primitive-admin 1.2.0-alpha.11 → 1.2.0-alpha.13
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/agent-sessions.d.ts +26 -10
- package/dist/src/commands/agent-sessions.js +80 -83
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/init.js +108 -34
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/locks.d.ts +5 -3
- package/dist/src/commands/locks.js +17 -61
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +1 -1
- package/dist/src/commands/rule-sets.js +0 -1
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/sync.d.ts +28 -0
- package/dist/src/commands/sync.js +255 -70
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +6 -4
- package/dist/src/lib/api-client.js +4 -14
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/config-object-descriptor.js +1 -0
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +13 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js +13 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db3-type-models.d.ts +92 -0
- package/dist/src/lib/db3-type-models.js +321 -0
- package/dist/src/lib/db3-type-models.js.map +1 -0
- package/dist/src/lib/function-db-types.d.ts +3 -1
- package/dist/src/lib/function-db-types.js +42 -8
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-typecheck.js +3 -0
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +19 -2
- package/dist/src/lib/generated-config-surfaces.js +38 -3
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/init-assets.d.ts +2 -6
- package/dist/src/lib/init-assets.js +11 -27
- package/dist/src/lib/init-assets.js.map +1 -1
- package/dist/src/lib/init-ios-links.d.ts +11 -7
- package/dist/src/lib/init-ios-links.js +28 -22
- package/dist/src/lib/init-ios-links.js.map +1 -1
- package/dist/src/lib/init-schema.d.ts +15 -0
- package/dist/src/lib/init-schema.js +54 -0
- package/dist/src/lib/init-schema.js.map +1 -1
- package/dist/src/lib/session-scope.d.ts +26 -0
- package/dist/src/lib/session-scope.js +58 -0
- package/dist/src/lib/session-scope.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +54 -0
- package/dist/src/lib/sync-resource-types.js +92 -1
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/template.d.ts +39 -3
- package/dist/src/lib/template.js +103 -14
- package/dist/src/lib/template.js.map +1 -1
- 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,
|
|
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,6mncAA6mnc,CAAC"}
|
|
@@ -18,12 +18,6 @@ export declare function platformLabel(platform: Platform): string;
|
|
|
18
18
|
* file is the cheapest place for a reader to find that rule.
|
|
19
19
|
*/
|
|
20
20
|
export declare const CANONICAL_SCHEMA_HEADER = "# The model schema for this app \u2014 ONE copy, shared by every client.\n#\n# The TOML keys here are the wire field names, so a second copy that drifts\n# orphans the other one's records. Every client reads THIS file:\n# - the web client's codegen input points at it, and its generated barrel\n# imports it directly\n# - the Swift client names it in `bao-codegen.json` beside its sources\n# Add or change a model here, then re-run each client's codegen.\n";
|
|
21
|
-
/**
|
|
22
|
-
* A starter schema for the rare composition that has no template starter to
|
|
23
|
-
* adopt. The scaffolded clients normally supply their own, which is what a
|
|
24
|
-
* composed repo promotes to the root.
|
|
25
|
-
*/
|
|
26
|
-
export declare const FALLBACK_STARTER_SCHEMA = "[models.user_prefs.fields.id]\ntype = \"id\"\nauto_assign = true\nindexed = true\nrequired = true\n\n[models.user_prefs.fields.key]\ntype = \"string\"\nindexed = true\nunique = true\n\n[models.user_prefs.fields.value]\ntype = \"string\"\n";
|
|
27
21
|
/**
|
|
28
22
|
* The app-wide `AGENTS.md` for a repository with several clients.
|
|
29
23
|
*
|
|
@@ -36,4 +30,6 @@ export declare function rootAgentsMarkdown(input: {
|
|
|
36
30
|
platform: Platform;
|
|
37
31
|
dir: string;
|
|
38
32
|
}>;
|
|
33
|
+
/** Whether the repository has `models/models.toml`; the layout names it only then. */
|
|
34
|
+
schema?: boolean;
|
|
39
35
|
}): string;
|
|
@@ -18,25 +18,6 @@ export const CANONICAL_SCHEMA_HEADER = `# The model schema for this app — ONE
|
|
|
18
18
|
# - the Swift client names it in \`bao-codegen.json\` beside its sources
|
|
19
19
|
# Add or change a model here, then re-run each client's codegen.
|
|
20
20
|
`;
|
|
21
|
-
/**
|
|
22
|
-
* A starter schema for the rare composition that has no template starter to
|
|
23
|
-
* adopt. The scaffolded clients normally supply their own, which is what a
|
|
24
|
-
* composed repo promotes to the root.
|
|
25
|
-
*/
|
|
26
|
-
export const FALLBACK_STARTER_SCHEMA = `[models.user_prefs.fields.id]
|
|
27
|
-
type = "id"
|
|
28
|
-
auto_assign = true
|
|
29
|
-
indexed = true
|
|
30
|
-
required = true
|
|
31
|
-
|
|
32
|
-
[models.user_prefs.fields.key]
|
|
33
|
-
type = "string"
|
|
34
|
-
indexed = true
|
|
35
|
-
unique = true
|
|
36
|
-
|
|
37
|
-
[models.user_prefs.fields.value]
|
|
38
|
-
type = "string"
|
|
39
|
-
`;
|
|
40
21
|
/**
|
|
41
22
|
* The app-wide `AGENTS.md` for a repository with several clients.
|
|
42
23
|
*
|
|
@@ -44,13 +25,20 @@ type = "string"
|
|
|
44
25
|
* own file is never replaced by init.
|
|
45
26
|
*/
|
|
46
27
|
export function rootAgentsMarkdown(input) {
|
|
28
|
+
const schema = input.schema ?? true;
|
|
47
29
|
const rows = input.clients
|
|
48
30
|
.map((client) => `- \`${client.dir}/\` — ${platformLabel(client.platform)} client`)
|
|
49
31
|
.join("\n");
|
|
32
|
+
const schemaRow = schema
|
|
33
|
+
? `- \`models/models.toml\` — the model schema. ONE copy: its keys are the wire
|
|
34
|
+
field names, so a second copy that drifts orphans the other's records. Each
|
|
35
|
+
client's codegen reads this file in place; never copy it into a client.
|
|
36
|
+
`
|
|
37
|
+
: "";
|
|
50
38
|
return `# ${input.appName}
|
|
51
39
|
|
|
52
40
|
One Primitive app, several clients. The app is the shared thing: one app ID,
|
|
53
|
-
one set of environments, one exported server config, one model schema. Each
|
|
41
|
+
one set of environments, one exported server config${schema ? ", one model schema" : ""}. Each
|
|
54
42
|
client is an independent project in its own directory — there is no workspace
|
|
55
43
|
file and no root \`package.json\`.
|
|
56
44
|
|
|
@@ -61,10 +49,7 @@ file and no root \`package.json\`.
|
|
|
61
49
|
- \`primitive/<env>/\` — the exported server config (workflows,
|
|
62
50
|
database type configs, app settings) that \`primitive config diff\` and
|
|
63
51
|
\`primitive config push\` read and write.
|
|
64
|
-
|
|
65
|
-
field names, so a second copy that drifts orphans the other's records. Each
|
|
66
|
-
client's codegen reads this file in place; never copy it into a client.
|
|
67
|
-
${rows}
|
|
52
|
+
${schemaRow}${rows}
|
|
68
53
|
|
|
69
54
|
## Per app vs per client
|
|
70
55
|
|
|
@@ -72,8 +57,7 @@ ${rows}
|
|
|
72
57
|
| --- | --- |
|
|
73
58
|
| Environments and app ID | Generated code |
|
|
74
59
|
| Exported server config | Dependencies and build config |
|
|
75
|
-
| Model schema | Runtime connection settings |
|
|
76
|
-
| Secrets | Deploy configuration |
|
|
60
|
+
${schema ? "| Model schema | Runtime connection settings |\n| Secrets | Deploy configuration |" : "| Secrets | Runtime connection settings |\n| — | Deploy configuration |"}
|
|
77
61
|
| — | Its own \`AGENTS.md\` |
|
|
78
62
|
|
|
79
63
|
## Running commands
|
|
@@ -90,7 +74,7 @@ primitive init <dir> --platform <web|ios>
|
|
|
90
74
|
\`\`\`
|
|
91
75
|
|
|
92
76
|
Run from inside this repository, that adds a client to THIS app: it reuses this
|
|
93
|
-
config, wires the new client to \`models/models.toml\`, and creates no second
|
|
77
|
+
config, ${schema ? "wires the new client to \`models/models.toml\`, " : ""}and creates no second
|
|
94
78
|
\`.primitive/\` and no second git repository.
|
|
95
79
|
`;
|
|
96
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-assets.js","sourceRoot":"","sources":["../../../src/lib/init-assets.ts"],"names":[],"mappings":"AAWA,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAAC,QAAkB;IAC9C,OAAO,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;CAQtC,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"init-assets.js","sourceRoot":"","sources":["../../../src/lib/init-assets.ts"],"names":[],"mappings":"AAWA,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAAC,QAAkB;IAC9C,OAAO,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;CAQtC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAKlC;IACC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;IACpC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO;SACvB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,MAAM,CAAC,GAAG,SAAS,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;SAClF,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,MAAM,SAAS,GAAG,MAAM;QACtB,CAAC,CAAC;;;CAGL;QACG,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,KAAK,KAAK,CAAC,OAAO;;;qDAG0B,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;EAWrF,SAAS,GAAG,IAAI;;;;;;;;EAQhB,MAAM,CAAC,CAAC,CAAC,oFAAoF,CAAC,CAAC,CAAC,yEAAyE;;;;;;;;;;;;;;;;;UAiBjK,MAAM,CAAC,CAAC,CAAC,kDAAkD,CAAC,CAAC,CAAC,EAAE;;CAEzE,CAAC;AACF,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `CFBundleURLName` the
|
|
3
|
-
* breaks the manager's scheme resolution, so it is pinned by a test that reads
|
|
4
|
-
* both files.
|
|
2
|
+
* The `CFBundleURLName` of the template's URL type: the entry init stamps.
|
|
5
3
|
*/
|
|
6
4
|
export declare const PRIMITIVE_AUTH_URL_TYPE_NAME = "PrimitiveAuth";
|
|
7
|
-
/** The
|
|
5
|
+
/** The template's shipped scheme — reserved, never a derived result. */
|
|
8
6
|
export declare const FALLBACK_CALLBACK_SCHEME = "primitiveapp";
|
|
9
7
|
/**
|
|
10
8
|
* The custom URL scheme for one scaffolded client: a readable prefix from the
|
|
@@ -14,8 +12,13 @@ export declare const FALLBACK_CALLBACK_SCHEME = "primitiveapp";
|
|
|
14
12
|
* share a scheme, whatever they are called.
|
|
15
13
|
*/
|
|
16
14
|
export declare function deriveCallbackScheme(appName: string, appId: string, clientDirName?: string): string;
|
|
17
|
-
/**
|
|
18
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The scheme callback an emailed sign-in link lands on, for one scheme: the
|
|
17
|
+
* value of the `PrimitiveOAuthRedirectURI` key, and the allow-list entry.
|
|
18
|
+
*/
|
|
19
|
+
export declare function iosSchemeCallbackUri(scheme: string): string;
|
|
20
|
+
/** The Info.plist key the template reads its `oauthRedirectUri` from. */
|
|
21
|
+
export declare const OAUTH_REDIRECT_URI_PLIST_KEY = "PrimitiveOAuthRedirectURI";
|
|
19
22
|
export interface StampResult {
|
|
20
23
|
/** `not-found` when the plist predates the `PrimitiveAuth` URL type. */
|
|
21
24
|
outcome: "stamped" | "already" | "not-found";
|
|
@@ -46,7 +49,8 @@ export declare function stampCallbackScheme(clientDir: string, scheme: string):
|
|
|
46
49
|
export declare function setWebUrlInstruction(origin: string, indent?: string): string[];
|
|
47
50
|
/**
|
|
48
51
|
* What init prints about email sign-in on the iOS path: it already works, and
|
|
49
|
-
* this is the
|
|
52
|
+
* this is the opt-in that adds a scheme link — an allow-list entry and one
|
|
53
|
+
* Info.plist key, no source edit.
|
|
50
54
|
*
|
|
51
55
|
* The allow-list step is phrased as a MERGE into the existing array — `app.toml`
|
|
52
56
|
* is the whole app-settings truth on push (#2880), so a replacement array would
|
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The iOS app's own URL scheme, and the documented opt-in that turns the
|
|
3
|
-
* sign-in email's LINK on (#2969).
|
|
3
|
+
* sign-in email's LINK on (#2969, #4930).
|
|
4
4
|
*
|
|
5
5
|
* The Swift template registers one custom URL scheme, under the
|
|
6
|
-
* `PrimitiveAuth` URL-type name that `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* scheme in its place.
|
|
6
|
+
* `PrimitiveAuth` URL-type name. Shipped, that scheme is `primitiveapp` —
|
|
7
|
+
* which every app scaffolded from the template would otherwise share, making
|
|
8
|
+
* iOS link routing between two of them on one device ambiguous. So init
|
|
9
|
+
* stamps an app-unique scheme in its place.
|
|
11
10
|
*
|
|
12
11
|
* The suffix is the WHOLE app ID, not a tail or a hash of it: app IDs are
|
|
13
12
|
* 26-character ULIDs, and any fixed-width squeeze of them is many-to-one — two
|
|
14
13
|
* distinct apps could still be handed the same scheme, which is the failure
|
|
15
14
|
* this stamping exists to prevent.
|
|
16
15
|
*
|
|
17
|
-
* Init writes no app settings here. Email sign-in works out of the box
|
|
18
|
-
* the
|
|
19
|
-
* code alone and the allow-list is not consulted at
|
|
20
|
-
* the developer's opt-in — one allow-list entry
|
|
21
|
-
*
|
|
16
|
+
* Init writes no app settings here. Email sign-in works out of the box: with
|
|
17
|
+
* no web origin and no `oauthRedirectUri`, the client sends NO redirect target,
|
|
18
|
+
* so the email carries the code alone and the allow-list is not consulted at
|
|
19
|
+
* all. Sending a scheme link is the developer's opt-in — one allow-list entry
|
|
20
|
+
* plus the `PrimitiveOAuthRedirectURI` key in `Info-Partial.plist`, which the
|
|
21
|
+
* template forwards as the client's `oauthRedirectUri` — and init only prints
|
|
22
|
+
* what those are.
|
|
22
23
|
*/
|
|
23
24
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
24
25
|
import { join } from "path";
|
|
25
26
|
/**
|
|
26
|
-
* The `CFBundleURLName` the
|
|
27
|
-
* breaks the manager's scheme resolution, so it is pinned by a test that reads
|
|
28
|
-
* both files.
|
|
27
|
+
* The `CFBundleURLName` of the template's URL type: the entry init stamps.
|
|
29
28
|
*/
|
|
30
29
|
export const PRIMITIVE_AUTH_URL_TYPE_NAME = "PrimitiveAuth";
|
|
31
|
-
/** The
|
|
30
|
+
/** The template's shipped scheme — reserved, never a derived result. */
|
|
32
31
|
export const FALLBACK_CALLBACK_SCHEME = "primitiveapp";
|
|
33
32
|
/** How much of the app name survives into the readable prefix. */
|
|
34
33
|
const PREFIX_MAX_LENGTH = 20;
|
|
@@ -63,10 +62,15 @@ export function deriveCallbackScheme(appName, appId, clientDirName) {
|
|
|
63
62
|
// what a derived one must never collide with.
|
|
64
63
|
return scheme === FALLBACK_CALLBACK_SCHEME ? `${scheme}-app` : scheme;
|
|
65
64
|
}
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
/**
|
|
66
|
+
* The scheme callback an emailed sign-in link lands on, for one scheme: the
|
|
67
|
+
* value of the `PrimitiveOAuthRedirectURI` key, and the allow-list entry.
|
|
68
|
+
*/
|
|
69
|
+
export function iosSchemeCallbackUri(scheme) {
|
|
70
|
+
return `${scheme}://oauth/callback`;
|
|
69
71
|
}
|
|
72
|
+
/** The Info.plist key the template reads its `oauthRedirectUri` from. */
|
|
73
|
+
export const OAUTH_REDIRECT_URI_PLIST_KEY = "PrimitiveOAuthRedirectURI";
|
|
70
74
|
/**
|
|
71
75
|
* Replaces the scheme registered under the `PrimitiveAuth` URL type in a
|
|
72
76
|
* scaffolded client's `Info-Partial.plist`.
|
|
@@ -132,7 +136,8 @@ export function setWebUrlInstruction(origin, indent = " ") {
|
|
|
132
136
|
}
|
|
133
137
|
/**
|
|
134
138
|
* What init prints about email sign-in on the iOS path: it already works, and
|
|
135
|
-
* this is the
|
|
139
|
+
* this is the opt-in that adds a scheme link — an allow-list entry and one
|
|
140
|
+
* Info.plist key, no source edit.
|
|
136
141
|
*
|
|
137
142
|
* The allow-list step is phrased as a MERGE into the existing array — `app.toml`
|
|
138
143
|
* is the whole app-settings truth on push (#2880), so a replacement array would
|
|
@@ -146,7 +151,7 @@ export function setWebUrlInstruction(origin, indent = " ") {
|
|
|
146
151
|
*/
|
|
147
152
|
export function linkOptInGuidance(scheme, options = {}) {
|
|
148
153
|
const registered = options.registered !== false;
|
|
149
|
-
const redirectUri =
|
|
154
|
+
const redirectUri = iosSchemeCallbackUri(scheme);
|
|
150
155
|
return [
|
|
151
156
|
"Email sign-in works now: the email carries a 6-digit code and needs no app settings.",
|
|
152
157
|
"When this app gets a web client, prefer the https link: set the environment's `webUrl` —",
|
|
@@ -155,8 +160,9 @@ export function linkOptInGuidance(scheme, options = {}) {
|
|
|
155
160
|
" app where it is installed and signs in through the browser anywhere else.",
|
|
156
161
|
`Until then, to ALSO send a sign-in link that opens this app, add "${redirectUri}" to the existing`,
|
|
157
162
|
" [auth].emailRedirectUris array in config/app.toml (merge it in — run",
|
|
158
|
-
" `primitive config pull --only app` first if that file is not there yet),
|
|
159
|
-
|
|
163
|
+
" `primitive config pull --only app` first if that file is not there yet), run",
|
|
164
|
+
` \`primitive config push --only app\`, and add the ${OAUTH_REDIRECT_URI_PLIST_KEY} key to`,
|
|
165
|
+
` Info-Partial.plist with the value "${redirectUri}".`,
|
|
160
166
|
registered
|
|
161
167
|
? "The scheme registration and the link routing are already in this client."
|
|
162
168
|
: `The scheme "${scheme}" is NOT registered in this client yet — register it first (see`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-ios-links.js","sourceRoot":"","sources":["../../../src/lib/init-ios-links.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"init-ios-links.js","sourceRoot":"","sources":["../../../src/lib/init-ios-links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAE5D,wEAAwE;AACxE,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAEvD,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,yEAAyE;AACzE,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,SAAS,cAAc,CAAC,KAAyB,EAAE,SAAiB;IAClE,MAAM,SAAS,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,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FAAmF;QACnF,gEAAgE;KACjE,CAAC;AACJ,CAAC"}
|
|
@@ -11,6 +11,21 @@ export declare function relativeSchemaPath(fromDir: string, toFile: string): str
|
|
|
11
11
|
* none (the Swift starter is comment-only but the file is still there).
|
|
12
12
|
*/
|
|
13
13
|
export declare function findClientSchema(clientDir: string, platform: Platform): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Why a root client with no schema where either template keeps one cannot
|
|
16
|
+
* join a composed app, or null when it can: a web client whose codegen script
|
|
17
|
+
* feeds `js-bao-codegen-v2` a schema file that exists keeps it somewhere this
|
|
18
|
+
* run does not recognize. A client that reads no schema file joins with
|
|
19
|
+
* nothing moved (#4929).
|
|
20
|
+
*/
|
|
21
|
+
export declare function misplacedClientSchema(clientDir: string): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Whether a Swift client reads no schema at all: no `Models/models.toml` in its
|
|
24
|
+
* target, and a `bao-codegen.json` that names no input (`"input": null`, how the
|
|
25
|
+
* Swift template ships since it stopped carrying a data model, #4930). Pointing
|
|
26
|
+
* such a client at the app's schema moves nothing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function swiftClientNamesNoSchema(clientDir: string): boolean;
|
|
14
29
|
/** The Swift target's source directory (`Sources/<AppName>`), if there is one. */
|
|
15
30
|
export declare function findSwiftTargetDir(clientDir: string): string | null;
|
|
16
31
|
/**
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
* Every function here reports what it changed rather than throwing on a shape
|
|
21
21
|
* it does not recognize, so a caller can say precisely what it did and did not
|
|
22
22
|
* rewire.
|
|
23
|
+
*
|
|
24
|
+
* A web client with no `src/models/models.toml` (the template since the
|
|
25
|
+
* fold-in, #4929, which generates its models from `primitive/<env>/db3-types/`)
|
|
26
|
+
* reads no schema, so it has nothing to check and nothing to wire.
|
|
23
27
|
*/
|
|
24
28
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync, } from "fs";
|
|
25
29
|
import { createHash } from "crypto";
|
|
@@ -52,6 +56,29 @@ export function findClientSchema(clientDir, platform) {
|
|
|
52
56
|
}
|
|
53
57
|
return findSwiftSchema(clientDir);
|
|
54
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Why a root client with no schema where either template keeps one cannot
|
|
61
|
+
* join a composed app, or null when it can: a web client whose codegen script
|
|
62
|
+
* feeds `js-bao-codegen-v2` a schema file that exists keeps it somewhere this
|
|
63
|
+
* run does not recognize. A client that reads no schema file joins with
|
|
64
|
+
* nothing moved (#4929).
|
|
65
|
+
*/
|
|
66
|
+
export function misplacedClientSchema(clientDir) {
|
|
67
|
+
const packageJsonPath = join(clientDir, "package.json");
|
|
68
|
+
if (!existsSync(packageJsonPath))
|
|
69
|
+
return null;
|
|
70
|
+
let codegen;
|
|
71
|
+
try {
|
|
72
|
+
codegen = JSON.parse(readFileSync(packageJsonPath, "utf-8")).scripts?.codegen;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const input = typeof codegen === "string" ? codegen.match(/js-bao-codegen-v2\b[^&|;]*?\s-i\s+(\S+)/)?.[1] : null;
|
|
78
|
+
return input && existsSync(join(clientDir, input))
|
|
79
|
+
? `${packageJsonPath}'s codegen script reads ${input}`
|
|
80
|
+
: null;
|
|
81
|
+
}
|
|
55
82
|
/** `Sources/<AppName>/Models/models.toml`, whatever the app is called. */
|
|
56
83
|
function findSwiftSchema(clientDir) {
|
|
57
84
|
const sources = join(clientDir, "Sources");
|
|
@@ -69,6 +96,29 @@ function findSwiftSchema(clientDir) {
|
|
|
69
96
|
}
|
|
70
97
|
return null;
|
|
71
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Whether a Swift client reads no schema at all: no `Models/models.toml` in its
|
|
101
|
+
* target, and a `bao-codegen.json` that names no input (`"input": null`, how the
|
|
102
|
+
* Swift template ships since it stopped carrying a data model, #4930). Pointing
|
|
103
|
+
* such a client at the app's schema moves nothing.
|
|
104
|
+
*/
|
|
105
|
+
export function swiftClientNamesNoSchema(clientDir) {
|
|
106
|
+
if (findSwiftSchema(clientDir))
|
|
107
|
+
return false;
|
|
108
|
+
const targetDir = findSwiftTargetDir(clientDir);
|
|
109
|
+
if (!targetDir)
|
|
110
|
+
return false;
|
|
111
|
+
const configPath = join(targetDir, "bao-codegen.json");
|
|
112
|
+
if (!existsSync(configPath))
|
|
113
|
+
return false;
|
|
114
|
+
try {
|
|
115
|
+
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
116
|
+
return config !== null && typeof config === "object" && (config.input ?? null) === null;
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
72
122
|
/** The Swift target's source directory (`Sources/<AppName>`), if there is one. */
|
|
73
123
|
export function findSwiftTargetDir(clientDir) {
|
|
74
124
|
const schema = findSwiftSchema(clientDir);
|
|
@@ -189,6 +239,8 @@ export function checkClientWiring(clientDir, platform, schemaPath) {
|
|
|
189
239
|
: checkSwiftWiring(clientDir, schemaPath);
|
|
190
240
|
}
|
|
191
241
|
function checkWebWiring(clientDir, schemaPath) {
|
|
242
|
+
if (!existsSync(join(clientDir, WEB_SCHEMA_RELATIVE)))
|
|
243
|
+
return null;
|
|
192
244
|
const packageJsonPath = join(clientDir, "package.json");
|
|
193
245
|
if (!existsSync(packageJsonPath)) {
|
|
194
246
|
return `no package.json in ${clientDir}`;
|
|
@@ -235,6 +287,8 @@ function checkSwiftWiring(clientDir, schemaPath) {
|
|
|
235
287
|
return null;
|
|
236
288
|
}
|
|
237
289
|
function wireWebClient(clientDir, schemaPath) {
|
|
290
|
+
if (!existsSync(join(clientDir, WEB_SCHEMA_RELATIVE)))
|
|
291
|
+
return { rewired: [] };
|
|
238
292
|
const rewired = [];
|
|
239
293
|
const packageJsonPath = join(clientDir, "package.json");
|
|
240
294
|
// The codegen input: `-i src/models/models.toml` -> `-i ../models/models.toml`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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,CAC1F,CAAC;YACF,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;gBAC3B,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBACvC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IAED,4EAA4E;IAC5E,4EAA4E;IAC5E,wEAAwE;IACxE,EAAE;IACF,2EAA2E;IAC3E,wEAAwE;IACxE,6EAA6E;IAC7E,wCAAwC;IACxC,MAAM,WAAW,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IAC/C,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CACV,GAAG,iBAAiB,CAClB,SAAS,EACT,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,EAChC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAChC,CACF,CAAC;IACJ,CAAC;IAED,IAAI,OAA2B,CAAC;IAChC,IAAI,WAAW,IAAI,WAAW,KAAK,UAAU,EAAE,CAAC;QAC9C,MAAM,CAAC,WAAW,CAAC,CAAC;QACpB,OAAO,GAAG,WAAW,CAAC;IACxB,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB,EAAE,OAAe;IACtE,IAAI,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,KAAK,CAAC;IACzC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Credentials } from "../types/index.js";
|
|
2
|
+
/** The app a request is for, and its parent: a pin on either reaches it. */
|
|
3
|
+
export interface ScopeTarget {
|
|
4
|
+
appId: string;
|
|
5
|
+
parentAppId?: string | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Whether a token holding `held` (undefined: unscoped, every scope) and
|
|
9
|
+
* pinned to `apps` can use `scope` on an app route of `target`, as the
|
|
10
|
+
* server's reach check decides: a pinned token reaches only its pinned apps
|
|
11
|
+
* and their children, and an unpinned token holding `admin` reaches only
|
|
12
|
+
* platform routes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function tokenReachesScope(token: {
|
|
15
|
+
scope?: unknown;
|
|
16
|
+
apps?: unknown;
|
|
17
|
+
}, scope: string, target: ScopeTarget): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether `credentials` can use `scope` on `target`: the login's own token
|
|
20
|
+
* can (a token with no `scope` claim is unscoped and holds every scope), or
|
|
21
|
+
* an unexpired step-up stored beside it can, as the API client retries a
|
|
22
|
+
* request refused for `admin` with that step-up. Either must also reach the
|
|
23
|
+
* app ({@link tokenReachesScope}). Null when the login's token has no claims
|
|
24
|
+
* to read (an opaque CI token) and no step-up can.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sessionHoldsScope(credentials: Credentials, scope: string, target: ScopeTarget, now?: number): boolean | null;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the stored admin session holds a scope, read from its token's
|
|
3
|
+
* claims and the step-up stored beside it, with no request. The server is the
|
|
4
|
+
* judge of every request; this lets a command refuse up front what the server
|
|
5
|
+
* would refuse partway through.
|
|
6
|
+
*/
|
|
7
|
+
import { isCiToken } from "./session-id.js";
|
|
8
|
+
function claimsOf(token) {
|
|
9
|
+
try {
|
|
10
|
+
const payload = JSON.parse(Buffer.from(token.split(".")[1] ?? "", "base64url").toString("utf-8"));
|
|
11
|
+
return payload && typeof payload === "object" ? payload : null;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Whether a token holding `held` (undefined: unscoped, every scope) and
|
|
19
|
+
* pinned to `apps` can use `scope` on an app route of `target`, as the
|
|
20
|
+
* server's reach check decides: a pinned token reaches only its pinned apps
|
|
21
|
+
* and their children, and an unpinned token holding `admin` reaches only
|
|
22
|
+
* platform routes.
|
|
23
|
+
*/
|
|
24
|
+
export function tokenReachesScope(token, scope, target) {
|
|
25
|
+
if (token.scope === undefined)
|
|
26
|
+
return true;
|
|
27
|
+
const held = Array.isArray(token.scope) ? token.scope : [];
|
|
28
|
+
if (!held.includes(scope))
|
|
29
|
+
return false;
|
|
30
|
+
const apps = Array.isArray(token.apps) ? token.apps : [];
|
|
31
|
+
if (apps.length === 0)
|
|
32
|
+
return !held.includes("admin");
|
|
33
|
+
return (apps.includes(target.appId) ||
|
|
34
|
+
(!!target.parentAppId && apps.includes(target.parentAppId)));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether `credentials` can use `scope` on `target`: the login's own token
|
|
38
|
+
* can (a token with no `scope` claim is unscoped and holds every scope), or
|
|
39
|
+
* an unexpired step-up stored beside it can, as the API client retries a
|
|
40
|
+
* request refused for `admin` with that step-up. Either must also reach the
|
|
41
|
+
* app ({@link tokenReachesScope}). Null when the login's token has no claims
|
|
42
|
+
* to read (an opaque CI token) and no step-up can.
|
|
43
|
+
*/
|
|
44
|
+
export function sessionHoldsScope(credentials, scope, target, now = Date.now()) {
|
|
45
|
+
const stepUp = credentials.stepUp;
|
|
46
|
+
if (stepUp &&
|
|
47
|
+
new Date(stepUp.expiresAt).getTime() > now &&
|
|
48
|
+
tokenReachesScope(stepUp, scope, target)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
if (isCiToken(credentials.accessToken))
|
|
52
|
+
return null;
|
|
53
|
+
const claims = claimsOf(credentials.accessToken);
|
|
54
|
+
if (!claims)
|
|
55
|
+
return null;
|
|
56
|
+
return tokenReachesScope(claims, scope, target);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=session-scope.js.map
|
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CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAC5D,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,WAAwB,EACxB,KAAa,EACb,MAAmB,EACnB,MAAc,IAAI,CAAC,GAAG,EAAE;IAExB,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAClC,IACE,MAAM;QACN,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,GAAG;QAC1C,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,EACxC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IACpD,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACjD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -360,6 +360,12 @@ export interface PushPruneSpec {
|
|
|
360
360
|
* fail-safe no shipped spec uses since #2762 wired the last one.
|
|
361
361
|
*/
|
|
362
362
|
deleteEntity: ((client: ApiClient, appId: string, address: string) => Promise<void>) | null;
|
|
363
|
+
/**
|
|
364
|
+
* The delete is a hard delete (`?hard=true`), which needs the `admin` scope;
|
|
365
|
+
* a session without it is refused before the push applies anything
|
|
366
|
+
* ({@link pruneAdminScopeRefusal}).
|
|
367
|
+
*/
|
|
368
|
+
deleteNeedsAdmin?: boolean;
|
|
363
369
|
/**
|
|
364
370
|
* A consequence of deleting this type the prune plan must state before the
|
|
365
371
|
* operator confirms — printed under the item's "will delete" line, in
|
|
@@ -481,6 +487,10 @@ export type PushPruneDecision =
|
|
|
481
487
|
* live `modifiedAt` matches prior state (or under `--force`). A 404 means the
|
|
482
488
|
* work is already done (drop the stale state). Any other read failure, a missing
|
|
483
489
|
* address, or a type without a delete surface leaves everything untouched.
|
|
490
|
+
*
|
|
491
|
+
* An archived row is still pending deletion, whatever its `modifiedAt`: it
|
|
492
|
+
* keeps its key, and archiving is what moved the timestamp. Status is
|
|
493
|
+
* server-owned and not in TOML, so the move is not drift.
|
|
484
494
|
*/
|
|
485
495
|
export declare function decidePushPruneCandidate(input: {
|
|
486
496
|
spec: PushPruneSpec;
|
|
@@ -489,6 +499,28 @@ export declare function decidePushPruneCandidate(input: {
|
|
|
489
499
|
fetch: PushPruneFetch;
|
|
490
500
|
force: boolean;
|
|
491
501
|
}): PushPruneDecision;
|
|
502
|
+
/** One candidate of a push-prune plan and what to do with it. */
|
|
503
|
+
export interface PushPrunePlanItem {
|
|
504
|
+
spec: PushPruneSpec;
|
|
505
|
+
key: string;
|
|
506
|
+
entry: any;
|
|
507
|
+
address?: string;
|
|
508
|
+
decision: PushPruneDecision;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Plan a push-prune over `specs`: every prior-state key no local file declares
|
|
512
|
+
* and `includes` selects, each confirmed by a point read and decided by
|
|
513
|
+
* {@link decidePushPruneCandidate}. Reads only.
|
|
514
|
+
*/
|
|
515
|
+
export declare function planPushPrune(input: {
|
|
516
|
+
specs: readonly PushPruneSpec[];
|
|
517
|
+
configDir: string;
|
|
518
|
+
entities: Record<string, any> | undefined;
|
|
519
|
+
includes: (label: string, key: string) => boolean;
|
|
520
|
+
client: ApiClient;
|
|
521
|
+
appId: string;
|
|
522
|
+
force: boolean;
|
|
523
|
+
}): Promise<PushPrunePlanItem[]>;
|
|
492
524
|
/**
|
|
493
525
|
* What a failed prune DELETE call means for the entity's sync-state slot.
|
|
494
526
|
*
|
|
@@ -530,6 +562,28 @@ export declare function formatPrunePlan(items: Array<{
|
|
|
530
562
|
key: string;
|
|
531
563
|
decision: PushPruneDecision;
|
|
532
564
|
}>): PrunePlanLine[];
|
|
565
|
+
/** The step-up a prune's hard deletes need, valid for 15 minutes. */
|
|
566
|
+
export declare const PRUNE_STEP_UP_COMMAND = "primitive login --step-up --scope write,admin";
|
|
567
|
+
/**
|
|
568
|
+
* The refusal for a prune plan that hard-deletes, from a session without the
|
|
569
|
+
* `admin` scope: it names each hard delete, the missing scope and the step-up.
|
|
570
|
+
* A candidate whose point read failed is named too: the plan `config push`
|
|
571
|
+
* rebuilds after applying could find it and delete it. Null when the plan
|
|
572
|
+
* deletes nothing that needs `admin`. `config push` checks it before applying
|
|
573
|
+
* anything, so the push does not land halfway and then have its deletes
|
|
574
|
+
* refused one by one.
|
|
575
|
+
*/
|
|
576
|
+
export declare function pruneAdminScopeRefusal(items: Array<{
|
|
577
|
+
spec: PushPruneSpec;
|
|
578
|
+
key: string;
|
|
579
|
+
decision: PushPruneDecision;
|
|
580
|
+
}>): string | null;
|
|
581
|
+
/**
|
|
582
|
+
* The refusal for a prune plan that hard-deletes when the session's scope
|
|
583
|
+
* could not be read: the push stops rather than assume `admin` and apply
|
|
584
|
+
* everything else before the deletes are refused.
|
|
585
|
+
*/
|
|
586
|
+
export declare function pruneScopeUnknownRefusal(reason: string): string;
|
|
533
587
|
/**
|
|
534
588
|
* Remove a pruned block's sidecar `<key>.tests/` directory and its
|
|
535
589
|
* `entities.testCases` state records. The main file is already gone (that is
|