diff --git a/generateProto.sh b/generateProto.sh index 3f0a3ae..8453076 100755 --- a/generateProto.sh +++ b/generateProto.sh @@ -12,7 +12,7 @@ mkdir ./src/generated/ chmod 755 ./src/generated -./node_modules/.bin/grpc_tools_node_protoc --plugin=protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./src/generated --ts_proto_opt=outputServices=generic-definitions,useExactTypes=false -I ./protos/ ./protos/*.proto +./node_modules/.bin/grpc_tools_node_protoc --plugin=protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=esModuleInterop=true --ts_proto_out=./src/generated --ts_proto_opt=outputServices=generic-definitions,useExactTypes=false -I ./protos/ ./protos/*.proto if [ $? -eq 0 ] then diff --git a/package-lock.json b/package-lock.json index 97acd57..82f905b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,10 +7,10 @@ "": { "name": "invest-nodejs-grpc-sdk", "version": "01.001.00", - "license": "ISC", + "license": "Apache-2.0", "dependencies": { "@grpc/grpc-js": "^1.5.10", - "long": "^5.2.0", + "long": "^4.0.0", "nice-grpc": "^1.1.0", "protobufjs": "^6.11.2" }, @@ -101,11 +101,6 @@ "node": ">=6" } }, - "node_modules/@grpc/proto-loader/node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, "node_modules/@humanwhocodes/config-array": { "version": "0.9.5", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", @@ -2013,9 +2008,9 @@ "dev": true }, "node_modules/long": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.0.tgz", - "integrity": "sha512-9RTUNjK60eJbx3uz+TEGF7fUr29ZDxR5QzXcyDpeSfeH28S9ycINflOgOlppit5U+4kNTe83KQnMEerw7GmE8w==" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" }, "node_modules/lowercase-keys": { "version": "1.0.1", @@ -2527,11 +2522,6 @@ "pbts": "bin/pbts" } }, - "node_modules/protobufjs/node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, "node_modules/pstree.remy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", @@ -3057,12 +3047,6 @@ "protobufjs": "^6.8.8" } }, - "node_modules/ts-proto-descriptors/node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", - "dev": true - }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -3420,13 +3404,6 @@ "long": "^4.0.0", "protobufjs": "^6.10.0", "yargs": "^16.2.0" - }, - "dependencies": { - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - } } }, "@humanwhocodes/config-array": { @@ -4867,9 +4844,9 @@ "dev": true }, "long": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.0.tgz", - "integrity": "sha512-9RTUNjK60eJbx3uz+TEGF7fUr29ZDxR5QzXcyDpeSfeH28S9ycINflOgOlppit5U+4kNTe83KQnMEerw7GmE8w==" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" }, "lowercase-keys": { "version": "1.0.1", @@ -5246,13 +5223,6 @@ "@types/long": "^4.0.1", "@types/node": ">=13.7.0", "long": "^4.0.0" - }, - "dependencies": { - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - } } }, "pstree.remy": { @@ -5621,14 +5591,6 @@ "requires": { "long": "^4.0.0", "protobufjs": "^6.8.8" - }, - "dependencies": { - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", - "dev": true - } } }, "tslib": { diff --git a/package.json b/package.json index 0f3c285..5fa2de8 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,14 @@ { "name": "invest-nodejs-grpc-sdk", - "version": "01.001.00", + "version": "01.002.00", "description": "", - "main": "test.ts", + "main": "dist/sdk.js", "scripts": { "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"", "lint": "eslint \"src/**/{*.ts,*.tsx}\"", "start": "tsc && node dist/index.js", - "dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/test.ts" + "dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/test.ts", + "build": "rm -rf ./dist && npx tsc" }, "keywords": [ "trading", @@ -19,7 +20,7 @@ "license": "Apache-2.0", "dependencies": { "@grpc/grpc-js": "^1.5.10", - "long": "^5.2.0", + "long": "^4.0.0", "nice-grpc": "^1.1.0", "protobufjs": "^6.11.2" }, diff --git a/src/generated/common.ts b/src/generated/common.ts index 86d0a07..7b5e7c9 100644 --- a/src/generated/common.ts +++ b/src/generated/common.ts @@ -1,6 +1,5 @@ /* eslint-disable */ -//@ts-ignore -import * as Long from 'long'; +import Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; @@ -396,8 +395,6 @@ function longToNumber(long: Long): number { return long.toNumber(); } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); diff --git a/src/generated/google/protobuf/timestamp.ts b/src/generated/google/protobuf/timestamp.ts index 40fb5e6..f13e8c8 100644 --- a/src/generated/google/protobuf/timestamp.ts +++ b/src/generated/google/protobuf/timestamp.ts @@ -1,6 +1,5 @@ /* eslint-disable */ -//@ts-ignore -import * as Long from 'long'; +import Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -202,8 +201,6 @@ function longToNumber(long: Long): number { return long.toNumber(); } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); diff --git a/src/generated/instruments.ts b/src/generated/instruments.ts index 5844a22..5b45541 100644 --- a/src/generated/instruments.ts +++ b/src/generated/instruments.ts @@ -1,6 +1,5 @@ /* eslint-disable */ -//@ts-ignore -import * as Long from 'long'; +import Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { SecurityTradingStatus, @@ -7721,8 +7720,6 @@ function longToNumber(long: Long): number { return long.toNumber(); } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); diff --git a/src/generated/marketdata.ts b/src/generated/marketdata.ts index b9cd475..e66bf79 100644 --- a/src/generated/marketdata.ts +++ b/src/generated/marketdata.ts @@ -1,6 +1,5 @@ /* eslint-disable */ -//@ts-ignore -import * as Long from 'long'; +import Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { SecurityTradingStatus, @@ -3714,8 +3713,6 @@ function longToNumber(long: Long): number { return long.toNumber(); } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); diff --git a/src/generated/operations.ts b/src/generated/operations.ts index 29af279..8da82d0 100644 --- a/src/generated/operations.ts +++ b/src/generated/operations.ts @@ -1,6 +1,5 @@ /* eslint-disable */ -//@ts-ignore -import * as Long from 'long'; +import Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; import { MoneyValue, Quotation } from './common'; @@ -3386,8 +3385,6 @@ function longToNumber(long: Long): number { return long.toNumber(); } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); diff --git a/src/generated/orders.ts b/src/generated/orders.ts index fadfce1..f726d5e 100644 --- a/src/generated/orders.ts +++ b/src/generated/orders.ts @@ -1,6 +1,5 @@ /* eslint-disable */ -//@ts-ignore -import * as Long from 'long'; +import Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; import { Ping, Quotation, MoneyValue } from './common'; @@ -1660,8 +1659,6 @@ function longToNumber(long: Long): number { return long.toNumber(); } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); diff --git a/src/generated/sandbox.ts b/src/generated/sandbox.ts index 1328774..7b134e7 100644 --- a/src/generated/sandbox.ts +++ b/src/generated/sandbox.ts @@ -1,6 +1,5 @@ /* eslint-disable */ -//@ts-ignore -import * as Long from 'long'; +import Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { MoneyValue } from './common'; import { GetAccountsRequest, GetAccountsResponse } from './users'; @@ -461,8 +460,6 @@ export type DeepPartial = T extends Builtin ? { [K in keyof T]?: DeepPartial } : Partial; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); diff --git a/src/generated/stoporders.ts b/src/generated/stoporders.ts index 0e5eca8..999a427 100644 --- a/src/generated/stoporders.ts +++ b/src/generated/stoporders.ts @@ -1,6 +1,5 @@ /* eslint-disable */ -//@ts-ignore -import * as Long from 'long'; +import Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; import { Quotation, MoneyValue } from './common'; @@ -859,8 +858,6 @@ function longToNumber(long: Long): number { return long.toNumber(); } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); diff --git a/src/generated/users.ts b/src/generated/users.ts index 1c8dbfa..ccbc8e2 100644 --- a/src/generated/users.ts +++ b/src/generated/users.ts @@ -1,6 +1,5 @@ /* eslint-disable */ -//@ts-ignore -import * as Long from 'long'; +import Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; import { MoneyValue, Quotation } from './common'; @@ -1039,8 +1038,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); diff --git a/tsconfig.json b/tsconfig.json index e175a07..c48af94 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,8 @@ "outDir": "./dist", "baseUrl": "./", "incremental": true, - "strict": true + "strict": true, + "esModuleInterop": true, }, "include": ["src/**/*.ts"], "exclude": ["node_modules"]