primitive-admin 1.0.49 → 1.0.51

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.
Files changed (153) hide show
  1. package/README.md +129 -10
  2. package/assets/skill/skills/primitive-platform/SKILL.md +85 -30
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +66 -1
  5. package/dist/bin/primitive.js.map +1 -1
  6. package/dist/src/commands/admins.d.ts +2 -0
  7. package/dist/src/commands/admins.js +25 -27
  8. package/dist/src/commands/admins.js.map +1 -1
  9. package/dist/src/commands/analytics.d.ts +2 -0
  10. package/dist/src/commands/apps.d.ts +2 -0
  11. package/dist/src/commands/apps.js +28 -0
  12. package/dist/src/commands/apps.js.map +1 -1
  13. package/dist/src/commands/auth.d.ts +2 -0
  14. package/dist/src/commands/blob-buckets.d.ts +2 -0
  15. package/dist/src/commands/blob-buckets.js +30 -26
  16. package/dist/src/commands/blob-buckets.js.map +1 -1
  17. package/dist/src/commands/catalog.d.ts +2 -0
  18. package/dist/src/commands/catalog.js +17 -18
  19. package/dist/src/commands/catalog.js.map +1 -1
  20. package/dist/src/commands/collection-type-configs.d.ts +2 -0
  21. package/dist/src/commands/collection-type-configs.js +9 -9
  22. package/dist/src/commands/collection-type-configs.js.map +1 -1
  23. package/dist/src/commands/collections.d.ts +2 -0
  24. package/dist/src/commands/collections.js +33 -36
  25. package/dist/src/commands/collections.js.map +1 -1
  26. package/dist/src/commands/comparisons.d.ts +2 -0
  27. package/dist/src/commands/cron-triggers.d.ts +2 -0
  28. package/dist/src/commands/cron-triggers.js +8 -15
  29. package/dist/src/commands/cron-triggers.js.map +1 -1
  30. package/dist/src/commands/database-types.d.ts +2 -0
  31. package/dist/src/commands/database-types.js +17 -18
  32. package/dist/src/commands/database-types.js.map +1 -1
  33. package/dist/src/commands/databases.d.ts +2 -0
  34. package/dist/src/commands/databases.js +72 -45
  35. package/dist/src/commands/databases.js.map +1 -1
  36. package/dist/src/commands/documents.d.ts +2 -0
  37. package/dist/src/commands/documents.js +17 -18
  38. package/dist/src/commands/documents.js.map +1 -1
  39. package/dist/src/commands/email-templates.d.ts +2 -0
  40. package/dist/src/commands/email-templates.js +9 -9
  41. package/dist/src/commands/email-templates.js.map +1 -1
  42. package/dist/src/commands/env.d.ts +12 -0
  43. package/dist/src/commands/group-type-configs.d.ts +2 -0
  44. package/dist/src/commands/group-type-configs.js +9 -9
  45. package/dist/src/commands/group-type-configs.js.map +1 -1
  46. package/dist/src/commands/groups.d.ts +2 -0
  47. package/dist/src/commands/groups.js +17 -18
  48. package/dist/src/commands/groups.js.map +1 -1
  49. package/dist/src/commands/guides.d.ts +84 -0
  50. package/dist/src/commands/guides.js +201 -24
  51. package/dist/src/commands/guides.js.map +1 -1
  52. package/dist/src/commands/init.d.ts +17 -0
  53. package/dist/src/commands/init.js +63 -25
  54. package/dist/src/commands/init.js.map +1 -1
  55. package/dist/src/commands/integrations.d.ts +2 -0
  56. package/dist/src/commands/integrations.js +39 -23
  57. package/dist/src/commands/integrations.js.map +1 -1
  58. package/dist/src/commands/llm.d.ts +2 -0
  59. package/dist/src/commands/llm.js +4 -2
  60. package/dist/src/commands/llm.js.map +1 -1
  61. package/dist/src/commands/prompts.d.ts +2 -0
  62. package/dist/src/commands/prompts.js +33 -36
  63. package/dist/src/commands/prompts.js.map +1 -1
  64. package/dist/src/commands/rule-sets.d.ts +2 -0
  65. package/dist/src/commands/rule-sets.js +9 -9
  66. package/dist/src/commands/rule-sets.js.map +1 -1
  67. package/dist/src/commands/secrets.d.ts +2 -0
  68. package/dist/src/commands/skill.d.ts +2 -0
  69. package/dist/src/commands/sync.d.ts +99 -0
  70. package/dist/src/commands/sync.js +437 -31
  71. package/dist/src/commands/sync.js.map +1 -1
  72. package/dist/src/commands/tokens.d.ts +2 -0
  73. package/dist/src/commands/tokens.js +113 -10
  74. package/dist/src/commands/tokens.js.map +1 -1
  75. package/dist/src/commands/users.d.ts +2 -0
  76. package/dist/src/commands/users.js +41 -45
  77. package/dist/src/commands/users.js.map +1 -1
  78. package/dist/src/commands/waitlist.d.ts +2 -0
  79. package/dist/src/commands/waitlist.js +10 -10
  80. package/dist/src/commands/waitlist.js.map +1 -1
  81. package/dist/src/commands/webhooks.d.ts +2 -0
  82. package/dist/src/commands/webhooks.js +9 -9
  83. package/dist/src/commands/webhooks.js.map +1 -1
  84. package/dist/src/commands/workflows.d.ts +49 -0
  85. package/dist/src/commands/workflows.js +136 -57
  86. package/dist/src/commands/workflows.js.map +1 -1
  87. package/dist/src/lib/api-client.d.ts +1229 -0
  88. package/dist/src/lib/api-client.js +44 -11
  89. package/dist/src/lib/api-client.js.map +1 -1
  90. package/dist/src/lib/auth-flow.d.ts +8 -0
  91. package/dist/src/lib/cli-manifest.d.ts +60 -0
  92. package/dist/src/lib/cli-manifest.js +70 -0
  93. package/dist/src/lib/cli-manifest.js.map +1 -0
  94. package/dist/src/lib/config.d.ts +37 -0
  95. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  96. package/dist/src/lib/confirm-prompt.js +110 -0
  97. package/dist/src/lib/confirm-prompt.js.map +1 -0
  98. package/dist/src/lib/constants.d.ts +2 -0
  99. package/dist/src/lib/crash-handlers.d.ts +20 -0
  100. package/dist/src/lib/crash-handlers.js +49 -0
  101. package/dist/src/lib/crash-handlers.js.map +1 -0
  102. package/dist/src/lib/credentials-store.d.ts +79 -0
  103. package/dist/src/lib/csv.d.ts +48 -0
  104. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  105. package/dist/src/lib/db-codegen/dbGenerator.d.ts +111 -0
  106. package/dist/src/lib/db-codegen/dbNaming.d.ts +45 -0
  107. package/dist/src/lib/db-codegen/dbTemplates.d.ts +97 -0
  108. package/dist/src/lib/db-codegen/dbTemplates.js +31 -10
  109. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  110. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +78 -0
  111. package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
  112. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  113. package/dist/src/lib/env-resolver.d.ts +62 -0
  114. package/dist/src/lib/fetch.d.ts +5 -0
  115. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  116. package/dist/src/lib/generated-allowlist.js +181 -0
  117. package/dist/src/lib/generated-allowlist.js.map +1 -0
  118. package/dist/src/lib/init-config.d.ts +46 -0
  119. package/dist/src/lib/init-config.js +7 -0
  120. package/dist/src/lib/init-config.js.map +1 -1
  121. package/dist/src/lib/migration-nag.d.ts +49 -0
  122. package/dist/src/lib/output.d.ts +49 -0
  123. package/dist/src/lib/output.js +25 -1
  124. package/dist/src/lib/output.js.map +1 -1
  125. package/dist/src/lib/paginate.d.ts +33 -0
  126. package/dist/src/lib/project-config.d.ts +97 -0
  127. package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
  128. package/dist/src/lib/resolve-platform.d.ts +45 -0
  129. package/dist/src/lib/resolve-platform.js +43 -0
  130. package/dist/src/lib/resolve-platform.js.map +1 -0
  131. package/dist/src/lib/skill-installer.d.ts +23 -0
  132. package/dist/src/lib/snapshots.d.ts +99 -0
  133. package/dist/src/lib/snapshots.js +357 -0
  134. package/dist/src/lib/snapshots.js.map +1 -0
  135. package/dist/src/lib/sync-paths.d.ts +72 -0
  136. package/dist/src/lib/sync-paths.js +29 -1
  137. package/dist/src/lib/sync-paths.js.map +1 -1
  138. package/dist/src/lib/template.d.ts +93 -0
  139. package/dist/src/lib/token-inject.d.ts +56 -0
  140. package/dist/src/lib/token-inject.js +204 -0
  141. package/dist/src/lib/token-inject.js.map +1 -0
  142. package/dist/src/lib/toml-database-config.d.ts +132 -0
  143. package/dist/src/lib/toml-params-validator.d.ts +95 -0
  144. package/dist/src/lib/version-check.d.ts +10 -0
  145. package/dist/src/lib/workflow-fragments.d.ts +41 -0
  146. package/dist/src/lib/workflow-toml-validator.d.ts +95 -0
  147. package/dist/src/lib/workflow-toml-validator.js +71 -130
  148. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  149. package/dist/src/types/index.d.ts +513 -0
  150. package/dist/src/validators.d.ts +64 -0
  151. package/dist/src/validators.js +63 -0
  152. package/dist/src/validators.js.map +1 -0
  153. package/package.json +10 -1
@@ -0,0 +1,513 @@
1
+ export interface Credentials {
2
+ serverUrl: string;
3
+ accessToken: string;
4
+ refreshToken: string;
5
+ expiresAt: string;
6
+ adminId: string;
7
+ email: string;
8
+ role: "admin" | "super-admin";
9
+ name?: string;
10
+ currentAppId?: string;
11
+ currentAppName?: string;
12
+ globalAdminAppId?: string;
13
+ }
14
+ export interface AppSummary {
15
+ appId: string;
16
+ name: string;
17
+ mode?: string;
18
+ }
19
+ export interface AppSettings {
20
+ name: string;
21
+ baseUrl?: string | null;
22
+ mode: "public" | "invite-only" | "domain";
23
+ waitlistEnabled?: boolean;
24
+ allowedDomains?: string[] | null;
25
+ redirectUris?: string[] | null;
26
+ googleOAuthEnabled?: boolean;
27
+ googleClientId?: string;
28
+ googleClientSecret?: string;
29
+ corsMode?: "universal" | "custom";
30
+ corsAllowedOrigins?: string[] | null;
31
+ corsAllowCredentials?: boolean;
32
+ corsAllowedMethods?: string[] | null;
33
+ corsAllowedHeaders?: string[] | null;
34
+ corsExposedHeaders?: string[] | null;
35
+ corsMaxAge?: number | null;
36
+ passkeyEnabled?: boolean;
37
+ passkeyRpId?: string;
38
+ passkeyRpName?: string;
39
+ passkeyRpConfig?: Record<string, {
40
+ name: string;
41
+ }> | null;
42
+ hasPasskey?: boolean;
43
+ magicLinkEnabled?: boolean;
44
+ }
45
+ export interface User {
46
+ userId: string;
47
+ email: string;
48
+ name: string;
49
+ role: "owner" | "admin" | "member";
50
+ addedAt: string;
51
+ }
52
+ export interface Invitation {
53
+ invitationId: string;
54
+ email: string;
55
+ role: "admin" | "member";
56
+ createdAt: string;
57
+ expiresAt: string;
58
+ invitedBy: string;
59
+ accepted?: boolean;
60
+ acceptedAt?: string;
61
+ }
62
+ export interface WaitlistEntry {
63
+ waitlistId: string;
64
+ email: string;
65
+ displayName?: string | null;
66
+ provider?: string | null;
67
+ providerId?: string | null;
68
+ source?: string | null;
69
+ note?: string | null;
70
+ requestedAt?: string | null;
71
+ updatedAt?: string | null;
72
+ }
73
+ export interface MultipartFieldDefinition {
74
+ fieldName: string;
75
+ type: "attachment" | "value";
76
+ attachmentIndex?: number;
77
+ attachmentName?: string;
78
+ value?: string;
79
+ }
80
+ export interface IntegrationRequestConfig {
81
+ baseUrl: string;
82
+ allowedMethods?: string[];
83
+ allowedPaths?: string[];
84
+ defaultMethod?: string;
85
+ defaultHeaders?: Record<string, string>;
86
+ staticQuery?: Record<string, any>;
87
+ forwardHeaders?: string[];
88
+ forwardQueryParams?: string[];
89
+ responsePassthrough?: boolean;
90
+ exampleQuery?: Record<string, any>;
91
+ exampleBody?: any;
92
+ bodyMode?: "json" | "raw" | "multipart";
93
+ multipartFieldMapping?: MultipartFieldDefinition[];
94
+ }
95
+ export interface IntegrationSummary {
96
+ integrationId: string;
97
+ integrationKey: string;
98
+ displayName: string;
99
+ status: string;
100
+ lastTestedAt?: string | null;
101
+ createdAt?: string;
102
+ modifiedAt?: string;
103
+ }
104
+ export interface IntegrationDetail extends IntegrationSummary {
105
+ appId: string;
106
+ description?: string | null;
107
+ requestConfig: IntegrationRequestConfig;
108
+ timeoutMs?: number;
109
+ maxRequestBodyBytes?: number;
110
+ }
111
+ export interface IntegrationSecret {
112
+ secretId: string;
113
+ version: string;
114
+ secretSummary?: string | null;
115
+ status?: string;
116
+ createdBy?: string;
117
+ createdAt?: string;
118
+ supersededAt?: string | null;
119
+ preview?: {
120
+ headers: string[];
121
+ query: string[];
122
+ body: string[];
123
+ } | null;
124
+ }
125
+ export interface IntegrationTestPayload {
126
+ method?: string;
127
+ path?: string;
128
+ query?: Record<string, any>;
129
+ headers?: Record<string, string>;
130
+ body?: any;
131
+ }
132
+ export interface IntegrationTestResult {
133
+ success: boolean;
134
+ upstreamResponse?: {
135
+ status: number;
136
+ headers: Record<string, string>;
137
+ body: any;
138
+ traceId?: string;
139
+ durationMs?: number;
140
+ };
141
+ errorCode?: string;
142
+ message?: string;
143
+ traceId?: string;
144
+ }
145
+ export interface IntegrationLogEntry {
146
+ timestamp: string;
147
+ method: string;
148
+ path: string;
149
+ status: number;
150
+ durationMs: number;
151
+ traceId: string;
152
+ errorCode?: string;
153
+ actorType?: string;
154
+ actorId?: string;
155
+ }
156
+ export interface Webhook {
157
+ webhookId: string;
158
+ webhookKey: string;
159
+ displayName: string;
160
+ description?: string;
161
+ status: string;
162
+ workflowKey: string;
163
+ verificationScheme: string;
164
+ signingSecretMasked?: string;
165
+ toleranceSeconds: number;
166
+ deduplicationEnabled: boolean;
167
+ deduplicationWindowMs: number;
168
+ secretGracePeriodMs: number;
169
+ inputMapping?: string;
170
+ allowedIpCidrs?: string;
171
+ metadata?: string;
172
+ lastTriggeredAt?: string;
173
+ createdAt: string;
174
+ modifiedAt: string;
175
+ }
176
+ export interface WebhookEvent {
177
+ eventId: string;
178
+ externalEventId?: string;
179
+ status: string;
180
+ httpStatus: number;
181
+ sourceIp?: string;
182
+ payloadSummary?: string;
183
+ rejectionReason?: string;
184
+ workflowRunKey?: string;
185
+ processingDurationMs?: number;
186
+ createdAt: string;
187
+ }
188
+ export interface Workflow {
189
+ workflowId: string;
190
+ workflowKey: string;
191
+ name: string;
192
+ description: string | null;
193
+ status: "draft" | "active" | "archived";
194
+ activeConfigId: string | null;
195
+ latestRevision: string | null;
196
+ inputSchema: object | null;
197
+ outputSchema: object | null;
198
+ perUserMaxRunning: number;
199
+ perUserMaxQueued: number;
200
+ perAppMaxRunning: number;
201
+ perAppMaxQueued: number;
202
+ queueTtlSeconds: number;
203
+ dequeueOrder: "fifo" | "lifo";
204
+ createdBy: string;
205
+ createdAt: string;
206
+ modifiedAt: string;
207
+ }
208
+ export interface WorkflowDraft {
209
+ steps: any[];
210
+ inputSchema: object | null;
211
+ outputSchema: object | null;
212
+ }
213
+ export interface WorkflowRevision {
214
+ revisionId: string;
215
+ workflowId: string;
216
+ stepsR2Key: string;
217
+ inputSchema: object | null;
218
+ outputSchema: object | null;
219
+ publishedAt: string | null;
220
+ createdBy: string;
221
+ createdAt: string;
222
+ }
223
+ export interface WorkflowRun {
224
+ runId: string;
225
+ runKey: string;
226
+ instanceId: string;
227
+ workflowId: string;
228
+ workflowKey: string;
229
+ revisionId: string;
230
+ contextDocId: string;
231
+ status: string;
232
+ startedAt: string | null;
233
+ endedAt: string | null;
234
+ startedByUserId?: string;
235
+ input: any | null;
236
+ meta: object | null;
237
+ isPreview?: boolean;
238
+ }
239
+ export interface WorkflowInstanceStatus {
240
+ status: string;
241
+ output?: any;
242
+ stepResults?: Array<{
243
+ id: string;
244
+ kind: string;
245
+ output: any;
246
+ startedAt: string;
247
+ endedAt: string;
248
+ durationMs: number;
249
+ skipped?: boolean;
250
+ }>;
251
+ error?: any;
252
+ }
253
+ export interface AppPromptSummary {
254
+ promptId: string;
255
+ promptKey: string;
256
+ displayName: string;
257
+ description?: string | null;
258
+ activeConfigId?: string | null;
259
+ defaultEvaluatorPromptId?: string | null;
260
+ status: "draft" | "active" | "archived";
261
+ createdAt?: string;
262
+ modifiedAt?: string;
263
+ }
264
+ export interface AppPromptDetail extends AppPromptSummary {
265
+ appId: string;
266
+ copiedFromCatalogId?: string | null;
267
+ inputSchema?: string | null;
268
+ createdBy?: string;
269
+ configs: AppPromptConfig[];
270
+ }
271
+ export interface AppPromptConfig {
272
+ configId: string;
273
+ promptId: string;
274
+ appId: string;
275
+ configName: string;
276
+ description?: string | null;
277
+ provider: "openrouter" | "gemini";
278
+ model: string;
279
+ systemPrompt?: string | null;
280
+ userPromptTemplate: string;
281
+ temperature?: number | null;
282
+ topP?: number | null;
283
+ maxTokens?: number | null;
284
+ outputSchema?: object | null;
285
+ providerConfig?: object | null;
286
+ status: "active" | "archived";
287
+ createdBy?: string;
288
+ createdAt?: string;
289
+ modifiedAt?: string;
290
+ }
291
+ export interface PromptExecuteResult {
292
+ success: boolean;
293
+ output: string;
294
+ rawResponse: any;
295
+ error?: string;
296
+ configId?: string;
297
+ metrics: {
298
+ durationMs: number;
299
+ inputTokens?: number;
300
+ outputTokens?: number;
301
+ totalTokens?: number;
302
+ };
303
+ }
304
+ export interface PromptPreviewResult {
305
+ systemPrompt?: string;
306
+ userPrompt: string;
307
+ model?: string;
308
+ provider?: string;
309
+ configId?: string;
310
+ }
311
+ export interface AnalyticsOverviewResponse {
312
+ windowDays: number;
313
+ bucketDays: number;
314
+ totals: {
315
+ dau: number;
316
+ wau: number;
317
+ mau: number;
318
+ totalEvents: number;
319
+ };
320
+ series: Array<{
321
+ bucketStart: string;
322
+ activeUsers: number;
323
+ totalEvents: number;
324
+ }>;
325
+ }
326
+ export interface AnalyticsTopUsersResponse {
327
+ windowDays: number;
328
+ limit: number;
329
+ results: Array<{
330
+ userUlid: string;
331
+ firstSeen: string;
332
+ lastSeen: string;
333
+ eventCount: number;
334
+ }>;
335
+ }
336
+ export interface AnalyticsUserTimelineResponse {
337
+ windowDays: number;
338
+ bucketSeconds: number;
339
+ timeline: Array<{
340
+ bucketStart: string;
341
+ events: number;
342
+ }>;
343
+ breakdown: Array<{
344
+ action: string;
345
+ feature: string;
346
+ route: string;
347
+ events: number;
348
+ }>;
349
+ }
350
+ export interface AnalyticsIntegrationMetricsResponse {
351
+ windowDays: number;
352
+ integrations: Array<{
353
+ integrationKey: string;
354
+ invocations: number;
355
+ errorRate: number;
356
+ avgDurationMs: number;
357
+ p95DurationMs: number;
358
+ }>;
359
+ }
360
+ export interface AdminSummary {
361
+ adminId: string;
362
+ email: string;
363
+ name: string;
364
+ role: string;
365
+ appCreationLimit: number;
366
+ disabledAt?: string | null;
367
+ assignedAppsCount: number;
368
+ createdAppsCount: number;
369
+ }
370
+ export interface AdminInvitation {
371
+ invitationId: string;
372
+ email: string;
373
+ invitedAt?: string;
374
+ expiresAt?: string;
375
+ invitedBy?: string | null;
376
+ type: "global" | "app";
377
+ appId?: string;
378
+ appName?: string;
379
+ appCreationLimit?: number;
380
+ }
381
+ export interface PromptCatalogItem {
382
+ catalogId: string;
383
+ catalogKey: string;
384
+ displayName: string;
385
+ description?: string | null;
386
+ category?: string | null;
387
+ provider: "openrouter" | "gemini";
388
+ model: string;
389
+ systemPrompt?: string | null;
390
+ userPromptTemplate: string;
391
+ inputSchema?: string | null;
392
+ outputSchema?: string | null;
393
+ temperature?: string | null;
394
+ topP?: string | null;
395
+ maxTokens?: number | null;
396
+ status: "draft" | "active" | "deprecated";
397
+ createdBy?: string;
398
+ createdAt?: string;
399
+ modifiedAt?: string;
400
+ }
401
+ export interface IntegrationCatalogItem {
402
+ catalogId: string;
403
+ catalogKey: string;
404
+ displayName: string;
405
+ description?: string | null;
406
+ category?: string | null;
407
+ requestConfig: string;
408
+ docUrl?: string | null;
409
+ logoUrl?: string | null;
410
+ status: "draft" | "active" | "deprecated";
411
+ createdBy?: string;
412
+ createdAt?: string;
413
+ modifiedAt?: string;
414
+ }
415
+ export interface WorkflowConfiguration {
416
+ configId: string;
417
+ workflowId: string;
418
+ appId: string;
419
+ configName: string;
420
+ description?: string | null;
421
+ stepsR2Key: string;
422
+ status: "active" | "archived";
423
+ steps?: any[];
424
+ createdBy?: string;
425
+ createdAt?: string;
426
+ modifiedAt?: string;
427
+ }
428
+ export interface SyncState {
429
+ appId: string;
430
+ serverUrl: string;
431
+ lastSyncedAt: string;
432
+ entities: {
433
+ app?: {
434
+ modifiedAt: string;
435
+ contentHash?: string;
436
+ };
437
+ integrations?: Record<string, {
438
+ id: string;
439
+ modifiedAt: string;
440
+ contentHash?: string;
441
+ }>;
442
+ prompts?: Record<string, {
443
+ id: string;
444
+ modifiedAt: string;
445
+ contentHash?: string;
446
+ }>;
447
+ workflows?: Record<string, {
448
+ id: string;
449
+ modifiedAt: string;
450
+ activeConfigId?: string;
451
+ contentHash?: string;
452
+ }>;
453
+ emailTemplates?: Record<string, {
454
+ id: string;
455
+ modifiedAt: string;
456
+ }>;
457
+ testCases?: Record<string, {
458
+ id: string;
459
+ blockType: string;
460
+ blockId: string;
461
+ blockKey: string;
462
+ slug: string;
463
+ modifiedAt: string;
464
+ attachmentFilenames?: string[];
465
+ contentHash?: string;
466
+ }>;
467
+ databaseTypes?: Record<string, {
468
+ databaseType: string;
469
+ modifiedAt: string;
470
+ operations?: Record<string, {
471
+ modifiedAt: string;
472
+ }>;
473
+ subscriptions?: Record<string, {
474
+ modifiedAt: string;
475
+ }>;
476
+ contentHash?: string;
477
+ hasSchema?: boolean;
478
+ }>;
479
+ ruleSets?: Record<string, {
480
+ id: string;
481
+ modifiedAt: string;
482
+ contentHash?: string;
483
+ }>;
484
+ groupTypeConfigs?: Record<string, {
485
+ modifiedAt: string;
486
+ contentHash?: string;
487
+ }>;
488
+ collectionTypeConfigs?: Record<string, {
489
+ modifiedAt: string;
490
+ contentHash?: string;
491
+ }>;
492
+ webhooks?: Record<string, {
493
+ id: string;
494
+ modifiedAt: string;
495
+ contentHash?: string;
496
+ }>;
497
+ blobBuckets?: Record<string, {
498
+ id: string;
499
+ modifiedAt: string;
500
+ contentHash?: string;
501
+ }>;
502
+ cronTriggers?: Record<string, {
503
+ id: string;
504
+ modifiedAt: string;
505
+ contentHash?: string;
506
+ }>;
507
+ scripts?: Record<string, {
508
+ id: string;
509
+ modifiedAt: string;
510
+ contentHash?: string;
511
+ }>;
512
+ };
513
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Public subpath export: `primitive-admin/validators` (issue #983).
3
+ *
4
+ * Re-exports the TOML validators that `sync push` runs as its load-bearing
5
+ * gate, so external tooling (e.g. `primitive-docs`) can validate the exact
6
+ * same way the published CLI does — instead of re-implementing the parse /
7
+ * expand / validate flow against submodule source and silently drifting.
8
+ *
9
+ * Two kinds of entry points are exported:
10
+ *
11
+ * 1. `validateWorkflowTomlSource(raw, filePath)` — the **source-level**
12
+ * wrapper. Runs the identical parse → fragment-expand → validate → format
13
+ * path that `sync push` runs for workflow TOML (`cli/src/commands/sync.ts`:
14
+ * `parseTomlFile()` → `validateWorkflowToml()` → `formatWorkflowTomlErrors()`).
15
+ * Use this when you have the raw TOML string and want zero divergence from
16
+ * `sync push`, including `include` fragment expansion.
17
+ *
18
+ * 2. The raw validators (`validateWorkflowToml`, `validateOperations`) and
19
+ * their formatters (`formatWorkflowTomlErrors`, `formatIssue`). These are
20
+ * **pure functions over already-parsed TOML** — they do not read files or
21
+ * parse TOML themselves. The consumer is responsible for parsing (e.g. with
22
+ * `@iarna/toml`) and, for workflows, for any `include` expansion. There is
23
+ * no coupling on a specific TOML parser version; pass whatever parsed
24
+ * object/operations[] you already have.
25
+ *
26
+ * Internal helpers (`collectParamRefs`, `declaredParamNames`,
27
+ * `locateOperationLine`) are intentionally NOT exported — they are
28
+ * implementation details of `validateOperations`.
29
+ */
30
+ import { type WorkflowTomlError } from "./lib/workflow-toml-validator.js";
31
+ export { validateWorkflowToml, formatWorkflowTomlErrors, type WorkflowTomlError, } from "./lib/workflow-toml-validator.js";
32
+ export { validateOperations, formatIssue, type ValidationIssue, type ValidationResult, type ValidateOptions, } from "./lib/toml-params-validator.js";
33
+ /**
34
+ * Result of {@link validateWorkflowTomlSource}.
35
+ */
36
+ export interface WorkflowTomlSourceResult {
37
+ /** The structured errors (empty when the source is valid). */
38
+ errors: WorkflowTomlError[];
39
+ /**
40
+ * A human-readable, multi-line error string (the same text `sync push`
41
+ * prints), or `null` when there are no errors.
42
+ */
43
+ formatted: string | null;
44
+ }
45
+ /**
46
+ * Validate a workflow TOML **source string** the exact way `sync push` does.
47
+ *
48
+ * Runs the identical pipeline `sync push` runs on every workflow file:
49
+ * `TOML.parse(raw)` → `expandWorkflowTomlData(parsed, filePath)`
50
+ * → `validateWorkflowToml(expanded)` → `formatWorkflowTomlErrors(...)`.
51
+ *
52
+ * The `include` fragment expansion resolves fragments relative to
53
+ * `<filePath>/../../workflow-fragments/` — pass the real (or intended) on-disk
54
+ * path of the workflow so fragment resolution matches `sync push`. If the
55
+ * source uses no `include` key the expander is a no-op and `filePath` is only
56
+ * used for error attribution.
57
+ *
58
+ * @param raw The raw workflow TOML source string.
59
+ * @param filePath The workflow's file path (used for fragment resolution and
60
+ * error attribution).
61
+ * @returns `{ errors, formatted }` — `errors` is empty and `formatted` is
62
+ * `null` when the source is valid.
63
+ */
64
+ export declare function validateWorkflowTomlSource(raw: string, filePath: string): WorkflowTomlSourceResult;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Public subpath export: `primitive-admin/validators` (issue #983).
3
+ *
4
+ * Re-exports the TOML validators that `sync push` runs as its load-bearing
5
+ * gate, so external tooling (e.g. `primitive-docs`) can validate the exact
6
+ * same way the published CLI does — instead of re-implementing the parse /
7
+ * expand / validate flow against submodule source and silently drifting.
8
+ *
9
+ * Two kinds of entry points are exported:
10
+ *
11
+ * 1. `validateWorkflowTomlSource(raw, filePath)` — the **source-level**
12
+ * wrapper. Runs the identical parse → fragment-expand → validate → format
13
+ * path that `sync push` runs for workflow TOML (`cli/src/commands/sync.ts`:
14
+ * `parseTomlFile()` → `validateWorkflowToml()` → `formatWorkflowTomlErrors()`).
15
+ * Use this when you have the raw TOML string and want zero divergence from
16
+ * `sync push`, including `include` fragment expansion.
17
+ *
18
+ * 2. The raw validators (`validateWorkflowToml`, `validateOperations`) and
19
+ * their formatters (`formatWorkflowTomlErrors`, `formatIssue`). These are
20
+ * **pure functions over already-parsed TOML** — they do not read files or
21
+ * parse TOML themselves. The consumer is responsible for parsing (e.g. with
22
+ * `@iarna/toml`) and, for workflows, for any `include` expansion. There is
23
+ * no coupling on a specific TOML parser version; pass whatever parsed
24
+ * object/operations[] you already have.
25
+ *
26
+ * Internal helpers (`collectParamRefs`, `declaredParamNames`,
27
+ * `locateOperationLine`) are intentionally NOT exported — they are
28
+ * implementation details of `validateOperations`.
29
+ */
30
+ import * as TOML from "@iarna/toml";
31
+ import { validateWorkflowToml, formatWorkflowTomlErrors, } from "./lib/workflow-toml-validator.js";
32
+ import { expandWorkflowTomlData } from "./lib/workflow-fragments.js";
33
+ export { validateWorkflowToml, formatWorkflowTomlErrors, } from "./lib/workflow-toml-validator.js";
34
+ export { validateOperations, formatIssue, } from "./lib/toml-params-validator.js";
35
+ /**
36
+ * Validate a workflow TOML **source string** the exact way `sync push` does.
37
+ *
38
+ * Runs the identical pipeline `sync push` runs on every workflow file:
39
+ * `TOML.parse(raw)` → `expandWorkflowTomlData(parsed, filePath)`
40
+ * → `validateWorkflowToml(expanded)` → `formatWorkflowTomlErrors(...)`.
41
+ *
42
+ * The `include` fragment expansion resolves fragments relative to
43
+ * `<filePath>/../../workflow-fragments/` — pass the real (or intended) on-disk
44
+ * path of the workflow so fragment resolution matches `sync push`. If the
45
+ * source uses no `include` key the expander is a no-op and `filePath` is only
46
+ * used for error attribution.
47
+ *
48
+ * @param raw The raw workflow TOML source string.
49
+ * @param filePath The workflow's file path (used for fragment resolution and
50
+ * error attribution).
51
+ * @returns `{ errors, formatted }` — `errors` is empty and `formatted` is
52
+ * `null` when the source is valid.
53
+ */
54
+ export function validateWorkflowTomlSource(raw, filePath) {
55
+ const parsed = TOML.parse(raw);
56
+ const expanded = expandWorkflowTomlData(parsed, filePath);
57
+ const errors = validateWorkflowToml(expanded);
58
+ return {
59
+ errors,
60
+ formatted: errors.length > 0 ? formatWorkflowTomlErrors(filePath, errors) : null,
61
+ };
62
+ }
63
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GAEzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GAEzB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,kBAAkB,EAClB,WAAW,GAIZ,MAAM,gCAAgC,CAAC;AAexC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,0BAA0B,CACxC,GAAW,EACX,QAAgB;IAEhB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAwB,CAAC;IACtD,MAAM,QAAQ,GAAG,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC9C,OAAO;QACL,MAAM;QACN,SAAS,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;KACjF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,17 +1,26 @@
1
1
  {
2
2
  "name": "primitive-admin",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "CLI for administering Primitive applications",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "primitive": "dist/bin/primitive.js"
8
8
  },
9
+ "exports": {
10
+ "./validators": {
11
+ "types": "./dist/src/validators.d.ts",
12
+ "import": "./dist/src/validators.js"
13
+ }
14
+ },
9
15
  "files": [
10
16
  "dist/",
11
17
  "assets/",
12
18
  "README.md"
13
19
  ],
14
20
  "scripts": {
21
+ "gen:allowlist": "node scripts/gen-allowlist.mjs",
22
+ "gen:allowlist:check": "node scripts/gen-allowlist.mjs --check",
23
+ "prebuild": "node scripts/gen-allowlist.mjs",
15
24
  "build": "tsc",
16
25
  "typecheck": "tsc --noEmit",
17
26
  "prepublishOnly": "pnpm run build",