@jchat/runtime 1.0.0-alpha.2 → 1.0.0-alpha.20

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 CHANGED
@@ -1,5 +1,104 @@
1
1
  # @jchat/runtime
2
2
 
3
+ ## 1.0.0-alpha.20
4
+
5
+ ### Patch Changes
6
+
7
+ - Bumped `@jchat/*` dependencies:
8
+ - [`shared@1.0.0-alpha.20`](https://github.com/mjjabarullah/jchat/releases/tag/shared@v1.0.0-alpha.20)
9
+
10
+ ## 1.0.0-alpha.19
11
+
12
+ ### Patch Changes
13
+
14
+ - Bumped `@jchat/*` dependencies:
15
+ - [`shared@1.0.0-alpha.19`](https://github.com/mjjabarullah/jchat/releases/tag/shared@v1.0.0-alpha.19)
16
+
17
+ ## 1.0.0-alpha.17
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependency `@jchat/shared` to `v1.0.0-alpha.17`
22
+
23
+ ## 1.0.0-alpha.16
24
+
25
+ No changes in this release.
26
+
27
+ ## 1.0.0-alpha.15
28
+
29
+ ### Patch Changes
30
+
31
+ - adba4c7: Remove redundant `prepack` build lifecycle scripts across addon development and runtime packages to eliminate concurrent build race conditions during publication.
32
+
33
+ ## 1.0.0-alpha.14
34
+
35
+ No changes in this release.
36
+
37
+ ## 1.0.0-alpha.13
38
+
39
+ No changes in this release.
40
+
41
+ ## 1.0.0-alpha.12
42
+
43
+ ### Patch Changes
44
+
45
+ - 3db301b: - Improve runtime supervisor reliability and multi-site configuration validation
46
+ - Enhance lifecycle checks and error handling in the `jchatRuntime` plugin
47
+ - Optimize server bootstrap and database health checks during initialization
48
+ - a53cd64: - Improve runtime startup performance with faster offline entitlement validation
49
+ - Streamline local development workflows on `localhost` and loopback environments
50
+ - Standardize runtime path and data directory resolution
51
+ - Internal runtime supervisor stability and performance improvements
52
+ - a7f8097: - Improve deployment security integrity and session protection
53
+ - Enhance runtime startup guards and installation flow routing
54
+ - Add offline grace period support for license verification during intermittent network interruptions
55
+ - Improve cross-process license locking reliability and automatic stale lock recovery
56
+ - Add support for custom runtime data directory configuration via `JCHAT_DATA_DIR`
57
+
58
+ ## 1.0.0-alpha.11
59
+
60
+ ### Patch Changes
61
+
62
+ - 4cdf5a9: Consolidate `Provider` and `RoutingMode` types and unify runtime type exports across domain, check, install, and plugin modules.
63
+ - 8ce0db9: Add `jchatRuntime` Elysia plugin encapsulating background license supervision, boot check throttling (24h), configurable check intervals (`JCHAT_LICENSE_CHECK_INTERVAL_DAYS`), timer unref on exit, and fail-closed route guards.
64
+
65
+ ## 1.0.0-alpha.10
66
+
67
+ ## 1.0.0-alpha.9
68
+
69
+ ### Patch Changes
70
+
71
+ - 7aef82c: Refactor runtime registry endpoint defaults to focus strictly on cryptographic licensing and support environment-aware overrides.
72
+
73
+ ## 1.0.0-alpha.8
74
+
75
+ ## 1.0.0-alpha.7
76
+
77
+ ### Minor Changes
78
+
79
+ - 7cef24c: - Enhance addon package diagnostics with semantic version compatibility validation for JChat host and Addon SDK
80
+ - Add support for local workspace development, sandbox test harnesses, and distribution packaging
81
+ - Improve runtime license verification and multi-environment path resolution
82
+ - Update addon generator templates with 20-language i18n support, standard scripts, and type definitions
83
+
84
+ ## 1.0.0-alpha.6
85
+
86
+ ## 1.0.0-alpha.5
87
+
88
+ ### Patch Changes
89
+
90
+ - 457b0fc: Refactor server configuration: merged environment schema into `server-context.ts` in `@jchat/runtime` and updated `loadServerContext` to properly accept `publicKeyPem`. Updated `@jchat/chat` to pass `SIGNING_ROOT_KEY` into `loadServerContext`.
91
+ - 93d798f: Fix `ServerConfigSchema` export
92
+
93
+ ## 1.0.0-alpha.4
94
+
95
+ ### Patch Changes
96
+
97
+ - 457b0fc: Refactor server configuration: merged environment schema into `server-context.ts` in `@jchat/runtime` and updated `loadServerContext` to properly accept `publicKeyPem`. Updated `@jchat/chat` to pass `SIGNING_ROOT_KEY` into `loadServerContext`.
98
+ - 93d798f: Fix `ServerConfigSchema` export
99
+
100
+ ## 1.0.0-alpha.3
101
+
3
102
  ## 1.0.0-alpha.2
4
103
 
5
104
  ### Patch Changes
package/LICENSE CHANGED
@@ -1,127 +1,23 @@
1
- JChat Runtime License Agreement - July 29, 2026
1
+ CUSTOM COMMERCIAL END USER LICENSE AGREEMENT (EULA)
2
2
 
3
- Copyright (c) 2026 Md. Jabarullah. All rights reserved.
3
+ Copyright (c) 2026 JChat Project. All rights reserved.
4
4
 
5
- This agreement governs the @jchat/runtime software package (the "Runtime"). The Runtime is
6
- proprietary software made publicly downloadable only to support authorized JChat deployments.
7
- Public availability, including availability through the npm public registry, does not make the
8
- Runtime open-source software and does not grant any rights except those stated below.
5
+ 1. DEFINITIONS
6
+ "Software" refers to this npm package and its source code.
7
+ "Authorized Application" refers strictly to the application known as "JChat".
9
8
 
10
- 1. Definitions
9
+ 2. LICENSE GRANT
10
+ Subject to the terms of this Agreement and payment of any applicable fees, the
11
+ Licensor grants you a non-exclusive, non-transferable, revocable license to
12
+ download, install, and use the Software.
11
13
 
12
- "JChat" means the JChat software product and services published by Md. Jabarullah.
14
+ 3. RESTRICTIONS ON USE
15
+ You are expressly prohibited from using this Software, in whole or in part,
16
+ in any application, product, or service other than the Authorized Application (JChat).
17
+ Any deployment, linking, execution, or inclusion of this Software into an
18
+ application that is not JChat constitutes a breach of this contract and
19
+ an infringement of copyright law.
13
20
 
14
- "Vendor License" means a valid standard, extended, or vendor-issued development license for JChat
15
- obtained from JChat Hub, Envato Market, Codester, or another channel expressly authorized by the
16
- copyright owner. A one-time marketplace purchase (including from Envato Market or Codester)
17
- constitutes a perpetual Vendor License for the purchased edition, provided the purchase remains
18
- valid and compliant with the applicable marketplace terms.
19
-
20
- "Authorized Deployment" means a JChat installation that complies with its Vendor License,
21
- including its domain, installation, environment, and usage restrictions.
22
-
23
- "You" means the individual or legal entity that owns a Vendor License or is acting for its
24
- authorized license holder.
25
-
26
- 2. Limited License Grant
27
-
28
- Subject to continued compliance with this agreement and the applicable Vendor License, you receive
29
- a limited, non-exclusive, non-transferable except as expressly allowed by Section 2(d),
30
- non-sublicensable, and revocable license to:
31
-
32
- a. download the Runtime from npm or another distribution channel authorized by JChat;
33
-
34
- b. install and execute the Runtime solely as an unmodified dependency of an Authorized Deployment;
35
-
36
- c. make reasonable technical copies required for private package caches, continuous integration,
37
- Docker or other deployment images, staging environments, disaster recovery, and backups for the
38
- Authorized Deployment; and
39
-
40
- d. provide those copies to a client only as an integral part of an end product and only when that
41
- transfer is permitted by the applicable Vendor License. Distributing JChat (including this
42
- Runtime as a dependency) as a purchased item on Envato Market or another authorized marketplace
43
- constitutes permitted redistribution under this section, provided the recipient is the
44
- end-product client and not a downstream redistributor.
45
-
46
- A vendor-issued development license may additionally authorize local development use according to
47
- the conditions encoded in that license. No right is granted to use the Runtime independently from
48
- JChat or without a valid Vendor License.
49
-
50
- 3. Restrictions
51
-
52
- Except where applicable law does not permit a restriction, you must not:
53
-
54
- a. sell, rent, sublicense, republish, publicly mirror, or distribute the Runtime as a standalone or
55
- reusable package;
56
-
57
- b. modify, adapt, translate, or create derivative works of the Runtime;
58
-
59
- c. reverse engineer, decompile, disassemble, or otherwise attempt to discover non-public source
60
- code or implementation details;
61
-
62
- d. remove or alter copyright, license, attribution, integrity, entitlement, or ownership notices;
63
-
64
- e. bypass, disable, interfere with, or misrepresent activation, entitlement, domain, installation,
65
- signature, integrity, or registry verification;
66
-
67
- f. use the Runtime to build, enable, or operate an unlicensed JChat deployment; or
68
-
69
- g. use the Runtime as a component of a competing standalone product or licensing system.
70
-
71
- Internal caches and deployment artifacts allowed by Section 2 are not prohibited redistribution,
72
- provided they remain access-controlled and are used only for the Authorized Deployment.
73
-
74
- 4. Ownership
75
-
76
- The Runtime is licensed, not sold. JChat and its licensors retain all title, copyright, patent,
77
- trade-secret, and other intellectual-property rights in the Runtime. No implied license is granted.
78
-
79
- 5. Third-Party Software
80
-
81
- Third-party components, if any, remain governed by their respective licenses. This agreement does
82
- not reduce rights granted under a third-party license.
83
-
84
- 6. Updates, Services, and Vendor License Terms
85
-
86
- This agreement does not promise updates, support, availability, or continued registry access.
87
- Purchase, activation, installation, replacement, and service terms remain governed by the
88
- applicable Vendor License and written JChat terms. If those terms conflict with this agreement for
89
- the Runtime, the more specific written terms supplied by JChat control.
90
-
91
- 7. Term and Termination
92
-
93
- This agreement remains effective while you comply with it and maintain the required Vendor License.
94
- For one-time marketplace purchases (Envato Market, Codester, or equivalent), the Vendor License
95
- does not expire; this agreement terminates only if the purchase is invalidated by the marketplace,
96
- or if you materially breach this agreement. For subscription or time-limited licenses issued
97
- directly by JChat Hub, this agreement terminates when that license expires or is revoked. On
98
- termination, you must stop using the Runtime and remove all copies except copies retained solely
99
- where applicable law requires archival retention.
100
-
101
- Sections 3, 4, 5, 8, 9, and 10 survive termination.
102
-
103
- 8. Disclaimer of Warranty
104
-
105
- TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE RUNTIME IS PROVIDED "AS IS" AND "AS
106
- AVAILABLE", WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY,
107
- INCLUDING WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR
108
- PURPOSE, ACCURACY, OR RELIABILITY.
109
-
110
- 9. Limitation of Liability
111
-
112
- TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, JCHAT, MD. JABARULLAH, AND THEIR SUPPLIERS WILL
113
- NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, CONSEQUENTIAL, OR PUNITIVE DAMAGES,
114
- OR FOR LOSS OF DATA, PROFITS, REVENUE, BUSINESS, OR GOODWILL, ARISING FROM OR RELATED TO THE
115
- RUNTIME, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
116
-
117
- 10. General
118
-
119
- The governing law, venue, and dispute terms stated in the applicable Vendor License or written
120
- JChat purchase terms apply to this agreement. If any provision is unenforceable, it will be limited
121
- to the minimum extent necessary, and the remaining provisions will continue in effect. A waiver
122
- must be in writing and applies only to the specific instance waived.
123
-
124
- The JChat name, logos, and related marks are not licensed except for truthful identification of
125
- compatible products and services.
126
-
127
- For permissions outside this agreement, contact JChat through https://jchat.com.
21
+ 4. NO REDISTRIBUTION
22
+ You may not sub-license, rent, lease, or publicly redistribute this Software
23
+ to any third party without explicit written consent from the Licensor.
package/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  # @jchat/runtime
2
2
 
3
- Runtime support package for JChat deployments.
3
+ Core runtime environment and instance state management package for JChat platform distributions.
4
4
 
5
- Encapsulates instance validation, local state management, and registry communication used by the
5
+ ## Overview
6
+
7
+ `@jchat/runtime` provides low-level runtime foundations, instance state persistence, and host communication utilities for JChat server applications and licensed environments.
6
8
 
7
9
  ## Requirements
8
10
 
9
- - Node.js 20+ or Bun 1.3+
11
+ - Bun 1.4.0+
10
12
 
11
13
  ## License
12
14
 
13
- Proprietary — see the LICENSE file included in this package.
15
+ Proprietary — All rights reserved. See the [LICENSE](./LICENSE) file included in this distribution for full terms and conditions.
package/dist/index.d.mts CHANGED
@@ -1,21 +1,27 @@
1
+ import { Elysia } from "elysia";
1
2
  import * as z from "zod";
2
3
  //#region src/domain.d.ts
3
- type Plan = "standard" | "extended";
4
- type RoutingMode = "path" | "subdomain";
5
- type DomainScope = "current-host" | "parent-domain";
6
- type NormalizedDomain = {
4
+ export type Provider = "envato" | "jchat";
5
+ export type Plan = "standard" | "extended";
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 resolveActivationDomain(host: string, plan: Plan, routingMode: RoutingMode, domainScope?: DomainScope): string;
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, plan: Plan, 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: RegistryProvider;
45
- routingMode: RegistryRoutingMode;
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,47 @@ 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: RegistryRoutingMode;
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, machineFingerprint: string) => boolean;
75
+ localTokenValidator?: (token: string, domain: string, installationId: string) => boolean;
73
76
  };
74
- declare function checkRegistry(input: CheckInput): Promise<CheckResult>;
77
+ //#endregion
78
+ //#region src/constants.d.ts
79
+ export declare const DEFAULT_LICENSE_SERVER_URL = "https://license.jchatlive.com";
80
+ export declare const DEFAULT_LICENSE_ISSUER = "https://license.jchatlive.com";
81
+ export declare const DEFAULT_LICENSE_AUDIENCE = "jchat-chat";
75
82
  //#endregion
76
83
  //#region src/state.d.ts
77
84
  type LocalState = {
78
85
  version: 1;
79
86
  installationId: string;
80
- privateKeyPem: string;
81
- publicKeyPem: string;
82
- machineFingerprint: string;
83
87
  instanceToken: string;
88
+ domain?: string;
84
89
  lastSuccessfulCheckAt?: string;
85
90
  };
86
- declare const DEFAULT_STATE_PATH: string;
87
- declare function createMachineFingerprint(): string;
88
- declare function createIdentity(machineFingerprint?: string): {
89
- installationId: `${string}-${string}-${string}-${string}-${string}`;
90
- machineFingerprint: string;
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;
91
+ export declare function resolveDataDir(): string;
92
+ export declare const DEFAULT_STATE_PATH: string;
93
+ export declare function createIdentity(): {
94
+ installationId: string;
107
95
  };
108
- declare function isApplicationDisabled(): boolean;
96
+ export declare function readTokenSync(filePath?: string): string;
97
+ export declare function readState(filePath?: string): Promise<LocalState | null>;
98
+ export declare function writeState(state: LocalState, filePath?: string): Promise<void>;
99
+ export declare function updateInstanceToken(instanceToken: string, statePath?: string): Promise<void>;
109
100
  //#endregion
110
101
  //#region src/install.d.ts
111
- type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
112
- type LicenseVerificationResult = {
102
+ export type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
103
+ export type LicenseVerificationResult = {
113
104
  valid: true;
114
105
  buyer: string;
115
106
  token: string;
@@ -119,24 +110,89 @@ type LicenseVerificationResult = {
119
110
  valid: false;
120
111
  error: string;
121
112
  };
122
- declare function installAndActivate(purchaseCode: string, domain: string, siteSlug: string | undefined, domainScope: DomainScope | undefined, routingMode: RoutingMode, provider?: PurchaseProvider, fetchImpl?: FetchLike): Promise<LicenseVerificationResult>;
113
+ export declare function installAndActivate(purchaseCode: string, domain: string, siteSlug: string | undefined, domainScope: DomainScope | undefined, routingMode: RoutingMode, provider?: Provider, fetchImpl?: FetchLike): Promise<LicenseVerificationResult>;
123
114
  //#endregion
124
115
  //#region src/paths.d.ts
125
116
  interface RuntimePathOptions {
126
117
  cwd?: string;
127
118
  env?: Record<string, string | undefined>;
128
119
  }
129
- declare function resolveRuntimePaths(options?: RuntimePathOptions): {
120
+ export declare function resolveRuntimePaths(options?: RuntimePathOptions): {
130
121
  repoRoot: string | null;
131
122
  runtimeRoot: string;
132
123
  uploadsDir: string;
133
124
  addonBundlesDir: string;
134
125
  addonSourceDir: string;
135
126
  migrationsDir: string;
127
+ dataDir: string;
128
+ };
129
+ export declare function findRepoRoot(startDir: string): string | null;
130
+ //#endregion
131
+ //#region src/runtime.d.ts
132
+ type RuntimeStatus$1 = "valid" | "unreachable-fallback" | "invalid" | "unavailable";
133
+ export declare function setRuntimeStatus(status: RuntimeStatus$1, reference?: string): void;
134
+ export declare function getRuntimeStatus(): {
135
+ status: RuntimeStatus$1;
136
+ reference: string;
137
+ };
138
+ export declare function isApplicationDisabled(): boolean;
139
+ export declare function isRuntimeBlocked(isProduction?: boolean): boolean;
140
+ //#endregion
141
+ //#region src/plugin.d.ts
142
+ export type RuntimePluginOptions = {
143
+ domain?: string;
144
+ routingMode?: RoutingMode;
145
+ checkIntervalDays?: number;
146
+ signingKey?: string;
147
+ isBootstrapComplete?: boolean;
148
+ isPrimaryWorker?: boolean;
149
+ allowedPaths?: Set<string>;
150
+ onInvalidate?: () => void;
151
+ getSiteCount?: () => Promise<number> | number;
136
152
  };
153
+ export declare function startRuntimeSupervisor(options?: RuntimePluginOptions): Promise<void>;
154
+ export declare function jchatRuntime(options?: RuntimePluginOptions): Elysia<"", {
155
+ decorator: {};
156
+ store: {};
157
+ derive: {
158
+ readonly runtimeStatus: {
159
+ status: RuntimeStatus$1;
160
+ reference: string;
161
+ };
162
+ };
163
+ resolve: {};
164
+ }, {
165
+ typebox: {};
166
+ error: {};
167
+ }, {
168
+ schema: {};
169
+ standaloneSchema: {};
170
+ macro: {};
171
+ macroFn: {};
172
+ parser: {};
173
+ response: {
174
+ 200: {
175
+ status: string;
176
+ message: string;
177
+ reference: string;
178
+ };
179
+ };
180
+ }, {}, {
181
+ derive: {};
182
+ resolve: {};
183
+ schema: {};
184
+ standaloneSchema: {};
185
+ response: {};
186
+ }, {
187
+ derive: {};
188
+ resolve: {};
189
+ schema: {};
190
+ standaloneSchema: {};
191
+ response: {};
192
+ }>;
137
193
  //#endregion
138
- //#region src/env.d.ts
139
- declare const ServerConfigSchema: z.ZodObject<{
194
+ //#region src/server-context.d.ts
195
+ export declare const ServerConfigSchema: z.ZodObject<{
140
196
  JCHAT_PORT: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>>;
141
197
  JCHAT_COOKIE_SECRET: z.ZodString;
142
198
  JCHAT_DATABASE_URL: z.ZodURL;
@@ -176,6 +232,9 @@ declare const ServerConfigSchema: z.ZodObject<{
176
232
  subdomain: "subdomain";
177
233
  }>>;
178
234
  JCHAT_ADDON_ENCRYPTION_KEY: z.ZodString;
235
+ JCHAT_LICENSE_SERVER_URL: z.ZodOptional<z.ZodURL>;
236
+ JCHAT_LICENSE_CHECK_INTERVAL_DAYS: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>>;
237
+ JCHAT_STORE_SERVER_URL: z.ZodOptional<z.ZodURL>;
179
238
  NODE_ENV: z.ZodDefault<z.ZodEnum<{
180
239
  development: "development";
181
240
  production: "production";
@@ -183,35 +242,35 @@ declare const ServerConfigSchema: z.ZodObject<{
183
242
  }>>;
184
243
  SYSTEM_BOOTSTRAP_COMPLETE: z.ZodOptional<z.ZodBoolean>;
185
244
  }, z.core.$strip>;
186
- type ServerConfig = z.infer<typeof ServerConfigSchema>;
245
+ export type ServerConfig = z.infer<typeof ServerConfigSchema>;
246
+ export declare function loadServerContext(environment: Record<string, unknown>, distribution: "production" | "developer-sandbox" | undefined, publicKeyPem: string): ServerConfig;
187
247
  //#endregion
188
248
  //#region src/index.d.ts
189
- type PurchaseProvider = "envato" | "jchat";
190
- type RuntimeEnvironment = "production" | "development";
191
- type ConfigPayload = {
249
+ export type RuntimeEnvironment = "production" | "development";
250
+ export type ConfigPayload = {
192
251
  iss: string;
193
252
  aud: string;
194
253
  licenseId: string;
195
254
  domain: string;
196
255
  buyer: string;
197
256
  installationId: string;
198
- machineFingerprint: string;
199
257
  plan: Plan;
200
258
  entitlements: string[];
201
- purchaseProvider: PurchaseProvider;
259
+ purchaseProvider: Provider;
202
260
  environment: RuntimeEnvironment;
203
261
  routingMode: RoutingMode;
204
262
  iat: number;
205
263
  };
206
- type RuntimeOptions = {
264
+ export type RuntimeOptions = {
207
265
  publicKeyPem: string;
208
266
  issuer?: string;
209
267
  audience?: string;
210
268
  };
211
- type RuntimeStatus = "valid" | "unreachable-fallback" | "invalid" | "unavailable";
212
- declare function parsePayload(token: string): ConfigPayload | null;
213
- declare function verifySignature(token: string, currentDomain: string, options: RuntimeOptions): boolean;
214
- declare function verifyEntitlement(token: string, currentDomain: string, installationId: string, machineFingerprint: string, options: RuntimeOptions): boolean;
215
- declare function hasEntitlement(token: string, currentDomain: string, entitlement: string, options: RuntimeOptions): boolean;
269
+ export type RuntimeStatus = "valid" | "unreachable-fallback" | "invalid" | "unavailable";
270
+ export declare function parsePayload(token: string): ConfigPayload | null;
271
+ export declare function verifySignature(token: string, currentDomain: string, options: RuntimeOptions): boolean;
272
+ export declare function verifyEntitlement(token: string, currentDomain: string, installationId: string, options?: RuntimeOptions): boolean;
273
+ export declare function hasEntitlement(token: string, currentDomain: string, entitlement: string, options: RuntimeOptions): boolean;
274
+ export declare function isMultiSiteAllowed(token: string | undefined | null, domain?: string): boolean;
216
275
  //#endregion
217
- export { ActivationInput, ActivationResult, AuditEvent, CheckInput, CheckResult, ConfigPayload, DEFAULT_STATE_PATH, DomainScope, FetchLike, LicenseVerificationResult, LocalState, NormalizedDomain, Plan, PurchaseProvider, RegistryProvider, RegistryRoutingMode, RoutingMode, RuntimeEnvironment, RuntimeOptions, RuntimeStatus, ServerConfig, ServerConfigSchema, acquireProcessLock, activateRegistry, checkRegistry, createIdentity, createMachineFingerprint, getRuntimeStatus, hasEntitlement, installAndActivate, isAllowedConfiguredDomain, isApplicationDisabled, isPublicDomain, normalizeDomain, parsePayload, readState, readTokenSync, recordAudit, registerInvalidationHandler, resolveActivationDomain, resolveRuntimePaths, setRuntimeStatus, updateInstanceToken, verifyEntitlement, verifySignature, writeState };
276
+ export type { ActivationInput, ActivationResult, CheckInput, CheckResult, LocalState };