@medusajs/region 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.
- package/dist/index.d.ts +36 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -19
- package/dist/index.js.map +1 -0
- package/dist/loaders/defaults.d.ts +2 -1
- package/dist/loaders/defaults.d.ts.map +1 -0
- package/dist/loaders/defaults.js +4 -4
- package/dist/loaders/defaults.js.map +1 -0
- package/dist/loaders/index.d.ts +1 -2
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +1 -2
- package/dist/loaders/index.js.map +1 -0
- package/dist/migrations/{RegionModuleSetup20240205173216.d.ts → Migration20240205173216.d.ts} +1 -0
- package/dist/migrations/Migration20240205173216.d.ts.map +1 -0
- package/dist/migrations/{RegionModuleSetup20240205173216.js → Migration20240205173216.js} +3 -2
- package/dist/migrations/Migration20240205173216.js.map +1 -0
- package/dist/migrations/Migration20240624200006.d.ts +6 -0
- package/dist/migrations/Migration20240624200006.d.ts.map +1 -0
- package/dist/migrations/Migration20240624200006.js +20 -0
- package/dist/migrations/Migration20240624200006.js.map +1 -0
- package/dist/models/country.d.ts +166 -10
- package/dist/models/country.d.ts.map +1 -0
- package/dist/models/country.js +22 -63
- package/dist/models/country.js.map +1 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/region.d.ts +111 -19
- package/dist/models/region.d.ts.map +1 -0
- package/dist/models/region.js +10 -90
- package/dist/models/region.js.map +1 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/region-module.d.ts +22 -17
- package/dist/services/region-module.d.ts.map +1 -0
- package/dist/services/region-module.js +43 -27
- package/dist/services/region-module.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +20 -21
- package/dist/initialize/index.d.ts +0 -4
- package/dist/initialize/index.js +0 -17
- package/dist/joiner-config.d.ts +0 -8
- package/dist/joiner-config.js +0 -33
- package/dist/loaders/connection.d.ts +0 -4
- package/dist/loaders/connection.js +0 -41
- package/dist/loaders/container.d.ts +0 -2
- package/dist/loaders/container.js +0 -34
- package/dist/module-definition.d.ts +0 -4
- package/dist/module-definition.js +0 -51
- package/dist/repositories/index.d.ts +0 -1
- package/dist/repositories/index.js +0 -5
- package/dist/scripts/bin/run-seed.d.ts +0 -3
- package/dist/scripts/bin/run-seed.js +0 -50
- package/dist/scripts/seed-utils.d.ts +0 -4
- package/dist/scripts/seed-utils.js +0 -12
package/dist/models/region.d.ts
CHANGED
@@ -1,19 +1,111 @@
|
|
1
|
-
|
2
|
-
import
|
3
|
-
import
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
1
|
+
declare const _default: import("@medusajs/framework/utils").DmlEntity<{
|
2
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
3
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
4
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
5
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
6
|
+
countries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<{
|
7
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
8
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
9
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
10
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
11
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
12
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
13
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
14
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
15
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
16
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
17
|
+
countries: import("@medusajs/framework/utils").HasMany<any>;
|
18
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
19
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">, import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
20
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
21
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
22
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
23
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
24
|
+
countries: import("@medusajs/framework/utils").HasMany<any>;
|
25
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
26
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">>>;
|
27
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
28
|
+
} & {
|
29
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
30
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
31
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
32
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
33
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
34
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
35
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
36
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
37
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
38
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
39
|
+
countries: import("@medusajs/framework/utils").HasMany<any>;
|
40
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
41
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">, import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
42
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
43
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
44
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
45
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
46
|
+
countries: import("@medusajs/framework/utils").HasMany<any>;
|
47
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
48
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">>>;
|
49
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
50
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
51
|
+
readonly name: "Country";
|
52
|
+
readonly tableName: "region_country";
|
53
|
+
}>>;
|
54
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
55
|
+
} & {
|
56
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
57
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
58
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
59
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
60
|
+
countries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<{
|
61
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
62
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
63
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
64
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
65
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
66
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
67
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
68
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
69
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
70
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
71
|
+
countries: import("@medusajs/framework/utils").HasMany<any>;
|
72
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
73
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">, import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
74
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
75
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
76
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
77
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
78
|
+
countries: import("@medusajs/framework/utils").HasMany<any>;
|
79
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
80
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">>>;
|
81
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
82
|
+
} & {
|
83
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
84
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
85
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
86
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
87
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
88
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
89
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
90
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
91
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
92
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
93
|
+
countries: import("@medusajs/framework/utils").HasMany<any>;
|
94
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
95
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">, import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
96
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
97
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
98
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
99
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
100
|
+
countries: import("@medusajs/framework/utils").HasMany<any>;
|
101
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
102
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">>>;
|
103
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
104
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
105
|
+
readonly name: "Country";
|
106
|
+
readonly tableName: "region_country";
|
107
|
+
}>>;
|
108
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
109
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">;
|
110
|
+
export default _default;
|
111
|
+
//# sourceMappingURL=region.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"region.d.ts","sourceRoot":"","sources":["../../src/models/region.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAOE"}
|
package/dist/models/region.js
CHANGED
@@ -1,96 +1,16 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
4
|
};
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const utils_1 = require("@medusajs/utils");
|
16
|
-
const core_1 = require("@mikro-orm/core");
|
6
|
+
const utils_1 = require("@medusajs/framework/utils");
|
17
7
|
const country_1 = __importDefault(require("./country"));
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
}
|
28
|
-
onInit() {
|
29
|
-
this.id = (0, utils_1.generateEntityId)(this.id, "reg");
|
30
|
-
}
|
31
|
-
};
|
32
|
-
__decorate([
|
33
|
-
(0, core_1.PrimaryKey)({ columnType: "text" }),
|
34
|
-
__metadata("design:type", String)
|
35
|
-
], Region.prototype, "id", void 0);
|
36
|
-
__decorate([
|
37
|
-
(0, utils_1.Searchable)(),
|
38
|
-
(0, core_1.Property)({ columnType: "text" }),
|
39
|
-
__metadata("design:type", String)
|
40
|
-
], Region.prototype, "name", void 0);
|
41
|
-
__decorate([
|
42
|
-
(0, utils_1.Searchable)(),
|
43
|
-
(0, core_1.Property)({ columnType: "text" }),
|
44
|
-
__metadata("design:type", String)
|
45
|
-
], Region.prototype, "currency_code", void 0);
|
46
|
-
__decorate([
|
47
|
-
(0, core_1.Property)({ columnType: "boolean" }),
|
48
|
-
__metadata("design:type", Object)
|
49
|
-
], Region.prototype, "automatic_taxes", void 0);
|
50
|
-
__decorate([
|
51
|
-
(0, core_1.OneToMany)(() => country_1.default, (country) => country.region),
|
52
|
-
__metadata("design:type", Object)
|
53
|
-
], Region.prototype, "countries", void 0);
|
54
|
-
__decorate([
|
55
|
-
(0, core_1.Property)({ columnType: "jsonb", nullable: true }),
|
56
|
-
__metadata("design:type", Object)
|
57
|
-
], Region.prototype, "metadata", void 0);
|
58
|
-
__decorate([
|
59
|
-
(0, core_1.Property)({
|
60
|
-
onCreate: () => new Date(),
|
61
|
-
columnType: "timestamptz",
|
62
|
-
defaultRaw: "now()",
|
63
|
-
}),
|
64
|
-
__metadata("design:type", Date)
|
65
|
-
], Region.prototype, "created_at", void 0);
|
66
|
-
__decorate([
|
67
|
-
(0, core_1.Property)({
|
68
|
-
onCreate: () => new Date(),
|
69
|
-
onUpdate: () => new Date(),
|
70
|
-
columnType: "timestamptz",
|
71
|
-
defaultRaw: "now()",
|
72
|
-
}),
|
73
|
-
__metadata("design:type", Date)
|
74
|
-
], Region.prototype, "updated_at", void 0);
|
75
|
-
__decorate([
|
76
|
-
(0, core_1.Index)({ name: "IDX_region_deleted_at" }),
|
77
|
-
(0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
|
78
|
-
__metadata("design:type", Object)
|
79
|
-
], Region.prototype, "deleted_at", void 0);
|
80
|
-
__decorate([
|
81
|
-
(0, core_1.BeforeCreate)(),
|
82
|
-
__metadata("design:type", Function),
|
83
|
-
__metadata("design:paramtypes", []),
|
84
|
-
__metadata("design:returntype", void 0)
|
85
|
-
], Region.prototype, "onCreate", null);
|
86
|
-
__decorate([
|
87
|
-
(0, core_1.OnInit)(),
|
88
|
-
__metadata("design:type", Function),
|
89
|
-
__metadata("design:paramtypes", []),
|
90
|
-
__metadata("design:returntype", void 0)
|
91
|
-
], Region.prototype, "onInit", null);
|
92
|
-
Region = __decorate([
|
93
|
-
(0, core_1.Entity)({ tableName: "region" }),
|
94
|
-
(0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
|
95
|
-
], Region);
|
96
|
-
exports.default = Region;
|
8
|
+
exports.default = utils_1.model.define("region", {
|
9
|
+
id: utils_1.model.id({ prefix: "reg" }).primaryKey(),
|
10
|
+
name: utils_1.model.text().searchable(),
|
11
|
+
currency_code: utils_1.model.text().searchable(),
|
12
|
+
automatic_taxes: utils_1.model.boolean().default(true),
|
13
|
+
countries: utils_1.model.hasMany(() => country_1.default),
|
14
|
+
metadata: utils_1.model.json().nullable(),
|
15
|
+
});
|
16
|
+
//# sourceMappingURL=region.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"region.js","sourceRoot":"","sources":["../../src/models/region.ts"],"names":[],"mappings":";;;;;AAAA,qDAAiD;AACjD,wDAAqC;AAErC,kBAAe,aAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;IACpC,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE;IAC5C,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IAC/B,aAAa,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IACxC,eAAe,EAAE,aAAK,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9C,SAAS,EAAE,aAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,iBAAa,CAAC;IAC7C,QAAQ,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAA"}
|
package/dist/services/index.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/services/index.js
CHANGED
@@ -6,3 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RegionModuleService = void 0;
|
7
7
|
var region_module_1 = require("./region-module");
|
8
8
|
Object.defineProperty(exports, "RegionModuleService", { enumerable: true, get: function () { return __importDefault(region_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,iDAAiE;AAAxD,qIAAA,OAAO,OAAuB"}
|
@@ -1,32 +1,36 @@
|
|
1
|
-
import { Context, CreateRegionDTO, DAL, FilterableRegionProps, InternalModuleDeclaration, IRegionModuleService,
|
2
|
-
import { ModulesSdkUtils } from "@medusajs/utils";
|
1
|
+
import { Context, CreateRegionDTO, DAL, FilterableRegionProps, InferEntityType, InternalModuleDeclaration, IRegionModuleService, ModulesSdkTypes, RegionCountryDTO, RegionDTO, SoftDeleteReturn, UpdateRegionDTO, UpsertRegionDTO } from "@medusajs/framework/types";
|
3
2
|
import { Country, Region } from "../models";
|
4
3
|
import { UpdateRegionInput } from "../types";
|
5
4
|
type InjectedDependencies = {
|
6
5
|
baseRepository: DAL.RepositoryService;
|
7
|
-
regionService: ModulesSdkTypes.
|
8
|
-
countryService: ModulesSdkTypes.
|
6
|
+
regionService: ModulesSdkTypes.IMedusaInternalService<any>;
|
7
|
+
countryService: ModulesSdkTypes.IMedusaInternalService<any>;
|
9
8
|
};
|
10
|
-
declare const RegionModuleService_base:
|
9
|
+
declare const RegionModuleService_base: import("@medusajs/framework/utils").MedusaServiceReturnType<{
|
10
|
+
Region: {
|
11
|
+
dto: RegionDTO;
|
12
|
+
model: typeof Region;
|
13
|
+
};
|
11
14
|
Country: {
|
12
15
|
dto: RegionCountryDTO;
|
16
|
+
model: typeof Country;
|
13
17
|
};
|
14
18
|
}>;
|
15
|
-
export default class RegionModuleService
|
19
|
+
export default class RegionModuleService extends RegionModuleService_base implements IRegionModuleService {
|
16
20
|
protected readonly moduleDeclaration: InternalModuleDeclaration;
|
17
21
|
protected baseRepository_: DAL.RepositoryService;
|
18
|
-
protected readonly regionService_: ModulesSdkTypes.
|
19
|
-
protected readonly countryService_: ModulesSdkTypes.
|
22
|
+
protected readonly regionService_: ModulesSdkTypes.IMedusaInternalService<typeof Region>;
|
23
|
+
protected readonly countryService_: ModulesSdkTypes.IMedusaInternalService<typeof Country>;
|
20
24
|
constructor({ baseRepository, regionService, countryService }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
protected
|
25
|
+
createRegions(data: CreateRegionDTO[], sharedContext?: Context): Promise<RegionDTO[]>;
|
26
|
+
createRegions(data: CreateRegionDTO, sharedContext?: Context): Promise<RegionDTO>;
|
27
|
+
createRegions_(data: CreateRegionDTO[], sharedContext?: Context): Promise<InferEntityType<typeof Region>[]>;
|
28
|
+
softDeleteRegions(ids: string | object | string[] | object[], config?: SoftDeleteReturn<string>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
29
|
+
upsertRegions(data: UpsertRegionDTO[], sharedContext?: Context): Promise<RegionDTO[]>;
|
30
|
+
upsertRegions(data: UpsertRegionDTO, sharedContext?: Context): Promise<RegionDTO>;
|
31
|
+
updateRegions(id: string, data: UpdateRegionDTO, sharedContext?: Context): Promise<RegionDTO>;
|
32
|
+
updateRegions(selector: FilterableRegionProps, data: UpdateRegionDTO, sharedContext?: Context): Promise<RegionDTO[]>;
|
33
|
+
protected updateRegions_(data: UpdateRegionInput[], sharedContext?: Context): Promise<InferEntityType<typeof Region>[]>;
|
30
34
|
private static normalizeInput;
|
31
35
|
/**
|
32
36
|
* Validate that countries can be assigned to a region.
|
@@ -39,3 +43,4 @@ export default class RegionModuleService<TRegion extends Region = Region, TCount
|
|
39
43
|
private validateCountries;
|
40
44
|
}
|
41
45
|
export {};
|
46
|
+
//# sourceMappingURL=region-module.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"region-module.d.ts","sourceRoot":"","sources":["../../src/services/region-module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,eAAe,EACf,GAAG,EACH,qBAAqB,EACrB,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,eAAe,EAChB,MAAM,2BAA2B,CAAA;AAalC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CA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ACrB,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,EAC1C,MAAM,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAChB,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IAcrC,aAAa,CACjB,IAAI,EAAE,eAAe,EAAE,EACvB,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,SAAS,EAAE,CAAC;IACjB,aAAa,CACjB,IAAI,EAAE,eAAe,EACrB,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,SAAS,CAAC;IA+Bf,aAAa,CACjB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,eAAe,EACrB,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,SAAS,CAAC;IACf,aAAa,CACjB,QAAQ,EAAE,qBAAqB,EAC/B,IAAI,EAAE,eAAe,EACrB,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,SAAS,EAAE,CAAC;cAqCP,cAAc,CAC5B,IAAI,EAAE,iBAAiB,EAAE,EACR,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,eAAe,CAAC,OAAO,MAAM,CAAC,EAAE,CAAC;IA+C5C,OAAO,CAAC,MAAM,CAAC,cAAc;IAW7B;;;;;;;OAOG;YACW,iBAAiB;CAqDhC"}
|
@@ -12,11 +12,9 @@ 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
|
-
|
18
|
-
const generateMethodForModels = [_models_1.Country];
|
19
|
-
class RegionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFactory(_models_1.Region, generateMethodForModels, joiner_config_1.entityNameToLinkableKeysMap) {
|
17
|
+
class RegionModuleService extends (0, utils_1.MedusaService)({ Region: _models_1.Region, Country: _models_1.Country }) {
|
20
18
|
constructor({ baseRepository, regionService, countryService }, moduleDeclaration) {
|
21
19
|
// @ts-ignore
|
22
20
|
super(...arguments);
|
@@ -25,15 +23,12 @@ class RegionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceF
|
|
25
23
|
this.regionService_ = regionService;
|
26
24
|
this.countryService_ = countryService;
|
27
25
|
}
|
28
|
-
|
29
|
-
return joiner_config_1.joinerConfig;
|
30
|
-
}
|
31
|
-
async create(data, sharedContext = {}) {
|
26
|
+
async createRegions(data, sharedContext = {}) {
|
32
27
|
const input = Array.isArray(data) ? data : [data];
|
33
|
-
const result = await this.
|
28
|
+
const result = await this.createRegions_(input, sharedContext);
|
34
29
|
return await this.baseRepository_.serialize(Array.isArray(data) ? result : result[0]);
|
35
30
|
}
|
36
|
-
async
|
31
|
+
async createRegions_(data, sharedContext = {}) {
|
37
32
|
let normalizedInput = RegionModuleService.normalizeInput(data);
|
38
33
|
let normalizedDbRegions = normalizedInput.map((region) => (0, utils_1.removeUndefined)({
|
39
34
|
...region,
|
@@ -51,21 +46,31 @@ class RegionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceF
|
|
51
46
|
}
|
52
47
|
return result;
|
53
48
|
}
|
54
|
-
|
49
|
+
// @ts-ignore
|
50
|
+
async softDeleteRegions(ids, config, sharedContext = {}) {
|
51
|
+
const result = await super.softDeleteRegions(ids, config, sharedContext);
|
52
|
+
// Note: You cannot revert the state of a region by simply restoring it. The association with countries is lost.
|
53
|
+
await super.updateCountries({
|
54
|
+
selector: { region_id: ids },
|
55
|
+
data: { region_id: null },
|
56
|
+
}, sharedContext);
|
57
|
+
return result;
|
58
|
+
}
|
59
|
+
async upsertRegions(data, sharedContext = {}) {
|
55
60
|
const input = Array.isArray(data) ? data : [data];
|
56
61
|
const forUpdate = input.filter((region) => !!region.id);
|
57
62
|
const forCreate = input.filter((region) => !region.id);
|
58
63
|
const operations = [];
|
59
64
|
if (forCreate.length) {
|
60
|
-
operations.push(this.
|
65
|
+
operations.push(this.createRegions_(forCreate, sharedContext));
|
61
66
|
}
|
62
67
|
if (forUpdate.length) {
|
63
|
-
operations.push(this.
|
68
|
+
operations.push(this.updateRegions_(forUpdate, sharedContext));
|
64
69
|
}
|
65
70
|
const result = (await (0, utils_1.promiseAll)(operations)).flat();
|
66
71
|
return await this.baseRepository_.serialize(Array.isArray(data) ? result : result[0]);
|
67
72
|
}
|
68
|
-
async
|
73
|
+
async updateRegions(idOrSelector, data, sharedContext = {}) {
|
69
74
|
let normalizedInput = [];
|
70
75
|
if ((0, utils_1.isString)(idOrSelector)) {
|
71
76
|
normalizedInput = [{ id: idOrSelector, ...data }];
|
@@ -77,11 +82,11 @@ class RegionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceF
|
|
77
82
|
...data,
|
78
83
|
}));
|
79
84
|
}
|
80
|
-
const updateResult = await this.
|
85
|
+
const updateResult = await this.updateRegions_(normalizedInput, sharedContext);
|
81
86
|
const regions = await this.baseRepository_.serialize(updateResult);
|
82
87
|
return (0, utils_1.isString)(idOrSelector) ? regions[0] : regions;
|
83
88
|
}
|
84
|
-
async
|
89
|
+
async updateRegions_(data, sharedContext = {}) {
|
85
90
|
const normalizedInput = RegionModuleService.normalizeInput(data);
|
86
91
|
// If countries are being updated for a region, first make previously set countries' region to null to get to a clean slate.
|
87
92
|
// Somewhat less efficient, but region operations will be very rare, so it is better to go with a simple solution
|
@@ -135,7 +140,7 @@ class RegionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceF
|
|
135
140
|
if (uniqueCountries.length !== countries.length) {
|
136
141
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Countries with codes: "${(0, utils_1.getDuplicates)(countries).join(", ")}" are already assigned to a region`);
|
137
142
|
}
|
138
|
-
const countriesInDb = await this.countryService_.list({ iso_2: uniqueCountries }, { select: ["iso_2", "region_id"]
|
143
|
+
const countriesInDb = await this.countryService_.list({ iso_2: uniqueCountries }, { select: ["iso_2", "region_id"] }, sharedContext);
|
139
144
|
const countryCodesInDb = countriesInDb.map((c) => c.iso_2.toLowerCase());
|
140
145
|
// Countries missing in the database
|
141
146
|
if (countriesInDb.length !== uniqueCountries.length) {
|
@@ -143,6 +148,7 @@ class RegionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceF
|
|
143
148
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Countries with codes: "${missingCountries.join(", ")}" do not exist`);
|
144
149
|
}
|
145
150
|
// Countries that already have a region already assigned to them
|
151
|
+
// @ts-ignore
|
146
152
|
const countriesWithRegion = countriesInDb.filter((c) => !!c.region_id);
|
147
153
|
if (countriesWithRegion.length) {
|
148
154
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Countries with codes: "${countriesWithRegion
|
@@ -154,37 +160,47 @@ class RegionModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceF
|
|
154
160
|
}
|
155
161
|
exports.default = RegionModuleService;
|
156
162
|
__decorate([
|
157
|
-
(0, utils_1.InjectManager)(
|
163
|
+
(0, utils_1.InjectManager)(),
|
158
164
|
__param(1, (0, utils_1.MedusaContext)()),
|
159
165
|
__metadata("design:type", Function),
|
160
166
|
__metadata("design:paramtypes", [Object, Object]),
|
161
167
|
__metadata("design:returntype", Promise)
|
162
|
-
], RegionModuleService.prototype, "
|
168
|
+
], RegionModuleService.prototype, "createRegions", null);
|
163
169
|
__decorate([
|
164
|
-
(0, utils_1.InjectTransactionManager)(
|
170
|
+
(0, utils_1.InjectTransactionManager)(),
|
165
171
|
__param(1, (0, utils_1.MedusaContext)()),
|
166
172
|
__metadata("design:type", Function),
|
167
173
|
__metadata("design:paramtypes", [Array, Object]),
|
168
174
|
__metadata("design:returntype", Promise)
|
169
|
-
], RegionModuleService.prototype, "
|
175
|
+
], RegionModuleService.prototype, "createRegions_", null);
|
176
|
+
__decorate([
|
177
|
+
(0, utils_1.InjectManager)()
|
178
|
+
// @ts-ignore
|
179
|
+
,
|
180
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
181
|
+
__metadata("design:type", Function),
|
182
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
183
|
+
__metadata("design:returntype", Promise)
|
184
|
+
], RegionModuleService.prototype, "softDeleteRegions", null);
|
170
185
|
__decorate([
|
171
|
-
(0, utils_1.InjectTransactionManager)(
|
186
|
+
(0, utils_1.InjectTransactionManager)(),
|
172
187
|
__param(1, (0, utils_1.MedusaContext)()),
|
173
188
|
__metadata("design:type", Function),
|
174
189
|
__metadata("design:paramtypes", [Object, Object]),
|
175
190
|
__metadata("design:returntype", Promise)
|
176
|
-
], RegionModuleService.prototype, "
|
191
|
+
], RegionModuleService.prototype, "upsertRegions", null);
|
177
192
|
__decorate([
|
178
|
-
(0, utils_1.InjectManager)(
|
193
|
+
(0, utils_1.InjectManager)(),
|
179
194
|
__param(2, (0, utils_1.MedusaContext)()),
|
180
195
|
__metadata("design:type", Function),
|
181
196
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
182
197
|
__metadata("design:returntype", Promise)
|
183
|
-
], RegionModuleService.prototype, "
|
198
|
+
], RegionModuleService.prototype, "updateRegions", null);
|
184
199
|
__decorate([
|
185
|
-
(0, utils_1.InjectTransactionManager)(
|
200
|
+
(0, utils_1.InjectTransactionManager)(),
|
186
201
|
__param(1, (0, utils_1.MedusaContext)()),
|
187
202
|
__metadata("design:type", Function),
|
188
203
|
__metadata("design:paramtypes", [Array, Object]),
|
189
204
|
__metadata("design:returntype", Promise)
|
190
|
-
], RegionModuleService.prototype, "
|
205
|
+
], RegionModuleService.prototype, "updateRegions_", null);
|
206
|
+
//# sourceMappingURL=region-module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"region-module.js","sourceRoot":"","sources":["../../src/services/region-module.ts"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AC,CAAC,CAAC,KAAK,CAAC;iBACnB,IAAI,CAAC,IAAI,CAAC,oCAAoC,CAClD,CAAA;QACH,CAAC;QAED,OAAO,aAAa,CAAA;IACtB,CAAC;CACF;AAjUD,sCAiUC;AAtRO;IADL,IAAA,qBAAa,GAAE;IAGb,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;wDASjB;AAGK;IADL,IAAA,gCAAwB,GAAE;IAGxB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;yDAkCjB;AAIK;IAFL,IAAA,qBAAa,GAAE;IAChB,aAAa;;IAIV,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;4DAajB;AAYK;IADL,IAAA,gCAAwB,GAAE;IAGxB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;wDAuBjB;AAeK;IADL,IAAA,qBAAa,GAAE;IAIb,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;wDA4BjB;AAGe;IADf,IAAA,gCAAwB,GAAE;IAGxB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;yDA8CjB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"root":["../src/index.ts","../src/loaders/defaults.ts","../src/loaders/index.ts","../src/migrations/migration20240205173216.ts","../src/migrations/migration20240624200006.ts","../src/models/country.ts","../src/models/index.ts","../src/models/region.ts","../src/services/index.ts","../src/services/region-module.ts","../src/types/index.ts"],"version":"5.6.2"}
|
package/dist/types/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Logger, UpdateRegionDTO } from "@medusajs/types";
|
1
|
+
import { Logger, UpdateRegionDTO } from "@medusajs/framework/types";
|
2
2
|
export type InitializeModuleInjectableDependencies = {
|
3
3
|
logger?: Logger;
|
4
4
|
};
|
@@ -16,3 +16,4 @@ export type CreateCountryDTO = {
|
|
16
16
|
export type UpdateRegionInput = UpdateRegionDTO & {
|
17
17
|
id: string;
|
18
18
|
};
|
19
|
+
//# 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,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEnE,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
package/dist/types/index.js
CHANGED
@@ -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/region",
|
3
|
-
"version": "0.
|
3
|
+
"version": "1.0.0-rc-20241001083650",
|
4
4
|
"description": "Medusa Region 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": ">=
|
12
|
-
},
|
13
|
-
"bin": {
|
14
|
-
"medusa-region-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
|
-
"
|
30
|
-
"build": "rimraf dist && tsc --build &&
|
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 --passWithNoTests --bail --forceExit -- src",
|
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
|
-
"
|
42
|
-
"
|
43
|
-
"
|
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.
|
51
|
+
"typescript": "^5.6.2"
|
49
52
|
},
|
50
|
-
"
|
51
|
-
"@medusajs/
|
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.
|
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 { 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>;
|