@medusajs/sales-channel 0.1.2 → 1.0.0-rc-20241001083650

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/dist/index.d.ts +6 -9
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +6 -44
  4. package/dist/index.js.map +1 -0
  5. package/dist/joinfer-config.d.ts +2 -0
  6. package/dist/joinfer-config.d.ts.map +1 -0
  7. package/dist/joinfer-config.js +12 -0
  8. package/dist/joinfer-config.js.map +1 -0
  9. package/dist/migrations/Migration20240115152146.d.ts +1 -0
  10. package/dist/migrations/Migration20240115152146.d.ts.map +1 -0
  11. package/dist/migrations/Migration20240115152146.js +1 -0
  12. package/dist/migrations/Migration20240115152146.js.map +1 -0
  13. package/dist/models/index.d.ts +1 -0
  14. package/dist/models/index.d.ts.map +1 -0
  15. package/dist/models/index.js +1 -0
  16. package/dist/models/index.js.map +1 -0
  17. package/dist/models/sales-channel.d.ts +3 -2
  18. package/dist/models/sales-channel.d.ts.map +1 -0
  19. package/dist/models/sales-channel.js +3 -2
  20. package/dist/models/sales-channel.js.map +1 -0
  21. package/dist/schema/index.d.ts +3 -0
  22. package/dist/schema/index.d.ts.map +1 -0
  23. package/dist/schema/index.js +15 -0
  24. package/dist/schema/index.js.map +1 -0
  25. package/dist/services/index.d.ts +1 -0
  26. package/dist/services/index.d.ts.map +1 -0
  27. package/dist/services/index.js +1 -0
  28. package/dist/services/index.js.map +1 -0
  29. package/dist/services/sales-channel-module.d.ts +18 -15
  30. package/dist/services/sales-channel-module.d.ts.map +1 -0
  31. package/dist/services/sales-channel-module.js +26 -23
  32. package/dist/services/sales-channel-module.js.map +1 -0
  33. package/dist/tsconfig.tsbuildinfo +1 -0
  34. package/dist/types/index.d.ts +2 -1
  35. package/dist/types/index.d.ts.map +1 -0
  36. package/dist/types/index.js +1 -0
  37. package/dist/types/index.js.map +1 -0
  38. package/package.json +20 -21
  39. package/dist/initialize/index.d.ts +0 -4
  40. package/dist/initialize/index.js +0 -17
  41. package/dist/joiner-config.d.ts +0 -7
  42. package/dist/joiner-config.js +0 -28
  43. package/dist/loaders/connection.d.ts +0 -4
  44. package/dist/loaders/connection.js +0 -41
  45. package/dist/loaders/container.d.ts +0 -2
  46. package/dist/loaders/container.js +0 -34
  47. package/dist/loaders/index.d.ts +0 -2
  48. package/dist/loaders/index.js +0 -18
  49. package/dist/module-definition.d.ts +0 -2
  50. package/dist/module-definition.js +0 -15
  51. package/dist/repositories/index.d.ts +0 -1
  52. package/dist/repositories/index.js +0 -5
  53. package/dist/scripts/bin/run-seed.d.ts +0 -3
  54. package/dist/scripts/bin/run-seed.js +0 -50
  55. package/dist/scripts/seed-utils.d.ts +0 -4
  56. package/dist/scripts/seed-utils.js +0 -12
package/dist/index.d.ts CHANGED
@@ -1,9 +1,6 @@
1
- import { moduleDefinition } from "./module-definition";
2
- export default moduleDefinition;
3
- export declare const runMigrations: ({ options, logger, }?: Pick<import("@medusajs/modules-sdk").LoaderOptions<import("@medusajs/modules-sdk").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
4
- export declare const revertMigration: ({ options, logger, }?: Pick<import("@medusajs/modules-sdk").LoaderOptions<import("@medusajs/modules-sdk").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
5
- export * from "./initialize";
6
- export * from "./types";
7
- export * from "./loaders";
8
- export * from "./models";
9
- export * from "./services";
1
+ import { SalesChannelModuleService } from "./services";
2
+ declare const _default: import("@medusajs/types").ModuleExports<typeof SalesChannelModuleService> & {
3
+ linkable: Record<string, any>;
4
+ };
5
+ export default _default;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAA;;;;AAErD,wBAEE"}
package/dist/index.js CHANGED
@@ -1,46 +1,8 @@
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
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
2
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.revertMigration = exports.runMigrations = void 0;
30
- const modules_sdk_1 = require("@medusajs/modules-sdk");
31
- const utils_1 = require("@medusajs/utils");
32
- const SalesChannelModels = __importStar(require("./models"));
33
- const module_definition_1 = require("./module-definition");
34
- exports.default = module_definition_1.moduleDefinition;
35
- const migrationScriptOptions = {
36
- moduleName: modules_sdk_1.Modules.SALES_CHANNEL,
37
- models: SalesChannelModels,
38
- pathToMigrations: __dirname + "/migrations",
39
- };
40
- exports.runMigrations = utils_1.ModulesSdkUtils.buildMigrationScript(migrationScriptOptions);
41
- exports.revertMigration = utils_1.ModulesSdkUtils.buildRevertMigrationScript(migrationScriptOptions);
42
- __exportStar(require("./initialize"), exports);
43
- __exportStar(require("./types"), exports);
44
- __exportStar(require("./loaders"), exports);
45
- __exportStar(require("./models"), exports);
46
- __exportStar(require("./services"), exports);
3
+ const utils_1 = require("@medusajs/framework/utils");
4
+ const _services_1 = require("./services");
5
+ exports.default = (0, utils_1.Module)(utils_1.Modules.SALES_CHANNEL, {
6
+ service: _services_1.SalesChannelModuleService,
7
+ });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,qDAA2D;AAC3D,yCAAqD;AAErD,kBAAe,IAAA,cAAM,EAAC,eAAO,CAAC,aAAa,EAAE;IAC3C,OAAO,EAAE,qCAAyB;CACnC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const joinerConfig: Omit<import("@medusajs/types").ModuleJoinerConfig, "serviceName" | "primaryKeys" | "alias" | "linkableKeys"> & Required<Pick<import("@medusajs/types").ModuleJoinerConfig, "serviceName" | "primaryKeys" | "alias" | "linkableKeys">>;
2
+ //# sourceMappingURL=joinfer-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joinfer-config.d.ts","sourceRoot":"","sources":["../src/joinfer-config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,uOAEvB,CAAA"}
@@ -0,0 +1,12 @@
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.joinerConfig = void 0;
7
+ const utils_1 = require("@medusajs/framework/utils");
8
+ const schema_1 = __importDefault(require("./schema"));
9
+ exports.joinerConfig = (0, utils_1.defineJoinerConfig)(utils_1.Modules.SALES_CHANNEL, {
10
+ schema: schema_1.default,
11
+ });
12
+ //# sourceMappingURL=joinfer-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joinfer-config.js","sourceRoot":"","sources":["../src/joinfer-config.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAuE;AACvE,sDAA4C;AAE/B,QAAA,YAAY,GAAG,IAAA,0BAAkB,EAAC,eAAO,CAAC,aAAa,EAAE;IACpE,MAAM,EAAN,gBAAM;CACP,CAAC,CAAA"}
@@ -2,3 +2,4 @@ import { Migration } from "@mikro-orm/migrations";
2
2
  export declare class Migration20240115152146 extends Migration {
3
3
  up(): Promise<void>;
4
4
  }
5
+ //# sourceMappingURL=Migration20240115152146.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240115152146.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240115152146.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ1B"}
@@ -9,3 +9,4 @@ class Migration20240115152146 extends migrations_1.Migration {
9
9
  }
10
10
  }
11
11
  exports.Migration20240115152146 = Migration20240115152146;
12
+ //# sourceMappingURL=Migration20240115152146.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20240115152146.js","sourceRoot":"","sources":["../../src/migrations/Migration20240115152146.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT,2WAA2W,CAC5W,CAAA;QACD,IAAI,CAAC,MAAM,CACT,gFAAgF,CACjF,CAAA;IACH,CAAC;CACF;AATD,0DASC"}
@@ -1 +1,2 @@
1
1
  export { default as SalesChannel } from "./sales-channel";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAA"}
@@ -6,3 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SalesChannel = void 0;
7
7
  var sales_channel_1 = require("./sales-channel");
8
8
  Object.defineProperty(exports, "SalesChannel", { enumerable: true, get: function () { return __importDefault(sales_channel_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAyD;AAAhD,8HAAA,OAAO,OAAgB"}
@@ -1,6 +1,6 @@
1
- import { DAL } from "@medusajs/types";
1
+ import { DAL } from "@medusajs/framework/types";
2
2
  import { OptionalProps } from "@mikro-orm/core";
3
- type SalesChannelOptionalProps = "is_disabled" | DAL.EntityDateColumns;
3
+ type SalesChannelOptionalProps = "is_disabled" | DAL.ModelDateColumns;
4
4
  export default class SalesChannel {
5
5
  [OptionalProps]?: SalesChannelOptionalProps;
6
6
  id: string;
@@ -15,3 +15,4 @@ export default class SalesChannel {
15
15
  onInit(): void;
16
16
  }
17
17
  export {};
18
+ //# sourceMappingURL=sales-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sales-channel.d.ts","sourceRoot":"","sources":["../../src/models/sales-channel.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAA;AAC/C,OAAO,EAML,aAAa,EAGd,MAAM,iBAAiB,CAAA;AAExB,KAAK,yBAAyB,GAAG,aAAa,GAAG,GAAG,CAAC,gBAAgB,CAAA;AAIrE,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,CAAC,aAAa,CAAC,CAAC,EAAE,yBAAyB,CAAA;IAG3C,EAAE,EAAG,MAAM,CAAA;IAIX,IAAI,EAAG,MAAM,CAAA;IAIb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAO;IAGjC,WAAW,EAAE,OAAO,CAAQ;IAO5B,UAAU,EAAE,IAAI,CAAA;IAGhB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAO;IAQ/C,UAAU,EAAE,IAAI,CAAA;IAIhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const utils_1 = require("@medusajs/utils");
12
+ const utils_1 = require("@medusajs/framework/utils");
13
13
  const core_1 = require("@mikro-orm/core");
14
14
  let SalesChannel = class SalesChannel {
15
15
  constructor() {
@@ -41,7 +41,7 @@ __decorate([
41
41
  ], SalesChannel.prototype, "description", void 0);
42
42
  __decorate([
43
43
  (0, core_1.Property)({ columnType: "boolean", default: false }),
44
- __metadata("design:type", Object)
44
+ __metadata("design:type", Boolean)
45
45
  ], SalesChannel.prototype, "is_disabled", void 0);
46
46
  __decorate([
47
47
  (0, core_1.Property)({
@@ -86,3 +86,4 @@ SalesChannel = __decorate([
86
86
  (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
87
87
  ], SalesChannel);
88
88
  exports.default = SalesChannel;
89
+ //# sourceMappingURL=sales-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sales-channel.js","sourceRoot":"","sources":["../../src/models/sales-channel.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qDAIkC;AAGlC,0CASwB;AAMT,IAAM,YAAY,GAAlB,MAAM,YAAY;IAAlB;QAYb,gBAAW,GAAkB,IAAI,CAAA;QAGjC,gBAAW,GAAY,KAAK,CAAA;QAU5B,aAAQ,GAAmC,IAAI,CAAA;QAY/C,eAAU,GAAgB,IAAI,CAAA;IAWhC,CAAC;IARC,QAAQ;QACN,IAAI,CAAC,EAAE,GAAG,IAAA,wBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IAC3C,CAAC;IAGD,MAAM;QACJ,IAAI,CAAC,EAAE,GAAG,IA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B,YAAY;IAFhC,IAAA,aAAM,GAAE;IACR,IAAA,aAAM,EAAC,gBAAQ,CAAC,kCAAkC,CAAC;GAC/B,YAAY,CAgDhC;kBAhDoB,YAAY"}
@@ -0,0 +1,3 @@
1
+ declare const _default: "\ntype SalesChannel {\n id: ID!\n name: String!\n description: String\n is_disabled: Boolean!\n created_at: DateTime!\n metadata: JSON\n updated_at: DateTime!\n deleted_at: DateTime\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":";AAAA,wBAWC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = `
4
+ type SalesChannel {
5
+ id: ID!
6
+ name: String!
7
+ description: String
8
+ is_disabled: Boolean!
9
+ created_at: DateTime!
10
+ metadata: JSON
11
+ updated_at: DateTime!
12
+ deleted_at: DateTime
13
+ }
14
+ `;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":";;AAAA,kBAAe;;;;;;;;;;;CAWd,CAAA"}
@@ -1 +1,2 @@
1
1
  export { default as SalesChannelModuleService } from "./sales-channel-module";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,wBAAwB,CAAA"}
@@ -6,3 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SalesChannelModuleService = void 0;
7
7
  var sales_channel_module_1 = require("./sales-channel-module");
8
8
  Object.defineProperty(exports, "SalesChannelModuleService", { enumerable: true, get: function () { return __importDefault(sales_channel_module_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAA6E;AAApE,kJAAA,OAAO,OAA6B"}
@@ -1,25 +1,28 @@
1
- import { Context, CreateSalesChannelDTO, DAL, FilterableSalesChannelProps, InternalModuleDeclaration, ISalesChannelModuleService, ModuleJoinerConfig, ModulesSdkTypes, SalesChannelDTO, UpdateSalesChannelDTO } from "@medusajs/types";
2
- import { ModulesSdkUtils } from "@medusajs/utils";
1
+ import { Context, CreateSalesChannelDTO, DAL, FilterableSalesChannelProps, InternalModuleDeclaration, ISalesChannelModuleService, ModuleJoinerConfig, ModulesSdkTypes, SalesChannelDTO, UpdateSalesChannelDTO, UpsertSalesChannelDTO } from "@medusajs/framework/types";
3
2
  import { SalesChannel } from "../models";
4
- import { UpsertSalesChannelDTO } from "@medusajs/types";
5
3
  type InjectedDependencies = {
6
4
  baseRepository: DAL.RepositoryService;
7
- salesChannelService: ModulesSdkTypes.InternalModuleService<any>;
5
+ salesChannelService: ModulesSdkTypes.IMedusaInternalService<any>;
8
6
  };
9
- declare const SalesChannelModuleService_base: new (container: InjectedDependencies) => ModulesSdkUtils.AbstractModuleService<InjectedDependencies, SalesChannelDTO, {}>;
10
- export default class SalesChannelModuleService<TEntity extends SalesChannel = SalesChannel> extends SalesChannelModuleService_base implements ISalesChannelModuleService {
7
+ declare const SalesChannelModuleService_base: import("@medusajs/framework/utils").MedusaServiceReturnType<{
8
+ SalesChannel: {
9
+ dto: SalesChannelDTO;
10
+ };
11
+ }>;
12
+ export default class SalesChannelModuleService extends SalesChannelModuleService_base implements ISalesChannelModuleService {
11
13
  protected readonly moduleDeclaration: InternalModuleDeclaration;
12
14
  protected baseRepository_: DAL.RepositoryService;
13
- protected readonly salesChannelService_: ModulesSdkTypes.InternalModuleService<TEntity>;
15
+ protected readonly salesChannelService_: ModulesSdkTypes.IMedusaInternalService<SalesChannel>;
14
16
  constructor({ baseRepository, salesChannelService }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
15
17
  __joinerConfig(): ModuleJoinerConfig;
16
- create(data: CreateSalesChannelDTO[], sharedContext?: Context): Promise<SalesChannelDTO[]>;
17
- create(data: CreateSalesChannelDTO, sharedContext?: Context): Promise<SalesChannelDTO>;
18
- create_(data: CreateSalesChannelDTO[], sharedContext: Context): Promise<SalesChannel[]>;
19
- update(id: string, data: UpdateSalesChannelDTO, sharedContext?: Context): Promise<SalesChannelDTO>;
20
- update(selector: FilterableSalesChannelProps, data: UpdateSalesChannelDTO, sharedContext?: Context): Promise<SalesChannelDTO[]>;
21
- update_(data: UpdateSalesChannelDTO[], sharedContext: Context): Promise<TEntity[]>;
22
- upsert(data: UpsertSalesChannelDTO[], sharedContext?: Context): Promise<SalesChannelDTO[]>;
23
- upsert(data: UpsertSalesChannelDTO, sharedContext?: Context): Promise<SalesChannelDTO>;
18
+ createSalesChannels(data: CreateSalesChannelDTO[], sharedContext?: Context): Promise<SalesChannelDTO[]>;
19
+ createSalesChannels(data: CreateSalesChannelDTO, sharedContext?: Context): Promise<SalesChannelDTO>;
20
+ createSalesChannels_(data: CreateSalesChannelDTO[], sharedContext: Context): Promise<SalesChannel[]>;
21
+ updateSalesChannels(id: string, data: UpdateSalesChannelDTO, sharedContext?: Context): Promise<SalesChannelDTO>;
22
+ updateSalesChannels(selector: FilterableSalesChannelProps, data: UpdateSalesChannelDTO, sharedContext?: Context): Promise<SalesChannelDTO[]>;
23
+ updateSalesChannels_(data: UpdateSalesChannelDTO[], sharedContext: Context): Promise<SalesChannel[]>;
24
+ upsertSalesChannels(data: UpsertSalesChannelDTO[], sharedContext?: Context): Promise<SalesChannelDTO[]>;
25
+ upsertSalesChannels(data: UpsertSalesChannelDTO, sharedContext?: Context): Promise<SalesChannelDTO>;
24
26
  }
25
27
  export {};
28
+ //# sourceMappingURL=sales-channel-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sales-channel-module.d.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ACV,IAAI,EAAE,qBAAqB,EAC3B,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,eAAe,CAAC;IACrB,mBAAmB,CACvB,QAAQ,EAAE,2BAA2B,EACrC,IAAI,EAAE,qBAAqB,EAC3B,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,eAAe,EAAE,CAAC;IAsCvB,oBAAoB,CACxB,IAAI,EAAE,qBAAqB,EAAE,EAC7B,aAAa,EAAE,OAAO;IAKlB,mBAAmB,CACvB,IAAI,EAAE,qBAAqB,EAAE,EAC7B,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,eAAe,EAAE,CAAC;IACvB,mBAAmB,CACvB,IAAI,EAAE,qBAAqB,EAC3B,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,eAAe,CAAC;CA4B5B"}
@@ -12,10 +12,12 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const utils_1 = require("@medusajs/utils");
15
+ const utils_1 = require("@medusajs/framework/utils");
16
16
  const _models_1 = require("../models");
17
- const joiner_config_1 = require("../joiner-config");
18
- class SalesChannelModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFactory(_models_1.SalesChannel, [], joiner_config_1.entityNameToLinkableKeysMap) {
17
+ const joinfer_config_1 = require("../joinfer-config");
18
+ class SalesChannelModuleService extends (0, utils_1.MedusaService)({
19
+ SalesChannel: _models_1.SalesChannel,
20
+ }) {
19
21
  constructor({ baseRepository, salesChannelService }, moduleDeclaration) {
20
22
  // @ts-ignore
21
23
  super(...arguments);
@@ -24,19 +26,19 @@ class SalesChannelModuleService extends utils_1.ModulesSdkUtils.abstractModuleSe
24
26
  this.salesChannelService_ = salesChannelService;
25
27
  }
26
28
  __joinerConfig() {
27
- return joiner_config_1.joinerConfig;
29
+ return joinfer_config_1.joinerConfig;
28
30
  }
29
- async create(data, sharedContext = {}) {
31
+ async createSalesChannels(data, sharedContext = {}) {
30
32
  const input = Array.isArray(data) ? data : [data];
31
- const result = await this.create_(input, sharedContext);
33
+ const result = await this.createSalesChannels_(input, sharedContext);
32
34
  return await this.baseRepository_.serialize(Array.isArray(data) ? result : result[0], {
33
35
  populate: true,
34
36
  });
35
37
  }
36
- async create_(data, sharedContext) {
38
+ async createSalesChannels_(data, sharedContext) {
37
39
  return await this.salesChannelService_.create(data, sharedContext);
38
40
  }
39
- async update(idOrSelector, data, sharedContext = {}) {
41
+ async updateSalesChannels(idOrSelector, data, sharedContext = {}) {
40
42
  let normalizedInput = [];
41
43
  if ((0, utils_1.isString)(idOrSelector)) {
42
44
  normalizedInput = [{ id: idOrSelector, ...data }];
@@ -48,24 +50,24 @@ class SalesChannelModuleService extends utils_1.ModulesSdkUtils.abstractModuleSe
48
50
  ...data,
49
51
  }));
50
52
  }
51
- const result = await this.update_(normalizedInput, sharedContext);
53
+ const result = await this.updateSalesChannels_(normalizedInput, sharedContext);
52
54
  return await this.baseRepository_.serialize(Array.isArray(data) ? result : result[0], {
53
55
  populate: true,
54
56
  });
55
57
  }
56
- async update_(data, sharedContext) {
58
+ async updateSalesChannels_(data, sharedContext) {
57
59
  return await this.salesChannelService_.update(data, sharedContext);
58
60
  }
59
- async upsert(data, sharedContext = {}) {
61
+ async upsertSalesChannels(data, sharedContext = {}) {
60
62
  const input = Array.isArray(data) ? data : [data];
61
63
  const forUpdate = input.filter((channel) => !!channel.id);
62
64
  const forCreate = input.filter((channel) => !channel.id);
63
65
  const operations = [];
64
66
  if (forCreate.length) {
65
- operations.push(this.create_(forCreate, sharedContext));
67
+ operations.push(this.createSalesChannels_(forCreate, sharedContext));
66
68
  }
67
69
  if (forUpdate.length) {
68
- operations.push(this.update_(forUpdate, sharedContext));
70
+ operations.push(this.updateSalesChannels_(forUpdate, sharedContext));
69
71
  }
70
72
  const result = (await (0, utils_1.promiseAll)(operations)).flat();
71
73
  return await this.baseRepository_.serialize(Array.isArray(data) ? result : result[0]);
@@ -73,36 +75,37 @@ class SalesChannelModuleService extends utils_1.ModulesSdkUtils.abstractModuleSe
73
75
  }
74
76
  exports.default = SalesChannelModuleService;
75
77
  __decorate([
76
- (0, utils_1.InjectManager)("baseRepository_"),
78
+ (0, utils_1.InjectManager)(),
77
79
  __param(1, (0, utils_1.MedusaContext)()),
78
80
  __metadata("design:type", Function),
79
81
  __metadata("design:paramtypes", [Object, Object]),
80
82
  __metadata("design:returntype", Promise)
81
- ], SalesChannelModuleService.prototype, "create", null);
83
+ ], SalesChannelModuleService.prototype, "createSalesChannels", null);
82
84
  __decorate([
83
- (0, utils_1.InjectTransactionManager)("baseRepository_"),
85
+ (0, utils_1.InjectTransactionManager)(),
84
86
  __param(1, (0, utils_1.MedusaContext)()),
85
87
  __metadata("design:type", Function),
86
88
  __metadata("design:paramtypes", [Array, Object]),
87
89
  __metadata("design:returntype", Promise)
88
- ], SalesChannelModuleService.prototype, "create_", null);
90
+ ], SalesChannelModuleService.prototype, "createSalesChannels_", null);
89
91
  __decorate([
90
- (0, utils_1.InjectManager)("baseRepository_"),
92
+ (0, utils_1.InjectManager)(),
91
93
  __param(2, (0, utils_1.MedusaContext)()),
92
94
  __metadata("design:type", Function),
93
95
  __metadata("design:paramtypes", [Object, Object, Object]),
94
96
  __metadata("design:returntype", Promise)
95
- ], SalesChannelModuleService.prototype, "update", null);
97
+ ], SalesChannelModuleService.prototype, "updateSalesChannels", null);
96
98
  __decorate([
97
- (0, utils_1.InjectTransactionManager)("baseRepository_"),
99
+ (0, utils_1.InjectTransactionManager)(),
98
100
  __metadata("design:type", Function),
99
101
  __metadata("design:paramtypes", [Array, Object]),
100
102
  __metadata("design:returntype", Promise)
101
- ], SalesChannelModuleService.prototype, "update_", null);
103
+ ], SalesChannelModuleService.prototype, "updateSalesChannels_", null);
102
104
  __decorate([
103
- (0, utils_1.InjectTransactionManager)("baseRepository_"),
105
+ (0, utils_1.InjectTransactionManager)(),
104
106
  __param(1, (0, utils_1.MedusaContext)()),
105
107
  __metadata("design:type", Function),
106
108
  __metadata("design:paramtypes", [Object, Object]),
107
109
  __metadata("design:returntype", Promise)
108
- ], SalesChannelModuleService.prototype, "upsert", null);
110
+ ], SalesChannelModuleService.prototype, "upsertSalesChannels", null);
111
+ //# sourceMappingURL=sales-channel-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sales-channel-module.js","sourceRoot":"","sources":["../../src/services/sales-channel-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAaA,qDAOkC;AAElC,qCAAsC;AAEtC,sDAAgD;AAOhD,MAAqB,yBACnB,SAAQ,IAAA,qBAAa,EAA6C;IAChE,YAAY,EAAZ,sBAAY;CACb,CAAC;IAMF,YACE,EAAE,cAAc,EAAE,mBAAmB,EAAwB,EAC1C,iBAA4C;QAE/D,aAAa;QACb,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QAHA,sBAAiB,GAAjB,iBAAiB,CAA2B;QAI/D,IAAI,CAAC,eAAe,GAAG,cAAc,CAAA;QACrC,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAA;IACjD,CAAC;IAED,cAAc;QACZ,OAAO,6BAAY,CAAA;IACrB,CAAC;IAaK,AAAN,KAAK,CAAC,mBAAmB,CACvB,IAAqD,EACpC,gBAAyB,EAAE;QAE5C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAEjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;QAEpE,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CACzC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EACxC;YACE,QAAQ,EAAE,IAAI;SACf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,IAAA,qBAAa,GAAE,CAAA;;;;oEA6BjB;AAGK;IADL,IAAA,gCAAwB,GAAE;;;;qEAM1B;AAWK;IADL,IAAA,gCAAwB,GAAE;IAGxB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;oEAuBjB"}
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts","../src/joinfer-config.ts","../src/migrations/migration20240115152146.ts","../src/models/index.ts","../src/models/sales-channel.ts","../src/schema/index.ts","../src/services/index.ts","../src/services/sales-channel-module.ts","../src/services/__tests__/index.ts","../src/types/index.ts"],"version":"5.6.2"}
@@ -1,7 +1,8 @@
1
- import { Logger, UpdateSalesChannelDTO } from "@medusajs/types";
1
+ import { Logger, UpdateSalesChannelDTO } from "@medusajs/framework/types";
2
2
  export type InitializeModuleInjectableDependencies = {
3
3
  logger?: Logger;
4
4
  };
5
5
  export type UpdateSalesChanneInput = UpdateSalesChannelDTO & {
6
6
  id: string;
7
7
  };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAEzE,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@medusajs/sales-channel",
3
- "version": "0.1.2",
3
+ "version": "1.0.0-rc-20241001083650",
4
4
  "description": "Medusa Sales Channel module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
- "dist"
8
+ "dist",
9
+ "!dist/**/__tests__",
10
+ "!dist/**/__mocks__",
11
+ "!dist/**/__fixtures__"
9
12
  ],
10
13
  "engines": {
11
- "node": ">=16"
12
- },
13
- "bin": {
14
- "medusa-sales-channel-seed": "dist/scripts/bin/run-seed.js"
14
+ "node": ">=20"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
@@ -26,8 +26,8 @@
26
26
  "scripts": {
27
27
  "watch": "tsc --build --watch",
28
28
  "watch:test": "tsc --build tsconfig.spec.json --watch",
29
- "prepublishOnly": "cross-env NODE_ENV=production tsc --build && tsc-alias -p tsconfig.json",
30
- "build": "rimraf dist && tsc --build && tsc-alias -p tsconfig.json",
29
+ "resolve:aliases": "tsc --showConfig -p tsconfig.json > tsconfig.resolved.json && tsc-alias -p tsconfig.resolved.json && rimraf tsconfig.resolved.json",
30
+ "build": "rimraf dist && tsc --build && npm run resolve:aliases",
31
31
  "test": "jest --runInBand --bail --forceExit -- src/**/__tests__/**/*.ts",
32
32
  "test:integration": "jest --forceExit -- integration-tests/**/__tests__/**/*.ts",
33
33
  "migration:generate": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:generate",
@@ -37,25 +37,24 @@
37
37
  "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear"
38
38
  },
39
39
  "devDependencies": {
40
+ "@medusajs/framework": "1.0.0-rc-20241001083650",
40
41
  "@mikro-orm/cli": "5.9.7",
41
- "cross-env": "^5.2.1",
42
- "jest": "^29.6.3",
43
- "medusa-test-utils": "^1.1.45",
42
+ "@mikro-orm/core": "5.9.7",
43
+ "@mikro-orm/migrations": "5.9.7",
44
+ "@mikro-orm/postgresql": "5.9.7",
45
+ "@swc/core": "^1.7.28",
46
+ "@swc/jest": "^0.2.36",
47
+ "jest": "^29.7.0",
48
+ "medusa-test-utils": "2.0.0-rc-20241001083650",
44
49
  "rimraf": "^3.0.2",
45
- "ts-jest": "^29.1.1",
46
- "ts-node": "^10.9.1",
47
50
  "tsc-alias": "^1.8.6",
48
- "typescript": "^5.1.6"
51
+ "typescript": "^5.6.2"
49
52
  },
50
- "dependencies": {
51
- "@medusajs/modules-sdk": "^1.12.12",
52
- "@medusajs/types": "^1.11.17",
53
- "@medusajs/utils": "^1.11.10",
53
+ "peerDependencies": {
54
+ "@medusajs/framework": "1.0.0-rc-20241001083650",
54
55
  "@mikro-orm/core": "5.9.7",
55
56
  "@mikro-orm/migrations": "5.9.7",
56
57
  "@mikro-orm/postgresql": "5.9.7",
57
- "awilix": "^8.0.0",
58
- "dotenv": "^16.4.5",
59
- "knex": "2.4.2"
58
+ "awilix": "^8.0.1"
60
59
  }
61
60
  }
@@ -1,4 +0,0 @@
1
- import { ExternalModuleDeclaration, InternalModuleDeclaration } from "@medusajs/modules-sdk";
2
- import { ModulesSdkTypes, ISalesChannelModuleService } from "@medusajs/types";
3
- import { InitializeModuleInjectableDependencies } from "../types";
4
- export declare const initialize: (options?: ModulesSdkTypes.ModuleServiceInitializeOptions | ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions | ExternalModuleDeclaration | InternalModuleDeclaration, injectedDependencies?: InitializeModuleInjectableDependencies) => Promise<ISalesChannelModuleService>;
@@ -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.SALES_CHANNEL;
8
- const loaded = await modules_sdk_1.MedusaModule.bootstrap({
9
- moduleKey: serviceKey,
10
- defaultPath: modules_sdk_1.MODULE_PACKAGE_NAMES[modules_sdk_1.Modules.SALES_CHANNEL],
11
- declaration: options,
12
- injectedDependencies,
13
- moduleExports: module_definition_1.moduleDefinition,
14
- });
15
- return loaded[serviceKey];
16
- };
17
- exports.initialize = initialize;
@@ -1,7 +0,0 @@
1
- import { ModuleJoinerConfig } from "@medusajs/types";
2
- import { MapToConfig } from "@medusajs/utils";
3
- export declare const LinkableKeys: {
4
- sales_channel_id: string;
5
- };
6
- export declare const entityNameToLinkableKeysMap: MapToConfig;
7
- export declare const joinerConfig: ModuleJoinerConfig;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.joinerConfig = exports.entityNameToLinkableKeysMap = exports.LinkableKeys = void 0;
4
- const modules_sdk_1 = require("@medusajs/modules-sdk");
5
- const _models_1 = require("./models");
6
- exports.LinkableKeys = {
7
- sales_channel_id: _models_1.SalesChannel.name,
8
- };
9
- const entityLinkableKeysMap = {};
10
- Object.entries(exports.LinkableKeys).forEach(([key, value]) => {
11
- entityLinkableKeysMap[value] ?? (entityLinkableKeysMap[value] = []);
12
- entityLinkableKeysMap[value].push({
13
- mapTo: key,
14
- valueFrom: key.split("_").pop(),
15
- });
16
- });
17
- exports.entityNameToLinkableKeysMap = entityLinkableKeysMap;
18
- exports.joinerConfig = {
19
- serviceName: modules_sdk_1.Modules.SALES_CHANNEL,
20
- primaryKeys: ["id"],
21
- linkableKeys: exports.LinkableKeys,
22
- alias: [
23
- {
24
- name: ["sales_channel", "sales_channels"],
25
- args: { entity: "SalesChannel" },
26
- },
27
- ],
28
- };
@@ -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 SalesChannelModels = __importStar(require("../models"));
29
- exports.default = async ({ options, container, logger, }, moduleDeclaration) => {
30
- const entities = Object.values(SalesChannelModels);
31
- const pathToMigrations = __dirname + "/../migrations";
32
- await utils_1.ModulesSdkUtils.mikroOrmConnectionLoader({
33
- moduleName: modules_sdk_1.Modules.SALES_CHANNEL,
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,2 +0,0 @@
1
- export * from "./connection";
2
- export * from "./container";
@@ -1,18 +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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./connection"), exports);
18
- __exportStar(require("./container"), exports);
@@ -1,2 +0,0 @@
1
- import { ModuleExports } from "@medusajs/types";
2
- export declare const moduleDefinition: ModuleExports;
@@ -1,15 +0,0 @@
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.moduleDefinition = void 0;
7
- const _services_1 = require("./services");
8
- const connection_1 = __importDefault(require("./loaders/connection"));
9
- const container_1 = __importDefault(require("./loaders/container"));
10
- const service = _services_1.SalesChannelModuleService;
11
- const loaders = [container_1.default, connection_1.default];
12
- exports.moduleDefinition = {
13
- service,
14
- loaders,
15
- };
@@ -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 utils_1 = require("@medusajs/utils");
28
- const modules_sdk_1 = require("@medusajs/modules-sdk");
29
- const ProductModels = __importStar(require("../../models"));
30
- const seed_utils_1 = require("../seed-utils");
31
- const os_1 = require("os");
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-product-seed <filePath>`);
39
- }
40
- const run = utils_1.ModulesSdkUtils.buildSeedScript({
41
- moduleName: modules_sdk_1.Modules.PRODUCT,
42
- models: ProductModels,
43
- pathToMigrations: __dirname + "/../../migrations",
44
- seedHandler: async ({ manager, data }) => {
45
- const { salesChannelData } = data;
46
- await (0, seed_utils_1.createSalesChannels)(manager, salesChannelData);
47
- },
48
- });
49
- await run({ path });
50
- })();
@@ -1,4 +0,0 @@
1
- import { SalesChannel } from "../models";
2
- import { RequiredEntityData } from "@mikro-orm/core";
3
- import { SqlEntityManager } from "@mikro-orm/postgresql";
4
- export declare function createSalesChannels(manager: SqlEntityManager, data: RequiredEntityData<SalesChannel>[]): Promise<SalesChannel[]>;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSalesChannels = void 0;
4
- const _models_1 = require("../models");
5
- async function createSalesChannels(manager, data) {
6
- const channels = data.map((channel) => {
7
- return manager.create(_models_1.SalesChannel, channel);
8
- });
9
- await manager.persistAndFlush(channels);
10
- return channels;
11
- }
12
- exports.createSalesChannels = createSalesChannels;