primitive-admin 1.1.0-alpha.43 → 1.1.0-alpha.45
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/README.md +2 -2
- package/dist/bin/primitive.js +0 -0
- package/dist/src/commands/blob-buckets.js +20 -7
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/catalog.js +3 -3
- package/dist/src/commands/catalog.js.map +1 -1
- package/dist/src/commands/databases.js +3 -3
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/guides.d.ts +86 -0
- package/dist/src/commands/guides.js +222 -41
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/integrations.js +2 -2
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/prompts.js +2 -2
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/sync.d.ts +23 -3
- package/dist/src/commands/sync.js +370 -121
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/workflows.js +191 -26
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +1 -0
- package/dist/src/lib/api-client.js +4 -0
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/block-layout.js +5 -5
- package/dist/src/lib/block-layout.js.map +1 -1
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +61 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +127 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
- package/dist/src/lib/config-toml.d.ts +10 -0
- package/dist/src/lib/config-toml.js +42 -0
- package/dist/src/lib/config-toml.js.map +1 -0
- package/dist/src/lib/constants.d.ts +9 -0
- package/dist/src/lib/constants.js +9 -0
- package/dist/src/lib/constants.js.map +1 -1
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +35 -7
- package/dist/src/lib/db-codegen/dbGenerator.js +384 -125
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +29 -0
- package/dist/src/lib/db-codegen/dbNaming.js +58 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +114 -5
- package/dist/src/lib/db-codegen/dbTemplates.js +163 -16
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +7 -3
- package/dist/src/lib/db-codegen/dbTsTypes.js +23 -1
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/generated-allowlist.js +14 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/init-config.js +2 -2
- package/dist/src/lib/init-config.js.map +1 -1
- package/dist/src/lib/toml-database-config.d.ts +10 -39
- package/dist/src/lib/toml-database-config.js +16 -82
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-metadata-config.d.ts +1 -1
- package/dist/src/lib/toml-metadata-config.js +3 -3
- package/dist/src/lib/toml-metadata-config.js.map +1 -1
- package/dist/src/lib/toml-native-form.d.ts +46 -0
- package/dist/src/lib/toml-native-form.js +78 -0
- package/dist/src/lib/toml-native-form.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +96 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +112 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +70 -0
- package/dist/src/lib/workflow-codegen/generator.js +186 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
- package/dist/src/lib/workflow-codegen/naming.js +81 -0
- package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +55 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js +237 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/workflow-fragments.js +3 -3
- package/dist/src/lib/workflow-fragments.js.map +1 -1
- package/dist/src/lib/workflow-toml-validator.d.ts +1 -1
- package/dist/src/lib/workflow-toml-validator.js +1 -1
- package/dist/src/validators.d.ts +4 -3
- package/dist/src/validators.js +6 -5
- package/dist/src/validators.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a TOML source string with a TOML 1.0-compliant parser.
|
|
3
|
+
* Accepts heterogeneous inline arrays that the old `@iarna` rejected.
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseConfigToml(content: string): Record<string, any>;
|
|
6
|
+
/**
|
|
7
|
+
* Serialize a config object to TOML with a TOML 1.0-compliant serializer.
|
|
8
|
+
* Emits heterogeneous arrays natively instead of falling back to a JSON string.
|
|
9
|
+
*/
|
|
10
|
+
export declare function stringifyConfigToml(data: any): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's single TOML wrapper. Every TOML parse/stringify in the CLI routes
|
|
3
|
+
* through here — config files (database-type configs, workflows, collection-type
|
|
4
|
+
* configs, v2 block configs) and non-config files alike (app.toml, prompts,
|
|
5
|
+
* integrations, cron triggers, webhooks, rule-sets, codegen, ...).
|
|
6
|
+
*
|
|
7
|
+
* Config files can carry **heterogeneous arrays**: a settings-gated pipeline
|
|
8
|
+
* produces a CEL step-reference string next to a filter object, e.g.
|
|
9
|
+
* `"$and" = ["$steps.settings.first.peerVisible", { status = "approved" }]`.
|
|
10
|
+
* TOML 1.0.0 permits heterogeneous arrays; the previous library `@iarna`
|
|
11
|
+
* targeted TOML 0.5 and threw on them in **both** directions (`stringify` and
|
|
12
|
+
* `parse`). `smol-toml` is TOML 1.0-compliant and round-trips them, so #1450
|
|
13
|
+
* swapped the config paths and #1464 finished the migration — moving every
|
|
14
|
+
* remaining site here and removing `@iarna` entirely. Keeping one library
|
|
15
|
+
* means one set of parser semantics to reason about.
|
|
16
|
+
*
|
|
17
|
+
* Behavioral notes for the smol-toml swap (measured against `@iarna@2.2.5`):
|
|
18
|
+
* every divergence is a loud error, never silent value drift. smol throws on
|
|
19
|
+
* integers beyond 2^53 (`@iarna` returned a BigInt that then broke
|
|
20
|
+
* `JSON.stringify` on push), rejects control characters in comments (TOML 1.0
|
|
21
|
+
* ban), and throws on stringifying an array containing `null` (`@iarna`
|
|
22
|
+
* silently dropped it). `null`/`undefined` data-loss guards live in
|
|
23
|
+
* `canEmitNative` (`toml-database-config.ts`), not here. `smol` re-emits with
|
|
24
|
+
* slightly different formatting (`[]` not `[ ]`, no array-of-tables indent) —
|
|
25
|
+
* a one-time reformat on the next `pull`.
|
|
26
|
+
*/
|
|
27
|
+
import * as smolToml from "smol-toml";
|
|
28
|
+
/**
|
|
29
|
+
* Parse a TOML source string with a TOML 1.0-compliant parser.
|
|
30
|
+
* Accepts heterogeneous inline arrays that the old `@iarna` rejected.
|
|
31
|
+
*/
|
|
32
|
+
export function parseConfigToml(content) {
|
|
33
|
+
return smolToml.parse(content);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Serialize a config object to TOML with a TOML 1.0-compliant serializer.
|
|
37
|
+
* Emits heterogeneous arrays natively instead of falling back to a JSON string.
|
|
38
|
+
*/
|
|
39
|
+
export function stringifyConfigToml(data) {
|
|
40
|
+
return smolToml.stringify(data);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=config-toml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-toml.js","sourceRoot":"","sources":["../../../src/lib/config-toml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,OAAO,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAwB,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAS;IAC3C,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
export declare const PRODUCTION_SERVER_URL = "https://primitiveapi.com";
|
|
2
2
|
export declare const DEFAULT_SERVER_URL: string;
|
|
3
|
+
/**
|
|
4
|
+
* The alpha deployment's canonical server URL. Mirrors
|
|
5
|
+
* `wrangler.toml [env.alpha] WORKER_URL` — keep the two in sync; if the alpha
|
|
6
|
+
* URL ever changes, update both. Used only by `primitive guides` to detect the
|
|
7
|
+
* alpha target and fetch guides from the `primitive-docs` `next` branch instead
|
|
8
|
+
* of `main` (issue #1463). This is an internal-only convenience;
|
|
9
|
+
* security-through-obscurity is acceptable.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ALPHA_SERVER_URL = "https://js-bao-wss-alpha.primitive-labs-dev.workers.dev";
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
export const PRODUCTION_SERVER_URL = "https://primitiveapi.com";
|
|
2
2
|
export const DEFAULT_SERVER_URL = process.env.PRIMITIVE_SERVER_URL || PRODUCTION_SERVER_URL;
|
|
3
|
+
/**
|
|
4
|
+
* The alpha deployment's canonical server URL. Mirrors
|
|
5
|
+
* `wrangler.toml [env.alpha] WORKER_URL` — keep the two in sync; if the alpha
|
|
6
|
+
* URL ever changes, update both. Used only by `primitive guides` to detect the
|
|
7
|
+
* alpha target and fetch guides from the `primitive-docs` `next` branch instead
|
|
8
|
+
* of `main` (issue #1463). This is an internal-only convenience;
|
|
9
|
+
* security-through-obscurity is acceptable.
|
|
10
|
+
*/
|
|
11
|
+
export const ALPHA_SERVER_URL = "https://js-bao-wss-alpha.primitive-labs-dev.workers.dev";
|
|
3
12
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAC7B,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAC7B,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,qBAAqB,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,yDAAyD,CAAC"}
|
|
@@ -13,9 +13,13 @@
|
|
|
13
13
|
* - The banner + fingerprint header pattern and stale-output cleanup.
|
|
14
14
|
*
|
|
15
15
|
* Adds the OPERATIONS half (op-params interfaces + per-op result aliases)
|
|
16
|
-
* that codegen-v2 has no analog for.
|
|
17
|
-
* the
|
|
16
|
+
* that codegen-v2 has no analog for. A result alias is derived from `op.type`
|
|
17
|
+
* and, where the shape is derivable, the op's parsed `definition`: a query op's
|
|
18
|
+
* `projection` (#1439), a mutation op's step kinds (#1438), and a pipeline op's
|
|
19
|
+
* `return` step (#1437). This file resolves those into the small descriptors
|
|
20
|
+
* the templates consume; the templates stay pure string-emitters.
|
|
18
21
|
*/
|
|
22
|
+
import { type GeneratedFileMismatch } from "../codegen-shared/generatedFiles.js";
|
|
19
23
|
export interface DbCodegenInput {
|
|
20
24
|
/** Database type name (drives the output filename). */
|
|
21
25
|
databaseType: string;
|
|
@@ -53,15 +57,37 @@ export interface DbCodegenResult {
|
|
|
53
57
|
/** Only populated under `--check`: files whose on-disk content is out of date. */
|
|
54
58
|
mismatches: DbCheckMismatch[];
|
|
55
59
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Re-exported from the shared generated-file module so existing importers keep
|
|
62
|
+
* a stable type. The write/`--check`/cleanup lifecycle now lives in
|
|
63
|
+
* `codegen-shared/generatedFiles.ts` (shared with `workflows codegen`).
|
|
64
|
+
*/
|
|
65
|
+
export type DbCheckMismatch = GeneratedFileMismatch;
|
|
60
66
|
/**
|
|
61
67
|
* Render the in-memory `.generated.ts` content for a single database-type
|
|
62
68
|
* TOML. Exported so tests can assert on the rendered string directly.
|
|
63
69
|
*/
|
|
64
70
|
export declare function renderDbTypeFile(input: DbCodegenInput): string;
|
|
71
|
+
/**
|
|
72
|
+
* Infer the scalar element TS type for op params consumed by a `$in`/`$nin`
|
|
73
|
+
* filter operator (#1488, Phase 1). Codegen-only: a param compared with
|
|
74
|
+
* `$in`/`$nin` against a model field is definitionally an array, so the
|
|
75
|
+
* typed-ops factory (#1441) should emit `<elem>[]` rather than widening an
|
|
76
|
+
* untyped/object param to `Record<string, unknown>` (which `string[]` is not
|
|
77
|
+
* assignable to).
|
|
78
|
+
*
|
|
79
|
+
* Kept a small local helper next to {@link inferRequiredRecordFields} rather
|
|
80
|
+
* than a shared cross-runtime analysis pass (sponsor decision on #1488).
|
|
81
|
+
*
|
|
82
|
+
* Returns a map of param name → element TS type. The `"unknown"` sentinel means
|
|
83
|
+
* "emit `unknown[]`" — used when the compared field is missing from the model
|
|
84
|
+
* schema (or the op has no resolvable model), when the same param is bound to
|
|
85
|
+
* fields of differing element types, or when the param is also used as a scalar
|
|
86
|
+
* elsewhere (conservative widen, mirroring #845's disagreement rule / #1488
|
|
87
|
+
* Fork 4). A param absent from the map is not consumed by any array operator
|
|
88
|
+
* and keeps its declared-type mapping (inference never widens such a param).
|
|
89
|
+
*/
|
|
90
|
+
export declare function inferArrayParamElementTypes(op: any, fieldTypesByModel: Map<string, Map<string, string>>): Map<string, string>;
|
|
65
91
|
/**
|
|
66
92
|
* Per-model result of {@link inferRequiredRecordFields}. Shaped as an object
|
|
67
93
|
* (rather than a bare `Set`) so it can grow additional inferred metadata later
|
|
@@ -106,6 +132,8 @@ export interface InferredRecordModelInfo {
|
|
|
106
132
|
*/
|
|
107
133
|
export declare function inferRequiredRecordFields(operations: any[]): Map<string, InferredRecordModelInfo>;
|
|
108
134
|
/**
|
|
109
|
-
* Run codegen end-to-end across one or more database-type TOML inputs.
|
|
135
|
+
* Run codegen end-to-end across one or more database-type TOML inputs. The
|
|
136
|
+
* disk lifecycle (write / `--check` / stale cleanup) is delegated to the
|
|
137
|
+
* shared `writeOrCheckGeneratedFiles` (shared with `workflows codegen`).
|
|
110
138
|
*/
|
|
111
139
|
export declare function generateDbTypes(options: GenerateDbTypesOptions): Promise<DbCodegenResult>;
|