@unchainedshop/core-countries 4.0.0-rc.4 → 4.0.0-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unchainedshop/core-countries",
3
- "version": "4.0.0-rc.4",
3
+ "version": "4.0.0-rc.6",
4
4
  "main": "lib/countries-index.js",
5
5
  "types": "lib/countries-index.d.ts",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "@unchainedshop/utils": "^4.0.0-rc.4"
36
36
  },
37
37
  "devDependencies": {
38
- "@types/node": "^24.0.4",
38
+ "@types/node": "^24.0.13",
39
39
  "tsx": "^4.20.3",
40
40
  "typescript": "^5.8.3"
41
41
  }
@@ -1,3 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- export declare const CountriesSchema: SimpleSchema;
3
- //# sourceMappingURL=CountriesSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CountriesSchema.d.ts","sourceRoot":"","sources":["../../src/db/CountriesSchema.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,eAAe,cAQ3B,CAAC"}
@@ -1,9 +0,0 @@
1
- import { Schemas } from '@unchainedshop/utils';
2
- import SimpleSchema from 'simpl-schema';
3
- export const CountriesSchema = new SimpleSchema({
4
- isoCode: { type: String, required: true },
5
- isActive: Boolean,
6
- defaultCurrencyCode: String,
7
- ...Schemas.timestampFields,
8
- }, { requiredByDefault: false });
9
- //# sourceMappingURL=CountriesSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CountriesSchema.js","sourceRoot":"","sources":["../../src/db/CountriesSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,YAAY,CAC7C;IACE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,QAAQ,EAAE,OAAO;IACjB,mBAAmB,EAAE,MAAM;IAC3B,GAAG,OAAO,CAAC,eAAe;CAC3B,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC"}
@@ -1,3 +0,0 @@
1
- import { MigrationRepository } from '@unchainedshop/mongodb';
2
- export default function addMigrations(repository: MigrationRepository): void;
3
- //# sourceMappingURL=addMigrations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addMigrations.d.ts","sourceRoot":"","sources":["../../src/migrations/addMigrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAI7D,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,UAAU,EAAE,mBAAmB,QAmCpE"}
@@ -1,28 +0,0 @@
1
- import { CountriesCollection } from '../db/CountriesCollection.js';
2
- export default function addMigrations(repository) {
3
- repository?.register({
4
- id: 20241220123500,
5
- name: 'Remove defaultCurrencyId from countries and add defaultCurrencyCode',
6
- up: async () => {
7
- const Currencies = await repository.db.collection('currencies');
8
- const Countries = await CountriesCollection(repository.db);
9
- const allCurrencies = await Currencies.find({}).toArray();
10
- const allCountries = await Countries.find({}).toArray();
11
- const currencyMap = allCurrencies.reduce((acc, currency) => {
12
- acc[currency._id] = currency.isoCode;
13
- return acc;
14
- }, {});
15
- for (const country of allCountries) {
16
- await Countries.updateOne({ _id: country._id, defaultCurrencyId: { $exists: true } }, {
17
- $set: {
18
- defaultCurrencyCode: currencyMap[country.defaultCurrencyId],
19
- },
20
- $unset: {
21
- defaultCurrencyId: 1,
22
- },
23
- });
24
- }
25
- },
26
- });
27
- }
28
- //# sourceMappingURL=addMigrations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addMigrations.js","sourceRoot":"","sources":["../../src/migrations/addMigrations.ts"],"names":[],"mappings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