@innovatorstack/harness 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +59 -2
- package/assets/brand/icon-on-dark.png +0 -0
- package/assets/brand/icon.png +0 -0
- package/assets/brand/mark-on-dark.svg +6 -0
- package/assets/brand/mark.svg +6 -0
- package/assets/brand/social-preview.png +0 -0
- package/assets/brand/social-preview.svg +13 -0
- package/dist/baseline/catalog.d.ts +5 -0
- package/dist/baseline/catalog.d.ts.map +1 -0
- package/dist/baseline/catalog.js +32 -0
- package/dist/baseline/catalog.js.map +1 -0
- package/dist/baseline/data/item-types.json +1062 -0
- package/dist/baseline/data/properties.json +31286 -0
- package/dist/baseline/data/records.json +6666 -0
- package/dist/baseline/data/relationships.json +393 -0
- package/dist/baseline/database.bin +0 -0
- package/dist/baseline/database.d.ts +4 -0
- package/dist/baseline/database.d.ts.map +1 -0
- package/dist/baseline/database.js +33 -0
- package/dist/baseline/database.js.map +1 -0
- package/dist/baseline/source.d.ts +5 -0
- package/dist/baseline/source.d.ts.map +1 -0
- package/dist/baseline/source.js +13 -0
- package/dist/baseline/source.js.map +1 -0
- package/dist/compatibility/capabilities.d.ts +49 -0
- package/dist/compatibility/capabilities.d.ts.map +1 -0
- package/dist/compatibility/capabilities.js +605 -0
- package/dist/compatibility/capabilities.js.map +1 -0
- package/dist/compatibility/check.d.ts +5 -0
- package/dist/compatibility/check.d.ts.map +1 -0
- package/dist/compatibility/check.js +332 -0
- package/dist/compatibility/check.js.map +1 -0
- package/dist/compatibility/executions.d.ts +11 -0
- package/dist/compatibility/executions.d.ts.map +1 -0
- package/dist/compatibility/executions.js +79 -0
- package/dist/compatibility/executions.js.map +1 -0
- package/dist/compatibility/executors.d.ts +21 -0
- package/dist/compatibility/executors.d.ts.map +1 -0
- package/dist/compatibility/executors.js +151 -0
- package/dist/compatibility/executors.js.map +1 -0
- package/dist/compatibility/index.d.ts +6 -0
- package/dist/compatibility/index.d.ts.map +1 -0
- package/dist/compatibility/index.js +4 -0
- package/dist/compatibility/index.js.map +1 -0
- package/dist/compatibility/metadata.d.ts +6 -0
- package/dist/compatibility/metadata.d.ts.map +1 -0
- package/dist/compatibility/metadata.js +137 -0
- package/dist/compatibility/metadata.js.map +1 -0
- package/dist/compatibility/mocks.d.ts +4 -0
- package/dist/compatibility/mocks.d.ts.map +1 -0
- package/dist/compatibility/mocks.js +22 -0
- package/dist/compatibility/mocks.js.map +1 -0
- package/dist/compatibility/revisions.d.ts +5 -0
- package/dist/compatibility/revisions.d.ts.map +1 -0
- package/dist/compatibility/revisions.js +34 -0
- package/dist/compatibility/revisions.js.map +1 -0
- package/dist/compatibility/security.d.ts +6 -0
- package/dist/compatibility/security.d.ts.map +1 -0
- package/dist/compatibility/security.js +74 -0
- package/dist/compatibility/security.js.map +1 -0
- package/dist/compatibility/sources.d.ts +6 -0
- package/dist/compatibility/sources.d.ts.map +1 -0
- package/dist/compatibility/sources.js +20 -0
- package/dist/compatibility/sources.js.map +1 -0
- package/dist/compatibility/types.d.ts +130 -0
- package/dist/compatibility/types.d.ts.map +1 -0
- package/dist/compatibility/types.js +48 -0
- package/dist/compatibility/types.js.map +1 -0
- package/dist/controls/clock.d.ts +23 -0
- package/dist/controls/clock.d.ts.map +1 -0
- package/dist/controls/clock.js +74 -0
- package/dist/controls/clock.js.map +1 -0
- package/dist/controls/execution.d.ts +8 -0
- package/dist/controls/execution.d.ts.map +1 -0
- package/dist/controls/execution.js +36 -0
- package/dist/controls/execution.js.map +1 -0
- package/dist/controls/failure-types.d.ts +52 -0
- package/dist/controls/failure-types.d.ts.map +1 -0
- package/dist/controls/failure-types.js +15 -0
- package/dist/controls/failure-types.js.map +1 -0
- package/dist/controls/failure-validation.d.ts +17 -0
- package/dist/controls/failure-validation.d.ts.map +1 -0
- package/dist/controls/failure-validation.js +63 -0
- package/dist/controls/failure-validation.js.map +1 -0
- package/dist/controls/failures.d.ts +20 -0
- package/dist/controls/failures.d.ts.map +1 -0
- package/dist/controls/failures.js +128 -0
- package/dist/controls/failures.js.map +1 -0
- package/dist/controls/ids.d.ts +24 -0
- package/dist/controls/ids.d.ts.map +1 -0
- package/dist/controls/ids.js +63 -0
- package/dist/controls/ids.js.map +1 -0
- package/dist/controls/observers.d.ts +20 -0
- package/dist/controls/observers.d.ts.map +1 -0
- package/dist/controls/observers.js +80 -0
- package/dist/controls/observers.js.map +1 -0
- package/dist/controls/state.d.ts +10 -0
- package/dist/controls/state.d.ts.map +1 -0
- package/dist/controls/state.js +50 -0
- package/dist/controls/state.js.map +1 -0
- package/dist/controls/targets.d.ts +19 -0
- package/dist/controls/targets.d.ts.map +1 -0
- package/dist/controls/targets.js +82 -0
- package/dist/controls/targets.js.map +1 -0
- package/dist/controls/values.d.ts +23 -0
- package/dist/controls/values.d.ts.map +1 -0
- package/dist/controls/values.js +27 -0
- package/dist/controls/values.js.map +1 -0
- package/dist/controls/world.d.ts +18 -0
- package/dist/controls/world.d.ts.map +1 -0
- package/dist/controls/world.js +26 -0
- package/dist/controls/world.js.map +1 -0
- package/dist/core/budget.d.ts +9 -0
- package/dist/core/budget.d.ts.map +1 -0
- package/dist/core/budget.js +23 -0
- package/dist/core/budget.js.map +1 -0
- package/dist/core/context.d.ts +8 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +38 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/data.d.ts +16 -0
- package/dist/core/data.d.ts.map +1 -0
- package/dist/core/data.js +197 -0
- package/dist/core/data.js.map +1 -0
- package/dist/core/deadline.d.ts +12 -0
- package/dist/core/deadline.d.ts.map +1 -0
- package/dist/core/deadline.js +38 -0
- package/dist/core/deadline.js.map +1 -0
- package/dist/core/errors.d.ts +7 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +15 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/files.d.ts +8 -0
- package/dist/core/files.d.ts.map +1 -0
- package/dist/core/files.js +98 -0
- package/dist/core/files.js.map +1 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/limits.d.ts +15 -0
- package/dist/core/limits.d.ts.map +1 -0
- package/dist/core/limits.js +15 -0
- package/dist/core/limits.js.map +1 -0
- package/dist/core/modules.d.ts +3 -0
- package/dist/core/modules.d.ts.map +1 -0
- package/dist/core/modules.js +68 -0
- package/dist/core/modules.js.map +1 -0
- package/dist/core/operation.d.ts +18 -0
- package/dist/core/operation.d.ts.map +1 -0
- package/dist/core/operation.js +21 -0
- package/dist/core/operation.js.map +1 -0
- package/dist/core/process.d.ts +3 -0
- package/dist/core/process.d.ts.map +1 -0
- package/dist/core/process.js +44 -0
- package/dist/core/process.js.map +1 -0
- package/dist/core/resources.d.ts +3 -0
- package/dist/core/resources.d.ts.map +1 -0
- package/dist/core/resources.js +28 -0
- package/dist/core/resources.js.map +1 -0
- package/dist/core/runtime.d.ts +54 -0
- package/dist/core/runtime.d.ts.map +1 -0
- package/dist/core/runtime.js +565 -0
- package/dist/core/runtime.js.map +1 -0
- package/dist/core/types.d.ts +61 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +1 -0
- package/dist/core/types.js.map +1 -0
- package/dist/diagnostics/source-location.d.ts +7 -0
- package/dist/diagnostics/source-location.d.ts.map +1 -0
- package/dist/diagnostics/source-location.js +1 -0
- package/dist/diagnostics/source-location.js.map +1 -0
- package/dist/engine/instance.d.ts +57 -0
- package/dist/engine/instance.d.ts.map +1 -0
- package/dist/engine/instance.js +281 -0
- package/dist/engine/instance.js.map +1 -0
- package/dist/engine.d.ts +5 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +6 -0
- package/dist/engine.js.map +1 -0
- package/dist/fixtures/module.d.ts +5 -0
- package/dist/fixtures/module.d.ts.map +1 -0
- package/dist/fixtures/module.js +112 -0
- package/dist/fixtures/module.js.map +1 -0
- package/dist/fixtures/types.d.ts +7 -0
- package/dist/fixtures/types.d.ts.map +1 -0
- package/dist/fixtures/types.js +1 -0
- package/dist/fixtures/types.js.map +1 -0
- package/dist/harness/configuration.d.ts +53 -0
- package/dist/harness/configuration.d.ts.map +1 -0
- package/dist/harness/configuration.js +279 -0
- package/dist/harness/configuration.js.map +1 -0
- package/dist/harness/create.d.ts +5 -0
- package/dist/harness/create.d.ts.map +1 -0
- package/dist/harness/create.js +156 -0
- package/dist/harness/create.js.map +1 -0
- package/dist/harness/extensions.d.ts +8 -0
- package/dist/harness/extensions.d.ts.map +1 -0
- package/dist/harness/extensions.js +58 -0
- package/dist/harness/extensions.js.map +1 -0
- package/dist/harness/fixtures.d.ts +9 -0
- package/dist/harness/fixtures.d.ts.map +1 -0
- package/dist/harness/fixtures.js +130 -0
- package/dist/harness/fixtures.js.map +1 -0
- package/dist/harness/runtime-identity.d.ts +3 -0
- package/dist/harness/runtime-identity.d.ts.map +1 -0
- package/dist/harness/runtime-identity.js +30 -0
- package/dist/harness/runtime-identity.js.map +1 -0
- package/dist/harness/setup-cache.d.ts +11 -0
- package/dist/harness/setup-cache.d.ts.map +1 -0
- package/dist/harness/setup-cache.js +40 -0
- package/dist/harness/setup-cache.js.map +1 -0
- package/dist/harness/setup-image.d.ts +5 -0
- package/dist/harness/setup-image.d.ts.map +1 -0
- package/dist/harness/setup-image.js +118 -0
- package/dist/harness/setup-image.js.map +1 -0
- package/dist/harness/setup-imports.d.ts +3 -0
- package/dist/harness/setup-imports.d.ts.map +1 -0
- package/dist/harness/setup-imports.js +30 -0
- package/dist/harness/setup-imports.js.map +1 -0
- package/dist/harness/setup-inputs.d.ts +12 -0
- package/dist/harness/setup-inputs.d.ts.map +1 -0
- package/dist/harness/setup-inputs.js +47 -0
- package/dist/harness/setup-inputs.js.map +1 -0
- package/dist/harness/setup-module.d.ts +3 -0
- package/dist/harness/setup-module.d.ts.map +1 -0
- package/dist/harness/setup-module.js +150 -0
- package/dist/harness/setup-module.js.map +1 -0
- package/dist/harness/world.d.ts +36 -0
- package/dist/harness/world.d.ts.map +1 -0
- package/dist/harness/world.js +171 -0
- package/dist/harness/world.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/instrumentation/failures.d.ts +5 -0
- package/dist/instrumentation/failures.d.ts.map +1 -0
- package/dist/instrumentation/failures.js +94 -0
- package/dist/instrumentation/failures.js.map +1 -0
- package/dist/instrumentation/recorder.d.ts +38 -0
- package/dist/instrumentation/recorder.d.ts.map +1 -0
- package/dist/instrumentation/recorder.js +372 -0
- package/dist/instrumentation/recorder.js.map +1 -0
- package/dist/instrumentation/snapshots.d.ts +20 -0
- package/dist/instrumentation/snapshots.d.ts.map +1 -0
- package/dist/instrumentation/snapshots.js +177 -0
- package/dist/instrumentation/snapshots.js.map +1 -0
- package/dist/instrumentation/types.d.ts +107 -0
- package/dist/instrumentation/types.d.ts.map +1 -0
- package/dist/instrumentation/types.js +25 -0
- package/dist/instrumentation/types.js.map +1 -0
- package/dist/items/codec.d.ts +4 -0
- package/dist/items/codec.d.ts.map +1 -0
- package/dist/items/codec.js +137 -0
- package/dist/items/codec.js.map +1 -0
- package/dist/items/item.d.ts +58 -0
- package/dist/items/item.d.ts.map +1 -0
- package/dist/items/item.js +145 -0
- package/dist/items/item.js.map +1 -0
- package/dist/items/logical.d.ts +23 -0
- package/dist/items/logical.d.ts.map +1 -0
- package/dist/items/logical.js +92 -0
- package/dist/items/logical.js.map +1 -0
- package/dist/items/origins.d.ts +7 -0
- package/dist/items/origins.d.ts.map +1 -0
- package/dist/items/origins.js +102 -0
- package/dist/items/origins.js.map +1 -0
- package/dist/items/xml.d.ts +7 -0
- package/dist/items/xml.d.ts.map +1 -0
- package/dist/items/xml.js +134 -0
- package/dist/items/xml.js.map +1 -0
- package/dist/methods/csharp/base-input.d.ts +30 -0
- package/dist/methods/csharp/base-input.d.ts.map +1 -0
- package/dist/methods/csharp/base-input.js +140 -0
- package/dist/methods/csharp/base-input.js.map +1 -0
- package/dist/methods/csharp/cache.d.ts +3 -0
- package/dist/methods/csharp/cache.d.ts.map +1 -0
- package/dist/methods/csharp/cache.js +52 -0
- package/dist/methods/csharp/cache.js.map +1 -0
- package/dist/methods/csharp/callbacks.d.ts +12 -0
- package/dist/methods/csharp/callbacks.d.ts.map +1 -0
- package/dist/methods/csharp/callbacks.js +75 -0
- package/dist/methods/csharp/callbacks.js.map +1 -0
- package/dist/methods/csharp/compiler.d.ts +26 -0
- package/dist/methods/csharp/compiler.d.ts.map +1 -0
- package/dist/methods/csharp/compiler.js +253 -0
- package/dist/methods/csharp/compiler.js.map +1 -0
- package/dist/methods/csharp/context.d.ts +17 -0
- package/dist/methods/csharp/context.d.ts.map +1 -0
- package/dist/methods/csharp/context.js +65 -0
- package/dist/methods/csharp/context.js.map +1 -0
- package/dist/methods/csharp/documents.d.ts +13 -0
- package/dist/methods/csharp/documents.d.ts.map +1 -0
- package/dist/methods/csharp/documents.js +128 -0
- package/dist/methods/csharp/documents.js.map +1 -0
- package/dist/methods/csharp/executor.d.ts +35 -0
- package/dist/methods/csharp/executor.d.ts.map +1 -0
- package/dist/methods/csharp/executor.js +363 -0
- package/dist/methods/csharp/executor.js.map +1 -0
- package/dist/methods/csharp/index.d.ts +4 -0
- package/dist/methods/csharp/index.d.ts.map +1 -0
- package/dist/methods/csharp/index.js +3 -0
- package/dist/methods/csharp/index.js.map +1 -0
- package/dist/methods/csharp/managed/CallContext.cs +21 -0
- package/dist/methods/csharp/managed/Connections.cs +27 -0
- package/dist/methods/csharp/managed/ContextSafety.cs +219 -0
- package/dist/methods/csharp/managed/DomChanges.cs +39 -0
- package/dist/methods/csharp/managed/ErrorLookup.cs +28 -0
- package/dist/methods/csharp/managed/EventMetadata.cs +45 -0
- package/dist/methods/csharp/managed/GlobalUsings.cs.template +9 -0
- package/dist/methods/csharp/managed/Identity.cs +30 -0
- package/dist/methods/csharp/managed/InOut.cs.template +42 -0
- package/dist/methods/csharp/managed/InOutInvocation.cs +41 -0
- package/dist/methods/csharp/managed/Innovator.cs +106 -0
- package/dist/methods/csharp/managed/Item.cs +515 -0
- package/dist/methods/csharp/managed/ItemDocuments.cs +62 -0
- package/dist/methods/csharp/managed/ItemXml.cs +465 -0
- package/dist/methods/csharp/managed/LogicalData.cs +20 -0
- package/dist/methods/csharp/managed/LogicalXml.cs +181 -0
- package/dist/methods/csharp/managed/ManagedDocuments.cs +48 -0
- package/dist/methods/csharp/managed/Method.cs.template +30 -0
- package/dist/methods/csharp/managed/MethodAssemblies.cs +83 -0
- package/dist/methods/csharp/managed/MethodContext.cs +44 -0
- package/dist/methods/csharp/managed/MethodEventArgs.cs +64 -0
- package/dist/methods/csharp/managed/MethodInvocation.cs +201 -0
- package/dist/methods/csharp/managed/NuGet.Config +6 -0
- package/dist/methods/csharp/managed/PayloadXml.cs +38 -0
- package/dist/methods/csharp/managed/Permissions.cs +47 -0
- package/dist/methods/csharp/managed/Program.cs +83 -0
- package/dist/methods/csharp/managed/PropertyItems.cs +46 -0
- package/dist/methods/csharp/managed/Protocol.cs +204 -0
- package/dist/methods/csharp/managed/ProtocolInput.cs +67 -0
- package/dist/methods/csharp/managed/ProtocolJson.cs +13 -0
- package/dist/methods/csharp/managed/RemoteContext.cs +33 -0
- package/dist/methods/csharp/managed/RequestOrigins.cs +207 -0
- package/dist/methods/csharp/managed/RequestRelationships.cs +129 -0
- package/dist/methods/csharp/managed/RequestXml.cs +237 -0
- package/dist/methods/csharp/managed/ResponseXml.cs +114 -0
- package/dist/methods/csharp/managed/ServerEventArgs.cs +223 -0
- package/dist/methods/csharp/managed/WorkLimits.cs +11 -0
- package/dist/methods/csharp/managed/Worker.csproj +23 -0
- package/dist/methods/csharp/managed/XmlProperties.cs +32 -0
- package/dist/methods/csharp/managed/XmlTraversal.cs +138 -0
- package/dist/methods/csharp/method-build.d.ts +11 -0
- package/dist/methods/csharp/method-build.d.ts.map +1 -0
- package/dist/methods/csharp/method-build.js +96 -0
- package/dist/methods/csharp/method-build.js.map +1 -0
- package/dist/methods/csharp/origins.d.ts +17 -0
- package/dist/methods/csharp/origins.d.ts.map +1 -0
- package/dist/methods/csharp/origins.js +78 -0
- package/dist/methods/csharp/origins.js.map +1 -0
- package/dist/methods/csharp/protocol.d.ts +6 -0
- package/dist/methods/csharp/protocol.d.ts.map +1 -0
- package/dist/methods/csharp/protocol.js +78 -0
- package/dist/methods/csharp/protocol.js.map +1 -0
- package/dist/methods/csharp/relationship-order.d.ts +8 -0
- package/dist/methods/csharp/relationship-order.d.ts.map +1 -0
- package/dist/methods/csharp/relationship-order.js +51 -0
- package/dist/methods/csharp/relationship-order.js.map +1 -0
- package/dist/methods/csharp/request-change.d.ts +27 -0
- package/dist/methods/csharp/request-change.d.ts.map +1 -0
- package/dist/methods/csharp/request-change.js +238 -0
- package/dist/methods/csharp/request-change.js.map +1 -0
- package/dist/methods/csharp/retained-items.d.ts +9 -0
- package/dist/methods/csharp/retained-items.d.ts.map +1 -0
- package/dist/methods/csharp/retained-items.js +95 -0
- package/dist/methods/csharp/retained-items.js.map +1 -0
- package/dist/methods/csharp/security.d.ts +13 -0
- package/dist/methods/csharp/security.d.ts.map +1 -0
- package/dist/methods/csharp/security.js +82 -0
- package/dist/methods/csharp/security.js.map +1 -0
- package/dist/methods/csharp/templates.d.ts +5 -0
- package/dist/methods/csharp/templates.d.ts.map +1 -0
- package/dist/methods/csharp/templates.js +66 -0
- package/dist/methods/csharp/templates.js.map +1 -0
- package/dist/methods/csharp/worker.d.ts +31 -0
- package/dist/methods/csharp/worker.d.ts.map +1 -0
- package/dist/methods/csharp/worker.js +172 -0
- package/dist/methods/csharp/worker.js.map +1 -0
- package/dist/methods/event-data.d.ts +31 -0
- package/dist/methods/event-data.d.ts.map +1 -0
- package/dist/methods/event-data.js +8 -0
- package/dist/methods/event-data.js.map +1 -0
- package/dist/methods/types.d.ts +47 -0
- package/dist/methods/types.d.ts.map +1 -0
- package/dist/methods/types.js +2 -0
- package/dist/methods/types.js.map +1 -0
- package/dist/mocks/configuration.d.ts +5 -0
- package/dist/mocks/configuration.d.ts.map +1 -0
- package/dist/mocks/configuration.js +102 -0
- package/dist/mocks/configuration.js.map +1 -0
- package/dist/mocks/parameters.d.ts +3 -0
- package/dist/mocks/parameters.d.ts.map +1 -0
- package/dist/mocks/parameters.js +16 -0
- package/dist/mocks/parameters.js.map +1 -0
- package/dist/mocks/registry.d.ts +39 -0
- package/dist/mocks/registry.d.ts.map +1 -0
- package/dist/mocks/registry.js +129 -0
- package/dist/mocks/registry.js.map +1 -0
- package/dist/mocks/response.d.ts +10 -0
- package/dist/mocks/response.d.ts.map +1 -0
- package/dist/mocks/response.js +94 -0
- package/dist/mocks/response.js.map +1 -0
- package/dist/mocks/types.d.ts +34 -0
- package/dist/mocks/types.d.ts.map +1 -0
- package/dist/mocks/types.js +1 -0
- package/dist/mocks/types.js.map +1 -0
- package/dist/packages/bootstrap.d.ts +10 -0
- package/dist/packages/bootstrap.d.ts.map +1 -0
- package/dist/packages/bootstrap.js +66 -0
- package/dist/packages/bootstrap.js.map +1 -0
- package/dist/packages/candidates.d.ts +13 -0
- package/dist/packages/candidates.d.ts.map +1 -0
- package/dist/packages/candidates.js +43 -0
- package/dist/packages/candidates.js.map +1 -0
- package/dist/packages/defaults.d.ts +11 -0
- package/dist/packages/defaults.d.ts.map +1 -0
- package/dist/packages/defaults.js +104 -0
- package/dist/packages/defaults.js.map +1 -0
- package/dist/packages/diagnostics.d.ts +22 -0
- package/dist/packages/diagnostics.d.ts.map +1 -0
- package/dist/packages/diagnostics.js +25 -0
- package/dist/packages/diagnostics.js.map +1 -0
- package/dist/packages/draft.d.ts +66 -0
- package/dist/packages/draft.d.ts.map +1 -0
- package/dist/packages/draft.js +186 -0
- package/dist/packages/draft.js.map +1 -0
- package/dist/packages/elements.d.ts +11 -0
- package/dist/packages/elements.d.ts.map +1 -0
- package/dist/packages/elements.js +58 -0
- package/dist/packages/elements.js.map +1 -0
- package/dist/packages/evaluation.d.ts +16 -0
- package/dist/packages/evaluation.d.ts.map +1 -0
- package/dist/packages/evaluation.js +71 -0
- package/dist/packages/evaluation.js.map +1 -0
- package/dist/packages/files.d.ts +21 -0
- package/dist/packages/files.d.ts.map +1 -0
- package/dist/packages/files.js +214 -0
- package/dist/packages/files.js.map +1 -0
- package/dist/packages/importer.d.ts +23 -0
- package/dist/packages/importer.d.ts.map +1 -0
- package/dist/packages/importer.js +791 -0
- package/dist/packages/importer.js.map +1 -0
- package/dist/packages/index.d.ts +8 -0
- package/dist/packages/index.d.ts.map +1 -0
- package/dist/packages/index.js +6 -0
- package/dist/packages/index.js.map +1 -0
- package/dist/packages/manifest.d.ts +3 -0
- package/dist/packages/manifest.d.ts.map +1 -0
- package/dist/packages/manifest.js +84 -0
- package/dist/packages/manifest.js.map +1 -0
- package/dist/packages/module.d.ts +11 -0
- package/dist/packages/module.d.ts.map +1 -0
- package/dist/packages/module.js +14 -0
- package/dist/packages/module.js.map +1 -0
- package/dist/packages/parser.d.ts +12 -0
- package/dist/packages/parser.d.ts.map +1 -0
- package/dist/packages/parser.js +258 -0
- package/dist/packages/parser.js.map +1 -0
- package/dist/packages/plan.d.ts +55 -0
- package/dist/packages/plan.d.ts.map +1 -0
- package/dist/packages/plan.js +542 -0
- package/dist/packages/plan.js.map +1 -0
- package/dist/packages/schema.d.ts +9 -0
- package/dist/packages/schema.d.ts.map +1 -0
- package/dist/packages/schema.js +347 -0
- package/dist/packages/schema.js.map +1 -0
- package/dist/packages/selector.d.ts +9 -0
- package/dist/packages/selector.d.ts.map +1 -0
- package/dist/packages/selector.js +61 -0
- package/dist/packages/selector.js.map +1 -0
- package/dist/packages/state.d.ts +6 -0
- package/dist/packages/state.d.ts.map +1 -0
- package/dist/packages/state.js +62 -0
- package/dist/packages/state.js.map +1 -0
- package/dist/packages/types.d.ts +22 -0
- package/dist/packages/types.d.ts.map +1 -0
- package/dist/packages/types.js +1 -0
- package/dist/packages/types.js.map +1 -0
- package/dist/platform/action-responses.d.ts +14 -0
- package/dist/platform/action-responses.d.ts.map +1 -0
- package/dist/platform/action-responses.js +85 -0
- package/dist/platform/action-responses.js.map +1 -0
- package/dist/platform/actions.d.ts +12 -0
- package/dist/platform/actions.d.ts.map +1 -0
- package/dist/platform/actions.js +13 -0
- package/dist/platform/actions.js.map +1 -0
- package/dist/platform/catalog.d.ts +20 -0
- package/dist/platform/catalog.d.ts.map +1 -0
- package/dist/platform/catalog.js +155 -0
- package/dist/platform/catalog.js.map +1 -0
- package/dist/platform/classifications.d.ts +14 -0
- package/dist/platform/classifications.d.ts.map +1 -0
- package/dist/platform/classifications.js +100 -0
- package/dist/platform/classifications.js.map +1 -0
- package/dist/platform/creation.d.ts +4 -0
- package/dist/platform/creation.d.ts.map +1 -0
- package/dist/platform/creation.js +23 -0
- package/dist/platform/creation.js.map +1 -0
- package/dist/platform/engine.d.ts +127 -0
- package/dist/platform/engine.d.ts.map +1 -0
- package/dist/platform/engine.js +1210 -0
- package/dist/platform/engine.js.map +1 -0
- package/dist/platform/errors.d.ts +20 -0
- package/dist/platform/errors.d.ts.map +1 -0
- package/dist/platform/errors.js +28 -0
- package/dist/platform/errors.js.map +1 -0
- package/dist/platform/events/after.d.ts +22 -0
- package/dist/platform/events/after.d.ts.map +1 -0
- package/dist/platform/events/after.js +86 -0
- package/dist/platform/events/after.js.map +1 -0
- package/dist/platform/events/base-updates.d.ts +11 -0
- package/dist/platform/events/base-updates.d.ts.map +1 -0
- package/dist/platform/events/base-updates.js +43 -0
- package/dist/platform/events/base-updates.js.map +1 -0
- package/dist/platform/events/bindings.d.ts +13 -0
- package/dist/platform/events/bindings.d.ts.map +1 -0
- package/dist/platform/events/bindings.js +76 -0
- package/dist/platform/events/bindings.js.map +1 -0
- package/dist/platform/events/data.d.ts +5 -0
- package/dist/platform/events/data.d.ts.map +1 -0
- package/dist/platform/events/data.js +17 -0
- package/dist/platform/events/data.js.map +1 -0
- package/dist/platform/events/inheritance.d.ts +4 -0
- package/dist/platform/events/inheritance.d.ts.map +1 -0
- package/dist/platform/events/inheritance.js +56 -0
- package/dist/platform/events/inheritance.js.map +1 -0
- package/dist/platform/events/input.d.ts +5 -0
- package/dist/platform/events/input.d.ts.map +1 -0
- package/dist/platform/events/input.js +9 -0
- package/dist/platform/events/input.js.map +1 -0
- package/dist/platform/events/replacement.d.ts +14 -0
- package/dist/platform/events/replacement.d.ts.map +1 -0
- package/dist/platform/events/replacement.js +60 -0
- package/dist/platform/events/replacement.js.map +1 -0
- package/dist/platform/events/types.d.ts +31 -0
- package/dist/platform/events/types.d.ts.map +1 -0
- package/dist/platform/events/types.js +6 -0
- package/dist/platform/events/types.js.map +1 -0
- package/dist/platform/events/version.d.ts +5 -0
- package/dist/platform/events/version.d.ts.map +1 -0
- package/dist/platform/events/version.js +22 -0
- package/dist/platform/events/version.js.map +1 -0
- package/dist/platform/graph-actions.d.ts +18 -0
- package/dist/platform/graph-actions.d.ts.map +1 -0
- package/dist/platform/graph-actions.js +109 -0
- package/dist/platform/graph-actions.js.map +1 -0
- package/dist/platform/lifecycle.d.ts +40 -0
- package/dist/platform/lifecycle.d.ts.map +1 -0
- package/dist/platform/lifecycle.js +309 -0
- package/dist/platform/lifecycle.js.map +1 -0
- package/dist/platform/locks.d.ts +29 -0
- package/dist/platform/locks.d.ts.map +1 -0
- package/dist/platform/locks.js +150 -0
- package/dist/platform/locks.js.map +1 -0
- package/dist/platform/projection.d.ts +8 -0
- package/dist/platform/projection.d.ts.map +1 -0
- package/dist/platform/projection.js +165 -0
- package/dist/platform/projection.js.map +1 -0
- package/dist/platform/queries/conditions.d.ts +4 -0
- package/dist/platform/queries/conditions.d.ts.map +1 -0
- package/dist/platform/queries/conditions.js +48 -0
- package/dist/platform/queries/conditions.js.map +1 -0
- package/dist/platform/queries/engine.d.ts +16 -0
- package/dist/platform/queries/engine.d.ts.map +1 -0
- package/dist/platform/queries/engine.js +41 -0
- package/dist/platform/queries/engine.js.map +1 -0
- package/dist/platform/queries/fields.d.ts +7 -0
- package/dist/platform/queries/fields.d.ts.map +1 -0
- package/dist/platform/queries/fields.js +88 -0
- package/dist/platform/queries/fields.js.map +1 -0
- package/dist/platform/queries/order.d.ts +5 -0
- package/dist/platform/queries/order.d.ts.map +1 -0
- package/dist/platform/queries/order.js +69 -0
- package/dist/platform/queries/order.js.map +1 -0
- package/dist/platform/queries/paging.d.ts +9 -0
- package/dist/platform/queries/paging.d.ts.map +1 -0
- package/dist/platform/queries/paging.js +39 -0
- package/dist/platform/queries/paging.js.map +1 -0
- package/dist/platform/queries/planner.d.ts +8 -0
- package/dist/platform/queries/planner.d.ts.map +1 -0
- package/dist/platform/queries/planner.js +145 -0
- package/dist/platform/queries/planner.js.map +1 -0
- package/dist/platform/queries/relationships.d.ts +16 -0
- package/dist/platform/queries/relationships.d.ts.map +1 -0
- package/dist/platform/queries/relationships.js +84 -0
- package/dist/platform/queries/relationships.js.map +1 -0
- package/dist/platform/queries/validation.d.ts +5 -0
- package/dist/platform/queries/validation.d.ts.map +1 -0
- package/dist/platform/queries/validation.js +79 -0
- package/dist/platform/queries/validation.js.map +1 -0
- package/dist/platform/query.d.ts +10 -0
- package/dist/platform/query.d.ts.map +1 -0
- package/dist/platform/query.js +93 -0
- package/dist/platform/query.js.map +1 -0
- package/dist/platform/references/behavior.d.ts +11 -0
- package/dist/platform/references/behavior.d.ts.map +1 -0
- package/dist/platform/references/behavior.js +25 -0
- package/dist/platform/references/behavior.js.map +1 -0
- package/dist/platform/references/catalog.d.ts +23 -0
- package/dist/platform/references/catalog.d.ts.map +1 -0
- package/dist/platform/references/catalog.js +153 -0
- package/dist/platform/references/catalog.js.map +1 -0
- package/dist/platform/references/deletion.d.ts +20 -0
- package/dist/platform/references/deletion.d.ts.map +1 -0
- package/dist/platform/references/deletion.js +86 -0
- package/dist/platform/references/deletion.js.map +1 -0
- package/dist/platform/references/maintenance.d.ts +22 -0
- package/dist/platform/references/maintenance.d.ts.map +1 -0
- package/dist/platform/references/maintenance.js +113 -0
- package/dist/platform/references/maintenance.js.map +1 -0
- package/dist/platform/references/policy.d.ts +14 -0
- package/dist/platform/references/policy.d.ts.map +1 -0
- package/dist/platform/references/policy.js +76 -0
- package/dist/platform/references/policy.js.map +1 -0
- package/dist/platform/references/sessions.d.ts +20 -0
- package/dist/platform/references/sessions.d.ts.map +1 -0
- package/dist/platform/references/sessions.js +98 -0
- package/dist/platform/references/sessions.js.map +1 -0
- package/dist/platform/relationship-copy-policy.d.ts +10 -0
- package/dist/platform/relationship-copy-policy.d.ts.map +1 -0
- package/dist/platform/relationship-copy-policy.js +41 -0
- package/dist/platform/relationship-copy-policy.js.map +1 -0
- package/dist/platform/relationship-copy.d.ts +21 -0
- package/dist/platform/relationship-copy.d.ts.map +1 -0
- package/dist/platform/relationship-copy.js +146 -0
- package/dist/platform/relationship-copy.js.map +1 -0
- package/dist/platform/relationship-type.d.ts +3 -0
- package/dist/platform/relationship-type.d.ts.map +1 -0
- package/dist/platform/relationship-type.js +11 -0
- package/dist/platform/relationship-type.js.map +1 -0
- package/dist/platform/request.d.ts +7 -0
- package/dist/platform/request.d.ts.map +1 -0
- package/dist/platform/request.js +86 -0
- package/dist/platform/request.js.map +1 -0
- package/dist/platform/revisions/policy.d.ts +13 -0
- package/dist/platform/revisions/policy.d.ts.map +1 -0
- package/dist/platform/revisions/policy.js +69 -0
- package/dist/platform/revisions/policy.js.map +1 -0
- package/dist/platform/revisions/sequences.d.ts +12 -0
- package/dist/platform/revisions/sequences.d.ts.map +1 -0
- package/dist/platform/revisions/sequences.js +38 -0
- package/dist/platform/revisions/sequences.js.map +1 -0
- package/dist/platform/security/grants.d.ts +14 -0
- package/dist/platform/security/grants.d.ts.map +1 -0
- package/dist/platform/security/grants.js +83 -0
- package/dist/platform/security/grants.js.map +1 -0
- package/dist/platform/security/identities.d.ts +16 -0
- package/dist/platform/security/identities.d.ts.map +1 -0
- package/dist/platform/security/identities.js +99 -0
- package/dist/platform/security/identities.js.map +1 -0
- package/dist/platform/security/inherited-relationships.d.ts +15 -0
- package/dist/platform/security/inherited-relationships.d.ts.map +1 -0
- package/dist/platform/security/inherited-relationships.js +70 -0
- package/dist/platform/security/inherited-relationships.js.map +1 -0
- package/dist/platform/security/method-execution.d.ts +12 -0
- package/dist/platform/security/method-execution.d.ts.map +1 -0
- package/dist/platform/security/method-execution.js +24 -0
- package/dist/platform/security/method-execution.js.map +1 -0
- package/dist/platform/security/permissions.d.ts +34 -0
- package/dist/platform/security/permissions.d.ts.map +1 -0
- package/dist/platform/security/permissions.js +188 -0
- package/dist/platform/security/permissions.js.map +1 -0
- package/dist/platform/security/policy.d.ts +39 -0
- package/dist/platform/security/policy.d.ts.map +1 -0
- package/dist/platform/security/policy.js +168 -0
- package/dist/platform/security/policy.js.map +1 -0
- package/dist/platform/security/source-access.d.ts +19 -0
- package/dist/platform/security/source-access.d.ts.map +1 -0
- package/dist/platform/security/source-access.js +72 -0
- package/dist/platform/security/source-access.js.map +1 -0
- package/dist/platform/security/source-inheritance.d.ts +19 -0
- package/dist/platform/security/source-inheritance.d.ts.map +1 -0
- package/dist/platform/security/source-inheritance.js +87 -0
- package/dist/platform/security/source-inheritance.js.map +1 -0
- package/dist/platform/security/system-identities.d.ts +4 -0
- package/dist/platform/security/system-identities.d.ts.map +1 -0
- package/dist/platform/security/system-identities.js +12 -0
- package/dist/platform/security/system-identities.js.map +1 -0
- package/dist/platform/security/teams.d.ts +15 -0
- package/dist/platform/security/teams.d.ts.map +1 -0
- package/dist/platform/security/teams.js +68 -0
- package/dist/platform/security/teams.js.map +1 -0
- package/dist/platform/security/time.d.ts +4 -0
- package/dist/platform/security/time.d.ts.map +1 -0
- package/dist/platform/security/time.js +26 -0
- package/dist/platform/security/time.js.map +1 -0
- package/dist/platform/security/types.d.ts +12 -0
- package/dist/platform/security/types.d.ts.map +1 -0
- package/dist/platform/security/types.js +6 -0
- package/dist/platform/security/types.js.map +1 -0
- package/dist/platform/trace.d.ts +41 -0
- package/dist/platform/trace.d.ts.map +1 -0
- package/dist/platform/trace.js +46 -0
- package/dist/platform/trace.js.map +1 -0
- package/dist/platform/unlocking.d.ts +27 -0
- package/dist/platform/unlocking.d.ts.map +1 -0
- package/dist/platform/unlocking.js +192 -0
- package/dist/platform/unlocking.js.map +1 -0
- package/dist/platform/values.d.ts +17 -0
- package/dist/platform/values.d.ts.map +1 -0
- package/dist/platform/values.js +105 -0
- package/dist/platform/values.js.map +1 -0
- package/dist/platform/version-policy.d.ts +4 -0
- package/dist/platform/version-policy.d.ts.map +1 -0
- package/dist/platform/version-policy.js +11 -0
- package/dist/platform/version-policy.js.map +1 -0
- package/dist/platform/versioned-request.d.ts +18 -0
- package/dist/platform/versioned-request.d.ts.map +1 -0
- package/dist/platform/versioned-request.js +95 -0
- package/dist/platform/versioned-request.js.map +1 -0
- package/dist/platform/versioning.d.ts +57 -0
- package/dist/platform/versioning.d.ts.map +1 -0
- package/dist/platform/versioning.js +441 -0
- package/dist/platform/versioning.js.map +1 -0
- package/dist/queries/date.d.ts +3 -0
- package/dist/queries/date.d.ts.map +1 -0
- package/dist/queries/date.js +20 -0
- package/dist/queries/date.js.map +1 -0
- package/dist/queries/decimal.d.ts +9 -0
- package/dist/queries/decimal.d.ts.map +1 -0
- package/dist/queries/decimal.js +42 -0
- package/dist/queries/decimal.js.map +1 -0
- package/dist/queries/evaluate.d.ts +9 -0
- package/dist/queries/evaluate.d.ts.map +1 -0
- package/dist/queries/evaluate.js +122 -0
- package/dist/queries/evaluate.js.map +1 -0
- package/dist/queries/lexer.d.ts +14 -0
- package/dist/queries/lexer.d.ts.map +1 -0
- package/dist/queries/lexer.js +87 -0
- package/dist/queries/lexer.js.map +1 -0
- package/dist/queries/like.d.ts +3 -0
- package/dist/queries/like.d.ts.map +1 -0
- package/dist/queries/like.js +35 -0
- package/dist/queries/like.js.map +1 -0
- package/dist/queries/parser.d.ts +28 -0
- package/dist/queries/parser.d.ts.map +1 -0
- package/dist/queries/parser.js +271 -0
- package/dist/queries/parser.js.map +1 -0
- package/dist/queries/predicates.d.ts +7 -0
- package/dist/queries/predicates.d.ts.map +1 -0
- package/dist/queries/predicates.js +62 -0
- package/dist/queries/predicates.js.map +1 -0
- package/dist/queries/types.d.ts +65 -0
- package/dist/queries/types.d.ts.map +1 -0
- package/dist/queries/types.js +25 -0
- package/dist/queries/types.js.map +1 -0
- package/dist/queries/values.d.ts +5 -0
- package/dist/queries/values.d.ts.map +1 -0
- package/dist/queries/values.js +77 -0
- package/dist/queries/values.js.map +1 -0
- package/dist/storage/documents.d.ts +5 -0
- package/dist/storage/documents.d.ts.map +1 -0
- package/dist/storage/documents.js +12 -0
- package/dist/storage/documents.js.map +1 -0
- package/dist/storage/metadata-epoch.d.ts +6 -0
- package/dist/storage/metadata-epoch.d.ts.map +1 -0
- package/dist/storage/metadata-epoch.js +15 -0
- package/dist/storage/metadata-epoch.js.map +1 -0
- package/dist/storage/package-transaction.d.ts +5 -0
- package/dist/storage/package-transaction.d.ts.map +1 -0
- package/dist/storage/package-transaction.js +12 -0
- package/dist/storage/package-transaction.js.map +1 -0
- package/dist/storage/properties.d.ts +4 -0
- package/dist/storage/properties.d.ts.map +1 -0
- package/dist/storage/properties.js +21 -0
- package/dist/storage/properties.js.map +1 -0
- package/dist/storage/sqlite/catalog.d.ts +19 -0
- package/dist/storage/sqlite/catalog.d.ts.map +1 -0
- package/dist/storage/sqlite/catalog.js +62 -0
- package/dist/storage/sqlite/catalog.js.map +1 -0
- package/dist/storage/sqlite/connections.d.ts +5 -0
- package/dist/storage/sqlite/connections.d.ts.map +1 -0
- package/dist/storage/sqlite/connections.js +36 -0
- package/dist/storage/sqlite/connections.js.map +1 -0
- package/dist/storage/sqlite/errors.d.ts +7 -0
- package/dist/storage/sqlite/errors.d.ts.map +1 -0
- package/dist/storage/sqlite/errors.js +9 -0
- package/dist/storage/sqlite/errors.js.map +1 -0
- package/dist/storage/sqlite/index.d.ts +5 -0
- package/dist/storage/sqlite/index.d.ts.map +1 -0
- package/dist/storage/sqlite/index.js +3 -0
- package/dist/storage/sqlite/index.js.map +1 -0
- package/dist/storage/sqlite/metadata.d.ts +8 -0
- package/dist/storage/sqlite/metadata.d.ts.map +1 -0
- package/dist/storage/sqlite/metadata.js +157 -0
- package/dist/storage/sqlite/metadata.js.map +1 -0
- package/dist/storage/sqlite/predicate.d.ts +9 -0
- package/dist/storage/sqlite/predicate.d.ts.map +1 -0
- package/dist/storage/sqlite/predicate.js +214 -0
- package/dist/storage/sqlite/predicate.js.map +1 -0
- package/dist/storage/sqlite/queries.d.ts +12 -0
- package/dist/storage/sqlite/queries.d.ts.map +1 -0
- package/dist/storage/sqlite/queries.js +30 -0
- package/dist/storage/sqlite/queries.js.map +1 -0
- package/dist/storage/sqlite/schema.d.ts +16 -0
- package/dist/storage/sqlite/schema.d.ts.map +1 -0
- package/dist/storage/sqlite/schema.js +197 -0
- package/dist/storage/sqlite/schema.js.map +1 -0
- package/dist/storage/sqlite/statements.d.ts +13 -0
- package/dist/storage/sqlite/statements.d.ts.map +1 -0
- package/dist/storage/sqlite/statements.js +35 -0
- package/dist/storage/sqlite/statements.js.map +1 -0
- package/dist/storage/sqlite/storage.d.ts +61 -0
- package/dist/storage/sqlite/storage.d.ts.map +1 -0
- package/dist/storage/sqlite/storage.js +644 -0
- package/dist/storage/sqlite/storage.js.map +1 -0
- package/dist/storage/sqlite/transactions.d.ts +23 -0
- package/dist/storage/sqlite/transactions.d.ts.map +1 -0
- package/dist/storage/sqlite/transactions.js +84 -0
- package/dist/storage/sqlite/transactions.js.map +1 -0
- package/dist/storage/types.d.ts +62 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +1 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/verification/diagnostics.d.ts +4 -0
- package/dist/verification/diagnostics.d.ts.map +1 -0
- package/dist/verification/diagnostics.js +106 -0
- package/dist/verification/diagnostics.js.map +1 -0
- package/dist/verification/index.d.ts +4 -0
- package/dist/verification/index.d.ts.map +1 -0
- package/dist/verification/index.js +3 -0
- package/dist/verification/index.js.map +1 -0
- package/dist/verification/inspection.d.ts +13 -0
- package/dist/verification/inspection.d.ts.map +1 -0
- package/dist/verification/inspection.js +87 -0
- package/dist/verification/inspection.js.map +1 -0
- package/dist/verification/inventory.d.ts +7 -0
- package/dist/verification/inventory.d.ts.map +1 -0
- package/dist/verification/inventory.js +55 -0
- package/dist/verification/inventory.js.map +1 -0
- package/dist/verification/types.d.ts +53 -0
- package/dist/verification/types.d.ts.map +1 -0
- package/dist/verification/types.js +12 -0
- package/dist/verification/types.js.map +1 -0
- package/dist/verification/verify.d.ts +4 -0
- package/dist/verification/verify.d.ts.map +1 -0
- package/dist/verification/verify.js +69 -0
- package/dist/verification/verify.js.map +1 -0
- package/examples/basic/.harness/fixtures.ts +5 -0
- package/examples/basic/.harness/packages/documents.xml +16 -0
- package/examples/basic/README.md +13 -0
- package/examples/basic/package.json +12 -0
- package/examples/basic/tests/documents.test.ts +19 -0
- package/examples/basic/tsconfig.json +15 -0
- package/examples/server-methods/.harness/fixtures.ts +18 -0
- package/examples/server-methods/.harness/mocks.json +6 -0
- package/examples/server-methods/.harness/packages/review.xml +69 -0
- package/examples/server-methods/README.md +14 -0
- package/examples/server-methods/package.json +12 -0
- package/examples/server-methods/tests/submission.test.ts +60 -0
- package/examples/server-methods/tsconfig.json +15 -0
- package/package.json +106 -5
- package/skills/innovator-harness/SKILL.md +109 -0
- package/skills/innovator-harness/agents/openai.yaml +7 -0
- package/skills/innovator-harness/assets/icon-small.png +0 -0
- package/skills/innovator-harness/assets/icon.png +0 -0
- package/src/baseline/catalog.ts +42 -0
- package/src/baseline/data/item-types.json +1062 -0
- package/src/baseline/data/properties.json +31286 -0
- package/src/baseline/data/records.json +6666 -0
- package/src/baseline/data/relationships.json +393 -0
- package/src/baseline/database.ts +39 -0
- package/src/baseline/source.ts +16 -0
- package/src/compatibility/capabilities.ts +626 -0
- package/src/compatibility/check.ts +483 -0
- package/src/compatibility/executions.ts +120 -0
- package/src/compatibility/executors.ts +180 -0
- package/src/compatibility/index.ts +22 -0
- package/src/compatibility/metadata.ts +219 -0
- package/src/compatibility/mocks.ts +32 -0
- package/src/compatibility/revisions.ts +45 -0
- package/src/compatibility/security.ts +102 -0
- package/src/compatibility/sources.ts +38 -0
- package/src/compatibility/types.ts +153 -0
- package/src/controls/clock.ts +108 -0
- package/src/controls/execution.ts +53 -0
- package/src/controls/failure-types.ts +61 -0
- package/src/controls/failure-validation.ts +99 -0
- package/src/controls/failures.ts +192 -0
- package/src/controls/ids.ts +87 -0
- package/src/controls/observers.ts +107 -0
- package/src/controls/state.ts +91 -0
- package/src/controls/targets.ts +123 -0
- package/src/controls/values.ts +44 -0
- package/src/controls/world.ts +31 -0
- package/src/core/budget.ts +25 -0
- package/src/core/context.ts +68 -0
- package/src/core/data.ts +273 -0
- package/src/core/deadline.ts +47 -0
- package/src/core/errors.ts +32 -0
- package/src/core/files.ts +45 -0
- package/src/core/index.ts +17 -0
- package/src/core/limits.ts +14 -0
- package/src/core/modules.ts +102 -0
- package/src/core/operation.ts +43 -0
- package/src/core/process.ts +55 -0
- package/src/core/resources.ts +34 -0
- package/src/core/runtime.ts +883 -0
- package/src/core/types.ts +80 -0
- package/src/diagnostics/source-location.ts +6 -0
- package/src/engine/instance.ts +428 -0
- package/src/engine.ts +9 -0
- package/src/fixtures/module.ts +182 -0
- package/src/fixtures/types.ts +9 -0
- package/src/harness/configuration.ts +426 -0
- package/src/harness/create.ts +214 -0
- package/src/harness/extensions.ts +86 -0
- package/src/harness/fixtures.ts +186 -0
- package/src/harness/runtime-identity.ts +41 -0
- package/src/harness/setup-cache.ts +56 -0
- package/src/harness/setup-image.ts +155 -0
- package/src/harness/setup-imports.ts +40 -0
- package/src/harness/setup-inputs.ts +80 -0
- package/src/harness/setup-module.ts +118 -0
- package/src/harness/world.ts +248 -0
- package/src/index.ts +84 -0
- package/src/instrumentation/failures.ts +148 -0
- package/src/instrumentation/recorder.ts +547 -0
- package/src/instrumentation/snapshots.ts +247 -0
- package/src/instrumentation/types.ts +126 -0
- package/src/items/codec.ts +198 -0
- package/src/items/item.ts +218 -0
- package/src/items/logical.ts +145 -0
- package/src/items/origins.ts +139 -0
- package/src/items/xml.ts +187 -0
- package/src/methods/csharp/base-input.ts +215 -0
- package/src/methods/csharp/cache.ts +67 -0
- package/src/methods/csharp/callbacks.ts +121 -0
- package/src/methods/csharp/compiler.ts +284 -0
- package/src/methods/csharp/context.ts +88 -0
- package/src/methods/csharp/documents.ts +186 -0
- package/src/methods/csharp/executor.ts +504 -0
- package/src/methods/csharp/index.ts +3 -0
- package/src/methods/csharp/method-build.ts +141 -0
- package/src/methods/csharp/origins.ts +126 -0
- package/src/methods/csharp/protocol.ts +104 -0
- package/src/methods/csharp/relationship-order.ts +76 -0
- package/src/methods/csharp/request-change.ts +349 -0
- package/src/methods/csharp/retained-items.ts +128 -0
- package/src/methods/csharp/security.ts +121 -0
- package/src/methods/csharp/templates.ts +92 -0
- package/src/methods/csharp/worker.ts +234 -0
- package/src/methods/event-data.ts +39 -0
- package/src/methods/types.ts +59 -0
- package/src/mocks/configuration.ts +158 -0
- package/src/mocks/parameters.ts +20 -0
- package/src/mocks/registry.ts +214 -0
- package/src/mocks/response.ts +128 -0
- package/src/mocks/types.ts +56 -0
- package/src/packages/bootstrap.ts +73 -0
- package/src/packages/candidates.ts +55 -0
- package/src/packages/defaults.ts +145 -0
- package/src/packages/diagnostics.ts +47 -0
- package/src/packages/draft.ts +280 -0
- package/src/packages/elements.ts +88 -0
- package/src/packages/evaluation.ts +89 -0
- package/src/packages/files.ts +332 -0
- package/src/packages/importer.ts +1257 -0
- package/src/packages/index.ts +7 -0
- package/src/packages/manifest.ts +158 -0
- package/src/packages/module.ts +36 -0
- package/src/packages/parser.ts +367 -0
- package/src/packages/plan.ts +872 -0
- package/src/packages/schema.ts +617 -0
- package/src/packages/selector.ts +104 -0
- package/src/packages/state.ts +82 -0
- package/src/packages/types.ts +25 -0
- package/src/platform/action-responses.ts +127 -0
- package/src/platform/actions.ts +11 -0
- package/src/platform/catalog.ts +220 -0
- package/src/platform/classifications.ts +165 -0
- package/src/platform/creation.ts +37 -0
- package/src/platform/engine.ts +2055 -0
- package/src/platform/errors.ts +39 -0
- package/src/platform/events/after.ts +149 -0
- package/src/platform/events/base-updates.ts +68 -0
- package/src/platform/events/bindings.ts +129 -0
- package/src/platform/events/data.ts +26 -0
- package/src/platform/events/inheritance.ts +98 -0
- package/src/platform/events/input.ts +12 -0
- package/src/platform/events/replacement.ts +109 -0
- package/src/platform/events/types.ts +56 -0
- package/src/platform/events/version.ts +38 -0
- package/src/platform/graph-actions.ts +198 -0
- package/src/platform/lifecycle.ts +549 -0
- package/src/platform/locks.ts +251 -0
- package/src/platform/projection.ts +262 -0
- package/src/platform/queries/conditions.ts +69 -0
- package/src/platform/queries/engine.ts +69 -0
- package/src/platform/queries/fields.ts +160 -0
- package/src/platform/queries/order.ts +105 -0
- package/src/platform/queries/paging.ts +66 -0
- package/src/platform/queries/planner.ts +244 -0
- package/src/platform/queries/relationships.ts +130 -0
- package/src/platform/queries/validation.ts +105 -0
- package/src/platform/query.ts +178 -0
- package/src/platform/references/behavior.ts +36 -0
- package/src/platform/references/catalog.ts +256 -0
- package/src/platform/references/deletion.ts +130 -0
- package/src/platform/references/maintenance.ts +175 -0
- package/src/platform/references/policy.ts +115 -0
- package/src/platform/references/sessions.ts +148 -0
- package/src/platform/relationship-copy-policy.ts +66 -0
- package/src/platform/relationship-copy.ts +218 -0
- package/src/platform/relationship-type.ts +23 -0
- package/src/platform/request.ts +139 -0
- package/src/platform/revisions/policy.ts +126 -0
- package/src/platform/revisions/sequences.ts +67 -0
- package/src/platform/security/grants.ts +116 -0
- package/src/platform/security/identities.ts +136 -0
- package/src/platform/security/inherited-relationships.ts +103 -0
- package/src/platform/security/method-execution.ts +34 -0
- package/src/platform/security/permissions.ts +337 -0
- package/src/platform/security/policy.ts +286 -0
- package/src/platform/security/source-access.ts +148 -0
- package/src/platform/security/source-inheritance.ts +134 -0
- package/src/platform/security/system-identities.ts +16 -0
- package/src/platform/security/teams.ts +100 -0
- package/src/platform/security/time.ts +30 -0
- package/src/platform/security/types.ts +17 -0
- package/src/platform/trace.ts +111 -0
- package/src/platform/unlocking.ts +295 -0
- package/src/platform/values.ts +217 -0
- package/src/platform/version-policy.ts +17 -0
- package/src/platform/versioned-request.ts +154 -0
- package/src/platform/versioning.ts +798 -0
- package/src/queries/date.ts +28 -0
- package/src/queries/decimal.ts +59 -0
- package/src/queries/evaluate.ts +168 -0
- package/src/queries/lexer.ts +109 -0
- package/src/queries/like.ts +47 -0
- package/src/queries/parser.ts +352 -0
- package/src/queries/predicates.ts +85 -0
- package/src/queries/types.ts +82 -0
- package/src/queries/values.ts +104 -0
- package/src/storage/documents.ts +20 -0
- package/src/storage/metadata-epoch.ts +20 -0
- package/src/storage/package-transaction.ts +25 -0
- package/src/storage/properties.ts +31 -0
- package/src/storage/sqlite/catalog.ts +89 -0
- package/src/storage/sqlite/connections.ts +49 -0
- package/src/storage/sqlite/errors.ts +23 -0
- package/src/storage/sqlite/index.ts +13 -0
- package/src/storage/sqlite/metadata.ts +216 -0
- package/src/storage/sqlite/predicate.ts +301 -0
- package/src/storage/sqlite/queries.ts +48 -0
- package/src/storage/sqlite/schema.ts +288 -0
- package/src/storage/sqlite/statements.ts +51 -0
- package/src/storage/sqlite/storage.ts +949 -0
- package/src/storage/sqlite/transactions.ts +108 -0
- package/src/storage/types.ts +69 -0
- package/src/verification/diagnostics.ts +124 -0
- package/src/verification/index.ts +10 -0
- package/src/verification/inspection.ts +108 -0
- package/src/verification/inventory.ts +76 -0
- package/src/verification/types.ts +61 -0
- package/src/verification/verify.ts +11 -0
|
@@ -0,0 +1,1210 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
import { capabilityForLanguage } from "../compatibility/capabilities.js";
|
|
54
|
+
import { assertActiveContext, spendContext } from "../core/context.js";
|
|
55
|
+
import { cloneFrozenData, setOwn } from "../core/data.js";
|
|
56
|
+
import { defineOperation } from "../core/operation.js";
|
|
57
|
+
import { Item, itemNode } from "../items/item.js";
|
|
58
|
+
import { parseItems } from "../items/xml.js";
|
|
59
|
+
import { MethodEventDataKind } from "../methods/event-data.js";
|
|
60
|
+
import { properties } from "../mocks/registry.js";
|
|
61
|
+
import { ActionResponses } from "./action-responses.js";
|
|
62
|
+
import { ItemAction } from "./actions.js";
|
|
63
|
+
import { PlatformCatalog } from "./catalog.js";
|
|
64
|
+
import { creationDefaults } from "./creation.js";
|
|
65
|
+
import { ApplicationError, PlatformError, requireSuccess } from "./errors.js";
|
|
66
|
+
import { AfterEvents } from "./events/after.js";
|
|
67
|
+
import { BaseUpdates } from "./events/base-updates.js";
|
|
68
|
+
import { afterAddFrames, afterUpdateFrames } from "./events/data.js";
|
|
69
|
+
import { requestDocument } from "./events/input.js";
|
|
70
|
+
import { EventReplacements } from "./events/replacement.js";
|
|
71
|
+
import { ServerEventVersion } from "./events/types.js";
|
|
72
|
+
import { GraphActions } from "./graph-actions.js";
|
|
73
|
+
import { LifeCycles } from "./lifecycle.js";
|
|
74
|
+
import { ItemLocks } from "./locks.js";
|
|
75
|
+
import { compileProjection } from "./projection.js";
|
|
76
|
+
import { ItemQueries } from "./queries/engine.js";
|
|
77
|
+
import { matches, projectedProperties, selectedProperties } from "./query.js";
|
|
78
|
+
import { DependentDeletion } from "./references/deletion.js";
|
|
79
|
+
import { ReferenceMaintenance } from "./references/maintenance.js";
|
|
80
|
+
import { relationshipType } from "./relationship-type.js";
|
|
81
|
+
import { validateRequest } from "./request.js";
|
|
82
|
+
import { Revisions } from "./revisions/policy.js";
|
|
83
|
+
import { NativeSecurity } from "./security/policy.js";
|
|
84
|
+
import { AuthorizationMode } from "./security/types.js";
|
|
85
|
+
import { PlatformTrace } from "./trace.js";
|
|
86
|
+
import { normalizeProperties } from "./values.js";
|
|
87
|
+
import { manualVersioning } from "./version-policy.js";
|
|
88
|
+
import { Versioning } from "./versioning.js";
|
|
89
|
+
export const applyItemOperation = defineOperation("platform.apply");
|
|
90
|
+
const applyBaseItemOperation = defineOperation("platform.event-base");
|
|
91
|
+
export const callMethodOperation = defineOperation("platform.method");
|
|
92
|
+
export const seedOperation = defineOperation("platform.seed");
|
|
93
|
+
export const seedRecordsOperation = defineOperation("platform.seedRecords");
|
|
94
|
+
export const applyAMLOperation = defineOperation("platform.aml");
|
|
95
|
+
const applySqlOperation = defineOperation("platform.sql");
|
|
96
|
+
const deleteOwnedItemOperation = defineOperation("platform.delete-owned");
|
|
97
|
+
const actions = new Set(Object.values(ItemAction));
|
|
98
|
+
const reservedActions = new Set(["copy", "clone", "merge", "purge", "create", "SQL Process"]);
|
|
99
|
+
const claimedExecutors = new WeakSet();
|
|
100
|
+
var BoundMethodKind;
|
|
101
|
+
(function (BoundMethodKind) {
|
|
102
|
+
BoundMethodKind["Replacement"] = "replacement";
|
|
103
|
+
BoundMethodKind["Callback"] = "callback";
|
|
104
|
+
})(BoundMethodKind || (BoundMethodKind = {}));
|
|
105
|
+
function dispatchItem(item, context) {
|
|
106
|
+
return context.execute(applyItemOperation, item);
|
|
107
|
+
}
|
|
108
|
+
export class Platform {
|
|
109
|
+
storage;
|
|
110
|
+
options;
|
|
111
|
+
trace;
|
|
112
|
+
now;
|
|
113
|
+
catalog;
|
|
114
|
+
executors = new Map();
|
|
115
|
+
ownedExecutors = new Set();
|
|
116
|
+
identity = Symbol("Harness world");
|
|
117
|
+
generation = 0;
|
|
118
|
+
nextId;
|
|
119
|
+
locks;
|
|
120
|
+
versioning;
|
|
121
|
+
lifeCycles;
|
|
122
|
+
revisions;
|
|
123
|
+
queries;
|
|
124
|
+
graph;
|
|
125
|
+
references;
|
|
126
|
+
deletion;
|
|
127
|
+
security;
|
|
128
|
+
responses;
|
|
129
|
+
replacements = new EventReplacements();
|
|
130
|
+
boundMethods = new WeakMap();
|
|
131
|
+
baseOverrides = new WeakMap();
|
|
132
|
+
baseUpdates = new BaseUpdates();
|
|
133
|
+
afterEvents;
|
|
134
|
+
constructor(storage, options = {}, trace = new PlatformTrace(), now = () => new Date(), select) {
|
|
135
|
+
this.storage = storage;
|
|
136
|
+
this.options = options;
|
|
137
|
+
this.trace = trace;
|
|
138
|
+
this.now = now;
|
|
139
|
+
this.catalog = new PlatformCatalog(storage);
|
|
140
|
+
this.responses = new ActionResponses(dispatchItem, (type) => this.hasAfterEvents(type));
|
|
141
|
+
this.security = new NativeSecurity(storage, options.authorization, options.userId, now, this.trace, this.catalog.classifications);
|
|
142
|
+
this.references = new ReferenceMaintenance(storage, this.trace);
|
|
143
|
+
this.deletion = this.createDependentDeletion();
|
|
144
|
+
this.graph = new GraphActions(storage, dispatchItem);
|
|
145
|
+
this.queries = new ItemQueries(storage, dispatchItem, select, (definition, records, context) => this.security.readable(definition, records, context));
|
|
146
|
+
this.nextId =
|
|
147
|
+
options.nextId ?? (() => crypto.randomUUID().replaceAll("-", "").toUpperCase());
|
|
148
|
+
this.afterEvents = this.createAfterEvents();
|
|
149
|
+
const runners = this.eventRunners();
|
|
150
|
+
const events = runners.item;
|
|
151
|
+
this.locks = new ItemLocks(storage, this.trace, events, options.userId, dispatchItem, this.references.catalog, select);
|
|
152
|
+
this.lifeCycles = new LifeCycles(storage, this.trace, events, (name, item, context) => context.execute(callMethodOperation, { name, context: item }), this.references, this.security, this.catalog.classifications);
|
|
153
|
+
this.revisions = new Revisions(storage);
|
|
154
|
+
this.versioning = new Versioning(storage, this.trace, this.locks, runners, this.nextId, this.graph, this.references, this.deletion, this.revisions, this.lifeCycles, this.security);
|
|
155
|
+
this.registerExecutors(options.executors ?? []);
|
|
156
|
+
}
|
|
157
|
+
createDependentDeletion() {
|
|
158
|
+
return new DependentDeletion(this.storage, this.references.catalog, this.references.sessions, dispatchItem, (parent, child, enabled, context) => context.execute(deleteOwnedItemOperation, { parent, child, enabled }));
|
|
159
|
+
}
|
|
160
|
+
createAfterEvents() {
|
|
161
|
+
return new AfterEvents((definition, name, enabled, version) => this.eventBindings(definition, name, enabled, version), (binding, name, item, context, data) => this.invokeEvent(binding, name, item, context, data), dispatchItem);
|
|
162
|
+
}
|
|
163
|
+
eventRunners() {
|
|
164
|
+
return {
|
|
165
|
+
item: (definition, name, item, enabled, context, data) => this.events(definition, name, item, enabled, context, ServerEventVersion.Item, data),
|
|
166
|
+
after: (definition, name, items, enabled, context) => this.afterEvents.run(definition, name, items, enabled, context),
|
|
167
|
+
update: (definition, request, context, applyBase) => this.updateEvent(definition, request, context, applyBase),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
registerExecutors(executors) {
|
|
171
|
+
for (const executor of executors) {
|
|
172
|
+
const language = executor.language.toLowerCase();
|
|
173
|
+
if (this.executors.has(language)) {
|
|
174
|
+
throw new PlatformError("DuplicateExecutor", `Multiple executors for '${executor.language}'.`);
|
|
175
|
+
}
|
|
176
|
+
this.executors.set(language, executor);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
module() {
|
|
180
|
+
return {
|
|
181
|
+
id: "platform",
|
|
182
|
+
requires: ["packages"],
|
|
183
|
+
setup: (registrar) => {
|
|
184
|
+
this.setupPlatform(registrar);
|
|
185
|
+
},
|
|
186
|
+
reset: () => {
|
|
187
|
+
this.generation += 1;
|
|
188
|
+
this.security.reset();
|
|
189
|
+
this.trace.reset();
|
|
190
|
+
for (const executor of this.ownedExecutors) {
|
|
191
|
+
executor.reset?.();
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
dispose: () => {
|
|
195
|
+
const errors = [];
|
|
196
|
+
for (const executor of this.ownedExecutors) {
|
|
197
|
+
try {
|
|
198
|
+
executor.dispose?.();
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
errors.push(error);
|
|
202
|
+
}
|
|
203
|
+
finally {
|
|
204
|
+
claimedExecutors.delete(executor);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
this.ownedExecutors.clear();
|
|
208
|
+
if (errors.length) {
|
|
209
|
+
throw new AggregateError(errors, "Executor cleanup failed.");
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
inspect(reference) {
|
|
215
|
+
this.assertReference(reference);
|
|
216
|
+
const item = this.storage.getItem(reference.type, reference.id);
|
|
217
|
+
if (!item) {
|
|
218
|
+
throw new PlatformError("MissingItem", `Record '${reference.type}:${reference.id}' no longer exists.`);
|
|
219
|
+
}
|
|
220
|
+
return item;
|
|
221
|
+
}
|
|
222
|
+
item(reference, action = "get") {
|
|
223
|
+
const stored = this.inspect(reference);
|
|
224
|
+
return new Item({
|
|
225
|
+
items: [
|
|
226
|
+
{
|
|
227
|
+
...itemNode(stored.type, action),
|
|
228
|
+
attributes: { id: stored.id, action },
|
|
229
|
+
properties: { ...stored.properties },
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
find(type, properties) {
|
|
235
|
+
const definition = this.catalog.itemType(type);
|
|
236
|
+
for (const name of Object.keys(properties)) {
|
|
237
|
+
if (name !== "id" &&
|
|
238
|
+
!definition.properties.some((property) => property.name === name)) {
|
|
239
|
+
throw new PlatformError("UnknownProperty", `Unknown selector '${definition.name}.${name}'.`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const records = this.storage
|
|
243
|
+
.listItems(definition.name)
|
|
244
|
+
.filter((record) => Object.entries(properties).every(([name, value]) => matches(this.storage, definition, record, { name, value })));
|
|
245
|
+
const record = records[0];
|
|
246
|
+
if (records.length !== 1 || !record) {
|
|
247
|
+
throw new PlatformError("ItemResolution", `Inspection of '${definition.name}' matched ${records.length} records; expected one.`);
|
|
248
|
+
}
|
|
249
|
+
return Object.freeze({
|
|
250
|
+
id: record.id,
|
|
251
|
+
type: definition.name,
|
|
252
|
+
world: this.identity,
|
|
253
|
+
generation: this.generation,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
assertReference(reference) {
|
|
257
|
+
if (reference.world !== this.identity || reference.generation !== this.generation) {
|
|
258
|
+
throw new PlatformError("InvalidReference", "Record reference belongs to a different world or a baseline before reset. Resolve it again from the current world.");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
seed(input, context, graph) {
|
|
262
|
+
const definition = this.catalog.itemType(input.type);
|
|
263
|
+
this.catalog.assertMutable(definition);
|
|
264
|
+
const properties = {};
|
|
265
|
+
this.resolveSeedProperties(definition, input.properties, properties, context);
|
|
266
|
+
const id = graph?.id ?? this.nextId();
|
|
267
|
+
const defaults = { config_id: id, generation: 1, is_current: 1 };
|
|
268
|
+
for (const [name, value] of Object.entries(defaults)) {
|
|
269
|
+
if (definition.properties.some((property) => property.name === name) &&
|
|
270
|
+
properties[name] === undefined) {
|
|
271
|
+
setOwn(properties, name, value);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
const item = {
|
|
275
|
+
id,
|
|
276
|
+
type: definition.name,
|
|
277
|
+
properties: normalizeProperties(this.storage, definition, this.lifeCycles.seedProperties(definition, {
|
|
278
|
+
...this.revisions.initial(definition, properties),
|
|
279
|
+
...properties,
|
|
280
|
+
}), {
|
|
281
|
+
creating: true,
|
|
282
|
+
id,
|
|
283
|
+
...(graph ? { pendingReferences: graph.targets } : {}),
|
|
284
|
+
}),
|
|
285
|
+
};
|
|
286
|
+
assertActiveContext(context);
|
|
287
|
+
this.storage.insertItem(item);
|
|
288
|
+
this.trace.record(context, {
|
|
289
|
+
kind: "seed",
|
|
290
|
+
name: definition.name,
|
|
291
|
+
after: item,
|
|
292
|
+
});
|
|
293
|
+
return Object.freeze({
|
|
294
|
+
id,
|
|
295
|
+
type: definition.name,
|
|
296
|
+
world: this.identity,
|
|
297
|
+
generation: this.generation,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
resolveSeedProperties(definition, input, properties, context) {
|
|
301
|
+
for (const [name, value] of Object.entries(input)) {
|
|
302
|
+
spendContext(context);
|
|
303
|
+
if (typeof value === "object" && value !== null) {
|
|
304
|
+
this.assertReference(value);
|
|
305
|
+
this.inspect(value);
|
|
306
|
+
const property = definition.properties.find((property) => property.name === name);
|
|
307
|
+
const target = property?.dataSource
|
|
308
|
+
? this.storage.listItemTypes().find((type) => type.id === property.dataSource)
|
|
309
|
+
: undefined;
|
|
310
|
+
if (property?.dataType !== "item" ||
|
|
311
|
+
(target && target.name.toLowerCase() !== value.type.toLowerCase())) {
|
|
312
|
+
throw new PlatformError("InvalidReference", `Record reference is not valid for '${definition.name}.${name}'.`);
|
|
313
|
+
}
|
|
314
|
+
setOwn(properties, name, value.id);
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
setOwn(properties, name, value);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
async authorize(request, restricted, context) {
|
|
322
|
+
if (this.options.authorization === AuthorizationMode.Native) {
|
|
323
|
+
this.security.authorize(request, context);
|
|
324
|
+
}
|
|
325
|
+
else if (this.options.authorization === AuthorizationMode.Unchecked) {
|
|
326
|
+
this.trace.record(context, {
|
|
327
|
+
kind: "authorization",
|
|
328
|
+
name: "explicitly unchecked",
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
else if (this.options.authorization) {
|
|
332
|
+
await this.options.authorization(request);
|
|
333
|
+
}
|
|
334
|
+
else if (restricted) {
|
|
335
|
+
throw new PlatformError("AuthorizationRequired", `Authorization rules exist for '${request.name}'. Supply an authorization policy or explicitly choose unchecked execution for a behavior-only test.`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
async callBoundMethod(input, context, kind = BoundMethodKind.Replacement) {
|
|
339
|
+
assertActiveContext(context);
|
|
340
|
+
this.boundMethods.set(input, kind);
|
|
341
|
+
try {
|
|
342
|
+
return await context.execute(callMethodOperation, input);
|
|
343
|
+
}
|
|
344
|
+
finally {
|
|
345
|
+
this.boundMethods.delete(input);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
async authorizeMethod(input, name, entry, context, checkExecutionIdentity) {
|
|
349
|
+
if (!checkExecutionIdentity && this.security.enabled) {
|
|
350
|
+
this.security.authorizeMethodSession(context);
|
|
351
|
+
this.trace.record(context, { kind: "authorization", name: "native Method NoCheck" });
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
await this.authorize({ kind: "method", name, item: input.context }, checkExecutionIdentity && Boolean(entry?.properties.execution_allowed_to), context);
|
|
355
|
+
}
|
|
356
|
+
async callMethod(input, context) {
|
|
357
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
358
|
+
try {
|
|
359
|
+
const permissions = __addDisposableResource(env_1, this.security.methods.enter(context, this.boundMethods.has(input)), false);
|
|
360
|
+
const entry = this.catalog.methodEntry(input.name);
|
|
361
|
+
const name = typeof entry?.properties.name === "string" ? entry.properties.name : input.name;
|
|
362
|
+
const names = [input.name, name];
|
|
363
|
+
if (entry) {
|
|
364
|
+
names.push(entry.id);
|
|
365
|
+
}
|
|
366
|
+
const mocked = this.options.mocks?.method(names, input.context);
|
|
367
|
+
if (mocked) {
|
|
368
|
+
await this.authorizeMethod(input, name, entry, context, permissions.checkExecutionIdentity);
|
|
369
|
+
return this.checkedMethodResult(input, this.mockedMethodResult(name, entry, mocked, context));
|
|
370
|
+
}
|
|
371
|
+
const definition = this.catalog.method(input.name);
|
|
372
|
+
const source = {
|
|
373
|
+
source: definition.source,
|
|
374
|
+
sourceHash: definition.hash,
|
|
375
|
+
definition: { type: "Method", id: definition.id },
|
|
376
|
+
};
|
|
377
|
+
this.trace.record(context, { kind: "method", name: definition.name, ...source });
|
|
378
|
+
await this.authorizeMethod(input, definition.name, entry, context, permissions.checkExecutionIdentity);
|
|
379
|
+
const executor = this.executorFor(definition);
|
|
380
|
+
return this.checkedMethodResult(input, await this.executeMethod(executor, definition, input.context, source, context, input.eventData));
|
|
381
|
+
}
|
|
382
|
+
catch (e_1) {
|
|
383
|
+
env_1.error = e_1;
|
|
384
|
+
env_1.hasError = true;
|
|
385
|
+
}
|
|
386
|
+
finally {
|
|
387
|
+
__disposeResources(env_1);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
checkedMethodResult(input, result) {
|
|
391
|
+
if (this.boundMethods.get(input) === BoundMethodKind.Callback && result.isError()) {
|
|
392
|
+
throw new ApplicationError(result);
|
|
393
|
+
}
|
|
394
|
+
return result;
|
|
395
|
+
}
|
|
396
|
+
async executeMethod(executor, definition, item, source, context, data) {
|
|
397
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
398
|
+
try {
|
|
399
|
+
let executed = false;
|
|
400
|
+
let acceptingSignals = true;
|
|
401
|
+
const identityScope = __addDisposableResource(env_2, this.security.grants.scope(context), false);
|
|
402
|
+
const eventScope = __addDisposableResource(env_2, this.replacements.scope(definition.id, context), false);
|
|
403
|
+
const executionStarted = () => {
|
|
404
|
+
if (acceptingSignals && !executed) {
|
|
405
|
+
executed = true;
|
|
406
|
+
this.trace.record(context, { kind: "execution", name: definition.name, ...source });
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
try {
|
|
410
|
+
const result = await executor.execute(definition, item, {
|
|
411
|
+
...this.methodPorts(definition, item, context, executionStarted),
|
|
412
|
+
security: identityScope,
|
|
413
|
+
...(eventScope ? { serverEvent: eventScope } : {}),
|
|
414
|
+
...(data ? { eventData: cloneFrozenData(data) } : {}),
|
|
415
|
+
});
|
|
416
|
+
// An adapter that completes execution provides evidence even without an early-start
|
|
417
|
+
// signal.
|
|
418
|
+
executionStarted();
|
|
419
|
+
if (result.isError() && result.getErrorCode() !== "0") {
|
|
420
|
+
this.trace.record(context, {
|
|
421
|
+
kind: "result",
|
|
422
|
+
name: definition.name,
|
|
423
|
+
result: result.payload,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
return requireSuccess(result);
|
|
427
|
+
}
|
|
428
|
+
finally {
|
|
429
|
+
acceptingSignals = false;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
catch (e_2) {
|
|
433
|
+
env_2.error = e_2;
|
|
434
|
+
env_2.hasError = true;
|
|
435
|
+
}
|
|
436
|
+
finally {
|
|
437
|
+
__disposeResources(env_2);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
executorFor(definition) {
|
|
441
|
+
const executor = this.executors.get(definition.language.toLowerCase());
|
|
442
|
+
const capability = capabilityForLanguage(definition.language);
|
|
443
|
+
if (!executor) {
|
|
444
|
+
throw new PlatformError("MissingExecutor", `Method '${definition.name}' requires a '${definition.language}' executor ` +
|
|
445
|
+
`(${definition.source.file}:${definition.source.line}).`, capability !== undefined ? { capability } : undefined);
|
|
446
|
+
}
|
|
447
|
+
return executor;
|
|
448
|
+
}
|
|
449
|
+
mockResult(name, mock, context, source) {
|
|
450
|
+
this.trace.record(context, {
|
|
451
|
+
kind: "mock",
|
|
452
|
+
name,
|
|
453
|
+
...source,
|
|
454
|
+
result: mock.result.payload,
|
|
455
|
+
mock: {
|
|
456
|
+
definition: mock.definition,
|
|
457
|
+
responseHash: mock.responseHash,
|
|
458
|
+
parameters: mock.parameters,
|
|
459
|
+
...(mock.responseFile ? { responseFile: mock.responseFile } : {}),
|
|
460
|
+
},
|
|
461
|
+
});
|
|
462
|
+
return requireSuccess(mock.result);
|
|
463
|
+
}
|
|
464
|
+
eventBindings(definition, name, enabled, version = ServerEventVersion.Item) {
|
|
465
|
+
return this.catalog.events(definition, name, enabled, version);
|
|
466
|
+
}
|
|
467
|
+
hasAfterEvents(type) {
|
|
468
|
+
const definition = this.catalog.itemType(type);
|
|
469
|
+
const names = [
|
|
470
|
+
"onAfterAdd",
|
|
471
|
+
"onAfterUpdate",
|
|
472
|
+
"onAfterMethod",
|
|
473
|
+
"onAfterLock",
|
|
474
|
+
"onAfterUnlock",
|
|
475
|
+
];
|
|
476
|
+
return names.some((name) => [ServerEventVersion.Item, ServerEventVersion.Collection].some((version) => this.eventBindings(definition, name, true, version).length > 0));
|
|
477
|
+
}
|
|
478
|
+
async events(definition, name, item, enabled, context, version = ServerEventVersion.Item, data) {
|
|
479
|
+
const bindings = [...this.eventBindings(definition, name, enabled, version)];
|
|
480
|
+
if (data?.kind === MethodEventDataKind.BeforeUpdate) {
|
|
481
|
+
bindings.push(...this.eventBindings(definition, name, enabled, ServerEventVersion.Collection));
|
|
482
|
+
bindings.sort((left, right) => Number(left.entry.properties.sort_order ?? 0) -
|
|
483
|
+
Number(right.entry.properties.sort_order ?? 0));
|
|
484
|
+
}
|
|
485
|
+
for (const binding of bindings) {
|
|
486
|
+
if (binding.version === ServerEventVersion.Collection && data) {
|
|
487
|
+
await this.invokeEvent(binding, name, Item.create(""), context, data);
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
if (version === ServerEventVersion.Item) {
|
|
491
|
+
await this.hydrateEventItem(name, item, context);
|
|
492
|
+
}
|
|
493
|
+
await this.invokeEvent(binding, name, item, context, data);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
async invokeEvent(binding, name, item, context, data) {
|
|
497
|
+
this.trace.record(context, { kind: "event", name, source: binding.entry.source });
|
|
498
|
+
// Callbacks share their input; the separate response supplies faults, not input patches.
|
|
499
|
+
await this.callBoundMethod({
|
|
500
|
+
name: binding.methodId,
|
|
501
|
+
context: item,
|
|
502
|
+
...(data ? { eventData: data } : {}),
|
|
503
|
+
}, context, BoundMethodKind.Callback);
|
|
504
|
+
}
|
|
505
|
+
async hydrateEventItem(name, item, context) {
|
|
506
|
+
if (name === "onAfterGet") {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (item.getItemCount() !== 1) {
|
|
510
|
+
throw new PlatformError("InvalidServerEventContext", `Event '${name}' requires one current document Item.`);
|
|
511
|
+
}
|
|
512
|
+
const node = item.node;
|
|
513
|
+
if (!node.attributes.id ||
|
|
514
|
+
Object.keys(node.attributes).length !== 1 ||
|
|
515
|
+
Object.keys(node.properties).length > 0 ||
|
|
516
|
+
Object.keys(node.propertyItems).length > 0 ||
|
|
517
|
+
Object.keys(node.propertyAttributes).length > 0 ||
|
|
518
|
+
node.relationships.length > 0 ||
|
|
519
|
+
(node.logical?.length ?? 0) > 0) {
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
const request = Item.create(node.type, "get");
|
|
523
|
+
request.setProperty("id", node.attributes.id);
|
|
524
|
+
const result = requireSuccess(await dispatchItem(request, context));
|
|
525
|
+
if (result.isError() || result.getItemCount() === 0) {
|
|
526
|
+
throw new ApplicationError(Item.error(`Cannot load '${node.type}:${node.attributes.id}' for '${name}'.`, "ItemNotFound"));
|
|
527
|
+
}
|
|
528
|
+
item.payload.items = result.getItemByIndex(0).clone().payload.items;
|
|
529
|
+
}
|
|
530
|
+
async apply(item, context, baseEvent) {
|
|
531
|
+
const request = item.node;
|
|
532
|
+
const action = request.attributes.action ?? "get";
|
|
533
|
+
if (request.type.toLowerCase() === "sql" && /^sql\s+process$/i.test(action)) {
|
|
534
|
+
return this.applySqlProcess(item, context);
|
|
535
|
+
}
|
|
536
|
+
if (reservedActions.has(action)) {
|
|
537
|
+
throw new PlatformError("UnsupportedAction", `Platform action '${action}' is not implemented.`);
|
|
538
|
+
}
|
|
539
|
+
if (!actions.has(action)) {
|
|
540
|
+
return await context.execute(callMethodOperation, {
|
|
541
|
+
name: action,
|
|
542
|
+
context: item,
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
const definition = this.catalog.itemType(request.type);
|
|
546
|
+
validateRequest(request, action);
|
|
547
|
+
if (action !== "get") {
|
|
548
|
+
this.responses.prepare(request, context);
|
|
549
|
+
}
|
|
550
|
+
this.traceAction(definition, item, action, context);
|
|
551
|
+
const enabled = this.baseUpdates.enabled(item) ?? request.attributes.serverEvents !== "0";
|
|
552
|
+
this.assertActionSupported(definition, action);
|
|
553
|
+
await this.authorizeAction(definition, action, item, context);
|
|
554
|
+
if (["lock", "unlock", "promoteItem"].includes(action)) {
|
|
555
|
+
return await this.applyStateAction(definition, item, context, baseEvent);
|
|
556
|
+
}
|
|
557
|
+
const verb = ["edit", "version"].includes(action)
|
|
558
|
+
? "Update"
|
|
559
|
+
: action[0]?.toUpperCase() + action.slice(1);
|
|
560
|
+
if (!["get", "add"].includes(action) &&
|
|
561
|
+
!(definition.isVersionable && ["edit", "update", "version"].includes(action))) {
|
|
562
|
+
return await this.mutateExisting(definition, item, verb, enabled, context, baseEvent);
|
|
563
|
+
}
|
|
564
|
+
return await this.applyStandardAction(definition, item, verb, enabled, context, baseEvent);
|
|
565
|
+
}
|
|
566
|
+
async applyStandardAction(definition, item, verb, enabled, context, baseEvent) {
|
|
567
|
+
const action = item.getAction();
|
|
568
|
+
if (definition.isVersionable && ["edit", "update", "version"].includes(action)) {
|
|
569
|
+
return await this.applyVersionedUpdate(definition, item, context);
|
|
570
|
+
}
|
|
571
|
+
const replacement = await this.replaceAction(definition, item, verb, enabled, context, baseEvent);
|
|
572
|
+
if (replacement) {
|
|
573
|
+
return replacement;
|
|
574
|
+
}
|
|
575
|
+
// The default action retains this node while callbacks share its changing document.
|
|
576
|
+
const request = item.node;
|
|
577
|
+
if (action === "add") {
|
|
578
|
+
this.prepareAddId(request, context);
|
|
579
|
+
}
|
|
580
|
+
const targetId = request.attributes.id;
|
|
581
|
+
const responseRequest = { ...request, attributes: { ...request.attributes } };
|
|
582
|
+
await this.events(definition, `onBefore${verb}`, requestDocument(item), enabled, context);
|
|
583
|
+
validateRequest(request, action);
|
|
584
|
+
this.assertActionContext(definition, request, action, targetId);
|
|
585
|
+
if (action === "get") {
|
|
586
|
+
return await this.get(definition, request, enabled, context);
|
|
587
|
+
}
|
|
588
|
+
return await this.add(definition, new Item({ items: [request] }), enabled, responseRequest, context);
|
|
589
|
+
}
|
|
590
|
+
prepareAddId(request, context) {
|
|
591
|
+
assertActiveContext(context);
|
|
592
|
+
if (request.attributes.id) {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
request.attributes.id = this.nextId();
|
|
596
|
+
}
|
|
597
|
+
assertActionContext(definition, request, action, targetId) {
|
|
598
|
+
if (request.type.toLowerCase() !== definition.name.toLowerCase() ||
|
|
599
|
+
(request.attributes.action ?? "get") !== action ||
|
|
600
|
+
(action !== "get" && targetId !== undefined && request.attributes.id !== targetId)) {
|
|
601
|
+
throw new PlatformError("UnsupportedContextChange", "A before event cannot change the ItemType, action or captured target ID.");
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
async authorizeAction(definition, action, item, context) {
|
|
605
|
+
let restricted = false;
|
|
606
|
+
if (this.options.authorization === undefined) {
|
|
607
|
+
const metadata = this.storage.getCatalogEntry("ItemType", definition.id);
|
|
608
|
+
restricted =
|
|
609
|
+
this.storage
|
|
610
|
+
.listCatalogEntries("Allowed Permission")
|
|
611
|
+
.some((entry) => entry.properties.source_id === definition.id) ||
|
|
612
|
+
metadata?.properties.use_src_access === "1";
|
|
613
|
+
}
|
|
614
|
+
await this.authorize({ kind: "action", name: `${definition.name}.${action}`, item }, restricted, context);
|
|
615
|
+
}
|
|
616
|
+
traceAction(definition, item, action, context) {
|
|
617
|
+
this.trace.record(context, {
|
|
618
|
+
kind: "action",
|
|
619
|
+
name: `${definition.name}.${action}`,
|
|
620
|
+
request: item.payload,
|
|
621
|
+
...(definition.source ? { source: definition.source } : {}),
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
async applyStateAction(definition, item, context, baseEvent) {
|
|
625
|
+
const action = item.getAction();
|
|
626
|
+
let verb = "Unlock";
|
|
627
|
+
if (action === "promoteItem") {
|
|
628
|
+
verb = "Promote";
|
|
629
|
+
}
|
|
630
|
+
else if (action === "lock") {
|
|
631
|
+
verb = "Lock";
|
|
632
|
+
}
|
|
633
|
+
const replacement = await this.replaceAction(definition, item, verb, item.getAttribute("serverEvents") !== "0", context, baseEvent);
|
|
634
|
+
if (replacement) {
|
|
635
|
+
return replacement;
|
|
636
|
+
}
|
|
637
|
+
const records = await this.query(definition, item.node, context);
|
|
638
|
+
if (!records.length) {
|
|
639
|
+
throw new ApplicationError(Item.error(`No '${definition.name}' records match this ${action} request.`, "NoItems"));
|
|
640
|
+
}
|
|
641
|
+
const result = [];
|
|
642
|
+
for (const record of records) {
|
|
643
|
+
const response = await this.applyStateTarget(definition, record, item, context);
|
|
644
|
+
result.push(...response.payload.items);
|
|
645
|
+
}
|
|
646
|
+
return await this.responses.complete(item.node, new Item({ items: result }), context);
|
|
647
|
+
}
|
|
648
|
+
async applyStateTarget(definition, record, item, context) {
|
|
649
|
+
const action = item.getAction();
|
|
650
|
+
this.security.assertMutation(definition, record, action, context);
|
|
651
|
+
if (definition.isVersionable) {
|
|
652
|
+
this.versioning.assertCurrent(record);
|
|
653
|
+
}
|
|
654
|
+
if (action === "promoteItem") {
|
|
655
|
+
this.locks.assertAvailable(record);
|
|
656
|
+
return await this.lifeCycles.promote(definition, record, item, context, (transition) => this.authorizeTransition(transition, record, item, context));
|
|
657
|
+
}
|
|
658
|
+
return await this.locks.base(definition, record, action === "lock" ? "lock" : "unlock", context, item);
|
|
659
|
+
}
|
|
660
|
+
async authorizeTransition(transition, record, item, context) {
|
|
661
|
+
if (this.security.enabled) {
|
|
662
|
+
this.security.transition(transition, record, context);
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
await this.authorize({ kind: "transition", name: transition.id, item }, Boolean(transition.properties.role), context);
|
|
666
|
+
}
|
|
667
|
+
applySqlProcess(item, context) {
|
|
668
|
+
const name = item.getProperty("name");
|
|
669
|
+
const mocked = this.options.mocks?.sql(name, properties(item));
|
|
670
|
+
if (mocked) {
|
|
671
|
+
return this.mockResult(`SQL Process: ${name}`, mocked, context, this.sqlSource(name));
|
|
672
|
+
}
|
|
673
|
+
return this.unsupportedSqlProcess(item, context);
|
|
674
|
+
}
|
|
675
|
+
unsupportedSqlProcess(item, context) {
|
|
676
|
+
const name = item.getProperty("name");
|
|
677
|
+
const definitions = this.storage
|
|
678
|
+
.listCatalogEntries("SQL")
|
|
679
|
+
.filter((definition) => String(definition.properties.name).toLowerCase() === name.toLowerCase());
|
|
680
|
+
const definition = definitions[0];
|
|
681
|
+
if (definitions.length !== 1 || !definition) {
|
|
682
|
+
throw new PlatformError("SqlResolution", `SQL '${name}' resolved to ${definitions.length} imported definitions.`);
|
|
683
|
+
}
|
|
684
|
+
const body = definition.properties.sqlserver_body;
|
|
685
|
+
if (typeof body !== "string") {
|
|
686
|
+
throw new PlatformError("InvalidSqlDefinition", `SQL '${name}' has no sqlserver_body source.`);
|
|
687
|
+
}
|
|
688
|
+
this.trace.record(context, {
|
|
689
|
+
kind: "action",
|
|
690
|
+
name: `SQL Process: ${name}`,
|
|
691
|
+
source: definition.source,
|
|
692
|
+
sourceHash: new Bun.CryptoHasher("sha256").update(body).digest("hex"),
|
|
693
|
+
definition: { type: "SQL", id: definition.id },
|
|
694
|
+
});
|
|
695
|
+
throw new PlatformError("UnsupportedSQL", `T-SQL execution is not implemented for '${name}' (${definition.source.file}:${definition.source.line}).`);
|
|
696
|
+
}
|
|
697
|
+
sqlSource(name) {
|
|
698
|
+
const definitions = this.storage
|
|
699
|
+
.listCatalogEntries("SQL")
|
|
700
|
+
.filter((entry) => String(entry.properties.name).toLowerCase() === name.toLowerCase());
|
|
701
|
+
const entry = definitions[0];
|
|
702
|
+
if (definitions.length !== 1 || !entry) {
|
|
703
|
+
return undefined;
|
|
704
|
+
}
|
|
705
|
+
const body = entry.properties.sqlserver_body;
|
|
706
|
+
return {
|
|
707
|
+
source: entry.source,
|
|
708
|
+
definition: { type: "SQL", id: entry.id },
|
|
709
|
+
...(typeof body === "string"
|
|
710
|
+
? { sourceHash: new Bun.CryptoHasher("sha256").update(body).digest("hex") }
|
|
711
|
+
: {}),
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
async query(definition, request, context) {
|
|
715
|
+
return (await this.queries.run(definition, request, context)).records;
|
|
716
|
+
}
|
|
717
|
+
async add(definition, item, enabled, responseRequest, context) {
|
|
718
|
+
const request = item.node;
|
|
719
|
+
const id = request.attributes.id;
|
|
720
|
+
if (!id) {
|
|
721
|
+
throw new Error("The default Add must allocate its ID before running before hooks.");
|
|
722
|
+
}
|
|
723
|
+
if (request.attributes.where) {
|
|
724
|
+
throw new PlatformError("InvalidAdd", "add cannot contain a where selector.");
|
|
725
|
+
}
|
|
726
|
+
await this.graph.properties(definition, request, context);
|
|
727
|
+
this.assertAddProperties(definition, request);
|
|
728
|
+
const properties = this.creationProperties(definition, request, id, context);
|
|
729
|
+
Object.assign(properties, this.security.creation(definition, properties, context));
|
|
730
|
+
const record = this.references.initialize(definition, {
|
|
731
|
+
id,
|
|
732
|
+
type: definition.name,
|
|
733
|
+
properties: normalizeProperties(this.storage, definition, properties, {
|
|
734
|
+
creating: true,
|
|
735
|
+
id,
|
|
736
|
+
}),
|
|
737
|
+
});
|
|
738
|
+
assertActiveContext(context);
|
|
739
|
+
this.storage.insertItem(record);
|
|
740
|
+
this.references.sessions.created(record, context);
|
|
741
|
+
this.trace.record(context, {
|
|
742
|
+
kind: "mutation",
|
|
743
|
+
name: "add",
|
|
744
|
+
after: record,
|
|
745
|
+
});
|
|
746
|
+
const children = await this.graph.relationships(definition, request, id, context);
|
|
747
|
+
const response = this.recordResponse(definition, record, request, children);
|
|
748
|
+
await this.afterEvents.run(definition, "onAfterAdd", afterAddFrames(definition.id, id), enabled, context);
|
|
749
|
+
return await this.responses.complete(responseRequest, response, context);
|
|
750
|
+
}
|
|
751
|
+
setupPlatform(registrar) {
|
|
752
|
+
registrar.handleAsync(deleteOwnedItemOperation, (input, context) => this.deleteOwned(input.parent, input.child, input.enabled, context));
|
|
753
|
+
for (const executor of this.executors.values()) {
|
|
754
|
+
if (claimedExecutors.has(executor)) {
|
|
755
|
+
throw new PlatformError("ExecutorAlreadyAttached", "Create a separate executor instance for each harness world.");
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
for (const executor of this.executors.values()) {
|
|
759
|
+
claimedExecutors.add(executor);
|
|
760
|
+
this.ownedExecutors.add(executor);
|
|
761
|
+
}
|
|
762
|
+
this.registerSeedOperations(registrar);
|
|
763
|
+
registrar.handleAsync(applyBaseItemOperation, (input, context) => this.references.sessions.run(context, () => this.applyBaseItem(input, context)));
|
|
764
|
+
registrar.handleAsync(applyItemOperation, (item, context) => this.references.sessions.run(context, () => this.apply(item.clone(), context)));
|
|
765
|
+
registrar.handleAsync(callMethodOperation, (input, context) => this.references.sessions.run(context, () => this.callMethod(input, context)));
|
|
766
|
+
registrar.handleAsync(applySqlOperation, async (input, context) => {
|
|
767
|
+
const mocked = this.options.mocks?.sql(true, {
|
|
768
|
+
...input.values,
|
|
769
|
+
method: input.method,
|
|
770
|
+
query: input.query,
|
|
771
|
+
});
|
|
772
|
+
if (mocked) {
|
|
773
|
+
return this.mockResult(`SQL: ${input.method}`, mocked, context);
|
|
774
|
+
}
|
|
775
|
+
throw new PlatformError("UnsupportedSQL", `T-SQL execution is not implemented (called by '${input.method}').`);
|
|
776
|
+
});
|
|
777
|
+
registrar.handleAsync(applyAMLOperation, (xml, context) => this.references.sessions.run(context, () => this.applyAML(xml, context)));
|
|
778
|
+
}
|
|
779
|
+
async deleteOwned(parent, child, enabled, context) {
|
|
780
|
+
const owner = this.storage.getItem(parent.type, parent.id);
|
|
781
|
+
const record = this.storage.getItem(child.type, child.id);
|
|
782
|
+
if (!owner ||
|
|
783
|
+
!record ||
|
|
784
|
+
String(record.properties.source_id).toLowerCase() !== owner.id.toLowerCase()) {
|
|
785
|
+
throw new PlatformError("RelationshipSource", "An owned deletion requires its persisted parent.");
|
|
786
|
+
}
|
|
787
|
+
relationshipType(this.storage, this.catalog.itemType(parent.type), child.type);
|
|
788
|
+
const request = Item.create(child.type, "delete");
|
|
789
|
+
request.setAttribute("id", child.id);
|
|
790
|
+
if (!enabled) {
|
|
791
|
+
request.setAttribute("serverEvents", "0");
|
|
792
|
+
}
|
|
793
|
+
return await this.security.deletingOwned(record, context, () => context.execute(applyBaseItemOperation, { item: request, event: "onDelete" }));
|
|
794
|
+
}
|
|
795
|
+
async applyAML(xml, context) {
|
|
796
|
+
const nodes = [];
|
|
797
|
+
const requests = parseItems(xml);
|
|
798
|
+
for (const item of requests) {
|
|
799
|
+
const result = requireSuccess(await context.execute(applyItemOperation, item));
|
|
800
|
+
if (requests.length === 1) {
|
|
801
|
+
return result;
|
|
802
|
+
}
|
|
803
|
+
if (result.isError()) {
|
|
804
|
+
throw new PlatformError("UnsupportedBatchResult", "Batch AML with a no-items result is not supported.");
|
|
805
|
+
}
|
|
806
|
+
for (const node of result.payload.items) {
|
|
807
|
+
spendContext(context);
|
|
808
|
+
nodes.push(node);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return new Item({ items: nodes });
|
|
812
|
+
}
|
|
813
|
+
registerSeedOperations(registrar) {
|
|
814
|
+
registrar.handleSync(seedOperation, (input, context) => this.seed(input, context));
|
|
815
|
+
registrar.handleSync(seedRecordsOperation, (records, context) => {
|
|
816
|
+
const targets = new Set(records.map((record) => JSON.stringify([record.type.toLowerCase(), record.id.toLowerCase()])));
|
|
817
|
+
for (const record of records) {
|
|
818
|
+
this.seed(record, context, { id: record.id, targets });
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
assertActionSupported(definition, action) {
|
|
823
|
+
if (action !== "get") {
|
|
824
|
+
this.catalog.assertMutable(definition);
|
|
825
|
+
}
|
|
826
|
+
if (action === "version" && !definition.isVersionable) {
|
|
827
|
+
throw new PlatformError("NotVersionable", `ItemType '${definition.name}' is not versionable.`);
|
|
828
|
+
}
|
|
829
|
+
if (action === "edit" &&
|
|
830
|
+
!definition.isVersionable &&
|
|
831
|
+
this.storage
|
|
832
|
+
.listCatalogEntries("Server Event")
|
|
833
|
+
.some((event) => event.properties.source_id === definition.id &&
|
|
834
|
+
/lock/i.test(String(event.properties.server_event)))) {
|
|
835
|
+
throw new PlatformError("UnsupportedLocking", `edit on '${definition.name}' requires lock event semantics that are not implemented.`);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
async replaceAction(definition, item, verb, enabled, context, baseEvent, applyBase) {
|
|
839
|
+
if (baseEvent === `on${verb}`) {
|
|
840
|
+
return undefined;
|
|
841
|
+
}
|
|
842
|
+
const replacement = this.eventBindings(definition, `on${verb}`, enabled);
|
|
843
|
+
if (replacement.length) {
|
|
844
|
+
if (replacement.length !== 1) {
|
|
845
|
+
throw new PlatformError("AmbiguousReplacement", `Multiple replacement handlers for '${definition.name}.on${verb}' are not supported.`);
|
|
846
|
+
}
|
|
847
|
+
const binding = replacement[0];
|
|
848
|
+
if (!binding) {
|
|
849
|
+
throw new PlatformError("InvalidEvent", "Missing replacement binding.");
|
|
850
|
+
}
|
|
851
|
+
this.trace.record(context, {
|
|
852
|
+
kind: "event",
|
|
853
|
+
name: `on${verb}`,
|
|
854
|
+
source: binding.entry.source,
|
|
855
|
+
});
|
|
856
|
+
return await this.replacements.invoke(binding, `on${verb}`, item, context, (request, nested) => this.delegateBase(request, `on${verb}`, nested, applyBase), () => this.callBoundMethod({ name: binding.methodId, context: item }, context));
|
|
857
|
+
}
|
|
858
|
+
return undefined;
|
|
859
|
+
}
|
|
860
|
+
async delegateBase(item, event, context, applyBase) {
|
|
861
|
+
const input = { item, event };
|
|
862
|
+
if (applyBase) {
|
|
863
|
+
this.baseOverrides.set(input, applyBase);
|
|
864
|
+
}
|
|
865
|
+
try {
|
|
866
|
+
return await context.execute(applyBaseItemOperation, input);
|
|
867
|
+
}
|
|
868
|
+
finally {
|
|
869
|
+
this.baseOverrides.delete(input);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
async applyBaseItem(input, context) {
|
|
873
|
+
const applyBase = this.baseOverrides.get(input);
|
|
874
|
+
if (applyBase) {
|
|
875
|
+
return await applyBase(input.item, context);
|
|
876
|
+
}
|
|
877
|
+
return await this.apply(input.item, context, input.event);
|
|
878
|
+
}
|
|
879
|
+
async updateEvent(definition, request, context, applyBase) {
|
|
880
|
+
await this.authorizeAction(definition, request.getAction(), request, context);
|
|
881
|
+
const attributes = { ...request.node.attributes };
|
|
882
|
+
const complete = async (item, nested) => {
|
|
883
|
+
// Native delegates capture these flags before the replacement mutates its DOM.
|
|
884
|
+
for (const name of ["serverEvents", "doGetItem"]) {
|
|
885
|
+
delete item.node.attributes[name];
|
|
886
|
+
if (attributes[name] !== undefined) {
|
|
887
|
+
item.node.attributes[name] = attributes[name];
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
const result = await applyBase(item, nested);
|
|
891
|
+
if (result.completed) {
|
|
892
|
+
return result.response;
|
|
893
|
+
}
|
|
894
|
+
const responseRequest = {
|
|
895
|
+
...item.node,
|
|
896
|
+
attributes: { ...item.node.attributes, action: "update" },
|
|
897
|
+
};
|
|
898
|
+
return await this.responses.complete(responseRequest, result.response, nested);
|
|
899
|
+
};
|
|
900
|
+
const replacement = await this.replaceAction(definition, request, "Update", request.getAttribute("serverEvents") !== "0", context, undefined, complete);
|
|
901
|
+
return replacement ?? (await complete(request, context));
|
|
902
|
+
}
|
|
903
|
+
async applyVersionedUpdate(definition, item, context) {
|
|
904
|
+
const request = item.node;
|
|
905
|
+
const action = item.getAction();
|
|
906
|
+
const records = await this.query(definition, request, context);
|
|
907
|
+
if (!records.length) {
|
|
908
|
+
throw new ApplicationError(Item.error(`No '${definition.name}' records match this ${action} request.`, "NoItems"));
|
|
909
|
+
}
|
|
910
|
+
const result = await this.versioning.applyBatch(definition, records, item, context);
|
|
911
|
+
if (result.completed) {
|
|
912
|
+
return result.response;
|
|
913
|
+
}
|
|
914
|
+
return await this.responses.complete(request, result.response, context);
|
|
915
|
+
}
|
|
916
|
+
async get(definition, request, enabled, context) {
|
|
917
|
+
const project = compileProjection(this.storage, definition, request.attributes.select, (type, record) => this.security.readable(type, [record], context).length === 1);
|
|
918
|
+
const selection = await this.queries.run(definition, request, context);
|
|
919
|
+
const records = selection.records;
|
|
920
|
+
if (!records.length) {
|
|
921
|
+
const empty = Item.error(`No items of type '${definition.name}' found.`, "0");
|
|
922
|
+
if (selection.messages) {
|
|
923
|
+
empty.payload.messages = selection.messages;
|
|
924
|
+
}
|
|
925
|
+
return empty;
|
|
926
|
+
}
|
|
927
|
+
const result = new Item({
|
|
928
|
+
items: records.map((record) => ({
|
|
929
|
+
...project(record),
|
|
930
|
+
relationships: [...(selection.relationships?.get(record.id) ?? [])],
|
|
931
|
+
})),
|
|
932
|
+
...(selection.messages ? { messages: selection.messages } : {}),
|
|
933
|
+
});
|
|
934
|
+
await this.events(definition, "onAfterGet", result, enabled, context);
|
|
935
|
+
return result;
|
|
936
|
+
}
|
|
937
|
+
async mutateExisting(definition, item, verb, enabled, context, baseEvent) {
|
|
938
|
+
const action = item.getAction();
|
|
939
|
+
const records = await this.mutationTargets(definition, item, context);
|
|
940
|
+
const result = [];
|
|
941
|
+
const updated = [];
|
|
942
|
+
let replaced = false;
|
|
943
|
+
const ids = records.map((record) => record.id);
|
|
944
|
+
for (const record of records) {
|
|
945
|
+
if (action === "delete" && !this.storage.getItem(record.type, record.id)) {
|
|
946
|
+
continue;
|
|
947
|
+
}
|
|
948
|
+
const mutate = () => this.mutateTarget(definition, record, item, verb, enabled, context, baseEvent, ids);
|
|
949
|
+
const response = action === "delete"
|
|
950
|
+
? await this.references.sessions.deleting(record, context, mutate)
|
|
951
|
+
: await mutate();
|
|
952
|
+
if (response.replaced && records.length === 1) {
|
|
953
|
+
return response.response;
|
|
954
|
+
}
|
|
955
|
+
if (response.replaced && response.response.payload.result !== undefined) {
|
|
956
|
+
throw new PlatformError("UnsupportedBatchResult", "A collection replacement cannot combine text responses.");
|
|
957
|
+
}
|
|
958
|
+
result.push(...response.response.payload.items);
|
|
959
|
+
replaced ||= response.replaced;
|
|
960
|
+
if (!response.replaced) {
|
|
961
|
+
updated.push(record.id);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
const response = new Item({ items: result });
|
|
965
|
+
if (verb === "Update") {
|
|
966
|
+
await this.afterEvents.run(definition, "onAfterUpdate", afterUpdateFrames(definition.id, Object.fromEntries(updated.map((id) => [id, id]))), enabled, context);
|
|
967
|
+
}
|
|
968
|
+
return replaced
|
|
969
|
+
? response
|
|
970
|
+
: await this.responses.complete(this.baseUpdates.response(item), response, context);
|
|
971
|
+
}
|
|
972
|
+
async mutationTargets(definition, item, context) {
|
|
973
|
+
const pinned = this.baseUpdates.targets(item);
|
|
974
|
+
const records = pinned
|
|
975
|
+
? this.pinnedMutationTargets(definition, pinned, context)
|
|
976
|
+
: await this.query(definition, item.node, context);
|
|
977
|
+
const action = item.getAction();
|
|
978
|
+
if (records.length === 0) {
|
|
979
|
+
throw new ApplicationError(Item.error(`No '${definition.name}' records match this ${action} request.`, "NoItems"));
|
|
980
|
+
}
|
|
981
|
+
return action === "delete" ? this.deletionTargets(definition, records, context) : records;
|
|
982
|
+
}
|
|
983
|
+
pinnedMutationTargets(definition, ids, context) {
|
|
984
|
+
return ids.map((id) => {
|
|
985
|
+
spendContext(context);
|
|
986
|
+
const record = this.storage.getItem(definition.name, id);
|
|
987
|
+
if (!record) {
|
|
988
|
+
throw new ApplicationError(Item.error(`Captured '${definition.name}:${id}' no longer exists.`, "NoItems"));
|
|
989
|
+
}
|
|
990
|
+
return record;
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
deletionTargets(definition, records, context) {
|
|
994
|
+
let targets = records;
|
|
995
|
+
if (definition.isVersionable) {
|
|
996
|
+
targets = [
|
|
997
|
+
...new Map(records
|
|
998
|
+
.flatMap((record) => this.versioning.family(record))
|
|
999
|
+
.map((record) => [record.id, record])).values(),
|
|
1000
|
+
];
|
|
1001
|
+
}
|
|
1002
|
+
this.deletion.prepare(targets, context);
|
|
1003
|
+
return targets;
|
|
1004
|
+
}
|
|
1005
|
+
async mutateTarget(definition, record, original, verb, enabled, context, baseEvent, idList = [record.id]) {
|
|
1006
|
+
this.security.assertMutation(definition, record, original.getAction(), context);
|
|
1007
|
+
const item = original.clone();
|
|
1008
|
+
item.node.attributes.id = record.id;
|
|
1009
|
+
delete item.node.attributes.where;
|
|
1010
|
+
delete item.node.attributes.idlist;
|
|
1011
|
+
const attributes = { ...item.node.attributes };
|
|
1012
|
+
const applyBase = verb === "Update"
|
|
1013
|
+
? (pending, nested) => this.applyCapturedMutation(pending, record.id, attributes, nested)
|
|
1014
|
+
: undefined;
|
|
1015
|
+
const replacement = await this.replaceAction(definition, item, verb, enabled, context, baseEvent, applyBase);
|
|
1016
|
+
if (replacement) {
|
|
1017
|
+
return { response: replacement, replaced: true };
|
|
1018
|
+
}
|
|
1019
|
+
return {
|
|
1020
|
+
response: await this.mutateTargetBase(definition, record, item, verb, enabled, context, idList),
|
|
1021
|
+
replaced: false,
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
async applyCapturedMutation(item, id, attributes, context) {
|
|
1025
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
1026
|
+
try {
|
|
1027
|
+
const _scope = __addDisposableResource(env_3, this.baseUpdates.enter(item, id, attributes, context), false);
|
|
1028
|
+
return await this.apply(item, context, "onUpdate");
|
|
1029
|
+
}
|
|
1030
|
+
catch (e_3) {
|
|
1031
|
+
env_3.error = e_3;
|
|
1032
|
+
env_3.hasError = true;
|
|
1033
|
+
}
|
|
1034
|
+
finally {
|
|
1035
|
+
__disposeResources(env_3);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
async mutateTargetBase(definition, record, item, verb, enabled, context, idList) {
|
|
1039
|
+
const action = item.getAction();
|
|
1040
|
+
const captured = item.node;
|
|
1041
|
+
await this.events(definition, `onBefore${verb}`, item, enabled, context, ServerEventVersion.Item, verb === "Update"
|
|
1042
|
+
? { kind: MethodEventDataKind.BeforeUpdate, id: record.id, idList }
|
|
1043
|
+
: undefined);
|
|
1044
|
+
const request = verb === "Update" ? captured : item.node;
|
|
1045
|
+
validateRequest(request, action);
|
|
1046
|
+
this.assertActionContext(definition, request, action, record.id);
|
|
1047
|
+
const classification = action === "delete"
|
|
1048
|
+
? undefined
|
|
1049
|
+
: this.lifeCycles.classificationChange(definition, record, request.properties, context);
|
|
1050
|
+
await this.graph.properties(definition, request, context);
|
|
1051
|
+
if (action === "delete") {
|
|
1052
|
+
await this.deletion.children(record, enabled, context);
|
|
1053
|
+
}
|
|
1054
|
+
this.mutateRecord(definition, record, request, action, context, classification);
|
|
1055
|
+
let stored = action === "delete" ? record : this.storage.getItem(definition.name, record.id);
|
|
1056
|
+
if (!stored) {
|
|
1057
|
+
throw new PlatformError("MissingItem", "Action result is missing.");
|
|
1058
|
+
}
|
|
1059
|
+
await this.deletion.changed(record, action === "delete" ? undefined : stored, enabled, context);
|
|
1060
|
+
const children = await this.graph.relationships(definition, request, record.id, context);
|
|
1061
|
+
stored = this.lifeCycles.applyClassification(stored, classification, context);
|
|
1062
|
+
const response = this.recordResponse(definition, stored, request, children);
|
|
1063
|
+
this.security.changed(record, stored, context);
|
|
1064
|
+
if (verb !== "Update") {
|
|
1065
|
+
await this.events(definition, `onAfter${verb}`, response, enabled, context);
|
|
1066
|
+
}
|
|
1067
|
+
return response;
|
|
1068
|
+
}
|
|
1069
|
+
recordResponse(definition, record, request, children) {
|
|
1070
|
+
return new Item({
|
|
1071
|
+
items: [
|
|
1072
|
+
{
|
|
1073
|
+
...itemNode(definition.name),
|
|
1074
|
+
attributes: { id: record.id },
|
|
1075
|
+
properties: projectedProperties(this.storage, definition, record, selectedProperties(request)),
|
|
1076
|
+
relationships: children,
|
|
1077
|
+
},
|
|
1078
|
+
],
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
mutateRecord(definition, record, request, action, context, classification) {
|
|
1082
|
+
if (Boolean(record.properties.locked_by_id)) {
|
|
1083
|
+
throw new PlatformError("UnsupportedLocking", `Cannot mutate locked '${definition.name}' record '${record.id}' without lock ownership support.`);
|
|
1084
|
+
}
|
|
1085
|
+
if (action === "delete") {
|
|
1086
|
+
this.deletion.assertRemovable(record, context);
|
|
1087
|
+
assertActiveContext(context);
|
|
1088
|
+
this.storage.deleteItem(definition.name, record.id);
|
|
1089
|
+
this.references.sessions.deleted(record, context);
|
|
1090
|
+
this.trace.record(context, {
|
|
1091
|
+
kind: "mutation",
|
|
1092
|
+
name: "delete",
|
|
1093
|
+
before: record,
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
else {
|
|
1097
|
+
this.updateRecord(definition, record, request, context, classification);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
updateRecord(definition, record, request, context, classification) {
|
|
1101
|
+
const normalized = normalizeProperties(this.storage, definition, request.properties, {
|
|
1102
|
+
creating: false,
|
|
1103
|
+
current: record,
|
|
1104
|
+
});
|
|
1105
|
+
const values = this.lifeCycles.authorizeUpdate(definition, record, normalized, classification, context);
|
|
1106
|
+
if (definition.isRelationship) {
|
|
1107
|
+
const prepared = this.references.initialize(definition, {
|
|
1108
|
+
...record,
|
|
1109
|
+
properties: { ...record.properties, ...values },
|
|
1110
|
+
});
|
|
1111
|
+
const behavior = prepared.properties.behavior;
|
|
1112
|
+
if (typeof behavior !== "string") {
|
|
1113
|
+
throw new TypeError("A relationship must retain its resolved behavior.");
|
|
1114
|
+
}
|
|
1115
|
+
values.behavior = behavior;
|
|
1116
|
+
}
|
|
1117
|
+
assertActiveContext(context);
|
|
1118
|
+
this.storage.updateItem(definition.name, record.id, this.security.auditedChanges(record, values));
|
|
1119
|
+
const after = this.storage.getItem(definition.name, record.id);
|
|
1120
|
+
if (!after) {
|
|
1121
|
+
throw new PlatformError("MissingItem", "Updated record disappeared.");
|
|
1122
|
+
}
|
|
1123
|
+
this.trace.record(context, { kind: "mutation", name: "update", before: record, after });
|
|
1124
|
+
}
|
|
1125
|
+
assertAddProperties(definition, request) {
|
|
1126
|
+
if (definition.isVersionable) {
|
|
1127
|
+
for (const name of [
|
|
1128
|
+
"config_id",
|
|
1129
|
+
"generation",
|
|
1130
|
+
"is_current",
|
|
1131
|
+
"new_version",
|
|
1132
|
+
"locked_by_id",
|
|
1133
|
+
]) {
|
|
1134
|
+
if (request.properties[name] !== undefined) {
|
|
1135
|
+
throw new PlatformError("ReadOnlyProperty", `Version property '${definition.name}.${name}' is managed by add. Use fixtures to seed existing generations.`);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
creationProperties(definition, request, id, context) {
|
|
1141
|
+
const classification = request.properties.classification === undefined
|
|
1142
|
+
? definition.properties.find((property) => property.name === "classification")
|
|
1143
|
+
?.defaultValue
|
|
1144
|
+
: request.properties.classification;
|
|
1145
|
+
this.catalog.classifications.assertValue(definition, classification, context);
|
|
1146
|
+
const properties = {
|
|
1147
|
+
config_id: id,
|
|
1148
|
+
generation: 1,
|
|
1149
|
+
is_current: 1,
|
|
1150
|
+
new_version: definition.isVersionable && !manualVersioning(this.storage, definition) ? 0 : 1,
|
|
1151
|
+
...this.revisions.initial(definition, request.properties),
|
|
1152
|
+
...(classification === undefined ? {} : { classification }),
|
|
1153
|
+
...request.properties,
|
|
1154
|
+
...this.lifeCycles.initialProperties(definition, classification),
|
|
1155
|
+
...creationDefaults(definition, request.properties, this.options.userId, this.now),
|
|
1156
|
+
};
|
|
1157
|
+
this.revisions.assertValue(definition, properties.major_rev);
|
|
1158
|
+
return properties;
|
|
1159
|
+
}
|
|
1160
|
+
methodPorts(definition, item, context, executionStarted) {
|
|
1161
|
+
const capability = capabilityForLanguage(definition.language);
|
|
1162
|
+
return {
|
|
1163
|
+
executionStarted,
|
|
1164
|
+
getNewId: () => {
|
|
1165
|
+
assertActiveContext(context);
|
|
1166
|
+
return this.nextId();
|
|
1167
|
+
},
|
|
1168
|
+
apply: (item) => context.execute(applyItemOperation, item),
|
|
1169
|
+
applyMethod: (name, item) => context.execute(callMethodOperation, { name, context: item }),
|
|
1170
|
+
applyAML: (xml) => context.execute(applyAMLOperation, xml),
|
|
1171
|
+
applySQL: (query, parameters) => context.execute(applySqlOperation, {
|
|
1172
|
+
query,
|
|
1173
|
+
method: definition.name,
|
|
1174
|
+
values: {
|
|
1175
|
+
...properties(item),
|
|
1176
|
+
...(parameters === undefined ? {} : { parameters }),
|
|
1177
|
+
},
|
|
1178
|
+
}),
|
|
1179
|
+
getUserId: () => {
|
|
1180
|
+
assertActiveContext(context);
|
|
1181
|
+
if (!this.options.userId) {
|
|
1182
|
+
throw new PlatformError("SessionRequired", "This Method requires a configured User session.");
|
|
1183
|
+
}
|
|
1184
|
+
return this.options.userId();
|
|
1185
|
+
},
|
|
1186
|
+
fail: (message) => context.fail(new PlatformError("UnsupportedCapability", `${definition.name}: ${message} ` +
|
|
1187
|
+
`(${definition.source.file}:${definition.source.line})`, {
|
|
1188
|
+
source: definition.source,
|
|
1189
|
+
...(capability !== undefined ? { capability } : {}),
|
|
1190
|
+
})),
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
mockedMethodResult(name, entry, mocked, context) {
|
|
1194
|
+
const code = entry?.properties.method_code;
|
|
1195
|
+
return this.mockResult(name, mocked, context, entry
|
|
1196
|
+
? {
|
|
1197
|
+
source: entry.source,
|
|
1198
|
+
definition: { type: "Method", id: entry.id },
|
|
1199
|
+
...(typeof code === "string"
|
|
1200
|
+
? {
|
|
1201
|
+
sourceHash: new Bun.CryptoHasher("sha256")
|
|
1202
|
+
.update(code)
|
|
1203
|
+
.digest("hex"),
|
|
1204
|
+
}
|
|
1205
|
+
: {}),
|
|
1206
|
+
}
|
|
1207
|
+
: undefined);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
//# sourceMappingURL=engine.js.map
|