@medusajs/framework 1.0.0-rc-20241001083650 → 1.0.0-rc-20241003153304
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/config/types.d.ts +1 -1
- package/dist/container.d.ts +2 -8
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js.map +1 -1
- package/dist/http/index.d.ts +7 -0
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +7 -0
- package/dist/http/index.js.map +1 -1
- package/dist/http/middlewares/apply-default-filters.d.ts +3 -0
- package/dist/http/middlewares/apply-default-filters.d.ts.map +1 -0
- package/dist/http/middlewares/apply-default-filters.js +32 -0
- package/dist/http/middlewares/apply-default-filters.js.map +1 -0
- package/dist/http/middlewares/apply-params-as-filters.d.ts +5 -0
- package/dist/http/middlewares/apply-params-as-filters.d.ts.map +1 -0
- package/dist/http/middlewares/apply-params-as-filters.js +14 -0
- package/dist/http/middlewares/apply-params-as-filters.js.map +1 -0
- package/dist/http/middlewares/clear-filters-by-key.d.ts +3 -0
- package/dist/http/middlewares/clear-filters-by-key.d.ts.map +1 -0
- package/dist/http/middlewares/clear-filters-by-key.js +12 -0
- package/dist/http/middlewares/clear-filters-by-key.js.map +1 -0
- package/dist/http/middlewares/ensure-publishable-api-key.d.ts +3 -0
- package/dist/http/middlewares/ensure-publishable-api-key.d.ts.map +1 -0
- package/dist/http/middlewares/ensure-publishable-api-key.js +49 -0
- package/dist/http/middlewares/ensure-publishable-api-key.js.map +1 -0
- package/dist/http/middlewares/error-handler.d.ts.map +1 -1
- package/dist/http/middlewares/error-handler.js.map +1 -1
- package/dist/http/middlewares/index.d.ts +4 -0
- package/dist/http/middlewares/index.d.ts.map +1 -1
- package/dist/http/middlewares/index.js +4 -0
- package/dist/http/middlewares/index.js.map +1 -1
- package/dist/http/middlewares/set-context.d.ts +3 -0
- package/dist/http/middlewares/set-context.d.ts.map +1 -0
- package/dist/http/middlewares/set-context.js +18 -0
- package/dist/http/middlewares/set-context.js.map +1 -0
- package/dist/http/router.d.ts +4 -0
- package/dist/http/router.d.ts.map +1 -1
- package/dist/http/router.js +14 -0
- package/dist/http/router.js.map +1 -1
- package/dist/http/types.d.ts +1 -10
- package/dist/http/types.d.ts.map +1 -1
- package/dist/http/types.js.map +1 -1
- package/dist/http/utils/get-query-config.d.ts +38 -0
- package/dist/http/utils/get-query-config.d.ts.map +1 -0
- package/dist/http/utils/get-query-config.js +163 -0
- package/dist/http/utils/get-query-config.js.map +1 -0
- package/dist/http/utils/http-compression.d.ts +5 -0
- package/dist/http/utils/http-compression.d.ts.map +1 -0
- package/dist/http/utils/http-compression.js +33 -0
- package/dist/http/utils/http-compression.js.map +1 -0
- package/dist/http/utils/maybe-apply-link-filter.d.ts +8 -0
- package/dist/http/utils/maybe-apply-link-filter.d.ts.map +1 -0
- package/dist/http/utils/maybe-apply-link-filter.js +71 -0
- package/dist/http/utils/maybe-apply-link-filter.js.map +1 -0
- package/dist/http/utils/refetch-entities.d.ts +5 -0
- package/dist/http/utils/refetch-entities.d.ts.map +1 -0
- package/dist/http/utils/refetch-entities.js +29 -0
- package/dist/http/utils/refetch-entities.js.map +1 -0
- package/dist/http/utils/unless-path.d.ts +9 -0
- package/dist/http/utils/unless-path.d.ts.map +1 -0
- package/dist/http/utils/unless-path.js +19 -0
- package/dist/http/utils/unless-path.js.map +1 -0
- package/dist/http/utils/validate-body.d.ts +5 -0
- package/dist/http/utils/validate-body.d.ts.map +1 -0
- package/dist/http/utils/validate-body.js +23 -0
- package/dist/http/utils/validate-body.js.map +1 -0
- package/dist/http/utils/validate-query.d.ts +6 -0
- package/dist/http/utils/validate-query.d.ts.map +1 -0
- package/dist/http/utils/validate-query.js +69 -0
- package/dist/http/utils/validate-query.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jobs/index.d.ts +1 -1
- package/dist/medusa-app-loader.d.ts +3 -2
- package/dist/medusa-app-loader.d.ts.map +1 -1
- package/dist/medusa-app-loader.js.map +1 -1
- package/dist/mikro-orm-cli/bin.d.ts +14 -0
- package/dist/mikro-orm-cli/bin.d.ts.map +1 -0
- package/dist/mikro-orm-cli/bin.js +54 -0
- package/dist/mikro-orm-cli/bin.js.map +1 -0
- package/dist/zod/index.d.ts +2 -0
- package/dist/zod/index.d.ts.map +1 -0
- package/dist/zod/index.js +18 -0
- package/dist/zod/index.js.map +1 -0
- package/dist/zod/zod-helpers.d.ts +3 -0
- package/dist/zod/zod-helpers.d.ts.map +1 -0
- package/dist/zod/zod-helpers.js +95 -0
- package/dist/zod/zod-helpers.js.map +1 -0
- package/package.json +19 -10
- package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,163 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.pickByConfig = pickByConfig;
|
4
|
+
exports.prepareListQuery = prepareListQuery;
|
5
|
+
exports.prepareRetrieveQuery = prepareRetrieveQuery;
|
6
|
+
const lodash_1 = require("lodash");
|
7
|
+
const utils_1 = require("@medusajs/utils");
|
8
|
+
function pickByConfig(obj, config) {
|
9
|
+
const fields = [...(config.select ?? []), ...(config.relations ?? [])];
|
10
|
+
if (fields.length) {
|
11
|
+
if (Array.isArray(obj)) {
|
12
|
+
return obj.map((o) => (0, lodash_1.pick)(o, fields));
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
return (0, lodash_1.pick)(obj, fields);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
return obj;
|
19
|
+
}
|
20
|
+
function prepareListQuery(validated, queryConfig = {}) {
|
21
|
+
// TODO: this function will be simplified a lot once we drop support for the old api
|
22
|
+
const { order, fields, limit = 50, expand, offset = 0 } = validated;
|
23
|
+
let { allowed = [], defaults = [], defaultFields = [], defaultLimit, allowedFields = [], allowedRelations = [], defaultRelations = [], isList, } = queryConfig;
|
24
|
+
allowedFields = allowed.length ? allowed : allowedFields;
|
25
|
+
defaultFields = defaults.length ? defaults : defaultFields;
|
26
|
+
// e.g *product.variants meaning that we want all fields from the product.variants
|
27
|
+
// in that case it wont be part of the select but it will be part of the relations.
|
28
|
+
// For the remote query we will have to add the fields to the fields array as product.variants.*
|
29
|
+
const starFields = new Set();
|
30
|
+
let allFields = new Set(defaultFields);
|
31
|
+
if ((0, utils_1.isDefined)(fields)) {
|
32
|
+
const customFields = fields.split(",").filter(Boolean);
|
33
|
+
const shouldReplaceDefaultFields = !customFields.length ||
|
34
|
+
customFields.some((field) => {
|
35
|
+
return !(field.startsWith("-") ||
|
36
|
+
field.startsWith("+") ||
|
37
|
+
field.startsWith(" ") ||
|
38
|
+
field.startsWith("*"));
|
39
|
+
});
|
40
|
+
if (shouldReplaceDefaultFields) {
|
41
|
+
allFields = new Set(customFields.map((f) => f.replace(/^[+ -]/, "")));
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
customFields.forEach((field) => {
|
45
|
+
if (field.startsWith("+") || field.startsWith(" ")) {
|
46
|
+
allFields.add(field.trim().replace(/^\+/, ""));
|
47
|
+
}
|
48
|
+
else if (field.startsWith("-")) {
|
49
|
+
allFields.delete(field.replace(/^-/, ""));
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
allFields.add(field);
|
53
|
+
}
|
54
|
+
});
|
55
|
+
}
|
56
|
+
allFields.add("id");
|
57
|
+
}
|
58
|
+
allFields.forEach((field) => {
|
59
|
+
if (field.startsWith("*")) {
|
60
|
+
starFields.add(field.replace(/^\*/, ""));
|
61
|
+
allFields.delete(field);
|
62
|
+
}
|
63
|
+
});
|
64
|
+
const notAllowedFields = [];
|
65
|
+
if (allowedFields.length) {
|
66
|
+
;
|
67
|
+
[...allFields, ...Array.from(starFields)].forEach((field) => {
|
68
|
+
const hasAllowedField = allowedFields.includes(field);
|
69
|
+
if (hasAllowedField) {
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
// Select full relation in that case it must match an allowed field fully
|
73
|
+
// e.g product.variants in that case we must have a product.variants in the allowedFields
|
74
|
+
if (starFields.has(field)) {
|
75
|
+
if (hasAllowedField) {
|
76
|
+
return;
|
77
|
+
}
|
78
|
+
notAllowedFields.push(field);
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
const fieldStartsWithAllowedField = allowedFields.some((allowedField) => field.startsWith(allowedField));
|
82
|
+
if (!fieldStartsWithAllowedField) {
|
83
|
+
notAllowedFields.push(field);
|
84
|
+
return;
|
85
|
+
}
|
86
|
+
});
|
87
|
+
}
|
88
|
+
if (allFields.size && notAllowedFields.length) {
|
89
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Requested fields [${Array.from(notAllowedFields).join(", ")}] are not valid`);
|
90
|
+
}
|
91
|
+
// TODO: maintain backward compatibility, remove in the future
|
92
|
+
const { select, relations } = (0, utils_1.stringToSelectRelationObject)(Array.from(allFields));
|
93
|
+
let allRelations = new Set([
|
94
|
+
...relations,
|
95
|
+
...defaultRelations,
|
96
|
+
...Array.from(starFields),
|
97
|
+
]);
|
98
|
+
if ((0, utils_1.isDefined)(expand)) {
|
99
|
+
allRelations = new Set(expand.split(",").filter(Boolean));
|
100
|
+
}
|
101
|
+
if (allowedRelations.length && expand) {
|
102
|
+
const allAllowedRelations = new Set([...allowedRelations]);
|
103
|
+
const notAllowedRelations = (0, utils_1.getSetDifference)(allRelations, allAllowedRelations);
|
104
|
+
if (allRelations.size && notAllowedRelations.size) {
|
105
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Requested fields [${Array.from(notAllowedRelations).join(", ")}] are not valid`);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
// End of expand compatibility
|
109
|
+
let orderBy = {};
|
110
|
+
if ((0, utils_1.isDefined)(order)) {
|
111
|
+
let orderField = order;
|
112
|
+
if (order.startsWith("-")) {
|
113
|
+
const [, field] = order.split("-");
|
114
|
+
orderField = field;
|
115
|
+
orderBy = { [field]: "DESC" };
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
orderBy = { [order]: "ASC" };
|
119
|
+
}
|
120
|
+
if (queryConfig?.allowedFields?.length &&
|
121
|
+
!queryConfig?.allowedFields.includes(orderField)) {
|
122
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Order field ${orderField} is not valid`);
|
123
|
+
}
|
124
|
+
}
|
125
|
+
const finalOrder = (0, utils_1.isPresent)(orderBy) ? orderBy : undefined;
|
126
|
+
return {
|
127
|
+
listConfig: {
|
128
|
+
select: select.length ? select : undefined,
|
129
|
+
relations: Array.from(allRelations),
|
130
|
+
skip: offset,
|
131
|
+
take: limit ?? defaultLimit,
|
132
|
+
order: finalOrder,
|
133
|
+
},
|
134
|
+
remoteQueryConfig: {
|
135
|
+
// Add starFields that are relations only on which we want all properties with a dedicated format to the remote query
|
136
|
+
fields: [
|
137
|
+
...Array.from(allFields),
|
138
|
+
...Array.from(starFields).map((f) => `${f}.*`),
|
139
|
+
],
|
140
|
+
pagination: isList
|
141
|
+
? {
|
142
|
+
skip: offset,
|
143
|
+
take: limit ?? defaultLimit,
|
144
|
+
order: finalOrder,
|
145
|
+
}
|
146
|
+
: {},
|
147
|
+
},
|
148
|
+
};
|
149
|
+
}
|
150
|
+
function prepareRetrieveQuery(validated, queryConfig) {
|
151
|
+
const { listConfig, remoteQueryConfig } = prepareListQuery(validated, queryConfig);
|
152
|
+
return {
|
153
|
+
retrieveConfig: {
|
154
|
+
select: listConfig.select,
|
155
|
+
relations: listConfig.relations,
|
156
|
+
},
|
157
|
+
remoteQueryConfig: {
|
158
|
+
fields: remoteQueryConfig.fields,
|
159
|
+
pagination: {},
|
160
|
+
},
|
161
|
+
};
|
162
|
+
}
|
163
|
+
//# sourceMappingURL=get-query-config.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"get-query-config.js","sourceRoot":"","sources":["../../../src/http/utils/get-query-config.ts"],"names":[],"mappings":";;AAUA,oCAcC;AAED,4CAwLC;AAED,oDAmBC;AAvOD,mCAA6B;AAE7B,2CAMwB;AAExB,SAAgB,YAAY,CAC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C,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC;aAC/C;YACD,UAAU,EAAE,MAAM;gBAChB,CAAC,CAAC;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,KAAK,IAAI,YAAY;oBAC3B,KAAK,EAAE,UAAU;iBAClB;gBACH,CAAC,CAAC,EAAE;SACP;KACF,CAAA;AACH,CAAC;AAED,SAAgB,oBAAoB,CAClC,SAAY,EACZ,WAAkC;IAElC,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CACxD,SAAS,EACT,WAAW,CACZ,CAAA;IAED,OAAO;QACL,cAAc,EAAE;YACd,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,SAAS,EAAE,UAAU,CAAC,SAAS;SAChC;QACD,iBAAiB,EAAE;YACjB,MAAM,EAAE,iBAAiB,CAAC,MAAM;YAChC,UAAU,EAAE,EAAE;SACf;KACF,CAAA;AACH,CAAC"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { HttpCompressionOptions, ProjectConfigOptions } from "../../config";
|
2
|
+
import type { MedusaRequest, MedusaResponse } from "../types";
|
3
|
+
export declare function shouldCompressResponse(req: MedusaRequest, res: MedusaResponse): boolean;
|
4
|
+
export declare function compressionOptions(config: ProjectConfigOptions): HttpCompressionOptions;
|
5
|
+
//# sourceMappingURL=http-compression.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"http-compression.d.ts","sourceRoot":"","sources":["../../../src/http/utils/http-compression.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE7D,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,cAAc,WAkBpB;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,oBAAoB,GAC3B,sBAAsB,CAWxB"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.shouldCompressResponse = shouldCompressResponse;
|
7
|
+
exports.compressionOptions = compressionOptions;
|
8
|
+
const compression_1 = __importDefault(require("compression"));
|
9
|
+
const utils_1 = require("@medusajs/utils");
|
10
|
+
function shouldCompressResponse(req, res) {
|
11
|
+
const { projectConfig } = req.scope.resolve(utils_1.ContainerRegistrationKeys.CONFIG_MODULE);
|
12
|
+
const { enabled } = compressionOptions(projectConfig);
|
13
|
+
if (!enabled) {
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
if (req.headers["x-no-compression"]) {
|
17
|
+
// don't compress responses with this request header
|
18
|
+
return false;
|
19
|
+
}
|
20
|
+
// fallback to standard filter function
|
21
|
+
return compression_1.default.filter(req, res);
|
22
|
+
}
|
23
|
+
function compressionOptions(config) {
|
24
|
+
const responseCompressionOptions = config.http.compression ?? {};
|
25
|
+
responseCompressionOptions.enabled =
|
26
|
+
responseCompressionOptions.enabled ?? false;
|
27
|
+
responseCompressionOptions.level = responseCompressionOptions.level ?? 6;
|
28
|
+
responseCompressionOptions.memLevel = responseCompressionOptions.memLevel ?? 8;
|
29
|
+
responseCompressionOptions.threshold =
|
30
|
+
responseCompressionOptions.threshold ?? 1024;
|
31
|
+
return responseCompressionOptions;
|
32
|
+
}
|
33
|
+
//# sourceMappingURL=http-compression.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"http-compression.js","sourceRoot":"","sources":["../../../src/http/utils/http-compression.ts"],"names":[],"mappings":";;;;;AAOA,wDAoBC;AAED,gDAaC;AA1CD,8DAAqC;AAErC,2CAA2D;AAK3D,SAAgB,sBAAsB,CACpC,GAAkB,EAClB,GAAmB;IAEnB,MAAM,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CACzC,iCAAyB,CAAC,aAAa,CACxC,CAAA;IACD,MAAM,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAA;IAErD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACpC,oDAAoD;QACpD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,uCAAuC;IACvC,OAAO,qBAAW,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC;AAED,SAAgB,kBAAkB,CAChC,MAA4B;IAE5B,MAAM,0BAA0B,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAA;IAEhE,0BAA0B,CAAC,OAAO;QAChC,0BAA0B,CAAC,OAAO,IAAI,KAAK,CAAA;IAC7C,0BAA0B,CAAC,KAAK,GAAG,0BAA0B,CAAC,KAAK,IAAI,CAAC,CAAA;IACxE,0BAA0B,CAAC,QAAQ,GAAG,0BAA0B,CAAC,QAAQ,IAAI,CAAC,CAAA;IAC9E,0BAA0B,CAAC,SAAS;QAClC,0BAA0B,CAAC,SAAS,IAAI,IAAI,CAAA;IAE9C,OAAO,0BAA0B,CAAA;AACnC,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { MedusaNextFunction, MedusaRequest } from "../types";
|
2
|
+
export declare function maybeApplyLinkFilter({ entryPoint, resourceId, filterableField, filterByField, }: {
|
3
|
+
entryPoint: any;
|
4
|
+
resourceId: any;
|
5
|
+
filterableField: any;
|
6
|
+
filterByField?: string | undefined;
|
7
|
+
}): (req: MedusaRequest, _: any, next: MedusaNextFunction) => Promise<void>;
|
8
|
+
//# sourceMappingURL=maybe-apply-link-filter.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"maybe-apply-link-filter.d.ts","sourceRoot":"","sources":["../../../src/http/utils/maybe-apply-link-filter.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE5D,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,UAAU,EACV,eAAe,EACf,aAAoB,GACrB;;;;;CAAA,SAEQ,aAAa,gBAEZ,kBAAkB,mBAiD3B"}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.maybeApplyLinkFilter = maybeApplyLinkFilter;
|
4
|
+
const utils_1 = require("@medusajs/utils");
|
5
|
+
function maybeApplyLinkFilter({ entryPoint, resourceId, filterableField, filterByField = "id", }) {
|
6
|
+
return async function linkFilter(req, _, next) {
|
7
|
+
const filterableFields = req.filterableFields;
|
8
|
+
if (!filterableFields?.[filterableField]) {
|
9
|
+
return next();
|
10
|
+
}
|
11
|
+
const filterFields = filterableFields[filterableField];
|
12
|
+
const idsToFilterBy = Array.isArray(filterFields)
|
13
|
+
? filterFields
|
14
|
+
: [filterFields];
|
15
|
+
delete filterableFields[filterableField];
|
16
|
+
const remoteQuery = req.scope.resolve(utils_1.ContainerRegistrationKeys.REMOTE_QUERY);
|
17
|
+
const queryObject = (0, utils_1.remoteQueryObjectFromString)({
|
18
|
+
entryPoint,
|
19
|
+
fields: [resourceId],
|
20
|
+
variables: { filters: { [filterableField]: idsToFilterBy } },
|
21
|
+
});
|
22
|
+
const resources = await remoteQuery(queryObject);
|
23
|
+
let existingFilters = filterableFields[filterByField];
|
24
|
+
if (existingFilters) {
|
25
|
+
if (typeof existingFilters === "string") {
|
26
|
+
existingFilters = [existingFilters];
|
27
|
+
}
|
28
|
+
filterableFields[filterByField] = (0, utils_1.arrayIntersection)(existingFilters, resources.map((p) => p[resourceId]));
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
filterableFields[filterByField] = resources.map((p) => p[resourceId]);
|
32
|
+
}
|
33
|
+
req.filterableFields = transformFilterableFields(filterableFields);
|
34
|
+
return next();
|
35
|
+
};
|
36
|
+
}
|
37
|
+
/*
|
38
|
+
Transforms an object key string into nested objects
|
39
|
+
before = {
|
40
|
+
"test.something.another": []
|
41
|
+
}
|
42
|
+
|
43
|
+
after = {
|
44
|
+
test: {
|
45
|
+
something: {
|
46
|
+
another: []
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
*/
|
51
|
+
function transformFilterableFields(filterableFields) {
|
52
|
+
const result = {};
|
53
|
+
for (const key of Object.keys(filterableFields)) {
|
54
|
+
const value = filterableFields[key];
|
55
|
+
const keys = key.split(".");
|
56
|
+
let current = result;
|
57
|
+
// Iterate over the keys, creating nested objects as needed
|
58
|
+
for (let i = 0; i < keys.length; i++) {
|
59
|
+
const part = keys[i];
|
60
|
+
current[part] ??= {};
|
61
|
+
if (i === keys.length - 1) {
|
62
|
+
// If its the last key, assign the value
|
63
|
+
current[part] = value;
|
64
|
+
break;
|
65
|
+
}
|
66
|
+
current = current[part];
|
67
|
+
}
|
68
|
+
}
|
69
|
+
return result;
|
70
|
+
}
|
71
|
+
//# sourceMappingURL=maybe-apply-link-filter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"maybe-apply-link-filter.js","sourceRoot":"","sources":["../../../src/http/utils/maybe-apply-link-filter.ts"],"names":[],"mappings":";;AAOA,oDA0DC;AAjED,2CAIwB;AAGxB,SAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,UAAU,EACV,eAAe,EACf,aAAa,GAAG,IAAI,GACrB;IACC,OAAO,KAAK,UAAU,UAAU,CAC9B,GAAkB,EAClB,CAAC,EACD,IAAwB;QAExB,MAAM,gBAAgB,GAAG,GAAG,CAAC,gBAAgB,CAAA;QAE7C,IAAI,CAAC,gBAAgB,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;YACzC,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QAED,MA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AaE;AACF,SAAS,yBAAyB,CAAC,gBAAyC;IAC1E,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;QACnC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAI,OAAO,GAAG,MAAM,CAAA;QAEpB,2DAA2D;QAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACpB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;YAEpB,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,wCAAwC;gBACxC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;gBACrB,MAAK;YACP,CAAC;YAED,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { MedusaContainer } from "@medusajs/types";
|
2
|
+
import { MedusaRequest } from "../types";
|
3
|
+
export declare const refetchEntities: (entryPoint: string, idOrFilter: string | object, scope: MedusaContainer, fields: string[], pagination?: MedusaRequest["remoteQueryConfig"]["pagination"]) => Promise<any>;
|
4
|
+
export declare const refetchEntity: (entryPoint: string, idOrFilter: string | object, scope: MedusaContainer, fields: string[]) => Promise<any>;
|
5
|
+
//# sourceMappingURL=refetch-entities.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"refetch-entities.d.ts","sourceRoot":"","sources":["../../../src/http/utils/refetch-entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAMjD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,eAAO,MAAM,eAAe,eACd,MAAM,cACN,MAAM,GAAG,MAAM,SACpB,eAAe,UACd,MAAM,EAAE,eACJ,aAAa,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,iBAuB7D,CAAA;AAED,eAAO,MAAM,aAAa,eACZ,MAAM,cACN,MAAM,GAAG,MAAM,SACpB,eAAe,UACd,MAAM,EAAE,iBAKjB,CAAA"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.refetchEntity = exports.refetchEntities = void 0;
|
4
|
+
const utils_1 = require("@medusajs/utils");
|
5
|
+
const refetchEntities = async (entryPoint, idOrFilter, scope, fields, pagination = {}) => {
|
6
|
+
const remoteQuery = scope.resolve(utils_1.ContainerRegistrationKeys.REMOTE_QUERY);
|
7
|
+
const filters = (0, utils_1.isString)(idOrFilter) ? { id: idOrFilter } : idOrFilter;
|
8
|
+
let context = {};
|
9
|
+
if ("context" in filters) {
|
10
|
+
if (filters.context) {
|
11
|
+
context = filters.context;
|
12
|
+
}
|
13
|
+
delete filters.context;
|
14
|
+
}
|
15
|
+
const variables = { filters, ...context, ...pagination };
|
16
|
+
const queryObject = (0, utils_1.remoteQueryObjectFromString)({
|
17
|
+
entryPoint,
|
18
|
+
variables,
|
19
|
+
fields,
|
20
|
+
});
|
21
|
+
return await remoteQuery(queryObject);
|
22
|
+
};
|
23
|
+
exports.refetchEntities = refetchEntities;
|
24
|
+
const refetchEntity = async (entryPoint, idOrFilter, scope, fields) => {
|
25
|
+
const [entity] = await (0, exports.refetchEntities)(entryPoint, idOrFilter, scope, fields);
|
26
|
+
return entity;
|
27
|
+
};
|
28
|
+
exports.refetchEntity = refetchEntity;
|
29
|
+
//# sourceMappingURL=refetch-entities.js.map
|
@@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-0,0 +1,9 @@
|
|
1
|
+
import { MedusaNextFunction, MedusaRequest, MedusaResponse, MiddlewareFunction } from "../types";
|
2
|
+
/**
|
3
|
+
* Due to how our route loader works, where we load all middlewares before routes, ambiguous routes * end up having all middlewares on different routes executed before the route handler is.
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* This function allows us to skip middlewares for particular routes, so we can temporarily solve * * this without completely breaking the route loader for everyone.
|
7
|
+
*/
|
8
|
+
export declare const unlessPath: (onPath: RegExp, middleware: MiddlewareFunction) => (req: MedusaRequest, res: MedusaResponse, next: MedusaNextFunction) => any;
|
9
|
+
//# sourceMappingURL=unless-path.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unless-path.d.ts","sourceRoot":"","sources":["../../../src/http/utils/unless-path.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAEjB;;GAEG;AACH;;GAEG;AACH,eAAO,MAAM,UAAU,WACZ,MAAM,cAAc,kBAAkB,WACzC,aAAa,OAAO,cAAc,QAAQ,kBAAkB,QAMjE,CAAA"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.unlessPath = void 0;
|
4
|
+
/**
|
5
|
+
* Due to how our route loader works, where we load all middlewares before routes, ambiguous routes * end up having all middlewares on different routes executed before the route handler is.
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* This function allows us to skip middlewares for particular routes, so we can temporarily solve * * this without completely breaking the route loader for everyone.
|
9
|
+
*/
|
10
|
+
const unlessPath = (onPath, middleware) => (req, res, next) => {
|
11
|
+
if (onPath.test(req.path)) {
|
12
|
+
return next();
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
return middleware(req, res, next);
|
16
|
+
}
|
17
|
+
};
|
18
|
+
exports.unlessPath = unlessPath;
|
19
|
+
//# sourceMappingURL=unless-path.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unless-path.js","sourceRoot":"","sources":["../../../src/http/utils/unless-path.ts"],"names":[],"mappings":";;;AAOA;;GAEG;AACH;;GAEG;AACI,MAAM,UAAU,GACrB,CAAC,MAAc,EAAE,UAA8B,EAAE,EAAE,CACnD,CAAC,GAAkB,EAAE,GAAmB,EAAE,IAAwB,EAAE,EAAE;IACpE,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,EAAE,CAAA;IACf,CAAC;SAAM,CAAC;QACN,OAAO,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;AACH,CAAC,CAAA;AARU,QAAA,UAAU,cAQpB"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
import { NextFunction } from "express";
|
3
|
+
import { MedusaRequest, MedusaResponse } from "../types";
|
4
|
+
export declare function validateAndTransformBody(zodSchema: z.ZodObject<any, any> | ((customSchema?: z.ZodObject<any, any>) => z.ZodObject<any, any> | z.ZodEffects<any, any>)): (req: MedusaRequest, res: MedusaResponse, next: NextFunction) => Promise<void>;
|
5
|
+
//# sourceMappingURL=validate-body.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"validate-body.d.ts","sourceRoot":"","sources":["../../../src/http/utils/validate-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAGxD,wBAAgB,wBAAwB,CACtC,SAAS,EACL,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GACrB,CAAC,CACC,YAAY,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,KACjC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GACvD,CACD,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,YAAY,KACf,OAAO,CAAC,IAAI,CAAC,CAoBjB"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.validateAndTransformBody = validateAndTransformBody;
|
4
|
+
const zod_helpers_1 = require("../../zod/zod-helpers");
|
5
|
+
function validateAndTransformBody(zodSchema) {
|
6
|
+
return async function validateBody(req, _, next) {
|
7
|
+
try {
|
8
|
+
let schema;
|
9
|
+
if (typeof zodSchema === "function") {
|
10
|
+
schema = zodSchema(req.additionalDataValidator);
|
11
|
+
}
|
12
|
+
else {
|
13
|
+
schema = zodSchema;
|
14
|
+
}
|
15
|
+
req.validatedBody = await (0, zod_helpers_1.zodValidator)(schema, req.body);
|
16
|
+
next();
|
17
|
+
}
|
18
|
+
catch (e) {
|
19
|
+
next(e);
|
20
|
+
}
|
21
|
+
};
|
22
|
+
}
|
23
|
+
//# sourceMappingURL=validate-body.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"validate-body.js","sourceRoot":"","sources":["../../../src/http/utils/validate-body.ts"],"names":[],"mappings":";;AAKA,4DA8BC;AAhCD,uDAAoD;AAEpD,SAAgB,wBAAwB,CACtC,SAIwD;IAMxD,OAAO,KAAK,UAAU,YAAY,CAChC,GAAkB,EAClB,CAAiB,EACjB,IAAkB;QAElB,IAAI,CAAC;YACH,IAAI,MAAsD,CAAA;YAC1D,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;gBACpC,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;YACjD,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,SAAS,CAAA;YACpB,CAAC;YAED,GAAG,CAAC,aAAa,GAAG,MAAM,IAAA,0BAAY,EAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;YACxD,IAAI,EAAE,CAAA;QACR,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,CAAC,CAAC,CAAA;QACT,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
import { NextFunction } from "express";
|
3
|
+
import { BaseEntity, QueryConfig } from "@medusajs/types";
|
4
|
+
import { MedusaRequest, MedusaResponse } from "../types";
|
5
|
+
export declare function validateAndTransformQuery<TEntity extends BaseEntity>(zodSchema: z.ZodObject<any, any> | z.ZodEffects<any, any>, queryConfig: QueryConfig<TEntity>): (req: MedusaRequest, res: MedusaResponse, next: NextFunction) => Promise<void>;
|
6
|
+
//# sourceMappingURL=validate-query.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"validate-query.d.ts","sourceRoot":"","sources":["../../../src/http/utils/validate-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAA;AAG7E,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAiDxD,wBAAgB,yBAAyB,CAAC,OAAO,SAAS,UAAU,EAClE,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EACzD,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,GAChC,CACD,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,YAAY,KACf,OAAO,CAAC,IAAI,CAAC,CA2BjB"}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.validateAndTransformQuery = validateAndTransformQuery;
|
4
|
+
const lodash_1 = require("lodash");
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
6
|
+
const zod_helpers_1 = require("../../zod/zod-helpers");
|
7
|
+
const get_query_config_1 = require("./get-query-config");
|
8
|
+
/**
|
9
|
+
* Normalize an input query, especially from array like query params to an array type
|
10
|
+
* e.g: /admin/orders/?fields[]=id,status,cart_id becomes { fields: ["id", "status", "cart_id"] }
|
11
|
+
*
|
12
|
+
* We only support up to 2 levels of depth for query params in order to have a somewhat readable query param, and limit possible performance issues
|
13
|
+
*/
|
14
|
+
const normalizeQuery = (req) => {
|
15
|
+
return Object.entries(req.query).reduce((acc, [key, val]) => {
|
16
|
+
let normalizedValue = val;
|
17
|
+
if (Array.isArray(val) && val.length === 1 && typeof val[0] === "string") {
|
18
|
+
normalizedValue = val[0].split(",");
|
19
|
+
}
|
20
|
+
if (key.includes(".")) {
|
21
|
+
const [parent, child, ...others] = key.split(".");
|
22
|
+
if (others.length > 0) {
|
23
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_ARGUMENT, `Key accessor more than 2 levels deep: ${key}`);
|
24
|
+
}
|
25
|
+
if (!acc[parent]) {
|
26
|
+
acc[parent] = {};
|
27
|
+
}
|
28
|
+
acc[parent] = {
|
29
|
+
...acc[parent],
|
30
|
+
[child]: normalizedValue,
|
31
|
+
};
|
32
|
+
}
|
33
|
+
else {
|
34
|
+
acc[key] = normalizedValue;
|
35
|
+
}
|
36
|
+
return acc;
|
37
|
+
}, {});
|
38
|
+
};
|
39
|
+
/**
|
40
|
+
* Omit the non filterable config from the validated object
|
41
|
+
* @param obj
|
42
|
+
*/
|
43
|
+
const getFilterableFields = (obj) => {
|
44
|
+
const result = (0, lodash_1.omit)(obj, ["limit", "offset", "fields", "order"]);
|
45
|
+
return (0, utils_1.removeUndefinedProperties)(result);
|
46
|
+
};
|
47
|
+
function validateAndTransformQuery(zodSchema, queryConfig) {
|
48
|
+
return async function validateQuery(req, _, next) {
|
49
|
+
try {
|
50
|
+
const allowed = (req.allowed ?? queryConfig.allowed ?? []);
|
51
|
+
delete req.allowed;
|
52
|
+
const query = normalizeQuery(req);
|
53
|
+
const validated = await (0, zod_helpers_1.zodValidator)(zodSchema, query);
|
54
|
+
const cnf = queryConfig.isList
|
55
|
+
? (0, get_query_config_1.prepareListQuery)(validated, { ...queryConfig, allowed })
|
56
|
+
: (0, get_query_config_1.prepareRetrieveQuery)(validated, { ...queryConfig, allowed });
|
57
|
+
req.validatedQuery = validated;
|
58
|
+
req.filterableFields = getFilterableFields(req.validatedQuery);
|
59
|
+
req.remoteQueryConfig = cnf.remoteQueryConfig;
|
60
|
+
req.listConfig = cnf.listConfig;
|
61
|
+
req.retrieveConfig = cnf.retrieveConfig;
|
62
|
+
next();
|
63
|
+
}
|
64
|
+
catch (e) {
|
65
|
+
next(e);
|
66
|
+
}
|
67
|
+
};
|
68
|
+
}
|
69
|
+
//# sourceMappingURL=validate-query.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"validate-query.js","sourceRoot":"","sources":["../../../src/http/utils/validate-query.ts"],"names":[],"mappings":";;AAwDA,8DAkCC;AAzFD,mCAA6B;AAE7B,2CAAwE;AAGxE,uDAAoD;AAEpD,yDAA2E;AAE3E;;;;;GAKG;AACH,MAAM,cAAc,GAAG,CAAC,GAAkB,EAAE,EAAE;IAC5C,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;QAC1D,IAAI,eAAe,GAAG,GAAG,CAAA;QACzB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,C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AU,aAAa,CACjC,GAAkB,EAClB,CAAiB,EACjB,IAAkB;QAElB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,IAAI,WAAW,CAAC,OAAO,IAAI,EAAE,CAAa,CAAA;YACtE,OAAO,GAAG,CAAC,OAAO,CAAA;YAClB,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,CAAA;YAEjC,MAAM,SAAS,GAAG,MAAM,IAAA,0BAAY,EAAC,SAAS,EAAE,KAAK,CAAC,CAAA;YACtD,MAAM,GAAG,GAAG,WAAW,CAAC,MAAM;gBAC5B,CAAC,CAAC,IAAA,mCAAgB,EAAC,SAAS,EAAE,EAAE,GAAG,WAAW,EAAE,OAAO,EAAE,CAAC;gBAC1D,CAAC,CAAC,IAAA,uCAAoB,EAAC,SAAS,EAAE,EAAE,GAAG,WAAW,EAAE,OAAO,EAAE,CAAC,CAAA;YAEhE,GAAG,CAAC,cAAc,GAAG,SAAS,CAAA;YAC9B,GAAG,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;YAC9D,GAAG,CAAC,iBAAiB,GAAG,GAAG,CAAC,iBAAiB,CAAA;YAC7C,GAAG,CAAC,UAAU,GAAI,GAAW,CAAC,UAAU,CAAA;YACxC,GAAG,CAAC,cAAc,GAAI,GAAW,CAAC,cAAc,CAAA;YAEhD,IAAI,EAAE,CAAA;QACR,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,CAAC,CAAC,CAAA;QACT,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
@@ -10,6 +10,7 @@ export * from "./medusa-app-loader";
|
|
10
10
|
export * from "./subscribers";
|
11
11
|
export * from "./workflows";
|
12
12
|
export * from "./telemetry";
|
13
|
+
export * from "./zod";
|
13
14
|
export declare const MEDUSA_CLI_PATH: string;
|
14
15
|
export { Query } from "@medusajs/modules-sdk";
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,OAAO,CAAA;AAErB,eAAO,MAAM,eAAe,QAA0C,CAAA;AAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA"}
|
package/dist/index.js
CHANGED
@@ -27,6 +27,7 @@ __exportStar(require("./medusa-app-loader"), exports);
|
|
27
27
|
__exportStar(require("./subscribers"), exports);
|
28
28
|
__exportStar(require("./workflows"), exports);
|
29
29
|
__exportStar(require("./telemetry"), exports);
|
30
|
+
__exportStar(require("./zod"), exports);
|
30
31
|
exports.MEDUSA_CLI_PATH = require.resolve("@medusajs/medusa-cli");
|
31
32
|
var modules_sdk_1 = require("@medusajs/modules-sdk");
|
32
33
|
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return modules_sdk_1.Query; } });
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B;AAC1B,kDAA+B;AAC/B,yCAAsB;AACtB,yCAAsB;AACtB,0CAAuB;AACvB,2CAAwB;AACxB,sDAAmC;AACnC,gDAA6B;AAC7B,8CAA2B;AAC3B,8CAA2B;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B;AAC1B,kDAA+B;AAC/B,yCAAsB;AACtB,yCAAsB;AACtB,0CAAuB;AACvB,2CAAwB;AACxB,sDAAmC;AACnC,gDAA6B;AAC7B,8CAA2B;AAC3B,8CAA2B;AAC3B,wCAAqB;AAER,QAAA,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;AAEtE,qDAA6C;AAApC,oGAAA,KAAK,OAAA"}
|
package/dist/jobs/index.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from
|
1
|
+
export * from "./job-loader";
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { MedusaAppOutput, RegisterModuleJoinerConfig } from "@medusajs/modules-sdk";
|
2
2
|
import { CommonTypes, ILinkMigrationsPlanner, InternalModuleDeclaration, ModuleServiceInitializeOptions } from "@medusajs/types";
|
3
3
|
import { MedusaContainer } from "./container";
|
4
|
+
import type { Knex } from "@mikro-orm/knex";
|
4
5
|
export declare class MedusaAppLoader {
|
5
6
|
#private;
|
6
7
|
constructor({ container, customLinksModules, }?: {
|
@@ -13,8 +14,8 @@ export declare class MedusaAppLoader {
|
|
13
14
|
protected prepareSharedResourcesAndDeps(): {
|
14
15
|
sharedResourcesConfig: ModuleServiceInitializeOptions;
|
15
16
|
injectedDependencies: {
|
16
|
-
__pg_connection__:
|
17
|
-
logger:
|
17
|
+
__pg_connection__: Knex<any, any[]>;
|
18
|
+
logger: import("@medusajs/types").Logger;
|
18
19
|
};
|
19
20
|
};
|
20
21
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"medusa-app-loader.d.ts","sourceRoot":"","sources":["../src/medusa-app-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,eAAe,EAEf,0BAA0B,EAC3B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,WAAW,EAEX,sBAAsB,EACtB,yBAAyB,EAGzB,8BAA8B,EAC/B,MAAM,iBAAiB,CAAA;AAYxB,OAAO,EAGL,eAAe,EAChB,MAAM,aAAa,CAAA;
|
1
|
+
{"version":3,"file":"medusa-app-loader.d.ts","sourceRoot":"","sources":["../src/medusa-app-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,eAAe,EAEf,0BAA0B,EAC3B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,WAAW,EAEX,sBAAsB,EACtB,yBAAyB,EAGzB,8BAA8B,EAC/B,MAAM,iBAAiB,CAAA;AAYxB,OAAO,EAGL,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C,qBAAa,eAAe;;gBAkBd,EACV,SAAS,EACT,kBAAkB,GACnB,GAAE;QACD,SAAS,CAAC,EAAE,eAAe,CAAA;QAC3B,kBAAkB,CAAC,EACf,0BAA0B,GAC1B,0BAA0B,EAAE,CAAA;KAC5B;IAKN,SAAS,CAAC,mBAAmB,CAC3B,aAAa,EAAE,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC;;;IAsCpD,SAAS,CAAC,6BAA6B;;;;;;;IA6BvC;;;;;;OAMG;IACG,oBAAoB,CACxB,EACE,WAAW,EACX,MAAc,GACf,GACG;QACE,WAAW,CAAC,EAAE,KAAK,CAAA;QACnB,MAAM,EAAE,KAAK,CAAA;KACd,GACD;QACE,WAAW,EAAE,MAAM,EAAE,CAAA;QACrB,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;KAGlC,GACA,OAAO,CAAC,IAAI,CAAC;IAuBhB;;OAEG;IACG,wBAAwB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAgBjE;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAevC;;;OAGG;IACG,IAAI,CAAC,MAAM;;KAAgC,GAAG,OAAO,CAAC,eAAe,CAAC;CAgE7E"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"medusa-app-loader.js","sourceRoot":"","sources":["../src/medusa-app-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAS8B;AAU9B,2CAMwB;AAGxB,mCAAgC;AAChC,qCAAwC;AACxC,2CAIoB;
|
1
|
+
{"version":3,"file":"medusa-app-loader.js","sourceRoot":"","sources":["../src/medusa-app-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAS8B;AAU9B,2CAMwB;AAGxB,mCAAgC;AAChC,qCAAwC;AACxC,2CAIoB;AAGpB,MAAa,eAAe;IAe1B,2KAA2K;IAC3K,mIAAmI;IACnI,kBAAkB;IAClB,YAAY,EACV,SAAS,EACT,kBAAkB,MAMhB,EAAE;QAzBN;;;WAGG;QACM,6CAA2B;QAEpC;;;WAGG;QACM,sDAEuB;QAc9B,uBAAA,IAAI,8BAAc,SAAS,IAAI,qBAAa,MAAA,CAAA;QAC5C,uBAAA,IAAI,uCAAuB,kBAAkB,IAAI,EAAE,MAAA,CAAA;IACrD,CAAC;IAES,mBAAmB,CAC3B,aAAkD;QAElD,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,+BAAiB,CAAC,CAAC,MAAM,CAC5D,CAAC,UAA4B,EAAE,EA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