T-Invest Node SDK Node.js
On this page

SDK development

Use this page when changing the source code or preparing a release of @woodger/t-invest-node-sdk.

Prepare a release

The repository pins the T-Invest API contracts and documents how to generate TypeScript. Check the contract source before updating proto files and record user-facing changes in the changelog.

Change the package quota declaration

When the provider changes quotas, check the official limits. Update packageConfig.unaryLimits in src/config.ts, the SDK quota policy, and the related tests in one change.

Quotas can change independently of proto versions. When the limits were checked, the Dev Portal listed 300 CancelOrder requests per minute and the contract repository at tag 1.51 listed 100. Limits in the contract repository

In packageConfig, default sets a service quota, methods sets quotas for individual RPCs, and each groups entry sets a quota shared across methods. For example, both report RPCs use the same quota.

src/config.ts
OperationsService: {
  default: {
    maxRequests: 200,
    windowMs: 60_000
  },
  groups: {
    reports: {
      limit: {
        maxRequests: 5,
        windowMs: 60_000
      },
      methods: [
        'GetBrokerReport',
        'GetDividendsForeignIssuer'
      ]
    }
  }
}

PackageConfigDefinition from src/config.types.ts checks quota values, service names, and RPCs at compile time. The public defaultConfig.unaryLimits is a flat table.

maxRequests and windowMs must be finite positive numbers. Keys must be known service names or full paths of supported unary RPCs. The SDK merges defaults with instance overrides and validates the resulting quotas before creating the transport limiter middleware. See the SDK architecture for configuration order and module responsibilities.

Update the certificate

Certificate updates ship with a new SDK release. Use the official source and verification steps in the certificate reference. Bundled certificate

  1. Obtain the new file from the published official source.
  2. Check its purpose, Subject, Issuer, CA flag, validity period, and expected fingerprint.
  3. Compare it with the preceding X.509 certificate.
  4. Update the certificate file, the SDK certificate document, and the regression test in one change.
  5. Verify a local TLS call and confirm the package archive contains the certificate.
  6. Release a new SDK version that documents the certificate change.

Check the project architecture and policies

Before changing a command, the transport, or a public type, check what its module is responsible for and consult the project policies.