@jsii/runtime 1.84.0 → 1.86.0
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/bin/jsii-runtime.js +8 -3
- package/lib/host.d.ts +1 -0
- package/lib/host.js +3 -2
- package/lib/program.js +7 -1
- package/package.json +8 -8
- package/webpack/bin/jsii-runtime.js +46 -26
- package/webpack/lib/program.js +778 -718
package/webpack/lib/program.js
CHANGED
|
@@ -9328,7 +9328,7 @@ var __webpack_modules__ = {
|
|
|
9328
9328
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
9329
9329
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9330
9330
|
};
|
|
9331
|
-
var _DiskCache_root;
|
|
9331
|
+
var _DiskCache_instances, _a, _DiskCache_CACHE, _DiskCache_root, _DiskCache_entries, _Entry_instances, _Entry_lockFile_get, _Entry_markerFile_get;
|
|
9332
9332
|
Object.defineProperty(exports, "__esModule", {
|
|
9333
9333
|
value: true
|
|
9334
9334
|
});
|
|
@@ -9342,6 +9342,7 @@ var __webpack_modules__ = {
|
|
|
9342
9342
|
const PRUNE_AFTER_MILLISECONDS = process.env.JSII_RUNTIME_PACKAGE_CACHE_TTL ? parseInt(process.env.JSII_RUNTIME_PACKAGE_CACHE_TTL, 10) * ONE_DAY_IN_MS : 30 * ONE_DAY_IN_MS;
|
|
9343
9343
|
class DiskCache {
|
|
9344
9344
|
constructor(root) {
|
|
9345
|
+
_DiskCache_instances.add(this);
|
|
9345
9346
|
_DiskCache_root.set(this, void 0);
|
|
9346
9347
|
__classPrivateFieldSet(this, _DiskCache_root, root, "f");
|
|
9347
9348
|
process.once("beforeExit", (() => this.pruneExpiredEntries()));
|
|
@@ -9356,10 +9357,10 @@ var __webpack_modules__ = {
|
|
|
9356
9357
|
(0, fs_1.writeFileSync)((0, path_1.join)(path, ".nosync"), "");
|
|
9357
9358
|
}
|
|
9358
9359
|
path = (0, fs_1.realpathSync)(path);
|
|
9359
|
-
if (!this.
|
|
9360
|
-
this.
|
|
9360
|
+
if (!__classPrivateFieldGet(this, _a, "f", _DiskCache_CACHE).has(path)) {
|
|
9361
|
+
__classPrivateFieldGet(this, _a, "f", _DiskCache_CACHE).set(path, new DiskCache(path));
|
|
9361
9362
|
}
|
|
9362
|
-
return this.
|
|
9363
|
+
return __classPrivateFieldGet(this, _a, "f", _DiskCache_CACHE).get(path);
|
|
9363
9364
|
}
|
|
9364
9365
|
entry(...key) {
|
|
9365
9366
|
if (key.length === 0) {
|
|
@@ -9378,7 +9379,7 @@ var __webpack_modules__ = {
|
|
|
9378
9379
|
}
|
|
9379
9380
|
pruneExpiredEntries() {
|
|
9380
9381
|
const cutOff = new Date(Date.now() - PRUNE_AFTER_MILLISECONDS);
|
|
9381
|
-
for (const entry of this.
|
|
9382
|
+
for (const entry of __classPrivateFieldGet(this, _DiskCache_instances, "m", _DiskCache_entries).call(this)) {
|
|
9382
9383
|
if (entry.atime < cutOff) {
|
|
9383
9384
|
entry.lock((lockedEntry => {
|
|
9384
9385
|
if (entry.atime > cutOff) {
|
|
@@ -9403,28 +9404,31 @@ var __webpack_modules__ = {
|
|
|
9403
9404
|
}
|
|
9404
9405
|
}
|
|
9405
9406
|
}
|
|
9406
|
-
* entries() {
|
|
9407
|
-
yield* inDirectory(__classPrivateFieldGet(this, _DiskCache_root, "f"));
|
|
9408
|
-
function* inDirectory(dir) {
|
|
9409
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(dir, MARKER_FILE_NAME))) {
|
|
9410
|
-
return yield new Entry(dir);
|
|
9411
|
-
}
|
|
9412
|
-
for (const file of directoriesUnder(dir)) {
|
|
9413
|
-
yield* inDirectory(file);
|
|
9414
|
-
}
|
|
9415
|
-
}
|
|
9416
|
-
}
|
|
9417
9407
|
}
|
|
9418
9408
|
exports.DiskCache = DiskCache;
|
|
9419
|
-
_DiskCache_root = new WeakMap
|
|
9420
|
-
|
|
9409
|
+
_a = DiskCache, _DiskCache_root = new WeakMap, _DiskCache_instances = new WeakSet,
|
|
9410
|
+
_DiskCache_entries = function* _DiskCache_entries() {
|
|
9411
|
+
yield* inDirectory(__classPrivateFieldGet(this, _DiskCache_root, "f"));
|
|
9412
|
+
function* inDirectory(dir) {
|
|
9413
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(dir, MARKER_FILE_NAME))) {
|
|
9414
|
+
return yield new Entry(dir);
|
|
9415
|
+
}
|
|
9416
|
+
for (const file of directoriesUnder(dir)) {
|
|
9417
|
+
yield* inDirectory(file);
|
|
9418
|
+
}
|
|
9419
|
+
}
|
|
9420
|
+
};
|
|
9421
|
+
_DiskCache_CACHE = {
|
|
9422
|
+
value: new Map
|
|
9423
|
+
};
|
|
9421
9424
|
class Entry {
|
|
9422
9425
|
constructor(path) {
|
|
9423
9426
|
this.path = path;
|
|
9427
|
+
_Entry_instances.add(this);
|
|
9424
9428
|
}
|
|
9425
9429
|
get atime() {
|
|
9426
9430
|
try {
|
|
9427
|
-
const stat = (0, fs_1.statSync)(this
|
|
9431
|
+
const stat = (0, fs_1.statSync)(__classPrivateFieldGet(this, _Entry_instances, "a", _Entry_markerFile_get));
|
|
9428
9432
|
return stat.atime;
|
|
9429
9433
|
} catch (err) {
|
|
9430
9434
|
if (err.code !== "ENOENT") {
|
|
@@ -9436,17 +9440,11 @@ var __webpack_modules__ = {
|
|
|
9436
9440
|
get pathExists() {
|
|
9437
9441
|
return (0, fs_1.existsSync)(this.path);
|
|
9438
9442
|
}
|
|
9439
|
-
get lockFile() {
|
|
9440
|
-
return `${this.path}.lock`;
|
|
9441
|
-
}
|
|
9442
|
-
get markerFile() {
|
|
9443
|
-
return (0, path_1.join)(this.path, MARKER_FILE_NAME);
|
|
9444
|
-
}
|
|
9445
9443
|
lock(cb) {
|
|
9446
9444
|
(0, fs_1.mkdirSync)((0, path_1.dirname)(this.path), {
|
|
9447
9445
|
recursive: true
|
|
9448
9446
|
});
|
|
9449
|
-
(0, lockfile_1.lockSync)(this
|
|
9447
|
+
(0, lockfile_1.lockSync)(__classPrivateFieldGet(this, _Entry_instances, "a", _Entry_lockFile_get), {
|
|
9450
9448
|
retries: 12,
|
|
9451
9449
|
stale: 5e3
|
|
9452
9450
|
});
|
|
@@ -9476,18 +9474,18 @@ var __webpack_modules__ = {
|
|
|
9476
9474
|
throw new Error(`Cannot touch ${this.path} once the lock block was returned!`);
|
|
9477
9475
|
}
|
|
9478
9476
|
if (this.pathExists) {
|
|
9479
|
-
if ((0, fs_1.existsSync)(this
|
|
9477
|
+
if ((0, fs_1.existsSync)(__classPrivateFieldGet(this, _Entry_instances, "a", _Entry_markerFile_get))) {
|
|
9480
9478
|
const now = new Date;
|
|
9481
|
-
(0, fs_1.utimesSync)(this
|
|
9479
|
+
(0, fs_1.utimesSync)(__classPrivateFieldGet(this, _Entry_instances, "a", _Entry_markerFile_get), now, now);
|
|
9482
9480
|
} else {
|
|
9483
|
-
(0, fs_1.writeFileSync)(this
|
|
9481
|
+
(0, fs_1.writeFileSync)(__classPrivateFieldGet(this, _Entry_instances, "a", _Entry_markerFile_get), "");
|
|
9484
9482
|
}
|
|
9485
9483
|
}
|
|
9486
9484
|
}
|
|
9487
9485
|
});
|
|
9488
9486
|
} finally {
|
|
9489
9487
|
disposed = true;
|
|
9490
|
-
(0, lockfile_1.unlockSync)(this
|
|
9488
|
+
(0, lockfile_1.unlockSync)(__classPrivateFieldGet(this, _Entry_instances, "a", _Entry_lockFile_get));
|
|
9491
9489
|
}
|
|
9492
9490
|
}
|
|
9493
9491
|
read(file) {
|
|
@@ -9502,6 +9500,11 @@ var __webpack_modules__ = {
|
|
|
9502
9500
|
}
|
|
9503
9501
|
}
|
|
9504
9502
|
exports.Entry = Entry;
|
|
9503
|
+
_Entry_instances = new WeakSet, _Entry_lockFile_get = function _Entry_lockFile_get() {
|
|
9504
|
+
return `${this.path}.lock`;
|
|
9505
|
+
}, _Entry_markerFile_get = function _Entry_markerFile_get() {
|
|
9506
|
+
return (0, path_1.join)(this.path, MARKER_FILE_NAME);
|
|
9507
|
+
};
|
|
9505
9508
|
function* directoriesUnder(root, recursive = false, ignoreErrors = true) {
|
|
9506
9509
|
for (const file of (0, fs_1.readdirSync)(root)) {
|
|
9507
9510
|
const path = (0, path_1.join)(root, file);
|
|
@@ -9576,14 +9579,26 @@ var __webpack_modules__ = {
|
|
|
9576
9579
|
const api = __webpack_require__(2816);
|
|
9577
9580
|
exports.api = api;
|
|
9578
9581
|
},
|
|
9579
|
-
2742: (__unused_webpack_module, exports, __webpack_require__)
|
|
9582
|
+
2742: function(__unused_webpack_module, exports, __webpack_require__) {
|
|
9580
9583
|
"use strict";
|
|
9584
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
9585
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9586
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
9587
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9588
|
+
};
|
|
9589
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
9590
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9591
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9592
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
9593
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
|
|
9594
|
+
value;
|
|
9595
|
+
};
|
|
9596
|
+
var _Kernel_instances, _Kernel_assemblies, _Kernel_objects, _Kernel_cbs, _Kernel_waiting, _Kernel_promises, _Kernel_serializerHost, _Kernel_nextid, _Kernel_syncInProgress, _Kernel_installDir, _Kernel_require, _Kernel_load, _Kernel_addAssembly, _Kernel_findCtor, _Kernel_getPackageDir, _Kernel_create, _Kernel_getSuperPropertyName, _Kernel_applyPropertyOverride, _Kernel_defineOverridenProperty, _Kernel_applyMethodOverride, _Kernel_defineOverridenMethod, _Kernel_findInvokeTarget, _Kernel_validateMethodArguments, _Kernel_assemblyFor, _Kernel_findSymbol, _Kernel_typeInfoForFqn, _Kernel_isVisibleType, _Kernel_typeInfoForMethod, _Kernel_tryTypeInfoForMethod, _Kernel_tryTypeInfoForProperty, _Kernel_typeInfoForProperty, _Kernel_toSandbox, _Kernel_fromSandbox, _Kernel_toSandboxValues, _Kernel_fromSandboxValues, _Kernel_boxUnboxParameters, _Kernel_debug, _Kernel_debugTime, _Kernel_ensureSync, _Kernel_findPropertyTarget, _Kernel_getBinScriptCommand, _Kernel_makecbid, _Kernel_makeprid;
|
|
9581
9597
|
Object.defineProperty(exports, "__esModule", {
|
|
9582
9598
|
value: true
|
|
9583
9599
|
});
|
|
9584
9600
|
exports.Kernel = exports.RuntimeError = exports.JsiiFault = void 0;
|
|
9585
9601
|
const spec = __webpack_require__(1804);
|
|
9586
|
-
const spec_1 = __webpack_require__(1804);
|
|
9587
9602
|
const cp = __webpack_require__(2081);
|
|
9588
9603
|
const fs = __webpack_require__(9728);
|
|
9589
9604
|
const module_1 = __webpack_require__(8188);
|
|
@@ -9612,71 +9627,36 @@ var __webpack_modules__ = {
|
|
|
9612
9627
|
class Kernel {
|
|
9613
9628
|
constructor(callbackHandler) {
|
|
9614
9629
|
this.callbackHandler = callbackHandler;
|
|
9630
|
+
_Kernel_instances.add(this);
|
|
9615
9631
|
this.traceEnabled = false;
|
|
9616
9632
|
this.debugTimingEnabled = false;
|
|
9617
|
-
this.
|
|
9618
|
-
this
|
|
9619
|
-
this.
|
|
9620
|
-
this
|
|
9621
|
-
this
|
|
9622
|
-
this
|
|
9633
|
+
this.validateAssemblies = false;
|
|
9634
|
+
_Kernel_assemblies.set(this, new Map);
|
|
9635
|
+
_Kernel_objects.set(this, new objects_1.ObjectTable(__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForFqn).bind(this)));
|
|
9636
|
+
_Kernel_cbs.set(this, new Map);
|
|
9637
|
+
_Kernel_waiting.set(this, new Map);
|
|
9638
|
+
_Kernel_promises.set(this, new Map);
|
|
9639
|
+
_Kernel_serializerHost.set(this, void 0);
|
|
9640
|
+
_Kernel_nextid.set(this, 2e4);
|
|
9641
|
+
_Kernel_syncInProgress.set(this, void 0);
|
|
9642
|
+
_Kernel_installDir.set(this, void 0);
|
|
9643
|
+
_Kernel_require.set(this, void 0);
|
|
9644
|
+
__classPrivateFieldSet(this, _Kernel_serializerHost, {
|
|
9645
|
+
objects: __classPrivateFieldGet(this, _Kernel_objects, "f"),
|
|
9646
|
+
debug: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).bind(this),
|
|
9647
|
+
isVisibleType: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_isVisibleType).bind(this),
|
|
9648
|
+
findSymbol: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findSymbol).bind(this),
|
|
9649
|
+
lookupType: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForFqn).bind(this)
|
|
9650
|
+
}, "f");
|
|
9623
9651
|
}
|
|
9624
9652
|
load(req) {
|
|
9625
|
-
return this.
|
|
9626
|
-
}
|
|
9627
|
-
_load(req) {
|
|
9628
|
-
var _a, _b, _c;
|
|
9629
|
-
this._debug("load", req);
|
|
9630
|
-
if ("assembly" in req) {
|
|
9631
|
-
throw new JsiiFault('`assembly` field is deprecated for "load", use `name`, `version` and `tarball` instead');
|
|
9632
|
-
}
|
|
9633
|
-
const pkgname = req.name;
|
|
9634
|
-
const pkgver = req.version;
|
|
9635
|
-
const packageDir = this._getPackageDir(pkgname);
|
|
9636
|
-
if (fs.pathExistsSync(packageDir)) {
|
|
9637
|
-
const epkg = fs.readJsonSync(path.join(packageDir, "package.json"));
|
|
9638
|
-
if (epkg.version !== pkgver) {
|
|
9639
|
-
throw new JsiiFault(`Multiple versions ${pkgver} and ${epkg.version} of the ` + `package '${pkgname}' cannot be loaded together since this is unsupported by ` + "some runtime environments");
|
|
9640
|
-
}
|
|
9641
|
-
this._debug("look up already-loaded assembly", pkgname);
|
|
9642
|
-
const assm = this.assemblies.get(pkgname);
|
|
9643
|
-
return {
|
|
9644
|
-
assembly: assm.metadata.name,
|
|
9645
|
-
types: Object.keys((_a = assm.metadata.types) !== null && _a !== void 0 ? _a : {}).length
|
|
9646
|
-
};
|
|
9647
|
-
}
|
|
9648
|
-
const originalUmask = process.umask(18);
|
|
9649
|
-
try {
|
|
9650
|
-
const {cache} = this._debugTime((() => tar.extract(req.tarball, packageDir, {
|
|
9651
|
-
strict: true,
|
|
9652
|
-
strip: 1,
|
|
9653
|
-
unlink: true
|
|
9654
|
-
}, req.name, req.version)), `tar.extract(${req.tarball}) => ${packageDir}`);
|
|
9655
|
-
if (cache != null) {
|
|
9656
|
-
this._debug(`Package cache enabled, extraction resulted in a cache ${cache}`);
|
|
9657
|
-
}
|
|
9658
|
-
} finally {
|
|
9659
|
-
process.umask(originalUmask);
|
|
9660
|
-
}
|
|
9661
|
-
let assmSpec;
|
|
9662
|
-
try {
|
|
9663
|
-
assmSpec = this._debugTime((() => (0, spec_1.loadAssemblyFromPath)(packageDir)), `loadAssemblyFromPath(${packageDir})`);
|
|
9664
|
-
} catch (e) {
|
|
9665
|
-
throw new JsiiFault(`Error for package tarball ${req.tarball}: ${e.message}`);
|
|
9666
|
-
}
|
|
9667
|
-
const closure = this._debugTime((() => this.require(packageDir)), `require(${packageDir})`);
|
|
9668
|
-
const assm = new Assembly(assmSpec, closure);
|
|
9669
|
-
this._debugTime((() => this._addAssembly(assm)), `registerAssembly({ name: ${assm.metadata.name}, types: ${Object.keys((_b = assm.metadata.types) !== null && _b !== void 0 ? _b : {}).length} })`);
|
|
9670
|
-
return {
|
|
9671
|
-
assembly: assmSpec.name,
|
|
9672
|
-
types: Object.keys((_c = assmSpec.types) !== null && _c !== void 0 ? _c : {}).length
|
|
9673
|
-
};
|
|
9653
|
+
return __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debugTime).call(this, (() => __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_load).call(this, req)), `load(${JSON.stringify(req, null, 2)})`);
|
|
9674
9654
|
}
|
|
9675
9655
|
getBinScriptCommand(req) {
|
|
9676
|
-
return this.
|
|
9656
|
+
return __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_getBinScriptCommand).call(this, req);
|
|
9677
9657
|
}
|
|
9678
9658
|
invokeBinScript(req) {
|
|
9679
|
-
const {command, args, env} = this.
|
|
9659
|
+
const {command, args, env} = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_getBinScriptCommand).call(this, req);
|
|
9680
9660
|
const result = cp.spawnSync(command, args, {
|
|
9681
9661
|
encoding: "utf-8",
|
|
9682
9662
|
env,
|
|
@@ -9690,27 +9670,27 @@ var __webpack_modules__ = {
|
|
|
9690
9670
|
};
|
|
9691
9671
|
}
|
|
9692
9672
|
create(req) {
|
|
9693
|
-
return this.
|
|
9673
|
+
return __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_create).call(this, req);
|
|
9694
9674
|
}
|
|
9695
9675
|
del(req) {
|
|
9696
9676
|
const {objref} = req;
|
|
9697
|
-
this.
|
|
9698
|
-
this.
|
|
9677
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "del", objref);
|
|
9678
|
+
__classPrivateFieldGet(this, _Kernel_objects, "f").deleteObject(objref);
|
|
9699
9679
|
return {};
|
|
9700
9680
|
}
|
|
9701
9681
|
sget(req) {
|
|
9702
9682
|
const {fqn, property} = req;
|
|
9703
9683
|
const symbol = `${fqn}.${property}`;
|
|
9704
|
-
this.
|
|
9705
|
-
const ti = this.
|
|
9684
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "sget", symbol);
|
|
9685
|
+
const ti = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForProperty).call(this, property, fqn);
|
|
9706
9686
|
if (!ti.static) {
|
|
9707
9687
|
throw new JsiiFault(`property ${symbol} is not static`);
|
|
9708
9688
|
}
|
|
9709
|
-
const prototype = this.
|
|
9710
|
-
const value = this.
|
|
9711
|
-
this.
|
|
9712
|
-
const ret = this.
|
|
9713
|
-
this.
|
|
9689
|
+
const prototype = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findSymbol).call(this, fqn);
|
|
9690
|
+
const value = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_ensureSync).call(this, `property ${property}`, (() => prototype[property]));
|
|
9691
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "value:", value);
|
|
9692
|
+
const ret = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_fromSandbox).call(this, value, ti, `of static property ${symbol}`);
|
|
9693
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "ret", ret);
|
|
9714
9694
|
return {
|
|
9715
9695
|
value: ret
|
|
9716
9696
|
};
|
|
@@ -9718,57 +9698,57 @@ var __webpack_modules__ = {
|
|
|
9718
9698
|
sset(req) {
|
|
9719
9699
|
const {fqn, property, value} = req;
|
|
9720
9700
|
const symbol = `${fqn}.${property}`;
|
|
9721
|
-
this.
|
|
9722
|
-
const ti = this.
|
|
9701
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "sset", symbol);
|
|
9702
|
+
const ti = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForProperty).call(this, property, fqn);
|
|
9723
9703
|
if (!ti.static) {
|
|
9724
9704
|
throw new JsiiFault(`property ${symbol} is not static`);
|
|
9725
9705
|
}
|
|
9726
9706
|
if (ti.immutable) {
|
|
9727
9707
|
throw new JsiiFault(`static property ${symbol} is readonly`);
|
|
9728
9708
|
}
|
|
9729
|
-
const prototype = this.
|
|
9730
|
-
this.
|
|
9709
|
+
const prototype = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findSymbol).call(this, fqn);
|
|
9710
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_ensureSync).call(this, `property ${property}`, (() => prototype[property] = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandbox).call(this, value, ti, `assigned to static property ${symbol}`)));
|
|
9731
9711
|
return {};
|
|
9732
9712
|
}
|
|
9733
9713
|
get(req) {
|
|
9734
9714
|
const {objref, property} = req;
|
|
9735
|
-
this.
|
|
9736
|
-
const {instance, fqn, interfaces} = this.
|
|
9737
|
-
const ti = this.
|
|
9738
|
-
const propertyToGet = this.
|
|
9739
|
-
const value = this.
|
|
9740
|
-
this.
|
|
9741
|
-
const ret = this.
|
|
9742
|
-
this.
|
|
9715
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "get", objref, property);
|
|
9716
|
+
const {instance, fqn, interfaces} = __classPrivateFieldGet(this, _Kernel_objects, "f").findObject(objref);
|
|
9717
|
+
const ti = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForProperty).call(this, property, fqn, interfaces);
|
|
9718
|
+
const propertyToGet = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findPropertyTarget).call(this, instance, property);
|
|
9719
|
+
const value = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_ensureSync).call(this, `property '${objref[api_1.TOKEN_REF]}.${propertyToGet}'`, (() => instance[propertyToGet]));
|
|
9720
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "value:", value);
|
|
9721
|
+
const ret = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_fromSandbox).call(this, value, ti, `of property ${fqn}.${property}`);
|
|
9722
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "ret:", ret);
|
|
9743
9723
|
return {
|
|
9744
9724
|
value: ret
|
|
9745
9725
|
};
|
|
9746
9726
|
}
|
|
9747
9727
|
set(req) {
|
|
9748
9728
|
const {objref, property, value} = req;
|
|
9749
|
-
this.
|
|
9750
|
-
const {instance, fqn, interfaces} = this.
|
|
9751
|
-
const propInfo = this.
|
|
9729
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "set", objref, property, value);
|
|
9730
|
+
const {instance, fqn, interfaces} = __classPrivateFieldGet(this, _Kernel_objects, "f").findObject(objref);
|
|
9731
|
+
const propInfo = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForProperty).call(this, req.property, fqn, interfaces);
|
|
9752
9732
|
if (propInfo.immutable) {
|
|
9753
9733
|
throw new JsiiFault(`Cannot set value of immutable property ${req.property} to ${req.value}`);
|
|
9754
9734
|
}
|
|
9755
|
-
const propertyToSet = this.
|
|
9756
|
-
this.
|
|
9735
|
+
const propertyToSet = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findPropertyTarget).call(this, instance, property);
|
|
9736
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_ensureSync).call(this, `property '${objref[api_1.TOKEN_REF]}.${propertyToSet}'`, (() => instance[propertyToSet] = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandbox).call(this, value, propInfo, `assigned to property ${fqn}.${property}`)));
|
|
9757
9737
|
return {};
|
|
9758
9738
|
}
|
|
9759
9739
|
invoke(req) {
|
|
9760
9740
|
var _a, _b;
|
|
9761
9741
|
const {objref, method} = req;
|
|
9762
9742
|
const args = (_a = req.args) !== null && _a !== void 0 ? _a : [];
|
|
9763
|
-
this.
|
|
9764
|
-
const {ti, obj, fn} = this.
|
|
9743
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "invoke", objref, method, args);
|
|
9744
|
+
const {ti, obj, fn} = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findInvokeTarget).call(this, objref, method, args);
|
|
9765
9745
|
if (ti.async) {
|
|
9766
9746
|
throw new JsiiFault(`${method} is an async method, use "begin" instead`);
|
|
9767
9747
|
}
|
|
9768
|
-
const fqn = (0, objects_1.jsiiTypeFqn)(obj);
|
|
9769
|
-
const ret = this.
|
|
9770
|
-
const result = this.
|
|
9771
|
-
this.
|
|
9748
|
+
const fqn = (0, objects_1.jsiiTypeFqn)(obj, __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_isVisibleType).bind(this));
|
|
9749
|
+
const ret = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_ensureSync).call(this, `method '${objref[api_1.TOKEN_REF]}.${method}'`, (() => fn.apply(obj, __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandboxValues).call(this, args, `method ${fqn ? `${fqn}#` : ""}${method}`, ti.parameters))));
|
|
9750
|
+
const result = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_fromSandbox).call(this, ret, (_b = ti.returns) !== null && _b !== void 0 ? _b : "void", `returned by method ${fqn ? `${fqn}#` : ""}${method}`);
|
|
9751
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "invoke result", result);
|
|
9772
9752
|
return {
|
|
9773
9753
|
result
|
|
9774
9754
|
};
|
|
@@ -9777,39 +9757,39 @@ var __webpack_modules__ = {
|
|
|
9777
9757
|
var _a, _b;
|
|
9778
9758
|
const {fqn, method} = req;
|
|
9779
9759
|
const args = (_a = req.args) !== null && _a !== void 0 ? _a : [];
|
|
9780
|
-
this.
|
|
9781
|
-
const ti = this.
|
|
9760
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "sinvoke", fqn, method, args);
|
|
9761
|
+
const ti = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForMethod).call(this, method, fqn);
|
|
9782
9762
|
if (!ti.static) {
|
|
9783
9763
|
throw new JsiiFault(`${fqn}.${method} is not a static method`);
|
|
9784
9764
|
}
|
|
9785
9765
|
if (ti.async) {
|
|
9786
9766
|
throw new JsiiFault(`${method} is an async method, use "begin" instead`);
|
|
9787
9767
|
}
|
|
9788
|
-
const prototype = this.
|
|
9768
|
+
const prototype = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findSymbol).call(this, fqn);
|
|
9789
9769
|
const fn = prototype[method];
|
|
9790
|
-
const ret = this.
|
|
9791
|
-
this.
|
|
9770
|
+
const ret = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_ensureSync).call(this, `method '${fqn}.${method}'`, (() => fn.apply(prototype, __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandboxValues).call(this, args, `static method ${fqn}.${method}`, ti.parameters))));
|
|
9771
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "method returned:", ret);
|
|
9792
9772
|
return {
|
|
9793
|
-
result: this.
|
|
9773
|
+
result: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_fromSandbox).call(this, ret, (_b = ti.returns) !== null && _b !== void 0 ? _b : "void", `returned by static method ${fqn}.${method}`)
|
|
9794
9774
|
};
|
|
9795
9775
|
}
|
|
9796
9776
|
begin(req) {
|
|
9797
9777
|
var _a;
|
|
9798
9778
|
const {objref, method} = req;
|
|
9799
9779
|
const args = (_a = req.args) !== null && _a !== void 0 ? _a : [];
|
|
9800
|
-
this.
|
|
9801
|
-
if (this
|
|
9802
|
-
throw new JsiiFault(`Cannot invoke async method '${req.objref[api_1.TOKEN_REF]}.${req.method}' while sync ${this
|
|
9780
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "begin", objref, method, args);
|
|
9781
|
+
if (__classPrivateFieldGet(this, _Kernel_syncInProgress, "f")) {
|
|
9782
|
+
throw new JsiiFault(`Cannot invoke async method '${req.objref[api_1.TOKEN_REF]}.${req.method}' while sync ${__classPrivateFieldGet(this, _Kernel_syncInProgress, "f")} is being processed`);
|
|
9803
9783
|
}
|
|
9804
|
-
const {ti, obj, fn} = this.
|
|
9784
|
+
const {ti, obj, fn} = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findInvokeTarget).call(this, objref, method, args);
|
|
9805
9785
|
if (!ti.async) {
|
|
9806
9786
|
throw new JsiiFault(`Method ${method} is expected to be an async method`);
|
|
9807
9787
|
}
|
|
9808
|
-
const fqn = (0, objects_1.jsiiTypeFqn)(obj);
|
|
9809
|
-
const promise = fn.apply(obj, this.
|
|
9788
|
+
const fqn = (0, objects_1.jsiiTypeFqn)(obj, __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_isVisibleType).bind(this));
|
|
9789
|
+
const promise = fn.apply(obj, __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandboxValues).call(this, args, `async method ${fqn ? `${fqn}#` : ""}${method}`, ti.parameters));
|
|
9810
9790
|
promise.catch((_ => undefined));
|
|
9811
|
-
const prid = this.
|
|
9812
|
-
this.
|
|
9791
|
+
const prid = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_makeprid).call(this);
|
|
9792
|
+
__classPrivateFieldGet(this, _Kernel_promises, "f").set(prid, {
|
|
9813
9793
|
promise,
|
|
9814
9794
|
method: ti
|
|
9815
9795
|
});
|
|
@@ -9820,8 +9800,8 @@ var __webpack_modules__ = {
|
|
|
9820
9800
|
async end(req) {
|
|
9821
9801
|
var _a;
|
|
9822
9802
|
const {promiseid} = req;
|
|
9823
|
-
this.
|
|
9824
|
-
const storedPromise = this.
|
|
9803
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "end", promiseid);
|
|
9804
|
+
const storedPromise = __classPrivateFieldGet(this, _Kernel_promises, "f").get(promiseid);
|
|
9825
9805
|
if (storedPromise == null) {
|
|
9826
9806
|
throw new JsiiFault(`Cannot find promise with ID: ${promiseid}`);
|
|
9827
9807
|
}
|
|
@@ -9829,9 +9809,9 @@ var __webpack_modules__ = {
|
|
|
9829
9809
|
let result;
|
|
9830
9810
|
try {
|
|
9831
9811
|
result = await promise;
|
|
9832
|
-
this.
|
|
9812
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "promise result:", result);
|
|
9833
9813
|
} catch (e) {
|
|
9834
|
-
this.
|
|
9814
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "promise error:", e);
|
|
9835
9815
|
if (e.name === "@jsii/kernel.Fault") {
|
|
9836
9816
|
if (e instanceof JsiiFault) {
|
|
9837
9817
|
throw e;
|
|
@@ -9844,14 +9824,14 @@ var __webpack_modules__ = {
|
|
|
9844
9824
|
throw new RuntimeError(e);
|
|
9845
9825
|
}
|
|
9846
9826
|
return {
|
|
9847
|
-
result: this.
|
|
9827
|
+
result: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_fromSandbox).call(this, result, (_a = method.returns) !== null && _a !== void 0 ? _a : "void", `returned by async method ${method.name}`)
|
|
9848
9828
|
};
|
|
9849
9829
|
}
|
|
9850
9830
|
callbacks(_req) {
|
|
9851
|
-
this.
|
|
9852
|
-
const ret = Array.from(this.
|
|
9853
|
-
this.
|
|
9854
|
-
this.
|
|
9831
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "callbacks");
|
|
9832
|
+
const ret = Array.from(__classPrivateFieldGet(this, _Kernel_cbs, "f").entries()).map((([cbid, cb]) => {
|
|
9833
|
+
__classPrivateFieldGet(this, _Kernel_waiting, "f").set(cbid, cb);
|
|
9834
|
+
__classPrivateFieldGet(this, _Kernel_cbs, "f").delete(cbid);
|
|
9855
9835
|
const callback = {
|
|
9856
9836
|
cbid,
|
|
9857
9837
|
cookie: cb.override.cookie,
|
|
@@ -9870,28 +9850,28 @@ var __webpack_modules__ = {
|
|
|
9870
9850
|
complete(req) {
|
|
9871
9851
|
var _a;
|
|
9872
9852
|
const {cbid, err, result, name} = req;
|
|
9873
|
-
this.
|
|
9874
|
-
const cb = this.
|
|
9853
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "complete", cbid, err, result);
|
|
9854
|
+
const cb = __classPrivateFieldGet(this, _Kernel_waiting, "f").get(cbid);
|
|
9875
9855
|
if (!cb) {
|
|
9876
9856
|
throw new JsiiFault(`Callback ${cbid} not found`);
|
|
9877
9857
|
}
|
|
9878
9858
|
if (err) {
|
|
9879
|
-
this.
|
|
9859
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "completed with error:", err);
|
|
9880
9860
|
cb.fail(name === "@jsii/kernel.Fault" ? new JsiiFault(err) : new RuntimeError(err));
|
|
9881
9861
|
} else {
|
|
9882
|
-
const sandoxResult = this.
|
|
9883
|
-
this.
|
|
9862
|
+
const sandoxResult = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandbox).call(this, result, (_a = cb.expectedReturnType) !== null && _a !== void 0 ? _a : "void", `returned by callback ${cb.toString()}`);
|
|
9863
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "completed with result:", sandoxResult);
|
|
9884
9864
|
cb.succeed(sandoxResult);
|
|
9885
9865
|
}
|
|
9886
|
-
this.
|
|
9866
|
+
__classPrivateFieldGet(this, _Kernel_waiting, "f").delete(cbid);
|
|
9887
9867
|
return {
|
|
9888
9868
|
cbid
|
|
9889
9869
|
};
|
|
9890
9870
|
}
|
|
9891
9871
|
naming(req) {
|
|
9892
9872
|
const assemblyName = req.assembly;
|
|
9893
|
-
this.
|
|
9894
|
-
const assembly = this.
|
|
9873
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "naming", assemblyName);
|
|
9874
|
+
const assembly = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_assemblyFor).call(this, assemblyName);
|
|
9895
9875
|
const targets = assembly.metadata.targets;
|
|
9896
9876
|
if (!targets) {
|
|
9897
9877
|
throw new JsiiFault(`Unexpected - "targets" for ${assemblyName} is missing!`);
|
|
@@ -9902,511 +9882,545 @@ var __webpack_modules__ = {
|
|
|
9902
9882
|
}
|
|
9903
9883
|
stats(_req) {
|
|
9904
9884
|
return {
|
|
9905
|
-
objectCount: this.
|
|
9885
|
+
objectCount: __classPrivateFieldGet(this, _Kernel_objects, "f").count
|
|
9906
9886
|
};
|
|
9907
9887
|
}
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9888
|
+
}
|
|
9889
|
+
exports.Kernel = Kernel;
|
|
9890
|
+
_Kernel_assemblies = new WeakMap, _Kernel_objects = new WeakMap, _Kernel_cbs = new WeakMap,
|
|
9891
|
+
_Kernel_waiting = new WeakMap, _Kernel_promises = new WeakMap, _Kernel_serializerHost = new WeakMap,
|
|
9892
|
+
_Kernel_nextid = new WeakMap, _Kernel_syncInProgress = new WeakMap, _Kernel_installDir = new WeakMap,
|
|
9893
|
+
_Kernel_require = new WeakMap, _Kernel_instances = new WeakSet, _Kernel_load = function _Kernel_load(req) {
|
|
9894
|
+
var _a, _b, _c;
|
|
9895
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "load", req);
|
|
9896
|
+
if ("assembly" in req) {
|
|
9897
|
+
throw new JsiiFault('`assembly` field is deprecated for "load", use `name`, `version` and `tarball` instead');
|
|
9898
|
+
}
|
|
9899
|
+
const pkgname = req.name;
|
|
9900
|
+
const pkgver = req.version;
|
|
9901
|
+
const packageDir = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_getPackageDir).call(this, pkgname);
|
|
9902
|
+
if (fs.pathExistsSync(packageDir)) {
|
|
9903
|
+
const epkg = fs.readJsonSync(path.join(packageDir, "package.json"));
|
|
9904
|
+
if (epkg.version !== pkgver) {
|
|
9905
|
+
throw new JsiiFault(`Multiple versions ${pkgver} and ${epkg.version} of the ` + `package '${pkgname}' cannot be loaded together since this is unsupported by ` + "some runtime environments");
|
|
9906
|
+
}
|
|
9907
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "look up already-loaded assembly", pkgname);
|
|
9908
|
+
const assm = __classPrivateFieldGet(this, _Kernel_assemblies, "f").get(pkgname);
|
|
9909
|
+
return {
|
|
9910
|
+
assembly: assm.metadata.name,
|
|
9911
|
+
types: Object.keys((_a = assm.metadata.types) !== null && _a !== void 0 ? _a : {}).length
|
|
9912
|
+
};
|
|
9923
9913
|
}
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
|
|
9928
|
-
|
|
9914
|
+
const originalUmask = process.umask(18);
|
|
9915
|
+
try {
|
|
9916
|
+
const {cache} = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debugTime).call(this, (() => tar.extract(req.tarball, packageDir, {
|
|
9917
|
+
strict: true,
|
|
9918
|
+
strip: 1,
|
|
9919
|
+
unlink: true
|
|
9920
|
+
}, req.name, req.version)), `tar.extract(${req.tarball}) => ${packageDir}`);
|
|
9921
|
+
if (cache != null) {
|
|
9922
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, `Package cache enabled, extraction resulted in a cache ${cache}`);
|
|
9929
9923
|
}
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9924
|
+
} finally {
|
|
9925
|
+
process.umask(originalUmask);
|
|
9926
|
+
}
|
|
9927
|
+
let assmSpec;
|
|
9928
|
+
try {
|
|
9929
|
+
assmSpec = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debugTime).call(this, (() => spec.loadAssemblyFromPath(packageDir, this.validateAssemblies)), `loadAssemblyFromPath(${packageDir})`);
|
|
9930
|
+
} catch (e) {
|
|
9931
|
+
throw new JsiiFault(`Error for package tarball ${req.tarball}: ${e.message}`);
|
|
9932
|
+
}
|
|
9933
|
+
const entryPoint = __classPrivateFieldGet(this, _Kernel_require, "f").resolve(assmSpec.name, {
|
|
9934
|
+
paths: [ __classPrivateFieldGet(this, _Kernel_installDir, "f") ]
|
|
9935
|
+
});
|
|
9936
|
+
const closure = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debugTime).call(this, (() => __classPrivateFieldGet(this, _Kernel_require, "f")(entryPoint)), `require(${entryPoint})`);
|
|
9937
|
+
const assm = new Assembly(assmSpec, closure);
|
|
9938
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debugTime).call(this, (() => __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_addAssembly).call(this, assm)), `registerAssembly({ name: ${assm.metadata.name}, types: ${Object.keys((_b = assm.metadata.types) !== null && _b !== void 0 ? _b : {}).length} })`);
|
|
9939
|
+
return {
|
|
9940
|
+
assembly: assmSpec.name,
|
|
9941
|
+
types: Object.keys((_c = assmSpec.types) !== null && _c !== void 0 ? _c : {}).length
|
|
9942
|
+
};
|
|
9943
|
+
}, _Kernel_addAssembly = function _Kernel_addAssembly(assm) {
|
|
9944
|
+
var _a;
|
|
9945
|
+
__classPrivateFieldGet(this, _Kernel_assemblies, "f").set(assm.metadata.name, assm);
|
|
9946
|
+
const jsiiVersion = assm.metadata.jsiiVersion.split(" ", 1)[0];
|
|
9947
|
+
const [jsiiMajor, jsiiMinor, _jsiiPatch, ..._rest] = jsiiVersion.split(".").map((str => parseInt(str, 10)));
|
|
9948
|
+
if (jsiiVersion === "0.0.0" || jsiiMajor > 1 || jsiiMajor === 1 && jsiiMinor >= 19) {
|
|
9949
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "Using compiler-woven runtime type information!");
|
|
9950
|
+
return;
|
|
9951
|
+
}
|
|
9952
|
+
for (const fqn of Object.keys((_a = assm.metadata.types) !== null && _a !== void 0 ? _a : {})) {
|
|
9953
|
+
const typedef = assm.metadata.types[fqn];
|
|
9954
|
+
switch (typedef.kind) {
|
|
9940
9955
|
case spec.TypeKind.Interface:
|
|
9941
|
-
|
|
9956
|
+
continue;
|
|
9942
9957
|
|
|
9943
|
-
|
|
9944
|
-
|
|
9958
|
+
case spec.TypeKind.Class:
|
|
9959
|
+
case spec.TypeKind.Enum:
|
|
9960
|
+
const constructor = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findSymbol).call(this, fqn);
|
|
9961
|
+
(0, objects_1.tagJsiiConstructor)(constructor, fqn);
|
|
9945
9962
|
}
|
|
9946
9963
|
}
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
this._debug("creating jsii-kernel modules workdir:", this.installDir);
|
|
9953
|
-
onExit.removeSync(this.installDir);
|
|
9954
|
-
}
|
|
9955
|
-
return path.join(this.installDir, "node_modules", pkgname);
|
|
9964
|
+
}, _Kernel_findCtor = function _Kernel_findCtor(fqn, args) {
|
|
9965
|
+
if (fqn === wire.EMPTY_OBJECT_FQN) {
|
|
9966
|
+
return {
|
|
9967
|
+
ctor: Object
|
|
9968
|
+
};
|
|
9956
9969
|
}
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
const
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9970
|
+
const typeinfo = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForFqn).call(this, fqn);
|
|
9971
|
+
switch (typeinfo.kind) {
|
|
9972
|
+
case spec.TypeKind.Class:
|
|
9973
|
+
const classType = typeinfo;
|
|
9974
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_validateMethodArguments).call(this, classType.initializer, args);
|
|
9975
|
+
return {
|
|
9976
|
+
ctor: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findSymbol).call(this, fqn),
|
|
9977
|
+
parameters: classType.initializer && classType.initializer.parameters
|
|
9978
|
+
};
|
|
9979
|
+
|
|
9980
|
+
case spec.TypeKind.Interface:
|
|
9981
|
+
throw new JsiiFault(`Cannot create an object with an FQN of an interface: ${fqn}`);
|
|
9982
|
+
|
|
9983
|
+
default:
|
|
9984
|
+
throw new JsiiFault(`Unexpected FQN kind: ${fqn}`);
|
|
9985
|
+
}
|
|
9986
|
+
}, _Kernel_getPackageDir = function _Kernel_getPackageDir(pkgname) {
|
|
9987
|
+
if (!__classPrivateFieldGet(this, _Kernel_installDir, "f")) {
|
|
9988
|
+
__classPrivateFieldSet(this, _Kernel_installDir, fs.mkdtempSync(path.join(os.tmpdir(), "jsii-kernel-")), "f");
|
|
9989
|
+
__classPrivateFieldSet(this, _Kernel_require, (0, module_1.createRequire)(__classPrivateFieldGet(this, _Kernel_installDir, "f")), "f");
|
|
9990
|
+
fs.mkdirpSync(path.join(__classPrivateFieldGet(this, _Kernel_installDir, "f"), "node_modules"));
|
|
9991
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "creating jsii-kernel modules workdir:", __classPrivateFieldGet(this, _Kernel_installDir, "f"));
|
|
9992
|
+
onExit.removeSync(__classPrivateFieldGet(this, _Kernel_installDir, "f"));
|
|
9993
|
+
}
|
|
9994
|
+
return path.join(__classPrivateFieldGet(this, _Kernel_installDir, "f"), "node_modules", pkgname);
|
|
9995
|
+
}, _Kernel_create = function _Kernel_create(req) {
|
|
9996
|
+
var _a, _b;
|
|
9997
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "create", req);
|
|
9998
|
+
const {fqn, interfaces, overrides} = req;
|
|
9999
|
+
const requestArgs = (_a = req.args) !== null && _a !== void 0 ? _a : [];
|
|
10000
|
+
const ctorResult = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_findCtor).call(this, fqn, requestArgs);
|
|
10001
|
+
const ctor = ctorResult.ctor;
|
|
10002
|
+
const obj = new ctor(...__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandboxValues).call(this, requestArgs, `new ${fqn}`, ctorResult.parameters));
|
|
10003
|
+
const objref = __classPrivateFieldGet(this, _Kernel_objects, "f").registerObject(obj, fqn, (_b = req.interfaces) !== null && _b !== void 0 ? _b : []);
|
|
10004
|
+
if (overrides) {
|
|
10005
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "overrides", overrides);
|
|
10006
|
+
const overrideTypeErrorMessage = 'Override can either be "method" or "property"';
|
|
10007
|
+
const methods = new Set;
|
|
10008
|
+
const properties = new Set;
|
|
10009
|
+
for (const override of overrides) {
|
|
10010
|
+
if (api.isMethodOverride(override)) {
|
|
10011
|
+
if (api.isPropertyOverride(override)) {
|
|
10012
|
+
throw new JsiiFault(overrideTypeErrorMessage);
|
|
10013
|
+
}
|
|
10014
|
+
if (methods.has(override.method)) {
|
|
10015
|
+
throw new JsiiFault(`Duplicate override for method '${override.method}'`);
|
|
10016
|
+
}
|
|
10017
|
+
methods.add(override.method);
|
|
10018
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_applyMethodOverride).call(this, obj, objref, fqn, interfaces, override);
|
|
10019
|
+
} else if (api.isPropertyOverride(override)) {
|
|
9972
10020
|
if (api.isMethodOverride(override)) {
|
|
9973
|
-
if (api.isPropertyOverride(override)) {
|
|
9974
|
-
throw new JsiiFault(overrideTypeErrorMessage);
|
|
9975
|
-
}
|
|
9976
|
-
if (methods.has(override.method)) {
|
|
9977
|
-
throw new JsiiFault(`Duplicate override for method '${override.method}'`);
|
|
9978
|
-
}
|
|
9979
|
-
methods.add(override.method);
|
|
9980
|
-
this._applyMethodOverride(obj, objref, fqn, interfaces, override);
|
|
9981
|
-
} else if (api.isPropertyOverride(override)) {
|
|
9982
|
-
if (api.isMethodOverride(override)) {
|
|
9983
|
-
throw new JsiiFault(overrideTypeErrorMessage);
|
|
9984
|
-
}
|
|
9985
|
-
if (properties.has(override.property)) {
|
|
9986
|
-
throw new JsiiFault(`Duplicate override for property '${override.property}'`);
|
|
9987
|
-
}
|
|
9988
|
-
properties.add(override.property);
|
|
9989
|
-
this._applyPropertyOverride(obj, objref, fqn, interfaces, override);
|
|
9990
|
-
} else {
|
|
9991
10021
|
throw new JsiiFault(overrideTypeErrorMessage);
|
|
9992
10022
|
}
|
|
10023
|
+
if (properties.has(override.property)) {
|
|
10024
|
+
throw new JsiiFault(`Duplicate override for property '${override.property}'`);
|
|
10025
|
+
}
|
|
10026
|
+
properties.add(override.property);
|
|
10027
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_applyPropertyOverride).call(this, obj, objref, fqn, interfaces, override);
|
|
10028
|
+
} else {
|
|
10029
|
+
throw new JsiiFault(overrideTypeErrorMessage);
|
|
9993
10030
|
}
|
|
9994
10031
|
}
|
|
9995
|
-
return objref;
|
|
9996
10032
|
}
|
|
9997
|
-
|
|
9998
|
-
|
|
10033
|
+
return objref;
|
|
10034
|
+
}, _Kernel_getSuperPropertyName = function _Kernel_getSuperPropertyName(name) {
|
|
10035
|
+
return `$jsii$super$${name}$`;
|
|
10036
|
+
}, _Kernel_applyPropertyOverride = function _Kernel_applyPropertyOverride(obj, objref, typeFqn, interfaces, override) {
|
|
10037
|
+
if (__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_tryTypeInfoForMethod).call(this, override.property, typeFqn, interfaces)) {
|
|
10038
|
+
throw new JsiiFault(`Trying to override method '${override.property}' as a property`);
|
|
9999
10039
|
}
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10040
|
+
let propInfo = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_tryTypeInfoForProperty).call(this, override.property, typeFqn, interfaces);
|
|
10041
|
+
if (!propInfo && override.property in obj) {
|
|
10042
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, `Skipping override of private property ${override.property}`);
|
|
10043
|
+
return;
|
|
10044
|
+
}
|
|
10045
|
+
if (!propInfo) {
|
|
10046
|
+
propInfo = {
|
|
10047
|
+
name: override.property,
|
|
10048
|
+
type: spec.CANONICAL_ANY
|
|
10049
|
+
};
|
|
10050
|
+
}
|
|
10051
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_defineOverridenProperty).call(this, obj, objref, override, propInfo);
|
|
10052
|
+
}, _Kernel_defineOverridenProperty = function _Kernel_defineOverridenProperty(obj, objref, override, propInfo) {
|
|
10053
|
+
var _a;
|
|
10054
|
+
const propertyName = override.property;
|
|
10055
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "apply override", propertyName);
|
|
10056
|
+
const prev = (_a = getPropertyDescriptor(obj, propertyName)) !== null && _a !== void 0 ? _a : {
|
|
10057
|
+
value: obj[propertyName],
|
|
10058
|
+
writable: true,
|
|
10059
|
+
enumerable: true,
|
|
10060
|
+
configurable: true
|
|
10061
|
+
};
|
|
10062
|
+
const prevEnumerable = prev.enumerable;
|
|
10063
|
+
prev.enumerable = false;
|
|
10064
|
+
Object.defineProperty(obj, __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_getSuperPropertyName).call(this, propertyName), prev);
|
|
10065
|
+
Object.defineProperty(obj, propertyName, {
|
|
10066
|
+
enumerable: prevEnumerable,
|
|
10067
|
+
configurable: prev.configurable,
|
|
10068
|
+
get: () => {
|
|
10069
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "virtual get", objref, propertyName, {
|
|
10070
|
+
cookie: override.cookie
|
|
10071
|
+
});
|
|
10072
|
+
const result = this.callbackHandler({
|
|
10073
|
+
cookie: override.cookie,
|
|
10074
|
+
cbid: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_makecbid).call(this),
|
|
10075
|
+
get: {
|
|
10076
|
+
objref,
|
|
10077
|
+
property: propertyName
|
|
10078
|
+
}
|
|
10079
|
+
});
|
|
10080
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "callback returned", result);
|
|
10081
|
+
return __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandbox).call(this, result, propInfo, `returned by callback property ${propertyName}`);
|
|
10082
|
+
},
|
|
10083
|
+
set: value => {
|
|
10084
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "virtual set", objref, propertyName, {
|
|
10085
|
+
cookie: override.cookie
|
|
10086
|
+
});
|
|
10087
|
+
this.callbackHandler({
|
|
10088
|
+
cookie: override.cookie,
|
|
10089
|
+
cbid: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_makecbid).call(this),
|
|
10090
|
+
set: {
|
|
10091
|
+
objref,
|
|
10092
|
+
property: propertyName,
|
|
10093
|
+
value: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_fromSandbox).call(this, value, propInfo, `assigned to callback property ${propertyName}`)
|
|
10094
|
+
}
|
|
10095
|
+
});
|
|
10003
10096
|
}
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10097
|
+
});
|
|
10098
|
+
function getPropertyDescriptor(obj, propertyName) {
|
|
10099
|
+
const direct = Object.getOwnPropertyDescriptor(obj, propertyName);
|
|
10100
|
+
if (direct != null) {
|
|
10101
|
+
return direct;
|
|
10008
10102
|
}
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
type: spec.CANONICAL_ANY
|
|
10013
|
-
};
|
|
10103
|
+
const proto = Object.getPrototypeOf(obj);
|
|
10104
|
+
if (proto == null && proto !== Object.prototype) {
|
|
10105
|
+
return undefined;
|
|
10014
10106
|
}
|
|
10015
|
-
|
|
10107
|
+
return getPropertyDescriptor(proto, propertyName);
|
|
10016
10108
|
}
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10109
|
+
}, _Kernel_applyMethodOverride = function _Kernel_applyMethodOverride(obj, objref, typeFqn, interfaces, override) {
|
|
10110
|
+
if (__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_tryTypeInfoForProperty).call(this, override.method, typeFqn, interfaces)) {
|
|
10111
|
+
throw new JsiiFault(`Trying to override property '${override.method}' as a method`);
|
|
10112
|
+
}
|
|
10113
|
+
let methodInfo = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_tryTypeInfoForMethod).call(this, override.method, typeFqn, interfaces);
|
|
10114
|
+
if (!methodInfo && obj[override.method]) {
|
|
10115
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, `Skipping override of private method ${override.method}`);
|
|
10116
|
+
return;
|
|
10117
|
+
}
|
|
10118
|
+
if (!methodInfo) {
|
|
10119
|
+
methodInfo = {
|
|
10120
|
+
name: override.method,
|
|
10121
|
+
returns: {
|
|
10122
|
+
type: spec.CANONICAL_ANY
|
|
10123
|
+
},
|
|
10124
|
+
parameters: [ {
|
|
10125
|
+
name: "args",
|
|
10126
|
+
type: spec.CANONICAL_ANY,
|
|
10127
|
+
variadic: true
|
|
10128
|
+
} ],
|
|
10129
|
+
variadic: true
|
|
10026
10130
|
};
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10131
|
+
}
|
|
10132
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_defineOverridenMethod).call(this, obj, objref, override, methodInfo);
|
|
10133
|
+
}, _Kernel_defineOverridenMethod = function _Kernel_defineOverridenMethod(obj, objref, override, methodInfo) {
|
|
10134
|
+
const methodName = override.method;
|
|
10135
|
+
const fqn = (0, objects_1.jsiiTypeFqn)(obj, __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_isVisibleType).bind(this));
|
|
10136
|
+
const methodContext = `${methodInfo.async ? "async " : ""}method${fqn ? `${fqn}#` : methodName}`;
|
|
10137
|
+
if (methodInfo.async) {
|
|
10138
|
+
Object.defineProperty(obj, methodName, {
|
|
10139
|
+
enumerable: false,
|
|
10140
|
+
configurable: false,
|
|
10141
|
+
writable: false,
|
|
10142
|
+
value: (...methodArgs) => {
|
|
10143
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "invoke async method override", override);
|
|
10144
|
+
const args = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandboxValues).call(this, methodArgs, methodContext, methodInfo.parameters);
|
|
10145
|
+
return new Promise(((succeed, fail) => {
|
|
10146
|
+
var _a;
|
|
10147
|
+
const cbid = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_makecbid).call(this);
|
|
10148
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "adding callback to queue", cbid);
|
|
10149
|
+
__classPrivateFieldGet(this, _Kernel_cbs, "f").set(cbid, {
|
|
10041
10150
|
objref,
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10151
|
+
override,
|
|
10152
|
+
args,
|
|
10153
|
+
expectedReturnType: (_a = methodInfo.returns) !== null && _a !== void 0 ? _a : "void",
|
|
10154
|
+
succeed,
|
|
10155
|
+
fail
|
|
10156
|
+
});
|
|
10157
|
+
}));
|
|
10158
|
+
}
|
|
10159
|
+
});
|
|
10160
|
+
} else {
|
|
10161
|
+
Object.defineProperty(obj, methodName, {
|
|
10162
|
+
enumerable: false,
|
|
10163
|
+
configurable: false,
|
|
10164
|
+
writable: false,
|
|
10165
|
+
value: (...methodArgs) => {
|
|
10166
|
+
var _a;
|
|
10167
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "invoke sync method override", override, "args", methodArgs);
|
|
10168
|
+
const result = this.callbackHandler({
|
|
10053
10169
|
cookie: override.cookie,
|
|
10054
|
-
cbid: this.
|
|
10055
|
-
|
|
10170
|
+
cbid: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_makecbid).call(this),
|
|
10171
|
+
invoke: {
|
|
10056
10172
|
objref,
|
|
10057
|
-
|
|
10058
|
-
|
|
10173
|
+
method: methodName,
|
|
10174
|
+
args: __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_fromSandboxValues).call(this, methodArgs, methodContext, methodInfo.parameters)
|
|
10059
10175
|
}
|
|
10060
10176
|
});
|
|
10177
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_debug).call(this, "Result", result);
|
|
10178
|
+
return __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandbox).call(this, result, (_a = methodInfo.returns) !== null && _a !== void 0 ? _a : "void", `returned by callback method ${methodName}`);
|
|
10061
10179
|
}
|
|
10062
10180
|
});
|
|
10063
|
-
function getPropertyDescriptor(obj, propertyName) {
|
|
10064
|
-
const direct = Object.getOwnPropertyDescriptor(obj, propertyName);
|
|
10065
|
-
if (direct != null) {
|
|
10066
|
-
return direct;
|
|
10067
|
-
}
|
|
10068
|
-
const proto = Object.getPrototypeOf(obj);
|
|
10069
|
-
if (proto == null && proto !== Object.prototype) {
|
|
10070
|
-
return undefined;
|
|
10071
|
-
}
|
|
10072
|
-
return getPropertyDescriptor(proto, propertyName);
|
|
10073
|
-
}
|
|
10074
10181
|
}
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
return;
|
|
10083
|
-
}
|
|
10084
|
-
if (!methodInfo) {
|
|
10085
|
-
methodInfo = {
|
|
10086
|
-
name: override.method,
|
|
10087
|
-
returns: {
|
|
10088
|
-
type: spec.CANONICAL_ANY
|
|
10089
|
-
},
|
|
10090
|
-
parameters: [ {
|
|
10091
|
-
name: "args",
|
|
10092
|
-
type: spec.CANONICAL_ANY,
|
|
10093
|
-
variadic: true
|
|
10094
|
-
} ],
|
|
10095
|
-
variadic: true
|
|
10096
|
-
};
|
|
10097
|
-
}
|
|
10098
|
-
this._defineOverridenMethod(obj, objref, override, methodInfo);
|
|
10099
|
-
}
|
|
10100
|
-
_defineOverridenMethod(obj, objref, override, methodInfo) {
|
|
10101
|
-
const methodName = override.method;
|
|
10102
|
-
const fqn = (0, objects_1.jsiiTypeFqn)(obj);
|
|
10103
|
-
const methodContext = `${methodInfo.async ? "async " : ""}method${fqn ? `${fqn}#` : methodName}`;
|
|
10104
|
-
if (methodInfo.async) {
|
|
10105
|
-
Object.defineProperty(obj, methodName, {
|
|
10106
|
-
enumerable: false,
|
|
10107
|
-
configurable: false,
|
|
10108
|
-
writable: false,
|
|
10109
|
-
value: (...methodArgs) => {
|
|
10110
|
-
this._debug("invoke async method override", override);
|
|
10111
|
-
const args = this._toSandboxValues(methodArgs, methodContext, methodInfo.parameters);
|
|
10112
|
-
return new Promise(((succeed, fail) => {
|
|
10113
|
-
var _a;
|
|
10114
|
-
const cbid = this._makecbid();
|
|
10115
|
-
this._debug("adding callback to queue", cbid);
|
|
10116
|
-
this.cbs.set(cbid, {
|
|
10117
|
-
objref,
|
|
10118
|
-
override,
|
|
10119
|
-
args,
|
|
10120
|
-
expectedReturnType: (_a = methodInfo.returns) !== null && _a !== void 0 ? _a : "void",
|
|
10121
|
-
succeed,
|
|
10122
|
-
fail
|
|
10123
|
-
});
|
|
10124
|
-
}));
|
|
10125
|
-
}
|
|
10126
|
-
});
|
|
10127
|
-
} else {
|
|
10128
|
-
Object.defineProperty(obj, methodName, {
|
|
10129
|
-
enumerable: false,
|
|
10130
|
-
configurable: false,
|
|
10131
|
-
writable: false,
|
|
10132
|
-
value: (...methodArgs) => {
|
|
10133
|
-
var _a;
|
|
10134
|
-
this._debug("invoke sync method override", override, "args", methodArgs);
|
|
10135
|
-
const result = this.callbackHandler({
|
|
10136
|
-
cookie: override.cookie,
|
|
10137
|
-
cbid: this._makecbid(),
|
|
10138
|
-
invoke: {
|
|
10139
|
-
objref,
|
|
10140
|
-
method: methodName,
|
|
10141
|
-
args: this._fromSandboxValues(methodArgs, methodContext, methodInfo.parameters)
|
|
10142
|
-
}
|
|
10143
|
-
});
|
|
10144
|
-
this._debug("Result", result);
|
|
10145
|
-
return this._toSandbox(result, (_a = methodInfo.returns) !== null && _a !== void 0 ? _a : "void", `returned by callback method ${methodName}`);
|
|
10146
|
-
}
|
|
10147
|
-
});
|
|
10148
|
-
}
|
|
10149
|
-
}
|
|
10150
|
-
_findInvokeTarget(objref, methodName, args) {
|
|
10151
|
-
const {instance, fqn, interfaces} = this.objects.findObject(objref);
|
|
10152
|
-
const ti = this._typeInfoForMethod(methodName, fqn, interfaces);
|
|
10153
|
-
this._validateMethodArguments(ti, args);
|
|
10154
|
-
let fn = instance.constructor.prototype[methodName];
|
|
10182
|
+
}, _Kernel_findInvokeTarget = function _Kernel_findInvokeTarget(objref, methodName, args) {
|
|
10183
|
+
const {instance, fqn, interfaces} = __classPrivateFieldGet(this, _Kernel_objects, "f").findObject(objref);
|
|
10184
|
+
const ti = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForMethod).call(this, methodName, fqn, interfaces);
|
|
10185
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_validateMethodArguments).call(this, ti, args);
|
|
10186
|
+
let fn = instance.constructor.prototype[methodName];
|
|
10187
|
+
if (!fn) {
|
|
10188
|
+
fn = instance[methodName];
|
|
10155
10189
|
if (!fn) {
|
|
10156
|
-
|
|
10157
|
-
if (!fn) {
|
|
10158
|
-
throw new JsiiFault(`Cannot find ${methodName} on object`);
|
|
10159
|
-
}
|
|
10190
|
+
throw new JsiiFault(`Cannot find ${methodName} on object`);
|
|
10160
10191
|
}
|
|
10161
|
-
return {
|
|
10162
|
-
ti,
|
|
10163
|
-
obj: instance,
|
|
10164
|
-
fn
|
|
10165
|
-
};
|
|
10166
10192
|
}
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10193
|
+
return {
|
|
10194
|
+
ti,
|
|
10195
|
+
obj: instance,
|
|
10196
|
+
fn
|
|
10197
|
+
};
|
|
10198
|
+
}, _Kernel_validateMethodArguments = function _Kernel_validateMethodArguments(method, args) {
|
|
10199
|
+
var _a;
|
|
10200
|
+
const params = (_a = method === null || method === void 0 ? void 0 : method.parameters) !== null && _a !== void 0 ? _a : [];
|
|
10201
|
+
if (args.length > params.length && !(method && method.variadic)) {
|
|
10202
|
+
throw new JsiiFault(`Too many arguments (method accepts ${params.length} parameters, got ${args.length} arguments)`);
|
|
10203
|
+
}
|
|
10204
|
+
for (let i = 0; i < params.length; ++i) {
|
|
10205
|
+
const param = params[i];
|
|
10206
|
+
const arg = args[i];
|
|
10207
|
+
if (param.variadic) {
|
|
10208
|
+
if (params.length <= i) {
|
|
10209
|
+
return;
|
|
10210
|
+
}
|
|
10211
|
+
for (let j = i; j < params.length; j++) {
|
|
10212
|
+
if (!param.optional && params[j] === undefined) {
|
|
10213
|
+
throw new JsiiFault(`Unexpected 'undefined' value at index ${j - i} of variadic argument '${param.name}' of type '${spec.describeTypeReference(param.type)}'`);
|
|
10184
10214
|
}
|
|
10185
|
-
} else if (!param.optional && arg === undefined) {
|
|
10186
|
-
throw new JsiiFault(`Not enough arguments. Missing argument for the required parameter '${param.name}' of type '${spec.describeTypeReference(param.type)}'`);
|
|
10187
10215
|
}
|
|
10216
|
+
} else if (!param.optional && arg === undefined) {
|
|
10217
|
+
throw new JsiiFault(`Not enough arguments. Missing argument for the required parameter '${param.name}' of type '${spec.describeTypeReference(param.type)}'`);
|
|
10188
10218
|
}
|
|
10189
10219
|
}
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
}
|
|
10195
|
-
return assembly;
|
|
10220
|
+
}, _Kernel_assemblyFor = function _Kernel_assemblyFor(assemblyName) {
|
|
10221
|
+
const assembly = __classPrivateFieldGet(this, _Kernel_assemblies, "f").get(assemblyName);
|
|
10222
|
+
if (!assembly) {
|
|
10223
|
+
throw new JsiiFault(`Could not find assembly: ${assemblyName}`);
|
|
10196
10224
|
}
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
curr = curr[name];
|
|
10207
|
-
}
|
|
10208
|
-
if (!curr) {
|
|
10209
|
-
throw new JsiiFault(`Could not find symbol ${fqn}`);
|
|
10225
|
+
return assembly;
|
|
10226
|
+
}, _Kernel_findSymbol = function _Kernel_findSymbol(fqn) {
|
|
10227
|
+
const [assemblyName, ...parts] = fqn.split(".");
|
|
10228
|
+
const assembly = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_assemblyFor).call(this, assemblyName);
|
|
10229
|
+
let curr = assembly.closure;
|
|
10230
|
+
while (parts.length > 0) {
|
|
10231
|
+
const name = parts.shift();
|
|
10232
|
+
if (!name) {
|
|
10233
|
+
break;
|
|
10210
10234
|
}
|
|
10211
|
-
|
|
10235
|
+
curr = curr[name];
|
|
10212
10236
|
}
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
const components = fqn.split(".");
|
|
10216
|
-
const moduleName = components[0];
|
|
10217
|
-
const assembly = this.assemblies.get(moduleName);
|
|
10218
|
-
if (!assembly) {
|
|
10219
|
-
throw new JsiiFault(`Module '${moduleName}' not found`);
|
|
10220
|
-
}
|
|
10221
|
-
const types = (_a = assembly.metadata.types) !== null && _a !== void 0 ? _a : {};
|
|
10222
|
-
const fqnInfo = types[fqn];
|
|
10223
|
-
if (!fqnInfo) {
|
|
10224
|
-
throw new JsiiFault(`Type '${fqn}' not found`);
|
|
10225
|
-
}
|
|
10226
|
-
return fqnInfo;
|
|
10237
|
+
if (!curr) {
|
|
10238
|
+
throw new JsiiFault(`Could not find symbol ${fqn}`);
|
|
10227
10239
|
}
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10240
|
+
return curr;
|
|
10241
|
+
}, _Kernel_typeInfoForFqn = function _Kernel_typeInfoForFqn(fqn) {
|
|
10242
|
+
var _a;
|
|
10243
|
+
const components = fqn.split(".");
|
|
10244
|
+
const moduleName = components[0];
|
|
10245
|
+
const assembly = __classPrivateFieldGet(this, _Kernel_assemblies, "f").get(moduleName);
|
|
10246
|
+
if (!assembly) {
|
|
10247
|
+
throw new JsiiFault(`Module '${moduleName}' not found`);
|
|
10248
|
+
}
|
|
10249
|
+
const types = (_a = assembly.metadata.types) !== null && _a !== void 0 ? _a : {};
|
|
10250
|
+
const fqnInfo = types[fqn];
|
|
10251
|
+
if (!fqnInfo) {
|
|
10252
|
+
throw new JsiiFault(`Type '${fqn}' not found`);
|
|
10253
|
+
}
|
|
10254
|
+
return fqnInfo;
|
|
10255
|
+
}, _Kernel_isVisibleType = function _Kernel_isVisibleType(fqn) {
|
|
10256
|
+
try {
|
|
10257
|
+
__classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForFqn).call(this, fqn);
|
|
10258
|
+
return true;
|
|
10259
|
+
} catch (e) {
|
|
10260
|
+
if (e instanceof JsiiFault) {
|
|
10261
|
+
return false;
|
|
10233
10262
|
}
|
|
10234
|
-
|
|
10263
|
+
throw e;
|
|
10235
10264
|
}
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
const found = this._tryTypeInfoForMethod(methodName, base);
|
|
10255
|
-
if (found) {
|
|
10256
|
-
return found;
|
|
10257
|
-
}
|
|
10265
|
+
}, _Kernel_typeInfoForMethod = function _Kernel_typeInfoForMethod(methodName, fqn, interfaces) {
|
|
10266
|
+
const ti = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_tryTypeInfoForMethod).call(this, methodName, fqn, interfaces);
|
|
10267
|
+
if (!ti) {
|
|
10268
|
+
const addendum = interfaces && interfaces.length > 0 ? ` or interface(s) ${interfaces.join(", ")}` : "";
|
|
10269
|
+
throw new JsiiFault(`Class ${fqn}${addendum} doesn't have a method '${methodName}'`);
|
|
10270
|
+
}
|
|
10271
|
+
return ti;
|
|
10272
|
+
}, _Kernel_tryTypeInfoForMethod = function _Kernel_tryTypeInfoForMethod(methodName, classFqn, interfaces = []) {
|
|
10273
|
+
var _a, _b;
|
|
10274
|
+
for (const fqn of [ classFqn, ...interfaces ]) {
|
|
10275
|
+
if (fqn === wire.EMPTY_OBJECT_FQN) {
|
|
10276
|
+
continue;
|
|
10277
|
+
}
|
|
10278
|
+
const typeinfo = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForFqn).call(this, fqn);
|
|
10279
|
+
const methods = (_a = typeinfo.methods) !== null && _a !== void 0 ? _a : [];
|
|
10280
|
+
for (const m of methods) {
|
|
10281
|
+
if (m.name === methodName) {
|
|
10282
|
+
return m;
|
|
10258
10283
|
}
|
|
10259
10284
|
}
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
var _a;
|
|
10264
|
-
for (const fqn of [ classFqn, ...interfaces ]) {
|
|
10265
|
-
if (fqn === wire.EMPTY_OBJECT_FQN) {
|
|
10285
|
+
const bases = [ typeinfo.base, ...(_b = typeinfo.interfaces) !== null && _b !== void 0 ? _b : [] ];
|
|
10286
|
+
for (const base of bases) {
|
|
10287
|
+
if (!base) {
|
|
10266
10288
|
continue;
|
|
10267
10289
|
}
|
|
10268
|
-
const
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
if (spec.isClassType(typeInfo)) {
|
|
10272
|
-
const classTypeInfo = typeInfo;
|
|
10273
|
-
properties = classTypeInfo.properties;
|
|
10274
|
-
bases = classTypeInfo.base ? [ classTypeInfo.base ] : [];
|
|
10275
|
-
} else if (spec.isInterfaceType(typeInfo)) {
|
|
10276
|
-
const interfaceTypeInfo = typeInfo;
|
|
10277
|
-
properties = interfaceTypeInfo.properties;
|
|
10278
|
-
bases = (_a = interfaceTypeInfo.interfaces) !== null && _a !== void 0 ? _a : [];
|
|
10279
|
-
} else {
|
|
10280
|
-
throw new JsiiFault(`Type of kind ${typeInfo.kind} does not have properties`);
|
|
10281
|
-
}
|
|
10282
|
-
for (const p of properties !== null && properties !== void 0 ? properties : []) {
|
|
10283
|
-
if (p.name === property) {
|
|
10284
|
-
return p;
|
|
10285
|
-
}
|
|
10286
|
-
}
|
|
10287
|
-
for (const baseFqn of bases) {
|
|
10288
|
-
const ret = this._tryTypeInfoForProperty(property, baseFqn);
|
|
10289
|
-
if (ret) {
|
|
10290
|
-
return ret;
|
|
10291
|
-
}
|
|
10290
|
+
const found = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_tryTypeInfoForMethod).call(this, methodName, base);
|
|
10291
|
+
if (found) {
|
|
10292
|
+
return found;
|
|
10292
10293
|
}
|
|
10293
10294
|
}
|
|
10294
|
-
return undefined;
|
|
10295
10295
|
}
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10296
|
+
return undefined;
|
|
10297
|
+
}, _Kernel_tryTypeInfoForProperty = function _Kernel_tryTypeInfoForProperty(property, classFqn, interfaces = []) {
|
|
10298
|
+
var _a;
|
|
10299
|
+
for (const fqn of [ classFqn, ...interfaces ]) {
|
|
10300
|
+
if (fqn === wire.EMPTY_OBJECT_FQN) {
|
|
10301
|
+
continue;
|
|
10301
10302
|
}
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
debug: this._debug.bind(this),
|
|
10316
|
-
findSymbol: this._findSymbol.bind(this),
|
|
10317
|
-
lookupType: this._typeInfoForFqn.bind(this)
|
|
10318
|
-
}, "serialize", v, targetType, context);
|
|
10319
|
-
}
|
|
10320
|
-
_toSandboxValues(xs, methodContext, parameters) {
|
|
10321
|
-
return this._boxUnboxParameters(xs, methodContext, parameters, this._toSandbox.bind(this));
|
|
10322
|
-
}
|
|
10323
|
-
_fromSandboxValues(xs, methodContext, parameters) {
|
|
10324
|
-
return this._boxUnboxParameters(xs, methodContext, parameters, this._fromSandbox.bind(this));
|
|
10325
|
-
}
|
|
10326
|
-
_boxUnboxParameters(xs, methodContext, parameters = [], boxUnbox) {
|
|
10327
|
-
const parametersCopy = [ ...parameters ];
|
|
10328
|
-
const variadic = parametersCopy.length > 0 && !!parametersCopy[parametersCopy.length - 1].variadic;
|
|
10329
|
-
while (variadic && parametersCopy.length < xs.length) {
|
|
10330
|
-
parametersCopy.push(parametersCopy[parametersCopy.length - 1]);
|
|
10303
|
+
const typeInfo = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_typeInfoForFqn).call(this, fqn);
|
|
10304
|
+
let properties;
|
|
10305
|
+
let bases;
|
|
10306
|
+
if (spec.isClassType(typeInfo)) {
|
|
10307
|
+
const classTypeInfo = typeInfo;
|
|
10308
|
+
properties = classTypeInfo.properties;
|
|
10309
|
+
bases = classTypeInfo.base ? [ classTypeInfo.base ] : [];
|
|
10310
|
+
} else if (spec.isInterfaceType(typeInfo)) {
|
|
10311
|
+
const interfaceTypeInfo = typeInfo;
|
|
10312
|
+
properties = interfaceTypeInfo.properties;
|
|
10313
|
+
bases = (_a = interfaceTypeInfo.interfaces) !== null && _a !== void 0 ? _a : [];
|
|
10314
|
+
} else {
|
|
10315
|
+
throw new JsiiFault(`Type of kind ${typeInfo.kind} does not have properties`);
|
|
10331
10316
|
}
|
|
10332
|
-
|
|
10333
|
-
|
|
10317
|
+
for (const p of properties !== null && properties !== void 0 ? properties : []) {
|
|
10318
|
+
if (p.name === property) {
|
|
10319
|
+
return p;
|
|
10320
|
+
}
|
|
10334
10321
|
}
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10322
|
+
for (const baseFqn of bases) {
|
|
10323
|
+
const ret = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_tryTypeInfoForProperty).call(this, property, baseFqn);
|
|
10324
|
+
if (ret) {
|
|
10325
|
+
return ret;
|
|
10326
|
+
}
|
|
10340
10327
|
}
|
|
10341
10328
|
}
|
|
10342
|
-
|
|
10343
|
-
|
|
10329
|
+
return undefined;
|
|
10330
|
+
}, _Kernel_typeInfoForProperty = function _Kernel_typeInfoForProperty(property, fqn, interfaces) {
|
|
10331
|
+
const typeInfo = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_tryTypeInfoForProperty).call(this, property, fqn, interfaces);
|
|
10332
|
+
if (!typeInfo) {
|
|
10333
|
+
const addendum = interfaces && interfaces.length > 0 ? ` or interface(s) ${interfaces.join(", ")}` : "";
|
|
10334
|
+
throw new JsiiFault(`Type ${fqn}${addendum} doesn't have a property '${property}'`);
|
|
10335
|
+
}
|
|
10336
|
+
return typeInfo;
|
|
10337
|
+
}, _Kernel_toSandbox = function _Kernel_toSandbox(v, expectedType, context) {
|
|
10338
|
+
return wire.process(__classPrivateFieldGet(this, _Kernel_serializerHost, "f"), "deserialize", v, expectedType, context);
|
|
10339
|
+
}, _Kernel_fromSandbox = function _Kernel_fromSandbox(v, targetType, context) {
|
|
10340
|
+
return wire.process(__classPrivateFieldGet(this, _Kernel_serializerHost, "f"), "serialize", v, targetType, context);
|
|
10341
|
+
}, _Kernel_toSandboxValues = function _Kernel_toSandboxValues(xs, methodContext, parameters) {
|
|
10342
|
+
return __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_boxUnboxParameters).call(this, xs, methodContext, parameters, __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_toSandbox).bind(this));
|
|
10343
|
+
}, _Kernel_fromSandboxValues = function _Kernel_fromSandboxValues(xs, methodContext, parameters) {
|
|
10344
|
+
return __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_boxUnboxParameters).call(this, xs, methodContext, parameters, __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_fromSandbox).bind(this));
|
|
10345
|
+
}, _Kernel_boxUnboxParameters = function _Kernel_boxUnboxParameters(xs, methodContext, parameters = [], boxUnbox) {
|
|
10346
|
+
const parametersCopy = [ ...parameters ];
|
|
10347
|
+
const variadic = parametersCopy.length > 0 && !!parametersCopy[parametersCopy.length - 1].variadic;
|
|
10348
|
+
while (variadic && parametersCopy.length < xs.length) {
|
|
10349
|
+
parametersCopy.push(parametersCopy[parametersCopy.length - 1]);
|
|
10350
|
+
}
|
|
10351
|
+
if (xs.length > parametersCopy.length) {
|
|
10352
|
+
throw new JsiiFault(`Argument list (${JSON.stringify(xs)}) not same size as expected argument list (length ${parametersCopy.length})`);
|
|
10353
|
+
}
|
|
10354
|
+
return xs.map(((x, i) => boxUnbox(x, parametersCopy[i], `passed to parameter ${parametersCopy[i].name} of ${methodContext}`)));
|
|
10355
|
+
}, _Kernel_debug = function _Kernel_debug(...args) {
|
|
10356
|
+
if (this.traceEnabled) {
|
|
10357
|
+
console.error("[@jsii/kernel]", ...args);
|
|
10358
|
+
}
|
|
10359
|
+
}, _Kernel_debugTime = function _Kernel_debugTime(cb, label) {
|
|
10360
|
+
const fullLabel = `[@jsii/kernel:timing] ${label}`;
|
|
10361
|
+
if (this.debugTimingEnabled) {
|
|
10362
|
+
console.time(fullLabel);
|
|
10363
|
+
}
|
|
10364
|
+
try {
|
|
10365
|
+
return cb();
|
|
10366
|
+
} finally {
|
|
10344
10367
|
if (this.debugTimingEnabled) {
|
|
10345
|
-
console.
|
|
10346
|
-
}
|
|
10347
|
-
try {
|
|
10348
|
-
return cb();
|
|
10349
|
-
} finally {
|
|
10350
|
-
if (this.debugTimingEnabled) {
|
|
10351
|
-
console.timeEnd(fullLabel);
|
|
10352
|
-
}
|
|
10368
|
+
console.timeEnd(fullLabel);
|
|
10353
10369
|
}
|
|
10354
10370
|
}
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
throw e;
|
|
10363
|
-
}
|
|
10364
|
-
throw new JsiiFault(e);
|
|
10365
|
-
}
|
|
10366
|
-
if (e instanceof RuntimeError) {
|
|
10371
|
+
}, _Kernel_ensureSync = function _Kernel_ensureSync(desc, fn) {
|
|
10372
|
+
__classPrivateFieldSet(this, _Kernel_syncInProgress, desc, "f");
|
|
10373
|
+
try {
|
|
10374
|
+
return fn();
|
|
10375
|
+
} catch (e) {
|
|
10376
|
+
if (e.name === "@jsii/kernel.Fault") {
|
|
10377
|
+
if (e instanceof JsiiFault) {
|
|
10367
10378
|
throw e;
|
|
10368
10379
|
}
|
|
10369
|
-
throw new
|
|
10370
|
-
} finally {
|
|
10371
|
-
delete this.syncInProgress;
|
|
10380
|
+
throw new JsiiFault(e);
|
|
10372
10381
|
}
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
const superProp = this._getSuperPropertyName(property);
|
|
10376
|
-
if (superProp in obj) {
|
|
10377
|
-
return superProp;
|
|
10382
|
+
if (e instanceof RuntimeError) {
|
|
10383
|
+
throw e;
|
|
10378
10384
|
}
|
|
10379
|
-
|
|
10380
|
-
}
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
}
|
|
10398
|
-
};
|
|
10385
|
+
throw new RuntimeError(e);
|
|
10386
|
+
} finally {
|
|
10387
|
+
__classPrivateFieldSet(this, _Kernel_syncInProgress, undefined, "f");
|
|
10388
|
+
}
|
|
10389
|
+
}, _Kernel_findPropertyTarget = function _Kernel_findPropertyTarget(obj, property) {
|
|
10390
|
+
const superProp = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_getSuperPropertyName).call(this, property);
|
|
10391
|
+
if (superProp in obj) {
|
|
10392
|
+
return superProp;
|
|
10393
|
+
}
|
|
10394
|
+
return property;
|
|
10395
|
+
}, _Kernel_getBinScriptCommand = function _Kernel_getBinScriptCommand(req) {
|
|
10396
|
+
var _a, _b;
|
|
10397
|
+
const packageDir = __classPrivateFieldGet(this, _Kernel_instances, "m", _Kernel_getPackageDir).call(this, req.assembly);
|
|
10398
|
+
if (fs.pathExistsSync(packageDir)) {
|
|
10399
|
+
const epkg = fs.readJsonSync(path.join(packageDir, "package.json"));
|
|
10400
|
+
const scriptPath = (_a = epkg.bin) === null || _a === void 0 ? void 0 : _a[req.script];
|
|
10401
|
+
if (!epkg.bin) {
|
|
10402
|
+
throw new JsiiFault(`Script with name ${req.script} was not defined.`);
|
|
10399
10403
|
}
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10404
|
+
return {
|
|
10405
|
+
command: path.join(packageDir, scriptPath),
|
|
10406
|
+
args: (_b = req.args) !== null && _b !== void 0 ? _b : [],
|
|
10407
|
+
env: {
|
|
10408
|
+
...process.env,
|
|
10409
|
+
NODE_OPTIONS: process.execArgv.join(" "),
|
|
10410
|
+
PATH: `${path.dirname(process.execPath)}:${process.env.PATH}`
|
|
10411
|
+
}
|
|
10412
|
+
};
|
|
10407
10413
|
}
|
|
10408
|
-
|
|
10409
|
-
|
|
10414
|
+
throw new JsiiFault(`Package with name ${req.assembly} was not loaded.`);
|
|
10415
|
+
}, _Kernel_makecbid = function _Kernel_makecbid() {
|
|
10416
|
+
var _a, _b;
|
|
10417
|
+
return `jsii::callback::${__classPrivateFieldSet(this, _Kernel_nextid, (_b = __classPrivateFieldGet(this, _Kernel_nextid, "f"),
|
|
10418
|
+
_a = _b++, _b), "f"), _a}`;
|
|
10419
|
+
}, _Kernel_makeprid = function _Kernel_makeprid() {
|
|
10420
|
+
var _a, _b;
|
|
10421
|
+
return `jsii::promise::${__classPrivateFieldSet(this, _Kernel_nextid, (_b = __classPrivateFieldGet(this, _Kernel_nextid, "f"),
|
|
10422
|
+
_a = _b++, _b), "f"), _a}`;
|
|
10423
|
+
};
|
|
10410
10424
|
class Assembly {
|
|
10411
10425
|
constructor(metadata, closure) {
|
|
10412
10426
|
this.metadata = metadata;
|
|
@@ -10422,7 +10436,15 @@ var __webpack_modules__ = {
|
|
|
10422
10436
|
exports.link = void 0;
|
|
10423
10437
|
const fs_1 = __webpack_require__(7147);
|
|
10424
10438
|
const path_1 = __webpack_require__(4822);
|
|
10439
|
+
const PRESERVE_SYMLINKS = process.execArgv.includes("--preserve-symlinks");
|
|
10425
10440
|
function link(existing, destination) {
|
|
10441
|
+
if (PRESERVE_SYMLINKS) {
|
|
10442
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(destination), {
|
|
10443
|
+
recursive: true
|
|
10444
|
+
});
|
|
10445
|
+
(0, fs_1.symlinkSync)(existing, destination);
|
|
10446
|
+
return;
|
|
10447
|
+
}
|
|
10426
10448
|
const stat = (0, fs_1.statSync)(existing);
|
|
10427
10449
|
if (!stat.isDirectory()) {
|
|
10428
10450
|
try {
|
|
@@ -10441,8 +10463,21 @@ var __webpack_modules__ = {
|
|
|
10441
10463
|
}
|
|
10442
10464
|
exports.link = link;
|
|
10443
10465
|
},
|
|
10444
|
-
2309: (__unused_webpack_module, exports, __webpack_require__)
|
|
10466
|
+
2309: function(__unused_webpack_module, exports, __webpack_require__) {
|
|
10445
10467
|
"use strict";
|
|
10468
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
10469
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10470
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10471
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10472
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
|
|
10473
|
+
value;
|
|
10474
|
+
};
|
|
10475
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
10476
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10477
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10478
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10479
|
+
};
|
|
10480
|
+
var _ObjectTable_instances, _ObjectTable_resolveType, _ObjectTable_objects, _ObjectTable_nextid, _ObjectTable_makeId, _ObjectTable_removeRedundant, _InterfaceCollection_resolveType, _InterfaceCollection_interfaces;
|
|
10446
10481
|
Object.defineProperty(exports, "__esModule", {
|
|
10447
10482
|
value: true
|
|
10448
10483
|
});
|
|
@@ -10455,8 +10490,24 @@ var __webpack_modules__ = {
|
|
|
10455
10490
|
const OBJID_SYMBOL = Symbol.for("$__jsii__objid__$");
|
|
10456
10491
|
const IFACES_SYMBOL = Symbol.for("$__jsii__interfaces__$");
|
|
10457
10492
|
const JSII_TYPE_FQN_SYMBOL = Symbol("$__jsii__fqn__$");
|
|
10458
|
-
|
|
10459
|
-
|
|
10493
|
+
const JSII_RTTI_SYMBOL = Symbol.for("jsii.rtti");
|
|
10494
|
+
function jsiiTypeFqn(obj, isVisibleType) {
|
|
10495
|
+
var _a;
|
|
10496
|
+
const ctor = obj.constructor;
|
|
10497
|
+
if (ctor[JSII_TYPE_FQN_SYMBOL] != null) {
|
|
10498
|
+
return ctor[JSII_TYPE_FQN_SYMBOL];
|
|
10499
|
+
}
|
|
10500
|
+
let curr = ctor;
|
|
10501
|
+
while ((_a = curr[JSII_RTTI_SYMBOL]) === null || _a === void 0 ? void 0 : _a.fqn) {
|
|
10502
|
+
if (isVisibleType(curr[JSII_RTTI_SYMBOL].fqn)) {
|
|
10503
|
+
const fqn = curr[JSII_RTTI_SYMBOL].fqn;
|
|
10504
|
+
tagJsiiConstructor(curr, fqn);
|
|
10505
|
+
tagJsiiConstructor(ctor, fqn);
|
|
10506
|
+
return fqn;
|
|
10507
|
+
}
|
|
10508
|
+
curr = Object.getPrototypeOf(curr);
|
|
10509
|
+
}
|
|
10510
|
+
return undefined;
|
|
10460
10511
|
}
|
|
10461
10512
|
exports.jsiiTypeFqn = jsiiTypeFqn;
|
|
10462
10513
|
function objectReference(obj) {
|
|
@@ -10489,7 +10540,7 @@ var __webpack_modules__ = {
|
|
|
10489
10540
|
}
|
|
10490
10541
|
function tagJsiiConstructor(constructor, fqn) {
|
|
10491
10542
|
if (Object.prototype.hasOwnProperty.call(constructor, JSII_TYPE_FQN_SYMBOL)) {
|
|
10492
|
-
return assert(constructor[JSII_TYPE_FQN_SYMBOL]
|
|
10543
|
+
return assert.strictEqual(constructor[JSII_TYPE_FQN_SYMBOL], fqn, `Unable to register ${constructor.name} as ${fqn}: it is already registerd with FQN ${constructor[JSII_TYPE_FQN_SYMBOL]}`);
|
|
10493
10544
|
}
|
|
10494
10545
|
Object.defineProperty(constructor, JSII_TYPE_FQN_SYMBOL, {
|
|
10495
10546
|
configurable: false,
|
|
@@ -10501,9 +10552,11 @@ var __webpack_modules__ = {
|
|
|
10501
10552
|
exports.tagJsiiConstructor = tagJsiiConstructor;
|
|
10502
10553
|
class ObjectTable {
|
|
10503
10554
|
constructor(resolveType) {
|
|
10504
|
-
this
|
|
10505
|
-
this
|
|
10506
|
-
this
|
|
10555
|
+
_ObjectTable_instances.add(this);
|
|
10556
|
+
_ObjectTable_resolveType.set(this, void 0);
|
|
10557
|
+
_ObjectTable_objects.set(this, new Map);
|
|
10558
|
+
_ObjectTable_nextid.set(this, 1e4);
|
|
10559
|
+
__classPrivateFieldSet(this, _ObjectTable_resolveType, resolveType, "f");
|
|
10507
10560
|
}
|
|
10508
10561
|
registerObject(obj, fqn, interfaces) {
|
|
10509
10562
|
var _a;
|
|
@@ -10520,13 +10573,13 @@ var __webpack_modules__ = {
|
|
|
10520
10573
|
if (!Object.prototype.hasOwnProperty.call(obj, IFACES_SYMBOL)) {
|
|
10521
10574
|
console.error(`[jsii/kernel] WARNING: referenced object ${existingRef[api.TOKEN_REF]} does not have the ${String(IFACES_SYMBOL)} property!`);
|
|
10522
10575
|
}
|
|
10523
|
-
this.
|
|
10576
|
+
__classPrivateFieldGet(this, _ObjectTable_objects, "f").get(existingRef[api.TOKEN_REF]).interfaces = obj[IFACES_SYMBOL] = existingRef[api.TOKEN_INTERFACES] = interfaces = __classPrivateFieldGet(this, _ObjectTable_instances, "m", _ObjectTable_removeRedundant).call(this, Array.from(allIfaces), fqn);
|
|
10524
10577
|
}
|
|
10525
10578
|
return existingRef;
|
|
10526
10579
|
}
|
|
10527
|
-
interfaces = this.
|
|
10528
|
-
const objid = this.
|
|
10529
|
-
this.
|
|
10580
|
+
interfaces = __classPrivateFieldGet(this, _ObjectTable_instances, "m", _ObjectTable_removeRedundant).call(this, interfaces, fqn);
|
|
10581
|
+
const objid = __classPrivateFieldGet(this, _ObjectTable_instances, "m", _ObjectTable_makeId).call(this, fqn);
|
|
10582
|
+
__classPrivateFieldGet(this, _ObjectTable_objects, "f").set(objid, {
|
|
10530
10583
|
instance: obj,
|
|
10531
10584
|
fqn,
|
|
10532
10585
|
interfaces
|
|
@@ -10543,7 +10596,7 @@ var __webpack_modules__ = {
|
|
|
10543
10596
|
throw new kernel_1.JsiiFault(`Malformed object reference: ${JSON.stringify(objref)}`);
|
|
10544
10597
|
}
|
|
10545
10598
|
const objid = objref[api.TOKEN_REF];
|
|
10546
|
-
const obj = this.
|
|
10599
|
+
const obj = __classPrivateFieldGet(this, _ObjectTable_objects, "f").get(objid);
|
|
10547
10600
|
if (!obj) {
|
|
10548
10601
|
throw new kernel_1.JsiiFault(`Object ${objid} not found`);
|
|
10549
10602
|
}
|
|
@@ -10557,40 +10610,43 @@ var __webpack_modules__ = {
|
|
|
10557
10610
|
return obj;
|
|
10558
10611
|
}
|
|
10559
10612
|
deleteObject({[api.TOKEN_REF]: objid}) {
|
|
10560
|
-
if (!this.
|
|
10613
|
+
if (!__classPrivateFieldGet(this, _ObjectTable_objects, "f").delete(objid)) {
|
|
10561
10614
|
throw new kernel_1.JsiiFault(`Object ${objid} not found`);
|
|
10562
10615
|
}
|
|
10563
10616
|
}
|
|
10564
10617
|
get count() {
|
|
10565
|
-
return this.
|
|
10566
|
-
}
|
|
10567
|
-
makeId(fqn) {
|
|
10568
|
-
return `${fqn}@${this.nextid++}`;
|
|
10569
|
-
}
|
|
10570
|
-
removeRedundant(interfaces, fqn) {
|
|
10571
|
-
if (!interfaces || interfaces.length === 0) {
|
|
10572
|
-
return undefined;
|
|
10573
|
-
}
|
|
10574
|
-
const result = new Set(interfaces);
|
|
10575
|
-
const builtIn = new InterfaceCollection(this.resolveType);
|
|
10576
|
-
if (fqn !== serialization_1.EMPTY_OBJECT_FQN) {
|
|
10577
|
-
builtIn.addFromClass(fqn);
|
|
10578
|
-
}
|
|
10579
|
-
interfaces.forEach(builtIn.addFromInterface.bind(builtIn));
|
|
10580
|
-
for (const iface of builtIn) {
|
|
10581
|
-
result.delete(iface);
|
|
10582
|
-
}
|
|
10583
|
-
return result.size > 0 ? Array.from(result).sort() : undefined;
|
|
10618
|
+
return __classPrivateFieldGet(this, _ObjectTable_objects, "f").size;
|
|
10584
10619
|
}
|
|
10585
10620
|
}
|
|
10586
10621
|
exports.ObjectTable = ObjectTable;
|
|
10622
|
+
_ObjectTable_resolveType = new WeakMap, _ObjectTable_objects = new WeakMap, _ObjectTable_nextid = new WeakMap,
|
|
10623
|
+
_ObjectTable_instances = new WeakSet, _ObjectTable_makeId = function _ObjectTable_makeId(fqn) {
|
|
10624
|
+
var _a, _b;
|
|
10625
|
+
return `${fqn}@${__classPrivateFieldSet(this, _ObjectTable_nextid, (_b = __classPrivateFieldGet(this, _ObjectTable_nextid, "f"),
|
|
10626
|
+
_a = _b++, _b), "f"), _a}`;
|
|
10627
|
+
}, _ObjectTable_removeRedundant = function _ObjectTable_removeRedundant(interfaces, fqn) {
|
|
10628
|
+
if (!interfaces || interfaces.length === 0) {
|
|
10629
|
+
return undefined;
|
|
10630
|
+
}
|
|
10631
|
+
const result = new Set(interfaces);
|
|
10632
|
+
const builtIn = new InterfaceCollection(__classPrivateFieldGet(this, _ObjectTable_resolveType, "f"));
|
|
10633
|
+
if (fqn !== serialization_1.EMPTY_OBJECT_FQN) {
|
|
10634
|
+
builtIn.addFromClass(fqn);
|
|
10635
|
+
}
|
|
10636
|
+
interfaces.forEach(builtIn.addFromInterface.bind(builtIn));
|
|
10637
|
+
for (const iface of builtIn) {
|
|
10638
|
+
result.delete(iface);
|
|
10639
|
+
}
|
|
10640
|
+
return result.size > 0 ? Array.from(result).sort() : undefined;
|
|
10641
|
+
};
|
|
10587
10642
|
class InterfaceCollection {
|
|
10588
10643
|
constructor(resolveType) {
|
|
10589
|
-
this
|
|
10590
|
-
this
|
|
10644
|
+
_InterfaceCollection_resolveType.set(this, void 0);
|
|
10645
|
+
_InterfaceCollection_interfaces.set(this, new Set);
|
|
10646
|
+
__classPrivateFieldSet(this, _InterfaceCollection_resolveType, resolveType, "f");
|
|
10591
10647
|
}
|
|
10592
10648
|
addFromClass(fqn) {
|
|
10593
|
-
const ti = this.
|
|
10649
|
+
const ti = __classPrivateFieldGet(this, _InterfaceCollection_resolveType, "f").call(this, fqn);
|
|
10594
10650
|
if (!spec.isClassType(ti)) {
|
|
10595
10651
|
throw new kernel_1.JsiiFault(`Expected a class, but received ${spec.describeTypeReference(ti)}`);
|
|
10596
10652
|
}
|
|
@@ -10599,16 +10655,16 @@ var __webpack_modules__ = {
|
|
|
10599
10655
|
}
|
|
10600
10656
|
if (ti.interfaces) {
|
|
10601
10657
|
for (const iface of ti.interfaces) {
|
|
10602
|
-
if (this.
|
|
10658
|
+
if (__classPrivateFieldGet(this, _InterfaceCollection_interfaces, "f").has(iface)) {
|
|
10603
10659
|
continue;
|
|
10604
10660
|
}
|
|
10605
|
-
this.
|
|
10661
|
+
__classPrivateFieldGet(this, _InterfaceCollection_interfaces, "f").add(iface);
|
|
10606
10662
|
this.addFromInterface(iface);
|
|
10607
10663
|
}
|
|
10608
10664
|
}
|
|
10609
10665
|
}
|
|
10610
10666
|
addFromInterface(fqn) {
|
|
10611
|
-
const ti = this.
|
|
10667
|
+
const ti = __classPrivateFieldGet(this, _InterfaceCollection_resolveType, "f").call(this, fqn);
|
|
10612
10668
|
if (!spec.isInterfaceType(ti)) {
|
|
10613
10669
|
throw new kernel_1.JsiiFault(`Expected an interface, but received ${spec.describeTypeReference(ti)}`);
|
|
10614
10670
|
}
|
|
@@ -10616,15 +10672,16 @@ var __webpack_modules__ = {
|
|
|
10616
10672
|
return;
|
|
10617
10673
|
}
|
|
10618
10674
|
for (const iface of ti.interfaces) {
|
|
10619
|
-
if (this.
|
|
10675
|
+
if (__classPrivateFieldGet(this, _InterfaceCollection_interfaces, "f").has(iface)) {
|
|
10620
10676
|
continue;
|
|
10621
10677
|
}
|
|
10622
|
-
this.
|
|
10678
|
+
__classPrivateFieldGet(this, _InterfaceCollection_interfaces, "f").add(iface);
|
|
10623
10679
|
this.addFromInterface(iface);
|
|
10624
10680
|
}
|
|
10625
10681
|
}
|
|
10626
|
-
[
|
|
10627
|
-
|
|
10682
|
+
[(_InterfaceCollection_resolveType = new WeakMap, _InterfaceCollection_interfaces = new WeakMap,
|
|
10683
|
+
Symbol.iterator)]() {
|
|
10684
|
+
return __classPrivateFieldGet(this, _InterfaceCollection_interfaces, "f")[Symbol.iterator]();
|
|
10628
10685
|
}
|
|
10629
10686
|
}
|
|
10630
10687
|
},
|
|
@@ -10689,65 +10746,65 @@ var __webpack_modules__ = {
|
|
|
10689
10746
|
}
|
|
10690
10747
|
},
|
|
10691
10748
|
["Date"]: {
|
|
10692
|
-
serialize(value, optionalValue) {
|
|
10693
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10749
|
+
serialize(value, optionalValue, host) {
|
|
10750
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10694
10751
|
return undefined;
|
|
10695
10752
|
}
|
|
10696
10753
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
10697
10754
|
if (!isDate(value)) {
|
|
10698
|
-
throw new SerializationError(`Value is not an instance of Date`, value);
|
|
10755
|
+
throw new SerializationError(`Value is not an instance of Date`, value, host);
|
|
10699
10756
|
}
|
|
10700
10757
|
return serializeDate(value);
|
|
10701
10758
|
},
|
|
10702
|
-
deserialize(value, optionalValue) {
|
|
10703
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10759
|
+
deserialize(value, optionalValue, host) {
|
|
10760
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10704
10761
|
return undefined;
|
|
10705
10762
|
}
|
|
10706
10763
|
if (!(0, api_1.isWireDate)(value)) {
|
|
10707
|
-
throw new SerializationError(`Value does not have the "${api_1.TOKEN_DATE}" key`, value);
|
|
10764
|
+
throw new SerializationError(`Value does not have the "${api_1.TOKEN_DATE}" key`, value, host);
|
|
10708
10765
|
}
|
|
10709
10766
|
return deserializeDate(value);
|
|
10710
10767
|
}
|
|
10711
10768
|
},
|
|
10712
10769
|
["Scalar"]: {
|
|
10713
|
-
serialize(value, optionalValue) {
|
|
10714
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10770
|
+
serialize(value, optionalValue, host) {
|
|
10771
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10715
10772
|
return undefined;
|
|
10716
10773
|
}
|
|
10717
10774
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
10718
10775
|
const primitiveType = optionalValue.type;
|
|
10719
10776
|
if (!isScalar(value)) {
|
|
10720
|
-
throw new SerializationError(`Value is not a ${spec.describeTypeReference(optionalValue.type)}`, value);
|
|
10777
|
+
throw new SerializationError(`Value is not a ${spec.describeTypeReference(optionalValue.type)}`, value, host);
|
|
10721
10778
|
}
|
|
10722
10779
|
if (typeof value !== primitiveType.primitive) {
|
|
10723
|
-
throw new SerializationError(`Value is not a ${spec.describeTypeReference(optionalValue.type)}`, value);
|
|
10780
|
+
throw new SerializationError(`Value is not a ${spec.describeTypeReference(optionalValue.type)}`, value, host);
|
|
10724
10781
|
}
|
|
10725
10782
|
return value;
|
|
10726
10783
|
},
|
|
10727
|
-
deserialize(value, optionalValue) {
|
|
10728
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10784
|
+
deserialize(value, optionalValue, host) {
|
|
10785
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10729
10786
|
return undefined;
|
|
10730
10787
|
}
|
|
10731
10788
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
10732
10789
|
const primitiveType = optionalValue.type;
|
|
10733
10790
|
if (!isScalar(value)) {
|
|
10734
|
-
throw new SerializationError(`Value is not a ${spec.describeTypeReference(optionalValue.type)}`, value);
|
|
10791
|
+
throw new SerializationError(`Value is not a ${spec.describeTypeReference(optionalValue.type)}`, value, host);
|
|
10735
10792
|
}
|
|
10736
10793
|
if (typeof value !== primitiveType.primitive) {
|
|
10737
|
-
throw new SerializationError(`Value is not a ${spec.describeTypeReference(optionalValue.type)}`, value);
|
|
10794
|
+
throw new SerializationError(`Value is not a ${spec.describeTypeReference(optionalValue.type)}`, value, host);
|
|
10738
10795
|
}
|
|
10739
10796
|
return value;
|
|
10740
10797
|
}
|
|
10741
10798
|
},
|
|
10742
10799
|
["Json"]: {
|
|
10743
|
-
serialize(value, optionalValue) {
|
|
10744
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10800
|
+
serialize(value, optionalValue, host) {
|
|
10801
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10745
10802
|
return undefined;
|
|
10746
10803
|
}
|
|
10747
10804
|
return value;
|
|
10748
10805
|
},
|
|
10749
10806
|
deserialize(value, optionalValue, host) {
|
|
10750
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10807
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10751
10808
|
return undefined;
|
|
10752
10809
|
}
|
|
10753
10810
|
if ((0, api_1.isWireMap)(value)) {
|
|
@@ -10770,7 +10827,7 @@ var __webpack_modules__ = {
|
|
|
10770
10827
|
if (Array.isArray(value)) {
|
|
10771
10828
|
return value.map(mapJsonValue);
|
|
10772
10829
|
}
|
|
10773
|
-
return mapValues(value, mapJsonValue);
|
|
10830
|
+
return mapValues(value, mapJsonValue, host);
|
|
10774
10831
|
function mapJsonValue(toMap, key) {
|
|
10775
10832
|
if (toMap == null) {
|
|
10776
10833
|
return toMap;
|
|
@@ -10785,42 +10842,42 @@ var __webpack_modules__ = {
|
|
|
10785
10842
|
},
|
|
10786
10843
|
["Enum"]: {
|
|
10787
10844
|
serialize(value, optionalValue, host) {
|
|
10788
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10845
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10789
10846
|
return undefined;
|
|
10790
10847
|
}
|
|
10791
10848
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
10792
10849
|
if (typeof value !== "string" && typeof value !== "number") {
|
|
10793
|
-
throw new SerializationError(`Value is not a string or number`, value);
|
|
10850
|
+
throw new SerializationError(`Value is not a string or number`, value, host);
|
|
10794
10851
|
}
|
|
10795
10852
|
host.debug("Serializing enum");
|
|
10796
10853
|
const enumType = optionalValue.type;
|
|
10797
10854
|
const enumMap = host.findSymbol(enumType.fqn);
|
|
10798
10855
|
const enumEntry = Object.entries(enumMap).find((([, v]) => v === value));
|
|
10799
10856
|
if (!enumEntry) {
|
|
10800
|
-
throw new SerializationError(`Value is not present in enum ${spec.describeTypeReference(enumType)}`, value);
|
|
10857
|
+
throw new SerializationError(`Value is not present in enum ${spec.describeTypeReference(enumType)}`, value, host);
|
|
10801
10858
|
}
|
|
10802
10859
|
return {
|
|
10803
10860
|
[api_1.TOKEN_ENUM]: `${enumType.fqn}/${enumEntry[0]}`
|
|
10804
10861
|
};
|
|
10805
10862
|
},
|
|
10806
10863
|
deserialize(value, optionalValue, host) {
|
|
10807
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10864
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10808
10865
|
return undefined;
|
|
10809
10866
|
}
|
|
10810
10867
|
if (!(0, api_1.isWireEnum)(value)) {
|
|
10811
|
-
throw new SerializationError(`Value does not have the "${api_1.TOKEN_ENUM}" key`, value);
|
|
10868
|
+
throw new SerializationError(`Value does not have the "${api_1.TOKEN_ENUM}" key`, value, host);
|
|
10812
10869
|
}
|
|
10813
|
-
return deserializeEnum(value, host
|
|
10870
|
+
return deserializeEnum(value, host);
|
|
10814
10871
|
}
|
|
10815
10872
|
},
|
|
10816
10873
|
["Array"]: {
|
|
10817
10874
|
serialize(value, optionalValue, host) {
|
|
10818
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10875
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10819
10876
|
return undefined;
|
|
10820
10877
|
}
|
|
10821
10878
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
10822
10879
|
if (!Array.isArray(value)) {
|
|
10823
|
-
throw new SerializationError(`Value is not an array`, value);
|
|
10880
|
+
throw new SerializationError(`Value is not an array`, value, host);
|
|
10824
10881
|
}
|
|
10825
10882
|
const arrayType = optionalValue.type;
|
|
10826
10883
|
return value.map(((x, idx) => process(host, "serialize", x, {
|
|
@@ -10828,12 +10885,12 @@ var __webpack_modules__ = {
|
|
|
10828
10885
|
}, `index ${(0, util_1.inspect)(idx)}`)));
|
|
10829
10886
|
},
|
|
10830
10887
|
deserialize(value, optionalValue, host) {
|
|
10831
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10888
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10832
10889
|
return undefined;
|
|
10833
10890
|
}
|
|
10834
10891
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
10835
10892
|
if (!Array.isArray(value)) {
|
|
10836
|
-
throw new SerializationError(`Value is not an array`, value);
|
|
10893
|
+
throw new SerializationError(`Value is not an array`, value, host);
|
|
10837
10894
|
}
|
|
10838
10895
|
const arrayType = optionalValue.type;
|
|
10839
10896
|
return value.map(((x, idx) => process(host, "deserialize", x, {
|
|
@@ -10843,7 +10900,7 @@ var __webpack_modules__ = {
|
|
|
10843
10900
|
},
|
|
10844
10901
|
["Map"]: {
|
|
10845
10902
|
serialize(value, optionalValue, host) {
|
|
10846
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10903
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10847
10904
|
return undefined;
|
|
10848
10905
|
}
|
|
10849
10906
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
@@ -10851,11 +10908,11 @@ var __webpack_modules__ = {
|
|
|
10851
10908
|
return {
|
|
10852
10909
|
[api_1.TOKEN_MAP]: mapValues(value, ((v, key) => process(host, "serialize", v, {
|
|
10853
10910
|
type: mapType.collection.elementtype
|
|
10854
|
-
}, `key ${(0, util_1.inspect)(key)}`)))
|
|
10911
|
+
}, `key ${(0, util_1.inspect)(key)}`)), host)
|
|
10855
10912
|
};
|
|
10856
10913
|
},
|
|
10857
10914
|
deserialize(value, optionalValue, host, {allowNullishMapValue = false} = {}) {
|
|
10858
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10915
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10859
10916
|
return undefined;
|
|
10860
10917
|
}
|
|
10861
10918
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
@@ -10864,12 +10921,12 @@ var __webpack_modules__ = {
|
|
|
10864
10921
|
return mapValues(value, ((v, key) => process(host, "deserialize", v, {
|
|
10865
10922
|
optional: allowNullishMapValue,
|
|
10866
10923
|
type: mapType.collection.elementtype
|
|
10867
|
-
}, `key ${(0, util_1.inspect)(key)}`)));
|
|
10924
|
+
}, `key ${(0, util_1.inspect)(key)}`)), host);
|
|
10868
10925
|
}
|
|
10869
10926
|
const result = mapValues(value[api_1.TOKEN_MAP], ((v, key) => process(host, "deserialize", v, {
|
|
10870
10927
|
optional: allowNullishMapValue,
|
|
10871
10928
|
type: mapType.collection.elementtype
|
|
10872
|
-
}, `key ${(0, util_1.inspect)(key)}`)));
|
|
10929
|
+
}, `key ${(0, util_1.inspect)(key)}`)), host);
|
|
10873
10930
|
Object.defineProperty(result, exports.SYMBOL_WIRE_TYPE, {
|
|
10874
10931
|
configurable: false,
|
|
10875
10932
|
enumerable: false,
|
|
@@ -10881,15 +10938,15 @@ var __webpack_modules__ = {
|
|
|
10881
10938
|
},
|
|
10882
10939
|
["Struct"]: {
|
|
10883
10940
|
serialize(value, optionalValue, host) {
|
|
10884
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10941
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10885
10942
|
return undefined;
|
|
10886
10943
|
}
|
|
10887
10944
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
10888
10945
|
if (typeof value !== "object" || value == null || value instanceof Date) {
|
|
10889
|
-
throw new SerializationError(`Value is not an object`, value);
|
|
10946
|
+
throw new SerializationError(`Value is not an object`, value, host);
|
|
10890
10947
|
}
|
|
10891
10948
|
if (Array.isArray(value)) {
|
|
10892
|
-
throw new SerializationError(`Value is an array`, value);
|
|
10949
|
+
throw new SerializationError(`Value is an array`, value, host);
|
|
10893
10950
|
}
|
|
10894
10951
|
host.debug("Returning value type by reference");
|
|
10895
10952
|
return host.objects.registerObject(value, exports.EMPTY_OBJECT_FQN, [ optionalValue.type.fqn ]);
|
|
@@ -10898,66 +10955,66 @@ var __webpack_modules__ = {
|
|
|
10898
10955
|
if (typeof value === "object" && Object.keys(value !== null && value !== void 0 ? value : {}).length === 0) {
|
|
10899
10956
|
value = undefined;
|
|
10900
10957
|
}
|
|
10901
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10958
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10902
10959
|
return undefined;
|
|
10903
10960
|
}
|
|
10904
10961
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
10905
10962
|
if (typeof value !== "object" || value == null) {
|
|
10906
|
-
throw new SerializationError(`Value is not an object`, value);
|
|
10963
|
+
throw new SerializationError(`Value is not an object`, value, host);
|
|
10907
10964
|
}
|
|
10908
10965
|
const namedType = host.lookupType(optionalValue.type.fqn);
|
|
10909
10966
|
const props = propertiesOf(namedType, host.lookupType);
|
|
10910
10967
|
if (Array.isArray(value)) {
|
|
10911
|
-
throw new SerializationError("Value is an array (varargs may have been incorrectly supplied)", value);
|
|
10968
|
+
throw new SerializationError("Value is an array (varargs may have been incorrectly supplied)", value, host);
|
|
10912
10969
|
}
|
|
10913
10970
|
if ((0, api_1.isObjRef)(value)) {
|
|
10914
10971
|
host.debug("Expected value type but got reference type, accepting for now (awslabs/jsii#400)");
|
|
10915
|
-
return validateRequiredProps(host.objects.findObject(value).instance, namedType.fqn, props);
|
|
10972
|
+
return validateRequiredProps(host.objects.findObject(value).instance, namedType.fqn, props, host);
|
|
10916
10973
|
}
|
|
10917
10974
|
if (_1.api.isWireStruct(value)) {
|
|
10918
10975
|
const {fqn, data} = value[_1.api.TOKEN_STRUCT];
|
|
10919
10976
|
if (!isAssignable(fqn, namedType, host.lookupType)) {
|
|
10920
|
-
throw new SerializationError(`Wired struct has type '${fqn}', which does not match expected type`, value);
|
|
10977
|
+
throw new SerializationError(`Wired struct has type '${fqn}', which does not match expected type`, value, host);
|
|
10921
10978
|
}
|
|
10922
10979
|
value = data;
|
|
10923
10980
|
}
|
|
10924
10981
|
if (_1.api.isWireMap(value)) {
|
|
10925
10982
|
value = value[_1.api.TOKEN_MAP];
|
|
10926
10983
|
}
|
|
10927
|
-
value = validateRequiredProps(value, namedType.fqn, props);
|
|
10984
|
+
value = validateRequiredProps(value, namedType.fqn, props, host);
|
|
10928
10985
|
return mapValues(value, ((v, key) => {
|
|
10929
10986
|
if (!props[key]) {
|
|
10930
10987
|
return undefined;
|
|
10931
10988
|
}
|
|
10932
10989
|
return process(host, "deserialize", v, props[key], `key ${(0, util_1.inspect)(key)}`);
|
|
10933
|
-
}));
|
|
10990
|
+
}), host);
|
|
10934
10991
|
}
|
|
10935
10992
|
},
|
|
10936
10993
|
["RefType"]: {
|
|
10937
10994
|
serialize(value, optionalValue, host) {
|
|
10938
10995
|
var _a;
|
|
10939
|
-
if (nullAndOk(value, optionalValue)) {
|
|
10996
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10940
10997
|
return undefined;
|
|
10941
10998
|
}
|
|
10942
10999
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
10943
11000
|
if (typeof value !== "object" || value == null || Array.isArray(value)) {
|
|
10944
|
-
throw new SerializationError(`Value is not an object`, value);
|
|
11001
|
+
throw new SerializationError(`Value is not an object`, value, host);
|
|
10945
11002
|
}
|
|
10946
11003
|
if (value instanceof Date) {
|
|
10947
|
-
throw new SerializationError(`Value is a Date`, value);
|
|
11004
|
+
throw new SerializationError(`Value is a Date`, value, host);
|
|
10948
11005
|
}
|
|
10949
11006
|
const expectedType = host.lookupType(optionalValue.type.fqn);
|
|
10950
11007
|
const interfaces = spec.isInterfaceType(expectedType) ? [ expectedType.fqn ] : undefined;
|
|
10951
|
-
const jsiiType = (_a = (0, objects_1.jsiiTypeFqn)(value)) !== null && _a !== void 0 ? _a : spec.isClassType(expectedType) ? expectedType.fqn : exports.EMPTY_OBJECT_FQN;
|
|
11008
|
+
const jsiiType = (_a = (0, objects_1.jsiiTypeFqn)(value, host.isVisibleType)) !== null && _a !== void 0 ? _a : spec.isClassType(expectedType) ? expectedType.fqn : exports.EMPTY_OBJECT_FQN;
|
|
10952
11009
|
return host.objects.registerObject(value, jsiiType, interfaces);
|
|
10953
11010
|
},
|
|
10954
11011
|
deserialize(value, optionalValue, host) {
|
|
10955
|
-
if (nullAndOk(value, optionalValue)) {
|
|
11012
|
+
if (nullAndOk(value, optionalValue, host)) {
|
|
10956
11013
|
return undefined;
|
|
10957
11014
|
}
|
|
10958
11015
|
assert(optionalValue !== VOID, "Encountered unexpected void type!");
|
|
10959
11016
|
if (!(0, api_1.isObjRef)(value)) {
|
|
10960
|
-
throw new SerializationError(`Value does not have the "${api_1.TOKEN_REF}" key`, value);
|
|
11017
|
+
throw new SerializationError(`Value does not have the "${api_1.TOKEN_REF}" key`, value, host);
|
|
10961
11018
|
}
|
|
10962
11019
|
const {instance, fqn} = host.objects.findObject(value);
|
|
10963
11020
|
const namedTypeRef = optionalValue.type;
|
|
@@ -10965,7 +11022,7 @@ var __webpack_modules__ = {
|
|
|
10965
11022
|
const namedType = host.lookupType(namedTypeRef.fqn);
|
|
10966
11023
|
const declaredType = optionalValue.type;
|
|
10967
11024
|
if (spec.isClassType(namedType) && !isAssignable(fqn, declaredType, host.lookupType)) {
|
|
10968
|
-
throw new SerializationError(`Object of type '${fqn}' is not convertible to ${spec.describeTypeReference(declaredType)}`, value);
|
|
11025
|
+
throw new SerializationError(`Object of type '${fqn}' is not convertible to ${spec.describeTypeReference(declaredType)}`, value, host);
|
|
10969
11026
|
}
|
|
10970
11027
|
}
|
|
10971
11028
|
return instance;
|
|
@@ -10989,10 +11046,10 @@ var __webpack_modules__ = {
|
|
|
10989
11046
|
}, `index ${(0, util_1.inspect)(idx)}`)));
|
|
10990
11047
|
}
|
|
10991
11048
|
if (typeof value === "function") {
|
|
10992
|
-
throw new SerializationError("Functions cannot be passed across language boundaries", value);
|
|
11049
|
+
throw new SerializationError("Functions cannot be passed across language boundaries", value, host);
|
|
10993
11050
|
}
|
|
10994
11051
|
if (typeof value !== "object" || value == null) {
|
|
10995
|
-
throw new SerializationError(`A jsii kernel assumption was violated: value is not an object`, value);
|
|
11052
|
+
throw new SerializationError(`A jsii kernel assumption was violated: value is not an object`, value, host);
|
|
10996
11053
|
}
|
|
10997
11054
|
if (exports.SYMBOL_WIRE_TYPE in value && value[exports.SYMBOL_WIRE_TYPE] === api_1.TOKEN_MAP) {
|
|
10998
11055
|
return exports.SERIALIZERS["Map"].serialize(value, {
|
|
@@ -11005,19 +11062,19 @@ var __webpack_modules__ = {
|
|
|
11005
11062
|
}, host);
|
|
11006
11063
|
}
|
|
11007
11064
|
if (value instanceof Set || value instanceof Map) {
|
|
11008
|
-
throw new SerializationError("Set and Map instances cannot be sent across the language boundary", value);
|
|
11065
|
+
throw new SerializationError("Set and Map instances cannot be sent across the language boundary", value, host);
|
|
11009
11066
|
}
|
|
11010
11067
|
const prevRef = (0, objects_1.objectReference)(value);
|
|
11011
11068
|
if (prevRef) {
|
|
11012
11069
|
return prevRef;
|
|
11013
11070
|
}
|
|
11014
|
-
const jsiiType = (_a = (0, objects_1.jsiiTypeFqn)(value)) !== null && _a !== void 0 ? _a : isByReferenceOnly(value) ? exports.EMPTY_OBJECT_FQN : undefined;
|
|
11071
|
+
const jsiiType = (_a = (0, objects_1.jsiiTypeFqn)(value, host.isVisibleType)) !== null && _a !== void 0 ? _a : isByReferenceOnly(value) ? exports.EMPTY_OBJECT_FQN : undefined;
|
|
11015
11072
|
if (jsiiType) {
|
|
11016
11073
|
return host.objects.registerObject(value, jsiiType);
|
|
11017
11074
|
}
|
|
11018
11075
|
return mapValues(value, ((v, key) => process(host, "serialize", v, {
|
|
11019
11076
|
type: spec.CANONICAL_ANY
|
|
11020
|
-
}, `key ${(0, util_1.inspect)(key)}`)));
|
|
11077
|
+
}, `key ${(0, util_1.inspect)(key)}`)), host);
|
|
11021
11078
|
},
|
|
11022
11079
|
deserialize(value, _type, host) {
|
|
11023
11080
|
if (value == null) {
|
|
@@ -11039,7 +11096,7 @@ var __webpack_modules__ = {
|
|
|
11039
11096
|
}
|
|
11040
11097
|
if ((0, api_1.isWireEnum)(value)) {
|
|
11041
11098
|
host.debug("ANY is an Enum");
|
|
11042
|
-
return deserializeEnum(value, host
|
|
11099
|
+
return deserializeEnum(value, host);
|
|
11043
11100
|
}
|
|
11044
11101
|
if ((0, api_1.isWireMap)(value)) {
|
|
11045
11102
|
host.debug("ANY is a Map");
|
|
@@ -11069,7 +11126,7 @@ var __webpack_modules__ = {
|
|
|
11069
11126
|
host.debug("ANY is a Map");
|
|
11070
11127
|
return mapValues(value, ((v, key) => process(host, "deserialize", v, {
|
|
11071
11128
|
type: spec.CANONICAL_ANY
|
|
11072
|
-
}, `key ${(0, util_1.inspect)(key)}`)));
|
|
11129
|
+
}, `key ${(0, util_1.inspect)(key)}`)), host);
|
|
11073
11130
|
}
|
|
11074
11131
|
}
|
|
11075
11132
|
};
|
|
@@ -11081,17 +11138,17 @@ var __webpack_modules__ = {
|
|
|
11081
11138
|
function deserializeDate(value) {
|
|
11082
11139
|
return new Date(value[api_1.TOKEN_DATE]);
|
|
11083
11140
|
}
|
|
11084
|
-
function deserializeEnum(value,
|
|
11141
|
+
function deserializeEnum(value, host) {
|
|
11085
11142
|
const enumLocator = value[api_1.TOKEN_ENUM];
|
|
11086
11143
|
const sep = enumLocator.lastIndexOf("/");
|
|
11087
11144
|
if (sep === -1) {
|
|
11088
|
-
throw new SerializationError(`Invalid enum token value ${(0, util_1.inspect)(enumLocator)}`, value);
|
|
11145
|
+
throw new SerializationError(`Invalid enum token value ${(0, util_1.inspect)(enumLocator)}`, value, host);
|
|
11089
11146
|
}
|
|
11090
11147
|
const typeName = enumLocator.slice(0, sep);
|
|
11091
11148
|
const valueName = enumLocator.slice(sep + 1);
|
|
11092
|
-
const enumValue =
|
|
11149
|
+
const enumValue = host.findSymbol(typeName)[valueName];
|
|
11093
11150
|
if (enumValue === undefined) {
|
|
11094
|
-
throw new SerializationError(`No such enum member: ${(0, util_1.inspect)(valueName)}`, value);
|
|
11151
|
+
throw new SerializationError(`No such enum member: ${(0, util_1.inspect)(valueName)}`, value, host);
|
|
11095
11152
|
}
|
|
11096
11153
|
return enumValue;
|
|
11097
11154
|
}
|
|
@@ -11169,12 +11226,12 @@ var __webpack_modules__ = {
|
|
|
11169
11226
|
} ];
|
|
11170
11227
|
}
|
|
11171
11228
|
exports.serializationType = serializationType;
|
|
11172
|
-
function nullAndOk(x, type) {
|
|
11229
|
+
function nullAndOk(x, type, host) {
|
|
11173
11230
|
if (x != null) {
|
|
11174
11231
|
return false;
|
|
11175
11232
|
}
|
|
11176
11233
|
if (type !== "void" && !type.optional) {
|
|
11177
|
-
throw new SerializationError(`A value is required (type is non-optional)`, x);
|
|
11234
|
+
throw new SerializationError(`A value is required (type is non-optional)`, x, host);
|
|
11178
11235
|
}
|
|
11179
11236
|
return true;
|
|
11180
11237
|
}
|
|
@@ -11191,12 +11248,12 @@ var __webpack_modules__ = {
|
|
|
11191
11248
|
}
|
|
11192
11249
|
return ret;
|
|
11193
11250
|
}
|
|
11194
|
-
function mapValues(value, fn) {
|
|
11251
|
+
function mapValues(value, fn, host) {
|
|
11195
11252
|
if (typeof value !== "object" || value == null) {
|
|
11196
|
-
throw new SerializationError(`Value is not an object`, value);
|
|
11253
|
+
throw new SerializationError(`Value is not an object`, value, host);
|
|
11197
11254
|
}
|
|
11198
11255
|
if (Array.isArray(value)) {
|
|
11199
|
-
throw new SerializationError(`Value is an array`, value);
|
|
11256
|
+
throw new SerializationError(`Value is an array`, value, host);
|
|
11200
11257
|
}
|
|
11201
11258
|
const out = {};
|
|
11202
11259
|
for (const [k, v] of Object.entries(value)) {
|
|
@@ -11251,11 +11308,11 @@ var __webpack_modules__ = {
|
|
|
11251
11308
|
}
|
|
11252
11309
|
return false;
|
|
11253
11310
|
}
|
|
11254
|
-
function validateRequiredProps(actualProps, typeName, specProps) {
|
|
11311
|
+
function validateRequiredProps(actualProps, typeName, specProps, host) {
|
|
11255
11312
|
const missingRequiredProps = Object.keys(specProps).filter((name => !specProps[name].optional)).filter((name => !(name in actualProps)));
|
|
11256
11313
|
if (missingRequiredProps.length > 0) {
|
|
11257
11314
|
throw new SerializationError(`Missing required properties for ${typeName}: ${missingRequiredProps.map((p => (0,
|
|
11258
|
-
util_1.inspect)(p))).join(", ")}`, actualProps);
|
|
11315
|
+
util_1.inspect)(p))).join(", ")}`, actualProps, host);
|
|
11259
11316
|
}
|
|
11260
11317
|
return actualProps;
|
|
11261
11318
|
}
|
|
@@ -11292,7 +11349,7 @@ var __webpack_modules__ = {
|
|
|
11292
11349
|
}
|
|
11293
11350
|
const typeDescr = type === VOID ? type : spec.describeTypeReference(type.type);
|
|
11294
11351
|
const optionalTypeDescr = type !== VOID && type.optional ? `${typeDescr} | undefined` : typeDescr;
|
|
11295
|
-
throw new SerializationError(`${titleize(context)}: Unable to ${serde} value as ${optionalTypeDescr}`, value, errors, {
|
|
11352
|
+
throw new SerializationError(`${titleize(context)}: Unable to ${serde} value as ${optionalTypeDescr}`, value, host, errors, {
|
|
11296
11353
|
renderValue: true
|
|
11297
11354
|
});
|
|
11298
11355
|
function titleize(text) {
|
|
@@ -11306,8 +11363,8 @@ var __webpack_modules__ = {
|
|
|
11306
11363
|
}
|
|
11307
11364
|
exports.process = process;
|
|
11308
11365
|
class SerializationError extends Error {
|
|
11309
|
-
constructor(message, value, causes = [], {renderValue = false} = {}) {
|
|
11310
|
-
super([ message, ...renderValue ? [ `${causes.length > 0 ? "├" : "╰"}── 🛑 Failing value is ${describeTypeOf(value)}`, ...value == null ? [] : (0,
|
|
11366
|
+
constructor(message, value, {isVisibleType}, causes = [], {renderValue = false} = {}) {
|
|
11367
|
+
super([ message, ...renderValue ? [ `${causes.length > 0 ? "├" : "╰"}── 🛑 Failing value is ${describeTypeOf(value, isVisibleType)}`, ...value == null ? [] : (0,
|
|
11311
11368
|
util_1.inspect)(value, false, 0).split("\n").map((l => `${causes.length > 0 ? "│" : " "} ${l}`)) ] : [], ...causes.length > 0 ? [ "╰── 🔍 Failure reason(s):", ...causes.map(((cause, idx) => {
|
|
11312
11369
|
var _a;
|
|
11313
11370
|
return ` ${idx < causes.length - 1 ? "├" : "╰"}─${causes.length > 1 ? ` [${(_a = cause.context) !== null && _a !== void 0 ? _a : (0,
|
|
@@ -11319,7 +11376,7 @@ var __webpack_modules__ = {
|
|
|
11319
11376
|
}
|
|
11320
11377
|
}
|
|
11321
11378
|
exports.SerializationError = SerializationError;
|
|
11322
|
-
function describeTypeOf(value) {
|
|
11379
|
+
function describeTypeOf(value, isVisibleType) {
|
|
11323
11380
|
const type = typeof value;
|
|
11324
11381
|
switch (type) {
|
|
11325
11382
|
case "object":
|
|
@@ -11329,7 +11386,7 @@ var __webpack_modules__ = {
|
|
|
11329
11386
|
if (Array.isArray(value)) {
|
|
11330
11387
|
return "an array";
|
|
11331
11388
|
}
|
|
11332
|
-
const fqn = (0, objects_1.jsiiTypeFqn)(value);
|
|
11389
|
+
const fqn = (0, objects_1.jsiiTypeFqn)(value, isVisibleType);
|
|
11333
11390
|
if (fqn != null && fqn !== exports.EMPTY_OBJECT_FQN) {
|
|
11334
11391
|
return `an instance of ${fqn}`;
|
|
11335
11392
|
}
|
|
@@ -11381,7 +11438,7 @@ var __webpack_modules__ = {
|
|
|
11381
11438
|
},
|
|
11382
11439
|
4383: (__unused_webpack_module, exports, __webpack_require__) => {
|
|
11383
11440
|
"use strict";
|
|
11384
|
-
var _a;
|
|
11441
|
+
var _a, _b;
|
|
11385
11442
|
Object.defineProperty(exports, "__esModule", {
|
|
11386
11443
|
value: true
|
|
11387
11444
|
});
|
|
@@ -11391,11 +11448,8 @@ var __webpack_modules__ = {
|
|
|
11391
11448
|
const disk_cache_1 = __webpack_require__(7202);
|
|
11392
11449
|
const link_1 = __webpack_require__(328);
|
|
11393
11450
|
const default_cache_root_1 = __webpack_require__(4964);
|
|
11394
|
-
let packageCacheEnabled = ((_a = process.env.JSII_RUNTIME_PACKAGE_CACHE) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === "enabled";
|
|
11451
|
+
let packageCacheEnabled = ((_b = (_a = process.env.JSII_RUNTIME_PACKAGE_CACHE) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) !== null && _b !== void 0 ? _b : "enabled") === "enabled";
|
|
11395
11452
|
function extract(file, outDir, options, ...comments) {
|
|
11396
|
-
(0, fs_1.mkdirSync)(outDir, {
|
|
11397
|
-
recursive: true
|
|
11398
|
-
});
|
|
11399
11453
|
try {
|
|
11400
11454
|
return (packageCacheEnabled ? extractViaCache : extractToOutDir)(file, outDir, options, ...comments);
|
|
11401
11455
|
} catch (err) {
|
|
@@ -11446,6 +11500,9 @@ var __webpack_modules__ = {
|
|
|
11446
11500
|
};
|
|
11447
11501
|
}
|
|
11448
11502
|
function extractToOutDir(file, cwd, options = {}) {
|
|
11503
|
+
(0, fs_1.mkdirSync)(cwd, {
|
|
11504
|
+
recursive: true
|
|
11505
|
+
});
|
|
11449
11506
|
untarInto({
|
|
11450
11507
|
...options,
|
|
11451
11508
|
cwd,
|
|
@@ -11486,13 +11543,14 @@ var __webpack_modules__ = {
|
|
|
11486
11543
|
const events_1 = __webpack_require__(2361);
|
|
11487
11544
|
class KernelHost {
|
|
11488
11545
|
constructor(inout, opts = {}) {
|
|
11489
|
-
var _a, _b;
|
|
11546
|
+
var _a, _b, _c;
|
|
11490
11547
|
this.inout = inout;
|
|
11491
11548
|
this.opts = opts;
|
|
11492
11549
|
this.kernel = new kernel_1.Kernel(this.callbackHandler.bind(this));
|
|
11493
11550
|
this.eventEmitter = new events_1.EventEmitter;
|
|
11494
11551
|
this.kernel.traceEnabled = (_a = opts.debug) !== null && _a !== void 0 ? _a : false;
|
|
11495
11552
|
this.kernel.debugTimingEnabled = (_b = opts.debugTiming) !== null && _b !== void 0 ? _b : false;
|
|
11553
|
+
this.kernel.validateAssemblies = (_c = opts.validateAssemblies) !== null && _c !== void 0 ? _c : false;
|
|
11496
11554
|
}
|
|
11497
11555
|
run() {
|
|
11498
11556
|
var _a;
|
|
@@ -17312,7 +17370,7 @@ var __webpack_modules__ = {
|
|
|
17312
17370
|
},
|
|
17313
17371
|
4147: module => {
|
|
17314
17372
|
"use strict";
|
|
17315
|
-
module.exports = JSON.parse('{"name":"@jsii/runtime","version":"1.
|
|
17373
|
+
module.exports = JSON.parse('{"name":"@jsii/runtime","version":"1.86.0","description":"jsii runtime kernel process","license":"Apache-2.0","author":{"name":"Amazon Web Services","url":"https://aws.amazon.com"},"homepage":"https://github.com/aws/jsii","bugs":{"url":"https://github.com/aws/jsii/issues"},"repository":{"type":"git","url":"https://github.com/aws/jsii.git","directory":"packages/@jsii/runtime"},"engines":{"node":">= 14.17.0"},"main":"lib/index.js","types":"lib/index.d.ts","bin":{"jsii-runtime":"bin/jsii-runtime"},"scripts":{"build":"tsc --build && chmod +x bin/jsii-runtime && npx webpack-cli && npm run lint","watch":"tsc --build -w","lint":"eslint . --ext .js,.ts --ignore-path=.gitignore --ignore-pattern=webpack.config.js","lint:fix":"yarn lint --fix","test":"jest","test:update":"jest -u","package":"package-js"},"dependencies":{"@jsii/kernel":"^1.86.0","@jsii/check-node":"1.86.0","@jsii/spec":"^1.86.0"},"devDependencies":{"@scope/jsii-calc-base":"^1.86.0","@scope/jsii-calc-lib":"^1.86.0","jsii-build-tools":"^1.86.0","jsii-calc":"^3.20.120","source-map-loader":"^4.0.1","webpack":"^5.88.2","webpack-cli":"^5.1.4"}}');
|
|
17316
17374
|
},
|
|
17317
17375
|
5277: module => {
|
|
17318
17376
|
"use strict";
|
|
@@ -17365,6 +17423,7 @@ var __webpack_exports__ = {};
|
|
|
17365
17423
|
const noStack = !!process.env.JSII_NOSTACK;
|
|
17366
17424
|
const debug = !!process.env.JSII_DEBUG;
|
|
17367
17425
|
const debugTiming = !!process.env.JSII_DEBUG_TIMING;
|
|
17426
|
+
const validateAssemblies = !!process.env.JSII_VALIDATE_ASSEMBLIES;
|
|
17368
17427
|
const stdio = new sync_stdio_1.SyncStdio({
|
|
17369
17428
|
errorFD: (_a = process.stderr.fd) !== null && _a !== void 0 ? _a : 2,
|
|
17370
17429
|
readFD: 3,
|
|
@@ -17374,7 +17433,8 @@ var __webpack_exports__ = {};
|
|
|
17374
17433
|
const host = new host_1.KernelHost(inout, {
|
|
17375
17434
|
debug,
|
|
17376
17435
|
noStack,
|
|
17377
|
-
debugTiming
|
|
17436
|
+
debugTiming,
|
|
17437
|
+
validateAssemblies
|
|
17378
17438
|
});
|
|
17379
17439
|
host.once("exit", process.exit.bind(process));
|
|
17380
17440
|
inout.write({
|