@drift-labs/sdk 2.104.0-beta.3 → 2.104.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/VERSION +1 -1
- package/bun.lockb +0 -0
- package/lib/browser/isomorphic/grpc.d.ts +1 -1
- package/lib/node/isomorphic/grpc.d.ts +5 -1
- package/package.json +3 -1
- package/scripts/postbuild.js +63 -29
- package/lib/browser/isomorphic/grpc.node.d.ts +0 -5
- package/lib/node/isomorphic/grpc.browser.d.ts +0 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.104.0-beta.
|
|
1
|
+
2.104.0-beta.5
|
package/bun.lockb
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function createClient(..._args: any): void;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import Client from '@triton-one/yellowstone-grpc';
|
|
2
|
+
import { SubscribeRequest, SubscribeUpdate, CommitmentLevel } from '@triton-one/yellowstone-grpc';
|
|
3
|
+
import { ClientDuplexStream, ChannelOptions } from '@grpc/grpc-js';
|
|
4
|
+
export { ClientDuplexStream, ChannelOptions, SubscribeRequest, SubscribeUpdate, CommitmentLevel, Client, };
|
|
5
|
+
export declare function createClient(...args: ConstructorParameters<typeof Client>): Client;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drift-labs/sdk",
|
|
3
|
-
"version": "2.104.0-beta.
|
|
3
|
+
"version": "2.104.0-beta.5",
|
|
4
4
|
"main": "lib/node/index.js",
|
|
5
5
|
"types": "lib/node/index.d.ts",
|
|
6
6
|
"browser": "./lib/browser/index.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"lint": "eslint './**/*.{ts,tsx}' --quiet",
|
|
15
15
|
"build": "yarn clean && tsc -p tsconfig.json && tsc -p tsconfig.browser.json && node scripts/postbuild.js",
|
|
16
|
+
"build:browser": "yarn clean && tsc -p tsconfig.json && tsc -p tsconfig.browser.json && node scripts/postbuild.js --force-env browser",
|
|
16
17
|
"clean": "rm -rf lib",
|
|
17
18
|
"test": "mocha -r ts-node/register tests/**/*.ts",
|
|
18
19
|
"test:inspect": "mocha --inspect-brk -r ts-node/register tests/**/*.ts",
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
"strict-event-emitter-types": "^2.0.0",
|
|
56
57
|
"tweetnacl": "1.0.3",
|
|
57
58
|
"uuid": "^8.3.2",
|
|
59
|
+
"yargs": "^17.7.2",
|
|
58
60
|
"zstddec": "^0.1.0"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
package/scripts/postbuild.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
// scripts/postbuild.js
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const yargs = require('yargs/yargs');
|
|
5
|
+
const { hideBin } = require('yargs/helpers');
|
|
4
6
|
|
|
5
|
-
const
|
|
7
|
+
const forceEnv = yargs(hideBin(process.argv))
|
|
8
|
+
.option('force-env', {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Specify environment to force (node or browser)',
|
|
11
|
+
choices: ['node', 'browser']
|
|
12
|
+
})
|
|
13
|
+
.argv?.forceEnv;
|
|
6
14
|
|
|
15
|
+
const isomorphicPackages = ['grpc'];
|
|
7
16
|
const environments = ['node', 'browser'];
|
|
8
17
|
|
|
9
18
|
environments.forEach((environment) => {
|
|
@@ -11,50 +20,75 @@ environments.forEach((environment) => {
|
|
|
11
20
|
console.log(``);
|
|
12
21
|
|
|
13
22
|
isomorphicPackages.forEach((package) => {
|
|
14
|
-
const isomorphPath = path.join(
|
|
15
|
-
__dirname,
|
|
16
|
-
'..',
|
|
17
|
-
'lib',
|
|
18
|
-
environment,
|
|
19
|
-
'isomorphic',
|
|
20
|
-
package + '.js'
|
|
21
|
-
);
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
// We want to overwrite the base isomorphic files (the "target" files) with the concrete implementation code and definition files (the "source" files).
|
|
25
|
+
|
|
26
|
+
const isomorphicFolderPath = path.join(
|
|
24
27
|
__dirname,
|
|
25
28
|
'..',
|
|
26
29
|
'lib',
|
|
27
30
|
environment,
|
|
28
|
-
'isomorphic'
|
|
29
|
-
`${package}.${environment}.js`
|
|
31
|
+
'isomorphic'
|
|
30
32
|
);
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const targetEnv = forceEnv ? forceEnv : environment;
|
|
35
|
+
|
|
36
|
+
const filesToSwap = [
|
|
37
|
+
{
|
|
38
|
+
source: `${package}.${targetEnv}.js`,
|
|
39
|
+
target: `${package}.js`,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
source: `${package}.${targetEnv}.d.ts`,
|
|
43
|
+
target: `${package}.d.ts`,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
for (const file of filesToSwap) {
|
|
48
|
+
const sourcePath = path.join(
|
|
49
|
+
isomorphicFolderPath,
|
|
50
|
+
file.source
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const targetPath = path.join(
|
|
54
|
+
isomorphicFolderPath,
|
|
55
|
+
file.target
|
|
38
56
|
);
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const sourceContent = fs.readFileSync(sourcePath, 'utf8');
|
|
60
|
+
fs.writeFileSync(targetPath, sourceContent);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error(
|
|
63
|
+
`Error processing isomophic package : ${package} :: ${error.message}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
39
66
|
}
|
|
40
67
|
|
|
41
68
|
// Delete other environment files for safety
|
|
42
69
|
environments.forEach((otherEnvironment) => {
|
|
43
|
-
if (otherEnvironment ===
|
|
70
|
+
if (otherEnvironment === targetEnv) {
|
|
44
71
|
return;
|
|
45
72
|
}
|
|
46
73
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
const otherTargetFiles = [
|
|
75
|
+
`${package}.${otherEnvironment}.js`,
|
|
76
|
+
`${package}.${otherEnvironment}.d.ts`,
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
for (const otherTargetFile of otherTargetFiles) {
|
|
80
|
+
const otherTargetPath = path.join(
|
|
81
|
+
__dirname,
|
|
82
|
+
'..',
|
|
83
|
+
'lib',
|
|
84
|
+
environment,
|
|
85
|
+
'isomorphic',
|
|
86
|
+
otherTargetFile
|
|
87
|
+
);
|
|
55
88
|
|
|
56
|
-
|
|
57
|
-
|
|
89
|
+
if (fs.existsSync(otherTargetPath)) {
|
|
90
|
+
fs.unlinkSync(otherTargetPath);
|
|
91
|
+
}
|
|
58
92
|
}
|
|
59
93
|
});
|
|
60
94
|
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import Client from '@triton-one/yellowstone-grpc';
|
|
2
|
-
import { SubscribeRequest, SubscribeUpdate, CommitmentLevel } from '@triton-one/yellowstone-grpc';
|
|
3
|
-
import { ClientDuplexStream, ChannelOptions } from '@grpc/grpc-js';
|
|
4
|
-
export { ClientDuplexStream, ChannelOptions, SubscribeRequest, SubscribeUpdate, CommitmentLevel, Client, };
|
|
5
|
-
export declare function createClient(...args: ConstructorParameters<typeof Client>): Client;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createClient(..._args: any): void;
|