Tedious: Please update documents with the latest config schema

Created on 2 Feb 2019  路  5Comments  路  Source: tediousjs/tedious

This is the warning I get by using the examples in the repository.

tedious deprecated The "config.userName" property is deprecated and future tedious versions will no longer support it. Please switch to using the new "config.authentication" property instead. src/server/models/utilities/AzureSQL.js:36:25

Please update documents with the latest config schema that uses "config.authentication"

Most helpful comment

@pranaytanniru It's a bit of a shortcoming of the current documentation.

Here's an example config that makes use of the authentication property:

{
  "server": "localhost",
  "authentication": {
    "type": "default",
    "options": {
      "userName": "sa",
      "password": "yourStrong(!)Password",
    }
  },
  "options": {
    "port": 1433,
    "database": "master"
  }
}

All 5 comments

@yianni-ververis the document about new config options is updated in http://tediousjs.github.io/tedious/api-connection.html any feedback to make it better is deeply welcomed 馃檹

hey, there is no example regarding how a config object should look like.

@pranaytanniru It's a bit of a shortcoming of the current documentation.

Here's an example config that makes use of the authentication property:

{
  "server": "localhost",
  "authentication": {
    "type": "default",
    "options": {
      "userName": "sa",
      "password": "yourStrong(!)Password",
    }
  },
  "options": {
    "port": 1433,
    "database": "master"
  }
}

I didn't get any error message except login failed for user ''

I was using Typescript and it turns out that the @types/tedious definition was out of date and didn't include an interface definition for the authentication object. I've submitted a PR to the DefinitelyTyped project to resolve this.

For a full list of the connection configuration options, you can check out the constructor that sets the configuration object under tedious/src/connection.js.

E.g.,

const authentication = {
        type: 'default',
        options: {
          userName: ...,
          password: ...
        }
      };

const config = {
      server: config.server,
      authentication: authentication,
      options: {
        abortTransactionOnError: false,
        appName: undefined,
        camelCaseColumns: false,
        cancelTimeout: DEFAULT_CANCEL_TIMEOUT,
        columnNameReplacer: undefined,
        connectionRetryInterval: DEFAULT_CONNECT_RETRY_INTERVAL,
        connectTimeout: DEFAULT_CONNECT_TIMEOUT,
        connectionIsolationLevel: ISOLATION_LEVEL.READ_COMMITTED,
        cryptoCredentialsDetails: {},
        database: undefined,
        datefirst: DEFAULT_DATEFIRST,
        dateFormat: DEFAULT_DATEFORMAT,
        debug: {
          data: false,
          packet: false,
          payload: false,
          token: false
        },
        enableAnsiNull: true,
        enableAnsiNullDefault: true,
        enableAnsiPadding: true,
        enableAnsiWarnings: true,
        enableArithAbort: false,
        enableConcatNullYieldsNull: true,
        enableCursorCloseOnCommit: null,
        enableImplicitTransactions: false,
        enableNumericRoundabort: false,
        enableQuotedIdentifier: true,
        encrypt: false,
        fallbackToDefaultDb: false,
        instanceName: undefined,
        isolationLevel: ISOLATION_LEVEL.READ_COMMITTED,
        language: DEFAULT_LANGUAGE,
        localAddress: undefined,
        maxRetriesOnTransientErrors: 3,
        multiSubnetFailover: false,
        packetSize: DEFAULT_PACKET_SIZE,
        port: DEFAULT_PORT,
        readOnlyIntent: false,
        requestTimeout: DEFAULT_CLIENT_REQUEST_TIMEOUT,
        rowCollectionOnDone: false,
        rowCollectionOnRequestCompletion: false,
        tdsVersion: DEFAULT_TDS_VERSION,
        textsize: DEFAULT_TEXTSIZE,
        trustServerCertificate: true,
        useColumnNames: false,
        useUTC: true
      }
    };
Was this page helpful?
0 / 5 - 0 ratings