@serve.zone/interfaces 32.118.0 → 32.120.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 +12 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/data/cloudlyconfig.d.ts +5 -5
- package/dist_ts/data/cloudlyconfig.js +38 -123
- package/dist_ts/data/cloudlyhostcontract.d.ts +141 -0
- package/dist_ts/data/cloudlyhostcontract.js +179 -0
- package/dist_ts/data/hostedapp.d.ts +3 -0
- package/dist_ts/data/hostedapp.js +2 -2
- package/dist_ts/data/index.d.ts +1 -0
- package/dist_ts/data/index.js +2 -1
- package/dist_ts/data/nodeaction.js +2 -2
- package/dist_ts/runtime.workloadinit.d.ts +11 -5
- package/dist_ts/runtime.workloadinit.js +29 -8
- package/package.json +4 -4
- package/readme.md +19 -12
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/data/cloudlyconfig.ts +42 -122
- package/ts/data/cloudlyhostcontract.ts +209 -0
- package/ts/data/hostedapp.ts +5 -1
- package/ts/data/index.ts +1 -0
- package/ts/data/nodeaction.ts +1 -1
- package/ts/runtime.workloadinit.ts +41 -12
package/changelog.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026-11-24 - 32.120.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Migrate canonical WorkloadInit release contract to `foss.global` while preserving validation of legacy `code.foss.global` release identities and attestation statements during rolling migration, and update the Spark download failure remedy to reference `foss.global`.
|
|
8
|
+
|
|
9
|
+
## 2026-11-23 - 32.119.0
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- Export Cloudly host environment names, standard offers and a strict versioned extras advertisement on hosted app lifecycle state (AGL-1605).
|
|
14
|
+
|
|
3
15
|
## 2026-11-23 - 32.118.0
|
|
4
16
|
|
|
5
17
|
### Features
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@serve.zone/interfaces',
|
|
6
|
-
version: '32.
|
|
6
|
+
version: '32.120.0',
|
|
7
7
|
description: 'Shared TypeScript interfaces and TypedRequest contracts for the serve.zone ecosystem.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFVBQVU7SUFDbkIsV0FBVyxFQUFFLHVGQUF1RjtDQUNyRyxDQUFBIn0=
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as plugins from '../plugins.js';
|
|
1
|
+
import type * as plugins from '../plugins.js';
|
|
2
2
|
export interface ICloudlyConfig {
|
|
3
3
|
environment?: 'production' | 'integration';
|
|
4
4
|
/**
|
|
@@ -43,8 +43,8 @@ export interface ICloudlyConfig {
|
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* The environment a host must give the Cloudly server: Cloudly refuses to start when one of these
|
|
46
|
-
* is missing, naming every missing variable (its `qenv.yml` required list).
|
|
47
|
-
*
|
|
46
|
+
* is missing, naming every missing variable (its `qenv.yml` required list). Retains the published
|
|
47
|
+
* tuple shape. The named constants live in `cloudlyHostContractRequiredEnvVars`.
|
|
48
48
|
*/
|
|
49
49
|
export declare const cloudlyHostRequiredEnvironment: readonly ["SERVEZONE_ENVIRONMENT", "SERVEZONE_PUBLIC_ORIGIN", "SERVEZONE_SSLMODE", "SERVEZONE_SECRET_KEYRING_PATH", "MONGODB_URL", "S3_ENDPOINT", "S3_ACCESSKEY", "S3_SECRETKEY", "S3_BUCKET"];
|
|
50
50
|
/** One variable a host must give the Cloudly server. */
|
|
@@ -59,8 +59,8 @@ export declare const cloudlyHostPlatformOidcEnvironment: readonly ["SERVEZONE_PL
|
|
|
59
59
|
/** One variable of the platform OIDC sign-in group. */
|
|
60
60
|
export type TCloudlyHostPlatformOidcEnvironmentName = typeof cloudlyHostPlatformOidcEnvironment[number];
|
|
61
61
|
/**
|
|
62
|
-
* The environment the Cloudly server reads but starts without.
|
|
63
|
-
*
|
|
62
|
+
* The environment the Cloudly server reads but starts without. Retains the published tuple
|
|
63
|
+
* shape. The named constants live in `cloudlyHostContractOptionalEnvVars`.
|
|
64
64
|
*
|
|
65
65
|
* Two more names are deliberately outside the contract: `SERVEZONE_ADMINACCOUNT` is deprecated
|
|
66
66
|
* (`ICloudlyConfig.servezoneAdminaccount`) and read until Cloudly 34.0.0, and
|
|
@@ -1,44 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { hostedAppRuntimeIdentityKeys } from './hostedapp.js';
|
|
1
|
+
import { cloudlyHostContractOptionalEnvVars as optionalEnv, cloudlyHostContractRequiredEnvVars as requiredEnv, cloudlyHostExtraCapabilities, } from './cloudlyhostcontract.js';
|
|
3
2
|
/**
|
|
4
3
|
* The environment a host must give the Cloudly server: Cloudly refuses to start when one of these
|
|
5
|
-
* is missing, naming every missing variable (its `qenv.yml` required list).
|
|
6
|
-
*
|
|
4
|
+
* is missing, naming every missing variable (its `qenv.yml` required list). Retains the published
|
|
5
|
+
* tuple shape. The named constants live in `cloudlyHostContractRequiredEnvVars`.
|
|
7
6
|
*/
|
|
8
7
|
export const cloudlyHostRequiredEnvironment = Object.freeze([
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* `host[:port]`.
|
|
19
|
-
*/
|
|
20
|
-
'SERVEZONE_PUBLIC_ORIGIN',
|
|
21
|
-
/**
|
|
22
|
-
* `external` (TLS is terminated in front of Cloudly) or `none`. Cloudly terminates no TLS itself.
|
|
23
|
-
*/
|
|
24
|
-
'SERVEZONE_SSLMODE',
|
|
25
|
-
/**
|
|
26
|
-
* The path of the secret keyring file. The host delivers it as a private file: a regular file
|
|
27
|
-
* that is not a symlink, has one hard link, is owned by the process user and grants no group or
|
|
28
|
-
* other permission, in a directory owned by that user that neither group nor others may write.
|
|
29
|
-
* This is the host's obligation; the Cloudly server does not check it yet.
|
|
30
|
-
*/
|
|
31
|
-
'SERVEZONE_SECRET_KEYRING_PATH',
|
|
32
|
-
/** The MongoDB connection URL of Cloudly's database. */
|
|
33
|
-
'MONGODB_URL',
|
|
34
|
-
/** The S3 endpoint of Cloudly's object storage. */
|
|
35
|
-
'S3_ENDPOINT',
|
|
36
|
-
/** The S3 access key. */
|
|
37
|
-
'S3_ACCESSKEY',
|
|
38
|
-
/** The S3 secret key. */
|
|
39
|
-
'S3_SECRETKEY',
|
|
40
|
-
/** The bucket Cloudly keeps its objects in; Cloudly creates it when it does not exist. */
|
|
41
|
-
'S3_BUCKET',
|
|
8
|
+
requiredEnv.environment,
|
|
9
|
+
requiredEnv.publicOrigin,
|
|
10
|
+
requiredEnv.sslMode,
|
|
11
|
+
requiredEnv.secretKeyringPath,
|
|
12
|
+
requiredEnv.mongoDbUrl,
|
|
13
|
+
requiredEnv.s3Endpoint,
|
|
14
|
+
requiredEnv.s3AccessKey,
|
|
15
|
+
requiredEnv.s3SecretKey,
|
|
16
|
+
requiredEnv.s3Bucket,
|
|
42
17
|
]);
|
|
43
18
|
/**
|
|
44
19
|
* The platform OIDC sign-in group (idp.global). It is all or none: Cloudly offers platform sign-in
|
|
@@ -47,97 +22,39 @@ export const cloudlyHostRequiredEnvironment = Object.freeze([
|
|
|
47
22
|
* `SERVEZONE_PUBLIC_ORIGIN`, and the audience equals the client ID.
|
|
48
23
|
*/
|
|
49
24
|
export const cloudlyHostPlatformOidcEnvironment = Object.freeze([
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
25
|
+
optionalEnv.platformOidcIssuer,
|
|
26
|
+
optionalEnv.platformOidcClientId,
|
|
27
|
+
optionalEnv.platformOidcClientSecret,
|
|
28
|
+
optionalEnv.platformOidcRedirectUri,
|
|
29
|
+
optionalEnv.platformOidcAudience,
|
|
55
30
|
]);
|
|
56
31
|
/**
|
|
57
|
-
* The environment the Cloudly server reads but starts without.
|
|
58
|
-
*
|
|
32
|
+
* The environment the Cloudly server reads but starts without. Retains the published tuple
|
|
33
|
+
* shape. The named constants live in `cloudlyHostContractOptionalEnvVars`.
|
|
59
34
|
*
|
|
60
35
|
* Two more names are deliberately outside the contract: `SERVEZONE_ADMINACCOUNT` is deprecated
|
|
61
36
|
* (`ICloudlyConfig.servezoneAdminaccount`) and read until Cloudly 34.0.0, and
|
|
62
37
|
* `SERVEZONE_INSTALL_DEMO_DATA` installs destructive demo data, so a host never sets either.
|
|
63
38
|
*/
|
|
64
39
|
export const cloudlyHostOptionalEnvironment = Object.freeze([
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
'MONGODB_NAME',
|
|
75
|
-
/** Optional member of the Mongo descriptor (user). */
|
|
76
|
-
'MONGODB_USER',
|
|
77
|
-
/** Optional member of the Mongo descriptor (password). */
|
|
78
|
-
'MONGODB_PASS',
|
|
79
|
-
/** The S3 port. This contract states no default. */
|
|
80
|
-
'S3_PORT',
|
|
81
|
-
/** Whether S3 is reached over TLS (`true` or `false`). This contract states no default. */
|
|
82
|
-
'S3_USESSL',
|
|
83
|
-
/**
|
|
84
|
-
* The host channel of a hosted Cloudly, together with `SERVEZONE_APP_CONTROL_TOKEN`
|
|
85
|
-
* (`hostedAppRuntimeIdentityKeys`). Cloudly counts as hosted only while both are set.
|
|
86
|
-
*/
|
|
87
|
-
hostedAppRuntimeIdentityKeys.runtimeUrl,
|
|
88
|
-
/** The host's machine JWT for the host channel, delivered as a secret. */
|
|
89
|
-
hostedAppRuntimeIdentityKeys.controlToken,
|
|
40
|
+
optionalEnv.listenPort,
|
|
41
|
+
optionalEnv.workloadInitApprovalPath,
|
|
42
|
+
optionalEnv.mongoDbName,
|
|
43
|
+
optionalEnv.mongoDbUser,
|
|
44
|
+
optionalEnv.mongoDbPass,
|
|
45
|
+
optionalEnv.s3Port,
|
|
46
|
+
optionalEnv.s3UseSsl,
|
|
47
|
+
optionalEnv.runtimeUrl,
|
|
48
|
+
optionalEnv.controlToken,
|
|
90
49
|
...cloudlyHostPlatformOidcEnvironment,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
'CLOUDLY_BASEOS_IMAGE_CLEANUP_INTERVAL_MS',
|
|
100
|
-
/**
|
|
101
|
-
* This controller site's own origin (Linus rulings 69 Q3 and 79 Q1): a canonical `https` origin
|
|
102
|
-
* (`data.validateControllerOrigin`), the `IControllerPeerSet.activeOrigin` this site states while
|
|
103
|
-
* it is active and the origin the witness names it by. While unset, the site counts as
|
|
104
|
-
* `SERVEZONE_PUBLIC_ORIGIN`, but only while the controller row lists no shadow; once it lists one,
|
|
105
|
-
* a start refuses an unset value or one equal to `SERVEZONE_PUBLIC_ORIGIN`. A fact about this one
|
|
106
|
-
* site, never stored in the replicated controller database.
|
|
107
|
-
*/
|
|
108
|
-
'SERVEZONE_SITE_ORIGIN',
|
|
109
|
-
/**
|
|
110
|
-
* The canonical `https` origin of the witness this site reads (`requests.witness`). Set together
|
|
111
|
-
* with `SERVEZONE_WITNESS_BEARER_PATH` or not at all: a start with only one of them is refused,
|
|
112
|
-
* naming the one that is unset. Required once the controller row lists another site as a shadow.
|
|
113
|
-
*/
|
|
114
|
-
'SERVEZONE_WITNESS_ORIGIN',
|
|
115
|
-
/**
|
|
116
|
-
* The path of this site's witness bearer, a private file under the rules of the secret keyring
|
|
117
|
-
* (`SERVEZONE_SECRET_KEYRING_PATH`) holding the 43-character base64url of 32 random bytes
|
|
118
|
-
* (`data.witnessContract.bearerRandomBytes`). The host creates it; Cloudly only reads it and
|
|
119
|
-
* hashes it, never writes or logs it. Set together with `SERVEZONE_WITNESS_ORIGIN` or not at all.
|
|
120
|
-
*/
|
|
121
|
-
'SERVEZONE_WITNESS_BEARER_PATH',
|
|
122
|
-
/**
|
|
123
|
-
* The port of Cloudly's relayed listener (Linus ruling 141 C7), a second port beside
|
|
124
|
-
* `SERVEZONE_LISTENPORT` that the host's relay ingress forwards to, and only to. Relayedness is
|
|
125
|
-
* the accepting listener, so this port serves the human surface only: the UI, human sign-in and
|
|
126
|
-
* human typed requests, never machine endpoints or Destroy. This contract states no default. A
|
|
127
|
-
* host that advertises `relayIngress` (`cloudlyHostExtras`) sets it together with
|
|
128
|
-
* `SERVEZONE_RELAY_INGRESS_ADDRESS`.
|
|
129
|
-
*/
|
|
130
|
-
'SERVEZONE_RELAYED_LISTENPORT',
|
|
131
|
-
/**
|
|
132
|
-
* Where Cloudly's cloud access connector dials the host's relay ingress (Linus ruling 141 C6 and
|
|
133
|
-
* C7, amendment 141a point 4): `<host>:<port>`, an IPv6 address in brackets
|
|
134
|
-
* (`[2001:db8::1]:8443`). The relay ingress is the host's second listener, reachable from the
|
|
135
|
-
* Cloudly container, that serves `SERVEZONE_PUBLIC_ORIGIN`'s TLS and forwards only to
|
|
136
|
-
* `SERVEZONE_RELAYED_LISTENPORT`. The connector never dials the public origin by name, whose
|
|
137
|
-
* public DNS points at the relay, nor an address taken from a request. A host that advertises
|
|
138
|
-
* `relayIngress` sets it together with `SERVEZONE_RELAYED_LISTENPORT`.
|
|
139
|
-
*/
|
|
140
|
-
'SERVEZONE_RELAY_INGRESS_ADDRESS',
|
|
50
|
+
optionalEnv.backupCron,
|
|
51
|
+
optionalEnv.backupKeepLast,
|
|
52
|
+
optionalEnv.baseOsImageCleanupIntervalMs,
|
|
53
|
+
optionalEnv.siteOrigin,
|
|
54
|
+
optionalEnv.witnessOrigin,
|
|
55
|
+
optionalEnv.witnessBearerPath,
|
|
56
|
+
optionalEnv.relayedListenPort,
|
|
57
|
+
optionalEnv.relayIngressAddress,
|
|
141
58
|
]);
|
|
142
59
|
/**
|
|
143
60
|
* The host extras a host can advertise to the Cloudly it runs (Linus ruling 13, amendment points
|
|
@@ -156,9 +73,7 @@ export const cloudlyHostOptionalEnvironment = Object.freeze([
|
|
|
156
73
|
* (`hostedAppGetLifecycleState`), and `validateHostedAppHostExtras` judges it. Cloudly uses only the
|
|
157
74
|
* names it knows (`isCloudlyHostExtra`) and ignores every other one, because an extra is an offer.
|
|
158
75
|
*/
|
|
159
|
-
export const cloudlyHostExtras =
|
|
160
|
-
'relayIngress',
|
|
161
|
-
]);
|
|
76
|
+
export const cloudlyHostExtras = cloudlyHostExtraCapabilities;
|
|
162
77
|
/** True for one of `cloudlyHostExtras`. */
|
|
163
78
|
export const isCloudlyHostExtra = (valueArg) => (cloudlyHostExtras.includes(valueArg));
|
|
164
79
|
/**
|
|
@@ -172,4 +87,4 @@ export const isCloudlyHostExtra = (valueArg) => (cloudlyHostExtras.includes(valu
|
|
|
172
87
|
export const cloudlyStatusPath = '/status';
|
|
173
88
|
/** The port Cloudly binds when `SERVEZONE_LISTENPORT` is unset. */
|
|
174
89
|
export const cloudlyDefaultListenPort = 3000;
|
|
175
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
90
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xvdWRseWNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzL2RhdGEvY2xvdWRseWNvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLE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xRQUFRO0lBQ3BCLFdBQVcsQ0FBQyxVQUFVO0lBQ3RCLFdBQVcsQ0FBQyxZQUFZO0lBQ3hCLEdBQUcsa0NBQWtDO0lBQ3JDLFdBQVcsQ0FBQyxVQUFVO0lBQ3RCLFdBQVcsQ0FBQyxjQUFjO0lBQzFCLFdBQVcsQ0FBQyw0QkFBNEI7SUFDeEMsV0FBVyxDQUFDLFVBQVU7SUFDdEIsV0FBVyxDQUFDLGFBQWE7SUFDekIsV0FBVyxDQUFDLGlCQUFpQjtJQUM3QixXQUFXLENBQUMsaUJBQWlCO0lBQzdCLFdBQVcsQ0FBQyxtQkFBbUI7Q0FDdkIsQ0FBQyxDQUFDO0FBS1o7Ozs7Ozs7Ozs7Ozs7Ozs7R0FnQkc7QUFDSCxNQUFNLENBQUMsTUFBTSxpQkFBaUIsR0FBRyw0QkFBNEIsQ0FBQztBQUs5RCwyQ0FBMkM7QUFDM0MsTUFBTSxDQUFDLE1BQU0sa0JBQWtCLEdBQUcsQ0FBQyxRQUFpQixFQUFpQyxFQUFFLENBQUMsQ0FDckYsaUJBQXdDLENBQUMsUUFBUSxDQUFDLFFBQVEsQ0FBQyxDQUM3RCxDQUFDO0FBRUY7Ozs7Ozs7R0FPRztBQUNILE1BQU0sQ0FBQyxNQUFNLGlCQUFpQixHQUFHLFNBQWtCLENBQUM7QUFFcEQsbUVBQW1FO0FBQ25FLE1BQU0sQ0FBQyxNQUFNLHdCQUF3QixHQUFHLElBQWEsQ0FBQyJ9
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/** The environment Cloudly requires at startup, as verified by its `qenv.yml`. */
|
|
2
|
+
export declare const cloudlyHostContractRequiredEnvVars: Readonly<{
|
|
3
|
+
/**
|
|
4
|
+
* The deployment environment. Production hosts set `production`; any other value turns on
|
|
5
|
+
* development reloading. The value is fixed for the life of a database: Cloudly binds it into
|
|
6
|
+
* the credentials and sessions it stores.
|
|
7
|
+
*/
|
|
8
|
+
readonly environment: 'SERVEZONE_ENVIRONMENT';
|
|
9
|
+
/**
|
|
10
|
+
* The origin clients reach Cloudly under: `http` or `https`, with an optional port, and no path,
|
|
11
|
+
* query or fragment. Ingress passes the request's `Host` unchanged, so it equals this origin's
|
|
12
|
+
* `host[:port]`.
|
|
13
|
+
*/
|
|
14
|
+
readonly publicOrigin: 'SERVEZONE_PUBLIC_ORIGIN';
|
|
15
|
+
/**
|
|
16
|
+
* `external` (TLS is terminated in front of Cloudly) or `none`. Cloudly terminates no TLS itself.
|
|
17
|
+
*/
|
|
18
|
+
readonly sslMode: 'SERVEZONE_SSLMODE';
|
|
19
|
+
/**
|
|
20
|
+
* The path of the secret keyring file. The host delivers it as a private file: a regular file
|
|
21
|
+
* that is not a symlink, has one hard link, is owned by the process user and grants no group or
|
|
22
|
+
* other permission, in a directory owned by that user that neither group nor others may write.
|
|
23
|
+
* This is the host's obligation; the Cloudly server does not check it yet.
|
|
24
|
+
*/
|
|
25
|
+
readonly secretKeyringPath: 'SERVEZONE_SECRET_KEYRING_PATH';
|
|
26
|
+
/** The MongoDB connection URL of Cloudly's database. */
|
|
27
|
+
readonly mongoDbUrl: 'MONGODB_URL';
|
|
28
|
+
/** The S3 endpoint of Cloudly's object storage. */
|
|
29
|
+
readonly s3Endpoint: 'S3_ENDPOINT';
|
|
30
|
+
/** The S3 access key. */
|
|
31
|
+
readonly s3AccessKey: 'S3_ACCESSKEY';
|
|
32
|
+
/** The S3 secret key. */
|
|
33
|
+
readonly s3SecretKey: 'S3_SECRETKEY';
|
|
34
|
+
/** The bucket Cloudly keeps its objects in; Cloudly creates it when it does not exist. */
|
|
35
|
+
readonly s3Bucket: 'S3_BUCKET';
|
|
36
|
+
}>;
|
|
37
|
+
export declare const cloudlyHostContractRequiredEnvVarList: readonly ("MONGODB_URL" | "S3_ACCESSKEY" | "S3_BUCKET" | "S3_ENDPOINT" | "S3_SECRETKEY" | "SERVEZONE_ENVIRONMENT" | "SERVEZONE_PUBLIC_ORIGIN" | "SERVEZONE_SECRET_KEYRING_PATH" | "SERVEZONE_SSLMODE")[];
|
|
38
|
+
export type TCloudlyHostRequiredEnvVar = typeof cloudlyHostContractRequiredEnvVarList[number];
|
|
39
|
+
/**
|
|
40
|
+
* Optional configuration. Both lists exclude `SERVEZONE_ADMINACCOUNT` (deprecated bootstrap)
|
|
41
|
+
* and `SERVEZONE_APP_HOST_TYPE` (display only).
|
|
42
|
+
*/
|
|
43
|
+
export declare const cloudlyHostContractOptionalEnvVars: Readonly<{
|
|
44
|
+
/** The port the server binds; `cloudlyDefaultListenPort` when unset. */
|
|
45
|
+
readonly listenPort: 'SERVEZONE_LISTENPORT';
|
|
46
|
+
/**
|
|
47
|
+
* The path of the WorkloadInit release approval file, a private file under the same rules as
|
|
48
|
+
* the secret keyring. Unset, the requests that need an approval answer
|
|
49
|
+
* `workloadinit-unconfigured`.
|
|
50
|
+
*/
|
|
51
|
+
readonly workloadInitApprovalPath: 'SERVEZONE_WORKLOADINIT_APPROVAL_PATH';
|
|
52
|
+
/** Optional member of the Mongo descriptor (database name). */
|
|
53
|
+
readonly mongoDbName: 'MONGODB_NAME';
|
|
54
|
+
/** Optional member of the Mongo descriptor (user). */
|
|
55
|
+
readonly mongoDbUser: 'MONGODB_USER';
|
|
56
|
+
/** Optional member of the Mongo descriptor (password). */
|
|
57
|
+
readonly mongoDbPass: 'MONGODB_PASS';
|
|
58
|
+
/** The S3 port. This contract states no default. */
|
|
59
|
+
readonly s3Port: 'S3_PORT';
|
|
60
|
+
/** Whether S3 is reached over TLS (`true` or `false`). This contract states no default. */
|
|
61
|
+
readonly s3UseSsl: 'S3_USESSL';
|
|
62
|
+
/**
|
|
63
|
+
* The host channel of a hosted Cloudly, together with `SERVEZONE_APP_CONTROL_TOKEN`
|
|
64
|
+
* (`hostedAppRuntimeIdentityKeys`). Cloudly counts as hosted only while both are set.
|
|
65
|
+
*/
|
|
66
|
+
readonly runtimeUrl: "SERVEZONE_RUNTIME_URL";
|
|
67
|
+
/** The host's machine JWT for the host channel, delivered as a secret. */
|
|
68
|
+
readonly controlToken: "SERVEZONE_APP_CONTROL_TOKEN";
|
|
69
|
+
readonly platformOidcIssuer: 'SERVEZONE_PLATFORM_OIDC_ISSUER';
|
|
70
|
+
readonly platformOidcClientId: 'SERVEZONE_PLATFORM_OIDC_CLIENT_ID';
|
|
71
|
+
readonly platformOidcClientSecret: 'SERVEZONE_PLATFORM_OIDC_CLIENT_SECRET';
|
|
72
|
+
readonly platformOidcRedirectUri: 'SERVEZONE_PLATFORM_OIDC_REDIRECT_URI';
|
|
73
|
+
readonly platformOidcAudience: 'SERVEZONE_PLATFORM_OIDC_AUDIENCE';
|
|
74
|
+
/** The schedule of the backup of every service; unset, Cloudly schedules no backup. */
|
|
75
|
+
readonly backupCron: 'CLOUDLY_BACKUP_CRON';
|
|
76
|
+
/** How many backups of a service the retention keeps; `24` when unset. */
|
|
77
|
+
readonly backupKeepLast: 'CLOUDLY_BACKUP_KEEP_LAST';
|
|
78
|
+
/**
|
|
79
|
+
* The interval of the periodic BaseOS image build cleanup in milliseconds; 43,200,000 (12 hours)
|
|
80
|
+
* when unset. A value that is not a positive number turns the periodic cleanup off.
|
|
81
|
+
*/
|
|
82
|
+
readonly baseOsImageCleanupIntervalMs: 'CLOUDLY_BASEOS_IMAGE_CLEANUP_INTERVAL_MS';
|
|
83
|
+
/**
|
|
84
|
+
* This controller site's own origin (Linus rulings 69 Q3 and 79 Q1): a canonical `https` origin
|
|
85
|
+
* (`data.validateControllerOrigin`), the `IControllerPeerSet.activeOrigin` this site states while
|
|
86
|
+
* it is active and the origin the witness names it by. While unset, the site counts as
|
|
87
|
+
* `SERVEZONE_PUBLIC_ORIGIN`, but only while the controller row lists no shadow; once it lists one,
|
|
88
|
+
* a start refuses an unset value or one equal to `SERVEZONE_PUBLIC_ORIGIN`. A fact about this one
|
|
89
|
+
* site, never stored in the replicated controller database.
|
|
90
|
+
*/
|
|
91
|
+
readonly siteOrigin: 'SERVEZONE_SITE_ORIGIN';
|
|
92
|
+
/**
|
|
93
|
+
* The canonical `https` origin of the witness this site reads (`requests.witness`). Set together
|
|
94
|
+
* with `SERVEZONE_WITNESS_BEARER_PATH` or not at all: a start with only one of them is refused,
|
|
95
|
+
* naming the one that is unset. Required once the controller row lists another site as a shadow.
|
|
96
|
+
*/
|
|
97
|
+
readonly witnessOrigin: 'SERVEZONE_WITNESS_ORIGIN';
|
|
98
|
+
/**
|
|
99
|
+
* The path of this site's witness bearer, a private file under the rules of the secret keyring
|
|
100
|
+
* (`SERVEZONE_SECRET_KEYRING_PATH`) holding the 43-character base64url of 32 random bytes
|
|
101
|
+
* (`data.witnessContract.bearerRandomBytes`). The host creates it; Cloudly only reads it and
|
|
102
|
+
* hashes it, never writes or logs it. Set together with `SERVEZONE_WITNESS_ORIGIN` or not at all.
|
|
103
|
+
*/
|
|
104
|
+
readonly witnessBearerPath: 'SERVEZONE_WITNESS_BEARER_PATH';
|
|
105
|
+
/**
|
|
106
|
+
* The port of Cloudly's relayed listener (Linus ruling 141 C7), a second port beside
|
|
107
|
+
* `SERVEZONE_LISTENPORT` that the host's relay ingress forwards to, and only to. Relayedness is
|
|
108
|
+
* the accepting listener, so this port serves the human surface only: the UI, human sign-in and
|
|
109
|
+
* human typed requests, never machine endpoints or Destroy. This contract states no default. A
|
|
110
|
+
* host that advertises `relayIngress` (`cloudlyHostExtras`) sets it together with
|
|
111
|
+
* `SERVEZONE_RELAY_INGRESS_ADDRESS`.
|
|
112
|
+
*/
|
|
113
|
+
readonly relayedListenPort: 'SERVEZONE_RELAYED_LISTENPORT';
|
|
114
|
+
/**
|
|
115
|
+
* Where Cloudly's cloud access connector dials the host's relay ingress (Linus ruling 141 C6 and
|
|
116
|
+
* C7, amendment 141a point 4): `<host>:<port>`, an IPv6 address in brackets
|
|
117
|
+
* (`[2001:db8::1]:8443`). The relay ingress is the host's second listener, reachable from the
|
|
118
|
+
* Cloudly container, that serves `SERVEZONE_PUBLIC_ORIGIN`'s TLS and forwards only to
|
|
119
|
+
* `SERVEZONE_RELAYED_LISTENPORT`. The connector never dials the public origin by name, whose
|
|
120
|
+
* public DNS points at the relay, nor an address taken from a request. A host that advertises
|
|
121
|
+
* `relayIngress` sets it together with `SERVEZONE_RELAYED_LISTENPORT`.
|
|
122
|
+
*/
|
|
123
|
+
readonly relayIngressAddress: 'SERVEZONE_RELAY_INGRESS_ADDRESS';
|
|
124
|
+
}>;
|
|
125
|
+
export declare const cloudlyHostContractOptionalEnvVarList: readonly ("CLOUDLY_BACKUP_CRON" | "CLOUDLY_BACKUP_KEEP_LAST" | "CLOUDLY_BASEOS_IMAGE_CLEANUP_INTERVAL_MS" | "MONGODB_NAME" | "MONGODB_PASS" | "MONGODB_USER" | "S3_PORT" | "S3_USESSL" | "SERVEZONE_APP_CONTROL_TOKEN" | "SERVEZONE_LISTENPORT" | "SERVEZONE_PLATFORM_OIDC_AUDIENCE" | "SERVEZONE_PLATFORM_OIDC_CLIENT_ID" | "SERVEZONE_PLATFORM_OIDC_CLIENT_SECRET" | "SERVEZONE_PLATFORM_OIDC_ISSUER" | "SERVEZONE_PLATFORM_OIDC_REDIRECT_URI" | "SERVEZONE_RELAYED_LISTENPORT" | "SERVEZONE_RELAY_INGRESS_ADDRESS" | "SERVEZONE_RUNTIME_URL" | "SERVEZONE_SITE_ORIGIN" | "SERVEZONE_WITNESS_BEARER_PATH" | "SERVEZONE_WITNESS_ORIGIN" | "SERVEZONE_WORKLOADINIT_APPROVAL_PATH")[];
|
|
126
|
+
export type TCloudlyHostOptionalEnvVar = typeof cloudlyHostContractOptionalEnvVarList[number];
|
|
127
|
+
/** Standard optional offers. These are separate from the advertised extras. */
|
|
128
|
+
export declare const cloudlyHostStandardOffers: readonly ["hosted-runtime-identity", "backups", "local-node", "shadow-pairing"];
|
|
129
|
+
/** Closed vocabulary for the versioned host advertisement. */
|
|
130
|
+
export declare const cloudlyHostExtraCapabilities: readonly ["relayIngress"];
|
|
131
|
+
export type TCloudlyHostExtraCapability = typeof cloudlyHostExtraCapabilities[number];
|
|
132
|
+
export interface ICloudlyHostAdvertisedExtras {
|
|
133
|
+
readonly contractVersion: 1;
|
|
134
|
+
readonly capabilities: readonly TCloudlyHostExtraCapability[];
|
|
135
|
+
}
|
|
136
|
+
/** Validate a stated advertisement. Only normalization accepts absence. */
|
|
137
|
+
export declare const validateCloudlyHostAdvertisedExtras: (valueArg: unknown) => string[];
|
|
138
|
+
/** No host channel or advertisement means no extras. A malformed advertisement throws. */
|
|
139
|
+
export declare const normalizeCloudlyHostAdvertisedExtras: (valueArg: unknown) => ICloudlyHostAdvertisedExtras;
|
|
140
|
+
/** Only a valid advertisement can offer a capability. */
|
|
141
|
+
export declare const hasCloudlyHostExtraCapability: (extrasArg: ICloudlyHostAdvertisedExtras | null | undefined, capabilityArg: TCloudlyHostExtraCapability) => boolean;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { readDataElements, readExactDataRecord } from '../private/dataproperties.js';
|
|
2
|
+
import { hostedAppRuntimeIdentityKeys } from './hostedapp.js';
|
|
3
|
+
/** The environment Cloudly requires at startup, as verified by its `qenv.yml`. */
|
|
4
|
+
export const cloudlyHostContractRequiredEnvVars = Object.freeze({
|
|
5
|
+
/**
|
|
6
|
+
* The deployment environment. Production hosts set `production`; any other value turns on
|
|
7
|
+
* development reloading. The value is fixed for the life of a database: Cloudly binds it into
|
|
8
|
+
* the credentials and sessions it stores.
|
|
9
|
+
*/
|
|
10
|
+
environment: 'SERVEZONE_ENVIRONMENT',
|
|
11
|
+
/**
|
|
12
|
+
* The origin clients reach Cloudly under: `http` or `https`, with an optional port, and no path,
|
|
13
|
+
* query or fragment. Ingress passes the request's `Host` unchanged, so it equals this origin's
|
|
14
|
+
* `host[:port]`.
|
|
15
|
+
*/
|
|
16
|
+
publicOrigin: 'SERVEZONE_PUBLIC_ORIGIN',
|
|
17
|
+
/**
|
|
18
|
+
* `external` (TLS is terminated in front of Cloudly) or `none`. Cloudly terminates no TLS itself.
|
|
19
|
+
*/
|
|
20
|
+
sslMode: 'SERVEZONE_SSLMODE',
|
|
21
|
+
/**
|
|
22
|
+
* The path of the secret keyring file. The host delivers it as a private file: a regular file
|
|
23
|
+
* that is not a symlink, has one hard link, is owned by the process user and grants no group or
|
|
24
|
+
* other permission, in a directory owned by that user that neither group nor others may write.
|
|
25
|
+
* This is the host's obligation; the Cloudly server does not check it yet.
|
|
26
|
+
*/
|
|
27
|
+
secretKeyringPath: 'SERVEZONE_SECRET_KEYRING_PATH',
|
|
28
|
+
/** The MongoDB connection URL of Cloudly's database. */
|
|
29
|
+
mongoDbUrl: 'MONGODB_URL',
|
|
30
|
+
/** The S3 endpoint of Cloudly's object storage. */
|
|
31
|
+
s3Endpoint: 'S3_ENDPOINT',
|
|
32
|
+
/** The S3 access key. */
|
|
33
|
+
s3AccessKey: 'S3_ACCESSKEY',
|
|
34
|
+
/** The S3 secret key. */
|
|
35
|
+
s3SecretKey: 'S3_SECRETKEY',
|
|
36
|
+
/** The bucket Cloudly keeps its objects in; Cloudly creates it when it does not exist. */
|
|
37
|
+
s3Bucket: 'S3_BUCKET',
|
|
38
|
+
});
|
|
39
|
+
export const cloudlyHostContractRequiredEnvVarList = Object.freeze(Object.values(cloudlyHostContractRequiredEnvVars));
|
|
40
|
+
/**
|
|
41
|
+
* Optional configuration. Both lists exclude `SERVEZONE_ADMINACCOUNT` (deprecated bootstrap)
|
|
42
|
+
* and `SERVEZONE_APP_HOST_TYPE` (display only).
|
|
43
|
+
*/
|
|
44
|
+
export const cloudlyHostContractOptionalEnvVars = Object.freeze({
|
|
45
|
+
/** The port the server binds; `cloudlyDefaultListenPort` when unset. */
|
|
46
|
+
listenPort: 'SERVEZONE_LISTENPORT',
|
|
47
|
+
/**
|
|
48
|
+
* The path of the WorkloadInit release approval file, a private file under the same rules as
|
|
49
|
+
* the secret keyring. Unset, the requests that need an approval answer
|
|
50
|
+
* `workloadinit-unconfigured`.
|
|
51
|
+
*/
|
|
52
|
+
workloadInitApprovalPath: 'SERVEZONE_WORKLOADINIT_APPROVAL_PATH',
|
|
53
|
+
/** Optional member of the Mongo descriptor (database name). */
|
|
54
|
+
mongoDbName: 'MONGODB_NAME',
|
|
55
|
+
/** Optional member of the Mongo descriptor (user). */
|
|
56
|
+
mongoDbUser: 'MONGODB_USER',
|
|
57
|
+
/** Optional member of the Mongo descriptor (password). */
|
|
58
|
+
mongoDbPass: 'MONGODB_PASS',
|
|
59
|
+
/** The S3 port. This contract states no default. */
|
|
60
|
+
s3Port: 'S3_PORT',
|
|
61
|
+
/** Whether S3 is reached over TLS (`true` or `false`). This contract states no default. */
|
|
62
|
+
s3UseSsl: 'S3_USESSL',
|
|
63
|
+
/**
|
|
64
|
+
* The host channel of a hosted Cloudly, together with `SERVEZONE_APP_CONTROL_TOKEN`
|
|
65
|
+
* (`hostedAppRuntimeIdentityKeys`). Cloudly counts as hosted only while both are set.
|
|
66
|
+
*/
|
|
67
|
+
runtimeUrl: hostedAppRuntimeIdentityKeys.runtimeUrl,
|
|
68
|
+
/** The host's machine JWT for the host channel, delivered as a secret. */
|
|
69
|
+
controlToken: hostedAppRuntimeIdentityKeys.controlToken,
|
|
70
|
+
platformOidcIssuer: 'SERVEZONE_PLATFORM_OIDC_ISSUER',
|
|
71
|
+
platformOidcClientId: 'SERVEZONE_PLATFORM_OIDC_CLIENT_ID',
|
|
72
|
+
platformOidcClientSecret: 'SERVEZONE_PLATFORM_OIDC_CLIENT_SECRET',
|
|
73
|
+
platformOidcRedirectUri: 'SERVEZONE_PLATFORM_OIDC_REDIRECT_URI',
|
|
74
|
+
platformOidcAudience: 'SERVEZONE_PLATFORM_OIDC_AUDIENCE',
|
|
75
|
+
/** The schedule of the backup of every service; unset, Cloudly schedules no backup. */
|
|
76
|
+
backupCron: 'CLOUDLY_BACKUP_CRON',
|
|
77
|
+
/** How many backups of a service the retention keeps; `24` when unset. */
|
|
78
|
+
backupKeepLast: 'CLOUDLY_BACKUP_KEEP_LAST',
|
|
79
|
+
/**
|
|
80
|
+
* The interval of the periodic BaseOS image build cleanup in milliseconds; 43,200,000 (12 hours)
|
|
81
|
+
* when unset. A value that is not a positive number turns the periodic cleanup off.
|
|
82
|
+
*/
|
|
83
|
+
baseOsImageCleanupIntervalMs: 'CLOUDLY_BASEOS_IMAGE_CLEANUP_INTERVAL_MS',
|
|
84
|
+
/**
|
|
85
|
+
* This controller site's own origin (Linus rulings 69 Q3 and 79 Q1): a canonical `https` origin
|
|
86
|
+
* (`data.validateControllerOrigin`), the `IControllerPeerSet.activeOrigin` this site states while
|
|
87
|
+
* it is active and the origin the witness names it by. While unset, the site counts as
|
|
88
|
+
* `SERVEZONE_PUBLIC_ORIGIN`, but only while the controller row lists no shadow; once it lists one,
|
|
89
|
+
* a start refuses an unset value or one equal to `SERVEZONE_PUBLIC_ORIGIN`. A fact about this one
|
|
90
|
+
* site, never stored in the replicated controller database.
|
|
91
|
+
*/
|
|
92
|
+
siteOrigin: 'SERVEZONE_SITE_ORIGIN',
|
|
93
|
+
/**
|
|
94
|
+
* The canonical `https` origin of the witness this site reads (`requests.witness`). Set together
|
|
95
|
+
* with `SERVEZONE_WITNESS_BEARER_PATH` or not at all: a start with only one of them is refused,
|
|
96
|
+
* naming the one that is unset. Required once the controller row lists another site as a shadow.
|
|
97
|
+
*/
|
|
98
|
+
witnessOrigin: 'SERVEZONE_WITNESS_ORIGIN',
|
|
99
|
+
/**
|
|
100
|
+
* The path of this site's witness bearer, a private file under the rules of the secret keyring
|
|
101
|
+
* (`SERVEZONE_SECRET_KEYRING_PATH`) holding the 43-character base64url of 32 random bytes
|
|
102
|
+
* (`data.witnessContract.bearerRandomBytes`). The host creates it; Cloudly only reads it and
|
|
103
|
+
* hashes it, never writes or logs it. Set together with `SERVEZONE_WITNESS_ORIGIN` or not at all.
|
|
104
|
+
*/
|
|
105
|
+
witnessBearerPath: 'SERVEZONE_WITNESS_BEARER_PATH',
|
|
106
|
+
/**
|
|
107
|
+
* The port of Cloudly's relayed listener (Linus ruling 141 C7), a second port beside
|
|
108
|
+
* `SERVEZONE_LISTENPORT` that the host's relay ingress forwards to, and only to. Relayedness is
|
|
109
|
+
* the accepting listener, so this port serves the human surface only: the UI, human sign-in and
|
|
110
|
+
* human typed requests, never machine endpoints or Destroy. This contract states no default. A
|
|
111
|
+
* host that advertises `relayIngress` (`cloudlyHostExtras`) sets it together with
|
|
112
|
+
* `SERVEZONE_RELAY_INGRESS_ADDRESS`.
|
|
113
|
+
*/
|
|
114
|
+
relayedListenPort: 'SERVEZONE_RELAYED_LISTENPORT',
|
|
115
|
+
/**
|
|
116
|
+
* Where Cloudly's cloud access connector dials the host's relay ingress (Linus ruling 141 C6 and
|
|
117
|
+
* C7, amendment 141a point 4): `<host>:<port>`, an IPv6 address in brackets
|
|
118
|
+
* (`[2001:db8::1]:8443`). The relay ingress is the host's second listener, reachable from the
|
|
119
|
+
* Cloudly container, that serves `SERVEZONE_PUBLIC_ORIGIN`'s TLS and forwards only to
|
|
120
|
+
* `SERVEZONE_RELAYED_LISTENPORT`. The connector never dials the public origin by name, whose
|
|
121
|
+
* public DNS points at the relay, nor an address taken from a request. A host that advertises
|
|
122
|
+
* `relayIngress` sets it together with `SERVEZONE_RELAYED_LISTENPORT`.
|
|
123
|
+
*/
|
|
124
|
+
relayIngressAddress: 'SERVEZONE_RELAY_INGRESS_ADDRESS',
|
|
125
|
+
});
|
|
126
|
+
export const cloudlyHostContractOptionalEnvVarList = Object.freeze(Object.values(cloudlyHostContractOptionalEnvVars));
|
|
127
|
+
/** Standard optional offers. These are separate from the advertised extras. */
|
|
128
|
+
export const cloudlyHostStandardOffers = Object.freeze([
|
|
129
|
+
'hosted-runtime-identity',
|
|
130
|
+
'backups',
|
|
131
|
+
'local-node',
|
|
132
|
+
'shadow-pairing',
|
|
133
|
+
]);
|
|
134
|
+
/** Closed vocabulary for the versioned host advertisement. */
|
|
135
|
+
export const cloudlyHostExtraCapabilities = Object.freeze([
|
|
136
|
+
'relayIngress',
|
|
137
|
+
]);
|
|
138
|
+
const advertisedExtrasContractVersion = 1;
|
|
139
|
+
const advertisedExtrasKeys = ['contractVersion', 'capabilities'];
|
|
140
|
+
const isCloudlyHostExtraCapability = (valueArg) => cloudlyHostExtraCapabilities.includes(valueArg);
|
|
141
|
+
const readCloudlyHostAdvertisedExtras = (valueArg) => {
|
|
142
|
+
const record = readExactDataRecord(valueArg, advertisedExtrasKeys);
|
|
143
|
+
if (record === null) {
|
|
144
|
+
return 'Cloudly host advertised extras must be an object with exactly contractVersion and capabilities';
|
|
145
|
+
}
|
|
146
|
+
if (record.contractVersion !== advertisedExtrasContractVersion) {
|
|
147
|
+
return 'Cloudly host advertised extras contractVersion must be 1';
|
|
148
|
+
}
|
|
149
|
+
const elements = readDataElements(record.capabilities, cloudlyHostExtraCapabilities.length);
|
|
150
|
+
if (elements === null || new Set(elements).size !== elements.length) {
|
|
151
|
+
return 'Cloudly host advertised extras capabilities must be a dense array of unique capabilities';
|
|
152
|
+
}
|
|
153
|
+
if (!elements.every(isCloudlyHostExtraCapability)) {
|
|
154
|
+
return 'Cloudly host advertised extras contains an unknown capability';
|
|
155
|
+
}
|
|
156
|
+
return { contractVersion: advertisedExtrasContractVersion, capabilities: elements };
|
|
157
|
+
};
|
|
158
|
+
/** Validate a stated advertisement. Only normalization accepts absence. */
|
|
159
|
+
export const validateCloudlyHostAdvertisedExtras = (valueArg) => {
|
|
160
|
+
const result = readCloudlyHostAdvertisedExtras(valueArg);
|
|
161
|
+
return typeof result === 'string' ? [result] : [];
|
|
162
|
+
};
|
|
163
|
+
/** No host channel or advertisement means no extras. A malformed advertisement throws. */
|
|
164
|
+
export const normalizeCloudlyHostAdvertisedExtras = (valueArg) => {
|
|
165
|
+
if (valueArg === undefined || valueArg === null) {
|
|
166
|
+
return { contractVersion: advertisedExtrasContractVersion, capabilities: [] };
|
|
167
|
+
}
|
|
168
|
+
const result = readCloudlyHostAdvertisedExtras(valueArg);
|
|
169
|
+
if (typeof result === 'string') {
|
|
170
|
+
throw new Error(result);
|
|
171
|
+
}
|
|
172
|
+
return result;
|
|
173
|
+
};
|
|
174
|
+
/** Only a valid advertisement can offer a capability. */
|
|
175
|
+
export const hasCloudlyHostExtraCapability = (extrasArg, capabilityArg) => {
|
|
176
|
+
const result = readCloudlyHostAdvertisedExtras(extrasArg);
|
|
177
|
+
return typeof result !== 'string' && result.capabilities.includes(capabilityArg);
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xvdWRseWhvc3Rjb250cmFjdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzL2RhdGEvY2xvdWRseWhvc3Rjb250cmFjdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUNyRixPQUFPLEVBQUUsNEJBQTRCLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUU5RCxrRkFBa0Y7QUFDbEYsTUFBTSxDQUFDLE1BQU0sa0NBQWtDLEdBQUcsTUFBTSxDQUFDLE1BQU0sQ0FBQztJQUM5RDs7OztPQUlHO0lBQ0gsV0FBVyxFQUFFLHVCQUF1QjtJQUNwQzs7OztPQUlHO0lBQ0gsWUFBWSxFQUFFLHlCQUF5QjtJQUN2Qzs7T0FFRztJQUNILE9BQU8sRUFBRSxtQkFBbUI7SUFDNUI7Ozs7O09BS0c7SUFDSCxpQkFBaUIsRUFBRSwrQkFBK0I7SUFDbEQsd0RBQXdEO0lBQ3hELFVBQVUsRUFBRSxhQUFhO0lBQ3pCLG1EQUFtRDtJQUNuRCxVQUFVLEVBQUUsYUFBYTtJQUN6Qix5QkFBeUI7SUFDekIsV0FBVyxFQUFFLGNBQWM7SUFDM0IseUJBQXlCO0lBQ3pCLFdBQVcsRUFBRSxjQUFjO0lBQzNCLDBGQUEwRjtJQUMxRixRQUFRLEVBQUUsV0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QUNsRCxRQUFpQixFQUNhLEVBQUU7SUFDaEMsSUFBSSxRQUFRLEtBQUssU0FBUyxJQUFJLFFBQVEsS0FBSyxJQUFJLEVBQUUsQ0FBQztRQUNoRCxPQUFPLEVBQUUsZUFBZSxFQUFFLCtCQUErQixFQUFFLFlBQVksRUFBRSxFQUFFLEVBQUUsQ0FBQztJQUNoRixDQUFDO0lBQ0QsTUFBTSxNQUFNLEdBQUcsK0JBQStCLENBQUMsUUFBUSxDQUFDLENBQUM7SUFDekQsSUFBSSxPQUFPLE1BQU0sS0FBSyxRQUFRLEVBQUUsQ0FBQztRQUMvQixNQUFNLElBQUksS0FBSyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQzFCLENBQUM7SUFDRCxPQUFPLE1BQU0sQ0FBQztBQUNoQixDQUFDLENBQUM7QUFFRix5REFBeUQ7QUFDekQsTUFBTSxDQUFDLE1BQU0sNkJBQTZCLEdBQUcsQ0FDM0MsU0FBMEQsRUFDMUQsYUFBMEMsRUFDakMsRUFBRTtJQUNYLE1BQU0sTUFBTSxHQUFHLCtCQUErQixDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQzFELE9BQU8sT0FBTyxNQUFNLEtBQUssUUFBUSxJQUFJLE1BQU0sQ0FBQyxZQUFZLENBQUMsUUFBUSxDQUFDLGFBQWEsQ0FBQyxDQUFDO0FBQ25GLENBQUMsQ0FBQyJ9
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ICloudlyHostAdvertisedExtras } from './cloudlyhostcontract.js';
|
|
1
2
|
/**
|
|
2
3
|
* The kind of host running a hosted app (`onebox`, `cloudly`, or another host's name), for display
|
|
3
4
|
* only: never branch on it. A host's capabilities reach an app only through the extras the host
|
|
@@ -174,6 +175,8 @@ export interface IHostedAppLifecycleState extends IHostedAppLifecycleReport {
|
|
|
174
175
|
* nothing, and so does a list the validator refuses.
|
|
175
176
|
*/
|
|
176
177
|
hostExtras?: string[];
|
|
178
|
+
/** Optional host-owned advertisement in the Cloudly host contract's closed format. */
|
|
179
|
+
advertisedExtras?: ICloudlyHostAdvertisedExtras;
|
|
177
180
|
}
|
|
178
181
|
type THostedAppBootstrapActionServerFields = 'id' | 'revision' | 'status' | 'createdAt' | 'updatedAt' | 'completedAt' | 'dismissedAt';
|
|
179
182
|
export type IHostedAppBootstrapActionRequest = (Omit<Extract<IHostedAppBootstrapAction, {
|