medusa-plugin-automation 0.1.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 (59) hide show
  1. package/.medusa/server/medusa-config.d.ts +1 -0
  2. package/.medusa/server/medusa-config.js +23 -0
  3. package/.medusa/server/src/admin/index.js +9920 -0
  4. package/.medusa/server/src/admin/index.mjs +9918 -0
  5. package/.medusa/server/src/admin/lib/medusa-events.d.ts +16 -0
  6. package/.medusa/server/src/admin/lib/medusa-events.js +131 -0
  7. package/.medusa/server/src/api/admin/automations/[id]/actions/[actionId]/deliveries/retry/route.d.ts +3 -0
  8. package/.medusa/server/src/api/admin/automations/[id]/actions/[actionId]/deliveries/retry/route.js +56 -0
  9. package/.medusa/server/src/api/admin/automations/[id]/actions/[actionId]/deliveries/route.d.ts +2 -0
  10. package/.medusa/server/src/api/admin/automations/[id]/actions/[actionId]/deliveries/route.js +26 -0
  11. package/.medusa/server/src/api/admin/automations/[id]/actions/[actionId]/query/route.d.ts +5 -0
  12. package/.medusa/server/src/api/admin/automations/[id]/actions/[actionId]/query/route.js +46 -0
  13. package/.medusa/server/src/api/admin/automations/[id]/actions/[actionId]/route.d.ts +5 -0
  14. package/.medusa/server/src/api/admin/automations/[id]/actions/[actionId]/route.js +37 -0
  15. package/.medusa/server/src/api/admin/automations/[id]/actions/route.d.ts +5 -0
  16. package/.medusa/server/src/api/admin/automations/[id]/actions/route.js +44 -0
  17. package/.medusa/server/src/api/admin/automations/[id]/receipts/route.d.ts +2 -0
  18. package/.medusa/server/src/api/admin/automations/[id]/receipts/route.js +17 -0
  19. package/.medusa/server/src/api/admin/automations/[id]/route.d.ts +5 -0
  20. package/.medusa/server/src/api/admin/automations/[id]/route.js +37 -0
  21. package/.medusa/server/src/api/admin/automations/route.d.ts +5 -0
  22. package/.medusa/server/src/api/admin/automations/route.js +36 -0
  23. package/.medusa/server/src/api/admin/automations/secrets/[id]/route.d.ts +2 -0
  24. package/.medusa/server/src/api/admin/automations/secrets/[id]/route.js +13 -0
  25. package/.medusa/server/src/api/admin/automations/secrets/route.d.ts +4 -0
  26. package/.medusa/server/src/api/admin/automations/secrets/route.js +38 -0
  27. package/.medusa/server/src/api/middlewares.d.ts +2 -0
  28. package/.medusa/server/src/api/middlewares.js +169 -0
  29. package/.medusa/server/src/api/validators.d.ts +470 -0
  30. package/.medusa/server/src/api/validators.js +123 -0
  31. package/.medusa/server/src/api/webhooks/[id]/route.d.ts +2 -0
  32. package/.medusa/server/src/api/webhooks/[id]/route.js +78 -0
  33. package/.medusa/server/src/lib/dispatch.d.ts +43 -0
  34. package/.medusa/server/src/lib/dispatch.js +400 -0
  35. package/.medusa/server/src/modules/automation/index.d.ts +92 -0
  36. package/.medusa/server/src/modules/automation/index.js +25 -0
  37. package/.medusa/server/src/modules/automation/migrations/Migration20260409171930.d.ts +5 -0
  38. package/.medusa/server/src/modules/automation/migrations/Migration20260409171930.js +47 -0
  39. package/.medusa/server/src/modules/automation/models/automation-action.d.ts +75 -0
  40. package/.medusa/server/src/modules/automation/models/automation-action.js +41 -0
  41. package/.medusa/server/src/modules/automation/models/automation-delivery.d.ts +57 -0
  42. package/.medusa/server/src/modules/automation/models/automation-delivery.js +23 -0
  43. package/.medusa/server/src/modules/automation/models/automation-query.d.ts +52 -0
  44. package/.medusa/server/src/modules/automation/models/automation-query.js +14 -0
  45. package/.medusa/server/src/modules/automation/models/automation-receipt.d.ts +53 -0
  46. package/.medusa/server/src/modules/automation/models/automation-receipt.js +29 -0
  47. package/.medusa/server/src/modules/automation/models/automation-secret.d.ts +5 -0
  48. package/.medusa/server/src/modules/automation/models/automation-secret.js +10 -0
  49. package/.medusa/server/src/modules/automation/models/automation-trigger.d.ts +56 -0
  50. package/.medusa/server/src/modules/automation/models/automation-trigger.js +27 -0
  51. package/.medusa/server/src/modules/automation/service.d.ts +274 -0
  52. package/.medusa/server/src/modules/automation/service.js +21 -0
  53. package/.medusa/server/src/modules/automation/types.d.ts +13 -0
  54. package/.medusa/server/src/modules/automation/types.js +3 -0
  55. package/.medusa/server/src/subscribers/automation-dispatcher.d.ts +3 -0
  56. package/.medusa/server/src/subscribers/automation-dispatcher.js +51 -0
  57. package/LICENSE.md +73 -0
  58. package/README.md +53 -0
  59. package/package.json +91 -0
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AutomationTrigger = exports.AutomationTriggerType = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const automation_action_1 = require("./automation-action");
6
+ const automation_receipt_1 = require("./automation-receipt");
7
+ var AutomationTriggerType;
8
+ (function (AutomationTriggerType) {
9
+ AutomationTriggerType["MEDUSA_EVENT"] = "medusa_event";
10
+ AutomationTriggerType["INCOMING_WEBHOOK"] = "incoming_webhook";
11
+ })(AutomationTriggerType || (exports.AutomationTriggerType = AutomationTriggerType = {}));
12
+ exports.AutomationTrigger = utils_1.model
13
+ .define('automationTrigger', {
14
+ id: utils_1.model.id().primaryKey(),
15
+ name: utils_1.model.text(),
16
+ description: utils_1.model.text().nullable(),
17
+ is_active: utils_1.model.boolean().default(true),
18
+ trigger_type: utils_1.model.enum(AutomationTriggerType),
19
+ trigger_events: utils_1.model.json().nullable(), // string[] — for medusa_event
20
+ trigger_signing_key: utils_1.model.text().nullable(), // HMAC-SHA256 secret — for incoming_webhook
21
+ log_incoming: utils_1.model.boolean().default(false), // log incoming payloads as AutomationReceipts
22
+ metadata: utils_1.model.json().nullable(),
23
+ actions: utils_1.model.hasMany(() => automation_action_1.AutomationAction, { mappedBy: 'trigger' }),
24
+ receipts: utils_1.model.hasMany(() => automation_receipt_1.AutomationReceipt, { mappedBy: 'trigger' })
25
+ })
26
+ .cascades({ delete: ['actions', 'receipts'] });
27
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b21hdGlvbi10cmlnZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiL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FBQVEsRUFBRTtJQUNqQyxPQUFPLEVBQUUsYUFBSyxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FBQyxvQ0FBZ0IsRUFBRSxFQUFFLFFBQVEsRUFBRSxTQUFTLEVBQUUsQ0FBQztJQUN2RSxRQUFRLEVBQUUsYUFBSyxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FBQyxzQ0FBaUIsRUFBRSxFQUFFLFFBQVEsRUFBRSxTQUFTLEVBQUUsQ0FBQztDQUN6RSxDQUFDO0tBQ0QsUUFBUSxDQUFDLEVBQUUsTUFBTSxFQUFFLENBQUMsU0FBUyxFQUFFLFVBQVUsQ0FBQyxFQUFFLENBQUMsQ0FBQSJ9
@@ -0,0 +1,274 @@
1
+ import { AutomationOptions } from './types';
2
+ declare const AutomationService_base: import("@medusajs/framework/utils").MedusaServiceReturnType<import("@medusajs/framework/utils").ModelConfigurationsToConfigTemplate<{
3
+ readonly AutomationTrigger: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
4
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
5
+ name: import("@medusajs/framework/utils").TextProperty;
6
+ description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
7
+ is_active: import("@medusajs/framework/utils").BooleanProperty;
8
+ trigger_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-trigger").AutomationTriggerType>;
9
+ trigger_events: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
10
+ trigger_signing_key: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
11
+ log_incoming: import("@medusajs/framework/utils").BooleanProperty;
12
+ metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
13
+ actions: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
14
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
15
+ name: import("@medusajs/framework/utils").TextProperty;
16
+ description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
17
+ is_active: import("@medusajs/framework/utils").BooleanProperty;
18
+ trigger: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationTrigger">, undefined>;
19
+ action_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-action").AutomationActionType>;
20
+ target_url: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
21
+ signing_secret_id: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
22
+ request_method: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
23
+ target_headers: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
24
+ medusa_workflow: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
25
+ field_mappings: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
26
+ static_values: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
27
+ metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
28
+ deliveries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
29
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
30
+ event_name: import("@medusajs/framework/utils").TextProperty;
31
+ request_payload: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
32
+ response_status: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
33
+ response_body: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
34
+ status: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-delivery").AutomationDeliveryStatus>;
35
+ attempts: import("@medusajs/framework/utils").NumberProperty;
36
+ error_message: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
37
+ action: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">, undefined>;
38
+ }>, "automationDelivery">>;
39
+ query: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
40
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
41
+ action: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">, undefined>;
42
+ entity_name: import("@medusajs/framework/utils").TextProperty;
43
+ fields: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
44
+ filters: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
45
+ limit: import("@medusajs/framework/utils").NumberProperty;
46
+ }>, "automationQuery">>;
47
+ }>, "automationAction">>;
48
+ receipts: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
49
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
50
+ trigger: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationTrigger">, undefined>;
51
+ request_ip: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
52
+ payload: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
53
+ }>, "automationReceipt">>;
54
+ }>, "automationTrigger">;
55
+ readonly AutomationAction: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
56
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
57
+ name: import("@medusajs/framework/utils").TextProperty;
58
+ description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
59
+ is_active: import("@medusajs/framework/utils").BooleanProperty;
60
+ trigger: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
61
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
62
+ name: import("@medusajs/framework/utils").TextProperty;
63
+ description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
64
+ is_active: import("@medusajs/framework/utils").BooleanProperty;
65
+ trigger_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-trigger").AutomationTriggerType>;
66
+ trigger_events: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
67
+ trigger_signing_key: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
68
+ log_incoming: import("@medusajs/framework/utils").BooleanProperty;
69
+ metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
70
+ actions: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">>;
71
+ receipts: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
72
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
73
+ trigger: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationTrigger">, undefined>;
74
+ request_ip: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
75
+ payload: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
76
+ }>, "automationReceipt">>;
77
+ }>, "automationTrigger">, undefined>;
78
+ action_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-action").AutomationActionType>;
79
+ target_url: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
80
+ signing_secret_id: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
81
+ request_method: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
82
+ target_headers: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
83
+ medusa_workflow: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
84
+ field_mappings: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
85
+ static_values: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
86
+ metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
87
+ deliveries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
88
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
89
+ event_name: import("@medusajs/framework/utils").TextProperty;
90
+ request_payload: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
91
+ response_status: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
92
+ response_body: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
93
+ status: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-delivery").AutomationDeliveryStatus>;
94
+ attempts: import("@medusajs/framework/utils").NumberProperty;
95
+ error_message: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
96
+ action: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">, undefined>;
97
+ }>, "automationDelivery">>;
98
+ query: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
99
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
100
+ action: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">, undefined>;
101
+ entity_name: import("@medusajs/framework/utils").TextProperty;
102
+ fields: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
103
+ filters: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
104
+ limit: import("@medusajs/framework/utils").NumberProperty;
105
+ }>, "automationQuery">>;
106
+ }>, "automationAction">;
107
+ readonly AutomationDelivery: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
108
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
109
+ event_name: import("@medusajs/framework/utils").TextProperty;
110
+ request_payload: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
111
+ response_status: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
112
+ response_body: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
113
+ status: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-delivery").AutomationDeliveryStatus>;
114
+ attempts: import("@medusajs/framework/utils").NumberProperty;
115
+ error_message: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
116
+ action: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
117
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
118
+ name: import("@medusajs/framework/utils").TextProperty;
119
+ description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
120
+ is_active: import("@medusajs/framework/utils").BooleanProperty;
121
+ trigger: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
122
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
123
+ name: import("@medusajs/framework/utils").TextProperty;
124
+ description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
125
+ is_active: import("@medusajs/framework/utils").BooleanProperty;
126
+ trigger_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-trigger").AutomationTriggerType>;
127
+ trigger_events: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
128
+ trigger_signing_key: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
129
+ log_incoming: import("@medusajs/framework/utils").BooleanProperty;
130
+ metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
131
+ actions: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">>;
132
+ receipts: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
133
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
134
+ trigger: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationTrigger">, undefined>;
135
+ request_ip: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
136
+ payload: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
137
+ }>, "automationReceipt">>;
138
+ }>, "automationTrigger">, undefined>;
139
+ action_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-action").AutomationActionType>;
140
+ target_url: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
141
+ signing_secret_id: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
142
+ request_method: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
143
+ target_headers: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
144
+ medusa_workflow: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
145
+ field_mappings: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
146
+ static_values: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
147
+ metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
148
+ deliveries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationDelivery">>;
149
+ query: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
150
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
151
+ action: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">, undefined>;
152
+ entity_name: import("@medusajs/framework/utils").TextProperty;
153
+ fields: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
154
+ filters: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
155
+ limit: import("@medusajs/framework/utils").NumberProperty;
156
+ }>, "automationQuery">>;
157
+ }>, "automationAction">, undefined>;
158
+ }>, "automationDelivery">;
159
+ readonly AutomationReceipt: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
160
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
161
+ trigger: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
162
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
163
+ name: import("@medusajs/framework/utils").TextProperty;
164
+ description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
165
+ is_active: import("@medusajs/framework/utils").BooleanProperty;
166
+ trigger_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-trigger").AutomationTriggerType>;
167
+ trigger_events: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
168
+ trigger_signing_key: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
169
+ log_incoming: import("@medusajs/framework/utils").BooleanProperty;
170
+ metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
171
+ actions: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
172
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
173
+ name: import("@medusajs/framework/utils").TextProperty;
174
+ description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
175
+ is_active: import("@medusajs/framework/utils").BooleanProperty;
176
+ trigger: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationTrigger">, undefined>;
177
+ action_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-action").AutomationActionType>;
178
+ target_url: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
179
+ signing_secret_id: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
180
+ request_method: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
181
+ target_headers: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
182
+ medusa_workflow: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
183
+ field_mappings: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
184
+ static_values: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
185
+ metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
186
+ deliveries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
187
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
188
+ event_name: import("@medusajs/framework/utils").TextProperty;
189
+ request_payload: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
190
+ response_status: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
191
+ response_body: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
192
+ status: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-delivery").AutomationDeliveryStatus>;
193
+ attempts: import("@medusajs/framework/utils").NumberProperty;
194
+ error_message: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
195
+ action: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">, undefined>;
196
+ }>, "automationDelivery">>;
197
+ query: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
198
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
199
+ action: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">, undefined>;
200
+ entity_name: import("@medusajs/framework/utils").TextProperty;
201
+ fields: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
202
+ filters: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
203
+ limit: import("@medusajs/framework/utils").NumberProperty;
204
+ }>, "automationQuery">>;
205
+ }>, "automationAction">>;
206
+ receipts: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationReceipt">>;
207
+ }>, "automationTrigger">, undefined>;
208
+ request_ip: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
209
+ payload: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
210
+ }>, "automationReceipt">;
211
+ readonly AutomationQuery: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
212
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
213
+ action: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
214
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
215
+ name: import("@medusajs/framework/utils").TextProperty;
216
+ description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
217
+ is_active: import("@medusajs/framework/utils").BooleanProperty;
218
+ trigger: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
219
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
220
+ name: import("@medusajs/framework/utils").TextProperty;
221
+ description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
222
+ is_active: import("@medusajs/framework/utils").BooleanProperty;
223
+ trigger_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-trigger").AutomationTriggerType>;
224
+ trigger_events: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
225
+ trigger_signing_key: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
226
+ log_incoming: import("@medusajs/framework/utils").BooleanProperty;
227
+ metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
228
+ actions: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">>;
229
+ receipts: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
230
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
231
+ trigger: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationTrigger">, undefined>;
232
+ request_ip: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
233
+ payload: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
234
+ }>, "automationReceipt">>;
235
+ }>, "automationTrigger">, undefined>;
236
+ action_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-action").AutomationActionType>;
237
+ target_url: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
238
+ signing_secret_id: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
239
+ request_method: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
240
+ target_headers: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
241
+ medusa_workflow: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
242
+ field_mappings: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
243
+ static_values: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
244
+ metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
245
+ deliveries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
246
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
247
+ event_name: import("@medusajs/framework/utils").TextProperty;
248
+ request_payload: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
249
+ response_status: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
250
+ response_body: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
251
+ status: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/automation-delivery").AutomationDeliveryStatus>;
252
+ attempts: import("@medusajs/framework/utils").NumberProperty;
253
+ error_message: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
254
+ action: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationAction">, undefined>;
255
+ }>, "automationDelivery">>;
256
+ query: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "automationQuery">>;
257
+ }>, "automationAction">, undefined>;
258
+ entity_name: import("@medusajs/framework/utils").TextProperty;
259
+ fields: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
260
+ filters: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
261
+ limit: import("@medusajs/framework/utils").NumberProperty;
262
+ }>, "automationQuery">;
263
+ readonly AutomationSecret: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
264
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
265
+ label: import("@medusajs/framework/utils").TextProperty;
266
+ secret: import("@medusajs/framework/utils").TextProperty;
267
+ }>, "automationSecret">;
268
+ }>>;
269
+ export declare class AutomationService extends AutomationService_base {
270
+ protected readonly options_: AutomationOptions;
271
+ constructor(_container: object, options?: AutomationOptions);
272
+ getOptions(): AutomationOptions;
273
+ }
274
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AutomationService = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const automation_trigger_1 = require("./models/automation-trigger");
6
+ const automation_action_1 = require("./models/automation-action");
7
+ const automation_delivery_1 = require("./models/automation-delivery");
8
+ const automation_receipt_1 = require("./models/automation-receipt");
9
+ const automation_query_1 = require("./models/automation-query");
10
+ const automation_secret_1 = require("./models/automation-secret");
11
+ class AutomationService extends (0, utils_1.MedusaService)({ AutomationTrigger: automation_trigger_1.AutomationTrigger, AutomationAction: automation_action_1.AutomationAction, AutomationDelivery: automation_delivery_1.AutomationDelivery, AutomationReceipt: automation_receipt_1.AutomationReceipt, AutomationQuery: automation_query_1.AutomationQuery, AutomationSecret: automation_secret_1.AutomationSecret }) {
12
+ constructor(_container, options = {}) {
13
+ super(...arguments);
14
+ this.options_ = options;
15
+ }
16
+ getOptions() {
17
+ return this.options_;
18
+ }
19
+ }
20
+ exports.AutomationService = AutomationService;
21
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9tb2R1bGVzL2F1dG9tYXRpb24vc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxxREFBeUQ7QUFDekQsb0VBQStEO0FBQy9ELGtFQUE2RDtBQUM3RCxzRUFBaUU7QUFDakUsb0VBQStEO0FBQy9ELGdFQUEyRDtBQUMzRCxrRUFBNkQ7QUFHN0QsTUFBYSxpQkFBa0IsU0FBUSxJQUFBLHFCQUFhLEVBQUMsRUFBRSxpQkFBaUIsRUFBakIsc0NBQWlCLEVBQUUsZ0JBQWdCLEVBQWhCLG9DQUFnQixFQUFFLGtCQUFrQixFQUFsQix3Q0FBa0IsRUFBRSxpQkFBaUIsRUFBakIsc0NBQWlCLEVBQUUsZUFBZSxFQUFmLGtDQUFlLEVBQUUsZ0JBQWdCLEVBQWhCLG9DQUFnQixFQUFFLENBQUM7SUFHdEssWUFBWSxVQUFrQixFQUFFLFVBQTZCLEVBQUU7UUFDOUQsS0FBSyxDQUFDLEdBQUcsU0FBUyxDQUFDLENBQUE7UUFDbkIsSUFBSSxDQUFDLFFBQVEsR0FBRyxPQUFPLENBQUE7SUFDeEIsQ0FBQztJQUVELFVBQVU7UUFDVCxPQUFPLElBQUksQ0FBQyxRQUFRLENBQUE7SUFDckIsQ0FBQztDQUNEO0FBWEQsOENBV0MifQ==
@@ -0,0 +1,13 @@
1
+ export type AutomationOptions = {
2
+ /**
3
+ * Maximum allowed incoming webhook payload size.
4
+ * Accepts a number (bytes) or a string with a unit suffix: '50kb', '1mb', etc.
5
+ * Defaults to '100kb' when not set.
6
+ */
7
+ maxPayloadSize?: string | number;
8
+ /**
9
+ * Maximum number of workflow iterations when a field mapping uses [] fan-out syntax.
10
+ * Defaults to 50. Set to 0 for no cap (use with caution).
11
+ */
12
+ maxWorkflowIterations?: number;
13
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9hdXRvbWF0aW9uL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -0,0 +1,3 @@
1
+ import type { SubscriberArgs, SubscriberConfig } from '@medusajs/framework';
2
+ export default function automationDispatchHandler({ event: { name: eventName, data: eventData }, container }: SubscriberArgs<Record<string, unknown>>): Promise<void>;
3
+ export declare const config: SubscriberConfig;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.config = void 0;
4
+ exports.default = automationDispatchHandler;
5
+ const utils_1 = require("@medusajs/framework/utils");
6
+ const automation_1 = require("../modules/automation");
7
+ const automation_trigger_1 = require("../modules/automation/models/automation-trigger");
8
+ const medusa_events_1 = require("../admin/lib/medusa-events");
9
+ const dispatch_1 = require("../lib/dispatch");
10
+ async function automationDispatchHandler({ event: { name: eventName, data: eventData }, container }) {
11
+ const logger = container.resolve(utils_1.ContainerRegistrationKeys.LOGGER);
12
+ const automationService = container.resolve(automation_1.AUTOMATION_MODULE);
13
+ let triggers;
14
+ try {
15
+ ;
16
+ [triggers] = await automationService.listAndCountAutomationTriggers({
17
+ trigger_type: automation_trigger_1.AutomationTriggerType.MEDUSA_EVENT,
18
+ is_active: true
19
+ });
20
+ }
21
+ catch (err) {
22
+ logger.error(`automation-dispatcher: failed to list triggers for ${eventName}: ${err instanceof Error ? err.message : JSON.stringify(err)}`);
23
+ return;
24
+ }
25
+ const matchingTriggers = triggers.filter(trigger => {
26
+ const events = Array.isArray(trigger.trigger_events) ? trigger.trigger_events : [];
27
+ return events.includes(eventName);
28
+ });
29
+ if (matchingTriggers.length === 0)
30
+ return;
31
+ const opts = {
32
+ signOutgoing: true,
33
+ maxWorkflowIterations: automationService.getOptions().maxWorkflowIterations
34
+ };
35
+ await Promise.allSettled(matchingTriggers.map(async (trigger) => {
36
+ const [actions] = await automationService.listAndCountAutomationActions({
37
+ trigger_id: trigger.id,
38
+ is_active: true
39
+ });
40
+ await Promise.allSettled(actions.map(async (action) => {
41
+ // Step 1: Optionally augment event data with a query
42
+ const sourceData = await (0, dispatch_1.augmentWithQuery)(container, automationService, action.id, eventData);
43
+ // Step 2: Dispatch the action and record the delivery
44
+ await (0, dispatch_1.dispatchAndRecord)(container, action, sourceData, eventName, opts);
45
+ }));
46
+ }));
47
+ }
48
+ exports.config = {
49
+ event: medusa_events_1.MEDUSA_EVENTS.map(e => e.name)
50
+ };
51
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b21hdGlvbi1kaXNwYXRjaGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3N1YnNjcmliZXJzL2F1dG9tYXRpb24tZGlzcGF0Y2hlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFVQSw0Q0F1REM7QUE5REQscURBQXFFO0FBQ3JFLHNEQUF5RDtBQUV6RCx3RkFBdUY7QUFDdkYsOERBQTBEO0FBQzFELDhDQUFxRTtBQUV0RCxLQUFLLFVBQVUseUJBQXlCLENBQUMsRUFDdkQsS0FBSyxFQUFFLEVBQUUsSUFBSSxFQUFFLFNBQVMsRUFBRSxJQUFJLEVBQUUsU0FBUyxFQUFFLEVBQzNDLFNBQVMsRUFDZ0M7SUFDekMsTUFBTSxNQUFNLEdBQUcsU0FBUyxDQUFDLE9BQU8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@
1
+ ## Sustainable Use License
2
+
3
+ Version 1.0
4
+
5
+ ### Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ### Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license
12
+ to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject
13
+ to the limitations below.
14
+
15
+ ### Limitations
16
+
17
+ You may use or modify the software only for your own internal business purposes or for non-commercial or
18
+ personal use. You may distribute the software or provide it to others only if you do so free of charge for
19
+ non-commercial purposes. You may not alter, remove, or obscure any licensing, copyright, or other notices of
20
+ the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
21
+
22
+ ### Patents
23
+
24
+ The licensor grants you a license, under any patent claims the licensor can license, or becomes able to
25
+ license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case
26
+ subject to the limitations and conditions in this license. This license does not cover any patent claims that
27
+ you cause to be infringed by modifications or additions to the software. If you or your company make any
28
+ written claim that the software infringes or contributes to infringement of any patent, your patent license
29
+ for the software granted under these terms ends immediately. If your company makes such a claim, your patent
30
+ license ends immediately for work on behalf of your company.
31
+
32
+ ### Notices
33
+
34
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these
35
+ terms. If you modify the software, you must include in any modified copies of the software a prominent notice
36
+ stating that you have modified the software.
37
+
38
+ ### No Other Rights
39
+
40
+ These terms do not imply any licenses other than those expressly granted in these terms.
41
+
42
+ ### Termination
43
+
44
+ If you use the software in violation of these terms, such use is not licensed, and your license will
45
+ automatically terminate. If the licensor provides you with a notice of your violation, and you cease all
46
+ violation of this license no later than 30 days after you receive that notice, your license will be reinstated
47
+ retroactively. However, if you violate these terms after such reinstatement, any additional violation of these
48
+ terms will cause your license to terminate automatically and permanently.
49
+
50
+ ### No Liability
51
+
52
+ As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will
53
+ not be liable to you for any damages arising out of these terms or the use or nature of the software, under
54
+ any kind of legal claim.
55
+
56
+ ### Definitions
57
+
58
+ The “licensor” is the entity offering these terms.
59
+
60
+ The “software” is the software the licensor makes available under these terms, including any portion of it.
61
+
62
+ “You” refers to the individual or entity agreeing to these terms.
63
+
64
+ “Your company” is any legal entity, sole proprietorship, or other kind of organization that you work for, plus
65
+ all organizations that have control over, are under the control of, or are under common control with that
66
+ organization. Control means ownership of substantially all the assets of an entity, or the power to direct its
67
+ management and policies by vote, contract, or otherwise. Control can be direct or indirect.
68
+
69
+ “Your license” is the license granted to you for the software under these terms.
70
+
71
+ “Use” means anything you do with the software requiring your license.
72
+
73
+ “Trademark” means trademarks, service marks, and similar rights.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # medusa-plugin-automation
2
+
3
+ Automation plugin for Medusa v2. Configure triggers from Medusa events or incoming webhooks, and execute actions like outgoing webhooks, HTTP requests, or Medusa workflows.
4
+
5
+ [Documentation](https://pevey.com/medusa-plugin-automation)
6
+
7
+ If you are not familiar with Medusa, you can learn more on [the project web site](https://www.medusajs.com/).
8
+
9
+ ## Features
10
+
11
+ - Two trigger types: Medusa events and incoming webhooks
12
+ - Three action types: outgoing webhooks, outgoing HTTP requests, and Medusa workflow execution
13
+ - HMAC-SHA256 signing for outgoing webhooks and incoming verification
14
+ - Field mapping with dot-notation paths and fan-out iteration
15
+ - Optional query augmentation to enrich event data before action execution
16
+ - Delivery tracking with response codes and error logging
17
+ - Receipt logging for incoming webhook payloads with sensitive data redaction
18
+ - Signing secret management with secure one-time display
19
+ - Admin pages for trigger, action, and secret management
20
+
21
+ ## Installation
22
+
23
+ Inside your medusa backend root folder:
24
+
25
+ ```bash
26
+ yarn add medusa-plugin-automation
27
+ ```
28
+
29
+ Replace "yarn add" with the correct command for your package manager if you are using (for example) npm, pnpm, or bun.
30
+
31
+ ## Configuration
32
+
33
+ Enable in your `medusa-config.ts` file. Example:
34
+
35
+ ```ts
36
+ module.exports = defineConfig({
37
+ //... other config
38
+ plugins: [
39
+ {
40
+ resolve: 'medusa-plugin-automation',
41
+ options: {}
42
+ }
43
+ // ... other plugins
44
+ ]
45
+ })
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ - Configure automation triggers and actions in Settings > Automations in the Medusa admin.
51
+ - Create signing secrets for HMAC-SHA256 verification.
52
+ - Receive incoming webhooks at `POST /webhooks/:triggerId`.
53
+ - Monitor deliveries and receipts from the trigger and action detail pages.