primitive-admin 1.1.0-alpha.71 → 1.1.0-alpha.72
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/dist/src/commands/apps.js +5 -2
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/database-types.js +13 -313
- package/dist/src/commands/database-types.js.map +1 -1
- package/dist/src/commands/email-templates.js +3 -3
- package/dist/src/commands/email-templates.js.map +1 -1
- package/dist/src/commands/env.js +17 -1
- package/dist/src/commands/env.js.map +1 -1
- package/dist/src/commands/init.d.ts +15 -0
- package/dist/src/commands/init.js +158 -22
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +30 -14
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/llm.js +9 -6
- package/dist/src/commands/llm.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +10 -0
- package/dist/src/commands/scripts.js +137 -8
- package/dist/src/commands/scripts.js.map +1 -1
- package/dist/src/commands/settings.d.ts +18 -0
- package/dist/src/commands/settings.js +54 -0
- package/dist/src/commands/settings.js.map +1 -0
- package/dist/src/commands/sync.d.ts +1 -31
- package/dist/src/commands/sync.js +5 -79
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/lib/env-resolver-core.d.ts +40 -0
- package/dist/src/lib/env-resolver-core.js +60 -0
- package/dist/src/lib/env-resolver-core.js.map +1 -1
- package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
- package/dist/src/lib/generated-workflow-model-fields.js +53 -0
- package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
- package/dist/src/lib/google-client-secret-status.d.ts +35 -0
- package/dist/src/lib/google-client-secret-status.js +56 -0
- package/dist/src/lib/google-client-secret-status.js.map +1 -0
- package/dist/src/lib/init-client-platforms.d.ts +14 -0
- package/dist/src/lib/init-client-platforms.js +71 -0
- package/dist/src/lib/init-client-platforms.js.map +1 -0
- package/dist/src/lib/init-email-redirect-uris.d.ts +37 -0
- package/dist/src/lib/init-email-redirect-uris.js +46 -0
- package/dist/src/lib/init-email-redirect-uris.js.map +1 -0
- package/dist/src/lib/init-ios-links.d.ts +40 -0
- package/dist/src/lib/init-ios-links.js +66 -1
- package/dist/src/lib/init-ios-links.js.map +1 -1
- package/dist/src/lib/integration-selector.d.ts +42 -0
- package/dist/src/lib/integration-selector.js +46 -0
- package/dist/src/lib/integration-selector.js.map +1 -0
- package/dist/src/lib/local-test-cases.d.ts +63 -0
- package/dist/src/lib/local-test-cases.js +135 -0
- package/dist/src/lib/local-test-cases.js.map +1 -0
- package/dist/src/lib/project-config.d.ts +8 -0
- package/dist/src/lib/project-config.js +17 -0
- package/dist/src/lib/project-config.js.map +1 -1
- package/dist/src/lib/test-case-file-names.d.ts +40 -0
- package/dist/src/lib/test-case-file-names.js +91 -0
- package/dist/src/lib/test-case-file-names.js.map +1 -0
- package/dist/src/lib/web-url.d.ts +40 -0
- package/dist/src/lib/web-url.js +76 -0
- package/dist/src/lib/web-url.js.map +1 -0
- package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
- package/dist/src/lib/workflow-field-descriptor.js +153 -0
- package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
- package/package.json +1 -1
|
@@ -52,8 +52,46 @@ export interface CoreEnvironmentEntry {
|
|
|
52
52
|
apiUrl: string;
|
|
53
53
|
appId?: string;
|
|
54
54
|
appName?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The app's web counterpart for this environment, as a normalized origin
|
|
57
|
+
* (#2982). Read through `normalizeWebOrigin`, so a value this reader carries
|
|
58
|
+
* is always an origin — see that function for why the typed read other
|
|
59
|
+
* fields get is not enough here.
|
|
60
|
+
*/
|
|
61
|
+
webUrl?: string;
|
|
55
62
|
description?: string;
|
|
56
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* The app's web counterpart as a normalized ORIGIN, or undefined when the
|
|
66
|
+
* value cannot be one (#2982).
|
|
67
|
+
*
|
|
68
|
+
* Unlike `appId`/`appName`, a typed read is not enough. This value is not
|
|
69
|
+
* merely carried: the Swift app points its emailed sign-in link at
|
|
70
|
+
* `<webUrl>/oauth/callback` and trusts incoming universal links from the same
|
|
71
|
+
* origin, and BOTH jobs need an origin —
|
|
72
|
+
*
|
|
73
|
+
* - https except loopback, the rule the server applies to every redirect URI
|
|
74
|
+
* (`src/auth/redirect-uri.ts`): an origin that cannot be allow-listed turns
|
|
75
|
+
* every sign-in request into a 400, and a plain-http link would carry the
|
|
76
|
+
* magic token in clear;
|
|
77
|
+
* - no path, query or fragment: the web client serves its callback on its own
|
|
78
|
+
* origin plus `/oauth/callback`, which is also the exact path the
|
|
79
|
+
* `apple-app-site-association` component claims;
|
|
80
|
+
* - no credentials, which have no business in a link that goes out by email.
|
|
81
|
+
*
|
|
82
|
+
* `primitive env add --web-url` and the project-config validation reject those
|
|
83
|
+
* shapes with a field-named error, but neither is on the path from a
|
|
84
|
+
* hand-edited `.primitive/config.json` to an Xcode build: the Swift template's
|
|
85
|
+
* pre-build script reads the file directly. So every reader that feeds
|
|
86
|
+
* `primitive.json` applies the contract, and a value that misses it is read as
|
|
87
|
+
* "this environment has no web counterpart" — code-only email, no trusted
|
|
88
|
+
* origin, nothing silently pointed at the wrong URL.
|
|
89
|
+
*
|
|
90
|
+
* The message-producing twin of this rule lives in `cli/src/lib/web-url.ts`;
|
|
91
|
+
* this file cannot import it (see COPYABILITY above), and a test pins that the
|
|
92
|
+
* two agree.
|
|
93
|
+
*/
|
|
94
|
+
export declare function normalizeWebOrigin(value: unknown): string | undefined;
|
|
57
95
|
export interface CoreProjectConfig {
|
|
58
96
|
version: number;
|
|
59
97
|
defaultEnvironment?: string;
|
|
@@ -68,6 +106,8 @@ export interface ResolvedPrimitiveEnv {
|
|
|
68
106
|
wsUrl: string;
|
|
69
107
|
appId?: string;
|
|
70
108
|
appName?: string;
|
|
109
|
+
/** The app's web counterpart for the SELECTED environment, if it has one. */
|
|
110
|
+
webUrl?: string;
|
|
71
111
|
description?: string;
|
|
72
112
|
source: PrimitiveEnvSource;
|
|
73
113
|
configPath: string;
|
|
@@ -50,6 +50,64 @@ export class PrimitiveEnvError extends Error {
|
|
|
50
50
|
this.path = path;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The app's web counterpart as a normalized ORIGIN, or undefined when the
|
|
55
|
+
* value cannot be one (#2982).
|
|
56
|
+
*
|
|
57
|
+
* Unlike `appId`/`appName`, a typed read is not enough. This value is not
|
|
58
|
+
* merely carried: the Swift app points its emailed sign-in link at
|
|
59
|
+
* `<webUrl>/oauth/callback` and trusts incoming universal links from the same
|
|
60
|
+
* origin, and BOTH jobs need an origin —
|
|
61
|
+
*
|
|
62
|
+
* - https except loopback, the rule the server applies to every redirect URI
|
|
63
|
+
* (`src/auth/redirect-uri.ts`): an origin that cannot be allow-listed turns
|
|
64
|
+
* every sign-in request into a 400, and a plain-http link would carry the
|
|
65
|
+
* magic token in clear;
|
|
66
|
+
* - no path, query or fragment: the web client serves its callback on its own
|
|
67
|
+
* origin plus `/oauth/callback`, which is also the exact path the
|
|
68
|
+
* `apple-app-site-association` component claims;
|
|
69
|
+
* - no credentials, which have no business in a link that goes out by email.
|
|
70
|
+
*
|
|
71
|
+
* `primitive env add --web-url` and the project-config validation reject those
|
|
72
|
+
* shapes with a field-named error, but neither is on the path from a
|
|
73
|
+
* hand-edited `.primitive/config.json` to an Xcode build: the Swift template's
|
|
74
|
+
* pre-build script reads the file directly. So every reader that feeds
|
|
75
|
+
* `primitive.json` applies the contract, and a value that misses it is read as
|
|
76
|
+
* "this environment has no web counterpart" — code-only email, no trusted
|
|
77
|
+
* origin, nothing silently pointed at the wrong URL.
|
|
78
|
+
*
|
|
79
|
+
* The message-producing twin of this rule lives in `cli/src/lib/web-url.ts`;
|
|
80
|
+
* this file cannot import it (see COPYABILITY above), and a test pins that the
|
|
81
|
+
* two agree.
|
|
82
|
+
*/
|
|
83
|
+
export function normalizeWebOrigin(value) {
|
|
84
|
+
if (typeof value !== "string")
|
|
85
|
+
return undefined;
|
|
86
|
+
const trimmed = value.trim();
|
|
87
|
+
if (!trimmed)
|
|
88
|
+
return undefined;
|
|
89
|
+
let url;
|
|
90
|
+
try {
|
|
91
|
+
url = new URL(trimmed);
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
97
|
+
return undefined;
|
|
98
|
+
if (url.protocol === "http:" &&
|
|
99
|
+
url.hostname !== "localhost" &&
|
|
100
|
+
url.hostname !== "127.0.0.1") {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
if (url.username || url.password)
|
|
104
|
+
return undefined;
|
|
105
|
+
if (url.pathname !== "/" && url.pathname !== "")
|
|
106
|
+
return undefined;
|
|
107
|
+
if (url.search || url.hash)
|
|
108
|
+
return undefined;
|
|
109
|
+
return url.origin;
|
|
110
|
+
}
|
|
53
111
|
/**
|
|
54
112
|
* Derives the WebSocket URL from the API URL. Every apiUrl/wsUrl pair in
|
|
55
113
|
* practice is the same host with the scheme swapped, so it is derived rather
|
|
@@ -149,6 +207,7 @@ export function readCoreProjectConfig(configPath) {
|
|
|
149
207
|
apiUrl: e.apiUrl.replace(/\/$/, ""),
|
|
150
208
|
appId: typeof e.appId === "string" ? e.appId : undefined,
|
|
151
209
|
appName: typeof e.appName === "string" ? e.appName : undefined,
|
|
210
|
+
webUrl: normalizeWebOrigin(e.webUrl),
|
|
152
211
|
description: typeof e.description === "string" ? e.description : undefined,
|
|
153
212
|
};
|
|
154
213
|
}
|
|
@@ -255,6 +314,7 @@ export function resolvePrimitiveEnv(options = {}) {
|
|
|
255
314
|
wsUrl: deriveWsUrl(entry.apiUrl),
|
|
256
315
|
appId: entry.appId,
|
|
257
316
|
appName: entry.appName,
|
|
317
|
+
webUrl: entry.webUrl,
|
|
258
318
|
description: entry.description,
|
|
259
319
|
source,
|
|
260
320
|
configPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-resolver-core.js","sourceRoot":"","sources":["../../../src/lib/env-resolver-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,wEAAwE;AACxE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAC1C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAC/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC;AACrD,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AACjD,MAAM,CAAC,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AACpE,MAAM,CAAC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAehE,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,IAAI,CAAwB;IAC5B,IAAI,CAAU;IAEvB,YAAY,IAA2B,EAAE,OAAe,EAAE,IAAa;QACrE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"env-resolver-core.js","sourceRoot":"","sources":["../../../src/lib/env-resolver-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IA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qBAAqB,CAAC,MAAM,EAAE;QACrD,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,IAAI;QAChD,UAAU,EAAE,GAAG,CAAC,aAAa,IAAI,IAAI;QACrC,cAAc,EAAE,kBAAkB,CAAC,UAAU,CAAC;QAC9C,UAAU;KACX,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,OAAO,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzC,MAAM,IAAI,iBAAiB,CACzB,gBAAgB,EAChB,gBAAgB,IAAI,QAAQ,2BAA2B,KAAK,UAAU,6EAA6E,IAAI,cAAc,KAAK,CAAC,MAAM,qCAAqC,EACtN,UAAU,CACX,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC;QAChC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,MAAM;QACN,UAAU;QACV,cAAc,EAAE,2BAA2B,CAAC,UAAU,CAAC;QACvD,WAAW,EAAE,wBAAwB,CAAC,UAAU,CAAC;KAClD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
+
*
|
|
4
|
+
* Source of truth: the `WorkflowDefinition` model in the repo-root
|
|
5
|
+
* `models.yaml` — the one statically-parseable server anchor for the
|
|
6
|
+
* `[workflow]`-level config surface (issue #2326, Phase 1 of #1976).
|
|
7
|
+
*
|
|
8
|
+
* Regenerate with:
|
|
9
|
+
* node cli/scripts/gen-workflow-fields.mjs (runs automatically at CLI prebuild)
|
|
10
|
+
*
|
|
11
|
+
* A CI freshness guard (`cli/scripts/gen-workflow-fields.mjs --check`, also
|
|
12
|
+
* asserted by `cli/tests/unit/workflow-field-descriptor-drift-guard.test.ts`)
|
|
13
|
+
* fails if this committed artifact does not match a fresh parse of
|
|
14
|
+
* `models.yaml`. The same test asserts every field below is classified in
|
|
15
|
+
* `cli/src/lib/workflow-field-descriptor.ts` as synced, structural, or
|
|
16
|
+
* internal — so a new server-side workflow field cannot be silently ignored by
|
|
17
|
+
* the CLI.
|
|
18
|
+
*/
|
|
19
|
+
/** Every `WorkflowDefinition` field, in `models.yaml` declaration order (#2326). */
|
|
20
|
+
export declare const GENERATED_WORKFLOW_MODEL_FIELDS: readonly string[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
+
*
|
|
4
|
+
* Source of truth: the `WorkflowDefinition` model in the repo-root
|
|
5
|
+
* `models.yaml` — the one statically-parseable server anchor for the
|
|
6
|
+
* `[workflow]`-level config surface (issue #2326, Phase 1 of #1976).
|
|
7
|
+
*
|
|
8
|
+
* Regenerate with:
|
|
9
|
+
* node cli/scripts/gen-workflow-fields.mjs (runs automatically at CLI prebuild)
|
|
10
|
+
*
|
|
11
|
+
* A CI freshness guard (`cli/scripts/gen-workflow-fields.mjs --check`, also
|
|
12
|
+
* asserted by `cli/tests/unit/workflow-field-descriptor-drift-guard.test.ts`)
|
|
13
|
+
* fails if this committed artifact does not match a fresh parse of
|
|
14
|
+
* `models.yaml`. The same test asserts every field below is classified in
|
|
15
|
+
* `cli/src/lib/workflow-field-descriptor.ts` as synced, structural, or
|
|
16
|
+
* internal — so a new server-side workflow field cannot be silently ignored by
|
|
17
|
+
* the CLI.
|
|
18
|
+
*/
|
|
19
|
+
/** Every `WorkflowDefinition` field, in `models.yaml` declaration order (#2326). */
|
|
20
|
+
export const GENERATED_WORKFLOW_MODEL_FIELDS = [
|
|
21
|
+
"workflowId",
|
|
22
|
+
"appId",
|
|
23
|
+
"workflowKey",
|
|
24
|
+
"name",
|
|
25
|
+
"status",
|
|
26
|
+
"latestRevision",
|
|
27
|
+
"description",
|
|
28
|
+
"stepsR2Key",
|
|
29
|
+
"draftStepsR2Key",
|
|
30
|
+
"draftInputSchema",
|
|
31
|
+
"draftOutputSchema",
|
|
32
|
+
"draftModifiedAt",
|
|
33
|
+
"activeConfigId",
|
|
34
|
+
"inputSchema",
|
|
35
|
+
"outputSchema",
|
|
36
|
+
"perUserMaxRunning",
|
|
37
|
+
"perUserMaxQueued",
|
|
38
|
+
"perAppMaxRunning",
|
|
39
|
+
"perAppMaxQueued",
|
|
40
|
+
"queueTtlSeconds",
|
|
41
|
+
"dequeueOrder",
|
|
42
|
+
"requiresClientApply",
|
|
43
|
+
"syncCallable",
|
|
44
|
+
"accessRule",
|
|
45
|
+
"metadataManifest",
|
|
46
|
+
"runAs",
|
|
47
|
+
"lock",
|
|
48
|
+
"capabilities",
|
|
49
|
+
"createdBy",
|
|
50
|
+
"createdAt",
|
|
51
|
+
"modifiedAt",
|
|
52
|
+
];
|
|
53
|
+
//# sourceMappingURL=generated-workflow-model-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-workflow-model-fields.js","sourceRoot":"","sources":["../../../src/lib/generated-workflow-model-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,oFAAoF;AACpF,MAAM,CAAC,MAAM,+BAA+B,GAAsB;IAChE,YAAY;IACZ,OAAO;IACP,aAAa;IACb,MAAM;IACN,QAAQ;IACR,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,mBAAmB;IACnB,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,qBAAqB;IACrB,cAAc;IACd,YAAY;IACZ,kBAAkB;IAClB,OAAO;IACP,MAAM;IACN,cAAc;IACd,WAAW;IACX,WAAW;IACX,YAAY;CACb,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The operator-facing warning for an app whose stored `googleClientSecret` is
|
|
3
|
+
* not a `{{secrets.KEY}}` reference (#2256, #2307).
|
|
4
|
+
*
|
|
5
|
+
* The server never sends such a value back: `GET /settings` omits the key and
|
|
6
|
+
* reports `googleClientSecretStatus` in its place, so the only way an operator
|
|
7
|
+
* learns the field is still unmigrated is a command that reads the status and
|
|
8
|
+
* says so. Two do — `apps get` and `config pull` — and
|
|
9
|
+
* each has two statuses to describe, so the wording lives here once and the
|
|
10
|
+
* call sites supply only what genuinely differs: how the field is named in that
|
|
11
|
+
* context, where the value is missing from, and what the un-migrated value
|
|
12
|
+
* blocks.
|
|
13
|
+
*
|
|
14
|
+
* Modelled on `signingSecretStatusWarning` (the same problem for
|
|
15
|
+
* `webhook.signingSecret`), deliberately kept as a separate function: the
|
|
16
|
+
* remediation names a different TOML key, and a `legacy-literal` blocks
|
|
17
|
+
* different things on the two fields.
|
|
18
|
+
*
|
|
19
|
+
* Returns `null` for a status that needs no warning (`reference`, `unset`, or
|
|
20
|
+
* anything a newer server adds), so a call site is one `if` rather than two.
|
|
21
|
+
*/
|
|
22
|
+
export declare function googleClientSecretStatusWarning(status: string | null | undefined, context: {
|
|
23
|
+
/** How to name the field, e.g. `"googleClientSecret"`. Starts the sentence. */
|
|
24
|
+
subject: string;
|
|
25
|
+
/** Where the value is missing from, e.g. `"this output"`. */
|
|
26
|
+
withheldFrom: string;
|
|
27
|
+
/**
|
|
28
|
+
* What an un-migrated value blocks, e.g. `"the next settings write will be
|
|
29
|
+
* rejected"`. Every settings write on such an app fails unless it carries a
|
|
30
|
+
* `googleClientSecret` that migrates the field
|
|
31
|
+
* (`validateGoogleClientSecretMigration`), and a pulled `app.toml` never
|
|
32
|
+
* carries one — so for the pull paths this is the concrete consequence.
|
|
33
|
+
*/
|
|
34
|
+
blocks: string;
|
|
35
|
+
}): string | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The operator-facing warning for an app whose stored `googleClientSecret` is
|
|
3
|
+
* not a `{{secrets.KEY}}` reference (#2256, #2307).
|
|
4
|
+
*
|
|
5
|
+
* The server never sends such a value back: `GET /settings` omits the key and
|
|
6
|
+
* reports `googleClientSecretStatus` in its place, so the only way an operator
|
|
7
|
+
* learns the field is still unmigrated is a command that reads the status and
|
|
8
|
+
* says so. Two do — `apps get` and `config pull` — and
|
|
9
|
+
* each has two statuses to describe, so the wording lives here once and the
|
|
10
|
+
* call sites supply only what genuinely differs: how the field is named in that
|
|
11
|
+
* context, where the value is missing from, and what the un-migrated value
|
|
12
|
+
* blocks.
|
|
13
|
+
*
|
|
14
|
+
* Modelled on `signingSecretStatusWarning` (the same problem for
|
|
15
|
+
* `webhook.signingSecret`), deliberately kept as a separate function: the
|
|
16
|
+
* remediation names a different TOML key, and a `legacy-literal` blocks
|
|
17
|
+
* different things on the two fields.
|
|
18
|
+
*
|
|
19
|
+
* Returns `null` for a status that needs no warning (`reference`, `unset`, or
|
|
20
|
+
* anything a newer server adds), so a call site is one `if` rather than two.
|
|
21
|
+
*/
|
|
22
|
+
export function googleClientSecretStatusWarning(status, context) {
|
|
23
|
+
const remediation = "Store the value with `primitive secrets set KEY --value <value>` and set " +
|
|
24
|
+
'googleClientSecret = "{{secrets.KEY}}".';
|
|
25
|
+
if (status === "legacy-literal") {
|
|
26
|
+
return (`${context.subject} still holds a raw value rather than a {{secrets.KEY}} reference, ` +
|
|
27
|
+
`so it is withheld from ${context.withheldFrom}. Google sign-in keeps working, but the ` +
|
|
28
|
+
`value is deprecated and ${context.blocks} until it is migrated. ${remediation}`);
|
|
29
|
+
}
|
|
30
|
+
// Not a working legacy literal: the stored value carries reference syntax
|
|
31
|
+
// that resolves to nothing, so Google sign-in is already failing (#2332).
|
|
32
|
+
//
|
|
33
|
+
// Two deliberate differences from the branch above, both to keep the
|
|
34
|
+
// rendered settings output byte-identical to what PR #2293 shipped:
|
|
35
|
+
//
|
|
36
|
+
// - `context.blocks` is unused. A push of the pulled file is rejected for
|
|
37
|
+
// this status too (`validateGoogleClientSecretMigration` gates on
|
|
38
|
+
// `isWithheldSecretStatus`, which covers both), but the sign-in outage is
|
|
39
|
+
// the louder problem and the remediation below already fixes both. The
|
|
40
|
+
// sibling `signingSecretStatusWarning` drops `blocks` in its malformed
|
|
41
|
+
// branch the same way.
|
|
42
|
+
// - The remediation sentence is written out rather than interpolating the
|
|
43
|
+
// `remediation` constant above: this one says "the real client secret",
|
|
44
|
+
// which the shared sentence does not.
|
|
45
|
+
//
|
|
46
|
+
// Both are worth revisiting together if `apps get`'s wording is ever
|
|
47
|
+
// allowed to change.
|
|
48
|
+
if (status === "malformed-reference") {
|
|
49
|
+
return (`${context.subject} is neither a {{secrets.KEY}} reference nor a plain stored value — it ` +
|
|
50
|
+
`carries reference syntax that does not resolve, so it is withheld from ${context.withheldFrom} ` +
|
|
51
|
+
"and Google sign-in is already FAILING. Store the real client secret with " +
|
|
52
|
+
'`primitive secrets set KEY --value <value>` and set googleClientSecret = "{{secrets.KEY}}".');
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=google-client-secret-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-client-secret-status.js","sourceRoot":"","sources":["../../../src/lib/google-client-secret-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,+BAA+B,CAC7C,MAAiC,EACjC,OAaC;IAED,MAAM,WAAW,GACf,2EAA2E;QAC3E,yCAAyC,CAAC;IAC5C,IAAI,MAAM,KAAK,gBAAgB,EAAE,CAAC;QAChC,OAAO,CACL,GAAG,OAAO,CAAC,OAAO,oEAAoE;YACtF,0BAA0B,OAAO,CAAC,YAAY,0CAA0C;YACxF,2BAA2B,OAAO,CAAC,MAAM,0BAA0B,WAAW,EAAE,CACjF,CAAC;IACJ,CAAC;IACD,0EAA0E;IAC1E,0EAA0E;IAC1E,EAAE;IACF,qEAAqE;IACrE,oEAAoE;IACpE,EAAE;IACF,4EAA4E;IAC5E,sEAAsE;IACtE,8EAA8E;IAC9E,2EAA2E;IAC3E,2EAA2E;IAC3E,2BAA2B;IAC3B,4EAA4E;IAC5E,4EAA4E;IAC5E,0CAA0C;IAC1C,EAAE;IACF,qEAAqE;IACrE,qBAAqB;IACrB,IAAI,MAAM,KAAK,qBAAqB,EAAE,CAAC;QACrC,OAAO,CACL,GAAG,OAAO,CAAC,OAAO,wEAAwE;YAC1F,0EAA0E,OAAO,CAAC,YAAY,GAAG;YACjG,2EAA2E;YAC3E,6FAA6F,CAC9F,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Platform } from "./resolve-platform.js";
|
|
2
|
+
/**
|
|
3
|
+
* The platform of the client in `dir`, or null when `dir` is not a client.
|
|
4
|
+
* The ONE definition of the template signals — the AGENTS.md client listing
|
|
5
|
+
* and the both-platforms predicate read it, so they cannot drift.
|
|
6
|
+
*/
|
|
7
|
+
export declare function detectClientPlatform(dir: string): Platform | null;
|
|
8
|
+
/**
|
|
9
|
+
* Every platform already present under `projectRoot`, counting a client that
|
|
10
|
+
* IS the root. Deduplicated, in canonical order.
|
|
11
|
+
*/
|
|
12
|
+
export declare function discoverClientPlatforms(projectRoot: string): Platform[];
|
|
13
|
+
/** Whether the app ends up with an iOS client AND a web client. */
|
|
14
|
+
export declare function appHasBothPlatforms(planned: Platform[], discovered: Platform[]): boolean;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which client platforms an app HAS — the ones this run scaffolds plus the
|
|
3
|
+
* ones already in the repository (#2982).
|
|
4
|
+
*
|
|
5
|
+
* An app with both an iOS and a web client gets the universal-link wiring: the
|
|
6
|
+
* emailed sign-in link becomes the web deployment's https callback, which
|
|
7
|
+
* opens the installed app and still signs in from any browser. So "does this
|
|
8
|
+
* app have both?" decides whether init seeds a `webUrl` and prints the
|
|
9
|
+
* activation checklist.
|
|
10
|
+
*
|
|
11
|
+
* The existing clients are found by the signals the templates ship — a Swift
|
|
12
|
+
* package or Xcode project, a Vite project — so a `functions/` directory with
|
|
13
|
+
* a `package.json` is not mistaken for a client. They are looked for in child
|
|
14
|
+
* directories AND at the project root: `primitive init` still produces the
|
|
15
|
+
* flat single-client layout where the client IS the repository root, and
|
|
16
|
+
* adding the second platform to such a repository is exactly the case this
|
|
17
|
+
* feature exists for (DSO-2982-013).
|
|
18
|
+
*/
|
|
19
|
+
import { existsSync, readdirSync } from "fs";
|
|
20
|
+
import { join } from "path";
|
|
21
|
+
/**
|
|
22
|
+
* The platform of the client in `dir`, or null when `dir` is not a client.
|
|
23
|
+
* The ONE definition of the template signals — the AGENTS.md client listing
|
|
24
|
+
* and the both-platforms predicate read it, so they cannot drift.
|
|
25
|
+
*/
|
|
26
|
+
export function detectClientPlatform(dir) {
|
|
27
|
+
let hasXcodeProject = false;
|
|
28
|
+
try {
|
|
29
|
+
hasXcodeProject = readdirSync(dir).some((name) => name.endsWith(".xcodeproj"));
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
if (existsSync(join(dir, "Package.swift")) || hasXcodeProject)
|
|
35
|
+
return "ios";
|
|
36
|
+
if (existsSync(join(dir, "package.json")) && existsSync(join(dir, "vite.config.ts"))) {
|
|
37
|
+
return "web";
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Every platform already present under `projectRoot`, counting a client that
|
|
43
|
+
* IS the root. Deduplicated, in canonical order.
|
|
44
|
+
*/
|
|
45
|
+
export function discoverClientPlatforms(projectRoot) {
|
|
46
|
+
const found = new Set();
|
|
47
|
+
const atRoot = detectClientPlatform(projectRoot);
|
|
48
|
+
if (atRoot)
|
|
49
|
+
found.add(atRoot);
|
|
50
|
+
let entries;
|
|
51
|
+
try {
|
|
52
|
+
entries = readdirSync(projectRoot, { withFileTypes: true });
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
entries = [];
|
|
56
|
+
}
|
|
57
|
+
for (const entry of entries) {
|
|
58
|
+
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
59
|
+
continue;
|
|
60
|
+
const platform = detectClientPlatform(join(projectRoot, entry.name));
|
|
61
|
+
if (platform)
|
|
62
|
+
found.add(platform);
|
|
63
|
+
}
|
|
64
|
+
return ["web", "ios"].filter((platform) => found.has(platform));
|
|
65
|
+
}
|
|
66
|
+
/** Whether the app ends up with an iOS client AND a web client. */
|
|
67
|
+
export function appHasBothPlatforms(planned, discovered) {
|
|
68
|
+
const platforms = new Set([...planned, ...discovered]);
|
|
69
|
+
return platforms.has("ios") && platforms.has("web");
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=init-client-platforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-client-platforms.js","sourceRoot":"","sources":["../../../src/lib/init-client-platforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,IAAI,CAAC;QACH,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;IACjF,CAAC;IAAC,MAAM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,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,mBAAmB,CACjC,OAAmB,EACnB,UAAsB;IAEtB,MAAM,SAAS,GAAG,IAAI,GAAG,CAAW,CAAC,GAAG,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC;IACjE,OAAO,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether init may add a sign-in callback to an app's magic-link allow-list,
|
|
3
|
+
* and what to write (#2982).
|
|
4
|
+
*
|
|
5
|
+
* A combined iOS + web app emails ONE https link — the web app's
|
|
6
|
+
* `/oauth/callback` — and the server matches that target against
|
|
7
|
+
* `emailRedirectUris` fail-closed. So init only points an environment's
|
|
8
|
+
* `webUrl` at a dev origin whose callback the app actually allows; otherwise it
|
|
9
|
+
* would flip a working code-only email into a request that 400s.
|
|
10
|
+
*
|
|
11
|
+
* A brand-new app is seeded with `http://localhost:5173/oauth/callback` at
|
|
12
|
+
* creation, and the dev-port step merges the chosen port's callback — but an
|
|
13
|
+
* app adopted with `--use-existing-app-id` on the default port has been through
|
|
14
|
+
* neither, and its allow-list is whatever it already was.
|
|
15
|
+
*
|
|
16
|
+
* The one thing this must never do is NARROW that list. An app with no
|
|
17
|
+
* `emailRedirectUris` attribute still behaves by the pre-#2891 app-wide
|
|
18
|
+
* `redirectUris`, and writing a fresh single-entry list would silently replace
|
|
19
|
+
* that fallback with our callback — breaking magic-link sign-in for whichever
|
|
20
|
+
* client was relying on it. An explicitly empty list is a deliberate "reject
|
|
21
|
+
* everything" for the same reason. Both are left alone, and init falls back to
|
|
22
|
+
* printing the manual step.
|
|
23
|
+
*/
|
|
24
|
+
export type EmailRedirectUriMerge = {
|
|
25
|
+
action: "already-listed";
|
|
26
|
+
} | {
|
|
27
|
+
action: "merge";
|
|
28
|
+
uris: string[];
|
|
29
|
+
} | {
|
|
30
|
+
action: "leave-alone";
|
|
31
|
+
reason: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Decide what to do with `existing` (the app's `emailRedirectUris` as the
|
|
35
|
+
* settings API reports it) to make `callbackUri` an allowed target.
|
|
36
|
+
*/
|
|
37
|
+
export declare function planEmailRedirectUriMerge(existing: unknown, callbackUri: string): EmailRedirectUriMerge;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether init may add a sign-in callback to an app's magic-link allow-list,
|
|
3
|
+
* and what to write (#2982).
|
|
4
|
+
*
|
|
5
|
+
* A combined iOS + web app emails ONE https link — the web app's
|
|
6
|
+
* `/oauth/callback` — and the server matches that target against
|
|
7
|
+
* `emailRedirectUris` fail-closed. So init only points an environment's
|
|
8
|
+
* `webUrl` at a dev origin whose callback the app actually allows; otherwise it
|
|
9
|
+
* would flip a working code-only email into a request that 400s.
|
|
10
|
+
*
|
|
11
|
+
* A brand-new app is seeded with `http://localhost:5173/oauth/callback` at
|
|
12
|
+
* creation, and the dev-port step merges the chosen port's callback — but an
|
|
13
|
+
* app adopted with `--use-existing-app-id` on the default port has been through
|
|
14
|
+
* neither, and its allow-list is whatever it already was.
|
|
15
|
+
*
|
|
16
|
+
* The one thing this must never do is NARROW that list. An app with no
|
|
17
|
+
* `emailRedirectUris` attribute still behaves by the pre-#2891 app-wide
|
|
18
|
+
* `redirectUris`, and writing a fresh single-entry list would silently replace
|
|
19
|
+
* that fallback with our callback — breaking magic-link sign-in for whichever
|
|
20
|
+
* client was relying on it. An explicitly empty list is a deliberate "reject
|
|
21
|
+
* everything" for the same reason. Both are left alone, and init falls back to
|
|
22
|
+
* printing the manual step.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Decide what to do with `existing` (the app's `emailRedirectUris` as the
|
|
26
|
+
* settings API reports it) to make `callbackUri` an allowed target.
|
|
27
|
+
*/
|
|
28
|
+
export function planEmailRedirectUriMerge(existing, callbackUri) {
|
|
29
|
+
if (!Array.isArray(existing)) {
|
|
30
|
+
return {
|
|
31
|
+
action: "leave-alone",
|
|
32
|
+
reason: "this app has no emailRedirectUris list of its own, and writing one would replace the allow-list it behaves by today",
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const uris = existing.filter((value) => typeof value === "string");
|
|
36
|
+
if (uris.length === 0) {
|
|
37
|
+
return {
|
|
38
|
+
action: "leave-alone",
|
|
39
|
+
reason: "this app's emailRedirectUris list is empty, which is a deliberate 'reject every link target'",
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (uris.includes(callbackUri))
|
|
43
|
+
return { action: "already-listed" };
|
|
44
|
+
return { action: "merge", uris: [...uris, callbackUri] };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=init-email-redirect-uris.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-email-redirect-uris.js","sourceRoot":"","sources":["../../../src/lib/init-email-redirect-uris.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAiB,EACjB,WAAmB;IAEnB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,OAAO;YACL,MAAM,EAAE,aAAa;YACrB,MAAM,EACJ,qHAAqH;SACxH,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC;IACpF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO;YACL,MAAM,EAAE,aAAa;YACrB,MAAM,EACJ,8FAA8F;SACjG,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;IACpE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,WAAW,CAAC,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -29,6 +29,20 @@ export interface StampResult {
|
|
|
29
29
|
* serializer would drop them.
|
|
30
30
|
*/
|
|
31
31
|
export declare function stampCallbackScheme(clientDir: string, scheme: string): StampResult;
|
|
32
|
+
/**
|
|
33
|
+
* How to point an environment at the app's web origin — in the shape that
|
|
34
|
+
* actually works (#2982).
|
|
35
|
+
*
|
|
36
|
+
* `primitive env add` CREATES an environment: it requires `--api-url` and
|
|
37
|
+
* refuses a name the config already has. Every environment anyone reads this
|
|
38
|
+
* about already exists (init wrote `dev`; `prod` was added when the app was
|
|
39
|
+
* deployed), so the instruction for those has to be the file, which is also
|
|
40
|
+
* what the docs describe as the way to edit one. The flag is worth naming only
|
|
41
|
+
* where a new environment is being created.
|
|
42
|
+
*
|
|
43
|
+
* `origin` is the placeholder or real origin to show.
|
|
44
|
+
*/
|
|
45
|
+
export declare function setWebUrlInstruction(origin: string, indent?: string): string[];
|
|
32
46
|
/**
|
|
33
47
|
* What init prints about email sign-in on the iOS path: it already works, and
|
|
34
48
|
* this is the one opt-in that adds the link.
|
|
@@ -46,5 +60,31 @@ export declare function stampCallbackScheme(clientDir: string, scheme: string):
|
|
|
46
60
|
export declare function linkOptInGuidance(scheme: string, options?: {
|
|
47
61
|
registered?: boolean;
|
|
48
62
|
}): string[];
|
|
63
|
+
/**
|
|
64
|
+
* What init prints for an app with BOTH clients: the emailed sign-in link is
|
|
65
|
+
* already the web app's https callback, and this is what it takes to make that
|
|
66
|
+
* link open the iOS app in production (#2982).
|
|
67
|
+
*
|
|
68
|
+
* Everything here is a post-deploy step by necessity — the production web
|
|
69
|
+
* domain does not exist at init time, and the deploy script never learns the
|
|
70
|
+
* URL it deployed to. The order is load-bearing: the `applinks:` entitlement
|
|
71
|
+
* is the ONLY thing that makes Apple fetch the association document, and
|
|
72
|
+
* Apple's CDN caches what it gets, so it goes last — after the deployed
|
|
73
|
+
* document has been verified.
|
|
74
|
+
*
|
|
75
|
+
* `webOrigin` is the dev origin the run seeded — set only when the run also
|
|
76
|
+
* confirmed that origin's `/oauth/callback` is on the app's allow-list, since
|
|
77
|
+
* that is what makes the seeded link work.
|
|
78
|
+
*
|
|
79
|
+
* `unverifiedDevCallback` is the opposite case: a combined app whose allow-list
|
|
80
|
+
* this run could not vouch for (an adopted app, or no credentials to ask with).
|
|
81
|
+
* Nothing was seeded — the app keeps its working code-only email — and the two
|
|
82
|
+
* steps that turn the link on are printed instead. Neither is set for an
|
|
83
|
+
* adopting run, which does not own the project config at all.
|
|
84
|
+
*/
|
|
85
|
+
export declare function universalLinkGuidance(options?: {
|
|
86
|
+
webOrigin?: string;
|
|
87
|
+
unverifiedDevCallback?: string;
|
|
88
|
+
}): string[];
|
|
49
89
|
/** What init says when the template predates the `PrimitiveAuth` URL type. */
|
|
50
90
|
export declare function missingUrlTypeGuidance(scheme: string): string[];
|