@hartl-services/medusa-base 0.4.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/.medusa/server/src/admin/index.js +1657 -111
  2. package/.medusa/server/src/admin/index.mjs +1647 -101
  3. package/.medusa/server/src/api/admin/email/messages/[id]/resends/route.js +24 -0
  4. package/.medusa/server/src/api/admin/email/messages/[id]/route.js +12 -0
  5. package/.medusa/server/src/api/admin/email/messages/route.js +12 -0
  6. package/.medusa/server/src/api/admin/email/terms-versions/[id]/download/route.js +16 -0
  7. package/.medusa/server/src/api/admin/email/terms-versions/route.js +47 -0
  8. package/.medusa/server/src/api/admin/orders/[id]/documents/[document_id]/download/route.js +21 -0
  9. package/.medusa/server/src/api/admin/orders/[id]/documents/[document_id]/regenerate/route.js +38 -0
  10. package/.medusa/server/src/api/admin/orders/[id]/documents/regenerate/route.js +32 -0
  11. package/.medusa/server/src/api/admin/orders/[id]/documents/route.js +36 -0
  12. package/.medusa/server/src/api/admin/orders/[id]/packing-lists/[fulfillment_id]/download/route.js +24 -0
  13. package/.medusa/server/src/api/admin/orders/[id]/packing-lists/[fulfillment_id]/retry/route.js +44 -0
  14. package/.medusa/server/src/api/admin/orders/[id]/packing-lists/route.js +82 -0
  15. package/.medusa/server/src/api/document-download-response.js +16 -0
  16. package/.medusa/server/src/api/document-response.js +23 -0
  17. package/.medusa/server/src/api/files/[asset]/route.js +24 -0
  18. package/.medusa/server/src/api/files/file-response.js +43 -0
  19. package/.medusa/server/src/api/files/gateway-options.js +31 -0
  20. package/.medusa/server/src/api/files/private/[token]/route.js +29 -0
  21. package/.medusa/server/src/api/files/upload/[token]/route.js +66 -0
  22. package/.medusa/server/src/api/middlewares.js +168 -1
  23. package/.medusa/server/src/api/packing-list-response.js +22 -0
  24. package/.medusa/server/src/api/route.js +27 -0
  25. package/.medusa/server/src/api/store/documents/[id]/download/route.js +21 -0
  26. package/.medusa/server/src/api/store/documents/[id]/route.js +15 -0
  27. package/.medusa/server/src/api/store/documents/route.js +11 -0
  28. package/.medusa/server/src/api/terms-download-response.js +12 -0
  29. package/.medusa/server/src/documents/config/index.js +18 -0
  30. package/.medusa/server/src/documents/paths/documents.js +6 -0
  31. package/.medusa/server/src/documents/paths/index.js +18 -0
  32. package/.medusa/server/src/documents/plugin-features.js +38 -0
  33. package/.medusa/server/src/documents/schemas/documents.js +18 -0
  34. package/.medusa/server/src/documents/schemas/index.js +18 -0
  35. package/.medusa/server/src/documents/scripts/verify-documents-file-storage.js +55 -0
  36. package/.medusa/server/src/documents/templates/financial-document.js +160 -0
  37. package/.medusa/server/src/documents/templates/format.js +73 -0
  38. package/.medusa/server/src/documents/templates/html-factory.js +42 -0
  39. package/.medusa/server/src/documents/templates/html-utils.js +23 -0
  40. package/.medusa/server/src/documents/templates/layout.js +142 -0
  41. package/.medusa/server/src/documents/templates/packing-list.js +52 -0
  42. package/.medusa/server/src/documents/types/admin-api.js +3 -0
  43. package/.medusa/server/src/documents/types/document-summary.js +3 -0
  44. package/.medusa/server/src/documents/types/documents.js +3 -0
  45. package/.medusa/server/src/documents/types/html-factory.js +6 -0
  46. package/.medusa/server/src/documents/types/index.js +22 -0
  47. package/.medusa/server/src/documents/types/store-api.js +3 -0
  48. package/.medusa/server/src/documents/utils/document-merchant.js +22 -0
  49. package/.medusa/server/src/documents/utils/document-render-settings.js +59 -0
  50. package/.medusa/server/src/documents/utils/html-to-pdf.js +61 -0
  51. package/.medusa/server/src/documents/utils/private-file-storage.js +64 -0
  52. package/.medusa/server/src/documents/utils/resolve-services.js +7 -0
  53. package/.medusa/server/src/email/application/handle-invite-event.js +318 -0
  54. package/.medusa/server/src/email/application/handle-password-reset-event.js +366 -0
  55. package/.medusa/server/src/email/config/index.js +84 -0
  56. package/.medusa/server/src/email/config/notification-module.js +20 -0
  57. package/.medusa/server/src/email/domain/business-keys.js +50 -0
  58. package/.medusa/server/src/email/domain/documents-fact-fingerprint.js +7 -0
  59. package/.medusa/server/src/email/domain/event-schemas.js +36 -0
  60. package/.medusa/server/src/email/domain/failure-classification.js +53 -0
  61. package/.medusa/server/src/email/domain/order-summary.js +103 -0
  62. package/.medusa/server/src/email/domain/refund-summary.js +43 -0
  63. package/.medusa/server/src/email/domain/return-summary.js +118 -0
  64. package/.medusa/server/src/email/domain/shipment-summary.js +74 -0
  65. package/.medusa/server/src/email/plugin-features.js +39 -0
  66. package/.medusa/server/src/email/rendering/default-templates.js +719 -0
  67. package/.medusa/server/src/email/rendering/load-email-shop-details.js +36 -0
  68. package/.medusa/server/src/email/rendering/render-email.js +50 -0
  69. package/.medusa/server/src/email/rendering/resolve-shop-configuration.js +67 -0
  70. package/.medusa/server/src/email/types/email-kinds.js +18 -0
  71. package/.medusa/server/src/email/types/index.js +21 -0
  72. package/.medusa/server/src/email/types/shop-configuration.js +3 -0
  73. package/.medusa/server/src/email/types/smtp-configuration.js +3 -0
  74. package/.medusa/server/src/email/types/template-data.js +232 -0
  75. package/.medusa/server/src/files/config/index.js +256 -0
  76. package/.medusa/server/src/files/gateway/index.js +115 -0
  77. package/.medusa/server/src/files/types/index.js +6 -0
  78. package/.medusa/server/src/files/types/public.js +6 -0
  79. package/.medusa/server/src/jobs/document-fact-publication-reconciliation.js +18 -0
  80. package/.medusa/server/src/jobs/document-resolution-reconciliation.js +20 -0
  81. package/.medusa/server/src/jobs/packing-list-reconciliation.js +49 -0
  82. package/.medusa/server/src/jobs/reconcile-email-attempts.js +63 -0
  83. package/.medusa/server/src/jobs/reconcile-pending-email-messages.js +41 -0
  84. package/.medusa/server/src/jobs/retry-email-messages.js +27 -0
  85. package/.medusa/server/src/migration-scripts/dismiss-orphaned-cart-promotion-links.js +26 -0
  86. package/.medusa/server/src/modules/documents/domain/cancellation-snapshot.js +97 -0
  87. package/.medusa/server/src/modules/documents/domain/document-number.js +36 -0
  88. package/.medusa/server/src/modules/documents/domain/document-resolution.js +24 -0
  89. package/.medusa/server/src/modules/documents/domain/issuance-rules.js +37 -0
  90. package/.medusa/server/src/modules/documents/domain/merchant.js +86 -0
  91. package/.medusa/server/src/modules/documents/domain/options.js +40 -0
  92. package/.medusa/server/src/modules/documents/domain/packing-list.js +90 -0
  93. package/.medusa/server/src/modules/documents/domain/snapshot-normalization.js +17 -0
  94. package/.medusa/server/src/modules/documents/domain/tax-breakdown.js +66 -0
  95. package/.medusa/server/src/modules/documents/index.js +15 -0
  96. package/.medusa/server/src/modules/documents/loaders/assert-private-file-storage.js +20 -0
  97. package/.medusa/server/src/modules/documents/migrations/Migration20260827061749.js +75 -0
  98. package/.medusa/server/src/modules/documents/migrations/Migration20260830111207.js +28 -0
  99. package/.medusa/server/src/modules/documents/models/document-artifact.js +25 -0
  100. package/.medusa/server/src/modules/documents/models/document-number-sequence.js +29 -0
  101. package/.medusa/server/src/modules/documents/models/document.js +82 -0
  102. package/.medusa/server/src/modules/documents/models/order-cancellation-resolution.js +51 -0
  103. package/.medusa/server/src/modules/documents/models/packing-list-revision.js +36 -0
  104. package/.medusa/server/src/modules/documents/models/packing-list.js +27 -0
  105. package/.medusa/server/src/modules/documents/models/refund-document-resolution.js +66 -0
  106. package/.medusa/server/src/modules/documents/models/shipment-invoice-assignment.js +51 -0
  107. package/.medusa/server/src/modules/documents/models/shipment-invoice-coordinator.js +44 -0
  108. package/.medusa/server/src/modules/documents/service.js +1701 -0
  109. package/.medusa/server/src/modules/email/domain/attachment.js +25 -0
  110. package/.medusa/server/src/modules/email/domain/message-state.js +69 -0
  111. package/.medusa/server/src/modules/email/index.js +13 -0
  112. package/.medusa/server/src/modules/email/migrations/Migration20260826173422.js +32 -0
  113. package/.medusa/server/src/modules/email/migrations/Migration20260827172945.js +16 -0
  114. package/.medusa/server/src/modules/email/migrations/Migration20260827194804.js +22 -0
  115. package/.medusa/server/src/modules/email/migrations/Migration20260906195205.js +16 -0
  116. package/.medusa/server/src/modules/email/models/email-attempt.js +56 -0
  117. package/.medusa/server/src/modules/email/models/email-message.js +71 -0
  118. package/.medusa/server/src/modules/email/models/email-terms-version.js +37 -0
  119. package/.medusa/server/src/modules/email/service.js +1285 -0
  120. package/.medusa/server/src/modules/plugin-features/domain/plugin-settings.js +4 -3
  121. package/.medusa/server/src/providers/s3-cache/cache/atomic-write.js +25 -0
  122. package/.medusa/server/src/providers/s3-cache/cache/cache-manager.js +115 -0
  123. package/.medusa/server/src/providers/s3-cache/cache/keyed-lock.js +28 -0
  124. package/.medusa/server/src/providers/s3-cache/index.js +8 -0
  125. package/.medusa/server/src/providers/s3-cache/object-key.js +53 -0
  126. package/.medusa/server/src/providers/s3-cache/s3-cache-file.js +229 -0
  127. package/.medusa/server/src/providers/s3-cache/s3-object-store.js +86 -0
  128. package/.medusa/server/src/providers/smtp/index.js +8 -0
  129. package/.medusa/server/src/providers/smtp/service.js +236 -0
  130. package/.medusa/server/src/providers/smtp/types.js +11 -0
  131. package/.medusa/server/src/public/config.js +186 -0
  132. package/.medusa/server/src/public/descriptor.js +3 -1
  133. package/.medusa/server/src/public/gateway.js +19 -0
  134. package/.medusa/server/src/public/instrumentation.js +56 -0
  135. package/.medusa/server/src/public/shop-config.js +12 -0
  136. package/.medusa/server/src/public/shop-master-data.js +2 -2
  137. package/.medusa/server/src/public/shop-types.js +24 -0
  138. package/.medusa/server/src/shop-config/build-food-shop-config.js +252 -0
  139. package/.medusa/server/src/shop-config/options.js +75 -0
  140. package/.medusa/server/src/subscribers/affiliate-consignment-reminder-due.js +26 -0
  141. package/.medusa/server/src/subscribers/documents-order-canceled.js +24 -0
  142. package/.medusa/server/src/subscribers/documents-order-cancellation-ready.js +26 -0
  143. package/.medusa/server/src/subscribers/documents-refund-ready.js +24 -0
  144. package/.medusa/server/src/subscribers/documents-shipment-created.js +36 -0
  145. package/.medusa/server/src/subscribers/documents-shipment-invoice-assignment-decided.js +26 -0
  146. package/.medusa/server/src/subscribers/email-order-canceled.js +28 -0
  147. package/.medusa/server/src/subscribers/email-shipment-created.js +32 -0
  148. package/.medusa/server/src/subscribers/order-placed.js +27 -0
  149. package/.medusa/server/src/subscribers/packing-list-allocation-revised.js +32 -0
  150. package/.medusa/server/src/subscribers/packing-list-fulfillment-canceled.js +54 -0
  151. package/.medusa/server/src/subscribers/packing-list-fulfillment-created.js +31 -0
  152. package/.medusa/server/src/subscribers/password-reset.js +23 -0
  153. package/.medusa/server/src/subscribers/payment-refunded.js +38 -0
  154. package/.medusa/server/src/subscribers/return-received.js +27 -0
  155. package/.medusa/server/src/subscribers/return-requested.js +27 -0
  156. package/.medusa/server/src/subscribers/user-invite.js +23 -0
  157. package/.medusa/server/src/utils/cart-promotion-links.js +101 -0
  158. package/.medusa/server/src/workflows/documents/issue-cancellation-after-refund.js +246 -0
  159. package/.medusa/server/src/workflows/documents/issue-document.js +165 -0
  160. package/.medusa/server/src/workflows/documents/issue-invoice-after-shipment.js +521 -0
  161. package/.medusa/server/src/workflows/documents/issue-packing-list.js +390 -0
  162. package/.medusa/server/src/workflows/documents/publish-document-facts.js +53 -0
  163. package/.medusa/server/src/workflows/documents/reconcile-document-resolutions.js +48 -0
  164. package/.medusa/server/src/workflows/documents/reconcile-order-cancellation.js +92 -0
  165. package/.medusa/server/src/workflows/documents/regenerate-issued-document.js +61 -0
  166. package/.medusa/server/src/workflows/email/dispatch-email-message.js +301 -0
  167. package/.medusa/server/src/workflows/email/documents-required-facts.js +30 -0
  168. package/.medusa/server/src/workflows/email/prepare-affiliate-reminder-email.js +58 -0
  169. package/.medusa/server/src/workflows/email/prepare-order-canceled-email.js +102 -0
  170. package/.medusa/server/src/workflows/email/prepare-order-received-email.js +82 -0
  171. package/.medusa/server/src/workflows/email/prepare-refund-email.js +71 -0
  172. package/.medusa/server/src/workflows/email/prepare-return-email.js +136 -0
  173. package/.medusa/server/src/workflows/email/prepare-shipment-email.js +115 -0
  174. package/.medusa/server/src/workflows/email/retry-email-messages.js +31 -0
  175. package/.medusa/server/src/workflows/hooks/dismiss-deleted-promotion-cart-links.js +23 -0
  176. package/README.md +1777 -8
  177. package/dist/admin-components/features/plugin-features/components/ImageSettingInput.d.ts +15 -0
  178. package/dist/admin-components/features/plugin-features/components/ImageSettingInput.js +42 -0
  179. package/dist/admin-components/features/plugin-features/components/PluginSettingsForm.js +4 -2
  180. package/dist/admin-components/features/plugin-features/hooks/usePluginFeatureEnabled.d.ts +1 -1
  181. package/dist/admin-components/features/plugin-features/hooks/usePluginFeatures.d.ts +4 -4
  182. package/dist/admin-components/features/plugin-features/hooks/usePluginSettingsForm.d.ts +1 -1
  183. package/dist/admin-components/features/plugin-features/lib/image-upload.d.ts +6 -0
  184. package/dist/admin-components/features/plugin-features/lib/image-upload.js +17 -0
  185. package/dist/admin-components/features/plugin-features/lib/plugin-features-admin-client.d.ts +4 -4
  186. package/dist/admin-components/i18n/texts.d.ts +6 -0
  187. package/dist/admin-components/i18n/texts.js +6 -0
  188. package/dist/documents/config/index.d.ts +11 -0
  189. package/dist/documents/config/index.js +17 -0
  190. package/dist/documents/templates/financial-document.d.ts +3 -0
  191. package/dist/documents/templates/financial-document.js +159 -0
  192. package/dist/documents/templates/format.d.ts +30 -0
  193. package/dist/documents/templates/format.js +72 -0
  194. package/dist/documents/templates/html-factory.d.ts +15 -0
  195. package/dist/documents/templates/html-factory.js +41 -0
  196. package/dist/documents/templates/html-utils.d.ts +8 -0
  197. package/dist/documents/templates/html-utils.js +22 -0
  198. package/dist/documents/templates/layout.d.ts +35 -0
  199. package/dist/documents/templates/layout.js +141 -0
  200. package/dist/documents/templates/packing-list.d.ts +3 -0
  201. package/dist/documents/templates/packing-list.js +51 -0
  202. package/dist/documents/types/admin-api.d.ts +1 -0
  203. package/dist/documents/types/admin-api.js +2 -0
  204. package/dist/documents/types/document-summary.d.ts +1 -0
  205. package/dist/documents/types/document-summary.js +2 -0
  206. package/dist/documents/types/documents.d.ts +191 -0
  207. package/dist/documents/types/documents.js +2 -0
  208. package/dist/documents/types/html-factory.d.ts +8 -0
  209. package/dist/documents/types/html-factory.js +5 -0
  210. package/dist/documents/types/index.d.ts +5 -0
  211. package/dist/documents/types/index.js +21 -0
  212. package/dist/documents/types/store-api.d.ts +1 -0
  213. package/dist/documents/types/store-api.js +2 -0
  214. package/dist/email/config/index.d.ts +17 -0
  215. package/dist/email/config/index.js +83 -0
  216. package/dist/email/config/notification-module.d.ts +22 -0
  217. package/dist/email/config/notification-module.js +19 -0
  218. package/dist/email/types/email-kinds.d.ts +15 -0
  219. package/dist/email/types/email-kinds.js +17 -0
  220. package/dist/email/types/index.d.ts +4 -0
  221. package/dist/email/types/index.js +20 -0
  222. package/dist/email/types/shop-configuration.d.ts +68 -0
  223. package/dist/email/types/shop-configuration.js +2 -0
  224. package/dist/email/types/smtp-configuration.d.ts +9 -0
  225. package/dist/email/types/smtp-configuration.js +2 -0
  226. package/dist/email/types/template-data.d.ts +609 -0
  227. package/dist/email/types/template-data.js +231 -0
  228. package/dist/files/config/index.d.ts +32 -0
  229. package/dist/files/config/index.js +255 -0
  230. package/dist/files/gateway/index.d.ts +30 -0
  231. package/dist/files/gateway/index.js +114 -0
  232. package/dist/files/types/index.d.ts +2 -0
  233. package/dist/files/types/index.js +5 -0
  234. package/dist/files/types/public.d.ts +90 -0
  235. package/dist/files/types/public.js +5 -0
  236. package/dist/modules/documents/domain/merchant.d.ts +22 -0
  237. package/dist/modules/documents/domain/merchant.js +85 -0
  238. package/dist/modules/documents/domain/options.d.ts +34 -0
  239. package/dist/modules/documents/domain/options.js +39 -0
  240. package/dist/public/config.d.ts +59 -0
  241. package/dist/public/config.js +185 -0
  242. package/dist/public/descriptor.js +2 -0
  243. package/dist/public/gateway.d.ts +2 -0
  244. package/dist/public/gateway.js +18 -0
  245. package/dist/public/instrumentation.d.ts +12 -0
  246. package/dist/public/instrumentation.js +55 -0
  247. package/dist/public/shop-config.d.ts +8 -0
  248. package/dist/public/shop-config.js +11 -0
  249. package/dist/public/shop-master-data.d.ts +1 -1
  250. package/dist/public/shop-master-data.js +1 -1
  251. package/dist/public/shop-types.d.ts +7 -0
  252. package/dist/public/shop-types.js +23 -0
  253. package/dist/public/types.d.ts +19 -2
  254. package/dist/shop-config/build-food-shop-config.d.ts +44 -0
  255. package/dist/shop-config/build-food-shop-config.js +251 -0
  256. package/dist/shop-config/options.d.ts +48 -0
  257. package/dist/shop-config/options.js +74 -0
  258. package/package.json +48 -5
@@ -0,0 +1,90 @@
1
+ export type CacheExpirationStrategy = "absolute" | "sliding";
2
+ export interface S3CacheCredentials {
3
+ accessKeyId?: string;
4
+ secretAccessKey?: string;
5
+ sessionToken?: string;
6
+ }
7
+ export interface S3CacheOptions {
8
+ bucket?: string;
9
+ credentials?: S3CacheCredentials;
10
+ endpoint?: string;
11
+ forcePathStyle?: boolean;
12
+ region?: string;
13
+ storagePrefix?: string;
14
+ }
15
+ export interface FileGatewayOptions {
16
+ baseUrl?: string;
17
+ privateDownloadDurationSeconds?: number;
18
+ signingSecret?: string;
19
+ }
20
+ export interface S3CacheOptionsCache {
21
+ cleanupIntervalMs?: number;
22
+ dir?: string;
23
+ expirationStrategy?: CacheExpirationStrategy;
24
+ ttlMs?: number;
25
+ }
26
+ export interface LocalFileProviderOptions {
27
+ backendUrl?: string;
28
+ privateUploadDir?: string;
29
+ uploadDir?: string;
30
+ }
31
+ export interface S3CacheFileModuleConfigOptions {
32
+ cache?: S3CacheOptionsCache;
33
+ enabled?: boolean;
34
+ gateway?: FileGatewayOptions;
35
+ local?: LocalFileProviderOptions;
36
+ s3?: S3CacheOptions;
37
+ }
38
+ export interface FileModuleProviderConfiguration {
39
+ id: string;
40
+ options: Record<string, unknown>;
41
+ resolve: string;
42
+ }
43
+ export interface FileModuleConfiguration {
44
+ options: {
45
+ providers: FileModuleProviderConfiguration[];
46
+ };
47
+ resolve: "@medusajs/medusa/file";
48
+ }
49
+ export interface ValidatedS3CacheCredentials {
50
+ accessKeyId: string;
51
+ secretAccessKey: string;
52
+ sessionToken?: string;
53
+ }
54
+ export interface ValidatedS3CacheOptions {
55
+ bucket: string;
56
+ credentials?: ValidatedS3CacheCredentials;
57
+ endpoint?: string;
58
+ forcePathStyle: boolean;
59
+ region: string;
60
+ storagePrefix: string;
61
+ }
62
+ export interface ValidatedFileGatewayOptions {
63
+ baseUrl: string;
64
+ privateDownloadDurationSeconds: number;
65
+ signingSecret: string;
66
+ }
67
+ export interface ValidatedS3CacheProviderOptions {
68
+ cache: Required<S3CacheOptionsCache>;
69
+ gateway: ValidatedFileGatewayOptions;
70
+ s3: ValidatedS3CacheOptions;
71
+ }
72
+ /** Package name under which the gateway routes read the `files` options. */
73
+ export declare const BASE_PLUGIN_RESOLVE = "@hartl-services/medusa-base";
74
+ /**
75
+ * The `files` namespace of the base plugin options: what the `/files` gateway
76
+ * routes sign and verify with. `createS3CacheStorageConfig` returns it from the
77
+ * same validated input as the File Module provider, so every URL the provider
78
+ * signs is one the routes accept.
79
+ */
80
+ export type FilesPluginOptions = {
81
+ gateway: {
82
+ signingSecret: string;
83
+ };
84
+ };
85
+ export interface S3CacheStorageConfiguration {
86
+ /** Register under `modules`: the File Module with this S3 provider. */
87
+ fileModule: FileModuleConfiguration;
88
+ /** Set as `files.gateway` in the options of the base plugin. */
89
+ gateway: FilesPluginOptions["gateway"];
90
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BASE_PLUGIN_RESOLVE = void 0;
4
+ /** Package name under which the gateway routes read the `files` options. */
5
+ exports.BASE_PLUGIN_RESOLVE = "@hartl-services/medusa-base";
@@ -0,0 +1,22 @@
1
+ import type { DocumentMerchant, DocumentMerchantOption } from "../../../documents/types/documents";
2
+ /** Shop master data keys (base plugin, `plugin_key: "shop"`) documents read. */
3
+ export type DocumentMerchantKey = keyof DocumentMerchant;
4
+ export type DocumentMerchantValues = Partial<Record<DocumentMerchantKey, string>>;
5
+ /** Without these a financial document or packing list has no legal sender. */
6
+ export declare const DOCUMENT_MERCHANT_REQUIRED_FIELDS: readonly ["legal_name", "address_line1", "postal_code", "city", "country_code"];
7
+ /** Development placeholder UID: never printed on a document. */
8
+ export declare const MERCHANT_VAT_PLACEHOLDER = "ATU00000000";
9
+ /**
10
+ * The plugin's `merchant` option as a per-field fallback for the shop master
11
+ * data. Empty values are left out so they never shadow a declared default.
12
+ */
13
+ export declare const merchantOptionToFallback: (option: DocumentMerchantOption | undefined) => DocumentMerchantValues;
14
+ export type DocumentMerchantResolution = {
15
+ merchant: DocumentMerchant;
16
+ missing: [];
17
+ } | {
18
+ merchant: null;
19
+ missing: DocumentMerchantKey[];
20
+ };
21
+ /** Maps resolved shop master data to the render input's `merchant`. */
22
+ export declare const toDocumentMerchant: (values: DocumentMerchantValues) => DocumentMerchantResolution;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toDocumentMerchant = exports.merchantOptionToFallback = exports.MERCHANT_VAT_PLACEHOLDER = exports.DOCUMENT_MERCHANT_REQUIRED_FIELDS = void 0;
4
+ /** Without these a financial document or packing list has no legal sender. */
5
+ exports.DOCUMENT_MERCHANT_REQUIRED_FIELDS = [
6
+ "legal_name",
7
+ "address_line1",
8
+ "postal_code",
9
+ "city",
10
+ "country_code",
11
+ ];
12
+ /** Development placeholder UID: never printed on a document. */
13
+ exports.MERCHANT_VAT_PLACEHOLDER = "ATU00000000";
14
+ const text = (value) => {
15
+ if (typeof value !== "string") {
16
+ return null;
17
+ }
18
+ const trimmed = value.trim();
19
+ return trimmed ? trimmed : null;
20
+ };
21
+ const vatNumber = (value) => {
22
+ const normalized = text(value);
23
+ return normalized &&
24
+ normalized.replace(/\s+/g, "").toUpperCase() === exports.MERCHANT_VAT_PLACEHOLDER
25
+ ? null
26
+ : normalized;
27
+ };
28
+ /**
29
+ * The plugin's `merchant` option as a per-field fallback for the shop master
30
+ * data. Empty values are left out so they never shadow a declared default.
31
+ */
32
+ const merchantOptionToFallback = (option) => {
33
+ if (!option) {
34
+ return {};
35
+ }
36
+ const address = option.registeredAddress;
37
+ const entries = [
38
+ ["legal_name", option.legalName],
39
+ ["address_line1", address?.address1],
40
+ ["address_line2", address?.address2],
41
+ ["postal_code", address?.postalCode],
42
+ ["city", address?.city],
43
+ [
44
+ "country_code",
45
+ text(address?.countryCode ?? option.countryCode)?.toLowerCase(),
46
+ ],
47
+ ["vat_number", option.vatNumber],
48
+ ];
49
+ const fallback = {};
50
+ for (const [key, value] of entries) {
51
+ const normalized = text(value);
52
+ if (normalized) {
53
+ fallback[key] = normalized;
54
+ }
55
+ }
56
+ return fallback;
57
+ };
58
+ exports.merchantOptionToFallback = merchantOptionToFallback;
59
+ /** Maps resolved shop master data to the render input's `merchant`. */
60
+ const toDocumentMerchant = (values) => {
61
+ const missing = exports.DOCUMENT_MERCHANT_REQUIRED_FIELDS.filter((key) => !text(values[key]));
62
+ if (missing.length > 0) {
63
+ return { merchant: null, missing };
64
+ }
65
+ return {
66
+ merchant: {
67
+ legal_name: text(values.legal_name),
68
+ address_line1: text(values.address_line1),
69
+ address_line2: text(values.address_line2),
70
+ postal_code: text(values.postal_code),
71
+ city: text(values.city),
72
+ country_code: text(values.country_code).toLowerCase(),
73
+ vat_number: vatNumber(values.vat_number),
74
+ email: text(values.email),
75
+ phone: text(values.phone),
76
+ website: text(values.website),
77
+ iban: text(values.iban),
78
+ bic: text(values.bic),
79
+ company_register_number: text(values.company_register_number),
80
+ company_register_court: text(values.company_register_court),
81
+ },
82
+ missing: [],
83
+ };
84
+ };
85
+ exports.toDocumentMerchant = toDocumentMerchant;
@@ -0,0 +1,34 @@
1
+ import type { DocumentHtmlFactory } from "../../../documents/types/html-factory";
2
+ import type { DocumentMerchantOption, DocumentPdfOptions } from "../../../documents/types/documents";
3
+ import { type DocumentMerchantValues } from "./merchant";
4
+ /** Used when the `documents.numbering.timeZone` option is not given. */
5
+ export declare const DEFAULT_NUMBERING_TIME_ZONE = "Europe/Vienna";
6
+ /** The `documents` namespace of the base plugin options. */
7
+ export type DocumentPluginOptions = {
8
+ /**
9
+ * Replaces the built-in German document markup. Omit it to use
10
+ * `createDefaultDocumentHtmlFactory` with the `numbering.timeZone`.
11
+ */
12
+ htmlFactory?: DocumentHtmlFactory;
13
+ /**
14
+ * Fallback for the shop master data of the base plugin: used per field
15
+ * only where no value is stored there.
16
+ */
17
+ merchant?: DocumentMerchantOption;
18
+ numbering?: {
19
+ timeZone?: string;
20
+ };
21
+ pdf?: DocumentPdfOptions;
22
+ };
23
+ export type ResolvedDocumentPluginOptions = {
24
+ htmlFactory: DocumentHtmlFactory;
25
+ /** The `merchant` option keyed by shop master data field. */
26
+ merchantFallback: DocumentMerchantValues;
27
+ numbering: {
28
+ timeZone: string;
29
+ };
30
+ pdf: {
31
+ executablePath: string;
32
+ };
33
+ };
34
+ export declare const resolveDocumentPluginOptions: (options: DocumentPluginOptions | undefined) => ResolvedDocumentPluginOptions;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveDocumentPluginOptions = exports.DEFAULT_NUMBERING_TIME_ZONE = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const html_factory_1 = require("../../../documents/templates/html-factory");
6
+ const merchant_1 = require("./merchant");
7
+ /** Used when the `documents.numbering.timeZone` option is not given. */
8
+ exports.DEFAULT_NUMBERING_TIME_ZONE = "Europe/Vienna";
9
+ const resolveDocumentPluginOptions = (options) => {
10
+ const configuredTimeZone = options?.numbering?.timeZone;
11
+ const timeZone = configuredTimeZone === undefined
12
+ ? exports.DEFAULT_NUMBERING_TIME_ZONE
13
+ : configuredTimeZone.trim();
14
+ if (!timeZone) {
15
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "The documents plugin requires a numbering time zone.");
16
+ }
17
+ try {
18
+ new Intl.DateTimeFormat("en", { timeZone }).format();
19
+ }
20
+ catch {
21
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `The documents numbering time zone '${timeZone}' is invalid.`);
22
+ }
23
+ if (options?.htmlFactory !== undefined &&
24
+ typeof options.htmlFactory !== "function") {
25
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "The documents 'htmlFactory' option must be a function.");
26
+ }
27
+ if (options?.merchant !== undefined &&
28
+ (typeof options.merchant !== "object" || options.merchant === null)) {
29
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "The documents 'merchant' option must be an object.");
30
+ }
31
+ const executablePath = options?.pdf?.executablePath?.trim() || "google-chrome";
32
+ return {
33
+ htmlFactory: options?.htmlFactory ?? (0, html_factory_1.createDefaultDocumentHtmlFactory)({ timeZone }),
34
+ merchantFallback: (0, merchant_1.merchantOptionToFallback)(options?.merchant),
35
+ numbering: { timeZone },
36
+ pdf: { executablePath },
37
+ };
38
+ };
39
+ exports.resolveDocumentPluginOptions = resolveDocumentPluginOptions;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Environment helpers for a shop's `medusa-config.ts`. The configuration
3
+ * itself (which plugins run, static shop facts, defaults) lives in the shop;
4
+ * these helpers only read and validate deployment values so a misconfigured
5
+ * deployment fails at startup with the variable's name.
6
+ */
7
+ export type ConfigurationPhase = "build" | "runtime";
8
+ /**
9
+ * Placeholders for the variables Medusa core and the Stripe payment provider
10
+ * need. `medusa build` loads the configuration without deployment secrets;
11
+ * pass these (merged with the placeholders of the shop's other plugins) as
12
+ * `buildPlaceholders` to `requireEnvironment` so required-variable checks pass
13
+ * during the build. They never reach a running server.
14
+ */
15
+ export declare const MEDUSA_BUILD_PLACEHOLDERS: Readonly<Record<string, string>>;
16
+ export declare const optionalEnvironment: (environment: NodeJS.ProcessEnv, name: string) => string | undefined;
17
+ /**
18
+ * Returns every named value or throws one error listing all missing names.
19
+ * During the build phase, the given `buildPlaceholders` stand in for
20
+ * deployment values; at runtime they are ignored.
21
+ */
22
+ export declare const requireEnvironment: <Name extends string>(environment: NodeJS.ProcessEnv, names: readonly Name[], phase: ConfigurationPhase, buildPlaceholders: Readonly<Record<string, string>>) => Readonly<Record<Name, string>>;
23
+ export declare const integerEnvironment: (environment: NodeJS.ProcessEnv, name: string, minimum: number, maximum: number) => number | undefined;
24
+ export declare const booleanEnvironment: (environment: NodeJS.ProcessEnv, name: string, defaultValue: boolean) => boolean;
25
+ /** Local development, tests and builds may use plain HTTP and SMTP. */
26
+ export declare const allowsInsecureLocalServices: (environment: NodeJS.ProcessEnv, phase: ConfigurationPhase) => boolean;
27
+ export declare const resolvePublicOrigin: (value: string, name: string, allowHttp: boolean) => string;
28
+ /**
29
+ * Builds an absolute URL on a validated origin from a path that may contain
30
+ * customer-controlled parts (e.g. a locale). Protocol-relative paths, queries,
31
+ * fragments and backslashes are rejected so the URL can never leave the origin.
32
+ */
33
+ export declare const shopUrl: (origin: string, path: string) => string;
34
+ export declare const resolveStripe: (values: {
35
+ readonly STRIPE_API_KEY: string;
36
+ readonly STRIPE_WEBHOOK_SECRET: string;
37
+ }) => {
38
+ readonly apiKey: string;
39
+ readonly webhookSecret: string;
40
+ };
41
+ export type RedisEventBusConfiguration = {
42
+ readonly url: string;
43
+ };
44
+ /**
45
+ * Redis is optional in development (Medusa then uses its local Event Bus),
46
+ * required at runtime everywhere else, and never used during a build.
47
+ * Production requires authenticated `rediss://` unless an insecure private
48
+ * network is explicitly accepted.
49
+ */
50
+ export declare const resolveRedisEventBus: (environment: NodeJS.ProcessEnv, phase: ConfigurationPhase) => RedisEventBusConfiguration | undefined;
51
+ /**
52
+ * Boot-time registrations of the plugin's built-in modules, from the same
53
+ * `@hartl-services/medusa-base/config` entry: the SMTP notification provider
54
+ * (E-Mail), the S3 file storage provider with its `/files` gateway part, and
55
+ * the default document markup.
56
+ */
57
+ export * from "../email/config";
58
+ export * from "../files/config";
59
+ export * from "../documents/config";
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ /* eslint-disable @medusajs/use-medusa-error-not-generic-error -- Startup configuration errors are not HTTP responses. */
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.resolveRedisEventBus = exports.resolveStripe = exports.shopUrl = exports.resolvePublicOrigin = exports.allowsInsecureLocalServices = exports.booleanEnvironment = exports.integerEnvironment = exports.requireEnvironment = exports.optionalEnvironment = exports.MEDUSA_BUILD_PLACEHOLDERS = void 0;
19
+ /**
20
+ * Placeholders for the variables Medusa core and the Stripe payment provider
21
+ * need. `medusa build` loads the configuration without deployment secrets;
22
+ * pass these (merged with the placeholders of the shop's other plugins) as
23
+ * `buildPlaceholders` to `requireEnvironment` so required-variable checks pass
24
+ * during the build. They never reach a running server.
25
+ */
26
+ exports.MEDUSA_BUILD_PLACEHOLDERS = {
27
+ ADMIN_CORS: "http://localhost",
28
+ AUTH_CORS: "http://localhost",
29
+ COOKIE_SECRET: "build-placeholder",
30
+ DATABASE_URL: "postgres://build:build@localhost:5432/build",
31
+ JWT_SECRET: "build-placeholder",
32
+ MEDUSA_BACKEND_URL: "http://localhost",
33
+ STOREFRONT_URL: "http://localhost:8000",
34
+ STORE_CORS: "http://localhost",
35
+ STRIPE_API_KEY: "sk_test_build-placeholder",
36
+ STRIPE_WEBHOOK_SECRET: "whsec_build-placeholder",
37
+ };
38
+ const optionalEnvironment = (environment, name) => {
39
+ const value = environment[name]?.trim();
40
+ return value ? value : undefined;
41
+ };
42
+ exports.optionalEnvironment = optionalEnvironment;
43
+ /**
44
+ * Returns every named value or throws one error listing all missing names.
45
+ * During the build phase, the given `buildPlaceholders` stand in for
46
+ * deployment values; at runtime they are ignored.
47
+ */
48
+ const requireEnvironment = (environment, names, phase, buildPlaceholders) => {
49
+ const source = phase === "build" ? { ...environment, ...buildPlaceholders } : environment;
50
+ const missing = names.filter((name) => (0, exports.optionalEnvironment)(source, name) === undefined);
51
+ if (missing.length > 0) {
52
+ throw new TypeError(`Missing required environment variables: ${missing.join(", ")}.`);
53
+ }
54
+ return Object.fromEntries(names.map((name) => [name, (0, exports.optionalEnvironment)(source, name)]));
55
+ };
56
+ exports.requireEnvironment = requireEnvironment;
57
+ const integerEnvironment = (environment, name, minimum, maximum) => {
58
+ const value = (0, exports.optionalEnvironment)(environment, name);
59
+ if (value === undefined) {
60
+ return undefined;
61
+ }
62
+ const parsed = Number(value);
63
+ if (!Number.isInteger(parsed) || parsed < minimum || parsed > maximum) {
64
+ throw new TypeError(`${name} must be an integer from ${minimum} through ${maximum}.`);
65
+ }
66
+ return parsed;
67
+ };
68
+ exports.integerEnvironment = integerEnvironment;
69
+ const booleanEnvironment = (environment, name, defaultValue) => {
70
+ const value = (0, exports.optionalEnvironment)(environment, name);
71
+ if (value === undefined) {
72
+ return defaultValue;
73
+ }
74
+ if (value !== "true" && value !== "false") {
75
+ throw new TypeError(`${name} must be either "true" or "false".`);
76
+ }
77
+ return value === "true";
78
+ };
79
+ exports.booleanEnvironment = booleanEnvironment;
80
+ /** Local development, tests and builds may use plain HTTP and SMTP. */
81
+ const allowsInsecureLocalServices = (environment, phase) => phase === "build" ||
82
+ environment.NODE_ENV === "development" ||
83
+ environment.NODE_ENV === "test";
84
+ exports.allowsInsecureLocalServices = allowsInsecureLocalServices;
85
+ const resolvePublicOrigin = (value, name, allowHttp) => {
86
+ let url;
87
+ try {
88
+ url = new URL(value);
89
+ }
90
+ catch {
91
+ throw new TypeError(`${name} must be a valid HTTP(S) origin.`);
92
+ }
93
+ if ((url.protocol !== "https:" && url.protocol !== "http:") ||
94
+ url.username ||
95
+ url.password ||
96
+ url.pathname !== "/" ||
97
+ url.search ||
98
+ url.hash) {
99
+ throw new TypeError(`${name} must be a valid HTTP(S) origin.`);
100
+ }
101
+ if (!allowHttp && url.protocol !== "https:") {
102
+ throw new TypeError(`${name} must use HTTPS outside development and test.`);
103
+ }
104
+ return url.origin;
105
+ };
106
+ exports.resolvePublicOrigin = resolvePublicOrigin;
107
+ /**
108
+ * Builds an absolute URL on a validated origin from a path that may contain
109
+ * customer-controlled parts (e.g. a locale). Protocol-relative paths, queries,
110
+ * fragments and backslashes are rejected so the URL can never leave the origin.
111
+ */
112
+ const shopUrl = (origin, path) => {
113
+ if (!path ||
114
+ path !== path.trim() ||
115
+ !path.startsWith("/") ||
116
+ path.startsWith("//") ||
117
+ path.includes("?") ||
118
+ path.includes("#") ||
119
+ path.includes("\\")) {
120
+ throw new TypeError(`Shop URL path "${path}" is not a plain absolute path.`);
121
+ }
122
+ return new URL(path, origin).toString();
123
+ };
124
+ exports.shopUrl = shopUrl;
125
+ const resolveStripe = (values) => {
126
+ if (!values.STRIPE_API_KEY.startsWith("sk_")) {
127
+ throw new TypeError("STRIPE_API_KEY must be a Stripe secret key (sk_...), not a publishable key.");
128
+ }
129
+ if (!values.STRIPE_WEBHOOK_SECRET.startsWith("whsec_")) {
130
+ throw new TypeError("STRIPE_WEBHOOK_SECRET must be a Stripe webhook signing secret (whsec_...).");
131
+ }
132
+ return {
133
+ apiKey: values.STRIPE_API_KEY,
134
+ webhookSecret: values.STRIPE_WEBHOOK_SECRET,
135
+ };
136
+ };
137
+ exports.resolveStripe = resolveStripe;
138
+ /**
139
+ * Redis is optional in development (Medusa then uses its local Event Bus),
140
+ * required at runtime everywhere else, and never used during a build.
141
+ * Production requires authenticated `rediss://` unless an insecure private
142
+ * network is explicitly accepted.
143
+ */
144
+ const resolveRedisEventBus = (environment, phase) => {
145
+ if (phase === "build") {
146
+ return undefined;
147
+ }
148
+ const url = (0, exports.optionalEnvironment)(environment, "REDIS_URL");
149
+ if (!url) {
150
+ if (environment.NODE_ENV !== "development") {
151
+ throw new TypeError("Missing required environment variables: REDIS_URL.");
152
+ }
153
+ return undefined;
154
+ }
155
+ let parsed;
156
+ try {
157
+ parsed = new URL(url);
158
+ }
159
+ catch {
160
+ throw new TypeError("REDIS_URL must be a valid Redis URL.");
161
+ }
162
+ if (parsed.protocol !== "redis:" && parsed.protocol !== "rediss:") {
163
+ throw new TypeError("REDIS_URL must use redis:// or rediss://.");
164
+ }
165
+ if (environment.NODE_ENV === "production") {
166
+ if (!parsed.password) {
167
+ throw new TypeError("Production REDIS_URL must include authentication.");
168
+ }
169
+ if (parsed.protocol !== "rediss:" &&
170
+ !(0, exports.booleanEnvironment)(environment, "REDIS_ALLOW_INSECURE_PRIVATE_NETWORK", false)) {
171
+ throw new TypeError("Production REDIS_URL must use rediss:// unless REDIS_ALLOW_INSECURE_PRIVATE_NETWORK=true.");
172
+ }
173
+ }
174
+ return { url };
175
+ };
176
+ exports.resolveRedisEventBus = resolveRedisEventBus;
177
+ /**
178
+ * Boot-time registrations of the plugin's built-in modules, from the same
179
+ * `@hartl-services/medusa-base/config` entry: the SMTP notification provider
180
+ * (E-Mail), the S3 file storage provider with its `/files` gateway part, and
181
+ * the default document markup.
182
+ */
183
+ __exportStar(require("../email/config"), exports);
184
+ __exportStar(require("../files/config"), exports);
185
+ __exportStar(require("../documents/config"), exports);
@@ -11,6 +11,7 @@ const SETTING_TYPES = new Set([
11
11
  "boolean",
12
12
  "secret",
13
13
  "select",
14
+ "image",
14
15
  ]);
15
16
  const ACTION_MODES = new Set(["sync", "background"]);
16
17
  const ADMIN_PAGE_PREFIX = "/settings/hartl-services/";
@@ -33,6 +34,7 @@ const defaultMatchesType = (setting) => {
33
34
  case "string":
34
35
  return hasText(value);
35
36
  case "url":
37
+ case "image":
36
38
  return typeof value === "string" && isHttpUrl(value);
37
39
  case "number":
38
40
  return typeof value === "number" && Number.isFinite(value);
@@ -0,0 +1,2 @@
1
+ /** Entry of `@hartl-services/medusa-base/gateway`: `/files` signing helpers. */
2
+ export * from "../files/gateway";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /** Entry of `@hartl-services/medusa-base/gateway`: `/files` signing helpers. */
18
+ __exportStar(require("../files/gateway"), exports);
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Medusa's start command only calls a function named exactly `register` from
3
+ * the shop's `instrumentation.ts` (see @medusajs/medusa/dist/commands/start.js),
4
+ * so the shop re-exports it:
5
+ *
6
+ * export { register } from "@hartl-services/medusa-base/instrumentation"
7
+ *
8
+ * SENTRY_DSN is optional: unset means "no error tracking", not "the app
9
+ * won't start". Needs `@sentry/node` (optional peer dependency of the base,
10
+ * installed by the shop).
11
+ */
12
+ export declare function register(): void;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.register = register;
37
+ const Sentry = __importStar(require("@sentry/node"));
38
+ /**
39
+ * Medusa's start command only calls a function named exactly `register` from
40
+ * the shop's `instrumentation.ts` (see @medusajs/medusa/dist/commands/start.js),
41
+ * so the shop re-exports it:
42
+ *
43
+ * export { register } from "@hartl-services/medusa-base/instrumentation"
44
+ *
45
+ * SENTRY_DSN is optional: unset means "no error tracking", not "the app
46
+ * won't start". Needs `@sentry/node` (optional peer dependency of the base,
47
+ * installed by the shop).
48
+ */
49
+ function register() {
50
+ Sentry.init({
51
+ dsn: process.env.SENTRY_DSN,
52
+ environment: process.env.SENTRY_ENVIRONMENT || process.env.NODE_ENV,
53
+ tracesSampleRate: 0,
54
+ });
55
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Entry of `@hartl-services/medusa-base/shop-config`: the turnkey
3
+ * `medusa-config.ts` of a food shop. Separate from `./config` because it loads
4
+ * the Sentry logger wrapper and with it `@sentry/node`.
5
+ */
6
+ export { buildFoodShopConfig, defineFoodShopConfig, } from "../shop-config/build-food-shop-config";
7
+ export type { FoodShopConfigInput, FoodShopModule, FoodShopPlugin, } from "../shop-config/build-food-shop-config";
8
+ export type { FoodShopConfigOptions } from "../shop-config/options";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineFoodShopConfig = exports.buildFoodShopConfig = void 0;
4
+ /**
5
+ * Entry of `@hartl-services/medusa-base/shop-config`: the turnkey
6
+ * `medusa-config.ts` of a food shop. Separate from `./config` because it loads
7
+ * the Sentry logger wrapper and with it `@sentry/node`.
8
+ */
9
+ var build_food_shop_config_1 = require("../shop-config/build-food-shop-config");
10
+ Object.defineProperty(exports, "buildFoodShopConfig", { enumerable: true, get: function () { return build_food_shop_config_1.buildFoodShopConfig; } });
11
+ Object.defineProperty(exports, "defineFoodShopConfig", { enumerable: true, get: function () { return build_food_shop_config_1.defineFoodShopConfig; } });
@@ -5,7 +5,7 @@ import type { PluginSettingsFallback } from "./types";
5
5
  * on the generic plugin page like any plugin's settings. It cannot be
6
6
  * switched off and declares no features.
7
7
  */
8
- export declare const shopMasterDataDescriptor: import("./types").PluginFeatureDescriptor<string, "legal_name" | "address_line1" | "address_line2" | "postal_code" | "city" | "country_code" | "vat_number" | "email" | "phone" | "website" | "iban" | "bic" | "company_register_number" | "company_register_court", never>;
8
+ export declare const shopMasterDataDescriptor: import("./types").PluginFeatureDescriptor<string, "country_code" | "legal_name" | "address_line1" | "address_line2" | "postal_code" | "city" | "vat_number" | "email" | "phone" | "website" | "iban" | "bic" | "company_register_number" | "company_register_court", never>;
9
9
  /** Keys of the shop master data settings. */
10
10
  export type ShopMasterDataKey = "legal_name" | "address_line1" | "address_line2" | "postal_code" | "city" | "country_code" | "vat_number" | "email" | "phone" | "website" | "iban" | "bic" | "company_register_number" | "company_register_court";
11
11
  /** Every key that has a value (stored > fallback). All values are strings. */