@medusajs/region 0.1.2-snapshot-20240718083016 → 0.1.2-snapshot-20240719080828

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/dist/index.d.ts +36 -4
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +9 -19
  4. package/dist/loaders/defaults.d.ts +1 -0
  5. package/dist/loaders/defaults.d.ts.map +1 -0
  6. package/dist/loaders/defaults.js +2 -3
  7. package/dist/loaders/index.d.ts +1 -2
  8. package/dist/loaders/index.d.ts.map +1 -0
  9. package/dist/loaders/index.js +0 -2
  10. package/dist/migrations/{RegionModuleSetup20240205173216.d.ts → Migration20240205173216.d.ts} +1 -0
  11. package/dist/migrations/Migration20240205173216.d.ts.map +1 -0
  12. package/dist/migrations/{RegionModuleSetup20240205173216.js → Migration20240205173216.js} +1 -1
  13. package/dist/migrations/Migration20240624200006.d.ts +6 -0
  14. package/dist/migrations/Migration20240624200006.d.ts.map +1 -0
  15. package/dist/migrations/Migration20240624200006.js +19 -0
  16. package/dist/models/country.d.ts +166 -10
  17. package/dist/models/country.d.ts.map +1 -0
  18. package/dist/models/country.js +20 -62
  19. package/dist/models/index.d.ts +1 -0
  20. package/dist/models/index.d.ts.map +1 -0
  21. package/dist/models/region.d.ts +111 -19
  22. package/dist/models/region.d.ts.map +1 -0
  23. package/dist/models/region.js +8 -89
  24. package/dist/services/index.d.ts +1 -0
  25. package/dist/services/index.d.ts.map +1 -0
  26. package/dist/services/region-module.d.ts +22 -17
  27. package/dist/services/region-module.d.ts.map +1 -0
  28. package/dist/services/region-module.js +35 -20
  29. package/dist/types/index.d.ts +1 -0
  30. package/dist/types/index.d.ts.map +1 -0
  31. package/package.json +8 -14
  32. package/dist/initialize/index.d.ts +0 -4
  33. package/dist/initialize/index.js +0 -17
  34. package/dist/joiner-config.d.ts +0 -8
  35. package/dist/joiner-config.js +0 -33
  36. package/dist/loaders/connection.d.ts +0 -4
  37. package/dist/loaders/connection.js +0 -41
  38. package/dist/loaders/container.d.ts +0 -2
  39. package/dist/loaders/container.js +0 -34
  40. package/dist/module-definition.d.ts +0 -4
  41. package/dist/module-definition.js +0 -51
  42. package/dist/repositories/index.d.ts +0 -1
  43. package/dist/repositories/index.js +0 -5
  44. package/dist/scripts/bin/run-seed.d.ts +0 -3
  45. package/dist/scripts/bin/run-seed.js +0 -50
  46. package/dist/scripts/seed-utils.d.ts +0 -4
  47. package/dist/scripts/seed-utils.js +0 -12
@@ -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
- });
@@ -1,4 +0,0 @@
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
- export declare const moduleDefinition: ModuleExports;
@@ -1,51 +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
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.moduleDefinition = exports.revertMigration = exports.runMigrations = void 0;
30
- 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
- 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
- const service = services_1.RegionModuleService;
45
- const loaders = [container_1.default, connection_1.default, defaults_1.default];
46
- exports.moduleDefinition = {
47
- service,
48
- loaders,
49
- runMigrations: exports.runMigrations,
50
- revertMigration: exports.revertMigration,
51
- };
@@ -1 +0,0 @@
1
- export { MikroOrmBaseRepository as BaseRepository } from "@medusajs/utils";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseRepository = void 0;
4
- var utils_1 = require("@medusajs/utils");
5
- Object.defineProperty(exports, "BaseRepository", { enumerable: true, get: function () { return utils_1.MikroOrmBaseRepository; } });
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- declare const _default: Promise<void>;
3
- export default _default;
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- const modules_sdk_1 = require("@medusajs/modules-sdk");
28
- const utils_1 = require("@medusajs/utils");
29
- const RegionModels = __importStar(require("../../models"));
30
- const os_1 = require("os");
31
- const seed_utils_1 = require("../seed-utils");
32
- const args = process.argv;
33
- const path = args.pop();
34
- exports.default = (async () => {
35
- const { config } = await Promise.resolve().then(() => __importStar(require("dotenv")));
36
- config();
37
- if (!path) {
38
- throw new Error(`filePath is required.${os_1.EOL}Example: medusa-region-seed <filePath>`);
39
- }
40
- const run = utils_1.ModulesSdkUtils.buildSeedScript({
41
- moduleName: modules_sdk_1.Modules.REGION,
42
- models: RegionModels,
43
- pathToMigrations: __dirname + "/../../migrations",
44
- seedHandler: async ({ manager, data }) => {
45
- const { regionData } = data;
46
- await (0, seed_utils_1.createRegions)(manager, regionData);
47
- },
48
- });
49
- await run({ path });
50
- })();
@@ -1,4 +0,0 @@
1
- import { RequiredEntityData } from "@mikro-orm/core";
2
- import { SqlEntityManager } from "@mikro-orm/postgresql";
3
- import { Region } from "../models";
4
- export declare function createRegions(manager: SqlEntityManager, data: RequiredEntityData<Region>[]): Promise<Region[]>;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRegions = void 0;
4
- const _models_1 = require("../models");
5
- async function createRegions(manager, data) {
6
- const regions = data.map((region) => {
7
- return manager.create(_models_1.Region, region);
8
- });
9
- await manager.persistAndFlush(regions);
10
- return regions;
11
- }
12
- exports.createRegions = createRegions;