@skedulo/integration-sdk 0.3.4 → 0.5.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 (225) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +84 -20
  3. package/dist/actions/action-registry.d.ts.map +1 -1
  4. package/dist/actions/action-registry.js +27 -23
  5. package/dist/actions/action-registry.js.map +1 -1
  6. package/dist/actions/data-flow/activate.action.d.ts +10 -0
  7. package/dist/actions/data-flow/activate.action.d.ts.map +1 -0
  8. package/dist/actions/data-flow/activate.action.js +22 -0
  9. package/dist/actions/data-flow/activate.action.js.map +1 -0
  10. package/dist/actions/data-flow/create.action.d.ts +9 -0
  11. package/dist/actions/data-flow/create.action.d.ts.map +1 -0
  12. package/dist/actions/data-flow/create.action.js +55 -0
  13. package/dist/actions/data-flow/create.action.js.map +1 -0
  14. package/dist/actions/data-flow/deactivate.action.d.ts +9 -0
  15. package/dist/actions/data-flow/deactivate.action.d.ts.map +1 -0
  16. package/dist/actions/data-flow/deactivate.action.js +21 -0
  17. package/dist/actions/data-flow/deactivate.action.js.map +1 -0
  18. package/dist/actions/data-flow/delete.action.d.ts +10 -0
  19. package/dist/actions/data-flow/delete.action.d.ts.map +1 -0
  20. package/dist/actions/data-flow/delete.action.js +33 -0
  21. package/dist/actions/data-flow/delete.action.js.map +1 -0
  22. package/dist/actions/data-flow/get.action.d.ts +5 -0
  23. package/dist/actions/data-flow/get.action.d.ts.map +1 -0
  24. package/dist/actions/data-flow/get.action.js +22 -0
  25. package/dist/actions/data-flow/get.action.js.map +1 -0
  26. package/dist/actions/data-flow/index.d.ts +9 -0
  27. package/dist/actions/data-flow/index.d.ts.map +1 -0
  28. package/dist/actions/data-flow/index.js +33 -0
  29. package/dist/actions/data-flow/index.js.map +1 -0
  30. package/dist/actions/data-flow/list.action.d.ts +6 -0
  31. package/dist/actions/data-flow/list.action.d.ts.map +1 -0
  32. package/dist/actions/data-flow/list.action.js +25 -0
  33. package/dist/actions/data-flow/list.action.js.map +1 -0
  34. package/dist/actions/data-flow/shared.d.ts +3 -0
  35. package/dist/actions/data-flow/shared.d.ts.map +1 -0
  36. package/dist/actions/data-flow/shared.js +16 -0
  37. package/dist/actions/data-flow/shared.js.map +1 -0
  38. package/dist/actions/data-flow/types.d.ts +21 -0
  39. package/dist/actions/data-flow/types.d.ts.map +1 -0
  40. package/dist/actions/data-flow/types.js +3 -0
  41. package/dist/actions/data-flow/types.js.map +1 -0
  42. package/dist/actions/data-flow/update.action.d.ts +16 -0
  43. package/dist/actions/data-flow/update.action.d.ts.map +1 -0
  44. package/dist/actions/data-flow/update.action.js +62 -0
  45. package/dist/actions/data-flow/update.action.js.map +1 -0
  46. package/dist/actions/data-flow.action.d.ts.map +1 -1
  47. package/dist/actions/data-flow.action.js +5 -9
  48. package/dist/actions/data-flow.action.js.map +1 -1
  49. package/dist/actions/event/index.d.ts +4 -0
  50. package/dist/actions/event/index.d.ts.map +1 -0
  51. package/dist/actions/event/index.js +23 -0
  52. package/dist/actions/event/index.js.map +1 -0
  53. package/dist/actions/event/on-skedulo.action.d.ts +4 -0
  54. package/dist/actions/event/on-skedulo.action.d.ts.map +1 -0
  55. package/dist/actions/event/on-skedulo.action.js +81 -0
  56. package/dist/actions/event/on-skedulo.action.js.map +1 -0
  57. package/dist/actions/event/on-vendor.action.d.ts +4 -0
  58. package/dist/actions/event/on-vendor.action.d.ts.map +1 -0
  59. package/dist/actions/event/on-vendor.action.js +43 -0
  60. package/dist/actions/event/on-vendor.action.js.map +1 -0
  61. package/dist/actions/event/types.d.ts +28 -0
  62. package/dist/actions/event/types.d.ts.map +1 -0
  63. package/dist/actions/event/types.js +3 -0
  64. package/dist/actions/event/types.js.map +1 -0
  65. package/dist/actions/metadata/get-fields.action.d.ts +5 -0
  66. package/dist/actions/metadata/get-fields.action.d.ts.map +1 -0
  67. package/dist/actions/metadata/get-fields.action.js +26 -0
  68. package/dist/actions/metadata/get-fields.action.js.map +1 -0
  69. package/dist/actions/metadata/get-objects.action.d.ts +5 -0
  70. package/dist/actions/metadata/get-objects.action.d.ts.map +1 -0
  71. package/dist/actions/metadata/get-objects.action.js +18 -0
  72. package/dist/actions/metadata/get-objects.action.js.map +1 -0
  73. package/dist/actions/metadata/get-sample-apis.action.d.ts +5 -0
  74. package/dist/actions/metadata/get-sample-apis.action.d.ts.map +1 -0
  75. package/dist/actions/metadata/get-sample-apis.action.js +19 -0
  76. package/dist/actions/metadata/get-sample-apis.action.js.map +1 -0
  77. package/dist/actions/metadata/get-sample-records.action.d.ts +5 -0
  78. package/dist/actions/metadata/get-sample-records.action.d.ts.map +1 -0
  79. package/dist/actions/metadata/get-sample-records.action.js +33 -0
  80. package/dist/actions/metadata/get-sample-records.action.js.map +1 -0
  81. package/dist/actions/metadata/get-templates.action.d.ts +5 -0
  82. package/dist/actions/metadata/get-templates.action.d.ts.map +1 -0
  83. package/dist/actions/metadata/get-templates.action.js +19 -0
  84. package/dist/actions/metadata/get-templates.action.js.map +1 -0
  85. package/dist/actions/metadata/index.d.ts +7 -0
  86. package/dist/actions/metadata/index.d.ts.map +1 -0
  87. package/dist/actions/metadata/index.js +29 -0
  88. package/dist/actions/metadata/index.js.map +1 -0
  89. package/dist/actions/metadata/shared.d.ts +6 -0
  90. package/dist/actions/metadata/shared.d.ts.map +1 -0
  91. package/dist/actions/metadata/shared.js +11 -0
  92. package/dist/actions/metadata/shared.js.map +1 -0
  93. package/dist/actions/metadata/types.d.ts +38 -0
  94. package/dist/actions/metadata/types.d.ts.map +1 -0
  95. package/dist/actions/metadata/types.js +3 -0
  96. package/dist/actions/metadata/types.js.map +1 -0
  97. package/dist/actions/scheduled-job/create.action.d.ts +5 -0
  98. package/dist/actions/scheduled-job/create.action.d.ts.map +1 -0
  99. package/dist/actions/scheduled-job/create.action.js +56 -0
  100. package/dist/actions/scheduled-job/create.action.js.map +1 -0
  101. package/dist/actions/scheduled-job/delete.action.d.ts +15 -0
  102. package/dist/actions/scheduled-job/delete.action.d.ts.map +1 -0
  103. package/dist/actions/scheduled-job/delete.action.js +42 -0
  104. package/dist/actions/scheduled-job/delete.action.js.map +1 -0
  105. package/dist/actions/scheduled-job/get.action.d.ts +7 -0
  106. package/dist/actions/scheduled-job/get.action.d.ts.map +1 -0
  107. package/dist/actions/scheduled-job/get.action.js +23 -0
  108. package/dist/actions/scheduled-job/get.action.js.map +1 -0
  109. package/dist/actions/scheduled-job/index.d.ts +7 -0
  110. package/dist/actions/scheduled-job/index.d.ts.map +1 -0
  111. package/dist/actions/scheduled-job/index.js +29 -0
  112. package/dist/actions/scheduled-job/index.js.map +1 -0
  113. package/dist/actions/scheduled-job/list.action.d.ts +5 -0
  114. package/dist/actions/scheduled-job/list.action.d.ts.map +1 -0
  115. package/dist/actions/scheduled-job/list.action.js +18 -0
  116. package/dist/actions/scheduled-job/list.action.js.map +1 -0
  117. package/dist/actions/scheduled-job/shared.d.ts +30 -0
  118. package/dist/actions/scheduled-job/shared.d.ts.map +1 -0
  119. package/dist/actions/scheduled-job/shared.js +129 -0
  120. package/dist/actions/scheduled-job/shared.js.map +1 -0
  121. package/dist/actions/scheduled-job/types.d.ts +23 -0
  122. package/dist/actions/scheduled-job/types.d.ts.map +1 -0
  123. package/dist/actions/scheduled-job/types.js +3 -0
  124. package/dist/actions/scheduled-job/types.js.map +1 -0
  125. package/dist/actions/scheduled-job/update.action.d.ts +5 -0
  126. package/dist/actions/scheduled-job/update.action.d.ts.map +1 -0
  127. package/dist/actions/scheduled-job/update.action.js +68 -0
  128. package/dist/actions/scheduled-job/update.action.js.map +1 -0
  129. package/dist/actions/scheduled-job.action.d.ts +73 -0
  130. package/dist/actions/scheduled-job.action.d.ts.map +1 -0
  131. package/dist/actions/scheduled-job.action.js +355 -0
  132. package/dist/actions/scheduled-job.action.js.map +1 -0
  133. package/dist/actions/setup.action.js +1 -1
  134. package/dist/actions/setup.action.js.map +1 -1
  135. package/dist/actions/sync/index.d.ts +4 -0
  136. package/dist/actions/sync/index.d.ts.map +1 -0
  137. package/dist/actions/sync/index.js +23 -0
  138. package/dist/actions/sync/index.js.map +1 -0
  139. package/dist/actions/sync/run-flow.action.d.ts +8 -0
  140. package/dist/actions/sync/run-flow.action.d.ts.map +1 -0
  141. package/dist/actions/sync/run-flow.action.js +81 -0
  142. package/dist/actions/sync/run-flow.action.js.map +1 -0
  143. package/dist/actions/sync/run-job.action.d.ts +11 -0
  144. package/dist/actions/sync/run-job.action.d.ts.map +1 -0
  145. package/dist/actions/sync/run-job.action.js +75 -0
  146. package/dist/actions/sync/run-job.action.js.map +1 -0
  147. package/dist/actions/sync/types.d.ts +41 -0
  148. package/dist/actions/sync/types.d.ts.map +1 -0
  149. package/dist/actions/sync/types.js +3 -0
  150. package/dist/actions/sync/types.js.map +1 -0
  151. package/dist/actions/sync.action.d.ts +8 -47
  152. package/dist/actions/sync.action.d.ts.map +1 -1
  153. package/dist/actions/sync.action.js +29 -162
  154. package/dist/actions/sync.action.js.map +1 -1
  155. package/dist/actions/utils/action-names.d.ts +19 -6
  156. package/dist/actions/utils/action-names.d.ts.map +1 -1
  157. package/dist/actions/utils/action-names.js +19 -6
  158. package/dist/actions/utils/action-names.js.map +1 -1
  159. package/dist/actions/utils/define-action.d.ts +36 -0
  160. package/dist/actions/utils/define-action.d.ts.map +1 -0
  161. package/dist/actions/utils/define-action.js +43 -0
  162. package/dist/actions/utils/define-action.js.map +1 -0
  163. package/dist/actions/utils/errors.d.ts +54 -8
  164. package/dist/actions/utils/errors.d.ts.map +1 -1
  165. package/dist/actions/utils/errors.js +107 -14
  166. package/dist/actions/utils/errors.js.map +1 -1
  167. package/dist/actions/utils/helpers.d.ts.map +1 -1
  168. package/dist/actions/utils/helpers.js +2 -1
  169. package/dist/actions/utils/helpers.js.map +1 -1
  170. package/dist/actions/utils/metrics.d.ts +12 -0
  171. package/dist/actions/utils/metrics.d.ts.map +1 -0
  172. package/dist/actions/utils/metrics.js +12 -0
  173. package/dist/actions/utils/metrics.js.map +1 -0
  174. package/dist/actions/utils/middleware.d.ts +39 -0
  175. package/dist/actions/utils/middleware.d.ts.map +1 -0
  176. package/dist/actions/utils/middleware.js +85 -0
  177. package/dist/actions/utils/middleware.js.map +1 -0
  178. package/dist/actions/utils/types.d.ts +5 -4
  179. package/dist/actions/utils/types.d.ts.map +1 -1
  180. package/dist/adapters/base-adapter-handler.d.ts +10 -0
  181. package/dist/adapters/base-adapter-handler.d.ts.map +1 -1
  182. package/dist/adapters/base-adapter-handler.js +18 -34
  183. package/dist/adapters/base-adapter-handler.js.map +1 -1
  184. package/dist/browser.d.ts +2 -0
  185. package/dist/browser.d.ts.map +1 -1
  186. package/dist/browser.js +3 -1
  187. package/dist/browser.js.map +1 -1
  188. package/dist/clients/integration-config.client.d.ts +21 -0
  189. package/dist/clients/integration-config.client.d.ts.map +1 -0
  190. package/dist/clients/integration-config.client.js +44 -0
  191. package/dist/clients/integration-config.client.js.map +1 -0
  192. package/dist/context.d.ts +18 -3
  193. package/dist/context.d.ts.map +1 -1
  194. package/dist/context.js +21 -5
  195. package/dist/context.js.map +1 -1
  196. package/dist/index.d.ts +11 -0
  197. package/dist/index.d.ts.map +1 -1
  198. package/dist/index.js +30 -1
  199. package/dist/index.js.map +1 -1
  200. package/dist/interfaces/data-flow-spec.interface.d.ts +14 -21
  201. package/dist/interfaces/data-flow-spec.interface.d.ts.map +1 -1
  202. package/dist/interfaces/data-flow-spec.interface.js +10 -26
  203. package/dist/interfaces/data-flow-spec.interface.js.map +1 -1
  204. package/dist/interfaces/integration-capabilities.interface.d.ts +2 -2
  205. package/dist/interfaces/scheduled-job.interface.d.ts +40 -0
  206. package/dist/interfaces/scheduled-job.interface.d.ts.map +1 -0
  207. package/dist/interfaces/scheduled-job.interface.js +39 -0
  208. package/dist/interfaces/scheduled-job.interface.js.map +1 -0
  209. package/dist/services/dataflow.service.d.ts +13 -6
  210. package/dist/services/dataflow.service.d.ts.map +1 -1
  211. package/dist/services/dataflow.service.js +34 -57
  212. package/dist/services/dataflow.service.js.map +1 -1
  213. package/dist/services/sync-runner.d.ts +1 -0
  214. package/dist/services/sync-runner.d.ts.map +1 -1
  215. package/dist/services/sync-runner.js +7 -27
  216. package/dist/services/sync-runner.js.map +1 -1
  217. package/dist/types.d.ts +2 -0
  218. package/dist/types.d.ts.map +1 -1
  219. package/dist/types.js +4 -1
  220. package/dist/types.js.map +1 -1
  221. package/dist/utils/artifact-builder.d.ts +40 -15
  222. package/dist/utils/artifact-builder.d.ts.map +1 -1
  223. package/dist/utils/artifact-builder.js +92 -17
  224. package/dist/utils/artifact-builder.js.map +1 -1
  225. package/package.json +1 -1
@@ -0,0 +1,41 @@
1
+ import type { Adapter } from '../../interfaces/adapter.interface';
2
+ import type { AdapterRegistry } from '../../adapters/adapter-registry';
3
+ import type { BatchResult } from '../../interfaces/sync-result.interface';
4
+ export type SyncDeps = {
5
+ adapter: Adapter;
6
+ registry: AdapterRegistry;
7
+ };
8
+ export interface RunFlowInput {
9
+ flowId: number;
10
+ /** Manual backfill: sync from this time, overriding the persisted cursor. */
11
+ since?: Date;
12
+ /** Manual full resync: ignore the persisted cursor and pull everything. */
13
+ fullResync?: boolean;
14
+ }
15
+ export type RunFlowOutput = {
16
+ runId: string;
17
+ flowId: number;
18
+ } & BatchResult;
19
+ export interface RunJobInput {
20
+ webhookName: string;
21
+ }
22
+ type PerFlowResultBase = {
23
+ flowId: number;
24
+ sourceObject?: string;
25
+ targetObject?: string;
26
+ };
27
+ export type PerFlowResult = PerFlowResultBase & ({
28
+ skipped: true;
29
+ reason: string;
30
+ } | {
31
+ error: string;
32
+ } | (BatchResult & {
33
+ durationMs: number;
34
+ }));
35
+ export interface RunJobOutput {
36
+ webhookName: string;
37
+ skipped?: boolean;
38
+ results: PerFlowResult[];
39
+ }
40
+ export {};
41
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/actions/sync/types.ts"],"names":[],"mappings":"AAAA,OAAO,K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"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/actions/sync/types.ts"],"names":[],"mappings":""}
@@ -6,60 +6,21 @@ type SyncDeps = {
6
6
  adapter: Adapter;
7
7
  registry: AdapterRegistry;
8
8
  };
9
- export interface PushInput {
10
- dataFlowId: number;
11
- }
12
- export type PushOutput = (BatchResult & {
13
- durationMs: number;
14
- flowId: number;
15
- }) | {
16
- flowId: number;
17
- error: string;
18
- };
19
- /**
20
- * Run a single outbound scheduled (push) data flow. One ElasticServer-triggered
21
- * artifact per flow invokes this action with its own `dataFlowId`.
22
- */
23
- export declare function makePushAction(deps: SyncDeps): Action<PushInput, PushOutput>;
24
- export interface ScheduledPullInput {
25
- dataFlowId: number;
26
- }
27
- export type ScheduledPullOutput = (BatchResult & {
28
- durationMs: number;
29
- flowId: number;
30
- }) | {
31
- flowId: number;
32
- error: string;
33
- };
34
- /**
35
- * Run a single inbound scheduled (pull) data flow. One ElasticServer-triggered
36
- * artifact per flow invokes this action with its own `dataFlowId`.
37
- */
38
- export declare function makeScheduledPullAction(deps: SyncDeps): Action<ScheduledPullInput, ScheduledPullOutput>;
39
9
  export interface RunFlowInput {
40
10
  flowId: number;
11
+ /** Manual backfill: sync from this time, overriding the persisted cursor. */
12
+ since?: Date;
13
+ /** Manual full resync: ignore the persisted cursor and pull everything. */
14
+ fullResync?: boolean;
41
15
  }
42
16
  export type RunFlowOutput = {
43
17
  runId: string;
44
18
  flowId: number;
45
19
  } & BatchResult;
20
+ /**
21
+ * Manually run a single flow. Admin-only. Supports a one-off backfill (`since`)
22
+ * or full resync (`fullResync`) that overrides the persisted cursor.
23
+ */
46
24
  export declare function makeRunFlowAction(deps: SyncDeps): Action<RunFlowInput, RunFlowOutput>;
47
- export type RunAllFlowsInput = void;
48
- type RunAllFlowsEntryBase = {
49
- flowId: number;
50
- sourceObject: string;
51
- targetObject: string;
52
- };
53
- export type RunAllFlowsEntry = RunAllFlowsEntryBase & ({
54
- skipped: true;
55
- reason: string;
56
- } | {
57
- error: string;
58
- } | BatchResult);
59
- export interface RunAllFlowsOutput {
60
- message: string;
61
- results: Record<string, RunAllFlowsEntry>;
62
- }
63
- export declare function makeRunAllFlowsAction(deps: SyncDeps): Action<RunAllFlowsInput, RunAllFlowsOutput>;
64
25
  export {};
65
26
  //# sourceMappingURL=sync.action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sync.action.d.ts","sourceRoot":"","sources":["../../src/actions/sync.action.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAQvE,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,eAAe,CAAC;AAEvD,KAAK,QAAQ,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAAE,CAAC;AA2BhE,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,MAAM,UAAU,GAClB,CAAC,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,GACtD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,CA8C5E;AAID,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,MAAM,mBAAmB,GAC3B,CAAC,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,GACtD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAA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CAAqC,CAAC;AAOvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,KAAK,QAAQ,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAAE,CAAC;AAahE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,2EAA2E;IAC3E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AACD,MAAM,MAAM,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAAC;AAa5E;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC,YAAY,EAAE,aAAa,CAAC,CAoDrF"}
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makePushAction = makePushAction;
4
- exports.makeScheduledPullAction = makeScheduledPullAction;
5
3
  exports.makeRunFlowAction = makeRunFlowAction;
6
- exports.makeRunAllFlowsAction = makeRunAllFlowsAction;
7
4
  const crypto_1 = require("crypto");
8
5
  const constants_1 = require("../constants");
9
- const data_flow_spec_interface_1 = require("../interfaces/data-flow-spec.interface");
10
6
  const sync_runner_1 = require("../services/sync-runner");
11
7
  const helpers_1 = require("../utils/helpers");
12
8
  const action_names_1 = require("./utils/action-names");
@@ -20,112 +16,34 @@ function parsePositiveInt(raw, field) {
20
16
  }
21
17
  return v;
22
18
  }
23
- /**
24
- * Per-flow actions get the flow id from the `sked-data-flow-id` header (lifted
25
- * into `meta`), falling back to the body for direct callers.
26
- */
27
- function parseDataFlowId(raw, meta) {
28
- if ((meta === null || meta === void 0 ? void 0 : meta.dataFlowId) !== undefined) {
29
- if (!Number.isInteger(meta.dataFlowId) || meta.dataFlowId <= 0) {
30
- throw new errors_1.InvalidInputError('dataFlowId must be a positive integer');
31
- }
32
- return meta.dataFlowId;
19
+ function parseSinceDate(value) {
20
+ if (typeof value !== 'string') {
21
+ throw new errors_1.InvalidInputError('since must be an ISO date-time string');
33
22
  }
34
- return parsePositiveInt(raw, 'dataFlowId');
35
- }
36
- /**
37
- * Run a single outbound scheduled (push) data flow. One ElasticServer-triggered
38
- * artifact per flow invokes this action with its own `dataFlowId`.
39
- */
40
- function makePushAction(deps) {
41
- return {
42
- name: action_names_1.ACTIONS.sync.push,
43
- parseInput(raw, meta) {
44
- return { dataFlowId: parseDataFlowId(raw, meta) };
45
- },
46
- async handler(input, ctx) {
47
- const integrationType = deps.adapter.integrationType;
48
- const lookupStrategy = (0, helpers_2.resolveLookupStrategy)(deps.adapter);
49
- const flow = await ctx.dataFlowService.getFlowById(input.dataFlowId);
50
- if (!flow) {
51
- throw new errors_1.ActionError('FLOW_NOT_FOUND', `Flow ${input.dataFlowId} not found`);
52
- }
53
- const sc = (0, data_flow_spec_interface_1.asSyncConfig)(flow.triggerConfig);
54
- if (!sc || sc.strategy !== data_flow_spec_interface_1.SyncStrategy.SCHEDULED) {
55
- throw new errors_1.ActionError('UNSUPPORTED_STRATEGY', 'push action requires strategy=scheduled');
56
- }
57
- const runner = new sync_runner_1.SyncRunner(deps.registry);
58
- const startedAt = Date.now();
59
- try {
60
- const stats = await runner.run({
61
- flowId: flow.id,
62
- since: null,
63
- sourceSystem: constants_1.SKEDULO_SYSTEM,
64
- targetSystem: integrationType,
65
- options: { lookupStrategy },
66
- }, ctx);
67
- const durationMs = Date.now() - startedAt;
68
- ctx.logger.info(`[push] flow=${flow.id} ${flow.sourceObject}→${flow.targetObject} ` +
69
- `${JSON.stringify(stats)} took=${durationMs}ms`);
70
- return Object.assign(Object.assign({}, stats), { durationMs, flowId: flow.id });
71
- }
72
- catch (err) {
73
- const msg = err instanceof Error ? err.message : String(err);
74
- ctx.logger.error(`[push] flow=${flow.id} failed: ${msg}`);
75
- return { flowId: flow.id, error: msg };
76
- }
77
- },
78
- };
23
+ const date = new Date(value);
24
+ if (Number.isNaN(date.getTime())) {
25
+ throw new errors_1.InvalidInputError(`since is not a valid date-time: "${value}"`);
26
+ }
27
+ return date;
79
28
  }
80
29
  /**
81
- * Run a single inbound scheduled (pull) data flow. One ElasticServer-triggered
82
- * artifact per flow invokes this action with its own `dataFlowId`.
30
+ * Manually run a single flow. Admin-only. Supports a one-off backfill (`since`)
31
+ * or full resync (`fullResync`) that overrides the persisted cursor.
83
32
  */
84
- function makeScheduledPullAction(deps) {
85
- return {
86
- name: action_names_1.ACTIONS.sync.scheduledPull,
87
- parseInput(raw, meta) {
88
- return { dataFlowId: parseDataFlowId(raw, meta) };
89
- },
90
- async handler(input, ctx) {
91
- const integrationType = deps.adapter.integrationType;
92
- const lookupStrategy = (0, helpers_2.resolveLookupStrategy)(deps.adapter);
93
- const flow = await ctx.dataFlowService.getFlowById(input.dataFlowId);
94
- if (!flow) {
95
- throw new errors_1.ActionError('FLOW_NOT_FOUND', `Flow ${input.dataFlowId} not found`);
96
- }
97
- const sc = (0, data_flow_spec_interface_1.asSyncConfig)(flow.triggerConfig);
98
- if (!sc || sc.strategy !== data_flow_spec_interface_1.SyncStrategy.SCHEDULED) {
99
- throw new errors_1.ActionError('UNSUPPORTED_STRATEGY', 'scheduledPull action requires strategy=scheduled');
100
- }
101
- const runner = new sync_runner_1.SyncRunner(deps.registry);
102
- const startedAt = Date.now();
103
- try {
104
- const stats = await runner.run({
105
- flowId: flow.id,
106
- since: null,
107
- sourceSystem: integrationType,
108
- targetSystem: constants_1.SKEDULO_SYSTEM,
109
- options: { lookupStrategy },
110
- }, ctx);
111
- const durationMs = Date.now() - startedAt;
112
- ctx.logger.info(`[scheduled-pull] flow=${flow.id} ${flow.sourceObject}→${flow.targetObject} ` +
113
- `${JSON.stringify(stats)} took=${durationMs}ms`);
114
- return Object.assign(Object.assign({}, stats), { durationMs, flowId: flow.id });
115
- }
116
- catch (err) {
117
- const msg = err instanceof Error ? err.message : String(err);
118
- ctx.logger.error(`[scheduled-pull] flow=${flow.id} failed: ${msg}`);
119
- return { flowId: flow.id, error: msg };
120
- }
121
- },
122
- };
123
- }
124
33
  function makeRunFlowAction(deps) {
125
34
  return {
126
35
  name: action_names_1.ACTIONS.sync.runFlow,
127
36
  parseInput(raw) {
128
- return { flowId: parsePositiveInt(raw, 'flowId') };
37
+ const obj = (raw !== null && raw !== void 0 ? raw : {});
38
+ const input = { flowId: parsePositiveInt(raw, 'flowId') };
39
+ // fullResync takes precedence over since when both are supplied.
40
+ if (obj.fullResync === true) {
41
+ input.fullResync = true;
42
+ }
43
+ else if (obj.since !== undefined) {
44
+ input.since = parseSinceDate(obj.since);
45
+ }
46
+ return input;
129
47
  },
130
48
  async handler(input, ctx) {
131
49
  var _a, _b;
@@ -139,10 +57,18 @@ function makeRunFlowAction(deps) {
139
57
  if (!flow) {
140
58
  throw new errors_1.ActionError('FLOW_NOT_FOUND', `Flow ${input.flowId} not found`);
141
59
  }
142
- ctx.logger.info(`[run-flow] flowId=${input.flowId} runId=${runId} starting`);
60
+ // overrideSince: undefined = normal resume, null = full resync, Date = backfill from time.
61
+ const overrideSince = input.fullResync ? null : input.since;
62
+ ctx.logger.info(`[run-flow] flowId=${input.flowId} runId=${runId} starting` +
63
+ (overrideSince === null
64
+ ? ' (full resync)'
65
+ : overrideSince
66
+ ? ` (backfill since ${overrideSince.toISOString()})`
67
+ : ''));
143
68
  const stats = await new sync_runner_1.SyncRunner(deps.registry).run({
144
69
  flowId: input.flowId,
145
70
  since: null,
71
+ overrideSince,
146
72
  sourceSystem: (_a = flow.sourceSystem) !== null && _a !== void 0 ? _a : integrationType,
147
73
  targetSystem: (_b = flow.targetSystem) !== null && _b !== void 0 ? _b : constants_1.SKEDULO_SYSTEM,
148
74
  options: { lookupStrategy },
@@ -152,63 +78,4 @@ function makeRunFlowAction(deps) {
152
78
  },
153
79
  };
154
80
  }
155
- function makeRunAllFlowsAction(deps) {
156
- return {
157
- name: action_names_1.ACTIONS.sync.runAllFlows,
158
- parseInput() {
159
- return undefined;
160
- },
161
- async handler(_input, ctx) {
162
- var _a, _b, _c, _d;
163
- if (!(0, helpers_1.isAdminRequest)(ctx.skedContext)) {
164
- throw new errors_1.ActionError('FORBIDDEN', 'runAllFlows requires admin privileges');
165
- }
166
- const integrationType = deps.adapter.integrationType;
167
- const lookupStrategy = (0, helpers_2.resolveLookupStrategy)(deps.adapter);
168
- const flows = await ctx.dataFlowService.listActive({ integrationType });
169
- if (flows.length === 0) {
170
- throw new errors_1.ActionError('NO_ACTIVE_FLOWS', `No active data flows found for ${integrationType}. Create flows first.`);
171
- }
172
- ctx.logger.info(`[run-all-flows] found ${flows.length} active flow(s): ` +
173
- flows.map((f) => `${f.sourceObject}→${f.targetObject}`).join(', '));
174
- const sorted = [...flows].sort((a, b) => { var _a, _b; return ((_a = a.executionOrder) !== null && _a !== void 0 ? _a : Infinity) - ((_b = b.executionOrder) !== null && _b !== void 0 ? _b : Infinity); });
175
- const runner = new sync_runner_1.SyncRunner(deps.registry);
176
- const results = {};
177
- for (const flow of sorted) {
178
- const startedAt = Date.now();
179
- const base = {
180
- flowId: flow.id,
181
- sourceObject: flow.sourceObject,
182
- targetObject: flow.targetObject,
183
- };
184
- try {
185
- if (!((_b = (_a = flow.mappingConfig) === null || _a === void 0 ? void 0 : _a.mappings) === null || _b === void 0 ? void 0 : _b.length)) {
186
- ctx.logger.warn(`[run-all-flows] skipping flow ${flow.id} (${flow.sourceObject}) — no mappingConfig`);
187
- results[String(flow.id)] = Object.assign(Object.assign({}, base), { skipped: true, reason: 'no mappingConfig' });
188
- continue;
189
- }
190
- await ctx.dataFlowService.updateCursor(flow.id, null);
191
- ctx.logger.info(`[run-all-flows] syncing ${flow.sourceObject} → ${flow.targetObject}`);
192
- const stats = await runner.run({
193
- flowId: flow.id,
194
- since: null,
195
- sourceSystem: (_c = flow.sourceSystem) !== null && _c !== void 0 ? _c : integrationType,
196
- targetSystem: (_d = flow.targetSystem) !== null && _d !== void 0 ? _d : constants_1.SKEDULO_SYSTEM,
197
- options: { lookupStrategy },
198
- }, ctx);
199
- const durationMs = Date.now() - startedAt;
200
- ctx.logger.info(`[run-all-flows] flow=${flow.id} ${flow.sourceObject}→${flow.targetObject} ` +
201
- `${JSON.stringify(stats)} took=${durationMs}ms`);
202
- results[String(flow.id)] = Object.assign(Object.assign({}, base), stats);
203
- }
204
- catch (err) {
205
- const msg = err instanceof Error ? err.message : String(err);
206
- ctx.logger.error(`[run-all-flows] flow=${flow.id} failed: ${msg}`);
207
- results[String(flow.id)] = Object.assign(Object.assign({}, base), { error: msg });
208
- }
209
- }
210
- return { message: 'All flows completed', results };
211
- },
212
- };
213
- }
214
81
  //# sourceMappingURL=sync.action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sync.action.js","sourceRoot":"","sources":["../../src/actions/sync.action.ts"],"names":[],"mappings":";;AAmDA,wCA8CC;AAeD,0DAmDC;AASD,8CAkCC;AAmBD,sDA4EC;AA7SD,mCAAoC;AAIpC,4CAA8C;AAC9C,qFAAoF;AACpF,yDAAqD;AACrD,8CAAkD;AAClD,uDAA+C;AAC/C,6CAAwD;AACxD,2CAAgE;AAKhE,SAAS,gBAAgB,CAAC,GAAY,EAAE,KAAa;IACnD,MAAM,GAAG,GAAG,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,CAA4B,CAAC;IACnD,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAK,CAAY,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,0BAAiB,CAAC,GAAG,KAAK,6BAA6B,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,CAAW,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,GAAY,EAAE,IAA2B;IAChE,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI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EAAG;QACnD,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -5,10 +5,18 @@
5
5
  export declare const ACTION_HEADER = "sked-integration-action";
6
6
  /**
7
7
  * HTTP header carrying the target flow id for per-flow actions. ElasticServer
8
- * scheduled webhooks post an empty body, so the flow id rides on this header;
9
- * the dispatcher merges it into the action input as `dataFlowId`.
8
+ * scheduled webhooks post an empty body (and triggered actions a bare array),
9
+ * so the flow id rides on this header; the dispatcher passes it to `parseInput`
10
+ * as `meta.dataFlowId`.
10
11
  */
11
12
  export declare const DATA_FLOW_ID_HEADER = "sked-data-flow-id";
13
+ /**
14
+ * HTTP header carrying the target scheduled job's `webhook_name`. The ES
15
+ * scheduled webhook provisioned for a job posts an empty body, so the job
16
+ * identity rides on this header; the dispatcher passes it to `parseInput` as
17
+ * `meta.scheduledJobName`.
18
+ */
19
+ export declare const SCHEDULED_JOB_NAME_HEADER = "sked-scheduled-job-name";
12
20
  /**
13
21
  * Wire-format action names, grouped by domain. Use these instead of hardcoded
14
22
  * strings on both sides of the dispatcher (SDK + UI / cross-function clients).
@@ -29,10 +37,15 @@ export declare const ACTIONS: Readonly<{
29
37
  getSampleRecords: "metadata.get-sample-records";
30
38
  }>;
31
39
  readonly sync: Readonly<{
32
- push: "sync.push";
33
- scheduledPull: "sync.scheduled-pull";
34
40
  runFlow: "sync.run-flow";
35
- runAllFlows: "sync.run-all-flows";
41
+ runJob: "sync.run-job";
42
+ }>;
43
+ readonly scheduledJob: Readonly<{
44
+ create: "scheduled-job.create";
45
+ update: "scheduled-job.update";
46
+ delete: "scheduled-job.delete";
47
+ list: "scheduled-job.list";
48
+ get: "scheduled-job.get";
36
49
  }>;
37
50
  readonly event: Readonly<{
38
51
  onSkedulo: "event.on-skedulo";
@@ -48,5 +61,5 @@ export declare const ACTIONS: Readonly<{
48
61
  list: "data-flow.list";
49
62
  }>;
50
63
  }>;
51
- export type ActionName = typeof ACTIONS.capabilities | (typeof ACTIONS.setup)[keyof typeof ACTIONS.setup] | (typeof ACTIONS.metadata)[keyof typeof ACTIONS.metadata] | (typeof ACTIONS.sync)[keyof typeof ACTIONS.sync] | (typeof ACTIONS.event)[keyof typeof ACTIONS.event] | (typeof ACTIONS.dataFlow)[keyof typeof ACTIONS.dataFlow];
64
+ export type ActionName = typeof ACTIONS.capabilities | (typeof ACTIONS.setup)[keyof typeof ACTIONS.setup] | (typeof ACTIONS.metadata)[keyof typeof ACTIONS.metadata] | (typeof ACTIONS.sync)[keyof typeof ACTIONS.sync] | (typeof ACTIONS.scheduledJob)[keyof typeof ACTIONS.scheduledJob] | (typeof ACTIONS.event)[keyof typeof ACTIONS.event] | (typeof ACTIONS.dataFlow)[keyof typeof ACTIONS.dataFlow];
52
65
  //# sourceMappingURL=action-names.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-names.d.ts","sourceRoot":"","sources":["../../../src/actions/utils/action-names.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,aAAa,4BAA4B,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCT,CAAC;AAEZ,MAAM,MAAM,UAAU,GAClB,OAAO,OAAO,CAAC,YAAY,GAC3B,CAAC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,KAAK,CAAC,GAClD,CAAC,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,QAAQ,CAAC,GACxD,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,IAAI,CAAC,GAChD,CAAC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,KAAK,CAAC,GAClD,CAAC,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"action-names.d.ts","sourceRoot":"","sources":["../../../src/actions/utils/action-names.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,aAAa,4BAA4B,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCT,CAAC;AAEZ,MAAM,MAAM,UAAU,GAClB,OAAO,OAAO,CAAC,YAAY,GAC3B,CAAC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,KAAK,CAAC,GAClD,CAAC,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,QAAQ,CAAC,GACxD,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,IAAI,CAAC,GAChD,CAAC,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,YAAY,CAAC,GAChE,CAAC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,KAAK,CAAC,GAClD,CAAC,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ACTIONS = exports.DATA_FLOW_ID_HEADER = exports.ACTION_HEADER = void 0;
3
+ exports.ACTIONS = exports.SCHEDULED_JOB_NAME_HEADER = exports.DATA_FLOW_ID_HEADER = exports.ACTION_HEADER = void 0;
4
4
  /**
5
5
  * HTTP header that carries the action name to the dispatcher.
6
6
  * Exported so consumers (UI, cross-function clients) don't hardcode it.
@@ -8,10 +8,18 @@ exports.ACTIONS = exports.DATA_FLOW_ID_HEADER = exports.ACTION_HEADER = void 0;
8
8
  exports.ACTION_HEADER = 'sked-integration-action';
9
9
  /**
10
10
  * HTTP header carrying the target flow id for per-flow actions. ElasticServer
11
- * scheduled webhooks post an empty body, so the flow id rides on this header;
12
- * the dispatcher merges it into the action input as `dataFlowId`.
11
+ * scheduled webhooks post an empty body (and triggered actions a bare array),
12
+ * so the flow id rides on this header; the dispatcher passes it to `parseInput`
13
+ * as `meta.dataFlowId`.
13
14
  */
14
15
  exports.DATA_FLOW_ID_HEADER = 'sked-data-flow-id';
16
+ /**
17
+ * HTTP header carrying the target scheduled job's `webhook_name`. The ES
18
+ * scheduled webhook provisioned for a job posts an empty body, so the job
19
+ * identity rides on this header; the dispatcher passes it to `parseInput` as
20
+ * `meta.scheduledJobName`.
21
+ */
22
+ exports.SCHEDULED_JOB_NAME_HEADER = 'sked-scheduled-job-name';
15
23
  /**
16
24
  * Wire-format action names, grouped by domain. Use these instead of hardcoded
17
25
  * strings on both sides of the dispatcher (SDK + UI / cross-function clients).
@@ -32,10 +40,15 @@ exports.ACTIONS = Object.freeze({
32
40
  getSampleRecords: 'metadata.get-sample-records',
33
41
  }),
34
42
  sync: Object.freeze({
35
- push: 'sync.push',
36
- scheduledPull: 'sync.scheduled-pull',
37
43
  runFlow: 'sync.run-flow',
38
- runAllFlows: 'sync.run-all-flows',
44
+ runJob: 'sync.run-job',
45
+ }),
46
+ scheduledJob: Object.freeze({
47
+ create: 'scheduled-job.create',
48
+ update: 'scheduled-job.update',
49
+ delete: 'scheduled-job.delete',
50
+ list: 'scheduled-job.list',
51
+ get: 'scheduled-job.get',
39
52
  }),
40
53
  event: Object.freeze({
41
54
  onSkedulo: 'event.on-skedulo',
@@ -1 +1 @@
1
- {"version":3,"file":"action-names.js","sourceRoot":"","sources":["../../../src/actions/utils/action-names.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,a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C;AAEnE;;;;;GAKG;AACU,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IACnC,YAAY,EAAE,cAAc;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QACnB,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,cAAc;KACvB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;QACtB,UAAU,EAAE,sBAAsB;QAClC,SAAS,EAAE,qBAAqB;QAChC,YAAY,EAAE,wBAAwB;QACtC,aAAa,EAAE,0BAA0B;QACzC,gBAAgB,EAAE,6BAA6B;KAChD,CAAC;IACF,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,eAAe;QACxB,MAAM,EAAE,cAAc;KACvB,CAAC;IACF,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC;QAC1B,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,sBAAsB;QAC9B,IAAI,EAAE,oBAAoB;QAC1B,GAAG,EAAE,mBAAmB;KACzB,CAAC;IACF,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS,EAAE,kBAAkB;QAC7B,QAAQ,EAAE,iBAAiB;KAC5B,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;QACtB,MAAM,EAAE,kBAAkB;QAC1B,MAAM,EAAE,kBAAkB;QAC1B,MAAM,EAAE,kBAAkB;QAC1B,QAAQ,EAAE,oBAAoB;QAC9B,UAAU,EAAE,sBAAsB;QAClC,GAAG,EAAE,eAAe;QACpB,IAAI,EAAE,gBAAgB;KACvB,CAAC;CACM,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { IntegrationContext } from '../../context';
2
+ import { type Middleware } from './middleware';
3
+ import type { Action, ParseMeta } from './types';
4
+ export interface DefineActionOpts<I, O> {
5
+ name: string;
6
+ parseInput: (raw: unknown, meta?: ParseMeta) => I;
7
+ handler: (input: I, ctx: IntegrationContext) => Promise<O>;
8
+ /**
9
+ * Whether the action is safe to retry without side-effect duplication.
10
+ * Echoed via the error envelope (for failures) and surfaced as metadata to
11
+ * the dispatcher. Mutating actions without an idempotency key should be `false`.
12
+ */
13
+ idempotent?: boolean;
14
+ /** Emit an audit log on success. Set `true` for mutating actions. */
15
+ audit?: boolean;
16
+ /** Gate the handler on admin privileges before running the rest of the chain. */
17
+ requireAdmin?: boolean;
18
+ /** Extra middleware appended after the built-in stack (metrics, logging, audit). */
19
+ middleware?: ReadonlyArray<Middleware>;
20
+ }
21
+ /**
22
+ * Build an `Action` with the standard cross-cutting concerns wired in.
23
+ *
24
+ * ```ts
25
+ * defineAction({
26
+ * name: ACTIONS.scheduledJob.create,
27
+ * parseInput: parseCreate,
28
+ * requireAdmin: true,
29
+ * audit: true,
30
+ * idempotent: false,
31
+ * handler: async (input, ctx) => { ... },
32
+ * });
33
+ * ```
34
+ */
35
+ export declare function defineAction<I, O>(opts: DefineActionOpts<I, O>): Action<I, O>;
36
+ //# sourceMappingURL=define-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-action.d.ts","sourceRoot":"","sources":["../../../src/actions/utils/define-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,gBAAgB,CAAC,CAAC,EAAE,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,CAAC,CAAC;IAClD,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,kBAAkB,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3D;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qEAAqE;IACrE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iFAAiF;IACjF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oFAAoF;IACpF,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CACxC;AAYD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAW7E"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineAction = defineAction;
4
+ const middleware_1 = require("./middleware");
5
+ /**
6
+ * Stock middleware order (outermost → innermost):
7
+ * metrics → logging → audit → [requireAdmin?] → [extras...] → handler
8
+ *
9
+ * Metrics outermost so failures still record counters. Logging just inside so
10
+ * the start/end log lines bracket business logic. Audit only fires on success,
11
+ * after the handler returns.
12
+ */
13
+ const DEFAULT_MIDDLEWARE = [middleware_1.withMetrics, middleware_1.withLogging, middleware_1.withAudit];
14
+ /**
15
+ * Build an `Action` with the standard cross-cutting concerns wired in.
16
+ *
17
+ * ```ts
18
+ * defineAction({
19
+ * name: ACTIONS.scheduledJob.create,
20
+ * parseInput: parseCreate,
21
+ * requireAdmin: true,
22
+ * audit: true,
23
+ * idempotent: false,
24
+ * handler: async (input, ctx) => { ... },
25
+ * });
26
+ * ```
27
+ */
28
+ function defineAction(opts) {
29
+ var _a, _b;
30
+ const meta = {
31
+ actionName: opts.name,
32
+ idempotent: (_a = opts.idempotent) !== null && _a !== void 0 ? _a : false,
33
+ audit: (_b = opts.audit) !== null && _b !== void 0 ? _b : false,
34
+ };
35
+ const stack = [...DEFAULT_MIDDLEWARE];
36
+ if (opts.requireAdmin)
37
+ stack.push(middleware_1.requireAdmin);
38
+ if (opts.middleware)
39
+ stack.push(...opts.middleware);
40
+ const composed = (0, middleware_1.compose)(stack, opts.handler, meta);
41
+ return { name: opts.name, parseInput: opts.parseInput, handler: composed };
42
+ }
43
+ //# sourceMappingURL=define-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-action.js","sourceRoot":"","sources":["../../../src/actions/utils/define-action.ts"],"names":[],"mappings":";;AAqDA,oCAWC;AA/DD,6CAOsB;AAqBtB;;;;;;;GAOG;AACH,MAAM,kBAAkB,GAA8B,CAAC,wBAAW,EAAE,wBAAW,EAAE,sBAAS,CAAC,CAAC;AAE5F;;;;;;;;;;;;;GAaG;AACH,SAAgB,YAAY,CAAO,IAA4B;;IAC7D,MAAM,IAAI,GAAG;QACX,UAAU,EAAE,IAAI,CAAC,IAAI;QACrB,UAAU,EAAE,MAAA,IAAI,CAAC,UAAU,mCAAI,KAAK;QACpC,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,mCAAI,KAAK;KAC3B,CAAC;IACF,MAAM,KAAK,GAAiB,CAAC,GAAG,kBAAkB,CAAC,CAAC;IACpD,IAAI,IAAI,CAAC,YAAY;QAAE,KAAK,CAAC,IAAI,CAAC,yBAAc,CAAC,CAAC;IAClD,IAAI,IAAI,CAAC,UAAU;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;IACpD,MAAM,QAAQ,GAAG,IAAA,oBAAO,EAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACpD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC7E,CAAC"}