primitive-admin 1.0.53 → 1.0.55
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 +8 -0
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/apps.js +54 -2
- package/dist/src/commands/apps.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/databases.js +220 -82
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.js +77 -0
- package/dist/src/commands/documents.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/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/settings.d.ts +15 -0
- package/dist/src/commands/settings.js +102 -0
- package/dist/src/commands/settings.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +105 -0
- package/dist/src/commands/sync-app-settings.js +339 -0
- package/dist/src/commands/sync-app-settings.js.map +1 -0
- package/dist/src/commands/sync.d.ts +204 -9
- package/dist/src/commands/sync.js +1706 -371
- 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 +667 -59
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +122 -18
- package/dist/src/lib/api-client.js +131 -2
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +108 -0
- package/dist/src/lib/app-settings-descriptor.js +250 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -0
- 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 +76 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +144 -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 +21 -65
- package/dist/src/lib/db-codegen/dbGenerator.js +117 -321
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +37 -0
- package/dist/src/lib/db-codegen/dbNaming.js +70 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +165 -5
- package/dist/src/lib/db-codegen/dbTemplates.js +292 -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/db-codegen/dbTypeIR.d.ts +146 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +101 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +200 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
- package/dist/src/lib/generated-allowlist.js +43 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/init-config.js +2 -2
- package/dist/src/lib/init-config.js.map +1 -1
- package/dist/src/lib/output.d.ts +25 -5
- package/dist/src/lib/output.js +32 -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/swift-codegen/dbGenerator.d.ts +68 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +380 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
- package/dist/src/lib/swift-codegen/generator.d.ts +84 -0
- package/dist/src/lib/swift-codegen/generator.js +178 -0
- package/dist/src/lib/swift-codegen/generator.js.map +1 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +225 -0
- package/dist/src/lib/sync-resource-types.js +394 -0
- package/dist/src/lib/sync-resource-types.js.map +1 -0
- 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 +87 -0
- package/dist/src/lib/workflow-codegen/generator.js +290 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +85 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js +71 -0
- package/dist/src/lib/workflow-codegen/invokerIR.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 +7 -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,6 +1050,7 @@ 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;
|
|
@@ -1038,7 +1110,7 @@ export declare class ApiClient {
|
|
|
1038
1110
|
}>;
|
|
1039
1111
|
createGroup(appId: string, data: {
|
|
1040
1112
|
groupType: string;
|
|
1041
|
-
groupId
|
|
1113
|
+
groupId?: string;
|
|
1042
1114
|
name: string;
|
|
1043
1115
|
description?: string;
|
|
1044
1116
|
}): Promise<any>;
|
|
@@ -1048,7 +1120,9 @@ export declare class ApiClient {
|
|
|
1048
1120
|
description?: string;
|
|
1049
1121
|
}): Promise<any>;
|
|
1050
1122
|
deleteGroup(appId: string, groupType: string, groupId: string): Promise<any>;
|
|
1051
|
-
listGroupMembers(appId: string, groupType: string, groupId: string
|
|
1123
|
+
listGroupMembers(appId: string, groupType: string, groupId: string, options?: {
|
|
1124
|
+
include?: "profiles";
|
|
1125
|
+
}): Promise<{
|
|
1052
1126
|
items: any[];
|
|
1053
1127
|
cursor?: string;
|
|
1054
1128
|
}>;
|
|
@@ -1082,6 +1156,7 @@ export declare class ApiClient {
|
|
|
1082
1156
|
createCollection(appId: string, data: {
|
|
1083
1157
|
name: string;
|
|
1084
1158
|
description?: string;
|
|
1159
|
+
initialMetadata?: Record<string, Record<string, unknown>>;
|
|
1085
1160
|
}): Promise<any>;
|
|
1086
1161
|
getCollection(appId: string, collectionId: string): Promise<any>;
|
|
1087
1162
|
updateCollection(appId: string, collectionId: string, data: {
|
|
@@ -1124,11 +1199,32 @@ export declare class ApiClient {
|
|
|
1124
1199
|
createCollectionTypeConfig(appId: string, data: {
|
|
1125
1200
|
collectionType: string;
|
|
1126
1201
|
ruleSetId?: string;
|
|
1202
|
+
metadataManifest?: any;
|
|
1127
1203
|
}): Promise<any>;
|
|
1128
1204
|
updateCollectionTypeConfig(appId: string, collectionType: string, data: {
|
|
1129
1205
|
ruleSetId?: string | null;
|
|
1206
|
+
metadataManifest?: any;
|
|
1130
1207
|
}, expectedModifiedAt?: string): Promise<any>;
|
|
1131
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>;
|
|
1132
1228
|
listRuleSets(appId: string, params?: {
|
|
1133
1229
|
resourceType?: string;
|
|
1134
1230
|
}): Promise<any[]>;
|
|
@@ -1146,6 +1242,9 @@ export declare class ApiClient {
|
|
|
1146
1242
|
}, expectedModifiedAt?: string): Promise<any>;
|
|
1147
1243
|
deleteRuleSet(appId: string, ruleSetId: string): Promise<any>;
|
|
1148
1244
|
getRuleSetSchema(appId: string): Promise<any>;
|
|
1245
|
+
getRuleSetResourceTypes(appId: string): Promise<{
|
|
1246
|
+
resourceTypes: string[];
|
|
1247
|
+
}>;
|
|
1149
1248
|
testRuleSet(appId: string, ruleSetId: string, data: any): Promise<any>;
|
|
1150
1249
|
debugRuleSet(appId: string, data: any): Promise<any>;
|
|
1151
1250
|
listGroupTypeConfigs(appId: string): Promise<any[]>;
|
|
@@ -1154,10 +1253,12 @@ export declare class ApiClient {
|
|
|
1154
1253
|
groupType: string;
|
|
1155
1254
|
ruleSetId?: string;
|
|
1156
1255
|
autoAddCreator?: boolean;
|
|
1256
|
+
metadataManifest?: any;
|
|
1157
1257
|
}): Promise<any>;
|
|
1158
1258
|
updateGroupTypeConfig(appId: string, groupType: string, data: {
|
|
1159
1259
|
ruleSetId?: string | null;
|
|
1160
1260
|
autoAddCreator?: boolean;
|
|
1261
|
+
metadataManifest?: any;
|
|
1161
1262
|
}, expectedModifiedAt?: string): Promise<any>;
|
|
1162
1263
|
deleteGroupTypeConfig(appId: string, groupType: string): Promise<any>;
|
|
1163
1264
|
exportDocumentState(appId: string, documentId: string): Promise<{
|
|
@@ -1178,6 +1279,8 @@ export declare class ApiClient {
|
|
|
1178
1279
|
userId: string;
|
|
1179
1280
|
permission: string;
|
|
1180
1281
|
}>): Promise<any>;
|
|
1282
|
+
setDocumentLinkAccess(appId: string, documentId: string, level: "reader" | "read-write"): Promise<any>;
|
|
1283
|
+
clearDocumentLinkAccess(appId: string, documentId: string): Promise<any>;
|
|
1181
1284
|
listDocumentInvitations(appId: string, documentId: string): Promise<any[]>;
|
|
1182
1285
|
listDocumentBlobs(appId: string, documentId: string): Promise<any[]>;
|
|
1183
1286
|
downloadBlob(appId: string, documentId: string, blobId: string): Promise<Buffer>;
|
|
@@ -1191,7 +1294,7 @@ export declare class ApiClient {
|
|
|
1191
1294
|
findUserByEmail(appId: string, email: string): Promise<any | null>;
|
|
1192
1295
|
listAdminDocuments(appId: string, userId: string): Promise<any[]>;
|
|
1193
1296
|
saveDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string, data: any): Promise<any>;
|
|
1194
|
-
batchDatabaseRecords(appId: string, databaseId: string, operations:
|
|
1297
|
+
batchDatabaseRecords(appId: string, databaseId: string, operations: DatabaseBatchOperation[]): Promise<any>;
|
|
1195
1298
|
deleteDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string): Promise<any>;
|
|
1196
1299
|
batchDeleteDatabaseRecords(appId: string, databaseId: string, operations: {
|
|
1197
1300
|
op: "delete";
|
|
@@ -1225,6 +1328,7 @@ export declare class ApiClient {
|
|
|
1225
1328
|
}): Promise<any>;
|
|
1226
1329
|
downloadBucketBlob(appId: string, bucketIdOrKey: string, blobId: string): Promise<Buffer>;
|
|
1227
1330
|
deleteBucketBlob(appId: string, bucketIdOrKey: string, blobId: string): Promise<any>;
|
|
1331
|
+
deleteBucketBlobs(appId: string, bucketIdOrKey: string, blobIds: string[]): Promise<any>;
|
|
1228
1332
|
getBucketBlobSignedUrl(appId: string, bucketIdOrKey: string, blobId: string, expiresInSeconds?: number): Promise<any>;
|
|
1229
1333
|
}
|
|
1230
1334
|
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);
|
|
@@ -1364,8 +1456,9 @@ export class ApiClient {
|
|
|
1364
1456
|
// ============================================
|
|
1365
1457
|
// GROUP MEMBERS
|
|
1366
1458
|
// ============================================
|
|
1367
|
-
async listGroupMembers(appId, groupType, groupId) {
|
|
1368
|
-
|
|
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}`);
|
|
1369
1462
|
}
|
|
1370
1463
|
async addGroupMember(appId, groupType, groupId, data) {
|
|
1371
1464
|
return this.post(`/app/${appId}/api/groups/${groupType}/${groupId}/members`, data);
|
|
@@ -1511,6 +1604,29 @@ export class ApiClient {
|
|
|
1511
1604
|
return this.delete(`/app/${appId}/api/collection-type-configs/${collectionType}`);
|
|
1512
1605
|
}
|
|
1513
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
|
+
// ============================================
|
|
1514
1630
|
// ACCESS RULE SETS
|
|
1515
1631
|
// ============================================
|
|
1516
1632
|
async listRuleSets(appId, params) {
|
|
@@ -1532,6 +1648,9 @@ export class ApiClient {
|
|
|
1532
1648
|
async getRuleSetSchema(appId) {
|
|
1533
1649
|
return this.get(`/app/${appId}/api/rule-sets/schema`);
|
|
1534
1650
|
}
|
|
1651
|
+
async getRuleSetResourceTypes(appId) {
|
|
1652
|
+
return this.get(`/app/${appId}/api/rule-sets/resource-types`);
|
|
1653
|
+
}
|
|
1535
1654
|
async testRuleSet(appId, ruleSetId, data) {
|
|
1536
1655
|
return this.post(`/app/${appId}/api/rule-sets/${ruleSetId}/test`, data);
|
|
1537
1656
|
}
|
|
@@ -1578,6 +1697,12 @@ export class ApiClient {
|
|
|
1578
1697
|
async grantDocumentPermission(appId, documentId, permissions) {
|
|
1579
1698
|
return this.put(`/app/${appId}/api/documents/${documentId}/permissions`, { permissions });
|
|
1580
1699
|
}
|
|
1700
|
+
async setDocumentLinkAccess(appId, documentId, level) {
|
|
1701
|
+
return this.put(`/app/${appId}/api/documents/${documentId}/link-access`, { level });
|
|
1702
|
+
}
|
|
1703
|
+
async clearDocumentLinkAccess(appId, documentId) {
|
|
1704
|
+
return this.delete(`/app/${appId}/api/documents/${documentId}/link-access`);
|
|
1705
|
+
}
|
|
1581
1706
|
async listDocumentInvitations(appId, documentId) {
|
|
1582
1707
|
return this.get(`/app/${appId}/api/documents/${documentId}/invitations`);
|
|
1583
1708
|
}
|
|
@@ -1739,6 +1864,10 @@ export class ApiClient {
|
|
|
1739
1864
|
async deleteBucketBlob(appId, bucketIdOrKey, blobId) {
|
|
1740
1865
|
return this.delete(`/app/${appId}/api/blob-buckets/${encodeURIComponent(bucketIdOrKey)}/blobs/${blobId}`);
|
|
1741
1866
|
}
|
|
1867
|
+
// Batch delete (#1455): one round-trip for N ids via POST .../blobs/delete.
|
|
1868
|
+
async deleteBucketBlobs(appId, bucketIdOrKey, blobIds) {
|
|
1869
|
+
return this.post(`/app/${appId}/api/blob-buckets/${encodeURIComponent(bucketIdOrKey)}/blobs/delete`, { blobIds });
|
|
1870
|
+
}
|
|
1742
1871
|
async getBucketBlobSignedUrl(appId, bucketIdOrKey, blobId, expiresInSeconds) {
|
|
1743
1872
|
return this.post(`/app/${appId}/api/blob-buckets/${encodeURIComponent(bucketIdOrKey)}/blobs/${blobId}/signed-url`, {
|
|
1744
1873
|
expiresInSeconds: expiresInSeconds || 300,
|