@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/index.d.ts
CHANGED
@@ -1,4 +1,36 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
import { RegionModuleService } from "./services";
|
2
|
+
import { Modules } from "@medusajs/framework/utils";
|
3
|
+
declare const _default: import("@medusajs/types").ModuleExports<typeof RegionModuleService> & {
|
4
|
+
linkable: {
|
5
|
+
region: {
|
6
|
+
id: {
|
7
|
+
serviceName: Modules.REGION;
|
8
|
+
field: "region";
|
9
|
+
linkable: "region_id";
|
10
|
+
primaryKey: "id";
|
11
|
+
};
|
12
|
+
toJSON: () => {
|
13
|
+
serviceName: Modules.REGION;
|
14
|
+
field: "region";
|
15
|
+
linkable: "region_id";
|
16
|
+
primaryKey: "id";
|
17
|
+
};
|
18
|
+
};
|
19
|
+
country: {
|
20
|
+
iso_2: {
|
21
|
+
serviceName: Modules.REGION;
|
22
|
+
field: "country";
|
23
|
+
linkable: "country_iso_2";
|
24
|
+
primaryKey: "iso_2";
|
25
|
+
};
|
26
|
+
toJSON: () => {
|
27
|
+
serviceName: Modules.REGION;
|
28
|
+
field: "country";
|
29
|
+
linkable: "country_iso_2";
|
30
|
+
primaryKey: "iso_2";
|
31
|
+
};
|
32
|
+
};
|
33
|
+
};
|
34
|
+
};
|
35
|
+
export default _default;
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAU,OAAO,EAAE,MAAM,2BAA2B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,wBAGE"}
|
package/dist/index.js
CHANGED
@@ -1,22 +1,13 @@
|
|
1
1
|
"use strict";
|
2
|
-
var
|
3
|
-
|
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);
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
4
|
};
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
|
18
|
-
const
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
6
|
+
const services_1 = require("./services");
|
7
|
+
const defaults_1 = __importDefault(require("./loaders/defaults"));
|
8
|
+
const utils_1 = require("@medusajs/framework/utils");
|
9
|
+
exports.default = (0, utils_1.Module)(utils_1.Modules.REGION, {
|
10
|
+
service: services_1.RegionModuleService,
|
11
|
+
loaders: [defaults_1.default],
|
12
|
+
});
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yCAAgD;AAChD,kEAA6C;AAC7C,qDAA2D;AAE3D,kBAAe,IAAA,cAAM,EAAC,eAAO,CAAC,MAAM,EAAE;IACpC,OAAO,EAAE,8BAAmB;IAC5B,OAAO,EAAE,CAAC,kBAAY,CAAC;CACxB,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/loaders/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGd,MAAM,2BAA2B,CAAA;wCAOG,aAAa,KAAG,OAAO,CAAC,IAAI,CAAC;AAAlE,wBAwBC"}
|
package/dist/loaders/defaults.js
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const utils_1 = require("@medusajs/utils");
|
4
|
-
const utils_2 = require("@medusajs/utils");
|
3
|
+
const utils_1 = require("@medusajs/framework/utils");
|
5
4
|
exports.default = async ({ container }) => {
|
6
5
|
// TODO: Add default logger to the container when running tests
|
7
6
|
const logger = container.resolve(utils_1.ContainerRegistrationKeys.LOGGER) ?? console;
|
8
7
|
const countryService_ = container.resolve("countryService");
|
9
8
|
try {
|
10
|
-
const normalizedCountries =
|
9
|
+
const normalizedCountries = utils_1.DefaultsUtils.defaultCountries.map((c) => ({
|
11
10
|
iso_2: c.alpha2.toLowerCase(),
|
12
11
|
iso_3: c.alpha3.toLowerCase(),
|
13
12
|
num_code: c.numeric,
|
@@ -15,9 +14,10 @@ exports.default = async ({ container }) => {
|
|
15
14
|
display_name: c.name,
|
16
15
|
}));
|
17
16
|
const resp = await countryService_.upsert(normalizedCountries);
|
18
|
-
logger.
|
17
|
+
logger.debug(`Loaded ${resp.length} countries`);
|
19
18
|
}
|
20
19
|
catch (error) {
|
21
20
|
logger.warn(`Failed to load countries, skipping loader. Original error: ${error.message}`);
|
22
21
|
}
|
23
22
|
};
|
23
|
+
//# sourceMappingURL=defaults.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/loaders/defaults.ts"],"names":[],"mappings":";;AAKA,qDAGkC;AAGlC,kBAAe,KAAK,EAAE,EAAE,SAAS,EAAiB,EAAiB,EAAE;IACnE,+DAA+D;IAC/D,MAAM,MAAM,GACV,SAAS,CAAC,OAAO,CAAS,iCAAyB,CAAC,MAAM,CAAC,IAAI,OAAO,CAAA;IACxE,MAAM,eAAe,GAEjB,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAEvC,IAAI,CAAC;QACH,MAAM,mBAAmB,GAAG,qBAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACrE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE;YAC7B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE;YAC7B,QAAQ,EAAE,CAAC,CAAC,OAAO;YACnB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE;YAC1B,YAAY,EAAE,CAAC,CAAC,IAAI;SACrB,CAAC,CAAC,CAAA;QAEH,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAA;QAC9D,MAAM,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,MAAM,YAAY,CAAC,CAAA;IACjD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CACT,8DAA8D,KAAK,CAAC,OAAO,EAAE,CAC9E,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
|
package/dist/loaders/index.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
package/dist/loaders/index.js
CHANGED
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./connection"), exports);
|
18
|
-
__exportStar(require("./container"), exports);
|
19
17
|
__exportStar(require("./defaults"), exports);
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Migration20240205173216.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240205173216.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,+BAAgC,SAAQ,SAAS;IACtD,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAuC1B"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.RegionModuleSetup20240205173216 = void 0;
|
4
|
-
const utils_1 = require("@medusajs/utils");
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
5
5
|
const migrations_1 = require("@mikro-orm/migrations");
|
6
6
|
class RegionModuleSetup20240205173216 extends migrations_1.Migration {
|
7
7
|
async up() {
|
@@ -27,7 +27,7 @@ CREATE INDEX IF NOT EXISTS "IDX_region_deleted_at" ON "region" ("deleted_at") WH
|
|
27
27
|
CREATE TABLE IF NOT EXISTS "region_country" (
|
28
28
|
"iso_2" text NOT NULL,
|
29
29
|
"iso_3" text NOT NULL,
|
30
|
-
"num_code"
|
30
|
+
"num_code" text NOT NULL,
|
31
31
|
"name" text NOT NULL,
|
32
32
|
"display_name" text NOT NULL,
|
33
33
|
"region_id" text NULL,
|
@@ -41,3 +41,4 @@ ALTER TABLE "region_country" ADD CONSTRAINT "region_country_region_id_foreign" F
|
|
41
41
|
}
|
42
42
|
}
|
43
43
|
exports.RegionModuleSetup20240205173216 = RegionModuleSetup20240205173216;
|
44
|
+
//# sourceMappingURL=Migration20240205173216.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Migration20240205173216.js","sourceRoot":"","sources":["../../src/migrations/Migration20240205173216.ts"],"names":[],"mappings":";;;AAAA,qDAAwF;AACxF,sDAAiD;AAEjD,MAAa,+BAAgC,SAAQ,sBAAS;IAC5D,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;EAed,IAAA,oDAA4C,EAC5C,QAAQ,EACR,CAAC,UAAU,EAAE,oBAAoB,EAAE,cAAc,CAAC,EAClD,eAAe,CAChB;;;;;;;;;;;;;;;;;CAiBA,CAAC,CAAA;IACA,CAAC;CACF;AAxCD,0EAwCC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Migration20240624200006.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20240624200006.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAanB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAqB5B"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Migration20240624200006 = void 0;
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
5
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
6
|
+
class Migration20240624200006 extends migrations_1.Migration {
|
7
|
+
async up() {
|
8
|
+
this.addSql('ALTER TABLE IF EXISTS "region_country" ADD COLUMN IF NOT EXISTS "metadata" jsonb null, ADD COLUMN "created_at" timestamptz NOT NULL DEFAULT NOW(), ADD COLUMN "updated_at" timestamptz NOT NULL DEFAULT NOW(), ADD COLUMN "deleted_at" timestamptz NULL;');
|
9
|
+
this.addSql((0, utils_1.generatePostgresAlterColummnIfExistStatement)("region_country", ["region_id"], `DROP NOT NULL`));
|
10
|
+
}
|
11
|
+
async down() {
|
12
|
+
this.addSql('ALTER TABLE IF EXISTS "region_country" DROP COLUMN IF EXISTS "metadata";');
|
13
|
+
this.addSql('ALTER TABLE IF EXISTS "region_country" DROP COLUMN IF EXISTS "created_at";');
|
14
|
+
this.addSql('ALTER TABLE IF EXISTS "region_country" DROP COLUMN IF EXISTS "updated_at";');
|
15
|
+
this.addSql('ALTER TABLE IF EXISTS "region_country" DROP COLUMN IF EXISTS "deleted_at";');
|
16
|
+
this.addSql((0, utils_1.generatePostgresAlterColummnIfExistStatement)("region_country", ["region_id"], `SET NOT NULL`));
|
17
|
+
}
|
18
|
+
}
|
19
|
+
exports.Migration20240624200006 = Migration20240624200006;
|
20
|
+
//# sourceMappingURL=Migration20240624200006.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Migration20240624200006.js","sourceRoot":"","sources":["../../src/migrations/Migration20240624200006.ts"],"names":[],"mappings":";;;AAAA,qDAAwF;AACxF,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT,0PAA0P,CAC3P,CAAA;QACD,IAAI,CAAC,MAAM,CACT,IAAA,oDAA4C,EAC1C,gBAAgB,EAChB,CAAC,WAAW,CAAC,EACb,eAAe,CAChB,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,CACT,0EAA0E,CAC3E,CAAA;QACD,IAAI,CAAC,MAAM,CACT,4EAA4E,CAC7E,CAAA;QACD,IAAI,CAAC,MAAM,CACT,4EAA4E,CAC7E,CAAA;QACD,IAAI,CAAC,MAAM,CACT,4EAA4E,CAC7E,CAAA;QACD,IAAI,CAAC,MAAM,CACT,IAAA,oDAA4C,EAC1C,gBAAgB,EAChB,CAAC,WAAW,CAAC,EACb,cAAc,CACf,CACF,CAAA;IACH,CAAC;CACF;AAnCD,0DAmCC"}
|
package/dist/models/country.d.ts
CHANGED
@@ -1,10 +1,166 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
declare const _default: import("@medusajs/framework/utils").DmlEntity<{
|
2
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
3
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
4
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
5
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
6
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
7
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<() => import("@medusajs/framework/utils").DmlEntity<{
|
8
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
9
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
10
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
11
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
12
|
+
countries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
13
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
14
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
15
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
16
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
17
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
18
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<any, import("@medusajs/framework/utils").BelongsTo<any>>;
|
19
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
20
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
21
|
+
readonly name: "Country";
|
22
|
+
readonly tableName: "region_country";
|
23
|
+
}>>;
|
24
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
25
|
+
} & {
|
26
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
27
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
28
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
29
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
30
|
+
countries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
31
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
32
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
33
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
34
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
35
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
36
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<any, import("@medusajs/framework/utils").BelongsTo<any>>;
|
37
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
38
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
39
|
+
readonly name: "Country";
|
40
|
+
readonly tableName: "region_country";
|
41
|
+
}>>;
|
42
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
43
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">, import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<{
|
44
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
45
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
46
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
47
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
48
|
+
countries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
49
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
50
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
51
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
52
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
53
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
54
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<any, import("@medusajs/framework/utils").BelongsTo<any>>;
|
55
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
56
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
57
|
+
readonly name: "Country";
|
58
|
+
readonly tableName: "region_country";
|
59
|
+
}>>;
|
60
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
61
|
+
} & {
|
62
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
63
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
64
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
65
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
66
|
+
countries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
67
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
68
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
69
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
70
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
71
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
72
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<any, import("@medusajs/framework/utils").BelongsTo<any>>;
|
73
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
74
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
75
|
+
readonly name: "Country";
|
76
|
+
readonly tableName: "region_country";
|
77
|
+
}>>;
|
78
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
79
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">>>;
|
80
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
81
|
+
} & {
|
82
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
83
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
84
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
85
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
86
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
87
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<() => import("@medusajs/framework/utils").DmlEntity<{
|
88
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
89
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
90
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
91
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
92
|
+
countries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
93
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
94
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
95
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
96
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
97
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
98
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<any, import("@medusajs/framework/utils").BelongsTo<any>>;
|
99
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
100
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
101
|
+
readonly name: "Country";
|
102
|
+
readonly tableName: "region_country";
|
103
|
+
}>>;
|
104
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
105
|
+
} & {
|
106
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
107
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
108
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
109
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
110
|
+
countries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
111
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
112
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
113
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
114
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
115
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
116
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<any, import("@medusajs/framework/utils").BelongsTo<any>>;
|
117
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
118
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
119
|
+
readonly name: "Country";
|
120
|
+
readonly tableName: "region_country";
|
121
|
+
}>>;
|
122
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
123
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">, import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<{
|
124
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
125
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
126
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
127
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
128
|
+
countries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
129
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
130
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
131
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
132
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
133
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
134
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<any, import("@medusajs/framework/utils").BelongsTo<any>>;
|
135
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
136
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
137
|
+
readonly name: "Country";
|
138
|
+
readonly tableName: "region_country";
|
139
|
+
}>>;
|
140
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
141
|
+
} & {
|
142
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
143
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
144
|
+
currency_code: import("@medusajs/framework/utils").TextProperty;
|
145
|
+
automatic_taxes: import("@medusajs/framework/utils").BooleanProperty;
|
146
|
+
countries: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<any & {
|
147
|
+
iso_2: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
148
|
+
iso_3: import("@medusajs/framework/utils").TextProperty;
|
149
|
+
num_code: import("@medusajs/framework/utils").TextProperty;
|
150
|
+
name: import("@medusajs/framework/utils").TextProperty;
|
151
|
+
display_name: import("@medusajs/framework/utils").TextProperty;
|
152
|
+
region: import("@medusajs/framework/utils").RelationNullableModifier<any, import("@medusajs/framework/utils").BelongsTo<any>>;
|
153
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
154
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
155
|
+
readonly name: "Country";
|
156
|
+
readonly tableName: "region_country";
|
157
|
+
}>>;
|
158
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
159
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, "region">>>;
|
160
|
+
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
161
|
+
} & {} & import("@medusajs/framework/utils").DMLSchemaDefaults, {
|
162
|
+
readonly name: "Country";
|
163
|
+
readonly tableName: "region_country";
|
164
|
+
}>;
|
165
|
+
export default _default;
|
166
|
+
//# sourceMappingURL=country.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"country.d.ts","sourceRoot":"","sources":["../../src/models/country.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAsBI"}
|
package/dist/models/country.js
CHANGED
@@ -1,69 +1,28 @@
|
|
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
|
16
|
-
const utils_1 = require("@medusajs/utils");
|
6
|
+
const utils_1 = require("@medusajs/framework/utils");
|
17
7
|
const region_1 = __importDefault(require("./region"));
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
__metadata("design:type", String)
|
40
|
-
], Country.prototype, "iso_3", void 0);
|
41
|
-
__decorate([
|
42
|
-
(0, core_1.Property)({ columnType: "int" }),
|
43
|
-
__metadata("design:type", Number)
|
44
|
-
], Country.prototype, "num_code", void 0);
|
45
|
-
__decorate([
|
46
|
-
(0, core_1.Property)({ columnType: "text" }),
|
47
|
-
__metadata("design:type", String)
|
48
|
-
], Country.prototype, "name", void 0);
|
49
|
-
__decorate([
|
50
|
-
(0, core_1.Property)({ columnType: "text" }),
|
51
|
-
__metadata("design:type", String)
|
52
|
-
], Country.prototype, "display_name", void 0);
|
53
|
-
__decorate([
|
54
|
-
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
55
|
-
__metadata("design:type", Object)
|
56
|
-
], Country.prototype, "region_id", void 0);
|
57
|
-
__decorate([
|
58
|
-
(0, core_1.ManyToOne)({
|
59
|
-
entity: () => region_1.default,
|
60
|
-
fieldName: "region_id",
|
61
|
-
nullable: true,
|
62
|
-
onDelete: "set null",
|
63
|
-
}),
|
64
|
-
__metadata("design:type", Object)
|
65
|
-
], Country.prototype, "region", void 0);
|
66
|
-
Country = __decorate([
|
67
|
-
(0, core_1.Entity)({ tableName: "region_country" })
|
68
|
-
], Country);
|
69
|
-
exports.default = Country;
|
8
|
+
exports.default = utils_1.model
|
9
|
+
.define({ name: "Country", tableName: "region_country" }, {
|
10
|
+
iso_2: utils_1.model.text().searchable().primaryKey(),
|
11
|
+
iso_3: utils_1.model.text(),
|
12
|
+
num_code: utils_1.model.text(),
|
13
|
+
name: utils_1.model.text().searchable(),
|
14
|
+
display_name: utils_1.model.text(),
|
15
|
+
region: utils_1.model
|
16
|
+
.belongsTo(() => region_1.default, { mappedBy: "countries" })
|
17
|
+
.nullable(),
|
18
|
+
metadata: utils_1.model.json().nullable(),
|
19
|
+
})
|
20
|
+
.indexes([
|
21
|
+
{
|
22
|
+
// TODO: Remove ts-ignore when field inference takes into account the nullable property
|
23
|
+
// @ts-ignore
|
24
|
+
on: ["region_id", "iso_2"],
|
25
|
+
unique: true,
|
26
|
+
},
|
27
|
+
]);
|
28
|
+
//# sourceMappingURL=country.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"country.js","sourceRoot":"","sources":["../../src/models/country.ts"],"names":[],"mappings":";;;;;AAAA,qDAAiD;AACjD,sDAA6B;AAE7B,kBAAe,aAAK;KACjB,MAAM,CACL,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAChD;IACE,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC,UAAU,EAAE;IAC7C,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE;IACnB,QAAQ,EAAE,aAAK,CAAC,IAAI,EAAE;IACtB,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IAC/B,YAAY,EAAE,aAAK,CAAC,IAAI,EAAE;IAC1B,MAAM,EAAE,aAAK;SACV,SAAS,CAAC,GAAG,EAAE,CAAC,gBAAM,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;SAClD,QAAQ,EAAE;IACb,QAAQ,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;CAClC,CACF;KACA,OAAO,CAAC;IACP;QACE,uFAAuF;QACvF,aAAa;QACb,EAAE,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;QAC1B,MAAM,EAAE,IAAI;KACb;CACF,CAAC,CAAA"}
|
package/dist/models/index.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/models/index.js
CHANGED
@@ -8,3 +8,4 @@ var country_1 = require("./country");
|
|
8
8
|
Object.defineProperty(exports, "Country", { enumerable: true, get: function () { return __importDefault(country_1).default; } });
|
9
9
|
var region_1 = require("./region");
|
10
10
|
Object.defineProperty(exports, "Region", { enumerable: true, get: function () { return __importDefault(region_1).default; } });
|
11
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;AAAA,qCAA8C;AAArC,mHAAA,OAAO,OAAW;AAC3B,mCAA4C;AAAnC,iHAAA,OAAO,OAAU"}
|