webloom-framework 0.4.1 → 0.4.3
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/README.md +11 -1
- package/dist/advanced.d.ts +19 -7
- package/dist/advanced.js +4 -4
- package/dist/advanced.js.map +1 -1
- package/dist/{chunk-SX46RHDI.js → chunk-UZAO6ORB.js} +205 -41
- package/dist/chunk-UZAO6ORB.js.map +1 -0
- package/dist/{chunk-ANA6GBEI.js → chunk-YIIDRFHK.js} +553 -47
- package/dist/chunk-YIIDRFHK.js.map +1 -0
- package/dist/{chunk-HJKPKWI7.js → chunk-ZP5QYTXX.js} +19 -4
- package/dist/chunk-ZP5QYTXX.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/{messageBus-CtrwkjrO.d.ts → messageBus-DigYfj74.d.ts} +1 -1
- package/dist/{messagePortServiceTransport-BYprNvQY.d.ts → messagePortServiceTransport-B9-24RK6.d.ts} +95 -4
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/{runtimeTypes-DquUCHz-.d.ts → runtimeTypes-50LVQs0h.d.ts} +55 -2
- package/dist/{sharedWorkerHost-KI7TIGdX.d.ts → sharedWorkerHost-DikS18hA.d.ts} +88 -2
- package/dist/testing.d.ts +6 -6
- package/dist/testing.js +4 -4
- package/dist/{windowRuntime-BKkLPsAS.d.ts → windowRuntime-e1Tn6SnN.d.ts} +2 -2
- package/docs/api.md +28 -1
- package/docs/proposals/webloom-v4/requirements.md +1 -1
- package/docs/proposals/webloom-v4/verification.md +26 -11
- package/package.json +1 -1
- package/dist/chunk-ANA6GBEI.js.map +0 -1
- package/dist/chunk-HJKPKWI7.js.map +0 -1
- package/dist/chunk-SX46RHDI.js.map +0 -1
|
@@ -614,6 +614,8 @@ var RUNTIME_ERROR_MESSAGE_TYPE = `${RUNTIME_PROTOCOL_VERSION}.error`;
|
|
|
614
614
|
var RUNTIME_CANCEL_TYPE = `${RUNTIME_PROTOCOL_VERSION}.cancel`;
|
|
615
615
|
var RUNTIME_NEXT_TYPE = `${RUNTIME_PROTOCOL_VERSION}.next`;
|
|
616
616
|
var RUNTIME_CREDIT_TYPE = `${RUNTIME_PROTOCOL_VERSION}.credit`;
|
|
617
|
+
var RUNTIME_CLOSE_TYPE = `${RUNTIME_PROTOCOL_VERSION}.close`;
|
|
618
|
+
var RUNTIME_CLOSE_ACK_TYPE = `${RUNTIME_PROTOCOL_VERSION}.close-ack`;
|
|
617
619
|
function record(value) {
|
|
618
620
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
619
621
|
}
|
|
@@ -664,11 +666,21 @@ function validDetails(value) {
|
|
|
664
666
|
function validIdentity(message2) {
|
|
665
667
|
return boundedText(message2.protocolVersion, MAX_VERSION_LENGTH) && message2.protocolVersion === RUNTIME_PROTOCOL_VERSION;
|
|
666
668
|
}
|
|
669
|
+
function validBinding(value) {
|
|
670
|
+
if (!record(value)) return false;
|
|
671
|
+
return boundedText(value.runtimeInstanceId, MAX_ID_LENGTH) && boundedText(value.connectionId, MAX_ID_LENGTH);
|
|
672
|
+
}
|
|
673
|
+
function validDrainResult(value) {
|
|
674
|
+
if (typeof value.drained !== "boolean" || typeof value.timedOut !== "boolean" || !Number.isSafeInteger(value.pendingExecutions) || value.pendingExecutions < 0) return false;
|
|
675
|
+
if (value.drained && (value.timedOut || value.pendingExecutions !== 0)) return false;
|
|
676
|
+
if (value.timedOut && (!value.pendingExecutions || value.drained)) return false;
|
|
677
|
+
return true;
|
|
678
|
+
}
|
|
667
679
|
function validServiceIdentity(message2) {
|
|
668
680
|
return boundedText(message2.callId, MAX_CALL_ID_LENGTH) && boundedText(message2.serviceInstanceId, MAX_ID_LENGTH);
|
|
669
681
|
}
|
|
670
682
|
function validateSnapshot(value) {
|
|
671
|
-
if (value.type !== RUNTIME_SNAPSHOT_TYPE || !validIdentity(value) || !boundedText(value.runtimeId, MAX_ID_LENGTH) || !boundedText(value.runtimeInstanceId, MAX_ID_LENGTH) || value.runtimeKind !== "window-main" && value.runtimeKind !== "shared-worker" || !Number.isSafeInteger(value.revision) || value.revision < 0 || !["starting", "ready", "stopping", "failed", "disposed"].includes(String(value.state)) || !Array.isArray(value.units) || !Array.isArray(value.services) || value.units.length > MAX_SNAPSHOT_UNITS || value.services.length > MAX_SNAPSHOT_SERVICES) return false;
|
|
683
|
+
if (value.type !== RUNTIME_SNAPSHOT_TYPE || !validIdentity(value) || value.binding !== void 0 && !validBinding(value.binding) || !boundedText(value.runtimeId, MAX_ID_LENGTH) || !boundedText(value.runtimeInstanceId, MAX_ID_LENGTH) || value.runtimeKind !== "window-main" && value.runtimeKind !== "shared-worker" || !Number.isSafeInteger(value.revision) || value.revision < 0 || !["starting", "ready", "stopping", "failed", "disposed"].includes(String(value.state)) || !Array.isArray(value.units) || !Array.isArray(value.services) || value.units.length > MAX_SNAPSHOT_UNITS || value.services.length > MAX_SNAPSHOT_SERVICES) return false;
|
|
672
684
|
if (value.state !== "ready" && value.services.length !== 0) return false;
|
|
673
685
|
const unitKeys = /* @__PURE__ */ new Set();
|
|
674
686
|
for (const unit of value.units) {
|
|
@@ -698,6 +710,7 @@ function validateSnapshot(value) {
|
|
|
698
710
|
function validateMessage(value) {
|
|
699
711
|
if (!record(value) || !text(value.type) || !validIdentity(value)) return false;
|
|
700
712
|
if (value.type === RUNTIME_SNAPSHOT_TYPE) return validateSnapshot(value);
|
|
713
|
+
if (value.binding !== void 0 && !validBinding(value.binding)) return false;
|
|
701
714
|
if (value.type === RUNTIME_ERROR_TYPE) return boundedText(value.code, MAX_ID_LENGTH) && boundedText(value.message, MAX_ERROR_MESSAGE_LENGTH) && phase(value.phase) && (value.pluginId === void 0 || boundedText(value.pluginId, MAX_ID_LENGTH)) && (value.unitId === void 0 || boundedText(value.unitId, MAX_ID_LENGTH));
|
|
702
715
|
if (value.type === RUNTIME_CALL_TYPE) return validServiceIdentity(value) && boundedText(value.capabilityId, MAX_ID_LENGTH) && boundedText(value.contractVersion, MAX_VERSION_LENGTH) && Object.hasOwn(value, "request") && validPayload(value.request) && (value.mode === "unary" || value.mode === "stream") && typeof value.timeoutMs === "number" && Number.isFinite(value.timeoutMs) && value.timeoutMs > 0 && value.timeoutMs <= 3e5 && (value.operationId === void 0 || boundedText(value.operationId, MAX_ID_LENGTH)) && (value.grantId === void 0 || boundedText(value.grantId, MAX_ID_LENGTH)) && (value.mode !== "stream" ? !Object.hasOwn(value, "initialCredit") : Number.isSafeInteger(value.initialCredit) && value.initialCredit >= 1 && value.initialCredit <= 256);
|
|
703
716
|
if (value.type === RUNTIME_RESULT_TYPE) return validServiceIdentity(value) && ((!Object.hasOwn(value, "result") || validPayload(value.result)) && (value.streamReady === true && !Object.hasOwn(value, "result") && !Object.hasOwn(value, "done") || value.done === true && !Object.hasOwn(value, "result") && !Object.hasOwn(value, "streamReady") || Object.hasOwn(value, "result") && !Object.hasOwn(value, "done") && !Object.hasOwn(value, "streamReady")));
|
|
@@ -705,6 +718,8 @@ function validateMessage(value) {
|
|
|
705
718
|
if (value.type === RUNTIME_CANCEL_TYPE) return validServiceIdentity(value);
|
|
706
719
|
if (value.type === RUNTIME_NEXT_TYPE) return validServiceIdentity(value) && Object.hasOwn(value, "item") && validPayload(value.item) && Number.isSafeInteger(value.sequence) && value.sequence >= 1;
|
|
707
720
|
if (value.type === RUNTIME_CREDIT_TYPE) return validServiceIdentity(value) && Number.isSafeInteger(value.count) && value.count >= 1 && value.count <= 256;
|
|
721
|
+
if (value.type === RUNTIME_CLOSE_TYPE) return !Object.hasOwn(value, "reason") && (value.timeoutMs === void 0 || Number.isFinite(value.timeoutMs) && value.timeoutMs >= 1 && value.timeoutMs <= 3e5);
|
|
722
|
+
if (value.type === RUNTIME_CLOSE_ACK_TYPE) return validBinding(value.acknowledgedBinding) && validDrainResult(value);
|
|
708
723
|
return false;
|
|
709
724
|
}
|
|
710
725
|
function validPayload(value) {
|
|
@@ -4019,6 +4034,6 @@ function hostForWindowApp(app) {
|
|
|
4019
4034
|
return host;
|
|
4020
4035
|
}
|
|
4021
4036
|
|
|
4022
|
-
export { DEFAULT_RUNTIME_LIMITS, LIFECYCLE_ERROR_TEXT, LifecycleScopeRevokedError, PermissionDeniedError, PermissionLeaseRevokedError, RESOURCE_OWNER, RESOURCE_REGISTRY, RUNTIME_CALL_TYPE, RUNTIME_CANCEL_TYPE, RUNTIME_CREDIT_TYPE, RUNTIME_ERROR_MESSAGE_TYPE, RUNTIME_ERROR_TYPE, RUNTIME_NEXT_TYPE, RUNTIME_PROTOCOL_VERSION, RUNTIME_RESULT_TYPE, RUNTIME_SNAPSHOT_TYPE, RuntimeInitializationError, RuntimeUnavailableError, SCOPED_TASK_SCHEDULER_CAPABILITY, StartupCapabilityError, StartupPluginError, UpgradeGateRejectedError, WebLoomError, assertCapability, assertReceivedPortSet, buildPluginGraph, capabilityDescriptor, capabilityKey, cloneFrozenAttributes, createCapabilityRegistry, createInMemoryPluginConfigStore, createLifecycleScope, createMessageBus, createPermissionLease, createPluginHost, createReceivePortLedger, createResourceRegistry, createResourceScope, createResourceStore, createRuntimeBudget, createRuntimeMessageCodec, createRuntimeUnitImplementationRegistry, createScopedTaskScheduler, createWindowApp, createWindowAppFromHost, defineCapability, dependenciesOfManifest, hostForWindowApp, invokeCapabilityHandler, isCapability, isCapabilityDescriptor, isRuntimeSnapshot, lifecycleErrorText, materializePluginDefinitions, normalizeRuntimeLimits, providesOfManifest, registerOwnedResource, reverseDependentsOf, selectRuntimeUnit, validateDto, validatePluginGraph, validateRawDto, validateTransferList, validateTransferListWithStats };
|
|
4023
|
-
//# sourceMappingURL=chunk-
|
|
4024
|
-
//# sourceMappingURL=chunk-
|
|
4037
|
+
export { DEFAULT_RUNTIME_LIMITS, LIFECYCLE_ERROR_TEXT, LifecycleScopeRevokedError, PermissionDeniedError, PermissionLeaseRevokedError, RESOURCE_OWNER, RESOURCE_REGISTRY, RUNTIME_CALL_TYPE, RUNTIME_CANCEL_TYPE, RUNTIME_CLOSE_ACK_TYPE, RUNTIME_CLOSE_TYPE, RUNTIME_CREDIT_TYPE, RUNTIME_ERROR_MESSAGE_TYPE, RUNTIME_ERROR_TYPE, RUNTIME_NEXT_TYPE, RUNTIME_PROTOCOL_VERSION, RUNTIME_RESULT_TYPE, RUNTIME_SNAPSHOT_TYPE, RuntimeInitializationError, RuntimeUnavailableError, SCOPED_TASK_SCHEDULER_CAPABILITY, StartupCapabilityError, StartupPluginError, UpgradeGateRejectedError, WebLoomError, assertCapability, assertReceivedPortSet, buildPluginGraph, capabilityDescriptor, capabilityKey, cloneFrozenAttributes, createCapabilityRegistry, createInMemoryPluginConfigStore, createLifecycleScope, createMessageBus, createPermissionLease, createPluginHost, createReceivePortLedger, createResourceRegistry, createResourceScope, createResourceStore, createRuntimeBudget, createRuntimeMessageCodec, createRuntimeUnitImplementationRegistry, createScopedTaskScheduler, createWindowApp, createWindowAppFromHost, defineCapability, dependenciesOfManifest, hostForWindowApp, invokeCapabilityHandler, isCapability, isCapabilityDescriptor, isRuntimeSnapshot, lifecycleErrorText, materializePluginDefinitions, normalizeRuntimeLimits, providesOfManifest, registerOwnedResource, reverseDependentsOf, selectRuntimeUnit, validateDto, validatePluginGraph, validateRawDto, validateTransferList, validateTransferListWithStats };
|
|
4038
|
+
//# sourceMappingURL=chunk-ZP5QYTXX.js.map
|
|
4039
|
+
//# sourceMappingURL=chunk-ZP5QYTXX.js.map
|