@jchat/runtime 1.0.0-alpha.3 → 1.0.0-alpha.30
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 +199 -0
- package/LICENSE +18 -122
- package/README.md +6 -4
- package/dist/distribution.d.mts +13 -0
- package/dist/distribution.mjs +4 -0
- package/dist/index.d.mts +268 -113
- package/dist/index.mjs +9 -1
- package/package.json +32 -18
- package/src/audit.test.ts +0 -25
- package/src/audit.ts +0 -25
- package/src/check.test.ts +0 -77
- package/src/check.ts +0 -202
- package/src/domain.test.ts +0 -45
- package/src/domain.ts +0 -75
- package/src/env.test.ts +0 -146
- package/src/env.ts +0 -256
- package/src/index.test.ts +0 -117
- package/src/index.ts +0 -206
- package/src/install.ts +0 -62
- package/src/paths.test.ts +0 -49
- package/src/paths.ts +0 -74
- package/src/runtime.test.ts +0 -21
- package/src/runtime.ts +0 -31
- package/src/state.test.ts +0 -54
- package/src/state.ts +0 -129
package/dist/index.d.mts
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { APPLICATION_DISTRIBUTION, APPLICATION_DISTRIBUTIONS, ApplicationDistribution, IS_DEVELOPER_SANDBOX, isDeveloperSandbox, resolveApplicationDistribution } from "./distribution.mjs";
|
|
2
|
+
import { Elysia } from "elysia";
|
|
2
3
|
//#region src/domain.d.ts
|
|
3
|
-
type
|
|
4
|
-
type
|
|
5
|
-
type
|
|
6
|
-
type
|
|
4
|
+
export type Provider = "envato" | "jchat";
|
|
5
|
+
export type Plan = string;
|
|
6
|
+
export type RoutingMode = "path" | "subdomain";
|
|
7
|
+
export type DomainScope = "current-host" | "parent-domain";
|
|
8
|
+
export type NormalizedDomain = {
|
|
7
9
|
host: string;
|
|
8
10
|
isLocalhost: boolean;
|
|
9
11
|
};
|
|
10
12
|
/** Normalize the host used for instance binding; ports and www are not significant. */
|
|
11
|
-
declare function normalizeDomain(value: string): NormalizedDomain;
|
|
12
|
-
declare function isPublicDomain(value: string): boolean;
|
|
13
|
-
declare function isAllowedConfiguredDomain(value: string): boolean;
|
|
14
|
-
declare function
|
|
13
|
+
export declare function normalizeDomain(value: string): NormalizedDomain;
|
|
14
|
+
export declare function isPublicDomain(value: string): boolean;
|
|
15
|
+
export declare function isAllowedConfiguredDomain(value: string): boolean;
|
|
16
|
+
export declare function isLocalhostDomain(value: string): boolean;
|
|
17
|
+
export declare function getRootDomain(value: string): string | null;
|
|
18
|
+
/** Checks if a request domain matches or is an authorized subdomain of the licensed domain. */
|
|
19
|
+
export declare function isMatchingDomain(requestHost: string, licensedDomain: string): boolean;
|
|
20
|
+
export declare function resolveActivationDomain(host: string, isMultiSite: boolean, routingMode: RoutingMode, domainScope?: DomainScope): string;
|
|
15
21
|
//#endregion
|
|
16
22
|
//#region src/audit.d.ts
|
|
17
|
-
type AuditEvent = "check_success" | "check_unreachable" | "check_rejected";
|
|
18
|
-
declare function recordAudit(event: AuditEvent, details: {
|
|
23
|
+
export type AuditEvent = "check_success" | "check_unreachable" | "check_rejected";
|
|
24
|
+
export declare function recordAudit(event: AuditEvent, details: {
|
|
19
25
|
domain?: string;
|
|
20
26
|
installationId?: string;
|
|
21
27
|
reference?: string;
|
|
@@ -34,18 +40,14 @@ type CheckResult = {
|
|
|
34
40
|
error: string;
|
|
35
41
|
reference: string;
|
|
36
42
|
};
|
|
37
|
-
type RegistryProvider = "envato" | "jchat";
|
|
38
|
-
type RegistryRoutingMode = "path" | "subdomain";
|
|
39
43
|
type ActivationInput = {
|
|
40
44
|
purchaseCode: string;
|
|
41
45
|
domain: string;
|
|
42
46
|
siteSlug?: string;
|
|
43
47
|
domainScope?: "current-host" | "parent-domain";
|
|
44
|
-
provider:
|
|
45
|
-
routingMode:
|
|
48
|
+
provider: Provider;
|
|
49
|
+
routingMode: RoutingMode;
|
|
46
50
|
installationId: string;
|
|
47
|
-
installationPublicKey: string;
|
|
48
|
-
machineFingerprint: string;
|
|
49
51
|
registryEndpoint?: string;
|
|
50
52
|
fetchImpl?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
51
53
|
};
|
|
@@ -58,58 +60,85 @@ type ActivationResult = {
|
|
|
58
60
|
success: false;
|
|
59
61
|
message: string;
|
|
60
62
|
};
|
|
61
|
-
declare function activateRegistry(input: ActivationInput): Promise<ActivationResult>;
|
|
63
|
+
export declare function activateRegistry(input: ActivationInput): Promise<ActivationResult>;
|
|
62
64
|
type CheckInput = {
|
|
63
65
|
token: string;
|
|
64
66
|
domain: string;
|
|
65
|
-
routingMode:
|
|
67
|
+
routingMode: RoutingMode;
|
|
66
68
|
installationId: string;
|
|
67
|
-
machineFingerprint: string;
|
|
68
69
|
registryEndpoint?: string;
|
|
69
70
|
runtimeOptions?: RuntimeOptions;
|
|
70
71
|
auditPath?: string;
|
|
72
|
+
lastSuccessfulCheckAt?: string;
|
|
73
|
+
gracePeriodDays?: number;
|
|
71
74
|
fetchImpl?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
72
|
-
localTokenValidator?: (token: string, domain: string, installationId: string
|
|
75
|
+
localTokenValidator?: (token: string, domain: string, installationId: string) => boolean;
|
|
73
76
|
};
|
|
74
|
-
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/constants.d.ts
|
|
79
|
+
export declare const DEFAULT_LICENSE_SERVER_URL = "https://license.jchatcloud.com";
|
|
80
|
+
export declare const DEFAULT_LICENSE_ISSUER = "https://license.jchatcloud.com";
|
|
81
|
+
export declare const DEFAULT_LICENSE_AUDIENCE = "jchat-chat";
|
|
82
|
+
export declare function getOfficialSigningPublicKey(): string;
|
|
83
|
+
export declare const OFFICIAL_SIGNING_PUBLIC_KEY: string;
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/feature-crypto.d.ts
|
|
86
|
+
export interface FeatureExecutionContext {
|
|
87
|
+
isValid: boolean;
|
|
88
|
+
featureKey: string;
|
|
89
|
+
stage?: FeatureStage;
|
|
90
|
+
siteId?: string;
|
|
91
|
+
executionToken?: string;
|
|
92
|
+
error?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Derives a cryptographically bound HMAC-SHA256 secret for a specific feature using the verified
|
|
96
|
+
* signature of the instance license token. Throws an Error if the signature is invalid or the token
|
|
97
|
+
* cannot be verified.
|
|
98
|
+
*/
|
|
99
|
+
export declare function deriveFeatureKey(token: string, featureKey: string, domain?: string, options?: RuntimeOptions): string;
|
|
100
|
+
/**
|
|
101
|
+
* Checks and returns the allowed feature stages (stable, beta, experimental) for the current
|
|
102
|
+
* instance. The license token MUST have a valid RS256 cryptographic signature against the vendor
|
|
103
|
+
* public key; otherwise, only "stable" is returned.
|
|
104
|
+
*/
|
|
105
|
+
export declare function checkAllowedStages(domain?: string, options?: RuntimeOptions): FeatureStage[];
|
|
106
|
+
/**
|
|
107
|
+
* Checks and returns the release channel (stable, lts) for the current instance. Reverts to
|
|
108
|
+
* "stable" if the token has no valid cryptographic signature.
|
|
109
|
+
*/
|
|
110
|
+
export declare function checkReleaseChannel(domain?: string, options?: RuntimeOptions): ReleaseChannel;
|
|
111
|
+
/** Verifies that the instance is cryptographically licensed to execute a feature at a given stage. */
|
|
112
|
+
export declare function verifyFeatureStageAccess(stage: FeatureStage, domain?: string, options?: RuntimeOptions): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Derives a full FeatureExecutionContext. If the feature's required stage is not licensed or the
|
|
115
|
+
* token signature is invalid, isValid is false with an appropriate error message.
|
|
116
|
+
*/
|
|
117
|
+
export declare function deriveFeatureExecutionContext(featureKey: string, requiredStage?: FeatureStage, siteId?: string, domain?: string, options?: RuntimeOptions): FeatureExecutionContext;
|
|
75
118
|
//#endregion
|
|
76
119
|
//#region src/state.d.ts
|
|
77
120
|
type LocalState = {
|
|
78
121
|
version: 1;
|
|
79
122
|
installationId: string;
|
|
80
|
-
privateKeyPem: string;
|
|
81
|
-
publicKeyPem: string;
|
|
82
|
-
machineFingerprint: string;
|
|
83
123
|
instanceToken: string;
|
|
124
|
+
domain?: string;
|
|
84
125
|
lastSuccessfulCheckAt?: string;
|
|
85
126
|
};
|
|
86
|
-
declare
|
|
87
|
-
declare function
|
|
88
|
-
declare
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
privateKeyPem: string;
|
|
92
|
-
publicKeyPem: string;
|
|
93
|
-
};
|
|
94
|
-
declare function readTokenSync(filePath?: string): string;
|
|
95
|
-
declare function readState(filePath?: string): Promise<LocalState | null>;
|
|
96
|
-
declare function writeState(state: LocalState, filePath?: string): Promise<void>;
|
|
97
|
-
declare function updateInstanceToken(instanceToken: string, statePath?: string): Promise<void>;
|
|
98
|
-
declare function acquireProcessLock(statePath?: string): Promise<() => Promise<void>>;
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region src/runtime.d.ts
|
|
101
|
-
type RuntimeStatus$1 = "valid" | "unreachable-fallback" | "invalid" | "unavailable";
|
|
102
|
-
declare function registerInvalidationHandler(handler: () => void): void;
|
|
103
|
-
declare function setRuntimeStatus(status: RuntimeStatus$1, reference?: string): void;
|
|
104
|
-
declare function getRuntimeStatus(): {
|
|
105
|
-
status: RuntimeStatus$1;
|
|
106
|
-
reference: string;
|
|
127
|
+
export declare function resolveDataDir(): string;
|
|
128
|
+
export declare function getDefaultStatePath(): string;
|
|
129
|
+
export declare const DEFAULT_STATE_PATH: string;
|
|
130
|
+
export declare function createIdentity(): {
|
|
131
|
+
installationId: string;
|
|
107
132
|
};
|
|
108
|
-
declare function
|
|
133
|
+
export declare function readStateSync(filePath?: string): LocalState | null;
|
|
134
|
+
export declare function readTokenSync(filePath?: string): string;
|
|
135
|
+
export declare function readState(filePath?: string): Promise<LocalState | null>;
|
|
136
|
+
export declare function writeState(state: LocalState, filePath?: string): Promise<void>;
|
|
137
|
+
export declare function updateInstanceToken(instanceToken: string, statePath?: string): Promise<void>;
|
|
109
138
|
//#endregion
|
|
110
139
|
//#region src/install.d.ts
|
|
111
|
-
type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
112
|
-
type LicenseVerificationResult = {
|
|
140
|
+
export type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
141
|
+
export type LicenseVerificationResult = {
|
|
113
142
|
valid: true;
|
|
114
143
|
buyer: string;
|
|
115
144
|
token: string;
|
|
@@ -119,99 +148,225 @@ type LicenseVerificationResult = {
|
|
|
119
148
|
valid: false;
|
|
120
149
|
error: string;
|
|
121
150
|
};
|
|
122
|
-
declare function installAndActivate(purchaseCode: string, domain: string, siteSlug: string | undefined, domainScope: DomainScope | undefined, routingMode: RoutingMode, provider?:
|
|
151
|
+
export declare function installAndActivate(purchaseCode: string, domain: string, siteSlug: string | undefined, domainScope: DomainScope | undefined, routingMode: RoutingMode, provider?: Provider, fetchImpl?: FetchLike): Promise<LicenseVerificationResult>;
|
|
123
152
|
//#endregion
|
|
124
153
|
//#region src/paths.d.ts
|
|
125
154
|
interface RuntimePathOptions {
|
|
126
155
|
cwd?: string;
|
|
127
156
|
env?: Record<string, string | undefined>;
|
|
128
157
|
}
|
|
129
|
-
declare function resolveRuntimePaths(options?: RuntimePathOptions): {
|
|
158
|
+
export declare function resolveRuntimePaths(options?: RuntimePathOptions): {
|
|
130
159
|
repoRoot: string | null;
|
|
131
160
|
runtimeRoot: string;
|
|
132
161
|
uploadsDir: string;
|
|
133
162
|
addonBundlesDir: string;
|
|
134
163
|
addonSourceDir: string;
|
|
135
164
|
migrationsDir: string;
|
|
165
|
+
dataDir: string;
|
|
136
166
|
};
|
|
167
|
+
export declare function findRepoRoot(startDir: string): string | null;
|
|
137
168
|
//#endregion
|
|
138
|
-
//#region src/
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
169
|
+
//#region src/runtime.d.ts
|
|
170
|
+
type RuntimeStatus$1 = "valid" | "unreachable-fallback" | "invalid" | "unavailable";
|
|
171
|
+
export declare function setRuntimeStatus(status: RuntimeStatus$1, reference?: string): void;
|
|
172
|
+
export declare function getRuntimeStatus(): {
|
|
173
|
+
status: RuntimeStatus$1;
|
|
174
|
+
reference: string;
|
|
175
|
+
};
|
|
176
|
+
export declare function isApplicationDisabled(): boolean;
|
|
177
|
+
export declare function isRuntimeBlocked(isProduction?: boolean): boolean;
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/plugin.d.ts
|
|
180
|
+
export type RuntimePluginOptions = {
|
|
181
|
+
domain?: string;
|
|
182
|
+
routingMode?: RoutingMode;
|
|
183
|
+
checkIntervalDays?: number;
|
|
184
|
+
signingKey?: string;
|
|
185
|
+
isBootstrapComplete?: boolean;
|
|
186
|
+
isPrimaryWorker?: boolean;
|
|
187
|
+
allowedPaths?: Set<string>;
|
|
188
|
+
onInvalidate?: () => void;
|
|
189
|
+
getSiteCount?: () => Promise<number> | number;
|
|
190
|
+
token?: string;
|
|
191
|
+
};
|
|
192
|
+
export declare function jchatRuntime(options?: RuntimePluginOptions): Elysia<"", {
|
|
193
|
+
decorator: {};
|
|
194
|
+
store: {};
|
|
195
|
+
derive: {
|
|
196
|
+
readonly runtimeStatus: {
|
|
197
|
+
status: RuntimeStatus$1;
|
|
198
|
+
reference: string;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
resolve: {};
|
|
202
|
+
}, {
|
|
203
|
+
typebox: {};
|
|
204
|
+
error: {};
|
|
205
|
+
}, {
|
|
206
|
+
schema: {};
|
|
207
|
+
standaloneSchema: {};
|
|
208
|
+
macro: {};
|
|
209
|
+
macroFn: {};
|
|
210
|
+
parser: {};
|
|
211
|
+
response: {
|
|
212
|
+
200: {
|
|
213
|
+
status: string;
|
|
214
|
+
message: string;
|
|
215
|
+
reference: string;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
}, {}, {
|
|
219
|
+
derive: {};
|
|
220
|
+
resolve: {};
|
|
221
|
+
schema: {};
|
|
222
|
+
standaloneSchema: {};
|
|
223
|
+
response: {};
|
|
224
|
+
}, {
|
|
225
|
+
derive: {};
|
|
226
|
+
resolve: {};
|
|
227
|
+
schema: {};
|
|
228
|
+
standaloneSchema: {};
|
|
229
|
+
response: {};
|
|
230
|
+
}>;
|
|
231
|
+
export declare class FeatureForbiddenError extends Error {
|
|
232
|
+
readonly status = 403;
|
|
233
|
+
readonly responseStatus: string;
|
|
234
|
+
readonly reference: string;
|
|
235
|
+
constructor(message: string, reference?: string, responseStatus?: string);
|
|
236
|
+
}
|
|
237
|
+
export interface FeatureGuardOptions {
|
|
238
|
+
feature: string;
|
|
239
|
+
stage?: FeatureStage;
|
|
240
|
+
domain?: string;
|
|
241
|
+
requiredEntitlement?: string;
|
|
242
|
+
resolveSiteId?: (context: {
|
|
243
|
+
headers: Record<string, string | undefined>;
|
|
244
|
+
authContext?: {
|
|
245
|
+
site?: {
|
|
246
|
+
id: string;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
[key: string]: unknown;
|
|
250
|
+
}) => Promise<string | undefined> | string | undefined;
|
|
251
|
+
isSiteEnabled?: (siteId: string, feature: string) => Promise<boolean> | boolean;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Elysia guard plugin that verifies a feature is active and authorized for the site/instance.
|
|
255
|
+
* Checks cryptographic license stage access, token validity, and site-level overrides.
|
|
256
|
+
*/
|
|
257
|
+
export declare function runtimeFeatureGuard(options: FeatureGuardOptions): Elysia<"", {
|
|
258
|
+
decorator: {};
|
|
259
|
+
store: {};
|
|
260
|
+
derive: {};
|
|
261
|
+
resolve: {};
|
|
262
|
+
}, {
|
|
263
|
+
typebox: {};
|
|
264
|
+
error: {};
|
|
265
|
+
}, {
|
|
266
|
+
schema: {};
|
|
267
|
+
standaloneSchema: {};
|
|
268
|
+
macro: {};
|
|
269
|
+
macroFn: {};
|
|
270
|
+
parser: {};
|
|
271
|
+
response: {};
|
|
272
|
+
}, {}, {
|
|
273
|
+
derive: {
|
|
274
|
+
readonly featureContext: FeatureExecutionContext;
|
|
275
|
+
};
|
|
276
|
+
resolve: {};
|
|
277
|
+
schema: {};
|
|
278
|
+
standaloneSchema: {};
|
|
279
|
+
response: {};
|
|
280
|
+
}, {
|
|
281
|
+
derive: {};
|
|
282
|
+
resolve: {};
|
|
283
|
+
schema: {};
|
|
284
|
+
standaloneSchema: {};
|
|
285
|
+
response: {};
|
|
286
|
+
}>;
|
|
287
|
+
export declare function refreshLicenseLease(options?: RuntimePluginOptions): Promise<CheckResult | null>;
|
|
288
|
+
export declare function startRuntimeSupervisor(options?: RuntimePluginOptions): Promise<void>;
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/server-context.d.ts
|
|
291
|
+
export interface BaseServerContext {
|
|
292
|
+
JCHAT_DOMAIN?: string;
|
|
293
|
+
JCHAT_COOKIE_SECRET: string;
|
|
294
|
+
NODE_ENV?: string;
|
|
295
|
+
SYSTEM_BOOTSTRAP_COMPLETE?: boolean;
|
|
296
|
+
[key: string]: unknown;
|
|
297
|
+
}
|
|
298
|
+
export interface ServerSchema<T> {
|
|
299
|
+
parse: (data: unknown) => T;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Validates the server environment against the application schema and seals the server context. In
|
|
303
|
+
* fresh installations or unconfigured bootstrap states where schema parsing fails, it safely falls
|
|
304
|
+
* back to an uninstalled state with a randomized cookie secret and SYSTEM_BOOTSTRAP_COMPLETE =
|
|
305
|
+
* false.
|
|
306
|
+
*/
|
|
307
|
+
export declare function loadServerConfig<T extends Record<string, unknown>>(schema: ServerSchema<T>, environment?: Record<string, unknown>, distribution?: ApplicationDistribution, publicKeyPem?: string): T & {
|
|
308
|
+
JCHAT_COOKIE_SECRET: string;
|
|
309
|
+
SYSTEM_BOOTSTRAP_COMPLETE: boolean;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Cryptographically verifies license state, validates production domain rules, salts
|
|
313
|
+
* JCHAT_COOKIE_SECRET with the HMAC license signature if verified, or randomizes it and flags
|
|
314
|
+
* SYSTEM_BOOTSTRAP_COMPLETE as false if invalid.
|
|
315
|
+
*/
|
|
316
|
+
export declare function sealServerContext<T extends Record<string, unknown>>(environmentOrConfig: T, distribution?: ApplicationDistribution, publicKeyPem?: string): T & {
|
|
317
|
+
JCHAT_COOKIE_SECRET: string;
|
|
318
|
+
SYSTEM_BOOTSTRAP_COMPLETE: boolean;
|
|
319
|
+
};
|
|
187
320
|
//#endregion
|
|
188
321
|
//#region src/index.d.ts
|
|
189
|
-
type
|
|
190
|
-
type
|
|
191
|
-
type
|
|
322
|
+
export type RuntimeEnvironment = "production" | "development";
|
|
323
|
+
export type FeatureStage = "stable" | "beta" | "experimental" | "deprecated";
|
|
324
|
+
export type ReleaseChannel = "stable" | "lts";
|
|
325
|
+
export type ConfigPayload = {
|
|
192
326
|
iss: string;
|
|
193
327
|
aud: string;
|
|
194
328
|
licenseId: string;
|
|
195
329
|
domain: string;
|
|
196
330
|
buyer: string;
|
|
197
331
|
installationId: string;
|
|
198
|
-
machineFingerprint: string;
|
|
199
332
|
plan: Plan;
|
|
200
333
|
entitlements: string[];
|
|
201
|
-
purchaseProvider:
|
|
334
|
+
purchaseProvider: Provider;
|
|
202
335
|
environment: RuntimeEnvironment;
|
|
203
336
|
routingMode: RoutingMode;
|
|
204
337
|
iat: number;
|
|
338
|
+
exp?: number;
|
|
339
|
+
isTrial?: boolean;
|
|
340
|
+
stages?: FeatureStage[];
|
|
341
|
+
channel?: ReleaseChannel;
|
|
342
|
+
limits?: {
|
|
343
|
+
maxSites: number;
|
|
344
|
+
maxRoomsPerSite?: number;
|
|
345
|
+
};
|
|
205
346
|
};
|
|
206
|
-
type RuntimeOptions = {
|
|
207
|
-
publicKeyPem
|
|
347
|
+
export type RuntimeOptions = {
|
|
348
|
+
publicKeyPem?: string;
|
|
208
349
|
issuer?: string;
|
|
209
350
|
audience?: string;
|
|
351
|
+
allowOfflineGrace?: boolean;
|
|
352
|
+
lastSuccessfulCheckAt?: string;
|
|
353
|
+
gracePeriodDays?: number;
|
|
210
354
|
};
|
|
211
|
-
type RuntimeStatus = "valid" | "unreachable-fallback" | "invalid" | "unavailable";
|
|
212
|
-
declare function parsePayload(token: string): ConfigPayload | null;
|
|
213
|
-
declare function
|
|
214
|
-
declare function
|
|
215
|
-
declare function
|
|
355
|
+
export type RuntimeStatus = "valid" | "unreachable-fallback" | "invalid" | "unavailable";
|
|
356
|
+
export declare function parsePayload(token: string): ConfigPayload | null;
|
|
357
|
+
export declare function resolveSigningPublicKey(providedPem?: string): string;
|
|
358
|
+
export declare function verifySignature(token: string, currentDomain: string, options?: RuntimeOptions): boolean;
|
|
359
|
+
export declare function verifyEntitlement(token: string, currentDomain: string, installationId: string, options?: RuntimeOptions): boolean;
|
|
360
|
+
export declare function hasEntitlement(token: string, currentDomain: string, entitlement: string, options?: RuntimeOptions): boolean;
|
|
361
|
+
export declare function isMultiSiteAllowed(token: string | undefined | null, domain?: string, options?: RuntimeOptions): boolean;
|
|
362
|
+
export declare function hasCapability(token: string | null | undefined, capability: string, domain?: string, options?: RuntimeOptions): boolean;
|
|
363
|
+
export declare function hasStageAccess(token: string | null | undefined, stage: FeatureStage, domain?: string, options?: RuntimeOptions): boolean;
|
|
364
|
+
export declare function getMaxSites(token: string | null | undefined): number;
|
|
365
|
+
export declare function getReleaseChannel(token: string | null | undefined, domain?: string, options?: RuntimeOptions): ReleaseChannel;
|
|
366
|
+
export declare function canCreateMultiSite(token: string | null | undefined): boolean;
|
|
367
|
+
export declare function checkHasEntitlement(entitlement: string, domain?: string): boolean;
|
|
368
|
+
export declare function checkMaxSites(domain?: string, options?: RuntimeOptions): number;
|
|
369
|
+
export declare function checkCanCreateMultiSite(domain?: string): boolean;
|
|
370
|
+
export declare function getContextPlan(defaultPlan?: string, domain?: string, options?: RuntimeOptions): string;
|
|
216
371
|
//#endregion
|
|
217
|
-
export {
|
|
372
|
+
export { APPLICATION_DISTRIBUTION, APPLICATION_DISTRIBUTIONS, type ActivationInput, type ActivationResult, ApplicationDistribution, type CheckInput, type CheckResult, IS_DEVELOPER_SANDBOX, type LocalState, isDeveloperSandbox, resolveApplicationDistribution };
|