@adminiumjs/meta 0.1.0-rc.1
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/LICENSE +661 -0
- package/dist/bootstrap.d.ts +103 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +225 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/columns.d.ts +44 -0
- package/dist/columns.d.ts.map +1 -0
- package/dist/columns.js +57 -0
- package/dist/columns.js.map +1 -0
- package/dist/connect.d.ts +38 -0
- package/dist/connect.d.ts.map +1 -0
- package/dist/connect.js +57 -0
- package/dist/connect.js.map +1 -0
- package/dist/ids.d.ts +79 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +165 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/0001_core_auth.d.ts +9 -0
- package/dist/migrations/0001_core_auth.d.ts.map +1 -0
- package/dist/migrations/0001_core_auth.js +102 -0
- package/dist/migrations/0001_core_auth.js.map +1 -0
- package/dist/migrations/0002_rbac.d.ts +8 -0
- package/dist/migrations/0002_rbac.d.ts.map +1 -0
- package/dist/migrations/0002_rbac.js +75 -0
- package/dist/migrations/0002_rbac.js.map +1 -0
- package/dist/migrations/0003_connections_schema.d.ts +9 -0
- package/dist/migrations/0003_connections_schema.d.ts.map +1 -0
- package/dist/migrations/0003_connections_schema.js +100 -0
- package/dist/migrations/0003_connections_schema.js.map +1 -0
- package/dist/migrations/0004_pages_views.d.ts +8 -0
- package/dist/migrations/0004_pages_views.d.ts.map +1 -0
- package/dist/migrations/0004_pages_views.js +59 -0
- package/dist/migrations/0004_pages_views.js.map +1 -0
- package/dist/migrations/0005_ops.d.ts +9 -0
- package/dist/migrations/0005_ops.d.ts.map +1 -0
- package/dist/migrations/0005_ops.js +104 -0
- package/dist/migrations/0005_ops.js.map +1 -0
- package/dist/migrations/0006_platform.d.ts +11 -0
- package/dist/migrations/0006_platform.d.ts.map +1 -0
- package/dist/migrations/0006_platform.js +259 -0
- package/dist/migrations/0006_platform.js.map +1 -0
- package/dist/migrations/0007_llm_runs.d.ts +33 -0
- package/dist/migrations/0007_llm_runs.d.ts.map +1 -0
- package/dist/migrations/0007_llm_runs.js +62 -0
- package/dist/migrations/0007_llm_runs.js.map +1 -0
- package/dist/migrations/0008_llm_overrides.d.ts +18 -0
- package/dist/migrations/0008_llm_overrides.d.ts.map +1 -0
- package/dist/migrations/0008_llm_overrides.js +24 -0
- package/dist/migrations/0008_llm_overrides.js.map +1 -0
- package/dist/migrations/0009_views_kind.d.ts +20 -0
- package/dist/migrations/0009_views_kind.d.ts.map +1 -0
- package/dist/migrations/0009_views_kind.js +24 -0
- package/dist/migrations/0009_views_kind.js.map +1 -0
- package/dist/migrations/0010_llm_prompt_version_width.d.ts +19 -0
- package/dist/migrations/0010_llm_prompt_version_width.d.ts.map +1 -0
- package/dist/migrations/0010_llm_prompt_version_width.js +28 -0
- package/dist/migrations/0010_llm_prompt_version_width.js.map +1 -0
- package/dist/migrations/index.d.ts +29 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +43 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrator.d.ts +83 -0
- package/dist/migrator.d.ts.map +1 -0
- package/dist/migrator.js +173 -0
- package/dist/migrator.js.map +1 -0
- package/dist/prefix.d.ts +19 -0
- package/dist/prefix.d.ts.map +1 -0
- package/dist/prefix.js +33 -0
- package/dist/prefix.js.map +1 -0
- package/dist/repos/api-keys.d.ts +31 -0
- package/dist/repos/api-keys.d.ts.map +1 -0
- package/dist/repos/api-keys.js +62 -0
- package/dist/repos/api-keys.js.map +1 -0
- package/dist/repos/audit.d.ts +51 -0
- package/dist/repos/audit.d.ts.map +1 -0
- package/dist/repos/audit.js +78 -0
- package/dist/repos/audit.js.map +1 -0
- package/dist/repos/connections.d.ts +90 -0
- package/dist/repos/connections.d.ts.map +1 -0
- package/dist/repos/connections.js +191 -0
- package/dist/repos/connections.js.map +1 -0
- package/dist/repos/email-templates.d.ts +47 -0
- package/dist/repos/email-templates.d.ts.map +1 -0
- package/dist/repos/email-templates.js +93 -0
- package/dist/repos/email-templates.js.map +1 -0
- package/dist/repos/exports.d.ts +67 -0
- package/dist/repos/exports.d.ts.map +1 -0
- package/dist/repos/exports.js +132 -0
- package/dist/repos/exports.js.map +1 -0
- package/dist/repos/files.d.ts +52 -0
- package/dist/repos/files.d.ts.map +1 -0
- package/dist/repos/files.js +86 -0
- package/dist/repos/files.js.map +1 -0
- package/dist/repos/imports.d.ts +71 -0
- package/dist/repos/imports.d.ts.map +1 -0
- package/dist/repos/imports.js +111 -0
- package/dist/repos/imports.js.map +1 -0
- package/dist/repos/index.d.ts +26 -0
- package/dist/repos/index.d.ts.map +1 -0
- package/dist/repos/index.js +26 -0
- package/dist/repos/index.js.map +1 -0
- package/dist/repos/jobs.d.ts +71 -0
- package/dist/repos/jobs.d.ts.map +1 -0
- package/dist/repos/jobs.js +187 -0
- package/dist/repos/jobs.js.map +1 -0
- package/dist/repos/llm-overrides.d.ts +89 -0
- package/dist/repos/llm-overrides.d.ts.map +1 -0
- package/dist/repos/llm-overrides.js +205 -0
- package/dist/repos/llm-overrides.js.map +1 -0
- package/dist/repos/llm-runs.d.ts +114 -0
- package/dist/repos/llm-runs.d.ts.map +1 -0
- package/dist/repos/llm-runs.js +214 -0
- package/dist/repos/llm-runs.js.map +1 -0
- package/dist/repos/notification-prefs.d.ts +34 -0
- package/dist/repos/notification-prefs.d.ts.map +1 -0
- package/dist/repos/notification-prefs.js +80 -0
- package/dist/repos/notification-prefs.js.map +1 -0
- package/dist/repos/notifications.d.ts +60 -0
- package/dist/repos/notifications.d.ts.map +1 -0
- package/dist/repos/notifications.js +107 -0
- package/dist/repos/notifications.js.map +1 -0
- package/dist/repos/overrides.d.ts +59 -0
- package/dist/repos/overrides.d.ts.map +1 -0
- package/dist/repos/overrides.js +143 -0
- package/dist/repos/overrides.js.map +1 -0
- package/dist/repos/pages.d.ts +192 -0
- package/dist/repos/pages.d.ts.map +1 -0
- package/dist/repos/pages.js +374 -0
- package/dist/repos/pages.js.map +1 -0
- package/dist/repos/password-resets.d.ts +32 -0
- package/dist/repos/password-resets.d.ts.map +1 -0
- package/dist/repos/password-resets.js +56 -0
- package/dist/repos/password-resets.js.map +1 -0
- package/dist/repos/permissions.d.ts +28 -0
- package/dist/repos/permissions.d.ts.map +1 -0
- package/dist/repos/permissions.js +100 -0
- package/dist/repos/permissions.js.map +1 -0
- package/dist/repos/roles.d.ts +33 -0
- package/dist/repos/roles.d.ts.map +1 -0
- package/dist/repos/roles.js +89 -0
- package/dist/repos/roles.js.map +1 -0
- package/dist/repos/scheduled-reports.d.ts +73 -0
- package/dist/repos/scheduled-reports.d.ts.map +1 -0
- package/dist/repos/scheduled-reports.js +132 -0
- package/dist/repos/scheduled-reports.js.map +1 -0
- package/dist/repos/sessions.d.ts +33 -0
- package/dist/repos/sessions.d.ts.map +1 -0
- package/dist/repos/sessions.js +79 -0
- package/dist/repos/sessions.js.map +1 -0
- package/dist/repos/settings.d.ts +25 -0
- package/dist/repos/settings.d.ts.map +1 -0
- package/dist/repos/settings.js +73 -0
- package/dist/repos/settings.js.map +1 -0
- package/dist/repos/snapshots.d.ts +79 -0
- package/dist/repos/snapshots.d.ts.map +1 -0
- package/dist/repos/snapshots.js +191 -0
- package/dist/repos/snapshots.js.map +1 -0
- package/dist/repos/user-prefs.d.ts +56 -0
- package/dist/repos/user-prefs.d.ts.map +1 -0
- package/dist/repos/user-prefs.js +147 -0
- package/dist/repos/user-prefs.js.map +1 -0
- package/dist/repos/users.d.ts +38 -0
- package/dist/repos/users.d.ts.map +1 -0
- package/dist/repos/users.js +103 -0
- package/dist/repos/users.js.map +1 -0
- package/dist/repos/util.d.ts +45 -0
- package/dist/repos/util.d.ts.map +1 -0
- package/dist/repos/util.js +81 -0
- package/dist/repos/util.js.map +1 -0
- package/dist/repos/views.d.ts +75 -0
- package/dist/repos/views.d.ts.map +1 -0
- package/dist/repos/views.js +180 -0
- package/dist/repos/views.js.map +1 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +4 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/json-payloads.d.ts +479 -0
- package/dist/schema/json-payloads.d.ts.map +1 -0
- package/dist/schema/json-payloads.js +340 -0
- package/dist/schema/json-payloads.js.map +1 -0
- package/dist/schema/settings-registry.d.ts +187 -0
- package/dist/schema/settings-registry.d.ts.map +1 -0
- package/dist/schema/settings-registry.js +183 -0
- package/dist/schema/settings-registry.js.map +1 -0
- package/dist/schema/tables.d.ts +568 -0
- package/dist/schema/tables.d.ts.map +1 -0
- package/dist/schema/tables.js +51 -0
- package/dist/schema/tables.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for the JSON payloads stored in adminium_* json columns
|
|
3
|
+
* (07-meta-store.md §3). Repos validate every JSON write against these —
|
|
4
|
+
* an invalid payload never reaches the database (acceptance #7).
|
|
5
|
+
*
|
|
6
|
+
* Page config (`adminium_pages.config`) is deliberately opaque here: the
|
|
7
|
+
* envelope schema is owned by `@adminium/engine/config` and validated at the
|
|
8
|
+
* server route layer (§3.17); `pagesRepo` persists already-validated JSON.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
// --- shared -----------------------------------------------------------------
|
|
12
|
+
/** §5.3 soft reference to a source record — never a cross-boundary FK. */
|
|
13
|
+
export const recordRefSchema = z.object({
|
|
14
|
+
connectionId: z.string(),
|
|
15
|
+
/** Qualified source name, e.g. `public.orders`. */
|
|
16
|
+
table: z.string(),
|
|
17
|
+
/** Full PK map — supports composite keys. */
|
|
18
|
+
pk: z.record(z.string(), z.unknown()),
|
|
19
|
+
/** Display snapshot taken at write time. */
|
|
20
|
+
label: z.string(),
|
|
21
|
+
});
|
|
22
|
+
export const LOCALES = ['en_US', 'de_DE', 'ar_EG', 'zh_CN', 'zh_TW', 'cs_CZ', 'da_DK', 'fr_FR'];
|
|
23
|
+
export const localeSchema = z.enum(LOCALES);
|
|
24
|
+
export const themeSchema = z.enum(['light', 'dark', 'system']);
|
|
25
|
+
export const accentSchema = z.enum(['indigo', 'blue', 'teal', 'violet', 'rose', 'red', 'orange', 'black']);
|
|
26
|
+
export const densitySchema = z.enum(['comfortable', 'compact']);
|
|
27
|
+
export const dirSchema = z.enum(['ltr', 'rtl']);
|
|
28
|
+
// --- users / prefs (§3.3, §3.4) ----------------------------------------------
|
|
29
|
+
export const userStatusSchema = z.enum(['active', 'invited', 'suspended']);
|
|
30
|
+
/** Array of argon2id hashes. */
|
|
31
|
+
export const recoveryCodesSchema = z.array(z.string());
|
|
32
|
+
/** Non-theming client state: sidebar collapse, last-visited page, dismissed hints. */
|
|
33
|
+
export const uiStateSchema = z.record(z.string(), z.unknown());
|
|
34
|
+
// --- rbac (§3.9) --------------------------------------------------------------
|
|
35
|
+
export const resourceKindSchema = z.enum(['table', 'page', 'system']);
|
|
36
|
+
export const tableActionsSchema = z.object({
|
|
37
|
+
read: z.boolean(),
|
|
38
|
+
create: z.boolean(),
|
|
39
|
+
update: z.boolean(),
|
|
40
|
+
delete: z.boolean(),
|
|
41
|
+
export: z.boolean(),
|
|
42
|
+
import: z.boolean(),
|
|
43
|
+
});
|
|
44
|
+
export const pageActionsSchema = z.object({
|
|
45
|
+
view: z.boolean(),
|
|
46
|
+
edit: z.boolean(),
|
|
47
|
+
});
|
|
48
|
+
/** resource_ref IS the action; the value is a single grant. */
|
|
49
|
+
export const systemActionsSchema = z.object({
|
|
50
|
+
allowed: z.boolean(),
|
|
51
|
+
});
|
|
52
|
+
/** v1 closed set of system action keys (§3.9), extended per milestone. */
|
|
53
|
+
export const SYSTEM_ACTION_KEYS = [
|
|
54
|
+
'users.manage',
|
|
55
|
+
'roles.manage',
|
|
56
|
+
'settings.manage',
|
|
57
|
+
'connections.manage',
|
|
58
|
+
'schema.remap',
|
|
59
|
+
'llm.run',
|
|
60
|
+
'automations.manage', // reserved — deferred feature, no v1 enforcement (RESERVED_SYSTEM_ACTION_KEYS)
|
|
61
|
+
'webhooks.manage', // reserved — deferred feature, no v1 enforcement (RESERVED_SYSTEM_ACTION_KEYS)
|
|
62
|
+
'api-keys.manage',
|
|
63
|
+
'manifests.manage', // reserved — deferred feature, no v1 enforcement (RESERVED_SYSTEM_ACTION_KEYS)
|
|
64
|
+
'audit.read',
|
|
65
|
+
'sql.run', // reserved — deferred feature, no v1 enforcement (RESERVED_SYSTEM_ACTION_KEYS)
|
|
66
|
+
// M7 wave 2 — data-io (T5) + scheduled reports (T6). `exports.manage` /
|
|
67
|
+
// `imports.manage` gate seeing/downloading OTHER users' artifacts (lists are
|
|
68
|
+
// mine-only without them); `reports.manage` gates the scheduled-reports
|
|
69
|
+
// admin verbs. Email templates deliberately add NO key: PUT rides the
|
|
70
|
+
// existing `settings.manage` (T6 supersedes the builders track's assumption).
|
|
71
|
+
'exports.manage',
|
|
72
|
+
'imports.manage',
|
|
73
|
+
'reports.manage',
|
|
74
|
+
// Jobs visibility/management (08 §2.17): `jobs.read` gates GET /jobs and
|
|
75
|
+
// reading/subscribing to OTHER users' jobs (owners always see their own via
|
|
76
|
+
// the payload.userId convention); `jobs.manage` gates POST /jobs and
|
|
77
|
+
// cancelling other users' jobs. Enforced by routes/jobs and the realtime
|
|
78
|
+
// hub's jobs:<id> channel authorizer.
|
|
79
|
+
'jobs.read',
|
|
80
|
+
'jobs.manage',
|
|
81
|
+
];
|
|
82
|
+
export const systemActionKeySchema = z.enum(SYSTEM_ACTION_KEYS);
|
|
83
|
+
/**
|
|
84
|
+
* Reserved keys — deferred features (automations, webhooks, manifest
|
|
85
|
+
* administration, raw-SQL console; deferred per the v1-free pivot,
|
|
86
|
+
* workplan/17-deferred-monetization.md) with ZERO enforcement points in v1:
|
|
87
|
+
* no route or realtime authorizer checks them. They stay in
|
|
88
|
+
* {@link SYSTEM_ACTION_KEYS} because the grammar is a closed set that stored
|
|
89
|
+
* grants round-trip through (removing a key would orphan persisted
|
|
90
|
+
* `adminium_role_permissions` rows and break forward-compat), but no
|
|
91
|
+
* permissions UI may OFFER them — letting an admin grant a key nothing checks
|
|
92
|
+
* is misleading security UI. Author grantable lists from
|
|
93
|
+
* {@link GRANTABLE_SYSTEM_ACTION_KEYS}; move a key out of here in the same
|
|
94
|
+
* change that lands its first enforcement point.
|
|
95
|
+
*/
|
|
96
|
+
export const RESERVED_SYSTEM_ACTION_KEYS = [
|
|
97
|
+
'automations.manage',
|
|
98
|
+
'webhooks.manage',
|
|
99
|
+
'manifests.manage',
|
|
100
|
+
'sql.run',
|
|
101
|
+
];
|
|
102
|
+
/**
|
|
103
|
+
* What a role editor / permissions surface may offer: the closed set minus
|
|
104
|
+
* {@link RESERVED_SYSTEM_ACTION_KEYS}. Derived, so the two lists cannot
|
|
105
|
+
* drift. (No dashboard roles page exists yet — apps/dashboard has no
|
|
106
|
+
* `@adminium/meta` dependency — so when that page or its catalog endpoint
|
|
107
|
+
* lands, THIS is the list it must be fed, not `SYSTEM_ACTION_KEYS`.)
|
|
108
|
+
*/
|
|
109
|
+
export const GRANTABLE_SYSTEM_ACTION_KEYS = SYSTEM_ACTION_KEYS.filter((key) => !RESERVED_SYSTEM_ACTION_KEYS.includes(key));
|
|
110
|
+
export function permissionActionsSchemaFor(kind) {
|
|
111
|
+
switch (kind) {
|
|
112
|
+
case 'table':
|
|
113
|
+
return tableActionsSchema;
|
|
114
|
+
case 'page':
|
|
115
|
+
return pageActionsSchema;
|
|
116
|
+
case 'system':
|
|
117
|
+
return systemActionsSchema;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// --- audit (§3.11) -------------------------------------------------------------
|
|
121
|
+
export const actorKindSchema = z.enum(['user', 'api-key', 'system', 'automation']);
|
|
122
|
+
export const auditCategorySchema = z.enum([
|
|
123
|
+
'auth',
|
|
124
|
+
'data',
|
|
125
|
+
'schema',
|
|
126
|
+
'settings',
|
|
127
|
+
'rbac',
|
|
128
|
+
'connection',
|
|
129
|
+
'llm',
|
|
130
|
+
'automation',
|
|
131
|
+
'export',
|
|
132
|
+
'system',
|
|
133
|
+
]);
|
|
134
|
+
/** `{ before, after }` images; PII-masked upstream; capped at 16 KB serialized. */
|
|
135
|
+
export const auditChangesSchema = z.object({
|
|
136
|
+
before: z.record(z.string(), z.unknown()).nullish(),
|
|
137
|
+
after: z.record(z.string(), z.unknown()).nullish(),
|
|
138
|
+
_truncated: z.literal(true).optional(),
|
|
139
|
+
});
|
|
140
|
+
/** Serialized-size cap for `adminium_audit_log.changes` (§3.11). */
|
|
141
|
+
export const AUDIT_CHANGES_MAX_BYTES = 16 * 1024;
|
|
142
|
+
// --- jobs (§3.12) ---------------------------------------------------------------
|
|
143
|
+
export const jobStatusSchema = z.enum(['pending', 'running', 'succeeded', 'failed', 'cancelled']);
|
|
144
|
+
/** Kind-specific; the worker validates the concrete shape. */
|
|
145
|
+
export const jobPayloadSchema = z.record(z.string(), z.unknown());
|
|
146
|
+
// --- connections (§3.13) ---------------------------------------------------------
|
|
147
|
+
export const connectionEngineSchema = z.enum(['postgres', 'mysql', 'sqlite']);
|
|
148
|
+
export const connectionSourceKindSchema = z.enum(['dsn', 'schema-file']);
|
|
149
|
+
export const connectionStatusSchema = z.enum(['unconfigured', 'connected', 'error']);
|
|
150
|
+
export const connectionSslSchema = z.object({
|
|
151
|
+
mode: z.enum(['require', 'verify-full', 'disable']),
|
|
152
|
+
caFileId: z.string().nullish(),
|
|
153
|
+
});
|
|
154
|
+
export const connectionSettingsSchema = z.object({
|
|
155
|
+
includedTables: z.array(z.string()).optional(),
|
|
156
|
+
intent: z.enum(['full-admin', 'read-only-analytics', 'crud', 'support-console']).optional(),
|
|
157
|
+
highVolumeUnchecked: z.boolean().optional(),
|
|
158
|
+
placeholderRows: z.boolean().optional(),
|
|
159
|
+
});
|
|
160
|
+
// --- schema overrides (§3.15): one row = one op ----------------------------------
|
|
161
|
+
const toneSchema = z.string();
|
|
162
|
+
export const overridePatchSchema = z.discriminatedUnion('op', [
|
|
163
|
+
// Labels are min(1): the engine's `TableModel.label` forbids '' and an empty
|
|
164
|
+
// rename is meaningless (the remap UI drops the op instead of staging '').
|
|
165
|
+
// Rejecting at write time keeps §3.15 last-write-wins + user>llm provenance
|
|
166
|
+
// free of empty-string special cases on the read path.
|
|
167
|
+
z.object({
|
|
168
|
+
op: z.literal('table.label'),
|
|
169
|
+
value: z.object({
|
|
170
|
+
label: z.string().min(1),
|
|
171
|
+
labelPlural: z.string().optional(),
|
|
172
|
+
icon: z.string().optional(),
|
|
173
|
+
}),
|
|
174
|
+
}),
|
|
175
|
+
z.object({ op: z.literal('table.exclude'), value: z.object({ excluded: z.boolean() }) }),
|
|
176
|
+
z.object({ op: z.literal('table.keyField'), value: z.object({ column: z.string() }) }),
|
|
177
|
+
z.object({ op: z.literal('column.label'), value: z.object({ label: z.string().min(1) }) }),
|
|
178
|
+
z.object({
|
|
179
|
+
op: z.literal('column.semanticType'),
|
|
180
|
+
value: z.object({ semanticType: z.string(), currency: z.string().optional() }),
|
|
181
|
+
}),
|
|
182
|
+
z.object({
|
|
183
|
+
op: z.literal('column.enumLabels'),
|
|
184
|
+
value: z.object({
|
|
185
|
+
labels: z.record(z.string(), z.string()),
|
|
186
|
+
tones: z.record(z.string(), toneSchema).optional(),
|
|
187
|
+
}),
|
|
188
|
+
}),
|
|
189
|
+
z.object({
|
|
190
|
+
op: z.literal('column.pii'),
|
|
191
|
+
value: z.object({ masked: z.boolean(), kind: z.string().optional() }),
|
|
192
|
+
}),
|
|
193
|
+
z.object({ op: z.literal('column.hidden'), value: z.object({ hidden: z.boolean() }) }),
|
|
194
|
+
z.object({
|
|
195
|
+
op: z.literal('relation.add'),
|
|
196
|
+
value: z.object({
|
|
197
|
+
fromColumn: z.string(),
|
|
198
|
+
toTable: z.string(),
|
|
199
|
+
toColumn: z.string(),
|
|
200
|
+
cardinality: z.enum(['many-to-one', 'one-to-one', 'one-to-many', 'many-to-many']),
|
|
201
|
+
}),
|
|
202
|
+
}),
|
|
203
|
+
z.object({
|
|
204
|
+
op: z.literal('relation.remove'),
|
|
205
|
+
value: z.object({ fromColumn: z.string(), toTable: z.string() }),
|
|
206
|
+
}),
|
|
207
|
+
z.object({
|
|
208
|
+
op: z.literal('relation.label'),
|
|
209
|
+
value: z.object({ fromColumn: z.string(), label: z.string() }),
|
|
210
|
+
}),
|
|
211
|
+
]);
|
|
212
|
+
export const overrideOriginSchema = z.enum(['user', 'llm']);
|
|
213
|
+
export const overrideStatusSchema = z.enum(['active', 'disabled']);
|
|
214
|
+
// --- pages (§3.16/§3.17) -----------------------------------------------------------
|
|
215
|
+
export const pageOriginSchema = z.enum(['generated', 'user', 'manifest', 'system', 'llm']);
|
|
216
|
+
export const navGroupSchema = z.enum(['workspace', 'library', 'planning', 'people', 'account']);
|
|
217
|
+
/**
|
|
218
|
+
* Opaque: envelope validation is owned by `@adminium/engine/config` and runs
|
|
219
|
+
* at the server route layer before the repo is called (§3.17).
|
|
220
|
+
*/
|
|
221
|
+
export const pageConfigSchema = z.record(z.string(), z.unknown());
|
|
222
|
+
/** Saved-view payload (§3.18). */
|
|
223
|
+
export const viewConfigSchema = z.object({
|
|
224
|
+
filters: z.array(z.unknown()).optional(),
|
|
225
|
+
sort: z.unknown().optional(),
|
|
226
|
+
visibleColumns: z.array(z.string()).optional(),
|
|
227
|
+
grouping: z.unknown().nullish(),
|
|
228
|
+
widgetState: z.record(z.string(), z.unknown()).optional(),
|
|
229
|
+
});
|
|
230
|
+
// --- notifications (§3.20/§3.21) ----------------------------------------------------
|
|
231
|
+
export const notificationChannelsSchema = z.object({
|
|
232
|
+
inApp: z.boolean(),
|
|
233
|
+
email: z.boolean(),
|
|
234
|
+
push: z.boolean(),
|
|
235
|
+
});
|
|
236
|
+
// --- llm runs (§3.19 / 06-llm-assist.md §7.4) -----------------------------------------
|
|
237
|
+
export const llmRunModeSchema = z.enum(['provider', 'byo']);
|
|
238
|
+
/**
|
|
239
|
+
* `validation_status` — the outcome of the LAST response validation, kept from
|
|
240
|
+
* 0006 as a secondary signal (drives the "some suggestions dropped" hint in the
|
|
241
|
+
* run-history UI). Orthogonal to the run-lifecycle `status` machine below, which
|
|
242
|
+
* 0007 adds as the authoritative state.
|
|
243
|
+
*/
|
|
244
|
+
export const llmValidationStatusSchema = z.enum(['pending', 'valid', 'partial', 'invalid']);
|
|
245
|
+
/**
|
|
246
|
+
* `status` — the authoritative run-lifecycle machine (06-llm-assist.md §7.4).
|
|
247
|
+
* Transitions (enforced by the server run-service, not the repo):
|
|
248
|
+
* draft → running | awaiting_response
|
|
249
|
+
* running | awaiting_response → validated | failed | discarded
|
|
250
|
+
* validated → applied | partially_applied | discarded
|
|
251
|
+
* applied | partially_applied | failed | discarded → (terminal, immutable)
|
|
252
|
+
*/
|
|
253
|
+
export const llmRunStatusSchema = z.enum([
|
|
254
|
+
'draft',
|
|
255
|
+
'running',
|
|
256
|
+
'awaiting_response',
|
|
257
|
+
'validated',
|
|
258
|
+
'applied',
|
|
259
|
+
'partially_applied',
|
|
260
|
+
'failed',
|
|
261
|
+
'discarded',
|
|
262
|
+
]);
|
|
263
|
+
/** Builder inputs echoed onto the run (§4.1) — opaque here, validated upstream by `buildPrompt`. */
|
|
264
|
+
export const llmRunSectionsSchema = z.array(z.string());
|
|
265
|
+
export const llmRunLocalesSchema = z.array(z.string()).min(1);
|
|
266
|
+
export const llmRunSamplingSchema = z
|
|
267
|
+
.object({ maxValuesPerColumn: z.number().int().positive() })
|
|
268
|
+
.nullable();
|
|
269
|
+
/** `review` — accepted/rejected suggestion-id lists persisted across re-review (§8.3). */
|
|
270
|
+
export const llmRunReviewSchema = z.object({
|
|
271
|
+
accepted: z.array(z.string()),
|
|
272
|
+
rejected: z.array(z.string()),
|
|
273
|
+
});
|
|
274
|
+
// --- automations (§3.22/§3.23) --------------------------------------------------------
|
|
275
|
+
export const automationTriggerSchema = z.object({
|
|
276
|
+
event: z.string(),
|
|
277
|
+
table: z.string().nullish(),
|
|
278
|
+
schedule: z.string().nullish(),
|
|
279
|
+
});
|
|
280
|
+
export const automationGraphSchema = z.object({
|
|
281
|
+
nodes: z.array(z.unknown()),
|
|
282
|
+
edges: z.array(z.unknown()),
|
|
283
|
+
});
|
|
284
|
+
export const automationRunStatusSchema = z.enum(['running', 'succeeded', 'failed', 'skipped']);
|
|
285
|
+
// --- scheduled reports (§3.24) ---------------------------------------------------------
|
|
286
|
+
export const reportScheduleSchema = z.object({
|
|
287
|
+
frequency: z.enum(['daily', 'weekly', 'monthly']),
|
|
288
|
+
dayOfWeek: z.number().int().min(0).max(6).nullish(),
|
|
289
|
+
dayOfMonth: z.number().int().min(1).max(31).nullish(),
|
|
290
|
+
time: z.string(),
|
|
291
|
+
timezone: z.string(),
|
|
292
|
+
});
|
|
293
|
+
export const reportRecipientsSchema = z.array(z.string());
|
|
294
|
+
export const reportFormatSchema = z.enum(['pdf', 'png']);
|
|
295
|
+
// --- exports / imports (§3.25/§3.26) ------------------------------------------------------
|
|
296
|
+
export const exportSourceSchema = z.object({
|
|
297
|
+
kind: z.enum(['table', 'view', 'page']),
|
|
298
|
+
table: z.string().nullish(),
|
|
299
|
+
viewId: z.string().nullish(),
|
|
300
|
+
filters: z.array(z.unknown()).optional(),
|
|
301
|
+
});
|
|
302
|
+
export const exportFormatSchema = z.enum(['csv', 'json', 'xlsx']);
|
|
303
|
+
export const exportStatusSchema = z.enum(['processing', 'ready', 'failed', 'cancelled', 'expired']);
|
|
304
|
+
export const importMappingSchema = z.object({
|
|
305
|
+
columns: z.array(z.object({ from: z.string(), to: z.string().nullable() })),
|
|
306
|
+
});
|
|
307
|
+
export const importOptionsSchema = z.object({
|
|
308
|
+
mode: z.enum(['insert', 'upsert']).optional(),
|
|
309
|
+
matchColumn: z.string().nullish(),
|
|
310
|
+
skipInvalid: z.boolean().optional(),
|
|
311
|
+
});
|
|
312
|
+
export const importStatsSchema = z.object({
|
|
313
|
+
total: z.number().int(),
|
|
314
|
+
inserted: z.number().int().optional(),
|
|
315
|
+
updated: z.number().int().optional(),
|
|
316
|
+
skipped: z.number().int().optional(),
|
|
317
|
+
});
|
|
318
|
+
export const importStatusSchema = z.enum(['validating', 'ready', 'running', 'succeeded', 'failed', 'cancelled']);
|
|
319
|
+
// --- files (§3.27) --------------------------------------------------------------------------
|
|
320
|
+
export const fileKindSchema = z.enum(['upload', 'export', 'import', 'branding', 'schema', 'archive']);
|
|
321
|
+
// --- email templates / webhooks / flags / manifests (§3.28–§3.32) -----------------------------
|
|
322
|
+
/** Block array — the concrete block schema is owned by 09-generated-app.md §email-editor. */
|
|
323
|
+
export const emailBlocksSchema = z.array(z.record(z.string(), z.unknown()));
|
|
324
|
+
/** Event keys, same grammar as automations (`record.created`, `export.ready`, `*`). */
|
|
325
|
+
export const webhookEventsSchema = z.array(z.string());
|
|
326
|
+
export const featureFlagEnvironmentSchema = z.object({
|
|
327
|
+
enabled: z.boolean(),
|
|
328
|
+
rollout: z.number().min(0).max(100),
|
|
329
|
+
rules: z.array(z.unknown()),
|
|
330
|
+
});
|
|
331
|
+
export const featureFlagEnvironmentsSchema = z.record(z.string(), featureFlagEnvironmentSchema);
|
|
332
|
+
/** Envelope only — the full manifest spec is frozen in 13-marketplace.md. */
|
|
333
|
+
export const manifestDocSchema = z
|
|
334
|
+
.object({
|
|
335
|
+
key: z.string(),
|
|
336
|
+
name: z.string(),
|
|
337
|
+
version: z.string(),
|
|
338
|
+
})
|
|
339
|
+
.loose();
|
|
340
|
+
//# sourceMappingURL=json-payloads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-payloads.js","sourceRoot":"","sources":["../../src/schema/json-payloads.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAE/E,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,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;CAC5B,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,4BAA4B,CAAC,CAAC;AAEhG,6EAA6E;AAC7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC;KACD,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings registry (07-meta-store.md §7.1): every global settings key with
|
|
3
|
+
* its Zod schema, code default, and secret flag. `adminium_settings` stores
|
|
4
|
+
* explicit overrides only — unset keys fall back to these defaults, so new
|
|
5
|
+
* releases can change defaults without data migrations.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export interface SettingDef<T = unknown> {
|
|
9
|
+
schema: z.ZodType<T>;
|
|
10
|
+
default: T;
|
|
11
|
+
/** Sensitive fields stored encrypted; redacted in API reads (write-only from the UI). */
|
|
12
|
+
secret?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* May this key travel in a config bundle (`adminium export-zip`)?
|
|
15
|
+
*
|
|
16
|
+
* DEFAULT FALSE — the flag is opt-IN, so a key added by a future wave is NOT
|
|
17
|
+
* exportable until someone reads this comment and decides it is. That default
|
|
18
|
+
* is the point. The export used to name the *non*-portable keys instead
|
|
19
|
+
* (`INSTANCE_IDENTITY_SETTINGS`, a deny-list of two), and it rotted inside the
|
|
20
|
+
* same wave that added it: `system.superAdminCreatedAt` — the once-only
|
|
21
|
+
* first-boot CLAIM whose mere presence permanently closes `/setup/*` — was not
|
|
22
|
+
* on it, so a full-instance bundle carried the claim into fresh installs and
|
|
23
|
+
* bricked them (zero users, setup closed forever, no account creatable). See
|
|
24
|
+
* `apps/server/src/export/redaction.ts`, whose own header argues exactly this:
|
|
25
|
+
* a deny-list rots, an allow-list fails closed.
|
|
26
|
+
*
|
|
27
|
+
* The bar for `portable: true` is "this is CONFIGURATION the operator authored
|
|
28
|
+
* and would want on another instance" — not instance identity, not a bootstrap
|
|
29
|
+
* claim, not anything whose meaning is "something already happened here".
|
|
30
|
+
*/
|
|
31
|
+
portable?: boolean;
|
|
32
|
+
description: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* One row of the desktop capability grant table (11-electron.md §12).
|
|
36
|
+
*
|
|
37
|
+
* A grant is the record that an installed micro-SaaS manifest was consented to a
|
|
38
|
+
* host capability — `{ manifestId, capabilityId }` is its identity, `grantedAt`
|
|
39
|
+
* its audit trail. The desktop `CapabilityHost` reads these to decide whether a
|
|
40
|
+
* `capabilities.invoke` (§4) may reach a provider; a call with no matching grant
|
|
41
|
+
* is refused with `CAPABILITY_NOT_GRANTED`. The dashboard's consent step writes
|
|
42
|
+
* one and its revoke control removes one.
|
|
43
|
+
*
|
|
44
|
+
* Bounds, not free strings: `capabilityId` is a dotted id from a closed host
|
|
45
|
+
* vocabulary (`printer.escpos`, …) and `manifestId` a reverse-DNS app id, so both
|
|
46
|
+
* are short. This is the meta-store boundary; the route validates `capabilityId`
|
|
47
|
+
* against the known set on top of it.
|
|
48
|
+
*/
|
|
49
|
+
export declare const capabilityGrantSchema: z.ZodObject<{
|
|
50
|
+
manifestId: z.ZodString;
|
|
51
|
+
capabilityId: z.ZodString;
|
|
52
|
+
grantedAt: z.ZodNumber;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export declare const capabilityGrantsSchema: z.ZodArray<z.ZodObject<{
|
|
55
|
+
manifestId: z.ZodString;
|
|
56
|
+
capabilityId: z.ZodString;
|
|
57
|
+
grantedAt: z.ZodNumber;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
/** One consented desktop capability grant (11-electron.md §12). */
|
|
60
|
+
export type CapabilityGrant = z.infer<typeof capabilityGrantSchema>;
|
|
61
|
+
export declare const SETTINGS_REGISTRY: {
|
|
62
|
+
readonly 'appearance.theme': SettingDef<"light" | "dark" | "system">;
|
|
63
|
+
readonly 'appearance.accent': SettingDef<"indigo" | "blue" | "teal" | "violet" | "rose" | "red" | "orange" | "black">;
|
|
64
|
+
readonly 'appearance.density': SettingDef<"comfortable" | "compact">;
|
|
65
|
+
readonly 'locale.default': SettingDef<"en_US" | "de_DE" | "ar_EG" | "zh_CN" | "zh_TW" | "cs_CZ" | "da_DK" | "fr_FR">;
|
|
66
|
+
readonly 'branding.appName': SettingDef<string>;
|
|
67
|
+
readonly 'branding.logoFileId': SettingDef<string | null>;
|
|
68
|
+
readonly 'branding.faviconFileId': SettingDef<string | null>;
|
|
69
|
+
readonly 'auth.sessionTtlHours': SettingDef<number>;
|
|
70
|
+
readonly 'auth.require2fa': SettingDef<boolean>;
|
|
71
|
+
readonly 'auth.allowSignup': SettingDef<boolean>;
|
|
72
|
+
readonly 'auth.passwordMinLength': SettingDef<number>;
|
|
73
|
+
readonly 'email.smtp': SettingDef<{
|
|
74
|
+
host: string;
|
|
75
|
+
port: number;
|
|
76
|
+
user: string;
|
|
77
|
+
passEncrypted: string;
|
|
78
|
+
from: string;
|
|
79
|
+
secure: boolean;
|
|
80
|
+
} | null>;
|
|
81
|
+
readonly 'llm.provider': SettingDef<"anthropic" | "openai" | "openai-compatible" | "ollama" | "adminium-managed" | null>;
|
|
82
|
+
readonly 'llm.apiKey': SettingDef<string | null>;
|
|
83
|
+
readonly 'llm.model': SettingDef<string | null>;
|
|
84
|
+
readonly 'llm.baseUrl': SettingDef<string | null>;
|
|
85
|
+
readonly 'llm.maxOutputTokens': SettingDef<number | null>;
|
|
86
|
+
readonly 'retention.auditLogDays': SettingDef<number>;
|
|
87
|
+
readonly 'retention.exportsDays': SettingDef<number>;
|
|
88
|
+
readonly 'retention.webhookDeliveriesDays': SettingDef<number>;
|
|
89
|
+
readonly 'retention.automationRunsDays': SettingDef<number>;
|
|
90
|
+
readonly 'retention.notificationsDays': SettingDef<number>;
|
|
91
|
+
readonly 'retention.llmRunsDays': SettingDef<number>;
|
|
92
|
+
readonly 'retention.jobsDays': SettingDef<number>;
|
|
93
|
+
readonly 'retention.auditArchive': SettingDef<boolean>;
|
|
94
|
+
readonly 'telemetry.enabled': SettingDef<boolean>;
|
|
95
|
+
readonly 'updates.checkEnabled': SettingDef<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* The desktop shell's §5 "Skip login on this computer" answer, mirrored out of
|
|
98
|
+
* `<userData>/config.json` (11-electron.md §2.3 `singleUser`) at every boot by
|
|
99
|
+
* the composition root. `POST /api/v1/auth/desktop-session` reads THIS — the
|
|
100
|
+
* route refuses while it is false, which is what the "Require login on this
|
|
101
|
+
* device" toggle turns off.
|
|
102
|
+
*
|
|
103
|
+
* NAMING: §5 spells the key `desktop.single_user`. This registry's convention
|
|
104
|
+
* is `<domain>.<camelCase>` for all 30 of its siblings, and the key is a TS
|
|
105
|
+
* literal type here rather than a string in a doc, so it follows the code.
|
|
106
|
+
*
|
|
107
|
+
* DEFAULT FALSE — i.e. "ask for the password" — even though §2.3's `config.json`
|
|
108
|
+
* default is `true` and §6 step 3's checkbox ships ticked. That is not a
|
|
109
|
+
* contradiction, because THIS DEFAULT IS ONLY EVER REACHED WHEN THE MIRROR DID
|
|
110
|
+
* NOT RUN. When the desktop shell passes `ADMINIUM_DESKTOP_SINGLE_USER`, every
|
|
111
|
+
* boot overwrites this row with the user's real answer and the default is dead
|
|
112
|
+
* code; the only world where it decides anything is one where the wrapper
|
|
113
|
+
* failed to tell the server what the user chose.
|
|
114
|
+
*
|
|
115
|
+
* In that world the two candidate defaults fail in opposite directions:
|
|
116
|
+
*
|
|
117
|
+
* true ⇒ a user who explicitly turned ON "Require login on this device" is
|
|
118
|
+
* silently auto-logged-in anyway. The control fails OPEN, against
|
|
119
|
+
* exactly the threat it exists for (someone else at this keyboard),
|
|
120
|
+
* and nothing anywhere says so.
|
|
121
|
+
* false ⇒ auto-login stops working and the user sees the standard login
|
|
122
|
+
* screen. A visible missing convenience, and their password still
|
|
123
|
+
* opens the app.
|
|
124
|
+
*
|
|
125
|
+
* A broken promise about a password beats a broken promise about a shortcut, so
|
|
126
|
+
* the unmirrored case fails closed and loudly rather than open and silently.
|
|
127
|
+
*
|
|
128
|
+
* NEVER portable: it is per-DEVICE policy. A bundle that carried it would
|
|
129
|
+
* answer "may this machine skip its login?" using another machine's answer.
|
|
130
|
+
*/
|
|
131
|
+
readonly 'desktop.singleUser': SettingDef<boolean>;
|
|
132
|
+
/**
|
|
133
|
+
* The desktop capability grant table (11-electron.md §12). Written by the
|
|
134
|
+
* consent step on manifest install and cleared by its revoke control; read by
|
|
135
|
+
* the main-process `CapabilityHost` on every `capabilities.invoke` to gate a
|
|
136
|
+
* call against a real, revocable grant.
|
|
137
|
+
*
|
|
138
|
+
* NAMING: §12 spells the `adminium_settings` key `desktop.capability_grants`.
|
|
139
|
+
* This registry's convention is `<domain>.<camelCase>` — the same override
|
|
140
|
+
* `desktop.singleUser` makes over §5's `desktop.single_user`, and for the same
|
|
141
|
+
* reason: the key is a TS literal type here, so it follows the code.
|
|
142
|
+
*
|
|
143
|
+
* NEVER portable: a grant is a per-DEVICE authorization to touch THIS machine's
|
|
144
|
+
* hardware. A bundle that carried it would silently pre-authorize an app to
|
|
145
|
+
* reach a receipt printer on a machine whose owner never consented.
|
|
146
|
+
*/
|
|
147
|
+
readonly 'desktop.capabilityGrants': SettingDef<{
|
|
148
|
+
manifestId: string;
|
|
149
|
+
capabilityId: string;
|
|
150
|
+
grantedAt: number;
|
|
151
|
+
}[]>;
|
|
152
|
+
readonly 'system.instanceId': SettingDef<string | null>;
|
|
153
|
+
readonly 'system.bootstrappedAt': SettingDef<number | null>;
|
|
154
|
+
/**
|
|
155
|
+
* The first-super-admin CLAIM (M10-T04). Its row's PRESENCE — not its value —
|
|
156
|
+
* is the once-only gate: `createFirstSuperAdmin` INSERTs it inside the same
|
|
157
|
+
* transaction that creates the user, so the `key` PRIMARY KEY makes a second
|
|
158
|
+
* (or concurrent) bootstrap attempt fail atomically on every dialect. Never
|
|
159
|
+
* `set()` this key from application code.
|
|
160
|
+
*
|
|
161
|
+
* NEVER portable, for the same reason it is never `set()`: importing it into
|
|
162
|
+
* an instance with zero users closes `/setup/*` (409) forever, so no super
|
|
163
|
+
* admin can be created and nobody can log in. The instance is scrap.
|
|
164
|
+
*/
|
|
165
|
+
readonly 'system.superAdminCreatedAt': SettingDef<number | null>;
|
|
166
|
+
/**
|
|
167
|
+
* The bundle FORMAT version of this store. Not portable: the target records
|
|
168
|
+
* its own, and the version a bundle was written at already travels in the
|
|
169
|
+
* manifest (`BundleManifest.configVersion`), which is what replay reads.
|
|
170
|
+
* Copying the source's value would let an old bundle silently downgrade the
|
|
171
|
+
* number a newer target reports about itself.
|
|
172
|
+
*/
|
|
173
|
+
readonly 'system.configVersion': SettingDef<number>;
|
|
174
|
+
};
|
|
175
|
+
export type SettingsRegistry = typeof SETTINGS_REGISTRY;
|
|
176
|
+
export type SettingKey = keyof SettingsRegistry;
|
|
177
|
+
export type SettingValue<K extends SettingKey> = SettingsRegistry[K] extends SettingDef<infer T> ? T : never;
|
|
178
|
+
export declare const SETTING_KEYS: SettingKey[];
|
|
179
|
+
export declare function isSettingKey(key: string): key is SettingKey;
|
|
180
|
+
export declare function isSecretSettingKey(key: SettingKey): boolean;
|
|
181
|
+
/**
|
|
182
|
+
* True when the registry declares `key` safe to carry in a config bundle.
|
|
183
|
+
* Opt-in, so an undeclared (i.e. new) key is never exported — see
|
|
184
|
+
* {@link SettingDef.portable}.
|
|
185
|
+
*/
|
|
186
|
+
export declare function isPortableSettingKey(key: SettingKey): boolean;
|
|
187
|
+
//# sourceMappingURL=settings-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-registry.d.ts","sourceRoot":"","sources":["../../src/schema/settings-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,OAAO;IACrC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,EAAE,CAAC,CAAC;IACX,yFAAyF;IACzF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAwCD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB;;;;iBAIhC,CAAC;AACH,eAAO,MAAM,sBAAsB;;;;kBAAiC,CAAC;AAErE,mEAAmE;AACnE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;;IAEH;;;;;;;;;;;;;;OAcG;;;;;;;;IAQH;;;;;;;;;;OAUG;;IAEH;;;;;;OAMG;;CAEK,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,OAAO,iBAAiB,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC;AAChD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,UAAU,IAAI,gBAAgB,CAAC,CAAC,CAAC,SAAS,UAAU,CAAC,M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