@medusajs/region 0.1.2-snapshot-20240426112214 → 0.1.2-snapshot-20240516152256

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- import { moduleDefinition, revertMigration, runMigrations } from "./module-definition";
1
+ import { moduleDefinition } from "./module-definition";
2
2
  export default moduleDefinition;
3
- export { revertMigration, runMigrations };
4
- export * from "./initialize";
package/dist/index.js CHANGED
@@ -1,22 +1,4 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.runMigrations = exports.revertMigration = void 0;
18
3
  const module_definition_1 = require("./module-definition");
19
- Object.defineProperty(exports, "revertMigration", { enumerable: true, get: function () { return module_definition_1.revertMigration; } });
20
- Object.defineProperty(exports, "runMigrations", { enumerable: true, get: function () { return module_definition_1.runMigrations; } });
21
4
  exports.default = module_definition_1.moduleDefinition;
22
- __exportStar(require("./initialize"), exports);
@@ -9,7 +9,7 @@ exports.LinkableKeys = {
9
9
  };
10
10
  const entityLinkableKeysMap = {};
11
11
  Object.entries(exports.LinkableKeys).forEach(([key, value]) => {
12
- entityLinkableKeysMap[value] ?? (entityLinkableKeysMap[value] = []);
12
+ entityLinkableKeysMap[value] ??= [];
13
13
  entityLinkableKeysMap[value].push({
14
14
  mapTo: key,
15
15
  valueFrom: key.split("_").pop(),
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("@medusajs/utils");
4
- const utils_2 = require("@medusajs/utils");
5
4
  exports.default = async ({ container }) => {
6
5
  // TODO: Add default logger to the container when running tests
7
6
  const logger = container.resolve(utils_1.ContainerRegistrationKeys.LOGGER) ?? console;
8
7
  const countryService_ = container.resolve("countryService");
9
8
  try {
10
- const normalizedCountries = utils_2.DefaultsUtils.defaultCountries.map((c) => ({
9
+ const normalizedCountries = utils_1.DefaultsUtils.defaultCountries.map((c) => ({
11
10
  iso_2: c.alpha2.toLowerCase(),
12
11
  iso_3: c.alpha3.toLowerCase(),
13
12
  num_code: c.numeric,
@@ -1,3 +1 @@
1
- export * from "./connection";
2
- export * from "./container";
3
1
  export * from "./defaults";
@@ -14,6 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./connection"), exports);
18
- __exportStar(require("./container"), exports);
19
17
  __exportStar(require("./defaults"), exports);
@@ -1,4 +1,2 @@
1
1
  import { ModuleExports } from "@medusajs/types";
2
- export declare const runMigrations: ({ options, logger, }?: Pick<import("@medusajs/types").LoaderOptions<import("@medusajs/types").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
3
- export declare const revertMigration: ({ options, logger, }?: Pick<import("@medusajs/types").LoaderOptions<import("@medusajs/types").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
4
2
  export declare const moduleDefinition: ModuleExports;
@@ -1,51 +1,14 @@
1
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.moduleDefinition = exports.revertMigration = exports.runMigrations = void 0;
6
+ exports.moduleDefinition = void 0;
30
7
  const services_1 = require("./services");
31
- const modules_sdk_1 = require("@medusajs/modules-sdk");
32
- const utils_1 = require("@medusajs/utils");
33
- const RegionModels = __importStar(require("./models"));
34
- const connection_1 = __importDefault(require("./loaders/connection"));
35
- const container_1 = __importDefault(require("./loaders/container"));
36
8
  const defaults_1 = __importDefault(require("./loaders/defaults"));
37
- const migrationScriptOptions = {
38
- moduleName: modules_sdk_1.Modules.REGION,
39
- models: RegionModels,
40
- pathToMigrations: __dirname + "/migrations",
41
- };
42
- exports.runMigrations = utils_1.ModulesSdkUtils.buildMigrationScript(migrationScriptOptions);
43
- exports.revertMigration = utils_1.ModulesSdkUtils.buildRevertMigrationScript(migrationScriptOptions);
44
9
  const service = services_1.RegionModuleService;
45
- const loaders = [container_1.default, connection_1.default, defaults_1.default];
10
+ const loaders = [defaults_1.default];
46
11
  exports.moduleDefinition = {
47
12
  service,
48
13
  loaders,
49
- runMigrations: exports.runMigrations,
50
- revertMigration: exports.revertMigration,
51
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/region",
3
- "version": "0.1.2-snapshot-20240426112214",
3
+ "version": "0.1.2-snapshot-20240516152256",
4
4
  "description": "Medusa Region module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -48,9 +48,9 @@
48
48
  "typescript": "^5.1.6"
49
49
  },
50
50
  "dependencies": {
51
- "@medusajs/modules-sdk": "1.12.11-snapshot-20240426112214",
52
- "@medusajs/types": "1.12.0-snapshot-20240426112214",
53
- "@medusajs/utils": "1.12.0-snapshot-20240426112214",
51
+ "@medusajs/modules-sdk": "1.13.0-snapshot-20240516152256",
52
+ "@medusajs/types": "1.12.0-snapshot-20240516152256",
53
+ "@medusajs/utils": "1.12.0-snapshot-20240516152256",
54
54
  "@mikro-orm/core": "5.9.7",
55
55
  "@mikro-orm/migrations": "5.9.7",
56
56
  "@mikro-orm/postgresql": "5.9.7",
@@ -1,4 +0,0 @@
1
- import { ExternalModuleDeclaration, InternalModuleDeclaration } from "@medusajs/modules-sdk";
2
- import { IRegionModuleService, ModulesSdkTypes } from "@medusajs/types";
3
- import { InitializeModuleInjectableDependencies } from "../types";
4
- export declare const initialize: (options?: ModulesSdkTypes.ModuleServiceInitializeOptions | ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions | ExternalModuleDeclaration | InternalModuleDeclaration, injectedDependencies?: InitializeModuleInjectableDependencies) => Promise<IRegionModuleService>;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initialize = void 0;
4
- const modules_sdk_1 = require("@medusajs/modules-sdk");
5
- const module_definition_1 = require("../module-definition");
6
- const initialize = async (options, injectedDependencies) => {
7
- const serviceKey = modules_sdk_1.Modules.REGION;
8
- const loaded = await modules_sdk_1.MedusaModule.bootstrap({
9
- moduleKey: serviceKey,
10
- defaultPath: modules_sdk_1.MODULE_PACKAGE_NAMES[modules_sdk_1.Modules.REGION],
11
- declaration: options,
12
- injectedDependencies,
13
- moduleExports: module_definition_1.moduleDefinition,
14
- });
15
- return loaded[serviceKey];
16
- };
17
- exports.initialize = initialize;
@@ -1,4 +0,0 @@
1
- import { InternalModuleDeclaration, LoaderOptions } from "@medusajs/modules-sdk";
2
- import { ModulesSdkTypes } from "@medusajs/types";
3
- declare const _default: ({ options, container, logger, }: LoaderOptions<ModulesSdkTypes.ModuleServiceInitializeOptions | ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions>, moduleDeclaration?: InternalModuleDeclaration) => Promise<void>;
4
- export default _default;
@@ -1,41 +0,0 @@
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const modules_sdk_1 = require("@medusajs/modules-sdk");
27
- const utils_1 = require("@medusajs/utils");
28
- const RegionModels = __importStar(require("../models"));
29
- exports.default = async ({ options, container, logger, }, moduleDeclaration) => {
30
- const entities = Object.values(RegionModels);
31
- const pathToMigrations = __dirname + "/../migrations";
32
- await utils_1.ModulesSdkUtils.mikroOrmConnectionLoader({
33
- moduleName: modules_sdk_1.Modules.REGION,
34
- entities,
35
- container,
36
- options,
37
- moduleDeclaration,
38
- logger,
39
- pathToMigrations,
40
- });
41
- };
@@ -1,2 +0,0 @@
1
- declare const _default: ({ container, options }: import("@medusajs/types").LoaderOptions) => Promise<void>;
2
- export default _default;
@@ -1,34 +0,0 @@
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const utils_1 = require("@medusajs/utils");
27
- const ModuleModels = __importStar(require("../models"));
28
- const ModuleRepositories = __importStar(require("../repositories"));
29
- const ModuleServices = __importStar(require("../services"));
30
- exports.default = utils_1.ModulesSdkUtils.moduleContainerLoaderFactory({
31
- moduleModels: ModuleModels,
32
- moduleRepositories: ModuleRepositories,
33
- moduleServices: ModuleServices,
34
- });