@hartl-services/medusa-base 0.4.0 → 1.0.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.
- package/.medusa/server/src/admin/index.js +1517 -87
- package/.medusa/server/src/admin/index.mjs +1518 -88
- package/.medusa/server/src/api/admin/email/messages/[id]/resends/route.js +24 -0
- package/.medusa/server/src/api/admin/email/messages/[id]/route.js +12 -0
- package/.medusa/server/src/api/admin/email/messages/route.js +12 -0
- package/.medusa/server/src/api/admin/email/terms-versions/[id]/download/route.js +16 -0
- package/.medusa/server/src/api/admin/email/terms-versions/route.js +47 -0
- package/.medusa/server/src/api/admin/orders/[id]/documents/[document_id]/download/route.js +21 -0
- package/.medusa/server/src/api/admin/orders/[id]/documents/[document_id]/regenerate/route.js +38 -0
- package/.medusa/server/src/api/admin/orders/[id]/documents/regenerate/route.js +32 -0
- package/.medusa/server/src/api/admin/orders/[id]/documents/route.js +36 -0
- package/.medusa/server/src/api/admin/orders/[id]/packing-lists/[fulfillment_id]/download/route.js +24 -0
- package/.medusa/server/src/api/admin/orders/[id]/packing-lists/[fulfillment_id]/retry/route.js +44 -0
- package/.medusa/server/src/api/admin/orders/[id]/packing-lists/route.js +82 -0
- package/.medusa/server/src/api/document-download-response.js +16 -0
- package/.medusa/server/src/api/document-response.js +23 -0
- package/.medusa/server/src/api/files/[asset]/route.js +24 -0
- package/.medusa/server/src/api/files/file-response.js +43 -0
- package/.medusa/server/src/api/files/gateway-options.js +31 -0
- package/.medusa/server/src/api/files/private/[token]/route.js +29 -0
- package/.medusa/server/src/api/files/upload/[token]/route.js +66 -0
- package/.medusa/server/src/api/middlewares.js +168 -1
- package/.medusa/server/src/api/packing-list-response.js +22 -0
- package/.medusa/server/src/api/route.js +27 -0
- package/.medusa/server/src/api/store/documents/[id]/download/route.js +21 -0
- package/.medusa/server/src/api/store/documents/[id]/route.js +15 -0
- package/.medusa/server/src/api/store/documents/route.js +11 -0
- package/.medusa/server/src/api/terms-download-response.js +12 -0
- package/.medusa/server/src/documents/config/index.js +18 -0
- package/.medusa/server/src/documents/paths/documents.js +6 -0
- package/.medusa/server/src/documents/paths/index.js +18 -0
- package/.medusa/server/src/documents/plugin-features.js +24 -0
- package/.medusa/server/src/documents/schemas/documents.js +18 -0
- package/.medusa/server/src/documents/schemas/index.js +18 -0
- package/.medusa/server/src/documents/scripts/verify-documents-file-storage.js +55 -0
- package/.medusa/server/src/documents/templates/financial-document.js +142 -0
- package/.medusa/server/src/documents/templates/format.js +31 -0
- package/.medusa/server/src/documents/templates/html-factory.js +40 -0
- package/.medusa/server/src/documents/templates/html-utils.js +13 -0
- package/.medusa/server/src/documents/templates/layout.js +97 -0
- package/.medusa/server/src/documents/templates/packing-list.js +50 -0
- package/.medusa/server/src/documents/types/admin-api.js +3 -0
- package/.medusa/server/src/documents/types/document-summary.js +3 -0
- package/.medusa/server/src/documents/types/documents.js +3 -0
- package/.medusa/server/src/documents/types/html-factory.js +6 -0
- package/.medusa/server/src/documents/types/index.js +22 -0
- package/.medusa/server/src/documents/types/store-api.js +3 -0
- package/.medusa/server/src/documents/utils/document-merchant.js +22 -0
- package/.medusa/server/src/documents/utils/html-to-pdf.js +61 -0
- package/.medusa/server/src/documents/utils/private-file-storage.js +64 -0
- package/.medusa/server/src/documents/utils/resolve-services.js +7 -0
- package/.medusa/server/src/email/application/handle-invite-event.js +312 -0
- package/.medusa/server/src/email/application/handle-password-reset-event.js +354 -0
- package/.medusa/server/src/email/config/index.js +84 -0
- package/.medusa/server/src/email/config/notification-module.js +20 -0
- package/.medusa/server/src/email/domain/business-keys.js +50 -0
- package/.medusa/server/src/email/domain/documents-fact-fingerprint.js +7 -0
- package/.medusa/server/src/email/domain/event-schemas.js +36 -0
- package/.medusa/server/src/email/domain/failure-classification.js +53 -0
- package/.medusa/server/src/email/plugin-features.js +31 -0
- package/.medusa/server/src/email/rendering/default-templates.js +91 -0
- package/.medusa/server/src/email/rendering/render-email.js +37 -0
- package/.medusa/server/src/email/rendering/resolve-shop-configuration.js +48 -0
- package/.medusa/server/src/email/types/email-kinds.js +18 -0
- package/.medusa/server/src/email/types/index.js +21 -0
- package/.medusa/server/src/email/types/shop-configuration.js +3 -0
- package/.medusa/server/src/email/types/smtp-configuration.js +3 -0
- package/.medusa/server/src/email/types/template-data.js +79 -0
- package/.medusa/server/src/files/config/index.js +256 -0
- package/.medusa/server/src/files/gateway/index.js +115 -0
- package/.medusa/server/src/files/types/index.js +6 -0
- package/.medusa/server/src/files/types/public.js +6 -0
- package/.medusa/server/src/jobs/document-fact-publication-reconciliation.js +18 -0
- package/.medusa/server/src/jobs/document-resolution-reconciliation.js +20 -0
- package/.medusa/server/src/jobs/packing-list-reconciliation.js +49 -0
- package/.medusa/server/src/jobs/reconcile-email-attempts.js +63 -0
- package/.medusa/server/src/jobs/reconcile-pending-email-messages.js +41 -0
- package/.medusa/server/src/jobs/retry-email-messages.js +27 -0
- package/.medusa/server/src/migration-scripts/dismiss-orphaned-cart-promotion-links.js +26 -0
- package/.medusa/server/src/modules/documents/domain/cancellation-snapshot.js +97 -0
- package/.medusa/server/src/modules/documents/domain/document-number.js +36 -0
- package/.medusa/server/src/modules/documents/domain/document-resolution.js +24 -0
- package/.medusa/server/src/modules/documents/domain/issuance-rules.js +37 -0
- package/.medusa/server/src/modules/documents/domain/merchant.js +86 -0
- package/.medusa/server/src/modules/documents/domain/options.js +40 -0
- package/.medusa/server/src/modules/documents/domain/packing-list.js +90 -0
- package/.medusa/server/src/modules/documents/domain/snapshot-normalization.js +17 -0
- package/.medusa/server/src/modules/documents/domain/tax-breakdown.js +66 -0
- package/.medusa/server/src/modules/documents/index.js +15 -0
- package/.medusa/server/src/modules/documents/loaders/assert-private-file-storage.js +20 -0
- package/.medusa/server/src/modules/documents/migrations/Migration20260827061749.js +75 -0
- package/.medusa/server/src/modules/documents/migrations/Migration20260830111207.js +28 -0
- package/.medusa/server/src/modules/documents/models/document-artifact.js +25 -0
- package/.medusa/server/src/modules/documents/models/document-number-sequence.js +29 -0
- package/.medusa/server/src/modules/documents/models/document.js +82 -0
- package/.medusa/server/src/modules/documents/models/order-cancellation-resolution.js +51 -0
- package/.medusa/server/src/modules/documents/models/packing-list-revision.js +36 -0
- package/.medusa/server/src/modules/documents/models/packing-list.js +27 -0
- package/.medusa/server/src/modules/documents/models/refund-document-resolution.js +66 -0
- package/.medusa/server/src/modules/documents/models/shipment-invoice-assignment.js +51 -0
- package/.medusa/server/src/modules/documents/models/shipment-invoice-coordinator.js +44 -0
- package/.medusa/server/src/modules/documents/service.js +1701 -0
- package/.medusa/server/src/modules/email/domain/attachment.js +25 -0
- package/.medusa/server/src/modules/email/domain/message-state.js +69 -0
- package/.medusa/server/src/modules/email/index.js +13 -0
- package/.medusa/server/src/modules/email/migrations/Migration20260826173422.js +32 -0
- package/.medusa/server/src/modules/email/migrations/Migration20260827172945.js +16 -0
- package/.medusa/server/src/modules/email/migrations/Migration20260827194804.js +22 -0
- package/.medusa/server/src/modules/email/migrations/Migration20260906195205.js +16 -0
- package/.medusa/server/src/modules/email/models/email-attempt.js +56 -0
- package/.medusa/server/src/modules/email/models/email-message.js +71 -0
- package/.medusa/server/src/modules/email/models/email-terms-version.js +37 -0
- package/.medusa/server/src/modules/email/service.js +1285 -0
- package/.medusa/server/src/providers/s3-cache/cache/atomic-write.js +25 -0
- package/.medusa/server/src/providers/s3-cache/cache/cache-manager.js +115 -0
- package/.medusa/server/src/providers/s3-cache/cache/keyed-lock.js +28 -0
- package/.medusa/server/src/providers/s3-cache/index.js +8 -0
- package/.medusa/server/src/providers/s3-cache/object-key.js +53 -0
- package/.medusa/server/src/providers/s3-cache/s3-cache-file.js +229 -0
- package/.medusa/server/src/providers/s3-cache/s3-object-store.js +86 -0
- package/.medusa/server/src/providers/smtp/index.js +8 -0
- package/.medusa/server/src/providers/smtp/service.js +236 -0
- package/.medusa/server/src/providers/smtp/types.js +11 -0
- package/.medusa/server/src/public/config.js +186 -0
- package/.medusa/server/src/public/gateway.js +19 -0
- package/.medusa/server/src/public/instrumentation.js +56 -0
- package/.medusa/server/src/public/shop-config.js +12 -0
- package/.medusa/server/src/public/shop-types.js +24 -0
- package/.medusa/server/src/shop-config/build-food-shop-config.js +248 -0
- package/.medusa/server/src/shop-config/options.js +71 -0
- package/.medusa/server/src/subscribers/affiliate-consignment-reminder-due.js +26 -0
- package/.medusa/server/src/subscribers/documents-order-canceled.js +24 -0
- package/.medusa/server/src/subscribers/documents-order-cancellation-ready.js +26 -0
- package/.medusa/server/src/subscribers/documents-refund-ready.js +24 -0
- package/.medusa/server/src/subscribers/documents-shipment-created.js +36 -0
- package/.medusa/server/src/subscribers/documents-shipment-invoice-assignment-decided.js +26 -0
- package/.medusa/server/src/subscribers/email-order-canceled.js +28 -0
- package/.medusa/server/src/subscribers/email-shipment-created.js +32 -0
- package/.medusa/server/src/subscribers/order-placed.js +27 -0
- package/.medusa/server/src/subscribers/packing-list-allocation-revised.js +32 -0
- package/.medusa/server/src/subscribers/packing-list-fulfillment-canceled.js +54 -0
- package/.medusa/server/src/subscribers/packing-list-fulfillment-created.js +31 -0
- package/.medusa/server/src/subscribers/password-reset.js +23 -0
- package/.medusa/server/src/subscribers/payment-refunded.js +38 -0
- package/.medusa/server/src/subscribers/return-received.js +27 -0
- package/.medusa/server/src/subscribers/return-requested.js +27 -0
- package/.medusa/server/src/subscribers/user-invite.js +23 -0
- package/.medusa/server/src/utils/cart-promotion-links.js +101 -0
- package/.medusa/server/src/workflows/documents/issue-cancellation-after-refund.js +246 -0
- package/.medusa/server/src/workflows/documents/issue-document.js +163 -0
- package/.medusa/server/src/workflows/documents/issue-invoice-after-shipment.js +521 -0
- package/.medusa/server/src/workflows/documents/issue-packing-list.js +384 -0
- package/.medusa/server/src/workflows/documents/publish-document-facts.js +53 -0
- package/.medusa/server/src/workflows/documents/reconcile-document-resolutions.js +48 -0
- package/.medusa/server/src/workflows/documents/reconcile-order-cancellation.js +92 -0
- package/.medusa/server/src/workflows/documents/regenerate-issued-document.js +61 -0
- package/.medusa/server/src/workflows/email/dispatch-email-message.js +299 -0
- package/.medusa/server/src/workflows/email/documents-required-facts.js +30 -0
- package/.medusa/server/src/workflows/email/prepare-affiliate-reminder-email.js +58 -0
- package/.medusa/server/src/workflows/email/prepare-order-canceled-email.js +64 -0
- package/.medusa/server/src/workflows/email/prepare-order-received-email.js +56 -0
- package/.medusa/server/src/workflows/email/prepare-refund-email.js +47 -0
- package/.medusa/server/src/workflows/email/prepare-return-email.js +75 -0
- package/.medusa/server/src/workflows/email/prepare-shipment-email.js +82 -0
- package/.medusa/server/src/workflows/email/retry-email-messages.js +31 -0
- package/.medusa/server/src/workflows/hooks/dismiss-deleted-promotion-cart-links.js +23 -0
- package/README.md +1619 -7
- package/dist/documents/config/index.d.ts +11 -0
- package/dist/documents/config/index.js +17 -0
- package/dist/documents/templates/financial-document.d.ts +3 -0
- package/dist/documents/templates/financial-document.js +141 -0
- package/dist/documents/templates/format.d.ts +16 -0
- package/dist/documents/templates/format.js +30 -0
- package/dist/documents/templates/html-factory.d.ts +11 -0
- package/dist/documents/templates/html-factory.js +39 -0
- package/dist/documents/templates/html-utils.d.ts +2 -0
- package/dist/documents/templates/html-utils.js +12 -0
- package/dist/documents/templates/layout.d.ts +17 -0
- package/dist/documents/templates/layout.js +96 -0
- package/dist/documents/templates/packing-list.d.ts +3 -0
- package/dist/documents/templates/packing-list.js +49 -0
- package/dist/documents/types/admin-api.d.ts +1 -0
- package/dist/documents/types/admin-api.js +2 -0
- package/dist/documents/types/document-summary.d.ts +1 -0
- package/dist/documents/types/document-summary.js +2 -0
- package/dist/documents/types/documents.d.ts +174 -0
- package/dist/documents/types/documents.js +2 -0
- package/dist/documents/types/html-factory.d.ts +7 -0
- package/dist/documents/types/html-factory.js +5 -0
- package/dist/documents/types/index.d.ts +5 -0
- package/dist/documents/types/index.js +21 -0
- package/dist/documents/types/store-api.d.ts +1 -0
- package/dist/documents/types/store-api.js +2 -0
- package/dist/email/config/index.d.ts +17 -0
- package/dist/email/config/index.js +83 -0
- package/dist/email/config/notification-module.d.ts +22 -0
- package/dist/email/config/notification-module.js +19 -0
- package/dist/email/types/email-kinds.d.ts +15 -0
- package/dist/email/types/email-kinds.js +17 -0
- package/dist/email/types/index.d.ts +4 -0
- package/dist/email/types/index.js +20 -0
- package/dist/email/types/shop-configuration.d.ts +43 -0
- package/dist/email/types/shop-configuration.js +2 -0
- package/dist/email/types/smtp-configuration.d.ts +9 -0
- package/dist/email/types/smtp-configuration.js +2 -0
- package/dist/email/types/template-data.d.ts +100 -0
- package/dist/email/types/template-data.js +78 -0
- package/dist/files/config/index.d.ts +32 -0
- package/dist/files/config/index.js +255 -0
- package/dist/files/gateway/index.d.ts +30 -0
- package/dist/files/gateway/index.js +114 -0
- package/dist/files/types/index.d.ts +2 -0
- package/dist/files/types/index.js +5 -0
- package/dist/files/types/public.d.ts +90 -0
- package/dist/files/types/public.js +5 -0
- package/dist/modules/documents/domain/merchant.d.ts +22 -0
- package/dist/modules/documents/domain/merchant.js +85 -0
- package/dist/modules/documents/domain/options.d.ts +34 -0
- package/dist/modules/documents/domain/options.js +39 -0
- package/dist/public/config.d.ts +59 -0
- package/dist/public/config.js +185 -0
- package/dist/public/gateway.d.ts +2 -0
- package/dist/public/gateway.js +18 -0
- package/dist/public/instrumentation.d.ts +12 -0
- package/dist/public/instrumentation.js +55 -0
- package/dist/public/shop-config.d.ts +8 -0
- package/dist/public/shop-config.js +11 -0
- package/dist/public/shop-types.d.ts +7 -0
- package/dist/public/shop-types.js +23 -0
- package/dist/public/types.d.ts +17 -1
- package/dist/shop-config/build-food-shop-config.d.ts +44 -0
- package/dist/shop-config/build-food-shop-config.js +247 -0
- package/dist/shop-config/options.d.ts +41 -0
- package/dist/shop-config/options.js +70 -0
- package/package.json +48 -5
|
@@ -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);
|
|
@@ -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; } });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry of `@hartl-services/medusa-base/types`: the shop-facing types of the
|
|
3
|
+
* built-in E-Mail (shop branding, templates, SMTP) and Documents (merchant,
|
|
4
|
+
* HTML factory, wire types) modules.
|
|
5
|
+
*/
|
|
6
|
+
export * from "../email/types";
|
|
7
|
+
export * from "../documents/types";
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
/**
|
|
18
|
+
* Entry of `@hartl-services/medusa-base/types`: the shop-facing types of the
|
|
19
|
+
* built-in E-Mail (shop branding, templates, SMTP) and Documents (merchant,
|
|
20
|
+
* HTML factory, wire types) modules.
|
|
21
|
+
*/
|
|
22
|
+
__exportStar(require("../email/types"), exports);
|
|
23
|
+
__exportStar(require("../documents/types"), exports);
|
package/dist/public/types.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DocumentPluginOptions } from "../modules/documents/domain/options";
|
|
2
|
+
import type { EmailPluginOptions } from "../email/types";
|
|
3
|
+
import type { FilesPluginOptions } from "../files/types";
|
|
4
|
+
/**
|
|
5
|
+
* Options of the base plugin (`plugins: [{ resolve, options }]`). Medusa hands
|
|
6
|
+
* the same options object to every module of the plugin; each module service
|
|
7
|
+
* reads only its own namespace (`email`, `documents`), the `/files` routes
|
|
8
|
+
* read `files`. `{}` is valid: E-Mail then boots but does not send, the
|
|
9
|
+
* documents numbering time zone defaults to "Europe/Vienna", and the `/files`
|
|
10
|
+
* routes answer that signing is not configured.
|
|
11
|
+
*/
|
|
2
12
|
export type BasePluginOptions = {
|
|
3
13
|
/**
|
|
4
14
|
* Key material for stored secret settings; set it from an environment
|
|
@@ -6,6 +16,12 @@ export type BasePluginOptions = {
|
|
|
6
16
|
* Changing it makes stored secrets undecryptable ("nicht gesetzt").
|
|
7
17
|
*/
|
|
8
18
|
readonly settingsSecret?: string;
|
|
19
|
+
/** Mail dispatch: shop branding/URLs and the JWT secret of the links. */
|
|
20
|
+
readonly email?: EmailPluginOptions;
|
|
21
|
+
/** Order documents: merchant fallback, numbering, PDF, HTML factory. */
|
|
22
|
+
readonly documents?: DocumentPluginOptions;
|
|
23
|
+
/** `/files` gateway signing; set from `createS3CacheStorageConfig`. */
|
|
24
|
+
readonly files?: FilesPluginOptions;
|
|
9
25
|
};
|
|
10
26
|
export type PluginFeatureDefinition<K extends string = string> = {
|
|
11
27
|
readonly key: K;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineConfig } from "@medusajs/framework/utils";
|
|
2
|
+
import { withSentryErrorReporting } from "../public/sentry-logger";
|
|
3
|
+
import { type FoodShopConfigOptions } from "./options";
|
|
4
|
+
type ConfigInput = Parameters<typeof defineConfig>[0];
|
|
5
|
+
type ProjectConfigInput = NonNullable<Extract<NonNullable<ConfigInput>, {
|
|
6
|
+
projectConfig?: unknown;
|
|
7
|
+
}>["projectConfig"]>;
|
|
8
|
+
/** A plugin registration of the returned configuration. */
|
|
9
|
+
export type FoodShopPlugin = {
|
|
10
|
+
resolve: string;
|
|
11
|
+
options: Record<string, unknown>;
|
|
12
|
+
};
|
|
13
|
+
/** A module registration of the returned configuration. */
|
|
14
|
+
export type FoodShopModule = {
|
|
15
|
+
key?: string;
|
|
16
|
+
resolve: string;
|
|
17
|
+
options?: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The configuration input before `defineConfig`. `modules` and `plugins` are
|
|
21
|
+
* plain arrays so a caller (for example a test harness) can adjust them.
|
|
22
|
+
*/
|
|
23
|
+
export type FoodShopConfigInput = {
|
|
24
|
+
admin: {
|
|
25
|
+
path: `/${string}`;
|
|
26
|
+
};
|
|
27
|
+
logger: ReturnType<typeof withSentryErrorReporting>;
|
|
28
|
+
projectConfig: ProjectConfigInput;
|
|
29
|
+
modules: FoodShopModule[];
|
|
30
|
+
plugins: FoodShopPlugin[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Builds the plain `medusa-config.ts` input of a food shop: Medusa core
|
|
34
|
+
* settings, the Redis event bus, SMTP notifications, S3 file storage, tax and
|
|
35
|
+
* Stripe payment providers, and the Hartl Services plugins (the base plugin
|
|
36
|
+
* with its E-Mail, Documents and file storage modules plus five feature
|
|
37
|
+
* plugins). Deployment
|
|
38
|
+
* values are read and validated from `environment`; a missing or invalid one
|
|
39
|
+
* fails with its name.
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildFoodShopConfig(options: FoodShopConfigOptions, environment?: NodeJS.ProcessEnv): FoodShopConfigInput;
|
|
42
|
+
/** `defineConfig(buildFoodShopConfig(options))` for `module.exports`. */
|
|
43
|
+
export declare function defineFoodShopConfig(options: FoodShopConfigOptions, environment?: NodeJS.ProcessEnv): ReturnType<typeof defineConfig>;
|
|
44
|
+
export {};
|