@naylence/agent-sdk 0.3.4-test.705 → 0.3.4-test.707
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/browser/index.js +600 -437
- package/dist/browser/index.js.map +1 -1
- package/dist/cjs/plugin.js +2 -0
- package/dist/cjs/plugin.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -0
- package/dist/cjs/version.js +5 -0
- package/dist/cjs/version.js.map +1 -0
- package/dist/esm/plugin.js +2 -0
- package/dist/esm/plugin.js.map +1 -1
- package/dist/esm/version.d.ts +5 -0
- package/dist/esm/version.js +8 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/version.d.ts +6 -0
- package/dist/types/version.d.ts.map +1 -0
- package/package.json +5 -2
package/dist/browser/index.js
CHANGED
|
@@ -669,7 +669,7 @@
|
|
|
669
669
|
const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
670
670
|
// const dateSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
671
671
|
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
672
|
-
const date$
|
|
672
|
+
const date$3 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
|
|
673
673
|
function timeSource(args) {
|
|
674
674
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
675
675
|
const regex = typeof args.precision === "number"
|
|
@@ -1435,7 +1435,7 @@
|
|
|
1435
1435
|
$ZodStringFormat.init(inst, def);
|
|
1436
1436
|
});
|
|
1437
1437
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1438
|
-
def.pattern ?? (def.pattern = date$
|
|
1438
|
+
def.pattern ?? (def.pattern = date$3);
|
|
1439
1439
|
$ZodStringFormat.init(inst, def);
|
|
1440
1440
|
});
|
|
1441
1441
|
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
@@ -2937,6 +2937,13 @@
|
|
|
2937
2937
|
...normalizeParams$1(params),
|
|
2938
2938
|
});
|
|
2939
2939
|
}
|
|
2940
|
+
function _coercedDate(Class, params) {
|
|
2941
|
+
return new Class({
|
|
2942
|
+
type: "date",
|
|
2943
|
+
coerce: true,
|
|
2944
|
+
...normalizeParams$1(params),
|
|
2945
|
+
});
|
|
2946
|
+
}
|
|
2940
2947
|
function _lt(value, params) {
|
|
2941
2948
|
return new $ZodCheckLessThan({
|
|
2942
2949
|
check: "less_than",
|
|
@@ -3128,7 +3135,7 @@
|
|
|
3128
3135
|
$ZodISODate.init(inst, def);
|
|
3129
3136
|
ZodStringFormat.init(inst, def);
|
|
3130
3137
|
});
|
|
3131
|
-
function date$
|
|
3138
|
+
function date$2(params) {
|
|
3132
3139
|
return _isoDate(ZodISODate, params);
|
|
3133
3140
|
}
|
|
3134
3141
|
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
@@ -3338,7 +3345,7 @@
|
|
|
3338
3345
|
inst.e164 = (params) => inst.check(_e164(ZodE164, params));
|
|
3339
3346
|
// iso
|
|
3340
3347
|
inst.datetime = (params) => inst.check(datetime(params));
|
|
3341
|
-
inst.date = (params) => inst.check(date$
|
|
3348
|
+
inst.date = (params) => inst.check(date$2(params));
|
|
3342
3349
|
inst.time = (params) => inst.check(time(params));
|
|
3343
3350
|
inst.duration = (params) => inst.check(duration(params));
|
|
3344
3351
|
});
|
|
@@ -3524,7 +3531,7 @@
|
|
|
3524
3531
|
inst.minDate = c.minimum ? new Date(c.minimum) : null;
|
|
3525
3532
|
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
|
|
3526
3533
|
});
|
|
3527
|
-
function date(params) {
|
|
3534
|
+
function date$1(params) {
|
|
3528
3535
|
return _date(ZodDate, params);
|
|
3529
3536
|
}
|
|
3530
3537
|
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
@@ -3867,6 +3874,10 @@
|
|
|
3867
3874
|
custom: "custom",
|
|
3868
3875
|
};
|
|
3869
3876
|
|
|
3877
|
+
function date(params) {
|
|
3878
|
+
return _coercedDate(ZodDate, params);
|
|
3879
|
+
}
|
|
3880
|
+
|
|
3870
3881
|
const PARTICIPANT_RE = /^[A-Za-z0-9_-]+$/;
|
|
3871
3882
|
const SEGMENT_RE = /^[A-Za-z0-9._-]+$/;
|
|
3872
3883
|
const HOST_SEGMENT_RE = /^[A-Za-z0-9.-]+$/; // Allow dots for host parts
|
|
@@ -5974,7 +5985,7 @@
|
|
|
5974
5985
|
}
|
|
5975
5986
|
}
|
|
5976
5987
|
return value;
|
|
5977
|
-
}, date())
|
|
5988
|
+
}, date$1())
|
|
5978
5989
|
.describe('UTC timestamp when the envelope was created');
|
|
5979
5990
|
const FLOW_FLAG_MASK = FlowFlags.SYN | FlowFlags.ACK | FlowFlags.RESET;
|
|
5980
5991
|
const FlowFlagsSchema = number()
|
|
@@ -6271,7 +6282,7 @@
|
|
|
6271
6282
|
// Context metadata
|
|
6272
6283
|
authMethod: string$1().optional()
|
|
6273
6284
|
.describe('Authentication method used'),
|
|
6274
|
-
expiresAt: date().optional()
|
|
6285
|
+
expiresAt: date$1().optional()
|
|
6275
6286
|
.describe('When authorization expires'),
|
|
6276
6287
|
}).transform((data) => {
|
|
6277
6288
|
// Convert string dates to Date objects if needed
|
|
@@ -6532,7 +6543,7 @@
|
|
|
6532
6543
|
}
|
|
6533
6544
|
}
|
|
6534
6545
|
return value;
|
|
6535
|
-
}, date());
|
|
6546
|
+
}, date$1());
|
|
6536
6547
|
const TaskStatusSchema = object({
|
|
6537
6548
|
state: nativeEnum(exports.TaskState),
|
|
6538
6549
|
message: MessageSchema.nullable().optional(),
|
|
@@ -6793,6 +6804,21 @@
|
|
|
6793
6804
|
class MissingAPIKeyError extends Error {
|
|
6794
6805
|
}
|
|
6795
6806
|
|
|
6807
|
+
/**
|
|
6808
|
+
* Utilities for hex, bytes, CSPRNG.
|
|
6809
|
+
* @module
|
|
6810
|
+
*/
|
|
6811
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
6812
|
+
/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
|
|
6813
|
+
/**
|
|
6814
|
+
* Converts string to bytes using UTF8 encoding.
|
|
6815
|
+
* Built-in doesn't validate input to be string: we do the check.
|
|
6816
|
+
* @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
|
|
6817
|
+
*/
|
|
6818
|
+
function utf8ToBytes(str) {
|
|
6819
|
+
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
6820
|
+
}
|
|
6821
|
+
|
|
6796
6822
|
const ALIAS = Symbol.for('yaml.alias');
|
|
6797
6823
|
const DOC = Symbol.for('yaml.document');
|
|
6798
6824
|
const MAP = Symbol.for('yaml.map');
|
|
@@ -19249,7 +19275,7 @@
|
|
|
19249
19275
|
* limitations under the License.
|
|
19250
19276
|
*/
|
|
19251
19277
|
// this is autogenerated file, see scripts/version-update.js
|
|
19252
|
-
var VERSION$
|
|
19278
|
+
var VERSION$3 = '1.9.0';
|
|
19253
19279
|
|
|
19254
19280
|
/*
|
|
19255
19281
|
* Copyright The OpenTelemetry Authors
|
|
@@ -19366,7 +19392,7 @@
|
|
|
19366
19392
|
*
|
|
19367
19393
|
* @param version version of the API requesting an instance of the global API
|
|
19368
19394
|
*/
|
|
19369
|
-
var isCompatible = _makeCompatibilityCheck(VERSION$
|
|
19395
|
+
var isCompatible = _makeCompatibilityCheck(VERSION$3);
|
|
19370
19396
|
|
|
19371
19397
|
/*
|
|
19372
19398
|
* Copyright The OpenTelemetry Authors
|
|
@@ -19383,14 +19409,14 @@
|
|
|
19383
19409
|
* See the License for the specific language governing permissions and
|
|
19384
19410
|
* limitations under the License.
|
|
19385
19411
|
*/
|
|
19386
|
-
var major = VERSION$
|
|
19412
|
+
var major = VERSION$3.split('.')[0];
|
|
19387
19413
|
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
|
|
19388
19414
|
var _global = _globalThis$1;
|
|
19389
19415
|
function registerGlobal(type, instance, diag, allowOverride) {
|
|
19390
19416
|
var _a;
|
|
19391
19417
|
if (allowOverride === void 0) { allowOverride = false; }
|
|
19392
19418
|
var api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
|
|
19393
|
-
version: VERSION$
|
|
19419
|
+
version: VERSION$3,
|
|
19394
19420
|
});
|
|
19395
19421
|
if (!allowOverride && api[type]) {
|
|
19396
19422
|
// already registered an API of this type
|
|
@@ -19398,14 +19424,14 @@
|
|
|
19398
19424
|
diag.error(err.stack || err.message);
|
|
19399
19425
|
return false;
|
|
19400
19426
|
}
|
|
19401
|
-
if (api.version !== VERSION$
|
|
19427
|
+
if (api.version !== VERSION$3) {
|
|
19402
19428
|
// All registered APIs must be of the same version exactly
|
|
19403
|
-
var err = new Error("@opentelemetry/api: Registration of version v" + api.version + " for " + type + " does not match previously registered API v" + VERSION$
|
|
19429
|
+
var err = new Error("@opentelemetry/api: Registration of version v" + api.version + " for " + type + " does not match previously registered API v" + VERSION$3);
|
|
19404
19430
|
diag.error(err.stack || err.message);
|
|
19405
19431
|
return false;
|
|
19406
19432
|
}
|
|
19407
19433
|
api[type] = instance;
|
|
19408
|
-
diag.debug("@opentelemetry/api: Registered a global for " + type + " v" + VERSION$
|
|
19434
|
+
diag.debug("@opentelemetry/api: Registered a global for " + type + " v" + VERSION$3 + ".");
|
|
19409
19435
|
return true;
|
|
19410
19436
|
}
|
|
19411
19437
|
function getGlobal(type) {
|
|
@@ -19417,7 +19443,7 @@
|
|
|
19417
19443
|
return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
|
|
19418
19444
|
}
|
|
19419
19445
|
function unregisterGlobal(type, diag) {
|
|
19420
|
-
diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + VERSION$
|
|
19446
|
+
diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + VERSION$3 + ".");
|
|
19421
19447
|
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
19422
19448
|
if (api) {
|
|
19423
19449
|
delete api[type];
|
|
@@ -21564,6 +21590,14 @@
|
|
|
21564
21590
|
trace: trace
|
|
21565
21591
|
});
|
|
21566
21592
|
|
|
21593
|
+
// This file is auto-generated during build - do not edit manually
|
|
21594
|
+
// Generated from package.json version: 0.3.5-test.907
|
|
21595
|
+
/**
|
|
21596
|
+
* The package version, injected at build time.
|
|
21597
|
+
* @internal
|
|
21598
|
+
*/
|
|
21599
|
+
const VERSION$2 = '0.3.5-test.907';
|
|
21600
|
+
|
|
21567
21601
|
/**
|
|
21568
21602
|
* Cross-platform logging utilities for Naylence Fame
|
|
21569
21603
|
*
|
|
@@ -22194,10 +22228,10 @@
|
|
|
22194
22228
|
* General utility functions for JSON handling, string manipulation,
|
|
22195
22229
|
* path normalization, base64 encoding, hashing, and more.
|
|
22196
22230
|
*/
|
|
22197
|
-
const ENV_VAR_SHOW_ENVELOPES = 'FAME_SHOW_ENVELOPES';
|
|
22231
|
+
const ENV_VAR_SHOW_ENVELOPES$1 = 'FAME_SHOW_ENVELOPES';
|
|
22198
22232
|
function isEnvelopeLoggingEnabled() {
|
|
22199
22233
|
return (typeof process !== 'undefined' &&
|
|
22200
|
-
process.env?.[ENV_VAR_SHOW_ENVELOPES] === 'true');
|
|
22234
|
+
process.env?.[ENV_VAR_SHOW_ENVELOPES$1] === 'true');
|
|
22201
22235
|
}
|
|
22202
22236
|
isEnvelopeLoggingEnabled();
|
|
22203
22237
|
// Base62 characters: 0–9, a–z, A–Z
|
|
@@ -22707,7 +22741,7 @@
|
|
|
22707
22741
|
function isArrayBufferView(value) {
|
|
22708
22742
|
return Boolean(value) && ArrayBuffer.isView(value);
|
|
22709
22743
|
}
|
|
22710
|
-
function toUint8Array(value) {
|
|
22744
|
+
function toUint8Array$1(value) {
|
|
22711
22745
|
if (!value) {
|
|
22712
22746
|
return null;
|
|
22713
22747
|
}
|
|
@@ -22749,7 +22783,7 @@
|
|
|
22749
22783
|
reject(request.error ?? new Error('Failed to read master key from IndexedDB'));
|
|
22750
22784
|
};
|
|
22751
22785
|
request.onsuccess = () => {
|
|
22752
|
-
resolve(toUint8Array(request.result));
|
|
22786
|
+
resolve(toUint8Array$1(request.result));
|
|
22753
22787
|
};
|
|
22754
22788
|
});
|
|
22755
22789
|
}
|
|
@@ -22768,7 +22802,7 @@
|
|
|
22768
22802
|
};
|
|
22769
22803
|
});
|
|
22770
22804
|
}
|
|
22771
|
-
function getRandomBytes$
|
|
22805
|
+
function getRandomBytes$3(length) {
|
|
22772
22806
|
if (!globalThis.crypto?.getRandomValues) {
|
|
22773
22807
|
throw new Error('crypto.getRandomValues is not available in this environment');
|
|
22774
22808
|
}
|
|
@@ -22817,7 +22851,7 @@
|
|
|
22817
22851
|
if (existing) {
|
|
22818
22852
|
return existing;
|
|
22819
22853
|
}
|
|
22820
|
-
const masterKey = getRandomBytes$
|
|
22854
|
+
const masterKey = getRandomBytes$3(MASTER_KEY_LENGTH$1);
|
|
22821
22855
|
await persistKey(db, this.storeName, this.keyId, masterKey);
|
|
22822
22856
|
return masterKey;
|
|
22823
22857
|
}
|
|
@@ -22844,18 +22878,18 @@
|
|
|
22844
22878
|
return null;
|
|
22845
22879
|
}
|
|
22846
22880
|
}
|
|
22847
|
-
let cachedNodeCrypto$
|
|
22881
|
+
let cachedNodeCrypto$2;
|
|
22848
22882
|
let cachedSubtle;
|
|
22849
|
-
async function loadNodeCrypto$
|
|
22850
|
-
if (cachedNodeCrypto$
|
|
22851
|
-
return cachedNodeCrypto$
|
|
22883
|
+
async function loadNodeCrypto$2() {
|
|
22884
|
+
if (cachedNodeCrypto$2 !== undefined) {
|
|
22885
|
+
return cachedNodeCrypto$2;
|
|
22852
22886
|
}
|
|
22853
22887
|
try {
|
|
22854
|
-
cachedNodeCrypto$
|
|
22855
|
-
return cachedNodeCrypto$
|
|
22888
|
+
cachedNodeCrypto$2 = await Promise.resolve().then(function () { return _nodeResolve_empty$1; });
|
|
22889
|
+
return cachedNodeCrypto$2;
|
|
22856
22890
|
}
|
|
22857
22891
|
catch {
|
|
22858
|
-
cachedNodeCrypto$
|
|
22892
|
+
cachedNodeCrypto$2 = null;
|
|
22859
22893
|
return null;
|
|
22860
22894
|
}
|
|
22861
22895
|
}
|
|
@@ -22867,21 +22901,21 @@
|
|
|
22867
22901
|
cachedSubtle = globalThis.crypto.subtle;
|
|
22868
22902
|
return cachedSubtle;
|
|
22869
22903
|
}
|
|
22870
|
-
const nodeCrypto = await loadNodeCrypto$
|
|
22904
|
+
const nodeCrypto = await loadNodeCrypto$2();
|
|
22871
22905
|
if (nodeCrypto?.webcrypto?.subtle) {
|
|
22872
22906
|
cachedSubtle = nodeCrypto.webcrypto.subtle;
|
|
22873
22907
|
return cachedSubtle;
|
|
22874
22908
|
}
|
|
22875
22909
|
throw new Error('Web Crypto API is not available in this environment');
|
|
22876
22910
|
}
|
|
22877
|
-
async function getRandomBytes$
|
|
22911
|
+
async function getRandomBytes$2(length) {
|
|
22878
22912
|
if (typeof globalThis.crypto !== 'undefined' &&
|
|
22879
22913
|
typeof globalThis.crypto.getRandomValues === 'function') {
|
|
22880
22914
|
const buffer = new Uint8Array(length);
|
|
22881
22915
|
globalThis.crypto.getRandomValues(buffer);
|
|
22882
22916
|
return buffer;
|
|
22883
22917
|
}
|
|
22884
|
-
const nodeCrypto = await loadNodeCrypto$
|
|
22918
|
+
const nodeCrypto = await loadNodeCrypto$2();
|
|
22885
22919
|
if (nodeCrypto) {
|
|
22886
22920
|
const buffer = nodeCrypto.randomBytes(length);
|
|
22887
22921
|
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
@@ -22970,7 +23004,7 @@
|
|
|
22970
23004
|
const normalizedKey = normalizeKey(key);
|
|
22971
23005
|
const keyBuffer = toArrayBuffer$1(normalizedKey);
|
|
22972
23006
|
const cryptoKey = await subtle.importKey('raw', keyBuffer, { name: 'AES-GCM' }, false, ['encrypt']);
|
|
22973
|
-
const iv = await getRandomBytes$
|
|
23007
|
+
const iv = await getRandomBytes$2(GCM_IV_LENGTH$1);
|
|
22974
23008
|
const ivBuffer = toArrayBuffer$1(iv);
|
|
22975
23009
|
const ciphertextBuffer = await subtle.encrypt({ name: 'AES-GCM', iv: ivBuffer }, cryptoKey, toArrayBuffer$1(plaintext));
|
|
22976
23010
|
const ciphertext = new Uint8Array(ciphertextBuffer);
|
|
@@ -23453,29 +23487,17 @@
|
|
|
23453
23487
|
IndexedDBStorageProvider: IndexedDBStorageProvider
|
|
23454
23488
|
});
|
|
23455
23489
|
|
|
23456
|
-
|
|
23457
|
-
const nodeStack = globalScope$1.__naylenceNodeStack__ ?? (globalScope$1.__naylenceNodeStack__ = []);
|
|
23458
|
-
function getCurrentNode() {
|
|
23459
|
-
return nodeStack.length > 0 ? nodeStack[nodeStack.length - 1] : null;
|
|
23460
|
-
}
|
|
23490
|
+
getLogger('naylence.fame.node.binding_manager');
|
|
23461
23491
|
|
|
23462
|
-
|
|
23463
|
-
function isGrant(candidate) {
|
|
23464
|
-
if (!candidate || typeof candidate !== 'object') {
|
|
23465
|
-
return false;
|
|
23466
|
-
}
|
|
23467
|
-
const grant = candidate;
|
|
23468
|
-
return typeof grant.type === 'string' && typeof grant.purpose === 'string';
|
|
23469
|
-
}
|
|
23470
|
-
function assertGrant(candidate, message = 'Invalid grant object') {
|
|
23471
|
-
if (!isGrant(candidate)) {
|
|
23472
|
-
throw new TypeError(message);
|
|
23473
|
-
}
|
|
23474
|
-
}
|
|
23492
|
+
getLogger('naylence.fame.node.response_context_manager');
|
|
23475
23493
|
|
|
23476
|
-
getLogger('naylence.fame.node.
|
|
23494
|
+
getLogger('naylence.fame.node.streaming_response_handler');
|
|
23477
23495
|
|
|
23478
|
-
getLogger('naylence.fame.node.
|
|
23496
|
+
getLogger('naylence.fame.node.channel_polling_manager');
|
|
23497
|
+
|
|
23498
|
+
getLogger('naylence.fame.node.rpc_server_handler');
|
|
23499
|
+
|
|
23500
|
+
getLogger('naylence.fame.node.rpc_client_manager');
|
|
23479
23501
|
|
|
23480
23502
|
var EnvelopeStatus;
|
|
23481
23503
|
(function (EnvelopeStatus) {
|
|
@@ -23512,8 +23534,57 @@
|
|
|
23512
23534
|
outbox: MailboxType.OUTBOX,
|
|
23513
23535
|
});
|
|
23514
23536
|
|
|
23537
|
+
getLogger('naylence.fame.node.envelope_listener_manager');
|
|
23538
|
+
|
|
23515
23539
|
getLogger('naylence.fame.delivery.default_delivery_tracker');
|
|
23516
23540
|
|
|
23541
|
+
const globalScope$1 = globalThis;
|
|
23542
|
+
const nodeStack = globalScope$1.__naylenceNodeStack__ ?? (globalScope$1.__naylenceNodeStack__ = []);
|
|
23543
|
+
function getCurrentNode() {
|
|
23544
|
+
return nodeStack.length > 0 ? nodeStack[nodeStack.length - 1] : null;
|
|
23545
|
+
}
|
|
23546
|
+
|
|
23547
|
+
getLogger('naylence.fame.node.root_session_manager');
|
|
23548
|
+
|
|
23549
|
+
/**
|
|
23550
|
+
* Base factory for creating FameConnector instances from either ConnectorConfig or ConnectionGrant.
|
|
23551
|
+
*
|
|
23552
|
+
* Concrete implementations must define supported grant types and provide grant-to-connector
|
|
23553
|
+
* conversion logic.
|
|
23554
|
+
*/
|
|
23555
|
+
getLogger('naylence.fame.connector.connector_factory');
|
|
23556
|
+
|
|
23557
|
+
getLogger('naylence.fame.node.upstream_session_manager');
|
|
23558
|
+
|
|
23559
|
+
getLogger('naylence.fame.node.admission.noop_admission_client');
|
|
23560
|
+
getLogger('naylence.fame.node.node');
|
|
23561
|
+
|
|
23562
|
+
const FameNodeModeSchema = union([literal('dev'), literal('prod')])
|
|
23563
|
+
.default('prod');
|
|
23564
|
+
object({
|
|
23565
|
+
type: literal('Node').default('Node'),
|
|
23566
|
+
mode: FameNodeModeSchema,
|
|
23567
|
+
id: string$1().optional().nullable(),
|
|
23568
|
+
directParentUrl: string$1().optional().nullable(),
|
|
23569
|
+
admission: unknown().optional().nullable(),
|
|
23570
|
+
requestedLogicals: array(string$1()).default([]),
|
|
23571
|
+
delivery: unknown().optional().nullable(),
|
|
23572
|
+
envContext: record(string$1(), unknown()).default({}),
|
|
23573
|
+
services: array(unknown()).default([]),
|
|
23574
|
+
hasParent: boolean().default(false),
|
|
23575
|
+
security: unknown().optional().nullable(),
|
|
23576
|
+
listeners: array(record(string$1(), unknown())).default([]),
|
|
23577
|
+
publicUrl: string$1().optional().nullable(),
|
|
23578
|
+
keyStore: unknown().optional().nullable(),
|
|
23579
|
+
storage: unknown().optional().nullable(),
|
|
23580
|
+
attachmentKeyValidator: unknown().optional().nullable(),
|
|
23581
|
+
telemetry: unknown().optional().nullable(),
|
|
23582
|
+
requestedCapabilities: array(string$1()).optional(),
|
|
23583
|
+
})
|
|
23584
|
+
.passthrough();
|
|
23585
|
+
|
|
23586
|
+
getLogger('naylence.fame.node.admission.default_node_attach_client');
|
|
23587
|
+
|
|
23517
23588
|
const TRACE_EMITTER_FACTORY_BASE_TYPE = 'TraceEmitterFactory';
|
|
23518
23589
|
class TraceEmitterFactory extends AbstractResourceFactory {
|
|
23519
23590
|
static async createTraceEmitter(config, options = {}) {
|
|
@@ -23553,12 +23624,12 @@
|
|
|
23553
23624
|
welcome: unknown().optional(),
|
|
23554
23625
|
})
|
|
23555
23626
|
.loose());
|
|
23556
|
-
function isPlainObject$
|
|
23627
|
+
function isPlainObject$2(value) {
|
|
23557
23628
|
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
23558
23629
|
}
|
|
23559
23630
|
function parseJson(content) {
|
|
23560
23631
|
const parsed = JSON.parse(content);
|
|
23561
|
-
if (!isPlainObject$
|
|
23632
|
+
if (!isPlainObject$2(parsed)) {
|
|
23562
23633
|
throw new Error('Parsed JSON config must be an object');
|
|
23563
23634
|
}
|
|
23564
23635
|
return parsed;
|
|
@@ -23568,7 +23639,7 @@
|
|
|
23568
23639
|
if (parsed == null) {
|
|
23569
23640
|
return {};
|
|
23570
23641
|
}
|
|
23571
|
-
if (!isPlainObject$
|
|
23642
|
+
if (!isPlainObject$2(parsed)) {
|
|
23572
23643
|
throw new Error('Parsed YAML config must be an object');
|
|
23573
23644
|
}
|
|
23574
23645
|
return parsed;
|
|
@@ -23699,164 +23770,284 @@
|
|
|
23699
23770
|
if (isNode && !getDefaultFameConfigResolver()) {
|
|
23700
23771
|
setDefaultFameConfigResolver(async () => loadRawFameConfig());
|
|
23701
23772
|
}
|
|
23702
|
-
// export function registerNodeLikeFactory(
|
|
23703
|
-
// type: string,
|
|
23704
|
-
// factory: new (...args: unknown[]) => NodeLikeFactory
|
|
23705
|
-
// ): void {
|
|
23706
|
-
// registerFactory(NODE_LIKE_FACTORY_BASE_TYPE, type, factory);
|
|
23707
|
-
// }
|
|
23708
|
-
|
|
23709
|
-
const FameNodeModeSchema = union([literal('dev'), literal('prod')])
|
|
23710
|
-
.default('prod');
|
|
23711
|
-
object({
|
|
23712
|
-
type: literal('Node').default('Node'),
|
|
23713
|
-
mode: FameNodeModeSchema,
|
|
23714
|
-
id: string$1().optional().nullable(),
|
|
23715
|
-
directParentUrl: string$1().optional().nullable(),
|
|
23716
|
-
admission: unknown().optional().nullable(),
|
|
23717
|
-
requestedLogicals: array(string$1()).default([]),
|
|
23718
|
-
delivery: unknown().optional().nullable(),
|
|
23719
|
-
envContext: record(string$1(), unknown()).default({}),
|
|
23720
|
-
services: array(unknown()).default([]),
|
|
23721
|
-
hasParent: boolean().default(false),
|
|
23722
|
-
security: unknown().optional().nullable(),
|
|
23723
|
-
listeners: array(record(string$1(), unknown())).default([]),
|
|
23724
|
-
publicUrl: string$1().optional().nullable(),
|
|
23725
|
-
keyStore: unknown().optional().nullable(),
|
|
23726
|
-
storage: unknown().optional().nullable(),
|
|
23727
|
-
attachmentKeyValidator: unknown().optional().nullable(),
|
|
23728
|
-
telemetry: unknown().optional().nullable(),
|
|
23729
|
-
requestedCapabilities: array(string$1()).optional(),
|
|
23730
|
-
})
|
|
23731
|
-
.passthrough();
|
|
23732
|
-
|
|
23733
|
-
getLogger('naylence.fame.sentinel.load_balancing.composite_load_balancing_strategy');
|
|
23734
|
-
|
|
23735
|
-
getLogger('naylence.fame.sentinel.load_balancing.sticky_load_balancing_strategy');
|
|
23736
|
-
|
|
23737
|
-
getLogger('naylence.fame.node.response_context_manager');
|
|
23738
|
-
|
|
23739
|
-
getLogger('naylence.fame.node.streaming_response_handler');
|
|
23740
|
-
|
|
23741
|
-
getLogger('naylence.fame.node.channel_polling_manager');
|
|
23742
|
-
|
|
23743
|
-
getLogger('naylence.fame.node.rpc_server_handler');
|
|
23744
|
-
|
|
23745
|
-
getLogger('naylence.fame.node.rpc_client_manager');
|
|
23746
|
-
|
|
23747
|
-
getLogger('naylence.fame.node.envelope_listener_manager');
|
|
23748
|
-
|
|
23749
|
-
getLogger('naylence.fame.node.root_session_manager');
|
|
23750
23773
|
|
|
23751
23774
|
/**
|
|
23752
|
-
*
|
|
23753
|
-
*
|
|
23754
|
-
* Concrete implementations must define supported grant types and provide grant-to-connector
|
|
23755
|
-
* conversion logic.
|
|
23775
|
+
* Node event listener interface for clean, event-driven node lifecycle management.
|
|
23756
23776
|
*/
|
|
23757
|
-
getLogger('naylence.fame.connector.connector_factory');
|
|
23758
|
-
|
|
23759
|
-
getLogger('naylence.fame.node.upstream_session_manager');
|
|
23760
|
-
|
|
23761
|
-
getLogger('naylence.fame.node.admission.noop_admission_client');
|
|
23762
|
-
getLogger('naylence.fame.node.node');
|
|
23763
|
-
|
|
23764
|
-
getLogger('naylence.fame.sentinel.route_manager');
|
|
23765
|
-
|
|
23766
|
-
getLogger('naylence.fame.sentinel.router');
|
|
23767
|
-
|
|
23768
|
-
getLogger('naylence.fame.sentinel.capability_aware_routing_policy');
|
|
23769
|
-
|
|
23770
|
-
getLogger('naylence.fame.sentinel.node_attach_frame_handler');
|
|
23771
|
-
new Set([
|
|
23772
|
-
DeliveryOriginType.DOWNSTREAM,
|
|
23773
|
-
DeliveryOriginType.PEER,
|
|
23774
|
-
]);
|
|
23775
|
-
|
|
23776
|
-
getLogger('naylence.fame.sentinel.address_bind_frame_handler');
|
|
23777
|
-
|
|
23778
|
-
getLogger('naylence.fame.sentinel.node_heartbeat_frame_handler');
|
|
23779
|
-
|
|
23780
|
-
getLogger('naylence.fame.sentinel.capability_frame_handler');
|
|
23781
|
-
|
|
23782
|
-
getLogger('naylence.fame.sentinel.credit_update_frame_handler');
|
|
23783
|
-
|
|
23784
|
-
getLogger('naylence.fame.sentinel.sentinel');
|
|
23785
|
-
|
|
23786
|
-
object({
|
|
23787
|
-
directUrl: string$1().trim().min(1).optional().nullable(),
|
|
23788
|
-
admission: unknown().optional().nullable(),
|
|
23789
|
-
})
|
|
23790
|
-
.passthrough();
|
|
23791
|
-
|
|
23792
|
-
object({
|
|
23793
|
-
type: literal('Sentinel').default('Sentinel'),
|
|
23794
|
-
routingPolicy: unknown().optional().nullable(),
|
|
23795
|
-
loadBalancing: unknown().optional().nullable(),
|
|
23796
|
-
stickiness: unknown().optional().nullable(),
|
|
23797
|
-
peers: unknown().optional().nullable(),
|
|
23798
|
-
maxAttachTtlSec: number().min(0).optional().nullable(),
|
|
23799
|
-
bindingAckTimeoutMs: number().min(0).optional().nullable(),
|
|
23800
|
-
attachTimeoutSec: number().min(0).optional().nullable(),
|
|
23801
|
-
routeStore: unknown().optional().nullable(),
|
|
23802
|
-
})
|
|
23803
|
-
.passthrough();
|
|
23804
|
-
getLogger('naylence.fame.connector.base_async_connector');
|
|
23805
|
-
// Environment variables
|
|
23806
|
-
const ENV_VAR_FAME_FLOW_CONTROL = 'FAME_FLOW_CONTROL';
|
|
23807
|
-
typeof process !== 'undefined' && process?.env
|
|
23808
|
-
? process.env[ENV_VAR_FAME_FLOW_CONTROL] !== '0'
|
|
23809
|
-
: true;
|
|
23810
|
-
|
|
23811
23777
|
/**
|
|
23812
|
-
*
|
|
23778
|
+
* Abstract base class providing default implementations for NodeEventListener.
|
|
23813
23779
|
*
|
|
23814
|
-
*
|
|
23815
|
-
*
|
|
23780
|
+
* This class provides a convenient base for implementing node event listeners
|
|
23781
|
+
* where you only need to override specific lifecycle methods. All methods
|
|
23782
|
+
* have sensible default implementations.
|
|
23816
23783
|
*/
|
|
23817
|
-
|
|
23818
|
-
|
|
23819
|
-
|
|
23820
|
-
function isPlainObject$2(value) {
|
|
23821
|
-
return Boolean(value &&
|
|
23822
|
-
typeof value === 'object' &&
|
|
23823
|
-
Object.prototype.toString.call(value) === '[object Object]');
|
|
23824
|
-
}
|
|
23825
|
-
function getOrCreateRegistry(ctor) {
|
|
23826
|
-
if (!ctor[RPC_REGISTRY]) {
|
|
23827
|
-
const parentRegistry = ctor.__proto__?.[RPC_REGISTRY];
|
|
23828
|
-
ctor[RPC_REGISTRY] = parentRegistry
|
|
23829
|
-
? new Map(parentRegistry)
|
|
23830
|
-
: new Map();
|
|
23784
|
+
class BaseNodeEventListener {
|
|
23785
|
+
constructor(priority = 1000) {
|
|
23786
|
+
this.priority = priority;
|
|
23831
23787
|
}
|
|
23832
|
-
|
|
23833
|
-
|
|
23834
|
-
function normalizeParams(params) {
|
|
23835
|
-
if (!params || typeof params !== 'object') {
|
|
23836
|
-
return { positional: [], keyword: {} };
|
|
23788
|
+
async onNodeStarted(_node) {
|
|
23789
|
+
// Default implementation does nothing
|
|
23837
23790
|
}
|
|
23838
|
-
|
|
23839
|
-
|
|
23840
|
-
if (positional.length === 0 &&
|
|
23841
|
-
Object.keys(keyword).length === 0 &&
|
|
23842
|
-
isPlainObject$2(params)) {
|
|
23843
|
-
return { positional: [], keyword: { ...params } };
|
|
23791
|
+
async onWelcome(_welcomeFrame) {
|
|
23792
|
+
// Default implementation does nothing
|
|
23844
23793
|
}
|
|
23845
|
-
|
|
23846
|
-
|
|
23847
|
-
class RpcMixin {
|
|
23848
|
-
static get rpcRegistry() {
|
|
23849
|
-
return getOrCreateRegistry(this);
|
|
23794
|
+
async onHeartbeatReceived(_envelope) {
|
|
23795
|
+
// Default implementation does nothing
|
|
23850
23796
|
}
|
|
23851
|
-
|
|
23852
|
-
|
|
23797
|
+
async onHeartbeatSent(_node, _envelope) {
|
|
23798
|
+
// Default implementation does nothing
|
|
23853
23799
|
}
|
|
23854
|
-
async
|
|
23855
|
-
|
|
23856
|
-
|
|
23857
|
-
|
|
23858
|
-
|
|
23859
|
-
|
|
23800
|
+
async onNodeInitialized(_node) {
|
|
23801
|
+
// Default implementation does nothing
|
|
23802
|
+
}
|
|
23803
|
+
async onNodeAttachToPeer(_node, _attachInfo, _connector) {
|
|
23804
|
+
// Default implementation does nothing
|
|
23805
|
+
}
|
|
23806
|
+
async onNodeAttachToUpstream(_node, _attachInfo) {
|
|
23807
|
+
// Default implementation does nothing
|
|
23808
|
+
}
|
|
23809
|
+
async onEnvelopeReceived(_node, envelope, _context) {
|
|
23810
|
+
// Default implementation passes envelope through unchanged
|
|
23811
|
+
return envelope;
|
|
23812
|
+
}
|
|
23813
|
+
async onDeliverLocal(_node, _address, envelope, _context) {
|
|
23814
|
+
// Default implementation passes envelope through unchanged
|
|
23815
|
+
return envelope;
|
|
23816
|
+
}
|
|
23817
|
+
async onDeliver(_node, envelope, _context) {
|
|
23818
|
+
// Default implementation passes envelope through unchanged
|
|
23819
|
+
return envelope;
|
|
23820
|
+
}
|
|
23821
|
+
async onForwardUpstream(_node, envelope, _context) {
|
|
23822
|
+
// Default implementation passes envelope through unchanged
|
|
23823
|
+
return envelope;
|
|
23824
|
+
}
|
|
23825
|
+
async onForwardToRoute(_node, _nextSegment, envelope, _context) {
|
|
23826
|
+
// Default implementation passes envelope through unchanged
|
|
23827
|
+
return envelope;
|
|
23828
|
+
}
|
|
23829
|
+
async onForwardToPeer(_node, _peerSegment, envelope, _context) {
|
|
23830
|
+
// Default implementation passes envelope through unchanged
|
|
23831
|
+
return envelope;
|
|
23832
|
+
}
|
|
23833
|
+
async onForwardUpstreamComplete(_node, envelope, _result, _error, _context) {
|
|
23834
|
+
// Default implementation passes envelope through unchanged
|
|
23835
|
+
return envelope;
|
|
23836
|
+
}
|
|
23837
|
+
async onForwardToRouteComplete(_node, _nextSegment, envelope, _result, _error, _context) {
|
|
23838
|
+
// Default implementation passes envelope through unchanged
|
|
23839
|
+
return envelope;
|
|
23840
|
+
}
|
|
23841
|
+
async onForwardToPeerComplete(_node, _peerSegment, envelope, _result, _error, _context) {
|
|
23842
|
+
// Default implementation passes envelope through unchanged
|
|
23843
|
+
return envelope;
|
|
23844
|
+
}
|
|
23845
|
+
async onForwardToPeers(_node, envelope, _peers, _excludePeers, _context) {
|
|
23846
|
+
// Default implementation passes envelope through unchanged
|
|
23847
|
+
return envelope;
|
|
23848
|
+
}
|
|
23849
|
+
async onForwardToPeersComplete(_node, envelope, _peers, _excludePeers, _result, _error, _context) {
|
|
23850
|
+
// Default implementation passes envelope through unchanged
|
|
23851
|
+
return envelope;
|
|
23852
|
+
}
|
|
23853
|
+
async onChildAttach(_options) {
|
|
23854
|
+
// Default implementation does nothing
|
|
23855
|
+
}
|
|
23856
|
+
async onEpochChange(_node, _epoch) {
|
|
23857
|
+
// Default implementation does nothing
|
|
23858
|
+
}
|
|
23859
|
+
async onNodePreparingToStop(_node) {
|
|
23860
|
+
// Default implementation does nothing
|
|
23861
|
+
}
|
|
23862
|
+
async onNodeStopped(_node) {
|
|
23863
|
+
// Default implementation does nothing
|
|
23864
|
+
}
|
|
23865
|
+
}
|
|
23866
|
+
var EncryptionStatus;
|
|
23867
|
+
(function (EncryptionStatus) {
|
|
23868
|
+
EncryptionStatus["OK"] = "OK";
|
|
23869
|
+
EncryptionStatus["SKIPPED"] = "SKIPPED";
|
|
23870
|
+
EncryptionStatus["QUEUED"] = "QUEUED";
|
|
23871
|
+
})(EncryptionStatus || (EncryptionStatus = {}));
|
|
23872
|
+
|
|
23873
|
+
var CryptoLevel;
|
|
23874
|
+
(function (CryptoLevel) {
|
|
23875
|
+
CryptoLevel["PLAINTEXT"] = "plaintext";
|
|
23876
|
+
CryptoLevel["CHANNEL"] = "channel";
|
|
23877
|
+
CryptoLevel["SEALED"] = "sealed";
|
|
23878
|
+
})(CryptoLevel || (CryptoLevel = {}));
|
|
23879
|
+
({
|
|
23880
|
+
[CryptoLevel.PLAINTEXT]: 1,
|
|
23881
|
+
[CryptoLevel.CHANNEL]: 2,
|
|
23882
|
+
[CryptoLevel.SEALED]: 3,
|
|
23883
|
+
});
|
|
23884
|
+
var SecurityAction;
|
|
23885
|
+
(function (SecurityAction) {
|
|
23886
|
+
SecurityAction["ALLOW"] = "allow";
|
|
23887
|
+
SecurityAction["REJECT"] = "reject";
|
|
23888
|
+
SecurityAction["NACK"] = "nack";
|
|
23889
|
+
})(SecurityAction || (SecurityAction = {}));
|
|
23890
|
+
var SignaturePolicy;
|
|
23891
|
+
(function (SignaturePolicy) {
|
|
23892
|
+
SignaturePolicy["REQUIRED"] = "required";
|
|
23893
|
+
SignaturePolicy["OPTIONAL"] = "optional";
|
|
23894
|
+
SignaturePolicy["DISABLED"] = "disabled";
|
|
23895
|
+
SignaturePolicy["FORBIDDEN"] = "forbidden";
|
|
23896
|
+
})(SignaturePolicy || (SignaturePolicy = {}));
|
|
23897
|
+
({
|
|
23898
|
+
plaintextViolationAction: SecurityAction.NACK,
|
|
23899
|
+
channelViolationAction: SecurityAction.NACK,
|
|
23900
|
+
sealedViolationAction: SecurityAction.NACK,
|
|
23901
|
+
});
|
|
23902
|
+
({
|
|
23903
|
+
minimumResponseLevel: CryptoLevel.CHANNEL});
|
|
23904
|
+
({
|
|
23905
|
+
defaultLevel: CryptoLevel.CHANNEL});
|
|
23906
|
+
({
|
|
23907
|
+
signaturePolicy: SignaturePolicy.OPTIONAL,
|
|
23908
|
+
unsignedViolationAction: SecurityAction.ALLOW,
|
|
23909
|
+
invalidSignatureAction: SecurityAction.REJECT,
|
|
23910
|
+
missingKeyAction: SecurityAction.NACK,
|
|
23911
|
+
});
|
|
23912
|
+
({
|
|
23913
|
+
signingMaterial: SigningMaterial.RAW_KEY});
|
|
23914
|
+
({
|
|
23915
|
+
minimumCryptoLevel: CryptoLevel.PLAINTEXT});
|
|
23916
|
+
|
|
23917
|
+
getLogger('naylence.fame.node.envelope_security_handler');
|
|
23918
|
+
|
|
23919
|
+
getLogger('naylence.fame.node.secure_channel_frame_handler');
|
|
23920
|
+
|
|
23921
|
+
const FameNodeAuthorizationContextSchema = AuthorizationContextSchema.and(object({
|
|
23922
|
+
sub: string$1().optional(),
|
|
23923
|
+
aud: string$1().optional(),
|
|
23924
|
+
assignedPath: string$1().optional(),
|
|
23925
|
+
acceptedCapabilities: array(string$1()).optional(),
|
|
23926
|
+
acceptedLogicals: array(string$1()).optional(),
|
|
23927
|
+
instanceId: string$1().optional(),
|
|
23928
|
+
scopes: array(string$1()).optional(),
|
|
23929
|
+
attachExpiresAt: date().optional(),
|
|
23930
|
+
}));
|
|
23931
|
+
FameDeliveryContextSchema.extend({
|
|
23932
|
+
security: SecurityContextSchema.extend({
|
|
23933
|
+
authorization: FameNodeAuthorizationContextSchema.optional(),
|
|
23934
|
+
}).optional(),
|
|
23935
|
+
});
|
|
23936
|
+
|
|
23937
|
+
const GRANT_PURPOSE_NODE_ATTACH = 'node.attach';
|
|
23938
|
+
function isGrant(candidate) {
|
|
23939
|
+
if (!candidate || typeof candidate !== 'object') {
|
|
23940
|
+
return false;
|
|
23941
|
+
}
|
|
23942
|
+
const grant = candidate;
|
|
23943
|
+
return typeof grant.type === 'string' && typeof grant.purpose === 'string';
|
|
23944
|
+
}
|
|
23945
|
+
function assertGrant(candidate, message = 'Invalid grant object') {
|
|
23946
|
+
if (!isGrant(candidate)) {
|
|
23947
|
+
throw new TypeError(message);
|
|
23948
|
+
}
|
|
23949
|
+
}
|
|
23950
|
+
|
|
23951
|
+
getLogger('naylence.fame.sentinel.load_balancing.composite_load_balancing_strategy');
|
|
23952
|
+
|
|
23953
|
+
getLogger('naylence.fame.sentinel.load_balancing.sticky_load_balancing_strategy');
|
|
23954
|
+
|
|
23955
|
+
getLogger('naylence.fame.sentinel.route_manager');
|
|
23956
|
+
|
|
23957
|
+
getLogger('naylence.fame.sentinel.router');
|
|
23958
|
+
|
|
23959
|
+
getLogger('naylence.fame.sentinel.capability_aware_routing_policy');
|
|
23960
|
+
|
|
23961
|
+
getLogger('naylence.fame.sentinel.node_attach_frame_handler');
|
|
23962
|
+
new Set([
|
|
23963
|
+
DeliveryOriginType.DOWNSTREAM,
|
|
23964
|
+
DeliveryOriginType.PEER,
|
|
23965
|
+
]);
|
|
23966
|
+
|
|
23967
|
+
getLogger('naylence.fame.sentinel.address_bind_frame_handler');
|
|
23968
|
+
|
|
23969
|
+
getLogger('naylence.fame.sentinel.node_heartbeat_frame_handler');
|
|
23970
|
+
|
|
23971
|
+
getLogger('naylence.fame.sentinel.capability_frame_handler');
|
|
23972
|
+
|
|
23973
|
+
getLogger('naylence.fame.sentinel.credit_update_frame_handler');
|
|
23974
|
+
|
|
23975
|
+
getLogger('naylence.fame.sentinel.sentinel');
|
|
23976
|
+
|
|
23977
|
+
object({
|
|
23978
|
+
directUrl: string$1().trim().min(1).optional().nullable(),
|
|
23979
|
+
admission: unknown().optional().nullable(),
|
|
23980
|
+
})
|
|
23981
|
+
.passthrough();
|
|
23982
|
+
|
|
23983
|
+
object({
|
|
23984
|
+
type: literal('Sentinel').default('Sentinel'),
|
|
23985
|
+
routingPolicy: unknown().optional().nullable(),
|
|
23986
|
+
loadBalancing: unknown().optional().nullable(),
|
|
23987
|
+
stickiness: unknown().optional().nullable(),
|
|
23988
|
+
peers: unknown().optional().nullable(),
|
|
23989
|
+
maxAttachTtlSec: number().min(0).optional().nullable(),
|
|
23990
|
+
bindingAckTimeoutMs: number().min(0).optional().nullable(),
|
|
23991
|
+
attachTimeoutSec: number().min(0).optional().nullable(),
|
|
23992
|
+
routeStore: unknown().optional().nullable(),
|
|
23993
|
+
})
|
|
23994
|
+
.passthrough();
|
|
23995
|
+
getLogger('naylence.fame.connector.base_async_connector');
|
|
23996
|
+
// Environment variables
|
|
23997
|
+
const ENV_VAR_FAME_FLOW_CONTROL = 'FAME_FLOW_CONTROL';
|
|
23998
|
+
typeof process !== 'undefined' && process?.env
|
|
23999
|
+
? process.env[ENV_VAR_FAME_FLOW_CONTROL] !== '0'
|
|
24000
|
+
: true;
|
|
24001
|
+
|
|
24002
|
+
/**
|
|
24003
|
+
* WebSocket Connector Implementation
|
|
24004
|
+
*
|
|
24005
|
+
* A transport adapter that works with both Node.js and browser WebSocket APIs.
|
|
24006
|
+
* Supports both native WebSocket clients and server-side WebSocket connections.
|
|
24007
|
+
*/
|
|
24008
|
+
getLogger('naylence.fame.connector.websocket_connector');
|
|
24009
|
+
|
|
24010
|
+
const RPC_REGISTRY = Symbol('naylence.rpc.registry');
|
|
24011
|
+
function isPlainObject$1(value) {
|
|
24012
|
+
return Boolean(value &&
|
|
24013
|
+
typeof value === 'object' &&
|
|
24014
|
+
Object.prototype.toString.call(value) === '[object Object]');
|
|
24015
|
+
}
|
|
24016
|
+
function getOrCreateRegistry(ctor) {
|
|
24017
|
+
if (!ctor[RPC_REGISTRY]) {
|
|
24018
|
+
const parentRegistry = ctor.__proto__?.[RPC_REGISTRY];
|
|
24019
|
+
ctor[RPC_REGISTRY] = parentRegistry
|
|
24020
|
+
? new Map(parentRegistry)
|
|
24021
|
+
: new Map();
|
|
24022
|
+
}
|
|
24023
|
+
return ctor[RPC_REGISTRY];
|
|
24024
|
+
}
|
|
24025
|
+
function normalizeParams(params) {
|
|
24026
|
+
if (!params || typeof params !== 'object') {
|
|
24027
|
+
return { positional: [], keyword: {} };
|
|
24028
|
+
}
|
|
24029
|
+
const positional = Array.isArray(params.args) ? [...params.args] : [];
|
|
24030
|
+
const keyword = isPlainObject$1(params.kwargs) ? { ...params.kwargs } : {};
|
|
24031
|
+
if (positional.length === 0 &&
|
|
24032
|
+
Object.keys(keyword).length === 0 &&
|
|
24033
|
+
isPlainObject$1(params)) {
|
|
24034
|
+
return { positional: [], keyword: { ...params } };
|
|
24035
|
+
}
|
|
24036
|
+
return { positional, keyword };
|
|
24037
|
+
}
|
|
24038
|
+
class RpcMixin {
|
|
24039
|
+
static get rpcRegistry() {
|
|
24040
|
+
return getOrCreateRegistry(this);
|
|
24041
|
+
}
|
|
24042
|
+
getRpcRegistry() {
|
|
24043
|
+
return this.constructor.rpcRegistry;
|
|
24044
|
+
}
|
|
24045
|
+
async handleRpcRequest(method, params) {
|
|
24046
|
+
const registry = this.getRpcRegistry();
|
|
24047
|
+
const entry = registry.get(method);
|
|
24048
|
+
if (!entry) {
|
|
24049
|
+
throw new Error(`Unknown RPC method: ${method}`);
|
|
24050
|
+
}
|
|
23860
24051
|
const handler = this[entry.propertyKey];
|
|
23861
24052
|
if (typeof handler !== 'function') {
|
|
23862
24053
|
throw new TypeError(`RPC handler '${entry.propertyKey}' is not callable`);
|
|
@@ -23883,7 +24074,7 @@
|
|
|
23883
24074
|
return { stream: false, args };
|
|
23884
24075
|
}
|
|
23885
24076
|
const last = args[args.length - 1];
|
|
23886
|
-
if (isPlainObject$
|
|
24077
|
+
if (isPlainObject$1(last) &&
|
|
23887
24078
|
Object.prototype.hasOwnProperty.call(last, '_stream')) {
|
|
23888
24079
|
const { _stream, ...rest } = last;
|
|
23889
24080
|
const cleanedArgs = [...args.slice(0, -1)];
|
|
@@ -23893,7 +24084,7 @@
|
|
|
23893
24084
|
return { stream: Boolean(_stream), args: cleanedArgs };
|
|
23894
24085
|
}
|
|
23895
24086
|
if (args.length === 1 &&
|
|
23896
|
-
isPlainObject$
|
|
24087
|
+
isPlainObject$1(args[0]) &&
|
|
23897
24088
|
Object.prototype.hasOwnProperty.call(args[0], '_stream')) {
|
|
23898
24089
|
const { _stream, ...rest } = args[0];
|
|
23899
24090
|
return {
|
|
@@ -23912,7 +24103,7 @@
|
|
|
23912
24103
|
return async (...rawArgs) => {
|
|
23913
24104
|
const { stream, args } = extractStreamFlag(rawArgs);
|
|
23914
24105
|
let params;
|
|
23915
|
-
if (args.length === 1 && isPlainObject$
|
|
24106
|
+
if (args.length === 1 && isPlainObject$1(args[0])) {
|
|
23916
24107
|
params = args[0];
|
|
23917
24108
|
}
|
|
23918
24109
|
else {
|
|
@@ -24201,23 +24392,198 @@
|
|
|
24201
24392
|
console.warn('[factory-manifest] skipped', spec, '— missing FACTORY_META or default export ctor');
|
|
24202
24393
|
return;
|
|
24203
24394
|
}
|
|
24204
|
-
registry.registerFactory(meta.base, meta.key, Ctor);
|
|
24395
|
+
registry.registerFactory(meta.base, meta.key, Ctor);
|
|
24396
|
+
}
|
|
24397
|
+
catch (error) {
|
|
24398
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
24399
|
+
console.warn('[factory-manifest] skipped', spec, '-', reason);
|
|
24400
|
+
}
|
|
24401
|
+
}));
|
|
24402
|
+
}
|
|
24403
|
+
/**
|
|
24404
|
+
* Register all default Naylence runtime factories into the supplied registry.
|
|
24405
|
+
*
|
|
24406
|
+
* @param registry Registry implementation to receive the default runtime factories.
|
|
24407
|
+
*/
|
|
24408
|
+
async function registerRuntimeFactories(registry = ResourceFactoryRegistry) {
|
|
24409
|
+
await registerDefaultFactories(registry);
|
|
24410
|
+
}
|
|
24411
|
+
|
|
24412
|
+
const AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE = 'AuthInjectionStrategyFactory';
|
|
24413
|
+
class AuthInjectionStrategyFactory extends AbstractResourceFactory {
|
|
24414
|
+
static async createAuthInjectionStrategy(config, options = {}) {
|
|
24415
|
+
if (config) {
|
|
24416
|
+
const strategy = await createResource$1(AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, config, options);
|
|
24417
|
+
if (!strategy) {
|
|
24418
|
+
throw new Error('Failed to create auth injection strategy from configuration');
|
|
24419
|
+
}
|
|
24420
|
+
return strategy;
|
|
24421
|
+
}
|
|
24422
|
+
const strategy = await createDefaultResource(AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, null, options);
|
|
24423
|
+
if (!strategy) {
|
|
24424
|
+
throw new Error('Failed to create default auth injection strategy');
|
|
24425
|
+
}
|
|
24426
|
+
return strategy;
|
|
24427
|
+
}
|
|
24428
|
+
}
|
|
24429
|
+
|
|
24430
|
+
getLogger('naylence.fame.security.keys.default_key_manager');
|
|
24431
|
+
|
|
24432
|
+
getLogger('naylence.fame.security.keys.noop_key_validator');
|
|
24433
|
+
|
|
24434
|
+
getLogger('naylence.fame.security.keys.key_management_handler');
|
|
24435
|
+
|
|
24436
|
+
getLogger('naylence.fame.security.keys.key_store');
|
|
24437
|
+
|
|
24438
|
+
utf8ToBytes('naylence-sealed-envelope');
|
|
24439
|
+
|
|
24440
|
+
getLogger('naylence.fame.security.policy.default_security_policy');
|
|
24441
|
+
|
|
24442
|
+
getLogger('naylence.fame.sentinel.key_correlation_map');
|
|
24443
|
+
|
|
24444
|
+
getLogger('naylence.fame.sentinel.key_frame_handler');
|
|
24445
|
+
getLogger('naylence.fame.security.default_security_manager');
|
|
24446
|
+
|
|
24447
|
+
getLogger('naylence.fame.security.auth.jwt_token_issuer');
|
|
24448
|
+
|
|
24449
|
+
getLogger('naylence.fame.security.auth.jwt_token_verifier');
|
|
24450
|
+
|
|
24451
|
+
getLogger('naylence.fame.security.crypto.providers.default_crypto_provider');
|
|
24452
|
+
|
|
24453
|
+
typeof TextDecoder !== 'undefined' ? new TextDecoder() : null;
|
|
24454
|
+
new TextEncoder();
|
|
24455
|
+
|
|
24456
|
+
getLogger('naylence.fame.security.node_security_profile_factory');
|
|
24457
|
+
|
|
24458
|
+
getLogger('naylence.fame.stickiness.simple_load_balancer_stickiness_manager');
|
|
24459
|
+
|
|
24460
|
+
const AUTH_INJECTION_STRATEGY_TYPE_ALIASES = {
|
|
24461
|
+
BearerTokenHeaderAuthInjectionStrategy: 'BearerTokenHeaderAuth',
|
|
24462
|
+
BearerTokenHeaderAuthStrategy: 'BearerTokenHeaderAuth',
|
|
24463
|
+
NoAuthInjectionStrategy: 'NoAuth',
|
|
24464
|
+
QueryParamAuthInjectionStrategy: 'QueryParamAuth',
|
|
24465
|
+
QueryParamAuthStrategy: 'QueryParamAuth',
|
|
24466
|
+
WebSocketSubprotocolAuthInjectionStrategy: 'WebSocketSubprotocolAuth',
|
|
24467
|
+
WebSocketSubprotocolAuthStrategy: 'WebSocketSubprotocolAuth',
|
|
24468
|
+
};
|
|
24469
|
+
function canonicalizeAuthConfig(auth) {
|
|
24470
|
+
if (!auth || typeof auth !== 'object' || Array.isArray(auth)) {
|
|
24471
|
+
return undefined;
|
|
24472
|
+
}
|
|
24473
|
+
const typeValue = auth.type;
|
|
24474
|
+
if (typeof typeValue !== 'string') {
|
|
24475
|
+
return auth;
|
|
24476
|
+
}
|
|
24477
|
+
const normalizedType = AUTH_INJECTION_STRATEGY_TYPE_ALIASES[typeValue] ?? typeValue;
|
|
24478
|
+
if (normalizedType === typeValue) {
|
|
24479
|
+
return auth;
|
|
24480
|
+
}
|
|
24481
|
+
return {
|
|
24482
|
+
...auth,
|
|
24483
|
+
type: normalizedType,
|
|
24484
|
+
};
|
|
24485
|
+
}
|
|
24486
|
+
function assertConnectionGrant(candidate, message = 'Invalid connection grant') {
|
|
24487
|
+
assertGrant(candidate, message);
|
|
24488
|
+
}
|
|
24489
|
+
|
|
24490
|
+
const WEBSOCKET_CONNECTION_GRANT_TYPE = 'WebSocketConnectionGrant';
|
|
24491
|
+
function normalizeWebSocketConnectionGrant(candidate) {
|
|
24492
|
+
const type = typeof candidate.type === 'string'
|
|
24493
|
+
? candidate.type
|
|
24494
|
+
: WEBSOCKET_CONNECTION_GRANT_TYPE;
|
|
24495
|
+
if (type !== WEBSOCKET_CONNECTION_GRANT_TYPE) {
|
|
24496
|
+
throw new TypeError(`WebSocketConnectionGrant expected type "${WEBSOCKET_CONNECTION_GRANT_TYPE}", received "${type}"`);
|
|
24497
|
+
}
|
|
24498
|
+
const purpose = typeof candidate.purpose === 'string' && candidate.purpose.length > 0
|
|
24499
|
+
? candidate.purpose
|
|
24500
|
+
: GRANT_PURPOSE_NODE_ATTACH;
|
|
24501
|
+
assertConnectionGrant({ ...candidate, type, purpose }, 'WebSocketConnectionGrant requires a valid base grant');
|
|
24502
|
+
const urlValue = candidate.url;
|
|
24503
|
+
if (urlValue !== undefined &&
|
|
24504
|
+
(typeof urlValue !== 'string' || urlValue.trim().length === 0)) {
|
|
24505
|
+
throw new TypeError('WebSocketConnectionGrant "url" must be a non-empty string when provided');
|
|
24506
|
+
}
|
|
24507
|
+
const base = {
|
|
24508
|
+
type,
|
|
24509
|
+
purpose,
|
|
24510
|
+
};
|
|
24511
|
+
if (typeof urlValue === 'string') {
|
|
24512
|
+
base.url = urlValue;
|
|
24513
|
+
}
|
|
24514
|
+
const authConfig = canonicalizeAuthConfig(candidate.auth);
|
|
24515
|
+
if (authConfig) {
|
|
24516
|
+
base.auth = authConfig;
|
|
24517
|
+
}
|
|
24518
|
+
return base;
|
|
24519
|
+
}
|
|
24520
|
+
|
|
24521
|
+
const TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE = 'TransportProvisionerFactory';
|
|
24522
|
+
class TransportProvisionerFactory extends AbstractResourceFactory {
|
|
24523
|
+
static async createTransportProvisioner(config, options = {}) {
|
|
24524
|
+
if (config) {
|
|
24525
|
+
const provisioner = await createResource$1(TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, config, options);
|
|
24526
|
+
if (!provisioner) {
|
|
24527
|
+
throw new Error('Failed to create transport provisioner from configuration');
|
|
24528
|
+
}
|
|
24529
|
+
return provisioner;
|
|
24530
|
+
}
|
|
24531
|
+
let provisioner = null;
|
|
24532
|
+
try {
|
|
24533
|
+
provisioner = await createDefaultResource(TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, null, options);
|
|
24205
24534
|
}
|
|
24206
24535
|
catch (error) {
|
|
24207
|
-
const
|
|
24208
|
-
|
|
24536
|
+
const message = 'Failed to create default transport provisioner' +
|
|
24537
|
+
(error instanceof Error && error.message ? `: ${error.message}` : '');
|
|
24538
|
+
throw new Error(message);
|
|
24209
24539
|
}
|
|
24210
|
-
|
|
24540
|
+
if (!provisioner) {
|
|
24541
|
+
throw new Error('Failed to create default transport provisioner');
|
|
24542
|
+
}
|
|
24543
|
+
return provisioner;
|
|
24544
|
+
}
|
|
24211
24545
|
}
|
|
24212
|
-
|
|
24213
|
-
|
|
24214
|
-
|
|
24215
|
-
|
|
24216
|
-
|
|
24217
|
-
|
|
24218
|
-
|
|
24546
|
+
|
|
24547
|
+
getLogger('naylence.fame.welcome.default_welcome_service');
|
|
24548
|
+
const ENV_VAR_SHOW_ENVELOPES = 'FAME_SHOW_ENVELOPES';
|
|
24549
|
+
typeof process !== 'undefined' && resolveShowEnvelopesFlag(process.env);
|
|
24550
|
+
function toCamelAlias(snakeKey) {
|
|
24551
|
+
return snakeKey
|
|
24552
|
+
.toLowerCase()
|
|
24553
|
+
.replace(/_([a-z])/g, (_match, char) => char.toUpperCase());
|
|
24554
|
+
}
|
|
24555
|
+
function readEnvValue(env, snakeKey) {
|
|
24556
|
+
if (!env) {
|
|
24557
|
+
return undefined;
|
|
24558
|
+
}
|
|
24559
|
+
if (env[snakeKey] !== undefined) {
|
|
24560
|
+
return env[snakeKey];
|
|
24561
|
+
}
|
|
24562
|
+
const lowerKey = snakeKey.toLowerCase();
|
|
24563
|
+
if (env[lowerKey] !== undefined) {
|
|
24564
|
+
return env[lowerKey];
|
|
24565
|
+
}
|
|
24566
|
+
const camelKey = toCamelAlias(snakeKey);
|
|
24567
|
+
if (env[camelKey] !== undefined) {
|
|
24568
|
+
return env[camelKey];
|
|
24569
|
+
}
|
|
24570
|
+
const pascalKey = camelKey.length > 0
|
|
24571
|
+
? camelKey[0].toUpperCase() + camelKey.slice(1)
|
|
24572
|
+
: camelKey;
|
|
24573
|
+
if (pascalKey && env[pascalKey] !== undefined) {
|
|
24574
|
+
return env[pascalKey];
|
|
24575
|
+
}
|
|
24576
|
+
return undefined;
|
|
24219
24577
|
}
|
|
24220
|
-
|
|
24578
|
+
function resolveShowEnvelopesFlag(env) {
|
|
24579
|
+
const candidate = readEnvValue(env, ENV_VAR_SHOW_ENVELOPES);
|
|
24580
|
+
if (typeof candidate !== 'string') {
|
|
24581
|
+
return false;
|
|
24582
|
+
}
|
|
24583
|
+
return candidate.trim().toLowerCase() === 'true';
|
|
24584
|
+
}
|
|
24585
|
+
|
|
24586
|
+
getLogger('naylence.fame.welcome.node_welcome_router');
|
|
24221
24587
|
|
|
24222
24588
|
/**
|
|
24223
24589
|
* Browser-friendly entry point for Naylence Runtime.
|
|
@@ -24266,99 +24632,6 @@
|
|
|
24266
24632
|
};
|
|
24267
24633
|
ensureRuntimePluginLoader();
|
|
24268
24634
|
|
|
24269
|
-
/**
|
|
24270
|
-
* Node event listener interface for clean, event-driven node lifecycle management.
|
|
24271
|
-
*/
|
|
24272
|
-
/**
|
|
24273
|
-
* Abstract base class providing default implementations for NodeEventListener.
|
|
24274
|
-
*
|
|
24275
|
-
* This class provides a convenient base for implementing node event listeners
|
|
24276
|
-
* where you only need to override specific lifecycle methods. All methods
|
|
24277
|
-
* have sensible default implementations.
|
|
24278
|
-
*/
|
|
24279
|
-
class BaseNodeEventListener {
|
|
24280
|
-
constructor(priority = 1000) {
|
|
24281
|
-
this.priority = priority;
|
|
24282
|
-
}
|
|
24283
|
-
async onNodeStarted(_node) {
|
|
24284
|
-
// Default implementation does nothing
|
|
24285
|
-
}
|
|
24286
|
-
async onWelcome(_welcomeFrame) {
|
|
24287
|
-
// Default implementation does nothing
|
|
24288
|
-
}
|
|
24289
|
-
async onHeartbeatReceived(_envelope) {
|
|
24290
|
-
// Default implementation does nothing
|
|
24291
|
-
}
|
|
24292
|
-
async onHeartbeatSent(_node, _envelope) {
|
|
24293
|
-
// Default implementation does nothing
|
|
24294
|
-
}
|
|
24295
|
-
async onNodeInitialized(_node) {
|
|
24296
|
-
// Default implementation does nothing
|
|
24297
|
-
}
|
|
24298
|
-
async onNodeAttachToPeer(_node, _attachInfo, _connector) {
|
|
24299
|
-
// Default implementation does nothing
|
|
24300
|
-
}
|
|
24301
|
-
async onNodeAttachToUpstream(_node, _attachInfo) {
|
|
24302
|
-
// Default implementation does nothing
|
|
24303
|
-
}
|
|
24304
|
-
async onEnvelopeReceived(_node, envelope, _context) {
|
|
24305
|
-
// Default implementation passes envelope through unchanged
|
|
24306
|
-
return envelope;
|
|
24307
|
-
}
|
|
24308
|
-
async onDeliverLocal(_node, _address, envelope, _context) {
|
|
24309
|
-
// Default implementation passes envelope through unchanged
|
|
24310
|
-
return envelope;
|
|
24311
|
-
}
|
|
24312
|
-
async onDeliver(_node, envelope, _context) {
|
|
24313
|
-
// Default implementation passes envelope through unchanged
|
|
24314
|
-
return envelope;
|
|
24315
|
-
}
|
|
24316
|
-
async onForwardUpstream(_node, envelope, _context) {
|
|
24317
|
-
// Default implementation passes envelope through unchanged
|
|
24318
|
-
return envelope;
|
|
24319
|
-
}
|
|
24320
|
-
async onForwardToRoute(_node, _nextSegment, envelope, _context) {
|
|
24321
|
-
// Default implementation passes envelope through unchanged
|
|
24322
|
-
return envelope;
|
|
24323
|
-
}
|
|
24324
|
-
async onForwardToPeer(_node, _peerSegment, envelope, _context) {
|
|
24325
|
-
// Default implementation passes envelope through unchanged
|
|
24326
|
-
return envelope;
|
|
24327
|
-
}
|
|
24328
|
-
async onForwardUpstreamComplete(_node, envelope, _result, _error, _context) {
|
|
24329
|
-
// Default implementation passes envelope through unchanged
|
|
24330
|
-
return envelope;
|
|
24331
|
-
}
|
|
24332
|
-
async onForwardToRouteComplete(_node, _nextSegment, envelope, _result, _error, _context) {
|
|
24333
|
-
// Default implementation passes envelope through unchanged
|
|
24334
|
-
return envelope;
|
|
24335
|
-
}
|
|
24336
|
-
async onForwardToPeerComplete(_node, _peerSegment, envelope, _result, _error, _context) {
|
|
24337
|
-
// Default implementation passes envelope through unchanged
|
|
24338
|
-
return envelope;
|
|
24339
|
-
}
|
|
24340
|
-
async onForwardToPeers(_node, envelope, _peers, _excludePeers, _context) {
|
|
24341
|
-
// Default implementation passes envelope through unchanged
|
|
24342
|
-
return envelope;
|
|
24343
|
-
}
|
|
24344
|
-
async onForwardToPeersComplete(_node, envelope, _peers, _excludePeers, _result, _error, _context) {
|
|
24345
|
-
// Default implementation passes envelope through unchanged
|
|
24346
|
-
return envelope;
|
|
24347
|
-
}
|
|
24348
|
-
async onChildAttach(_options) {
|
|
24349
|
-
// Default implementation does nothing
|
|
24350
|
-
}
|
|
24351
|
-
async onEpochChange(_node, _epoch) {
|
|
24352
|
-
// Default implementation does nothing
|
|
24353
|
-
}
|
|
24354
|
-
async onNodePreparingToStop(_node) {
|
|
24355
|
-
// Default implementation does nothing
|
|
24356
|
-
}
|
|
24357
|
-
async onNodeStopped(_node) {
|
|
24358
|
-
// Default implementation does nothing
|
|
24359
|
-
}
|
|
24360
|
-
}
|
|
24361
|
-
|
|
24362
24635
|
const telemetryLogger = getLogger('naylence.fame.telemetry.base_trace_emitter');
|
|
24363
24636
|
function logTelemetryFailure(event, error, context = {}) {
|
|
24364
24637
|
telemetryLogger.warning(event, {
|
|
@@ -24672,31 +24945,13 @@
|
|
|
24672
24945
|
default: NoopTraceEmitterFactory
|
|
24673
24946
|
});
|
|
24674
24947
|
|
|
24675
|
-
const
|
|
24676
|
-
class AuthInjectionStrategyFactory extends AbstractResourceFactory {
|
|
24677
|
-
static async createAuthInjectionStrategy(config, options = {}) {
|
|
24678
|
-
if (config) {
|
|
24679
|
-
const strategy = await createResource$1(AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, config, options);
|
|
24680
|
-
if (!strategy) {
|
|
24681
|
-
throw new Error('Failed to create auth injection strategy from configuration');
|
|
24682
|
-
}
|
|
24683
|
-
return strategy;
|
|
24684
|
-
}
|
|
24685
|
-
const strategy = await createDefaultResource(AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE, null, options);
|
|
24686
|
-
if (!strategy) {
|
|
24687
|
-
throw new Error('Failed to create default auth injection strategy');
|
|
24688
|
-
}
|
|
24689
|
-
return strategy;
|
|
24690
|
-
}
|
|
24691
|
-
}
|
|
24692
|
-
|
|
24693
|
-
const logger$5 = getLogger('naylence.fame.telemetry.otel_setup');
|
|
24948
|
+
const logger$2$1 = getLogger('naylence.fame.telemetry.otel_setup');
|
|
24694
24949
|
let registeredOtel = null;
|
|
24695
24950
|
async function setupOtel(options) {
|
|
24696
24951
|
const normalized = normalizeSetupOtelOptions(options);
|
|
24697
24952
|
try {
|
|
24698
24953
|
if (registeredOtel) {
|
|
24699
|
-
logger$
|
|
24954
|
+
logger$2$1.debug('open_telemetry_reusing_provider', {
|
|
24700
24955
|
service_name: normalized.serviceName,
|
|
24701
24956
|
});
|
|
24702
24957
|
return registeredOtel.control;
|
|
@@ -24717,12 +24972,12 @@
|
|
|
24717
24972
|
}
|
|
24718
24973
|
if (currentProvider &&
|
|
24719
24974
|
currentProvider.constructor?.name === 'NodeTracerProvider') {
|
|
24720
|
-
logger$
|
|
24975
|
+
logger$2$1.debug('open_telemetry_existing_node_provider', {
|
|
24721
24976
|
service_name: normalized.serviceName,
|
|
24722
24977
|
});
|
|
24723
24978
|
return null;
|
|
24724
24979
|
}
|
|
24725
|
-
logger$
|
|
24980
|
+
logger$2$1.debug('open_telemetry_initializing', {
|
|
24726
24981
|
service_name: normalized.serviceName,
|
|
24727
24982
|
endpoint: normalized.endpoint ?? null,
|
|
24728
24983
|
environment: normalized.environment ?? null,
|
|
@@ -24750,7 +25005,7 @@
|
|
|
24750
25005
|
spanProcessors: [spanProcessor],
|
|
24751
25006
|
});
|
|
24752
25007
|
provider.register();
|
|
24753
|
-
logger$
|
|
25008
|
+
logger$2$1.debug('open_telemetry_initialized', {
|
|
24754
25009
|
service_name: normalized.serviceName,
|
|
24755
25010
|
exporter: exporter.constructor?.name ?? 'unknown_exporter',
|
|
24756
25011
|
});
|
|
@@ -24760,7 +25015,7 @@
|
|
|
24760
25015
|
await provider.forceFlush();
|
|
24761
25016
|
}
|
|
24762
25017
|
catch (flushError) {
|
|
24763
|
-
logger$
|
|
25018
|
+
logger$2$1.warning('open_telemetry_force_flush_failed', {
|
|
24764
25019
|
error: flushError instanceof Error
|
|
24765
25020
|
? flushError.message
|
|
24766
25021
|
: String(flushError),
|
|
@@ -24772,7 +25027,7 @@
|
|
|
24772
25027
|
await provider.shutdown();
|
|
24773
25028
|
}
|
|
24774
25029
|
catch (shutdownError) {
|
|
24775
|
-
logger$
|
|
25030
|
+
logger$2$1.warning('open_telemetry_shutdown_failed', {
|
|
24776
25031
|
error: shutdownError instanceof Error
|
|
24777
25032
|
? shutdownError.message
|
|
24778
25033
|
: String(shutdownError),
|
|
@@ -24790,7 +25045,7 @@
|
|
|
24790
25045
|
return control;
|
|
24791
25046
|
}
|
|
24792
25047
|
catch (error) {
|
|
24793
|
-
logger$
|
|
25048
|
+
logger$2$1.error('open_telemetry_not_available', {
|
|
24794
25049
|
error: error instanceof Error ? error.message : String(error),
|
|
24795
25050
|
stack: error instanceof Error && error.stack ? error.stack : undefined,
|
|
24796
25051
|
});
|
|
@@ -24896,7 +25151,7 @@
|
|
|
24896
25151
|
if (headers && Object.keys(headers).length > 0) {
|
|
24897
25152
|
exporterOptions.headers = headers;
|
|
24898
25153
|
}
|
|
24899
|
-
logger$
|
|
25154
|
+
logger$2$1.debug('open_telemetry_using_otlp_http_exporter', {
|
|
24900
25155
|
endpoint,
|
|
24901
25156
|
headers_present: Boolean(headers && Object.keys(headers).length),
|
|
24902
25157
|
});
|
|
@@ -24904,17 +25159,17 @@
|
|
|
24904
25159
|
}
|
|
24905
25160
|
}
|
|
24906
25161
|
catch (error) {
|
|
24907
|
-
logger$
|
|
25162
|
+
logger$2$1.error('open_telemetry_exporter_not_available', {
|
|
24908
25163
|
error: error instanceof Error ? error.message : String(error),
|
|
24909
25164
|
});
|
|
24910
25165
|
}
|
|
24911
25166
|
}
|
|
24912
|
-
logger$
|
|
25167
|
+
logger$2$1.warning('open_telemetry_falling_back_to_console_exporter');
|
|
24913
25168
|
return new ConsoleSpanExporter();
|
|
24914
25169
|
}
|
|
24915
25170
|
|
|
24916
25171
|
let openTelemetryTraceEmitterModulePromise = null;
|
|
24917
|
-
const logger$
|
|
25172
|
+
const logger$1$1 = getLogger('naylence.fame.telemetry.open_telemetry_trace_emitter_factory');
|
|
24918
25173
|
function getOpenTelemetryTraceEmitterModule() {
|
|
24919
25174
|
if (!openTelemetryTraceEmitterModulePromise) {
|
|
24920
25175
|
openTelemetryTraceEmitterModulePromise = safeImport(() => Promise.resolve().then(function () { return openTelemetryTraceEmitter; }), '@opentelemetry/api', {
|
|
@@ -24946,7 +25201,7 @@
|
|
|
24946
25201
|
await AuthInjectionStrategyFactory.createAuthInjectionStrategy(normalized.auth);
|
|
24947
25202
|
try {
|
|
24948
25203
|
await authStrategy.apply(mergedHeaders);
|
|
24949
|
-
logger$
|
|
25204
|
+
logger$1$1.info('trace_emitter_auth_applied', {
|
|
24950
25205
|
service_name: normalized.serviceName,
|
|
24951
25206
|
});
|
|
24952
25207
|
}
|
|
@@ -24969,7 +25224,7 @@
|
|
|
24969
25224
|
sampler: normalized.sampler,
|
|
24970
25225
|
headers: Object.keys(mergedHeaders).length > 0 ? mergedHeaders : undefined,
|
|
24971
25226
|
});
|
|
24972
|
-
logger$
|
|
25227
|
+
logger$1$1.debug('trace_emitter_lifecycle_acquired', {
|
|
24973
25228
|
service_name: normalized.serviceName,
|
|
24974
25229
|
lifecycle_available: Boolean(lifecycle),
|
|
24975
25230
|
});
|
|
@@ -25000,7 +25255,7 @@
|
|
|
25000
25255
|
}
|
|
25001
25256
|
try {
|
|
25002
25257
|
const emitter = new OpenTelemetryTraceEmitter(emitterOptions);
|
|
25003
|
-
logger$
|
|
25258
|
+
logger$1$1.debug('trace_emitter_created', {
|
|
25004
25259
|
service_name: normalized.serviceName,
|
|
25005
25260
|
has_lifecycle: Boolean(lifecycle),
|
|
25006
25261
|
has_auth_strategy: Boolean(authStrategy),
|
|
@@ -25194,15 +25449,10 @@
|
|
|
25194
25449
|
default: TraceEmitterProfileFactory
|
|
25195
25450
|
});
|
|
25196
25451
|
|
|
25197
|
-
getLogger('naylence.fame.security.auth.jwt_token_issuer');
|
|
25198
|
-
|
|
25199
|
-
getLogger('naylence.fame.security.auth.jwt_token_verifier');
|
|
25200
|
-
|
|
25201
|
-
getLogger('naylence.fame.security.crypto.providers.default_crypto_provider');
|
|
25202
|
-
|
|
25203
25452
|
let initialized = false;
|
|
25204
25453
|
const runtimePlugin = {
|
|
25205
25454
|
name: 'naylence:runtime',
|
|
25455
|
+
version: VERSION$2,
|
|
25206
25456
|
async register() {
|
|
25207
25457
|
// console.log('[naylence:runtime] register() called, initialized=', initialized);
|
|
25208
25458
|
if (initialized) {
|
|
@@ -25511,93 +25761,6 @@
|
|
|
25511
25761
|
OpenTelemetryTraceEmitter: OpenTelemetryTraceEmitter
|
|
25512
25762
|
});
|
|
25513
25763
|
|
|
25514
|
-
const AUTH_INJECTION_STRATEGY_TYPE_ALIASES = {
|
|
25515
|
-
BearerTokenHeaderAuthInjectionStrategy: 'BearerTokenHeaderAuth',
|
|
25516
|
-
BearerTokenHeaderAuthStrategy: 'BearerTokenHeaderAuth',
|
|
25517
|
-
NoAuthInjectionStrategy: 'NoAuth',
|
|
25518
|
-
QueryParamAuthInjectionStrategy: 'QueryParamAuth',
|
|
25519
|
-
QueryParamAuthStrategy: 'QueryParamAuth',
|
|
25520
|
-
WebSocketSubprotocolAuthInjectionStrategy: 'WebSocketSubprotocolAuth',
|
|
25521
|
-
WebSocketSubprotocolAuthStrategy: 'WebSocketSubprotocolAuth',
|
|
25522
|
-
};
|
|
25523
|
-
function canonicalizeAuthConfig(auth) {
|
|
25524
|
-
if (!auth || typeof auth !== 'object' || Array.isArray(auth)) {
|
|
25525
|
-
return undefined;
|
|
25526
|
-
}
|
|
25527
|
-
const typeValue = auth.type;
|
|
25528
|
-
if (typeof typeValue !== 'string') {
|
|
25529
|
-
return auth;
|
|
25530
|
-
}
|
|
25531
|
-
const normalizedType = AUTH_INJECTION_STRATEGY_TYPE_ALIASES[typeValue] ?? typeValue;
|
|
25532
|
-
if (normalizedType === typeValue) {
|
|
25533
|
-
return auth;
|
|
25534
|
-
}
|
|
25535
|
-
return {
|
|
25536
|
-
...auth,
|
|
25537
|
-
type: normalizedType,
|
|
25538
|
-
};
|
|
25539
|
-
}
|
|
25540
|
-
function assertConnectionGrant(candidate, message = 'Invalid connection grant') {
|
|
25541
|
-
assertGrant(candidate, message);
|
|
25542
|
-
}
|
|
25543
|
-
|
|
25544
|
-
const WEBSOCKET_CONNECTION_GRANT_TYPE = 'WebSocketConnectionGrant';
|
|
25545
|
-
function normalizeWebSocketConnectionGrant(candidate) {
|
|
25546
|
-
const type = typeof candidate.type === 'string'
|
|
25547
|
-
? candidate.type
|
|
25548
|
-
: WEBSOCKET_CONNECTION_GRANT_TYPE;
|
|
25549
|
-
if (type !== WEBSOCKET_CONNECTION_GRANT_TYPE) {
|
|
25550
|
-
throw new TypeError(`WebSocketConnectionGrant expected type "${WEBSOCKET_CONNECTION_GRANT_TYPE}", received "${type}"`);
|
|
25551
|
-
}
|
|
25552
|
-
const purpose = typeof candidate.purpose === 'string' && candidate.purpose.length > 0
|
|
25553
|
-
? candidate.purpose
|
|
25554
|
-
: GRANT_PURPOSE_NODE_ATTACH;
|
|
25555
|
-
assertConnectionGrant({ ...candidate, type, purpose }, 'WebSocketConnectionGrant requires a valid base grant');
|
|
25556
|
-
const urlValue = candidate.url;
|
|
25557
|
-
if (urlValue !== undefined &&
|
|
25558
|
-
(typeof urlValue !== 'string' || urlValue.trim().length === 0)) {
|
|
25559
|
-
throw new TypeError('WebSocketConnectionGrant "url" must be a non-empty string when provided');
|
|
25560
|
-
}
|
|
25561
|
-
const base = {
|
|
25562
|
-
type,
|
|
25563
|
-
purpose,
|
|
25564
|
-
};
|
|
25565
|
-
if (typeof urlValue === 'string') {
|
|
25566
|
-
base.url = urlValue;
|
|
25567
|
-
}
|
|
25568
|
-
const authConfig = canonicalizeAuthConfig(candidate.auth);
|
|
25569
|
-
if (authConfig) {
|
|
25570
|
-
base.auth = authConfig;
|
|
25571
|
-
}
|
|
25572
|
-
return base;
|
|
25573
|
-
}
|
|
25574
|
-
|
|
25575
|
-
const TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE = 'TransportProvisionerFactory';
|
|
25576
|
-
class TransportProvisionerFactory extends AbstractResourceFactory {
|
|
25577
|
-
static async createTransportProvisioner(config, options = {}) {
|
|
25578
|
-
if (config) {
|
|
25579
|
-
const provisioner = await createResource$1(TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, config, options);
|
|
25580
|
-
if (!provisioner) {
|
|
25581
|
-
throw new Error('Failed to create transport provisioner from configuration');
|
|
25582
|
-
}
|
|
25583
|
-
return provisioner;
|
|
25584
|
-
}
|
|
25585
|
-
let provisioner = null;
|
|
25586
|
-
try {
|
|
25587
|
-
provisioner = await createDefaultResource(TRANSPORT_PROVISIONER_FACTORY_BASE_TYPE, null, options);
|
|
25588
|
-
}
|
|
25589
|
-
catch (error) {
|
|
25590
|
-
const message = 'Failed to create default transport provisioner' +
|
|
25591
|
-
(error instanceof Error && error.message ? `: ${error.message}` : '');
|
|
25592
|
-
throw new Error(message);
|
|
25593
|
-
}
|
|
25594
|
-
if (!provisioner) {
|
|
25595
|
-
throw new Error('Failed to create default transport provisioner');
|
|
25596
|
-
}
|
|
25597
|
-
return provisioner;
|
|
25598
|
-
}
|
|
25599
|
-
}
|
|
25600
|
-
|
|
25601
25764
|
class WebSocketTransportProvisioner {
|
|
25602
25765
|
constructor(options) {
|
|
25603
25766
|
this.url = options.url;
|