@diagonal-hq/workflows 0.1.0 → 0.3.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/README.md CHANGED
@@ -4,8 +4,8 @@ This package is the authoring API of Diagonal managed workflows. A workflow modu
4
4
 
5
5
  ## Entry points
6
6
 
7
- | Entry point | Used by | Exports |
8
- | --------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7
+ | Entry point | Used by | Exports |
8
+ | ---------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
9
9
  | `@diagonal-hq/workflows` | Workflows | `defineWorkflow`, `respond`, `redirect`, `fail`, `validationError`, the input schema builder `v`, `transaction`, `data`, `mail`, `notification`, `sms`, and the generated capability wrappers |
10
10
  | `@diagonal-hq/workflows/test` | E2E setup and assert scripts | The helpers that call no host capability: `fail`, `validationError`, `HostError`, `WorkflowFailure`, and `v` |
11
11
  | `@diagonal-hq/workflows/migration` | Data migration scripts | The same helpers as `/test` |
@@ -43,10 +43,16 @@ const output = await runWorkflow(welcomeMember, {}, { transport });
43
43
 
44
44
  ## Publish the package
45
45
 
46
- The `Publish npm package` workflow (`.github/workflows/publish-npm-package.yml`) publishes the package to npm. It runs only from `main`.
46
+ The `Publish npm package` workflow (`.github/workflows/publish-npm-package.yml`) publishes the package to npm after each push to `main`. You can also run it from the Actions tab.
47
47
 
48
- 1. Set `version` in `package.json` to a version that npm does not have. A version with a prerelease part, such as `0.2.0-next.1`, gets the `next` tag. Other versions get `latest`.
49
- 2. Merge the change to `main`.
50
- 3. Run the workflow from the Actions tab and select `workflows`.
48
+ 1. The build job builds and packs the package. It compares the packed files with the tarball that npm has for the version in `package.json`. The `version` field does not count.
49
+ 2. When the files differ, a model reads the diff and the commit subjects since that publish. It classifies the change as breaking, feature, or fix. Before 1.0.0, a breaking change raises the minor part, and other changes raise the patch part. From 1.0.0, the workflow follows semantic versioning.
50
+ 3. The build job packs the package again at the new version and runs the smoke test on the tarball.
51
+ 4. The commit job commits the new version to `main` with an `[automated] release:` commit.
52
+ 5. The publish job runs in the `npm-publish` environment and publishes the tested bytes with npm trusted publishing. It does not build again. It refuses a version that npm already has.
53
+
54
+ To choose a version yourself, such as 1.0.0 or a prerelease, set `version` in `package.json` to a version that npm does not have, and merge the change. The workflow publishes that version as it is. A version with a prerelease part, such as `0.2.0-next.1`, gets the `next` tag. Other versions get `latest`. The workflow does not raise a prerelease version. Set the next version by hand.
55
+
56
+ The model call uses the `OPENROUTER_API_KEY` secret. When the call fails, the release fails. The workflow does not guess a version.
51
57
 
52
58
  npm must list `Diagonal-HQ/diagonal`, the `publish-npm-package.yml` workflow, and the `npm-publish` environment as the trusted publisher of `@diagonal-hq/workflows`.
package/dist/data.d.ts CHANGED
@@ -1,9 +1,19 @@
1
- import { type DataCountInput, type DataCreateInput, type DataCreateManyInput, type DataDeleteInput, type DataDeleteManyInput, type DataDeleteManyOutput, type DataFindInput, type DataFindOrCreateInput, type DataRestoreInput, type DataSearchInput, type DataSearchOutput, type DataUpdateInput, type DataUpdateOrCreateInput } from './generated/capabilities';
2
- import type { WorkspaceResources } from './index';
1
+ import { type DataCountInput, type DataCreateInput, type DataCreateManyInput, type DataDeleteInput, type DataDeleteManyInput, type DataDeleteManyOutput, type DataFindInput, type DataFindOrCreateInput, type DataRestoreInput, type DataSearchInput, type DataSearchOutput, type DataUpdateInput, type DataUpdateOrCreateInput } from "./generated/capabilities.js";
2
+ import type { WorkspaceResources } from "./index.js";
3
3
  type Entry = WorkspaceResources[keyof WorkspaceResources];
4
4
  export type ResourceKey = [keyof WorkspaceResources] extends [never] ? string : Entry extends {
5
5
  id: infer I;
6
6
  } ? I : never;
7
+ /** The id of each entry of `E` that has every capability in `C`. */
8
+ type IdWithCapabilities<E, C extends string> = E extends {
9
+ id: infer I;
10
+ capabilities: infer Declared;
11
+ } ? [C] extends [Declared] ? I : never : never;
12
+ /**
13
+ * The ids of the resources that have every capability in `C`. Any string while the workspace
14
+ * declares no resources.
15
+ */
16
+ export type ResourceKeyWith<C extends string> = [keyof WorkspaceResources] extends [never] ? string : IdWithCapabilities<Entry, C>;
7
17
  type EntryFor<R> = Extract<Entry, {
8
18
  id: R;
9
19
  }>;
@@ -99,16 +109,16 @@ export declare const data: {
99
109
  deleteMany: <R extends ResourceKey>(input: Omit<DataDeleteManyInput, "resource"> & {
100
110
  resource: R;
101
111
  }) => Promise<DataDeleteManyOutput>;
102
- aggregateMetrics: (input: import("./index").DataAggregateMetricsInput) => Promise<import("./index").DataAggregateMetricsOutput>;
112
+ aggregateMetrics: (input: import("./index.js").DataAggregateMetricsInput) => Promise<import("./index.js").DataAggregateMetricsOutput>;
103
113
  relation: {
104
- attach: (input: import("./index").DataRelationAttachInput) => Promise<import("./index").DataRelationAttachOutput>;
105
- attachMany: (input: import("./index").DataRelationAttachManyInput) => Promise<import("./index").DataRelationAttachManyOutput>;
106
- detach: (input: import("./index").DataRelationDetachInput) => Promise<import("./index").DataRelationDetachOutput>;
107
- detachMany: (input: import("./index").DataRelationDetachManyInput) => Promise<import("./index").DataRelationDetachManyOutput>;
108
- sync: (input: import("./index").DataRelationSyncInput) => Promise<import("./index").DataRelationSyncOutput>;
114
+ attach: (input: import("./index.js").DataRelationAttachInput) => Promise<import("./index.js").DataRelationAttachOutput>;
115
+ attachMany: (input: import("./index.js").DataRelationAttachManyInput) => Promise<import("./index.js").DataRelationAttachManyOutput>;
116
+ detach: (input: import("./index.js").DataRelationDetachInput) => Promise<import("./index.js").DataRelationDetachOutput>;
117
+ detachMany: (input: import("./index.js").DataRelationDetachManyInput) => Promise<import("./index.js").DataRelationDetachManyOutput>;
118
+ sync: (input: import("./index.js").DataRelationSyncInput) => Promise<import("./index.js").DataRelationSyncOutput>;
109
119
  };
110
- semanticSearch: (input: import("./index").DataSemanticSearchInput) => Promise<import("./index").DataSemanticSearchOutput>;
111
- sum: (input: import("./index").DataSumInput) => Promise<import("./index").DataSumOutput>;
112
- validate: (input: import("./index").DataValidateInput) => Promise<import("./index").DataValidateOutput>;
120
+ semanticSearch: (input: import("./index.js").DataSemanticSearchInput) => Promise<import("./index.js").DataSemanticSearchOutput>;
121
+ sum: (input: import("./index.js").DataSumInput) => Promise<import("./index.js").DataSumOutput>;
122
+ validate: (input: import("./index.js").DataValidateInput) => Promise<import("./index.js").DataValidateOutput>;
113
123
  };
114
124
  export {};
@@ -1,5 +1,6 @@
1
- import type { ContentDocument } from '../input';
2
- export declare const SDK_VERSION = 54;
1
+ import type { ResourceKeyWith } from "../data.js";
2
+ import type { ContentDocument } from "../input.js";
3
+ export declare const SDK_VERSION = 56;
3
4
  export interface AiDecideInput {
4
5
  state: unknown;
5
6
  questions: Array<{
@@ -24,7 +25,7 @@ export interface AiRunPromptInput {
24
25
  }
25
26
  export type AiRunPromptOutput = string;
26
27
  export interface AuthImpersonateInput {
27
- resource: string;
28
+ resource: ResourceKeyWith<"authenticatable">;
28
29
  record: string;
29
30
  }
30
31
  export type AuthImpersonateOutput = {
@@ -34,18 +35,18 @@ export type AuthImpersonateOutput = {
34
35
  [key: string]: unknown;
35
36
  };
36
37
  export interface AuthLoginInput {
37
- resource: string;
38
+ resource: ResourceKeyWith<"authenticatable">;
38
39
  record: string;
39
40
  }
40
41
  export type AuthLoginOutput = boolean;
41
42
  export interface CalendarGenerateLinkInput {
42
43
  type: "apple" | "google" | "outlook";
43
- resource: string;
44
+ resource: ResourceKeyWith<"eventable">;
44
45
  record: string;
45
46
  }
46
47
  export type CalendarGenerateLinkOutput = unknown;
47
48
  export interface CalendarSearchEventsInput {
48
- resource: string;
49
+ resource: ResourceKeyWith<"eventable">;
49
50
  from: string;
50
51
  to: string;
51
52
  filters?: unknown;
@@ -639,7 +640,7 @@ export interface MoneyFormatInput {
639
640
  }
640
641
  export type MoneyFormatOutput = string;
641
642
  export interface NotificationSendInput {
642
- resource: string;
643
+ resource: ResourceKeyWith<"notifiable">;
643
644
  relations?: Array<string>;
644
645
  record: string;
645
646
  subject: string;
@@ -700,7 +701,7 @@ export interface NotificationSendNotificationInput {
700
701
  }
701
702
  export type NotificationSendNotificationOutput = boolean;
702
703
  export interface NotificationSetConsentInput {
703
- resource: string;
704
+ resource: ResourceKeyWith<"notifiable">;
704
705
  record: string;
705
706
  sms?: boolean | null;
706
707
  email?: boolean | null;
@@ -730,7 +731,7 @@ export type PageUrlOutput = unknown;
730
731
  export interface PayablesVoidInput {
731
732
  reason?: string | null;
732
733
  effectiveDate?: string | null;
733
- payableResource: string;
734
+ payableResource: ResourceKeyWith<"payable">;
734
735
  payableRecord: string;
735
736
  }
736
737
  export type PayablesVoidOutput = {
@@ -739,9 +740,9 @@ export type PayablesVoidOutput = {
739
740
  };
740
741
  export interface PayablesWriteOffInput {
741
742
  lineAllocations?: unknown[] | null;
742
- payableResource: string;
743
+ payableResource: ResourceKeyWith<"payable">;
743
744
  payableRecord: string;
744
- adjustmentResource: string;
745
+ adjustmentResource: ResourceKeyWith<"payable_adjustment">;
745
746
  amount?: {
746
747
  amount: number;
747
748
  currency: string;
@@ -752,7 +753,7 @@ export interface PayablesWriteOffInput {
752
753
  }
753
754
  export type PayablesWriteOffOutput = Record<string, unknown>;
754
755
  export interface PaymentCreateManualInput {
755
- resource: string;
756
+ resource: ResourceKeyWith<"payment">;
756
757
  payableRecord: string;
757
758
  amount: {
758
759
  amount: number;
@@ -765,7 +766,7 @@ export interface PaymentCreateManualInput {
765
766
  }
766
767
  export type PaymentCreateManualOutput = Record<string, unknown>;
767
768
  export interface PaymentsChargeInput {
768
- payableResource: string;
769
+ payableResource: ResourceKeyWith<"payable">;
769
770
  payableRecord: string;
770
771
  amount?: {
771
772
  amount: number;
@@ -778,7 +779,7 @@ export interface PaymentsChargeInput {
778
779
  }
779
780
  export type PaymentsChargeOutput = Record<string, unknown>;
780
781
  export interface PaymentsCheckoutInput {
781
- payableResource: string;
782
+ payableResource: ResourceKeyWith<"payable">;
782
783
  payableRecord: string;
783
784
  successUrl: string;
784
785
  cancelUrl?: string | null;
@@ -790,7 +791,7 @@ export type PaymentsCheckoutOutput = {
790
791
  [key: string]: unknown;
791
792
  };
792
793
  export interface PaymentsConfirmInput {
793
- payableResource: string;
794
+ payableResource: ResourceKeyWith<"payable">;
794
795
  payableRecord: string;
795
796
  confirmationTokenId?: string | null;
796
797
  paymentMethodId?: string | null;
@@ -816,7 +817,7 @@ export type PaymentsConfirmOutput = {
816
817
  [key: string]: unknown;
817
818
  };
818
819
  export interface PaymentsRefundInput {
819
- resource: string;
820
+ resource: ResourceKeyWith<"payment">;
820
821
  record: string;
821
822
  amount?: {
822
823
  amount: number;
@@ -902,7 +903,7 @@ export interface SmsSendNotificationInput {
902
903
  }
903
904
  export type SmsSendNotificationOutput = Record<string, unknown>;
904
905
  export interface SubscriptionsActivateInput {
905
- subscriptionResource: string;
906
+ subscriptionResource: ResourceKeyWith<"subscription">;
906
907
  subscriptionRecord: string;
907
908
  }
908
909
  export type SubscriptionsActivateOutput = {
@@ -910,7 +911,7 @@ export type SubscriptionsActivateOutput = {
910
911
  [key: string]: unknown;
911
912
  };
912
913
  export interface SubscriptionsCancelInput {
913
- subscriptionResource: string;
914
+ subscriptionResource: ResourceKeyWith<"subscription">;
914
915
  subscriptionRecord: string;
915
916
  atPeriodEnd?: boolean | null;
916
917
  }
@@ -919,7 +920,7 @@ export type SubscriptionsCancelOutput = {
919
920
  [key: string]: unknown;
920
921
  };
921
922
  export interface SubscriptionsChangeItemsInput {
922
- subscriptionResource: string;
923
+ subscriptionResource: ResourceKeyWith<"subscription">;
923
924
  subscriptionRecord: string;
924
925
  items: Array<{
925
926
  price_record_id?: string;
@@ -1100,7 +1101,7 @@ export type SubscriptionsChangeItemsOutput = {
1100
1101
  [key: string]: unknown;
1101
1102
  };
1102
1103
  export interface SubscriptionsCreateInput {
1103
- subscriptionResource: string;
1104
+ subscriptionResource: ResourceKeyWith<"subscription">;
1104
1105
  accountingEntity?: string | null;
1105
1106
  payerRecord: string;
1106
1107
  priceRecordIds?: Array<string> | null;
@@ -1146,7 +1147,7 @@ export type SubscriptionsCreateOutput = {
1146
1147
  [key: string]: unknown;
1147
1148
  };
1148
1149
  export interface SubscriptionsGenerateInvoiceInput {
1149
- subscriptionResource: string;
1150
+ subscriptionResource: ResourceKeyWith<"subscription">;
1150
1151
  subscriptionRecord: string;
1151
1152
  }
1152
1153
  export type SubscriptionsGenerateInvoiceOutput = {
@@ -1158,7 +1159,7 @@ export type SubscriptionsGenerateInvoiceOutput = {
1158
1159
  [key: string]: unknown;
1159
1160
  };
1160
1161
  export interface SubscriptionsPauseInput {
1161
- subscriptionResource: string;
1162
+ subscriptionResource: ResourceKeyWith<"subscription">;
1162
1163
  subscriptionRecord: string;
1163
1164
  }
1164
1165
  export type SubscriptionsPauseOutput = {
@@ -1166,7 +1167,7 @@ export type SubscriptionsPauseOutput = {
1166
1167
  [key: string]: unknown;
1167
1168
  };
1168
1169
  export interface SubscriptionsPreviewInput {
1169
- subscriptionResource: string;
1170
+ subscriptionResource: ResourceKeyWith<"subscription">;
1170
1171
  priceRecordIds?: Array<string> | null;
1171
1172
  items?: Array<{
1172
1173
  price_record_id?: string;
@@ -1347,7 +1348,7 @@ export type SubscriptionsPreviewOutput = {
1347
1348
  [key: string]: unknown;
1348
1349
  };
1349
1350
  export interface SubscriptionsPreviewChangeInput {
1350
- subscriptionResource: string;
1351
+ subscriptionResource: ResourceKeyWith<"subscription">;
1351
1352
  subscriptionRecord: string;
1352
1353
  items: Array<{
1353
1354
  price_record_id?: string;
@@ -1521,7 +1522,7 @@ export type SubscriptionsPreviewChangeOutput = {
1521
1522
  [key: string]: unknown;
1522
1523
  };
1523
1524
  export interface SubscriptionsResumeInput {
1524
- subscriptionResource: string;
1525
+ subscriptionResource: ResourceKeyWith<"subscription">;
1525
1526
  subscriptionRecord: string;
1526
1527
  }
1527
1528
  export type SubscriptionsResumeOutput = {
@@ -1529,7 +1530,7 @@ export type SubscriptionsResumeOutput = {
1529
1530
  [key: string]: unknown;
1530
1531
  };
1531
1532
  export interface SubscriptionsSetUpcomingItemsInput {
1532
- subscriptionResource: string;
1533
+ subscriptionResource: ResourceKeyWith<"subscription">;
1533
1534
  subscriptionRecord: string;
1534
1535
  desiredPriceRecordIds?: Array<string> | null;
1535
1536
  items?: Array<{
@@ -1804,7 +1805,7 @@ export interface WorkflowRunInput {
1804
1805
  [key: string]: unknown;
1805
1806
  };
1806
1807
  input?: Record<string, unknown> | null;
1807
- runAsResource?: string | null;
1808
+ runAsResource?: ResourceKeyWith<"authenticatable"> | null;
1808
1809
  runAsRecord?: string | null;
1809
1810
  executionMode?: "async" | "sync" | null;
1810
1811
  }
@@ -1937,7 +1938,7 @@ export declare const file: {
1937
1938
  changeVisibility: (input: FileChangeVisibilityInput) => Promise<FileChangeVisibilityOutput>;
1938
1939
  /** Download a file from a public http(s) URL and save it privately in the workspace */
1939
1940
  createFromUrl: (input: FileCreateFromUrlInput) => Promise<FileCreateFromUrlOutput>;
1940
- /** Create a public library master from an accessible workspace file, preserving external sources. Returns the library File ID */
1941
+ /** Create a public library master from an accessible workspace file, preserving external sources. Accepts images, video, audio and PDF by the type detected from bytes. Store other files in a record file field. Returns the library File ID */
1941
1942
  createMediaLibraryItem: (input: FileCreateMediaLibraryItemInput) => Promise<FileCreateMediaLibraryItemOutput>;
1942
1943
  /** Generate a QR code PNG image that encodes a value and save it privately in the workspace */
1943
1944
  createQrCode: (input: FileCreateQrCodeInput) => Promise<FileCreateQrCodeOutput>;
@@ -1,4 +1,4 @@
1
- import type { HostTransport } from './transport';
1
+ import type { HostTransport } from "./transport.js";
2
2
  /**
3
3
  * Sends each capability call to the workspace API for a local run. Every request is separate on
4
4
  * the server, so a transaction cannot span calls: `transaction()` fails before it sends a request.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import './console';
2
- export { HostError, WorkflowFailure, fail, validationError } from './errors';
3
- export { invoke, setTransport, type HostTransport } from './transport';
4
- export { transaction } from './transaction';
5
- export { data } from './data';
6
- export { mail, notification, sms } from './notifications';
7
- export { InputField, InputSchema, v, type ContentDocument, type ContentNode, type ContentOptions, type FileVisibility, type Infer, type InferInput, type InputFieldKind, type InputFieldSpec, type InputShape, type Money, type RecordScope } from './input';
8
- export { defineWorkflow, parseWorkflowInput, redirect, respond, validateWorkflowInput, type Identity, type InputErrors, type InputValidator, type RequestContext, type ScriptExecution, type WorkflowContext, type WorkflowDefinition, type WorkflowExecution } from './workflow';
9
- export * from './generated/capabilities';
1
+ import "./console.js";
2
+ export { HostError, WorkflowFailure, fail, validationError } from "./errors.js";
3
+ export { invoke, setTransport, type HostTransport } from "./transport.js";
4
+ export { transaction } from "./transaction.js";
5
+ export { data } from "./data.js";
6
+ export { mail, notification, sms } from "./notifications.js";
7
+ export { InputField, InputSchema, v, type ContentDocument, type ContentNode, type ContentOptions, type FileVisibility, type Infer, type InferInput, type InputFieldKind, type InputFieldSpec, type InputShape, type Money, type RecordScope } from "./input.js";
8
+ export { defineWorkflow, parseWorkflowInput, redirect, respond, validateWorkflowInput, type Identity, type InputErrors, type InputValidator, type RequestContext, type ScriptExecution, type WorkflowContext, type WorkflowDefinition, type WorkflowExecution } from "./workflow.js";
9
+ export * from "./generated/capabilities.js";
10
10
  /** The embedding host selects its execution context through its supplied declarations. */
11
11
  export interface ScriptHostContext {
12
12
  }
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ async function transaction(fn) {
42
42
  }
43
43
 
44
44
  // packages/workflows/src/generated/capabilities.ts
45
- var SDK_VERSION = 54;
45
+ var SDK_VERSION = 56;
46
46
  var ai = {
47
47
  /** Ask a decisions model typed questions about some content and get labelled answers with their probabilities */
48
48
  decide: (input) => invoke("ai.decide", input),
@@ -142,7 +142,7 @@ var file = {
142
142
  changeVisibility: (input) => invoke("file.change_visibility", input),
143
143
  /** Download a file from a public http(s) URL and save it privately in the workspace */
144
144
  createFromUrl: (input) => invoke("file.create_from_url", input),
145
- /** Create a public library master from an accessible workspace file, preserving external sources. Returns the library File ID */
145
+ /** Create a public library master from an accessible workspace file, preserving external sources. Accepts images, video, audio and PDF by the type detected from bytes. Store other files in a record file field. Returns the library File ID */
146
146
  createMediaLibraryItem: (input) => invoke("file.create_media_library_item", input),
147
147
  /** Generate a QR code PNG image that encodes a value and save it privately in the workspace */
148
148
  createQrCode: (input) => invoke("file.create_qr_code", input)
package/dist/input.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ResourceKey } from './data';
1
+ import type { ResourceKey } from "./data.js";
2
2
  /**
3
3
  * A declared input field, as data. The compiler reads a workflow's input schema from its source
4
4
  * and saves each field as a workflow input variable, so the platform validates a run's input
@@ -1,6 +1,6 @@
1
- import type { ResourceKey } from './data';
2
- import { type MailSendNotificationInput, type MailSendNotificationOutput, type NotificationSendBulkNotificationsInput, type NotificationSendBulkNotificationsOutput, type NotificationSendNotificationInput, type NotificationSetConsentInput, type NotificationSetConsentOutput, type SmsSendNotificationInput, type SmsSendNotificationOutput } from './generated/capabilities';
3
- import type { WorkspaceNotificationTypes } from './index';
1
+ import type { ResourceKey } from "./data.js";
2
+ import { type MailSendNotificationInput, type MailSendNotificationOutput, type NotificationSendBulkNotificationsInput, type NotificationSendBulkNotificationsOutput, type NotificationSendNotificationInput, type NotificationSetConsentInput, type NotificationSetConsentOutput, type SmsSendNotificationInput, type SmsSendNotificationOutput } from "./generated/capabilities.js";
3
+ import type { WorkspaceNotificationTypes } from "./index.js";
4
4
  type Entry = WorkspaceNotificationTypes[keyof WorkspaceNotificationTypes];
5
5
  type Declared = [keyof WorkspaceNotificationTypes] extends [never] ? false : true;
6
6
  export type NotificationTypeKey = Declared extends true ? Entry extends {
@@ -28,18 +28,18 @@ type NotificationInput<I, T, Channel extends 'template' | 'emailTemplate' | 'sms
28
28
  });
29
29
  export declare const mail: {
30
30
  sendNotification: <T extends NotificationTypeKey>(input: NotificationInput<MailSendNotificationInput, T, "emailTemplate">) => Promise<MailSendNotificationOutput>;
31
- search: (input: import("./index").MailSearchInput) => Promise<import("./index").MailSearchOutput>;
32
- send: (input: import("./index").MailSendInput) => Promise<import("./index").MailSendOutput>;
31
+ search: (input: import("./index.js").MailSearchInput) => Promise<import("./index.js").MailSearchOutput>;
32
+ send: (input: import("./index.js").MailSendInput) => Promise<import("./index.js").MailSendOutput>;
33
33
  };
34
34
  export declare const notification: {
35
35
  sendNotification: <T extends NotificationTypeKey>(input: NotificationInput<NotificationSendNotificationInput, T>) => Promise<boolean>;
36
36
  sendBulkNotifications: <T extends NotificationTypeKey, R extends ResourceKey>(input: Omit<NotificationInput<NotificationSendBulkNotificationsInput, T>, "resource"> & {
37
37
  resource: R;
38
38
  }) => Promise<NotificationSendBulkNotificationsOutput>;
39
- setConsent: <R extends ResourceKey>(input: Omit<NotificationSetConsentInput, "resource"> & {
39
+ setConsent: <R extends NotificationSetConsentInput["resource"]>(input: Omit<NotificationSetConsentInput, "resource"> & {
40
40
  resource: R;
41
41
  }) => Promise<NotificationSetConsentOutput>;
42
- send: (input: import("./index").NotificationSendInput) => Promise<import("./index").NotificationSendOutput>;
42
+ send: (input: import("./index.js").NotificationSendInput) => Promise<import("./index.js").NotificationSendOutput>;
43
43
  };
44
44
  export declare const sms: {
45
45
  sendNotification: <T extends NotificationTypeKey>(input: NotificationInput<SmsSendNotificationInput, T, "smsTemplate">) => Promise<SmsSendNotificationOutput>;
@@ -1,3 +1,3 @@
1
- import '../console';
2
- export { HostError, WorkflowFailure, fail, validationError } from '../errors';
3
- export { InputField, InputSchema, v, type ContentDocument, type ContentNode, type ContentOptions, type FileVisibility, type Infer, type InferInput, type InputFieldKind, type InputFieldSpec, type InputShape, type Money, type RecordScope } from '../input';
1
+ import "../console.js";
2
+ export { HostError, WorkflowFailure, fail, validationError } from "../errors.js";
3
+ export { InputField, InputSchema, v, type ContentDocument, type ContentNode, type ContentOptions, type FileVisibility, type Infer, type InferInput, type InputFieldKind, type InputFieldSpec, type InputShape, type Money, type RecordScope } from "../input.js";
@@ -1,3 +1,3 @@
1
- import '../console';
2
- export { HostError, WorkflowFailure, fail, validationError } from '../errors';
3
- export { InputField, InputSchema, v, type ContentDocument, type ContentNode, type ContentOptions, type FileVisibility, type Infer, type InferInput, type InputFieldKind, type InputFieldSpec, type InputShape, type Money, type RecordScope } from '../input';
1
+ import "../console.js";
2
+ export { HostError, WorkflowFailure, fail, validationError } from "../errors.js";
3
+ export { InputField, InputSchema, v, type ContentDocument, type ContentNode, type ContentOptions, type FileVisibility, type Infer, type InferInput, type InputFieldKind, type InputFieldSpec, type InputShape, type Money, type RecordScope } from "../input.js";
@@ -1,4 +1,4 @@
1
- import type { HostTransport } from './transport';
1
+ import type { HostTransport } from "./transport.js";
2
2
  export declare class SerialTransactionTransport implements HostTransport {
3
3
  private readonly transport;
4
4
  private pending;
@@ -1,5 +1,5 @@
1
- import { type HostTransport } from '../transport';
2
- import { type InputValidator, type WorkflowContext, type WorkflowDefinition } from '../workflow';
1
+ import { type HostTransport } from "../transport.js";
2
+ import { type InputValidator, type WorkflowContext, type WorkflowDefinition } from "../workflow.js";
3
3
  export declare class MockTransport implements HostTransport {
4
4
  private readonly handlers;
5
5
  readonly calls: Array<{
@@ -1,8 +1,10 @@
1
- import type { ScriptHostContext } from './index';
2
- import { type InferInput, type InputFieldSpec, type InputSchema, type InputShape } from './input';
1
+ import type { ResourceKeyWith } from "./data.js";
2
+ import type { ScriptHostContext } from "./index.js";
3
+ import { type InferInput, type InputFieldSpec, type InputSchema, type InputShape } from "./input.js";
3
4
  export interface Identity {
4
5
  id: string;
5
- resourceId: string;
6
+ /** The identity's resource has the Authenticatable capability. */
7
+ resourceId: ResourceKeyWith<'authenticatable'>;
6
8
  email: string | null;
7
9
  name: string | null;
8
10
  permissions: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/workflows",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "The authoring API of Diagonal managed workflows, their capabilities, and the workflow test helpers.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {