@science-corporation/synapse 2.3.1 → 2.3.2
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/package.json +70 -70
- package/scripts/generate.sh +10 -0
- package/src/api_version.ts +2 -0
- package/src/browser.ts +2 -0
- package/src/index.ts +2 -0
- package/src/utils/version.ts +12 -0
- package/synapse-api/README.md +1 -1
- package/synapse-api/VERSION +1 -0
- package/synapse-api/api/query.proto +1 -0
package/package.json
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@science-corporation/synapse",
|
|
3
|
-
"version": "2.3.
|
|
4
|
-
"description": "Client library and CLI for the Synapse API",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"default": "./dist/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./browser": {
|
|
14
|
-
"types": "./dist/browser.d.ts",
|
|
15
|
-
"default": "./dist/browser.js"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"dist",
|
|
20
|
-
"scripts",
|
|
21
|
-
"src",
|
|
22
|
-
"synapse-api"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "bash ./scripts/build.sh",
|
|
26
|
-
"clean": "rimraf dist src/api",
|
|
27
|
-
"dist": "npm run generate && npm run build",
|
|
28
|
-
"generate": "bash ./scripts/generate.sh",
|
|
29
|
-
"lint": "tsc --noEmit && eslint .",
|
|
30
|
-
"postinstall": "bash ./scripts/postinstall.sh && npm run dist",
|
|
31
|
-
"test": "tsc --noEmit && jest"
|
|
32
|
-
},
|
|
33
|
-
"repository": {
|
|
34
|
-
"type": "git",
|
|
35
|
-
"url": "git+https://github.com/sciencecorp/synapse-typescript.git"
|
|
36
|
-
},
|
|
37
|
-
"author": {
|
|
38
|
-
"name": "Science Corporation",
|
|
39
|
-
"email": "team@science.xyz"
|
|
40
|
-
},
|
|
41
|
-
"bugs": {
|
|
42
|
-
"url": "https://github.com/sciencecorp/synapse-typescript/issues"
|
|
43
|
-
},
|
|
44
|
-
"homepage": "https://github.com/sciencecorp/synapse-typescript#readme",
|
|
45
|
-
"engines": {
|
|
46
|
-
"node": ">=18"
|
|
47
|
-
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@eslint/compat": "^1.2.6",
|
|
50
|
-
"@types/jest": "^29.5.14",
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "^8.23.0",
|
|
52
|
-
"@typescript-eslint/parser": "^8.23.0",
|
|
53
|
-
"eslint": "^9.5.0",
|
|
54
|
-
"eslint-import-resolver-typescript": "^3.7.0",
|
|
55
|
-
"eslint-plugin-import": "^2.31.0",
|
|
56
|
-
"jest": "^29.7.0",
|
|
57
|
-
"rimraf": "^5.0.5",
|
|
58
|
-
"ts-jest": "^29.2.5",
|
|
59
|
-
"typescript": "^5.5.2"
|
|
60
|
-
},
|
|
61
|
-
"dependencies": {
|
|
62
|
-
"@grpc/grpc-js": "^1.10.10",
|
|
63
|
-
"@grpc/proto-loader": "^0.7.13",
|
|
64
|
-
"google-protobuf": "^3.21.2",
|
|
65
|
-
"long": "^5.3.1",
|
|
66
|
-
"protobufjs-cli": "^1.1.3",
|
|
67
|
-
"tmp": "^0.2.5",
|
|
68
|
-
"yargs": "^17.7.2"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@science-corporation/synapse",
|
|
3
|
+
"version": "2.3.2",
|
|
4
|
+
"description": "Client library and CLI for the Synapse API",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./browser": {
|
|
14
|
+
"types": "./dist/browser.d.ts",
|
|
15
|
+
"default": "./dist/browser.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"scripts",
|
|
21
|
+
"src",
|
|
22
|
+
"synapse-api"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "bash ./scripts/build.sh",
|
|
26
|
+
"clean": "rimraf dist src/api",
|
|
27
|
+
"dist": "npm run generate && npm run build",
|
|
28
|
+
"generate": "bash ./scripts/generate.sh",
|
|
29
|
+
"lint": "tsc --noEmit && eslint .",
|
|
30
|
+
"postinstall": "bash ./scripts/postinstall.sh && npm run dist",
|
|
31
|
+
"test": "tsc --noEmit && jest"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/sciencecorp/synapse-typescript.git"
|
|
36
|
+
},
|
|
37
|
+
"author": {
|
|
38
|
+
"name": "Science Corporation",
|
|
39
|
+
"email": "team@science.xyz"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/sciencecorp/synapse-typescript/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/sciencecorp/synapse-typescript#readme",
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@eslint/compat": "^1.2.6",
|
|
50
|
+
"@types/jest": "^29.5.14",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^8.23.0",
|
|
52
|
+
"@typescript-eslint/parser": "^8.23.0",
|
|
53
|
+
"eslint": "^9.5.0",
|
|
54
|
+
"eslint-import-resolver-typescript": "^3.7.0",
|
|
55
|
+
"eslint-plugin-import": "^2.31.0",
|
|
56
|
+
"jest": "^29.7.0",
|
|
57
|
+
"rimraf": "^5.0.5",
|
|
58
|
+
"ts-jest": "^29.2.5",
|
|
59
|
+
"typescript": "^5.5.2"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@grpc/grpc-js": "^1.10.10",
|
|
63
|
+
"@grpc/proto-loader": "^0.7.13",
|
|
64
|
+
"google-protobuf": "^3.21.2",
|
|
65
|
+
"long": "^5.3.1",
|
|
66
|
+
"protobufjs-cli": "^1.1.3",
|
|
67
|
+
"tmp": "^0.2.5",
|
|
68
|
+
"yargs": "^17.7.2"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/scripts/generate.sh
CHANGED
|
@@ -5,6 +5,16 @@ PROTOS=$(find ${PROTO_DIR} -name '*.proto' | sed "s|${PROTO_DIR}/||")
|
|
|
5
5
|
|
|
6
6
|
mkdir -p ${PROTO_OUT_DIR}
|
|
7
7
|
|
|
8
|
+
# Mirror synapse-api/VERSION into src/api_version.ts so the protocol
|
|
9
|
+
# version is available as a constant in both node and browser builds.
|
|
10
|
+
if [ -f "${PROTO_DIR}/VERSION" ]; then
|
|
11
|
+
SYNAPSE_API_VERSION=$(tr -d '[:space:]' < ${PROTO_DIR}/VERSION)
|
|
12
|
+
cat > ./src/api_version.ts <<EOF
|
|
13
|
+
// Generated from synapse-api/VERSION by scripts/generate.sh. Do not edit.
|
|
14
|
+
export const SYNAPSE_API_VERSION = "${SYNAPSE_API_VERSION}";
|
|
15
|
+
EOF
|
|
16
|
+
fi
|
|
17
|
+
|
|
8
18
|
pbjs \
|
|
9
19
|
-t json \
|
|
10
20
|
-w es6 \
|
package/src/browser.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// Browser-safe exports (types and enums only)
|
|
2
2
|
export type { CallOptions } from "./utils/client";
|
|
3
3
|
export { IStatus, Status, StatusCode } from "./utils/status";
|
|
4
|
+
export { SYNAPSE_API_VERSION } from "./api_version";
|
|
5
|
+
export { decodeSynapseVersion } from "./utils/version";
|
|
4
6
|
export * from "./api/api";
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,8 @@ export { default as Config } from "./config";
|
|
|
2
2
|
export { default as Device } from "./device";
|
|
3
3
|
export * from "./nodes";
|
|
4
4
|
export { IStatus, Status, StatusCode } from "./utils/status";
|
|
5
|
+
export { SYNAPSE_API_VERSION } from "./api_version";
|
|
6
|
+
export { decodeSynapseVersion } from "./utils/version";
|
|
5
7
|
|
|
6
8
|
export type { CallOptions } from "./utils/client";
|
|
7
9
|
export * from "./api/api";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Decode a Synapse API version uint32 into a "major.minor.patch" string.
|
|
2
|
+
//
|
|
3
|
+
// Encoding (see synapse-api device.proto, DeviceInfo.synapse_version):
|
|
4
|
+
// bits [31:24] major (0-255)
|
|
5
|
+
// bits [23:16] minor (0-255)
|
|
6
|
+
// bits [15:0] patch (0-65535)
|
|
7
|
+
export function decodeSynapseVersion(v: number): string {
|
|
8
|
+
const major = (v >>> 24) & 0xff;
|
|
9
|
+
const minor = (v >>> 16) & 0xff;
|
|
10
|
+
const patch = v & 0xffff;
|
|
11
|
+
return `${major}.${minor}.${patch}`;
|
|
12
|
+
}
|
package/synapse-api/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.4.1
|