primitive-admin 1.2.0-alpha.5 → 1.2.0-alpha.7

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.
Files changed (47) hide show
  1. package/README.md +1 -1
  2. package/dist/src/commands/apps-children.d.ts +1 -1
  3. package/dist/src/commands/apps-children.js +170 -28
  4. package/dist/src/commands/apps-children.js.map +1 -1
  5. package/dist/src/commands/auth.js +41 -6
  6. package/dist/src/commands/auth.js.map +1 -1
  7. package/dist/src/commands/config.js +43 -4
  8. package/dist/src/commands/config.js.map +1 -1
  9. package/dist/src/commands/databases.js +130 -53
  10. package/dist/src/commands/databases.js.map +1 -1
  11. package/dist/src/commands/init.d.ts +7 -0
  12. package/dist/src/commands/init.js +9 -1
  13. package/dist/src/commands/init.js.map +1 -1
  14. package/dist/src/commands/sync.d.ts +118 -6
  15. package/dist/src/commands/sync.js +594 -55
  16. package/dist/src/commands/sync.js.map +1 -1
  17. package/dist/src/lib/child-apps-local.d.ts +45 -21
  18. package/dist/src/lib/child-apps-local.js +68 -30
  19. package/dist/src/lib/child-apps-local.js.map +1 -1
  20. package/dist/src/lib/credentials-store.d.ts +38 -3
  21. package/dist/src/lib/credentials-store.js +175 -9
  22. package/dist/src/lib/credentials-store.js.map +1 -1
  23. package/dist/src/lib/function-collect.d.ts +1 -1
  24. package/dist/src/lib/function-collect.js +4 -0
  25. package/dist/src/lib/function-collect.js.map +1 -1
  26. package/dist/src/lib/generated-config-surfaces.d.ts +148 -0
  27. package/dist/src/lib/generated-config-surfaces.js +208 -25
  28. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  29. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  30. package/dist/src/lib/generated-sdk-types.js +1 -1
  31. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  32. package/dist/src/lib/local-state.d.ts +21 -6
  33. package/dist/src/lib/local-state.js +78 -34
  34. package/dist/src/lib/local-state.js.map +1 -1
  35. package/dist/src/lib/push-failure-report.d.ts +45 -0
  36. package/dist/src/lib/push-failure-report.js +57 -0
  37. package/dist/src/lib/push-failure-report.js.map +1 -0
  38. package/dist/src/lib/sync-selectors.d.ts +5 -1
  39. package/dist/src/lib/sync-selectors.js +23 -13
  40. package/dist/src/lib/sync-selectors.js.map +1 -1
  41. package/dist/src/lib/transient-retry.d.ts +9 -0
  42. package/dist/src/lib/transient-retry.js +37 -0
  43. package/dist/src/lib/transient-retry.js.map +1 -1
  44. package/dist/src/lib/vars-override.d.ts +105 -0
  45. package/dist/src/lib/vars-override.js +143 -0
  46. package/dist/src/lib/vars-override.js.map +1 -0
  47. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"generated-sdk-types.js","sourceRoot":"","sources":["../../../src/lib/generated-sdk-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,4j6HAA4j6H,CAAC"}
1
+ {"version":3,"file":"generated-sdk-types.js","sourceRoot":"","sources":["../../../src/lib/generated-sdk-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,u7gIAAu7gI,CAAC"}
@@ -55,17 +55,32 @@ export interface IgnoreCoverageOutcome {
55
55
  /** Why, for `failed`. */
56
56
  detail?: string;
57
57
  }
58
+ /**
59
+ * Makes sure the machine-local file at `path` is git-ignored before it is
60
+ * written, and confirms it.
61
+ *
62
+ * When the file is not already covered an anchored pattern is appended to the
63
+ * repository's exclude file, resolved via `git rev-parse --git-path
64
+ * info/exclude` so a linked worktree (where `.git` is a FILE) works, and
65
+ * anchored relative to `git rev-parse --show-toplevel` so a project root
66
+ * nested below the worktree root is not mis-rooted. `reason` names the command
67
+ * in the comment written beside the pattern.
68
+ *
69
+ * Coverage is confirmed, not assumed (#4485): a destination git already
70
+ * tracks is a failure, and so is one `git check-ignore` still reports as not
71
+ * ignored once the pattern is in place — a committed `.gitignore` negation
72
+ * outranks `info/exclude`. Git runs from the nearest existing directory above
73
+ * the destination, and no directory is created.
74
+ */
75
+ export declare function ensureFileIgnored(path: string, options: {
76
+ reason: string;
77
+ }): IgnoreCoverageOutcome;
58
78
  /**
59
79
  * Makes sure `.primitive/local.json` is ignored before it is written.
60
80
  *
61
81
  * Templates scaffolded from now on carry the entry in their `.gitignore`, but
62
82
  * projects created before this change do not — and `env use` writing an
63
83
  * untracked-but-committable file would be exactly the "switching backends
64
- * dirties the repo" problem this replaced. When the file is not already
65
- * covered we append an anchored pattern to the repository's exclude file,
66
- * resolved via `git rev-parse --git-path info/exclude` so a linked worktree
67
- * (where `.git` is a FILE) works, and anchored relative to
68
- * `git rev-parse --show-toplevel` so a project root nested below the worktree
69
- * root is not mis-rooted.
84
+ * dirties the repo" problem this replaced. See {@link ensureFileIgnored}.
70
85
  */
71
86
  export declare function ensureLocalStateIgnored(localStatePath: string): IgnoreCoverageOutcome;
@@ -176,71 +176,115 @@ function git(cwd, args) {
176
176
  function escapeGitignorePattern(relPath) {
177
177
  return relPath.replace(/[\\*?[\]]/g, (c) => "\\" + c).replace(/^([#!])/, "\\$1");
178
178
  }
179
+ /** The nearest directory at or above `path` that exists. */
180
+ function nearestExistingDir(path) {
181
+ let dir = dirname(path);
182
+ while (!existsSync(dir)) {
183
+ const parent = dirname(dir);
184
+ if (parent === dir)
185
+ break;
186
+ dir = parent;
187
+ }
188
+ return dir;
189
+ }
190
+ /** Whether git reports `path` as ignored, run from `cwd`. */
191
+ function isGitIgnored(cwd, path) {
192
+ try {
193
+ execFileSync("git", ["check-ignore", "-q", "--", path], { cwd, stdio: "ignore" });
194
+ return true;
195
+ }
196
+ catch {
197
+ // Exit 1 means "not ignored".
198
+ return false;
199
+ }
200
+ }
201
+ /** Whether git tracks `path`, run from `cwd`. */
202
+ function isGitTracked(cwd, path) {
203
+ try {
204
+ execFileSync("git", ["ls-files", "--error-unmatch", "--", path], { cwd, stdio: "ignore" });
205
+ return true;
206
+ }
207
+ catch {
208
+ return false;
209
+ }
210
+ }
179
211
  /**
180
- * Makes sure `.primitive/local.json` is ignored before it is written.
212
+ * Makes sure the machine-local file at `path` is git-ignored before it is
213
+ * written, and confirms it.
181
214
  *
182
- * Templates scaffolded from now on carry the entry in their `.gitignore`, but
183
- * projects created before this change do not — and `env use` writing an
184
- * untracked-but-committable file would be exactly the "switching backends
185
- * dirties the repo" problem this replaced. When the file is not already
186
- * covered we append an anchored pattern to the repository's exclude file,
187
- * resolved via `git rev-parse --git-path info/exclude` so a linked worktree
188
- * (where `.git` is a FILE) works, and anchored relative to
189
- * `git rev-parse --show-toplevel` so a project root nested below the worktree
190
- * root is not mis-rooted.
215
+ * When the file is not already covered an anchored pattern is appended to the
216
+ * repository's exclude file, resolved via `git rev-parse --git-path
217
+ * info/exclude` so a linked worktree (where `.git` is a FILE) works, and
218
+ * anchored relative to `git rev-parse --show-toplevel` so a project root
219
+ * nested below the worktree root is not mis-rooted. `reason` names the command
220
+ * in the comment written beside the pattern.
221
+ *
222
+ * Coverage is confirmed, not assumed (#4485): a destination git already
223
+ * tracks is a failure, and so is one `git check-ignore` still reports as not
224
+ * ignored once the pattern is in place — a committed `.gitignore` negation
225
+ * outranks `info/exclude`. Git runs from the nearest existing directory above
226
+ * the destination, and no directory is created.
191
227
  */
192
- export function ensureLocalStateIgnored(localStatePath) {
193
- const dir = dirname(localStatePath);
194
- if (!existsSync(dir))
195
- mkdirSync(dir, { recursive: true });
228
+ export function ensureFileIgnored(path, options) {
229
+ const cwd = nearestExistingDir(path);
196
230
  let topLevel;
197
231
  try {
198
- topLevel = git(dir, ["rev-parse", "--show-toplevel"]);
232
+ topLevel = git(cwd, ["rev-parse", "--show-toplevel"]);
199
233
  }
200
234
  catch {
201
235
  return { status: "not-a-repo" };
202
236
  }
203
237
  if (!topLevel)
204
238
  return { status: "not-a-repo" };
205
- try {
206
- execFileSync("git", ["check-ignore", "-q", "--", localStatePath], {
207
- cwd: dir,
208
- stdio: "ignore",
209
- });
210
- return { status: "already-ignored" };
211
- }
212
- catch {
213
- // Exit 1 means "not ignored" — carry on and add coverage.
214
- }
215
239
  // git reports the toplevel with symlinks resolved (/private/var on macOS);
216
240
  // the caller's path usually is not (/var). Compare like for like or the
217
241
  // "relative" path escapes the repository entirely.
218
- const realDir = realpathSync(dir);
219
- const rel = relative(topLevel, join(realDir, basename(localStatePath)))
220
- .split(sep)
221
- .join("/");
242
+ const realPath = join(realpathSync(cwd), relative(cwd, path));
243
+ const rel = relative(topLevel, realPath).split(sep).join("/");
244
+ if (isGitTracked(cwd, realPath)) {
245
+ return { status: "failed", detail: `${rel} is tracked by git` };
246
+ }
247
+ if (isGitIgnored(cwd, realPath))
248
+ return { status: "already-ignored" };
222
249
  const pattern = "/" + escapeGitignorePattern(rel);
250
+ const overridden = {
251
+ status: "failed",
252
+ detail: `${rel} is still not ignored: a .gitignore rule overrides the exclude entry "${pattern}"`,
253
+ };
223
254
  try {
224
- const excludePath = git(dir, ["rev-parse", "--path-format=absolute", "--git-path", "info/exclude"]);
255
+ const excludePath = git(cwd, ["rev-parse", "--path-format=absolute", "--git-path", "info/exclude"]);
225
256
  if (!excludePath)
226
257
  return { status: "failed", detail: "could not locate the git exclude file" };
227
258
  mkdirSync(dirname(excludePath), { recursive: true });
228
259
  const existing = existsSync(excludePath) ? readFileSync(excludePath, "utf-8") : "";
229
260
  if (existing.split(/\r?\n/).some((line) => line.trim() === pattern)) {
230
- return { status: "already-ignored" };
261
+ return isGitIgnored(cwd, realPath) ? { status: "already-ignored" } : overridden;
231
262
  }
232
263
  const prefix = existing === "" || existing.endsWith("\n") ? "" : "\n";
233
264
  writeFileSync(excludePath, existing +
234
265
  prefix +
235
- `\n# Added by 'primitive env use' — this machine's Primitive environment\n` +
236
- `# selection is local state, not a team decision. Add the same pattern to a\n` +
237
- `# committed .gitignore to make the coverage shared.\n` +
266
+ `\n# Added by '${options.reason}' — ${basename(path)} is per-machine Primitive\n` +
267
+ `# state, never committed. Add the same pattern to a committed .gitignore to\n` +
268
+ `# make the coverage shared.\n` +
238
269
  pattern +
239
270
  "\n");
271
+ if (!isGitIgnored(cwd, realPath))
272
+ return overridden;
240
273
  return { status: "excluded", excludePath, pattern };
241
274
  }
242
275
  catch (err) {
243
276
  return { status: "failed", detail: err?.message || String(err) };
244
277
  }
245
278
  }
279
+ /**
280
+ * Makes sure `.primitive/local.json` is ignored before it is written.
281
+ *
282
+ * Templates scaffolded from now on carry the entry in their `.gitignore`, but
283
+ * projects created before this change do not — and `env use` writing an
284
+ * untracked-but-committable file would be exactly the "switching backends
285
+ * dirties the repo" problem this replaced. See {@link ensureFileIgnored}.
286
+ */
287
+ export function ensureLocalStateIgnored(localStatePath) {
288
+ return ensureFileIgnored(localStatePath, { reason: "primitive env use" });
289
+ }
246
290
  //# sourceMappingURL=local-state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"local-state.js","sourceRoot":"","sources":["../../../src/lib/local-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAE9D,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,GAEnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,CAAC;AAE3D;;;;GAIG;AACH,SAAS,sBAAsB,CAAC,IAAY;IAC1C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YA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AO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;IACnE,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,cAAsB;IAC5D,OAAO,iBAAiB,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * What a failed `config push` tells the command that started it (#4491).
3
+ *
4
+ * `apps children create` runs the child's first push as a separate CLI
5
+ * invocation and sees only its exit code. When it names a file in
6
+ * `PRIMITIVE_PUSH_FAILURE_REPORT`, a push that fails writes there whether the
7
+ * failure was transient — every failed request got no answer or a 5xx, 429 or
8
+ * 408 — so the creator knows whether running the push again can help. Pushing
9
+ * again is safe: a push applies only what the server does not hold yet.
10
+ *
11
+ * A push that exits before it reaches the server, or fails in a way it does
12
+ * not classify, writes nothing; no report reads as not transient.
13
+ */
14
+ /** The environment variable naming the file a failed push writes its report to. */
15
+ export declare const PUSH_FAILURE_REPORT_ENV = "PRIMITIVE_PUSH_FAILURE_REPORT";
16
+ /** A failed push's report. */
17
+ export interface PushFailureReport {
18
+ /** Whether every failure was transient, so the same push may succeed when run again. */
19
+ transient: boolean;
20
+ }
21
+ /** The parts of a failed push that decide whether it was transient. */
22
+ export interface PushFailureCounts {
23
+ /** Changes that could not be applied, each with whether its failure was transient. */
24
+ applyFailures: ReadonlyArray<{
25
+ transient?: boolean;
26
+ }>;
27
+ conflicts: number;
28
+ blockedDatabaseTypes: number;
29
+ /** Schema and operation gate failures, all kinds together. */
30
+ schemaErrors: number;
31
+ }
32
+ /**
33
+ * Whether a push that failed only on applies failed transiently: there was at
34
+ * least one failed apply, each was transient, and nothing else (a conflict, a
35
+ * blocked database type, a schema gate) failed beside them.
36
+ */
37
+ export declare function pushFailureIsTransient(counts: PushFailureCounts): boolean;
38
+ /**
39
+ * Writes the report to the file `PRIMITIVE_PUSH_FAILURE_REPORT` names. Does
40
+ * nothing when it is unset, and never throws: the report must not mask the
41
+ * failure it describes.
42
+ */
43
+ export declare function writePushFailureReport(transient: boolean): void;
44
+ /** The report at `path`, or null when there is none or it cannot be read. */
45
+ export declare function readPushFailureReport(path: string): PushFailureReport | null;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * What a failed `config push` tells the command that started it (#4491).
3
+ *
4
+ * `apps children create` runs the child's first push as a separate CLI
5
+ * invocation and sees only its exit code. When it names a file in
6
+ * `PRIMITIVE_PUSH_FAILURE_REPORT`, a push that fails writes there whether the
7
+ * failure was transient — every failed request got no answer or a 5xx, 429 or
8
+ * 408 — so the creator knows whether running the push again can help. Pushing
9
+ * again is safe: a push applies only what the server does not hold yet.
10
+ *
11
+ * A push that exits before it reaches the server, or fails in a way it does
12
+ * not classify, writes nothing; no report reads as not transient.
13
+ */
14
+ import { existsSync, readFileSync, writeFileSync } from "fs";
15
+ /** The environment variable naming the file a failed push writes its report to. */
16
+ export const PUSH_FAILURE_REPORT_ENV = "PRIMITIVE_PUSH_FAILURE_REPORT";
17
+ /**
18
+ * Whether a push that failed only on applies failed transiently: there was at
19
+ * least one failed apply, each was transient, and nothing else (a conflict, a
20
+ * blocked database type, a schema gate) failed beside them.
21
+ */
22
+ export function pushFailureIsTransient(counts) {
23
+ return (counts.conflicts === 0 &&
24
+ counts.blockedDatabaseTypes === 0 &&
25
+ counts.schemaErrors === 0 &&
26
+ counts.applyFailures.length > 0 &&
27
+ counts.applyFailures.every((failure) => failure.transient === true));
28
+ }
29
+ /**
30
+ * Writes the report to the file `PRIMITIVE_PUSH_FAILURE_REPORT` names. Does
31
+ * nothing when it is unset, and never throws: the report must not mask the
32
+ * failure it describes.
33
+ */
34
+ export function writePushFailureReport(transient) {
35
+ const path = process.env[PUSH_FAILURE_REPORT_ENV];
36
+ if (!path)
37
+ return;
38
+ try {
39
+ writeFileSync(path, JSON.stringify({ transient }));
40
+ }
41
+ catch {
42
+ // No report reads as not transient.
43
+ }
44
+ }
45
+ /** The report at `path`, or null when there is none or it cannot be read. */
46
+ export function readPushFailureReport(path) {
47
+ if (!existsSync(path))
48
+ return null;
49
+ try {
50
+ const parsed = JSON.parse(readFileSync(path, "utf-8"));
51
+ return { transient: parsed?.transient === true };
52
+ }
53
+ catch {
54
+ return null;
55
+ }
56
+ }
57
+ //# sourceMappingURL=push-failure-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-failure-report.js","sourceRoot":"","sources":["../../../src/lib/push-failure-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAE7D,mFAAmF;AACnF,MAAM,CAAC,MAAM,uBAAuB,GAAG,+BAA+B,CAAC;AAkBvE;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAyB;IAC9D,OAAO,CACL,MAAM,CAAC,SAAS,KAAK,CAAC;QACtB,MAAM,CAAC,oBAAoB,KAAK,CAAC;QACjC,MAAM,CAAC,YAAY,KAAK,CAAC;QACzB,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC;QAC/B,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CACpE,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAkB;IACvD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAClD,IAAI,CAAC,IAAI;QAAE,OAAO;IAClB,IAAI,CAAC;QACH,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,EAA8B,CAAC,CAAC,CAAC;IACjF,CAAC;IAAC,MAAM,CAAC;QACP,oCAAoC;IACtC,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QACvD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,EAAE,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -118,8 +118,12 @@ export declare function trackedSelectorKeys(syncState: SyncState | null | undefi
118
118
  * retire one tracked key — the operator had to restore the TOML, which prune
119
119
  * would then decline to consider, or drop `--only` and push the whole tree.
120
120
  * Callers that pass no `tracked` keep the local-files-only meaning.
121
+ *
122
+ * `varsOverridePath` is the selected machine-local environment's
123
+ * `vars.<name>.override.toml` (#4485): a key either file declares is matched,
124
+ * and either file existing is "the file exists" for a tracked key.
121
125
  */
122
- export declare function unmatchedSelectors(selection: SyncSelection, configDir: string, tracked?: TrackedSelectorKeys | null): string[];
126
+ export declare function unmatchedSelectors(selection: SyncSelection, configDir: string, tracked?: TrackedSelectorKeys | null, varsOverridePath?: string | null): string[];
123
127
  /** The file a selector points at, for an operator-facing message. */
124
128
  export declare function selectorFileHint(type: string): string;
125
129
  /**
@@ -201,8 +201,12 @@ export function trackedSelectorKeys(syncState, options) {
201
201
  * retire one tracked key — the operator had to restore the TOML, which prune
202
202
  * would then decline to consider, or drop `--only` and push the whole tree.
203
203
  * Callers that pass no `tracked` keep the local-files-only meaning.
204
+ *
205
+ * `varsOverridePath` is the selected machine-local environment's
206
+ * `vars.<name>.override.toml` (#4485): a key either file declares is matched,
207
+ * and either file existing is "the file exists" for a tracked key.
204
208
  */
205
- export function unmatchedSelectors(selection, configDir, tracked) {
209
+ export function unmatchedSelectors(selection, configDir, tracked, varsOverridePath) {
206
210
  const missing = [];
207
211
  for (const [label, keys] of selection.entityKeys) {
208
212
  const descriptor = getConfigObjectDescriptor(label);
@@ -228,24 +232,30 @@ export function unmatchedSelectors(selection, configDir, tracked) {
228
232
  missing.push("app");
229
233
  }
230
234
  if (selection.varKeys.size > 0) {
231
- const varsPath = join(configDir, "vars.toml");
232
- // The tracked-var fallback below needs the file to exist, even though the
233
- // key it matches is one the file no longer declares: push plans var writes
234
- // from a PARSED `vars.toml` only (`preflightParsedVars` → `planVarsPush`),
235
+ const varsFiles = [join(configDir, "vars.toml"), ...(varsOverridePath ? [varsOverridePath] : [])];
236
+ // The tracked-var fallback below needs a var file to exist, even though the
237
+ // key it matches is one no file declares any more: push plans var writes
238
+ // from a PARSED var table only (`preflightParsedVars` → `planVarsPush`),
235
239
  // so with no file at all the deletion that would justify the selector is
236
- // never planned and the push applies nothing. A missing `vars.toml` is
237
- // still this check's to refuse.
238
- const varsFileExists = existsSync(varsPath);
240
+ // never planned and the push applies nothing. No var file at all is still
241
+ // this check's to refuse.
242
+ let varsFileExists = false;
239
243
  let declared = new Set();
240
- if (varsFileExists) {
244
+ for (const varsPath of varsFiles) {
245
+ if (!existsSync(varsPath))
246
+ continue;
247
+ varsFileExists = true;
241
248
  try {
242
- // `vars.toml` is a FLAT root table — `API_BASE_URL = "…"`, no section.
243
- declared = new Set(Object.keys(parseConfigToml(readFileSync(varsPath, "utf-8"))));
249
+ // A var file is a FLAT root table — `API_BASE_URL = "…"`, no section.
250
+ for (const key of Object.keys(parseConfigToml(readFileSync(varsPath, "utf-8")))) {
251
+ declared.add(key);
252
+ }
244
253
  }
245
254
  catch {
246
- // A malformed vars.toml is the push preflight's error to report, not
255
+ // A malformed var file is the push preflight's error to report, not
247
256
  // this check's — treat it as "cannot tell" and stay quiet.
248
- declared = selection.varKeys;
257
+ declared = new Set(selection.varKeys);
258
+ break;
249
259
  }
250
260
  }
251
261
  for (const key of selection.varKeys) {
@@ -1 +1 @@
1
- {"version":3,"file":"sync-selectors.js","sourceRoot":"","sources":["../../../src/lib/sync-selectors.ts"],"names":[],"mappings":"AA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AAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,yBAAyB,CAAC,IAAI,CAAC,EAAE,QAAQ,IAAI,IAAI,CAAC;AAC3D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAiB,EACjB,KAAa,EACb,GAAW;IAEX,MAAM,MAAM,GAAG,yBAAyB,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9D,MAAM,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAC;IACvC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,OAAO,WAAW,CAAC,GAAG,CAAC;SACpB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC3C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;SAC9B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;AACjD,CAAC"}
@@ -23,6 +23,15 @@ export declare function isTransientStatus(status: number): boolean;
23
23
  export declare function failureStatus(error: unknown): number | undefined;
24
24
  /** Whether a failed request is worth making again. */
25
25
  export declare function isTransientFailure(error: unknown): boolean;
26
+ /**
27
+ * Whether a failure is a request the server never answered, or answered with
28
+ * a transient status. Unlike `isTransientFailure`, an error with no status is
29
+ * transient only when it is a transport failure: an error the CLI raised
30
+ * itself (a file it could not parse, a check it made) is an answer too. An
31
+ * error that wraps another (`cause`) is judged by the one it wraps, so a
32
+ * push's own message around a dropped request or a 503 keeps its verdict.
33
+ */
34
+ export declare function isTransientRequestFailure(error: unknown): boolean;
26
35
  /**
27
36
  * Run `attempt`, retrying a transient failure on the back-off schedule.
28
37
  *
@@ -31,6 +31,43 @@ export function isTransientFailure(error) {
31
31
  const status = failureStatus(error);
32
32
  return status === undefined || isTransientStatus(status);
33
33
  }
34
+ /** Socket-level codes a request fails with when it got no answer. */
35
+ const TRANSPORT_ERROR_CODES = new Set([
36
+ "ECONNRESET",
37
+ "ECONNREFUSED",
38
+ "ECONNABORTED",
39
+ "ETIMEDOUT",
40
+ "EPIPE",
41
+ "EAI_AGAIN",
42
+ "UND_ERR_SOCKET",
43
+ "UND_ERR_CONNECT_TIMEOUT",
44
+ "UND_ERR_HEADERS_TIMEOUT",
45
+ "UND_ERR_BODY_TIMEOUT",
46
+ ]);
47
+ /**
48
+ * Whether a failure is a request the server never answered, or answered with
49
+ * a transient status. Unlike `isTransientFailure`, an error with no status is
50
+ * transient only when it is a transport failure: an error the CLI raised
51
+ * itself (a file it could not parse, a check it made) is an answer too. An
52
+ * error that wraps another (`cause`) is judged by the one it wraps, so a
53
+ * push's own message around a dropped request or a 503 keeps its verdict.
54
+ */
55
+ export function isTransientRequestFailure(error) {
56
+ return requestFailureIsTransient(error, 0);
57
+ }
58
+ function requestFailureIsTransient(error, depth) {
59
+ if (!error || typeof error !== "object" || depth > 4)
60
+ return false;
61
+ const status = failureStatus(error);
62
+ if (status !== undefined)
63
+ return isTransientStatus(status);
64
+ const code = error.code;
65
+ if (typeof code === "string" && TRANSPORT_ERROR_CODES.has(code))
66
+ return true;
67
+ if (error instanceof TypeError && error.message === "fetch failed")
68
+ return true;
69
+ return requestFailureIsTransient(error.cause, depth + 1);
70
+ }
34
71
  const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
35
72
  /**
36
73
  * Run `attempt`, retrying a transient failure on the back-off schedule.
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AO,KAAK,EAAE,CAAC;YACf,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC;gBAAE,MAAM,KAAK,CAAC;YAC3E,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC;YACxC,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * A child app's own config var values: `vars.<name>.override.toml` (#4485).
3
+ *
4
+ * A machine-local environment `<name>` (#4117) shares the committed
5
+ * environment's `primitive/<tree>/`, so the `vars.toml` there holds the
6
+ * parent's values. Vars whose value belongs to one app — its database ids, a
7
+ * webhook URL embedding its app id, an OAuth origin — need a place of their
8
+ * own that survives a push, a diff and a pull without touching what merges to
9
+ * main. That place is `primitive/<tree>/vars.<name>.override.toml`, a flat
10
+ * `KEY = "value"` table under the same rules as `vars.toml`:
11
+ *
12
+ * - It is read only when `<name>` is the SELECTED environment. A committed
13
+ * environment has no override, so a file named for one is never read.
14
+ * - It LAYERS over `vars.toml`: its keys replace or add, every other key keeps
15
+ * `vars.toml`'s value, and no key can be made absent on the child.
16
+ * - It is machine-local and git-ignored (`primitive/*\/*.override.toml`).
17
+ *
18
+ * Everything here is pure apart from `readLocalVars`, which reads the two
19
+ * files; the commands own the writes.
20
+ */
21
+ /** The tree's shared var file. */
22
+ export declare const VARS_FILE_NAME = "vars.toml";
23
+ /**
24
+ * The gitignore pattern that keeps every override file out of a commit,
25
+ * written by `primitive init` and carried by both app templates.
26
+ */
27
+ export declare const VARS_OVERRIDE_GITIGNORE_PATTERN = "primitive/*/*.override.toml";
28
+ /** A flat var table: key to value. */
29
+ export type VarTable = Record<string, string>;
30
+ /** `vars.<name>.override.toml` — the override file's name inside the tree. */
31
+ export declare function varsOverrideFileName(name: string): string;
32
+ /**
33
+ * The override file for `env` in the tree `configDir`, or `null` for a
34
+ * committed environment, which never has one. Refuses a name that is not a
35
+ * safe path component.
36
+ */
37
+ export declare function varsOverridePath(configDir: string, env: {
38
+ name: string;
39
+ local: boolean;
40
+ }): string | null;
41
+ /**
42
+ * `base` with `override`'s keys replacing or adding to it. Either side may be
43
+ * absent; the result is a new table.
44
+ */
45
+ export declare function layerVars(base: Record<string, unknown> | null, override: Record<string, unknown> | null): Record<string, unknown>;
46
+ /** The two var files of an environment and the table they layer into. */
47
+ export interface LocalVars {
48
+ basePath: string;
49
+ /** `vars.toml`'s table, or `null` when the file is absent. */
50
+ base: Record<string, unknown> | null;
51
+ /** The override file, or `null` for an environment that has none. */
52
+ overridePath: string | null;
53
+ /** The override's table, or `null` when there is no file. */
54
+ override: Record<string, unknown> | null;
55
+ /** What the environment's vars are: `base` with `override` layered over it. */
56
+ layered: Record<string, unknown>;
57
+ /** Override keys `vars.toml` also declares, sorted. */
58
+ overridingKeys: string[];
59
+ /** Override keys `vars.toml` does not declare, sorted. */
60
+ addedKeys: string[];
61
+ }
62
+ /**
63
+ * Reads `vars.toml` in `configDir` and the override at `overridePath`, and
64
+ * layers them. A file that cannot be parsed throws an error naming it.
65
+ */
66
+ export declare function readLocalVars(configDir: string, overridePath: string | null): LocalVars;
67
+ /**
68
+ * The override file's body: a header saying what the file is, then the keys
69
+ * sorted. An empty table is a comment-only file.
70
+ */
71
+ export declare function serializeVarsOverride(vars: VarTable, target: {
72
+ name: string;
73
+ tree: string;
74
+ }): string;
75
+ /**
76
+ * What `config pull` on a machine-local environment writes into its override
77
+ * file. `vars.toml` is never written by such a pull, so each pulled key —
78
+ * every key on the server or in the override, or only `selectedKeys` — is
79
+ * resolved against it: a server value equal to `vars.toml`'s is dropped from
80
+ * the override, any other server value is held there, and a key the server no
81
+ * longer has is removed. Keys outside the selection stay as they are.
82
+ */
83
+ export declare function planVarsOverridePull(serverVars: ReadonlyArray<{
84
+ key: string;
85
+ value?: string;
86
+ }>, baseVars: Record<string, unknown>, selectedKeys: ReadonlySet<string> | null, currentOverride: Record<string, unknown>, target: {
87
+ name: string;
88
+ tree: string;
89
+ }): {
90
+ vars: VarTable;
91
+ content: string;
92
+ };
93
+ /** The one line push, diff and pull print when an override is in play. */
94
+ export declare function varsOverrideSummaryLine(fileName: string, keys: {
95
+ overridingKeys: readonly string[];
96
+ addedKeys: readonly string[];
97
+ }): string;
98
+ /**
99
+ * The note a push on a child with an override prints when it changed the
100
+ * value of a var that already existed and left at least one function as it
101
+ * was. Functions read vars through a cache keyed by function version, so an
102
+ * unchanged function keeps the value it first read until a new version of it
103
+ * is pushed or its isolate is recycled. `null` when neither applies.
104
+ */
105
+ export declare function cachedVarsNote(changedKeys: readonly string[], skippedFunctionCount: number): string | null;