primitive-admin 1.1.0-alpha.4 → 1.1.0-alpha.41
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 +325 -31
- package/assets/skill/skills/primitive-platform/SKILL.md +281 -0
- package/dist/bin/primitive.d.ts +2 -0
- package/dist/bin/primitive.js +268 -16
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.d.ts +2 -0
- package/dist/src/commands/admins.js +123 -18
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/analytics.d.ts +2 -0
- package/dist/src/commands/analytics.js +464 -55
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps.d.ts +2 -0
- package/dist/src/commands/apps.js +55 -13
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth.d.ts +2 -0
- package/dist/src/commands/auth.js +177 -7
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.d.ts +2 -0
- package/dist/src/commands/blob-buckets.js +422 -0
- package/dist/src/commands/blob-buckets.js.map +1 -0
- package/dist/src/commands/catalog.d.ts +2 -0
- package/dist/src/commands/catalog.js +34 -35
- package/dist/src/commands/catalog.js.map +1 -1
- package/dist/src/commands/collection-type-configs.d.ts +2 -0
- package/dist/src/commands/collection-type-configs.js +178 -0
- package/dist/src/commands/collection-type-configs.js.map +1 -0
- package/dist/src/commands/collections.d.ts +2 -0
- package/dist/src/commands/collections.js +515 -0
- package/dist/src/commands/collections.js.map +1 -0
- package/dist/src/commands/comparisons.d.ts +2 -0
- package/dist/src/commands/comparisons.js +6 -6
- package/dist/src/commands/comparisons.js.map +1 -1
- package/dist/src/commands/cron-triggers.d.ts +2 -0
- package/dist/src/commands/cron-triggers.js +357 -0
- package/dist/src/commands/cron-triggers.js.map +1 -0
- package/dist/src/commands/database-types.d.ts +2 -0
- package/dist/src/commands/database-types.js +471 -0
- package/dist/src/commands/database-types.js.map +1 -0
- package/dist/src/commands/databases.d.ts +2 -0
- package/dist/src/commands/databases.js +1462 -83
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +2 -0
- package/dist/src/commands/documents.js +518 -11
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.d.ts +2 -0
- package/dist/src/commands/email-templates.js +281 -0
- package/dist/src/commands/email-templates.js.map +1 -0
- package/dist/src/commands/env.d.ts +12 -0
- package/dist/src/commands/env.js +260 -0
- package/dist/src/commands/env.js.map +1 -0
- package/dist/src/commands/group-type-configs.d.ts +2 -0
- package/dist/src/commands/group-type-configs.js +181 -0
- package/dist/src/commands/group-type-configs.js.map +1 -0
- package/dist/src/commands/groups.d.ts +2 -0
- package/dist/src/commands/groups.js +48 -45
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.d.ts +159 -0
- package/dist/src/commands/guides.js +449 -35
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/init.d.ts +17 -0
- package/dist/src/commands/init.js +811 -201
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.d.ts +2 -0
- package/dist/src/commands/integrations.js +533 -46
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/llm.d.ts +2 -0
- package/dist/src/commands/llm.js +4 -2
- package/dist/src/commands/llm.js.map +1 -1
- package/dist/src/commands/metadata.d.ts +2 -0
- package/dist/src/commands/metadata.js +194 -0
- package/dist/src/commands/metadata.js.map +1 -0
- package/dist/src/commands/prompts.d.ts +2 -0
- package/dist/src/commands/prompts.js +50 -52
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +3 -0
- package/dist/src/commands/rule-sets.js +388 -0
- package/dist/src/commands/rule-sets.js.map +1 -0
- package/dist/src/commands/scripts.d.ts +2 -0
- package/dist/src/commands/scripts.js +667 -0
- package/dist/src/commands/scripts.js.map +1 -0
- package/dist/src/commands/secrets.d.ts +2 -0
- package/dist/src/commands/secrets.js +108 -0
- package/dist/src/commands/secrets.js.map +1 -0
- package/dist/src/commands/skill.d.ts +2 -0
- package/dist/src/commands/skill.js +29 -0
- package/dist/src/commands/skill.js.map +1 -0
- package/dist/src/commands/sync.d.ts +175 -0
- package/dist/src/commands/sync.js +4412 -233
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.d.ts +2 -0
- package/dist/src/commands/tokens.js +122 -19
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/users.d.ts +2 -0
- package/dist/src/commands/users.js +440 -22
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/waitlist.d.ts +2 -0
- package/dist/src/commands/waitlist.js +10 -10
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/webhooks.d.ts +2 -0
- package/dist/src/commands/webhooks.js +391 -0
- package/dist/src/commands/webhooks.js.map +1 -0
- package/dist/src/commands/workflows.d.ts +49 -0
- package/dist/src/commands/workflows.js +1009 -123
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +1283 -0
- package/dist/src/lib/api-client.js +1129 -83
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/auth-flow.d.ts +8 -0
- package/dist/src/lib/block-layout.d.ts +160 -0
- package/dist/src/lib/block-layout.js +451 -0
- package/dist/src/lib/block-layout.js.map +1 -0
- package/dist/src/lib/cli-manifest.d.ts +60 -0
- package/dist/src/lib/cli-manifest.js +70 -0
- package/dist/src/lib/cli-manifest.js.map +1 -0
- package/dist/src/lib/config.d.ts +53 -0
- package/dist/src/lib/config.js +92 -53
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/confirm-prompt.d.ts +83 -0
- package/dist/src/lib/confirm-prompt.js +110 -0
- package/dist/src/lib/confirm-prompt.js.map +1 -0
- package/dist/src/lib/constants.d.ts +2 -0
- package/dist/src/lib/constants.js +3 -0
- package/dist/src/lib/constants.js.map +1 -0
- package/dist/src/lib/crash-handlers.d.ts +20 -0
- package/dist/src/lib/crash-handlers.js +49 -0
- package/dist/src/lib/crash-handlers.js.map +1 -0
- package/dist/src/lib/credentials-store.d.ts +79 -0
- package/dist/src/lib/credentials-store.js +307 -0
- package/dist/src/lib/credentials-store.js.map +1 -0
- package/dist/src/lib/csv.d.ts +48 -0
- package/dist/src/lib/csv.js +177 -0
- package/dist/src/lib/csv.js.map +1 -0
- package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
- package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
- package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +111 -0
- package/dist/src/lib/db-codegen/dbGenerator.js +371 -0
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/db-codegen/dbNaming.d.ts +45 -0
- package/dist/src/lib/db-codegen/dbNaming.js +104 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +97 -0
- package/dist/src/lib/db-codegen/dbTemplates.js +159 -0
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +78 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js +112 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
- package/dist/src/lib/env-resolver.d.ts +62 -0
- package/dist/src/lib/env-resolver.js +121 -0
- package/dist/src/lib/env-resolver.js.map +1 -0
- package/dist/src/lib/fetch.d.ts +5 -0
- package/dist/src/lib/generated-allowlist.d.ts +28 -0
- package/dist/src/lib/generated-allowlist.js +220 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -0
- package/dist/src/lib/init-config.d.ts +59 -0
- package/dist/src/lib/init-config.js +113 -0
- package/dist/src/lib/init-config.js.map +1 -0
- package/dist/src/lib/migration-nag.d.ts +49 -0
- package/dist/src/lib/migration-nag.js +163 -0
- package/dist/src/lib/migration-nag.js.map +1 -0
- package/dist/src/lib/output.d.ts +86 -0
- package/dist/src/lib/output.js +150 -8
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/paginate.d.ts +33 -0
- package/dist/src/lib/paginate.js +42 -0
- package/dist/src/lib/paginate.js.map +1 -0
- package/dist/src/lib/project-config.d.ts +97 -0
- package/dist/src/lib/project-config.js +209 -0
- package/dist/src/lib/project-config.js.map +1 -0
- package/dist/src/lib/query-operators.d.ts +43 -0
- package/dist/src/lib/query-operators.js +80 -0
- package/dist/src/lib/query-operators.js.map +1 -0
- package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
- package/dist/src/lib/refresh-admin-credentials.js +103 -0
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
- package/dist/src/lib/resolve-platform.d.ts +45 -0
- package/dist/src/lib/resolve-platform.js +43 -0
- package/dist/src/lib/resolve-platform.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +23 -0
- package/dist/src/lib/skill-installer.js +135 -0
- package/dist/src/lib/skill-installer.js.map +1 -0
- package/dist/src/lib/snapshots.d.ts +99 -0
- package/dist/src/lib/snapshots.js +357 -0
- package/dist/src/lib/snapshots.js.map +1 -0
- package/dist/src/lib/sync-paths.d.ts +72 -0
- package/dist/src/lib/sync-paths.js +130 -0
- package/dist/src/lib/sync-paths.js.map +1 -0
- package/dist/src/lib/template.d.ts +97 -0
- package/dist/src/lib/template.js +336 -62
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/token-inject.d.ts +56 -0
- package/dist/src/lib/token-inject.js +204 -0
- package/dist/src/lib/token-inject.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +152 -0
- package/dist/src/lib/toml-database-config.js +600 -0
- package/dist/src/lib/toml-database-config.js.map +1 -0
- package/dist/src/lib/toml-metadata-config.d.ts +139 -0
- package/dist/src/lib/toml-metadata-config.js +427 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -0
- package/dist/src/lib/toml-params-validator.d.ts +129 -0
- package/dist/src/lib/toml-params-validator.js +298 -0
- package/dist/src/lib/toml-params-validator.js.map +1 -0
- package/dist/src/lib/version-check.d.ts +10 -0
- package/dist/src/lib/version-check.js +172 -0
- package/dist/src/lib/version-check.js.map +1 -0
- package/dist/src/lib/workflow-apply.d.ts +66 -0
- package/dist/src/lib/workflow-apply.js +117 -0
- package/dist/src/lib/workflow-apply.js.map +1 -0
- package/dist/src/lib/workflow-fragments.d.ts +41 -0
- package/dist/src/lib/workflow-fragments.js +121 -0
- package/dist/src/lib/workflow-fragments.js.map +1 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +95 -0
- package/dist/src/lib/workflow-toml-validator.js +323 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -0
- package/dist/src/types/index.d.ts +520 -0
- package/dist/src/validators.d.ts +64 -0
- package/dist/src/validators.js +63 -0
- package/dist/src/validators.js.map +1 -0
- package/package.json +18 -4
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI TOML parser / validator / serializer for resource-metadata config
|
|
3
|
+
* surfaces (issue #1304, P-B — CLI/TOML config-sync).
|
|
4
|
+
*
|
|
5
|
+
* Two surfaces, mirroring the "config change ships all three surfaces" rule
|
|
6
|
+
* (CLAUDE.md; same shape as the database type-config helpers in
|
|
7
|
+
* `toml-database-config.ts`):
|
|
8
|
+
*
|
|
9
|
+
* 1. `MetadataCategoryConfig` blocks — a per-`{resourceType, category}`
|
|
10
|
+
* typed-schema + read/write-rule definition. These round-trip through
|
|
11
|
+
* `primitive sync push` / `pull` against the P-A REST API
|
|
12
|
+
* (`metadata-categories` CRUD). One file = one category, using a single
|
|
13
|
+
* `[metadataCategoryConfig]` section so the nested `schema.fields.*`
|
|
14
|
+
* tables serialize cleanly and byte-stably.
|
|
15
|
+
*
|
|
16
|
+
* 2. The declared-access manifest (`[metadata]` + `secrets` blocks) that
|
|
17
|
+
* lives on the owning config surfaces (`CollectionTypeConfig` /
|
|
18
|
+
* `DatabaseTypeConfig` / `WorkflowDefinition`). This module provides the
|
|
19
|
+
* TOML *structure* + *validator* + byte-stable round-trip helpers for the
|
|
20
|
+
* manifest so a bad value is rejected with a clear error. Wiring the
|
|
21
|
+
* manifest onto those config models' sync push/pull (which needs a
|
|
22
|
+
* storage field on each model) is P-C's "persist the manifest on owning
|
|
23
|
+
* configs" work — this module ships the parse/validate/serialize the
|
|
24
|
+
* P-C eval-site folding will call, matching how earlier phases shipped a
|
|
25
|
+
* validated mechanism ahead of its live wiring.
|
|
26
|
+
*
|
|
27
|
+
* All functions here are pure and unit-testable (no network, no filesystem).
|
|
28
|
+
* `validate*` functions return an error string (or `null` when valid) rather
|
|
29
|
+
* than throwing, mirroring `validateCategorySchema` server-side.
|
|
30
|
+
*/
|
|
31
|
+
/** The reserved projected category (computed live from a resource's columns).
|
|
32
|
+
* Matches the server's `RESERVED_PROJECTED_CATEGORY`. */
|
|
33
|
+
export declare const RESERVED_CATEGORY = "attrs";
|
|
34
|
+
/** The REST body shape for a category-config upsert (P-A `metadata-categories`). */
|
|
35
|
+
export interface MetadataCategoryConfigInput {
|
|
36
|
+
resourceType: string;
|
|
37
|
+
category: string;
|
|
38
|
+
schema: unknown;
|
|
39
|
+
readRule: string | null;
|
|
40
|
+
writeRule: string | null;
|
|
41
|
+
description: string | null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Normalize a parsed `[metadataCategoryConfig]` TOML section into the REST
|
|
45
|
+
* upsert body. Server-managed fields (`schemaVersion`, `generation`) are never
|
|
46
|
+
* emitted or read here — they'd churn a round-trip.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseMetadataCategoryToml(tomlData: any): MetadataCategoryConfigInput;
|
|
49
|
+
/**
|
|
50
|
+
* Validate a parsed category config (post-{@link parseMetadataCategoryToml}).
|
|
51
|
+
* Returns an error string, or `null` when valid. The server re-validates on
|
|
52
|
+
* write; this is the fast local check so `sync push` fails with a clear
|
|
53
|
+
* message before hitting the network.
|
|
54
|
+
*/
|
|
55
|
+
export declare function validateMetadataCategoryConfig(input: MetadataCategoryConfigInput): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Validate the `schema` block is a well-formed js-bao `FieldOptions` map:
|
|
58
|
+
* `{ fields: { <name>: { type, required?, maxLength?, maxCount?, enum? } } }`.
|
|
59
|
+
* Mirrors the server's `validateCategorySchema`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function validateCategorySchema(schema: unknown): string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Serialize a category config (as returned by the P-A REST API — `schema` is a
|
|
64
|
+
* parsed object) to byte-stable TOML. Only the authored fields are emitted;
|
|
65
|
+
* server-managed `schemaVersion` / `generation` / `appId` / `categoryKey` are
|
|
66
|
+
* dropped so a pull → push → pull cycle is a no-op.
|
|
67
|
+
*
|
|
68
|
+
* Scalars are inserted before `schema` so `@iarna/toml` emits them ahead of
|
|
69
|
+
* the nested `[metadataCategoryConfig.schema.fields.*]` tables.
|
|
70
|
+
*/
|
|
71
|
+
export declare function serializeMetadataCategoryConfig(config: any): string;
|
|
72
|
+
/** The one **server-authenticated** `rootFrom` root — the calling user's id
|
|
73
|
+
* (issue #1362). Unlike the {@link ROOT_CONTEXT_PREFIXES} roots (caller-supplied),
|
|
74
|
+
* `user.userId` binds the authenticated principal, so a rule may read the
|
|
75
|
+
* caller's own metadata (`md.<name>`). Mirrors the server's `CALLER_ROOTFROM`. */
|
|
76
|
+
export declare const CALLER_ROOTFROM = "user.userId";
|
|
77
|
+
/** The target `type` a {@link CALLER_ROOTFROM} path must declare. `user.userId`
|
|
78
|
+
* names a user, so the path must resolve `user`-typed metadata; a mismatched
|
|
79
|
+
* type would silently query `app#<type>#<userId>` for a resource that isn't the
|
|
80
|
+
* user. Mirrors the server's `CALLER_ROOTFROM_TYPE`. */
|
|
81
|
+
export declare const CALLER_ROOTFROM_TYPE = "user";
|
|
82
|
+
/**
|
|
83
|
+
* Validate a path's `rootFrom` value together with its declared target `type`
|
|
84
|
+
* (issue #1362), mirroring the server's `validateRootFromPath`
|
|
85
|
+
* (`src/app-api/helpers/metadata-cel-access.ts`). A `rootFrom` is sound when it
|
|
86
|
+
* is either:
|
|
87
|
+
*
|
|
88
|
+
* - a static dotted **caller-supplied** context path rooted at one of
|
|
89
|
+
* {@link ROOT_CONTEXT_PREFIXES} (`input.*`/`record.*`/`params.*`), with at
|
|
90
|
+
* least two segments; or
|
|
91
|
+
* - exactly {@link CALLER_ROOTFROM} (`user.userId`) — the one
|
|
92
|
+
* **server-authenticated** root — in which case the path must also declare
|
|
93
|
+
* `type = "user"` ({@link CALLER_ROOTFROM_TYPE}).
|
|
94
|
+
*
|
|
95
|
+
* Any other `user.*` path is rejected outright — the caller root is a single
|
|
96
|
+
* special case, not a blanket `user.*` namespace (Fork 1 = A). This is the fast
|
|
97
|
+
* local check so `sync push` fails with a clear message before the network call;
|
|
98
|
+
* the server's `validateRootFromPath` re-validates at persist time. Returns a
|
|
99
|
+
* human-readable reason (worded to follow `metadata.paths."<name>" `), or null
|
|
100
|
+
* when sound.
|
|
101
|
+
*/
|
|
102
|
+
export declare function validateRootFromPath(root: string, type: string | undefined): string | null;
|
|
103
|
+
export interface DeclaredAccessManifest {
|
|
104
|
+
self?: {
|
|
105
|
+
categories: string[];
|
|
106
|
+
};
|
|
107
|
+
paths?: Record<string, {
|
|
108
|
+
from?: string;
|
|
109
|
+
rootFrom?: string;
|
|
110
|
+
via?: string;
|
|
111
|
+
type?: string;
|
|
112
|
+
categories: string[];
|
|
113
|
+
}>;
|
|
114
|
+
secrets?: string[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Read the declared-access manifest out of a parsed config TOML: the top-level
|
|
118
|
+
* `[metadata]` table (self + paths) and the `secrets` array. Returns `null`
|
|
119
|
+
* when neither is present (the config declares no metadata/secrets access).
|
|
120
|
+
*/
|
|
121
|
+
export declare function parseDeclaredAccessManifestToml(tomlData: any): DeclaredAccessManifest | null;
|
|
122
|
+
/**
|
|
123
|
+
* Validate a declared-access manifest structurally. Returns an error string,
|
|
124
|
+
* or `null` when valid. This is the local surface-level check (identifier
|
|
125
|
+
* names, key shape, exactly-one-root per path); the server's
|
|
126
|
+
* `validatePathGraph` still does the deep graph validation (cycles, depth,
|
|
127
|
+
* schema-mismatch) at persist time.
|
|
128
|
+
*/
|
|
129
|
+
export declare function validateDeclaredAccessManifest(manifest: DeclaredAccessManifest | null | undefined): string | null;
|
|
130
|
+
/**
|
|
131
|
+
* Serialize a declared-access manifest into the TOML fragment object that
|
|
132
|
+
* merges into an owning config's TOML data (the caller spreads the returned
|
|
133
|
+
* keys alongside the config's own section). Returns `{}` when empty so a
|
|
134
|
+
* config with no declared access emits nothing (byte-stable).
|
|
135
|
+
*/
|
|
136
|
+
export declare function serializeDeclaredAccessManifest(manifest: DeclaredAccessManifest | null | undefined): {
|
|
137
|
+
metadata?: any;
|
|
138
|
+
secrets?: string[];
|
|
139
|
+
};
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI TOML parser / validator / serializer for resource-metadata config
|
|
3
|
+
* surfaces (issue #1304, P-B — CLI/TOML config-sync).
|
|
4
|
+
*
|
|
5
|
+
* Two surfaces, mirroring the "config change ships all three surfaces" rule
|
|
6
|
+
* (CLAUDE.md; same shape as the database type-config helpers in
|
|
7
|
+
* `toml-database-config.ts`):
|
|
8
|
+
*
|
|
9
|
+
* 1. `MetadataCategoryConfig` blocks — a per-`{resourceType, category}`
|
|
10
|
+
* typed-schema + read/write-rule definition. These round-trip through
|
|
11
|
+
* `primitive sync push` / `pull` against the P-A REST API
|
|
12
|
+
* (`metadata-categories` CRUD). One file = one category, using a single
|
|
13
|
+
* `[metadataCategoryConfig]` section so the nested `schema.fields.*`
|
|
14
|
+
* tables serialize cleanly and byte-stably.
|
|
15
|
+
*
|
|
16
|
+
* 2. The declared-access manifest (`[metadata]` + `secrets` blocks) that
|
|
17
|
+
* lives on the owning config surfaces (`CollectionTypeConfig` /
|
|
18
|
+
* `DatabaseTypeConfig` / `WorkflowDefinition`). This module provides the
|
|
19
|
+
* TOML *structure* + *validator* + byte-stable round-trip helpers for the
|
|
20
|
+
* manifest so a bad value is rejected with a clear error. Wiring the
|
|
21
|
+
* manifest onto those config models' sync push/pull (which needs a
|
|
22
|
+
* storage field on each model) is P-C's "persist the manifest on owning
|
|
23
|
+
* configs" work — this module ships the parse/validate/serialize the
|
|
24
|
+
* P-C eval-site folding will call, matching how earlier phases shipped a
|
|
25
|
+
* validated mechanism ahead of its live wiring.
|
|
26
|
+
*
|
|
27
|
+
* All functions here are pure and unit-testable (no network, no filesystem).
|
|
28
|
+
* `validate*` functions return an error string (or `null` when valid) rather
|
|
29
|
+
* than throwing, mirroring `validateCategorySchema` server-side.
|
|
30
|
+
*/
|
|
31
|
+
import * as TOML from "@iarna/toml";
|
|
32
|
+
/** Identifier-safe name: letters, digits, underscore; not starting with a digit.
|
|
33
|
+
* Matches the server's `METADATA_KEY_PATTERN`. */
|
|
34
|
+
const IDENTIFIER_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
35
|
+
/** The reserved projected category (computed live from a resource's columns).
|
|
36
|
+
* Matches the server's `RESERVED_PROJECTED_CATEGORY`. */
|
|
37
|
+
export const RESERVED_CATEGORY = "attrs";
|
|
38
|
+
/** The subset of js-bao `FieldOptions` field types the metadata schema accepts.
|
|
39
|
+
* Matches the server's `MetadataFieldType`. */
|
|
40
|
+
const METADATA_FIELD_TYPES = new Set([
|
|
41
|
+
"string",
|
|
42
|
+
"number",
|
|
43
|
+
"boolean",
|
|
44
|
+
"date",
|
|
45
|
+
"id",
|
|
46
|
+
"stringset",
|
|
47
|
+
]);
|
|
48
|
+
const CATEGORY_SECTION_KEYS = new Set([
|
|
49
|
+
"resourceType",
|
|
50
|
+
"category",
|
|
51
|
+
"schema",
|
|
52
|
+
"readRule",
|
|
53
|
+
"writeRule",
|
|
54
|
+
"description",
|
|
55
|
+
]);
|
|
56
|
+
/**
|
|
57
|
+
* Normalize a parsed `[metadataCategoryConfig]` TOML section into the REST
|
|
58
|
+
* upsert body. Server-managed fields (`schemaVersion`, `generation`) are never
|
|
59
|
+
* emitted or read here — they'd churn a round-trip.
|
|
60
|
+
*/
|
|
61
|
+
export function parseMetadataCategoryToml(tomlData) {
|
|
62
|
+
const section = (tomlData && tomlData.metadataCategoryConfig) || {};
|
|
63
|
+
return {
|
|
64
|
+
resourceType: section.resourceType,
|
|
65
|
+
category: section.category,
|
|
66
|
+
schema: section.schema,
|
|
67
|
+
readRule: section.readRule ?? null,
|
|
68
|
+
writeRule: section.writeRule ?? null,
|
|
69
|
+
description: section.description ?? null,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate a parsed category config (post-{@link parseMetadataCategoryToml}).
|
|
74
|
+
* Returns an error string, or `null` when valid. The server re-validates on
|
|
75
|
+
* write; this is the fast local check so `sync push` fails with a clear
|
|
76
|
+
* message before hitting the network.
|
|
77
|
+
*/
|
|
78
|
+
export function validateMetadataCategoryConfig(input) {
|
|
79
|
+
if (!input.resourceType || typeof input.resourceType !== "string") {
|
|
80
|
+
return "metadataCategoryConfig.resourceType is required and must be a string";
|
|
81
|
+
}
|
|
82
|
+
if (!IDENTIFIER_PATTERN.test(input.resourceType)) {
|
|
83
|
+
return `metadataCategoryConfig.resourceType "${input.resourceType}" must be identifier-safe (letters, digits, underscore; not starting with a digit)`;
|
|
84
|
+
}
|
|
85
|
+
if (!input.category || typeof input.category !== "string") {
|
|
86
|
+
return "metadataCategoryConfig.category is required and must be a string";
|
|
87
|
+
}
|
|
88
|
+
if (!IDENTIFIER_PATTERN.test(input.category)) {
|
|
89
|
+
return `metadataCategoryConfig.category "${input.category}" must be identifier-safe (letters, digits, underscore; not starting with a digit)`;
|
|
90
|
+
}
|
|
91
|
+
if (input.category === RESERVED_CATEGORY) {
|
|
92
|
+
return `metadataCategoryConfig.category "${RESERVED_CATEGORY}" is reserved (a projected category computed from the resource's own columns) and cannot be defined`;
|
|
93
|
+
}
|
|
94
|
+
if (input.readRule !== null &&
|
|
95
|
+
input.readRule !== undefined &&
|
|
96
|
+
typeof input.readRule !== "string") {
|
|
97
|
+
return "metadataCategoryConfig.readRule must be a string (a CEL expression)";
|
|
98
|
+
}
|
|
99
|
+
if (input.writeRule !== null &&
|
|
100
|
+
input.writeRule !== undefined &&
|
|
101
|
+
typeof input.writeRule !== "string") {
|
|
102
|
+
return "metadataCategoryConfig.writeRule must be a string (a CEL expression)";
|
|
103
|
+
}
|
|
104
|
+
if (input.description !== null &&
|
|
105
|
+
input.description !== undefined &&
|
|
106
|
+
typeof input.description !== "string") {
|
|
107
|
+
return "metadataCategoryConfig.description must be a string";
|
|
108
|
+
}
|
|
109
|
+
return validateCategorySchema(input.schema);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Validate the `schema` block is a well-formed js-bao `FieldOptions` map:
|
|
113
|
+
* `{ fields: { <name>: { type, required?, maxLength?, maxCount?, enum? } } }`.
|
|
114
|
+
* Mirrors the server's `validateCategorySchema`.
|
|
115
|
+
*/
|
|
116
|
+
export function validateCategorySchema(schema) {
|
|
117
|
+
if (schema === null || typeof schema !== "object" || Array.isArray(schema)) {
|
|
118
|
+
return "metadataCategoryConfig.schema must be a table with a 'fields' map";
|
|
119
|
+
}
|
|
120
|
+
const fields = schema.fields;
|
|
121
|
+
if (fields === null || typeof fields !== "object" || Array.isArray(fields)) {
|
|
122
|
+
return "metadataCategoryConfig.schema.fields must be a table";
|
|
123
|
+
}
|
|
124
|
+
// Reject unknown top-level keys under `schema` (only `fields` is meaningful).
|
|
125
|
+
for (const key of Object.keys(schema)) {
|
|
126
|
+
if (key !== "fields") {
|
|
127
|
+
return `metadataCategoryConfig.schema has an unknown key "${key}" (only "fields" is allowed)`;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
for (const [name, def] of Object.entries(fields)) {
|
|
131
|
+
if (!IDENTIFIER_PATTERN.test(name)) {
|
|
132
|
+
return `schema field name "${name}" must be identifier-safe`;
|
|
133
|
+
}
|
|
134
|
+
if (def === null || typeof def !== "object" || Array.isArray(def)) {
|
|
135
|
+
return `schema field "${name}" must be a table with a "type"`;
|
|
136
|
+
}
|
|
137
|
+
const field = def;
|
|
138
|
+
if (typeof field.type !== "string" || !METADATA_FIELD_TYPES.has(field.type)) {
|
|
139
|
+
return `schema field "${name}" has an invalid type (allowed: ${[
|
|
140
|
+
...METADATA_FIELD_TYPES,
|
|
141
|
+
].join(", ")})`;
|
|
142
|
+
}
|
|
143
|
+
if (field.enum !== undefined) {
|
|
144
|
+
if (!Array.isArray(field.enum) ||
|
|
145
|
+
field.enum.some((v) => typeof v !== "string")) {
|
|
146
|
+
return `schema field "${name}" enum must be an array of strings`;
|
|
147
|
+
}
|
|
148
|
+
if (field.type !== "string") {
|
|
149
|
+
return `schema field "${name}" enum is only valid on a "string" field`;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (field.maxLength !== undefined && typeof field.maxLength !== "number") {
|
|
153
|
+
return `schema field "${name}" maxLength must be a number`;
|
|
154
|
+
}
|
|
155
|
+
if (field.maxCount !== undefined && typeof field.maxCount !== "number") {
|
|
156
|
+
return `schema field "${name}" maxCount must be a number`;
|
|
157
|
+
}
|
|
158
|
+
if (field.required !== undefined && typeof field.required !== "boolean") {
|
|
159
|
+
return `schema field "${name}" required must be a boolean`;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Serialize a category config (as returned by the P-A REST API — `schema` is a
|
|
166
|
+
* parsed object) to byte-stable TOML. Only the authored fields are emitted;
|
|
167
|
+
* server-managed `schemaVersion` / `generation` / `appId` / `categoryKey` are
|
|
168
|
+
* dropped so a pull → push → pull cycle is a no-op.
|
|
169
|
+
*
|
|
170
|
+
* Scalars are inserted before `schema` so `@iarna/toml` emits them ahead of
|
|
171
|
+
* the nested `[metadataCategoryConfig.schema.fields.*]` tables.
|
|
172
|
+
*/
|
|
173
|
+
export function serializeMetadataCategoryConfig(config) {
|
|
174
|
+
const section = {
|
|
175
|
+
resourceType: config.resourceType,
|
|
176
|
+
category: config.category,
|
|
177
|
+
};
|
|
178
|
+
if (config.readRule !== null && config.readRule !== undefined) {
|
|
179
|
+
section.readRule = config.readRule;
|
|
180
|
+
}
|
|
181
|
+
if (config.writeRule !== null && config.writeRule !== undefined) {
|
|
182
|
+
section.writeRule = config.writeRule;
|
|
183
|
+
}
|
|
184
|
+
if (config.description !== null &&
|
|
185
|
+
config.description !== undefined &&
|
|
186
|
+
config.description !== "") {
|
|
187
|
+
section.description = config.description;
|
|
188
|
+
}
|
|
189
|
+
// `schema` may arrive as a parsed object (REST) or a JSON string (defensive).
|
|
190
|
+
let schema = config.schema;
|
|
191
|
+
if (typeof schema === "string") {
|
|
192
|
+
try {
|
|
193
|
+
schema = JSON.parse(schema);
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
schema = { fields: {} };
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
section.schema = schema ?? { fields: {} };
|
|
200
|
+
return TOML.stringify({ metadataCategoryConfig: section });
|
|
201
|
+
}
|
|
202
|
+
// --- Declared-access manifest (`[metadata]` + `secrets`) -------------------
|
|
203
|
+
//
|
|
204
|
+
// The manifest that lives on an owning config surface. Shape mirrors the
|
|
205
|
+
// server's `MetadataDeclaration` (`src/app-api/helpers/metadata-cel-access.ts`):
|
|
206
|
+
// metadata.self.categories = ["profile"]
|
|
207
|
+
// [metadata.paths.<name>] from|rootFrom, via, type, categories
|
|
208
|
+
// secrets = ["STRIPE_KEY"]
|
|
209
|
+
/** Root contexts a `rootFrom` path may start at (caller-supplied subjectless
|
|
210
|
+
* contexts). Mirrors the server's `ROOT_CONTEXT_PREFIXES`
|
|
211
|
+
* (`src/app-api/helpers/metadata-cel-access.ts`). */
|
|
212
|
+
const ROOT_CONTEXT_PREFIXES = ["input", "record", "params"];
|
|
213
|
+
/** The one **server-authenticated** `rootFrom` root — the calling user's id
|
|
214
|
+
* (issue #1362). Unlike the {@link ROOT_CONTEXT_PREFIXES} roots (caller-supplied),
|
|
215
|
+
* `user.userId` binds the authenticated principal, so a rule may read the
|
|
216
|
+
* caller's own metadata (`md.<name>`). Mirrors the server's `CALLER_ROOTFROM`. */
|
|
217
|
+
export const CALLER_ROOTFROM = "user.userId";
|
|
218
|
+
/** The target `type` a {@link CALLER_ROOTFROM} path must declare. `user.userId`
|
|
219
|
+
* names a user, so the path must resolve `user`-typed metadata; a mismatched
|
|
220
|
+
* type would silently query `app#<type>#<userId>` for a resource that isn't the
|
|
221
|
+
* user. Mirrors the server's `CALLER_ROOTFROM_TYPE`. */
|
|
222
|
+
export const CALLER_ROOTFROM_TYPE = "user";
|
|
223
|
+
/**
|
|
224
|
+
* Validate a path's `rootFrom` value together with its declared target `type`
|
|
225
|
+
* (issue #1362), mirroring the server's `validateRootFromPath`
|
|
226
|
+
* (`src/app-api/helpers/metadata-cel-access.ts`). A `rootFrom` is sound when it
|
|
227
|
+
* is either:
|
|
228
|
+
*
|
|
229
|
+
* - a static dotted **caller-supplied** context path rooted at one of
|
|
230
|
+
* {@link ROOT_CONTEXT_PREFIXES} (`input.*`/`record.*`/`params.*`), with at
|
|
231
|
+
* least two segments; or
|
|
232
|
+
* - exactly {@link CALLER_ROOTFROM} (`user.userId`) — the one
|
|
233
|
+
* **server-authenticated** root — in which case the path must also declare
|
|
234
|
+
* `type = "user"` ({@link CALLER_ROOTFROM_TYPE}).
|
|
235
|
+
*
|
|
236
|
+
* Any other `user.*` path is rejected outright — the caller root is a single
|
|
237
|
+
* special case, not a blanket `user.*` namespace (Fork 1 = A). This is the fast
|
|
238
|
+
* local check so `sync push` fails with a clear message before the network call;
|
|
239
|
+
* the server's `validateRootFromPath` re-validates at persist time. Returns a
|
|
240
|
+
* human-readable reason (worded to follow `metadata.paths."<name>" `), or null
|
|
241
|
+
* when sound.
|
|
242
|
+
*/
|
|
243
|
+
export function validateRootFromPath(root, type) {
|
|
244
|
+
if (root === CALLER_ROOTFROM) {
|
|
245
|
+
if (type !== CALLER_ROOTFROM_TYPE) {
|
|
246
|
+
return `rootFrom "${CALLER_ROOTFROM}" requires type = "${CALLER_ROOTFROM_TYPE}" (got ${type ? `"${type}"` : "no type"})`;
|
|
247
|
+
}
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
const prefix = root.split(".")[0];
|
|
251
|
+
if (prefix === "user") {
|
|
252
|
+
return `rootFrom "${root}" is not allowed — the only server-authenticated root is "${CALLER_ROOTFROM}"`;
|
|
253
|
+
}
|
|
254
|
+
const segments = root.split(".");
|
|
255
|
+
const isStaticDotted = segments.length >= 1 && segments.every((s) => IDENTIFIER_PATTERN.test(s));
|
|
256
|
+
if (!isStaticDotted ||
|
|
257
|
+
segments.length < 2 ||
|
|
258
|
+
!ROOT_CONTEXT_PREFIXES.includes(prefix)) {
|
|
259
|
+
return `rootFrom "${root}" must be a static dotted context path rooted at ${ROOT_CONTEXT_PREFIXES.join("/")} or "${CALLER_ROOTFROM}"`;
|
|
260
|
+
}
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
const MANIFEST_KEYS = new Set(["self", "paths", "secrets"]);
|
|
264
|
+
const SELF_KEYS = new Set(["categories"]);
|
|
265
|
+
const PATH_KEYS = new Set(["from", "rootFrom", "via", "type", "categories"]);
|
|
266
|
+
/**
|
|
267
|
+
* Read the declared-access manifest out of a parsed config TOML: the top-level
|
|
268
|
+
* `[metadata]` table (self + paths) and the `secrets` array. Returns `null`
|
|
269
|
+
* when neither is present (the config declares no metadata/secrets access).
|
|
270
|
+
*/
|
|
271
|
+
export function parseDeclaredAccessManifestToml(tomlData) {
|
|
272
|
+
const metadata = tomlData?.metadata;
|
|
273
|
+
const secrets = tomlData?.secrets;
|
|
274
|
+
if (metadata === undefined && secrets === undefined)
|
|
275
|
+
return null;
|
|
276
|
+
const manifest = {};
|
|
277
|
+
if (metadata && typeof metadata === "object") {
|
|
278
|
+
if (metadata.self !== undefined) {
|
|
279
|
+
manifest.self = { categories: metadata.self?.categories };
|
|
280
|
+
}
|
|
281
|
+
if (metadata.paths !== undefined) {
|
|
282
|
+
manifest.paths = metadata.paths;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (secrets !== undefined) {
|
|
286
|
+
manifest.secrets = secrets;
|
|
287
|
+
}
|
|
288
|
+
return manifest;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Validate a declared-access manifest structurally. Returns an error string,
|
|
292
|
+
* or `null` when valid. This is the local surface-level check (identifier
|
|
293
|
+
* names, key shape, exactly-one-root per path); the server's
|
|
294
|
+
* `validatePathGraph` still does the deep graph validation (cycles, depth,
|
|
295
|
+
* schema-mismatch) at persist time.
|
|
296
|
+
*/
|
|
297
|
+
export function validateDeclaredAccessManifest(manifest) {
|
|
298
|
+
if (manifest === null || manifest === undefined)
|
|
299
|
+
return null;
|
|
300
|
+
if (typeof manifest !== "object" || Array.isArray(manifest)) {
|
|
301
|
+
return "declared-access manifest must be a table";
|
|
302
|
+
}
|
|
303
|
+
// `self`
|
|
304
|
+
if (manifest.self !== undefined) {
|
|
305
|
+
const self = manifest.self;
|
|
306
|
+
if (self === null || typeof self !== "object" || Array.isArray(self)) {
|
|
307
|
+
return "metadata.self must be a table with a 'categories' array";
|
|
308
|
+
}
|
|
309
|
+
for (const key of Object.keys(self)) {
|
|
310
|
+
if (!SELF_KEYS.has(key)) {
|
|
311
|
+
return `metadata.self has an unknown key "${key}" (only "categories" is allowed)`;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const catError = validateCategoryList(self.categories, "metadata.self");
|
|
315
|
+
if (catError)
|
|
316
|
+
return catError;
|
|
317
|
+
}
|
|
318
|
+
// `paths`
|
|
319
|
+
if (manifest.paths !== undefined) {
|
|
320
|
+
const paths = manifest.paths;
|
|
321
|
+
if (paths === null || typeof paths !== "object" || Array.isArray(paths)) {
|
|
322
|
+
return "metadata.paths must be a table of named path declarations";
|
|
323
|
+
}
|
|
324
|
+
const declaredNodes = new Set(["self", ...Object.keys(paths)]);
|
|
325
|
+
for (const [name, raw] of Object.entries(paths)) {
|
|
326
|
+
if (!IDENTIFIER_PATTERN.test(name)) {
|
|
327
|
+
return `metadata.paths."${name}" name must be identifier-safe`;
|
|
328
|
+
}
|
|
329
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
330
|
+
return `metadata.paths."${name}" must be a table`;
|
|
331
|
+
}
|
|
332
|
+
const p = raw;
|
|
333
|
+
for (const key of Object.keys(p)) {
|
|
334
|
+
if (!PATH_KEYS.has(key)) {
|
|
335
|
+
return `metadata.paths."${name}" has an unknown key "${key}" (allowed: ${[
|
|
336
|
+
...PATH_KEYS,
|
|
337
|
+
].join(", ")})`;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
const hasFrom = typeof p.from === "string" && p.from !== "";
|
|
341
|
+
const hasRoot = typeof p.rootFrom === "string" && p.rootFrom !== "";
|
|
342
|
+
if (hasFrom === hasRoot) {
|
|
343
|
+
return `metadata.paths."${name}" must declare exactly one of "from" or "rootFrom"`;
|
|
344
|
+
}
|
|
345
|
+
if (hasFrom) {
|
|
346
|
+
if (!declaredNodes.has(p.from)) {
|
|
347
|
+
return `metadata.paths."${name}" from "${p.from}" references an undeclared node (must be "self" or another declared path)`;
|
|
348
|
+
}
|
|
349
|
+
if (typeof p.via !== "string" || !p.via.includes(".")) {
|
|
350
|
+
return `metadata.paths."${name}" must declare a "via" of the form "<category>.<key>"`;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
// rootFrom: a caller-supplied static context path
|
|
355
|
+
// (`input.*`/`record.*`/`params.*`) OR the server-authenticated
|
|
356
|
+
// `user.userId` root (which requires `type = "user"`). Mirrors the
|
|
357
|
+
// server's `validateRootFromPath` (issue #1362).
|
|
358
|
+
const rootFrom = p.rootFrom;
|
|
359
|
+
const type = typeof p.type === "string" ? p.type : undefined;
|
|
360
|
+
const rootReason = validateRootFromPath(rootFrom, type);
|
|
361
|
+
if (rootReason) {
|
|
362
|
+
return `metadata.paths."${name}" ${rootReason}`;
|
|
363
|
+
}
|
|
364
|
+
if (p.via !== undefined) {
|
|
365
|
+
return `metadata.paths."${name}" roots at "${rootFrom}" and must not also declare "via"`;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (typeof p.type !== "string" || p.type === "") {
|
|
369
|
+
return `metadata.paths."${name}" must declare a target "type" (the resource type)`;
|
|
370
|
+
}
|
|
371
|
+
const catError = validateCategoryList(p.categories, `metadata.paths."${name}"`);
|
|
372
|
+
if (catError)
|
|
373
|
+
return catError;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// `secrets`
|
|
377
|
+
if (manifest.secrets !== undefined) {
|
|
378
|
+
if (!Array.isArray(manifest.secrets) ||
|
|
379
|
+
manifest.secrets.some((s) => typeof s !== "string")) {
|
|
380
|
+
return "secrets must be an array of secret key names (strings)";
|
|
381
|
+
}
|
|
382
|
+
for (const key of manifest.secrets) {
|
|
383
|
+
if (!IDENTIFIER_PATTERN.test(key)) {
|
|
384
|
+
return `secrets key "${key}" must be identifier-safe`;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
function validateCategoryList(categories, where) {
|
|
391
|
+
if (!Array.isArray(categories) ||
|
|
392
|
+
categories.some((c) => typeof c !== "string")) {
|
|
393
|
+
return `${where}.categories must be an array of category names (strings)`;
|
|
394
|
+
}
|
|
395
|
+
for (const cat of categories) {
|
|
396
|
+
if (cat !== RESERVED_CATEGORY && !IDENTIFIER_PATTERN.test(cat)) {
|
|
397
|
+
return `${where}.categories entry "${cat}" must be identifier-safe`;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return null;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Serialize a declared-access manifest into the TOML fragment object that
|
|
404
|
+
* merges into an owning config's TOML data (the caller spreads the returned
|
|
405
|
+
* keys alongside the config's own section). Returns `{}` when empty so a
|
|
406
|
+
* config with no declared access emits nothing (byte-stable).
|
|
407
|
+
*/
|
|
408
|
+
export function serializeDeclaredAccessManifest(manifest) {
|
|
409
|
+
if (!manifest)
|
|
410
|
+
return {};
|
|
411
|
+
const out = {};
|
|
412
|
+
const metadata = {};
|
|
413
|
+
if (manifest.self && Array.isArray(manifest.self.categories)) {
|
|
414
|
+
metadata.self = { categories: manifest.self.categories };
|
|
415
|
+
}
|
|
416
|
+
if (manifest.paths && Object.keys(manifest.paths).length > 0) {
|
|
417
|
+
metadata.paths = manifest.paths;
|
|
418
|
+
}
|
|
419
|
+
if (Object.keys(metadata).length > 0) {
|
|
420
|
+
out.metadata = metadata;
|
|
421
|
+
}
|
|
422
|
+
if (Array.isArray(manifest.secrets) && manifest.secrets.length > 0) {
|
|
423
|
+
out.secrets = manifest.secrets;
|
|
424
|
+
}
|
|
425
|
+
return out;
|
|
426
|
+
}
|
|
427
|
+
//# sourceMappingURL=toml-metadata-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toml-metadata-config.js","sourceRoot":"","sources":["../../../src/lib/toml-metadata-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC;mDACmD;AACnD,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAEtD;0DAC0D;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAEzC;gDACgD;AAChD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,IAAI;IACJ,WAAW;CACZ,CAAC,CAAC;AAYH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,cAAc;IACd,UAAU;IACV,QAAQ;IACR,UAAU;IACV,WAAW;IACX,aA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