@jchat/runtime 1.0.0-alpha.2 → 1.0.0-alpha.21
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 +106 -0
- package/LICENSE +18 -122
- package/README.md +6 -4
- package/dist/index.d.mts +124 -65
- package/dist/index.mjs +1 -1
- package/package.json +21 -13
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,111 @@
|
|
|
1
1
|
# @jchat/runtime
|
|
2
2
|
|
|
3
|
+
## 1.0.0-alpha.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Bumped `@jchat/*` dependencies:
|
|
8
|
+
- [`shared@1.0.0-alpha.21`](https://github.com/mjjabarullah/jchat/releases/tag/shared@v1.0.0-alpha.21)
|
|
9
|
+
|
|
10
|
+
## 1.0.0-alpha.20
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Bumped `@jchat/*` dependencies:
|
|
15
|
+
- [`shared@1.0.0-alpha.20`](https://github.com/mjjabarullah/jchat/releases/tag/shared@v1.0.0-alpha.20)
|
|
16
|
+
|
|
17
|
+
## 1.0.0-alpha.19
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Bumped `@jchat/*` dependencies:
|
|
22
|
+
- [`shared@1.0.0-alpha.19`](https://github.com/mjjabarullah/jchat/releases/tag/shared@v1.0.0-alpha.19)
|
|
23
|
+
|
|
24
|
+
## 1.0.0-alpha.17
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependency `@jchat/shared` to `v1.0.0-alpha.17`
|
|
29
|
+
|
|
30
|
+
## 1.0.0-alpha.16
|
|
31
|
+
|
|
32
|
+
No changes in this release.
|
|
33
|
+
|
|
34
|
+
## 1.0.0-alpha.15
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- adba4c7: Remove redundant `prepack` build lifecycle scripts across addon development and runtime packages to eliminate concurrent build race conditions during publication.
|
|
39
|
+
|
|
40
|
+
## 1.0.0-alpha.14
|
|
41
|
+
|
|
42
|
+
No changes in this release.
|
|
43
|
+
|
|
44
|
+
## 1.0.0-alpha.13
|
|
45
|
+
|
|
46
|
+
No changes in this release.
|
|
47
|
+
|
|
48
|
+
## 1.0.0-alpha.12
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- 3db301b: - Improve runtime supervisor reliability and multi-site configuration validation
|
|
53
|
+
- Enhance lifecycle checks and error handling in the `jchatRuntime` plugin
|
|
54
|
+
- Optimize server bootstrap and database health checks during initialization
|
|
55
|
+
- a53cd64: - Improve runtime startup performance with faster offline entitlement validation
|
|
56
|
+
- Streamline local development workflows on `localhost` and loopback environments
|
|
57
|
+
- Standardize runtime path and data directory resolution
|
|
58
|
+
- Internal runtime supervisor stability and performance improvements
|
|
59
|
+
- a7f8097: - Improve deployment security integrity and session protection
|
|
60
|
+
- Enhance runtime startup guards and installation flow routing
|
|
61
|
+
- Add offline grace period support for license verification during intermittent network interruptions
|
|
62
|
+
- Improve cross-process license locking reliability and automatic stale lock recovery
|
|
63
|
+
- Add support for custom runtime data directory configuration via `JCHAT_DATA_DIR`
|
|
64
|
+
|
|
65
|
+
## 1.0.0-alpha.11
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- 4cdf5a9: Consolidate `Provider` and `RoutingMode` types and unify runtime type exports across domain, check, install, and plugin modules.
|
|
70
|
+
- 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.
|
|
71
|
+
|
|
72
|
+
## 1.0.0-alpha.10
|
|
73
|
+
|
|
74
|
+
## 1.0.0-alpha.9
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- 7aef82c: Refactor runtime registry endpoint defaults to focus strictly on cryptographic licensing and support environment-aware overrides.
|
|
79
|
+
|
|
80
|
+
## 1.0.0-alpha.8
|
|
81
|
+
|
|
82
|
+
## 1.0.0-alpha.7
|
|
83
|
+
|
|
84
|
+
### Minor Changes
|
|
85
|
+
|
|
86
|
+
- 7cef24c: - Enhance addon package diagnostics with semantic version compatibility validation for JChat host and Addon SDK
|
|
87
|
+
- Add support for local workspace development, sandbox test harnesses, and distribution packaging
|
|
88
|
+
- Improve runtime license verification and multi-environment path resolution
|
|
89
|
+
- Update addon generator templates with 20-language i18n support, standard scripts, and type definitions
|
|
90
|
+
|
|
91
|
+
## 1.0.0-alpha.6
|
|
92
|
+
|
|
93
|
+
## 1.0.0-alpha.5
|
|
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.4
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- 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`.
|
|
105
|
+
- 93d798f: Fix `ServerConfigSchema` export
|
|
106
|
+
|
|
107
|
+
## 1.0.0-alpha.3
|
|
108
|
+
|
|
3
109
|
## 1.0.0-alpha.2
|
|
4
110
|
|
|
5
111
|
### Patch Changes
|
package/LICENSE
CHANGED
|
@@ -1,127 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
CUSTOM COMMERCIAL END USER LICENSE AGREEMENT (EULA)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2026
|
|
3
|
+
Copyright (c) 2026 JChat Project. All rights reserved.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
3
|
+
Core runtime environment and instance state management package for JChat platform distributions.
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
-
|
|
11
|
+
- Bun 1.4.0+
|
|
10
12
|
|
|
11
13
|
## License
|
|
12
14
|
|
|
13
|
-
Proprietary —
|
|
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
|
|
4
|
-
type
|
|
5
|
-
type
|
|
6
|
-
type
|
|
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
|
|
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:
|
|
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,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:
|
|
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.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
|
|
87
|
-
declare
|
|
88
|
-
declare function createIdentity(
|
|
89
|
-
installationId:
|
|
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
|
|
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?:
|
|
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/
|
|
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
|
|
190
|
-
type
|
|
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:
|
|
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,
|
|
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,
|
|
276
|
+
export type { ActivationInput, ActivationResult, CheckInput, CheckResult, LocalState };
|