nomyo-js/package.json

74 lines
2.1 KiB
JSON
Raw Normal View History

2026-01-17 12:02:08 +01:00
{
"name": "nomyo-js",
feat: align timeout, error types and docs with the Python SDK Completes the parity work (step 4). Request timeout now defaults to 900 s, matching Python, instead of 60 s. Encrypted inference cannot stream, so an entire completion arrives in one response; a long generation on a busy backend legitimately takes minutes and was timing out here while succeeding in the Python client. Error types now distinguish malformed data from integrity failures. Python raises ValueError for a bad package, a non-200 or unparseable /pki/public_key, and plaintext that will not parse, reserving SecurityError for crypto failures. This port wrapped nearly all of it in SecurityError — so a server sending malformed JSON was reported as an authentication failure, pointing debugging in exactly the wrong direction. Malformed data is now a plain Error (the JS equivalent of ValueError), carried past the deliberately opaque catch-all by a symbol marker rather than a new exported class. Genuine crypto failures still report a single vague message so they cannot serve as a decryption oracle. Also adds the missing guard Python has: decrypting without a private key now says so, instead of failing later and being reported as an integrity failure. doc/attestation.md ports the Python attestation guide to the JS API, and documents the two deliberate divergences: no verify_ssl escape hatch, and jose injection instead of a runtime dynamic import. Version 0.1.0 -> 0.3.0 to match the Python client's feature level, now that the two are at parity. Not ported: Python's warning when secure_memory=True but the SecureMemory module is unavailable. There is no JS equivalent — zeroing is always available, and the weaker case (mlock unavailable) is already reported honestly by getProtectionInfo(). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 12:17:52 +02:00
"version": "0.3.0",
2026-01-17 12:02:08 +01:00
"description": "OpenAI-compatible secure chat client with end-to-end encryption",
"main": "dist/node/index.js",
fix: correct package entry points and publish contents Five packaging defects, all pre-existing: 1. dist/esm/index.js held ESM syntax while the package is not "type": "module", so Node classified it as CommonJS. It failed outright on Node 18 ("Unexpected token 'export'") and only worked on Node >= 22 because Node re-parses after guessing the module type, paying that cost on every import. Bundles now carry explicit extensions: .mjs for ES output, .cjs/.js for CommonJS. The browser build gained a real CommonJS output too — the exports map previously pointed the browser "require" condition at an ES module. The exports map now also leads with "types" and ends with a "default" fallback for resolvers matching neither "node" nor "browser". 2. files: ["native"] published the local build directory: a 94.6 kB Linux-x64 .node binary, a 148 kB object file and generated Makefiles. node-gyp-build checks build/Release before prebuilds, so every consumer on every platform would have found this machine's binary, skipped compiling, and failed to load it. It fails safe (native/ index.js catches and returns null), but the addon could never work for anyone else. Narrowed to the four source files. 3. binding.gyp resolves node-addon-api at build time, but nothing declared it: it was a devDependency of the root, absent from native/package.json. The build only succeeded here because a dev install populates the root node_modules. Declared as a dependency of the native package, where it is actually needed. 4. No clean step, so stale output shipped — the tarball carried both dist/types/core/** and a dist/types/src/** tree left over from before rootDir was set. build now runs clean first. 5. test:browser ran `karma start` with no karma.conf.js anywhere in the repo, and tests/browser is an empty directory. Removed the script and the karma devDependency rather than leave a script that cannot run. Verified: CommonJS require and ESM import both resolve on Node 18.19.1 and 24.18.0; TypeScript resolves types under both bundler and node16; npm pack now produces 35 files / 103.8 kB with no build artefacts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 12:39:09 +02:00
"browser": "dist/browser/index.mjs",
"module": "dist/esm/index.mjs",
2026-01-17 12:02:08 +01:00
"types": "dist/types/index.d.ts",
"exports": {
".": {
fix: correct package entry points and publish contents Five packaging defects, all pre-existing: 1. dist/esm/index.js held ESM syntax while the package is not "type": "module", so Node classified it as CommonJS. It failed outright on Node 18 ("Unexpected token 'export'") and only worked on Node >= 22 because Node re-parses after guessing the module type, paying that cost on every import. Bundles now carry explicit extensions: .mjs for ES output, .cjs/.js for CommonJS. The browser build gained a real CommonJS output too — the exports map previously pointed the browser "require" condition at an ES module. The exports map now also leads with "types" and ends with a "default" fallback for resolvers matching neither "node" nor "browser". 2. files: ["native"] published the local build directory: a 94.6 kB Linux-x64 .node binary, a 148 kB object file and generated Makefiles. node-gyp-build checks build/Release before prebuilds, so every consumer on every platform would have found this machine's binary, skipped compiling, and failed to load it. It fails safe (native/ index.js catches and returns null), but the addon could never work for anyone else. Narrowed to the four source files. 3. binding.gyp resolves node-addon-api at build time, but nothing declared it: it was a devDependency of the root, absent from native/package.json. The build only succeeded here because a dev install populates the root node_modules. Declared as a dependency of the native package, where it is actually needed. 4. No clean step, so stale output shipped — the tarball carried both dist/types/core/** and a dist/types/src/** tree left over from before rootDir was set. build now runs clean first. 5. test:browser ran `karma start` with no karma.conf.js anywhere in the repo, and tests/browser is an empty directory. Removed the script and the karma devDependency rather than leave a script that cannot run. Verified: CommonJS require and ESM import both resolve on Node 18.19.1 and 24.18.0; TypeScript resolves types under both bundler and node16; npm pack now produces 35 files / 103.8 kB with no build artefacts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 12:39:09 +02:00
"types": "./dist/types/index.d.ts",
2026-01-17 12:02:08 +01:00
"browser": {
fix: correct package entry points and publish contents Five packaging defects, all pre-existing: 1. dist/esm/index.js held ESM syntax while the package is not "type": "module", so Node classified it as CommonJS. It failed outright on Node 18 ("Unexpected token 'export'") and only worked on Node >= 22 because Node re-parses after guessing the module type, paying that cost on every import. Bundles now carry explicit extensions: .mjs for ES output, .cjs/.js for CommonJS. The browser build gained a real CommonJS output too — the exports map previously pointed the browser "require" condition at an ES module. The exports map now also leads with "types" and ends with a "default" fallback for resolvers matching neither "node" nor "browser". 2. files: ["native"] published the local build directory: a 94.6 kB Linux-x64 .node binary, a 148 kB object file and generated Makefiles. node-gyp-build checks build/Release before prebuilds, so every consumer on every platform would have found this machine's binary, skipped compiling, and failed to load it. It fails safe (native/ index.js catches and returns null), but the addon could never work for anyone else. Narrowed to the four source files. 3. binding.gyp resolves node-addon-api at build time, but nothing declared it: it was a devDependency of the root, absent from native/package.json. The build only succeeded here because a dev install populates the root node_modules. Declared as a dependency of the native package, where it is actually needed. 4. No clean step, so stale output shipped — the tarball carried both dist/types/core/** and a dist/types/src/** tree left over from before rootDir was set. build now runs clean first. 5. test:browser ran `karma start` with no karma.conf.js anywhere in the repo, and tests/browser is an empty directory. Removed the script and the karma devDependency rather than leave a script that cannot run. Verified: CommonJS require and ESM import both resolve on Node 18.19.1 and 24.18.0; TypeScript resolves types under both bundler and node16; npm pack now produces 35 files / 103.8 kB with no build artefacts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 12:39:09 +02:00
"import": "./dist/browser/index.mjs",
"require": "./dist/browser/index.cjs"
},
"node": {
"import": "./dist/esm/index.mjs",
"require": "./dist/node/index.js"
2026-01-17 12:02:08 +01:00
},
fix: correct package entry points and publish contents Five packaging defects, all pre-existing: 1. dist/esm/index.js held ESM syntax while the package is not "type": "module", so Node classified it as CommonJS. It failed outright on Node 18 ("Unexpected token 'export'") and only worked on Node >= 22 because Node re-parses after guessing the module type, paying that cost on every import. Bundles now carry explicit extensions: .mjs for ES output, .cjs/.js for CommonJS. The browser build gained a real CommonJS output too — the exports map previously pointed the browser "require" condition at an ES module. The exports map now also leads with "types" and ends with a "default" fallback for resolvers matching neither "node" nor "browser". 2. files: ["native"] published the local build directory: a 94.6 kB Linux-x64 .node binary, a 148 kB object file and generated Makefiles. node-gyp-build checks build/Release before prebuilds, so every consumer on every platform would have found this machine's binary, skipped compiling, and failed to load it. It fails safe (native/ index.js catches and returns null), but the addon could never work for anyone else. Narrowed to the four source files. 3. binding.gyp resolves node-addon-api at build time, but nothing declared it: it was a devDependency of the root, absent from native/package.json. The build only succeeded here because a dev install populates the root node_modules. Declared as a dependency of the native package, where it is actually needed. 4. No clean step, so stale output shipped — the tarball carried both dist/types/core/** and a dist/types/src/** tree left over from before rootDir was set. build now runs clean first. 5. test:browser ran `karma start` with no karma.conf.js anywhere in the repo, and tests/browser is an empty directory. Removed the script and the karma devDependency rather than leave a script that cannot run. Verified: CommonJS require and ESM import both resolve on Node 18.19.1 and 24.18.0; TypeScript resolves types under both bundler and node16; npm pack now produces 35 files / 103.8 kB with no build artefacts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 12:39:09 +02:00
"default": "./dist/browser/index.mjs"
2026-01-17 12:02:08 +01:00
}
},
"files": [
"dist",
fix: correct package entry points and publish contents Five packaging defects, all pre-existing: 1. dist/esm/index.js held ESM syntax while the package is not "type": "module", so Node classified it as CommonJS. It failed outright on Node 18 ("Unexpected token 'export'") and only worked on Node >= 22 because Node re-parses after guessing the module type, paying that cost on every import. Bundles now carry explicit extensions: .mjs for ES output, .cjs/.js for CommonJS. The browser build gained a real CommonJS output too — the exports map previously pointed the browser "require" condition at an ES module. The exports map now also leads with "types" and ends with a "default" fallback for resolvers matching neither "node" nor "browser". 2. files: ["native"] published the local build directory: a 94.6 kB Linux-x64 .node binary, a 148 kB object file and generated Makefiles. node-gyp-build checks build/Release before prebuilds, so every consumer on every platform would have found this machine's binary, skipped compiling, and failed to load it. It fails safe (native/ index.js catches and returns null), but the addon could never work for anyone else. Narrowed to the four source files. 3. binding.gyp resolves node-addon-api at build time, but nothing declared it: it was a devDependency of the root, absent from native/package.json. The build only succeeded here because a dev install populates the root node_modules. Declared as a dependency of the native package, where it is actually needed. 4. No clean step, so stale output shipped — the tarball carried both dist/types/core/** and a dist/types/src/** tree left over from before rootDir was set. build now runs clean first. 5. test:browser ran `karma start` with no karma.conf.js anywhere in the repo, and tests/browser is an empty directory. Removed the script and the karma devDependency rather than leave a script that cannot run. Verified: CommonJS require and ESM import both resolve on Node 18.19.1 and 24.18.0; TypeScript resolves types under both bundler and node16; npm pack now produces 35 files / 103.8 kB with no build artefacts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 12:39:09 +02:00
"native/binding.gyp",
"native/index.js",
"native/package.json",
"native/src",
2026-01-17 12:02:08 +01:00
"README.md",
"LICENSE"
],
"scripts": {
fix: correct package entry points and publish contents Five packaging defects, all pre-existing: 1. dist/esm/index.js held ESM syntax while the package is not "type": "module", so Node classified it as CommonJS. It failed outright on Node 18 ("Unexpected token 'export'") and only worked on Node >= 22 because Node re-parses after guessing the module type, paying that cost on every import. Bundles now carry explicit extensions: .mjs for ES output, .cjs/.js for CommonJS. The browser build gained a real CommonJS output too — the exports map previously pointed the browser "require" condition at an ES module. The exports map now also leads with "types" and ends with a "default" fallback for resolvers matching neither "node" nor "browser". 2. files: ["native"] published the local build directory: a 94.6 kB Linux-x64 .node binary, a 148 kB object file and generated Makefiles. node-gyp-build checks build/Release before prebuilds, so every consumer on every platform would have found this machine's binary, skipped compiling, and failed to load it. It fails safe (native/ index.js catches and returns null), but the addon could never work for anyone else. Narrowed to the four source files. 3. binding.gyp resolves node-addon-api at build time, but nothing declared it: it was a devDependency of the root, absent from native/package.json. The build only succeeded here because a dev install populates the root node_modules. Declared as a dependency of the native package, where it is actually needed. 4. No clean step, so stale output shipped — the tarball carried both dist/types/core/** and a dist/types/src/** tree left over from before rootDir was set. build now runs clean first. 5. test:browser ran `karma start` with no karma.conf.js anywhere in the repo, and tests/browser is an empty directory. Removed the script and the karma devDependency rather than leave a script that cannot run. Verified: CommonJS require and ESM import both resolve on Node 18.19.1 and 24.18.0; TypeScript resolves types under both bundler and node16; npm pack now produces 35 files / 103.8 kB with no build artefacts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 12:39:09 +02:00
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
"build": "npm run clean && npm run build:node && npm run build:browser && npm run build:types",
2026-01-17 12:02:08 +01:00
"build:node": "rollup -c --environment TARGET:node",
"build:browser": "rollup -c --environment TARGET:browser",
"build:types": "tsc --emitDeclarationOnly",
"test": "jest",
"prepublishOnly": "npm run build && npm test"
},
"keywords": [
"openai",
"encryption",
"secure",
"chat",
"e2e",
"privacy",
"nomyo"
],
"author": "",
"license": "Apache-2.0",
"engines": {
"node": ">=22.22.2"
},
2026-01-17 12:02:08 +01:00
"devDependencies": {
"@rollup/plugin-commonjs": "^29.0.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^12.0.0",
"@types/jest": "^30.0.0",
"@types/node": "^24.0.0",
"jest": "^30.0.0",
"node-addon-api": "^8.6.0",
2026-06-12 13:28:30 +00:00
"node-gyp": "^13.0.0",
"node-gyp-build": "^4.8.0",
"rollup": "^4.0.0",
"ts-jest": "^29.4.6",
fix: repair npm install and the rollup build Three independent breakages, all present on main before this branch: 1. `npm ci` always exited non-zero. The root package.json carried "install": "node-gyp-build", but binding.gyp lives in native/, so the script ran in a directory with nothing to build: gyp: binding.gyp not found (cwd: <repo root>) native/package.json already declares that same install script in the right place, alongside its binding.gyp and "gypfile": true, so the root copy was a duplicate in the wrong package. Removing it also clears the now-inaccurate hasInstallScript flag from the lockfile. `npm ci` exits 0 again; the addon still builds from native/. 2. `npm run build` failed at the first step. @rollup/plugin-typescript requires tslib as a peer, and nothing depended on it directly — it was only present transitively as an optional dev dep, so a clean install could omit it entirely. Declared explicitly. 3. rollup.config.js used ESM syntax while package.json has no "type": "module", so Node parsed it as CommonJS and threw "Cannot use import statement outside a module". Node 24 recovers by reparsing (with a warning); Node 18 fails outright. Renamed to rollup.config.mjs, which is unambiguous on both. Setting "type": "module" instead would have broken jest.config.js, which is CommonJS. Verified on Node 18.19.1 and Node 24.18.0: npm ci exits 0, npm run build produces all three bundles plus declarations, and 76/76 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 11:10:36 +02:00
"tslib": "^2.8.1",
"typescript": "^6.0.0"
2026-01-17 12:02:08 +01:00
},
"optionalDependencies": {
"nomyo-native": "file:./native"
}
}