@mailwoman/core 10.8.0 → 11.0.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.
Files changed (51) hide show
  1. package/lib/cloudflare/tokens.ts +141 -0
  2. package/lib/cloudflare/wrangler.ts +47 -0
  3. package/lib/cloudflare.ts +10 -0
  4. package/lib/geocode/result.ts +6 -0
  5. package/lib/network/connectivity.ts +112 -0
  6. package/lib/network/reachability.ts +90 -0
  7. package/lib/pipeline/client-result.ts +0 -9
  8. package/lib/resolver/types.ts +76 -47
  9. package/lib/resolver.ts +11 -3
  10. package/lib/scripting/arguments.ts +1 -1
  11. package/lib/scripting/operation.ts +9 -0
  12. package/out/cloudflare/tokens.d.ts +69 -0
  13. package/out/cloudflare/tokens.d.ts.map +1 -0
  14. package/out/cloudflare/tokens.js +80 -0
  15. package/out/cloudflare/tokens.js.map +1 -0
  16. package/out/cloudflare/wrangler.d.ts +24 -0
  17. package/out/cloudflare/wrangler.d.ts.map +1 -0
  18. package/out/cloudflare/wrangler.js +31 -0
  19. package/out/cloudflare/wrangler.js.map +1 -0
  20. package/out/cloudflare.d.ts +10 -0
  21. package/out/cloudflare.d.ts.map +1 -0
  22. package/out/cloudflare.js +10 -0
  23. package/out/cloudflare.js.map +1 -0
  24. package/out/geocode/result.d.ts +2 -0
  25. package/out/geocode/result.d.ts.map +1 -1
  26. package/out/geocode/result.js +6 -0
  27. package/out/geocode/result.js.map +1 -1
  28. package/out/network/connectivity.d.ts +67 -0
  29. package/out/network/connectivity.d.ts.map +1 -0
  30. package/out/network/connectivity.js +71 -0
  31. package/out/network/connectivity.js.map +1 -0
  32. package/out/network/reachability.d.ts +48 -0
  33. package/out/network/reachability.d.ts.map +1 -0
  34. package/out/network/reachability.js +80 -0
  35. package/out/network/reachability.js.map +1 -0
  36. package/out/pipeline/client-result.d.ts +0 -8
  37. package/out/pipeline/client-result.d.ts.map +1 -1
  38. package/out/resolver/types.d.ts +67 -46
  39. package/out/resolver/types.d.ts.map +1 -1
  40. package/out/resolver/types.js +13 -1
  41. package/out/resolver/types.js.map +1 -1
  42. package/out/resolver.d.ts +2 -2
  43. package/out/resolver.d.ts.map +1 -1
  44. package/out/resolver.js +1 -1
  45. package/out/resolver.js.map +1 -1
  46. package/out/scripting/arguments.d.ts +1 -1
  47. package/out/scripting/arguments.d.ts.map +1 -1
  48. package/out/scripting/operation.d.ts +8 -0
  49. package/out/scripting/operation.d.ts.map +1 -1
  50. package/out/scripting/operation.js.map +1 -1
  51. package/package.json +64 -36
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Builds Cloudflare API token requests and the dashboard links that create the same tokens by hand.
6
+ * A permission is declared once with both spellings Cloudflare uses for it: the permission group name the
7
+ * API lists, and the short key a dashboard template link takes.
8
+ */
9
+ /**
10
+ * One permission as the API names it and as a dashboard template link keys it.
11
+ */
12
+ export interface CloudflarePermission {
13
+ /**
14
+ * The permission group's name in `GET /accounts/:id/tokens/permission_groups`.
15
+ *
16
+ * The API spells write access "Write" and the dashboard spells it "Edit".
17
+ * {@linkcode resolvePermissionGroups} matches either.
18
+ */
19
+ group: string;
20
+ /**
21
+ * The `permissionGroupKeys` entry of a dashboard template link.
22
+ */
23
+ key: string;
24
+ type: "read" | "edit" | "purge";
25
+ scope: "account" | "zone";
26
+ }
27
+ /**
28
+ * A permission group as `GET /accounts/:id/tokens/permission_groups` returns it.
29
+ */
30
+ export interface PermissionGroup {
31
+ id: string;
32
+ name: string;
33
+ }
34
+ export interface TokenPolicy {
35
+ effect: "allow";
36
+ resources: Record<string, string>;
37
+ permission_groups: PermissionGroup[];
38
+ }
39
+ export interface TokenRequest {
40
+ name: string;
41
+ policies: TokenPolicy[];
42
+ }
43
+ /**
44
+ * A dashboard link that opens the account-owned token form with `permissions` and `name` filled in.
45
+ *
46
+ * The form asks which account when the viewer belongs to several.
47
+ * A template link cannot preset a zone, so a token with a zone permission asks the viewer to pick the zone.
48
+ */
49
+ export declare function tokenTemplateLink(name: string, permissions: readonly CloudflarePermission[]): string;
50
+ /**
51
+ * The permission group of each of `permissions`, matched by name.
52
+ *
53
+ * Throws naming every permission without a group, so a renamed group stops a mint before any token exists.
54
+ */
55
+ export declare function resolvePermissionGroups(permissions: readonly CloudflarePermission[], groups: readonly PermissionGroup[]): Map<CloudflarePermission, PermissionGroup>;
56
+ /**
57
+ * The request body that creates a token holding `permissions`.
58
+ *
59
+ * Account permissions apply to `accountID` and zone permissions to `zoneID`, one policy each.
60
+ * A token with no permission of a scope gets no policy for it.
61
+ */
62
+ export declare function tokenRequestBody(options: {
63
+ name: string;
64
+ permissions: readonly CloudflarePermission[];
65
+ groups: Map<CloudflarePermission, PermissionGroup>;
66
+ accountID: string;
67
+ zoneID?: string;
68
+ }): TokenRequest;
69
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../lib/cloudflare/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;IAC/B,KAAK,EAAE,SAAS,GAAG,MAAM,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,iBAAiB,EAAE,eAAe,EAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,EAAE,CAAA;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAMpG;AAMD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACtC,WAAW,EAAE,SAAS,oBAAoB,EAAE,EAC5C,MAAM,EAAE,SAAS,eAAe,EAAE,GAChC,GAAG,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAoB5C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAA;IAC5C,MAAM,EAAE,GAAG,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAA;IAClD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,YAAY,CA6Bf"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Builds Cloudflare API token requests and the dashboard links that create the same tokens by hand.
6
+ * A permission is declared once with both spellings Cloudflare uses for it: the permission group name the
7
+ * API lists, and the short key a dashboard template link takes.
8
+ */
9
+ import { stringifyJSON } from "#json";
10
+ const DASHBOARD = "https://dash.cloudflare.com/";
11
+ /**
12
+ * A dashboard link that opens the account-owned token form with `permissions` and `name` filled in.
13
+ *
14
+ * The form asks which account when the viewer belongs to several.
15
+ * A template link cannot preset a zone, so a token with a zone permission asks the viewer to pick the zone.
16
+ */
17
+ export function tokenTemplateLink(name, permissions) {
18
+ const keys = permissions.map((permission) => ({ key: permission.key, type: permission.type }));
19
+ const query = new URLSearchParams({ permissionGroupKeys: stringifyJSON(keys), name });
20
+ // The dashboard reads `to` unencoded, as Cloudflare's own template links write it.
21
+ return `${DASHBOARD}?to=/:account/api-tokens&${query.toString().replaceAll("+", "%20")}`;
22
+ }
23
+ function groupNameKey(name) {
24
+ return name.replace(/ (Write|Edit)$/u, " write").toLowerCase();
25
+ }
26
+ /**
27
+ * The permission group of each of `permissions`, matched by name.
28
+ *
29
+ * Throws naming every permission without a group, so a renamed group stops a mint before any token exists.
30
+ */
31
+ export function resolvePermissionGroups(permissions, groups) {
32
+ const byName = new Map(groups.map((group) => [groupNameKey(group.name), group]));
33
+ const resolved = new Map();
34
+ const missing = [];
35
+ for (const permission of permissions) {
36
+ const group = byName.get(groupNameKey(permission.group));
37
+ if (group) {
38
+ resolved.set(permission, group);
39
+ }
40
+ else {
41
+ missing.push(permission.group);
42
+ }
43
+ }
44
+ if (missing.length) {
45
+ throw new Error(`Cloudflare lists no permission group named ${missing.map((name) => `"${name}"`).join(", ")}`);
46
+ }
47
+ return resolved;
48
+ }
49
+ /**
50
+ * The request body that creates a token holding `permissions`.
51
+ *
52
+ * Account permissions apply to `accountID` and zone permissions to `zoneID`, one policy each.
53
+ * A token with no permission of a scope gets no policy for it.
54
+ */
55
+ export function tokenRequestBody(options) {
56
+ const { name, permissions, groups, accountID, zoneID } = options;
57
+ if (!zoneID && permissions.some((permission) => permission.scope === "zone")) {
58
+ throw new Error(`token "${name}" holds a zone permission and no zone was given`);
59
+ }
60
+ const resources = {
61
+ account: { [`com.cloudflare.api.account.${accountID}`]: "*" },
62
+ zone: { [`com.cloudflare.api.account.zone.${zoneID}`]: "*" },
63
+ };
64
+ const policies = ["account", "zone"]
65
+ .map((scope) => ({
66
+ effect: "allow",
67
+ resources: resources[scope],
68
+ permission_groups: permissions
69
+ .filter((permission) => permission.scope === scope)
70
+ .map((permission) => {
71
+ const group = groups.get(permission);
72
+ if (!group)
73
+ throw new Error(`no permission group resolved for "${permission.group}"`);
74
+ return { id: group.id, name: group.name };
75
+ }),
76
+ }))
77
+ .filter((policy) => policy.permission_groups.length);
78
+ return { name, policies };
79
+ }
80
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+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AC3B,iBAAiB,EAAE,WAAW;aAC5B,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,KAAK,KAAK,CAAC;aAClD,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;YACnB,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;YAEpC,IAAI,CAAC,KAAK;gBAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,UAAU,CAAC,KAAK,GAAG,CAAC,CAAA;YAErF,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAA;QAC1C,CAAC,CAAC;KACH,CAAC,CAAC;SACF,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAErD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;AAC1B,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * R2 uploads through `wrangler r2 object put`. Wrangler reads `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`
7
+ * from the environment. `wrangler` is an optional peer dependency of this package, so a caller installs it.
8
+ */
9
+ /**
10
+ * The largest object `wrangler r2 object put` accepts.
11
+ * A larger file goes through rclone.
12
+ */
13
+ export declare const WRANGLER_OBJECT_CAP_BYTES: number;
14
+ /**
15
+ * Put one local file at `bucket/key` on R2.
16
+ *
17
+ * Throws before running wrangler when the file exceeds {@linkcode WRANGLER_OBJECT_CAP_BYTES}.
18
+ */
19
+ export declare function putR2ObjectWithWrangler({ file, bucket, key, }: {
20
+ file: string;
21
+ bucket: string;
22
+ key: string;
23
+ }): Promise<void>;
24
+ //# sourceMappingURL=wrangler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrangler.d.ts","sourceRoot":"","sources":["../../lib/cloudflare/wrangler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAoB,CAAA;AAE1D;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,EAC7C,IAAI,EACJ,MAAM,EACN,GAAG,GACH,EAAE;IACF,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;CACX,GAAG,OAAO,CAAC,IAAI,CAAC,CAYhB"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * R2 uploads through `wrangler r2 object put`. Wrangler reads `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`
7
+ * from the environment. `wrangler` is an optional peer dependency of this package, so a caller installs it.
8
+ */
9
+ import { resolvePath } from "path-ts";
10
+ import { statPath } from "#fs/readers/stat";
11
+ import { resolvePackageDirectory } from "#module/resolvers";
12
+ import { runFile } from "#process";
13
+ /**
14
+ * The largest object `wrangler r2 object put` accepts.
15
+ * A larger file goes through rclone.
16
+ */
17
+ export const WRANGLER_OBJECT_CAP_BYTES = 300 * 1024 * 1024;
18
+ /**
19
+ * Put one local file at `bucket/key` on R2.
20
+ *
21
+ * Throws before running wrangler when the file exceeds {@linkcode WRANGLER_OBJECT_CAP_BYTES}.
22
+ */
23
+ export async function putR2ObjectWithWrangler({ file, bucket, key, }) {
24
+ const { size } = await statPath(file);
25
+ if (size > WRANGLER_OBJECT_CAP_BYTES) {
26
+ throw new Error(`${file} is ${size.toLocaleString()} bytes; wrangler puts objects up to ${WRANGLER_OBJECT_CAP_BYTES.toLocaleString()}, so publish it through rclone`);
27
+ }
28
+ const bin = resolvePath(resolvePackageDirectory("wrangler"), "bin", "wrangler.js");
29
+ await runFile("node", [bin, "r2", "object", "put", `${bucket}/${key}`, "--file", file, "--remote"]);
30
+ }
31
+ //# sourceMappingURL=wrangler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrangler.js","sourceRoot":"","sources":["../../lib/cloudflare/wrangler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAElC;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAA;AAE1D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,EAC7C,IAAI,EACJ,MAAM,EACN,GAAG,GAKH;IACA,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;IAErC,IAAI,IAAI,GAAG,yBAAyB,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACd,GAAG,IAAI,OAAO,IAAI,CAAC,cAAc,EAAE,uCAAuC,yBAAyB,CAAC,cAAc,EAAE,gCAAgC,CACpJ,CAAA;IACF,CAAC;IAED,MAAM,GAAG,GAAG,WAAW,CAAC,uBAAuB,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAA;IAElF,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAA;AACpG,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Cloudflare token request builders and the wrangler R2 upload. API calls go through the `cloudflare` SDK.
7
+ */
8
+ export * from "#cloudflare/tokens";
9
+ export * from "#cloudflare/wrangler";
10
+ //# sourceMappingURL=cloudflare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../lib/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Cloudflare token request builders and the wrangler R2 upload. API calls go through the `cloudflare` SDK.
7
+ */
8
+ export * from "#cloudflare/tokens";
9
+ export * from "#cloudflare/wrangler";
10
+ //# sourceMappingURL=cloudflare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudflare.js","sourceRoot":"","sources":["../lib/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA"}
@@ -45,6 +45,7 @@ export declare const GeocodeCandidateSchema: z.ZodObject<{
45
45
  countryCode: z.ZodNullable<z.ZodString>;
46
46
  placeID: z.ZodNullable<z.ZodString>;
47
47
  score: z.ZodNullable<z.ZodNumber>;
48
+ matchedAlias: z.ZodOptional<z.ZodLiteral<true>>;
48
49
  }, z.core.$strip>;
49
50
  export type GeocodeCandidate = z.infer<typeof GeocodeCandidateSchema>;
50
51
  /**
@@ -433,6 +434,7 @@ export declare const GeocodeResultSchema: z.ZodObject<{
433
434
  countryCode: z.ZodNullable<z.ZodString>;
434
435
  placeID: z.ZodNullable<z.ZodString>;
435
436
  score: z.ZodNullable<z.ZodNumber>;
437
+ matchedAlias: z.ZodOptional<z.ZodLiteral<true>>;
436
438
  }, z.core.$strip>>;
437
439
  postcode_country_scope: z.ZodNullable<z.ZodString>;
438
440
  capital_promotion: z.ZodNullable<z.Zod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AM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
@@ -62,6 +62,12 @@ export const GeocodeCandidateSchema = z
62
62
  * The field is null when the resolver recorded no score for the candidate.
63
63
  */
64
64
  score: z.number().nullable(),
65
+ /**
66
+ * True when the input matched an alias of this place, such as a former name, and differs from `name`.
67
+ *
68
+ * The field is absent when the input matched the primary name.
69
+ */
70
+ matchedAlias: z.literal(true).optional(),
65
71
  })
66
72
  .meta({ id: "GeocodeCandidate", description: "A ranked candidate place." });
67
73
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../../lib/geocode/result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACvF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAEzD;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KACnC,IAAI,CAAC,gBAAgB,CAAC;KACtB,IAAI,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC,CAAA;AAEhG;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KACnC,MAAM,CAAC;IACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,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B,CAAC;IAEhD;;;;;;OAMG;IACH,eAAe,EAAE,0BAA0B,CAAC,QAAQ,EAAE;IAEtD;;;;;OAKG;IACH,aAAa,EAAE,4BAA4B,CAAC,QAAQ,EAAE;CACtD,CAAC;KACD,IAAI,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE,oEAAoE,EAAE,CAAC,CAAA"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file The two connectivity signals a browser client reads before it sends a request, and the error a client raises
6
+ * when they say the request cannot reach its service.
7
+ */
8
+ import { ResourceError } from "#errors/schema";
9
+ /**
10
+ * What a client knows about its connection, from two independent sources.
11
+ *
12
+ * `null` means the source is unavailable or has not reported yet.
13
+ * A reading of `false` means the source reported a failure.
14
+ */
15
+ export interface ConnectivityReading {
16
+ /**
17
+ * `navigator.onLine`: `false` when the device has no network interface up.
18
+ *
19
+ * `true` reports only that an interface is up.
20
+ * A captive portal or a network with no route out still reads `true`.
21
+ */
22
+ online: boolean | null;
23
+ /**
24
+ * Whether the latest reachability probe of the service succeeded.
25
+ */
26
+ reachable: boolean | null;
27
+ }
28
+ /**
29
+ * The reading a client assumes before either source reports: both signals unknown.
30
+ */
31
+ export declare const UNKNOWN_CONNECTIVITY: ConnectivityReading;
32
+ /**
33
+ * `navigator.onLine`, or `null` on a runtime whose `navigator` lacks it.
34
+ *
35
+ * Node 21 and later define `navigator` without `onLine`, and workerd's `navigator` lacks
36
+ * it too, so the absent property reads as unknown there rather than as offline.
37
+ */
38
+ export declare function readNavigatorOnline(): boolean | null;
39
+ /**
40
+ * Why a reading rules out a request to its service.
41
+ */
42
+ export declare const OfflineReason: {
43
+ /**
44
+ * The device reports no network interface up.
45
+ */
46
+ readonly Offline: "offline";
47
+ /**
48
+ * The device has a network, and the service's reachability probe failed.
49
+ */
50
+ readonly Unreachable: "service-unreachable";
51
+ };
52
+ export type OfflineReason = (typeof OfflineReason)[keyof typeof OfflineReason];
53
+ /**
54
+ * The reason a reading rules out a request, or `null` when the reading allows one or is unknown.
55
+ */
56
+ export declare function offlineReason(reading: ConnectivityReading): OfflineReason | null;
57
+ /**
58
+ * A 503 {@linkcode ResourceError} of kind `network` for a request that a connectivity reading ruled out.
59
+ *
60
+ * The `network` kind segment matches `ResourceErrorKind.Network`, the kind `APIClient`
61
+ * assigns a responseless failure, so `isTransientResourceError` reports it as transient
62
+ * and a caller that requeues network failures requeues this one.
63
+ * The URN is `connectivity:network:<reason>`, and `cause` holds the failure
64
+ * that prompted the check, if one did.
65
+ */
66
+ export declare function offlineResourceError(reason: OfflineReason, cause?: unknown): ResourceError;
67
+ //# sourceMappingURL=connectivity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectivity.d.ts","sourceRoot":"","sources":["../../lib/network/connectivity.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;IAEtB;;OAEG;IACH,SAAS,EAAE,OAAO,GAAG,IAAI,CAAA;CACzB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,mBAAuD,CAAA;AAE1F;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,GAAG,IAAI,CAKpD;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;IACzB;;OAEG;aACH,OAAO,EAAE,SAAS;IAClB;;OAEG;aACH,WAAW,EAAE,qBAAqB;CACzB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAA;AAE9E;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa,GAAG,IAAI,CAMhF;AAYD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,aAAa,CAc1F"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file The two connectivity signals a browser client reads before it sends a request, and the error a client raises
6
+ * when they say the request cannot reach its service.
7
+ */
8
+ import { ResourceError } from "#errors/schema";
9
+ /**
10
+ * The reading a client assumes before either source reports: both signals unknown.
11
+ */
12
+ export const UNKNOWN_CONNECTIVITY = { online: null, reachable: null };
13
+ /**
14
+ * `navigator.onLine`, or `null` on a runtime whose `navigator` lacks it.
15
+ *
16
+ * Node 21 and later define `navigator` without `onLine`, and workerd's `navigator` lacks
17
+ * it too, so the absent property reads as unknown there rather than as offline.
18
+ */
19
+ export function readNavigatorOnline() {
20
+ const navigatorLike = globalThis.navigator;
21
+ const online = navigatorLike?.onLine;
22
+ return typeof online === "boolean" ? online : null;
23
+ }
24
+ /**
25
+ * Why a reading rules out a request to its service.
26
+ */
27
+ export const OfflineReason = {
28
+ /**
29
+ * The device reports no network interface up.
30
+ */
31
+ Offline: "offline",
32
+ /**
33
+ * The device has a network, and the service's reachability probe failed.
34
+ */
35
+ Unreachable: "service-unreachable",
36
+ };
37
+ /**
38
+ * The reason a reading rules out a request, or `null` when the reading allows one or is unknown.
39
+ */
40
+ export function offlineReason(reading) {
41
+ if (reading.online === false)
42
+ return OfflineReason.Offline;
43
+ if (reading.reachable === false)
44
+ return OfflineReason.Unreachable;
45
+ return null;
46
+ }
47
+ /**
48
+ * The URN source segment of an error {@linkcode offlineResourceError} builds.
49
+ */
50
+ const CONNECTIVITY_ERROR_SOURCE = "connectivity";
51
+ const OFFLINE_MESSAGES = {
52
+ [OfflineReason.Offline]: "This device is offline.",
53
+ [OfflineReason.Unreachable]: "This device has a network connection, but the service did not answer.",
54
+ };
55
+ /**
56
+ * A 503 {@linkcode ResourceError} of kind `network` for a request that a connectivity reading ruled out.
57
+ *
58
+ * The `network` kind segment matches `ResourceErrorKind.Network`, the kind `APIClient`
59
+ * assigns a responseless failure, so `isTransientResourceError` reports it as transient
60
+ * and a caller that requeues network failures requeues this one.
61
+ * The URN is `connectivity:network:<reason>`, and `cause` holds the failure
62
+ * that prompted the check, if one did.
63
+ */
64
+ export function offlineResourceError(reason, cause) {
65
+ const error = ResourceError.from(503, OFFLINE_MESSAGES[reason], CONNECTIVITY_ERROR_SOURCE, "network", reason);
66
+ if (cause != null) {
67
+ error.cause = cause;
68
+ }
69
+ return error;
70
+ }
71
+ //# sourceMappingURL=connectivity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectivity.js","sourceRoot":"","sources":["../../lib/network/connectivity.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAuB9C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwB,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AAE1F;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IAClC,MAAM,aAAa,GAAI,UAAmD,CAAC,SAAS,CAAA;IACpF,MAAM,MAAM,GAAG,aAAa,EAAE,MAAM,CAAA;IAEpC,OAAO,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B;;OAEG;IACH,OAAO,EAAE,SAAS;IAClB;;OAEG;IACH,WAAW,EAAE,qBAAqB;CACzB,CAAA;AAIV;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAA4B;IACzD,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK;QAAE,OAAO,aAAa,CAAC,OAAO,CAAA;IAE1D,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK;QAAE,OAAO,aAAa,CAAC,WAAW,CAAA;IAEjE,OAAO,IAAI,CAAA;AACZ,CAAC;AAED;;GAEG;AACH,MAAM,yBAAyB,GAAG,cAAc,CAAA;AAEhD,MAAM,gBAAgB,GAAkC;IACvD,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,yBAAyB;IAClD,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,uEAAuE;CACpG,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAqB,EAAE,KAAe;IAC1E,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAC/B,GAAkB,EAClB,gBAAgB,CAAC,MAAM,CAAC,EACxB,yBAAyB,EACzB,SAAS,EACT,MAAM,CACN,CAAA;IAED,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QACnB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,OAAO,KAAK,CAAA;AACb,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Tests whether a service answers by requesting one of its routes.
6
+ */
7
+ /**
8
+ * The milliseconds {@linkcode ReachabilityProbe.test} waits for a response
9
+ * before it reports the service unreachable.
10
+ */
11
+ export declare const DEFAULT_REACHABILITY_TIMEOUT_MS = 5000;
12
+ /**
13
+ * A probe that tests whether a service answers, by requesting a route on it.
14
+ *
15
+ * Probe the service the caller depends on, such as the geocoder API's `/health` route,
16
+ * rather than a third party's connectivity endpoint.
17
+ * A third-party endpoint reports whether the internet is reachable,
18
+ * and the service can be down while it answers.
19
+ *
20
+ * Each probe of a third-party endpoint also sends the user's IP address to that party.
21
+ *
22
+ * The request runs in `cors` mode, so the status is readable.
23
+ * A captive portal's interception of an HTTPS request fails the TLS handshake,
24
+ * and the probe reports that as unreachable.
25
+ */
26
+ export declare class ReachabilityProbe implements Disposable {
27
+ #private;
28
+ protected readonly url: string;
29
+ /**
30
+ * @param url The route to request.
31
+ * It must answer CORS requests from the page's origin.
32
+ */
33
+ constructor(url: string | URL);
34
+ [Symbol.dispose]: () => void;
35
+ /**
36
+ * Cancels the test in flight.
37
+ * The cancelled test resolves `false`.
38
+ */
39
+ abort: () => void;
40
+ /**
41
+ * Resolves `true` when the route answers with a 2xx status, and `false` on any
42
+ * other status, a network failure or a timeout.
43
+ *
44
+ * A new test cancels the previous one.
45
+ */
46
+ test: (requestTimeout?: number, requestInit?: RequestInit) => Promise<boolean>;
47
+ }
48
+ //# sourceMappingURL=reachability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reachability.d.ts","sourceRoot":"","sources":["../../lib/network/reachability.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,+BAA+B,OAAO,CAAA;AAEnD;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAkB,YAAW,UAAU;;IAEnD,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IAE9B;;;OAGG;IACH,YAAY,GAAG,EAAE,MAAM,GAAG,GAAG,EAE5B;IAEM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAO,IAAI,CAAgB;IAElD;;;OAGG;IACI,KAAK,QAAO,IAAI,CAEtB;IAED;;;;;OAKG;IACI,IAAI,0CAAoE,WAAW,KAAG,OAAO,CAAC,OAAO,CAAC,CAiC5G;CACD"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Tests whether a service answers by requesting one of its routes.
6
+ */
7
+ /**
8
+ * The milliseconds {@linkcode ReachabilityProbe.test} waits for a response
9
+ * before it reports the service unreachable.
10
+ */
11
+ export const DEFAULT_REACHABILITY_TIMEOUT_MS = 5000;
12
+ /**
13
+ * A probe that tests whether a service answers, by requesting a route on it.
14
+ *
15
+ * Probe the service the caller depends on, such as the geocoder API's `/health` route,
16
+ * rather than a third party's connectivity endpoint.
17
+ * A third-party endpoint reports whether the internet is reachable,
18
+ * and the service can be down while it answers.
19
+ *
20
+ * Each probe of a third-party endpoint also sends the user's IP address to that party.
21
+ *
22
+ * The request runs in `cors` mode, so the status is readable.
23
+ * A captive portal's interception of an HTTPS request fails the TLS handshake,
24
+ * and the probe reports that as unreachable.
25
+ */
26
+ export class ReachabilityProbe {
27
+ #abortController = null;
28
+ url;
29
+ /**
30
+ * @param url The route to request.
31
+ * It must answer CORS requests from the page's origin.
32
+ */
33
+ constructor(url) {
34
+ this.url = String(url);
35
+ }
36
+ [Symbol.dispose] = () => this.abort();
37
+ /**
38
+ * Cancels the test in flight.
39
+ * The cancelled test resolves `false`.
40
+ */
41
+ abort = () => {
42
+ this.#abortController?.abort();
43
+ };
44
+ /**
45
+ * Resolves `true` when the route answers with a 2xx status, and `false` on any
46
+ * other status, a network failure or a timeout.
47
+ *
48
+ * A new test cancels the previous one.
49
+ */
50
+ test = (requestTimeout = DEFAULT_REACHABILITY_TIMEOUT_MS, requestInit) => {
51
+ this.abort();
52
+ const controller = new AbortController();
53
+ this.#abortController = controller;
54
+ return (
55
+ // `AbortSignal.any` and `fetch` can throw synchronously, and the chain turns that into `false`.
56
+ Promise.resolve()
57
+ .then(() => {
58
+ const signals = [controller.signal, AbortSignal.timeout(requestTimeout)];
59
+ if (requestInit?.signal) {
60
+ signals.push(requestInit.signal);
61
+ }
62
+ return fetch(this.url, {
63
+ method: "GET",
64
+ credentials: "omit",
65
+ mode: "cors",
66
+ cache: "no-store",
67
+ ...requestInit,
68
+ signal: AbortSignal.any(signals),
69
+ });
70
+ })
71
+ .then((response) => response.ok)
72
+ .catch(() => false)
73
+ .finally(() => {
74
+ if (this.#abortController === controller) {
75
+ this.#abortController = null;
76
+ }
77
+ }));
78
+ };
79
+ }
80
+ //# sourceMappingURL=reachability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reachability.js","sourceRoot":"","sources":["../../lib/network/reachability.ts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G,CAAC,OAAO,CAAC;aAChC,CAAC,CAAA;QACH,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;aAC/B,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;aAClB,OAAO,CAAC,GAAG,EAAE;YACb,IAAI,IAAI,CAAC,gBAAgB,KAAK,UAAU,EAAE,CAAC;gBAC1C,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAA;YAC7B,CAAC;QACF,CAAC,CAAC,CACH,CAAA;IACF,CAAC,CAAA;CACD"}
@@ -41,13 +41,6 @@ export interface ResolvedPlaceView {
41
41
  tier: "address_point" | "interpolated" | null;
42
42
  uncertaintyM: number | null;
43
43
  }
44
- export interface DualRoleView {
45
- id: number;
46
- name: string;
47
- placetype: string;
48
- relationshipType: string;
49
- role: string;
50
- }
51
44
  export interface StageTiming {
52
45
  shape: number;
53
46
  classify: number;
@@ -88,6 +81,5 @@ export interface ParseResult {
88
81
  candidates: ResolvedPlaceView[];
89
82
  fstActive: boolean;
90
83
  fstProvenance: FSTProvenance | null;
91
- dualRoles: DualRoleView[] | null;
92
84
  }
93
85
  //# sourceMappingURL=client-result.d.ts.map