@simplysf/simply-settings-core 0.2.0 → 0.3.0
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/README.md +19 -16
- package/lib/address/isoCodes/debian.d.ts +10 -0
- package/lib/address/isoCodes/debian.js +77 -0
- package/lib/address/isoCodes/debian.js.map +1 -0
- package/lib/address/isoCodes/http.d.ts +12 -0
- package/lib/address/isoCodes/http.js +92 -0
- package/lib/address/isoCodes/http.js.map +1 -0
- package/lib/address/isoCodes/index.d.ts +46 -0
- package/lib/address/isoCodes/index.js +72 -0
- package/lib/address/isoCodes/index.js.map +1 -0
- package/lib/address/isoCodes/types.d.ts +54 -0
- package/lib/address/isoCodes/types.js +17 -0
- package/lib/address/isoCodes/types.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,22 +21,25 @@ Requires Node.js `>=22` and either `"type": "module"` or a dynamic `import()`. T
|
|
|
21
21
|
|
|
22
22
|
Everything below is exported from the package root. Removing or renaming an export is a breaking change; see [`src/index.ts`](src/index.ts).
|
|
23
23
|
|
|
24
|
-
| Export | Description
|
|
25
|
-
| --------------------------------------------------------------------------- |
|
|
26
|
-
| `parseStateDefinitions(json)` | Validates a `{ "US-CA": "California" }` object into `StateDefinition[]`, naming the first bad entry.
|
|
27
|
-
| `filterStateDefinitions(definitions, countries?)` | Narrows definitions to ISO country codes. Fails on a malformed code or a country with no definitions.
|
|
28
|
-
| `formatStateKey(definition)` | `US-CA` for a definition.
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
24
|
+
| Export | Description |
|
|
25
|
+
| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| `parseStateDefinitions(json)` | Validates a `{ "US-CA": "California" }` object into `StateDefinition[]`, naming the first bad entry. |
|
|
27
|
+
| `filterStateDefinitions(definitions, countries?)` | Narrows definitions to ISO country codes. Fails on a malformed code or a country with no definitions. |
|
|
28
|
+
| `formatStateKey(definition)` | `US-CA` for a definition. |
|
|
29
|
+
| `fetchIsoCodesStateDefinitions(options)` | Downloads ISO 3166-2 data from a source at run time and returns it as definitions, with the version and URL used. `debian` ([Debian `iso-codes`](https://salsa.debian.org/iso-codes-team/iso-codes)) is the only source today. Top level only unless `allLevels`. |
|
|
30
|
+
| `subdivisionsToStateDefinitions(subdivisions, options?)` | The shared conversion behind it: the nested-subdivision filter, then `parseStateDefinitions`. |
|
|
31
|
+
| `ISO_CODES_SOURCES`, `ISO_CODES_SOURCE_IDS` | The supported sources (`IsoCodesSource` adapters), and their ids. |
|
|
32
|
+
| `retrieveAddressSettingsXml(options)` / `deployAddressSettingsXml(options)` | Metadata API retrieve/deploy of the org's `Address` settings, as `Address.settings-meta.xml` text. A failed deploy is reported in the result, not thrown. |
|
|
33
|
+
| `parseAddressSettingsXml(xml)` | The countries and states in a settings file, with ISO codes kept as strings (Andorra's `02` stays `02`). |
|
|
34
|
+
| `planStateCreation(definitions, settings)` | Splits definitions into `pending` (to submit) and `settled` (`exists`, `country-missing`) without any Setup traffic. |
|
|
35
|
+
| `openSetupSession(options)` / `SetupSession` | A cookie-carrying session on the org's Setup pages, opened through a single-use frontdoor URL (the mechanism `sf org open` uses). |
|
|
36
|
+
| `createState(session, definition, options?)` | Submits one state through _Configure New State_ and classifies the result. Retries transport failures, and reports per-state problems as `failed` instead of throwing. |
|
|
37
|
+
| `createStates(options)` | Runs `createState` over many states, `concurrency` at a time (default `DEFAULT_CREATE_CONCURRENCY`, 4). |
|
|
38
|
+
| `parseNewStateForm(html)` / `fillNewStateForm(form, definition)` | Finds the form by its fields' stable id suffixes, not Visualforce's generated ids, and builds the submission. |
|
|
39
|
+
| `classifyNewStateResponse(response)` | Maps a form POST response to `created`, `exists`, `rejected`, `country-missing`, or `failed`. |
|
|
40
|
+
| `planStateActivation(xml, definitions)` | Sets `<active>`/`<visible>` on exactly the listed states. Every other state and country is untouched. |
|
|
41
|
+
| `activateStates(options)` | Retrieve, `planStateActivation`, then deploy. Supports `dryRun`. |
|
|
42
|
+
| `isLoginPage(response)`, `NEW_STATE_FORM_PATH`, `SetupTransportError` | Supporting helpers and constants. |
|
|
40
43
|
|
|
41
44
|
```ts
|
|
42
45
|
import {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IsoCodesSource } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The raw `iso_3166-2.json` for a tag or branch.
|
|
4
|
+
*
|
|
5
|
+
* @param version - A tag (`v4.20.1`) or branch (`main`).
|
|
6
|
+
* @returns The URL.
|
|
7
|
+
*/
|
|
8
|
+
export declare function debianIsoCodesDataUrl(version: string): string;
|
|
9
|
+
/** Debian's `iso-codes` repository on salsa.debian.org: release tags, or any branch. */
|
|
10
|
+
export declare const debianIsoCodesSource: IsoCodesSource;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { SfError } from '@salesforce/core';
|
|
17
|
+
import { getJson } from './http.js';
|
|
18
|
+
// Debian's iso-codes is LGPL-2.1+. It's downloaded at run time and used in memory, never
|
|
19
|
+
// redistributed in this package — see docs/design/0043-settings-address-states-iso-codes.md.
|
|
20
|
+
const LABEL = 'Debian iso-codes';
|
|
21
|
+
const HOMEPAGE = 'https://salsa.debian.org/iso-codes-team/iso-codes';
|
|
22
|
+
const TAGS_URL = 'https://salsa.debian.org/api/v4/projects/iso-codes-team%2Fiso-codes/repository/tags?order_by=version&sort=desc&per_page=20';
|
|
23
|
+
const RELEASE_TAG_PATTERN = /^v\d+(\.\d+)*$/;
|
|
24
|
+
/**
|
|
25
|
+
* The raw `iso_3166-2.json` for a tag or branch.
|
|
26
|
+
*
|
|
27
|
+
* @param version - A tag (`v4.20.1`) or branch (`main`).
|
|
28
|
+
* @returns The URL.
|
|
29
|
+
*/
|
|
30
|
+
export function debianIsoCodesDataUrl(version) {
|
|
31
|
+
const ref = version.split('/').map(encodeURIComponent).join('/');
|
|
32
|
+
return `${HOMEPAGE}/-/raw/${ref}/data/iso_3166-2.json`;
|
|
33
|
+
}
|
|
34
|
+
function isSubdivision(value) {
|
|
35
|
+
if (value === null || typeof value !== 'object')
|
|
36
|
+
return false;
|
|
37
|
+
const { code, name, parent } = value;
|
|
38
|
+
return typeof code === 'string' && typeof name === 'string' && (parent === undefined || typeof parent === 'string');
|
|
39
|
+
}
|
|
40
|
+
/** Debian's `iso-codes` repository on salsa.debian.org: release tags, or any branch. */
|
|
41
|
+
export const debianIsoCodesSource = {
|
|
42
|
+
id: 'debian',
|
|
43
|
+
label: LABEL,
|
|
44
|
+
homepage: HOMEPAGE,
|
|
45
|
+
async resolveLatestVersion(options) {
|
|
46
|
+
// Tags, not `main`: tags are what distributions ship, while `main` can hold in-progress edits.
|
|
47
|
+
const tags = await getJson(TAGS_URL, LABEL, options);
|
|
48
|
+
const latest = Array.isArray(tags)
|
|
49
|
+
? tags
|
|
50
|
+
.map((tag) => tag?.name)
|
|
51
|
+
.find((name) => typeof name === 'string' && RELEASE_TAG_PATTERN.test(name))
|
|
52
|
+
: undefined;
|
|
53
|
+
if (!latest) {
|
|
54
|
+
throw new SfError(`Couldn't find a release of ${LABEL} at ${TAGS_URL}.`, 'IsoCodesDownloadError', [
|
|
55
|
+
`Specify a version explicitly, e.g. a tag from ${HOMEPAGE}/-/tags.`,
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
return latest;
|
|
59
|
+
},
|
|
60
|
+
async fetchSubdivisions(version, options) {
|
|
61
|
+
const url = debianIsoCodesDataUrl(version);
|
|
62
|
+
const data = await getJson(url, LABEL, options);
|
|
63
|
+
if (data === undefined) {
|
|
64
|
+
throw new SfError(`${LABEL} has no version "${version}".`, 'IsoCodesVersionNotFoundError', [
|
|
65
|
+
`See ${HOMEPAGE}/-/tags for the available versions.`,
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
const entries = data?.['3166-2'];
|
|
69
|
+
if (!Array.isArray(entries) || !entries.every(isSubdivision)) {
|
|
70
|
+
throw new SfError(`${url} isn't in the expected shape: { "3166-2": [{ code, name, parent? }] }.`, 'InvalidIsoCodesDataError');
|
|
71
|
+
}
|
|
72
|
+
// `type` (e.g. "Metropolitan department") is dropped: nothing selects on it yet.
|
|
73
|
+
const subdivisions = entries.map(({ code, name, parent }) => (parent ? { code, name, parent } : { code, name }));
|
|
74
|
+
return { url, subdivisions };
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=debian.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debian.js","sourceRoot":"","sources":["../../../src/address/isoCodes/debian.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,yFAAyF;AACzF,6FAA6F;AAE7F,MAAM,KAAK,GAAG,kBAA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EAAE,CAAC;IAC/B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IsoCodesFetchOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* GETs a JSON document, retrying transport failures.
|
|
4
|
+
*
|
|
5
|
+
* @param url - What to fetch.
|
|
6
|
+
* @param label - The source's label, for the error message.
|
|
7
|
+
* @param options - Timeout, retry, and dispatcher settings.
|
|
8
|
+
* @returns The parsed body for a 200, or `undefined` for a 404 — the caller knows what a missing
|
|
9
|
+
* document means.
|
|
10
|
+
* @throws SfError (`IsoCodesDownloadError`) for anything else, once retries are spent.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getJson(url: string, label: string, options: IsoCodesFetchOptions): Promise<unknown>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { SfError } from '@salesforce/core';
|
|
17
|
+
import { Duration } from '@salesforce/kit';
|
|
18
|
+
import { retryWithBackoff } from '@simplysf/simply-core';
|
|
19
|
+
import { fetch } from 'undici';
|
|
20
|
+
/** A 5xx: worth retrying, unlike a response we can act on. */
|
|
21
|
+
class ServerError extends Error {
|
|
22
|
+
status;
|
|
23
|
+
constructor(status) {
|
|
24
|
+
super(`HTTP ${status}`);
|
|
25
|
+
this.status = status;
|
|
26
|
+
this.name = 'ServerError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function isTransportError(error) {
|
|
30
|
+
if (error instanceof ServerError)
|
|
31
|
+
return true;
|
|
32
|
+
if (!(error instanceof Error))
|
|
33
|
+
return false;
|
|
34
|
+
// undici's `fetch` rejects with `TypeError: fetch failed` for socket-level failures, and
|
|
35
|
+
// `AbortSignal.timeout` with a `TimeoutError` DOMException.
|
|
36
|
+
return (error instanceof TypeError && error.message === 'fetch failed') || error.name === 'TimeoutError';
|
|
37
|
+
}
|
|
38
|
+
function describeFailure(error) {
|
|
39
|
+
if (error instanceof Error && error.name === 'TimeoutError')
|
|
40
|
+
return 'the request timed out';
|
|
41
|
+
if (error instanceof TypeError && error.cause instanceof Error)
|
|
42
|
+
return error.cause.message;
|
|
43
|
+
return error instanceof Error ? error.message : String(error);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* GETs a JSON document, retrying transport failures.
|
|
47
|
+
*
|
|
48
|
+
* @param url - What to fetch.
|
|
49
|
+
* @param label - The source's label, for the error message.
|
|
50
|
+
* @param options - Timeout, retry, and dispatcher settings.
|
|
51
|
+
* @returns The parsed body for a 200, or `undefined` for a 404 — the caller knows what a missing
|
|
52
|
+
* document means.
|
|
53
|
+
* @throws SfError (`IsoCodesDownloadError`) for anything else, once retries are spent.
|
|
54
|
+
*/
|
|
55
|
+
export async function getJson(url, label, options) {
|
|
56
|
+
const downloadError = (reason) => new SfError(`Couldn't download ISO 3166-2 data from ${label} (${url}): ${reason}.`, 'IsoCodesDownloadError', [
|
|
57
|
+
'Check your network connection and proxy settings (HTTPS_PROXY), or provide the state definitions as a file instead.',
|
|
58
|
+
]);
|
|
59
|
+
let response;
|
|
60
|
+
try {
|
|
61
|
+
response = await retryWithBackoff(async () => {
|
|
62
|
+
const res = await fetch(url, {
|
|
63
|
+
headers: { Accept: 'application/json' },
|
|
64
|
+
signal: AbortSignal.timeout(options.requestTimeoutMs ?? 30_000),
|
|
65
|
+
dispatcher: options.dispatcher,
|
|
66
|
+
});
|
|
67
|
+
const body = await res.text();
|
|
68
|
+
if (res.status >= 500)
|
|
69
|
+
throw new ServerError(res.status);
|
|
70
|
+
return { status: res.status, body };
|
|
71
|
+
}, {
|
|
72
|
+
retryAttempts: options.retryAttempts ?? 2,
|
|
73
|
+
backoffFactor: 2,
|
|
74
|
+
initialDelay: options.initialRetryDelay ?? Duration.seconds(2),
|
|
75
|
+
shouldRetry: isTransportError,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
throw downloadError(describeFailure(error));
|
|
80
|
+
}
|
|
81
|
+
if (response.status === 404)
|
|
82
|
+
return undefined;
|
|
83
|
+
if (response.status !== 200)
|
|
84
|
+
throw downloadError(`HTTP ${response.status}`);
|
|
85
|
+
try {
|
|
86
|
+
return JSON.parse(response.body);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
throw downloadError('the response is not valid JSON');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/address/isoCodes/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAG/B,8DAA8D;AAC9D,MAAM,WAAY,SAAQ,KAAK;IACM;IAAnC,YAAmC,MAAc;QAC/C,KAAK,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC;QADS,WAAM,GAAN,MAAM,CAAQ;QAE/C,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED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AAC;gBAC/D,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG;gBAAE,MAAM,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACzD,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QACtC,CAAC,EACD;YACE,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,CAAC;YACzC,aAAa,EAAE,CAAC;YAChB,YAAY,EAAE,OAAO,CAAC,iBAAiB,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YAC9D,WAAW,EAAE,gBAAgB;SAC9B,CACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,SAAS,CAAC;IAC9C,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG;QAAE,MAAM,aAAa,CAAC,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAE5E,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAY,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,aAAa,CAAC,gCAAgC,CAAC,CAAC;IACxD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type StateDefinition } from '../stateDefinitions.js';
|
|
2
|
+
import type { IsoCodesFetchOptions, IsoCodesSource, IsoCodesSourceId, IsoCodesSubdivision } from './types.js';
|
|
3
|
+
/** Every supported source, by id. Adding a source is an entry here plus its adapter. */
|
|
4
|
+
export declare const ISO_CODES_SOURCES: Readonly<Record<IsoCodesSourceId, IsoCodesSource>>;
|
|
5
|
+
/** The ids of {@link ISO_CODES_SOURCES}, e.g. for a CLI flag's allowed values. */
|
|
6
|
+
export declare const ISO_CODES_SOURCE_IDS: IsoCodesSourceId[];
|
|
7
|
+
/**
|
|
8
|
+
* Turns a source's subdivisions into state definitions.
|
|
9
|
+
*
|
|
10
|
+
* @param subdivisions - From a source.
|
|
11
|
+
* @param options - `allLevels` keeps subdivisions nested under another one (French departments
|
|
12
|
+
* under their regions); by default only the top level is kept.
|
|
13
|
+
* @returns The definitions, in the source's order.
|
|
14
|
+
* @throws SfError (`InvalidStateDefinitionsError`) for an entry `parseStateDefinitions` rejects.
|
|
15
|
+
*/
|
|
16
|
+
export declare function subdivisionsToStateDefinitions(subdivisions: IsoCodesSubdivision[], options?: {
|
|
17
|
+
allLevels?: boolean;
|
|
18
|
+
}): StateDefinition[];
|
|
19
|
+
export type FetchIsoCodesStateDefinitionsOptions = IsoCodesFetchOptions & {
|
|
20
|
+
source: IsoCodesSourceId;
|
|
21
|
+
/** In the source's own terms; for `debian`, a tag or branch. Defaults to the source's latest release. */
|
|
22
|
+
version?: string;
|
|
23
|
+
/** See {@link subdivisionsToStateDefinitions}. */
|
|
24
|
+
allLevels?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type IsoCodesStateDefinitions = {
|
|
27
|
+
source: IsoCodesSourceId;
|
|
28
|
+
/** The source's label, e.g. `Debian iso-codes`. */
|
|
29
|
+
label: string;
|
|
30
|
+
/** The version used: as given, or the resolved latest release. */
|
|
31
|
+
version: string;
|
|
32
|
+
/** Where the data was downloaded from. */
|
|
33
|
+
url: string;
|
|
34
|
+
allLevels: boolean;
|
|
35
|
+
definitions: StateDefinition[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Downloads ISO 3166-2 data from a source and converts it to state definitions. Nothing is
|
|
39
|
+
* cached or written to disk.
|
|
40
|
+
*
|
|
41
|
+
* @param options - The source, an optional version, `allLevels`, and HTTP settings.
|
|
42
|
+
* @returns The definitions, with the source, version, and URL they came from.
|
|
43
|
+
* @throws SfError (`UnsupportedIsoCodesSourceError`) for an unknown source; otherwise whatever the
|
|
44
|
+
* source's adapter throws, or (`InvalidIsoCodesDataError`) when its data fails validation.
|
|
45
|
+
*/
|
|
46
|
+
export declare function fetchIsoCodesStateDefinitions(options: FetchIsoCodesStateDefinitionsOptions): Promise<IsoCodesStateDefinitions>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { SfError } from '@salesforce/core';
|
|
17
|
+
import { EnvHttpProxyAgent } from 'undici';
|
|
18
|
+
import { parseStateDefinitions } from '../stateDefinitions.js';
|
|
19
|
+
import { debianIsoCodesSource } from './debian.js';
|
|
20
|
+
/** Every supported source, by id. Adding a source is an entry here plus its adapter. */
|
|
21
|
+
export const ISO_CODES_SOURCES = {
|
|
22
|
+
debian: debianIsoCodesSource,
|
|
23
|
+
};
|
|
24
|
+
/** The ids of {@link ISO_CODES_SOURCES}, e.g. for a CLI flag's allowed values. */
|
|
25
|
+
export const ISO_CODES_SOURCE_IDS = Object.keys(ISO_CODES_SOURCES);
|
|
26
|
+
/**
|
|
27
|
+
* Turns a source's subdivisions into state definitions.
|
|
28
|
+
*
|
|
29
|
+
* @param subdivisions - From a source.
|
|
30
|
+
* @param options - `allLevels` keeps subdivisions nested under another one (French departments
|
|
31
|
+
* under their regions); by default only the top level is kept.
|
|
32
|
+
* @returns The definitions, in the source's order.
|
|
33
|
+
* @throws SfError (`InvalidStateDefinitionsError`) for an entry `parseStateDefinitions` rejects.
|
|
34
|
+
*/
|
|
35
|
+
export function subdivisionsToStateDefinitions(subdivisions, options = {}) {
|
|
36
|
+
const kept = options.allLevels ? subdivisions : subdivisions.filter((subdivision) => !subdivision.parent);
|
|
37
|
+
return parseStateDefinitions(Object.fromEntries(kept.map((subdivision) => [subdivision.code, subdivision.name])));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Downloads ISO 3166-2 data from a source and converts it to state definitions. Nothing is
|
|
41
|
+
* cached or written to disk.
|
|
42
|
+
*
|
|
43
|
+
* @param options - The source, an optional version, `allLevels`, and HTTP settings.
|
|
44
|
+
* @returns The definitions, with the source, version, and URL they came from.
|
|
45
|
+
* @throws SfError (`UnsupportedIsoCodesSourceError`) for an unknown source; otherwise whatever the
|
|
46
|
+
* source's adapter throws, or (`InvalidIsoCodesDataError`) when its data fails validation.
|
|
47
|
+
*/
|
|
48
|
+
export async function fetchIsoCodesStateDefinitions(options) {
|
|
49
|
+
const source = Object.hasOwn(ISO_CODES_SOURCES, options.source) ? ISO_CODES_SOURCES[options.source] : undefined;
|
|
50
|
+
if (!source) {
|
|
51
|
+
throw new SfError(`Unsupported ISO 3166-2 source "${String(options.source)}". Supported: ${ISO_CODES_SOURCE_IDS.join(', ')}.`, 'UnsupportedIsoCodesSourceError');
|
|
52
|
+
}
|
|
53
|
+
const ownDispatcher = options.dispatcher ? undefined : new EnvHttpProxyAgent();
|
|
54
|
+
const fetchOptions = { ...options, dispatcher: options.dispatcher ?? ownDispatcher };
|
|
55
|
+
const allLevels = options.allLevels ?? false;
|
|
56
|
+
try {
|
|
57
|
+
const version = options.version ?? (await source.resolveLatestVersion(fetchOptions));
|
|
58
|
+
const { url, subdivisions } = await source.fetchSubdivisions(version, fetchOptions);
|
|
59
|
+
let definitions;
|
|
60
|
+
try {
|
|
61
|
+
definitions = subdivisionsToStateDefinitions(subdivisions, { allLevels });
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
throw new SfError(`${url}: ${error instanceof Error ? error.message : String(error)}`, 'InvalidIsoCodesDataError');
|
|
65
|
+
}
|
|
66
|
+
return { source: source.id, label: source.label, version, url, allLevels, definitions };
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
await ownDispatcher?.close();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/address/isoCodes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAwB,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,wFAAwF;AACxF,MAAM,CAAC,MAAM,iBAAiB,GAAuD;IACnF,MAAM,EAAE,oBAAoB;CAC7B,CAAC;AAEF,kFAAkF;AAClF,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAuB,CAAC;AAEzF;;;;;;;;GAQG;AACH,MAAM,UAAU,8BAA8B,CAC5C,YAAmC,EACnC,UAAmC,EAAE;IAErC,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1G,OAAO,qBAAqB,CAAC,MAAM,CAAC,WAAW,CA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C5E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,OAAO,CACf,GAAG,GAAG,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACnE,0BAA0B,CAC3B,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;IAC1F,CAAC;YAAS,CAAC;QACT,MAAM,aAAa,EAAE,KAAK,EAAE,CAAC;IAC/B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Duration } from '@salesforce/kit';
|
|
2
|
+
import type { Dispatcher } from 'undici';
|
|
3
|
+
/** The ISO 3166-2 sources state definitions can be fetched from. */
|
|
4
|
+
export type IsoCodesSourceId = 'debian';
|
|
5
|
+
/** One ISO 3166-2 subdivision, as a source reports it. */
|
|
6
|
+
export type IsoCodesSubdivision = {
|
|
7
|
+
/** The full ISO 3166-2 code, e.g. `FR-ARA`. */
|
|
8
|
+
code: string;
|
|
9
|
+
name: string;
|
|
10
|
+
/** The full code of the subdivision this one is nested under, e.g. `FR-ARA` for `FR-01`. */
|
|
11
|
+
parent?: string;
|
|
12
|
+
};
|
|
13
|
+
export type IsoCodesFetchOptions = {
|
|
14
|
+
/** Bounds each HTTP request. Defaults to 30 seconds. */
|
|
15
|
+
requestTimeoutMs?: number;
|
|
16
|
+
/** Retries after a transport failure (timeout, reset, 5xx). Defaults to 2. */
|
|
17
|
+
retryAttempts?: number;
|
|
18
|
+
/** Delay before the first retry, doubling after that. Defaults to 2 seconds. */
|
|
19
|
+
initialRetryDelay?: Duration;
|
|
20
|
+
/**
|
|
21
|
+
* The `undici` dispatcher for every request. Defaults to an `EnvHttpProxyAgent`, so
|
|
22
|
+
* `HTTPS_PROXY`/`NO_PROXY` are honored. For tests: a `MockAgent`.
|
|
23
|
+
*/
|
|
24
|
+
dispatcher?: Dispatcher;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Where ISO 3166-2 data comes from. An adapter only finds a version and downloads that version's
|
|
28
|
+
* subdivisions; the level filter and validation every source shares live in
|
|
29
|
+
* `fetchIsoCodesStateDefinitions`.
|
|
30
|
+
*/
|
|
31
|
+
export type IsoCodesSource = {
|
|
32
|
+
id: IsoCodesSourceId;
|
|
33
|
+
/** For messages and attribution, e.g. `Debian iso-codes`. */
|
|
34
|
+
label: string;
|
|
35
|
+
/** The source's home page. */
|
|
36
|
+
homepage: string;
|
|
37
|
+
/**
|
|
38
|
+
* The version used when none is given.
|
|
39
|
+
*
|
|
40
|
+
* @throws SfError (`IsoCodesDownloadError`) when no version can be determined.
|
|
41
|
+
*/
|
|
42
|
+
resolveLatestVersion(options: IsoCodesFetchOptions): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Downloads one version's subdivisions.
|
|
45
|
+
*
|
|
46
|
+
* @throws SfError (`IsoCodesVersionNotFoundError`) for a version the source doesn't have,
|
|
47
|
+
* (`IsoCodesDownloadError`) when the download fails, or (`InvalidIsoCodesDataError`) when the
|
|
48
|
+
* data isn't in the expected shape.
|
|
49
|
+
*/
|
|
50
|
+
fetchSubdivisions(version: string, options: IsoCodesFetchOptions): Promise<{
|
|
51
|
+
url: string;
|
|
52
|
+
subdivisions: IsoCodesSubdivision[];
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/address/isoCodes/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ export { deployAddressSettingsXml, retrieveAddressSettingsXml, type AddressSetti
|
|
|
3
3
|
export { parseAddressSettingsXml, planStateActivation, type AddressSettings, type AddressSettingsCountry, type AddressSettingsState, type StateActivationPlan, } from './address/addressSettingsXml.js';
|
|
4
4
|
export { createState, createStates, DEFAULT_CREATE_CONCURRENCY, planStateCreation, type CreateStateOptions, type CreateStatesOptions, type StateCreationOutcome, type StateCreationPlan, type StateCreationStatus, } from './address/createStates.js';
|
|
5
5
|
export { classifyNewStateResponse, fillNewStateForm, parseNewStateForm, type NewStateForm, type NewStateResponseClassification, type NewStateResponseStatus, } from './address/newStateForm.js';
|
|
6
|
+
export { fetchIsoCodesStateDefinitions, ISO_CODES_SOURCE_IDS, ISO_CODES_SOURCES, subdivisionsToStateDefinitions, type FetchIsoCodesStateDefinitionsOptions, type IsoCodesStateDefinitions, } from './address/isoCodes/index.js';
|
|
7
|
+
export type { IsoCodesFetchOptions, IsoCodesSource, IsoCodesSourceId, IsoCodesSubdivision, } from './address/isoCodes/types.js';
|
|
6
8
|
export { isLoginPage, NEW_STATE_FORM_PATH, openSetupSession, SetupSession, SetupTransportError, type OpenSetupSessionOptions, type SetupResponse, } from './address/setupSession.js';
|
|
7
9
|
export { filterStateDefinitions, formatStateKey, parseStateDefinitions, type StateDefinition, } from './address/stateDefinitions.js';
|
package/lib/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export { deployAddressSettingsXml, retrieveAddressSettingsXml, } from './address
|
|
|
23
23
|
export { parseAddressSettingsXml, planStateActivation, } from './address/addressSettingsXml.js';
|
|
24
24
|
export { createState, createStates, DEFAULT_CREATE_CONCURRENCY, planStateCreation, } from './address/createStates.js';
|
|
25
25
|
export { classifyNewStateResponse, fillNewStateForm, parseNewStateForm, } from './address/newStateForm.js';
|
|
26
|
+
export { fetchIsoCodesStateDefinitions, ISO_CODES_SOURCE_IDS, ISO_CODES_SOURCES, subdivisionsToStateDefinitions, } from './address/isoCodes/index.js';
|
|
26
27
|
export { isLoginPage, NEW_STATE_FORM_PATH, openSetupSession, SetupSession, SetupTransportError, } from './address/setupSession.js';
|
|
27
28
|
export { filterStateDefinitions, formatStateKey, parseStateDefinitions, } from './address/stateDefinitions.js';
|
|
28
29
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,mGAAmG;AACnG,iGAAiG;AACjG,qGAAqG;AACrG,kGAAkG;AAClG,qFAAqF;AAErF,OAAO,EAAE,cAAc,EAAyD,MAAM,6BAA6B,CAAC;AACpH,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAI3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,mBAAmB,GAKpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,WAAW,EACX,YAAY,EACZ,0BAA0B,EAC1B,iBAAiB,GAMlB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,GAIlB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,GAGpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,qBAAqB,GAEtB,MAAM,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,mGAAmG;AACnG,iGAAiG;AACjG,qGAAqG;AACrG,kGAAkG;AAClG,qFAAqF;AAErF,OAAO,EAAE,cAAc,EAAyD,MAAM,6BAA6B,CAAC;AACpH,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAI3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,mBAAmB,GAKpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,WAAW,EACX,YAAY,EACZ,0BAA0B,EAC1B,iBAAiB,GAMlB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,GAIlB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACpB,iBAAiB,EACjB,8BAA8B,GAG/B,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,GAGpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,qBAAqB,GAEtB,MAAM,+BAA+B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysf/simply-settings-core",
|
|
3
3
|
"description": "State and Country/Territory picklist automation (create states via the Setup form, activate them via AddressSettings) — the library layer behind @simplysf/simply-settings, published separately for direct consumption (e.g. editor tooling, CI scripts) without the CLI framework",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"author": "@ClayChipps",
|
|
6
6
|
"homepage": "https://github.com/SimplySF/simply-plugins-core",
|
|
7
7
|
"bugs": "https://github.com/SimplySF/simply-plugins-core/issues",
|
|
@@ -135,5 +135,5 @@
|
|
|
135
135
|
"output": []
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
|
-
"gitHead": "
|
|
138
|
+
"gitHead": "8ce681b40ae8e7adb25f792c279ceb20f5cdfbdd"
|
|
139
139
|
}
|