@neosmart/ssclient 2.0.0 → 2.0.1-beta.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/bin/ssclient.wasm CHANGED
Binary file
package/install.js CHANGED
@@ -28,17 +28,18 @@ const __dirname = dirname(__filename);
28
28
  * @property {Record<string, string | string[] | BuildEntry>} precompiled - Mapping of os-arch to builds
29
29
  */
30
30
 
31
+ const BIN_NAME = "ssclient";
32
+ const VERSION = pkg.version.replace(/[+-].*/, "");
31
33
  const MANIFEST_URLS = [
32
34
  `${__dirname}/manifest.json`,
33
35
  `https://raw.githubusercontent.com/neosmart/securestore-rs/refs/heads/master/ssclient/npm/manifests/v${pkg.version}.json`,
34
- `https://neosmart.net/SecureStore/ssclient/npm/manifests/v${pkg.version}.json`,
35
- `https://raw.githubusercontent.com/neosmart/securestore-rs/refs/tags/ssclient/${pkg.version}/ssclient/npm/manifests/v${pkg.version}.json`,
36
+ `https://raw.githubusercontent.com/neosmart/securestore-rs/refs/heads/master/ssclient/npm/manifests/v${VERSION}.json`,
37
+ `https://neosmart.net/SecureStore/ssclient/npm/manifests/v${VERSION}.json`,
38
+ `https://raw.githubusercontent.com/neosmart/securestore-rs/refs/tags/${BIN_NAME}/${VERSION}/ssclient/npm/manifests/v${VERSION}.json`,
36
39
  ];
37
- const BIN_NAME = "ssclient";
38
40
  const PKG_ROOT = __dirname;
39
41
  const FALLBACK_JS = join(PKG_ROOT, "ssclient.js");
40
42
  const BASE_BIN_DIR = join(PKG_ROOT, "bin");
41
- const VERSION = pkg.version;
42
43
  const VERSIONED_DIR = join(BASE_BIN_DIR, `v${VERSION}`);
43
44
  const ENTRY_POINT = join(__dirname, pkg.bin[BIN_NAME]);
44
45
 
@@ -198,8 +199,10 @@ async function linkBinary(target, linkPath) {
198
199
  // Don't check if it exists first because we need to also remove broken symlinks
199
200
  await unlink(linkPath);
200
201
  } catch (err) {
201
- console.error(`Failed to remove existing binary: ${err}`);
202
- throw err;
202
+ if (existsSync(linkPath)) {
203
+ console.error(`Failed to remove existing binary: ${err}`);
204
+ throw err;
205
+ }
203
206
  }
204
207
 
205
208
  const rel = relative(dirname(linkPath), target);
@@ -246,6 +249,9 @@ async function resolve(pathOrUrl, result) {
246
249
  if (!response.ok) {
247
250
  throw new Error(`HTTP Error: ${response.status} ${response.statusText}`);
248
251
  }
252
+ if (/html/i.test(response.headers.get("content-type") ?? "")) {
253
+ throw new Error("Unexpected HTML in response!");
254
+ }
249
255
  return result === "text" ? await response.text() : await response.json();
250
256
  } else if (existsSync(pathOrUrl)) {
251
257
  const text = await readFile(pathOrUrl, { encoding: "utf8" });
@@ -264,8 +270,14 @@ async function main() {
264
270
 
265
271
  /** @type {Manifest} */
266
272
  const manifest = await (async () => {
273
+ /** @type {string | undefined} */
274
+ let last;
267
275
  for (const url of MANIFEST_URLS) {
276
+ if (url === last) {
277
+ continue;
278
+ }
268
279
  try {
280
+ last = url;
269
281
  const manifest = await resolve(url, "json");
270
282
  return manifest;
271
283
  } catch {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neosmart/ssclient",
3
3
  "description": "SecureStore cli client, cross-platform and sandboxed",
4
- "version": "2.0.0",
4
+ "version": "2.0.1-beta.1",
5
5
  "keywords": [
6
6
  "SecureStore",
7
7
  "encryption",
@@ -30,20 +30,16 @@
30
30
  "./build.js",
31
31
  "./install.js",
32
32
  "./ssclient.js",
33
- "./tsconfig.js"
33
+ "./tsconfig.json"
34
34
  ],
35
35
  "type": "module",
36
36
  "scripts": {
37
- "prepublishOnly": "npm run lint && npm run build",
38
- "prepare": "echo 'This placeholder file will be overridden by our install scripts' > bin/ssclient.cmd",
37
+ "prepack": "npm run lint && npm run build && echo 'This placeholder file will be overridden by our install scripts' > bin/ssclient.cmd",
39
38
  "install": "node ./install.js",
40
39
  "ssclient": "node ./ssclient.js",
41
40
  "build": "node ./build.js",
42
41
  "lint": "tsc"
43
42
  },
44
- "devDependecies": [
45
- "@types/node"
46
- ],
47
43
  "devDependencies": {
48
44
  "@types/node": "^22.0.0",
49
45
  "typescript": "^6.0.2"
package/tsconfig.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [ "ES2022", "dom" ],
4
+ "types": [ "node" ],
5
+ "target": "ES2022",
6
+ "module": "Preserve",
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+ "checkJs": true,
11
+ "noEmit": true,
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": true,
14
+ "strict": true,
15
+ "noImplicitAny": true,
16
+ "strictNullChecks": true,
17
+ "skipLibCheck": true,
18
+ "forceConsistentCasingInFileNames": true,
19
+ "resolveJsonModule": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noUncheckedIndexedAccess": true,
22
+ "noImplicitOverride": true,
23
+ "noUnusedLocals": true,
24
+ "noUnusedParameters": true,
25
+ "noPropertyAccessFromIndexSignature": true
26
+ },
27
+ "exclude": [
28
+ "node_modules"
29
+ ]
30
+ }