@pwfabric/runtime 0.0.0-stage → 1.0.0-rc.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 +90 -0
- package/README.md +43 -2
- package/dist/a11y/announcer.d.ts +65 -0
- package/dist/a11y/announcer.js +140 -0
- package/dist/a11y/announcer.js.map +1 -0
- package/dist/a11y/contrast.d.ts +54 -0
- package/dist/a11y/contrast.js +93 -0
- package/dist/a11y/contrast.js.map +1 -0
- package/dist/a11y/focus.d.ts +123 -0
- package/dist/a11y/focus.js +282 -0
- package/dist/a11y/focus.js.map +1 -0
- package/dist/a11y/index.d.ts +21 -0
- package/dist/a11y/index.js +18 -0
- package/dist/a11y/index.js.map +1 -0
- package/dist/a11y/keyboard.d.ts +144 -0
- package/dist/a11y/keyboard.js +317 -0
- package/dist/a11y/keyboard.js.map +1 -0
- package/dist/adapters/default-image.d.ts +25 -0
- package/dist/adapters/default-image.js +37 -0
- package/dist/adapters/default-image.js.map +1 -0
- package/dist/adapters/index.d.ts +27 -0
- package/dist/adapters/index.js +28 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/next-image.d.ts +38 -0
- package/dist/adapters/next-image.js +124 -0
- package/dist/adapters/next-image.js.map +1 -0
- package/dist/adapters/types.d.ts +61 -0
- package/dist/adapters/types.js +11 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/analytics/index.d.ts +14 -0
- package/dist/analytics/index.js +15 -0
- package/dist/analytics/index.js.map +1 -0
- package/dist/analytics/tracker.d.ts +65 -0
- package/dist/analytics/tracker.js +251 -0
- package/dist/analytics/tracker.js.map +1 -0
- package/dist/analytics/types.d.ts +130 -0
- package/dist/analytics/types.js +11 -0
- package/dist/analytics/types.js.map +1 -0
- package/dist/auth/index.d.ts +15 -0
- package/dist/auth/index.js +14 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/provider.d.ts +132 -0
- package/dist/auth/provider.js +473 -0
- package/dist/auth/provider.js.map +1 -0
- package/dist/auth/types.d.ts +117 -0
- package/dist/auth/types.js +9 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/binding/collection.d.ts +190 -0
- package/dist/binding/collection.js +358 -0
- package/dist/binding/collection.js.map +1 -0
- package/dist/binding/datasource.d.ts +319 -0
- package/dist/binding/datasource.js +556 -0
- package/dist/binding/datasource.js.map +1 -0
- package/dist/binding/engine.d.ts +65 -0
- package/dist/binding/engine.js +268 -0
- package/dist/binding/engine.js.map +1 -0
- package/dist/binding/expression.d.ts +150 -0
- package/dist/binding/expression.js +787 -0
- package/dist/binding/expression.js.map +1 -0
- package/dist/binding/index.d.ts +19 -0
- package/dist/binding/index.js +14 -0
- package/dist/binding/index.js.map +1 -0
- package/dist/binding/two-way.d.ts +149 -0
- package/dist/binding/two-way.js +462 -0
- package/dist/binding/two-way.js.map +1 -0
- package/dist/binding/types.d.ts +119 -0
- package/dist/binding/types.js +9 -0
- package/dist/binding/types.js.map +1 -0
- package/dist/blocks/component-types.d.ts +81 -0
- package/dist/blocks/component-types.js +11 -0
- package/dist/blocks/component-types.js.map +1 -0
- package/dist/blocks/composition-rules.d.ts +168 -0
- package/dist/blocks/composition-rules.js +391 -0
- package/dist/blocks/composition-rules.js.map +1 -0
- package/dist/blocks/hooks.d.ts +31 -0
- package/dist/blocks/hooks.js +42 -0
- package/dist/blocks/hooks.js.map +1 -0
- package/dist/blocks/index.d.ts +14 -0
- package/dist/blocks/index.js +23 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/blocks/registry.d.ts +84 -0
- package/dist/blocks/registry.js +136 -0
- package/dist/blocks/registry.js.map +1 -0
- package/dist/blocks/rule-engine.d.ts +131 -0
- package/dist/blocks/rule-engine.js +321 -0
- package/dist/blocks/rule-engine.js.map +1 -0
- package/dist/blocks/surface-event-context.d.ts +13 -0
- package/dist/blocks/surface-event-context.js +14 -0
- package/dist/blocks/surface-event-context.js.map +1 -0
- package/dist/blocks/surface-id-context.d.ts +13 -0
- package/dist/blocks/surface-id-context.js +15 -0
- package/dist/blocks/surface-id-context.js.map +1 -0
- package/dist/bus.d.ts +41 -0
- package/dist/bus.js +158 -0
- package/dist/bus.js.map +1 -0
- package/dist/cache/index.d.ts +9 -0
- package/dist/cache/index.js +10 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/memory.d.ts +32 -0
- package/dist/cache/memory.js +138 -0
- package/dist/cache/memory.js.map +1 -0
- package/dist/cache/types.d.ts +62 -0
- package/dist/cache/types.js +9 -0
- package/dist/cache/types.js.map +1 -0
- package/dist/capability/index.d.ts +72 -0
- package/dist/capability/index.js +87 -0
- package/dist/capability/index.js.map +1 -0
- package/dist/capability/kernel-capabilities.d.ts +31 -0
- package/dist/capability/kernel-capabilities.js +36 -0
- package/dist/capability/kernel-capabilities.js.map +1 -0
- package/dist/capability/platform-capabilities.d.ts +71 -0
- package/dist/capability/platform-capabilities.js +267 -0
- package/dist/capability/platform-capabilities.js.map +1 -0
- package/dist/capability/type-mapping.d.ts +70 -0
- package/dist/capability/type-mapping.js +107 -0
- package/dist/capability/type-mapping.js.map +1 -0
- package/dist/capability/validation.d.ts +46 -0
- package/dist/capability/validation.js +54 -0
- package/dist/capability/validation.js.map +1 -0
- package/dist/connectors/declared-connector.d.ts +48 -0
- package/dist/connectors/declared-connector.js +333 -0
- package/dist/connectors/declared-connector.js.map +1 -0
- package/dist/connectors/engine-registry.d.ts +50 -0
- package/dist/connectors/engine-registry.js +135 -0
- package/dist/connectors/engine-registry.js.map +1 -0
- package/dist/connectors/index.d.ts +14 -0
- package/dist/connectors/index.js +14 -0
- package/dist/connectors/index.js.map +1 -0
- package/dist/connectors/module-loader.d.ts +70 -0
- package/dist/connectors/module-loader.js +143 -0
- package/dist/connectors/module-loader.js.map +1 -0
- package/dist/connectors/types.d.ts +174 -0
- package/dist/connectors/types.js +23 -0
- package/dist/connectors/types.js.map +1 -0
- package/dist/context.d.ts +27 -0
- package/dist/context.js +38 -0
- package/dist/context.js.map +1 -0
- package/dist/data/DataCapabilityProvider.d.ts +39 -0
- package/dist/data/DataCapabilityProvider.js +58 -0
- package/dist/data/DataCapabilityProvider.js.map +1 -0
- package/dist/data/index.d.ts +17 -0
- package/dist/data/index.js +18 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/manager.d.ts +40 -0
- package/dist/data/manager.js +442 -0
- package/dist/data/manager.js.map +1 -0
- package/dist/data/types.d.ts +218 -0
- package/dist/data/types.js +2 -0
- package/dist/data/types.js.map +1 -0
- package/dist/entity/aggregate.d.ts +8 -0
- package/dist/entity/aggregate.js +24 -0
- package/dist/entity/aggregate.js.map +1 -0
- package/dist/entity/apply-query.d.ts +58 -0
- package/dist/entity/apply-query.js +264 -0
- package/dist/entity/apply-query.js.map +1 -0
- package/dist/entity/behavior.d.ts +94 -0
- package/dist/entity/behavior.js +78 -0
- package/dist/entity/behavior.js.map +1 -0
- package/dist/entity/connector.d.ts +141 -0
- package/dist/entity/connector.js +89 -0
- package/dist/entity/connector.js.map +1 -0
- package/dist/entity/connectors/index.d.ts +12 -0
- package/dist/entity/connectors/index.js +11 -0
- package/dist/entity/connectors/index.js.map +1 -0
- package/dist/entity/connectors/static.d.ts +51 -0
- package/dist/entity/connectors/static.js +245 -0
- package/dist/entity/connectors/static.js.map +1 -0
- package/dist/entity/entity-datasource.d.ts +50 -0
- package/dist/entity/entity-datasource.js +33 -0
- package/dist/entity/entity-datasource.js.map +1 -0
- package/dist/entity/facade.d.ts +70 -0
- package/dist/entity/facade.js +70 -0
- package/dist/entity/facade.js.map +1 -0
- package/dist/entity/http-connector.d.ts +123 -0
- package/dist/entity/http-connector.js +295 -0
- package/dist/entity/http-connector.js.map +1 -0
- package/dist/entity/index.d.ts +38 -0
- package/dist/entity/index.js +31 -0
- package/dist/entity/index.js.map +1 -0
- package/dist/entity/postgres-connector.d.ts +64 -0
- package/dist/entity/postgres-connector.js +239 -0
- package/dist/entity/postgres-connector.js.map +1 -0
- package/dist/entity/registry.d.ts +59 -0
- package/dist/entity/registry.js +90 -0
- package/dist/entity/registry.js.map +1 -0
- package/dist/entity/store.d.ts +66 -0
- package/dist/entity/store.js +349 -0
- package/dist/entity/store.js.map +1 -0
- package/dist/entity/types.d.ts +180 -0
- package/dist/entity/types.js +10 -0
- package/dist/entity/types.js.map +1 -0
- package/dist/execution-context.d.ts +88 -0
- package/dist/execution-context.js +146 -0
- package/dist/execution-context.js.map +1 -0
- package/dist/executor.d.ts +27 -0
- package/dist/executor.js +33 -0
- package/dist/executor.js.map +1 -0
- package/dist/forms/form-entity-bridge.d.ts +94 -0
- package/dist/forms/form-entity-bridge.js +96 -0
- package/dist/forms/form-entity-bridge.js.map +1 -0
- package/dist/forms/form-write-target.d.ts +34 -0
- package/dist/forms/form-write-target.js +81 -0
- package/dist/forms/form-write-target.js.map +1 -0
- package/dist/forms/index.d.ts +22 -0
- package/dist/forms/index.js +25 -0
- package/dist/forms/index.js.map +1 -0
- package/dist/forms/named-control-values.d.ts +27 -0
- package/dist/forms/named-control-values.js +42 -0
- package/dist/forms/named-control-values.js.map +1 -0
- package/dist/forms/processor.d.ts +55 -0
- package/dist/forms/processor.js +154 -0
- package/dist/forms/processor.js.map +1 -0
- package/dist/forms/types.d.ts +174 -0
- package/dist/forms/types.js +33 -0
- package/dist/forms/types.js.map +1 -0
- package/dist/forms/validator.d.ts +61 -0
- package/dist/forms/validator.js +218 -0
- package/dist/forms/validator.js.map +1 -0
- package/dist/graph/index.d.ts +10 -0
- package/dist/graph/index.js +9 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/resolver.d.ts +66 -0
- package/dist/graph/resolver.js +243 -0
- package/dist/graph/resolver.js.map +1 -0
- package/dist/graph/types.d.ts +125 -0
- package/dist/graph/types.js +9 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/hooks/useInstalledAtoms.d.ts +96 -0
- package/dist/hooks/useInstalledAtoms.js +92 -0
- package/dist/hooks/useInstalledAtoms.js.map +1 -0
- package/dist/i18n/index.d.ts +15 -0
- package/dist/i18n/index.js +14 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/translator.d.ts +76 -0
- package/dist/i18n/translator.js +357 -0
- package/dist/i18n/translator.js.map +1 -0
- package/dist/i18n/types.d.ts +93 -0
- package/dist/i18n/types.js +9 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel.d.ts +47 -0
- package/dist/kernel.js +258 -0
- package/dist/kernel.js.map +1 -0
- package/dist/perf/budget.d.ts +92 -0
- package/dist/perf/budget.js +122 -0
- package/dist/perf/budget.js.map +1 -0
- package/dist/perf/index.d.ts +16 -0
- package/dist/perf/index.js +13 -0
- package/dist/perf/index.js.map +1 -0
- package/dist/perf/render-timer.d.ts +90 -0
- package/dist/perf/render-timer.js +136 -0
- package/dist/perf/render-timer.js.map +1 -0
- package/dist/perf/reporter.d.ts +126 -0
- package/dist/perf/reporter.js +241 -0
- package/dist/perf/reporter.js.map +1 -0
- package/dist/perf/web-vitals.d.ts +111 -0
- package/dist/perf/web-vitals.js +268 -0
- package/dist/perf/web-vitals.js.map +1 -0
- package/dist/registry.d.ts +63 -0
- package/dist/registry.js +126 -0
- package/dist/registry.js.map +1 -0
- package/dist/render/BehaviorSurfaceProvider.d.ts +65 -0
- package/dist/render/BehaviorSurfaceProvider.js +185 -0
- package/dist/render/BehaviorSurfaceProvider.js.map +1 -0
- package/dist/render/BlockErrorBoundary.d.ts +26 -0
- package/dist/render/BlockErrorBoundary.js +41 -0
- package/dist/render/BlockErrorBoundary.js.map +1 -0
- package/dist/render/DataBoundSurfaceRenderer.d.ts +78 -0
- package/dist/render/DataBoundSurfaceRenderer.js +998 -0
- package/dist/render/DataBoundSurfaceRenderer.js.map +1 -0
- package/dist/render/DynamicBlockWrapper.d.ts +23 -0
- package/dist/render/DynamicBlockWrapper.js +117 -0
- package/dist/render/DynamicBlockWrapper.js.map +1 -0
- package/dist/render/appearance-resolver.d.ts +50 -0
- package/dist/render/appearance-resolver.js +78 -0
- package/dist/render/appearance-resolver.js.map +1 -0
- package/dist/render/capability-gate.d.ts +69 -0
- package/dist/render/capability-gate.js +94 -0
- package/dist/render/capability-gate.js.map +1 -0
- package/dist/render/conditional-states-css.d.ts +41 -0
- package/dist/render/conditional-states-css.js +82 -0
- package/dist/render/conditional-states-css.js.map +1 -0
- package/dist/render/connections-context.d.ts +31 -0
- package/dist/render/connections-context.js +34 -0
- package/dist/render/connections-context.js.map +1 -0
- package/dist/render/dark-theme-css.d.ts +36 -0
- package/dist/render/dark-theme-css.js +67 -0
- package/dist/render/dark-theme-css.js.map +1 -0
- package/dist/render/data-binding-types.d.ts +191 -0
- package/dist/render/data-binding-types.js +11 -0
- package/dist/render/data-binding-types.js.map +1 -0
- package/dist/render/data-cache.d.ts +30 -0
- package/dist/render/data-cache.js +37 -0
- package/dist/render/data-cache.js.map +1 -0
- package/dist/render/derive-dark-theme.d.ts +17 -0
- package/dist/render/derive-dark-theme.js +18 -0
- package/dist/render/derive-dark-theme.js.map +1 -0
- package/dist/render/dynamic-artifact-context.d.ts +77 -0
- package/dist/render/dynamic-artifact-context.js +89 -0
- package/dist/render/dynamic-artifact-context.js.map +1 -0
- package/dist/render/dynamic-block-loader.d.ts +80 -0
- package/dist/render/dynamic-block-loader.js +197 -0
- package/dist/render/dynamic-block-loader.js.map +1 -0
- package/dist/render/endpoint.d.ts +18 -0
- package/dist/render/endpoint.js +109 -0
- package/dist/render/endpoint.js.map +1 -0
- package/dist/render/entity-facade-context.d.ts +34 -0
- package/dist/render/entity-facade-context.js +37 -0
- package/dist/render/entity-facade-context.js.map +1 -0
- package/dist/render/group-states-css.d.ts +41 -0
- package/dist/render/group-states-css.js +73 -0
- package/dist/render/group-states-css.js.map +1 -0
- package/dist/render/hooks/useSurfaceEvents.d.ts +8 -0
- package/dist/render/hooks/useSurfaceEvents.js +9 -0
- package/dist/render/hooks/useSurfaceEvents.js.map +1 -0
- package/dist/render/hooks/useSurfaceId.d.ts +8 -0
- package/dist/render/hooks/useSurfaceId.js +9 -0
- package/dist/render/hooks/useSurfaceId.js.map +1 -0
- package/dist/render/index.d.ts +48 -0
- package/dist/render/index.js +61 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/interaction-rule-engine.d.ts +12 -0
- package/dist/render/interaction-rule-engine.js +47 -0
- package/dist/render/interaction-rule-engine.js.map +1 -0
- package/dist/render/keyframes-css.d.ts +31 -0
- package/dist/render/keyframes-css.js +44 -0
- package/dist/render/keyframes-css.js.map +1 -0
- package/dist/render/query-state.d.ts +3 -0
- package/dist/render/query-state.js +70 -0
- package/dist/render/query-state.js.map +1 -0
- package/dist/render/renderer.d.ts +44 -0
- package/dist/render/renderer.js +937 -0
- package/dist/render/renderer.js.map +1 -0
- package/dist/render/resolve-expressions.d.ts +37 -0
- package/dist/render/resolve-expressions.js +309 -0
- package/dist/render/resolve-expressions.js.map +1 -0
- package/dist/render/responsive-style-css.d.ts +42 -0
- package/dist/render/responsive-style-css.js +123 -0
- package/dist/render/responsive-style-css.js.map +1 -0
- package/dist/render/responsive.d.ts +49 -0
- package/dist/render/responsive.js +99 -0
- package/dist/render/responsive.js.map +1 -0
- package/dist/render/scoped-css.d.ts +71 -0
- package/dist/render/scoped-css.js +102 -0
- package/dist/render/scoped-css.js.map +1 -0
- package/dist/render/shell-selection.d.ts +69 -0
- package/dist/render/shell-selection.js +117 -0
- package/dist/render/shell-selection.js.map +1 -0
- package/dist/render/states-css.d.ts +32 -0
- package/dist/render/states-css.js +63 -0
- package/dist/render/states-css.js.map +1 -0
- package/dist/render/surface-data-context.d.ts +18 -0
- package/dist/render/surface-data-context.js +21 -0
- package/dist/render/surface-data-context.js.map +1 -0
- package/dist/render/surface-event-bus.d.ts +19 -0
- package/dist/render/surface-event-bus.js +68 -0
- package/dist/render/surface-event-bus.js.map +1 -0
- package/dist/render/surface-event-context.d.ts +11 -0
- package/dist/render/surface-event-context.js +12 -0
- package/dist/render/surface-event-context.js.map +1 -0
- package/dist/render/surface-id-context.d.ts +8 -0
- package/dist/render/surface-id-context.js +9 -0
- package/dist/render/surface-id-context.js.map +1 -0
- package/dist/render/theme-utils.d.ts +14 -0
- package/dist/render/theme-utils.js +15 -0
- package/dist/render/theme-utils.js.map +1 -0
- package/dist/render/types.d.ts +282 -0
- package/dist/render/types.js +9 -0
- package/dist/render/types.js.map +1 -0
- package/dist/render/visibility-css.d.ts +42 -0
- package/dist/render/visibility-css.js +119 -0
- package/dist/render/visibility-css.js.map +1 -0
- package/dist/render/width-scope.d.ts +34 -0
- package/dist/render/width-scope.js +44 -0
- package/dist/render/width-scope.js.map +1 -0
- package/dist/render/write-only-sources.d.ts +33 -0
- package/dist/render/write-only-sources.js +99 -0
- package/dist/render/write-only-sources.js.map +1 -0
- package/dist/routing/index.d.ts +14 -0
- package/dist/routing/index.js +15 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/router.d.ts +42 -0
- package/dist/routing/router.js +218 -0
- package/dist/routing/router.js.map +1 -0
- package/dist/routing/types.d.ts +124 -0
- package/dist/routing/types.js +9 -0
- package/dist/routing/types.js.map +1 -0
- package/dist/seo/generator.d.ts +39 -0
- package/dist/seo/generator.js +236 -0
- package/dist/seo/generator.js.map +1 -0
- package/dist/seo/index.d.ts +14 -0
- package/dist/seo/index.js +15 -0
- package/dist/seo/index.js.map +1 -0
- package/dist/seo/types.d.ts +181 -0
- package/dist/seo/types.js +9 -0
- package/dist/seo/types.js.map +1 -0
- package/dist/state/index.d.ts +15 -0
- package/dist/state/index.js +16 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/manager.d.ts +33 -0
- package/dist/state/manager.js +81 -0
- package/dist/state/manager.js.map +1 -0
- package/dist/state/store.d.ts +40 -0
- package/dist/state/store.js +145 -0
- package/dist/state/store.js.map +1 -0
- package/dist/state/types.d.ts +107 -0
- package/dist/state/types.js +9 -0
- package/dist/state/types.js.map +1 -0
- package/dist/surface/expression.d.ts +65 -0
- package/dist/surface/expression.js +179 -0
- package/dist/surface/expression.js.map +1 -0
- package/dist/surface/index.d.ts +32 -0
- package/dist/surface/index.js +25 -0
- package/dist/surface/index.js.map +1 -0
- package/dist/surface/interpreter.d.ts +96 -0
- package/dist/surface/interpreter.js +231 -0
- package/dist/surface/interpreter.js.map +1 -0
- package/dist/surface/layout.d.ts +54 -0
- package/dist/surface/layout.js +288 -0
- package/dist/surface/layout.js.map +1 -0
- package/dist/surface/output.d.ts +90 -0
- package/dist/surface/output.js +104 -0
- package/dist/surface/output.js.map +1 -0
- package/dist/surface/primitives.d.ts +180 -0
- package/dist/surface/primitives.js +339 -0
- package/dist/surface/primitives.js.map +1 -0
- package/dist/surface/renderer.d.ts +96 -0
- package/dist/surface/renderer.js +190 -0
- package/dist/surface/renderer.js.map +1 -0
- package/dist/surface/schemas.d.ts +181 -0
- package/dist/surface/schemas.js +142 -0
- package/dist/surface/schemas.js.map +1 -0
- package/dist/surface/transforms.d.ts +144 -0
- package/dist/surface/transforms.js +120 -0
- package/dist/surface/transforms.js.map +1 -0
- package/dist/surface/types.d.ts +160 -0
- package/dist/surface/types.js +51 -0
- package/dist/surface/types.js.map +1 -0
- package/dist/surface/validation.d.ts +123 -0
- package/dist/surface/validation.js +147 -0
- package/dist/surface/validation.js.map +1 -0
- package/dist/validator.d.ts +55 -0
- package/dist/validator.js +100 -0
- package/dist/validator.js.map +1 -0
- package/package.json +106 -3
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed Transform Wrappers
|
|
3
|
+
*
|
|
4
|
+
* Typed runtime wrappers for TransformDescriptor.config.
|
|
5
|
+
* These do NOT modify @pwfabric/contracts. They provide typed alternatives
|
|
6
|
+
* that narrow the opaque Record<string, unknown> config.
|
|
7
|
+
*
|
|
8
|
+
* @module @pwfabric/runtime/surface/transforms
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import type { TransformDescriptor } from '@pwfabric/contracts';
|
|
12
|
+
/**
|
|
13
|
+
* Config for 'map' transforms
|
|
14
|
+
*/
|
|
15
|
+
export interface MapTransformConfig {
|
|
16
|
+
readonly field: string;
|
|
17
|
+
readonly mapper: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Config for 'filter' transforms
|
|
21
|
+
*/
|
|
22
|
+
export interface FilterTransformConfig {
|
|
23
|
+
readonly field: string;
|
|
24
|
+
readonly predicate: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Config for 'pick' transforms
|
|
28
|
+
*/
|
|
29
|
+
export interface PickTransformConfig {
|
|
30
|
+
readonly fields: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Config for 'omit' transforms
|
|
34
|
+
*/
|
|
35
|
+
export interface OmitTransformConfig {
|
|
36
|
+
readonly fields: readonly string[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Config for 'custom' transforms
|
|
40
|
+
*/
|
|
41
|
+
export interface CustomTransformConfig {
|
|
42
|
+
readonly handler: string;
|
|
43
|
+
readonly params?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Discriminated union of all typed transform configs
|
|
47
|
+
*/
|
|
48
|
+
export type TypedTransformConfig = {
|
|
49
|
+
readonly type: 'map';
|
|
50
|
+
readonly config: MapTransformConfig;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: 'filter';
|
|
53
|
+
readonly config: FilterTransformConfig;
|
|
54
|
+
} | {
|
|
55
|
+
readonly type: 'pick';
|
|
56
|
+
readonly config: PickTransformConfig;
|
|
57
|
+
} | {
|
|
58
|
+
readonly type: 'omit';
|
|
59
|
+
readonly config: OmitTransformConfig;
|
|
60
|
+
} | {
|
|
61
|
+
readonly type: 'custom';
|
|
62
|
+
readonly config: CustomTransformConfig;
|
|
63
|
+
};
|
|
64
|
+
export declare const mapTransformConfigSchema: z.ZodObject<{
|
|
65
|
+
field: z.ZodString;
|
|
66
|
+
mapper: z.ZodString;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
field: string;
|
|
69
|
+
mapper: string;
|
|
70
|
+
}, {
|
|
71
|
+
field: string;
|
|
72
|
+
mapper: string;
|
|
73
|
+
}>;
|
|
74
|
+
export declare const filterTransformConfigSchema: z.ZodObject<{
|
|
75
|
+
field: z.ZodString;
|
|
76
|
+
predicate: z.ZodString;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
field: string;
|
|
79
|
+
predicate: string;
|
|
80
|
+
}, {
|
|
81
|
+
field: string;
|
|
82
|
+
predicate: string;
|
|
83
|
+
}>;
|
|
84
|
+
export declare const pickTransformConfigSchema: z.ZodObject<{
|
|
85
|
+
fields: z.ZodArray<z.ZodString, "many">;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
fields: string[];
|
|
88
|
+
}, {
|
|
89
|
+
fields: string[];
|
|
90
|
+
}>;
|
|
91
|
+
export declare const omitTransformConfigSchema: z.ZodObject<{
|
|
92
|
+
fields: z.ZodArray<z.ZodString, "many">;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
fields: string[];
|
|
95
|
+
}, {
|
|
96
|
+
fields: string[];
|
|
97
|
+
}>;
|
|
98
|
+
export declare const customTransformConfigSchema: z.ZodObject<{
|
|
99
|
+
handler: z.ZodString;
|
|
100
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
handler: string;
|
|
103
|
+
params?: Record<string, unknown> | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
handler: string;
|
|
106
|
+
params?: Record<string, unknown> | undefined;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Result of validating a transform config
|
|
110
|
+
*/
|
|
111
|
+
export interface TransformValidationResult {
|
|
112
|
+
readonly valid: boolean;
|
|
113
|
+
readonly errors: readonly string[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Validate a transform descriptor's config against the typed schema
|
|
117
|
+
* for the given transform type.
|
|
118
|
+
*/
|
|
119
|
+
export declare function validateTransformConfig(type: TransformDescriptor['type'], config: Record<string, unknown>): TransformValidationResult;
|
|
120
|
+
/**
|
|
121
|
+
* Type guard that narrows an opaque TransformDescriptor into
|
|
122
|
+
* a TypedTransformConfig if the config passes validation.
|
|
123
|
+
*/
|
|
124
|
+
export declare function narrowTransformDescriptor(descriptor: TransformDescriptor): TypedTransformConfig | null;
|
|
125
|
+
/**
|
|
126
|
+
* Create a typed 'map' transform descriptor
|
|
127
|
+
*/
|
|
128
|
+
export declare function createMapTransform(config: MapTransformConfig): TransformDescriptor;
|
|
129
|
+
/**
|
|
130
|
+
* Create a typed 'filter' transform descriptor
|
|
131
|
+
*/
|
|
132
|
+
export declare function createFilterTransform(config: FilterTransformConfig): TransformDescriptor;
|
|
133
|
+
/**
|
|
134
|
+
* Create a typed 'pick' transform descriptor
|
|
135
|
+
*/
|
|
136
|
+
export declare function createPickTransform(config: PickTransformConfig): TransformDescriptor;
|
|
137
|
+
/**
|
|
138
|
+
* Create a typed 'omit' transform descriptor
|
|
139
|
+
*/
|
|
140
|
+
export declare function createOmitTransform(config: OmitTransformConfig): TransformDescriptor;
|
|
141
|
+
/**
|
|
142
|
+
* Create a typed 'custom' transform descriptor
|
|
143
|
+
*/
|
|
144
|
+
export declare function createCustomTransform(config: CustomTransformConfig): TransformDescriptor;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed Transform Wrappers
|
|
3
|
+
*
|
|
4
|
+
* Typed runtime wrappers for TransformDescriptor.config.
|
|
5
|
+
* These do NOT modify @pwfabric/contracts. They provide typed alternatives
|
|
6
|
+
* that narrow the opaque Record<string, unknown> config.
|
|
7
|
+
*
|
|
8
|
+
* @module @pwfabric/runtime/surface/transforms
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
// ============================================================
|
|
12
|
+
// ZOD SCHEMAS
|
|
13
|
+
// ============================================================
|
|
14
|
+
export const mapTransformConfigSchema = z.object({
|
|
15
|
+
field: z.string().min(1),
|
|
16
|
+
mapper: z.string().min(1),
|
|
17
|
+
});
|
|
18
|
+
export const filterTransformConfigSchema = z.object({
|
|
19
|
+
field: z.string().min(1),
|
|
20
|
+
predicate: z.string().min(1),
|
|
21
|
+
});
|
|
22
|
+
export const pickTransformConfigSchema = z.object({
|
|
23
|
+
fields: z.array(z.string().min(1)).min(1),
|
|
24
|
+
});
|
|
25
|
+
export const omitTransformConfigSchema = z.object({
|
|
26
|
+
fields: z.array(z.string().min(1)).min(1),
|
|
27
|
+
});
|
|
28
|
+
export const customTransformConfigSchema = z.object({
|
|
29
|
+
handler: z.string().min(1),
|
|
30
|
+
params: z.record(z.unknown()).optional(),
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Map of transform types to their Zod schemas
|
|
34
|
+
*/
|
|
35
|
+
const transformConfigSchemas = {
|
|
36
|
+
map: mapTransformConfigSchema,
|
|
37
|
+
filter: filterTransformConfigSchema,
|
|
38
|
+
pick: pickTransformConfigSchema,
|
|
39
|
+
omit: omitTransformConfigSchema,
|
|
40
|
+
custom: customTransformConfigSchema,
|
|
41
|
+
};
|
|
42
|
+
// ============================================================
|
|
43
|
+
// VALIDATION FUNCTION
|
|
44
|
+
// ============================================================
|
|
45
|
+
/**
|
|
46
|
+
* Validate a transform descriptor's config against the typed schema
|
|
47
|
+
* for the given transform type.
|
|
48
|
+
*/
|
|
49
|
+
export function validateTransformConfig(type, config) {
|
|
50
|
+
const schema = transformConfigSchemas[type];
|
|
51
|
+
const result = schema.safeParse(config);
|
|
52
|
+
if (result.success) {
|
|
53
|
+
return { valid: true, errors: [] };
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
valid: false,
|
|
57
|
+
errors: result.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// ============================================================
|
|
61
|
+
// TYPE GUARD
|
|
62
|
+
// ============================================================
|
|
63
|
+
/**
|
|
64
|
+
* Type guard that narrows an opaque TransformDescriptor into
|
|
65
|
+
* a TypedTransformConfig if the config passes validation.
|
|
66
|
+
*/
|
|
67
|
+
export function narrowTransformDescriptor(descriptor) {
|
|
68
|
+
if (!descriptor.config) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const schema = transformConfigSchemas[descriptor.type];
|
|
72
|
+
const result = schema.safeParse(descriptor.config);
|
|
73
|
+
if (!result.success) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
// The type assertion is safe because Zod validated the config shape
|
|
77
|
+
return {
|
|
78
|
+
type: descriptor.type,
|
|
79
|
+
config: result.data,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
// ============================================================
|
|
83
|
+
// FACTORY FUNCTIONS
|
|
84
|
+
// ============================================================
|
|
85
|
+
/**
|
|
86
|
+
* Create a typed 'map' transform descriptor
|
|
87
|
+
*/
|
|
88
|
+
export function createMapTransform(config) {
|
|
89
|
+
const parsed = mapTransformConfigSchema.parse(config);
|
|
90
|
+
return { type: 'map', config: parsed };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Create a typed 'filter' transform descriptor
|
|
94
|
+
*/
|
|
95
|
+
export function createFilterTransform(config) {
|
|
96
|
+
const parsed = filterTransformConfigSchema.parse(config);
|
|
97
|
+
return { type: 'filter', config: parsed };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create a typed 'pick' transform descriptor
|
|
101
|
+
*/
|
|
102
|
+
export function createPickTransform(config) {
|
|
103
|
+
const parsed = pickTransformConfigSchema.parse(config);
|
|
104
|
+
return { type: 'pick', config: { ...parsed, fields: [...parsed.fields] } };
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Create a typed 'omit' transform descriptor
|
|
108
|
+
*/
|
|
109
|
+
export function createOmitTransform(config) {
|
|
110
|
+
const parsed = omitTransformConfigSchema.parse(config);
|
|
111
|
+
return { type: 'omit', config: { ...parsed, fields: [...parsed.fields] } };
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Create a typed 'custom' transform descriptor
|
|
115
|
+
*/
|
|
116
|
+
export function createCustomTransform(config) {
|
|
117
|
+
const parsed = customTransformConfigSchema.parse(config);
|
|
118
|
+
return { type: 'custom', config: parsed };
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=transforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transforms.js","sourceRoot":"","sources":["../../src/surface/transforms.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Typed Transform Wrappers\n *\n * Typed runtime wrappers for TransformDescriptor.config.\n * These do NOT modify @pwfabric/contracts. They provide typed alternatives\n * that narrow the opaque Record<string, unknown> config.\n *\n * @module @pwfabric/runtime/surface/transforms\n */\n\nimport { z } from 'zod'\nimport type { TransformDescriptor } from '@pwfabric/contracts'\n\n// ============================================================\n// TYPED TRANSFORM CONFIG INTERFACES\n// ============================================================\n\n/**\n * Config for 'map' transforms\n */\nexport interface MapTransformConfig {\n readonly field: string\n readonly mapper: string\n}\n\n/**\n * Config for 'filter' transforms\n */\nexport interface FilterTransformConfig {\n readonly field: string\n readonly predicate: string\n}\n\n/**\n * Config for 'pick' transforms\n */\nexport interface PickTransformConfig {\n readonly fields: readonly string[]\n}\n\n/**\n * Config for 'omit' transforms\n */\nexport interface OmitTransformConfig {\n readonly fields: readonly string[]\n}\n\n/**\n * Config for 'custom' transforms\n */\nexport interface CustomTransformConfig {\n readonly handler: string\n readonly params?: Record<string, unknown>\n}\n\n/**\n * Discriminated union of all typed transform configs\n */\nexport type TypedTransformConfig =\n | { readonly type: 'map'; readonly config: MapTransformConfig }\n | { readonly type: 'filter'; readonly config: FilterTransformConfig }\n | { readonly type: 'pick'; readonly config: PickTransformConfig }\n | { readonly type: 'omit'; readonly config: OmitTransformConfig }\n | { readonly type: 'custom'; readonly config: CustomTransformConfig }\n\n// ============================================================\n// ZOD SCHEMAS\n// ============================================================\n\nexport const mapTransformConfigSchema = z.object({\n field: z.string().min(1),\n mapper: z.string().min(1),\n})\n\nexport const filterTransformConfigSchema = z.object({\n field: z.string().min(1),\n predicate: z.string().min(1),\n})\n\nexport const pickTransformConfigSchema = z.object({\n fields: z.array(z.string().min(1)).min(1),\n})\n\nexport const omitTransformConfigSchema = z.object({\n fields: z.array(z.string().min(1)).min(1),\n})\n\nexport const customTransformConfigSchema = z.object({\n handler: z.string().min(1),\n params: z.record(z.unknown()).optional(),\n})\n\n/**\n * Map of transform types to their Zod schemas\n */\nconst transformConfigSchemas = {\n map: mapTransformConfigSchema,\n filter: filterTransformConfigSchema,\n pick: pickTransformConfigSchema,\n omit: omitTransformConfigSchema,\n custom: customTransformConfigSchema,\n} as const\n\n// ============================================================\n// VALIDATION TYPES\n// ============================================================\n\n/**\n * Result of validating a transform config\n */\nexport interface TransformValidationResult {\n readonly valid: boolean\n readonly errors: readonly string[]\n}\n\n// ============================================================\n// VALIDATION FUNCTION\n// ============================================================\n\n/**\n * Validate a transform descriptor's config against the typed schema\n * for the given transform type.\n */\nexport function validateTransformConfig(\n type: TransformDescriptor['type'],\n config: Record<string, unknown>\n): TransformValidationResult {\n const schema = transformConfigSchemas[type]\n\n const result = schema.safeParse(config)\n\n if (result.success) {\n return { valid: true, errors: [] }\n }\n\n return {\n valid: false,\n errors: result.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`),\n }\n}\n\n// ============================================================\n// TYPE GUARD\n// ============================================================\n\n/**\n * Type guard that narrows an opaque TransformDescriptor into\n * a TypedTransformConfig if the config passes validation.\n */\nexport function narrowTransformDescriptor(\n descriptor: TransformDescriptor\n): TypedTransformConfig | null {\n if (!descriptor.config) {\n return null\n }\n\n const schema = transformConfigSchemas[descriptor.type]\n const result = schema.safeParse(descriptor.config)\n\n if (!result.success) {\n return null\n }\n\n // The type assertion is safe because Zod validated the config shape\n return {\n type: descriptor.type,\n config: result.data,\n } as TypedTransformConfig\n}\n\n// ============================================================\n// FACTORY FUNCTIONS\n// ============================================================\n\n/**\n * Create a typed 'map' transform descriptor\n */\nexport function createMapTransform(config: MapTransformConfig): TransformDescriptor {\n const parsed = mapTransformConfigSchema.parse(config)\n return { type: 'map', config: parsed }\n}\n\n/**\n * Create a typed 'filter' transform descriptor\n */\nexport function createFilterTransform(config: FilterTransformConfig): TransformDescriptor {\n const parsed = filterTransformConfigSchema.parse(config)\n return { type: 'filter', config: parsed }\n}\n\n/**\n * Create a typed 'pick' transform descriptor\n */\nexport function createPickTransform(config: PickTransformConfig): TransformDescriptor {\n const parsed = pickTransformConfigSchema.parse(config)\n return { type: 'pick', config: { ...parsed, fields: [...parsed.fields] } }\n}\n\n/**\n * Create a typed 'omit' transform descriptor\n */\nexport function createOmitTransform(config: OmitTransformConfig): TransformDescriptor {\n const parsed = omitTransformConfigSchema.parse(config)\n return { type: 'omit', config: { ...parsed, fields: [...parsed.fields] } }\n}\n\n/**\n * Create a typed 'custom' transform descriptor\n */\nexport function createCustomTransform(config: CustomTransformConfig): TransformDescriptor {\n const parsed = customTransformConfigSchema.parse(config)\n return { type: 'custom', config: parsed }\n}\n"]}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Surface Rendering Types
|
|
3
|
+
*
|
|
4
|
+
* Internal types for surface rendering pipeline
|
|
5
|
+
*
|
|
6
|
+
* @module @pwfabric/runtime/surface/types
|
|
7
|
+
*/
|
|
8
|
+
import type { CapabilityId, SurfaceId } from '@pwfabric/contracts';
|
|
9
|
+
/**
|
|
10
|
+
* Primitive types supported by the runtime
|
|
11
|
+
*/
|
|
12
|
+
export type PrimitiveType = 'text' | 'container' | 'button' | 'input' | 'image' | 'link' | 'list' | 'list-item' | 'divider' | 'spacer' | 'heading' | 'paragraph' | 'slot' | 'fragment' | 'conditional' | 'loop';
|
|
13
|
+
/**
|
|
14
|
+
* Base properties shared by all render nodes
|
|
15
|
+
*/
|
|
16
|
+
export interface BaseNodeProps {
|
|
17
|
+
readonly id?: string;
|
|
18
|
+
readonly key?: string;
|
|
19
|
+
readonly className?: string;
|
|
20
|
+
readonly style?: Record<string, string | number>;
|
|
21
|
+
readonly data?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Render node - the output of surface rendering
|
|
25
|
+
*/
|
|
26
|
+
export interface RenderNode {
|
|
27
|
+
readonly type: PrimitiveType | string;
|
|
28
|
+
readonly props: BaseNodeProps & Record<string, unknown>;
|
|
29
|
+
readonly children: readonly RenderNode[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create a render node
|
|
33
|
+
*/
|
|
34
|
+
export declare function createNode(type: PrimitiveType | string, props?: BaseNodeProps & Record<string, unknown>, children?: readonly RenderNode[]): RenderNode;
|
|
35
|
+
/**
|
|
36
|
+
* Surface JSON definition (input format)
|
|
37
|
+
*/
|
|
38
|
+
export interface SurfaceJSON {
|
|
39
|
+
readonly $schema?: string;
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly version: string;
|
|
42
|
+
readonly environment: string;
|
|
43
|
+
readonly metadata?: {
|
|
44
|
+
readonly name?: string;
|
|
45
|
+
readonly description?: string;
|
|
46
|
+
readonly tags?: readonly string[];
|
|
47
|
+
};
|
|
48
|
+
readonly bindings?: readonly BindingJSON[];
|
|
49
|
+
readonly layout: LayoutJSON;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Capability binding in JSON
|
|
53
|
+
*/
|
|
54
|
+
export interface BindingJSON {
|
|
55
|
+
readonly capability: string;
|
|
56
|
+
readonly alias?: string;
|
|
57
|
+
readonly transform?: {
|
|
58
|
+
readonly input?: Record<string, unknown>;
|
|
59
|
+
readonly output?: Record<string, unknown>;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Layout definition in JSON
|
|
64
|
+
*/
|
|
65
|
+
export interface LayoutJSON {
|
|
66
|
+
readonly type: PrimitiveType | string;
|
|
67
|
+
readonly props?: Record<string, unknown>;
|
|
68
|
+
readonly children?: readonly LayoutJSON[];
|
|
69
|
+
readonly slot?: string;
|
|
70
|
+
readonly if?: string;
|
|
71
|
+
readonly each?: {
|
|
72
|
+
readonly items: string;
|
|
73
|
+
readonly as: string;
|
|
74
|
+
readonly key?: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Context passed during rendering
|
|
79
|
+
*/
|
|
80
|
+
export interface RenderContext {
|
|
81
|
+
readonly surfaceId: SurfaceId;
|
|
82
|
+
readonly bindings: Map<string, CapabilityId>;
|
|
83
|
+
readonly data: Record<string, unknown>;
|
|
84
|
+
readonly slots: Map<string, readonly RenderNode[]>;
|
|
85
|
+
readonly parent?: RenderContext;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Create a render context
|
|
89
|
+
*/
|
|
90
|
+
export declare function createRenderContext(options: {
|
|
91
|
+
surfaceId: SurfaceId;
|
|
92
|
+
bindings?: Map<string, CapabilityId>;
|
|
93
|
+
data?: Record<string, unknown>;
|
|
94
|
+
slots?: Map<string, readonly RenderNode[]>;
|
|
95
|
+
parent?: RenderContext;
|
|
96
|
+
}): RenderContext;
|
|
97
|
+
/**
|
|
98
|
+
* Create a child context with additional data
|
|
99
|
+
*/
|
|
100
|
+
export declare function createChildContext(parent: RenderContext, additionalData: Record<string, unknown>): RenderContext;
|
|
101
|
+
/**
|
|
102
|
+
* Result of rendering a surface
|
|
103
|
+
*/
|
|
104
|
+
export type RenderResult = {
|
|
105
|
+
readonly success: true;
|
|
106
|
+
readonly output: RenderOutput;
|
|
107
|
+
} | {
|
|
108
|
+
readonly success: false;
|
|
109
|
+
readonly error: RenderError;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Render output
|
|
113
|
+
*/
|
|
114
|
+
export interface RenderOutput {
|
|
115
|
+
readonly surfaceId: SurfaceId;
|
|
116
|
+
readonly root: RenderNode;
|
|
117
|
+
readonly metadata: {
|
|
118
|
+
readonly renderTime: number;
|
|
119
|
+
readonly nodeCount: number;
|
|
120
|
+
readonly bindings: readonly string[];
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Formalized error code vocabulary for render errors
|
|
125
|
+
*/
|
|
126
|
+
export type RenderErrorCode = 'invalid_surface' | 'missing_binding' | 'layout_error' | 'slot_error' | 'expression_error';
|
|
127
|
+
/**
|
|
128
|
+
* Render error types
|
|
129
|
+
*/
|
|
130
|
+
export type RenderError = {
|
|
131
|
+
readonly type: 'invalid_surface';
|
|
132
|
+
readonly message: string;
|
|
133
|
+
readonly details?: Record<string, unknown>;
|
|
134
|
+
} | {
|
|
135
|
+
readonly type: 'missing_binding';
|
|
136
|
+
readonly binding: string;
|
|
137
|
+
readonly details?: Record<string, unknown>;
|
|
138
|
+
} | {
|
|
139
|
+
readonly type: 'layout_error';
|
|
140
|
+
readonly message: string;
|
|
141
|
+
readonly details?: Record<string, unknown>;
|
|
142
|
+
} | {
|
|
143
|
+
readonly type: 'slot_error';
|
|
144
|
+
readonly slot: string;
|
|
145
|
+
readonly message: string;
|
|
146
|
+
readonly details?: Record<string, unknown>;
|
|
147
|
+
} | {
|
|
148
|
+
readonly type: 'expression_error';
|
|
149
|
+
readonly expression: string;
|
|
150
|
+
readonly message: string;
|
|
151
|
+
readonly details?: Record<string, unknown>;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Create a successful render result
|
|
155
|
+
*/
|
|
156
|
+
export declare function renderSuccess(output: RenderOutput): RenderResult;
|
|
157
|
+
/**
|
|
158
|
+
* Create a failed render result
|
|
159
|
+
*/
|
|
160
|
+
export declare function renderError(error: RenderError): RenderResult;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Surface Rendering Types
|
|
3
|
+
*
|
|
4
|
+
* Internal types for surface rendering pipeline
|
|
5
|
+
*
|
|
6
|
+
* @module @pwfabric/runtime/surface/types
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Create a render node
|
|
10
|
+
*/
|
|
11
|
+
export function createNode(type, props = {}, children = []) {
|
|
12
|
+
return { type, props, children };
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a render context
|
|
16
|
+
*/
|
|
17
|
+
export function createRenderContext(options) {
|
|
18
|
+
const result = {
|
|
19
|
+
surfaceId: options.surfaceId,
|
|
20
|
+
bindings: options.bindings ?? new Map(),
|
|
21
|
+
data: options.data ?? {},
|
|
22
|
+
slots: options.slots ?? new Map(),
|
|
23
|
+
};
|
|
24
|
+
if (options.parent) {
|
|
25
|
+
return { ...result, parent: options.parent };
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a child context with additional data
|
|
31
|
+
*/
|
|
32
|
+
export function createChildContext(parent, additionalData) {
|
|
33
|
+
return {
|
|
34
|
+
...parent,
|
|
35
|
+
data: { ...parent.data, ...additionalData },
|
|
36
|
+
parent,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create a successful render result
|
|
41
|
+
*/
|
|
42
|
+
export function renderSuccess(output) {
|
|
43
|
+
return { success: true, output };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a failed render result
|
|
47
|
+
*/
|
|
48
|
+
export function renderError(error) {
|
|
49
|
+
return { success: false, error };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/surface/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiDH;;GAEG;AACH,MAAM,UAAU,UAAU,CACxB,IAA4B,EAC5B,QAAiD,EAAE,EACnD,WAAkC,EAAE;IAEpC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;AAClC,CAAC;AAkED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAMnC;IACC,MAAM,MAAM,GAAkB;QAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,IAAI,GAAG,EAAE;QACvC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI,GAAG,EAAE;KAClC,CAAA;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;IAC9C,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAqB,EACrB,cAAuC;IAEvC,OAAO;QACL,GAAG,MAAM;QACT,IAAI,EAAE,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,GAAG,cAAc,EAAE;QAC3C,MAAM;KACP,CAAA;AACH,CAAC;AAoED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAoB;IAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAkB;IAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAClC,CAAC","sourcesContent":["/**\n * Surface Rendering Types\n *\n * Internal types for surface rendering pipeline\n *\n * @module @pwfabric/runtime/surface/types\n */\n\nimport type { CapabilityId, SurfaceId } from '@pwfabric/contracts'\n\n// ============================================================\n// RENDER NODE TYPES\n// ============================================================\n\n/**\n * Primitive types supported by the runtime\n */\nexport type PrimitiveType =\n | 'text'\n | 'container'\n | 'button'\n | 'input'\n | 'image'\n | 'link'\n | 'list'\n | 'list-item'\n | 'divider'\n | 'spacer'\n | 'heading'\n | 'paragraph'\n | 'slot'\n | 'fragment'\n | 'conditional'\n | 'loop'\n\n/**\n * Base properties shared by all render nodes\n */\nexport interface BaseNodeProps {\n readonly id?: string\n readonly key?: string\n readonly className?: string\n readonly style?: Record<string, string | number>\n readonly data?: Record<string, unknown>\n}\n\n/**\n * Render node - the output of surface rendering\n */\nexport interface RenderNode {\n readonly type: PrimitiveType | string\n readonly props: BaseNodeProps & Record<string, unknown>\n readonly children: readonly RenderNode[]\n}\n\n/**\n * Create a render node\n */\nexport function createNode(\n type: PrimitiveType | string,\n props: BaseNodeProps & Record<string, unknown> = {},\n children: readonly RenderNode[] = []\n): RenderNode {\n return { type, props, children }\n}\n\n// ============================================================\n// SURFACE JSON SCHEMA\n// ============================================================\n\n/**\n * Surface JSON definition (input format)\n */\nexport interface SurfaceJSON {\n readonly $schema?: string\n readonly id: string\n readonly version: string\n readonly environment: string\n readonly metadata?: {\n readonly name?: string\n readonly description?: string\n readonly tags?: readonly string[]\n }\n readonly bindings?: readonly BindingJSON[]\n readonly layout: LayoutJSON\n}\n\n/**\n * Capability binding in JSON\n */\nexport interface BindingJSON {\n readonly capability: string\n readonly alias?: string\n readonly transform?: {\n readonly input?: Record<string, unknown>\n readonly output?: Record<string, unknown>\n }\n}\n\n/**\n * Layout definition in JSON\n */\nexport interface LayoutJSON {\n readonly type: PrimitiveType | string\n readonly props?: Record<string, unknown>\n readonly children?: readonly LayoutJSON[]\n readonly slot?: string\n readonly if?: string\n readonly each?: {\n readonly items: string\n readonly as: string\n readonly key?: string\n }\n}\n\n// ============================================================\n// RENDER CONTEXT\n// ============================================================\n\n/**\n * Context passed during rendering\n */\nexport interface RenderContext {\n readonly surfaceId: SurfaceId\n readonly bindings: Map<string, CapabilityId>\n readonly data: Record<string, unknown>\n readonly slots: Map<string, readonly RenderNode[]>\n readonly parent?: RenderContext\n}\n\n/**\n * Create a render context\n */\nexport function createRenderContext(options: {\n surfaceId: SurfaceId\n bindings?: Map<string, CapabilityId>\n data?: Record<string, unknown>\n slots?: Map<string, readonly RenderNode[]>\n parent?: RenderContext\n}): RenderContext {\n const result: RenderContext = {\n surfaceId: options.surfaceId,\n bindings: options.bindings ?? new Map(),\n data: options.data ?? {},\n slots: options.slots ?? new Map(),\n }\n if (options.parent) {\n return { ...result, parent: options.parent }\n }\n return result\n}\n\n/**\n * Create a child context with additional data\n */\nexport function createChildContext(\n parent: RenderContext,\n additionalData: Record<string, unknown>\n): RenderContext {\n return {\n ...parent,\n data: { ...parent.data, ...additionalData },\n parent,\n }\n}\n\n// ============================================================\n// RENDER RESULT\n// ============================================================\n\n/**\n * Result of rendering a surface\n */\nexport type RenderResult =\n | { readonly success: true; readonly output: RenderOutput }\n | { readonly success: false; readonly error: RenderError }\n\n/**\n * Render output\n */\nexport interface RenderOutput {\n readonly surfaceId: SurfaceId\n readonly root: RenderNode\n readonly metadata: {\n readonly renderTime: number\n readonly nodeCount: number\n readonly bindings: readonly string[]\n }\n}\n\n/**\n * Formalized error code vocabulary for render errors\n */\nexport type RenderErrorCode =\n | 'invalid_surface'\n | 'missing_binding'\n | 'layout_error'\n | 'slot_error'\n | 'expression_error'\n\n/**\n * Render error types\n */\nexport type RenderError =\n | {\n readonly type: 'invalid_surface'\n readonly message: string\n readonly details?: Record<string, unknown>\n }\n | {\n readonly type: 'missing_binding'\n readonly binding: string\n readonly details?: Record<string, unknown>\n }\n | {\n readonly type: 'layout_error'\n readonly message: string\n readonly details?: Record<string, unknown>\n }\n | {\n readonly type: 'slot_error'\n readonly slot: string\n readonly message: string\n readonly details?: Record<string, unknown>\n }\n | {\n readonly type: 'expression_error'\n readonly expression: string\n readonly message: string\n readonly details?: Record<string, unknown>\n }\n\n/**\n * Create a successful render result\n */\nexport function renderSuccess(output: RenderOutput): RenderResult {\n return { success: true, output }\n}\n\n/**\n * Create a failed render result\n */\nexport function renderError(error: RenderError): RenderResult {\n return { success: false, error }\n}\n"]}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block Props Validation
|
|
3
|
+
*
|
|
4
|
+
* Runtime validation of block props using injected Zod schemas.
|
|
5
|
+
* the legacy `blockSchemas` map is gone — production
|
|
6
|
+
* callers supply a schema map sourced from the install pipeline (per-atom
|
|
7
|
+
* `manifest.definition.props[*].jsonSchema` rebuilt into Zod). Without a
|
|
8
|
+
* schema map the validator runs in lenient mode and passes everything
|
|
9
|
+
* through.
|
|
10
|
+
*
|
|
11
|
+
* @module @pwfabric/runtime/surface/validation
|
|
12
|
+
*/
|
|
13
|
+
import type { ZodSchema } from 'zod';
|
|
14
|
+
/** Map of block type → Zod schema. Supply via options to enable strict checks. */
|
|
15
|
+
export type BlockSchemaMap = Readonly<Record<string, ZodSchema>>;
|
|
16
|
+
/**
|
|
17
|
+
* Options for block props validation
|
|
18
|
+
*/
|
|
19
|
+
export interface BlockPropsValidationOptions {
|
|
20
|
+
/**
|
|
21
|
+
* When true, unknown block types cause validation failure.
|
|
22
|
+
* When false (default), unknown block types pass through.
|
|
23
|
+
*/
|
|
24
|
+
readonly strict?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Per-block-type Zod schemas. the runtime no longer
|
|
27
|
+
* ships a built-in schema map — callers that want prop validation
|
|
28
|
+
* supply their own (typically rebuilt from
|
|
29
|
+
* each installed block manifest's `definition.props[*].jsonSchema`).
|
|
30
|
+
* Omitting the map yields lenient pass-through behaviour.
|
|
31
|
+
*/
|
|
32
|
+
readonly schemas?: BlockSchemaMap;
|
|
33
|
+
/**
|
|
34
|
+
* Per-block-type manifest props. When supplied, props a manifest
|
|
35
|
+
* does not declare and templates on `bindable: false` props are reported as
|
|
36
|
+
* WARNINGS (`manifestPropFindings`); they never fail validation.
|
|
37
|
+
*/
|
|
38
|
+
readonly manifests?: BlockManifestPropsMap;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Result of validating block props against the schema
|
|
42
|
+
*/
|
|
43
|
+
export interface BlockPropsValidationResult {
|
|
44
|
+
readonly valid: boolean;
|
|
45
|
+
readonly errors: readonly string[];
|
|
46
|
+
readonly coerced?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Validate block props against the known Zod schema for the given block type.
|
|
50
|
+
*
|
|
51
|
+
* - Known block types are validated against the schema from @pwfabric/core.
|
|
52
|
+
* - Unknown block types pass through in lenient mode (default) and fail in strict mode.
|
|
53
|
+
* - On success, returns coerced data (with defaults applied by Zod).
|
|
54
|
+
*/
|
|
55
|
+
export declare function validateBlockProps(type: string, props: Record<string, unknown>, options?: BlockPropsValidationOptions): BlockPropsValidationResult;
|
|
56
|
+
/**
|
|
57
|
+
* Layout node shape for recursive validation.
|
|
58
|
+
* Matches LayoutJSON structure without importing it to avoid circular deps.
|
|
59
|
+
*/
|
|
60
|
+
interface LayoutNode {
|
|
61
|
+
readonly type: string;
|
|
62
|
+
readonly props?: Record<string, unknown>;
|
|
63
|
+
readonly children?: readonly LayoutNode[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A single validation issue with path context
|
|
67
|
+
*/
|
|
68
|
+
export interface LayoutPropsIssue {
|
|
69
|
+
readonly path: string;
|
|
70
|
+
readonly type: string;
|
|
71
|
+
readonly errors: readonly string[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Validate all block props in a layout tree recursively.
|
|
75
|
+
*
|
|
76
|
+
* Returns a flat list of validation issues with path context.
|
|
77
|
+
*/
|
|
78
|
+
export declare function validateLayoutProps(layout: LayoutNode, options?: BlockPropsValidationOptions, path?: string): readonly LayoutPropsIssue[];
|
|
79
|
+
/**
|
|
80
|
+
* One prop a pack manifest declares: `manifest.definition.props[*]`. Only the
|
|
81
|
+
* two fields the check reads; a full manifest entry passes as it is.
|
|
82
|
+
*/
|
|
83
|
+
export interface ManifestPropSpec {
|
|
84
|
+
readonly name: string;
|
|
85
|
+
/** `false` = the prop takes a literal only; a `{{ }}` template is not resolved for it. */
|
|
86
|
+
readonly bindable?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/** Block type → the props its manifest declares. */
|
|
89
|
+
export type BlockManifestPropsMap = Readonly<Record<string, readonly ManifestPropSpec[]>>;
|
|
90
|
+
export type ManifestPropFindingCode = 'UNKNOWN_PROP' | 'TEMPLATE_ON_UNBINDABLE';
|
|
91
|
+
/**
|
|
92
|
+
* A prop that does not match its block's manifest. Always a WARNING:
|
|
93
|
+
* existing apps carry such props and must keep rendering; a caller
|
|
94
|
+
* decides whether to show, count or (later) refuse them.
|
|
95
|
+
*/
|
|
96
|
+
export interface ManifestPropFinding {
|
|
97
|
+
readonly path: string;
|
|
98
|
+
readonly type: string;
|
|
99
|
+
readonly prop: string;
|
|
100
|
+
readonly code: ManifestPropFindingCode;
|
|
101
|
+
readonly severity: 'warning';
|
|
102
|
+
readonly message: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The props of ONE block that its manifest does not allow.
|
|
106
|
+
*
|
|
107
|
+
* WHY: a prop the manifest does not declare was
|
|
108
|
+
* accepted silently. The schema check rebuilds each prop's JSON schema into a
|
|
109
|
+
* passthrough object, so a misspelt or invented prop (`tone` on a block that
|
|
110
|
+
* has none, `paddingY` where the block reads `padding`) validated clean and
|
|
111
|
+
* did nothing on screen. And a `{{ }}` template on a `bindable: false` prop was
|
|
112
|
+
* shown to the visitor as literal braces. Both are now named.
|
|
113
|
+
*
|
|
114
|
+
* @param specs the block's declared props; `undefined` (block not in the map)
|
|
115
|
+
* yields nothing, because an unknown block type is a different finding.
|
|
116
|
+
*/
|
|
117
|
+
export declare function blockManifestPropFindings(type: string, props: Record<string, unknown> | undefined, specs: readonly ManifestPropSpec[] | undefined, path?: string): ManifestPropFinding[];
|
|
118
|
+
/**
|
|
119
|
+
* Every manifest finding in a layout tree, with path context. Blocks whose
|
|
120
|
+
* type is not in `manifests` are skipped.
|
|
121
|
+
*/
|
|
122
|
+
export declare function manifestPropFindings(layout: LayoutNode, manifests: BlockManifestPropsMap, path?: string): ManifestPropFinding[];
|
|
123
|
+
export {};
|