@serve.zone/interfaces 32.89.0 → 32.91.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/changelog.md +17 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/data/cloudlyconfig.d.ts +7 -5
- package/dist_ts/data/cloudlyconfig.js +26 -5
- package/dist_ts/data/gatewayareas.d.ts +6 -3
- package/dist_ts/data/gatewayareas.js +1 -1
- package/dist_ts/data/gatewayareas.validation.js +26 -7
- package/dist_ts/data/gatewayintent.d.ts +30 -3
- package/dist_ts/data/gatewayintent.js +8 -2
- package/dist_ts/data/hostedapp.d.ts +20 -2
- package/dist_ts/data/hostedapp.js +25 -10
- package/dist_ts/data/mail.d.ts +6 -1
- package/dist_ts/data/mail.js +1 -1
- package/package.json +1 -1
- package/readme.md +31 -12
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/data/cloudlyconfig.ts +25 -4
- package/ts/data/gatewayareas.ts +6 -3
- package/ts/data/gatewayareas.validation.ts +33 -6
- package/ts/data/gatewayintent.ts +34 -4
- package/ts/data/hostedapp.ts +44 -13
- package/ts/data/mail.ts +6 -1
package/ts/data/hostedapp.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The kind of host running a hosted app (`onebox`, `cloudly`, or another host's name), for display
|
|
3
|
-
* only: never branch on it. A host's capabilities reach an app only through
|
|
4
|
-
* advertises,
|
|
3
|
+
* only: never branch on it. A host's capabilities reach an app only through the extras the host
|
|
4
|
+
* advertises, `IHostedAppLifecycleState.hostExtras`.
|
|
5
5
|
*/
|
|
6
6
|
export type THostedAppHostType = 'onebox' | 'cloudly' | string;
|
|
7
7
|
|
|
@@ -428,6 +428,16 @@ export interface IHostedAppLifecycleState extends IHostedAppLifecycleReport {
|
|
|
428
428
|
reportedAt?: number;
|
|
429
429
|
bootstrapAction?: IHostedAppBootstrapAction;
|
|
430
430
|
upgradeState?: IHostedAppUpgradeState;
|
|
431
|
+
/**
|
|
432
|
+
* The host extras this host advertises to the app (Linus ruling 15 point 4, ruling 13 amendment
|
|
433
|
+
* point 12, amendment 141a point 4): optional offers, never a precondition for the app's start or
|
|
434
|
+
* run. Host-owned, so a lifecycle report that states it is refused. A host states only a list
|
|
435
|
+
* `validateHostedAppHostExtras` accepts. The names are open: each kind of app declares the ones
|
|
436
|
+
* it reads (Cloudly's are `cloudlyHostExtras`), and a reader uses only the names it knows
|
|
437
|
+
* (`isCloudlyHostExtra` for Cloudly) and ignores every other one. An absent or empty list offers
|
|
438
|
+
* nothing, and so does a list the validator refuses.
|
|
439
|
+
*/
|
|
440
|
+
hostExtras?: string[];
|
|
431
441
|
}
|
|
432
442
|
|
|
433
443
|
type THostedAppBootstrapActionServerFields =
|
|
@@ -461,10 +471,38 @@ const hostedAppLifecycleReportKeys: ReadonlySet<string> = new Set<
|
|
|
461
471
|
|
|
462
472
|
const hostedAppLifecycleHostOwnedKeys: ReadonlySet<string> = new Set<
|
|
463
473
|
Exclude<keyof IHostedAppLifecycleState, keyof IHostedAppLifecycleReport>
|
|
464
|
-
>(['appInstanceId', 'hostType', 'reportedAt', 'bootstrapAction', 'upgradeState']);
|
|
474
|
+
>(['appInstanceId', 'hostType', 'reportedAt', 'bootstrapAction', 'upgradeState', 'hostExtras']);
|
|
465
475
|
|
|
466
476
|
const hostedAppCapabilityRegex = /^[A-Za-z0-9][A-Za-z0-9:._-]{0,99}$/;
|
|
467
|
-
const
|
|
477
|
+
const hostedAppNameListMaximumLength = 64;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* The capability rule, shared by a report's `capabilities` and a state's `hostExtras`: a dense
|
|
481
|
+
* array of at most 64 unique names, each a letter or digit followed by at most 99 letters, digits
|
|
482
|
+
* or `:._-`.
|
|
483
|
+
*/
|
|
484
|
+
const isUniqueCanonicalHostedAppNameList = (valueArg: unknown): boolean => (
|
|
485
|
+
Array.isArray(valueArg)
|
|
486
|
+
&& Object.keys(valueArg).length === valueArg.length
|
|
487
|
+
&& valueArg.length <= hostedAppNameListMaximumLength
|
|
488
|
+
&& valueArg.every((nameArg) => (
|
|
489
|
+
typeof nameArg === 'string' && hostedAppCapabilityRegex.test(nameArg)
|
|
490
|
+
))
|
|
491
|
+
&& new Set(valueArg).size === valueArg.length
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Judges a lifecycle state's `hostExtras` (Linus amendment 141a point 4) by the capability rule:
|
|
496
|
+
* unique canonical names, at most 64. It judges the form only and accepts names this package does
|
|
497
|
+
* not declare, because a host may offer an extra an older app does not know, and that app ignores
|
|
498
|
+
* it. An absent list passes. A host states only a list this accepts; a reader runs it before it
|
|
499
|
+
* uses a name.
|
|
500
|
+
*/
|
|
501
|
+
export const validateHostedAppHostExtras = (hostExtrasArg: unknown): string[] => (
|
|
502
|
+
hostExtrasArg === undefined || isUniqueCanonicalHostedAppNameList(hostExtrasArg)
|
|
503
|
+
? []
|
|
504
|
+
: ['hosted app host extras must be unique canonical names']
|
|
505
|
+
);
|
|
468
506
|
|
|
469
507
|
const isBoundedHostedAppText = (valueArg: unknown, maximumLengthArg: number): boolean => (
|
|
470
508
|
typeof valueArg === 'string' && valueArg.trim().length > 0 && valueArg.length <= maximumLengthArg
|
|
@@ -528,15 +566,8 @@ export const validateHostedAppLifecycleReport = (
|
|
|
528
566
|
|| report.statusMessage.length > hostedAppStatusMessageMaximumLength)) {
|
|
529
567
|
errors.push('hosted app lifecycle report statusMessage must be bounded');
|
|
530
568
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
&& (!Array.isArray(capabilities)
|
|
534
|
-
|| Object.keys(capabilities).length !== capabilities.length
|
|
535
|
-
|| capabilities.length > hostedAppLifecycleReportMaximumCapabilities
|
|
536
|
-
|| capabilities.some((capabilityArg) => (
|
|
537
|
-
typeof capabilityArg !== 'string' || !hostedAppCapabilityRegex.test(capabilityArg)
|
|
538
|
-
))
|
|
539
|
-
|| new Set(capabilities).size !== capabilities.length)) {
|
|
569
|
+
if (report.capabilities !== undefined
|
|
570
|
+
&& !isUniqueCanonicalHostedAppNameList(report.capabilities)) {
|
|
540
571
|
errors.push('hosted app lifecycle report capabilities must be unique canonical names');
|
|
541
572
|
}
|
|
542
573
|
return errors;
|
package/ts/data/mail.ts
CHANGED
|
@@ -283,7 +283,12 @@ export interface IServiceMailInboundConfig {
|
|
|
283
283
|
|
|
284
284
|
export interface IServiceMailOutboundConfig {
|
|
285
285
|
enabled?: boolean;
|
|
286
|
-
/**
|
|
286
|
+
/**
|
|
287
|
+
* The outbound credential's public name. After a takeover the credential has no id of its own: its
|
|
288
|
+
* public name is the SMTP username, and this member equals `username`. Before a takeover it is the
|
|
289
|
+
* id the gateway (dcrouter) lists the credential under. Public metadata only; never store passwords
|
|
290
|
+
* here.
|
|
291
|
+
*/
|
|
287
292
|
credentialId?: string;
|
|
288
293
|
username?: string;
|
|
289
294
|
status?: TMailCredentialStatus;
|