primitive-admin 1.0.52 → 1.0.54
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 +38 -10
- package/dist/bin/primitive.js +6 -0
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/auth.js +16 -6
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +84 -7
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/catalog.js +3 -3
- package/dist/src/commands/catalog.js.map +1 -1
- package/dist/src/commands/collections.js +12 -9
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/database-types.js +11 -1
- package/dist/src/commands/database-types.js.map +1 -1
- package/dist/src/commands/databases.js +197 -74
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/group-type-configs.js +1 -9
- package/dist/src/commands/group-type-configs.js.map +1 -1
- package/dist/src/commands/groups.js +12 -6
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.d.ts +161 -0
- package/dist/src/commands/guides.js +502 -84
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/init.js +77 -45
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +2 -2
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/metadata.d.ts +2 -0
- package/dist/src/commands/metadata.js +344 -0
- package/dist/src/commands/metadata.js.map +1 -0
- package/dist/src/commands/prompts.js +2 -2
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +1 -0
- package/dist/src/commands/rule-sets.js +25 -3
- package/dist/src/commands/rule-sets.js.map +1 -1
- 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/sync.d.ts +212 -16
- package/dist/src/commands/sync.js +1688 -287
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/vars.d.ts +8 -0
- package/dist/src/commands/vars.js +110 -0
- package/dist/src/commands/vars.js.map +1 -0
- package/dist/src/commands/webhooks.js +17 -3
- package/dist/src/commands/webhooks.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +30 -0
- package/dist/src/commands/workflows.js +651 -52
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +123 -19
- package/dist/src/lib/api-client.js +128 -4
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/batch.d.ts +26 -0
- package/dist/src/lib/batch.js +32 -0
- package/dist/src/lib/batch.js.map +1 -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/codegen-shared/generatedFiles.d.ts +61 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +127 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
- package/dist/src/lib/config-toml.d.ts +10 -0
- package/dist/src/lib/config-toml.js +42 -0
- package/dist/src/lib/config-toml.js.map +1 -0
- package/dist/src/lib/config.d.ts +16 -0
- package/dist/src/lib/config.js +41 -0
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/constants.d.ts +9 -0
- package/dist/src/lib/constants.js +9 -0
- package/dist/src/lib/constants.js.map +1 -1
- package/dist/src/lib/csv.d.ts +1 -2
- package/dist/src/lib/csv.js +3 -8
- package/dist/src/lib/csv.js.map +1 -1
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +35 -7
- package/dist/src/lib/db-codegen/dbGenerator.js +384 -125
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +29 -0
- package/dist/src/lib/db-codegen/dbNaming.js +58 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +114 -5
- package/dist/src/lib/db-codegen/dbTemplates.js +163 -16
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +7 -3
- package/dist/src/lib/db-codegen/dbTsTypes.js +23 -1
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/generated-allowlist.js +52 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/init-config.d.ts +13 -0
- package/dist/src/lib/init-config.js +21 -2
- package/dist/src/lib/init-config.js.map +1 -1
- package/dist/src/lib/output.d.ts +42 -5
- package/dist/src/lib/output.js +70 -4
- package/dist/src/lib/output.js.map +1 -1
- 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/template.d.ts +9 -5
- package/dist/src/lib/template.js +58 -45
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/toml-database-config.d.ts +10 -19
- package/dist/src/lib/toml-database-config.js +28 -59
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-metadata-config.d.ts +147 -0
- package/dist/src/lib/toml-metadata-config.js +463 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -0
- package/dist/src/lib/toml-native-form.d.ts +46 -0
- package/dist/src/lib/toml-native-form.js +78 -0
- package/dist/src/lib/toml-native-form.js.map +1 -0
- package/dist/src/lib/toml-params-validator.d.ts +34 -0
- package/dist/src/lib/toml-params-validator.js +118 -3
- package/dist/src/lib/toml-params-validator.js.map +1 -1
- package/dist/src/lib/workflow-apply.d.ts +86 -0
- package/dist/src/lib/workflow-apply.js +127 -0
- package/dist/src/lib/workflow-apply.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +74 -0
- package/dist/src/lib/workflow-codegen/generator.js +215 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
- package/dist/src/lib/workflow-codegen/naming.js +81 -0
- package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +64 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js +282 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/workflow-fragments.js +3 -3
- package/dist/src/lib/workflow-fragments.js.map +1 -1
- package/dist/src/lib/workflow-payload.d.ts +68 -0
- package/dist/src/lib/workflow-payload.js +150 -0
- package/dist/src/lib/workflow-payload.js.map +1 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +1 -1
- package/dist/src/lib/workflow-toml-validator.js +37 -1
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/dist/src/types/index.d.ts +11 -0
- package/dist/src/validators.d.ts +4 -3
- package/dist/src/validators.js +6 -5
- package/dist/src/validators.js.map +1 -1
- package/package.json +5 -3
|
@@ -301,6 +301,17 @@ interface TopPromptsResponse {
|
|
|
301
301
|
prompts: PromptAnalyticsSummary[];
|
|
302
302
|
_timing: AnalyticsTiming;
|
|
303
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* One operation in an `admin-data/batch` request. Mirrors the wire shape the
|
|
306
|
+
* DatabaseDO expects (`databases-controller.ts`): `{ op, modelName, id, data }`.
|
|
307
|
+
* `data` is required for `save`/`patch` and omitted for `delete`.
|
|
308
|
+
*/
|
|
309
|
+
export interface DatabaseBatchOperation {
|
|
310
|
+
op: "save" | "patch" | "delete";
|
|
311
|
+
modelName: string;
|
|
312
|
+
id: string;
|
|
313
|
+
data?: any;
|
|
314
|
+
}
|
|
304
315
|
export declare class ApiClient {
|
|
305
316
|
private credentials;
|
|
306
317
|
constructor();
|
|
@@ -445,6 +456,14 @@ export declare class ApiClient {
|
|
|
445
456
|
summary?: string;
|
|
446
457
|
}): Promise<any>;
|
|
447
458
|
deleteAppSecret(appId: string, secretId: string): Promise<any>;
|
|
459
|
+
listAppConfigVars(appId: string): Promise<any[]>;
|
|
460
|
+
upsertAppConfigVar(appId: string, key: string, payload: {
|
|
461
|
+
value: string;
|
|
462
|
+
summary?: string;
|
|
463
|
+
}, expectedModifiedAt?: string, options?: {
|
|
464
|
+
expectNotExists?: boolean;
|
|
465
|
+
}): Promise<any>;
|
|
466
|
+
deleteAppConfigVar(appId: string, key: string, expectedModifiedAt?: string): Promise<any>;
|
|
448
467
|
listWebhooks(appId: string, params?: {
|
|
449
468
|
status?: string;
|
|
450
469
|
cursor?: string;
|
|
@@ -474,6 +493,45 @@ export declare class ApiClient {
|
|
|
474
493
|
pauseCronTrigger(appId: string, triggerId: string): Promise<any>;
|
|
475
494
|
resumeCronTrigger(appId: string, triggerId: string): Promise<any>;
|
|
476
495
|
testCronTrigger(appId: string, triggerId: string): Promise<any>;
|
|
496
|
+
listIterations(appId: string): Promise<{
|
|
497
|
+
items: any[];
|
|
498
|
+
}>;
|
|
499
|
+
getIteration(appId: string, iterationName: string): Promise<any>;
|
|
500
|
+
resetIteration(appId: string, iterationName: string): Promise<any>;
|
|
501
|
+
readResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string): Promise<any>;
|
|
502
|
+
writeResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string, data: Record<string, any>): Promise<any>;
|
|
503
|
+
batchReadResourceMetadata(appId: string, requests: Array<{
|
|
504
|
+
resourceType: string;
|
|
505
|
+
resourceId: string;
|
|
506
|
+
categories: string[];
|
|
507
|
+
}>): Promise<{
|
|
508
|
+
results: any[];
|
|
509
|
+
}>;
|
|
510
|
+
/**
|
|
511
|
+
* List every stored metadata category on one resource (issue #1402 — debug
|
|
512
|
+
* tooling). The CLI authenticates as a console admin, so the app-level
|
|
513
|
+
* owner/admin bypass returns every category regardless of its readRule.
|
|
514
|
+
*/
|
|
515
|
+
listResourceMetadata(appId: string, resourceType: string, resourceId: string): Promise<{
|
|
516
|
+
resourceType: string;
|
|
517
|
+
resourceId: string;
|
|
518
|
+
categories: Array<{
|
|
519
|
+
category: string;
|
|
520
|
+
data: Record<string, any>;
|
|
521
|
+
schemaVersion: number | null;
|
|
522
|
+
}>;
|
|
523
|
+
}>;
|
|
524
|
+
/**
|
|
525
|
+
* Delete one resource's metadata for one category (issue #1402 — debug
|
|
526
|
+
* tooling). Idempotent: deleting an absent item succeeds with
|
|
527
|
+
* `deleted: false` rather than a 404.
|
|
528
|
+
*/
|
|
529
|
+
deleteResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string): Promise<{
|
|
530
|
+
resourceType: string;
|
|
531
|
+
resourceId: string;
|
|
532
|
+
category: string;
|
|
533
|
+
deleted: boolean;
|
|
534
|
+
}>;
|
|
477
535
|
listPrompts(appId: string, params?: {
|
|
478
536
|
status?: string;
|
|
479
537
|
limit?: number;
|
|
@@ -510,6 +568,17 @@ export declare class ApiClient {
|
|
|
510
568
|
items: any[];
|
|
511
569
|
}>;
|
|
512
570
|
getScript(appId: string, scriptId: string): Promise<any>;
|
|
571
|
+
/**
|
|
572
|
+
* List a script's versioned configs (the `ScriptConfig` rows). Each config
|
|
573
|
+
* is a distinct block version: `configId` is the stable version selector,
|
|
574
|
+
* `contentHash` is its content identity, and `status` reports whether it is
|
|
575
|
+
* `active`/`draft`/`archived`. The script header's `activeConfigId` names
|
|
576
|
+
* the live version. Used by `scripts configs list` and by the script test
|
|
577
|
+
* commands to run against a specific pinned version.
|
|
578
|
+
*/
|
|
579
|
+
listScriptConfigs(appId: string, scriptId: string): Promise<{
|
|
580
|
+
items: any[];
|
|
581
|
+
}>;
|
|
513
582
|
createScript(appId: string, payload: {
|
|
514
583
|
name: string;
|
|
515
584
|
body: string;
|
|
@@ -533,11 +602,11 @@ export declare class ApiClient {
|
|
|
533
602
|
activeConfigId: string | null;
|
|
534
603
|
activeConfigName: string | null;
|
|
535
604
|
}>;
|
|
536
|
-
listTestCases(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string): Promise<{
|
|
605
|
+
listTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string): Promise<{
|
|
537
606
|
items: any[];
|
|
538
607
|
}>;
|
|
539
|
-
getTestCase(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, testCaseId: string): Promise<any>;
|
|
540
|
-
createTestCase(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, payload: {
|
|
608
|
+
getTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<any>;
|
|
609
|
+
createTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
|
|
541
610
|
name: string;
|
|
542
611
|
inputVariables: Record<string, any>;
|
|
543
612
|
expectedOutputPattern?: string;
|
|
@@ -547,7 +616,7 @@ export declare class ApiClient {
|
|
|
547
616
|
evaluatorPromptId?: string;
|
|
548
617
|
evaluatorConfigId?: string;
|
|
549
618
|
}): Promise<any>;
|
|
550
|
-
updateTestCase(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, testCaseId: string, payload: {
|
|
619
|
+
updateTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, payload: {
|
|
551
620
|
name?: string;
|
|
552
621
|
inputVariables?: Record<string, any>;
|
|
553
622
|
expectedOutputPattern?: string | null;
|
|
@@ -557,8 +626,8 @@ export declare class ApiClient {
|
|
|
557
626
|
evaluatorPromptId?: string | null;
|
|
558
627
|
evaluatorConfigId?: string | null;
|
|
559
628
|
}): Promise<any>;
|
|
560
|
-
deleteTestCase(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, testCaseId: string): Promise<void>;
|
|
561
|
-
listTestCaseAttachments(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, testCaseId: string): Promise<{
|
|
629
|
+
deleteTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<void>;
|
|
630
|
+
listTestCaseAttachments(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<{
|
|
562
631
|
attachments: Array<{
|
|
563
632
|
filename: string;
|
|
564
633
|
contentType: string;
|
|
@@ -566,7 +635,7 @@ export declare class ApiClient {
|
|
|
566
635
|
r2Key: string;
|
|
567
636
|
}>;
|
|
568
637
|
}>;
|
|
569
|
-
uploadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, testCaseId: string, filename: string, data: Buffer, contentType: string): Promise<{
|
|
638
|
+
uploadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string, data: Buffer, contentType: string): Promise<{
|
|
570
639
|
success: boolean;
|
|
571
640
|
attachment: {
|
|
572
641
|
filename: string;
|
|
@@ -575,26 +644,26 @@ export declare class ApiClient {
|
|
|
575
644
|
r2Key: string;
|
|
576
645
|
};
|
|
577
646
|
}>;
|
|
578
|
-
downloadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, testCaseId: string, filename: string): Promise<{
|
|
647
|
+
downloadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string): Promise<{
|
|
579
648
|
data: Buffer;
|
|
580
649
|
contentType: string;
|
|
581
650
|
}>;
|
|
582
|
-
deleteTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, testCaseId: string, filename: string): Promise<{
|
|
651
|
+
deleteTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string): Promise<{
|
|
583
652
|
success: boolean;
|
|
584
653
|
deleted: boolean;
|
|
585
654
|
}>;
|
|
586
|
-
executeBlockTest(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, payload: {
|
|
655
|
+
executeBlockTest(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
|
|
587
656
|
variables?: Record<string, any>;
|
|
588
657
|
testCaseId?: string;
|
|
589
658
|
configId?: string;
|
|
590
659
|
comparisonGroup?: string;
|
|
591
660
|
}): Promise<any>;
|
|
592
|
-
runAllTestCases(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, payload?: {
|
|
661
|
+
runAllTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
|
|
593
662
|
overrideConfigId?: string;
|
|
594
663
|
comparisonGroup?: string;
|
|
595
664
|
testCaseIds?: string[];
|
|
596
665
|
}): Promise<any>;
|
|
597
|
-
listTestRuns(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, params?: {
|
|
666
|
+
listTestRuns(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, params?: {
|
|
598
667
|
limit?: number;
|
|
599
668
|
comparisonGroup?: string;
|
|
600
669
|
}): Promise<{
|
|
@@ -772,7 +841,7 @@ export declare class ApiClient {
|
|
|
772
841
|
appId: string;
|
|
773
842
|
workflowId: string;
|
|
774
843
|
}): Promise<any>;
|
|
775
|
-
startBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, payload?: {
|
|
844
|
+
startBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
|
|
776
845
|
comparisonGroup?: string;
|
|
777
846
|
overrideConfigId?: string;
|
|
778
847
|
testCaseIds?: string[];
|
|
@@ -782,7 +851,7 @@ export declare class ApiClient {
|
|
|
782
851
|
instanceIds: string[];
|
|
783
852
|
errors?: any[];
|
|
784
853
|
}>;
|
|
785
|
-
getBatchTestStatus(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, batchId: string): Promise<{
|
|
854
|
+
getBatchTestStatus(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, batchId: string): Promise<{
|
|
786
855
|
status: string;
|
|
787
856
|
batchId: string;
|
|
788
857
|
completed: number;
|
|
@@ -799,7 +868,7 @@ export declare class ApiClient {
|
|
|
799
868
|
endedAt?: string;
|
|
800
869
|
}>;
|
|
801
870
|
}>;
|
|
802
|
-
cancelBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow", blockId: string, batchId: string, instanceIds: string[]): Promise<{
|
|
871
|
+
cancelBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, batchId: string, instanceIds: string[]): Promise<{
|
|
803
872
|
batchId: string;
|
|
804
873
|
terminated: string[];
|
|
805
874
|
errors?: any[];
|
|
@@ -871,6 +940,7 @@ export declare class ApiClient {
|
|
|
871
940
|
title: string;
|
|
872
941
|
databaseType?: string;
|
|
873
942
|
metadata?: Record<string, any> | string;
|
|
943
|
+
initialMetadata?: Record<string, Record<string, unknown>>;
|
|
874
944
|
}): Promise<any>;
|
|
875
945
|
getDatabase(appId: string, databaseId: string): Promise<any>;
|
|
876
946
|
updateDatabase(appId: string, databaseId: string, data: Record<string, any>): Promise<any>;
|
|
@@ -968,6 +1038,7 @@ export declare class ApiClient {
|
|
|
968
1038
|
autoPopulatedFields?: Record<string, any> | null;
|
|
969
1039
|
timestamps?: Record<string, any> | null;
|
|
970
1040
|
schema?: string | null;
|
|
1041
|
+
metadataManifest?: any;
|
|
971
1042
|
}): Promise<any>;
|
|
972
1043
|
updateDatabaseTypeConfig(appId: string, databaseType: string, data: {
|
|
973
1044
|
ruleSetId?: string | null;
|
|
@@ -979,11 +1050,14 @@ export declare class ApiClient {
|
|
|
979
1050
|
schema?: string | null;
|
|
980
1051
|
pendingOpDeletes?: string[];
|
|
981
1052
|
finalOpNames?: string[];
|
|
1053
|
+
metadataManifest?: any;
|
|
982
1054
|
}, expectedModifiedAt?: string, options?: {
|
|
983
1055
|
dryRun?: boolean;
|
|
984
1056
|
acceptWarnings?: boolean;
|
|
985
1057
|
}): Promise<any>;
|
|
986
|
-
deleteDatabaseTypeConfig(appId: string, databaseType: string
|
|
1058
|
+
deleteDatabaseTypeConfig(appId: string, databaseType: string, options?: {
|
|
1059
|
+
force?: boolean;
|
|
1060
|
+
}): Promise<any>;
|
|
987
1061
|
/**
|
|
988
1062
|
* Issue #666 Phase 3: ask the server to scaffold a TOML schema from
|
|
989
1063
|
* existing ops + DO field introspection. Read-only — does NOT persist.
|
|
@@ -1036,7 +1110,7 @@ export declare class ApiClient {
|
|
|
1036
1110
|
}>;
|
|
1037
1111
|
createGroup(appId: string, data: {
|
|
1038
1112
|
groupType: string;
|
|
1039
|
-
groupId
|
|
1113
|
+
groupId?: string;
|
|
1040
1114
|
name: string;
|
|
1041
1115
|
description?: string;
|
|
1042
1116
|
}): Promise<any>;
|
|
@@ -1046,7 +1120,9 @@ export declare class ApiClient {
|
|
|
1046
1120
|
description?: string;
|
|
1047
1121
|
}): Promise<any>;
|
|
1048
1122
|
deleteGroup(appId: string, groupType: string, groupId: string): Promise<any>;
|
|
1049
|
-
listGroupMembers(appId: string, groupType: string, groupId: string
|
|
1123
|
+
listGroupMembers(appId: string, groupType: string, groupId: string, options?: {
|
|
1124
|
+
include?: "profiles";
|
|
1125
|
+
}): Promise<{
|
|
1050
1126
|
items: any[];
|
|
1051
1127
|
cursor?: string;
|
|
1052
1128
|
}>;
|
|
@@ -1080,6 +1156,7 @@ export declare class ApiClient {
|
|
|
1080
1156
|
createCollection(appId: string, data: {
|
|
1081
1157
|
name: string;
|
|
1082
1158
|
description?: string;
|
|
1159
|
+
initialMetadata?: Record<string, Record<string, unknown>>;
|
|
1083
1160
|
}): Promise<any>;
|
|
1084
1161
|
getCollection(appId: string, collectionId: string): Promise<any>;
|
|
1085
1162
|
updateCollection(appId: string, collectionId: string, data: {
|
|
@@ -1122,11 +1199,32 @@ export declare class ApiClient {
|
|
|
1122
1199
|
createCollectionTypeConfig(appId: string, data: {
|
|
1123
1200
|
collectionType: string;
|
|
1124
1201
|
ruleSetId?: string;
|
|
1202
|
+
metadataManifest?: any;
|
|
1125
1203
|
}): Promise<any>;
|
|
1126
1204
|
updateCollectionTypeConfig(appId: string, collectionType: string, data: {
|
|
1127
1205
|
ruleSetId?: string | null;
|
|
1206
|
+
metadataManifest?: any;
|
|
1128
1207
|
}, expectedModifiedAt?: string): Promise<any>;
|
|
1129
1208
|
deleteCollectionTypeConfig(appId: string, collectionType: string): Promise<any>;
|
|
1209
|
+
/**
|
|
1210
|
+
* List all metadata category configs for an app. The route returns
|
|
1211
|
+
* `{ configs: [...] }`; unwrap to a bare array to match the other
|
|
1212
|
+
* `list*Configs` helpers.
|
|
1213
|
+
*/
|
|
1214
|
+
listMetadataCategoryConfigs(appId: string): Promise<any[]>;
|
|
1215
|
+
getMetadataCategoryConfig(appId: string, resourceType: string, category: string): Promise<any>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Create or replace a metadata category config (idempotent upsert via the
|
|
1218
|
+
* path-addressed PUT route). `resourceType` / `category` identify the config;
|
|
1219
|
+
* the body carries `schema` / `readRule` / `writeRule` / `description`.
|
|
1220
|
+
*/
|
|
1221
|
+
upsertMetadataCategoryConfig(appId: string, resourceType: string, category: string, data: {
|
|
1222
|
+
schema: unknown;
|
|
1223
|
+
readRule?: string | null;
|
|
1224
|
+
writeRule?: string | null;
|
|
1225
|
+
description?: string | null;
|
|
1226
|
+
metadataManifest?: unknown;
|
|
1227
|
+
}): Promise<any>;
|
|
1130
1228
|
listRuleSets(appId: string, params?: {
|
|
1131
1229
|
resourceType?: string;
|
|
1132
1230
|
}): Promise<any[]>;
|
|
@@ -1144,6 +1242,9 @@ export declare class ApiClient {
|
|
|
1144
1242
|
}, expectedModifiedAt?: string): Promise<any>;
|
|
1145
1243
|
deleteRuleSet(appId: string, ruleSetId: string): Promise<any>;
|
|
1146
1244
|
getRuleSetSchema(appId: string): Promise<any>;
|
|
1245
|
+
getRuleSetResourceTypes(appId: string): Promise<{
|
|
1246
|
+
resourceTypes: string[];
|
|
1247
|
+
}>;
|
|
1147
1248
|
testRuleSet(appId: string, ruleSetId: string, data: any): Promise<any>;
|
|
1148
1249
|
debugRuleSet(appId: string, data: any): Promise<any>;
|
|
1149
1250
|
listGroupTypeConfigs(appId: string): Promise<any[]>;
|
|
@@ -1152,10 +1253,12 @@ export declare class ApiClient {
|
|
|
1152
1253
|
groupType: string;
|
|
1153
1254
|
ruleSetId?: string;
|
|
1154
1255
|
autoAddCreator?: boolean;
|
|
1256
|
+
metadataManifest?: any;
|
|
1155
1257
|
}): Promise<any>;
|
|
1156
1258
|
updateGroupTypeConfig(appId: string, groupType: string, data: {
|
|
1157
1259
|
ruleSetId?: string | null;
|
|
1158
1260
|
autoAddCreator?: boolean;
|
|
1261
|
+
metadataManifest?: any;
|
|
1159
1262
|
}, expectedModifiedAt?: string): Promise<any>;
|
|
1160
1263
|
deleteGroupTypeConfig(appId: string, groupType: string): Promise<any>;
|
|
1161
1264
|
exportDocumentState(appId: string, documentId: string): Promise<{
|
|
@@ -1189,7 +1292,7 @@ export declare class ApiClient {
|
|
|
1189
1292
|
findUserByEmail(appId: string, email: string): Promise<any | null>;
|
|
1190
1293
|
listAdminDocuments(appId: string, userId: string): Promise<any[]>;
|
|
1191
1294
|
saveDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string, data: any): Promise<any>;
|
|
1192
|
-
batchDatabaseRecords(appId: string, databaseId: string, operations:
|
|
1295
|
+
batchDatabaseRecords(appId: string, databaseId: string, operations: DatabaseBatchOperation[]): Promise<any>;
|
|
1193
1296
|
deleteDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string): Promise<any>;
|
|
1194
1297
|
batchDeleteDatabaseRecords(appId: string, databaseId: string, operations: {
|
|
1195
1298
|
op: "delete";
|
|
@@ -1223,6 +1326,7 @@ export declare class ApiClient {
|
|
|
1223
1326
|
}): Promise<any>;
|
|
1224
1327
|
downloadBucketBlob(appId: string, bucketIdOrKey: string, blobId: string): Promise<Buffer>;
|
|
1225
1328
|
deleteBucketBlob(appId: string, bucketIdOrKey: string, blobId: string): Promise<any>;
|
|
1329
|
+
deleteBucketBlobs(appId: string, bucketIdOrKey: string, blobIds: string[]): Promise<any>;
|
|
1226
1330
|
getBucketBlobSignedUrl(appId: string, bucketIdOrKey: string, blobId: string, expiresInSeconds?: number): Promise<any>;
|
|
1227
1331
|
}
|
|
1228
1332
|
export declare const apiClient: ApiClient;
|
|
@@ -510,6 +510,43 @@ export class ApiClient {
|
|
|
510
510
|
return this.delete(`/admin/api/apps/${appId}/secrets/${secretId}`);
|
|
511
511
|
}
|
|
512
512
|
// ============================================
|
|
513
|
+
// APP CONFIG VARS (issue #1364 — non-secret twin of secrets)
|
|
514
|
+
// ============================================
|
|
515
|
+
async listAppConfigVars(appId) {
|
|
516
|
+
const result = await this.get(`/admin/api/apps/${appId}/vars`);
|
|
517
|
+
return result?.items ?? [];
|
|
518
|
+
}
|
|
519
|
+
async upsertAppConfigVar(appId, key, payload, expectedModifiedAt, options = {}) {
|
|
520
|
+
// Encode the key so a malformed one (e.g. containing "/") reaches the
|
|
521
|
+
// server's key validation (400) instead of producing a routing 404.
|
|
522
|
+
// `expectedModifiedAt` (issue #1423 review r-2 P1) is the optimistic-
|
|
523
|
+
// concurrency precondition for an UPDATE — the server rejects the write
|
|
524
|
+
// with a 409 CONFLICT (surfaced as `ConflictError`) if the var changed
|
|
525
|
+
// since it.
|
|
526
|
+
//
|
|
527
|
+
// `expectNotExists` (issue #1423 review r-3 P1a) is the create-only
|
|
528
|
+
// precondition. A create has no baseline timestamp to send, but without
|
|
529
|
+
// any precondition the by-key upsert silently overwrites a var created
|
|
530
|
+
// remotely since our snapshot. Setting `expectNotExists` makes the server
|
|
531
|
+
// 409 CONFLICT if the key already exists instead of overwriting it.
|
|
532
|
+
const body = { ...payload };
|
|
533
|
+
if (expectedModifiedAt !== undefined)
|
|
534
|
+
body.expectedModifiedAt = expectedModifiedAt;
|
|
535
|
+
if (options.expectNotExists)
|
|
536
|
+
body.expectNotExists = true;
|
|
537
|
+
return this.put(`/admin/api/apps/${appId}/vars/by-key/${encodeURIComponent(key)}`, body);
|
|
538
|
+
}
|
|
539
|
+
async deleteAppConfigVar(appId, key, expectedModifiedAt) {
|
|
540
|
+
// The DELETE carries the optimistic-concurrency precondition (issue #1423
|
|
541
|
+
// review r-2 P1) as a query param since it has no body; the server 409s
|
|
542
|
+
// (ConflictError) if the var was edited remotely since `expectedModifiedAt`.
|
|
543
|
+
let path = `/admin/api/apps/${appId}/vars/by-key/${encodeURIComponent(key)}`;
|
|
544
|
+
if (expectedModifiedAt !== undefined) {
|
|
545
|
+
path += `?expectedModifiedAt=${encodeURIComponent(expectedModifiedAt)}`;
|
|
546
|
+
}
|
|
547
|
+
return this.delete(path);
|
|
548
|
+
}
|
|
549
|
+
// ============================================
|
|
513
550
|
// WEBHOOKS
|
|
514
551
|
// ============================================
|
|
515
552
|
async listWebhooks(appId, params) {
|
|
@@ -571,6 +608,49 @@ export class ApiClient {
|
|
|
571
608
|
return this.post(`/app/${appId}/api/cron-triggers/${triggerId}/test`, {});
|
|
572
609
|
}
|
|
573
610
|
// ============================================
|
|
611
|
+
// ITERATIONS (iterate-users introspection / reset — #1209)
|
|
612
|
+
// ============================================
|
|
613
|
+
async listIterations(appId) {
|
|
614
|
+
const result = await this.get(`/app/${appId}/api/iterations`);
|
|
615
|
+
return { items: result?.items ?? [] };
|
|
616
|
+
}
|
|
617
|
+
async getIteration(appId, iterationName) {
|
|
618
|
+
return this.get(`/app/${appId}/api/iterations/${encodeURIComponent(iterationName)}`);
|
|
619
|
+
}
|
|
620
|
+
async resetIteration(appId, iterationName) {
|
|
621
|
+
return this.post(`/app/${appId}/api/iterations/${encodeURIComponent(iterationName)}/reset`, {});
|
|
622
|
+
}
|
|
623
|
+
// ============================================
|
|
624
|
+
// RESOURCE METADATA (values — issue #1352)
|
|
625
|
+
// ============================================
|
|
626
|
+
async readResourceMetadata(appId, resourceType, resourceId, category) {
|
|
627
|
+
return this.get(`/app/${appId}/api/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/metadata/${encodeURIComponent(category)}`);
|
|
628
|
+
}
|
|
629
|
+
async writeResourceMetadata(appId, resourceType, resourceId, category, data) {
|
|
630
|
+
return this.put(`/app/${appId}/api/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/metadata/${encodeURIComponent(category)}`, { data });
|
|
631
|
+
}
|
|
632
|
+
async batchReadResourceMetadata(appId, requests) {
|
|
633
|
+
return this.post(`/app/${appId}/api/resources/metadata/batch`, {
|
|
634
|
+
requests,
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* List every stored metadata category on one resource (issue #1402 — debug
|
|
639
|
+
* tooling). The CLI authenticates as a console admin, so the app-level
|
|
640
|
+
* owner/admin bypass returns every category regardless of its readRule.
|
|
641
|
+
*/
|
|
642
|
+
async listResourceMetadata(appId, resourceType, resourceId) {
|
|
643
|
+
return this.get(`/app/${appId}/api/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/metadata`);
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Delete one resource's metadata for one category (issue #1402 — debug
|
|
647
|
+
* tooling). Idempotent: deleting an absent item succeeds with
|
|
648
|
+
* `deleted: false` rather than a 404.
|
|
649
|
+
*/
|
|
650
|
+
async deleteResourceMetadata(appId, resourceType, resourceId, category) {
|
|
651
|
+
return this.delete(`/app/${appId}/api/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/metadata/${encodeURIComponent(category)}`);
|
|
652
|
+
}
|
|
653
|
+
// ============================================
|
|
574
654
|
// PROMPTS
|
|
575
655
|
// ============================================
|
|
576
656
|
async listPrompts(appId, params) {
|
|
@@ -640,6 +720,18 @@ export class ApiClient {
|
|
|
640
720
|
async getScript(appId, scriptId) {
|
|
641
721
|
return this.get(`/admin/api/apps/${appId}/scripts/${scriptId}`);
|
|
642
722
|
}
|
|
723
|
+
/**
|
|
724
|
+
* List a script's versioned configs (the `ScriptConfig` rows). Each config
|
|
725
|
+
* is a distinct block version: `configId` is the stable version selector,
|
|
726
|
+
* `contentHash` is its content identity, and `status` reports whether it is
|
|
727
|
+
* `active`/`draft`/`archived`. The script header's `activeConfigId` names
|
|
728
|
+
* the live version. Used by `scripts configs list` and by the script test
|
|
729
|
+
* commands to run against a specific pinned version.
|
|
730
|
+
*/
|
|
731
|
+
async listScriptConfigs(appId, scriptId) {
|
|
732
|
+
const result = await this.get(`/admin/api/apps/${appId}/scripts/${scriptId}/configs`);
|
|
733
|
+
return { items: result?.items ?? [] };
|
|
734
|
+
}
|
|
643
735
|
async createScript(appId, payload) {
|
|
644
736
|
// Mints the script header + a default `active` config carrying the body.
|
|
645
737
|
return this.post(`/admin/api/apps/${appId}/scripts`, payload);
|
|
@@ -1252,8 +1344,9 @@ export class ApiClient {
|
|
|
1252
1344
|
const path = `/app/${appId}/api/databases/types/${encodeURIComponent(databaseType)}${query ? `?${query}` : ""}`;
|
|
1253
1345
|
return this.patch(path, body);
|
|
1254
1346
|
}
|
|
1255
|
-
async deleteDatabaseTypeConfig(appId, databaseType) {
|
|
1256
|
-
|
|
1347
|
+
async deleteDatabaseTypeConfig(appId, databaseType, options) {
|
|
1348
|
+
const query = options?.force ? "?force=true" : "";
|
|
1349
|
+
return this.delete(`/app/${appId}/api/databases/types/${encodeURIComponent(databaseType)}${query}`);
|
|
1257
1350
|
}
|
|
1258
1351
|
/**
|
|
1259
1352
|
* Issue #666 Phase 3: ask the server to scaffold a TOML schema from
|
|
@@ -1363,8 +1456,9 @@ export class ApiClient {
|
|
|
1363
1456
|
// ============================================
|
|
1364
1457
|
// GROUP MEMBERS
|
|
1365
1458
|
// ============================================
|
|
1366
|
-
async listGroupMembers(appId, groupType, groupId) {
|
|
1367
|
-
|
|
1459
|
+
async listGroupMembers(appId, groupType, groupId, options) {
|
|
1460
|
+
const qs = options?.include ? `?include=${options.include}` : "";
|
|
1461
|
+
return this.get(`/app/${appId}/api/groups/${groupType}/${groupId}/members${qs}`);
|
|
1368
1462
|
}
|
|
1369
1463
|
async addGroupMember(appId, groupType, groupId, data) {
|
|
1370
1464
|
return this.post(`/app/${appId}/api/groups/${groupType}/${groupId}/members`, data);
|
|
@@ -1510,6 +1604,29 @@ export class ApiClient {
|
|
|
1510
1604
|
return this.delete(`/app/${appId}/api/collection-type-configs/${collectionType}`);
|
|
1511
1605
|
}
|
|
1512
1606
|
// ============================================
|
|
1607
|
+
// METADATA CATEGORY CONFIGS (issue #1304, P-B)
|
|
1608
|
+
// ============================================
|
|
1609
|
+
/**
|
|
1610
|
+
* List all metadata category configs for an app. The route returns
|
|
1611
|
+
* `{ configs: [...] }`; unwrap to a bare array to match the other
|
|
1612
|
+
* `list*Configs` helpers.
|
|
1613
|
+
*/
|
|
1614
|
+
async listMetadataCategoryConfigs(appId) {
|
|
1615
|
+
const res = await this.get(`/app/${appId}/api/metadata-categories`);
|
|
1616
|
+
return Array.isArray(res?.configs) ? res.configs : [];
|
|
1617
|
+
}
|
|
1618
|
+
async getMetadataCategoryConfig(appId, resourceType, category) {
|
|
1619
|
+
return this.get(`/app/${appId}/api/metadata-categories/${encodeURIComponent(resourceType)}/${encodeURIComponent(category)}`);
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Create or replace a metadata category config (idempotent upsert via the
|
|
1623
|
+
* path-addressed PUT route). `resourceType` / `category` identify the config;
|
|
1624
|
+
* the body carries `schema` / `readRule` / `writeRule` / `description`.
|
|
1625
|
+
*/
|
|
1626
|
+
async upsertMetadataCategoryConfig(appId, resourceType, category, data) {
|
|
1627
|
+
return this.put(`/app/${appId}/api/metadata-categories/${encodeURIComponent(resourceType)}/${encodeURIComponent(category)}`, data);
|
|
1628
|
+
}
|
|
1629
|
+
// ============================================
|
|
1513
1630
|
// ACCESS RULE SETS
|
|
1514
1631
|
// ============================================
|
|
1515
1632
|
async listRuleSets(appId, params) {
|
|
@@ -1531,6 +1648,9 @@ export class ApiClient {
|
|
|
1531
1648
|
async getRuleSetSchema(appId) {
|
|
1532
1649
|
return this.get(`/app/${appId}/api/rule-sets/schema`);
|
|
1533
1650
|
}
|
|
1651
|
+
async getRuleSetResourceTypes(appId) {
|
|
1652
|
+
return this.get(`/app/${appId}/api/rule-sets/resource-types`);
|
|
1653
|
+
}
|
|
1534
1654
|
async testRuleSet(appId, ruleSetId, data) {
|
|
1535
1655
|
return this.post(`/app/${appId}/api/rule-sets/${ruleSetId}/test`, data);
|
|
1536
1656
|
}
|
|
@@ -1738,6 +1858,10 @@ export class ApiClient {
|
|
|
1738
1858
|
async deleteBucketBlob(appId, bucketIdOrKey, blobId) {
|
|
1739
1859
|
return this.delete(`/app/${appId}/api/blob-buckets/${encodeURIComponent(bucketIdOrKey)}/blobs/${blobId}`);
|
|
1740
1860
|
}
|
|
1861
|
+
// Batch delete (#1455): one round-trip for N ids via POST .../blobs/delete.
|
|
1862
|
+
async deleteBucketBlobs(appId, bucketIdOrKey, blobIds) {
|
|
1863
|
+
return this.post(`/app/${appId}/api/blob-buckets/${encodeURIComponent(bucketIdOrKey)}/blobs/delete`, { blobIds });
|
|
1864
|
+
}
|
|
1741
1865
|
async getBucketBlobSignedUrl(appId, bucketIdOrKey, blobId, expiresInSeconds) {
|
|
1742
1866
|
return this.post(`/app/${appId}/api/blob-buckets/${encodeURIComponent(bucketIdOrKey)}/blobs/${blobId}/signed-url`, {
|
|
1743
1867
|
expiresInSeconds: expiresInSeconds || 300,
|