@open-mercato/shared 0.8.1-develop.7275.1.f772b944d4 → 0.8.1-develop.7294.1.0ef99fc518
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/.turbo/turbo-build.log +2 -1
- package/build.mjs +4 -1
- package/dist/lib/crud/errors.js +6 -1
- package/dist/lib/crud/errors.js.map +2 -2
- package/dist/lib/crud/factory.js +22 -13
- package/dist/lib/crud/factory.js.map +2 -2
- package/dist/lib/custom-fields/kinds.js +113 -0
- package/dist/lib/custom-fields/kinds.js.map +7 -0
- package/dist/lib/encryption/indexDoc.js +12 -9
- package/dist/lib/encryption/indexDoc.js.map +2 -2
- package/dist/lib/location/countries.generated.js +265 -0
- package/dist/lib/location/countries.generated.js.map +7 -0
- package/dist/lib/location/countries.js +2 -13
- package/dist/lib/location/countries.js.map +2 -2
- package/dist/lib/navigation/pageReload.js +11 -0
- package/dist/lib/navigation/pageReload.js.map +7 -0
- package/dist/lib/schedule/interval.js +33 -0
- package/dist/lib/schedule/interval.js.map +7 -0
- package/dist/lib/schedule/invalidScheduleValue.js +19 -0
- package/dist/lib/schedule/invalidScheduleValue.js.map +7 -0
- package/dist/lib/version.js +1 -1
- package/dist/lib/version.js.map +1 -1
- package/package.json +3 -2
- package/scripts/generate-countries.mjs +75 -0
- package/src/lib/crud/__tests__/crud-factory.test.ts +177 -0
- package/src/lib/crud/__tests__/errors.test.ts +31 -1
- package/src/lib/crud/errors.ts +16 -0
- package/src/lib/crud/factory.ts +37 -15
- package/src/lib/custom-fields/__tests__/kinds.test.ts +208 -0
- package/src/lib/custom-fields/kinds.ts +205 -0
- package/src/lib/encryption/__tests__/indexDoc.custom-field-kinds.test.ts +127 -0
- package/src/lib/encryption/__tests__/indexDoc.test.ts +39 -0
- package/src/lib/encryption/indexDoc.ts +16 -7
- package/src/lib/location/__tests__/countries.test.ts +25 -0
- package/src/lib/location/countries.generated.ts +264 -0
- package/src/lib/location/countries.ts +2 -23
- package/src/lib/navigation/__tests__/pageReload.test.ts +58 -0
- package/src/lib/navigation/pageReload.ts +43 -0
- package/src/lib/schedule/__tests__/interval.test.ts +37 -0
- package/src/lib/schedule/interval.ts +45 -0
- package/src/lib/schedule/invalidScheduleValue.ts +33 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {
|
|
2
|
+
selectDefinitionForRecord,
|
|
3
|
+
sortDefinitionSummaries,
|
|
4
|
+
summarizeDefinitionRow
|
|
5
|
+
} from "../crud/custom-field-definition-index.js";
|
|
6
|
+
const CF_KEY_PREFIX = /^cf[:_]/;
|
|
7
|
+
function sanitizeKey(key) {
|
|
8
|
+
return key.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
9
|
+
}
|
|
10
|
+
function normalizeKey(value) {
|
|
11
|
+
if (typeof value === "string") return value.trim();
|
|
12
|
+
if (value == null) return "";
|
|
13
|
+
return String(value).trim();
|
|
14
|
+
}
|
|
15
|
+
function normalizeScopeId(value) {
|
|
16
|
+
if (typeof value !== "string") return null;
|
|
17
|
+
const trimmed = value.trim();
|
|
18
|
+
return trimmed.length ? trimmed : null;
|
|
19
|
+
}
|
|
20
|
+
function normalizeTimestamp(value) {
|
|
21
|
+
if (value instanceof Date) return value;
|
|
22
|
+
if (typeof value === "string" || typeof value === "number") return value;
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
function pushCandidate(bucket, key, summary) {
|
|
26
|
+
const existing = bucket.get(key);
|
|
27
|
+
if (existing) existing.push(summary);
|
|
28
|
+
else bucket.set(key, [summary]);
|
|
29
|
+
}
|
|
30
|
+
function buildCustomFieldKindIndex(rows) {
|
|
31
|
+
const keys = /* @__PURE__ */ new Map();
|
|
32
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
33
|
+
for (const row of rows) {
|
|
34
|
+
const key = normalizeKey(row.key);
|
|
35
|
+
if (!key) continue;
|
|
36
|
+
const summary = summarizeDefinitionRow({
|
|
37
|
+
key,
|
|
38
|
+
entityId: "",
|
|
39
|
+
kind: typeof row.kind === "string" && row.kind.length ? row.kind : null,
|
|
40
|
+
configJson: row.configJson ?? null,
|
|
41
|
+
organizationId: normalizeScopeId(row.organizationId),
|
|
42
|
+
tenantId: normalizeScopeId(row.tenantId),
|
|
43
|
+
deletedAt: null,
|
|
44
|
+
updatedAt: normalizeTimestamp(row.updatedAt)
|
|
45
|
+
});
|
|
46
|
+
if (!summary) continue;
|
|
47
|
+
pushCandidate(keys, key, summary);
|
|
48
|
+
const alias = sanitizeKey(key);
|
|
49
|
+
if (alias !== key) pushCandidate(aliases, alias, summary);
|
|
50
|
+
}
|
|
51
|
+
for (const [key, candidates] of keys) keys.set(key, sortDefinitionSummaries(candidates));
|
|
52
|
+
for (const [alias, candidates] of aliases) aliases.set(alias, sortDefinitionSummaries(candidates));
|
|
53
|
+
return { keys, aliases };
|
|
54
|
+
}
|
|
55
|
+
function emptyCustomFieldKindIndex() {
|
|
56
|
+
return { keys: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Map() };
|
|
57
|
+
}
|
|
58
|
+
function mergeCustomFieldKindIndexes(indexes) {
|
|
59
|
+
const merged = emptyCustomFieldKindIndex();
|
|
60
|
+
for (const index of indexes) {
|
|
61
|
+
if (!index) continue;
|
|
62
|
+
for (const [key, candidates] of index.keys) {
|
|
63
|
+
if (!merged.keys.has(key)) merged.keys.set(key, candidates);
|
|
64
|
+
}
|
|
65
|
+
for (const [alias, candidates] of index.aliases) {
|
|
66
|
+
if (!merged.aliases.has(alias)) merged.aliases.set(alias, candidates);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return merged;
|
|
70
|
+
}
|
|
71
|
+
function selectCustomFieldKindMap(index, organizationId, tenantId) {
|
|
72
|
+
const map = {};
|
|
73
|
+
if (!index) return map;
|
|
74
|
+
const orgId = organizationId ?? null;
|
|
75
|
+
const tenant = tenantId ?? null;
|
|
76
|
+
for (const [key, candidates] of index.keys) {
|
|
77
|
+
map[key] = selectDefinitionForRecord(candidates, orgId, tenant)?.kind ?? null;
|
|
78
|
+
}
|
|
79
|
+
for (const [alias, candidates] of index.aliases) {
|
|
80
|
+
if (alias in map) continue;
|
|
81
|
+
map[alias] = selectDefinitionForRecord(candidates, orgId, tenant)?.kind ?? null;
|
|
82
|
+
}
|
|
83
|
+
return map;
|
|
84
|
+
}
|
|
85
|
+
function createCustomFieldKindMapResolver(index) {
|
|
86
|
+
const cache = /* @__PURE__ */ new Map();
|
|
87
|
+
return (organizationId, tenantId) => {
|
|
88
|
+
const scopeKey = `${organizationId ?? ""}::${tenantId ?? ""}`;
|
|
89
|
+
const cached = cache.get(scopeKey);
|
|
90
|
+
if (cached) return cached;
|
|
91
|
+
const map = selectCustomFieldKindMap(index, organizationId, tenantId);
|
|
92
|
+
cache.set(scopeKey, map);
|
|
93
|
+
return map;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function resolveCustomFieldKind(kinds, docKey) {
|
|
97
|
+
if (!kinds) return null;
|
|
98
|
+
const bare = docKey.replace(CF_KEY_PREFIX, "");
|
|
99
|
+
if (!bare) return null;
|
|
100
|
+
if (bare in kinds) return kinds[bare] ?? null;
|
|
101
|
+
const alias = sanitizeKey(bare);
|
|
102
|
+
if (alias !== bare && alias in kinds) return kinds[alias] ?? null;
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
buildCustomFieldKindIndex,
|
|
107
|
+
createCustomFieldKindMapResolver,
|
|
108
|
+
emptyCustomFieldKindIndex,
|
|
109
|
+
mergeCustomFieldKindIndexes,
|
|
110
|
+
resolveCustomFieldKind,
|
|
111
|
+
selectCustomFieldKindMap
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=kinds.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/custom-fields/kinds.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Custom-field `kind` lookup for the `cf:`/`cf_` keys carried by a query-index document.\n *\n * `decryptCustomFieldValue` cannot recover a value's original JS type from the ciphertext\n * alone: the encrypt path stores a raw string unwrapped and JSON-stringifies everything\n * else, so the string `\"123\"` and the number `123` produce the same plaintext. The field's\n * `kind` is the only disambiguator, which is why every index-document read path has to\n * resolve it before decrypting (issue #5968).\n *\n * `custom_field_defs` has no unique constraint on `(entity_id, key)` \u2014 per-scope overrides\n * are a first-class feature, and an organization's override may declare a different `kind`\n * than the tenant-wide or global definition it shadows. A flat \"last row wins\" map would\n * therefore type a value from whichever definition the database happened to return last.\n * So the index keeps every candidate definition per key and resolves the winner against the\n * scope of the row being decrypted, through the same `selectDefinitionForRecord` precedence\n * the non-indexed loader in `crud/custom-fields.ts` already applies per record.\n */\nimport {\n selectDefinitionForRecord,\n sortDefinitionSummaries,\n summarizeDefinitionRow,\n type CustomFieldDefinitionSummary,\n} from '../crud/custom-field-definition-index'\n\nexport type CustomFieldKindMap = Record<string, string | null>\n\nexport type CustomFieldKindRow = {\n key: unknown\n kind?: unknown\n organizationId?: unknown\n tenantId?: unknown\n configJson?: unknown\n updatedAt?: unknown\n}\n\n/**\n * Candidate definitions per document key. `keys` holds the authored keys; `aliases` holds\n * the SQL-safe aliases only, and is consulted solely when the document key matches no\n * authored key \u2014 so a literal `my_field` definition is never shadowed by the alias a\n * `my-field` definition also sanitizes to.\n */\nexport type CustomFieldKindIndex = {\n keys: Map<string, CustomFieldDefinitionSummary[]>\n aliases: Map<string, CustomFieldDefinitionSummary[]>\n}\n\n/** Resolves the kind map that applies to a row in the given scope. */\nexport type CustomFieldKindMapResolver = (\n organizationId: string | null | undefined,\n tenantId: string | null | undefined,\n) => CustomFieldKindMap\n\nconst CF_KEY_PREFIX = /^cf[:_]/\n\n/**\n * Mirrors `HybridQueryEngine.sanitize()`, which aliases the doc key `cf:my-field` as the\n * SQL-safe column alias `cf_my_field`. The transform is lossy, so an index keyed only by the\n * authored key would never match a sanitized alias.\n */\nfunction sanitizeKey(key: string): string {\n return key.replace(/[^a-zA-Z0-9_]/g, '_')\n}\n\nfunction normalizeKey(value: unknown): string {\n if (typeof value === 'string') return value.trim()\n if (value == null) return ''\n return String(value).trim()\n}\n\nfunction normalizeScopeId(value: unknown): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim()\n return trimmed.length ? trimmed : null\n}\n\nfunction normalizeTimestamp(value: unknown): Date | string | number | null {\n if (value instanceof Date) return value\n if (typeof value === 'string' || typeof value === 'number') return value\n return null\n}\n\nfunction pushCandidate(\n bucket: Map<string, CustomFieldDefinitionSummary[]>,\n key: string,\n summary: CustomFieldDefinitionSummary,\n): void {\n const existing = bucket.get(key)\n if (existing) existing.push(summary)\n else bucket.set(key, [summary])\n}\n\nexport function buildCustomFieldKindIndex(rows: Iterable<CustomFieldKindRow>): CustomFieldKindIndex {\n const keys = new Map<string, CustomFieldDefinitionSummary[]>()\n const aliases = new Map<string, CustomFieldDefinitionSummary[]>()\n for (const row of rows) {\n const key = normalizeKey(row.key)\n if (!key) continue\n const summary = summarizeDefinitionRow({\n key,\n entityId: '',\n kind: typeof row.kind === 'string' && row.kind.length ? row.kind : null,\n configJson: row.configJson ?? null,\n organizationId: normalizeScopeId(row.organizationId),\n tenantId: normalizeScopeId(row.tenantId),\n deletedAt: null,\n updatedAt: normalizeTimestamp(row.updatedAt),\n })\n if (!summary) continue\n pushCandidate(keys, key, summary)\n const alias = sanitizeKey(key)\n if (alias !== key) pushCandidate(aliases, alias, summary)\n }\n // One precedence rule everywhere: `selectDefinitionForRecord` picks the scope winner and\n // `sortDefinitionSummaries` breaks ties deterministically, for authored keys and aliases\n // alike, so no bucket depends on the order rows arrived in.\n for (const [key, candidates] of keys) keys.set(key, sortDefinitionSummaries(candidates))\n for (const [alias, candidates] of aliases) aliases.set(alias, sortDefinitionSummaries(candidates))\n return { keys, aliases }\n}\n\nexport function emptyCustomFieldKindIndex(): CustomFieldKindIndex {\n return { keys: new Map(), aliases: new Map() }\n}\n\n/**\n * Merges per-source indexes into one, with earlier sources winning a key outright. Callers\n * pass their sources in the same priority order the value itself resolves in, so a key\n * defined by more than one source is typed by the source the value actually came from.\n */\nexport function mergeCustomFieldKindIndexes(\n indexes: Array<CustomFieldKindIndex | null | undefined>,\n): CustomFieldKindIndex {\n const merged = emptyCustomFieldKindIndex()\n for (const index of indexes) {\n if (!index) continue\n for (const [key, candidates] of index.keys) {\n if (!merged.keys.has(key)) merged.keys.set(key, candidates)\n }\n for (const [alias, candidates] of index.aliases) {\n if (!merged.aliases.has(alias)) merged.aliases.set(alias, candidates)\n }\n }\n return merged\n}\n\n/**\n * Flattens the index to the kind map that applies to one scope. The winner per key is the\n * organization's own definition, then a tenant-scoped one, then a global one \u2014 the order\n * `selectDefinitionForRecord` encodes and the whole codebase resolves definitions by.\n */\nexport function selectCustomFieldKindMap(\n index: CustomFieldKindIndex | null | undefined,\n organizationId: string | null | undefined,\n tenantId: string | null | undefined,\n): CustomFieldKindMap {\n const map: CustomFieldKindMap = {}\n if (!index) return map\n const orgId = organizationId ?? null\n const tenant = tenantId ?? null\n for (const [key, candidates] of index.keys) {\n map[key] = selectDefinitionForRecord(candidates, orgId, tenant)?.kind ?? null\n }\n for (const [alias, candidates] of index.aliases) {\n if (alias in map) continue\n map[alias] = selectDefinitionForRecord(candidates, orgId, tenant)?.kind ?? null\n }\n return map\n}\n\n/**\n * Memoizing wrapper for the common read shape: many rows, few distinct scopes. A list query\n * whose rows all share one organization resolves the map once; a global search spanning\n * organizations resolves one map per organization rather than one per row.\n */\nexport function createCustomFieldKindMapResolver(\n index: CustomFieldKindIndex | null | undefined,\n): CustomFieldKindMapResolver {\n const cache = new Map<string, CustomFieldKindMap>()\n return (organizationId, tenantId) => {\n const scopeKey = `${organizationId ?? ''}::${tenantId ?? ''}`\n const cached = cache.get(scopeKey)\n if (cached) return cached\n const map = selectCustomFieldKindMap(index, organizationId, tenantId)\n cache.set(scopeKey, map)\n return map\n }\n}\n\n/**\n * Resolves the `kind` for a `cf:`/`cf_`-prefixed index-document key. Returns `null` when the\n * key has no active definition \u2014 callers then keep the historical no-`kind` behavior rather\n * than guessing, so an unresolved lookup degrades instead of corrupting the value.\n */\nexport function resolveCustomFieldKind(\n kinds: CustomFieldKindMap | null | undefined,\n docKey: string,\n): string | null {\n if (!kinds) return null\n const bare = docKey.replace(CF_KEY_PREFIX, '')\n if (!bare) return null\n if (bare in kinds) return kinds[bare] ?? null\n const alias = sanitizeKey(bare)\n if (alias !== bare && alias in kinds) return kinds[alias] ?? null\n return null\n}\n"],
|
|
5
|
+
"mappings": "AAiBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AA8BP,MAAM,gBAAgB;AAOtB,SAAS,YAAY,KAAqB;AACxC,SAAO,IAAI,QAAQ,kBAAkB,GAAG;AAC1C;AAEA,SAAS,aAAa,OAAwB;AAC5C,MAAI,OAAO,UAAU,SAAU,QAAO,MAAM,KAAK;AACjD,MAAI,SAAS,KAAM,QAAO;AAC1B,SAAO,OAAO,KAAK,EAAE,KAAK;AAC5B;AAEA,SAAS,iBAAiB,OAA+B;AACvD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAK;AAC3B,SAAO,QAAQ,SAAS,UAAU;AACpC;AAEA,SAAS,mBAAmB,OAA+C;AACzE,MAAI,iBAAiB,KAAM,QAAO;AAClC,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,SAAU,QAAO;AACnE,SAAO;AACT;AAEA,SAAS,cACP,QACA,KACA,SACM;AACN,QAAM,WAAW,OAAO,IAAI,GAAG;AAC/B,MAAI,SAAU,UAAS,KAAK,OAAO;AAAA,MAC9B,QAAO,IAAI,KAAK,CAAC,OAAO,CAAC;AAChC;AAEO,SAAS,0BAA0B,MAA0D;AAClG,QAAM,OAAO,oBAAI,IAA4C;AAC7D,QAAM,UAAU,oBAAI,IAA4C;AAChE,aAAW,OAAO,MAAM;AACtB,UAAM,MAAM,aAAa,IAAI,GAAG;AAChC,QAAI,CAAC,IAA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AAI,CAAC,MAAO,QAAO;AACnB,QAAM,QAAQ,kBAAkB;AAChC,QAAM,SAAS,YAAY;AAC3B,aAAW,CAAC,KAAK,UAAU,KAAK,MAAM,MAAM;AAC1C,QAAI,GAAG,IAAI,0BAA0B,YAAY,OAAO,MAAM,GAAG,QAAQ;AAAA,EAC3E;AACA,aAAW,CAAC,OAAO,UAAU,KAAK,MAAM,SAAS;AAC/C,QAAI,SAAS,IAAK;AAClB,QAAI,KAAK,IAAI,0BAA0B,YAAY,OAAO,MAAM,GAAG,QAAQ;AAAA,EAC7E;AACA,SAAO;AACT;AAOO,SAAS,iCACd,OAC4B;AAC5B,QAAM,QAAQ,oBAAI,IAAgC;AAClD,SAAO,CAAC,gBAAgB,aAAa;AACnC,UAAM,WAAW,GAAG,kBAAkB,EAAE,KAAK,YAAY,EAAE;AAC3D,UAAM,SAAS,MAAM,IAAI,QAAQ;AACjC,QAAI,OAAQ,QAAO;AACnB,UAAM,MAAM,yBAAyB,OAAO,gBAAgB,QAAQ;AACpE,UAAM,IAAI,UAAU,GAAG;AACvB,WAAO;AAAA,EACT;AACF;AAOO,SAAS,uBACd,OACA,QACe;AACf,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,OAAO,OAAO,QAAQ,eAAe,EAAE;AAC7C,MAAI,CAAC,KAAM,QAAO;AAClB,MAAI,QAAQ,MAAO,QAAO,MAAM,IAAI,KAAK;AACzC,QAAM,QAAQ,YAAY,IAAI;AAC9B,MAAI,UAAU,QAAQ,SAAS,MAAO,QAAO,MAAM,KAAK,KAAK;AAC7D,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
import { decryptCustomFieldValue } from "./customFieldValues.js";
|
|
2
|
-
|
|
2
|
+
import { resolveCustomFieldKind } from "../custom-fields/kinds.js";
|
|
3
|
+
async function decryptValue(value, scope, service, cache, kind) {
|
|
3
4
|
if (Array.isArray(value)) {
|
|
4
|
-
return Promise.all(
|
|
5
|
+
return Promise.all(
|
|
6
|
+
value.map((entry) => decryptCustomFieldValue(entry, scope.tenantId, service, cache, { kind }))
|
|
7
|
+
);
|
|
5
8
|
}
|
|
6
|
-
return decryptCustomFieldValue(value, scope.tenantId, service, cache);
|
|
9
|
+
return decryptCustomFieldValue(value, scope.tenantId, service, cache, { kind });
|
|
7
10
|
}
|
|
8
|
-
async function decryptIndexDocCustomFields(doc, scope, service, cache) {
|
|
11
|
+
async function decryptIndexDocCustomFields(doc, scope, service, cache, kinds) {
|
|
9
12
|
const keys = Object.keys(doc).filter((key) => key.startsWith("cf:") || key.startsWith("cf_"));
|
|
10
13
|
if (!keys.length) return doc;
|
|
11
14
|
const working = { ...doc };
|
|
12
15
|
await Promise.all(
|
|
13
16
|
keys.map(async (key) => {
|
|
14
17
|
try {
|
|
15
|
-
working[key] = await decryptValue(working[key], scope, service, cache);
|
|
18
|
+
working[key] = await decryptValue(working[key], scope, service, cache, resolveCustomFieldKind(kinds, key));
|
|
16
19
|
} catch {
|
|
17
20
|
}
|
|
18
21
|
})
|
|
19
22
|
);
|
|
20
23
|
return working;
|
|
21
24
|
}
|
|
22
|
-
async function decryptIndexDocForSearch(entityId, doc, scope, service, cache) {
|
|
25
|
+
async function decryptIndexDocForSearch(entityId, doc, scope, service, cache, kinds) {
|
|
23
26
|
if (!service || typeof service.decryptEntityPayload !== "function") {
|
|
24
|
-
return decryptIndexDocCustomFields(doc, scope, service, cache);
|
|
27
|
+
return decryptIndexDocCustomFields(doc, scope, service, cache, kinds);
|
|
25
28
|
}
|
|
26
29
|
if (service.isEnabled?.() === false) {
|
|
27
|
-
return decryptIndexDocCustomFields(doc, scope, service, cache);
|
|
30
|
+
return decryptIndexDocCustomFields(doc, scope, service, cache, kinds);
|
|
28
31
|
}
|
|
29
32
|
let working = doc;
|
|
30
33
|
const decryptEntity = async (targetEntityId) => {
|
|
@@ -40,7 +43,7 @@ async function decryptIndexDocForSearch(entityId, doc, scope, service, cache) {
|
|
|
40
43
|
if (entityId === "customers:customer_person_profile" || entityId === "customers:customer_company_profile") {
|
|
41
44
|
await decryptEntity("customers:customer_entity");
|
|
42
45
|
}
|
|
43
|
-
return decryptIndexDocCustomFields(working, scope, service, cache);
|
|
46
|
+
return decryptIndexDocCustomFields(working, scope, service, cache, kinds);
|
|
44
47
|
}
|
|
45
48
|
async function encryptIndexDocForStorage(entityId, doc, scope, service) {
|
|
46
49
|
if (!service || typeof service.encryptEntityPayload !== "function") return doc;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/encryption/indexDoc.ts"],
|
|
4
|
-
"sourcesContent": ["import { decryptCustomFieldValue } from './customFieldValues'\nimport type { TenantDataEncryptionService } from './tenantDataEncryptionService'\n\nexport type IndexDocScope = {\n tenantId: string | null\n organizationId?: string | null\n}\n\nasync function decryptValue(\n value: unknown,\n scope: IndexDocScope,\n service: TenantDataEncryptionService | null,\n cache
|
|
5
|
-
"mappings": "AAAA,SAAS,+BAA+B;
|
|
4
|
+
"sourcesContent": ["import { decryptCustomFieldValue } from './customFieldValues'\nimport { resolveCustomFieldKind, type CustomFieldKindMap } from '../custom-fields/kinds'\nimport type { TenantDataEncryptionService } from './tenantDataEncryptionService'\n\nexport type IndexDocScope = {\n tenantId: string | null\n organizationId?: string | null\n}\n\nasync function decryptValue(\n value: unknown,\n scope: IndexDocScope,\n service: TenantDataEncryptionService | null,\n cache: Map<string | null, string | null> | undefined,\n kind: string | null,\n): Promise<unknown> {\n if (Array.isArray(value)) {\n return Promise.all(\n value.map((entry) => decryptCustomFieldValue(entry, scope.tenantId, service, cache, { kind })),\n )\n }\n return decryptCustomFieldValue(value, scope.tenantId, service, cache, { kind })\n}\n\nexport async function decryptIndexDocCustomFields(\n doc: Record<string, unknown>,\n scope: IndexDocScope,\n service: TenantDataEncryptionService | null,\n cache?: Map<string | null, string | null>,\n kinds?: CustomFieldKindMap | null,\n): Promise<Record<string, unknown>> {\n // HybridQueryEngine aliases cf keys as `cf_<key>` (sanitized), while index docs use `cf:<key>`.\n // Support both shapes to keep decryption consistent across query paths.\n const keys = Object.keys(doc).filter((key) => key.startsWith('cf:') || key.startsWith('cf_'))\n if (!keys.length) return doc\n\n const working: Record<string, unknown> = { ...doc }\n await Promise.all(\n keys.map(async (key) => {\n try {\n // Without the field's kind, `decryptCustomFieldValue` falls back to `JSON.parse` and\n // retypes string-typed values whose plaintext looks like JSON \u2014 `\"123\"` becomes 123\n // and `\"true\"` becomes true (issue #5968). An unresolved kind keeps the legacy path.\n working[key] = await decryptValue(working[key], scope, service, cache, resolveCustomFieldKind(kinds, key))\n } catch {\n // ignore; keep original value\n }\n }),\n )\n return working\n}\n\nexport async function decryptIndexDocForSearch(\n entityId: string,\n doc: Record<string, unknown>,\n scope: IndexDocScope,\n service: TenantDataEncryptionService | null,\n cache?: Map<string | null, string | null>,\n kinds?: CustomFieldKindMap | null,\n): Promise<Record<string, unknown>> {\n if (!service || typeof service.decryptEntityPayload !== 'function') {\n return decryptIndexDocCustomFields(doc, scope, service, cache, kinds)\n }\n if (service.isEnabled?.() === false) {\n return decryptIndexDocCustomFields(doc, scope, service, cache, kinds)\n }\n\n let working: Record<string, unknown> = doc\n const decryptEntity = async (targetEntityId: string) => {\n const decrypted = await service.decryptEntityPayload(\n targetEntityId,\n working,\n scope.tenantId ?? null,\n scope.organizationId ?? null,\n )\n working = { ...working, ...decrypted }\n }\n\n await decryptEntity(entityId)\n if (entityId === 'customers:customer_person_profile' || entityId === 'customers:customer_company_profile') {\n await decryptEntity('customers:customer_entity')\n }\n\n return decryptIndexDocCustomFields(working, scope, service, cache, kinds)\n}\n\nexport async function encryptIndexDocForStorage(\n entityId: string,\n doc: Record<string, unknown>,\n scope: IndexDocScope,\n service: TenantDataEncryptionService | null,\n): Promise<Record<string, unknown>> {\n if (!service || typeof service.encryptEntityPayload !== 'function') return doc\n if (service.isEnabled?.() === false) return doc\n\n let working: Record<string, unknown> = doc\n const encryptEntity = async (targetEntityId: string) => {\n const encrypted = await service.encryptEntityPayload(\n targetEntityId,\n working,\n scope.tenantId ?? null,\n scope.organizationId ?? null,\n )\n working = { ...working, ...encrypted }\n }\n\n await encryptEntity(entityId)\n if (entityId === 'customers:customer_person_profile' || entityId === 'customers:customer_company_profile') {\n await encryptEntity('customers:customer_entity')\n }\n\n return working\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,+BAA+B;AACxC,SAAS,8BAAuD;AAQhE,eAAe,aACb,OACA,OACA,SACA,OACA,MACkB;AAClB,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,QAAQ;AAAA,MACb,MAAM,IAAI,CAAC,UAAU,wBAAwB,OAAO,MAAM,UAAU,SAAS,OAAO,EAAE,KAAK,CAAC,CAAC;AAAA,IAC/F;AAAA,EACF;AACA,SAAO,wBAAwB,OAAO,MAAM,UAAU,SAAS,OAAO,EAAE,KAAK,CAAC;AAChF;AAEA,eAAsB,4BACpB,KACA,OACA,SACA,OACA,OACkC;AAGlC,QAAM,OAAO,OAAO,KAAK,GAAG,EAAE,OAAO,CAAC,QAAQ,IAAI,WAAW,KAAK,KAAK,IAAI,WAAW,KAAK,CAAC;AAC5F,MAAI,CAAC,KAAK,OAAQ,QAAO;AAEzB,QAAM,UAAmC,EAAE,GAAG,IAAI;AAClD,QAAM,QAAQ;AAAA,IACZ,KAAK,IAAI,OAAO,QAAQ;AACtB,UAAI;AAIF,gBAAQ,GAAG,IAAI,MAAM,aAAa,QAAQ,GAAG,GAAG,OAAO,SAAS,OAAO,uBAAuB,OAAO,GAAG,CAAC;AAAA,MAC3G,QAAQ;AAAA,MAER;AAAA,IACF,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAEA,eAAsB,yBACpB,UACA,KACA,OACA,SACA,OACA,OACkC;AAClC,MAAI,CAAC,WAAW,OAAO,QAAQ,yBAAyB,YAAY;AAClE,WAAO,4BAA4B,KAAK,OAAO,SAAS,OAAO,KAAK;AAAA,EACtE;AACA,MAAI,QAAQ,YAAY,MAAM,OAAO;AACnC,WAAO,4BAA4B,KAAK,OAAO,SAAS,OAAO,KAAK;AAAA,EACtE;AAEA,MAAI,UAAmC;AACvC,QAAM,gBAAgB,OAAO,mBAA2B;AACtD,UAAM,YAAY,MAAM,QAAQ;AAAA,MAC9B;AAAA,MACA;AAAA,MACA,MAAM,YAAY;AAAA,MAClB,MAAM,kBAAkB;AAAA,IAC1B;AACA,cAAU,EAAE,GAAG,SAAS,GAAG,UAAU;AAAA,EACvC;AAEA,QAAM,cAAc,QAAQ;AAC5B,MAAI,aAAa,uCAAuC,aAAa,sCAAsC;AACzG,UAAM,cAAc,2BAA2B;AAAA,EACjD;AAEA,SAAO,4BAA4B,SAAS,OAAO,SAAS,OAAO,KAAK;AAC1E;AAEA,eAAsB,0BACpB,UACA,KACA,OACA,SACkC;AAClC,MAAI,CAAC,WAAW,OAAO,QAAQ,yBAAyB,WAAY,QAAO;AAC3E,MAAI,QAAQ,YAAY,MAAM,MAAO,QAAO;AAE5C,MAAI,UAAmC;AACvC,QAAM,gBAAgB,OAAO,mBAA2B;AACtD,UAAM,YAAY,MAAM,QAAQ;AAAA,MAC9B;AAAA,MACA;AAAA,MACA,MAAM,YAAY;AAAA,MAClB,MAAM,kBAAkB;AAAA,IAC1B;AACA,cAAU,EAAE,GAAG,SAAS,GAAG,UAAU;AAAA,EACvC;AAEA,QAAM,cAAc,QAAQ;AAC5B,MAAI,aAAa,uCAAuC,aAAa,sCAAsC;AACzG,UAAM,cAAc,2BAA2B;AAAA,EACjD;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
const REGISTRY_COUNTRIES = [
|
|
2
|
+
{ code: "AC", name: "Ascension Island" },
|
|
3
|
+
{ code: "AD", name: "Andorra" },
|
|
4
|
+
{ code: "AE", name: "United Arab Emirates" },
|
|
5
|
+
{ code: "AF", name: "Afghanistan" },
|
|
6
|
+
{ code: "AG", name: "Antigua and Barbuda" },
|
|
7
|
+
{ code: "AI", name: "Anguilla" },
|
|
8
|
+
{ code: "AL", name: "Albania" },
|
|
9
|
+
{ code: "AM", name: "Armenia" },
|
|
10
|
+
{ code: "AO", name: "Angola" },
|
|
11
|
+
{ code: "AQ", name: "Antarctica" },
|
|
12
|
+
{ code: "AR", name: "Argentina" },
|
|
13
|
+
{ code: "AS", name: "American Samoa" },
|
|
14
|
+
{ code: "AT", name: "Austria" },
|
|
15
|
+
{ code: "AU", name: "Australia" },
|
|
16
|
+
{ code: "AW", name: "Aruba" },
|
|
17
|
+
{ code: "AX", name: "\xC5land Islands" },
|
|
18
|
+
{ code: "AZ", name: "Azerbaijan" },
|
|
19
|
+
{ code: "BA", name: "Bosnia and Herzegovina" },
|
|
20
|
+
{ code: "BB", name: "Barbados" },
|
|
21
|
+
{ code: "BD", name: "Bangladesh" },
|
|
22
|
+
{ code: "BE", name: "Belgium" },
|
|
23
|
+
{ code: "BF", name: "Burkina Faso" },
|
|
24
|
+
{ code: "BG", name: "Bulgaria" },
|
|
25
|
+
{ code: "BH", name: "Bahrain" },
|
|
26
|
+
{ code: "BI", name: "Burundi" },
|
|
27
|
+
{ code: "BJ", name: "Benin" },
|
|
28
|
+
{ code: "BL", name: "Saint Barth\xE9lemy" },
|
|
29
|
+
{ code: "BM", name: "Bermuda" },
|
|
30
|
+
{ code: "BN", name: "Brunei Darussalam" },
|
|
31
|
+
{ code: "BO", name: "Bolivia" },
|
|
32
|
+
{ code: "BQ", name: "Bonaire, Sint Eustatius and Saba" },
|
|
33
|
+
{ code: "BR", name: "Brazil" },
|
|
34
|
+
{ code: "BS", name: "Bahamas" },
|
|
35
|
+
{ code: "BT", name: "Bhutan" },
|
|
36
|
+
{ code: "BV", name: "Bouvet Island" },
|
|
37
|
+
{ code: "BW", name: "Botswana" },
|
|
38
|
+
{ code: "BY", name: "Belarus" },
|
|
39
|
+
{ code: "BZ", name: "Belize" },
|
|
40
|
+
{ code: "CA", name: "Canada" },
|
|
41
|
+
{ code: "CC", name: "Cocos (Keeling) Islands" },
|
|
42
|
+
{ code: "CD", name: "The Democratic Republic of the Congo" },
|
|
43
|
+
{ code: "CF", name: "Central African Republic" },
|
|
44
|
+
{ code: "CG", name: "Congo" },
|
|
45
|
+
{ code: "CH", name: "Switzerland" },
|
|
46
|
+
{ code: "CI", name: "C\xF4te d'Ivoire" },
|
|
47
|
+
{ code: "CK", name: "Cook Islands" },
|
|
48
|
+
{ code: "CL", name: "Chile" },
|
|
49
|
+
{ code: "CM", name: "Cameroon" },
|
|
50
|
+
{ code: "CN", name: "China" },
|
|
51
|
+
{ code: "CO", name: "Colombia" },
|
|
52
|
+
{ code: "CP", name: "Clipperton Island" },
|
|
53
|
+
{ code: "CQ", name: "Sark" },
|
|
54
|
+
{ code: "CR", name: "Costa Rica" },
|
|
55
|
+
{ code: "CU", name: "Cuba" },
|
|
56
|
+
{ code: "CV", name: "Cabo Verde, Cape Verde" },
|
|
57
|
+
{ code: "CW", name: "Cura\xE7ao" },
|
|
58
|
+
{ code: "CX", name: "Christmas Island" },
|
|
59
|
+
{ code: "CY", name: "Cyprus" },
|
|
60
|
+
{ code: "CZ", name: "Czechia, Czech Republic" },
|
|
61
|
+
{ code: "DE", name: "Germany" },
|
|
62
|
+
{ code: "DG", name: "Diego Garcia" },
|
|
63
|
+
{ code: "DJ", name: "Djibouti" },
|
|
64
|
+
{ code: "DK", name: "Denmark" },
|
|
65
|
+
{ code: "DM", name: "Dominica" },
|
|
66
|
+
{ code: "DO", name: "Dominican Republic" },
|
|
67
|
+
{ code: "DZ", name: "Algeria" },
|
|
68
|
+
{ code: "EA", name: "Ceuta, Melilla" },
|
|
69
|
+
{ code: "EC", name: "Ecuador" },
|
|
70
|
+
{ code: "EE", name: "Estonia" },
|
|
71
|
+
{ code: "EG", name: "Egypt" },
|
|
72
|
+
{ code: "EH", name: "Western Sahara" },
|
|
73
|
+
{ code: "ER", name: "Eritrea" },
|
|
74
|
+
{ code: "ES", name: "Spain" },
|
|
75
|
+
{ code: "ET", name: "Ethiopia" },
|
|
76
|
+
{ code: "EU", name: "European Union" },
|
|
77
|
+
{ code: "EZ", name: "Eurozone" },
|
|
78
|
+
{ code: "FI", name: "Finland" },
|
|
79
|
+
{ code: "FJ", name: "Fiji" },
|
|
80
|
+
{ code: "FK", name: "Falkland Islands (Malvinas)" },
|
|
81
|
+
{ code: "FM", name: "Federated States of Micronesia" },
|
|
82
|
+
{ code: "FO", name: "Faroe Islands" },
|
|
83
|
+
{ code: "FR", name: "France" },
|
|
84
|
+
{ code: "GA", name: "Gabon" },
|
|
85
|
+
{ code: "GB", name: "United Kingdom" },
|
|
86
|
+
{ code: "GD", name: "Grenada" },
|
|
87
|
+
{ code: "GE", name: "Georgia" },
|
|
88
|
+
{ code: "GF", name: "French Guiana" },
|
|
89
|
+
{ code: "GG", name: "Guernsey" },
|
|
90
|
+
{ code: "GH", name: "Ghana" },
|
|
91
|
+
{ code: "GI", name: "Gibraltar" },
|
|
92
|
+
{ code: "GL", name: "Greenland" },
|
|
93
|
+
{ code: "GM", name: "Gambia" },
|
|
94
|
+
{ code: "GN", name: "Guinea" },
|
|
95
|
+
{ code: "GP", name: "Guadeloupe" },
|
|
96
|
+
{ code: "GQ", name: "Equatorial Guinea" },
|
|
97
|
+
{ code: "GR", name: "Greece" },
|
|
98
|
+
{ code: "GS", name: "South Georgia and the South Sandwich Islands" },
|
|
99
|
+
{ code: "GT", name: "Guatemala" },
|
|
100
|
+
{ code: "GU", name: "Guam" },
|
|
101
|
+
{ code: "GW", name: "Guinea-Bissau" },
|
|
102
|
+
{ code: "GY", name: "Guyana" },
|
|
103
|
+
{ code: "HK", name: "Hong Kong" },
|
|
104
|
+
{ code: "HM", name: "Heard Island and McDonald Islands" },
|
|
105
|
+
{ code: "HN", name: "Honduras" },
|
|
106
|
+
{ code: "HR", name: "Croatia" },
|
|
107
|
+
{ code: "HT", name: "Haiti" },
|
|
108
|
+
{ code: "HU", name: "Hungary" },
|
|
109
|
+
{ code: "IC", name: "Canary Islands" },
|
|
110
|
+
{ code: "ID", name: "Indonesia" },
|
|
111
|
+
{ code: "IE", name: "Ireland" },
|
|
112
|
+
{ code: "IL", name: "Israel" },
|
|
113
|
+
{ code: "IM", name: "Isle of Man" },
|
|
114
|
+
{ code: "IN", name: "India" },
|
|
115
|
+
{ code: "IO", name: "British Indian Ocean Territory" },
|
|
116
|
+
{ code: "IQ", name: "Iraq" },
|
|
117
|
+
{ code: "IR", name: "Islamic Republic of Iran" },
|
|
118
|
+
{ code: "IS", name: "Iceland" },
|
|
119
|
+
{ code: "IT", name: "Italy" },
|
|
120
|
+
{ code: "JE", name: "Jersey" },
|
|
121
|
+
{ code: "JM", name: "Jamaica" },
|
|
122
|
+
{ code: "JO", name: "Jordan" },
|
|
123
|
+
{ code: "JP", name: "Japan" },
|
|
124
|
+
{ code: "KE", name: "Kenya" },
|
|
125
|
+
{ code: "KG", name: "Kyrgyzstan" },
|
|
126
|
+
{ code: "KH", name: "Cambodia" },
|
|
127
|
+
{ code: "KI", name: "Kiribati" },
|
|
128
|
+
{ code: "KM", name: "Comoros" },
|
|
129
|
+
{ code: "KN", name: "Saint Kitts and Nevis" },
|
|
130
|
+
{ code: "KP", name: "Democratic People's Republic of Korea" },
|
|
131
|
+
{ code: "KR", name: "Republic of Korea" },
|
|
132
|
+
{ code: "KW", name: "Kuwait" },
|
|
133
|
+
{ code: "KY", name: "Cayman Islands" },
|
|
134
|
+
{ code: "KZ", name: "Kazakhstan" },
|
|
135
|
+
{ code: "LA", name: "Lao People's Democratic Republic" },
|
|
136
|
+
{ code: "LB", name: "Lebanon" },
|
|
137
|
+
{ code: "LC", name: "Saint Lucia" },
|
|
138
|
+
{ code: "LI", name: "Liechtenstein" },
|
|
139
|
+
{ code: "LK", name: "Sri Lanka" },
|
|
140
|
+
{ code: "LR", name: "Liberia" },
|
|
141
|
+
{ code: "LS", name: "Lesotho" },
|
|
142
|
+
{ code: "LT", name: "Lithuania" },
|
|
143
|
+
{ code: "LU", name: "Luxembourg" },
|
|
144
|
+
{ code: "LV", name: "Latvia" },
|
|
145
|
+
{ code: "LY", name: "Libya" },
|
|
146
|
+
{ code: "MA", name: "Morocco" },
|
|
147
|
+
{ code: "MC", name: "Monaco" },
|
|
148
|
+
{ code: "MD", name: "Moldova" },
|
|
149
|
+
{ code: "ME", name: "Montenegro" },
|
|
150
|
+
{ code: "MF", name: "Saint Martin (French part)" },
|
|
151
|
+
{ code: "MG", name: "Madagascar" },
|
|
152
|
+
{ code: "MH", name: "Marshall Islands" },
|
|
153
|
+
{ code: "MK", name: "North Macedonia" },
|
|
154
|
+
{ code: "ML", name: "Mali" },
|
|
155
|
+
{ code: "MM", name: "Myanmar" },
|
|
156
|
+
{ code: "MN", name: "Mongolia" },
|
|
157
|
+
{ code: "MO", name: "Macao" },
|
|
158
|
+
{ code: "MP", name: "Northern Mariana Islands" },
|
|
159
|
+
{ code: "MQ", name: "Martinique" },
|
|
160
|
+
{ code: "MR", name: "Mauritania" },
|
|
161
|
+
{ code: "MS", name: "Montserrat" },
|
|
162
|
+
{ code: "MT", name: "Malta" },
|
|
163
|
+
{ code: "MU", name: "Mauritius" },
|
|
164
|
+
{ code: "MV", name: "Maldives" },
|
|
165
|
+
{ code: "MW", name: "Malawi" },
|
|
166
|
+
{ code: "MX", name: "Mexico" },
|
|
167
|
+
{ code: "MY", name: "Malaysia" },
|
|
168
|
+
{ code: "MZ", name: "Mozambique" },
|
|
169
|
+
{ code: "NA", name: "Namibia" },
|
|
170
|
+
{ code: "NC", name: "New Caledonia" },
|
|
171
|
+
{ code: "NE", name: "Niger" },
|
|
172
|
+
{ code: "NF", name: "Norfolk Island" },
|
|
173
|
+
{ code: "NG", name: "Nigeria" },
|
|
174
|
+
{ code: "NI", name: "Nicaragua" },
|
|
175
|
+
{ code: "NL", name: "Netherlands" },
|
|
176
|
+
{ code: "NO", name: "Norway" },
|
|
177
|
+
{ code: "NP", name: "Nepal" },
|
|
178
|
+
{ code: "NR", name: "Nauru" },
|
|
179
|
+
{ code: "NU", name: "Niue" },
|
|
180
|
+
{ code: "NZ", name: "New Zealand" },
|
|
181
|
+
{ code: "OM", name: "Oman" },
|
|
182
|
+
{ code: "PA", name: "Panama" },
|
|
183
|
+
{ code: "PE", name: "Peru" },
|
|
184
|
+
{ code: "PF", name: "French Polynesia" },
|
|
185
|
+
{ code: "PG", name: "Papua New Guinea" },
|
|
186
|
+
{ code: "PH", name: "Philippines" },
|
|
187
|
+
{ code: "PK", name: "Pakistan" },
|
|
188
|
+
{ code: "PL", name: "Poland" },
|
|
189
|
+
{ code: "PM", name: "Saint Pierre and Miquelon" },
|
|
190
|
+
{ code: "PN", name: "Pitcairn" },
|
|
191
|
+
{ code: "PR", name: "Puerto Rico" },
|
|
192
|
+
{ code: "PS", name: "State of Palestine" },
|
|
193
|
+
{ code: "PT", name: "Portugal" },
|
|
194
|
+
{ code: "PW", name: "Palau" },
|
|
195
|
+
{ code: "PY", name: "Paraguay" },
|
|
196
|
+
{ code: "QA", name: "Qatar" },
|
|
197
|
+
{ code: "RE", name: "R\xE9union" },
|
|
198
|
+
{ code: "RO", name: "Romania" },
|
|
199
|
+
{ code: "RS", name: "Serbia" },
|
|
200
|
+
{ code: "RU", name: "Russian Federation" },
|
|
201
|
+
{ code: "RW", name: "Rwanda" },
|
|
202
|
+
{ code: "SA", name: "Saudi Arabia" },
|
|
203
|
+
{ code: "SB", name: "Solomon Islands" },
|
|
204
|
+
{ code: "SC", name: "Seychelles" },
|
|
205
|
+
{ code: "SD", name: "Sudan" },
|
|
206
|
+
{ code: "SE", name: "Sweden" },
|
|
207
|
+
{ code: "SG", name: "Singapore" },
|
|
208
|
+
{ code: "SH", name: "Saint Helena, Ascension and Tristan da Cunha" },
|
|
209
|
+
{ code: "SI", name: "Slovenia" },
|
|
210
|
+
{ code: "SJ", name: "Svalbard and Jan Mayen" },
|
|
211
|
+
{ code: "SK", name: "Slovakia" },
|
|
212
|
+
{ code: "SL", name: "Sierra Leone" },
|
|
213
|
+
{ code: "SM", name: "San Marino" },
|
|
214
|
+
{ code: "SN", name: "Senegal" },
|
|
215
|
+
{ code: "SO", name: "Somalia" },
|
|
216
|
+
{ code: "SR", name: "Suriname" },
|
|
217
|
+
{ code: "SS", name: "South Sudan" },
|
|
218
|
+
{ code: "ST", name: "Sao Tome and Principe" },
|
|
219
|
+
{ code: "SV", name: "El Salvador" },
|
|
220
|
+
{ code: "SX", name: "Sint Maarten (Dutch part)" },
|
|
221
|
+
{ code: "SY", name: "Syrian Arab Republic" },
|
|
222
|
+
{ code: "SZ", name: "Eswatini, eSwatini, Swaziland" },
|
|
223
|
+
{ code: "TA", name: "Tristan da Cunha" },
|
|
224
|
+
{ code: "TC", name: "Turks and Caicos Islands" },
|
|
225
|
+
{ code: "TD", name: "Chad" },
|
|
226
|
+
{ code: "TF", name: "French Southern Territories" },
|
|
227
|
+
{ code: "TG", name: "Togo" },
|
|
228
|
+
{ code: "TH", name: "Thailand" },
|
|
229
|
+
{ code: "TJ", name: "Tajikistan" },
|
|
230
|
+
{ code: "TK", name: "Tokelau" },
|
|
231
|
+
{ code: "TL", name: "Timor-Leste" },
|
|
232
|
+
{ code: "TM", name: "Turkmenistan" },
|
|
233
|
+
{ code: "TN", name: "Tunisia" },
|
|
234
|
+
{ code: "TO", name: "Tonga" },
|
|
235
|
+
{ code: "TR", name: "T\xFCrkiye, Turkey" },
|
|
236
|
+
{ code: "TT", name: "Trinidad and Tobago" },
|
|
237
|
+
{ code: "TV", name: "Tuvalu" },
|
|
238
|
+
{ code: "TW", name: "Taiwan, Province of China" },
|
|
239
|
+
{ code: "TZ", name: "United Republic of Tanzania" },
|
|
240
|
+
{ code: "UA", name: "Ukraine" },
|
|
241
|
+
{ code: "UG", name: "Uganda" },
|
|
242
|
+
{ code: "UM", name: "United States Minor Outlying Islands" },
|
|
243
|
+
{ code: "UN", name: "United Nations" },
|
|
244
|
+
{ code: "US", name: "United States" },
|
|
245
|
+
{ code: "UY", name: "Uruguay" },
|
|
246
|
+
{ code: "UZ", name: "Uzbekistan" },
|
|
247
|
+
{ code: "VA", name: "Holy See (Vatican City State)" },
|
|
248
|
+
{ code: "VC", name: "Saint Vincent and the Grenadines" },
|
|
249
|
+
{ code: "VE", name: "Venezuela" },
|
|
250
|
+
{ code: "VG", name: "British Virgin Islands" },
|
|
251
|
+
{ code: "VI", name: "U.S. Virgin Islands" },
|
|
252
|
+
{ code: "VN", name: "Viet Nam" },
|
|
253
|
+
{ code: "VU", name: "Vanuatu" },
|
|
254
|
+
{ code: "WF", name: "Wallis and Futuna" },
|
|
255
|
+
{ code: "WS", name: "Samoa" },
|
|
256
|
+
{ code: "YE", name: "Yemen" },
|
|
257
|
+
{ code: "YT", name: "Mayotte" },
|
|
258
|
+
{ code: "ZA", name: "South Africa" },
|
|
259
|
+
{ code: "ZM", name: "Zambia" },
|
|
260
|
+
{ code: "ZW", name: "Zimbabwe" }
|
|
261
|
+
];
|
|
262
|
+
export {
|
|
263
|
+
REGISTRY_COUNTRIES
|
|
264
|
+
};
|
|
265
|
+
//# sourceMappingURL=countries.generated.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/location/countries.generated.ts"],
|
|
4
|
+
"sourcesContent": ["// AUTO-GENERATED by scripts/generate-countries.mjs \u2014 do not edit by hand.\n// Regenerate via `node packages/shared/scripts/generate-countries.mjs` or the shared package build.\n\nexport const REGISTRY_COUNTRIES: Array<{ code: string; name: string }> = [\n { code: \"AC\", name: \"Ascension Island\" },\n { code: \"AD\", name: \"Andorra\" },\n { code: \"AE\", name: \"United Arab Emirates\" },\n { code: \"AF\", name: \"Afghanistan\" },\n { code: \"AG\", name: \"Antigua and Barbuda\" },\n { code: \"AI\", name: \"Anguilla\" },\n { code: \"AL\", name: \"Albania\" },\n { code: \"AM\", name: \"Armenia\" },\n { code: \"AO\", name: \"Angola\" },\n { code: \"AQ\", name: \"Antarctica\" },\n { code: \"AR\", name: \"Argentina\" },\n { code: \"AS\", name: \"American Samoa\" },\n { code: \"AT\", name: \"Austria\" },\n { code: \"AU\", name: \"Australia\" },\n { code: \"AW\", name: \"Aruba\" },\n { code: \"AX\", name: \"\u00C5land Islands\" },\n { code: \"AZ\", name: \"Azerbaijan\" },\n { code: \"BA\", name: \"Bosnia and Herzegovina\" },\n { code: \"BB\", name: \"Barbados\" },\n { code: \"BD\", name: \"Bangladesh\" },\n { code: \"BE\", name: \"Belgium\" },\n { code: \"BF\", name: \"Burkina Faso\" },\n { code: \"BG\", name: \"Bulgaria\" },\n { code: \"BH\", name: \"Bahrain\" },\n { code: \"BI\", name: \"Burundi\" },\n { code: \"BJ\", name: \"Benin\" },\n { code: \"BL\", name: \"Saint Barth\u00E9lemy\" },\n { code: \"BM\", name: \"Bermuda\" },\n { code: \"BN\", name: \"Brunei Darussalam\" },\n { code: \"BO\", name: \"Bolivia\" },\n { code: \"BQ\", name: \"Bonaire, Sint Eustatius and Saba\" },\n { code: \"BR\", name: \"Brazil\" },\n { code: \"BS\", name: \"Bahamas\" },\n { code: \"BT\", name: \"Bhutan\" },\n { code: \"BV\", name: \"Bouvet Island\" },\n { code: \"BW\", name: \"Botswana\" },\n { code: \"BY\", name: \"Belarus\" },\n { code: \"BZ\", name: \"Belize\" },\n { code: \"CA\", name: \"Canada\" },\n { code: \"CC\", name: \"Cocos (Keeling) Islands\" },\n { code: \"CD\", name: \"The Democratic Republic of the Congo\" },\n { code: \"CF\", name: \"Central African Republic\" },\n { code: \"CG\", name: \"Congo\" },\n { code: \"CH\", name: \"Switzerland\" },\n { code: \"CI\", name: \"C\u00F4te d'Ivoire\" },\n { code: \"CK\", name: \"Cook Islands\" },\n { code: \"CL\", name: \"Chile\" },\n { code: \"CM\", name: \"Cameroon\" },\n { code: \"CN\", name: \"China\" },\n { code: \"CO\", name: \"Colombia\" },\n { code: \"CP\", name: \"Clipperton Island\" },\n { code: \"CQ\", name: \"Sark\" },\n { code: \"CR\", name: \"Costa Rica\" },\n { code: \"CU\", name: \"Cuba\" },\n { code: \"CV\", name: \"Cabo Verde, Cape Verde\" },\n { code: \"CW\", name: \"Cura\u00E7ao\" },\n { code: \"CX\", name: \"Christmas Island\" },\n { code: \"CY\", name: \"Cyprus\" },\n { code: \"CZ\", name: \"Czechia, Czech Republic\" },\n { code: \"DE\", name: \"Germany\" },\n { code: \"DG\", name: \"Diego Garcia\" },\n { code: \"DJ\", name: \"Djibouti\" },\n { code: \"DK\", name: \"Denmark\" },\n { code: \"DM\", name: \"Dominica\" },\n { code: \"DO\", name: \"Dominican Republic\" },\n { code: \"DZ\", name: \"Algeria\" },\n { code: \"EA\", name: \"Ceuta, Melilla\" },\n { code: \"EC\", name: \"Ecuador\" },\n { code: \"EE\", name: \"Estonia\" },\n { code: \"EG\", name: \"Egypt\" },\n { code: \"EH\", name: \"Western Sahara\" },\n { code: \"ER\", name: \"Eritrea\" },\n { code: \"ES\", name: \"Spain\" },\n { code: \"ET\", name: \"Ethiopia\" },\n { code: \"EU\", name: \"European Union\" },\n { code: \"EZ\", name: \"Eurozone\" },\n { code: \"FI\", name: \"Finland\" },\n { code: \"FJ\", name: \"Fiji\" },\n { code: \"FK\", name: \"Falkland Islands (Malvinas)\" },\n { code: \"FM\", name: \"Federated States of Micronesia\" },\n { code: \"FO\", name: \"Faroe Islands\" },\n { code: \"FR\", name: \"France\" },\n { code: \"GA\", name: \"Gabon\" },\n { code: \"GB\", name: \"United Kingdom\" },\n { code: \"GD\", name: \"Grenada\" },\n { code: \"GE\", name: \"Georgia\" },\n { code: \"GF\", name: \"French Guiana\" },\n { code: \"GG\", name: \"Guernsey\" },\n { code: \"GH\", name: \"Ghana\" },\n { code: \"GI\", name: \"Gibraltar\" },\n { code: \"GL\", name: \"Greenland\" },\n { code: \"GM\", name: \"Gambia\" },\n { code: \"GN\", name: \"Guinea\" },\n { code: \"GP\", name: \"Guadeloupe\" },\n { code: \"GQ\", name: \"Equatorial Guinea\" },\n { code: \"GR\", name: \"Greece\" },\n { code: \"GS\", name: \"South Georgia and the South Sandwich Islands\" },\n { code: \"GT\", name: \"Guatemala\" },\n { code: \"GU\", name: \"Guam\" },\n { code: \"GW\", name: \"Guinea-Bissau\" },\n { code: \"GY\", name: \"Guyana\" },\n { code: \"HK\", name: \"Hong Kong\" },\n { code: \"HM\", name: \"Heard Island and McDonald Islands\" },\n { code: \"HN\", name: \"Honduras\" },\n { code: \"HR\", name: \"Croatia\" },\n { code: \"HT\", name: \"Haiti\" },\n { code: \"HU\", name: \"Hungary\" },\n { code: \"IC\", name: \"Canary Islands\" },\n { code: \"ID\", name: \"Indonesia\" },\n { code: \"IE\", name: \"Ireland\" },\n { code: \"IL\", name: \"Israel\" },\n { code: \"IM\", name: \"Isle of Man\" },\n { code: \"IN\", name: \"India\" },\n { code: \"IO\", name: \"British Indian Ocean Territory\" },\n { code: \"IQ\", name: \"Iraq\" },\n { code: \"IR\", name: \"Islamic Republic of Iran\" },\n { code: \"IS\", name: \"Iceland\" },\n { code: \"IT\", name: \"Italy\" },\n { code: \"JE\", name: \"Jersey\" },\n { code: \"JM\", name: \"Jamaica\" },\n { code: \"JO\", name: \"Jordan\" },\n { code: \"JP\", name: \"Japan\" },\n { code: \"KE\", name: \"Kenya\" },\n { code: \"KG\", name: \"Kyrgyzstan\" },\n { code: \"KH\", name: \"Cambodia\" },\n { code: \"KI\", name: \"Kiribati\" },\n { code: \"KM\", name: \"Comoros\" },\n { code: \"KN\", name: \"Saint Kitts and Nevis\" },\n { code: \"KP\", name: \"Democratic People's Republic of Korea\" },\n { code: \"KR\", name: \"Republic of Korea\" },\n { code: \"KW\", name: \"Kuwait\" },\n { code: \"KY\", name: \"Cayman Islands\" },\n { code: \"KZ\", name: \"Kazakhstan\" },\n { code: \"LA\", name: \"Lao People's Democratic Republic\" },\n { code: \"LB\", name: \"Lebanon\" },\n { code: \"LC\", name: \"Saint Lucia\" },\n { code: \"LI\", name: \"Liechtenstein\" },\n { code: \"LK\", name: \"Sri Lanka\" },\n { code: \"LR\", name: \"Liberia\" },\n { code: \"LS\", name: \"Lesotho\" },\n { code: \"LT\", name: \"Lithuania\" },\n { code: \"LU\", name: \"Luxembourg\" },\n { code: \"LV\", name: \"Latvia\" },\n { code: \"LY\", name: \"Libya\" },\n { code: \"MA\", name: \"Morocco\" },\n { code: \"MC\", name: \"Monaco\" },\n { code: \"MD\", name: \"Moldova\" },\n { code: \"ME\", name: \"Montenegro\" },\n { code: \"MF\", name: \"Saint Martin (French part)\" },\n { code: \"MG\", name: \"Madagascar\" },\n { code: \"MH\", name: \"Marshall Islands\" },\n { code: \"MK\", name: \"North Macedonia\" },\n { code: \"ML\", name: \"Mali\" },\n { code: \"MM\", name: \"Myanmar\" },\n { code: \"MN\", name: \"Mongolia\" },\n { code: \"MO\", name: \"Macao\" },\n { code: \"MP\", name: \"Northern Mariana Islands\" },\n { code: \"MQ\", name: \"Martinique\" },\n { code: \"MR\", name: \"Mauritania\" },\n { code: \"MS\", name: \"Montserrat\" },\n { code: \"MT\", name: \"Malta\" },\n { code: \"MU\", name: \"Mauritius\" },\n { code: \"MV\", name: \"Maldives\" },\n { code: \"MW\", name: \"Malawi\" },\n { code: \"MX\", name: \"Mexico\" },\n { code: \"MY\", name: \"Malaysia\" },\n { code: \"MZ\", name: \"Mozambique\" },\n { code: \"NA\", name: \"Namibia\" },\n { code: \"NC\", name: \"New Caledonia\" },\n { code: \"NE\", name: \"Niger\" },\n { code: \"NF\", name: \"Norfolk Island\" },\n { code: \"NG\", name: \"Nigeria\" },\n { code: \"NI\", name: \"Nicaragua\" },\n { code: \"NL\", name: \"Netherlands\" },\n { code: \"NO\", name: \"Norway\" },\n { code: \"NP\", name: \"Nepal\" },\n { code: \"NR\", name: \"Nauru\" },\n { code: \"NU\", name: \"Niue\" },\n { code: \"NZ\", name: \"New Zealand\" },\n { code: \"OM\", name: \"Oman\" },\n { code: \"PA\", name: \"Panama\" },\n { code: \"PE\", name: \"Peru\" },\n { code: \"PF\", name: \"French Polynesia\" },\n { code: \"PG\", name: \"Papua New Guinea\" },\n { code: \"PH\", name: \"Philippines\" },\n { code: \"PK\", name: \"Pakistan\" },\n { code: \"PL\", name: \"Poland\" },\n { code: \"PM\", name: \"Saint Pierre and Miquelon\" },\n { code: \"PN\", name: \"Pitcairn\" },\n { code: \"PR\", name: \"Puerto Rico\" },\n { code: \"PS\", name: \"State of Palestine\" },\n { code: \"PT\", name: \"Portugal\" },\n { code: \"PW\", name: \"Palau\" },\n { code: \"PY\", name: \"Paraguay\" },\n { code: \"QA\", name: \"Qatar\" },\n { code: \"RE\", name: \"R\u00E9union\" },\n { code: \"RO\", name: \"Romania\" },\n { code: \"RS\", name: \"Serbia\" },\n { code: \"RU\", name: \"Russian Federation\" },\n { code: \"RW\", name: \"Rwanda\" },\n { code: \"SA\", name: \"Saudi Arabia\" },\n { code: \"SB\", name: \"Solomon Islands\" },\n { code: \"SC\", name: \"Seychelles\" },\n { code: \"SD\", name: \"Sudan\" },\n { code: \"SE\", name: \"Sweden\" },\n { code: \"SG\", name: \"Singapore\" },\n { code: \"SH\", name: \"Saint Helena, Ascension and Tristan da Cunha\" },\n { code: \"SI\", name: \"Slovenia\" },\n { code: \"SJ\", name: \"Svalbard and Jan Mayen\" },\n { code: \"SK\", name: \"Slovakia\" },\n { code: \"SL\", name: \"Sierra Leone\" },\n { code: \"SM\", name: \"San Marino\" },\n { code: \"SN\", name: \"Senegal\" },\n { code: \"SO\", name: \"Somalia\" },\n { code: \"SR\", name: \"Suriname\" },\n { code: \"SS\", name: \"South Sudan\" },\n { code: \"ST\", name: \"Sao Tome and Principe\" },\n { code: \"SV\", name: \"El Salvador\" },\n { code: \"SX\", name: \"Sint Maarten (Dutch part)\" },\n { code: \"SY\", name: \"Syrian Arab Republic\" },\n { code: \"SZ\", name: \"Eswatini, eSwatini, Swaziland\" },\n { code: \"TA\", name: \"Tristan da Cunha\" },\n { code: \"TC\", name: \"Turks and Caicos Islands\" },\n { code: \"TD\", name: \"Chad\" },\n { code: \"TF\", name: \"French Southern Territories\" },\n { code: \"TG\", name: \"Togo\" },\n { code: \"TH\", name: \"Thailand\" },\n { code: \"TJ\", name: \"Tajikistan\" },\n { code: \"TK\", name: \"Tokelau\" },\n { code: \"TL\", name: \"Timor-Leste\" },\n { code: \"TM\", name: \"Turkmenistan\" },\n { code: \"TN\", name: \"Tunisia\" },\n { code: \"TO\", name: \"Tonga\" },\n { code: \"TR\", name: \"T\u00FCrkiye, Turkey\" },\n { code: \"TT\", name: \"Trinidad and Tobago\" },\n { code: \"TV\", name: \"Tuvalu\" },\n { code: \"TW\", name: \"Taiwan, Province of China\" },\n { code: \"TZ\", name: \"United Republic of Tanzania\" },\n { code: \"UA\", name: \"Ukraine\" },\n { code: \"UG\", name: \"Uganda\" },\n { code: \"UM\", name: \"United States Minor Outlying Islands\" },\n { code: \"UN\", name: \"United Nations\" },\n { code: \"US\", name: \"United States\" },\n { code: \"UY\", name: \"Uruguay\" },\n { code: \"UZ\", name: \"Uzbekistan\" },\n { code: \"VA\", name: \"Holy See (Vatican City State)\" },\n { code: \"VC\", name: \"Saint Vincent and the Grenadines\" },\n { code: \"VE\", name: \"Venezuela\" },\n { code: \"VG\", name: \"British Virgin Islands\" },\n { code: \"VI\", name: \"U.S. Virgin Islands\" },\n { code: \"VN\", name: \"Viet Nam\" },\n { code: \"VU\", name: \"Vanuatu\" },\n { code: \"WF\", name: \"Wallis and Futuna\" },\n { code: \"WS\", name: \"Samoa\" },\n { code: \"YE\", name: \"Yemen\" },\n { code: \"YT\", name: \"Mayotte\" },\n { code: \"ZA\", name: \"South Africa\" },\n { code: \"ZM\", name: \"Zambia\" },\n { code: \"ZW\", name: \"Zimbabwe\" },\n]\n"],
|
|
5
|
+
"mappings": "AAGO,MAAM,qBAA4D;AAAA,EACvE,EAAE,MAAM,MAAM,MAAM,mBAAmB;AAAA,EACvC,EAAE,MAAM,MAAM,MAAM,UAAU;AAAA,EAC9B,EAAE,MAAM,MA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,MAAM,eAAe;AAAA,EACnC,EAAE,MAAM,MAAM,MAAM,SAAS;AAAA,EAC7B,EAAE,MAAM,MAAM,MAAM,WAAW;AACjC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
if (entry.Type !== "region") return false;
|
|
4
|
-
if (!entry.Subtag || !/^[A-Z]{2}$/.test(entry.Subtag)) return false;
|
|
5
|
-
if (entry.Deprecated) return false;
|
|
6
|
-
if (!entry.Description || !entry.Description.length) return false;
|
|
7
|
-
if (entry.Description[0] === "Private use") return false;
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
const RAW_COUNTRIES = registry.filter(isIsoAlpha2).map((entry) => ({
|
|
11
|
-
code: entry.Subtag,
|
|
12
|
-
name: entry.Description.join(", ")
|
|
13
|
-
}));
|
|
1
|
+
import { REGISTRY_COUNTRIES } from "./countries.generated.js";
|
|
2
|
+
const RAW_COUNTRIES = REGISTRY_COUNTRIES;
|
|
14
3
|
const SUPPLEMENTAL_COUNTRIES = [
|
|
15
4
|
{ code: "XK", name: "Kosovo" }
|
|
16
5
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/location/countries.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { REGISTRY_COUNTRIES } from './countries.generated'\n\nexport type IsoCountry = {\n code: string\n name: string\n}\n\nconst RAW_COUNTRIES: IsoCountry[] = REGISTRY_COUNTRIES\n\n// Codes in common use that the language-subtag registry does not list as region subtags.\n// XK is user-assigned rather than ISO 3166-1 assigned, so it never appears in the registry.\nconst SUPPLEMENTAL_COUNTRIES: IsoCountry[] = [\n { code: 'XK', name: 'Kosovo' },\n]\n\nconst RAW_COUNTRY_CODES = new Set(RAW_COUNTRIES.map((entry) => entry.code))\n\nexport const ISO_COUNTRIES: IsoCountry[] = [\n ...RAW_COUNTRIES,\n ...SUPPLEMENTAL_COUNTRIES.filter((entry) => !RAW_COUNTRY_CODES.has(entry.code)),\n].sort((a, b) => a.name.localeCompare(b.name, 'en', { sensitivity: 'base' }))\n\nexport const COUNTRY_PRIORITY: string[] = ['PL', 'DE', 'ES', 'FR', 'IT', 'US', 'GB', 'CA']\n\nconst displayNameCache = new Map<string, Intl.DisplayNames>()\n\nfunction getDisplayNames(locale: string): Intl.DisplayNames | null {\n if (typeof Intl === 'undefined' || typeof Intl.DisplayNames === 'undefined') return null\n const key = locale || 'en'\n let instance = displayNameCache.get(key)\n if (!instance) {\n try {\n instance = new Intl.DisplayNames([key], { type: 'region' })\n displayNameCache.set(key, instance)\n } catch {\n return null\n }\n }\n return instance\n}\n\nexport function resolveCountryName(code: string, options: { locale?: string } = {}): string {\n const normalized = code.toUpperCase()\n const fallback = ISO_COUNTRIES.find((entry) => entry.code === normalized)?.name ?? normalized\n const displayNames = getDisplayNames(options.locale ?? 'en')\n if (!displayNames) return fallback\n try {\n const label = displayNames.of(normalized as any)\n // Intl echoes the raw code back when its ICU data cannot resolve the region.\n if (typeof label !== 'string' || label === normalized) return fallback\n return label\n } catch {\n return fallback\n }\n}\n\nexport function buildCountryOptions(options: {\n locale?: string\n priority?: string[]\n transformLabel?: (code: string, defaultLabel: string) => string\n} = {}): Array<{ code: string; label: string }> {\n const { locale, transformLabel } = options\n const priority = (options.priority ?? COUNTRY_PRIORITY).map((code) => code.toUpperCase())\n const prioritySet = new Set(priority)\n const labelFor = (code: string) => {\n const base = resolveCountryName(code, { locale })\n return transformLabel ? transformLabel(code, base) : base\n }\n\n const byCode = new Map(ISO_COUNTRIES.map((entry) => [entry.code, entry]))\n\n const prioritized = priority\n .map((code) => {\n const base = byCode.get(code)\n if (!base) return null\n return { code, label: labelFor(code) }\n })\n .filter((entry): entry is { code: string; label: string } => !!entry)\n .sort((a, b) => a.label.localeCompare(b.label, locale ?? 'en', { sensitivity: 'base' }))\n\n const remaining = ISO_COUNTRIES\n .filter((entry) => !prioritySet.has(entry.code))\n .map((entry) => ({ code: entry.code, label: labelFor(entry.code) }))\n .sort((a, b) => a.label.localeCompare(b.label, locale ?? 'en', { sensitivity: 'base' }))\n\n return [...prioritized, ...remaining]\n}\n\nexport function matchCountryCodes(\n term: string,\n options: { locales?: string[] } = {},\n): string[] {\n const needle = term.trim().toLowerCase()\n if (!needle) return []\n const searchLocales = options.locales?.length ? options.locales : ['en']\n return ISO_COUNTRIES\n .filter((entry) => {\n if (entry.name.toLowerCase().includes(needle)) return true\n return searchLocales.some((locale) =>\n resolveCountryName(entry.code, { locale }).toLowerCase().includes(needle),\n )\n })\n .map((entry) => entry.code)\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,0BAA0B;AAOnC,MAAM,gBAA8B;AAIpC,MAAM,yBAAuC;AAAA,EAC3C,EAAE,MAAM,MAAM,MAAM,SAAS;AAC/B;AAEA,MAAM,oBAAoB,IAAI,IAAI,cAAc,IAAI,CAAC,UAAU,MAAM,IAAI,CAAC;AAEnE,MAAM,gBAA8B;AAAA,EACzC,GAAG;AAAA,EACH,GAAG,uBAAuB,OAAO,CAAC,UAAU,CAAC,kBAAkB,IAAI,MAAM,IAAI,CAAC;AAChF,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,MAAM,EAAE,aAAa,OAAO,CAAC,CAAC;AAErE,MAAM,mBAA6B,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,IAAI;AAEzF,MAAM,mBAAmB,oBAAI,IAA+B;AAE5D,SAAS,gBAAgB,QAA0C;AACjE,MAAI,OAAO,SAAS,eAAe,OAAO,KAAK,iBAAiB,YAAa,QAAO;AACpF,QAAM,MAAM,UAAU;AACtB,MAAI,WAAW,iBAAiB,IAAI,GAAG;AACvC,MAAI,CAAC,UAAU;AACb,QAAI;AACF,iBAAW,IAAI,KAAK,aAAa,CA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AAM,EAAE,aAAa,OAAO,CAAC,CAAC;AAEzF,QAAM,YAAY,cACf,OAAO,CAAC,UAAU,CAAC,YAAY,IAAI,MAAM,IAAI,CAAC,EAC9C,IAAI,CAAC,WAAW,EAAE,MAAM,MAAM,MAAM,OAAO,SAAS,MAAM,IAAI,EAAE,EAAE,EAClE,KAAK,CAAC,GAAG,MAAM,EAAE,MAAM,cAAc,EAAE,OAAO,UAAU,MAAM,EAAE,aAAa,OAAO,CAAC,CAAC;AAEzF,SAAO,CAAC,GAAG,aAAa,GAAG,SAAS;AACtC;AAEO,SAAS,kBACd,MACA,UAAkC,CAAC,GACzB;AACV,QAAM,SAAS,KAAK,KAAK,EAAE,YAAY;AACvC,MAAI,CAAC,OAAQ,QAAO,CAAC;AACrB,QAAM,gBAAgB,QAAQ,SAAS,SAAS,QAAQ,UAAU,CAAC,IAAI;AACvE,SAAO,cACJ,OAAO,CAAC,UAAU;AACjB,QAAI,MAAM,KAAK,YAAY,EAAE,SAAS,MAAM,EAAG,QAAO;AACtD,WAAO,cAAc;AAAA,MAAK,CAAC,WACzB,mBAAmB,MAAM,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,SAAS,MAAM;AAAA,IAC1E;AAAA,EACF,CAAC,EACA,IAAI,CAAC,UAAU,MAAM,IAAI;AAC9B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function navigateWithPageReload(path) {
|
|
2
|
+
window.location.assign(path);
|
|
3
|
+
}
|
|
4
|
+
function replaceWithPageReload(path) {
|
|
5
|
+
window.location.replace(path);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
navigateWithPageReload,
|
|
9
|
+
replaceWithPageReload
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=pageReload.js.map
|