@open-mercato/core 0.4.2-canary-7732371765 → 0.4.2-canary-ed15f2e753

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 (173) hide show
  1. package/dist/generated/entities/api_key/index.js +2 -0
  2. package/dist/generated/entities/api_key/index.js.map +2 -2
  3. package/dist/generated/entities/workflow_event_trigger/index.js +33 -0
  4. package/dist/generated/entities/workflow_event_trigger/index.js.map +7 -0
  5. package/dist/generated/entities.ids.generated.js +1 -0
  6. package/dist/generated/entities.ids.generated.js.map +2 -2
  7. package/dist/generated/entity-fields-registry.js +2 -0
  8. package/dist/generated/entity-fields-registry.js.map +2 -2
  9. package/dist/modules/api_keys/data/entities.js +3 -0
  10. package/dist/modules/api_keys/data/entities.js.map +2 -2
  11. package/dist/modules/api_keys/migrations/Migration20260125204102.js +13 -0
  12. package/dist/modules/api_keys/migrations/Migration20260125204102.js.map +7 -0
  13. package/dist/modules/api_keys/services/apiKeyService.js +41 -0
  14. package/dist/modules/api_keys/services/apiKeyService.js.map +3 -3
  15. package/dist/modules/auth/events.js +30 -0
  16. package/dist/modules/auth/events.js.map +7 -0
  17. package/dist/modules/auth/services/rbacService.js.map +2 -2
  18. package/dist/modules/business_rules/api/execute/[ruleId]/route.js +145 -0
  19. package/dist/modules/business_rules/api/execute/[ruleId]/route.js.map +7 -0
  20. package/dist/modules/business_rules/data/validators.js +34 -0
  21. package/dist/modules/business_rules/data/validators.js.map +2 -2
  22. package/dist/modules/business_rules/index.js +21 -1
  23. package/dist/modules/business_rules/index.js.map +2 -2
  24. package/dist/modules/business_rules/lib/rule-engine.js +182 -1
  25. package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
  26. package/dist/modules/catalog/events.js +34 -0
  27. package/dist/modules/catalog/events.js.map +7 -0
  28. package/dist/modules/customers/events.js +49 -0
  29. package/dist/modules/customers/events.js.map +7 -0
  30. package/dist/modules/directory/events.js +23 -0
  31. package/dist/modules/directory/events.js.map +7 -0
  32. package/dist/modules/sales/acl.js +1 -0
  33. package/dist/modules/sales/acl.js.map +2 -2
  34. package/dist/modules/sales/backend/sales/documents/[id]/page.js +12 -0
  35. package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
  36. package/dist/modules/sales/commands/documents.js +62 -0
  37. package/dist/modules/sales/commands/documents.js.map +2 -2
  38. package/dist/modules/sales/events.js +63 -0
  39. package/dist/modules/sales/events.js.map +7 -0
  40. package/dist/modules/sales/lib/dictionaries.js +3 -0
  41. package/dist/modules/sales/lib/dictionaries.js.map +2 -2
  42. package/dist/modules/sales/lib/frontend/documentDataEvents.js +25 -0
  43. package/dist/modules/sales/lib/frontend/documentDataEvents.js.map +7 -0
  44. package/dist/modules/workflows/acl.js +2 -0
  45. package/dist/modules/workflows/acl.js.map +2 -2
  46. package/dist/modules/workflows/api/instances/route.js +18 -6
  47. package/dist/modules/workflows/api/instances/route.js.map +2 -2
  48. package/dist/modules/workflows/api/tasks/route.js +6 -1
  49. package/dist/modules/workflows/api/tasks/route.js.map +2 -2
  50. package/dist/modules/workflows/backend/definitions/[id]/page.js +9 -1
  51. package/dist/modules/workflows/backend/definitions/[id]/page.js.map +2 -2
  52. package/dist/modules/workflows/backend/definitions/[id]/page.meta.js +1 -1
  53. package/dist/modules/workflows/backend/definitions/[id]/page.meta.js.map +2 -2
  54. package/dist/modules/workflows/backend/definitions/create/page.js +24 -15
  55. package/dist/modules/workflows/backend/definitions/create/page.js.map +2 -2
  56. package/dist/modules/workflows/backend/definitions/create/page.meta.js +1 -1
  57. package/dist/modules/workflows/backend/definitions/create/page.meta.js.map +2 -2
  58. package/dist/modules/workflows/backend/definitions/visual-editor/page.js +150 -132
  59. package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +2 -2
  60. package/dist/modules/workflows/backend/definitions/visual-editor/page.meta.js +1 -1
  61. package/dist/modules/workflows/backend/definitions/visual-editor/page.meta.js.map +2 -2
  62. package/dist/modules/workflows/backend/events/[id]/page.js +1 -1
  63. package/dist/modules/workflows/backend/events/[id]/page.js.map +2 -2
  64. package/dist/modules/workflows/backend/events/[id]/page.meta.js +2 -2
  65. package/dist/modules/workflows/backend/events/[id]/page.meta.js.map +2 -2
  66. package/dist/modules/workflows/backend/instances/[id]/page.meta.js +2 -2
  67. package/dist/modules/workflows/backend/instances/[id]/page.meta.js.map +2 -2
  68. package/dist/modules/workflows/backend/tasks/[id]/page.js +1 -1
  69. package/dist/modules/workflows/backend/tasks/[id]/page.js.map +2 -2
  70. package/dist/modules/workflows/backend/tasks/[id]/page.meta.js +2 -2
  71. package/dist/modules/workflows/backend/tasks/[id]/page.meta.js.map +2 -2
  72. package/dist/modules/workflows/backend/tasks/page.js +5 -6
  73. package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
  74. package/dist/modules/workflows/cli.js +81 -3
  75. package/dist/modules/workflows/cli.js.map +3 -3
  76. package/dist/modules/workflows/components/DefinitionTriggersEditor.js +481 -0
  77. package/dist/modules/workflows/components/DefinitionTriggersEditor.js.map +7 -0
  78. package/dist/modules/workflows/components/EventTriggersEditor.js +553 -0
  79. package/dist/modules/workflows/components/EventTriggersEditor.js.map +7 -0
  80. package/dist/modules/workflows/data/entities.js +64 -1
  81. package/dist/modules/workflows/data/entities.js.map +2 -2
  82. package/dist/modules/workflows/data/validators.js +115 -0
  83. package/dist/modules/workflows/data/validators.js.map +2 -2
  84. package/dist/modules/workflows/events.js +38 -0
  85. package/dist/modules/workflows/events.js.map +7 -0
  86. package/dist/modules/workflows/examples/checkout-demo-definition.json +1 -5
  87. package/dist/modules/workflows/examples/order-approval-definition.json +257 -0
  88. package/dist/modules/workflows/examples/order-approval-guard-rules.json +32 -0
  89. package/dist/modules/workflows/lib/activity-executor.js +75 -13
  90. package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
  91. package/dist/modules/workflows/lib/event-trigger-service.js +308 -0
  92. package/dist/modules/workflows/lib/event-trigger-service.js.map +7 -0
  93. package/dist/modules/workflows/lib/graph-utils.js +71 -2
  94. package/dist/modules/workflows/lib/graph-utils.js.map +2 -2
  95. package/dist/modules/workflows/lib/seeds.js +22 -5
  96. package/dist/modules/workflows/lib/seeds.js.map +2 -2
  97. package/dist/modules/workflows/lib/start-validator.js +33 -23
  98. package/dist/modules/workflows/lib/start-validator.js.map +2 -2
  99. package/dist/modules/workflows/lib/transition-handler.js +157 -45
  100. package/dist/modules/workflows/lib/transition-handler.js.map +3 -3
  101. package/dist/modules/workflows/migrations/Migration20260123143500.js +36 -0
  102. package/dist/modules/workflows/migrations/Migration20260123143500.js.map +7 -0
  103. package/dist/modules/workflows/subscribers/event-trigger.js +78 -0
  104. package/dist/modules/workflows/subscribers/event-trigger.js.map +7 -0
  105. package/dist/modules/workflows/widgets/injection/order-approval/widget.client.js +323 -0
  106. package/dist/modules/workflows/widgets/injection/order-approval/widget.client.js.map +7 -0
  107. package/dist/modules/workflows/widgets/injection/order-approval/widget.js +17 -0
  108. package/dist/modules/workflows/widgets/injection/order-approval/widget.js.map +7 -0
  109. package/dist/modules/workflows/widgets/injection-table.js +19 -0
  110. package/dist/modules/workflows/widgets/injection-table.js.map +7 -0
  111. package/generated/entities/api_key/index.ts +1 -0
  112. package/generated/entities/workflow_event_trigger/index.ts +15 -0
  113. package/generated/entities.ids.generated.ts +1 -0
  114. package/generated/entity-fields-registry.ts +2 -0
  115. package/package.json +2 -2
  116. package/src/modules/api_keys/data/entities.ts +4 -0
  117. package/src/modules/api_keys/migrations/.snapshot-open-mercato.json +9 -0
  118. package/src/modules/api_keys/migrations/Migration20260125204102.ts +13 -0
  119. package/src/modules/api_keys/services/apiKeyService.ts +85 -0
  120. package/src/modules/auth/events.ts +39 -0
  121. package/src/modules/auth/services/rbacService.ts +1 -1
  122. package/src/modules/business_rules/api/execute/[ruleId]/route.ts +163 -0
  123. package/src/modules/business_rules/data/validators.ts +40 -0
  124. package/src/modules/business_rules/index.ts +25 -0
  125. package/src/modules/business_rules/lib/rule-engine.ts +281 -1
  126. package/src/modules/catalog/events.ts +45 -0
  127. package/src/modules/customers/events.ts +63 -0
  128. package/src/modules/directory/events.ts +31 -0
  129. package/src/modules/sales/acl.ts +1 -0
  130. package/src/modules/sales/backend/sales/documents/[id]/page.tsx +16 -0
  131. package/src/modules/sales/commands/documents.ts +74 -1
  132. package/src/modules/sales/events.ts +82 -0
  133. package/src/modules/sales/lib/dictionaries.ts +3 -0
  134. package/src/modules/sales/lib/frontend/documentDataEvents.ts +28 -0
  135. package/src/modules/workflows/acl.ts +2 -0
  136. package/src/modules/workflows/api/__tests__/instances.route.test.ts +5 -2
  137. package/src/modules/workflows/api/instances/route.ts +21 -7
  138. package/src/modules/workflows/api/tasks/route.ts +7 -1
  139. package/src/modules/workflows/backend/definitions/[id]/page.meta.ts +1 -1
  140. package/src/modules/workflows/backend/definitions/[id]/page.tsx +9 -0
  141. package/src/modules/workflows/backend/definitions/create/page.meta.ts +1 -1
  142. package/src/modules/workflows/backend/definitions/create/page.tsx +9 -0
  143. package/src/modules/workflows/backend/definitions/visual-editor/page.meta.ts +1 -1
  144. package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +21 -3
  145. package/src/modules/workflows/backend/events/[id]/page.meta.ts +2 -2
  146. package/src/modules/workflows/backend/events/[id]/page.tsx +1 -1
  147. package/src/modules/workflows/backend/instances/[id]/page.meta.ts +2 -2
  148. package/src/modules/workflows/backend/tasks/[id]/page.meta.ts +2 -2
  149. package/src/modules/workflows/backend/tasks/[id]/page.tsx +1 -1
  150. package/src/modules/workflows/backend/tasks/page.tsx +5 -6
  151. package/src/modules/workflows/cli.ts +111 -0
  152. package/src/modules/workflows/components/DefinitionTriggersEditor.tsx +581 -0
  153. package/src/modules/workflows/components/EventTriggersEditor.tsx +664 -0
  154. package/src/modules/workflows/data/entities.ts +124 -0
  155. package/src/modules/workflows/data/validators.ts +138 -0
  156. package/src/modules/workflows/events.ts +49 -0
  157. package/src/modules/workflows/examples/checkout-demo-definition.json +1 -5
  158. package/src/modules/workflows/examples/order-approval-definition.json +257 -0
  159. package/src/modules/workflows/examples/order-approval-guard-rules.json +32 -0
  160. package/src/modules/workflows/i18n/en.json +71 -0
  161. package/src/modules/workflows/lib/__tests__/activity-executor.test.ts +43 -36
  162. package/src/modules/workflows/lib/__tests__/transition-handler.test.ts +170 -90
  163. package/src/modules/workflows/lib/activity-executor.ts +129 -16
  164. package/src/modules/workflows/lib/event-trigger-service.ts +557 -0
  165. package/src/modules/workflows/lib/graph-utils.ts +117 -2
  166. package/src/modules/workflows/lib/seeds.ts +34 -8
  167. package/src/modules/workflows/lib/start-validator.ts +38 -28
  168. package/src/modules/workflows/lib/transition-handler.ts +208 -55
  169. package/src/modules/workflows/migrations/Migration20260123143500.ts +38 -0
  170. package/src/modules/workflows/subscribers/event-trigger.ts +109 -0
  171. package/src/modules/workflows/widgets/injection/order-approval/widget.client.tsx +446 -0
  172. package/src/modules/workflows/widgets/injection/order-approval/widget.ts +16 -0
  173. package/src/modules/workflows/widgets/injection-table.ts +21 -0
@@ -9,6 +9,7 @@ const roles_json = "roles_json";
9
9
  const created_by = "created_by";
10
10
  const session_token = "session_token";
11
11
  const session_user_id = "session_user_id";
12
+ const session_secret_encrypted = "session_secret_encrypted";
12
13
  const last_used_at = "last_used_at";
13
14
  const expires_at = "expires_at";
14
15
  const created_at = "created_at";
@@ -27,6 +28,7 @@ export {
27
28
  name,
28
29
  organization_id,
29
30
  roles_json,
31
+ session_secret_encrypted,
30
32
  session_token,
31
33
  session_user_id,
32
34
  tenant_id,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../generated/entities/api_key/index.ts"],
4
- "sourcesContent": ["export const id = 'id'\nexport const name = 'name'\nexport const description = 'description'\nexport const tenant_id = 'tenant_id'\nexport const organization_id = 'organization_id'\nexport const key_hash = 'key_hash'\nexport const key_prefix = 'key_prefix'\nexport const roles_json = 'roles_json'\nexport const created_by = 'created_by'\nexport const session_token = 'session_token'\nexport const session_user_id = 'session_user_id'\nexport const last_used_at = 'last_used_at'\nexport const expires_at = 'expires_at'\nexport const created_at = 'created_at'\nexport const updated_at = 'updated_at'\nexport const deleted_at = 'deleted_at'\n"],
5
- "mappings": "AAAO,MAAM,KAAK;AACX,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,YAAY;AAClB,MAAM,kBAAkB;AACxB,MAAM,WAAW;AACjB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;",
4
+ "sourcesContent": ["export const id = 'id'\nexport const name = 'name'\nexport const description = 'description'\nexport const tenant_id = 'tenant_id'\nexport const organization_id = 'organization_id'\nexport const key_hash = 'key_hash'\nexport const key_prefix = 'key_prefix'\nexport const roles_json = 'roles_json'\nexport const created_by = 'created_by'\nexport const session_token = 'session_token'\nexport const session_user_id = 'session_user_id'\nexport const session_secret_encrypted = 'session_secret_encrypted'\nexport const last_used_at = 'last_used_at'\nexport const expires_at = 'expires_at'\nexport const created_at = 'created_at'\nexport const updated_at = 'updated_at'\nexport const deleted_at = 'deleted_at'\n"],
5
+ "mappings": "AAAO,MAAM,KAAK;AACX,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,YAAY;AAClB,MAAM,kBAAkB;AACxB,MAAM,WAAW;AACjB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AACxB,MAAM,2BAA2B;AACjC,MAAM,eAAe;AACrB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,33 @@
1
+ const id = "id";
2
+ const name = "name";
3
+ const description = "description";
4
+ const workflow_definition_id = "workflow_definition_id";
5
+ const event_pattern = "event_pattern";
6
+ const config = "config";
7
+ const enabled = "enabled";
8
+ const priority = "priority";
9
+ const tenant_id = "tenant_id";
10
+ const organization_id = "organization_id";
11
+ const created_by = "created_by";
12
+ const updated_by = "updated_by";
13
+ const created_at = "created_at";
14
+ const updated_at = "updated_at";
15
+ const deleted_at = "deleted_at";
16
+ export {
17
+ config,
18
+ created_at,
19
+ created_by,
20
+ deleted_at,
21
+ description,
22
+ enabled,
23
+ event_pattern,
24
+ id,
25
+ name,
26
+ organization_id,
27
+ priority,
28
+ tenant_id,
29
+ updated_at,
30
+ updated_by,
31
+ workflow_definition_id
32
+ };
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../generated/entities/workflow_event_trigger/index.ts"],
4
+ "sourcesContent": ["export const id = 'id'\nexport const name = 'name'\nexport const description = 'description'\nexport const workflow_definition_id = 'workflow_definition_id'\nexport const event_pattern = 'event_pattern'\nexport const config = 'config'\nexport const enabled = 'enabled'\nexport const priority = 'priority'\nexport const tenant_id = 'tenant_id'\nexport const organization_id = 'organization_id'\nexport const created_by = 'created_by'\nexport const updated_by = 'updated_by'\nexport const created_at = 'created_at'\nexport const updated_at = 'updated_at'\nexport const deleted_at = 'deleted_at'\n"],
5
+ "mappings": "AAAO,MAAM,KAAK;AACX,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,yBAAyB;AAC/B,MAAM,gBAAgB;AACtB,MAAM,SAAS;AACf,MAAM,UAAU;AAChB,MAAM,WAAW;AACjB,MAAM,YAAY;AAClB,MAAM,kBAAkB;AACxB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;",
6
+ "names": []
7
+ }
@@ -153,6 +153,7 @@ const E = {
153
153
  "user_task": "workflows:user_task",
154
154
  "workflow_definition": "workflows:workflow_definition",
155
155
  "workflow_event": "workflows:workflow_event",
156
+ "workflow_event_trigger": "workflows:workflow_event_trigger",
156
157
  "workflow_instance": "workflows:workflow_instance"
157
158
  },
158
159
  "currencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../generated/entities.ids.generated.ts"],
4
- "sourcesContent": ["// AUTO-GENERATED by mercato generate entity-ids\nexport const M = {\n \"dashboards\": \"dashboards\",\n \"auth\": \"auth\",\n \"directory\": \"directory\",\n \"customers\": \"customers\",\n \"perspectives\": \"perspectives\",\n \"entities\": \"entities\",\n \"configs\": \"configs\",\n \"query_index\": \"query_index\",\n \"audit_logs\": \"audit_logs\",\n \"attachments\": \"attachments\",\n \"catalog\": \"catalog\",\n \"sales\": \"sales\",\n \"api_keys\": \"api_keys\",\n \"dictionaries\": \"dictionaries\",\n \"api_docs\": \"api_docs\",\n \"business_rules\": \"business_rules\",\n \"feature_toggles\": \"feature_toggles\",\n \"workflows\": \"workflows\",\n \"currencies\": \"currencies\",\n \"planner\": \"planner\",\n \"resources\": \"resources\",\n \"staff\": \"staff\"\n} as const\nexport const E = {\n \"dashboards\": {\n \"dashboard_layout\": \"dashboards:dashboard_layout\",\n \"dashboard_role_widgets\": \"dashboards:dashboard_role_widgets\",\n \"dashboard_user_widgets\": \"dashboards:dashboard_user_widgets\"\n },\n \"auth\": {\n \"password_reset\": \"auth:password_reset\",\n \"role\": \"auth:role\",\n \"role_acl\": \"auth:role_acl\",\n \"role_sidebar_preference\": \"auth:role_sidebar_preference\",\n \"session\": \"auth:session\",\n \"user\": \"auth:user\",\n \"user_acl\": \"auth:user_acl\",\n \"user_role\": \"auth:user_role\",\n \"user_sidebar_preference\": \"auth:user_sidebar_preference\"\n },\n \"directory\": {\n \"organization\": \"directory:organization\",\n \"tenant\": \"directory:tenant\"\n },\n \"customers\": {\n \"customer_activity\": \"customers:customer_activity\",\n \"customer_address\": \"customers:customer_address\",\n \"customer_comment\": \"customers:customer_comment\",\n \"customer_company_profile\": \"customers:customer_company_profile\",\n \"customer_deal\": \"customers:customer_deal\",\n \"customer_deal_company_link\": \"customers:customer_deal_company_link\",\n \"customer_deal_person_link\": \"customers:customer_deal_person_link\",\n \"customer_dictionary_entry\": \"customers:customer_dictionary_entry\",\n \"customer_entity\": \"customers:customer_entity\",\n \"customer_person_profile\": \"customers:customer_person_profile\",\n \"customer_settings\": \"customers:customer_settings\",\n \"customer_tag\": \"customers:customer_tag\",\n \"customer_tag_assignment\": \"customers:customer_tag_assignment\",\n \"customer_todo_link\": \"customers:customer_todo_link\"\n },\n \"perspectives\": {\n \"perspective\": \"perspectives:perspective\",\n \"role_perspective\": \"perspectives:role_perspective\"\n },\n \"entities\": {\n \"custom_entity\": \"entities:custom_entity\",\n \"custom_entity_storage\": \"entities:custom_entity_storage\",\n \"custom_field_def\": \"entities:custom_field_def\",\n \"custom_field_entity_config\": \"entities:custom_field_entity_config\",\n \"custom_field_value\": \"entities:custom_field_value\",\n \"encryption_map\": \"entities:encryption_map\"\n },\n \"configs\": {\n \"module_config\": \"configs:module_config\",\n \"upgrade_action_run\": \"configs:upgrade_action_run\"\n },\n \"query_index\": {\n \"entity_index_coverage\": \"query_index:entity_index_coverage\",\n \"entity_index_job\": \"query_index:entity_index_job\",\n \"entity_index_row\": \"query_index:entity_index_row\",\n \"indexer_error_log\": \"query_index:indexer_error_log\",\n \"indexer_status_log\": \"query_index:indexer_status_log\",\n \"search_token\": \"query_index:search_token\"\n },\n \"audit_logs\": {\n \"access_log\": \"audit_logs:access_log\",\n \"action_log\": \"audit_logs:action_log\"\n },\n \"attachments\": {\n \"attachment\": \"attachments:attachment\",\n \"attachment_partition\": \"attachments:attachment_partition\"\n },\n \"catalog\": {\n \"catalog_offer\": \"catalog:catalog_offer\",\n \"catalog_option_schema_template\": \"catalog:catalog_option_schema_template\",\n \"catalog_price_kind\": \"catalog:catalog_price_kind\",\n \"catalog_product\": \"catalog:catalog_product\",\n \"catalog_product_category\": \"catalog:catalog_product_category\",\n \"catalog_product_category_assignment\": \"catalog:catalog_product_category_assignment\",\n \"catalog_product_price\": \"catalog:catalog_product_price\",\n \"catalog_product_tag\": \"catalog:catalog_product_tag\",\n \"catalog_product_tag_assignment\": \"catalog:catalog_product_tag_assignment\",\n \"catalog_product_variant\": \"catalog:catalog_product_variant\",\n \"catalog_product_variant_relation\": \"catalog:catalog_product_variant_relation\"\n },\n \"sales\": {\n \"sales_channel\": \"sales:sales_channel\",\n \"sales_credit_memo\": \"sales:sales_credit_memo\",\n \"sales_credit_memo_line\": \"sales:sales_credit_memo_line\",\n \"sales_delivery_window\": \"sales:sales_delivery_window\",\n \"sales_document_address\": \"sales:sales_document_address\",\n \"sales_document_sequence\": \"sales:sales_document_sequence\",\n \"sales_document_tag\": \"sales:sales_document_tag\",\n \"sales_document_tag_assignment\": \"sales:sales_document_tag_assignment\",\n \"sales_invoice\": \"sales:sales_invoice\",\n \"sales_invoice_line\": \"sales:sales_invoice_line\",\n \"sales_note\": \"sales:sales_note\",\n \"sales_order\": \"sales:sales_order\",\n \"sales_order_adjustment\": \"sales:sales_order_adjustment\",\n \"sales_order_line\": \"sales:sales_order_line\",\n \"sales_payment\": \"sales:sales_payment\",\n \"sales_payment_allocation\": \"sales:sales_payment_allocation\",\n \"sales_payment_method\": \"sales:sales_payment_method\",\n \"sales_quote\": \"sales:sales_quote\",\n \"sales_quote_adjustment\": \"sales:sales_quote_adjustment\",\n \"sales_quote_line\": \"sales:sales_quote_line\",\n \"sales_settings\": \"sales:sales_settings\",\n \"sales_shipment\": \"sales:sales_shipment\",\n \"sales_shipment_item\": \"sales:sales_shipment_item\",\n \"sales_shipping_method\": \"sales:sales_shipping_method\",\n \"sales_tax_rate\": \"sales:sales_tax_rate\"\n },\n \"api_keys\": {\n \"api_key\": \"api_keys:api_key\"\n },\n \"dictionaries\": {\n \"dictionary\": \"dictionaries:dictionary\",\n \"dictionary_entry\": \"dictionaries:dictionary_entry\"\n },\n \"business_rules\": {\n \"business_rule\": \"business_rules:business_rule\",\n \"rule_execution_log\": \"business_rules:rule_execution_log\",\n \"rule_set\": \"business_rules:rule_set\",\n \"rule_set_member\": \"business_rules:rule_set_member\"\n },\n \"feature_toggles\": {\n \"feature_toggle\": \"feature_toggles:feature_toggle\",\n \"feature_toggle_override\": \"feature_toggles:feature_toggle_override\"\n },\n \"workflows\": {\n \"step_instance\": \"workflows:step_instance\",\n \"user_task\": \"workflows:user_task\",\n \"workflow_definition\": \"workflows:workflow_definition\",\n \"workflow_event\": \"workflows:workflow_event\",\n \"workflow_instance\": \"workflows:workflow_instance\"\n },\n \"currencies\": {\n \"currency\": \"currencies:currency\",\n \"currency_fetch_config\": \"currencies:currency_fetch_config\",\n \"exchange_rate\": \"currencies:exchange_rate\"\n },\n \"planner\": {\n \"planner_availability_rule\": \"planner:planner_availability_rule\",\n \"planner_availability_rule_set\": \"planner:planner_availability_rule_set\"\n },\n \"resources\": {\n \"resources_resource\": \"resources:resources_resource\",\n \"resources_resource_activity\": \"resources:resources_resource_activity\",\n \"resources_resource_comment\": \"resources:resources_resource_comment\",\n \"resources_resource_tag\": \"resources:resources_resource_tag\",\n \"resources_resource_tag_assignment\": \"resources:resources_resource_tag_assignment\",\n \"resources_resource_type\": \"resources:resources_resource_type\"\n },\n \"staff\": {\n \"staff_leave_request\": \"staff:staff_leave_request\",\n \"staff_team\": \"staff:staff_team\",\n \"staff_team_member\": \"staff:staff_team_member\",\n \"staff_team_member_activity\": \"staff:staff_team_member_activity\",\n \"staff_team_member_address\": \"staff:staff_team_member_address\",\n \"staff_team_member_comment\": \"staff:staff_team_member_comment\",\n \"staff_team_member_job_history\": \"staff:staff_team_member_job_history\",\n \"staff_team_role\": \"staff:staff_team_role\"\n }\n} as const\nexport type KnownModuleId = keyof typeof M\nexport type KnownEntities = typeof E\n"],
5
- "mappings": "AACO,MAAM,IAAI;AAAA,EACf,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,eAAe;AAAA,EACf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AAsB;AAAA,IACtB,YAAY;AAAA,IACZ,mBAAmB;AAAA,EACrB;AAAA,EACA,mBAAmB;AAAA,IACjB,kBAAkB;AAAA,IAClB,2BAA2B;AAAA,EAC7B;AAAA,EACA,aAAa;AAAA,IACX,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,uBAAuB;AAAA,IACvB,kBAAkB;AAAA,IAClB,qBAAqB;AAAA,EACvB;AAAA,EACA,cAAc;AAAA,IACZ,YAAY;AAAA,IACZ,yBAAyB;AAAA,IACzB,iBAAiB;AAAA,EACnB;AAAA,EACA,WAAW;AAAA,IACT,6BAA6B;AAAA,IAC7B,iCAAiC;AAAA,EACnC;AAAA,EACA,aAAa;AAAA,IACX,sBAAsB;AAAA,IACtB,+BAA+B;AAAA,IAC/B,8BAA8B;AAAA,IAC9B,0BAA0B;AAAA,IAC1B,qCAAqC;AAAA,IACrC,2BAA2B;AAAA,EAC7B;AAAA,EACA,SAAS;AAAA,IACP,uBAAuB;AAAA,IACvB,cAAc;AAAA,IACd,qBAAqB;AAAA,IACrB,8BAA8B;AAAA,IAC9B,6BAA6B;AAAA,IAC7B,6BAA6B;AAAA,IAC7B,iCAAiC;AAAA,IACjC,mBAAmB;AAAA,EACrB;AACF;",
4
+ "sourcesContent": ["// AUTO-GENERATED by mercato generate entity-ids\nexport const M = {\n \"dashboards\": \"dashboards\",\n \"auth\": \"auth\",\n \"directory\": \"directory\",\n \"customers\": \"customers\",\n \"perspectives\": \"perspectives\",\n \"entities\": \"entities\",\n \"configs\": \"configs\",\n \"query_index\": \"query_index\",\n \"audit_logs\": \"audit_logs\",\n \"attachments\": \"attachments\",\n \"catalog\": \"catalog\",\n \"sales\": \"sales\",\n \"api_keys\": \"api_keys\",\n \"dictionaries\": \"dictionaries\",\n \"api_docs\": \"api_docs\",\n \"business_rules\": \"business_rules\",\n \"feature_toggles\": \"feature_toggles\",\n \"workflows\": \"workflows\",\n \"currencies\": \"currencies\",\n \"planner\": \"planner\",\n \"resources\": \"resources\",\n \"staff\": \"staff\"\n} as const\nexport const E = {\n \"dashboards\": {\n \"dashboard_layout\": \"dashboards:dashboard_layout\",\n \"dashboard_role_widgets\": \"dashboards:dashboard_role_widgets\",\n \"dashboard_user_widgets\": \"dashboards:dashboard_user_widgets\"\n },\n \"auth\": {\n \"password_reset\": \"auth:password_reset\",\n \"role\": \"auth:role\",\n \"role_acl\": \"auth:role_acl\",\n \"role_sidebar_preference\": \"auth:role_sidebar_preference\",\n \"session\": \"auth:session\",\n \"user\": \"auth:user\",\n \"user_acl\": \"auth:user_acl\",\n \"user_role\": \"auth:user_role\",\n \"user_sidebar_preference\": \"auth:user_sidebar_preference\"\n },\n \"directory\": {\n \"organization\": \"directory:organization\",\n \"tenant\": \"directory:tenant\"\n },\n \"customers\": {\n \"customer_activity\": \"customers:customer_activity\",\n \"customer_address\": \"customers:customer_address\",\n \"customer_comment\": \"customers:customer_comment\",\n \"customer_company_profile\": \"customers:customer_company_profile\",\n \"customer_deal\": \"customers:customer_deal\",\n \"customer_deal_company_link\": \"customers:customer_deal_company_link\",\n \"customer_deal_person_link\": \"customers:customer_deal_person_link\",\n \"customer_dictionary_entry\": \"customers:customer_dictionary_entry\",\n \"customer_entity\": \"customers:customer_entity\",\n \"customer_person_profile\": \"customers:customer_person_profile\",\n \"customer_settings\": \"customers:customer_settings\",\n \"customer_tag\": \"customers:customer_tag\",\n \"customer_tag_assignment\": \"customers:customer_tag_assignment\",\n \"customer_todo_link\": \"customers:customer_todo_link\"\n },\n \"perspectives\": {\n \"perspective\": \"perspectives:perspective\",\n \"role_perspective\": \"perspectives:role_perspective\"\n },\n \"entities\": {\n \"custom_entity\": \"entities:custom_entity\",\n \"custom_entity_storage\": \"entities:custom_entity_storage\",\n \"custom_field_def\": \"entities:custom_field_def\",\n \"custom_field_entity_config\": \"entities:custom_field_entity_config\",\n \"custom_field_value\": \"entities:custom_field_value\",\n \"encryption_map\": \"entities:encryption_map\"\n },\n \"configs\": {\n \"module_config\": \"configs:module_config\",\n \"upgrade_action_run\": \"configs:upgrade_action_run\"\n },\n \"query_index\": {\n \"entity_index_coverage\": \"query_index:entity_index_coverage\",\n \"entity_index_job\": \"query_index:entity_index_job\",\n \"entity_index_row\": \"query_index:entity_index_row\",\n \"indexer_error_log\": \"query_index:indexer_error_log\",\n \"indexer_status_log\": \"query_index:indexer_status_log\",\n \"search_token\": \"query_index:search_token\"\n },\n \"audit_logs\": {\n \"access_log\": \"audit_logs:access_log\",\n \"action_log\": \"audit_logs:action_log\"\n },\n \"attachments\": {\n \"attachment\": \"attachments:attachment\",\n \"attachment_partition\": \"attachments:attachment_partition\"\n },\n \"catalog\": {\n \"catalog_offer\": \"catalog:catalog_offer\",\n \"catalog_option_schema_template\": \"catalog:catalog_option_schema_template\",\n \"catalog_price_kind\": \"catalog:catalog_price_kind\",\n \"catalog_product\": \"catalog:catalog_product\",\n \"catalog_product_category\": \"catalog:catalog_product_category\",\n \"catalog_product_category_assignment\": \"catalog:catalog_product_category_assignment\",\n \"catalog_product_price\": \"catalog:catalog_product_price\",\n \"catalog_product_tag\": \"catalog:catalog_product_tag\",\n \"catalog_product_tag_assignment\": \"catalog:catalog_product_tag_assignment\",\n \"catalog_product_variant\": \"catalog:catalog_product_variant\",\n \"catalog_product_variant_relation\": \"catalog:catalog_product_variant_relation\"\n },\n \"sales\": {\n \"sales_channel\": \"sales:sales_channel\",\n \"sales_credit_memo\": \"sales:sales_credit_memo\",\n \"sales_credit_memo_line\": \"sales:sales_credit_memo_line\",\n \"sales_delivery_window\": \"sales:sales_delivery_window\",\n \"sales_document_address\": \"sales:sales_document_address\",\n \"sales_document_sequence\": \"sales:sales_document_sequence\",\n \"sales_document_tag\": \"sales:sales_document_tag\",\n \"sales_document_tag_assignment\": \"sales:sales_document_tag_assignment\",\n \"sales_invoice\": \"sales:sales_invoice\",\n \"sales_invoice_line\": \"sales:sales_invoice_line\",\n \"sales_note\": \"sales:sales_note\",\n \"sales_order\": \"sales:sales_order\",\n \"sales_order_adjustment\": \"sales:sales_order_adjustment\",\n \"sales_order_line\": \"sales:sales_order_line\",\n \"sales_payment\": \"sales:sales_payment\",\n \"sales_payment_allocation\": \"sales:sales_payment_allocation\",\n \"sales_payment_method\": \"sales:sales_payment_method\",\n \"sales_quote\": \"sales:sales_quote\",\n \"sales_quote_adjustment\": \"sales:sales_quote_adjustment\",\n \"sales_quote_line\": \"sales:sales_quote_line\",\n \"sales_settings\": \"sales:sales_settings\",\n \"sales_shipment\": \"sales:sales_shipment\",\n \"sales_shipment_item\": \"sales:sales_shipment_item\",\n \"sales_shipping_method\": \"sales:sales_shipping_method\",\n \"sales_tax_rate\": \"sales:sales_tax_rate\"\n },\n \"api_keys\": {\n \"api_key\": \"api_keys:api_key\"\n },\n \"dictionaries\": {\n \"dictionary\": \"dictionaries:dictionary\",\n \"dictionary_entry\": \"dictionaries:dictionary_entry\"\n },\n \"business_rules\": {\n \"business_rule\": \"business_rules:business_rule\",\n \"rule_execution_log\": \"business_rules:rule_execution_log\",\n \"rule_set\": \"business_rules:rule_set\",\n \"rule_set_member\": \"business_rules:rule_set_member\"\n },\n \"feature_toggles\": {\n \"feature_toggle\": \"feature_toggles:feature_toggle\",\n \"feature_toggle_override\": \"feature_toggles:feature_toggle_override\"\n },\n \"workflows\": {\n \"step_instance\": \"workflows:step_instance\",\n \"user_task\": \"workflows:user_task\",\n \"workflow_definition\": \"workflows:workflow_definition\",\n \"workflow_event\": \"workflows:workflow_event\",\n \"workflow_event_trigger\": \"workflows:workflow_event_trigger\",\n \"workflow_instance\": \"workflows:workflow_instance\"\n },\n \"currencies\": {\n \"currency\": \"currencies:currency\",\n \"currency_fetch_config\": \"currencies:currency_fetch_config\",\n \"exchange_rate\": \"currencies:exchange_rate\"\n },\n \"planner\": {\n \"planner_availability_rule\": \"planner:planner_availability_rule\",\n \"planner_availability_rule_set\": \"planner:planner_availability_rule_set\"\n },\n \"resources\": {\n \"resources_resource\": \"resources:resources_resource\",\n \"resources_resource_activity\": \"resources:resources_resource_activity\",\n \"resources_resource_comment\": \"resources:resources_resource_comment\",\n \"resources_resource_tag\": \"resources:resources_resource_tag\",\n \"resources_resource_tag_assignment\": \"resources:resources_resource_tag_assignment\",\n \"resources_resource_type\": \"resources:resources_resource_type\"\n },\n \"staff\": {\n \"staff_leave_request\": \"staff:staff_leave_request\",\n \"staff_team\": \"staff:staff_team\",\n \"staff_team_member\": \"staff:staff_team_member\",\n \"staff_team_member_activity\": \"staff:staff_team_member_activity\",\n \"staff_team_member_address\": \"staff:staff_team_member_address\",\n \"staff_team_member_comment\": \"staff:staff_team_member_comment\",\n \"staff_team_member_job_history\": \"staff:staff_team_member_job_history\",\n \"staff_team_role\": \"staff:staff_team_role\"\n }\n} as const\nexport type KnownModuleId = keyof typeof M\nexport type KnownEntities = typeof E\n"],
5
+ "mappings": "AACO,MAAM,IAAI;AAAA,EACf,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,eAAe;AAAA,EACf,cAAc;AAAA,EACd,eAAe;AAAA,EACf,WAAW;AAAA,EACX,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAW;AAAA,EACX,aAAa;AAAA,EACb,SAAS;AACX;AACO,MAAM,IAAI;AAAA,EACf,cAAc;AAAA,IACZ,oBAAoB;AAAA,IACpB,0BAA0B;AAAA,IAC1B,0BAA0B;AAAA,EAC5B;AAAA,EACA,QAAQ;AAAA,IACN,kBAAkB;AAAA,IAClB,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,2BAA2B;AAAA,IAC3B,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,2BAA2B;AAAA,EAC7B;AAAA,EACA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,IACrC,2BAA2B;AAAA,EAC7B;AAAA,EACA,SAAS;AAAA,IACP,uBAAuB;AAAA,IACvB,cAAc;AAAA,IACd,qBAAqB;AAAA,IACrB,8BAA8B;AAAA,IAC9B,6BAA6B;AAAA,IAC7B,6BAA6B;AAAA,IAC7B,iCAAiC;AAAA,IACjC,mBAAmB;AAAA,EACrB;AACF;",
6
6
  "names": []
7
7
  }
@@ -114,6 +114,7 @@ import * as user_sidebar_preference from "./entities/user_sidebar_preference/ind
114
114
  import * as user_task from "./entities/user_task/index.js";
115
115
  import * as workflow_definition from "./entities/workflow_definition/index.js";
116
116
  import * as workflow_event from "./entities/workflow_event/index.js";
117
+ import * as workflow_event_trigger from "./entities/workflow_event_trigger/index.js";
117
118
  import * as workflow_instance from "./entities/workflow_instance/index.js";
118
119
  const entityFieldsRegistry = {
119
120
  access_log,
@@ -232,6 +233,7 @@ const entityFieldsRegistry = {
232
233
  user_task,
233
234
  workflow_definition,
234
235
  workflow_event,
236
+ workflow_event_trigger,
235
237
  workflow_instance
236
238
  };
237
239
  function getEntityFields(slug) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../generated/entity-fields-registry.ts"],
4
- "sourcesContent": ["// AUTO-GENERATED by mercato generate entity-ids\n// Static registry for entity fields - eliminates dynamic imports for Turbopack compatibility\nimport * as access_log from './entities/access_log/index'\nimport * as action_log from './entities/action_log/index'\nimport * as api_key from './entities/api_key/index'\nimport * as attachment from './entities/attachment/index'\nimport * as attachment_partition from './entities/attachment_partition/index'\nimport * as business_rule from './entities/business_rule/index'\nimport * as catalog_offer from './entities/catalog_offer/index'\nimport * as catalog_option_schema_template from './entities/catalog_option_schema_template/index'\nimport * as catalog_price_kind from './entities/catalog_price_kind/index'\nimport * as catalog_product from './entities/catalog_product/index'\nimport * as catalog_product_category from './entities/catalog_product_category/index'\nimport * as catalog_product_category_assignment from './entities/catalog_product_category_assignment/index'\nimport * as catalog_product_price from './entities/catalog_product_price/index'\nimport * as catalog_product_tag from './entities/catalog_product_tag/index'\nimport * as catalog_product_tag_assignment from './entities/catalog_product_tag_assignment/index'\nimport * as catalog_product_variant from './entities/catalog_product_variant/index'\nimport * as catalog_product_variant_relation from './entities/catalog_product_variant_relation/index'\nimport * as currency from './entities/currency/index'\nimport * as currency_fetch_config from './entities/currency_fetch_config/index'\nimport * as custom_entity from './entities/custom_entity/index'\nimport * as custom_entity_storage from './entities/custom_entity_storage/index'\nimport * as custom_field_def from './entities/custom_field_def/index'\nimport * as custom_field_entity_config from './entities/custom_field_entity_config/index'\nimport * as custom_field_value from './entities/custom_field_value/index'\nimport * as customer_activity from './entities/customer_activity/index'\nimport * as customer_address from './entities/customer_address/index'\nimport * as customer_comment from './entities/customer_comment/index'\nimport * as customer_company_profile from './entities/customer_company_profile/index'\nimport * as customer_deal from './entities/customer_deal/index'\nimport * as customer_deal_company_link from './entities/customer_deal_company_link/index'\nimport * as customer_deal_person_link from './entities/customer_deal_person_link/index'\nimport * as customer_dictionary_entry from './entities/customer_dictionary_entry/index'\nimport * as customer_entity from './entities/customer_entity/index'\nimport * as customer_person_profile from './entities/customer_person_profile/index'\nimport * as customer_settings from './entities/customer_settings/index'\nimport * as customer_tag from './entities/customer_tag/index'\nimport * as customer_tag_assignment from './entities/customer_tag_assignment/index'\nimport * as customer_todo_link from './entities/customer_todo_link/index'\nimport * as dashboard_layout from './entities/dashboard_layout/index'\nimport * as dashboard_role_widgets from './entities/dashboard_role_widgets/index'\nimport * as dashboard_user_widgets from './entities/dashboard_user_widgets/index'\nimport * as dictionary from './entities/dictionary/index'\nimport * as dictionary_entry from './entities/dictionary_entry/index'\nimport * as encryption_map from './entities/encryption_map/index'\nimport * as entity_index_coverage from './entities/entity_index_coverage/index'\nimport * as entity_index_job from './entities/entity_index_job/index'\nimport * as entity_index_row from './entities/entity_index_row/index'\nimport * as exchange_rate from './entities/exchange_rate/index'\nimport * as feature_toggle from './entities/feature_toggle/index'\nimport * as feature_toggle_override from './entities/feature_toggle_override/index'\nimport * as indexer_error_log from './entities/indexer_error_log/index'\nimport * as indexer_status_log from './entities/indexer_status_log/index'\nimport * as module_config from './entities/module_config/index'\nimport * as organization from './entities/organization/index'\nimport * as password_reset from './entities/password_reset/index'\nimport * as perspective from './entities/perspective/index'\nimport * as planner_availability_rule from './entities/planner_availability_rule/index'\nimport * as planner_availability_rule_set from './entities/planner_availability_rule_set/index'\nimport * as resources_resource from './entities/resources_resource/index'\nimport * as resources_resource_activity from './entities/resources_resource_activity/index'\nimport * as resources_resource_comment from './entities/resources_resource_comment/index'\nimport * as resources_resource_tag from './entities/resources_resource_tag/index'\nimport * as resources_resource_tag_assignment from './entities/resources_resource_tag_assignment/index'\nimport * as resources_resource_type from './entities/resources_resource_type/index'\nimport * as role from './entities/role/index'\nimport * as role_acl from './entities/role_acl/index'\nimport * as role_perspective from './entities/role_perspective/index'\nimport * as role_sidebar_preference from './entities/role_sidebar_preference/index'\nimport * as rule_execution_log from './entities/rule_execution_log/index'\nimport * as rule_set from './entities/rule_set/index'\nimport * as rule_set_member from './entities/rule_set_member/index'\nimport * as sales_channel from './entities/sales_channel/index'\nimport * as sales_credit_memo from './entities/sales_credit_memo/index'\nimport * as sales_credit_memo_line from './entities/sales_credit_memo_line/index'\nimport * as sales_delivery_window from './entities/sales_delivery_window/index'\nimport * as sales_document_address from './entities/sales_document_address/index'\nimport * as sales_document_sequence from './entities/sales_document_sequence/index'\nimport * as sales_document_tag from './entities/sales_document_tag/index'\nimport * as sales_document_tag_assignment from './entities/sales_document_tag_assignment/index'\nimport * as sales_invoice from './entities/sales_invoice/index'\nimport * as sales_invoice_line from './entities/sales_invoice_line/index'\nimport * as sales_note from './entities/sales_note/index'\nimport * as sales_order from './entities/sales_order/index'\nimport * as sales_order_adjustment from './entities/sales_order_adjustment/index'\nimport * as sales_order_line from './entities/sales_order_line/index'\nimport * as sales_payment from './entities/sales_payment/index'\nimport * as sales_payment_allocation from './entities/sales_payment_allocation/index'\nimport * as sales_payment_method from './entities/sales_payment_method/index'\nimport * as sales_quote from './entities/sales_quote/index'\nimport * as sales_quote_adjustment from './entities/sales_quote_adjustment/index'\nimport * as sales_quote_line from './entities/sales_quote_line/index'\nimport * as sales_settings from './entities/sales_settings/index'\nimport * as sales_shipment from './entities/sales_shipment/index'\nimport * as sales_shipment_item from './entities/sales_shipment_item/index'\nimport * as sales_shipping_method from './entities/sales_shipping_method/index'\nimport * as sales_tax_rate from './entities/sales_tax_rate/index'\nimport * as search_token from './entities/search_token/index'\nimport * as session from './entities/session/index'\nimport * as staff_leave_request from './entities/staff_leave_request/index'\nimport * as staff_team from './entities/staff_team/index'\nimport * as staff_team_member from './entities/staff_team_member/index'\nimport * as staff_team_member_activity from './entities/staff_team_member_activity/index'\nimport * as staff_team_member_address from './entities/staff_team_member_address/index'\nimport * as staff_team_member_comment from './entities/staff_team_member_comment/index'\nimport * as staff_team_member_job_history from './entities/staff_team_member_job_history/index'\nimport * as staff_team_role from './entities/staff_team_role/index'\nimport * as step_instance from './entities/step_instance/index'\nimport * as tenant from './entities/tenant/index'\nimport * as upgrade_action_run from './entities/upgrade_action_run/index'\nimport * as user from './entities/user/index'\nimport * as user_acl from './entities/user_acl/index'\nimport * as user_role from './entities/user_role/index'\nimport * as user_sidebar_preference from './entities/user_sidebar_preference/index'\nimport * as user_task from './entities/user_task/index'\nimport * as workflow_definition from './entities/workflow_definition/index'\nimport * as workflow_event from './entities/workflow_event/index'\nimport * as workflow_instance from './entities/workflow_instance/index'\n\nexport const entityFieldsRegistry: Record<string, Record<string, string>> = {\n access_log,\n action_log,\n api_key,\n attachment,\n attachment_partition,\n business_rule,\n catalog_offer,\n catalog_option_schema_template,\n catalog_price_kind,\n catalog_product,\n catalog_product_category,\n catalog_product_category_assignment,\n catalog_product_price,\n catalog_product_tag,\n catalog_product_tag_assignment,\n catalog_product_variant,\n catalog_product_variant_relation,\n currency,\n currency_fetch_config,\n custom_entity,\n custom_entity_storage,\n custom_field_def,\n custom_field_entity_config,\n custom_field_value,\n customer_activity,\n customer_address,\n customer_comment,\n customer_company_profile,\n customer_deal,\n customer_deal_company_link,\n customer_deal_person_link,\n customer_dictionary_entry,\n customer_entity,\n customer_person_profile,\n customer_settings,\n customer_tag,\n customer_tag_assignment,\n customer_todo_link,\n dashboard_layout,\n dashboard_role_widgets,\n dashboard_user_widgets,\n dictionary,\n dictionary_entry,\n encryption_map,\n entity_index_coverage,\n entity_index_job,\n entity_index_row,\n exchange_rate,\n feature_toggle,\n feature_toggle_override,\n indexer_error_log,\n indexer_status_log,\n module_config,\n organization,\n password_reset,\n perspective,\n planner_availability_rule,\n planner_availability_rule_set,\n resources_resource,\n resources_resource_activity,\n resources_resource_comment,\n resources_resource_tag,\n resources_resource_tag_assignment,\n resources_resource_type,\n role,\n role_acl,\n role_perspective,\n role_sidebar_preference,\n rule_execution_log,\n rule_set,\n rule_set_member,\n sales_channel,\n sales_credit_memo,\n sales_credit_memo_line,\n sales_delivery_window,\n sales_document_address,\n sales_document_sequence,\n sales_document_tag,\n sales_document_tag_assignment,\n sales_invoice,\n sales_invoice_line,\n sales_note,\n sales_order,\n sales_order_adjustment,\n sales_order_line,\n sales_payment,\n sales_payment_allocation,\n sales_payment_method,\n sales_quote,\n sales_quote_adjustment,\n sales_quote_line,\n sales_settings,\n sales_shipment,\n sales_shipment_item,\n sales_shipping_method,\n sales_tax_rate,\n search_token,\n session,\n staff_leave_request,\n staff_team,\n staff_team_member,\n staff_team_member_activity,\n staff_team_member_address,\n staff_team_member_comment,\n staff_team_member_job_history,\n staff_team_role,\n step_instance,\n tenant,\n upgrade_action_run,\n user,\n user_acl,\n user_role,\n user_sidebar_preference,\n user_task,\n workflow_definition,\n workflow_event,\n workflow_instance\n}\n\nexport function getEntityFields(slug: string): Record<string, string> | undefined {\n return entityFieldsRegistry[slug]\n}\n"],
5
- "mappings": "AAEA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAA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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,gBAAgB,MAAkD;AAChF,SAAO,qBAAqB,IAAI;AAClC;",
4
+ "sourcesContent": ["// AUTO-GENERATED by mercato generate entity-ids\n// Static registry for entity fields - eliminates dynamic imports for Turbopack compatibility\nimport * as access_log from './entities/access_log/index'\nimport * as action_log from './entities/action_log/index'\nimport * as api_key from './entities/api_key/index'\nimport * as attachment from './entities/attachment/index'\nimport * as attachment_partition from './entities/attachment_partition/index'\nimport * as business_rule from './entities/business_rule/index'\nimport * as catalog_offer from './entities/catalog_offer/index'\nimport * as catalog_option_schema_template from './entities/catalog_option_schema_template/index'\nimport * as catalog_price_kind from './entities/catalog_price_kind/index'\nimport * as catalog_product from './entities/catalog_product/index'\nimport * as catalog_product_category from './entities/catalog_product_category/index'\nimport * as catalog_product_category_assignment from './entities/catalog_product_category_assignment/index'\nimport * as catalog_product_price from './entities/catalog_product_price/index'\nimport * as catalog_product_tag from './entities/catalog_product_tag/index'\nimport * as catalog_product_tag_assignment from './entities/catalog_product_tag_assignment/index'\nimport * as catalog_product_variant from './entities/catalog_product_variant/index'\nimport * as catalog_product_variant_relation from './entities/catalog_product_variant_relation/index'\nimport * as currency from './entities/currency/index'\nimport * as currency_fetch_config from './entities/currency_fetch_config/index'\nimport * as custom_entity from './entities/custom_entity/index'\nimport * as custom_entity_storage from './entities/custom_entity_storage/index'\nimport * as custom_field_def from './entities/custom_field_def/index'\nimport * as custom_field_entity_config from './entities/custom_field_entity_config/index'\nimport * as custom_field_value from './entities/custom_field_value/index'\nimport * as customer_activity from './entities/customer_activity/index'\nimport * as customer_address from './entities/customer_address/index'\nimport * as customer_comment from './entities/customer_comment/index'\nimport * as customer_company_profile from './entities/customer_company_profile/index'\nimport * as customer_deal from './entities/customer_deal/index'\nimport * as customer_deal_company_link from './entities/customer_deal_company_link/index'\nimport * as customer_deal_person_link from './entities/customer_deal_person_link/index'\nimport * as customer_dictionary_entry from './entities/customer_dictionary_entry/index'\nimport * as customer_entity from './entities/customer_entity/index'\nimport * as customer_person_profile from './entities/customer_person_profile/index'\nimport * as customer_settings from './entities/customer_settings/index'\nimport * as customer_tag from './entities/customer_tag/index'\nimport * as customer_tag_assignment from './entities/customer_tag_assignment/index'\nimport * as customer_todo_link from './entities/customer_todo_link/index'\nimport * as dashboard_layout from './entities/dashboard_layout/index'\nimport * as dashboard_role_widgets from './entities/dashboard_role_widgets/index'\nimport * as dashboard_user_widgets from './entities/dashboard_user_widgets/index'\nimport * as dictionary from './entities/dictionary/index'\nimport * as dictionary_entry from './entities/dictionary_entry/index'\nimport * as encryption_map from './entities/encryption_map/index'\nimport * as entity_index_coverage from './entities/entity_index_coverage/index'\nimport * as entity_index_job from './entities/entity_index_job/index'\nimport * as entity_index_row from './entities/entity_index_row/index'\nimport * as exchange_rate from './entities/exchange_rate/index'\nimport * as feature_toggle from './entities/feature_toggle/index'\nimport * as feature_toggle_override from './entities/feature_toggle_override/index'\nimport * as indexer_error_log from './entities/indexer_error_log/index'\nimport * as indexer_status_log from './entities/indexer_status_log/index'\nimport * as module_config from './entities/module_config/index'\nimport * as organization from './entities/organization/index'\nimport * as password_reset from './entities/password_reset/index'\nimport * as perspective from './entities/perspective/index'\nimport * as planner_availability_rule from './entities/planner_availability_rule/index'\nimport * as planner_availability_rule_set from './entities/planner_availability_rule_set/index'\nimport * as resources_resource from './entities/resources_resource/index'\nimport * as resources_resource_activity from './entities/resources_resource_activity/index'\nimport * as resources_resource_comment from './entities/resources_resource_comment/index'\nimport * as resources_resource_tag from './entities/resources_resource_tag/index'\nimport * as resources_resource_tag_assignment from './entities/resources_resource_tag_assignment/index'\nimport * as resources_resource_type from './entities/resources_resource_type/index'\nimport * as role from './entities/role/index'\nimport * as role_acl from './entities/role_acl/index'\nimport * as role_perspective from './entities/role_perspective/index'\nimport * as role_sidebar_preference from './entities/role_sidebar_preference/index'\nimport * as rule_execution_log from './entities/rule_execution_log/index'\nimport * as rule_set from './entities/rule_set/index'\nimport * as rule_set_member from './entities/rule_set_member/index'\nimport * as sales_channel from './entities/sales_channel/index'\nimport * as sales_credit_memo from './entities/sales_credit_memo/index'\nimport * as sales_credit_memo_line from './entities/sales_credit_memo_line/index'\nimport * as sales_delivery_window from './entities/sales_delivery_window/index'\nimport * as sales_document_address from './entities/sales_document_address/index'\nimport * as sales_document_sequence from './entities/sales_document_sequence/index'\nimport * as sales_document_tag from './entities/sales_document_tag/index'\nimport * as sales_document_tag_assignment from './entities/sales_document_tag_assignment/index'\nimport * as sales_invoice from './entities/sales_invoice/index'\nimport * as sales_invoice_line from './entities/sales_invoice_line/index'\nimport * as sales_note from './entities/sales_note/index'\nimport * as sales_order from './entities/sales_order/index'\nimport * as sales_order_adjustment from './entities/sales_order_adjustment/index'\nimport * as sales_order_line from './entities/sales_order_line/index'\nimport * as sales_payment from './entities/sales_payment/index'\nimport * as sales_payment_allocation from './entities/sales_payment_allocation/index'\nimport * as sales_payment_method from './entities/sales_payment_method/index'\nimport * as sales_quote from './entities/sales_quote/index'\nimport * as sales_quote_adjustment from './entities/sales_quote_adjustment/index'\nimport * as sales_quote_line from './entities/sales_quote_line/index'\nimport * as sales_settings from './entities/sales_settings/index'\nimport * as sales_shipment from './entities/sales_shipment/index'\nimport * as sales_shipment_item from './entities/sales_shipment_item/index'\nimport * as sales_shipping_method from './entities/sales_shipping_method/index'\nimport * as sales_tax_rate from './entities/sales_tax_rate/index'\nimport * as search_token from './entities/search_token/index'\nimport * as session from './entities/session/index'\nimport * as staff_leave_request from './entities/staff_leave_request/index'\nimport * as staff_team from './entities/staff_team/index'\nimport * as staff_team_member from './entities/staff_team_member/index'\nimport * as staff_team_member_activity from './entities/staff_team_member_activity/index'\nimport * as staff_team_member_address from './entities/staff_team_member_address/index'\nimport * as staff_team_member_comment from './entities/staff_team_member_comment/index'\nimport * as staff_team_member_job_history from './entities/staff_team_member_job_history/index'\nimport * as staff_team_role from './entities/staff_team_role/index'\nimport * as step_instance from './entities/step_instance/index'\nimport * as tenant from './entities/tenant/index'\nimport * as upgrade_action_run from './entities/upgrade_action_run/index'\nimport * as user from './entities/user/index'\nimport * as user_acl from './entities/user_acl/index'\nimport * as user_role from './entities/user_role/index'\nimport * as user_sidebar_preference from './entities/user_sidebar_preference/index'\nimport * as user_task from './entities/user_task/index'\nimport * as workflow_definition from './entities/workflow_definition/index'\nimport * as workflow_event from './entities/workflow_event/index'\nimport * as workflow_event_trigger from './entities/workflow_event_trigger/index'\nimport * as workflow_instance from './entities/workflow_instance/index'\n\nexport const entityFieldsRegistry: Record<string, Record<string, string>> = {\n access_log,\n action_log,\n api_key,\n attachment,\n attachment_partition,\n business_rule,\n catalog_offer,\n catalog_option_schema_template,\n catalog_price_kind,\n catalog_product,\n catalog_product_category,\n catalog_product_category_assignment,\n catalog_product_price,\n catalog_product_tag,\n catalog_product_tag_assignment,\n catalog_product_variant,\n catalog_product_variant_relation,\n currency,\n currency_fetch_config,\n custom_entity,\n custom_entity_storage,\n custom_field_def,\n custom_field_entity_config,\n custom_field_value,\n customer_activity,\n customer_address,\n customer_comment,\n customer_company_profile,\n customer_deal,\n customer_deal_company_link,\n customer_deal_person_link,\n customer_dictionary_entry,\n customer_entity,\n customer_person_profile,\n customer_settings,\n customer_tag,\n customer_tag_assignment,\n customer_todo_link,\n dashboard_layout,\n dashboard_role_widgets,\n dashboard_user_widgets,\n dictionary,\n dictionary_entry,\n encryption_map,\n entity_index_coverage,\n entity_index_job,\n entity_index_row,\n exchange_rate,\n feature_toggle,\n feature_toggle_override,\n indexer_error_log,\n indexer_status_log,\n module_config,\n organization,\n password_reset,\n perspective,\n planner_availability_rule,\n planner_availability_rule_set,\n resources_resource,\n resources_resource_activity,\n resources_resource_comment,\n resources_resource_tag,\n resources_resource_tag_assignment,\n resources_resource_type,\n role,\n role_acl,\n role_perspective,\n role_sidebar_preference,\n rule_execution_log,\n rule_set,\n rule_set_member,\n sales_channel,\n sales_credit_memo,\n sales_credit_memo_line,\n sales_delivery_window,\n sales_document_address,\n sales_document_sequence,\n sales_document_tag,\n sales_document_tag_assignment,\n sales_invoice,\n sales_invoice_line,\n sales_note,\n sales_order,\n sales_order_adjustment,\n sales_order_line,\n sales_payment,\n sales_payment_allocation,\n sales_payment_method,\n sales_quote,\n sales_quote_adjustment,\n sales_quote_line,\n sales_settings,\n sales_shipment,\n sales_shipment_item,\n sales_shipping_method,\n sales_tax_rate,\n search_token,\n session,\n staff_leave_request,\n staff_team,\n staff_team_member,\n staff_team_member_activity,\n staff_team_member_address,\n staff_team_member_comment,\n staff_team_member_job_history,\n staff_team_role,\n step_instance,\n tenant,\n upgrade_action_run,\n user,\n user_acl,\n user_role,\n user_sidebar_preference,\n user_task,\n workflow_definition,\n workflow_event,\n workflow_event_trigger,\n workflow_instance\n}\n\nexport function getEntityFields(slug: string): Record<string, string> | undefined {\n return entityFieldsRegistry[slug]\n}\n"],
5
+ "mappings": "AAEA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY,0BAA0B;AACtC,YAAY,mBAAmB;AAC/B,YAAY,mBAAmB;AAC/B,YAAY,oCAAoC;AAChD,YAAY,wBAAwB;AACpC,YAAY,qBAAqB;AACjC,YAAY,8BAA8B;AAC1C,YAAY,yCAAyC;AACrD,YAAY,2BAA2B;AACvC,YAAY,yBAAyB;AACrC,YAAY,oCAAoC;AAChD,YAAY,6BAA6B;AACzC,YAAY,sCAAsC;AAClD,YAAY,cAAc;AAC1B,YAAY,2BAA2B;AACvC,YAAY,mBAAmB;AAC/B,YAAY,2BAA2B;AACvC,YAAY,sBAAsB;AAClC,YAAY,gCAAgC;AAC5C,YAAY,wBAAwB;AACpC,YAAY,uBAAuB;AACnC,YAAY,sBAAsB;AAClC,YAAY,sBAAsB;AAClC,YAAY,8BAA8B;AAC1C,YAAY,mBAAmB;AAC/B,YAAY,gCAAgC;AAC5C,YAAY,+BAA+B;AAC3C,YAAY,+BAA+B;AAC3C,YAAY,qBAAqB;AACjC,YAAY,6BAA6B;AACzC,YAAY,uBAAuB;AACnC,YAAY,kBAAkB;AAC9B,YAAY,6BAA6B;AACzC,YAAY,wBAAwB;AACpC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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,gBAAgB,MAAkD;AAChF,SAAO,qBAAqB,IAAI;AAClC;",
6
6
  "names": []
7
7
  }
@@ -47,6 +47,9 @@ __decorateClass([
47
47
  __decorateClass([
48
48
  Property({ name: "session_user_id", type: "uuid", nullable: true })
49
49
  ], ApiKey.prototype, "sessionUserId", 2);
50
+ __decorateClass([
51
+ Property({ name: "session_secret_encrypted", type: "text", nullable: true })
52
+ ], ApiKey.prototype, "sessionSecretEncrypted", 2);
50
53
  __decorateClass([
51
54
  Property({ name: "last_used_at", type: Date, nullable: true })
52
55
  ], ApiKey.prototype, "lastUsedAt", 2);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/modules/api_keys/data/entities.ts"],
4
- "sourcesContent": ["import { Entity, PrimaryKey, Property, Unique } from '@mikro-orm/core'\n\n@Entity({ tableName: 'api_keys' })\n@Unique({ properties: ['keyPrefix'] })\nexport class ApiKey {\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ type: 'text' })\n name!: string\n\n @Property({ name: 'description', type: 'text', nullable: true })\n description?: string | null\n\n @Property({ name: 'tenant_id', type: 'uuid', nullable: true })\n tenantId?: string | null\n\n @Property({ name: 'organization_id', type: 'uuid', nullable: true })\n organizationId?: string | null\n\n @Property({ name: 'key_hash', type: 'text' })\n keyHash!: string\n\n @Property({ name: 'key_prefix', type: 'text' })\n keyPrefix!: string\n\n @Property({ name: 'roles_json', type: 'json', nullable: true })\n rolesJson?: string[] | null\n\n @Property({ name: 'created_by', type: 'uuid', nullable: true })\n createdBy?: string | null\n\n /** Session token for ephemeral session-scoped keys (used by AI chat) */\n @Property({ name: 'session_token', type: 'text', nullable: true })\n sessionToken?: string | null\n\n /** User ID who owns this session (for ephemeral keys) */\n @Property({ name: 'session_user_id', type: 'uuid', nullable: true })\n sessionUserId?: string | null\n\n @Property({ name: 'last_used_at', type: Date, nullable: true })\n lastUsedAt?: Date | null\n\n @Property({ name: 'expires_at', type: Date, nullable: true })\n expiresAt?: Date | null\n\n @Property({ name: 'created_at', type: Date, onCreate: () => new Date() })\n createdAt: Date = new Date()\n\n @Property({ name: 'updated_at', type: Date, onUpdate: () => new Date(), nullable: true })\n updatedAt?: Date\n\n @Property({ name: 'deleted_at', type: Date, nullable: true })\n deletedAt?: Date | null\n}\n"],
5
- "mappings": ";;;;;;;;;;AAAA,SAAS,QAAQ,YAAY,UAAU,cAAc;AAI9C,IAAM,SAAN,MAAa;AAAA,EAAb;AA2CL,qBAAkB,oBAAI,KAAK;AAAA;AAO7B;AAhDE;AAAA,EADC,WAAW,EAAE,MAAM,QAAQ,YAAY,oBAAoB,CAAC;AAAA,GADlD,OAEX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAJf,OAKX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,eAAe,MAAM,QAAQ,UAAU,KAAK,CAAC;AAAA,GAPpD,OAQX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,aAAa,MAAM,QAAQ,UAAU,KAAK,CAAC;AAAA,GAVlD,OAWX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,mBAAmB,MAA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"sourcesContent": ["import { Entity, PrimaryKey, Property, Unique } from '@mikro-orm/core'\n\n@Entity({ tableName: 'api_keys' })\n@Unique({ properties: ['keyPrefix'] })\nexport class ApiKey {\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ type: 'text' })\n name!: string\n\n @Property({ name: 'description', type: 'text', nullable: true })\n description?: string | null\n\n @Property({ name: 'tenant_id', type: 'uuid', nullable: true })\n tenantId?: string | null\n\n @Property({ name: 'organization_id', type: 'uuid', nullable: true })\n organizationId?: string | null\n\n @Property({ name: 'key_hash', type: 'text' })\n keyHash!: string\n\n @Property({ name: 'key_prefix', type: 'text' })\n keyPrefix!: string\n\n @Property({ name: 'roles_json', type: 'json', nullable: true })\n rolesJson?: string[] | null\n\n @Property({ name: 'created_by', type: 'uuid', nullable: true })\n createdBy?: string | null\n\n /** Session token for ephemeral session-scoped keys (used by AI chat) */\n @Property({ name: 'session_token', type: 'text', nullable: true })\n sessionToken?: string | null\n\n /** User ID who owns this session (for ephemeral keys) */\n @Property({ name: 'session_user_id', type: 'uuid', nullable: true })\n sessionUserId?: string | null\n\n /** Encrypted API key secret for session keys (recoverable for API calls) */\n @Property({ name: 'session_secret_encrypted', type: 'text', nullable: true })\n sessionSecretEncrypted?: string | null\n\n @Property({ name: 'last_used_at', type: Date, nullable: true })\n lastUsedAt?: Date | null\n\n @Property({ name: 'expires_at', type: Date, nullable: true })\n expiresAt?: Date | null\n\n @Property({ name: 'created_at', type: Date, onCreate: () => new Date() })\n createdAt: Date = new Date()\n\n @Property({ name: 'updated_at', type: Date, onUpdate: () => new Date(), nullable: true })\n updatedAt?: Date\n\n @Property({ name: 'deleted_at', type: Date, nullable: true })\n deletedAt?: Date | null\n}\n"],
5
+ "mappings": ";;;;;;;;;;AAAA,SAAS,QAAQ,YAAY,UAAU,cAAc;AAI9C,IAAM,SAAN,MAAa;AAAA,EAAb;AA+CL,qBAAkB,oBAAI,KAAK;AAAA;AAO7B;AApD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jD,OA4CX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,cAAc,MAAM,MAAM,UAAU,MAAM,oBAAI,KAAK,EAAE,CAAC;AAAA,GA9C7D,OA+CX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,cAAc,MAAM,MAAM,UAAU,MAAM,oBAAI,KAAK,GAAG,UAAU,KAAK,CAAC;AAAA,GAjD7E,OAkDX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,cAAc,MAAM,MAAM,UAAU,KAAK,CAAC;AAAA,GApDjD,OAqDX;AArDW,SAAN;AAAA,EAFN,OAAO,EAAE,WAAW,WAAW,CAAC;AAAA,EAChC,OAAO,EAAE,YAAY,CAAC,WAAW,EAAE,CAAC;AAAA,GACxB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,13 @@
1
+ import { Migration } from "@mikro-orm/migrations";
2
+ class Migration20260125204102 extends Migration {
3
+ async up() {
4
+ this.addSql(`alter table "api_keys" add column "session_secret_encrypted" text null;`);
5
+ }
6
+ async down() {
7
+ this.addSql(`alter table "api_keys" drop column "session_secret_encrypted";`);
8
+ }
9
+ }
10
+ export {
11
+ Migration20260125204102
12
+ };
13
+ //# sourceMappingURL=Migration20260125204102.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/api_keys/migrations/Migration20260125204102.ts"],
4
+ "sourcesContent": ["import { Migration } from '@mikro-orm/migrations';\n\nexport class Migration20260125204102 extends Migration {\n\n override async up(): Promise<void> {\n this.addSql(`alter table \"api_keys\" add column \"session_secret_encrypted\" text null;`);\n }\n\n override async down(): Promise<void> {\n this.addSql(`alter table \"api_keys\" drop column \"session_secret_encrypted\";`);\n }\n\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAEnB,MAAM,gCAAgC,UAAU;AAAA,EAErD,MAAe,KAAoB;AACjC,SAAK,OAAO,yEAAyE;AAAA,EACvF;AAAA,EAEA,MAAe,OAAsB;AACnC,SAAK,OAAO,gEAAgE;AAAA,EAC9E;AAEF;",
6
+ "names": []
7
+ }
@@ -1,7 +1,31 @@
1
1
  import { randomBytes } from "node:crypto";
2
2
  import { hash, compare } from "bcryptjs";
3
3
  import { ApiKey } from "../data/entities.js";
4
+ import { createKmsService } from "@open-mercato/shared/lib/encryption/kms";
5
+ import { encryptWithAesGcm, decryptWithAesGcm } from "@open-mercato/shared/lib/encryption/aes";
4
6
  const BCRYPT_COST = 10;
7
+ async function encryptSessionSecret(secret, tenantId) {
8
+ if (!tenantId) return null;
9
+ const kms = createKmsService();
10
+ if (!kms.isHealthy()) return null;
11
+ const dek = await kms.getTenantDek(tenantId);
12
+ if (!dek) {
13
+ const created = await kms.createTenantDek(tenantId);
14
+ if (!created) return null;
15
+ const encrypted2 = encryptWithAesGcm(secret, created.key);
16
+ return encrypted2.value;
17
+ }
18
+ const encrypted = encryptWithAesGcm(secret, dek.key);
19
+ return encrypted.value;
20
+ }
21
+ async function decryptSessionSecret(encrypted, tenantId) {
22
+ if (!tenantId || !encrypted) return null;
23
+ const kms = createKmsService();
24
+ if (!kms.isHealthy()) return null;
25
+ const dek = await kms.getTenantDek(tenantId);
26
+ if (!dek) return null;
27
+ return decryptWithAesGcm(encrypted, dek.key);
28
+ }
5
29
  function generateApiKeySecret() {
6
30
  const short = randomBytes(4).toString("hex");
7
31
  const body = randomBytes(24).toString("hex");
@@ -64,6 +88,7 @@ async function createSessionApiKey(em, input) {
64
88
  const ttl = input.ttlMinutes ?? 30;
65
89
  const expiresAt = new Date(Date.now() + ttl * 60 * 1e3);
66
90
  const keyHash = await hashApiKey(secret);
91
+ const encryptedSecret = await encryptSessionSecret(secret, input.tenantId ?? null);
67
92
  const record = em.create(ApiKey, {
68
93
  name: `__session_${input.sessionToken}__`,
69
94
  description: "Ephemeral session API key for AI chat",
@@ -75,6 +100,7 @@ async function createSessionApiKey(em, input) {
75
100
  createdBy: input.userId,
76
101
  sessionToken: input.sessionToken,
77
102
  sessionUserId: input.userId,
103
+ sessionSecretEncrypted: encryptedSecret,
78
104
  expiresAt,
79
105
  createdAt: /* @__PURE__ */ new Date()
80
106
  });
@@ -95,6 +121,20 @@ async function findApiKeyBySessionToken(em, sessionToken) {
95
121
  if (record.expiresAt && record.expiresAt.getTime() < Date.now()) return null;
96
122
  return record;
97
123
  }
124
+ async function findSessionApiKeyWithSecret(em, sessionToken) {
125
+ const record = await findApiKeyBySessionToken(em, sessionToken);
126
+ if (!record) return null;
127
+ if (!record.sessionSecretEncrypted) {
128
+ console.warn("[ApiKeyService] Session key has no encrypted secret:", sessionToken.slice(0, 12));
129
+ return null;
130
+ }
131
+ const secret = await decryptSessionSecret(record.sessionSecretEncrypted, record.tenantId ?? null);
132
+ if (!secret) {
133
+ console.warn("[ApiKeyService] Failed to decrypt session secret:", sessionToken.slice(0, 12));
134
+ return null;
135
+ }
136
+ return { key: record, secret };
137
+ }
98
138
  async function deleteSessionApiKey(em, sessionToken) {
99
139
  const record = await em.findOne(ApiKey, { sessionToken, deletedAt: null });
100
140
  if (!record) return;
@@ -125,6 +165,7 @@ export {
125
165
  deleteSessionApiKey,
126
166
  findApiKeyBySecret,
127
167
  findApiKeyBySessionToken,
168
+ findSessionApiKeyWithSecret,
128
169
  generateApiKeySecret,
129
170
  generateSessionToken,
130
171
  hashApiKey,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/modules/api_keys/services/apiKeyService.ts"],
4
- "sourcesContent": ["import { randomBytes } from 'node:crypto'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { hash, compare } from 'bcryptjs'\nimport type { RbacService } from '@open-mercato/core/modules/auth/services/rbacService'\nimport { Role } from '@open-mercato/core/modules/auth/data/entities'\nimport { ApiKey } from '../data/entities'\n\nconst BCRYPT_COST = 10\n\nexport type CreateApiKeyInput = {\n name: string\n description?: string | null\n tenantId?: string | null\n organizationId?: string | null\n roles?: string[]\n expiresAt?: Date | null\n createdBy?: string | null\n}\n\nexport type ApiKeyWithSecret = {\n record: ApiKey\n secret: string\n}\n\nexport function generateApiKeySecret(): { secret: string; prefix: string } {\n const short = randomBytes(4).toString('hex')\n const body = randomBytes(24).toString('hex')\n const secret = `omk_${short}.${body}`\n const prefix = secret.slice(0, 12)\n return { secret, prefix }\n}\n\nexport async function hashApiKey(secret: string): Promise<string> {\n return hash(secret, BCRYPT_COST)\n}\n\nexport async function verifyApiKey(secret: string, keyHash: string): Promise<boolean> {\n return compare(secret, keyHash)\n}\n\nexport async function createApiKey(\n em: EntityManager,\n input: CreateApiKeyInput,\n opts: { rbac?: RbacService } = {},\n): Promise<ApiKeyWithSecret> {\n const { secret, prefix } = generateApiKeySecret()\n const keyHash = await hashApiKey(secret)\n const record = em.create(ApiKey, {\n name: input.name,\n description: input.description ?? null,\n tenantId: input.tenantId ?? null,\n organizationId: input.organizationId ?? null,\n keyHash,\n keyPrefix: prefix,\n rolesJson: Array.isArray(input.roles) ? input.roles : [],\n createdBy: input.createdBy ?? null,\n expiresAt: input.expiresAt ?? null,\n createdAt: new Date(),\n })\n await em.persistAndFlush(record)\n if (opts.rbac) {\n await opts.rbac.invalidateUserCache(`api_key:${record.id}`)\n }\n return { record, secret }\n}\n\nexport async function deleteApiKey(\n em: EntityManager,\n id: string,\n opts: { rbac?: RbacService } = {},\n): Promise<void> {\n const record = await em.findOne(ApiKey, { id })\n if (!record) return\n record.deletedAt = new Date()\n await em.persistAndFlush(record)\n if (opts.rbac) {\n await opts.rbac.invalidateUserCache(`api_key:${record.id}`)\n }\n}\n\nexport async function findApiKeyBySecret(em: EntityManager, secret: string): Promise<ApiKey | null> {\n if (!secret) return null\n // Extract prefix from the secret for fast candidate lookup\n const prefix = secret.slice(0, 12)\n // Find candidates by prefix (fast index lookup)\n const candidates = await em.find(ApiKey, { keyPrefix: prefix, deletedAt: null })\n // Verify each candidate with bcrypt until we find a match\n for (const candidate of candidates) {\n if (candidate.expiresAt && candidate.expiresAt.getTime() < Date.now()) continue\n const isValid = await verifyApiKey(secret, candidate.keyHash)\n if (isValid) return candidate\n }\n return null\n}\n\n// =============================================================================\n// Session-scoped API Keys (for AI Chat ephemeral authorization)\n// =============================================================================\n\nexport type CreateSessionApiKeyInput = {\n sessionToken: string\n userId: string\n userRoles: string[]\n tenantId?: string | null\n organizationId?: string | null\n ttlMinutes?: number\n}\n\n/**\n * Generate a unique session token for ephemeral API keys.\n * Format: sess_{32 hex chars}\n */\nexport function generateSessionToken(): string {\n return `sess_${randomBytes(16).toString('hex')}`\n}\n\n/**\n * Create an ephemeral API key scoped to a chat session.\n * The key inherits the user's roles and expires after ttlMinutes (default 30).\n */\nexport async function createSessionApiKey(\n em: EntityManager,\n input: CreateSessionApiKeyInput\n): Promise<{ keyId: string; secret: string; sessionToken: string }> {\n const { secret, prefix } = generateApiKeySecret()\n const ttl = input.ttlMinutes ?? 30\n const expiresAt = new Date(Date.now() + ttl * 60 * 1000)\n const keyHash = await hashApiKey(secret)\n\n const record = em.create(ApiKey, {\n name: `__session_${input.sessionToken}__`,\n description: 'Ephemeral session API key for AI chat',\n tenantId: input.tenantId ?? null,\n organizationId: input.organizationId ?? null,\n keyHash,\n keyPrefix: prefix,\n rolesJson: input.userRoles,\n createdBy: input.userId,\n sessionToken: input.sessionToken,\n sessionUserId: input.userId,\n expiresAt,\n createdAt: new Date(),\n })\n\n await em.persistAndFlush(record)\n\n return {\n keyId: record.id,\n secret,\n sessionToken: input.sessionToken,\n }\n}\n\n/**\n * Find an API key by its session token.\n * Returns null if not found, expired, or deleted.\n */\nexport async function findApiKeyBySessionToken(\n em: EntityManager,\n sessionToken: string\n): Promise<ApiKey | null> {\n if (!sessionToken) return null\n\n const record = await em.findOne(ApiKey, {\n sessionToken,\n deletedAt: null,\n })\n\n if (!record) return null\n if (record.expiresAt && record.expiresAt.getTime() < Date.now()) return null\n\n return record\n}\n\n/**\n * Delete an ephemeral API key by its session token.\n */\nexport async function deleteSessionApiKey(\n em: EntityManager,\n sessionToken: string\n): Promise<void> {\n const record = await em.findOne(ApiKey, { sessionToken, deletedAt: null })\n if (!record) return\n\n record.deletedAt = new Date()\n await em.persistAndFlush(record)\n}\n\n/**\n * Execute a function with a one-time API key\n *\n * Creates a temporary API key, executes the function, and deletes the key.\n * Perfect for workflow activities that need authenticated access without\n * storing long-lived credentials.\n *\n * @param em - Entity manager\n * @param input - API key configuration\n * @param fn - Function to execute with the API key secret\n * @returns Result of the function\n */\nexport async function withOnetimeApiKey<T>(\n em: EntityManager,\n input: CreateApiKeyInput,\n fn: (secret: string) => Promise<T>\n): Promise<T> {\n const { record, secret } = await createApiKey(em, {\n ...input,\n name: input.name || '__onetime__',\n description: input.description || 'One-time API key',\n })\n\n try {\n // Execute the function with the API key\n const result = await fn(secret)\n return result\n } finally {\n // Always delete the API key, even if the function throws\n try {\n await em.removeAndFlush(record)\n } catch (error) {\n // Log but don't throw - we don't want cleanup errors to mask the original error\n console.error('[withOnetimeApiKey] Failed to delete one-time API key:', error)\n }\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,mBAAmB;AAE5B,SAAS,MAAM,eAAe;AAG9B,SAAS,cAAc;AAEvB,MAAM,cAAc;AAiBb,SAAS,uBAA2D;AACzE,QAAM,QAAQ,YAAY,CAAC,EAAE,SAAS,KAAK;AAC3C,QAAM,OAAO,YAAY,EAAE,EAAE,SAAS,KAAK;AAC3C,QAAM,SAAS,OAAO,KAAK,IAAI,IAAI;AACnC,QAAM,SAAS,OAAO,MAAM,GAAG,EAAE;AACjC,SAAO,EAAE,QAAQ,OAAO;AAC1B;AAEA,eAAsB,WAAW,QAAiC;AAChE,SAAO,KAAK,QAAQ,WAAW;AACjC;AAEA,eAAsB,aAAa,QAAgB,SAAmC;AACpF,SAAO,QAAQ,QAAQ,OAAO;AAChC;AAEA,eAAsB,aACpB,IACA,OACA,OAA+B,CAAC,GACL;AAC3B,QAAM,EAAE,QAAQ,OAAO,IAAI,qBAAqB;AAChD,QAAM,UAAU,MAAM,WAAW,MAAM;AACvC,QAAM,SAAS,GAAG,OAAO,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,QAAQ,OAAO,IAAI,MAAM,aAAa,IAAI;AAAA,IAChD,GAAG;AAAA,IACH,MAAM,MAAM,QAAQ;AAAA,IACpB,aAAa,MAAM,eAAe;AAAA,EACpC,CAAC;AAED,MAAI;AAEF,UAAM,SAAS,MAAM,GAAG,MAAM;AAC9B,WAAO;AAAA,EACT,UAAE;AAEA,QAAI;AACF,YAAM,GAAG,eAAe,MAAM;AAAA,IAChC,SAAS,OAAO;AAEd,cAAQ,MAAM,0DAA0D,KAAK;AAAA,IAC/E;AAAA,EACF;AACF;",
6
- "names": []
4
+ "sourcesContent": ["import { randomBytes } from 'node:crypto'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { hash, compare } from 'bcryptjs'\nimport type { RbacService } from '@open-mercato/core/modules/auth/services/rbacService'\nimport { Role } from '@open-mercato/core/modules/auth/data/entities'\nimport { ApiKey } from '../data/entities'\nimport { createKmsService } from '@open-mercato/shared/lib/encryption/kms'\nimport { encryptWithAesGcm, decryptWithAesGcm } from '@open-mercato/shared/lib/encryption/aes'\n\nconst BCRYPT_COST = 10\n\n// =============================================================================\n// Session Secret Encryption Helpers\n// =============================================================================\n\n/**\n * Encrypt an API key secret for storage.\n * Uses tenant-specific DEK if available, otherwise returns null.\n */\nasync function encryptSessionSecret(\n secret: string,\n tenantId: string | null\n): Promise<string | null> {\n if (!tenantId) return null\n\n const kms = createKmsService()\n if (!kms.isHealthy()) return null\n\n const dek = await kms.getTenantDek(tenantId)\n if (!dek) {\n // Try to create a DEK if one doesn't exist\n const created = await kms.createTenantDek(tenantId)\n if (!created) return null\n const encrypted = encryptWithAesGcm(secret, created.key)\n return encrypted.value\n }\n\n const encrypted = encryptWithAesGcm(secret, dek.key)\n return encrypted.value\n}\n\n/**\n * Decrypt an API key secret from storage.\n * Returns null if decryption fails or no DEK available.\n */\nasync function decryptSessionSecret(\n encrypted: string,\n tenantId: string | null\n): Promise<string | null> {\n if (!tenantId || !encrypted) return null\n\n const kms = createKmsService()\n if (!kms.isHealthy()) return null\n\n const dek = await kms.getTenantDek(tenantId)\n if (!dek) return null\n\n return decryptWithAesGcm(encrypted, dek.key)\n}\n\nexport type CreateApiKeyInput = {\n name: string\n description?: string | null\n tenantId?: string | null\n organizationId?: string | null\n roles?: string[]\n expiresAt?: Date | null\n createdBy?: string | null\n}\n\nexport type ApiKeyWithSecret = {\n record: ApiKey\n secret: string\n}\n\nexport function generateApiKeySecret(): { secret: string; prefix: string } {\n const short = randomBytes(4).toString('hex')\n const body = randomBytes(24).toString('hex')\n const secret = `omk_${short}.${body}`\n const prefix = secret.slice(0, 12)\n return { secret, prefix }\n}\n\nexport async function hashApiKey(secret: string): Promise<string> {\n return hash(secret, BCRYPT_COST)\n}\n\nexport async function verifyApiKey(secret: string, keyHash: string): Promise<boolean> {\n return compare(secret, keyHash)\n}\n\nexport async function createApiKey(\n em: EntityManager,\n input: CreateApiKeyInput,\n opts: { rbac?: RbacService } = {},\n): Promise<ApiKeyWithSecret> {\n const { secret, prefix } = generateApiKeySecret()\n const keyHash = await hashApiKey(secret)\n const record = em.create(ApiKey, {\n name: input.name,\n description: input.description ?? null,\n tenantId: input.tenantId ?? null,\n organizationId: input.organizationId ?? null,\n keyHash,\n keyPrefix: prefix,\n rolesJson: Array.isArray(input.roles) ? input.roles : [],\n createdBy: input.createdBy ?? null,\n expiresAt: input.expiresAt ?? null,\n createdAt: new Date(),\n })\n await em.persistAndFlush(record)\n if (opts.rbac) {\n await opts.rbac.invalidateUserCache(`api_key:${record.id}`)\n }\n return { record, secret }\n}\n\nexport async function deleteApiKey(\n em: EntityManager,\n id: string,\n opts: { rbac?: RbacService } = {},\n): Promise<void> {\n const record = await em.findOne(ApiKey, { id })\n if (!record) return\n record.deletedAt = new Date()\n await em.persistAndFlush(record)\n if (opts.rbac) {\n await opts.rbac.invalidateUserCache(`api_key:${record.id}`)\n }\n}\n\nexport async function findApiKeyBySecret(em: EntityManager, secret: string): Promise<ApiKey | null> {\n if (!secret) return null\n // Extract prefix from the secret for fast candidate lookup\n const prefix = secret.slice(0, 12)\n // Find candidates by prefix (fast index lookup)\n const candidates = await em.find(ApiKey, { keyPrefix: prefix, deletedAt: null })\n // Verify each candidate with bcrypt until we find a match\n for (const candidate of candidates) {\n if (candidate.expiresAt && candidate.expiresAt.getTime() < Date.now()) continue\n const isValid = await verifyApiKey(secret, candidate.keyHash)\n if (isValid) return candidate\n }\n return null\n}\n\n// =============================================================================\n// Session-scoped API Keys (for AI Chat ephemeral authorization)\n// =============================================================================\n\nexport type CreateSessionApiKeyInput = {\n sessionToken: string\n userId: string\n userRoles: string[]\n tenantId?: string | null\n organizationId?: string | null\n ttlMinutes?: number\n}\n\n/**\n * Generate a unique session token for ephemeral API keys.\n * Format: sess_{32 hex chars}\n */\nexport function generateSessionToken(): string {\n return `sess_${randomBytes(16).toString('hex')}`\n}\n\n/**\n * Create an ephemeral API key scoped to a chat session.\n * The key inherits the user's roles and expires after ttlMinutes (default 30).\n * The API key secret is encrypted and stored so it can be recovered for API calls.\n */\nexport async function createSessionApiKey(\n em: EntityManager,\n input: CreateSessionApiKeyInput\n): Promise<{ keyId: string; secret: string; sessionToken: string }> {\n const { secret, prefix } = generateApiKeySecret()\n const ttl = input.ttlMinutes ?? 30\n const expiresAt = new Date(Date.now() + ttl * 60 * 1000)\n const keyHash = await hashApiKey(secret)\n\n // Encrypt the secret for later retrieval (used by MCP server for API calls)\n const encryptedSecret = await encryptSessionSecret(secret, input.tenantId ?? null)\n\n const record = em.create(ApiKey, {\n name: `__session_${input.sessionToken}__`,\n description: 'Ephemeral session API key for AI chat',\n tenantId: input.tenantId ?? null,\n organizationId: input.organizationId ?? null,\n keyHash,\n keyPrefix: prefix,\n rolesJson: input.userRoles,\n createdBy: input.userId,\n sessionToken: input.sessionToken,\n sessionUserId: input.userId,\n sessionSecretEncrypted: encryptedSecret,\n expiresAt,\n createdAt: new Date(),\n })\n\n await em.persistAndFlush(record)\n\n return {\n keyId: record.id,\n secret,\n sessionToken: input.sessionToken,\n }\n}\n\n/**\n * Find an API key by its session token.\n * Returns null if not found, expired, or deleted.\n */\nexport async function findApiKeyBySessionToken(\n em: EntityManager,\n sessionToken: string\n): Promise<ApiKey | null> {\n if (!sessionToken) return null\n\n const record = await em.findOne(ApiKey, {\n sessionToken,\n deletedAt: null,\n })\n\n if (!record) return null\n if (record.expiresAt && record.expiresAt.getTime() < Date.now()) return null\n\n return record\n}\n\n/**\n * Find a session API key with its decrypted secret.\n * Returns null if not found, expired, deleted, or decryption fails.\n * This is used by the MCP server to recover the API key secret for making\n * authenticated API calls on behalf of the user.\n */\nexport async function findSessionApiKeyWithSecret(\n em: EntityManager,\n sessionToken: string\n): Promise<{ key: ApiKey; secret: string } | null> {\n const record = await findApiKeyBySessionToken(em, sessionToken)\n if (!record) return null\n\n // If no encrypted secret stored, cannot recover\n if (!record.sessionSecretEncrypted) {\n console.warn('[ApiKeyService] Session key has no encrypted secret:', sessionToken.slice(0, 12))\n return null\n }\n\n // Decrypt the secret\n const secret = await decryptSessionSecret(record.sessionSecretEncrypted, record.tenantId ?? null)\n if (!secret) {\n console.warn('[ApiKeyService] Failed to decrypt session secret:', sessionToken.slice(0, 12))\n return null\n }\n\n return { key: record, secret }\n}\n\n/**\n * Delete an ephemeral API key by its session token.\n */\nexport async function deleteSessionApiKey(\n em: EntityManager,\n sessionToken: string\n): Promise<void> {\n const record = await em.findOne(ApiKey, { sessionToken, deletedAt: null })\n if (!record) return\n\n record.deletedAt = new Date()\n await em.persistAndFlush(record)\n}\n\n/**\n * Execute a function with a one-time API key\n *\n * Creates a temporary API key, executes the function, and deletes the key.\n * Perfect for workflow activities that need authenticated access without\n * storing long-lived credentials.\n *\n * @param em - Entity manager\n * @param input - API key configuration\n * @param fn - Function to execute with the API key secret\n * @returns Result of the function\n */\nexport async function withOnetimeApiKey<T>(\n em: EntityManager,\n input: CreateApiKeyInput,\n fn: (secret: string) => Promise<T>\n): Promise<T> {\n const { record, secret } = await createApiKey(em, {\n ...input,\n name: input.name || '__onetime__',\n description: input.description || 'One-time API key',\n })\n\n try {\n // Execute the function with the API key\n const result = await fn(secret)\n return result\n } finally {\n // Always delete the API key, even if the function throws\n try {\n await em.removeAndFlush(record)\n } catch (error) {\n // Log but don't throw - we don't want cleanup errors to mask the original error\n console.error('[withOnetimeApiKey] Failed to delete one-time API key:', error)\n }\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,mBAAmB;AAE5B,SAAS,MAAM,eAAe;AAG9B,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,mBAAmB,yBAAyB;AAErD,MAAM,cAAc;AAUpB,eAAe,qBACb,QACA,UACwB;AACxB,MAAI,CAAC,SAAU,QAAO;AAEtB,QAAM,MAAM,iBAAiB;AAC7B,MAAI,CAAC,IAAI,UAAU,EAAG,QAAO;AAE7B,QAAM,MAAM,MAAM,IAAI,aAAa,QAAQ;AAC3C,MAAI,CAAC,KAAK;AAER,UAAM,UAAU,MAAM,IAAI,gBAAgB,QAAQ;AAClD,QAAI,CAAC,QAAS,QAAO;AACrB,UAAMA,aAAY,kBAAkB,QAAQ,QAAQ,GAAG;AACvD,WAAOA,WAAU;AAAA,EACnB;AAEA,QAAM,YAAY,kBAAkB,QAAQ,IAAI,GAAG;AACnD,SAAO,UAAU;AACnB;AAMA,eAAe,qBACb,WACA,UACwB;AACxB,MAAI,CAAC,YAAY,CAAC,UAAW,QAAO;AAEpC,QAAM,MAAM,iBAAiB;AAC7B,MAAI,CAAC,IAAI,UAAU,EAAG,QAAO;AAE7B,QAAM,MAAM,MAAM,IAAI,aAAa,QAAQ;AAC3C,MAAI,CAAC,IAAK,QAAO;AAEjB,SAAO,kBAAkB,WAAW,IAAI,GAAG;AAC7C;AAiBO,SAAS,uBAA2D;AACzE,QAAM,QAAQ,YAAY,CAAC,EAAE,SAAS,KAAK;AAC3C,QAAM,OAAO,YAAY,EAAE,EAAE,SAAS,KAAK;AAC3C,QAAM,SAAS,OAAO,KAAK,IAAI,IAAI;AACnC,QAAM,SAAS,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encrypted"]
7
7
  }
@@ -0,0 +1,30 @@
1
+ import { createModuleEvents } from "@open-mercato/shared/modules/events";
2
+ const events = [
3
+ // Users
4
+ { id: "auth.users.created", label: "User Created", entity: "users", category: "crud" },
5
+ { id: "auth.users.updated", label: "User Updated", entity: "users", category: "crud" },
6
+ { id: "auth.users.deleted", label: "User Deleted", entity: "users", category: "crud" },
7
+ // Roles
8
+ { id: "auth.roles.created", label: "Role Created", entity: "roles", category: "crud" },
9
+ { id: "auth.roles.updated", label: "Role Updated", entity: "roles", category: "crud" },
10
+ { id: "auth.roles.deleted", label: "Role Deleted", entity: "roles", category: "crud" },
11
+ // Authentication events
12
+ { id: "auth.login.success", label: "Login Successful", category: "lifecycle" },
13
+ { id: "auth.login.failed", label: "Login Failed", category: "lifecycle" },
14
+ { id: "auth.logout", label: "User Logged Out", category: "lifecycle" },
15
+ { id: "auth.password.changed", label: "Password Changed", category: "lifecycle" },
16
+ { id: "auth.password.reset.requested", label: "Password Reset Requested", category: "lifecycle" },
17
+ { id: "auth.password.reset.completed", label: "Password Reset Completed", category: "lifecycle" }
18
+ ];
19
+ const eventsConfig = createModuleEvents({
20
+ moduleId: "auth",
21
+ events
22
+ });
23
+ const emitAuthEvent = eventsConfig.emit;
24
+ var events_default = eventsConfig;
25
+ export {
26
+ events_default as default,
27
+ emitAuthEvent,
28
+ eventsConfig
29
+ };
30
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/modules/auth/events.ts"],
4
+ "sourcesContent": ["import { createModuleEvents } from '@open-mercato/shared/modules/events'\n\n/**\n * Auth Module Events\n *\n * Declares all events that can be emitted by the auth module.\n */\nconst events = [\n // Users\n { id: 'auth.users.created', label: 'User Created', entity: 'users', category: 'crud' },\n { id: 'auth.users.updated', label: 'User Updated', entity: 'users', category: 'crud' },\n { id: 'auth.users.deleted', label: 'User Deleted', entity: 'users', category: 'crud' },\n\n // Roles\n { id: 'auth.roles.created', label: 'Role Created', entity: 'roles', category: 'crud' },\n { id: 'auth.roles.updated', label: 'Role Updated', entity: 'roles', category: 'crud' },\n { id: 'auth.roles.deleted', label: 'Role Deleted', entity: 'roles', category: 'crud' },\n\n // Authentication events\n { id: 'auth.login.success', label: 'Login Successful', category: 'lifecycle' },\n { id: 'auth.login.failed', label: 'Login Failed', category: 'lifecycle' },\n { id: 'auth.logout', label: 'User Logged Out', category: 'lifecycle' },\n { id: 'auth.password.changed', label: 'Password Changed', category: 'lifecycle' },\n { id: 'auth.password.reset.requested', label: 'Password Reset Requested', category: 'lifecycle' },\n { id: 'auth.password.reset.completed', label: 'Password Reset Completed', category: 'lifecycle' },\n] as const\n\nexport const eventsConfig = createModuleEvents({\n moduleId: 'auth',\n events,\n})\n\n/** Type-safe event emitter for auth module */\nexport const emitAuthEvent = eventsConfig.emit\n\n/** Event IDs that can be emitted by the auth module */\nexport type AuthEventId = typeof events[number]['id']\n\nexport default eventsConfig\n"],
5
+ "mappings": "AAAA,SAAS,0BAA0B;AAOnC,MAAM,SAAS;AAAA;AAAA,EAEb,EAAE,IAAI,sBAAsB,OAAO,gBAAgB,QAAQ,SAAS,UAAU,OAAO;AAAA,EACrF,EAAE,IAAI,sBAAsB,OAAO,gBAAgB,QAAQ,SAAS,UAAU,OAAO;AAAA,EACrF,EAAE,IAAI,sBAAsB,OAAO,gBAAgB,QAAQ,SAAS,UAAU,OAAO;AAAA;AAAA,EAGrF,EAAE,IAAI,sBAAsB,OAAO,gBAAgB,QAAQ,SAAS,UAAU,OAAO;AAAA,EACrF,EAAE,IAAI,sBAAsB,OAAO,gBAAgB,QAAQ,SAAS,UAAU,OAAO;AAAA,EACrF,EAAE,IAAI,sBAAsB,OAAO,gBAAgB,QAAQ,SAAS,UAAU,OAAO;AAAA;AAAA,EAGrF,EAAE,IAAI,sBAAsB,OAAO,oBAAoB,UAAU,YAAY;AAAA,EAC7E,EAAE,IAAI,qBAAqB,OAAO,gBAAgB,UAAU,YAAY;AAAA,EACxE,EAAE,IAAI,eAAe,OAAO,mBAAmB,UAAU,YAAY;AAAA,EACrE,EAAE,IAAI,yBAAyB,OAAO,oBAAoB,UAAU,YAAY;AAAA,EAChF,EAAE,IAAI,iCAAiC,OAAO,4BAA4B,UAAU,YAAY;AAAA,EAChG,EAAE,IAAI,iCAAiC,OAAO,4BAA4B,UAAU,YAAY;AAClG;AAEO,MAAM,eAAe,mBAAmB;AAAA,EAC7C,UAAU;AAAA,EACV;AACF,CAAC;AAGM,MAAM,gBAAgB,aAAa;AAK1C,IAAO,iBAAQ;",
6
+ "names": []
7
+ }