@science-corporation/synapse 2.2.9 → 2.3.1

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 CHANGED
@@ -1,70 +1,70 @@
1
- {
2
- "name": "@science-corporation/synapse",
3
- "version": "2.2.9",
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.1",
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
+ }
@@ -39,15 +39,49 @@ fi
39
39
  # Else, fallback to downloading from github
40
40
  echo "Downloading synapse-api..."
41
41
 
42
+ # Resolve which synapse-typescript ref to ask the GitHub API about, in order
43
+ # of decreasing fidelity:
44
+ # 1. git HEAD when there's a real working tree (most accurate).
45
+ # 2. The SHA in $npm_package_resolved — npm exports this during install
46
+ # lifecycle scripts as `git+ssh://...#<sha>`. This is the one that
47
+ # makes `npm install git://...#<sha>` actually work, since during
48
+ # pacote's prepare phase the .git dir has been moved away and the
49
+ # package.json gitHead field has not yet been injected.
50
+ # 3. package.json#gitHead — npm writes this after prepare completes, so
51
+ # it's available for downstream consumers reading an already-installed
52
+ # package, just not during the prepare phase itself.
53
+ # 4. v$version tag, as a last resort for vanilla tarball installs after a
54
+ # release has tagged the version.
55
+ REF_LIB=""
42
56
  if [ "$HAS_GIT" = true ]; then
43
57
  REF_LIB=$(git rev-parse HEAD)
44
- else
45
- REF_LIB=$(node -p "require('./package.json').version")
46
- if [ -z "$REF_LIB" ]; then
58
+ fi
59
+
60
+ if [ -z "$REF_LIB" ] && [ -n "$npm_package_resolved" ]; then
61
+ # Strip everything up to and including the last '#' to get the SHA.
62
+ CANDIDATE="${npm_package_resolved##*#}"
63
+ # Only accept if it looks like a SHA (40 hex chars). Anything else is
64
+ # probably a URL with no fragment, which would leave the var untouched.
65
+ if [ "${#CANDIDATE}" = 40 ] && [ -z "${CANDIDATE//[0-9a-f]/}" ]; then
66
+ REF_LIB="$CANDIDATE"
67
+ echo " - Using npm_package_resolved SHA for ref lookup"
68
+ fi
69
+ fi
70
+
71
+ if [ -z "$REF_LIB" ]; then
72
+ REF_LIB=$(node -e "const p=require('./package.json'); if (p.gitHead) process.stdout.write(p.gitHead);" 2>/dev/null)
73
+ if [ -n "$REF_LIB" ]; then
74
+ echo " - Using package.json gitHead for ref lookup"
75
+ fi
76
+ fi
77
+
78
+ if [ -z "$REF_LIB" ]; then
79
+ PKG_VERSION=$(node -p "require('./package.json').version")
80
+ if [ -z "$PKG_VERSION" ]; then
47
81
  echo " - Failed to get version from package.json"
48
82
  exit 1
49
83
  fi
50
- REF_LIB=v$REF_LIB
84
+ REF_LIB=v$PKG_VERSION
51
85
  fi
52
86
 
53
87
  echo "- Looking up synapse-api ref for synapse-typescript ref $REF_LIB"