graphify-sf 0.3.6 → 0.3.8

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/install.js CHANGED
@@ -1,8 +1,39 @@
1
1
  "use strict";
2
2
 
3
+ // postinstall hook.
4
+ //
5
+ // The graphify-sf npm package is a thin wrapper that fetches a prebuilt binary
6
+ // from the project's GitHub Releases. In locked-down corporate networks the
7
+ // download can be blocked by a proxy or firewall. A failed download here MUST
8
+ // NOT abort `npm install` for the whole dependency tree — graphify-sf is an
9
+ // optional second engine for its consumers, so a missing binary should degrade
10
+ // gracefully (the binary is fetched lazily on first run, and there are offline
11
+ // remediation paths).
12
+ //
13
+ // Therefore: never exit non-zero from postinstall. Print a clear, actionable
14
+ // warning and exit 0. The actual binary resolution happens later via
15
+ // download.ensureBinary() at first invocation.
16
+
3
17
  const { download } = require("./lib/download");
4
18
 
5
- download().catch((err) => {
6
- process.stderr.write(`graphify-sf postinstall failed: ${err.message}\n`);
7
- process.exit(1);
8
- });
19
+ download()
20
+ .then(() => {
21
+ process.exit(0);
22
+ })
23
+ .catch((err) => {
24
+ process.stderr.write(
25
+ `\ngraphify-sf: could not pre-fetch the CLI binary during install.\n` +
26
+ ` Reason: ${err.message}\n` +
27
+ `\n` +
28
+ ` This is non-fatal — installation will continue. The binary will be\n` +
29
+ ` fetched automatically the first time you run graphify-sf, provided\n` +
30
+ ` network access is available then.\n` +
31
+ `\n` +
32
+ ` If your network blocks GitHub Releases, use one of these instead:\n` +
33
+ ` • Install the Python package directly: pipx install graphify-sf\n` +
34
+ ` • Point at an existing binary: export GRAPHIFY_BIN=/path/to/graphify-sf\n` +
35
+ `\n`
36
+ );
37
+ // Non-fatal: do not break the consumer's `npm install`.
38
+ process.exit(0);
39
+ });
package/lib/download.js CHANGED
@@ -120,12 +120,34 @@ async function download() {
120
120
  process.stdout.write(`graphify-sf: installed to ${dest}\n`);
121
121
  }
122
122
 
123
+ // Resolve a user-supplied binary path from the GRAPHIFY_BIN environment
124
+ // variable. This is the highest-priority resolution and is the documented
125
+ // escape hatch for locked-down networks where the GitHub download is blocked.
126
+ // Returns the path if it points at an existing file, otherwise null.
127
+ function envBinary() {
128
+ const p = process.env.GRAPHIFY_BIN;
129
+ if (p && fs.existsSync(p)) {
130
+ return p;
131
+ }
132
+ return null;
133
+ }
134
+
123
135
  async function ensureBinary() {
136
+ // 1. Explicit override always wins.
137
+ const fromEnv = envBinary();
138
+ if (fromEnv) {
139
+ return fromEnv;
140
+ }
141
+
142
+ // 2. Already-downloaded binary in the package's bin/ dir.
124
143
  const dest = binaryPath();
125
- if (!fs.existsSync(dest)) {
126
- await download();
144
+ if (fs.existsSync(dest)) {
145
+ return dest;
127
146
  }
147
+
148
+ // 3. Lazily download on first use.
149
+ await download();
128
150
  return dest;
129
151
  }
130
152
 
131
- module.exports = { assetName, binaryPath, binDir, download, ensureBinary };
153
+ module.exports = { assetName, binaryPath, binDir, download, ensureBinary, envBinary };
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "graphify-sf",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Turn any Salesforce SFDX project into a queryable knowledge graph — no Python required.",
5
5
  "bin": {
6
6
  "graphify-sf": "bin/graphify-sf.js"
7
7
  },
8
8
  "main": "index.js",
9
9
  "scripts": {
10
- "postinstall": "node install.js"
10
+ "postinstall": "node install.js",
11
+ "test": "node --test"
11
12
  },
12
13
  "files": [
13
14
  "bin/",