@serve.zone/interfaces 32.88.0 → 32.90.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 (43) hide show
  1. package/changelog.md +22 -0
  2. package/dist_ts/00_commitinfo_data.js +1 -1
  3. package/dist_ts/data/cloudaccess.d.ts +402 -0
  4. package/dist_ts/data/cloudaccess.js +685 -0
  5. package/dist_ts/data/cloudlyconfig.d.ts +20 -0
  6. package/dist_ts/data/cloudlyconfig.js +21 -1
  7. package/dist_ts/data/gatewayareas.d.ts +120 -22
  8. package/dist_ts/data/gatewayareas.js +36 -1
  9. package/dist_ts/data/gatewayareas.validation.js +203 -42
  10. package/dist_ts/data/gatewayconnector.d.ts +2 -2
  11. package/dist_ts/data/gatewayconnector.js +20 -1
  12. package/dist_ts/data/gatewayintent.d.ts +181 -0
  13. package/dist_ts/data/gatewayintent.js +67 -0
  14. package/dist_ts/data/index.d.ts +2 -0
  15. package/dist_ts/data/index.js +3 -1
  16. package/dist_ts/data/mail.d.ts +6 -1
  17. package/dist_ts/data/mail.js +1 -1
  18. package/dist_ts/data/witness.js +4 -9
  19. package/dist_ts/private/bearerencoding.d.ts +9 -0
  20. package/dist_ts/private/bearerencoding.js +17 -0
  21. package/dist_ts/private/storagecontract.js +3 -3
  22. package/dist_ts/requests/cloudaccess.d.ts +125 -0
  23. package/dist_ts/requests/cloudaccess.js +2 -0
  24. package/dist_ts/requests/gatewayconnector.d.ts +33 -1
  25. package/dist_ts/requests/index.d.ts +2 -1
  26. package/dist_ts/requests/index.js +3 -2
  27. package/package.json +1 -1
  28. package/readme.md +155 -11
  29. package/ts/00_commitinfo_data.ts +1 -1
  30. package/ts/data/cloudaccess.ts +1133 -0
  31. package/ts/data/cloudlyconfig.ts +27 -0
  32. package/ts/data/gatewayareas.ts +88 -22
  33. package/ts/data/gatewayareas.validation.ts +225 -40
  34. package/ts/data/gatewayconnector.ts +19 -0
  35. package/ts/data/gatewayintent.ts +239 -0
  36. package/ts/data/index.ts +2 -0
  37. package/ts/data/mail.ts +6 -1
  38. package/ts/data/witness.ts +3 -10
  39. package/ts/private/bearerencoding.ts +24 -0
  40. package/ts/private/storagecontract.ts +2 -2
  41. package/ts/requests/cloudaccess.ts +201 -0
  42. package/ts/requests/gatewayconnector.ts +41 -1
  43. package/ts/requests/index.ts +2 -0
@@ -177,6 +177,33 @@ export const cloudlyHostOptionalEnvironment = Object.freeze([
177
177
  /** One variable the Cloudly server reads but starts without. */
178
178
  export type TCloudlyHostOptionalEnvironmentName = typeof cloudlyHostOptionalEnvironment[number];
179
179
 
180
+ /**
181
+ * The host extras a host can advertise to the Cloudly it runs (Linus ruling 13, amendment points
182
+ * 12 and 17): optional offers Cloudly uses only when the host advertises them, never a precondition
183
+ * for its start or run, and never inferred from the host type (`SERVEZONE_APP_HOST_TYPE`) or by
184
+ * probing the environment.
185
+ *
186
+ * `relayIngress` (Linus ruling 141 C7): the host serves `SERVEZONE_PUBLIC_ORIGIN`'s TLS on a second
187
+ * listener the Cloudly container can reach and forwards that listener only to Cloudly's relayed
188
+ * port, which serves the human surface only; a request accepted there is relayed. Cloud access can
189
+ * be started only on a host that advertises it.
190
+ *
191
+ * No carrier advertises an extra yet, so none can be advertised or read (amendment 141a): ruling 15
192
+ * point 4 names the carrier, `IHostedAppLifecycleState.hostExtras`, which this package does not
193
+ * declare yet, and no environment variable of either list names the relayed port yet.
194
+ */
195
+ export const cloudlyHostExtras = Object.freeze([
196
+ 'relayIngress',
197
+ ] as const);
198
+
199
+ /** One host extra. */
200
+ export type TCloudlyHostExtra = typeof cloudlyHostExtras[number];
201
+
202
+ /** True for one of `cloudlyHostExtras`. */
203
+ export const isCloudlyHostExtra = (valueArg: unknown): valueArg is TCloudlyHostExtra => (
204
+ (cloudlyHostExtras as readonly unknown[]).includes(valueArg)
205
+ );
206
+
180
207
  /**
181
208
  * Cloudly's health path on its listen port (`GET` or `HEAD`). It answers 200 with
182
209
  * `{ healthy: true, checks }` while Cloudly runs and 503 otherwise; it states no version. Cloudly
@@ -449,16 +449,30 @@ export interface IGatewayDnsRecordRow {
449
449
  /** A `dcrouter`-source row of `domains`. */
450
450
  domainId: string;
451
451
  /**
452
- * Inside its zone: the zone's `name` itself, or a name that ends in `.` and the zone's `name`,
453
- * compared as written.
452
+ * At most 253 characters of lowercase labels (letters, digits, `_` and inner `-`, 1 to 63
453
+ * characters, as a zone's), no trailing dot; the leftmost label may instead be exactly `*`, with at
454
+ * least one label after it (Linus ruling 129). Inside its zone: the zone's `name` itself, or a name
455
+ * that ends in `.` and the zone's `name`, compared as written. A name outside the form is refused,
456
+ * never repaired; whether a gateway answers a `*` name as a wildcard is the gateway's to state.
454
457
  */
455
458
  name: string;
456
459
  type: TGatewayDnsRecordType;
457
460
  /**
458
- * The record value in the gateway's value syntax. An `A` value is one dotted IPv4 address (four
459
- * decimal octets of one to three digits, each at most 255) and an `AAAA` value one IPv6 address in
460
- * hex groups of one to four digits, either case, eight groups or fewer with exactly one `::`, no
461
- * IPv4 tail and no zone id: the forms the gateway's DNS encoder takes, with nothing around them.
461
+ * The record value in its one spelling per type, the one the gateway's record value owner emits
462
+ * (Linus ruling 129):
463
+ *
464
+ * - `A`: one IPv4 address as a dotted quad without leading zeros. `AAAA`: one IPv6 address in its
465
+ * RFC 5952 text (lowercase hex groups without leading zeros, the longest run of two or more
466
+ * zero groups written `::`, the first run on a tie), no IPv4 tail and no zone id. The contract's
467
+ * canonical address text, with nothing around it (Linus ruling 143 B): another spelling of the
468
+ * same address is refused, and any address of the family is a value.
469
+ * - `CNAME`, `NS`: one domain name: lowercase, no trailing dot, no whitespace, no empty label,
470
+ * each label at most 63 octets and the name at most 253.
471
+ * - `MX`: `<preference> <exchange>` with one space between: the preference 0 to 65535 without a
472
+ * leading zero, the exchange such a name, or `0 .` for a null MX.
473
+ * - `SOA`: `<mname> <rname> <serial> <refresh> <retry> <expire> <minimum>` with one space between
474
+ * each: two such names and five numbers from 0 to 4294967295 without a leading zero.
475
+ * - `CAA`: a text without whitespace around it. `TXT`: the text itself.
462
476
  */
463
477
  value: string;
464
478
  /** Seconds, positive. */
@@ -472,9 +486,10 @@ export interface IGatewayDnsRecordRow {
472
486
  export interface IGatewayDnsStaticRecordRow {
473
487
  /** `static-` followed by 64 lowercase hex digits. */
474
488
  id: string;
489
+ /** The name form of `IGatewayDnsRecordRow.name`; a static record belongs to no zone row. */
475
490
  name: string;
476
491
  type: TGatewayDnsStaticRecordType;
477
- /** As `IGatewayDnsRecordRow.value`, the `A` and `AAAA` forms included. */
492
+ /** As `IGatewayDnsRecordRow.value`: the one spelling of its type. */
478
493
  value: string;
479
494
  /** Seconds; `null` for the gateway's default. */
480
495
  ttl: number | null;
@@ -486,6 +501,7 @@ export interface IGatewayDnsStaticRecordRow {
486
501
  export interface IGatewayDnsProtectedHostnameRow {
487
502
  /** The exact hostname: lowercase, no trailing dot, no wildcard. */
488
503
  id: string;
504
+ /** Without whitespace around it: the gateway stores a reason trimmed. */
489
505
  reason: string;
490
506
  }
491
507
 
@@ -529,7 +545,8 @@ export interface IGatewayDnsArea {
529
545
  protectedHostnames: IGatewayDnsProtectedHostnameRow[];
530
546
  /**
531
547
  * Zones the gateway may answer for once it has proven their delegation itself, keyed by zone
532
- * name. The proof and its evidence stay on the gateway; it serves the proven ones.
548
+ * name: at least two labels of letters, digits and inner hyphens (no `_`), the form a delegation
549
+ * names. The proof and its evidence stay on the gateway; it serves the proven ones.
533
550
  */
534
551
  authorityZones: IGatewayAreaKeyRow[];
535
552
  clientHostnames: IGatewayDnsClientHostnameRow[];
@@ -624,7 +641,9 @@ export interface IGatewayRouteRemoteIngress {
624
641
  * `security.basicAuth` and `security.jwtAuth` stay in the route as objects without their secret, and
625
642
  * the validator holds "the object exactly when its secret is set": there is no representation of a
626
643
  * basic-auth object with an empty user list or a JWT object without a secret. A gateway that stores
627
- * one refuses to export it, by name (Linus ruling 124, part 2 (iii)).
644
+ * one refuses to export it, by name (Linus ruling 124, part 2 (iii)). Without its secret the member
645
+ * is absent: one that is present in another spelling (`basicAuth: null`, a text, a number) is
646
+ * refused `secret-engine-mismatch` at the secret's path, like an object without its secret.
628
647
  */
629
648
  export interface IGatewayRouteSecrets {
630
649
  /** `action.tls.certificate.key`; set exactly when `action.tls.certificate` is an object. */
@@ -688,8 +707,9 @@ export interface IGatewayRouteRow {
688
707
 
689
708
  /**
690
709
  * The secrets lifted out of a source profile's security, under the same rule as
691
- * `IGatewayRouteSecrets`: `basicAuth` and `jwtAuth` are objects exactly when their secret is set, and
692
- * a gateway refuses to export an empty user list or a secret-less JWT object, by name.
710
+ * `IGatewayRouteSecrets`: `basicAuth` and `jwtAuth` are objects exactly when their secret is set and
711
+ * absent otherwise, and a gateway refuses to export an empty user list or a secret-less JWT object,
712
+ * by name.
693
713
  */
694
714
  export interface IGatewaySourceProfileSecrets {
695
715
  /** `security.basicAuth.users`, the whole list; set exactly with `security.basicAuth`. */
@@ -803,7 +823,8 @@ export interface IGatewayMailPortConfig {
803
823
 
804
824
  /**
805
825
  * The mail server settings singleton (the stored settings, never the run-time options).
806
- * `emailConfig` is SmartMTA's server options. `auth.users` and `auth.accounts` are out; the rest of
826
+ * `emailConfig` is SmartMTA's server options; while `enabled` it names a non-blank `hostname` and
827
+ * `ports`, a non-empty list of ports 1 to 65535 (a gateway starts no mail server without them). `auth.users` and `auth.accounts` are out; the rest of
807
828
  * `auth` (`required`, `methods`) travels inside `emailConfig` (Linus ruling 126, which amends ruling
808
829
  * 121). SMTP accounts are rows of `smtpAccounts`; plaintext `auth.users` logins have no table form,
809
830
  * so a gateway that holds one refuses to export by name. Host paths stay out, and `tls.keyPem` is
@@ -816,7 +837,10 @@ export interface IGatewayMailServerSettings {
816
837
  /** `emailConfig.tls.keyPem`; only with `emailConfig.tls`. */
817
838
  tlsKey: IGatewaySealedValue | null;
818
839
  emailPortConfig: IGatewayMailPortConfig;
819
- /** The effective source: what the gateway serves for settings stored without one. */
840
+ /**
841
+ * The effective source: what the gateway serves for settings stored without one.
842
+ * `configuredMaterial` only with material in the table: `tlsKey`, or `emailConfig.tls.certPem`.
843
+ */
820
844
  tlsSource: 'managedCertificate' | 'configuredMaterial';
821
845
  }
822
846
 
@@ -948,11 +972,45 @@ export interface IGatewayMailArea {
948
972
  // edges
949
973
  // ---------------------------------------------------------------------------------------------
950
974
 
975
+ /**
976
+ * The ranges and bounds of an edge's settings (`IGatewayEdgePerformance`, `IGatewayEdgeEgress`), the
977
+ * ones a gateway's remote ingress engine takes; `validateGatewayAreaTables` refuses outside them: an
978
+ * integer outside its range as `invalid-value` (a wrong value), a list beyond its length as
979
+ * `bound-exceeded` (a document's size).
980
+ */
981
+ export const gatewayEdgeSettingBounds = Object.freeze({
982
+ /** Each integer performance setting, inclusive. Only `maxHalfClosedStreams` may be 0 (it turns the retention off). */
983
+ performance: Object.freeze({
984
+ maxStreamsPerEdge: Object.freeze({ minimum: 1, maximum: 100_000 }),
985
+ totalWindowBudgetBytes: Object.freeze({ minimum: 1, maximum: 1_073_741_824 }),
986
+ minStreamWindowBytes: Object.freeze({ minimum: 1, maximum: 16_777_216 }),
987
+ maxStreamWindowBytes: Object.freeze({ minimum: 1, maximum: 134_217_728 }),
988
+ sustainedStreamWindowBytes: Object.freeze({ minimum: 1, maximum: 134_217_728 }),
989
+ quicDatagramReceiveBufferBytes: Object.freeze({ minimum: 1, maximum: 67_108_864 }),
990
+ streamFramePayloadBytes: Object.freeze({ minimum: 1, maximum: 16_777_216 }),
991
+ firstDataConnectTimeoutMs: Object.freeze({ minimum: 1, maximum: 3_600_000 }),
992
+ clientWriteTimeoutMs: Object.freeze({ minimum: 1, maximum: 3_600_000 }),
993
+ maxHalfClosedStreams: Object.freeze({ minimum: 0, maximum: 100_000 }),
994
+ halfCloseDrainTimeoutMs: Object.freeze({ minimum: 1, maximum: 3_600_000 }),
995
+ }),
996
+ /** Entries of `serverFirstPorts`. */
997
+ maximumServerFirstPorts: 128,
998
+ /** The client-first TLS port, which `serverFirstPorts` never names. */
999
+ clientFirstPort: 443,
1000
+ /** The `allowedPorts` of every enabled egress policy, exactly (Linus ruling 129, Q3): outbound SMTP. */
1001
+ egressAllowedPorts: Object.freeze([25] as const),
1002
+ /** Entries of an egress policy's `deniedCidrs` and of its `allowedHostPatterns`. */
1003
+ maximumEgressListEntries: 128,
1004
+ /** An egress policy's `maxConcurrentStreams`, from 1. */
1005
+ maximumEgressConcurrentStreams: 100_000,
1006
+ } as const);
1007
+
951
1008
  /**
952
1009
  * dcrouter's `IRemoteIngressPerformanceConfig`, canonical; `null` members take the gateway default.
953
1010
  * At least one member is set: settings that state nothing are the owner's `performance: null`, never
954
1011
  * an object of `null` members (Linus ruling 125, Q-b7; the gateway stores and exports them as no
955
- * setting).
1012
+ * setting). Every integer lies in its range of `gatewayEdgeSettingBounds.performance`, and neither
1013
+ * `minStreamWindowBytes` nor `sustainedStreamWindowBytes` is above a stated `maxStreamWindowBytes`.
956
1014
  */
957
1015
  export interface IGatewayEdgePerformance {
958
1016
  profile: 'balanced' | 'throughput' | 'highConcurrency' | null;
@@ -967,15 +1025,19 @@ export interface IGatewayEdgePerformance {
967
1025
  clientWriteTimeoutMs: number | null;
968
1026
  maxHalfClosedStreams: number | null;
969
1027
  halfCloseDrainTimeoutMs: number | null;
970
- /** A non-empty set of ports; `null` for none (never `[]`). */
1028
+ /**
1029
+ * A non-empty set of at most `gatewayEdgeSettingBounds.maximumServerFirstPorts` ports, never 443
1030
+ * (client-first TLS); `null` for none (never `[]`).
1031
+ */
971
1032
  serverFirstPorts: number[] | null;
972
1033
  }
973
1034
 
974
1035
  /**
975
1036
  * dcrouter's `IRemoteIngressEgressPolicyConfig`, canonical; `null` members take the gateway default.
976
- * An enabled policy states its ports (the gateway's default `[25]` is written out, never `null`); a
977
- * disabled one states nothing else, every other member `null`, because the gateway keeps only
978
- * `enabled` of it. A list member is `null` or non-empty, never `[]` (Linus ruling 125, Q-b7).
1037
+ * An enabled policy states its ports, which are exactly `gatewayEdgeSettingBounds.egressAllowedPorts`
1038
+ * (`[25]`, never `null`; Linus ruling 129: a gateway opens no other egress port); a disabled one
1039
+ * states nothing else, every other member `null`, because the gateway keeps only `enabled` of it. A
1040
+ * list member is `null` or non-empty, never `[]` (Linus ruling 125, Q-b7).
979
1041
  *
980
1042
  * Always stated on an edge row (`IGatewayEdgeRow.egress`): the gateway reads an edge without a
981
1043
  * policy and one with a disabled policy alike, so egress off has the one spelling
@@ -985,13 +1047,14 @@ export interface IGatewayEdgePerformance {
985
1047
  */
986
1048
  export interface IGatewayEdgeEgress {
987
1049
  enabled: boolean;
988
- /** A non-empty set of ports exactly when `enabled`; `null` otherwise. */
1050
+ /** `[25]` exactly when `enabled`; `null` otherwise. */
989
1051
  allowedPorts: number[] | null;
990
1052
  allowPrivateRanges: boolean | null;
991
- /** A non-empty set of CIDRs, or `null`. */
1053
+ /** A non-empty set of at most `gatewayEdgeSettingBounds.maximumEgressListEntries` CIDRs, each without whitespace around it, or `null`. */
992
1054
  deniedCidrs: string[] | null;
993
- /** A non-empty set of host patterns, or `null`. */
1055
+ /** A non-empty set of host patterns under the same bound and rule, or `null`. */
994
1056
  allowedHostPatterns: string[] | null;
1057
+ /** 1 to `gatewayEdgeSettingBounds.maximumEgressConcurrentStreams`, or `null`. */
995
1058
  maxConcurrentStreams: number | null;
996
1059
  }
997
1060
 
@@ -1012,15 +1075,18 @@ export interface IGatewayEdgeRow {
1012
1075
  egress: IGatewayEdgeEgress;
1013
1076
  /** A set of tags (the gateway reads absent as empty). */
1014
1077
  tags: string[];
1078
+ /** One IPv4 address in canonical text (a dotted quad without leading zeros). */
1015
1079
  publicIp: string | null;
1016
- /** dcrouter stores it as `publicIpV6`. */
1080
+ /** One IPv6 address in canonical text (RFC 5952). dcrouter stores it as `publicIpV6`. */
1017
1081
  publicIpv6: string | null;
1082
+ /** A lowercase fully qualified name: two or more labels of letters, digits and inner hyphens, no trailing dot. */
1018
1083
  mailHostname: string | null;
1019
1084
  }
1020
1085
 
1021
1086
  /** The tunnel hub singleton, without its listener port and TLS files. */
1022
1087
  export interface IGatewayEdgeHubSettings {
1023
1088
  enabled: boolean;
1089
+ /** Without whitespace around it. */
1024
1090
  hubDomain: string | null;
1025
1091
  performance: IGatewayEdgePerformance | null;
1026
1092
  }