@mailwoman/codex 4.4.0 → 4.5.1

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.
Files changed (78) hide show
  1. package/out/address-system-conventions.d.ts +2 -2
  2. package/out/address-system-conventions.js +4 -4
  3. package/out/au/delivery-service.d.ts +165 -0
  4. package/out/au/delivery-service.d.ts.map +1 -0
  5. package/out/au/delivery-service.js +132 -0
  6. package/out/au/delivery-service.js.map +1 -0
  7. package/out/au/index.d.ts +15 -0
  8. package/out/au/index.d.ts.map +1 -0
  9. package/out/au/index.js +15 -0
  10. package/out/au/index.js.map +1 -0
  11. package/out/au/level-designator.d.ts +150 -0
  12. package/out/au/level-designator.d.ts.map +1 -0
  13. package/out/au/level-designator.js +156 -0
  14. package/out/au/level-designator.js.map +1 -0
  15. package/out/au/postcode.d.ts +40 -0
  16. package/out/au/postcode.d.ts.map +1 -0
  17. package/out/au/postcode.js +37 -0
  18. package/out/au/postcode.js.map +1 -0
  19. package/out/au/state.d.ts +31 -0
  20. package/out/au/state.d.ts.map +1 -0
  21. package/out/au/state.js +31 -0
  22. package/out/au/state.js.map +1 -0
  23. package/out/country/country.d.ts +20 -17
  24. package/out/country/country.d.ts.map +1 -1
  25. package/out/country/country.js +19 -16
  26. package/out/country/country.js.map +1 -1
  27. package/out/country/index.d.ts +1 -1
  28. package/out/country/index.d.ts.map +1 -1
  29. package/out/country/index.js +1 -1
  30. package/out/country/index.js.map +1 -1
  31. package/out/country/names.d.ts +1 -1
  32. package/out/country/names.js +1 -1
  33. package/out/fr/cedex.d.ts +35 -0
  34. package/out/fr/cedex.d.ts.map +1 -0
  35. package/out/fr/cedex.js +43 -0
  36. package/out/fr/cedex.js.map +1 -0
  37. package/out/fr/index.d.ts +1 -0
  38. package/out/fr/index.d.ts.map +1 -1
  39. package/out/fr/index.js +1 -0
  40. package/out/fr/index.js.map +1 -1
  41. package/out/index.d.ts +3 -1
  42. package/out/index.d.ts.map +1 -1
  43. package/out/index.js +2 -0
  44. package/out/index.js.map +1 -1
  45. package/out/nz/delivery-service.d.ts +152 -0
  46. package/out/nz/delivery-service.d.ts.map +1 -0
  47. package/out/nz/delivery-service.js +158 -0
  48. package/out/nz/delivery-service.js.map +1 -0
  49. package/out/nz/index.d.ts +12 -0
  50. package/out/nz/index.d.ts.map +1 -0
  51. package/out/nz/index.js +12 -0
  52. package/out/nz/index.js.map +1 -0
  53. package/out/nz/postcode.d.ts +31 -0
  54. package/out/nz/postcode.d.ts.map +1 -0
  55. package/out/nz/postcode.js +28 -0
  56. package/out/nz/postcode.js.map +1 -0
  57. package/out/postcode-systems.d.ts +1 -1
  58. package/out/postcode-systems.d.ts.map +1 -1
  59. package/out/postcode-systems.js +4 -0
  60. package/out/postcode-systems.js.map +1 -1
  61. package/out/us/floor-designator.d.ts +104 -0
  62. package/out/us/floor-designator.d.ts.map +1 -0
  63. package/out/us/floor-designator.js +84 -0
  64. package/out/us/floor-designator.js.map +1 -0
  65. package/out/us/index.d.ts +6 -2
  66. package/out/us/index.d.ts.map +1 -1
  67. package/out/us/index.js +6 -2
  68. package/out/us/index.js.map +1 -1
  69. package/out/us/military-address.d.ts +143 -0
  70. package/out/us/military-address.d.ts.map +1 -0
  71. package/out/us/military-address.js +156 -0
  72. package/out/us/military-address.js.map +1 -0
  73. package/out/us/street-directional.d.ts +4 -2
  74. package/out/us/street-directional.d.ts.map +1 -1
  75. package/out/us/street-directional.js +4 -2
  76. package/out/us/street-directional.js.map +1 -1
  77. package/out/us/zipcode.d.ts +1 -1
  78. package/package.json +4 -2
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * CEDEX — Courrier d'Entreprise à Distribution EXceptionnelle (La Poste business routing, NF Z
7
+ * 10-011 §3.4). A CEDEX line replaces the ordinary delivery line for high-volume business
8
+ * recipients: `75008 PARIS CEDEX 08` — the word CEDEX after the distribution office name,
9
+ * optionally followed by a 1–2 digit office number. The component is the `CEDEX [NN]` phrase
10
+ * itself (the schema's `cedex` tag); the preceding postcode/locality keep their own tags.
11
+ *
12
+ * This slice closes the gap PR #516 documented: the shard builder sourced the shape from SCHEMA.mdx
13
+ * prose because codex had no cedex home. Now it does — the builder and any future consumer import
14
+ * from here (the no-load-bearing-trivia discipline: one provenanced source).
15
+ */
16
+ /** Matches a CEDEX phrase: the keyword plus an optional 1–2 digit office number. */
17
+ export const CEDEX_PATTERN = /\bCEDEX(?:\s+(\d{1,2}))?\b/i;
18
+ /**
19
+ * Find the CEDEX phrase in a line, if any. Returns the LAST match — a CEDEX line places the phrase
20
+ * terminally (NF Z 10-011), and any earlier occurrence in pathological input is more likely a venue
21
+ * name fragment.
22
+ */
23
+ export function matchCedex(text) {
24
+ let match = null;
25
+ const re = new RegExp(CEDEX_PATTERN.source, "gi");
26
+ for (const m of text.matchAll(re)) {
27
+ match = {
28
+ matched: m[0],
29
+ start: m.index,
30
+ end: m.index + m[0].length,
31
+ ...(m[1] ? { office: m[1] } : {}),
32
+ };
33
+ }
34
+ return match;
35
+ }
36
+ /** True when the string is exactly a CEDEX phrase (the component-value validator). */
37
+ export function isCedex(input) {
38
+ if (typeof input !== "string")
39
+ return false;
40
+ const m = input.trim().match(CEDEX_PATTERN);
41
+ return m !== null && m[0].length === input.trim().length;
42
+ }
43
+ //# sourceMappingURL=cedex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cedex.js","sourceRoot":"","sources":["../../fr/cedex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,oFAAoF;AACpF,MAAM,CAAC,MAAM,aAAa,GAAG,6BAA6B,CAAA;AAY1D;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACtC,IAAI,KAAK,GAAsB,IAAI,CAAA;IACnC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACjD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;QACnC,KAAK,GAAG;YACP,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;YACb,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,GAAG,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM;YAC1B,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACjC,CAAA;IACF,CAAC;IACD,OAAO,KAAK,CAAA;AACb,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,OAAO,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IAC3C,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAA;AACzD,CAAC"}
package/out/fr/index.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  * The French address system (La Poste / ISO 3166-2:FR): street types (voie), postal codes (code
7
7
  * postal), and the admin hierarchy of départements and régions.
8
8
  */
9
+ export * from "./cedex.js";
9
10
  export * from "./code-postal.js";
10
11
  export * from "./departement.js";
11
12
  export * from "./region.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../fr/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../fr/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA"}
package/out/fr/index.js CHANGED
@@ -6,6 +6,7 @@
6
6
  * The French address system (La Poste / ISO 3166-2:FR): street types (voie), postal codes (code
7
7
  * postal), and the admin hierarchy of départements and régions.
8
8
  */
9
+ export * from "./cedex.js";
9
10
  export * from "./code-postal.js";
10
11
  export * from "./departement.js";
11
12
  export * from "./region.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../fr/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../fr/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA"}
package/out/index.d.ts CHANGED
@@ -17,12 +17,14 @@
17
17
  * `candidateSystemsForPostcode` (the inverse of the per-slice postcode patterns) is a top-level
18
18
  * export.
19
19
  */
20
- export { ADDRESS_SYSTEM_CONVENTIONS, type AddressSystemConventions, conventionsForSystem, } from "./address-system-conventions.js";
20
+ export { ADDRESS_SYSTEM_CONVENTIONS, conventionsForSystem, type AddressSystemConventions, } from "./address-system-conventions.js";
21
+ export * as au from "./au/index.js";
21
22
  export * as ca from "./ca/index.js";
22
23
  export * as de from "./de/index.js";
23
24
  export * as fr from "./fr/index.js";
24
25
  export * as gb from "./gb/index.js";
25
26
  export * as jp from "./jp/index.js";
27
+ export * as nz from "./nz/index.js";
26
28
  export { candidateSystemsForPostcode, type SystemCode } from "./postcode-systems.js";
27
29
  export * as us from "./us/index.js";
28
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACN,0BAA0B,EAC1B,KAAK,wBAAwB,EAC7B,oBAAoB,GACpB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACN,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,wBAAwB,GAC7B,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
package/out/index.js CHANGED
@@ -18,11 +18,13 @@
18
18
  * export.
19
19
  */
20
20
  export { ADDRESS_SYSTEM_CONVENTIONS, conventionsForSystem, } from "./address-system-conventions.js";
21
+ export * as au from "./au/index.js";
21
22
  export * as ca from "./ca/index.js";
22
23
  export * as de from "./de/index.js";
23
24
  export * as fr from "./fr/index.js";
24
25
  export * as gb from "./gb/index.js";
25
26
  export * as jp from "./jp/index.js";
27
+ export * as nz from "./nz/index.js";
26
28
  export { candidateSystemsForPostcode } from "./postcode-systems.js";
27
29
  export * as us from "./us/index.js";
28
30
  //# sourceMappingURL=index.js.map
package/out/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACN,0BAA0B,EAE1B,oBAAoB,GACpB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAmB,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACN,0BAA0B,EAC1B,oBAAoB,GAEpB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAmB,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * NZ Post delivery-service types — the second half of the Commonwealth po_box vocabulary: `PO Box
7
+ * 24999`, `Private Bag 106999`, `CMB B99`, plus the identifier-less counter services, plus the
8
+ * colloquial "Private Box" alias documented here for recognition with its 'invalid' citation.
9
+ *
10
+ * Sourcing (accessed 2026-06-11):
11
+ *
12
+ * - NZ Post Address Standards (ADV358, October 2021 edition hosted on nzpost.co.nz) is the
13
+ * authoritative document. Verbatim: "The Delivery Service Type is mandatory. It may be PO
14
+ * Box, Private Bag, CMB, Response Bag, Counter Delivery or Poste Restante." Its Delivery
15
+ * Service Elements table gives the descriptions reproduced in
16
+ * {@link NZ_DELIVERY_SERVICE_TYPES}, and the identifier rules: "The Delivery Service
17
+ * Identifier must have no leading zeros and no spaces, separators or other punctuation"; "The
18
+ * Delivery Service Identifier is not used for Counter Delivery or Poste Restante. It is also
19
+ * not used for Private Bags that do not have an identifier allocated by New Zealand Post".
20
+ * Examples: `PO Box 24999`, `Private Bag 106999`, `Response Bag 500999`, `CMB B99`, `Counter
21
+ * Delivery`, `Poste Restante`. The standard's incorrect-form examples show `P O Box 4 099`
22
+ * and `PB 39990` as wrong — `PB` is a common error, not a designator, so it is NOT in this
23
+ * table.
24
+ * - The live addressing-standards page repeats the format rules: "PO Box and Private Bag numbers are
25
+ * space-free (eg. 'PO Box 23226', not 'PO Box 23 226')", "'PO' is space-free … and
26
+ * punctuation-free".
27
+ *
28
+ * All six types are CURRENT in the October 2021 ADV358 (including CMB — no legacy flag is needed
29
+ * for the NZ slice).
30
+ *
31
+ * **"Private Box" — colloquial alias, officially invalid:** ADV358 does not list "Private Box" as a
32
+ * Delivery Service Type and NZ Post's live standards pages (addressing-standards, how-to-address-
33
+ * mail, accessed 2026-06-11) name only the six types above. However, real NZ mail and the postal
34
+ * arena's gold rows carry "Private Box" as a colloquial synonym for a numbered PO Box (same
35
+ * numbered format, different label). Operator ruling 2026-06-11: "Private Box = recognize-as-used
36
+ * — codex documents it unofficial/colloquial WITH the 'officially invalid' citation; the shard
37
+ * teaches recognition (validity and recognition are separate disciplines, same as the AU legacy
38
+ * flags)." This is encoded in {@link NZ_PRIVATE_BOX_ALIAS} — a distinct export from
39
+ * {@link NZ_DELIVERY_SERVICE_TYPES} so callers can choose whether to include the unofficial form.
40
+ * @see {@link https://www.nzpost.co.nz/sites/nz/files/2021-10/adv358-address-standards.pdf NZ Post Address Standards (ADV358, Oct 2021)}
41
+ * @see {@link https://www.nzpost.co.nz/business/shipping-in-nz/addressing-standards NZ Post addressing standards}
42
+ * @see {@link https://www.nzpost.co.nz/personal/sending-in-nz/how-to-address-mail NZ Post — how to address mail}
43
+ */
44
+ /** Identifier requirement per ADV358's Delivery Service Elements rules. */
45
+ export type NzIdentifierRule = "required-if-allocated" | "optional" | "not-used";
46
+ /** One Delivery Service Type row from ADV358. */
47
+ export interface NzDeliveryServiceType {
48
+ /** The Delivery Service Type, verbatim casing per ADV358 ("PO Box", "Private Bag", "CMB"). */
49
+ type: string;
50
+ /** The ADV358 description, verbatim. */
51
+ description: string;
52
+ /**
53
+ * Identifier rule: PO Box/Response Bag/CMB identifiers are mandatory if allocated; Private Bag
54
+ * may legitimately have none ("not used … for Private Bags that do not have an identifier
55
+ * allocated by New Zealand Post"); Counter Delivery and Poste Restante never carry one.
56
+ */
57
+ identifier: NzIdentifierRule;
58
+ }
59
+ /** The six Delivery Service Types, verbatim from ADV358 (see the module header). */
60
+ export declare const NZ_DELIVERY_SERVICE_TYPES: readonly [{
61
+ readonly type: "PO Box";
62
+ readonly description: "Post Box, PO Box";
63
+ readonly identifier: "required-if-allocated";
64
+ }, {
65
+ readonly type: "Private Bag";
66
+ readonly description: "Private Bag";
67
+ readonly identifier: "optional";
68
+ }, {
69
+ readonly type: "Response Bag";
70
+ readonly description: "Response Bag (used for competitions)";
71
+ readonly identifier: "required-if-allocated";
72
+ }, {
73
+ readonly type: "CMB";
74
+ readonly description: "Community Mail Box in postal outlet or on a thoroughfare";
75
+ readonly identifier: "required-if-allocated";
76
+ }, {
77
+ readonly type: "Counter Delivery";
78
+ readonly description: "Hold for Counter Delivery collection - domestic mail";
79
+ readonly identifier: "not-used";
80
+ }, {
81
+ readonly type: "Poste Restante";
82
+ readonly description: "Hold for Poste Restante collection - international mail";
83
+ readonly identifier: "not-used";
84
+ }];
85
+ /** A canonical NZ Delivery Service Type. */
86
+ export type NzDeliveryServiceTypeName = (typeof NZ_DELIVERY_SERVICE_TYPES)[number]["type"];
87
+ /**
88
+ * Metadata for the colloquial "Private Box" alias (see the module header and operator ruling
89
+ * 2026-06-11). Kept separate from {@link NZ_DELIVERY_SERVICE_TYPES} because it is NOT a valid ADV358
90
+ * Delivery Service Type — recognition and validity are separate concerns.
91
+ *
92
+ * Sourcing: ADV358 (Oct 2021) omits "Private Box" from its Delivery Service Type list entirely. NZ
93
+ * Post's live standards pages (nzpost.co.nz/business/shipping-in-nz/addressing-standards and
94
+ * nzpost.co.nz/personal/sending-in-nz/how-to-address-mail, accessed 2026-06-11) do not list it as a
95
+ * valid type. Real NZ mail and the postal arena's gold rows nonetheless carry it as a colloquial
96
+ * synonym for a numbered PO Box. Operator ruling 2026-06-11 authorizes its inclusion here for
97
+ * recognition only, with this citation; corpus synthesis should treat it as a non-prescriptive
98
+ * form.
99
+ */
100
+ export declare const NZ_PRIVATE_BOX_ALIAS: {
101
+ /** The surface form as it appears on real mail and in postal-arena gold rows. */
102
+ readonly type: "Private Box";
103
+ /**
104
+ * The description of validity status — NOT a valid ADV358 Delivery Service Type; a colloquial NZ
105
+ * synonym for a numbered PO Box (same format as "PO Box <number>").
106
+ */
107
+ readonly description: "Colloquial NZ synonym for a numbered PO Box — NOT a valid ADV358 Delivery Service Type";
108
+ /** Identifier rule mirrors PO Box: a number is expected when the alias is used with one. */
109
+ readonly identifier: "required-if-allocated";
110
+ /** True — this form is NOT valid per ADV358 or NZ Post's live standards pages (accessed
111
+ 2026-06-11). */
112
+ readonly officiallyInvalid: true;
113
+ };
114
+ /** Extended type name union including the colloquial alias recognized for parsing. */
115
+ export type NzDeliveryServiceMatchTypeName = NzDeliveryServiceTypeName | "Private Box";
116
+ /** Result of an NZ delivery-service parse. */
117
+ export interface NzDeliveryServiceMatch {
118
+ /** The designator phrase as it appeared ("PO Box", "private bag", "Private Box"). */
119
+ matched: string;
120
+ /**
121
+ * The canonical Delivery Service Type or recognized alias ("PO Box", "Private Bag", "CMB", …,
122
+ * "Private Box"). When `type` is "Private Box", `colloquial` is true and `officiallyInvalid` is
123
+ * true — the form is not a valid ADV358 type.
124
+ */
125
+ type: NzDeliveryServiceMatchTypeName;
126
+ /** The Delivery Service Identifier when present ("24999", "B99"). */
127
+ id?: string;
128
+ /**
129
+ * True when the matched form is the colloquial "Private Box" alias — not a valid ADV358 Delivery
130
+ * Service Type. Absent (undefined) for all standard ADV358 types.
131
+ */
132
+ colloquial?: true;
133
+ }
134
+ /**
135
+ * If `input` is a standalone NZ delivery-service phrase ("PO Box 24999", "Private Bag 106999", "CMB
136
+ * B99", bare "Private Bag", "Counter Delivery", "Private Box 102"), return the canonical type and
137
+ * identifier. Null otherwise — including for "PB 39990" (an error of form per ADV358).
138
+ *
139
+ * When `type` is "Private Box", the result carries `colloquial: true` — indicating the colloquial
140
+ * alias (not an ADV358 Delivery Service Type; see {@link NZ_PRIVATE_BOX_ALIAS} and operator ruling
141
+ * 2026-06-11). Callers that want only formally-valid ADV358 types should check
142
+ * `!result.colloquial`.
143
+ */
144
+ export declare function matchNzDeliveryService(input: unknown): NzDeliveryServiceMatch | null;
145
+ /** Type-predicate: does the input look like a standalone NZ delivery-service address line? */
146
+ export declare function isNzDeliveryService(input: unknown): boolean;
147
+ /**
148
+ * Normalize a recognized phrase to the ADV358 form (`"p.o. box 24999"` → `"PO Box 24999"`). Returns
149
+ * the input unchanged if it isn't a delivery-service phrase.
150
+ */
151
+ export declare function normalizeNzDeliveryService(input: string): string;
152
+ //# sourceMappingURL=delivery-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-service.d.ts","sourceRoot":"","sources":["../../nz/delivery-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,2EAA2E;AAC3E,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,GAAG,UAAU,GAAG,UAAU,CAAA;AAEhF,iDAAiD;AACjD,MAAM,WAAW,qBAAqB;IACrC,8FAA8F;IAC9F,IAAI,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,UAAU,EAAE,gBAAgB,CAAA;CAC5B;AAED,oFAAoF;AACpF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;EAmBe,CAAA;AAErD,4CAA4C;AAC5C,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB;IAChC,iFAAiF;;IAEjF;;;OAGG;;IAEH,4FAA4F;;IAE5F;eACc;;CAEL,CAAA;AAqBV,sFAAsF;AACtF,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,GAAG,aAAa,CAAA;AAkBtF,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACtC,qFAAqF;IACrF,OAAO,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,IAAI,EAAE,8BAA8B,CAAA;IACpC,qEAAqE;IACrE,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAA;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,GAAG,IAAI,CASpF;AAED,8FAA8F;AAC9F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIhE"}
@@ -0,0 +1,158 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * NZ Post delivery-service types — the second half of the Commonwealth po_box vocabulary: `PO Box
7
+ * 24999`, `Private Bag 106999`, `CMB B99`, plus the identifier-less counter services, plus the
8
+ * colloquial "Private Box" alias documented here for recognition with its 'invalid' citation.
9
+ *
10
+ * Sourcing (accessed 2026-06-11):
11
+ *
12
+ * - NZ Post Address Standards (ADV358, October 2021 edition hosted on nzpost.co.nz) is the
13
+ * authoritative document. Verbatim: "The Delivery Service Type is mandatory. It may be PO
14
+ * Box, Private Bag, CMB, Response Bag, Counter Delivery or Poste Restante." Its Delivery
15
+ * Service Elements table gives the descriptions reproduced in
16
+ * {@link NZ_DELIVERY_SERVICE_TYPES}, and the identifier rules: "The Delivery Service
17
+ * Identifier must have no leading zeros and no spaces, separators or other punctuation"; "The
18
+ * Delivery Service Identifier is not used for Counter Delivery or Poste Restante. It is also
19
+ * not used for Private Bags that do not have an identifier allocated by New Zealand Post".
20
+ * Examples: `PO Box 24999`, `Private Bag 106999`, `Response Bag 500999`, `CMB B99`, `Counter
21
+ * Delivery`, `Poste Restante`. The standard's incorrect-form examples show `P O Box 4 099`
22
+ * and `PB 39990` as wrong — `PB` is a common error, not a designator, so it is NOT in this
23
+ * table.
24
+ * - The live addressing-standards page repeats the format rules: "PO Box and Private Bag numbers are
25
+ * space-free (eg. 'PO Box 23226', not 'PO Box 23 226')", "'PO' is space-free … and
26
+ * punctuation-free".
27
+ *
28
+ * All six types are CURRENT in the October 2021 ADV358 (including CMB — no legacy flag is needed
29
+ * for the NZ slice).
30
+ *
31
+ * **"Private Box" — colloquial alias, officially invalid:** ADV358 does not list "Private Box" as a
32
+ * Delivery Service Type and NZ Post's live standards pages (addressing-standards, how-to-address-
33
+ * mail, accessed 2026-06-11) name only the six types above. However, real NZ mail and the postal
34
+ * arena's gold rows carry "Private Box" as a colloquial synonym for a numbered PO Box (same
35
+ * numbered format, different label). Operator ruling 2026-06-11: "Private Box = recognize-as-used
36
+ * — codex documents it unofficial/colloquial WITH the 'officially invalid' citation; the shard
37
+ * teaches recognition (validity and recognition are separate disciplines, same as the AU legacy
38
+ * flags)." This is encoded in {@link NZ_PRIVATE_BOX_ALIAS} — a distinct export from
39
+ * {@link NZ_DELIVERY_SERVICE_TYPES} so callers can choose whether to include the unofficial form.
40
+ * @see {@link https://www.nzpost.co.nz/sites/nz/files/2021-10/adv358-address-standards.pdf NZ Post Address Standards (ADV358, Oct 2021)}
41
+ * @see {@link https://www.nzpost.co.nz/business/shipping-in-nz/addressing-standards NZ Post addressing standards}
42
+ * @see {@link https://www.nzpost.co.nz/personal/sending-in-nz/how-to-address-mail NZ Post — how to address mail}
43
+ */
44
+ /** The six Delivery Service Types, verbatim from ADV358 (see the module header). */
45
+ export const NZ_DELIVERY_SERVICE_TYPES = [
46
+ { type: "PO Box", description: "Post Box, PO Box", identifier: "required-if-allocated" },
47
+ { type: "Private Bag", description: "Private Bag", identifier: "optional" },
48
+ { type: "Response Bag", description: "Response Bag (used for competitions)", identifier: "required-if-allocated" },
49
+ {
50
+ type: "CMB",
51
+ description: "Community Mail Box in postal outlet or on a thoroughfare",
52
+ identifier: "required-if-allocated",
53
+ },
54
+ {
55
+ type: "Counter Delivery",
56
+ description: "Hold for Counter Delivery collection - domestic mail",
57
+ identifier: "not-used",
58
+ },
59
+ {
60
+ type: "Poste Restante",
61
+ description: "Hold for Poste Restante collection - international mail",
62
+ identifier: "not-used",
63
+ },
64
+ ];
65
+ /**
66
+ * Metadata for the colloquial "Private Box" alias (see the module header and operator ruling
67
+ * 2026-06-11). Kept separate from {@link NZ_DELIVERY_SERVICE_TYPES} because it is NOT a valid ADV358
68
+ * Delivery Service Type — recognition and validity are separate concerns.
69
+ *
70
+ * Sourcing: ADV358 (Oct 2021) omits "Private Box" from its Delivery Service Type list entirely. NZ
71
+ * Post's live standards pages (nzpost.co.nz/business/shipping-in-nz/addressing-standards and
72
+ * nzpost.co.nz/personal/sending-in-nz/how-to-address-mail, accessed 2026-06-11) do not list it as a
73
+ * valid type. Real NZ mail and the postal arena's gold rows nonetheless carry it as a colloquial
74
+ * synonym for a numbered PO Box. Operator ruling 2026-06-11 authorizes its inclusion here for
75
+ * recognition only, with this citation; corpus synthesis should treat it as a non-prescriptive
76
+ * form.
77
+ */
78
+ export const NZ_PRIVATE_BOX_ALIAS = {
79
+ /** The surface form as it appears on real mail and in postal-arena gold rows. */
80
+ type: "Private Box",
81
+ /**
82
+ * The description of validity status — NOT a valid ADV358 Delivery Service Type; a colloquial NZ
83
+ * synonym for a numbered PO Box (same format as "PO Box <number>").
84
+ */
85
+ description: "Colloquial NZ synonym for a numbered PO Box — NOT a valid ADV358 Delivery Service Type",
86
+ /** Identifier rule mirrors PO Box: a number is expected when the alias is used with one. */
87
+ identifier: "required-if-allocated",
88
+ /** True — this form is NOT valid per ADV358 or NZ Post's live standards pages (accessed
89
+ 2026-06-11). */
90
+ officiallyInvalid: true,
91
+ };
92
+ /**
93
+ * Per-type surface patterns (designator phrase only). Recognition is deliberately wider than the
94
+ * prescriptive standard — mail in the wild writes "P.O. Box" even though ADV358 says `PO` is
95
+ * punctuation-free — but it does NOT admit forms the standard names as errors of TYPE (`PB`).
96
+ *
97
+ * The colloquial "Private Box" alias is included for recognition (see {@link NZ_PRIVATE_BOX_ALIAS}
98
+ * and operator ruling 2026-06-11); it maps to a distinct synthetic type string so callers can
99
+ * distinguish it from the ADV358 types.
100
+ */
101
+ const TYPE_PATTERNS = [
102
+ ["PO Box", String.raw `p\.?\s*o\.?\s*box|post\s+box`],
103
+ ["Private Bag", String.raw `private\s+bag`],
104
+ ["Private Box", String.raw `private\s+box`],
105
+ ["Response Bag", String.raw `response\s+bag`],
106
+ ["CMB", String.raw `community\s+mail\s+box|cmb`],
107
+ ["Counter Delivery", String.raw `counter\s+delivery`],
108
+ ["Poste Restante", String.raw `poste\s+restante`],
109
+ ];
110
+ const IDENTIFIER_RULES = new Map([
111
+ ...NZ_DELIVERY_SERVICE_TYPES.map((t) => [t.type, t.identifier]),
112
+ // "Private Box" mirrors PO Box identifier rules (required-if-allocated) per the alias metadata.
113
+ ["Private Box", NZ_PRIVATE_BOX_ALIAS.identifier],
114
+ ]);
115
+ // One anchored regex per type. The identifier shape follows ADV358 (alphanumeric, no spaces or
116
+ // separators — `24999`, `B99`); the identifier-less counter services take no tail at all.
117
+ const MATCHERS = TYPE_PATTERNS.map(([type, src]) => {
118
+ const rule = IDENTIFIER_RULES.get(type);
119
+ const tail = rule === "not-used" ? "" : String.raw `(?:\s+([\dA-Za-z]+))${rule === "optional" ? "?" : ""}`;
120
+ return { type, re: new RegExp(String.raw `^\s*(${src})${tail}\s*$`, "i") };
121
+ });
122
+ /**
123
+ * If `input` is a standalone NZ delivery-service phrase ("PO Box 24999", "Private Bag 106999", "CMB
124
+ * B99", bare "Private Bag", "Counter Delivery", "Private Box 102"), return the canonical type and
125
+ * identifier. Null otherwise — including for "PB 39990" (an error of form per ADV358).
126
+ *
127
+ * When `type` is "Private Box", the result carries `colloquial: true` — indicating the colloquial
128
+ * alias (not an ADV358 Delivery Service Type; see {@link NZ_PRIVATE_BOX_ALIAS} and operator ruling
129
+ * 2026-06-11). Callers that want only formally-valid ADV358 types should check
130
+ * `!result.colloquial`.
131
+ */
132
+ export function matchNzDeliveryService(input) {
133
+ if (typeof input !== "string")
134
+ return null;
135
+ for (const { type, re } of MATCHERS) {
136
+ const m = re.exec(input);
137
+ if (!m)
138
+ continue;
139
+ const colloquial = type === "Private Box" ? { colloquial: true } : {};
140
+ return { matched: m[1].trim(), type, ...(m[2] ? { id: m[2] } : {}), ...colloquial };
141
+ }
142
+ return null;
143
+ }
144
+ /** Type-predicate: does the input look like a standalone NZ delivery-service address line? */
145
+ export function isNzDeliveryService(input) {
146
+ return matchNzDeliveryService(input) !== null;
147
+ }
148
+ /**
149
+ * Normalize a recognized phrase to the ADV358 form (`"p.o. box 24999"` → `"PO Box 24999"`). Returns
150
+ * the input unchanged if it isn't a delivery-service phrase.
151
+ */
152
+ export function normalizeNzDeliveryService(input) {
153
+ const m = matchNzDeliveryService(input);
154
+ if (!m)
155
+ return input;
156
+ return m.id ? `${m.type} ${m.id.toUpperCase()}` : m.type;
157
+ }
158
+ //# sourceMappingURL=delivery-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-service.js","sourceRoot":"","sources":["../../nz/delivery-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAmBH,oFAAoF;AACpF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACxC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,uBAAuB,EAAE;IACxF,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE;IAC3E,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,sCAAsC,EAAE,UAAU,EAAE,uBAAuB,EAAE;IAClH;QACC,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,0DAA0D;QACvE,UAAU,EAAE,uBAAuB;KACnC;IACD;QACC,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,sDAAsD;QACnE,UAAU,EAAE,UAAU;KACtB;IACD;QACC,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,yDAAyD;QACtE,UAAU,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AC,KAAa;IACvD,MAAM,CAAC,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAA;IACvC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IACpB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACzD,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The New Zealand address system (NZ Post / ISO 3166-2:NZ; ADV358 Address Standards):
7
+ * delivery-service types (PO Box, Private Bag, CMB, Response Bag, Counter Delivery, Poste
8
+ * Restante) and the 4-digit postcode. NZ addresses carry no state/region line.
9
+ */
10
+ export * from "./delivery-service.js";
11
+ export * from "./postcode.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../nz/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The New Zealand address system (NZ Post / ISO 3166-2:NZ; ADV358 Address Standards):
7
+ * delivery-service types (PO Box, Private Bag, CMB, Response Bag, Counter Delivery, Poste
8
+ * Restante) and the 4-digit postcode. NZ addresses carry no state/region line.
9
+ */
10
+ export * from "./delivery-service.js";
11
+ export * from "./postcode.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../nz/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * New Zealand postcodes: four digits, after the town/city on the last line (`Timaru 7942`).
7
+ * Verbatim from NZ Post's Address Standards (ADV358, Oct 2021, accessed 2026-06-11): "Postcode is
8
+ * mandatory and is four digits. It follows the city or town." Note NZ has no state/region line —
9
+ * "The province, region, district or territory is not to be used."
10
+ *
11
+ * The shape collides with Australia's (also 4 digits) — `candidateSystemsForPostcode` returns both,
12
+ * by design (shape test, not membership test).
13
+ * @see {@link https://www.nzpost.co.nz/sites/nz/files/2021-10/adv358-address-standards.pdf NZ Post Address Standards (ADV358, Oct 2021)}
14
+ */
15
+ import type { Tagged } from "type-fest";
16
+ /**
17
+ * A New Zealand postcode: four digits.
18
+ *
19
+ * @category Postal
20
+ * @type string
21
+ * @title New Zealand postcode
22
+ * @pattern ^\d{4}$
23
+ */
24
+ export type NzPostcode = Tagged<string, "NzPostcode">;
25
+ /** The NZ postcode shape: exactly four digits. */
26
+ export declare const NZ_POSTCODE_PATTERN: RegExp;
27
+ /** Normalize a postcode surface form (trim only — NZ has no country-prefix courtesy form). */
28
+ export declare function normalizeNzPostcode(raw: unknown): NzPostcode | null;
29
+ /** Type-predicate for a (normalized) New Zealand postcode. */
30
+ export declare function isNzPostcode(input: unknown): input is NzPostcode;
31
+ //# sourceMappingURL=postcode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postcode.d.ts","sourceRoot":"","sources":["../../nz/postcode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;AAErD,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,QAAY,CAAA;AAE5C,8FAA8F;AAC9F,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAInE;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * New Zealand postcodes: four digits, after the town/city on the last line (`Timaru 7942`).
7
+ * Verbatim from NZ Post's Address Standards (ADV358, Oct 2021, accessed 2026-06-11): "Postcode is
8
+ * mandatory and is four digits. It follows the city or town." Note NZ has no state/region line —
9
+ * "The province, region, district or territory is not to be used."
10
+ *
11
+ * The shape collides with Australia's (also 4 digits) — `candidateSystemsForPostcode` returns both,
12
+ * by design (shape test, not membership test).
13
+ * @see {@link https://www.nzpost.co.nz/sites/nz/files/2021-10/adv358-address-standards.pdf NZ Post Address Standards (ADV358, Oct 2021)}
14
+ */
15
+ /** The NZ postcode shape: exactly four digits. */
16
+ export const NZ_POSTCODE_PATTERN = /^\d{4}$/;
17
+ /** Normalize a postcode surface form (trim only — NZ has no country-prefix courtesy form). */
18
+ export function normalizeNzPostcode(raw) {
19
+ if (typeof raw !== "string")
20
+ return null;
21
+ const s = raw.trim();
22
+ return NZ_POSTCODE_PATTERN.test(s) ? s : null;
23
+ }
24
+ /** Type-predicate for a (normalized) New Zealand postcode. */
25
+ export function isNzPostcode(input) {
26
+ return typeof input === "string" && NZ_POSTCODE_PATTERN.test(input);
27
+ }
28
+ //# sourceMappingURL=postcode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postcode.js","sourceRoot":"","sources":["../../nz/postcode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH,kDAAkD;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAA;AAE5C,8FAA8F;AAC9F,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC/C,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IACxC,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAA;IACpB,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,CAAgB,CAAC,CAAC,CAAC,IAAI,CAAA;AAC9D,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,YAAY,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACpE,CAAC"}
@@ -21,7 +21,7 @@
21
21
  * for".
22
22
  */
23
23
  /** A codex address-system code — the subpath under `@mailwoman/codex/<system>`. */
24
- export type SystemCode = "us" | "de" | "fr" | "ca" | "gb" | "jp";
24
+ export type SystemCode = "us" | "de" | "fr" | "ca" | "gb" | "jp" | "au" | "nz";
25
25
  /**
26
26
  * Every address system whose own postcode shape accepts `postcode`. Empty when no system recognizes
27
27
  * the shape (e.g. a bare `27`, or a 7-digit run). O(number of systems) — a handful of cheap regex
@@ -1 +1 @@
1
- {"version":3,"file":"postcode-systems.d.ts","sourceRoot":"","sources":["../postcode-systems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,mFAAmF;AACnF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAiBhE;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,CAO1E"}
1
+ {"version":3,"file":"postcode-systems.d.ts","sourceRoot":"","sources":["../postcode-systems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAWH,mFAAmF;AACnF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAmB9E;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,CAO1E"}
@@ -20,11 +20,13 @@
20
20
  * call; this function answers the coarser, model-free "which systems is this shape even eligible
21
21
  * for".
22
22
  */
23
+ import { normalizeAuPostcode } from "./au/index.js";
23
24
  import { normalizeCaPostalCode } from "./ca/index.js";
24
25
  import { normalizePLZ } from "./de/index.js";
25
26
  import { normalizeCodePostal } from "./fr/index.js";
26
27
  import { normalizeUkPostcode } from "./gb/index.js";
27
28
  import { normalizeJpPostalCode } from "./jp/index.js";
29
+ import { normalizeNzPostcode } from "./nz/index.js";
28
30
  import { isZipCode } from "./us/index.js";
29
31
  /**
30
32
  * Per-system membership test: each entry returns true when the string is accepted by that system's
@@ -39,6 +41,8 @@ const SYSTEM_ACCEPTS = [
39
41
  ["ca", (s) => normalizeCaPostalCode(s) !== null],
40
42
  ["gb", (s) => normalizeUkPostcode(s) !== null],
41
43
  ["jp", (s) => normalizeJpPostalCode(s) !== null],
44
+ ["au", (s) => normalizeAuPostcode(s) !== null],
45
+ ["nz", (s) => normalizeNzPostcode(s) !== null],
42
46
  ];
43
47
  /**
44
48
  * Every address system whose own postcode shape accepts `postcode`. Empty when no system recognizes
@@ -1 +1 @@
1
- {"version":3,"file":"postcode-systems.js","sourceRoot":"","sources":["../postcode-systems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,SAAS,EA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