@notionhq/workers 0.5.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.
Files changed (182) hide show
  1. package/dist/alpha/ajv-formats.d.js +0 -0
  2. package/dist/alpha/builder.d.ts +149 -0
  3. package/dist/alpha/builder.d.ts.map +1 -0
  4. package/dist/alpha/builder.js +260 -0
  5. package/dist/alpha/builder.test.d.ts +2 -0
  6. package/dist/alpha/builder.test.d.ts.map +1 -0
  7. package/dist/alpha/cli/build.d.ts +13 -0
  8. package/dist/alpha/cli/build.d.ts.map +1 -0
  9. package/dist/alpha/cli/build.js +36 -0
  10. package/dist/alpha/cli/build.test.d.ts +2 -0
  11. package/dist/alpha/cli/build.test.d.ts.map +1 -0
  12. package/dist/alpha/cli/codegen.d.ts +10 -0
  13. package/dist/alpha/cli/codegen.d.ts.map +1 -0
  14. package/dist/alpha/cli/codegen.js +41 -0
  15. package/dist/alpha/cli/codegen.test.d.ts +2 -0
  16. package/dist/alpha/cli/codegen.test.d.ts.map +1 -0
  17. package/dist/alpha/cli/discover.d.ts +35 -0
  18. package/dist/alpha/cli/discover.d.ts.map +1 -0
  19. package/dist/alpha/cli/discover.js +39 -0
  20. package/dist/alpha/cli/discover.test.d.ts +2 -0
  21. package/dist/alpha/cli/discover.test.d.ts.map +1 -0
  22. package/dist/alpha/cli/emit-manifest.d.ts +33 -0
  23. package/dist/alpha/cli/emit-manifest.d.ts.map +1 -0
  24. package/dist/alpha/cli/emit-manifest.js +266 -0
  25. package/dist/alpha/cli/emit-manifest.test.d.ts +2 -0
  26. package/dist/alpha/cli/emit-manifest.test.d.ts.map +1 -0
  27. package/dist/alpha/cli/index.d.ts +3 -0
  28. package/dist/alpha/cli/index.d.ts.map +1 -0
  29. package/dist/alpha/cli/index.js +36 -0
  30. package/dist/alpha/context.d.ts +8 -0
  31. package/dist/alpha/context.d.ts.map +1 -0
  32. package/dist/alpha/context.js +33 -0
  33. package/dist/alpha/database.d.ts +90 -0
  34. package/dist/alpha/database.d.ts.map +1 -0
  35. package/dist/alpha/database.js +9 -0
  36. package/dist/alpha/error.d.ts +41 -0
  37. package/dist/alpha/error.d.ts.map +1 -0
  38. package/dist/alpha/error.js +25 -0
  39. package/dist/alpha/icon-names.d.ts +6 -0
  40. package/dist/alpha/icon-names.d.ts.map +1 -0
  41. package/dist/alpha/icon-names.js +0 -0
  42. package/dist/alpha/json-schema.d.ts +117 -0
  43. package/dist/alpha/json-schema.d.ts.map +1 -0
  44. package/dist/alpha/json-schema.js +0 -0
  45. package/dist/alpha/manifest.d.ts +44 -0
  46. package/dist/alpha/manifest.d.ts.map +1 -0
  47. package/dist/alpha/manifest.js +0 -0
  48. package/dist/alpha/output.d.ts +7 -0
  49. package/dist/alpha/output.d.ts.map +1 -0
  50. package/dist/alpha/output.js +8 -0
  51. package/dist/alpha/pacer.d.ts +74 -0
  52. package/dist/alpha/pacer.d.ts.map +1 -0
  53. package/dist/alpha/pacer.js +66 -0
  54. package/dist/alpha/pacer.test.d.ts +2 -0
  55. package/dist/alpha/pacer.test.d.ts.map +1 -0
  56. package/dist/alpha/schedule.d.ts +6 -0
  57. package/dist/alpha/schedule.d.ts.map +1 -0
  58. package/dist/alpha/schedule.js +43 -0
  59. package/dist/alpha/schedule.test.d.ts +2 -0
  60. package/dist/alpha/schedule.test.d.ts.map +1 -0
  61. package/dist/alpha/schema-builder.d.ts +79 -0
  62. package/dist/alpha/schema-builder.d.ts.map +1 -0
  63. package/dist/alpha/schema-builder.js +135 -0
  64. package/dist/alpha/schema.d.ts +185 -0
  65. package/dist/alpha/schema.d.ts.map +1 -0
  66. package/dist/alpha/schema.js +115 -0
  67. package/dist/alpha/sync.d.ts +233 -0
  68. package/dist/alpha/sync.d.ts.map +1 -0
  69. package/dist/alpha/sync.js +70 -0
  70. package/dist/alpha/sync.test.d.ts +2 -0
  71. package/dist/alpha/sync.test.d.ts.map +1 -0
  72. package/dist/alpha/tool.d.ts +132 -0
  73. package/dist/alpha/tool.d.ts.map +1 -0
  74. package/dist/alpha/tool.js +156 -0
  75. package/dist/alpha/tool.test.d.ts +2 -0
  76. package/dist/alpha/tool.test.d.ts.map +1 -0
  77. package/dist/alpha/triggers.d.ts +365 -0
  78. package/dist/alpha/triggers.d.ts.map +1 -0
  79. package/dist/alpha/triggers.generated.d.ts +246 -0
  80. package/dist/alpha/triggers.generated.d.ts.map +1 -0
  81. package/dist/alpha/triggers.generated.js +239 -0
  82. package/dist/alpha/triggers.js +0 -0
  83. package/dist/alpha/types.d.ts +228 -0
  84. package/dist/alpha/types.d.ts.map +1 -0
  85. package/dist/alpha/types.js +0 -0
  86. package/dist/alpha/workflow.d.ts +70 -0
  87. package/dist/alpha/workflow.d.ts.map +1 -0
  88. package/dist/alpha/workflow.js +39 -0
  89. package/dist/alpha/workflow.test.d.ts +2 -0
  90. package/dist/alpha/workflow.test.d.ts.map +1 -0
  91. package/dist/block.d.ts.map +1 -1
  92. package/dist/builder.d.ts.map +1 -1
  93. package/dist/builder.js +2 -6
  94. package/dist/capabilities/ai_connector.d.ts.map +1 -1
  95. package/dist/capabilities/automation.d.ts.map +1 -1
  96. package/dist/capabilities/context.d.ts.map +1 -1
  97. package/dist/capabilities/oauth.d.ts.map +1 -1
  98. package/dist/capabilities/output.d.ts.map +1 -1
  99. package/dist/capabilities/output.js +2 -4
  100. package/dist/capabilities/stateful-capability.d.ts.map +1 -1
  101. package/dist/capabilities/stateful-capability.js +2 -6
  102. package/dist/capabilities/sync.d.ts.map +1 -1
  103. package/dist/capabilities/sync.js +2 -8
  104. package/dist/capabilities/tool.d.ts.map +1 -1
  105. package/dist/capabilities/tool.js +6 -20
  106. package/dist/capabilities/webhook.d.ts.map +1 -1
  107. package/dist/capabilities/workflow.d.ts +2 -2
  108. package/dist/capabilities/workflow.d.ts.map +1 -1
  109. package/dist/index.d.ts +2 -2
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +1 -7
  112. package/dist/json-schema.d.ts.map +1 -1
  113. package/dist/schema-builder.d.ts.map +1 -1
  114. package/dist/schema.d.ts.map +1 -1
  115. package/dist/types.d.ts.map +1 -1
  116. package/dist/worker.d.ts.map +1 -1
  117. package/dist/worker.js +1 -4
  118. package/package.json +74 -14
  119. package/src/alpha/ajv-formats.d.ts +7 -0
  120. package/src/alpha/builder.test.ts +197 -0
  121. package/src/alpha/builder.ts +338 -0
  122. package/src/alpha/cli/build.test.ts +240 -0
  123. package/src/alpha/cli/build.ts +57 -0
  124. package/src/alpha/cli/codegen.test.ts +31 -0
  125. package/src/alpha/cli/codegen.ts +51 -0
  126. package/src/alpha/cli/discover.test.ts +43 -0
  127. package/src/alpha/cli/discover.ts +81 -0
  128. package/src/alpha/cli/emit-manifest.test.ts +45 -0
  129. package/src/alpha/cli/emit-manifest.ts +409 -0
  130. package/src/alpha/cli/index.ts +41 -0
  131. package/src/alpha/context.ts +61 -0
  132. package/src/alpha/database.ts +102 -0
  133. package/src/alpha/error.ts +49 -0
  134. package/src/alpha/icon-names.ts +890 -0
  135. package/src/alpha/json-schema.ts +180 -0
  136. package/src/alpha/manifest.ts +47 -0
  137. package/src/alpha/output.ts +8 -0
  138. package/src/alpha/pacer.test.ts +81 -0
  139. package/src/alpha/pacer.ts +181 -0
  140. package/src/alpha/schedule.test.ts +31 -0
  141. package/src/alpha/schedule.ts +53 -0
  142. package/src/alpha/schema-builder.ts +193 -0
  143. package/src/alpha/schema.ts +222 -0
  144. package/src/alpha/sync.test.ts +191 -0
  145. package/src/alpha/sync.ts +340 -0
  146. package/src/alpha/tool.test.ts +116 -0
  147. package/src/alpha/tool.ts +319 -0
  148. package/src/alpha/triggers.generated.ts +489 -0
  149. package/src/alpha/triggers.ts +500 -0
  150. package/src/alpha/types.ts +284 -0
  151. package/src/alpha/workflow.test.ts +84 -0
  152. package/src/alpha/workflow.ts +131 -0
  153. package/src/block.ts +1 -5
  154. package/src/builder.test.ts +28 -60
  155. package/src/builder.ts +3 -10
  156. package/src/capabilities/ai_connector.test.ts +9 -32
  157. package/src/capabilities/ai_connector.ts +5 -17
  158. package/src/capabilities/automation.test.ts +3 -12
  159. package/src/capabilities/automation.ts +3 -11
  160. package/src/capabilities/context.ts +3 -6
  161. package/src/capabilities/oauth.test.ts +1 -0
  162. package/src/capabilities/oauth.ts +1 -3
  163. package/src/capabilities/output.ts +1 -3
  164. package/src/capabilities/stateful-capability.test.ts +1 -0
  165. package/src/capabilities/stateful-capability.ts +2 -6
  166. package/src/capabilities/sync.test.ts +15 -45
  167. package/src/capabilities/sync.ts +10 -40
  168. package/src/capabilities/tool.test.ts +106 -146
  169. package/src/capabilities/tool.ts +17 -39
  170. package/src/capabilities/webhook.ts +3 -10
  171. package/src/capabilities/workflow.test.ts +10 -31
  172. package/src/capabilities/workflow.ts +5 -12
  173. package/src/index.ts +2 -12
  174. package/src/json-schema.test.ts +2 -4
  175. package/src/json-schema.ts +7 -6
  176. package/src/pacer.test.ts +1 -3
  177. package/src/pacer_internal.ts +1 -5
  178. package/src/schema-builder.test.ts +10 -35
  179. package/src/schema-builder.ts +5 -16
  180. package/src/schema.ts +2 -10
  181. package/src/types.ts +1 -7
  182. package/src/worker.ts +8 -34
@@ -45,16 +45,18 @@ interface ForbiddenCompositionKeywords {
45
45
 
46
46
  // ---- Individual schema definitions ----
47
47
 
48
- export interface JSONSchemaStringDef<T extends string = string>
49
- extends ForbiddenCompositionKeywords {
48
+ export interface JSONSchemaStringDef<
49
+ T extends string = string,
50
+ > extends ForbiddenCompositionKeywords {
50
51
  type: "string";
51
52
  description?: string;
52
53
  format?: JSONSchemaStringFormat;
53
54
  enum?: readonly T[];
54
55
  }
55
56
 
56
- export interface JSONSchemaNumberDef<T extends number = number>
57
- extends ForbiddenCompositionKeywords {
57
+ export interface JSONSchemaNumberDef<
58
+ T extends number = number,
59
+ > extends ForbiddenCompositionKeywords {
58
60
  type: "number" | "integer";
59
61
  description?: string;
60
62
  enum?: readonly T[];
@@ -70,8 +72,7 @@ export interface JSONSchemaNullDef extends ForbiddenCompositionKeywords {
70
72
  description?: string;
71
73
  }
72
74
 
73
- export interface JSONSchemaArrayDef<E = unknown>
74
- extends ForbiddenCompositionKeywords {
75
+ export interface JSONSchemaArrayDef<E = unknown> extends ForbiddenCompositionKeywords {
75
76
  type: "array";
76
77
  description?: string;
77
78
  items: JSONSchema<E>;
package/src/pacer.test.ts CHANGED
@@ -83,9 +83,7 @@ describe("pacerWait", () => {
83
83
  it("throws when pacer key not found in runtime context", async () => {
84
84
  setPacerState({ pacers: {} });
85
85
 
86
- await expect(pacerWait("unknown")).rejects.toThrow(
87
- 'Pacer "unknown" not found',
88
- );
86
+ await expect(pacerWait("unknown")).rejects.toThrow('Pacer "unknown" not found');
89
87
  });
90
88
 
91
89
  it("preserves allowedRequests and intervalMs across calls", async () => {
@@ -39,11 +39,7 @@ export function initPacerState(
39
39
  declarations?: readonly PacerDeclaration[],
40
40
  ): void {
41
41
  const pacers = runtimePacers ?? {};
42
- if (
43
- Object.keys(pacers).length === 0 &&
44
- declarations &&
45
- declarations.length > 0
46
- ) {
42
+ if (Object.keys(pacers).length === 0 && declarations && declarations.length > 0) {
47
43
  const localPacers: Record<string, PacerEntry> = {};
48
44
  for (const decl of declarations) {
49
45
  localPacers[decl.key] = {
@@ -1,11 +1,7 @@
1
1
  import { describe, expect, it } from "vitest";
2
+
2
3
  import type { JSONSchema } from "./json-schema.js";
3
- import {
4
- getSchema,
5
- type Infer,
6
- j,
7
- type SchemaBuilder,
8
- } from "./schema-builder.js";
4
+ import { getSchema, type Infer, j, type SchemaBuilder } from "./schema-builder.js";
9
5
 
10
6
  // ---------------------------------------------------------------------------
11
7
  // 1. Primitives
@@ -188,9 +184,7 @@ describe("json-schema-builder — array", () => {
188
184
  });
189
185
 
190
186
  it("array of objects", () => {
191
- const schema = getSchema(
192
- j.array(j.object({ name: j.string(), age: j.number() })),
193
- );
187
+ const schema = getSchema(j.array(j.object({ name: j.string(), age: j.number() })));
194
188
  expect(schema).toEqual({
195
189
  type: "array",
196
190
  items: {
@@ -351,9 +345,7 @@ describe("json-schema-builder — anyOf", () => {
351
345
  });
352
346
 
353
347
  it("anyOf with description", () => {
354
- expect(
355
- getSchema(j.anyOf(j.string(), j.number()).describe("string or number")),
356
- ).toEqual({
348
+ expect(getSchema(j.anyOf(j.string(), j.number()).describe("string or number"))).toEqual({
357
349
  anyOf: [{ type: "string" }, { type: "number" }],
358
350
  description: "string or number",
359
351
  });
@@ -463,12 +455,8 @@ describe("json-schema-builder — discriminated unions", () => {
463
455
 
464
456
  it("discriminated union with descriptions on individual variants", () => {
465
457
  const schema = j.anyOf(
466
- j
467
- .object({ type: j.enum("text"), value: j.string() })
468
- .describe("A text node"),
469
- j
470
- .object({ type: j.enum("image"), url: j.string() })
471
- .describe("An image node"),
458
+ j.object({ type: j.enum("text"), value: j.string() }).describe("A text node"),
459
+ j.object({ type: j.enum("image"), url: j.string() }).describe("An image node"),
472
460
  );
473
461
 
474
462
  const raw = getSchema(schema) as unknown as {
@@ -497,9 +485,7 @@ describe("json-schema-builder — discriminated unions", () => {
497
485
  expect(raw.properties.content.anyOf).toHaveLength(2);
498
486
 
499
487
  // The content field is in required
500
- expect(
501
- (getSchema(schema) as unknown as Record<string, unknown>).required,
502
- ).toContain("content");
488
+ expect((getSchema(schema) as unknown as Record<string, unknown>).required).toContain("content");
503
489
  });
504
490
 
505
491
  it("nullable discriminated union", () => {
@@ -614,15 +600,7 @@ describe("json-schema-builder — integration", () => {
614
600
  },
615
601
  createdAt: { type: "string", format: "date-time" },
616
602
  },
617
- required: [
618
- "foo",
619
- "bar",
620
- "count",
621
- "tags",
622
- "address",
623
- "nickname",
624
- "createdAt",
625
- ],
603
+ required: ["foo", "bar", "count", "tags", "address", "nickname", "createdAt"],
626
604
  additionalProperties: false,
627
605
  });
628
606
  });
@@ -634,9 +612,7 @@ describe("json-schema-builder — integration", () => {
634
612
 
635
613
  describe("json-schema-builder — constraint enforcement", () => {
636
614
  it("object always has required matching properties keys", () => {
637
- const schema = getSchema(
638
- j.object({ x: j.number(), y: j.string(), z: j.boolean() }),
639
- );
615
+ const schema = getSchema(j.object({ x: j.number(), y: j.string(), z: j.boolean() }));
640
616
  const raw = schema as unknown as Record<string, unknown>;
641
617
  expect(raw.required).toEqual(["x", "y", "z"]);
642
618
  expect(raw.additionalProperties).toBe(false);
@@ -669,8 +645,7 @@ describe("json-schema-builder — constraint enforcement", () => {
669
645
  }),
670
646
  );
671
647
  const raw = schema as unknown as Record<string, unknown>;
672
- const outer = (raw as { properties: { outer: Record<string, unknown> } })
673
- .properties.outer;
648
+ const outer = (raw as { properties: { outer: Record<string, unknown> } }).properties.outer;
674
649
  expect(outer.required).toEqual(["inner"]);
675
650
  expect(outer.additionalProperties).toBe(false);
676
651
  });
@@ -47,12 +47,8 @@ function makeBuilder<T>(schema: AnyJSONSchema): SchemaBuilder<T> {
47
47
  return makeBuilder<T>({ ...schema, description: text });
48
48
  },
49
49
  nullable() {
50
- const { description: desc, ...rest } = schema as unknown as Record<
51
- string,
52
- unknown
53
- >;
54
- const inner =
55
- desc !== undefined ? (rest as unknown as AnyJSONSchema) : schema;
50
+ const { description: desc, ...rest } = schema as unknown as Record<string, unknown>;
51
+ const inner = desc !== undefined ? (rest as unknown as AnyJSONSchema) : schema;
56
52
  const wrapper: Record<string, unknown> = {
57
53
  anyOf: [inner, { type: "null" }],
58
54
  };
@@ -82,15 +78,9 @@ export function boolean(): SchemaBuilder<boolean> {
82
78
 
83
79
  // ---- Enum ----
84
80
 
85
- function enumBuilder<T extends string>(
86
- ...values: readonly T[]
87
- ): SchemaBuilder<T>;
88
- function enumBuilder<T extends number>(
89
- ...values: readonly T[]
90
- ): SchemaBuilder<T>;
91
- function enumBuilder(
92
- ...values: readonly (string | number)[]
93
- ): SchemaBuilder<unknown> {
81
+ function enumBuilder<T extends string>(...values: readonly T[]): SchemaBuilder<T>;
82
+ function enumBuilder<T extends number>(...values: readonly T[]): SchemaBuilder<T>;
83
+ function enumBuilder(...values: readonly (string | number)[]): SchemaBuilder<unknown> {
94
84
  const type = typeof values[0] === "string" ? "string" : "number";
95
85
  return makeBuilder({ type, enum: values } as AnyJSONSchema);
96
86
  }
@@ -155,7 +145,6 @@ export function object<P extends Record<string, SchemaBuilder<unknown>>>(
155
145
  const schemaProps: Record<string, AnyJSONSchema> = {};
156
146
  const keys = Object.keys(properties);
157
147
  for (const key of keys) {
158
- // biome-ignore lint/style/noNonNullAssertion: key comes from Object.keys(properties)
159
148
  schemaProps[key] = getSchema(properties[key]!);
160
149
  }
161
150
  return makeBuilder({
package/src/schema.ts CHANGED
@@ -1,10 +1,4 @@
1
- import type {
2
- DateFormat,
3
- Icon,
4
- NumberFormat,
5
- SelectOption,
6
- StatusGroup,
7
- } from "./types.js";
1
+ import type { DateFormat, Icon, NumberFormat, SelectOption, StatusGroup } from "./types.js";
8
2
 
9
3
  /**
10
4
  * Supported property types for sync schemas.
@@ -182,9 +176,7 @@ export function multiSelect(options: SelectOption[]): PropertyConfiguration {
182
176
  /**
183
177
  * Creates a status property definition with groups.
184
178
  */
185
- export function status(config: {
186
- groups: StatusGroup[];
187
- }): PropertyConfiguration {
179
+ export function status(config: { groups: StatusGroup[] }): PropertyConfiguration {
188
180
  return { type: "status", groups: config.groups };
189
181
  }
190
182
 
package/src/types.ts CHANGED
@@ -118,13 +118,7 @@ export type NumberFormat =
118
118
  /**
119
119
  * Date format types
120
120
  */
121
- export type DateFormat =
122
- | "relative"
123
- | "MM/DD/YYYY"
124
- | "DD/MM/YYYY"
125
- | "YYYY/MM/DD"
126
- | "ll"
127
- | "MMM d";
121
+ export type DateFormat = "relative" | "MM/DD/YYYY" | "DD/MM/YYYY" | "YYYY/MM/DD" | "ll" | "MMM d";
128
122
 
129
123
  import type { NoticonName } from "./icon-names.js";
130
124
 
package/src/worker.ts CHANGED
@@ -27,10 +27,7 @@ import type {
27
27
  WebhookConfiguration,
28
28
  WebhookEvent,
29
29
  } from "./capabilities/webhook.js";
30
- import {
31
- createWebhookCapability,
32
- WebhookVerificationError,
33
- } from "./capabilities/webhook.js";
30
+ import { createWebhookCapability, WebhookVerificationError } from "./capabilities/webhook.js";
34
31
  import type {
35
32
  WorkflowCapability,
36
33
  WorkflowConfiguration,
@@ -68,7 +65,6 @@ export { WebhookVerificationError };
68
65
  type Capability =
69
66
  | SyncCapability
70
67
  | AiConnectorCapability
71
- // biome-ignore lint/suspicious/noExplicitAny: tool capabilities are generic over arbitrary input/output payloads.
72
68
  | ToolCapability<any, any>
73
69
  | AutomationCapability
74
70
  | WorkflowCapability
@@ -92,19 +88,13 @@ export type CapabilityType = Capability["_tag"];
92
88
  // incoming context matches the capability's declared input.
93
89
 
94
90
  /** A tool capability as stored: its input/output types are erased. */
95
- type StoredToolCapability = Omit<
96
- Extract<Capability, { _tag: "tool" }>,
97
- "handler"
98
- > & {
91
+ type StoredToolCapability = Omit<Extract<Capability, { _tag: "tool" }>, "handler"> & {
99
92
  handler: (input: never, options?: HandlerOptions) => Promise<unknown>;
100
93
  };
101
94
 
102
95
  /** A workflow capability as stored: its event type is erased. */
103
96
  type StoredWorkflowCapability = Omit<WorkflowCapability, "handler"> & {
104
- handler: (
105
- event: never,
106
- options?: HandlerOptions,
107
- ) => Promise<{ status: "success" } | undefined>;
97
+ handler: (event: never, options?: HandlerOptions) => Promise<{ status: "success" } | undefined>;
108
98
  };
109
99
 
110
100
  /** How `Worker` stores registered capabilities internally. */
@@ -148,10 +138,7 @@ export type ManagedDatabaseConfig<PK extends string, S extends Schema<PK>> = {
148
138
  * Configuration union for all database types.
149
139
  * Currently only `"managed"` is supported.
150
140
  */
151
- export type DatabaseConfig<
152
- PK extends string,
153
- S extends Schema<PK>,
154
- > = ManagedDatabaseConfig<PK, S>;
141
+ export type DatabaseConfig<PK extends string, S extends Schema<PK>> = ManagedDatabaseConfig<PK, S>;
155
142
 
156
143
  /**
157
144
  * An opaque handle returned by `worker.database()`. Pass this to
@@ -495,10 +482,7 @@ export class Worker {
495
482
  * @param config - The automation configuration.
496
483
  * @returns The capability object.
497
484
  */
498
- automation(
499
- key: string,
500
- config: AutomationConfiguration,
501
- ): AutomationCapability {
485
+ automation(key: string, config: AutomationConfiguration): AutomationCapability {
502
486
  this.#validateUniqueKey(key);
503
487
  const capability = createAutomationCapability(key, config);
504
488
  this.#capabilities.set(key, capability);
@@ -532,9 +516,7 @@ export class Worker {
532
516
  * @param config - The workflow configuration.
533
517
  * @returns The capability object.
534
518
  */
535
- workflow<
536
- const TTriggers extends readonly [WorkflowTrigger, ...WorkflowTrigger[]],
537
- >(
519
+ workflow<const TTriggers extends readonly [WorkflowTrigger, ...WorkflowTrigger[]]>(
538
520
  key: string,
539
521
  config: WorkflowConfiguration<TTriggers>,
540
522
  ): WorkflowCapability<TTriggers> {
@@ -655,11 +637,7 @@ export class Worker {
655
637
  * @param options - Additional options for execution (e.g. for testing).
656
638
  * @returns The result of the capability execution.
657
639
  */
658
- async run(
659
- key: string,
660
- context: unknown,
661
- options: HandlerOptions = {},
662
- ): Promise<unknown> {
640
+ async run(key: string, context: unknown, options: HandlerOptions = {}): Promise<unknown> {
663
641
  const capability = this.#capabilities.get(key);
664
642
 
665
643
  if (!capability) {
@@ -687,11 +665,7 @@ export class Worker {
687
665
  if (!key || typeof key !== "string") {
688
666
  throw new Error("Capability key must be a non-empty string");
689
667
  }
690
- if (
691
- this.#capabilities.has(key) ||
692
- this.#databases.has(key) ||
693
- this.#pacers.has(key)
694
- ) {
668
+ if (this.#capabilities.has(key) || this.#databases.has(key) || this.#pacers.has(key)) {
695
669
  throw new Error(`Worker item with key "${key}" already registered`);
696
670
  }
697
671
  }