@aster-rpc/aster 0.1.2
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/dist/capabilities.d.ts +26 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +29 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/client.d.ts +65 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +108 -0
- package/dist/client.js.map +1 -0
- package/dist/codec.d.ts +156 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +477 -0
- package/dist/codec.js.map +1 -0
- package/dist/config.d.ts +102 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +454 -0
- package/dist/config.js.map +1 -0
- package/dist/contract/identity.d.ts +115 -0
- package/dist/contract/identity.d.ts.map +1 -0
- package/dist/contract/identity.js +188 -0
- package/dist/contract/identity.js.map +1 -0
- package/dist/contract/manifest.d.ts +77 -0
- package/dist/contract/manifest.d.ts.map +1 -0
- package/dist/contract/manifest.js +127 -0
- package/dist/contract/manifest.js.map +1 -0
- package/dist/contract/publication.d.ts +71 -0
- package/dist/contract/publication.d.ts.map +1 -0
- package/dist/contract/publication.js +85 -0
- package/dist/contract/publication.js.map +1 -0
- package/dist/decorators.d.ts +139 -0
- package/dist/decorators.d.ts.map +1 -0
- package/dist/decorators.js +175 -0
- package/dist/decorators.js.map +1 -0
- package/dist/dynamic.d.ts +61 -0
- package/dist/dynamic.d.ts.map +1 -0
- package/dist/dynamic.js +147 -0
- package/dist/dynamic.js.map +1 -0
- package/dist/framing.d.ts +74 -0
- package/dist/framing.d.ts.map +1 -0
- package/dist/framing.js +162 -0
- package/dist/framing.js.map +1 -0
- package/dist/health.d.ts +127 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/health.js +236 -0
- package/dist/health.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +101 -0
- package/dist/index.js.map +1 -0
- package/dist/interceptors/audit.d.ts +25 -0
- package/dist/interceptors/audit.d.ts.map +1 -0
- package/dist/interceptors/audit.js +46 -0
- package/dist/interceptors/audit.js.map +1 -0
- package/dist/interceptors/auth.d.ts +13 -0
- package/dist/interceptors/auth.d.ts.map +1 -0
- package/dist/interceptors/auth.js +34 -0
- package/dist/interceptors/auth.js.map +1 -0
- package/dist/interceptors/base.d.ts +74 -0
- package/dist/interceptors/base.d.ts.map +1 -0
- package/dist/interceptors/base.js +103 -0
- package/dist/interceptors/base.js.map +1 -0
- package/dist/interceptors/capability.d.ts +16 -0
- package/dist/interceptors/capability.d.ts.map +1 -0
- package/dist/interceptors/capability.js +63 -0
- package/dist/interceptors/capability.js.map +1 -0
- package/dist/interceptors/circuit-breaker.d.ts +40 -0
- package/dist/interceptors/circuit-breaker.d.ts.map +1 -0
- package/dist/interceptors/circuit-breaker.js +91 -0
- package/dist/interceptors/circuit-breaker.js.map +1 -0
- package/dist/interceptors/compression.d.ts +11 -0
- package/dist/interceptors/compression.d.ts.map +1 -0
- package/dist/interceptors/compression.js +12 -0
- package/dist/interceptors/compression.js.map +1 -0
- package/dist/interceptors/deadline.d.ts +12 -0
- package/dist/interceptors/deadline.d.ts.map +1 -0
- package/dist/interceptors/deadline.js +28 -0
- package/dist/interceptors/deadline.js.map +1 -0
- package/dist/interceptors/metrics.d.ts +43 -0
- package/dist/interceptors/metrics.d.ts.map +1 -0
- package/dist/interceptors/metrics.js +132 -0
- package/dist/interceptors/metrics.js.map +1 -0
- package/dist/interceptors/rate-limit.d.ts +24 -0
- package/dist/interceptors/rate-limit.d.ts.map +1 -0
- package/dist/interceptors/rate-limit.js +84 -0
- package/dist/interceptors/rate-limit.js.map +1 -0
- package/dist/interceptors/retry.d.ts +25 -0
- package/dist/interceptors/retry.d.ts.map +1 -0
- package/dist/interceptors/retry.js +55 -0
- package/dist/interceptors/retry.js.map +1 -0
- package/dist/limits.d.ts +77 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +137 -0
- package/dist/limits.js.map +1 -0
- package/dist/logging.d.ts +40 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +92 -0
- package/dist/logging.js.map +1 -0
- package/dist/metadata.d.ts +14 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +68 -0
- package/dist/metadata.js.map +1 -0
- package/dist/metrics.d.ts +40 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +92 -0
- package/dist/metrics.js.map +1 -0
- package/dist/peer-store.d.ts +53 -0
- package/dist/peer-store.d.ts.map +1 -0
- package/dist/peer-store.js +105 -0
- package/dist/peer-store.js.map +1 -0
- package/dist/protocol.d.ts +44 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +59 -0
- package/dist/protocol.js.map +1 -0
- package/dist/registration.d.ts +81 -0
- package/dist/registration.d.ts.map +1 -0
- package/dist/registration.js +161 -0
- package/dist/registration.js.map +1 -0
- package/dist/registry/acl.d.ts +57 -0
- package/dist/registry/acl.d.ts.map +1 -0
- package/dist/registry/acl.js +104 -0
- package/dist/registry/acl.js.map +1 -0
- package/dist/registry/client.d.ts +70 -0
- package/dist/registry/client.d.ts.map +1 -0
- package/dist/registry/client.js +115 -0
- package/dist/registry/client.js.map +1 -0
- package/dist/registry/gossip.d.ts +43 -0
- package/dist/registry/gossip.d.ts.map +1 -0
- package/dist/registry/gossip.js +102 -0
- package/dist/registry/gossip.js.map +1 -0
- package/dist/registry/keys.d.ts +25 -0
- package/dist/registry/keys.d.ts.map +1 -0
- package/dist/registry/keys.js +47 -0
- package/dist/registry/keys.js.map +1 -0
- package/dist/registry/models.d.ts +80 -0
- package/dist/registry/models.d.ts.map +1 -0
- package/dist/registry/models.js +35 -0
- package/dist/registry/models.js.map +1 -0
- package/dist/registry/publisher.d.ts +65 -0
- package/dist/registry/publisher.d.ts.map +1 -0
- package/dist/registry/publisher.js +164 -0
- package/dist/registry/publisher.js.map +1 -0
- package/dist/runtime.d.ts +267 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1366 -0
- package/dist/runtime.js.map +1 -0
- package/dist/server.d.ts +100 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +511 -0
- package/dist/server.js.map +1 -0
- package/dist/service.d.ts +72 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +98 -0
- package/dist/service.js.map +1 -0
- package/dist/session.d.ts +64 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +350 -0
- package/dist/session.js.map +1 -0
- package/dist/status.d.ts +113 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +206 -0
- package/dist/status.js.map +1 -0
- package/dist/transport/base.d.ts +46 -0
- package/dist/transport/base.d.ts.map +1 -0
- package/dist/transport/base.js +10 -0
- package/dist/transport/base.js.map +1 -0
- package/dist/transport/iroh.d.ts +45 -0
- package/dist/transport/iroh.d.ts.map +1 -0
- package/dist/transport/iroh.js +225 -0
- package/dist/transport/iroh.js.map +1 -0
- package/dist/transport/local.d.ts +48 -0
- package/dist/transport/local.d.ts.map +1 -0
- package/dist/transport/local.js +139 -0
- package/dist/transport/local.js.map +1 -0
- package/dist/trust/admission.d.ts +60 -0
- package/dist/trust/admission.d.ts.map +1 -0
- package/dist/trust/admission.js +149 -0
- package/dist/trust/admission.js.map +1 -0
- package/dist/trust/bootstrap.d.ts +109 -0
- package/dist/trust/bootstrap.d.ts.map +1 -0
- package/dist/trust/bootstrap.js +311 -0
- package/dist/trust/bootstrap.js.map +1 -0
- package/dist/trust/clock.d.ts +93 -0
- package/dist/trust/clock.d.ts.map +1 -0
- package/dist/trust/clock.js +154 -0
- package/dist/trust/clock.js.map +1 -0
- package/dist/trust/consumer.d.ts +139 -0
- package/dist/trust/consumer.d.ts.map +1 -0
- package/dist/trust/consumer.js +323 -0
- package/dist/trust/consumer.js.map +1 -0
- package/dist/trust/credentials.d.ts +98 -0
- package/dist/trust/credentials.d.ts.map +1 -0
- package/dist/trust/credentials.js +250 -0
- package/dist/trust/credentials.js.map +1 -0
- package/dist/trust/delegated.d.ts +118 -0
- package/dist/trust/delegated.d.ts.map +1 -0
- package/dist/trust/delegated.js +292 -0
- package/dist/trust/delegated.js.map +1 -0
- package/dist/trust/gossip.d.ts +146 -0
- package/dist/trust/gossip.d.ts.map +1 -0
- package/dist/trust/gossip.js +334 -0
- package/dist/trust/gossip.js.map +1 -0
- package/dist/trust/hooks.d.ts +84 -0
- package/dist/trust/hooks.d.ts.map +1 -0
- package/dist/trust/hooks.js +125 -0
- package/dist/trust/hooks.js.map +1 -0
- package/dist/trust/iid.d.ts +65 -0
- package/dist/trust/iid.d.ts.map +1 -0
- package/dist/trust/iid.js +104 -0
- package/dist/trust/iid.js.map +1 -0
- package/dist/trust/mesh.d.ts +43 -0
- package/dist/trust/mesh.d.ts.map +1 -0
- package/dist/trust/mesh.js +105 -0
- package/dist/trust/mesh.js.map +1 -0
- package/dist/trust/nonce.d.ts +39 -0
- package/dist/trust/nonce.d.ts.map +1 -0
- package/dist/trust/nonce.js +46 -0
- package/dist/trust/nonce.js.map +1 -0
- package/dist/trust/producer.d.ts +80 -0
- package/dist/trust/producer.d.ts.map +1 -0
- package/dist/trust/producer.js +151 -0
- package/dist/trust/producer.js.map +1 -0
- package/dist/trust/rcan.d.ts +29 -0
- package/dist/trust/rcan.d.ts.map +1 -0
- package/dist/trust/rcan.js +57 -0
- package/dist/trust/rcan.js.map +1 -0
- package/dist/types.d.ts +57 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +50 -0
- package/dist/types.js.map +1 -0
- package/dist/xlang.d.ts +26 -0
- package/dist/xlang.d.ts.map +1 -0
- package/dist/xlang.js +55 -0
- package/dist/xlang.js.map +1 -0
- package/package.json +59 -0
package/dist/codec.js
ADDED
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codec abstraction — serialization + optional zstd compression.
|
|
3
|
+
*
|
|
4
|
+
* Spec reference: S5.1 (serialization), S5.2 (compression)
|
|
5
|
+
*
|
|
6
|
+
* Provides:
|
|
7
|
+
* - JsonCodec: JSON over UTF-8 bytes (testing, development)
|
|
8
|
+
* - ForyCodec: @apache-fory/core XLANG (production cross-language)
|
|
9
|
+
* - Zstd compression for payloads > threshold
|
|
10
|
+
*/
|
|
11
|
+
import { MAX_DECOMPRESSED_SIZE } from './limits.js';
|
|
12
|
+
import { WIRE_TYPE_KEY } from './decorators.js';
|
|
13
|
+
import { ContractViolationError } from './status.js';
|
|
14
|
+
/** Default compression threshold in bytes (4 KiB). */
|
|
15
|
+
export const DEFAULT_COMPRESSION_THRESHOLD = 4096;
|
|
16
|
+
/** Re-export WIRE_TYPE_KEY as wireType for API compatibility. */
|
|
17
|
+
export { WIRE_TYPE_KEY as wireType };
|
|
18
|
+
/** Get the wire type tag from a @WireType-decorated class. */
|
|
19
|
+
export function getWireType(cls) {
|
|
20
|
+
return cls?.[WIRE_TYPE_KEY];
|
|
21
|
+
}
|
|
22
|
+
// -- Zstd helpers (use node:zlib which has zstd since Node 21.7) --------------
|
|
23
|
+
let _zstdAvailable;
|
|
24
|
+
let _zstdCompress;
|
|
25
|
+
let _zstdDecompress;
|
|
26
|
+
async function initZstd() {
|
|
27
|
+
if (_zstdAvailable !== undefined)
|
|
28
|
+
return _zstdAvailable;
|
|
29
|
+
try {
|
|
30
|
+
const zlib = await import('node:zlib');
|
|
31
|
+
if (typeof zlib.zstdCompressSync === 'function') {
|
|
32
|
+
_zstdCompress = (data) => new Uint8Array(zlib.zstdCompressSync(Buffer.from(data)));
|
|
33
|
+
_zstdDecompress = (data, maxSize) => {
|
|
34
|
+
const result = zlib.zstdDecompressSync(Buffer.from(data), { maxOutputLength: maxSize });
|
|
35
|
+
if (result.byteLength > maxSize) {
|
|
36
|
+
throw new Error(`decompressed size ${result.byteLength} exceeds limit ${maxSize}`);
|
|
37
|
+
}
|
|
38
|
+
return new Uint8Array(result);
|
|
39
|
+
};
|
|
40
|
+
_zstdAvailable = true;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
_zstdAvailable = false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
_zstdAvailable = false;
|
|
48
|
+
}
|
|
49
|
+
return _zstdAvailable;
|
|
50
|
+
}
|
|
51
|
+
// Try to init eagerly
|
|
52
|
+
initZstd().catch(() => { });
|
|
53
|
+
function zstdCompress(data) {
|
|
54
|
+
return _zstdCompress ? _zstdCompress(data) : null;
|
|
55
|
+
}
|
|
56
|
+
function zstdDecompress(data) {
|
|
57
|
+
if (!_zstdDecompress) {
|
|
58
|
+
throw new Error('zstd decompression not available (requires Node 21.7+)');
|
|
59
|
+
}
|
|
60
|
+
return _zstdDecompress(data, MAX_DECOMPRESSED_SIZE);
|
|
61
|
+
}
|
|
62
|
+
// -- JsonCodec ----------------------------------------------------------------
|
|
63
|
+
/**
|
|
64
|
+
* Simple JSON codec for cross-language interop and development.
|
|
65
|
+
*
|
|
66
|
+
* Strict mode: when ``decode`` is called with a ``hintType`` argument
|
|
67
|
+
* (a @WireType-decorated class constructor), the codec validates that
|
|
68
|
+
* every key in the decoded object matches a field declared on the
|
|
69
|
+
* class. Unknown keys raise ``ContractViolationError`` -- the producer
|
|
70
|
+
* owns the contract, and consumers must use the field names defined
|
|
71
|
+
* by the producer's manifest. Validation walks nested objects and
|
|
72
|
+
* arrays recursively, so a bad field at any depth fails loudly.
|
|
73
|
+
*
|
|
74
|
+
* If ``hintType`` is omitted (or is ``null``/``undefined``), decoding
|
|
75
|
+
* is permissive and returns the raw parsed value -- the codec doesn't
|
|
76
|
+
* know what shape to enforce. Callers that need strict validation
|
|
77
|
+
* must always pass the expected type.
|
|
78
|
+
*/
|
|
79
|
+
export class JsonCodec {
|
|
80
|
+
encoder = new TextEncoder();
|
|
81
|
+
decoder = new TextDecoder();
|
|
82
|
+
threshold;
|
|
83
|
+
constructor(compressionThreshold = DEFAULT_COMPRESSION_THRESHOLD) {
|
|
84
|
+
this.threshold = compressionThreshold;
|
|
85
|
+
}
|
|
86
|
+
encode(obj) {
|
|
87
|
+
return this.encoder.encode(JSON.stringify(obj));
|
|
88
|
+
}
|
|
89
|
+
decode(payload, hintType) {
|
|
90
|
+
const parsed = JSON.parse(this.decoder.decode(payload));
|
|
91
|
+
if (hintType && typeof hintType === 'function') {
|
|
92
|
+
validateContractShape(parsed, hintType);
|
|
93
|
+
}
|
|
94
|
+
return parsed;
|
|
95
|
+
}
|
|
96
|
+
encodeCompressed(obj) {
|
|
97
|
+
const data = this.encode(obj);
|
|
98
|
+
if (data.byteLength > this.threshold && _zstdAvailable) {
|
|
99
|
+
const compressed = zstdCompress(data);
|
|
100
|
+
if (compressed && compressed.byteLength < data.byteLength) {
|
|
101
|
+
return [compressed, true];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return [data, false];
|
|
105
|
+
}
|
|
106
|
+
decodeCompressed(payload, compressed, hintType) {
|
|
107
|
+
if (compressed) {
|
|
108
|
+
const decompressed = zstdDecompress(payload);
|
|
109
|
+
return this.decode(decompressed, hintType);
|
|
110
|
+
}
|
|
111
|
+
return this.decode(payload, hintType);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const _shapeCache = new WeakMap();
|
|
115
|
+
function introspectClass(cls) {
|
|
116
|
+
const cached = _shapeCache.get(cls);
|
|
117
|
+
if (cached !== undefined)
|
|
118
|
+
return cached;
|
|
119
|
+
let template;
|
|
120
|
+
try {
|
|
121
|
+
template = new cls();
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// Class isn't default-constructible -- record a sentinel so we
|
|
125
|
+
// never retry, and fall back to permissive decode forever.
|
|
126
|
+
_shapeCache.set(cls, null);
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const fieldNames = new Set(Object.keys(template));
|
|
130
|
+
const nestedTypes = new Map();
|
|
131
|
+
const elementTypes = new Map();
|
|
132
|
+
for (const [key, defaultValue] of Object.entries(template)) {
|
|
133
|
+
if (defaultValue === null || defaultValue === undefined)
|
|
134
|
+
continue;
|
|
135
|
+
if (Array.isArray(defaultValue)) {
|
|
136
|
+
// For arrays, sample the first element if any. Empty arrays
|
|
137
|
+
// can't be introspected -- documented limitation.
|
|
138
|
+
const sample = defaultValue[0];
|
|
139
|
+
const elementCls = sample?.constructor;
|
|
140
|
+
if (elementCls &&
|
|
141
|
+
elementCls !== Object &&
|
|
142
|
+
typeof elementCls === 'function') {
|
|
143
|
+
elementTypes.set(key, elementCls);
|
|
144
|
+
}
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (typeof defaultValue !== 'object')
|
|
148
|
+
continue; // primitive (incl. enum members)
|
|
149
|
+
const nestedCls = defaultValue.constructor;
|
|
150
|
+
if (nestedCls &&
|
|
151
|
+
nestedCls !== Object &&
|
|
152
|
+
nestedCls !== Array &&
|
|
153
|
+
nestedCls !== Date &&
|
|
154
|
+
nestedCls !== Map &&
|
|
155
|
+
nestedCls !== Set &&
|
|
156
|
+
typeof nestedCls === 'function') {
|
|
157
|
+
nestedTypes.set(key, nestedCls);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const shape = { fieldNames, nestedTypes, elementTypes };
|
|
161
|
+
_shapeCache.set(cls, shape);
|
|
162
|
+
return shape;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Strict shape validation: walks ``value`` against ``cls`` and throws
|
|
166
|
+
* ``ContractViolationError`` if any object has keys not declared on
|
|
167
|
+
* the corresponding @WireType class. Recurses into nested objects and
|
|
168
|
+
* arrays so a bad field at any depth fails loudly with the dotted
|
|
169
|
+
* path to the violation.
|
|
170
|
+
*
|
|
171
|
+
* Limitations (documented; tests pin them):
|
|
172
|
+
*
|
|
173
|
+
* - Nested types behind a `null` / `undefined` default are not
|
|
174
|
+
* recursed into. Top-level validation always runs.
|
|
175
|
+
* - Empty array defaults can't be element-introspected. Top-level
|
|
176
|
+
* validation always runs.
|
|
177
|
+
* - Date / Map / Set / typed-array fields are treated as opaque
|
|
178
|
+
* primitives -- their values may be objects on the wire but the
|
|
179
|
+
* validator doesn't try to recurse.
|
|
180
|
+
* - Class generics are erased at runtime; the validator sees the
|
|
181
|
+
* default value of the generic field, not its declared type.
|
|
182
|
+
*/
|
|
183
|
+
function validateContractShape(value, cls, path = '') {
|
|
184
|
+
if (value === null || value === undefined)
|
|
185
|
+
return;
|
|
186
|
+
if (typeof value !== 'object' || Array.isArray(value))
|
|
187
|
+
return;
|
|
188
|
+
const shape = introspectClass(cls);
|
|
189
|
+
if (shape === null)
|
|
190
|
+
return; // class isn't default-constructible
|
|
191
|
+
const { fieldNames, nestedTypes, elementTypes } = shape;
|
|
192
|
+
const dict = value;
|
|
193
|
+
const unexpected = [];
|
|
194
|
+
for (const key of Object.keys(dict)) {
|
|
195
|
+
if (!fieldNames.has(key))
|
|
196
|
+
unexpected.push(key);
|
|
197
|
+
}
|
|
198
|
+
if (unexpected.length > 0) {
|
|
199
|
+
const sanitized = sanitizeKeys(unexpected);
|
|
200
|
+
const location = path || cls.name || 'unknown';
|
|
201
|
+
const message = `contract violation at ${location}: unexpected JSON field(s) ` +
|
|
202
|
+
`${JSON.stringify(sanitized)} (expected: ${JSON.stringify([...fieldNames].sort())})`;
|
|
203
|
+
throw new ContractViolationError(message, {
|
|
204
|
+
unexpected_fields: sanitized.join(','),
|
|
205
|
+
location,
|
|
206
|
+
expected_class: cls.name || 'unknown',
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
// Recurse into nested @WireType objects + arrays using the cached
|
|
210
|
+
// shape map. This avoids re-instantiating the class on every
|
|
211
|
+
// decode (preserving constructor side effects) and is O(1) per
|
|
212
|
+
// field after the first decode.
|
|
213
|
+
for (const [key, child] of Object.entries(dict)) {
|
|
214
|
+
if (child === null || child === undefined)
|
|
215
|
+
continue;
|
|
216
|
+
const nestedPath = path ? `${path}.${key}` : `${cls.name || 'value'}.${key}`;
|
|
217
|
+
const nestedCls = nestedTypes.get(key);
|
|
218
|
+
if (nestedCls && typeof child === 'object' && !Array.isArray(child)) {
|
|
219
|
+
validateContractShape(child, nestedCls, nestedPath);
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
const elementCls = elementTypes.get(key);
|
|
223
|
+
if (elementCls && Array.isArray(child)) {
|
|
224
|
+
for (let i = 0; i < child.length; i++) {
|
|
225
|
+
const item = child[i];
|
|
226
|
+
if (item && typeof item === 'object' && !Array.isArray(item)) {
|
|
227
|
+
validateContractShape(item, elementCls, `${nestedPath}[${i}]`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Repr-quote unexpected key names for safe logging.
|
|
235
|
+
*
|
|
236
|
+
* Prevents log injection: keys can contain control chars, ANSI
|
|
237
|
+
* escapes, newlines, or backslashes that would corrupt the error
|
|
238
|
+
* message or terminal. We replace control chars with their escape
|
|
239
|
+
* forms, cap each key's length, and cap the number of keys in the
|
|
240
|
+
* list so a malicious client can't blow up log storage with
|
|
241
|
+
* megabyte-long key names.
|
|
242
|
+
*/
|
|
243
|
+
function sanitizeKeys(keys, maxCount = 5, maxLen = 80) {
|
|
244
|
+
const out = [];
|
|
245
|
+
for (const k of keys.slice(0, maxCount)) {
|
|
246
|
+
let s = String(k);
|
|
247
|
+
if (s.length > maxLen)
|
|
248
|
+
s = s.slice(0, maxLen) + '...(truncated)';
|
|
249
|
+
// Escape control chars + non-printable bytes via JSON.stringify
|
|
250
|
+
// (which produces a quoted string with backslash-escapes), then
|
|
251
|
+
// strip the surrounding quotes to keep the inline form readable.
|
|
252
|
+
const quoted = JSON.stringify(s);
|
|
253
|
+
out.push(quoted.slice(1, -1));
|
|
254
|
+
}
|
|
255
|
+
if (keys.length > maxCount) {
|
|
256
|
+
out.push(`...(+${keys.length - maxCount} more)`);
|
|
257
|
+
}
|
|
258
|
+
return out;
|
|
259
|
+
}
|
|
260
|
+
// -- Type graph walking -------------------------------------------------------
|
|
261
|
+
/**
|
|
262
|
+
* Walk the type graph starting from root types, discovering nested @WireType
|
|
263
|
+
* classes by inspecting default values of instances.
|
|
264
|
+
*
|
|
265
|
+
* Returns all discovered types in dependency order (leaves first), suitable
|
|
266
|
+
* for registration with Fory. This is the TS equivalent of Python's
|
|
267
|
+
* `_walk_type_graph()`.
|
|
268
|
+
*
|
|
269
|
+
* Limitations (compared to Python's dataclass introspection):
|
|
270
|
+
* - Only discovers nested types whose default values are instances of @WireType classes
|
|
271
|
+
* - Types in arrays, optionals, or maps that default to empty/null must be registered explicitly
|
|
272
|
+
*
|
|
273
|
+
* @param rootTypes - Classes decorated with @WireType
|
|
274
|
+
* @returns All types in dependency order (leaves first)
|
|
275
|
+
*/
|
|
276
|
+
export function walkTypeGraph(rootTypes) {
|
|
277
|
+
const visited = new Set();
|
|
278
|
+
const ordered = [];
|
|
279
|
+
function visit(cls) {
|
|
280
|
+
if (visited.has(cls))
|
|
281
|
+
return;
|
|
282
|
+
visited.add(cls);
|
|
283
|
+
// Check this class has a wire type tag
|
|
284
|
+
const tag = cls[WIRE_TYPE_KEY];
|
|
285
|
+
if (!tag)
|
|
286
|
+
return;
|
|
287
|
+
// Instantiate to discover fields and their default values
|
|
288
|
+
try {
|
|
289
|
+
const instance = new cls();
|
|
290
|
+
for (const key of Object.keys(instance)) {
|
|
291
|
+
const value = instance[key];
|
|
292
|
+
if (value === null || value === undefined)
|
|
293
|
+
continue;
|
|
294
|
+
// Check if the value's constructor is a @WireType class
|
|
295
|
+
const ctor = value?.constructor;
|
|
296
|
+
if (ctor && ctor !== Object && ctor !== Array && ctor !== String &&
|
|
297
|
+
ctor !== Number && ctor !== Boolean && ctor[WIRE_TYPE_KEY]) {
|
|
298
|
+
visit(ctor);
|
|
299
|
+
}
|
|
300
|
+
// Check items in arrays for @WireType instances
|
|
301
|
+
if (Array.isArray(value)) {
|
|
302
|
+
for (const item of value) {
|
|
303
|
+
const itemCtor = item?.constructor;
|
|
304
|
+
if (itemCtor && itemCtor[WIRE_TYPE_KEY]) {
|
|
305
|
+
visit(itemCtor);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
catch {
|
|
312
|
+
// If instantiation fails (e.g. required constructor args), skip walking fields
|
|
313
|
+
}
|
|
314
|
+
// Add after dependencies (leaves first)
|
|
315
|
+
ordered.push(cls);
|
|
316
|
+
}
|
|
317
|
+
for (const cls of rootTypes) {
|
|
318
|
+
visit(cls);
|
|
319
|
+
}
|
|
320
|
+
return ordered;
|
|
321
|
+
}
|
|
322
|
+
// -- ForyConfig ----------------------------------------------------------------
|
|
323
|
+
/**
|
|
324
|
+
* Configuration for the Fory serializer.
|
|
325
|
+
*/
|
|
326
|
+
export class ForyConfig {
|
|
327
|
+
/** Compression threshold in bytes (default: 4096). */
|
|
328
|
+
compressionThreshold;
|
|
329
|
+
/** Whether to use cross-language mode (xlang). Default: true. */
|
|
330
|
+
xlang;
|
|
331
|
+
constructor(opts) {
|
|
332
|
+
this.compressionThreshold = opts?.compressionThreshold ?? DEFAULT_COMPRESSION_THRESHOLD;
|
|
333
|
+
this.xlang = opts?.xlang ?? true;
|
|
334
|
+
}
|
|
335
|
+
/** The resolved xlang mode (same as xlang field). */
|
|
336
|
+
get resolvedXlang() {
|
|
337
|
+
return this.xlang;
|
|
338
|
+
}
|
|
339
|
+
/** Convert to kwargs-style object for passing to Fory constructor. */
|
|
340
|
+
toKwargs() {
|
|
341
|
+
return {
|
|
342
|
+
xlang: this.xlang,
|
|
343
|
+
// Fory doesn't directly take compressionThreshold; pass via codec
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Resolve a ForyConfig with defaults.
|
|
349
|
+
*/
|
|
350
|
+
export function resolveForyConfig(config) {
|
|
351
|
+
const xlang = config?.xlang ?? true;
|
|
352
|
+
return {
|
|
353
|
+
compressionThreshold: config?.compressionThreshold ?? DEFAULT_COMPRESSION_THRESHOLD,
|
|
354
|
+
xlang,
|
|
355
|
+
resolvedXlang: xlang,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
// -- ForyCodec ----------------------------------------------------------------
|
|
359
|
+
/**
|
|
360
|
+
* ForyCodec — cross-language serialization via @apache-fory/core.
|
|
361
|
+
*
|
|
362
|
+
* Wraps the Fory JS XLANG serializer for wire-compatible serialization
|
|
363
|
+
* with Python's pyfory.
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* import Fory from '@apache-fory/core';
|
|
368
|
+
* const fory = new Fory({ compatible: true });
|
|
369
|
+
* const codec = new ForyCodec(fory);
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
export class ForyCodec {
|
|
373
|
+
fory;
|
|
374
|
+
threshold;
|
|
375
|
+
serializers = new Map();
|
|
376
|
+
constructor(foryInstance, compressionThreshold = DEFAULT_COMPRESSION_THRESHOLD) {
|
|
377
|
+
this.fory = foryInstance;
|
|
378
|
+
this.threshold = compressionThreshold;
|
|
379
|
+
}
|
|
380
|
+
/** Register a type for serialization. */
|
|
381
|
+
registerType(typeInfo) {
|
|
382
|
+
const { serialize, deserialize } = this.fory.registerSerializer(typeInfo);
|
|
383
|
+
const name = typeInfo?.options?.typeName ?? typeInfo?.tag ?? String(typeInfo);
|
|
384
|
+
this.serializers.set(name, { serialize, deserialize });
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Walk the type graph from root types and register all discovered
|
|
388
|
+
* @WireType classes with Fory. Types are registered in dependency
|
|
389
|
+
* order (leaves first).
|
|
390
|
+
*
|
|
391
|
+
* @param rootTypes - Classes decorated with @WireType
|
|
392
|
+
* @param buildTypeInfo - Function that converts a class to a Fory typeInfo object.
|
|
393
|
+
* Receives (cls, wireTag) and should return the object to pass to registerType().
|
|
394
|
+
*/
|
|
395
|
+
registerTypeGraph(rootTypes, buildTypeInfo) {
|
|
396
|
+
const types = walkTypeGraph(rootTypes);
|
|
397
|
+
for (const cls of types) {
|
|
398
|
+
const tag = cls[WIRE_TYPE_KEY];
|
|
399
|
+
if (tag && !this.serializers.has(tag)) {
|
|
400
|
+
const typeInfo = buildTypeInfo(cls, tag);
|
|
401
|
+
this.registerType(typeInfo);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
encode(obj, _hintType) {
|
|
406
|
+
const result = this.fory.serialize(obj);
|
|
407
|
+
return new Uint8Array(result);
|
|
408
|
+
}
|
|
409
|
+
decode(payload, _hintType) {
|
|
410
|
+
return this.fory.deserialize(payload);
|
|
411
|
+
}
|
|
412
|
+
encodeCompressed(obj) {
|
|
413
|
+
const data = this.encode(obj);
|
|
414
|
+
if (data.byteLength > this.threshold && _zstdAvailable) {
|
|
415
|
+
const compressed = zstdCompress(data);
|
|
416
|
+
if (compressed && compressed.byteLength < data.byteLength) {
|
|
417
|
+
return [compressed, true];
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return [data, false];
|
|
421
|
+
}
|
|
422
|
+
decodeCompressed(payload, compressed, hintType) {
|
|
423
|
+
if (compressed) {
|
|
424
|
+
const decompressed = zstdDecompress(payload);
|
|
425
|
+
return this.decode(decompressed, hintType);
|
|
426
|
+
}
|
|
427
|
+
return this.decode(payload, hintType);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Compress bytes using zstd (if available).
|
|
431
|
+
* Returns null if zstd is unavailable or compression didn't help.
|
|
432
|
+
*/
|
|
433
|
+
compress(data) {
|
|
434
|
+
if (!_zstdAvailable)
|
|
435
|
+
return null;
|
|
436
|
+
return zstdCompress(data);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Decompress zstd-compressed bytes.
|
|
440
|
+
*/
|
|
441
|
+
decompress(data) {
|
|
442
|
+
return zstdDecompress(data);
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Encode a row schema for a list of field names (for row-oriented data).
|
|
446
|
+
* Returns a JSON-encoded schema descriptor.
|
|
447
|
+
*/
|
|
448
|
+
encodeRowSchema(fields) {
|
|
449
|
+
return new TextEncoder().encode(JSON.stringify({ fields }));
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Decode a row-oriented data payload using a previously decoded schema.
|
|
453
|
+
* Reconstructs objects from parallel arrays.
|
|
454
|
+
*/
|
|
455
|
+
decodeRowData(schemaBytes, dataBytes) {
|
|
456
|
+
const schema = JSON.parse(new TextDecoder().decode(schemaBytes));
|
|
457
|
+
const rows = this.decode(dataBytes);
|
|
458
|
+
if (!Array.isArray(rows))
|
|
459
|
+
return [];
|
|
460
|
+
return rows.map((row) => {
|
|
461
|
+
if (!Array.isArray(row))
|
|
462
|
+
return row;
|
|
463
|
+
const obj = {};
|
|
464
|
+
for (let i = 0; i < schema.fields.length; i++) {
|
|
465
|
+
obj[schema.fields[i]] = row[i];
|
|
466
|
+
}
|
|
467
|
+
return obj;
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Return the list of registered type names.
|
|
472
|
+
*/
|
|
473
|
+
registeredTypes() {
|
|
474
|
+
return [...this.serializers.keys()];
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
//# sourceMappingURL=codec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,sDAAsD;AACtD,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAElD,iEAAiE;AACjE,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,CAAC;AAErC,8DAA8D;AAC9D,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,OAAQ,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,GAAG,CAAC;QACb,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC;CACF"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsterConfig — configuration resolution.
|
|
3
|
+
*
|
|
4
|
+
* Three-layer resolution order:
|
|
5
|
+
* 1. Built-in defaults
|
|
6
|
+
* 2. Config file (aster.config.ts, aster.toml, .asterrc)
|
|
7
|
+
* 3. Environment variables (ASTER_* prefix, always win)
|
|
8
|
+
*/
|
|
9
|
+
/** Aster configuration. */
|
|
10
|
+
export interface AsterConfig {
|
|
11
|
+
rootPubkey?: Uint8Array;
|
|
12
|
+
rootPubkeyFile?: string;
|
|
13
|
+
enrollmentCredentialFile?: string;
|
|
14
|
+
allowAllConsumers: boolean;
|
|
15
|
+
allowAllProducers: boolean;
|
|
16
|
+
endpointAddr?: string;
|
|
17
|
+
storagePath?: string;
|
|
18
|
+
healthPort: number;
|
|
19
|
+
healthHost: string;
|
|
20
|
+
secretKey?: Uint8Array;
|
|
21
|
+
relayMode?: string;
|
|
22
|
+
bindAddr?: string;
|
|
23
|
+
enableMonitoring: boolean;
|
|
24
|
+
enableHooks: boolean;
|
|
25
|
+
hookTimeoutMs: number;
|
|
26
|
+
logFormat: 'json' | 'text';
|
|
27
|
+
logLevel: 'debug' | 'info' | 'warning' | 'error';
|
|
28
|
+
logMask: boolean;
|
|
29
|
+
identityFile?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Load config from environment variables with built-in defaults. */
|
|
32
|
+
export declare function configFromEnv(): AsterConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Load config from a TOML file, then overlay env vars.
|
|
35
|
+
*
|
|
36
|
+
* Supports aster.toml with sections: [trust], [connect], [storage],
|
|
37
|
+
* [network], [logging], [health].
|
|
38
|
+
*/
|
|
39
|
+
export declare function configFromFile(filePath: string): AsterConfig;
|
|
40
|
+
/** Parsed identity data from a .aster-identity TOML file. */
|
|
41
|
+
export interface IdentityData {
|
|
42
|
+
node: Record<string, unknown>;
|
|
43
|
+
peers: Record<string, unknown>[];
|
|
44
|
+
published_services: Record<string, Record<string, unknown>>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Load and parse an .aster-identity TOML file.
|
|
48
|
+
*
|
|
49
|
+
* Synthesizes ``aster.role`` and ``aster.name`` into each peer's
|
|
50
|
+
* ``attributes`` from the top-level ``role`` and ``name`` fields.
|
|
51
|
+
* Merges the top-level ``[published_services.*]`` into each peer's
|
|
52
|
+
* ``published_services`` so callers always see a complete peer dict.
|
|
53
|
+
*
|
|
54
|
+
* Returns the full parsed identity or null if the file doesn't exist.
|
|
55
|
+
*/
|
|
56
|
+
export declare function loadIdentityFile(filePath?: string): IdentityData | null;
|
|
57
|
+
/**
|
|
58
|
+
* Load identity from a .aster-identity TOML file.
|
|
59
|
+
*
|
|
60
|
+
* Returns secretKey + matching peer, or null if not found.
|
|
61
|
+
* This is the simple convenience wrapper; use loadIdentityFile()
|
|
62
|
+
* for full access to published_services and all peers.
|
|
63
|
+
*/
|
|
64
|
+
export declare function loadIdentity(filePath?: string, peerName?: string, role?: string): {
|
|
65
|
+
secretKey: Uint8Array;
|
|
66
|
+
peer: Record<string, unknown>;
|
|
67
|
+
} | null;
|
|
68
|
+
/**
|
|
69
|
+
* Find a peer entry by name or role from parsed identity data.
|
|
70
|
+
*/
|
|
71
|
+
export declare function findPeer(identity: IdentityData, name?: string, role?: string): Record<string, unknown> | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Extract producer tokens from a peer's published_services.
|
|
74
|
+
*
|
|
75
|
+
* Returns a map of service name to token data (entries that
|
|
76
|
+
* have a ``producer_token`` field).
|
|
77
|
+
*/
|
|
78
|
+
export declare function getProducerTokens(peer: Record<string, unknown>): Record<string, Record<string, unknown>>;
|
|
79
|
+
/**
|
|
80
|
+
* Minimal TOML parser for config files.
|
|
81
|
+
* Handles sections (including dotted like [a.b]), array-of-tables,
|
|
82
|
+
* strings, numbers, booleans, inline tables, and simple arrays.
|
|
83
|
+
* Not a full TOML parser.
|
|
84
|
+
*/
|
|
85
|
+
export declare function parseSimpleToml(text: string): Record<string, unknown>;
|
|
86
|
+
/**
|
|
87
|
+
* Load endpoint config from a file path (alias for configFromFile).
|
|
88
|
+
*/
|
|
89
|
+
export declare function loadEndpointConfig(filePath: string): AsterConfig;
|
|
90
|
+
/**
|
|
91
|
+
* Resolve the root public key from config (raw bytes or from file).
|
|
92
|
+
* Returns undefined if neither is set.
|
|
93
|
+
*/
|
|
94
|
+
export declare function resolveRootPubkey(config: AsterConfig): Uint8Array | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Convert AsterConfig to an endpoint-specific config subset.
|
|
97
|
+
* Returns the config fields relevant to network endpoint setup.
|
|
98
|
+
*/
|
|
99
|
+
export declare function toEndpointConfig(config: AsterConfig): Record<string, unknown>;
|
|
100
|
+
/** Print resolved config (masks sensitive values). */
|
|
101
|
+
export declare function printConfig(config: AsterConfig): void;
|
|
102
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,2BAA2B;AAC3B,MAAM,WAAW,WAAW;IAE1B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAG3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IAGnB,SAAS,CA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