@zarel-ai/sdk 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +29 -31
- package/dist/_internal/auth-headers.d.ts +3 -3
- package/dist/_internal/auth-headers.d.ts.map +1 -1
- package/dist/_internal/auth-headers.js +5 -3
- package/dist/_internal/auth-headers.js.map +1 -1
- package/dist/_internal/confirmation.d.ts +1 -1
- package/dist/_internal/confirmation.d.ts.map +1 -1
- package/dist/_internal/confirmation.js +3 -1
- package/dist/_internal/confirmation.js.map +1 -1
- package/dist/_internal/event-iterator.d.ts.map +1 -1
- package/dist/_internal/event-iterator.js +3 -1
- package/dist/_internal/event-iterator.js.map +1 -1
- package/dist/_internal/fetch-client.d.ts +26 -18
- package/dist/_internal/fetch-client.d.ts.map +1 -1
- package/dist/_internal/fetch-client.js +40 -35
- package/dist/_internal/fetch-client.js.map +1 -1
- package/dist/_internal/interceptors.d.ts.map +1 -1
- package/dist/_internal/interceptors.js.map +1 -1
- package/dist/_internal/mcp.d.ts.map +1 -1
- package/dist/_internal/mcp.js +6 -4
- package/dist/_internal/mcp.js.map +1 -1
- package/dist/_internal/pagination.d.ts +5 -5
- package/dist/_internal/pagination.d.ts.map +1 -1
- package/dist/_internal/pagination.js +7 -5
- package/dist/_internal/pagination.js.map +1 -1
- package/dist/_internal/require-token.d.ts +4 -4
- package/dist/_internal/require-token.d.ts.map +1 -1
- package/dist/_internal/require-token.js +6 -4
- package/dist/_internal/require-token.js.map +1 -1
- package/dist/_internal/retry-after.d.ts.map +1 -1
- package/dist/_internal/retry-after.js +2 -0
- package/dist/_internal/retry-after.js.map +1 -1
- package/dist/_internal/sse-client.d.ts.map +1 -1
- package/dist/_internal/sse-client.js +4 -3
- package/dist/_internal/sse-client.js.map +1 -1
- package/dist/_internal/version.d.ts +2 -2
- package/dist/_internal/version.d.ts.map +1 -1
- package/dist/_internal/version.js +4 -2
- package/dist/_internal/version.js.map +1 -1
- package/dist/client.d.ts +8 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +10 -10
- package/dist/client.js.map +1 -1
- package/dist/contract/_singleton.d.ts +31 -6
- package/dist/contract/_singleton.d.ts.map +1 -1
- package/dist/contract/_singleton.js +30 -6
- package/dist/contract/_singleton.js.map +1 -1
- package/dist/contract/actions.d.ts +16 -4
- package/dist/contract/actions.d.ts.map +1 -1
- package/dist/contract/actions.js +13 -12
- package/dist/contract/actions.js.map +1 -1
- package/dist/contract/assistant.d.ts +3 -3
- package/dist/contract/assistant.d.ts.map +1 -1
- package/dist/contract/assistant.js +13 -11
- package/dist/contract/assistant.js.map +1 -1
- package/dist/contract/batch.d.ts +9 -20
- package/dist/contract/batch.d.ts.map +1 -1
- package/dist/contract/batch.js +14 -6
- package/dist/contract/batch.js.map +1 -1
- package/dist/contract/capabilities.d.ts +7 -13
- package/dist/contract/capabilities.d.ts.map +1 -1
- package/dist/contract/capabilities.js +10 -8
- package/dist/contract/capabilities.js.map +1 -1
- package/dist/contract/constraints.d.ts +7 -13
- package/dist/contract/constraints.d.ts.map +1 -1
- package/dist/contract/constraints.js +10 -8
- package/dist/contract/constraints.js.map +1 -1
- package/dist/contract/events.d.ts +9 -13
- package/dist/contract/events.d.ts.map +1 -1
- package/dist/contract/events.js +12 -13
- package/dist/contract/events.js.map +1 -1
- package/dist/contract/flows.d.ts +30 -19
- package/dist/contract/flows.d.ts.map +1 -1
- package/dist/contract/flows.js +46 -29
- package/dist/contract/flows.js.map +1 -1
- package/dist/contract/index.d.ts +207 -32
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +13 -14
- package/dist/contract/index.js.map +1 -1
- package/dist/contract/metadata.d.ts +6 -20
- package/dist/contract/metadata.d.ts.map +1 -1
- package/dist/contract/metadata.js +16 -8
- package/dist/contract/metadata.js.map +1 -1
- package/dist/contract/process-model.d.ts +10 -15
- package/dist/contract/process-model.d.ts.map +1 -1
- package/dist/contract/process-model.js +11 -9
- package/dist/contract/process-model.js.map +1 -1
- package/dist/contract/roots/channels.d.ts.map +1 -1
- package/dist/contract/roots/channels.js +12 -10
- package/dist/contract/roots/channels.js.map +1 -1
- package/dist/contract/roots/events.d.ts.map +1 -1
- package/dist/contract/roots/events.js +2 -0
- package/dist/contract/roots/events.js.map +1 -1
- package/dist/contract/roots/index.d.ts +3 -2
- package/dist/contract/roots/index.d.ts.map +1 -1
- package/dist/contract/roots/index.js +13 -12
- package/dist/contract/roots/index.js.map +1 -1
- package/dist/contract/roots/mcp-servers.d.ts +11 -29
- package/dist/contract/roots/mcp-servers.d.ts.map +1 -1
- package/dist/contract/roots/mcp-servers.js +22 -18
- package/dist/contract/roots/mcp-servers.js.map +1 -1
- package/dist/contract/roots/profiles.d.ts +13 -12
- package/dist/contract/roots/profiles.d.ts.map +1 -1
- package/dist/contract/roots/profiles.js +18 -7
- package/dist/contract/roots/profiles.js.map +1 -1
- package/dist/contract/roots/timezone.d.ts +3 -3
- package/dist/contract/roots/timezone.d.ts.map +1 -1
- package/dist/contract/roots/timezone.js +5 -2
- package/dist/contract/roots/timezone.js.map +1 -1
- package/dist/contract/roots/treatment.d.ts +3 -2
- package/dist/contract/roots/treatment.d.ts.map +1 -1
- package/dist/contract/roots/treatment.js +8 -8
- package/dist/contract/roots/treatment.js.map +1 -1
- package/dist/contract/roots/vocabulary.d.ts +20 -13
- package/dist/contract/roots/vocabulary.d.ts.map +1 -1
- package/dist/contract/roots/vocabulary.js +28 -9
- package/dist/contract/roots/vocabulary.js.map +1 -1
- package/dist/contract/schemas.d.ts +7 -10
- package/dist/contract/schemas.d.ts.map +1 -1
- package/dist/contract/schemas.js +10 -8
- package/dist/contract/schemas.js.map +1 -1
- package/dist/contract/skills.d.ts +14 -4
- package/dist/contract/skills.d.ts.map +1 -1
- package/dist/contract/skills.js +11 -11
- package/dist/contract/skills.js.map +1 -1
- package/dist/errors.d.ts +4 -4
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +4 -4
- package/dist/errors.js.map +1 -1
- package/dist/generated/contract.d.ts +4494 -706
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/index.d.ts +119 -7
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/runtime.d.ts +1490 -368
- package/dist/generated/runtime.d.ts.map +1 -1
- package/dist/generated/unwrap-map.d.ts +5 -2
- package/dist/generated/unwrap-map.d.ts.map +1 -1
- package/dist/generated/unwrap-map.js +5 -5
- package/dist/generated/unwrap-map.js.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/resources/actions.d.ts +5 -6
- package/dist/resources/actions.d.ts.map +1 -1
- package/dist/resources/actions.js +9 -10
- package/dist/resources/actions.js.map +1 -1
- package/dist/resources/audit.d.ts +6 -6
- package/dist/resources/audit.d.ts.map +1 -1
- package/dist/resources/audit.js +3 -25
- package/dist/resources/audit.js.map +1 -1
- package/dist/resources/authorization-ceiling.d.ts +2 -2
- package/dist/resources/authorization-ceiling.d.ts.map +1 -1
- package/dist/resources/authorization-ceiling.js +8 -7
- package/dist/resources/authorization-ceiling.js.map +1 -1
- package/dist/resources/authorization-operation-ids.d.ts +1 -1
- package/dist/resources/authorization-operation-ids.d.ts.map +1 -1
- package/dist/resources/authorization-operation-ids.js +4 -2
- package/dist/resources/authorization-operation-ids.js.map +1 -1
- package/dist/resources/authorization.d.ts +53 -19
- package/dist/resources/authorization.d.ts.map +1 -1
- package/dist/resources/authorization.js +24 -6
- package/dist/resources/authorization.js.map +1 -1
- package/dist/resources/authorizations.d.ts +3 -5
- package/dist/resources/authorizations.d.ts.map +1 -1
- package/dist/resources/authorizations.js +4 -2
- package/dist/resources/authorizations.js.map +1 -1
- package/dist/resources/channels.d.ts +7 -7
- package/dist/resources/channels.d.ts.map +1 -1
- package/dist/resources/channels.js +10 -10
- package/dist/resources/channels.js.map +1 -1
- package/dist/resources/contracts.d.ts +2 -2
- package/dist/resources/contracts.d.ts.map +1 -1
- package/dist/resources/contracts.js +15 -14
- package/dist/resources/contracts.js.map +1 -1
- package/dist/resources/conversation-sessions.d.ts +19 -20
- package/dist/resources/conversation-sessions.d.ts.map +1 -1
- package/dist/resources/conversation-sessions.js +17 -22
- package/dist/resources/conversation-sessions.js.map +1 -1
- package/dist/resources/conversation.d.ts +4 -4
- package/dist/resources/conversation.d.ts.map +1 -1
- package/dist/resources/conversation.js +13 -11
- package/dist/resources/conversation.js.map +1 -1
- package/dist/resources/embedding-credentials.d.ts +3 -3
- package/dist/resources/embedding-credentials.d.ts.map +1 -1
- package/dist/resources/embedding-credentials.js +8 -6
- package/dist/resources/embedding-credentials.js.map +1 -1
- package/dist/resources/entities.d.ts +50 -32
- package/dist/resources/entities.d.ts.map +1 -1
- package/dist/resources/entities.js +51 -32
- package/dist/resources/entities.js.map +1 -1
- package/dist/resources/events.d.ts +4 -5
- package/dist/resources/events.d.ts.map +1 -1
- package/dist/resources/events.js +12 -11
- package/dist/resources/events.js.map +1 -1
- package/dist/resources/flows.d.ts +18 -15
- package/dist/resources/flows.d.ts.map +1 -1
- package/dist/resources/flows.js +41 -27
- package/dist/resources/flows.js.map +1 -1
- package/dist/resources/imports.d.ts.map +1 -1
- package/dist/resources/imports.js +1 -1
- package/dist/resources/imports.js.map +1 -1
- package/dist/resources/index.d.ts +3 -2
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +6 -2
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/llm-credentials.d.ts +21 -6
- package/dist/resources/llm-credentials.d.ts.map +1 -1
- package/dist/resources/llm-credentials.js +25 -10
- package/dist/resources/llm-credentials.js.map +1 -1
- package/dist/resources/llm-services.d.ts +8 -8
- package/dist/resources/llm-services.d.ts.map +1 -1
- package/dist/resources/llm-services.js +11 -9
- package/dist/resources/llm-services.js.map +1 -1
- package/dist/resources/mcp.d.ts.map +1 -1
- package/dist/resources/mcp.js +5 -3
- package/dist/resources/mcp.js.map +1 -1
- package/dist/resources/receipts.d.ts +1 -1
- package/dist/resources/receipts.d.ts.map +1 -1
- package/dist/resources/receipts.js +1 -1
- package/dist/resources/receipts.js.map +1 -1
- package/dist/resources/records.d.ts +1 -1
- package/dist/resources/records.d.ts.map +1 -1
- package/dist/resources/records.js +7 -5
- package/dist/resources/records.js.map +1 -1
- package/dist/resources/role-assignments.d.ts +4 -5
- package/dist/resources/role-assignments.d.ts.map +1 -1
- package/dist/resources/role-assignments.js +8 -7
- package/dist/resources/role-assignments.js.map +1 -1
- package/dist/resources/roles.d.ts +23 -23
- package/dist/resources/roles.d.ts.map +1 -1
- package/dist/resources/roles.js +20 -14
- package/dist/resources/roles.js.map +1 -1
- package/dist/resources/runtime-entities.d.ts +12 -9
- package/dist/resources/runtime-entities.d.ts.map +1 -1
- package/dist/resources/runtime-entities.js +5 -8
- package/dist/resources/runtime-entities.js.map +1 -1
- package/dist/resources/state-machine.d.ts +6 -12
- package/dist/resources/state-machine.d.ts.map +1 -1
- package/dist/resources/state-machine.js +17 -21
- package/dist/resources/state-machine.js.map +1 -1
- package/dist/resources/system.d.ts.map +1 -1
- package/dist/resources/system.js +5 -5
- package/dist/resources/system.js.map +1 -1
- package/dist/resources/tools.d.ts +2 -2
- package/dist/resources/tools.d.ts.map +1 -1
- package/dist/resources/tools.js +7 -5
- package/dist/resources/tools.js.map +1 -1
- package/dist/resources/traces.d.ts +1 -7
- package/dist/resources/traces.d.ts.map +1 -1
- package/dist/resources/traces.js +4 -29
- package/dist/resources/traces.js.map +1 -1
- package/dist/runtime/index.d.ts +4 -2
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +21 -17
- package/dist/runtime/index.js.map +1 -1
- package/dist/types/actions.d.ts +7 -8
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/actions.js +4 -2
- package/dist/types/actions.js.map +1 -1
- package/dist/types/audit.d.ts +5 -7
- package/dist/types/audit.d.ts.map +1 -1
- package/dist/types/audit.js +6 -6
- package/dist/types/audit.js.map +1 -1
- package/dist/types/channels.d.ts +1 -1
- package/dist/types/channels.d.ts.map +1 -1
- package/dist/types/channels.js +5 -3
- package/dist/types/channels.js.map +1 -1
- package/dist/types/collections-contract.d.ts +50 -0
- package/dist/types/collections-contract.d.ts.map +1 -0
- package/dist/types/collections-contract.js +22 -0
- package/dist/types/collections-contract.js.map +1 -0
- package/dist/types/confirmation.d.ts +4 -4
- package/dist/types/confirmation.d.ts.map +1 -1
- package/dist/types/confirmation.js +6 -4
- package/dist/types/confirmation.js.map +1 -1
- package/dist/types/contracts.d.ts +12 -15
- package/dist/types/contracts.d.ts.map +1 -1
- package/dist/types/contracts.js +5 -4
- package/dist/types/contracts.js.map +1 -1
- package/dist/types/conversation-sessions.d.ts +1 -1
- package/dist/types/conversation-sessions.d.ts.map +1 -1
- package/dist/types/conversation-sessions.js +3 -1
- package/dist/types/conversation-sessions.js.map +1 -1
- package/dist/types/conversation.d.ts +13 -40
- package/dist/types/conversation.d.ts.map +1 -1
- package/dist/types/entities.d.ts +52 -16
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/types/entities.js +12 -0
- package/dist/types/entities.js.map +1 -1
- package/dist/types/events-stream.d.ts +2 -2
- package/dist/types/events-stream.d.ts.map +1 -1
- package/dist/types/events-stream.js +6 -4
- package/dist/types/events-stream.js.map +1 -1
- package/dist/types/flows-contract.d.ts +28 -7
- package/dist/types/flows-contract.d.ts.map +1 -1
- package/dist/types/flows-contract.js +11 -4
- package/dist/types/flows-contract.js.map +1 -1
- package/dist/types/flows.d.ts +27 -58
- package/dist/types/flows.d.ts.map +1 -1
- package/dist/types/flows.js +8 -20
- package/dist/types/flows.js.map +1 -1
- package/dist/types/imports.d.ts +9 -0
- package/dist/types/imports.d.ts.map +1 -1
- package/dist/types/index.d.ts +8 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/locale.d.ts +2 -2
- package/dist/types/locale.d.ts.map +1 -1
- package/dist/types/locale.js +4 -2
- package/dist/types/locale.js.map +1 -1
- package/dist/types/mcp-and-events-contract.d.ts +51 -0
- package/dist/types/mcp-and-events-contract.d.ts.map +1 -0
- package/dist/types/mcp-and-events-contract.js +20 -0
- package/dist/types/mcp-and-events-contract.js.map +1 -0
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/mcp.js +3 -1
- package/dist/types/mcp.js.map +1 -1
- package/dist/types/platform.d.ts +12 -12
- package/dist/types/platform.d.ts.map +1 -1
- package/dist/types/platform.js +0 -1
- package/dist/types/platform.js.map +1 -1
- package/dist/types/receipt.d.ts +3 -5
- package/dist/types/receipt.d.ts.map +1 -1
- package/dist/types/receipt.js +5 -5
- package/dist/types/receipt.js.map +1 -1
- package/dist/types/records.d.ts +3 -3
- package/dist/types/records.d.ts.map +1 -1
- package/dist/types/records.js +2 -0
- package/dist/types/records.js.map +1 -1
- package/dist/types/spec.d.ts +2 -2
- package/dist/types/spec.d.ts.map +1 -1
- package/dist/types/state-machine.d.ts +48 -84
- package/dist/types/state-machine.d.ts.map +1 -1
- package/dist/types/state-machine.js +9 -4
- package/dist/types/state-machine.js.map +1 -1
- package/dist/types/system.d.ts.map +1 -1
- package/dist/types/tools.d.ts +36 -28
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/types/tools.js +6 -6
- package/dist/types/tools.js.map +1 -1
- package/dist/types/traces.d.ts +6 -9
- package/dist/types/traces.d.ts.map +1 -1
- package/dist/types/traces.js +5 -5
- package/dist/types/traces.js.map +1 -1
- package/dist/types/treatment-contract.d.ts +70 -0
- package/dist/types/treatment-contract.d.ts.map +1 -0
- package/dist/types/treatment-contract.js +20 -0
- package/dist/types/treatment-contract.js.map +1 -0
- package/dist/types/workflows.d.ts +14 -0
- package/dist/types/workflows.d.ts.map +1 -1
- package/dist/types/workflows.js +7 -6
- package/dist/types/workflows.js.map +1 -1
- package/package.json +93 -96
- package/dist/contract/governance.d.ts +0 -6
- package/dist/contract/governance.d.ts.map +0 -1
- package/dist/contract/governance.js +0 -17
- package/dist/contract/governance.js.map +0 -1
|
@@ -1,66 +1,84 @@
|
|
|
1
1
|
import { type FetchClient } from '../_internal/fetch-client';
|
|
2
|
-
import type { EntityInput, FieldDefinitionInput } from '../types/entities';
|
|
2
|
+
import type { EntityInput, EntityReplaceInput, EntityWriteInput, FieldDefinitionInput, FieldReplaceInput, FieldWriteInput } from '../types/entities';
|
|
3
|
+
import type { ContractDeletedAck } from '../types/flows-contract';
|
|
3
4
|
import type { LocaleOptions } from '../types/locale';
|
|
4
|
-
import type { EntityListPayload, EntityPayload,
|
|
5
|
+
import type { EntityFieldListPayload, EntityFieldPayload, EntityFieldRecordPayload, EntityListPayload, EntityPayload, EntityRecordPayload, FieldTransitionPayload, FieldTransitionCreatePayload, FieldTransitionWritePayload, FieldTransitionPatchPayload } from '../generated';
|
|
6
|
+
/**
|
|
7
|
+
* `/contract/entities*`.
|
|
8
|
+
*
|
|
9
|
+
* Every return type here is derived from the contract API's OpenAPI document.
|
|
10
|
+
*/
|
|
5
11
|
export declare class EntitiesResource {
|
|
6
12
|
private readonly client;
|
|
7
13
|
constructor(client: FetchClient);
|
|
8
14
|
/**
|
|
9
15
|
* List all entities for the current tenant.
|
|
10
|
-
*
|
|
16
|
+
* Pass `{locale: 'es'}` to receive Spanish labels; omit for
|
|
11
17
|
* server-side fallback (JWT preferences.language → canonical).
|
|
12
18
|
*/
|
|
13
19
|
list(options?: LocaleOptions): Promise<EntityListPayload>;
|
|
14
20
|
/**
|
|
15
21
|
* Create a new entity.
|
|
22
|
+
*
|
|
23
|
+
* `label` and `description` are REFUSED with 400: semantic content is written by a contract
|
|
24
|
+
* publish, never here.
|
|
16
25
|
*/
|
|
17
|
-
create(input: EntityInput): Promise<
|
|
26
|
+
create(input: EntityInput): Promise<EntityRecordPayload>;
|
|
18
27
|
/**
|
|
19
28
|
* Get a single entity by name.
|
|
20
29
|
*/
|
|
21
30
|
get(entityName: string, options?: LocaleOptions): Promise<EntityPayload>;
|
|
22
31
|
/**
|
|
23
|
-
*
|
|
32
|
+
* Merge-patch an entity: an absent key is left alone, an explicit `null` clears it.
|
|
24
33
|
*/
|
|
25
|
-
update(entityName: string, input:
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
*/
|
|
29
|
-
delete(entityName: string): Promise<void>;
|
|
34
|
+
update(entityName: string, input: EntityWriteInput): Promise<EntityRecordPayload>;
|
|
35
|
+
/** `ContractDeletedAck`, not `void`: this route answers `{success, data: {message}}`. */
|
|
36
|
+
delete(entityName: string): Promise<ContractDeletedAck>;
|
|
30
37
|
/**
|
|
31
38
|
* Add a field to an entity.
|
|
39
|
+
*
|
|
40
|
+
* The body is validated by the same rules a contract publish applies, so this reaches the SAME
|
|
41
|
+
* verdict a publish of the equivalent YAML does — including the type-linked `constraints` check
|
|
42
|
+
* and the `binding` forms.
|
|
32
43
|
*/
|
|
33
|
-
addField(entityName: string, field: FieldDefinitionInput): Promise<
|
|
34
|
-
/**
|
|
35
|
-
* Update a field on an entity.
|
|
36
|
-
*/
|
|
37
|
-
updateField(entityName: string, fieldName: string, update: Partial<FieldDefinitionInput>): Promise<EntityMutationPayload>;
|
|
44
|
+
addField(entityName: string, field: FieldDefinitionInput): Promise<EntityFieldRecordPayload>;
|
|
38
45
|
/**
|
|
39
|
-
*
|
|
46
|
+
* Merge-patch a field. Judged on the field the patch LEAVES BEHIND, so a `constraints` block
|
|
47
|
+
* added without restating the type is validated against the STORED type.
|
|
40
48
|
*/
|
|
41
|
-
|
|
49
|
+
updateField(entityName: string, fieldName: string, update: FieldWriteInput): Promise<EntityFieldRecordPayload>;
|
|
50
|
+
/** `ContractDeletedAck`, not `void`: this route answers `{success, data: {message}}`. */
|
|
51
|
+
deleteField(entityName: string, fieldName: string): Promise<ContractDeletedAck>;
|
|
42
52
|
/**
|
|
43
|
-
* Replace an entity
|
|
53
|
+
* Replace an entity wholesale (PUT). {@link update} is the partial (PATCH) counterpart.
|
|
54
|
+
*
|
|
55
|
+
* A TOTAL write: every mutable declaration is REQUIRED, and `null` is how one is cleared. It
|
|
56
|
+
* does not clear by omission, because no read on this surface returns those five declarations —
|
|
57
|
+
* see `EntityReplaceInput`.
|
|
44
58
|
*/
|
|
45
|
-
replace(entityName: string, input:
|
|
59
|
+
replace(entityName: string, input: EntityReplaceInput): Promise<EntityRecordPayload>;
|
|
46
60
|
/**
|
|
47
|
-
* List an entity's fields. The response is `{
|
|
48
|
-
*
|
|
61
|
+
* List an entity's fields. The response is `{entity_name, fields}` — the field array is nested
|
|
62
|
+
* under `fields` (the endpoint wraps it, unlike the transition/step lists).
|
|
49
63
|
*/
|
|
50
|
-
listFields(entityName: string, options?: LocaleOptions): Promise<
|
|
64
|
+
listFields(entityName: string, options?: LocaleOptions): Promise<EntityFieldListPayload>;
|
|
51
65
|
/**
|
|
52
|
-
* Read a single field definition.
|
|
66
|
+
* Read a single field definition — the SAME shape the collection and the entity detail carry.
|
|
53
67
|
*/
|
|
54
|
-
getField(entityName: string, fieldName: string, options?: LocaleOptions): Promise<
|
|
68
|
+
getField(entityName: string, fieldName: string, options?: LocaleOptions): Promise<EntityFieldPayload>;
|
|
55
69
|
/**
|
|
56
|
-
* Replace a field
|
|
70
|
+
* Replace a field wholesale (PUT). {@link updateField} is the partial (PATCH) counterpart.
|
|
71
|
+
*
|
|
72
|
+
* A TOTAL write — every mutable property is REQUIRED and `null` clears; see
|
|
73
|
+
* `FieldReplaceInput`.
|
|
57
74
|
*/
|
|
58
|
-
replaceField(entityName: string, fieldName: string, input:
|
|
59
|
-
listFieldTransitions(entityName: string, fieldName: string, options?: LocaleOptions): Promise<
|
|
60
|
-
getFieldTransition(entityName: string, fieldName: string, from: string, to: string, options?: LocaleOptions): Promise<
|
|
61
|
-
createFieldTransition(entityName: string, fieldName: string, input:
|
|
62
|
-
replaceFieldTransition(entityName: string, fieldName: string, from: string, to: string, input:
|
|
63
|
-
patchFieldTransition(entityName: string, fieldName: string, from: string, to: string, patch:
|
|
64
|
-
|
|
75
|
+
replaceField(entityName: string, fieldName: string, input: FieldReplaceInput): Promise<EntityFieldRecordPayload>;
|
|
76
|
+
listFieldTransitions(entityName: string, fieldName: string, options?: LocaleOptions): Promise<FieldTransitionPayload[]>;
|
|
77
|
+
getFieldTransition(entityName: string, fieldName: string, from: string, to: string, options?: LocaleOptions): Promise<FieldTransitionPayload>;
|
|
78
|
+
createFieldTransition(entityName: string, fieldName: string, input: FieldTransitionCreatePayload): Promise<FieldTransitionPayload>;
|
|
79
|
+
replaceFieldTransition(entityName: string, fieldName: string, from: string, to: string, input: FieldTransitionWritePayload): Promise<FieldTransitionPayload>;
|
|
80
|
+
patchFieldTransition(entityName: string, fieldName: string, from: string, to: string, patch: FieldTransitionPatchPayload): Promise<FieldTransitionPayload>;
|
|
81
|
+
/** `ContractDeletedAck`, not `void`: this route answers `{success, data: {message}}`. */
|
|
82
|
+
deleteFieldTransition(entityName: string, fieldName: string, from: string, to: string): Promise<ContractDeletedAck>;
|
|
65
83
|
}
|
|
66
84
|
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/resources/entities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/resources/entities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EACR,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EACR,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,4BAA4B,EAC5B,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|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EntitiesResource = void 0;
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
|
+
// Copyright 2026 Nicolas Moreno
|
|
4
6
|
const fetch_client_1 = require("../_internal/fetch-client");
|
|
7
|
+
/**
|
|
8
|
+
* `/contract/entities*`.
|
|
9
|
+
*
|
|
10
|
+
* Every return type here is derived from the contract API's OpenAPI document.
|
|
11
|
+
*/
|
|
5
12
|
class EntitiesResource {
|
|
6
13
|
client;
|
|
7
14
|
constructor(client) {
|
|
@@ -9,97 +16,109 @@ class EntitiesResource {
|
|
|
9
16
|
}
|
|
10
17
|
/**
|
|
11
18
|
* List all entities for the current tenant.
|
|
12
|
-
*
|
|
19
|
+
* Pass `{locale: 'es'}` to receive Spanish labels; omit for
|
|
13
20
|
* server-side fallback (JWT preferences.language → canonical).
|
|
14
21
|
*/
|
|
15
22
|
async list(options) {
|
|
16
|
-
return this.client.get('/contract/entities', (0, fetch_client_1.localeQuery)(options), { operationId: 'listEntities' });
|
|
23
|
+
return await this.client.get('/contract/entities', (0, fetch_client_1.localeQuery)(options), { operationId: 'listEntities' });
|
|
17
24
|
}
|
|
18
25
|
/**
|
|
19
26
|
* Create a new entity.
|
|
27
|
+
*
|
|
28
|
+
* `label` and `description` are REFUSED with 400: semantic content is written by a contract
|
|
29
|
+
* publish, never here.
|
|
20
30
|
*/
|
|
21
31
|
async create(input) {
|
|
22
|
-
return this.client.post('/contract/entities', input, { operationId: 'createEntity' });
|
|
32
|
+
return await this.client.post('/contract/entities', input, { operationId: 'createEntity' });
|
|
23
33
|
}
|
|
24
34
|
/**
|
|
25
35
|
* Get a single entity by name.
|
|
26
36
|
*/
|
|
27
37
|
async get(entityName, options) {
|
|
28
|
-
return this.client.get(`/contract/entities/${entityName}`, (0, fetch_client_1.localeQuery)(options), { operationId: 'getEntity' });
|
|
38
|
+
return await this.client.get(`/contract/entities/${entityName}`, (0, fetch_client_1.localeQuery)(options), { operationId: 'getEntity' });
|
|
29
39
|
}
|
|
30
40
|
/**
|
|
31
|
-
*
|
|
41
|
+
* Merge-patch an entity: an absent key is left alone, an explicit `null` clears it.
|
|
32
42
|
*/
|
|
33
43
|
async update(entityName, input) {
|
|
34
|
-
return this.client.patch(`/contract/entities/${entityName}`, input, { operationId: 'patchEntity' });
|
|
44
|
+
return await this.client.patch(`/contract/entities/${entityName}`, input, { operationId: 'patchEntity' });
|
|
35
45
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Delete an entity.
|
|
38
|
-
*/
|
|
46
|
+
/** `ContractDeletedAck`, not `void`: this route answers `{success, data: {message}}`. */
|
|
39
47
|
async delete(entityName) {
|
|
40
|
-
await this.client.del(`/contract/entities/${entityName}`, { operationId: 'deleteEntity' });
|
|
48
|
+
return await this.client.del(`/contract/entities/${entityName}`, { operationId: 'deleteEntity' });
|
|
41
49
|
}
|
|
42
50
|
/**
|
|
43
51
|
* Add a field to an entity.
|
|
52
|
+
*
|
|
53
|
+
* The body is validated by the same rules a contract publish applies, so this reaches the SAME
|
|
54
|
+
* verdict a publish of the equivalent YAML does — including the type-linked `constraints` check
|
|
55
|
+
* and the `binding` forms.
|
|
44
56
|
*/
|
|
45
57
|
async addField(entityName, field) {
|
|
46
|
-
return this.client.post(`/contract/entities/${entityName}/fields`, field, { operationId: 'createEntityField' });
|
|
58
|
+
return await this.client.post(`/contract/entities/${entityName}/fields`, field, { operationId: 'createEntityField' });
|
|
47
59
|
}
|
|
48
60
|
/**
|
|
49
|
-
*
|
|
61
|
+
* Merge-patch a field. Judged on the field the patch LEAVES BEHIND, so a `constraints` block
|
|
62
|
+
* added without restating the type is validated against the STORED type.
|
|
50
63
|
*/
|
|
51
64
|
async updateField(entityName, fieldName, update) {
|
|
52
|
-
return this.client.patch(`/contract/entities/${entityName}/fields/${fieldName}`, update, { operationId: 'patchEntityField' });
|
|
65
|
+
return await this.client.patch(`/contract/entities/${entityName}/fields/${fieldName}`, update, { operationId: 'patchEntityField' });
|
|
53
66
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Delete a field from an entity.
|
|
56
|
-
*/
|
|
67
|
+
/** `ContractDeletedAck`, not `void`: this route answers `{success, data: {message}}`. */
|
|
57
68
|
async deleteField(entityName, fieldName) {
|
|
58
|
-
await this.client.del(`/contract/entities/${entityName}/fields/${fieldName}`, { operationId: 'deleteEntityField' });
|
|
69
|
+
return await this.client.del(`/contract/entities/${entityName}/fields/${fieldName}`, { operationId: 'deleteEntityField' });
|
|
59
70
|
}
|
|
60
71
|
/**
|
|
61
|
-
* Replace an entity
|
|
72
|
+
* Replace an entity wholesale (PUT). {@link update} is the partial (PATCH) counterpart.
|
|
73
|
+
*
|
|
74
|
+
* A TOTAL write: every mutable declaration is REQUIRED, and `null` is how one is cleared. It
|
|
75
|
+
* does not clear by omission, because no read on this surface returns those five declarations —
|
|
76
|
+
* see `EntityReplaceInput`.
|
|
62
77
|
*/
|
|
63
78
|
async replace(entityName, input) {
|
|
64
|
-
return this.client.put(`/contract/entities/${entityName}`, input, { operationId: 'replaceEntity' });
|
|
79
|
+
return await this.client.put(`/contract/entities/${entityName}`, input, { operationId: 'replaceEntity' });
|
|
65
80
|
}
|
|
66
81
|
/**
|
|
67
|
-
* List an entity's fields. The response is `{
|
|
68
|
-
*
|
|
82
|
+
* List an entity's fields. The response is `{entity_name, fields}` — the field array is nested
|
|
83
|
+
* under `fields` (the endpoint wraps it, unlike the transition/step lists).
|
|
69
84
|
*/
|
|
70
85
|
async listFields(entityName, options) {
|
|
71
|
-
return this.client.get(`/contract/entities/${entityName}/fields`, (0, fetch_client_1.localeQuery)(options), { operationId: 'listEntityFields' });
|
|
86
|
+
return await this.client.get(`/contract/entities/${entityName}/fields`, (0, fetch_client_1.localeQuery)(options), { operationId: 'listEntityFields' });
|
|
72
87
|
}
|
|
73
88
|
/**
|
|
74
|
-
* Read a single field definition.
|
|
89
|
+
* Read a single field definition — the SAME shape the collection and the entity detail carry.
|
|
75
90
|
*/
|
|
76
91
|
async getField(entityName, fieldName, options) {
|
|
77
|
-
return this.client.get(`/contract/entities/${entityName}/fields/${fieldName}`, (0, fetch_client_1.localeQuery)(options), { operationId: 'getEntityField' });
|
|
92
|
+
return await this.client.get(`/contract/entities/${entityName}/fields/${fieldName}`, (0, fetch_client_1.localeQuery)(options), { operationId: 'getEntityField' });
|
|
78
93
|
}
|
|
79
94
|
/**
|
|
80
|
-
* Replace a field
|
|
95
|
+
* Replace a field wholesale (PUT). {@link updateField} is the partial (PATCH) counterpart.
|
|
96
|
+
*
|
|
97
|
+
* A TOTAL write — every mutable property is REQUIRED and `null` clears; see
|
|
98
|
+
* `FieldReplaceInput`.
|
|
81
99
|
*/
|
|
82
100
|
async replaceField(entityName, fieldName, input) {
|
|
83
|
-
return this.client.put(`/contract/entities/${entityName}/fields/${fieldName}`, input, { operationId: 'replaceEntityField' });
|
|
101
|
+
return await this.client.put(`/contract/entities/${entityName}/fields/${fieldName}`, input, { operationId: 'replaceEntityField' });
|
|
84
102
|
}
|
|
85
103
|
// ── Field transitions — state-machine rules on a field, addressed by (entity, field, from, to) ──
|
|
86
104
|
async listFieldTransitions(entityName, fieldName, options) {
|
|
87
|
-
return this.client.get(`/contract/entities/${entityName}/fields/${fieldName}/transitions`, (0, fetch_client_1.localeQuery)(options), { operationId: 'listFieldTransitions' });
|
|
105
|
+
return await this.client.get(`/contract/entities/${entityName}/fields/${fieldName}/transitions`, (0, fetch_client_1.localeQuery)(options), { operationId: 'listFieldTransitions' });
|
|
88
106
|
}
|
|
89
107
|
async getFieldTransition(entityName, fieldName, from, to, options) {
|
|
90
|
-
return this.client.get(`/contract/entities/${entityName}/fields/${fieldName}/transitions/${from}/${to}`, (0, fetch_client_1.localeQuery)(options), { operationId: 'getFieldTransition' });
|
|
108
|
+
return await this.client.get(`/contract/entities/${entityName}/fields/${fieldName}/transitions/${from}/${to}`, (0, fetch_client_1.localeQuery)(options), { operationId: 'getFieldTransition' });
|
|
91
109
|
}
|
|
92
110
|
async createFieldTransition(entityName, fieldName, input) {
|
|
93
|
-
return this.client.post(`/contract/entities/${entityName}/fields/${fieldName}/transitions`, input, { operationId: 'createFieldTransition' });
|
|
111
|
+
return await this.client.post(`/contract/entities/${entityName}/fields/${fieldName}/transitions`, input, { operationId: 'createFieldTransition' });
|
|
94
112
|
}
|
|
95
113
|
async replaceFieldTransition(entityName, fieldName, from, to, input) {
|
|
96
|
-
return this.client.put(`/contract/entities/${entityName}/fields/${fieldName}/transitions/${from}/${to}`, input, { operationId: 'replaceFieldTransition' });
|
|
114
|
+
return await this.client.put(`/contract/entities/${entityName}/fields/${fieldName}/transitions/${from}/${to}`, input, { operationId: 'replaceFieldTransition' });
|
|
97
115
|
}
|
|
98
116
|
async patchFieldTransition(entityName, fieldName, from, to, patch) {
|
|
99
|
-
return this.client.patch(`/contract/entities/${entityName}/fields/${fieldName}/transitions/${from}/${to}`, patch, { operationId: 'patchFieldTransition' });
|
|
117
|
+
return await this.client.patch(`/contract/entities/${entityName}/fields/${fieldName}/transitions/${from}/${to}`, patch, { operationId: 'patchFieldTransition' });
|
|
100
118
|
}
|
|
119
|
+
/** `ContractDeletedAck`, not `void`: this route answers `{success, data: {message}}`. */
|
|
101
120
|
async deleteFieldTransition(entityName, fieldName, from, to) {
|
|
102
|
-
await this.client.del(`/contract/entities/${entityName}/fields/${fieldName}/transitions/${from}/${to}`, { operationId: 'deleteFieldTransition' });
|
|
121
|
+
return await this.client.del(`/contract/entities/${entityName}/fields/${fieldName}/transitions/${from}/${to}`, { operationId: 'deleteFieldTransition' });
|
|
103
122
|
}
|
|
104
123
|
}
|
|
105
124
|
exports.EntitiesResource = EntitiesResource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../src/resources/entities.ts"],"names":[],"mappings":";;;AAAA,4DAA0E;
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../src/resources/entities.ts"],"names":[],"mappings":";;;AAAA,+BAA+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AAkC;QAC5H,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAyB,sBAAsB,UAAU,WAAW,SAAS,gBAAgB,IAAI,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC,CAAC;IAC7L,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,UAAkB,EAAE,SAAiB,EAAE,IAAY,EAAE,EAAU,EAAE,KAAkC;QAC1H,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAyB,sBAAsB,UAAU,WAAW,SAAS,gBAAgB,IAAI,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC,CAAC;IAC7L,CAAC;IAED,yFAAyF;IACzF,KAAK,CAAC,qBAAqB,CAAC,UAAkB,EAAE,SAAiB,EAAE,IAAY,EAAE,EAAU;QACvF,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAqB,sBAAsB,UAAU,WAAW,SAAS,gBAAgB,IAAI,IAAI,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC,CAAC;IACjL,CAAC;CACJ;AA/HD,4CA+HC"}
|
|
@@ -6,8 +6,8 @@ export declare class EventsResource {
|
|
|
6
6
|
private readonly client;
|
|
7
7
|
constructor(client: FetchClient);
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* (`GET /runtime/events/stream
|
|
9
|
+
* Open a typed Server-Sent-Events stream of live tenant events
|
|
10
|
+
* (`GET /runtime/events/stream`). Delivers typed `conversation.turn_created`
|
|
11
11
|
* events (and a generic fallback for other named events) to `handlers.onEvent`;
|
|
12
12
|
* reconnects across transient disconnects. Returns a teardown handle.
|
|
13
13
|
*/
|
|
@@ -22,9 +22,8 @@ export declare class EventsResource {
|
|
|
22
22
|
*/
|
|
23
23
|
iterate(options?: EventIterateOptions): AsyncIterableIterator<RuntimeStreamEvent>;
|
|
24
24
|
/**
|
|
25
|
-
* List event deliveries (the runtime log of dispatched webhook events
|
|
26
|
-
*
|
|
27
|
-
* `/runtime/events/delivery` surface.
|
|
25
|
+
* List event deliveries (the runtime log of dispatched webhook events,
|
|
26
|
+
* `GET /runtime/events/delivery`).
|
|
28
27
|
*/
|
|
29
28
|
listDeliveries(options?: LocaleOptions): Promise<EventListResponse>;
|
|
30
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/resources/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/resources/events.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,2BAA2B,CAAC;AACrF,OAAO,KAAK,EACR,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,6BAA6B,EAC7B,mCAAmC,EACtC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EACR,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EACrB,MAAM,wBAAwB,CAAC;AAGhC,qBAAa,cAAc;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,iBAAiB;IAItF;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC;IAcjF;;;OAGG;IACG,cAAc,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAOzE;;OAEG;IACG,SAAS,CACX,KAAK,EAAE,sBAAsB,EAC7B,cAAc,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAC1C,OAAO,CAAC,yBAAyB,CAAC;IAIrC;;OAEG;IACG,iBAAiB,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAOxF;;OAEG;IACG,kBAAkB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,mCAAmC,CAAC;CAG1G"}
|
package/dist/resources/events.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EventsResource = void 0;
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
|
+
// Copyright 2026 Nicolas Moreno
|
|
4
6
|
const fetch_client_1 = require("../_internal/fetch-client");
|
|
5
7
|
const event_iterator_1 = require("../_internal/event-iterator");
|
|
6
8
|
class EventsResource {
|
|
@@ -9,8 +11,8 @@ class EventsResource {
|
|
|
9
11
|
this.client = client;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
13
|
-
* (`GET /runtime/events/stream
|
|
14
|
+
* Open a typed Server-Sent-Events stream of live tenant events
|
|
15
|
+
* (`GET /runtime/events/stream`). Delivers typed `conversation.turn_created`
|
|
14
16
|
* events (and a generic fallback for other named events) to `handlers.onEvent`;
|
|
15
17
|
* reconnects across transient disconnects. Returns a teardown handle.
|
|
16
18
|
*/
|
|
@@ -35,21 +37,20 @@ class EventsResource {
|
|
|
35
37
|
return (0, event_iterator_1.createEventIterator)((handlers, streamOpts) => this.client.openEventStream('/runtime/events/stream', handlers, streamOpts), config);
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
38
|
-
* List event deliveries (the runtime log of dispatched webhook events
|
|
39
|
-
*
|
|
40
|
-
* `/runtime/events/delivery` surface.
|
|
40
|
+
* List event deliveries (the runtime log of dispatched webhook events,
|
|
41
|
+
* `GET /runtime/events/delivery`).
|
|
41
42
|
*/
|
|
42
43
|
async listDeliveries(options) {
|
|
43
44
|
const q = (0, fetch_client_1.localeQueryOrUndefined)(options);
|
|
44
45
|
return q
|
|
45
|
-
? this.client.get('/runtime/events/delivery', q, { operationId: 'listEventDeliveries' })
|
|
46
|
-
: this.client.get('/runtime/events/delivery', undefined, { operationId: 'listEventDeliveries' });
|
|
46
|
+
? await this.client.get('/runtime/events/delivery', q, { operationId: 'listEventDeliveries' })
|
|
47
|
+
: await this.client.get('/runtime/events/delivery', undefined, { operationId: 'listEventDeliveries' });
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
49
50
|
* Create a webhook event subscription.
|
|
50
51
|
*/
|
|
51
52
|
async subscribe(input, requestOptions) {
|
|
52
|
-
return this.client.post('/runtime/events/subscriptions', input, { operationId: 'createEventSubscription', ...requestOptions });
|
|
53
|
+
return await this.client.post('/runtime/events/subscriptions', input, { operationId: 'createEventSubscription', ...requestOptions });
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
55
56
|
* List all event subscriptions.
|
|
@@ -57,14 +58,14 @@ class EventsResource {
|
|
|
57
58
|
async listSubscriptions(options) {
|
|
58
59
|
const q = (0, fetch_client_1.localeQueryOrUndefined)(options);
|
|
59
60
|
return q
|
|
60
|
-
? this.client.get('/runtime/events/subscriptions', q, { operationId: 'listEventSubscriptions' })
|
|
61
|
-
: this.client.get('/runtime/events/subscriptions', undefined, { operationId: 'listEventSubscriptions' });
|
|
61
|
+
? await this.client.get('/runtime/events/subscriptions', q, { operationId: 'listEventSubscriptions' })
|
|
62
|
+
: await this.client.get('/runtime/events/subscriptions', undefined, { operationId: 'listEventSubscriptions' });
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
65
|
* Deactivate a webhook subscription.
|
|
65
66
|
*/
|
|
66
67
|
async deleteSubscription(subscriptionId) {
|
|
67
|
-
return this.client.del(`/runtime/events/subscriptions/${subscriptionId}`, { operationId: 'deactivateEventSubscription' });
|
|
68
|
+
return await this.client.del(`/runtime/events/subscriptions/${subscriptionId}`, { operationId: 'deactivateEventSubscription' });
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
exports.EventsResource = EventsResource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/resources/events.ts"],"names":[],"mappings":";;;AAAA,4DAAqF;AAgBrF,gEAAkE;AAElE,MAAa,cAAc;IACM;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;;OAKG;IACH,MAAM,CAAC,QAA6B,EAAE,OAA4B;QAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,wBAAwB,EAAE,QAAQ,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,OAA6B;QACjC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;QAClE,MAAM,MAAM,GAAG;YACX,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnD,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjD,aAAa;SAChB,CAAC;QACF,OAAO,IAAA,oCAAmB,EACtB,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,CACrB,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,wBAAwB,EAAE,QAAQ,EAAE,UAAU,CAAC,EAC/E,MAAM,CACT,CAAC;IACN,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/resources/events.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,gCAAgC;AAChC,4DAAqF;AAgBrF,gEAAkE;AAElE,MAAa,cAAc;IACM;IAA7B,YAA6B,MAA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,KAA6B,EAC7B,cAAyC;QAEzC,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAA4B,+BAA+B,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,yBAAyB,EAAE,GAAG,cAAc,EAAE,CAAC,CAAC;IACpK,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAuB;QAC3C,MAAM,CAAC,GAAG,IAAA,qCAAsB,EAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,CAAC;YACJ,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgC,+BAA+B,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;YACrI,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgC,+BAA+B,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC,CAAC;IACtJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CAAC,cAA+B;QACpD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAsC,iCAAiC,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC,CAAC;IACzK,CAAC;CACJ;AAxED,wCAwEC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type FetchClient } from '../_internal/fetch-client';
|
|
2
|
-
import type { FlowEventListResponse, FlowEventResponse, FlowInstanceListResponse, FlowInstanceResponse } from '../types/flows';
|
|
3
|
-
import type { FlowCallbackResponse } from '../types/platform';
|
|
2
|
+
import type { FlowCallbackListResponse, FlowCallbackResolution, FlowCallbackResponse, FlowEventListResponse, FlowEventResponse, FlowInstanceListResponse, FlowInstanceResponse } from '../types/flows';
|
|
4
3
|
import type { LocaleOptions } from '../types/locale';
|
|
5
4
|
/**
|
|
6
5
|
* Runtime flow instances, events, and callbacks.
|
|
@@ -17,16 +16,12 @@ export declare class FlowsResource {
|
|
|
17
16
|
}): Promise<FlowInstanceListResponse>;
|
|
18
17
|
getInstance(instanceId: string, options?: LocaleOptions): Promise<FlowInstanceResponse>;
|
|
19
18
|
/**
|
|
20
|
-
* The appended flow lifecycle log — where per-step history lives
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* (`listFlowEvents`) the whole time; this resource simply never bound it, so
|
|
24
|
-
* the only per-step data the platform keeps was unreachable from the SDK.
|
|
25
|
-
* That is why consumers reached for `FlowInstance.steps`, a field the route
|
|
26
|
-
* has never sent.
|
|
19
|
+
* The appended flow lifecycle log — where per-step history lives
|
|
20
|
+
* (`GET /runtime/flows/events`). A flow instance carries no per-step data;
|
|
21
|
+
* read it here.
|
|
27
22
|
*
|
|
28
23
|
* Pass `instanceId` for one run's trace. Events come back in CHAIN order
|
|
29
|
-
* (`seq`), not `created_at` —
|
|
24
|
+
* (`seq`), not `created_at` — events appended together can share a
|
|
30
25
|
* timestamp, so only `seq` is a total order.
|
|
31
26
|
*/
|
|
32
27
|
listEvents(options?: LocaleOptions & {
|
|
@@ -34,12 +29,20 @@ export declare class FlowsResource {
|
|
|
34
29
|
eventType?: string;
|
|
35
30
|
}): Promise<FlowEventListResponse>;
|
|
36
31
|
getEvent(eventId: string, options?: LocaleOptions): Promise<FlowEventResponse>;
|
|
32
|
+
/** The tenant's flow callbacks — a suspended run's resumption points. */
|
|
33
|
+
listCallbacks(options?: LocaleOptions): Promise<FlowCallbackListResponse>;
|
|
34
|
+
/** One flow callback. */
|
|
35
|
+
getCallback(callbackId: string, options?: LocaleOptions): Promise<FlowCallbackResponse>;
|
|
37
36
|
/**
|
|
38
|
-
* Resolve a pending flow callback
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
37
|
+
* Resolve a pending flow callback with `{action: 'complete', payload}` or
|
|
38
|
+
* `{action: 'fail', reason?}`. Answers the resolved callback.
|
|
39
|
+
*
|
|
40
|
+
* REQUIRES A TOKEN: a token-less PATCH is refused `401`, so an external worker
|
|
41
|
+
* resolving a callback must authenticate like any other caller.
|
|
42
|
+
*
|
|
43
|
+
* The response is the canonical envelope carrying the resolved `FlowCallback`;
|
|
44
|
+
* the transport unwraps it, so this returns the `FlowCallback` itself.
|
|
42
45
|
*/
|
|
43
|
-
resolveCallback(callbackId: string,
|
|
46
|
+
resolveCallback(callbackId: string, resolution: FlowCallbackResolution): Promise<FlowCallbackResponse>;
|
|
44
47
|
}
|
|
45
48
|
//# sourceMappingURL=flows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/resources/flows.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/resources/flows.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,2BAA2B,CAAC;AACrF,OAAO,KAAK,EACR,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;GAMG;AACH,qBAAa,aAAa;IACV,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAE1C,aAAa,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAW7F,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAQ7F;;;;;;;;OAQG;IACG,UAAU,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAUjH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQpF,yEAAyE;IACnE,aAAa,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAO/E,yBAAyB;IACnB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAQ7F;;;;;;;;;OASG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,sBAAsB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAO/G"}
|
package/dist/resources/flows.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlowsResource = void 0;
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
|
+
// Copyright 2026 Nicolas Moreno
|
|
4
6
|
const fetch_client_1 = require("../_internal/fetch-client");
|
|
5
7
|
/**
|
|
6
8
|
* Runtime flow instances, events, and callbacks.
|
|
@@ -15,35 +17,31 @@ class FlowsResource {
|
|
|
15
17
|
this.client = client;
|
|
16
18
|
}
|
|
17
19
|
async listInstances(options) {
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
+
// Optional `flow` filter (`?flow={name}`) narrows the list to one
|
|
21
|
+
// flow's runs; it combines with the locale query.
|
|
20
22
|
const q = {};
|
|
21
23
|
if (options?.locale)
|
|
22
24
|
q.locale = options.locale;
|
|
23
25
|
if (options?.flow)
|
|
24
26
|
q.flow = options.flow;
|
|
25
27
|
return Object.keys(q).length > 0
|
|
26
|
-
? this.client.get('/runtime/flows/instances', q, { operationId: 'listFlowInstances' })
|
|
27
|
-
: this.client.get('/runtime/flows/instances', undefined, { operationId: 'listFlowInstances' });
|
|
28
|
+
? await this.client.get('/runtime/flows/instances', q, { operationId: 'listFlowInstances' })
|
|
29
|
+
: await this.client.get('/runtime/flows/instances', undefined, { operationId: 'listFlowInstances' });
|
|
28
30
|
}
|
|
29
31
|
async getInstance(instanceId, options) {
|
|
30
32
|
const path = `/runtime/flows/instances/${encodeURIComponent(instanceId)}`;
|
|
31
33
|
const q = (0, fetch_client_1.localeQueryOrUndefined)(options);
|
|
32
34
|
return q
|
|
33
|
-
? this.client.get(path, q, { operationId: 'getFlowInstance' })
|
|
34
|
-
: this.client.get(path, undefined, { operationId: 'getFlowInstance' });
|
|
35
|
+
? await this.client.get(path, q, { operationId: 'getFlowInstance' })
|
|
36
|
+
: await this.client.get(path, undefined, { operationId: 'getFlowInstance' });
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
|
-
* The appended flow lifecycle log — where per-step history lives
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* (`listFlowEvents`) the whole time; this resource simply never bound it, so
|
|
41
|
-
* the only per-step data the platform keeps was unreachable from the SDK.
|
|
42
|
-
* That is why consumers reached for `FlowInstance.steps`, a field the route
|
|
43
|
-
* has never sent.
|
|
39
|
+
* The appended flow lifecycle log — where per-step history lives
|
|
40
|
+
* (`GET /runtime/flows/events`). A flow instance carries no per-step data;
|
|
41
|
+
* read it here.
|
|
44
42
|
*
|
|
45
43
|
* Pass `instanceId` for one run's trace. Events come back in CHAIN order
|
|
46
|
-
* (`seq`), not `created_at` —
|
|
44
|
+
* (`seq`), not `created_at` — events appended together can share a
|
|
47
45
|
* timestamp, so only `seq` is a total order.
|
|
48
46
|
*/
|
|
49
47
|
async listEvents(options) {
|
|
@@ -55,27 +53,43 @@ class FlowsResource {
|
|
|
55
53
|
if (options?.eventType)
|
|
56
54
|
q.event_type = options.eventType;
|
|
57
55
|
return Object.keys(q).length > 0
|
|
58
|
-
? this.client.get('/runtime/flows/events', q, { operationId: 'listFlowEvents' })
|
|
59
|
-
: this.client.get('/runtime/flows/events', undefined, { operationId: 'listFlowEvents' });
|
|
56
|
+
? await this.client.get('/runtime/flows/events', q, { operationId: 'listFlowEvents' })
|
|
57
|
+
: await this.client.get('/runtime/flows/events', undefined, { operationId: 'listFlowEvents' });
|
|
60
58
|
}
|
|
61
59
|
async getEvent(eventId, options) {
|
|
62
60
|
const path = `/runtime/flows/events/${encodeURIComponent(eventId)}`;
|
|
63
61
|
const q = (0, fetch_client_1.localeQueryOrUndefined)(options);
|
|
64
62
|
return q
|
|
65
|
-
? this.client.get(path, q, { operationId: 'getFlowEvent' })
|
|
66
|
-
: this.client.get(path, undefined, { operationId: 'getFlowEvent' });
|
|
63
|
+
? await this.client.get(path, q, { operationId: 'getFlowEvent' })
|
|
64
|
+
: await this.client.get(path, undefined, { operationId: 'getFlowEvent' });
|
|
65
|
+
}
|
|
66
|
+
/** The tenant's flow callbacks — a suspended run's resumption points. */
|
|
67
|
+
async listCallbacks(options) {
|
|
68
|
+
const q = (0, fetch_client_1.localeQueryOrUndefined)(options);
|
|
69
|
+
return q
|
|
70
|
+
? await this.client.get('/runtime/flows/callbacks', q, { operationId: 'listFlowCallbacks' })
|
|
71
|
+
: await this.client.get('/runtime/flows/callbacks', undefined, { operationId: 'listFlowCallbacks' });
|
|
72
|
+
}
|
|
73
|
+
/** One flow callback. */
|
|
74
|
+
async getCallback(callbackId, options) {
|
|
75
|
+
const path = `/runtime/flows/callbacks/${encodeURIComponent(callbackId)}`;
|
|
76
|
+
const q = (0, fetch_client_1.localeQueryOrUndefined)(options);
|
|
77
|
+
return q
|
|
78
|
+
? await this.client.get(path, q, { operationId: 'getFlowCallback' })
|
|
79
|
+
: await this.client.get(path, undefined, { operationId: 'getFlowCallback' });
|
|
67
80
|
}
|
|
68
81
|
/**
|
|
69
|
-
* Resolve a pending flow callback
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
82
|
+
* Resolve a pending flow callback with `{action: 'complete', payload}` or
|
|
83
|
+
* `{action: 'fail', reason?}`. Answers the resolved callback.
|
|
84
|
+
*
|
|
85
|
+
* REQUIRES A TOKEN: a token-less PATCH is refused `401`, so an external worker
|
|
86
|
+
* resolving a callback must authenticate like any other caller.
|
|
87
|
+
*
|
|
88
|
+
* The response is the canonical envelope carrying the resolved `FlowCallback`;
|
|
89
|
+
* the transport unwraps it, so this returns the `FlowCallback` itself.
|
|
73
90
|
*/
|
|
74
|
-
async resolveCallback(callbackId,
|
|
75
|
-
|
|
76
|
-
// — indistinguishable from a canonical no-data envelope by key shape, so
|
|
77
|
-
// opt out of the unwrap to return the whole body (G1).
|
|
78
|
-
return this.client.patch(`/runtime/flows/callbacks/${encodeURIComponent(callbackId)}`, payload, { operationId: 'resolveFlowCallback' });
|
|
91
|
+
async resolveCallback(callbackId, resolution) {
|
|
92
|
+
return await this.client.patch(`/runtime/flows/callbacks/${encodeURIComponent(callbackId)}`, resolution, { operationId: 'resolveFlowCallback' });
|
|
79
93
|
}
|
|
80
94
|
}
|
|
81
95
|
exports.FlowsResource = FlowsResource;
|