@medusajs/medusa 2.12.2-snapshot-20251205140019 → 2.12.2-snapshot-20251207121122
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/dist/api/admin/locales/[code]/route.d.ts +4 -0
- package/dist/api/admin/locales/[code]/route.d.ts.map +1 -0
- package/dist/api/admin/locales/[code]/route.js +20 -0
- package/dist/api/admin/locales/[code]/route.js.map +1 -0
- package/dist/api/admin/locales/middlewares.d.ts +3 -0
- package/dist/api/admin/locales/middlewares.d.ts.map +1 -0
- package/dist/api/admin/locales/middlewares.js +56 -0
- package/dist/api/admin/locales/middlewares.js.map +1 -0
- package/dist/api/admin/locales/query-config.d.ts +11 -0
- package/dist/api/admin/locales/query-config.d.ts.map +1 -0
- package/dist/api/admin/locales/query-config.js +14 -0
- package/dist/api/admin/locales/query-config.js.map +1 -0
- package/dist/api/admin/locales/route.d.ts +4 -0
- package/dist/api/admin/locales/route.d.ts.map +1 -0
- package/dist/api/admin/locales/route.js +23 -0
- package/dist/api/admin/locales/route.js.map +1 -0
- package/dist/api/admin/locales/validators.d.ts +51 -0
- package/dist/api/admin/locales/validators.d.ts.map +1 -0
- package/dist/api/admin/locales/validators.js +18 -0
- package/dist/api/admin/locales/validators.js.map +1 -0
- package/dist/api/admin/stores/query-config.d.ts.map +1 -1
- package/dist/api/admin/stores/query-config.js +2 -0
- package/dist/api/admin/stores/query-config.js.map +1 -1
- package/dist/api/admin/stores/validators.d.ts +18 -0
- package/dist/api/admin/stores/validators.d.ts.map +1 -1
- package/dist/api/admin/stores/validators.js +6 -0
- package/dist/api/admin/stores/validators.js.map +1 -1
- package/dist/api/admin/translations/batch/route.d.ts +5 -0
- package/dist/api/admin/translations/batch/route.d.ts.map +1 -0
- package/dist/api/admin/translations/batch/route.js +41 -0
- package/dist/api/admin/translations/batch/route.js.map +1 -0
- package/dist/api/admin/translations/middlewares.d.ts +3 -0
- package/dist/api/admin/translations/middlewares.d.ts.map +1 -0
- package/dist/api/admin/translations/middlewares.js +79 -0
- package/dist/api/admin/translations/middlewares.js.map +1 -0
- package/dist/api/admin/translations/query-config.d.ts +10 -0
- package/dist/api/admin/translations/query-config.d.ts.map +1 -0
- package/dist/api/admin/translations/query-config.js +19 -0
- package/dist/api/admin/translations/query-config.js.map +1 -0
- package/dist/api/admin/translations/route.d.ts +4 -0
- package/dist/api/admin/translations/route.d.ts.map +1 -0
- package/dist/api/admin/translations/route.js +23 -0
- package/dist/api/admin/translations/route.js.map +1 -0
- package/dist/api/admin/translations/validators.d.ts +120 -0
- package/dist/api/admin/translations/validators.d.ts.map +1 -0
- package/dist/api/admin/translations/validators.js +34 -0
- package/dist/api/admin/translations/validators.js.map +1 -0
- package/dist/api/middlewares.d.ts.map +1 -1
- package/dist/api/middlewares.js +4 -0
- package/dist/api/middlewares.js.map +1 -1
- package/dist/api/store/products/[id]/route.d.ts.map +1 -1
- package/dist/api/store/products/[id]/route.js +5 -0
- package/dist/api/store/products/[id]/route.js.map +1 -1
- package/dist/api/store/products/middlewares.d.ts.map +1 -1
- package/dist/api/store/products/middlewares.js +4 -0
- package/dist/api/store/products/middlewares.js.map +1 -1
- package/dist/api/store/products/route.d.ts.map +1 -1
- package/dist/api/store/products/route.js +10 -0
- package/dist/api/store/products/route.js.map +1 -1
- package/dist/feature-flags/translation.d.ts +4 -0
- package/dist/feature-flags/translation.d.ts.map +1 -0
- package/dist/feature-flags/translation.js +10 -0
- package/dist/feature-flags/translation.js.map +1 -0
- package/dist/modules/translation.d.ts +5 -0
- package/dist/modules/translation.d.ts.map +1 -0
- package/dist/modules/translation.js +25 -0
- package/dist/modules/translation.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +54 -53
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
|
2
|
+
import { HttpTypes } from "@medusajs/framework/types";
|
|
3
|
+
export declare const GET: (req: MedusaRequest<HttpTypes.AdminLocaleParams>, res: MedusaResponse<HttpTypes.AdminLocaleResponse>) => Promise<void>;
|
|
4
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/api/admin/locales/[code]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,eAAO,MAAM,GAAG,GACd,KAAK,aAAa,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAC/C,KAAK,cAAc,CAAC,SAAS,CAAC,mBAAmB,CAAC,kBAqBnD,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
const GET = async (req, res) => {
|
|
6
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
7
|
+
const { data: [locale], } = await query.graph({
|
|
8
|
+
entity: "locale",
|
|
9
|
+
filters: {
|
|
10
|
+
code: req.params.code,
|
|
11
|
+
},
|
|
12
|
+
fields: req.queryConfig.fields,
|
|
13
|
+
}, {
|
|
14
|
+
cache: { enable: true },
|
|
15
|
+
throwIfKeyNotFound: true,
|
|
16
|
+
});
|
|
17
|
+
res.status(200).json({ locale });
|
|
18
|
+
};
|
|
19
|
+
exports.GET = GET;
|
|
20
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../src/api/admin/locales/[code]/route.ts"],"names":[],"mappings":";;;AAAA,qDAAqE;AAI9D,MAAM,GAAG,GAAG,KAAK,EACtB,GAA+C,EAC/C,GAAkD,EAClD,EAAE;IACF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,iCAAyB,CAAC,KAAK,CAAC,CAAA;IAEhE,MAAM,EACJ,IAAI,EAAE,CAAC,MAAM,CAAC,GACf,GAAG,MAAM,KAAK,CAAC,KAAK,CACnB;QACE,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE;YACP,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI;SACtB;QACD,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,MAAM;KAC/B,EACD;QACE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;QACvB,kBAAkB,EAAE,IAAI;KACzB,CACF,CAAA;IAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;AAClC,CAAC,CAAA;AAvBY,QAAA,GAAG,OAuBf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middlewares.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/locales/middlewares.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAK1D,eAAO,MAAM,6BAA6B,EAAE,eAAe,EAqB1D,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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.adminLocalesRoutesMiddlewares = void 0;
|
|
37
|
+
const framework_1 = require("@medusajs/framework");
|
|
38
|
+
const QueryConfig = __importStar(require("./query-config"));
|
|
39
|
+
const validators_1 = require("./validators");
|
|
40
|
+
exports.adminLocalesRoutesMiddlewares = [
|
|
41
|
+
{
|
|
42
|
+
method: ["GET"],
|
|
43
|
+
matcher: "/admin/locales",
|
|
44
|
+
middlewares: [
|
|
45
|
+
(0, framework_1.validateAndTransformQuery)(validators_1.AdminGetLocalesParams, QueryConfig.listTransformQueryConfig),
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
method: ["GET"],
|
|
50
|
+
matcher: "/admin/locales/:code",
|
|
51
|
+
middlewares: [
|
|
52
|
+
(0, framework_1.validateAndTransformQuery)(validators_1.AdminGetLocaleParams, QueryConfig.retrieveTransformQueryConfig),
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
//# sourceMappingURL=middlewares.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../../../src/api/admin/locales/middlewares.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mDAA+D;AAC/D,4DAA6C;AAC7C,6CAA0E;AAE7D,QAAA,6BAA6B,GAAsB;IAC9D;QACE,MAAM,EAAE,CAAC,KAAK,CAAC;QACf,OAAO,EAAE,gBAAgB;QACzB,WAAW,EAAE;YACX,IAAA,qCAAyB,EACvB,kCAAqB,EACrB,WAAW,CAAC,wBAAwB,CACrC;SACF;KACF;IACD;QACE,MAAM,EAAE,CAAC,KAAK,CAAC;QACf,OAAO,EAAE,sBAAsB;QAC/B,WAAW,EAAE;YACX,IAAA,qCAAyB,EACvB,iCAAoB,EACpB,WAAW,CAAC,4BAA4B,CACzC;SACF;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const defaultAdminLocaleFields: string[];
|
|
2
|
+
export declare const retrieveTransformQueryConfig: {
|
|
3
|
+
defaults: string[];
|
|
4
|
+
isList: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const listTransformQueryConfig: {
|
|
7
|
+
defaultLimit: number;
|
|
8
|
+
isList: boolean;
|
|
9
|
+
defaults: string[];
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=query-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-config.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/locales/query-config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,UAAmB,CAAA;AAExD,eAAO,MAAM,4BAA4B;;;CAGxC,CAAA;AAED,eAAO,MAAM,wBAAwB;;;;CAIpC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listTransformQueryConfig = exports.retrieveTransformQueryConfig = exports.defaultAdminLocaleFields = void 0;
|
|
4
|
+
exports.defaultAdminLocaleFields = ["code", "name"];
|
|
5
|
+
exports.retrieveTransformQueryConfig = {
|
|
6
|
+
defaults: exports.defaultAdminLocaleFields,
|
|
7
|
+
isList: false,
|
|
8
|
+
};
|
|
9
|
+
exports.listTransformQueryConfig = {
|
|
10
|
+
...exports.retrieveTransformQueryConfig,
|
|
11
|
+
defaultLimit: 200,
|
|
12
|
+
isList: true,
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=query-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-config.js","sourceRoot":"","sources":["../../../../src/api/admin/locales/query-config.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE3C,QAAA,4BAA4B,GAAG;IAC1C,QAAQ,EAAE,gCAAwB;IAClC,MAAM,EAAE,KAAK;CACd,CAAA;AAEY,QAAA,wBAAwB,GAAG;IACtC,GAAG,oCAA4B;IAC/B,YAAY,EAAE,GAAG;IACjB,MAAM,EAAE,IAAI;CACb,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
|
2
|
+
import { HttpTypes } from "@medusajs/framework/types";
|
|
3
|
+
export declare const GET: (req: MedusaRequest<HttpTypes.AdminLocaleListParams>, res: MedusaResponse<HttpTypes.AdminLocaleListResponse>) => Promise<void>;
|
|
4
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/locales/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,eAAO,MAAM,GAAG,GACd,KAAK,aAAa,CAAC,SAAS,CAAC,qBAAqB,CAAC,EACnD,KAAK,cAAc,CAAC,SAAS,CAAC,uBAAuB,CAAC,kBAsBvD,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
const GET = async (req, res) => {
|
|
6
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
7
|
+
const { data: locales, metadata } = await query.graph({
|
|
8
|
+
entity: "locale",
|
|
9
|
+
filters: req.filterableFields,
|
|
10
|
+
fields: req.queryConfig.fields,
|
|
11
|
+
pagination: req.queryConfig.pagination,
|
|
12
|
+
}, {
|
|
13
|
+
cache: { enable: true },
|
|
14
|
+
});
|
|
15
|
+
res.json({
|
|
16
|
+
locales,
|
|
17
|
+
count: metadata?.count ?? 0,
|
|
18
|
+
offset: metadata?.skip ?? 0,
|
|
19
|
+
limit: metadata?.take ?? 0,
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.GET = GET;
|
|
23
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../src/api/admin/locales/route.ts"],"names":[],"mappings":";;;AAAA,qDAAqE;AAI9D,MAAM,GAAG,GAAG,KAAK,EACtB,GAAmD,EACnD,GAAsD,EACtD,EAAE;IACF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,iCAAyB,CAAC,KAAK,CAAC,CAAA;IAEhE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,CACnD;QACE,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,GAAG,CAAC,gBAAgB;QAC7B,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,MAAM;QAC9B,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,UAAU;KACvC,EACD;QACE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;KACxB,CACF,CAAA;IAED,GAAG,CAAC,IAAI,CAAC;QACP,OAAO;QACP,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;QAC3B,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC;QAC3B,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC;KAC3B,CAAC,CAAA;AACJ,CAAC,CAAA;AAxBY,QAAA,GAAG,OAwBf"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const AdminGetLocaleParams: z.ZodObject<{
|
|
3
|
+
fields: z.ZodOptional<z.ZodString>;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
fields?: string | undefined;
|
|
6
|
+
}, {
|
|
7
|
+
fields?: string | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const AdminGetLocalesParamsFields: z.ZodObject<{
|
|
10
|
+
q: z.ZodOptional<z.ZodString>;
|
|
11
|
+
code: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
code?: string | string[] | undefined;
|
|
14
|
+
q?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
code?: string | string[] | undefined;
|
|
17
|
+
q?: string | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export type AdminGetLocalesParamsType = z.infer<typeof AdminGetLocalesParams>;
|
|
20
|
+
export declare const AdminGetLocalesParams: z.ZodObject<{} & {
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
$and: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodObject<{
|
|
23
|
+
q: z.ZodOptional<z.ZodString>;
|
|
24
|
+
code: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
code?: string | string[] | undefined;
|
|
27
|
+
q?: string | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
code?: string | string[] | undefined;
|
|
30
|
+
q?: string | undefined;
|
|
31
|
+
}>, "many">>>;
|
|
32
|
+
$or: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodObject<{
|
|
33
|
+
q: z.ZodOptional<z.ZodString>;
|
|
34
|
+
code: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
code?: string | string[] | undefined;
|
|
37
|
+
q?: string | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
code?: string | string[] | undefined;
|
|
40
|
+
q?: string | undefined;
|
|
41
|
+
}>, "many">>>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
[x: string]: any;
|
|
44
|
+
$and?: unknown;
|
|
45
|
+
$or?: unknown;
|
|
46
|
+
}, {
|
|
47
|
+
[x: string]: any;
|
|
48
|
+
$and?: unknown;
|
|
49
|
+
$or?: unknown;
|
|
50
|
+
}>;
|
|
51
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/locales/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,oBAAoB;;;;;;EAAuB,CAAA;AAExD,eAAO,MAAM,2BAA2B;;;;;;;;;EAGtC,CAAA;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAC7E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK2B,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdminGetLocalesParams = exports.AdminGetLocalesParamsFields = exports.AdminGetLocaleParams = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const validators_1 = require("../../utils/validators");
|
|
6
|
+
const common_validators_1 = require("../../utils/common-validators");
|
|
7
|
+
exports.AdminGetLocaleParams = (0, validators_1.createSelectParams)();
|
|
8
|
+
exports.AdminGetLocalesParamsFields = zod_1.z.object({
|
|
9
|
+
q: zod_1.z.string().optional(),
|
|
10
|
+
code: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
11
|
+
});
|
|
12
|
+
exports.AdminGetLocalesParams = (0, validators_1.createFindParams)({
|
|
13
|
+
offset: 0,
|
|
14
|
+
limit: 200,
|
|
15
|
+
})
|
|
16
|
+
.merge(exports.AdminGetLocalesParamsFields)
|
|
17
|
+
.merge((0, common_validators_1.applyAndAndOrOperators)(exports.AdminGetLocalesParamsFields));
|
|
18
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../src/api/admin/locales/validators.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,uDAA6E;AAC7E,qEAAsE;AAEzD,QAAA,oBAAoB,GAAG,IAAA,+BAAkB,GAAE,CAAA;AAE3C,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAClD,CAAC,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxB,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC5D,CAAC,CAAA;AAGW,QAAA,qBAAqB,GAAG,IAAA,6BAAgB,EAAC;IACpD,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,GAAG;CACX,CAAC;KACC,KAAK,CAAC,mCAA2B,CAAC;KAClC,KAAK,CAAC,IAAA,0CAAsB,EAAC,mCAA2B,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-config.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/stores/query-config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"query-config.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/stores/query-config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,UAanC,CAAA;AAED,eAAO,MAAM,4BAA4B;;;CAGxC,CAAA;AAED,eAAO,MAAM,wBAAwB;;;CAGpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-config.js","sourceRoot":"","sources":["../../../../src/api/admin/stores/query-config.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG;IACrC,IAAI;IACJ,MAAM;IACN,uBAAuB;IACvB,gCAAgC;IAChC,0BAA0B;IAC1B,mBAAmB;IACnB,qBAAqB;IACrB,UAAU;IACV,YAAY;IACZ,YAAY;CACb,CAAA;AAEY,QAAA,4BAA4B,GAAG;IAC1C,QAAQ,EAAE,+BAAuB;IACjC,MAAM,EAAE,KAAK;CACd,CAAA;AAEY,QAAA,wBAAwB,GAAG;IACtC,GAAG,oCAA4B;IAC/B,MAAM,EAAE,IAAI;CACb,CAAA"}
|
|
1
|
+
{"version":3,"file":"query-config.js","sourceRoot":"","sources":["../../../../src/api/admin/stores/query-config.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG;IACrC,IAAI;IACJ,MAAM;IACN,uBAAuB;IACvB,gCAAgC;IAChC,oBAAoB;IACpB,2BAA2B;IAC3B,0BAA0B;IAC1B,mBAAmB;IACnB,qBAAqB;IACrB,UAAU;IACV,YAAY;IACZ,YAAY;CACb,CAAA;AAEY,QAAA,4BAA4B,GAAG;IAC1C,QAAQ,EAAE,+BAAuB;IACjC,MAAM,EAAE,KAAK;CACd,CAAA;AAEY,QAAA,wBAAwB,GAAG;IACtC,GAAG,oCAA4B;IAC/B,MAAM,EAAE,IAAI;CACb,CAAA"}
|
|
@@ -74,6 +74,16 @@ export declare const AdminUpdateStore: z.ZodObject<{
|
|
|
74
74
|
is_tax_inclusive?: boolean | undefined;
|
|
75
75
|
is_default?: boolean | undefined;
|
|
76
76
|
}>, "many">>;
|
|
77
|
+
supported_locales: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
78
|
+
locale_code: z.ZodString;
|
|
79
|
+
is_default: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
locale_code: string;
|
|
82
|
+
is_default?: boolean | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
locale_code: string;
|
|
85
|
+
is_default?: boolean | undefined;
|
|
86
|
+
}>, "many">>;
|
|
77
87
|
default_sales_channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
88
|
default_region_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
89
|
default_location_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -89,6 +99,10 @@ export declare const AdminUpdateStore: z.ZodObject<{
|
|
|
89
99
|
is_tax_inclusive?: boolean | undefined;
|
|
90
100
|
is_default?: boolean | undefined;
|
|
91
101
|
}[] | undefined;
|
|
102
|
+
supported_locales?: {
|
|
103
|
+
locale_code: string;
|
|
104
|
+
is_default?: boolean | undefined;
|
|
105
|
+
}[] | undefined;
|
|
92
106
|
}, {
|
|
93
107
|
metadata?: Record<string, unknown> | null | undefined;
|
|
94
108
|
name?: string | undefined;
|
|
@@ -100,5 +114,9 @@ export declare const AdminUpdateStore: z.ZodObject<{
|
|
|
100
114
|
is_tax_inclusive?: boolean | undefined;
|
|
101
115
|
is_default?: boolean | undefined;
|
|
102
116
|
}[] | undefined;
|
|
117
|
+
supported_locales?: {
|
|
118
|
+
locale_code: string;
|
|
119
|
+
is_default?: boolean | undefined;
|
|
120
|
+
}[] | undefined;
|
|
103
121
|
}>;
|
|
104
122
|
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/stores/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AACzE,eAAO,MAAM,mBAAmB;;;;;;EAAuB,CAAA;AAEvD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;EAIrC,CAAA;AAEF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAC3E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK2B,CAAA;AAE5D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACnE,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/stores/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AACzE,eAAO,MAAM,mBAAmB;;;;;;EAAuB,CAAA;AAEvD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;EAIrC,CAAA;AAEF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAC3E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK2B,CAAA;AAE5D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACnE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuB3B,CAAA"}
|
|
@@ -25,6 +25,12 @@ exports.AdminUpdateStore = zod_1.z.object({
|
|
|
25
25
|
is_tax_inclusive: zod_1.z.boolean().optional(),
|
|
26
26
|
}))
|
|
27
27
|
.optional(),
|
|
28
|
+
supported_locales: zod_1.z
|
|
29
|
+
.array(zod_1.z.object({
|
|
30
|
+
locale_code: zod_1.z.string(),
|
|
31
|
+
is_default: zod_1.z.boolean().optional(),
|
|
32
|
+
}))
|
|
33
|
+
.optional(),
|
|
28
34
|
default_sales_channel_id: zod_1.z.string().nullish(),
|
|
29
35
|
default_region_id: zod_1.z.string().nullish(),
|
|
30
36
|
default_location_id: zod_1.z.string().nullish(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../src/api/admin/stores/validators.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,uDAA6E;AAC7E,qEAAsE;AAGzD,QAAA,mBAAmB,GAAG,IAAA,+BAAkB,GAAE,CAAA;AAE1C,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,CAAC,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxB,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EA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,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;KACnC,CAAC,CACH;SACA,QAAQ,EAAE;IACb,wBAAwB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9C,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IACvC,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IACzC,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CAC1C,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/framework";
|
|
2
|
+
import { BatchMethodRequest, HttpTypes } from "@medusajs/types";
|
|
3
|
+
import { AdminCreateTranslationType, AdminUpdateTranslationType } from "../validators";
|
|
4
|
+
export declare const POST: (req: AuthenticatedMedusaRequest<BatchMethodRequest<AdminCreateTranslationType, AdminUpdateTranslationType>>, res: MedusaResponse<HttpTypes.AdminTranslationsBatchResponse>) => Promise<MedusaResponse<HttpTypes.AdminTranslationsBatchResponse>>;
|
|
5
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/api/admin/translations/batch/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEhF,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE/D,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,eAAe,CAAA;AAEtB,eAAO,MAAM,IAAI,GACf,KAAK,0BAA0B,CAC7B,kBAAkB,CAAC,0BAA0B,EAAE,0BAA0B,CAAC,CAC3E,EACD,KAAK,cAAc,CAAC,SAAS,CAAC,8BAA8B,CAAC,sEA4C9D,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = void 0;
|
|
4
|
+
const core_flows_1 = require("@medusajs/core-flows");
|
|
5
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
6
|
+
const query_config_1 = require("../query-config");
|
|
7
|
+
const POST = async (req, res) => {
|
|
8
|
+
const { create = [], update = [], delete: deleteIds = [] } = req.validatedBody;
|
|
9
|
+
const { result } = await (0, core_flows_1.batchTranslationsWorkflow)(req.scope).run({
|
|
10
|
+
input: {
|
|
11
|
+
create,
|
|
12
|
+
update,
|
|
13
|
+
delete: deleteIds,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
const ids = Array.from(new Set([
|
|
17
|
+
...result.created.map((t) => t.id),
|
|
18
|
+
...result.updated.map((t) => t.id),
|
|
19
|
+
]));
|
|
20
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
21
|
+
const { data: translations } = await query.graph({
|
|
22
|
+
entity: "translation",
|
|
23
|
+
fields: query_config_1.defaultAdminTranslationFields,
|
|
24
|
+
filters: {
|
|
25
|
+
id: ids,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const created = translations.filter((t) => result.created.some((r) => r.id === t.id));
|
|
29
|
+
const updated = translations.filter((t) => result.updated.some((r) => r.id === t.id));
|
|
30
|
+
return res.status(200).json({
|
|
31
|
+
created,
|
|
32
|
+
updated,
|
|
33
|
+
deleted: {
|
|
34
|
+
ids: deleteIds,
|
|
35
|
+
object: "translation",
|
|
36
|
+
deleted: true,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
exports.POST = POST;
|
|
41
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../src/api/admin/translations/batch/route.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AAA;IACD,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACxC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAC1C,CAAA;IAED,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QAC1B,OAAO;QACP,OAAO;QACP,OAAO,EAAE;YACP,GAAG,EAAE,SAAS;YACd,MAAM,EAAE,aAAa;YACrB,OAAO,EAAE,IAAI;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAhDY,QAAA,IAAI,QAgDhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middlewares.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/translations/middlewares.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,eAAe,EAGhB,MAAM,qBAAqB,CAAA;AA0C5B,eAAO,MAAM,kCAAkC,EAAE,eAAe,EAuB/D,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.adminTranslationsRoutesMiddlewares = void 0;
|
|
40
|
+
const framework_1 = require("@medusajs/framework");
|
|
41
|
+
const validators_1 = require("./validators");
|
|
42
|
+
const QueryConfig = __importStar(require("./query-config"));
|
|
43
|
+
const utils_1 = require("../../../utils");
|
|
44
|
+
const utils_2 = require("@medusajs/framework/utils");
|
|
45
|
+
const translation_1 = __importDefault(require("../../../feature-flags/translation"));
|
|
46
|
+
const isTranslationsEnabledMiddleware = async (req, res, next) => {
|
|
47
|
+
const flagRouter = req.scope.resolve(utils_2.ContainerRegistrationKeys.FEATURE_FLAG_ROUTER);
|
|
48
|
+
const translationsModuleService = req.scope.resolve(utils_2.Modules.TRANSLATION, {
|
|
49
|
+
allowUnregistered: true,
|
|
50
|
+
});
|
|
51
|
+
const isTranslationsEnabled = flagRouter.isFeatureEnabled(translation_1.default.key) &&
|
|
52
|
+
!!translationsModuleService;
|
|
53
|
+
if (!isTranslationsEnabled) {
|
|
54
|
+
throw new utils_2.MedusaError(utils_2.MedusaErrorTypes.NOT_FOUND, `Translations feature flag is not enabled, make sure to set the appropiate environment variable or enable it in your medusa-config.ts file`);
|
|
55
|
+
}
|
|
56
|
+
return next();
|
|
57
|
+
};
|
|
58
|
+
exports.adminTranslationsRoutesMiddlewares = [
|
|
59
|
+
{
|
|
60
|
+
method: ["GET"],
|
|
61
|
+
matcher: "/admin/translations",
|
|
62
|
+
middlewares: [
|
|
63
|
+
isTranslationsEnabledMiddleware,
|
|
64
|
+
(0, framework_1.validateAndTransformQuery)(validators_1.AdminGetTranslationsParams, QueryConfig.listTransformQueryConfig),
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
method: ["POST"],
|
|
69
|
+
matcher: "/admin/translations/batch",
|
|
70
|
+
bodyParser: {
|
|
71
|
+
sizeLimit: utils_1.DEFAULT_BATCH_ENDPOINTS_SIZE_LIMIT,
|
|
72
|
+
},
|
|
73
|
+
middlewares: [
|
|
74
|
+
isTranslationsEnabledMiddleware,
|
|
75
|
+
(0, framework_1.validateAndTransformBody)(validators_1.AdminBatchTranslations),
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
//# sourceMappingURL=middlewares.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../../../src/api/admin/translations/middlewares.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAO4B;AAC5B,6CAGqB;AACrB,4DAA6C;AAC7C,0CAAmE;AACnE,qDAKkC;AAElC,qFAAuE;AAEvE,MAAM,+BAA+B,GAAG,KAAK,EAC3C,GAA+B,EAC/B,GAAmB,EACnB,IAAwB,EACxB,EAAE;IACF,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAClC,iCAAyB,CAAC,mBAAmB,CAC9C,CAAA;IACD,MAAM,yBAAyB,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,eAAO,CAAC,WAAW,EAAE;QACvE,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAA;IAEF,MAAM,qBAAqB,GACzB,UAAU,CAAC,gBAAgB,CAAC,qBAAsB,CAAC,GAAG,CAAC;QACvD,CAAC,CAAC,yBAAyB,CAAA;IAE7B,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,MAAM,IAAI,mBAAW,CACnB,wBAAgB,CAAC,SAAS,EAC1B,2IAA2I,CAC5I,CAAA;IACH,CAAC;IAED,OAAO,IAAI,EAAE,CAAA;AACf,CAAC,CAAA;AAEY,QAAA,kCAAkC,GAAsB;IACnE;QACE,MAAM,EAAE,CAAC,KAAK,CAAC;QACf,OAAO,EAAE,qBAAqB;QAC9B,WAAW,EAAE;YACX,+BAA+B;YAC/B,IAAA,qCAAyB,EACvB,uCAA0B,EAC1B,WAAW,CAAC,wBAAwB,CACrC;SACF;KACF;IACD;QACE,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,2BAA2B;QACpC,UAAU,EAAE;YACV,SAAS,EAAE,0CAAkC;SAC9C;QACD,WAAW,EAAE;YACX,+BAA+B;YAC/B,IAAA,oCAAwB,EAAC,mCAAsB,CAAC;SACjD;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const defaultAdminTranslationFields: string[];
|
|
2
|
+
export declare const retrieveTransformQueryConfig: {
|
|
3
|
+
defaults: string[];
|
|
4
|
+
isList: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const listTransformQueryConfig: {
|
|
7
|
+
isList: boolean;
|
|
8
|
+
defaults: string[];
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=query-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-config.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/translations/query-config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,UAMzC,CAAA;AAED,eAAO,MAAM,4BAA4B;;;CAGxC,CAAA;AAED,eAAO,MAAM,wBAAwB;;;CAGpC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listTransformQueryConfig = exports.retrieveTransformQueryConfig = exports.defaultAdminTranslationFields = void 0;
|
|
4
|
+
exports.defaultAdminTranslationFields = [
|
|
5
|
+
"id",
|
|
6
|
+
"reference_id",
|
|
7
|
+
"reference",
|
|
8
|
+
"locale_code",
|
|
9
|
+
"translations",
|
|
10
|
+
];
|
|
11
|
+
exports.retrieveTransformQueryConfig = {
|
|
12
|
+
defaults: exports.defaultAdminTranslationFields,
|
|
13
|
+
isList: false,
|
|
14
|
+
};
|
|
15
|
+
exports.listTransformQueryConfig = {
|
|
16
|
+
...exports.retrieveTransformQueryConfig,
|
|
17
|
+
isList: true,
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=query-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-config.js","sourceRoot":"","sources":["../../../../src/api/admin/translations/query-config.ts"],"names":[],"mappings":";;;AAAa,QAAA,6BAA6B,GAAG;IAC3C,IAAI;IACJ,cAAc;IACd,WAAW;IACX,aAAa;IACb,cAAc;CACf,CAAA;AAEY,QAAA,4BAA4B,GAAG;IAC1C,QAAQ,EAAE,qCAA6B;IACvC,MAAM,EAAE,KAAK;CACd,CAAA;AAEY,QAAA,wBAAwB,GAAG;IACtC,GAAG,oCAA4B;IAC/B,MAAM,EAAE,IAAI;CACb,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
|
2
|
+
import { HttpTypes } from "@medusajs/framework/types";
|
|
3
|
+
export declare const GET: (req: MedusaRequest<HttpTypes.AdminTranslationsListParams>, res: MedusaResponse<HttpTypes.AdminTranslationsListResponse>) => Promise<MedusaResponse<HttpTypes.AdminTranslationsListResponse>>;
|
|
4
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/api/admin/translations/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAGrD,eAAO,MAAM,GAAG,GACd,KAAK,aAAa,CAAC,SAAS,CAAC,2BAA2B,CAAC,EACzD,KAAK,cAAc,CAAC,SAAS,CAAC,6BAA6B,CAAC,qEAsB7D,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
const GET = async (req, res) => {
|
|
6
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
7
|
+
const { data: translations, metadata } = await query.graph({
|
|
8
|
+
entity: "translation",
|
|
9
|
+
fields: req.queryConfig.fields,
|
|
10
|
+
filters: req.filterableFields,
|
|
11
|
+
pagination: req.queryConfig.pagination,
|
|
12
|
+
}, {
|
|
13
|
+
cache: { enable: true },
|
|
14
|
+
});
|
|
15
|
+
return res.status(200).json({
|
|
16
|
+
translations,
|
|
17
|
+
count: metadata?.count ?? 0,
|
|
18
|
+
offset: metadata?.skip ?? 0,
|
|
19
|
+
limit: metadata?.take ?? 0,
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.GET = GET;
|
|
23
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../src/api/admin/translations/route.ts"],"names":[],"mappings":";;;AAEA,qDAAqE;AAE9D,MAAM,GAAG,GAAG,KAAK,EACtB,GAAyD,EACzD,GAA4D,EAC5D,EAAE;IACF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,iCAAyB,CAAC,KAAK,CAAC,CAAA;IAEhE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,CACxD;QACE,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,MAAM;QAC9B,OAAO,EAAE,GAAG,CAAC,gBAAgB;QAC7B,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,UAAU;KACvC,EACD;QACE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;KACxB,CACF,CAAA;IAED,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QAC1B,YAAY;QACZ,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;QAC3B,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC;QAC3B,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC;KAC3B,CAAC,CAAA;AACJ,CAAC,CAAA;AAxBY,QAAA,GAAG,OAwBf"}
|