@simplysf/simply-settings-core 0.1.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/LICENSE.txt +205 -205
- 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 +14 -13
package/LICENSE.txt
CHANGED
|
@@ -1,206 +1,206 @@
|
|
|
1
|
-
Apache License Version 2.0
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026, SimplySF.
|
|
4
|
-
All rights reserved.
|
|
5
|
-
|
|
6
|
-
Apache License
|
|
7
|
-
Version 2.0, January 2004
|
|
8
|
-
http://www.apache.org/licenses/
|
|
9
|
-
|
|
10
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
-
|
|
12
|
-
1. Definitions.
|
|
13
|
-
|
|
14
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
-
|
|
17
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
-
the copyright owner that is granting the License.
|
|
19
|
-
|
|
20
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
-
other entities that control, are controlled by, or are under common
|
|
22
|
-
control with that entity. For the purposes of this definition,
|
|
23
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
-
direction or management of such entity, whether by contract or
|
|
25
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
-
|
|
28
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
-
exercising permissions granted by this License.
|
|
30
|
-
|
|
31
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
-
including but not limited to software source code, documentation
|
|
33
|
-
source, and configuration files.
|
|
34
|
-
|
|
35
|
-
"Object" form shall mean any form resulting from mechanical
|
|
36
|
-
transformation or translation of a Source form, including but
|
|
37
|
-
not limited to compiled object code, generated documentation,
|
|
38
|
-
and conversions to other media types.
|
|
39
|
-
|
|
40
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
-
Object form, made available under the License, as indicated by a
|
|
42
|
-
copyright notice that is included in or attached to the work
|
|
43
|
-
(an example is provided in the Appendix below).
|
|
44
|
-
|
|
45
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
-
form, that is based on (or derived from) the Work and for which the
|
|
47
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
-
of this License, Derivative Works shall not include works that remain
|
|
50
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
-
the Work and Derivative Works thereof.
|
|
52
|
-
|
|
53
|
-
"Contribution" shall mean any work of authorship, including
|
|
54
|
-
the original version of the Work and any modifications or additions
|
|
55
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
-
means any form of electronic, verbal, or written communication sent
|
|
60
|
-
to the Licensor or its representatives, including but not limited to
|
|
61
|
-
communication on electronic mailing lists, source code control systems,
|
|
62
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
-
excluding communication that is conspicuously marked or otherwise
|
|
65
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
-
|
|
67
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
-
subsequently incorporated within the Work.
|
|
70
|
-
|
|
71
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
-
Work and such Derivative Works in Source or Object form.
|
|
77
|
-
|
|
78
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
-
(except as stated in this section) patent license to make, have made,
|
|
82
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
-
where such license applies only to those patent claims licensable
|
|
84
|
-
by such Contributor that are necessarily infringed by their
|
|
85
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
-
institute patent litigation against any entity (including a
|
|
88
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
-
or contributory patent infringement, then any patent licenses
|
|
91
|
-
granted to You under this License for that Work shall terminate
|
|
92
|
-
as of the date such litigation is filed.
|
|
93
|
-
|
|
94
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
-
modifications, and in Source or Object form, provided that You
|
|
97
|
-
meet the following conditions:
|
|
98
|
-
|
|
99
|
-
(a) You must give any other recipients of the Work or
|
|
100
|
-
Derivative Works a copy of this License; and
|
|
101
|
-
|
|
102
|
-
(b) You must cause any modified files to carry prominent notices
|
|
103
|
-
stating that You changed the files; and
|
|
104
|
-
|
|
105
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
-
that You distribute, all copyright, patent, trademark, and
|
|
107
|
-
attribution notices from the Source form of the Work,
|
|
108
|
-
excluding those notices that do not pertain to any part of
|
|
109
|
-
the Derivative Works; and
|
|
110
|
-
|
|
111
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
-
distribution, then any Derivative Works that You distribute must
|
|
113
|
-
include a readable copy of the attribution notices contained
|
|
114
|
-
within such NOTICE file, excluding those notices that do not
|
|
115
|
-
pertain to any part of the Derivative Works, in at least one
|
|
116
|
-
of the following places: within a NOTICE text file distributed
|
|
117
|
-
as part of the Derivative Works; within the Source form or
|
|
118
|
-
documentation, if provided along with the Derivative Works; or,
|
|
119
|
-
within a display generated by the Derivative Works, if and
|
|
120
|
-
wherever such third-party notices normally appear. The contents
|
|
121
|
-
of the NOTICE file are for informational purposes only and
|
|
122
|
-
do not modify the License. You may add Your own attribution
|
|
123
|
-
notices within Derivative Works that You distribute, alongside
|
|
124
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
125
|
-
that such additional attribution notices cannot be construed
|
|
126
|
-
as modifying the License.
|
|
127
|
-
|
|
128
|
-
You may add Your own copyright statement to Your modifications and
|
|
129
|
-
may provide additional or different license terms and conditions
|
|
130
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
-
the conditions stated in this License.
|
|
134
|
-
|
|
135
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
-
this License, without any additional terms or conditions.
|
|
139
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
-
the terms of any separate license agreement you may have executed
|
|
141
|
-
with Licensor regarding such Contributions.
|
|
142
|
-
|
|
143
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
-
except as required for reasonable and customary use in describing the
|
|
146
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
-
|
|
148
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
-
implied, including, without limitation, any warranties or conditions
|
|
153
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
-
appropriateness of using or redistributing the Work and assume any
|
|
156
|
-
risks associated with Your exercise of permissions under this License.
|
|
157
|
-
|
|
158
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
-
unless required by applicable law (such as deliberate and grossly
|
|
161
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
-
liable to You for damages, including any direct, indirect, special,
|
|
163
|
-
incidental, or consequential damages of any character arising as a
|
|
164
|
-
result of this License or out of the use or inability to use the
|
|
165
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
-
other commercial damages or losses), even if such Contributor
|
|
168
|
-
has been advised of the possibility of such damages.
|
|
169
|
-
|
|
170
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
-
or other liability obligations and/or rights consistent with this
|
|
174
|
-
License. However, in accepting such obligations, You may act only
|
|
175
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
-
defend, and hold each Contributor harmless for any liability
|
|
178
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
-
of your accepting any such warranty or additional liability.
|
|
180
|
-
|
|
181
|
-
END OF TERMS AND CONDITIONS
|
|
182
|
-
|
|
183
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
-
|
|
185
|
-
To apply the Apache License to your work, attach the following
|
|
186
|
-
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
187
|
-
replaced with your own identifying information. (Don't include
|
|
188
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
-
comment syntax for the file format. We also recommend that a
|
|
190
|
-
file or class name and description of purpose be included on the
|
|
191
|
-
same "printed page" as the copyright notice for easier
|
|
192
|
-
identification within third-party archives.
|
|
193
|
-
|
|
194
|
-
Copyright {yyyy} {name of copyright owner}
|
|
195
|
-
|
|
196
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
-
you may not use this file except in compliance with the License.
|
|
198
|
-
You may obtain a copy of the License at
|
|
199
|
-
|
|
200
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
-
|
|
202
|
-
Unless required by applicable law or agreed to in writing, software
|
|
203
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
-
See the License for the specific language governing permissions and
|
|
1
|
+
Apache License Version 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, SimplySF.
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Apache License
|
|
7
|
+
Version 2.0, January 2004
|
|
8
|
+
http://www.apache.org/licenses/
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
+
|
|
12
|
+
1. Definitions.
|
|
13
|
+
|
|
14
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
+
the copyright owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
+
other entities that control, are controlled by, or are under common
|
|
22
|
+
control with that entity. For the purposes of this definition,
|
|
23
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
+
direction or management of such entity, whether by contract or
|
|
25
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
+
|
|
28
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
+
exercising permissions granted by this License.
|
|
30
|
+
|
|
31
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
+
including but not limited to software source code, documentation
|
|
33
|
+
source, and configuration files.
|
|
34
|
+
|
|
35
|
+
"Object" form shall mean any form resulting from mechanical
|
|
36
|
+
transformation or translation of a Source form, including but
|
|
37
|
+
not limited to compiled object code, generated documentation,
|
|
38
|
+
and conversions to other media types.
|
|
39
|
+
|
|
40
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
+
Object form, made available under the License, as indicated by a
|
|
42
|
+
copyright notice that is included in or attached to the work
|
|
43
|
+
(an example is provided in the Appendix below).
|
|
44
|
+
|
|
45
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
+
form, that is based on (or derived from) the Work and for which the
|
|
47
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
+
of this License, Derivative Works shall not include works that remain
|
|
50
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
+
the Work and Derivative Works thereof.
|
|
52
|
+
|
|
53
|
+
"Contribution" shall mean any work of authorship, including
|
|
54
|
+
the original version of the Work and any modifications or additions
|
|
55
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
+
means any form of electronic, verbal, or written communication sent
|
|
60
|
+
to the Licensor or its representatives, including but not limited to
|
|
61
|
+
communication on electronic mailing lists, source code control systems,
|
|
62
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
+
excluding communication that is conspicuously marked or otherwise
|
|
65
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
+
|
|
67
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
+
subsequently incorporated within the Work.
|
|
70
|
+
|
|
71
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
+
Work and such Derivative Works in Source or Object form.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have made,
|
|
82
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
+
where such license applies only to those patent claims licensable
|
|
84
|
+
by such Contributor that are necessarily infringed by their
|
|
85
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
+
institute patent litigation against any entity (including a
|
|
88
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
+
or contributory patent infringement, then any patent licenses
|
|
91
|
+
granted to You under this License for that Work shall terminate
|
|
92
|
+
as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or
|
|
100
|
+
Derivative Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work,
|
|
108
|
+
excluding those notices that do not pertain to any part of
|
|
109
|
+
the Derivative Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute must
|
|
113
|
+
include a readable copy of the attribution notices contained
|
|
114
|
+
within such NOTICE file, excluding those notices that do not
|
|
115
|
+
pertain to any part of the Derivative Works, in at least one
|
|
116
|
+
of the following places: within a NOTICE text file distributed
|
|
117
|
+
as part of the Derivative Works; within the Source form or
|
|
118
|
+
documentation, if provided along with the Derivative Works; or,
|
|
119
|
+
within a display generated by the Derivative Works, if and
|
|
120
|
+
wherever such third-party notices normally appear. The contents
|
|
121
|
+
of the NOTICE file are for informational purposes only and
|
|
122
|
+
do not modify the License. You may add Your own attribution
|
|
123
|
+
notices within Derivative Works that You distribute, alongside
|
|
124
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
125
|
+
that such additional attribution notices cannot be construed
|
|
126
|
+
as modifying the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own copyright statement to Your modifications and
|
|
129
|
+
may provide additional or different license terms and conditions
|
|
130
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
+
the conditions stated in this License.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
+
the terms of any separate license agreement you may have executed
|
|
141
|
+
with Licensor regarding such Contributions.
|
|
142
|
+
|
|
143
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
+
except as required for reasonable and customary use in describing the
|
|
146
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
+
|
|
148
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
+
implied, including, without limitation, any warranties or conditions
|
|
153
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any
|
|
156
|
+
risks associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
+
unless required by applicable law (such as deliberate and grossly
|
|
161
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
+
liable to You for damages, including any direct, indirect, special,
|
|
163
|
+
incidental, or consequential damages of any character arising as a
|
|
164
|
+
result of this License or out of the use or inability to use the
|
|
165
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
+
other commercial damages or losses), even if such Contributor
|
|
168
|
+
has been advised of the possibility of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
+
or other liability obligations and/or rights consistent with this
|
|
174
|
+
License. However, in accepting such obligations, You may act only
|
|
175
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
+
defend, and hold each Contributor harmless for any liability
|
|
178
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
+
of your accepting any such warranty or additional liability.
|
|
180
|
+
|
|
181
|
+
END OF TERMS AND CONDITIONS
|
|
182
|
+
|
|
183
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
+
|
|
185
|
+
To apply the Apache License to your work, attach the following
|
|
186
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
187
|
+
replaced with your own identifying information. (Don't include
|
|
188
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
+
comment syntax for the file format. We also recommend that a
|
|
190
|
+
file or class name and description of purpose be included on the
|
|
191
|
+
same "printed page" as the copyright notice for easier
|
|
192
|
+
identification within third-party archives.
|
|
193
|
+
|
|
194
|
+
Copyright {yyyy} {name of copyright owner}
|
|
195
|
+
|
|
196
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
+
you may not use this file except in compliance with the License.
|
|
198
|
+
You may obtain a copy of the License at
|
|
199
|
+
|
|
200
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
+
|
|
202
|
+
Unless required by applicable law or agreed to in writing, software
|
|
203
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
+
See the License for the specific language governing permissions and
|
|
206
206
|
limitations under the License.
|
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,kBAAkB,CAAC;AACjC,MAAM,QAAQ,GAAG,mDAAmD,CAAC;AACrE,MAAM,QAAQ,GACZ,4HAA4H,CAAC;AAC/H,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,GAAG,QAAQ,UAAU,GAAG,uBAAuB,CAAC;AACzD,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,KAAK,KAAK,IAAI,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AAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAEhD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,OAAO,CAAC,GAAG,KAAK,oBAAoB,OAAO,IAAI,EAAE,8BAA8B,EAAE;gBACzF,OAAO,QAAQ,qCAAqC;aACrD,CAAC,CAAC;QACL,CAAC;QAED,MAAM,OAAO,GAAI,IAAuC,EAAE,CAAC,QAAQ,CAAC,CAAC;QACrE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;YAC7D,MAAM,IAAI,OAAO,CACf,GAAG,GAAG,wEAAwE,EAC9E,0BAA0B,CAC3B,CAAC;QACJ,CAAC;QAED,iFAAiF;QACjF,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACjH,OAAO,EAAE,GAAG,EAAE,YAAY,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,SAAS,gBAAgB,CAAC,KAAc;IACtC,IAAI,KAAK,YAAY,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9C,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5C,yFAAyF;IACzF,4DAA4D;IAC5D,OAAO,CAAC,KAAK,YAAY,SAAS,IAAI,KAAK,CAAC,OAAO,KAAK,cAAc,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC;AAC3G,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,uBAAuB,CA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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,"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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",
|
|
@@ -52,6 +52,17 @@
|
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "wireit",
|
|
57
|
+
"compile": "wireit",
|
|
58
|
+
"fix-license": "eslint src test --fix --rule \"header/header: [2]\"",
|
|
59
|
+
"format": "wireit",
|
|
60
|
+
"lint": "wireit",
|
|
61
|
+
"test": "wireit",
|
|
62
|
+
"test:coverage": "vitest run --coverage --project simply-settings-core",
|
|
63
|
+
"test:only": "wireit",
|
|
64
|
+
"test:watch": "vitest watch --project simply-settings-core"
|
|
65
|
+
},
|
|
55
66
|
"wireit": {
|
|
56
67
|
"build": {
|
|
57
68
|
"dependencies": [
|
|
@@ -124,15 +135,5 @@
|
|
|
124
135
|
"output": []
|
|
125
136
|
}
|
|
126
137
|
},
|
|
127
|
-
"
|
|
128
|
-
|
|
129
|
-
"compile": "wireit",
|
|
130
|
-
"fix-license": "eslint src test --fix --rule \"header/header: [2]\"",
|
|
131
|
-
"format": "wireit",
|
|
132
|
-
"lint": "wireit",
|
|
133
|
-
"test": "wireit",
|
|
134
|
-
"test:coverage": "vitest run --coverage --project simply-settings-core",
|
|
135
|
-
"test:only": "wireit",
|
|
136
|
-
"test:watch": "vitest watch --project simply-settings-core"
|
|
137
|
-
}
|
|
138
|
-
}
|
|
138
|
+
"gitHead": "8ce681b40ae8e7adb25f792c279ceb20f5cdfbdd"
|
|
139
|
+
}
|