@aigne/aos 0.2.0-beta
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/CHANGELOG.md +49 -0
- package/LICENSE.md +26 -0
- package/dist/agent-dsl.cjs +116 -0
- package/dist/agent-dsl.d.cts +31 -0
- package/dist/agent-dsl.d.cts.map +1 -0
- package/dist/agent-dsl.d.mts +31 -0
- package/dist/agent-dsl.d.mts.map +1 -0
- package/dist/agent-dsl.mjs +115 -0
- package/dist/agent-dsl.mjs.map +1 -0
- package/dist/arc-compat.cjs +125 -0
- package/dist/arc-compat.d.cts +17 -0
- package/dist/arc-compat.d.cts.map +1 -0
- package/dist/arc-compat.d.mts +17 -0
- package/dist/arc-compat.d.mts.map +1 -0
- package/dist/arc-compat.mjs +123 -0
- package/dist/arc-compat.mjs.map +1 -0
- package/dist/auto-surface/compiler.cjs +36 -0
- package/dist/auto-surface/compiler.d.cts +7 -0
- package/dist/auto-surface/compiler.d.cts.map +1 -0
- package/dist/auto-surface/compiler.d.mts +7 -0
- package/dist/auto-surface/compiler.d.mts.map +1 -0
- package/dist/auto-surface/compiler.mjs +37 -0
- package/dist/auto-surface/compiler.mjs.map +1 -0
- package/dist/auto-surface/definition-dsl.cjs +333 -0
- package/dist/auto-surface/definition-dsl.d.cts +41 -0
- package/dist/auto-surface/definition-dsl.d.cts.map +1 -0
- package/dist/auto-surface/definition-dsl.d.mts +41 -0
- package/dist/auto-surface/definition-dsl.d.mts.map +1 -0
- package/dist/auto-surface/definition-dsl.mjs +332 -0
- package/dist/auto-surface/definition-dsl.mjs.map +1 -0
- package/dist/auto-surface/fragments.cjs +177 -0
- package/dist/auto-surface/fragments.d.cts +23 -0
- package/dist/auto-surface/fragments.d.cts.map +1 -0
- package/dist/auto-surface/fragments.d.mts +23 -0
- package/dist/auto-surface/fragments.d.mts.map +1 -0
- package/dist/auto-surface/fragments.mjs +175 -0
- package/dist/auto-surface/fragments.mjs.map +1 -0
- package/dist/auto-surface/index.d.mts +9 -0
- package/dist/auto-surface/layering.cjs +43 -0
- package/dist/auto-surface/layering.d.cts +7 -0
- package/dist/auto-surface/layering.d.cts.map +1 -0
- package/dist/auto-surface/layering.d.mts +7 -0
- package/dist/auto-surface/layering.d.mts.map +1 -0
- package/dist/auto-surface/layering.mjs +43 -0
- package/dist/auto-surface/layering.mjs.map +1 -0
- package/dist/auto-surface/projection.cjs +11 -0
- package/dist/auto-surface/projection.d.cts +11 -0
- package/dist/auto-surface/projection.d.cts.map +1 -0
- package/dist/auto-surface/projection.d.mts +11 -0
- package/dist/auto-surface/projection.d.mts.map +1 -0
- package/dist/auto-surface/projection.mjs +12 -0
- package/dist/auto-surface/projection.mjs.map +1 -0
- package/dist/auto-surface/projectors/settings-shell.cjs +114 -0
- package/dist/auto-surface/projectors/settings-shell.d.cts +10 -0
- package/dist/auto-surface/projectors/settings-shell.d.cts.map +1 -0
- package/dist/auto-surface/projectors/settings-shell.d.mts +10 -0
- package/dist/auto-surface/projectors/settings-shell.d.mts.map +1 -0
- package/dist/auto-surface/projectors/settings-shell.mjs +114 -0
- package/dist/auto-surface/projectors/settings-shell.mjs.map +1 -0
- package/dist/auto-surface/scenario.cjs +38 -0
- package/dist/auto-surface/scenario.d.cts +31 -0
- package/dist/auto-surface/scenario.d.cts.map +1 -0
- package/dist/auto-surface/scenario.d.mts +31 -0
- package/dist/auto-surface/scenario.d.mts.map +1 -0
- package/dist/auto-surface/scenario.mjs +37 -0
- package/dist/auto-surface/scenario.mjs.map +1 -0
- package/dist/auto-surface/types.cjs +9 -0
- package/dist/auto-surface/types.d.cts +153 -0
- package/dist/auto-surface/types.d.cts.map +1 -0
- package/dist/auto-surface/types.d.mts +153 -0
- package/dist/auto-surface/types.d.mts.map +1 -0
- package/dist/auto-surface/types.mjs +9 -0
- package/dist/auto-surface/types.mjs.map +1 -0
- package/dist/auto-surface/value-dsl.cjs +80 -0
- package/dist/auto-surface/value-dsl.d.cts +24 -0
- package/dist/auto-surface/value-dsl.d.cts.map +1 -0
- package/dist/auto-surface/value-dsl.d.mts +24 -0
- package/dist/auto-surface/value-dsl.d.mts.map +1 -0
- package/dist/auto-surface/value-dsl.mjs +79 -0
- package/dist/auto-surface/value-dsl.mjs.map +1 -0
- package/dist/blocklet/activation.cjs +94 -0
- package/dist/blocklet/activation.d.cts +30 -0
- package/dist/blocklet/activation.d.cts.map +1 -0
- package/dist/blocklet/activation.d.mts +30 -0
- package/dist/blocklet/activation.d.mts.map +1 -0
- package/dist/blocklet/activation.mjs +94 -0
- package/dist/blocklet/activation.mjs.map +1 -0
- package/dist/blocklet/did-space-registry.cjs +282 -0
- package/dist/blocklet/did-space-registry.d.cts +82 -0
- package/dist/blocklet/did-space-registry.d.cts.map +1 -0
- package/dist/blocklet/did-space-registry.d.mts +82 -0
- package/dist/blocklet/did-space-registry.d.mts.map +1 -0
- package/dist/blocklet/did-space-registry.mjs +281 -0
- package/dist/blocklet/did-space-registry.mjs.map +1 -0
- package/dist/blocklet/handlers.cjs +66 -0
- package/dist/blocklet/handlers.d.cts +16 -0
- package/dist/blocklet/handlers.d.cts.map +1 -0
- package/dist/blocklet/handlers.d.mts +16 -0
- package/dist/blocklet/handlers.d.mts.map +1 -0
- package/dist/blocklet/handlers.mjs +65 -0
- package/dist/blocklet/handlers.mjs.map +1 -0
- package/dist/blocklet/index.d.mts +7 -0
- package/dist/blocklet/manifest.d.cts +2 -0
- package/dist/blocklet/manifest.d.mts +2 -0
- package/dist/blocklet/manifest.mjs +3 -0
- package/dist/blocklet/registry.cjs +447 -0
- package/dist/blocklet/registry.d.cts +197 -0
- package/dist/blocklet/registry.d.cts.map +1 -0
- package/dist/blocklet/registry.d.mts +197 -0
- package/dist/blocklet/registry.d.mts.map +1 -0
- package/dist/blocklet/registry.mjs +441 -0
- package/dist/blocklet/registry.mjs.map +1 -0
- package/dist/blocklet/static-render.cjs +183 -0
- package/dist/blocklet/static-render.d.cts +55 -0
- package/dist/blocklet/static-render.d.cts.map +1 -0
- package/dist/blocklet/static-render.d.mts +55 -0
- package/dist/blocklet/static-render.d.mts.map +1 -0
- package/dist/blocklet/static-render.mjs +181 -0
- package/dist/blocklet/static-render.mjs.map +1 -0
- package/dist/blocklet/types.d.cts +70 -0
- package/dist/blocklet/types.d.cts.map +1 -0
- package/dist/blocklet/types.d.mts +70 -0
- package/dist/blocklet/types.d.mts.map +1 -0
- package/dist/devices/chain.cjs +127 -0
- package/dist/devices/chain.d.cts +48 -0
- package/dist/devices/chain.d.cts.map +1 -0
- package/dist/devices/chain.d.mts +48 -0
- package/dist/devices/chain.d.mts.map +1 -0
- package/dist/devices/chain.mjs +125 -0
- package/dist/devices/chain.mjs.map +1 -0
- package/dist/dsl-shared.cjs +290 -0
- package/dist/dsl-shared.d.cts +54 -0
- package/dist/dsl-shared.d.cts.map +1 -0
- package/dist/dsl-shared.d.mts +54 -0
- package/dist/dsl-shared.d.mts.map +1 -0
- package/dist/dsl-shared.mjs +287 -0
- package/dist/dsl-shared.mjs.map +1 -0
- package/dist/http/afs-mcp.cjs +85 -0
- package/dist/http/afs-mcp.d.cts +14 -0
- package/dist/http/afs-mcp.d.cts.map +1 -0
- package/dist/http/afs-mcp.d.mts +14 -0
- package/dist/http/afs-mcp.d.mts.map +1 -0
- package/dist/http/afs-mcp.mjs +86 -0
- package/dist/http/afs-mcp.mjs.map +1 -0
- package/dist/http/afs-raw.cjs +264 -0
- package/dist/http/afs-raw.d.cts +31 -0
- package/dist/http/afs-raw.d.cts.map +1 -0
- package/dist/http/afs-raw.d.mts +31 -0
- package/dist/http/afs-raw.d.mts.map +1 -0
- package/dist/http/afs-raw.mjs +264 -0
- package/dist/http/afs-raw.mjs.map +1 -0
- package/dist/http/afs-rest.cjs +30 -0
- package/dist/http/afs-rest.d.cts +21 -0
- package/dist/http/afs-rest.d.cts.map +1 -0
- package/dist/http/afs-rest.d.mts +21 -0
- package/dist/http/afs-rest.d.mts.map +1 -0
- package/dist/http/afs-rest.mjs +31 -0
- package/dist/http/afs-rest.mjs.map +1 -0
- package/dist/http/afs-rpc-wire.cjs +271 -0
- package/dist/http/afs-rpc-wire.d.cts +195 -0
- package/dist/http/afs-rpc-wire.d.cts.map +1 -0
- package/dist/http/afs-rpc-wire.d.mts +195 -0
- package/dist/http/afs-rpc-wire.d.mts.map +1 -0
- package/dist/http/afs-rpc-wire.mjs +262 -0
- package/dist/http/afs-rpc-wire.mjs.map +1 -0
- package/dist/http/afs-rpc.cjs +729 -0
- package/dist/http/afs-rpc.d.cts +103 -0
- package/dist/http/afs-rpc.d.cts.map +1 -0
- package/dist/http/afs-rpc.d.mts +103 -0
- package/dist/http/afs-rpc.d.mts.map +1 -0
- package/dist/http/afs-rpc.mjs +729 -0
- package/dist/http/afs-rpc.mjs.map +1 -0
- package/dist/http/afs-upload.cjs +116 -0
- package/dist/http/afs-upload.d.cts +40 -0
- package/dist/http/afs-upload.d.cts.map +1 -0
- package/dist/http/afs-upload.d.mts +40 -0
- package/dist/http/afs-upload.d.mts.map +1 -0
- package/dist/http/afs-upload.mjs +116 -0
- package/dist/http/afs-upload.mjs.map +1 -0
- package/dist/http/aup-client.cjs +60 -0
- package/dist/http/aup-client.d.cts +22 -0
- package/dist/http/aup-client.d.cts.map +1 -0
- package/dist/http/aup-client.d.mts +22 -0
- package/dist/http/aup-client.d.mts.map +1 -0
- package/dist/http/aup-client.mjs +59 -0
- package/dist/http/aup-client.mjs.map +1 -0
- package/dist/http/aup-event.cjs +100 -0
- package/dist/http/aup-event.d.cts +38 -0
- package/dist/http/aup-event.d.cts.map +1 -0
- package/dist/http/aup-event.d.mts +38 -0
- package/dist/http/aup-event.d.mts.map +1 -0
- package/dist/http/aup-event.mjs +101 -0
- package/dist/http/aup-event.mjs.map +1 -0
- package/dist/http/auth-context.cjs +66 -0
- package/dist/http/auth-context.d.cts +64 -0
- package/dist/http/auth-context.d.cts.map +1 -0
- package/dist/http/auth-context.d.mts +64 -0
- package/dist/http/auth-context.d.mts.map +1 -0
- package/dist/http/auth-context.mjs +66 -0
- package/dist/http/auth-context.mjs.map +1 -0
- package/dist/http/csrf.cjs +50 -0
- package/dist/http/csrf.d.cts +8 -0
- package/dist/http/csrf.d.cts.map +1 -0
- package/dist/http/csrf.d.mts +8 -0
- package/dist/http/csrf.d.mts.map +1 -0
- package/dist/http/csrf.mjs +49 -0
- package/dist/http/csrf.mjs.map +1 -0
- package/dist/http/handlers.cjs +106 -0
- package/dist/http/handlers.d.cts +39 -0
- package/dist/http/handlers.d.cts.map +1 -0
- package/dist/http/handlers.d.mts +39 -0
- package/dist/http/handlers.d.mts.map +1 -0
- package/dist/http/handlers.mjs +104 -0
- package/dist/http/handlers.mjs.map +1 -0
- package/dist/http/index.d.mts +1 -0
- package/dist/http/ingest-facade.cjs +315 -0
- package/dist/http/ingest-facade.mjs +314 -0
- package/dist/http/ingest-facade.mjs.map +1 -0
- package/dist/http/raw-url.cjs +136 -0
- package/dist/http/raw-url.d.cts +54 -0
- package/dist/http/raw-url.d.cts.map +1 -0
- package/dist/http/raw-url.d.mts +54 -0
- package/dist/http/raw-url.d.mts.map +1 -0
- package/dist/http/raw-url.mjs +136 -0
- package/dist/http/raw-url.mjs.map +1 -0
- package/dist/http/request-context.cjs +178 -0
- package/dist/http/request-context.d.cts +76 -0
- package/dist/http/request-context.d.cts.map +1 -0
- package/dist/http/request-context.d.mts +76 -0
- package/dist/http/request-context.d.mts.map +1 -0
- package/dist/http/request-context.mjs +179 -0
- package/dist/http/request-context.mjs.map +1 -0
- package/dist/index.cjs +197 -0
- package/dist/index.d.cts +63 -0
- package/dist/index.d.mts +68 -0
- package/dist/index.mjs +61 -0
- package/dist/mcp/index.cjs +9 -0
- package/dist/mcp/index.d.cts +5 -0
- package/dist/mcp/index.d.mts +5 -0
- package/dist/mcp/index.mjs +6 -0
- package/dist/mcp/prompts.cjs +17 -0
- package/dist/mcp/prompts.d.cts +8 -0
- package/dist/mcp/prompts.d.cts.map +1 -0
- package/dist/mcp/prompts.d.mts +8 -0
- package/dist/mcp/prompts.d.mts.map +1 -0
- package/dist/mcp/prompts.mjs +17 -0
- package/dist/mcp/prompts.mjs.map +1 -0
- package/dist/mcp/resources.cjs +22 -0
- package/dist/mcp/resources.d.cts +8 -0
- package/dist/mcp/resources.d.cts.map +1 -0
- package/dist/mcp/resources.d.mts +8 -0
- package/dist/mcp/resources.d.mts.map +1 -0
- package/dist/mcp/resources.mjs +22 -0
- package/dist/mcp/resources.mjs.map +1 -0
- package/dist/mcp/server.cjs +51 -0
- package/dist/mcp/server.d.cts +20 -0
- package/dist/mcp/server.d.cts.map +1 -0
- package/dist/mcp/server.d.mts +20 -0
- package/dist/mcp/server.d.mts.map +1 -0
- package/dist/mcp/server.mjs +52 -0
- package/dist/mcp/server.mjs.map +1 -0
- package/dist/mcp/tools.cjs +218 -0
- package/dist/mcp/tools.d.cts +8 -0
- package/dist/mcp/tools.d.cts.map +1 -0
- package/dist/mcp/tools.d.mts +8 -0
- package/dist/mcp/tools.d.mts.map +1 -0
- package/dist/mcp/tools.mjs +219 -0
- package/dist/mcp/tools.mjs.map +1 -0
- package/dist/mcp/utils.cjs +75 -0
- package/dist/mcp/utils.mjs +69 -0
- package/dist/mcp/utils.mjs.map +1 -0
- package/dist/mount/index.cjs +4 -0
- package/dist/mount/index.d.cts +3 -0
- package/dist/mount/index.d.mts +3 -0
- package/dist/mount/index.mjs +3 -0
- package/dist/mount/materializer.cjs +167 -0
- package/dist/mount/materializer.d.cts +97 -0
- package/dist/mount/materializer.d.cts.map +1 -0
- package/dist/mount/materializer.d.mts +97 -0
- package/dist/mount/materializer.d.mts.map +1 -0
- package/dist/mount/materializer.mjs +167 -0
- package/dist/mount/materializer.mjs.map +1 -0
- package/dist/mount/types.d.cts +90 -0
- package/dist/mount/types.d.cts.map +1 -0
- package/dist/mount/types.d.mts +90 -0
- package/dist/mount/types.d.mts.map +1 -0
- package/dist/mount-config.cjs +61 -0
- package/dist/mount-config.d.cts +19 -0
- package/dist/mount-config.d.cts.map +1 -0
- package/dist/mount-config.d.mts +19 -0
- package/dist/mount-config.d.mts.map +1 -0
- package/dist/mount-config.mjs +61 -0
- package/dist/mount-config.mjs.map +1 -0
- package/dist/projectors/aup-projector.cjs +190 -0
- package/dist/projectors/aup-projector.d.cts +59 -0
- package/dist/projectors/aup-projector.d.cts.map +1 -0
- package/dist/projectors/aup-projector.d.mts +59 -0
- package/dist/projectors/aup-projector.d.mts.map +1 -0
- package/dist/projectors/aup-projector.mjs +188 -0
- package/dist/projectors/aup-projector.mjs.map +1 -0
- package/dist/projectors/index.cjs +6 -0
- package/dist/projectors/index.d.cts +2 -0
- package/dist/projectors/index.d.mts +2 -0
- package/dist/projectors/index.mjs +3 -0
- package/dist/scaffold/afs.cjs +195 -0
- package/dist/scaffold/afs.d.cts +16 -0
- package/dist/scaffold/afs.d.cts.map +1 -0
- package/dist/scaffold/afs.d.mts +16 -0
- package/dist/scaffold/afs.d.mts.map +1 -0
- package/dist/scaffold/afs.mjs +195 -0
- package/dist/scaffold/afs.mjs.map +1 -0
- package/dist/scaffold/composition.cjs +92 -0
- package/dist/scaffold/composition.d.cts +10 -0
- package/dist/scaffold/composition.d.cts.map +1 -0
- package/dist/scaffold/composition.d.mts +10 -0
- package/dist/scaffold/composition.d.mts.map +1 -0
- package/dist/scaffold/composition.mjs +92 -0
- package/dist/scaffold/composition.mjs.map +1 -0
- package/dist/scaffold/dsl-error.cjs +21 -0
- package/dist/scaffold/dsl-error.d.cts +11 -0
- package/dist/scaffold/dsl-error.d.cts.map +1 -0
- package/dist/scaffold/dsl-error.d.mts +11 -0
- package/dist/scaffold/dsl-error.d.mts.map +1 -0
- package/dist/scaffold/dsl-error.mjs +20 -0
- package/dist/scaffold/dsl-error.mjs.map +1 -0
- package/dist/scaffold/index.d.mts +12 -0
- package/dist/scaffold/manifest-dsl.cjs +188 -0
- package/dist/scaffold/manifest-dsl.d.cts +8 -0
- package/dist/scaffold/manifest-dsl.d.cts.map +1 -0
- package/dist/scaffold/manifest-dsl.d.mts +8 -0
- package/dist/scaffold/manifest-dsl.d.mts.map +1 -0
- package/dist/scaffold/manifest-dsl.mjs +188 -0
- package/dist/scaffold/manifest-dsl.mjs.map +1 -0
- package/dist/scaffold/module-dsl.cjs +284 -0
- package/dist/scaffold/module-dsl.d.cts +8 -0
- package/dist/scaffold/module-dsl.d.cts.map +1 -0
- package/dist/scaffold/module-dsl.d.mts +8 -0
- package/dist/scaffold/module-dsl.d.mts.map +1 -0
- package/dist/scaffold/module-dsl.mjs +284 -0
- package/dist/scaffold/module-dsl.mjs.map +1 -0
- package/dist/scaffold/resolver.cjs +156 -0
- package/dist/scaffold/resolver.d.cts +7 -0
- package/dist/scaffold/resolver.d.cts.map +1 -0
- package/dist/scaffold/resolver.d.mts +7 -0
- package/dist/scaffold/resolver.d.mts.map +1 -0
- package/dist/scaffold/resolver.mjs +156 -0
- package/dist/scaffold/resolver.mjs.map +1 -0
- package/dist/scaffold/runtime.cjs +24 -0
- package/dist/scaffold/runtime.d.cts +19 -0
- package/dist/scaffold/runtime.d.cts.map +1 -0
- package/dist/scaffold/runtime.d.mts +19 -0
- package/dist/scaffold/runtime.d.mts.map +1 -0
- package/dist/scaffold/runtime.mjs +25 -0
- package/dist/scaffold/runtime.mjs.map +1 -0
- package/dist/scaffold/shell-dsl.cjs +279 -0
- package/dist/scaffold/shell-dsl.d.cts +8 -0
- package/dist/scaffold/shell-dsl.d.cts.map +1 -0
- package/dist/scaffold/shell-dsl.d.mts +8 -0
- package/dist/scaffold/shell-dsl.d.mts.map +1 -0
- package/dist/scaffold/shell-dsl.mjs +279 -0
- package/dist/scaffold/shell-dsl.mjs.map +1 -0
- package/dist/scaffold/surface-dsl.cjs +182 -0
- package/dist/scaffold/surface-dsl.d.cts +8 -0
- package/dist/scaffold/surface-dsl.d.cts.map +1 -0
- package/dist/scaffold/surface-dsl.d.mts +8 -0
- package/dist/scaffold/surface-dsl.d.mts.map +1 -0
- package/dist/scaffold/surface-dsl.mjs +182 -0
- package/dist/scaffold/surface-dsl.mjs.map +1 -0
- package/dist/scaffold/surfaces.cjs +84 -0
- package/dist/scaffold/surfaces.d.cts +23 -0
- package/dist/scaffold/surfaces.d.cts.map +1 -0
- package/dist/scaffold/surfaces.d.mts +24 -0
- package/dist/scaffold/surfaces.d.mts.map +1 -0
- package/dist/scaffold/surfaces.mjs +84 -0
- package/dist/scaffold/surfaces.mjs.map +1 -0
- package/dist/scaffold/types.d.cts +264 -0
- package/dist/scaffold/types.d.cts.map +1 -0
- package/dist/scaffold/types.d.mts +265 -0
- package/dist/scaffold/types.d.mts.map +1 -0
- package/dist/scaffold/workspace-dsl.cjs +339 -0
- package/dist/scaffold/workspace-dsl.d.cts +49 -0
- package/dist/scaffold/workspace-dsl.d.cts.map +1 -0
- package/dist/scaffold/workspace-dsl.d.mts +49 -0
- package/dist/scaffold/workspace-dsl.d.mts.map +1 -0
- package/dist/scaffold/workspace-dsl.mjs +337 -0
- package/dist/scaffold/workspace-dsl.mjs.map +1 -0
- package/dist/scope/index.d.mts +3 -0
- package/dist/scope/read-blocklet-scope.cjs +29 -0
- package/dist/scope/read-blocklet-scope.d.cts +8 -0
- package/dist/scope/read-blocklet-scope.d.cts.map +1 -0
- package/dist/scope/read-blocklet-scope.d.mts +8 -0
- package/dist/scope/read-blocklet-scope.d.mts.map +1 -0
- package/dist/scope/read-blocklet-scope.mjs +30 -0
- package/dist/scope/read-blocklet-scope.mjs.map +1 -0
- package/dist/scope/resolve-scoped-afs.cjs +87 -0
- package/dist/scope/resolve-scoped-afs.d.cts +7 -0
- package/dist/scope/resolve-scoped-afs.d.cts.map +1 -0
- package/dist/scope/resolve-scoped-afs.d.mts +7 -0
- package/dist/scope/resolve-scoped-afs.d.mts.map +1 -0
- package/dist/scope/resolve-scoped-afs.mjs +88 -0
- package/dist/scope/resolve-scoped-afs.mjs.map +1 -0
- package/dist/scope/types.d.cts +25 -0
- package/dist/scope/types.d.cts.map +1 -0
- package/dist/scope/types.d.mts +25 -0
- package/dist/scope/types.d.mts.map +1 -0
- package/dist/session/backends.cjs +90 -0
- package/dist/session/backends.d.cts +35 -0
- package/dist/session/backends.d.cts.map +1 -0
- package/dist/session/backends.d.mts +35 -0
- package/dist/session/backends.d.mts.map +1 -0
- package/dist/session/backends.mjs +89 -0
- package/dist/session/backends.mjs.map +1 -0
- package/dist/session/replication-resolver.cjs +323 -0
- package/dist/session/replication-resolver.d.cts +71 -0
- package/dist/session/replication-resolver.d.cts.map +1 -0
- package/dist/session/replication-resolver.d.mts +71 -0
- package/dist/session/replication-resolver.d.mts.map +1 -0
- package/dist/session/replication-resolver.mjs +323 -0
- package/dist/session/replication-resolver.mjs.map +1 -0
- package/dist/session/role-level.cjs +36 -0
- package/dist/session/role-level.d.cts +24 -0
- package/dist/session/role-level.d.cts.map +1 -0
- package/dist/session/role-level.d.mts +24 -0
- package/dist/session/role-level.d.mts.map +1 -0
- package/dist/session/role-level.mjs +35 -0
- package/dist/session/role-level.mjs.map +1 -0
- package/dist/session/session-dir-providers.cjs +254 -0
- package/dist/session/session-dir-providers.d.cts +32 -0
- package/dist/session/session-dir-providers.d.cts.map +1 -0
- package/dist/session/session-dir-providers.d.mts +32 -0
- package/dist/session/session-dir-providers.d.mts.map +1 -0
- package/dist/session/session-dir-providers.mjs +252 -0
- package/dist/session/session-dir-providers.mjs.map +1 -0
- package/dist/session/session-id.cjs +20 -0
- package/dist/session/session-id.d.cts +15 -0
- package/dist/session/session-id.d.cts.map +1 -0
- package/dist/session/session-id.d.mts +15 -0
- package/dist/session/session-id.d.mts.map +1 -0
- package/dist/session/session-id.mjs +20 -0
- package/dist/session/session-id.mjs.map +1 -0
- package/dist/session/session-user-afs.cjs +899 -0
- package/dist/session/session-user-afs.d.cts +296 -0
- package/dist/session/session-user-afs.d.cts.map +1 -0
- package/dist/session/session-user-afs.d.mts +296 -0
- package/dist/session/session-user-afs.d.mts.map +1 -0
- package/dist/session/session-user-afs.mjs +896 -0
- package/dist/session/session-user-afs.mjs.map +1 -0
- package/dist/session/settings-cascade.cjs +69 -0
- package/dist/session/settings-cascade.d.cts +81 -0
- package/dist/session/settings-cascade.d.cts.map +1 -0
- package/dist/session/settings-cascade.d.mts +81 -0
- package/dist/session/settings-cascade.d.mts.map +1 -0
- package/dist/session/settings-cascade.mjs +69 -0
- package/dist/session/settings-cascade.mjs.map +1 -0
- package/dist/session/settings-resolver.cjs +770 -0
- package/dist/session/settings-resolver.d.cts +177 -0
- package/dist/session/settings-resolver.d.cts.map +1 -0
- package/dist/session/settings-resolver.d.mts +177 -0
- package/dist/session/settings-resolver.d.mts.map +1 -0
- package/dist/session/settings-resolver.mjs +771 -0
- package/dist/session/settings-resolver.mjs.map +1 -0
- package/dist/session/settings-schema-store.cjs +0 -0
- package/dist/session/settings-schema-store.d.cts +72 -0
- package/dist/session/settings-schema-store.d.cts.map +1 -0
- package/dist/session/settings-schema-store.d.mts +72 -0
- package/dist/session/settings-schema-store.d.mts.map +1 -0
- package/dist/session/settings-schema-store.mjs +0 -0
- package/dist/session/settings-schema-store.mjs.map +1 -0
- package/dist/system-mounts/index.cjs +14 -0
- package/dist/system-mounts/index.d.cts +6 -0
- package/dist/system-mounts/index.d.mts +6 -0
- package/dist/system-mounts/index.mjs +6 -0
- package/dist/system-mounts/install.cjs +101 -0
- package/dist/system-mounts/install.d.cts +36 -0
- package/dist/system-mounts/install.d.cts.map +1 -0
- package/dist/system-mounts/install.d.mts +37 -0
- package/dist/system-mounts/install.d.mts.map +1 -0
- package/dist/system-mounts/install.mjs +102 -0
- package/dist/system-mounts/install.mjs.map +1 -0
- package/dist/system-mounts/installers.cjs +247 -0
- package/dist/system-mounts/installers.d.cts +13 -0
- package/dist/system-mounts/installers.d.cts.map +1 -0
- package/dist/system-mounts/installers.d.mts +14 -0
- package/dist/system-mounts/installers.d.mts.map +1 -0
- package/dist/system-mounts/installers.mjs +244 -0
- package/dist/system-mounts/installers.mjs.map +1 -0
- package/dist/system-mounts/lists.cjs +122 -0
- package/dist/system-mounts/lists.d.cts +34 -0
- package/dist/system-mounts/lists.d.cts.map +1 -0
- package/dist/system-mounts/lists.d.mts +34 -0
- package/dist/system-mounts/lists.d.mts.map +1 -0
- package/dist/system-mounts/lists.mjs +122 -0
- package/dist/system-mounts/lists.mjs.map +1 -0
- package/dist/system-mounts/types.d.cts +124 -0
- package/dist/system-mounts/types.d.cts.map +1 -0
- package/dist/system-mounts/types.d.mts +125 -0
- package/dist/system-mounts/types.d.mts.map +1 -0
- package/dist/system-mounts/validate.cjs +56 -0
- package/dist/system-mounts/validate.d.cts +34 -0
- package/dist/system-mounts/validate.d.cts.map +1 -0
- package/dist/system-mounts/validate.d.mts +34 -0
- package/dist/system-mounts/validate.d.mts.map +1 -0
- package/dist/system-mounts/validate.mjs +56 -0
- package/dist/system-mounts/validate.mjs.map +1 -0
- package/dist/terminal-llm.cjs +90 -0
- package/dist/terminal-llm.d.cts +50 -0
- package/dist/terminal-llm.d.cts.map +1 -0
- package/dist/terminal-llm.d.mts +50 -0
- package/dist/terminal-llm.d.mts.map +1 -0
- package/dist/terminal-llm.mjs +90 -0
- package/dist/terminal-llm.mjs.map +1 -0
- package/dist/terminal-repl.cjs +371 -0
- package/dist/terminal-repl.d.cts +69 -0
- package/dist/terminal-repl.d.cts.map +1 -0
- package/dist/terminal-repl.d.mts +69 -0
- package/dist/terminal-repl.d.mts.map +1 -0
- package/dist/terminal-repl.mjs +370 -0
- package/dist/terminal-repl.mjs.map +1 -0
- package/dist/transport/idle-timer.cjs +136 -0
- package/dist/transport/idle-timer.d.cts +92 -0
- package/dist/transport/idle-timer.d.cts.map +1 -0
- package/dist/transport/idle-timer.d.mts +92 -0
- package/dist/transport/idle-timer.d.mts.map +1 -0
- package/dist/transport/idle-timer.mjs +132 -0
- package/dist/transport/idle-timer.mjs.map +1 -0
- package/dist/web-component-dsl.cjs +153 -0
- package/dist/web-component-dsl.d.cts +27 -0
- package/dist/web-component-dsl.d.cts.map +1 -0
- package/dist/web-component-dsl.d.mts +27 -0
- package/dist/web-component-dsl.d.mts.map +1 -0
- package/dist/web-component-dsl.mjs +152 -0
- package/dist/web-component-dsl.mjs.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { joinURL } from "ufo";
|
|
2
|
+
|
|
3
|
+
//#region src/auto-surface/fragments.ts
|
|
4
|
+
const DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT = "/.surface/definitions";
|
|
5
|
+
const DEFAULT_AUTO_SURFACE_VALUES_ROOT = "/.surface/overrides";
|
|
6
|
+
async function loadAutoSurfaceFragment(reader, options) {
|
|
7
|
+
const root = options.root ?? DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT;
|
|
8
|
+
const resources = [];
|
|
9
|
+
if (!await hasDirectory(reader, root)) return {
|
|
10
|
+
source: options.source,
|
|
11
|
+
owner: options.owner,
|
|
12
|
+
resources
|
|
13
|
+
};
|
|
14
|
+
await walkDefinitionDirectory(reader, root, [], {}, resources);
|
|
15
|
+
return {
|
|
16
|
+
source: options.source,
|
|
17
|
+
owner: options.owner,
|
|
18
|
+
resources
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
async function loadAutoSurfaceValueLayer(reader, options = {}) {
|
|
22
|
+
const root = options.root ?? DEFAULT_AUTO_SURFACE_VALUES_ROOT;
|
|
23
|
+
const values = {};
|
|
24
|
+
if (!await hasDirectory(reader, root)) return values;
|
|
25
|
+
await walkValueDirectory(reader, root, [], values);
|
|
26
|
+
return values;
|
|
27
|
+
}
|
|
28
|
+
async function walkDefinitionDirectory(reader, currentPath, relativeSegments, inheritedContext, resources) {
|
|
29
|
+
const entries = await listVisible(reader, currentPath);
|
|
30
|
+
const dirs = entries.filter(isDirectoryEntry);
|
|
31
|
+
const files = entries.filter((entry) => !isDirectoryEntry(entry));
|
|
32
|
+
const context = deriveDefinitionContext(relativeSegments, inheritedContext, await readDirectoryMeta(reader, files, currentPath));
|
|
33
|
+
for (const file of files) {
|
|
34
|
+
if (!file.id.endsWith(".field.json")) continue;
|
|
35
|
+
const field = await readJSON(reader, entryPath(currentPath, file));
|
|
36
|
+
const resourceId = typeof field.id === "string" && field.id.trim().length > 0 ? field.id : buildResourceId(relativeSegments, stripSuffix(file.id, ".field.json"));
|
|
37
|
+
resources.push({
|
|
38
|
+
...field,
|
|
39
|
+
id: resourceId,
|
|
40
|
+
presentations: mergePresentations(field.presentations, inferSettingsShellPresentation(relativeSegments, context))
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
for (const dir of dirs) await walkDefinitionDirectory(reader, entryPath(currentPath, dir), [...relativeSegments, dir.id], context, resources);
|
|
44
|
+
}
|
|
45
|
+
async function walkValueDirectory(reader, currentPath, relativeSegments, values) {
|
|
46
|
+
const entries = await listVisible(reader, currentPath);
|
|
47
|
+
const dirs = entries.filter(isDirectoryEntry);
|
|
48
|
+
const files = entries.filter((entry) => !isDirectoryEntry(entry));
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
if (!file.id.endsWith(".value.json")) continue;
|
|
51
|
+
const parsed = await readJSON(reader, entryPath(currentPath, file), { allowScalar: true });
|
|
52
|
+
const valueId = resolveValueId(parsed, relativeSegments, file.id);
|
|
53
|
+
values[valueId] = resolveValue(parsed);
|
|
54
|
+
}
|
|
55
|
+
for (const dir of dirs) await walkValueDirectory(reader, entryPath(currentPath, dir), [...relativeSegments, dir.id], values);
|
|
56
|
+
}
|
|
57
|
+
async function readDirectoryMeta(reader, files, currentPath) {
|
|
58
|
+
const result = {};
|
|
59
|
+
for (const file of files) {
|
|
60
|
+
if (![
|
|
61
|
+
"group.json",
|
|
62
|
+
"page.json",
|
|
63
|
+
"section.json"
|
|
64
|
+
].includes(file.id)) continue;
|
|
65
|
+
const path = entryPath(currentPath, file);
|
|
66
|
+
result[file.id] = await readJSON(reader, path);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
function deriveDefinitionContext(relativeSegments, inheritedContext, localMeta) {
|
|
71
|
+
const context = { ...inheritedContext };
|
|
72
|
+
if (relativeSegments.length >= 1) {
|
|
73
|
+
const groupId = relativeSegments[0];
|
|
74
|
+
context.group = {
|
|
75
|
+
title: localMeta["group.json"]?.title ?? inheritedContext.group?.title ?? labelize(groupId),
|
|
76
|
+
description: localMeta["group.json"]?.description ?? inheritedContext.group?.description,
|
|
77
|
+
order: localMeta["group.json"]?.order ?? inheritedContext.group?.order
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (relativeSegments.length >= 2) {
|
|
81
|
+
const pageId = relativeSegments[1];
|
|
82
|
+
context.page = {
|
|
83
|
+
title: localMeta["page.json"]?.title ?? inheritedContext.page?.title ?? labelize(pageId),
|
|
84
|
+
description: localMeta["page.json"]?.description ?? inheritedContext.page?.description,
|
|
85
|
+
order: localMeta["page.json"]?.order ?? inheritedContext.page?.order
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (relativeSegments.length >= 3) {
|
|
89
|
+
const sectionId = relativeSegments.slice(2).join("/");
|
|
90
|
+
context.section = {
|
|
91
|
+
title: localMeta["section.json"]?.title ?? inheritedContext.section?.title ?? labelize(relativeSegments[relativeSegments.length - 1]),
|
|
92
|
+
description: localMeta["section.json"]?.description ?? inheritedContext.section?.description,
|
|
93
|
+
order: localMeta["section.json"]?.order ?? inheritedContext.section?.order
|
|
94
|
+
};
|
|
95
|
+
if (!context.section.title) context.section.title = labelize(sectionId);
|
|
96
|
+
}
|
|
97
|
+
return context;
|
|
98
|
+
}
|
|
99
|
+
function inferSettingsShellPresentation(relativeSegments, context) {
|
|
100
|
+
return {
|
|
101
|
+
group: context.group?.title ?? labelize(relativeSegments[0] ?? "general"),
|
|
102
|
+
page: context.page?.title ?? "General",
|
|
103
|
+
section: context.section?.title ?? "General",
|
|
104
|
+
...context.group?.order !== void 0 ? { groupOrder: context.group.order } : {},
|
|
105
|
+
...context.page?.order !== void 0 ? { pageOrder: context.page.order } : {},
|
|
106
|
+
...context.section?.order !== void 0 ? { sectionOrder: context.section.order } : {}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function mergePresentations(existing, inferred) {
|
|
110
|
+
return {
|
|
111
|
+
...existing ?? {},
|
|
112
|
+
"settings-shell": {
|
|
113
|
+
...inferred,
|
|
114
|
+
...existing?.["settings-shell"] ?? {}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function buildResourceId(relativeSegments, basename) {
|
|
119
|
+
return [...relativeSegments, basename].filter(Boolean).join(".");
|
|
120
|
+
}
|
|
121
|
+
function resolveValueId(parsed, relativeSegments, fileName) {
|
|
122
|
+
if (isPlainObject(parsed) && typeof parsed.id === "string" && parsed.id.trim().length > 0) return parsed.id;
|
|
123
|
+
return buildResourceId(relativeSegments, stripSuffix(fileName, ".value.json"));
|
|
124
|
+
}
|
|
125
|
+
function resolveValue(parsed) {
|
|
126
|
+
if (isPlainObject(parsed) && Object.hasOwn(parsed, "value")) return parsed.value;
|
|
127
|
+
return parsed;
|
|
128
|
+
}
|
|
129
|
+
async function hasDirectory(reader, path) {
|
|
130
|
+
try {
|
|
131
|
+
const entries = await reader.list(path);
|
|
132
|
+
return Array.isArray(entries.data);
|
|
133
|
+
} catch {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function listVisible(reader, path) {
|
|
138
|
+
return ((await reader.list(path)).data ?? []).filter((entry) => entry?.id && !entry.id.startsWith("."));
|
|
139
|
+
}
|
|
140
|
+
async function readJSON(reader, path, options = {}) {
|
|
141
|
+
const content = extractContent(await reader.read(path));
|
|
142
|
+
if (typeof content === "string") try {
|
|
143
|
+
return JSON.parse(content);
|
|
144
|
+
} catch (error) {
|
|
145
|
+
throw new Error(`Invalid JSON in "${path}": ${error instanceof Error ? error.message : String(error)}`);
|
|
146
|
+
}
|
|
147
|
+
if (content && typeof content === "object") return content;
|
|
148
|
+
if (options.allowScalar) return content;
|
|
149
|
+
throw new Error(`Expected JSON object in "${path}"`);
|
|
150
|
+
}
|
|
151
|
+
function extractContent(result) {
|
|
152
|
+
const data = result.data;
|
|
153
|
+
if (data && typeof data === "object" && "content" in data) return data.content;
|
|
154
|
+
return data;
|
|
155
|
+
}
|
|
156
|
+
function isDirectoryEntry(entry) {
|
|
157
|
+
const meta = entry.meta ?? {};
|
|
158
|
+
return meta.kind === "fs:directory" || meta.kind === "directory" || Array.isArray(meta.kinds) && meta.kinds.includes("fs:directory") || typeof meta.childrenCount === "number";
|
|
159
|
+
}
|
|
160
|
+
function entryPath(parentPath, entry) {
|
|
161
|
+
return entry.path || joinURL(parentPath, entry.id);
|
|
162
|
+
}
|
|
163
|
+
function stripSuffix(value, suffix) {
|
|
164
|
+
return value.endsWith(suffix) ? value.slice(0, -suffix.length) : value;
|
|
165
|
+
}
|
|
166
|
+
function labelize(value) {
|
|
167
|
+
return value.replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
168
|
+
}
|
|
169
|
+
function isPlainObject(value) {
|
|
170
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
export { DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT, DEFAULT_AUTO_SURFACE_VALUES_ROOT, loadAutoSurfaceFragment, loadAutoSurfaceValueLayer };
|
|
175
|
+
//# sourceMappingURL=fragments.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragments.mjs","names":[],"sources":["../../src/auto-surface/fragments.ts"],"sourcesContent":["import type { AFSEntry, AFSListResult, AFSReadResult } from \"@aigne/afs\";\nimport { joinURL } from \"ufo\";\nimport type {\n AutoSurfaceDefinitionOwner,\n AutoSurfaceFragment,\n AutoSurfacePresentations,\n AutoSurfaceResourceDefinition,\n AutoSurfaceSettingsShellPresentation,\n} from \"./types.js\";\n\nexport const DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT = \"/.surface/definitions\";\nexport const DEFAULT_AUTO_SURFACE_VALUES_ROOT = \"/.surface/overrides\";\n\nexport interface AutoSurfaceFragmentReader {\n list(path: string): Promise<AFSListResult>;\n read(path: string): Promise<AFSReadResult>;\n}\n\nexport interface LoadAutoSurfaceFragmentOptions {\n source: string;\n owner: AutoSurfaceDefinitionOwner;\n root?: string;\n}\n\nexport interface LoadAutoSurfaceValueLayerOptions {\n root?: string;\n}\n\ninterface AutoSurfaceDirectoryMeta {\n title?: string;\n description?: string;\n order?: number;\n}\n\ninterface AutoSurfaceFieldFile extends Omit<AutoSurfaceResourceDefinition, \"id\"> {\n id?: string;\n}\n\ninterface DefinitionContext {\n group?: AutoSurfaceDirectoryMeta;\n page?: AutoSurfaceDirectoryMeta;\n section?: AutoSurfaceDirectoryMeta;\n}\n\nexport async function loadAutoSurfaceFragment(\n reader: AutoSurfaceFragmentReader,\n options: LoadAutoSurfaceFragmentOptions,\n): Promise<AutoSurfaceFragment> {\n const root = options.root ?? DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT;\n const resources: AutoSurfaceResourceDefinition[] = [];\n\n if (!(await hasDirectory(reader, root))) {\n return { source: options.source, owner: options.owner, resources };\n }\n\n await walkDefinitionDirectory(reader, root, [], {}, resources);\n return {\n source: options.source,\n owner: options.owner,\n resources,\n };\n}\n\nexport async function loadAutoSurfaceValueLayer(\n reader: AutoSurfaceFragmentReader,\n options: LoadAutoSurfaceValueLayerOptions = {},\n): Promise<Record<string, unknown>> {\n const root = options.root ?? DEFAULT_AUTO_SURFACE_VALUES_ROOT;\n const values: Record<string, unknown> = {};\n\n if (!(await hasDirectory(reader, root))) return values;\n\n await walkValueDirectory(reader, root, [], values);\n return values;\n}\n\nasync function walkDefinitionDirectory(\n reader: AutoSurfaceFragmentReader,\n currentPath: string,\n relativeSegments: string[],\n inheritedContext: DefinitionContext,\n resources: AutoSurfaceResourceDefinition[],\n): Promise<void> {\n const entries = await listVisible(reader, currentPath);\n const dirs = entries.filter(isDirectoryEntry);\n const files = entries.filter((entry) => !isDirectoryEntry(entry));\n const localMeta = await readDirectoryMeta(reader, files, currentPath);\n const context = deriveDefinitionContext(relativeSegments, inheritedContext, localMeta);\n\n for (const file of files) {\n if (!file.id.endsWith(\".field.json\")) continue;\n const path = entryPath(currentPath, file);\n const parsed = await readJSON(reader, path);\n const field = parsed as AutoSurfaceFieldFile;\n const resourceId =\n typeof field.id === \"string\" && field.id.trim().length > 0\n ? field.id\n : buildResourceId(relativeSegments, stripSuffix(file.id, \".field.json\"));\n resources.push({\n ...field,\n id: resourceId,\n presentations: mergePresentations(\n field.presentations,\n inferSettingsShellPresentation(relativeSegments, context),\n ),\n });\n }\n\n for (const dir of dirs) {\n await walkDefinitionDirectory(\n reader,\n entryPath(currentPath, dir),\n [...relativeSegments, dir.id],\n context,\n resources,\n );\n }\n}\n\nasync function walkValueDirectory(\n reader: AutoSurfaceFragmentReader,\n currentPath: string,\n relativeSegments: string[],\n values: Record<string, unknown>,\n): Promise<void> {\n const entries = await listVisible(reader, currentPath);\n const dirs = entries.filter(isDirectoryEntry);\n const files = entries.filter((entry) => !isDirectoryEntry(entry));\n\n for (const file of files) {\n if (!file.id.endsWith(\".value.json\")) continue;\n const path = entryPath(currentPath, file);\n const parsed = await readJSON(reader, path, { allowScalar: true });\n const valueId = resolveValueId(parsed, relativeSegments, file.id);\n values[valueId] = resolveValue(parsed);\n }\n\n for (const dir of dirs) {\n await walkValueDirectory(\n reader,\n entryPath(currentPath, dir),\n [...relativeSegments, dir.id],\n values,\n );\n }\n}\n\nasync function readDirectoryMeta(\n reader: AutoSurfaceFragmentReader,\n files: AFSEntry[],\n currentPath: string,\n): Promise<Record<string, AutoSurfaceDirectoryMeta>> {\n const result: Record<string, AutoSurfaceDirectoryMeta> = {};\n\n for (const file of files) {\n if (![\"group.json\", \"page.json\", \"section.json\"].includes(file.id)) continue;\n const path = entryPath(currentPath, file);\n result[file.id] = (await readJSON(reader, path)) as AutoSurfaceDirectoryMeta;\n }\n\n return result;\n}\n\nfunction deriveDefinitionContext(\n relativeSegments: string[],\n inheritedContext: DefinitionContext,\n localMeta: Record<string, AutoSurfaceDirectoryMeta>,\n): DefinitionContext {\n const context: DefinitionContext = { ...inheritedContext };\n\n if (relativeSegments.length >= 1) {\n const groupId = relativeSegments[0]!;\n context.group = {\n title: localMeta[\"group.json\"]?.title ?? inheritedContext.group?.title ?? labelize(groupId),\n description: localMeta[\"group.json\"]?.description ?? inheritedContext.group?.description,\n order: localMeta[\"group.json\"]?.order ?? inheritedContext.group?.order,\n };\n }\n\n if (relativeSegments.length >= 2) {\n const pageId = relativeSegments[1]!;\n context.page = {\n title: localMeta[\"page.json\"]?.title ?? inheritedContext.page?.title ?? labelize(pageId),\n description: localMeta[\"page.json\"]?.description ?? inheritedContext.page?.description,\n order: localMeta[\"page.json\"]?.order ?? inheritedContext.page?.order,\n };\n }\n\n if (relativeSegments.length >= 3) {\n const sectionId = relativeSegments.slice(2).join(\"/\");\n context.section = {\n title:\n localMeta[\"section.json\"]?.title ??\n inheritedContext.section?.title ??\n labelize(relativeSegments[relativeSegments.length - 1]!),\n description: localMeta[\"section.json\"]?.description ?? inheritedContext.section?.description,\n order: localMeta[\"section.json\"]?.order ?? inheritedContext.section?.order,\n };\n if (!context.section.title) context.section.title = labelize(sectionId);\n }\n\n return context;\n}\n\nfunction inferSettingsShellPresentation(\n relativeSegments: string[],\n context: DefinitionContext,\n): AutoSurfaceSettingsShellPresentation {\n return {\n group: context.group?.title ?? labelize(relativeSegments[0] ?? \"general\"),\n page: context.page?.title ?? \"General\",\n section: context.section?.title ?? \"General\",\n ...(context.group?.order !== undefined ? { groupOrder: context.group.order } : {}),\n ...(context.page?.order !== undefined ? { pageOrder: context.page.order } : {}),\n ...(context.section?.order !== undefined ? { sectionOrder: context.section.order } : {}),\n };\n}\n\nfunction mergePresentations(\n existing: AutoSurfacePresentations | undefined,\n inferred: AutoSurfaceSettingsShellPresentation,\n): AutoSurfacePresentations {\n return {\n ...(existing ?? {}),\n \"settings-shell\": {\n ...inferred,\n ...(existing?.[\"settings-shell\"] ?? {}),\n },\n };\n}\n\nfunction buildResourceId(relativeSegments: string[], basename: string): string {\n return [...relativeSegments, basename].filter(Boolean).join(\".\");\n}\n\nfunction resolveValueId(parsed: unknown, relativeSegments: string[], fileName: string): string {\n if (isPlainObject(parsed) && typeof parsed.id === \"string\" && parsed.id.trim().length > 0) {\n return parsed.id;\n }\n return buildResourceId(relativeSegments, stripSuffix(fileName, \".value.json\"));\n}\n\nfunction resolveValue(parsed: unknown): unknown {\n if (isPlainObject(parsed) && Object.hasOwn(parsed, \"value\")) {\n return parsed.value;\n }\n return parsed;\n}\n\nasync function hasDirectory(reader: AutoSurfaceFragmentReader, path: string): Promise<boolean> {\n try {\n const entries = await reader.list(path);\n return Array.isArray(entries.data);\n } catch {\n return false;\n }\n}\n\nasync function listVisible(reader: AutoSurfaceFragmentReader, path: string): Promise<AFSEntry[]> {\n const result = await reader.list(path);\n return (result.data ?? []).filter((entry) => entry?.id && !entry.id.startsWith(\".\"));\n}\n\nasync function readJSON(\n reader: AutoSurfaceFragmentReader,\n path: string,\n options: { allowScalar?: boolean } = {},\n): Promise<unknown> {\n const result = await reader.read(path);\n const content = extractContent(result);\n if (typeof content === \"string\") {\n try {\n return JSON.parse(content);\n } catch (error) {\n throw new Error(\n `Invalid JSON in \"${path}\": ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n if (content && typeof content === \"object\") return content;\n if (options.allowScalar) return content;\n throw new Error(`Expected JSON object in \"${path}\"`);\n}\n\nfunction extractContent(result: AFSReadResult): unknown {\n const data = result.data;\n if (data && typeof data === \"object\" && \"content\" in data) {\n return (data as { content?: unknown }).content;\n }\n return data;\n}\n\nfunction isDirectoryEntry(entry: AFSEntry): boolean {\n const meta = entry.meta ?? {};\n return (\n meta.kind === \"fs:directory\" ||\n meta.kind === \"directory\" ||\n (Array.isArray(meta.kinds) && meta.kinds.includes(\"fs:directory\")) ||\n typeof meta.childrenCount === \"number\"\n );\n}\n\nfunction entryPath(parentPath: string, entry: AFSEntry): string {\n return entry.path || joinURL(parentPath, entry.id);\n}\n\nfunction stripSuffix(value: string, suffix: string): string {\n return value.endsWith(suffix) ? value.slice(0, -suffix.length) : value;\n}\n\nfunction labelize(value: string): string {\n return value\n .replace(/[_-]+/g, \" \")\n .replace(/([a-z])([A-Z])/g, \"$1 $2\")\n .replace(/\\b\\w/g, (char) => char.toUpperCase());\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return Object.prototype.toString.call(value) === \"[object Object]\";\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AutoSurfaceBindingMap, AutoSurfaceCompileResult, AutoSurfaceDefinitionOwner, AutoSurfaceDiagnostic, AutoSurfaceFragment, AutoSurfaceLayer, AutoSurfaceLoadedRegistry, AutoSurfaceOption, AutoSurfacePolicy, AutoSurfacePresentations, AutoSurfaceProjectedField, AutoSurfaceProjectedGroup, AutoSurfaceProjectedPage, AutoSurfaceProjectedSection, AutoSurfaceProjection, AutoSurfaceProjectorName, AutoSurfaceRegistry, AutoSurfaceRegistryEntry, AutoSurfaceResolvedRegistry, AutoSurfaceResolvedResource, AutoSurfaceResolvedScenario, AutoSurfaceResourceDefinition, AutoSurfaceSettingsShellPresentation, AutoSurfaceSettingsShellProjection, AutoSurfaceValidationRule, AutoSurfaceValueLayers, AutoSurfaceValueSource, AutoSurfaceValueType, normalizeAutoSurfaceScopes } from "./types.mjs";
|
|
2
|
+
import { compileAutoSurfaceRegistry } from "./compiler.mjs";
|
|
3
|
+
import { AutoSurfaceDefinitionDslCompileError, AutoSurfaceDefinitionDslCompileResult, AutoSurfaceDefinitionDslField, AutoSurfaceDefinitionDslGroup, AutoSurfaceDefinitionDslPage, AutoSurfaceDefinitionDslSection, compileAutoSurfaceDefinitionDsl, formatAutoSurfaceDefinitionDsl } from "./definition-dsl.mjs";
|
|
4
|
+
import { AutoSurfaceFragmentReader, DEFAULT_AUTO_SURFACE_DEFINITIONS_ROOT, DEFAULT_AUTO_SURFACE_VALUES_ROOT, LoadAutoSurfaceFragmentOptions, LoadAutoSurfaceValueLayerOptions, loadAutoSurfaceFragment, loadAutoSurfaceValueLayer } from "./fragments.mjs";
|
|
5
|
+
import { resolveAutoSurfaceValues } from "./layering.mjs";
|
|
6
|
+
import { ProjectAutoSurfaceOptions, projectAutoSurface } from "./projection.mjs";
|
|
7
|
+
import { ProjectSettingsShellOptions, projectSettingsShell } from "./projectors/settings-shell.mjs";
|
|
8
|
+
import { AutoSurfaceDefinitionSource, AutoSurfaceValueLayerSource, LoadAutoSurfaceRegistryOptions, LoadAutoSurfaceValueLayersOptions, ResolveAutoSurfaceScenarioOptions, loadAutoSurfaceRegistry, loadAutoSurfaceValueLayers, resolveAutoSurfaceScenario } from "./scenario.mjs";
|
|
9
|
+
import { AutoSurfaceValueDslCompileError, AutoSurfaceValueDslCompileResult, AutoSurfaceValueDslEntry, compileAutoSurfaceValueDsl, formatAutoSurfaceValueDsl } from "./value-dsl.mjs";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/auto-surface/layering.ts
|
|
3
|
+
const LAYER_ORDER = [
|
|
4
|
+
"system",
|
|
5
|
+
"package",
|
|
6
|
+
"instance",
|
|
7
|
+
"user"
|
|
8
|
+
];
|
|
9
|
+
function resolveAutoSurfaceValues(registry, layers) {
|
|
10
|
+
const resources = {};
|
|
11
|
+
for (const [resourceId, entry] of Object.entries(registry.resources)) {
|
|
12
|
+
const scopes = entry.definition.scopes ?? ["instance"];
|
|
13
|
+
let value = entry.definition.defaultValue;
|
|
14
|
+
let source = entry.definition.defaultValue === void 0 ? "unset" : "default";
|
|
15
|
+
for (const layer of LAYER_ORDER) {
|
|
16
|
+
if (!scopes.includes(layer)) continue;
|
|
17
|
+
if (!canApplyLayer(layer, entry.definition.policy)) continue;
|
|
18
|
+
const candidate = layers[layer]?.[resourceId];
|
|
19
|
+
if (candidate === void 0) continue;
|
|
20
|
+
value = candidate;
|
|
21
|
+
source = layer;
|
|
22
|
+
}
|
|
23
|
+
resources[resourceId] = {
|
|
24
|
+
id: resourceId,
|
|
25
|
+
definition: entry.definition,
|
|
26
|
+
owner: entry.owner,
|
|
27
|
+
value,
|
|
28
|
+
source,
|
|
29
|
+
availableScopes: scopes,
|
|
30
|
+
bindings: entry.definition.bindings ?? {},
|
|
31
|
+
sourceDefinition: entry.source
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return { resources };
|
|
35
|
+
}
|
|
36
|
+
function canApplyLayer(layer, policy) {
|
|
37
|
+
if (layer === "instance" && policy?.allowInstanceOverride === false) return false;
|
|
38
|
+
if (layer === "user" && policy?.allowUserOverride === false) return false;
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
exports.resolveAutoSurfaceValues = resolveAutoSurfaceValues;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AutoSurfaceRegistry, AutoSurfaceResolvedRegistry, AutoSurfaceValueLayers } from "./types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/auto-surface/layering.d.ts
|
|
4
|
+
declare function resolveAutoSurfaceValues(registry: AutoSurfaceRegistry, layers: AutoSurfaceValueLayers): AutoSurfaceResolvedRegistry;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { resolveAutoSurfaceValues };
|
|
7
|
+
//# sourceMappingURL=layering.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layering.d.cts","names":[],"sources":["../../src/auto-surface/layering.ts"],"mappings":";;;iBAWgB,wBAAA,CACd,QAAA,EAAU,mBAAA,EACV,MAAA,EAAQ,sBAAA,GACP,2BAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AutoSurfaceRegistry, AutoSurfaceResolvedRegistry, AutoSurfaceValueLayers } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/auto-surface/layering.d.ts
|
|
4
|
+
declare function resolveAutoSurfaceValues(registry: AutoSurfaceRegistry, layers: AutoSurfaceValueLayers): AutoSurfaceResolvedRegistry;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { resolveAutoSurfaceValues };
|
|
7
|
+
//# sourceMappingURL=layering.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layering.d.mts","names":[],"sources":["../../src/auto-surface/layering.ts"],"mappings":";;;iBAWgB,wBAAA,CACd,QAAA,EAAU,mBAAA,EACV,MAAA,EAAQ,sBAAA,GACP,2BAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/auto-surface/layering.ts
|
|
2
|
+
const LAYER_ORDER = [
|
|
3
|
+
"system",
|
|
4
|
+
"package",
|
|
5
|
+
"instance",
|
|
6
|
+
"user"
|
|
7
|
+
];
|
|
8
|
+
function resolveAutoSurfaceValues(registry, layers) {
|
|
9
|
+
const resources = {};
|
|
10
|
+
for (const [resourceId, entry] of Object.entries(registry.resources)) {
|
|
11
|
+
const scopes = entry.definition.scopes ?? ["instance"];
|
|
12
|
+
let value = entry.definition.defaultValue;
|
|
13
|
+
let source = entry.definition.defaultValue === void 0 ? "unset" : "default";
|
|
14
|
+
for (const layer of LAYER_ORDER) {
|
|
15
|
+
if (!scopes.includes(layer)) continue;
|
|
16
|
+
if (!canApplyLayer(layer, entry.definition.policy)) continue;
|
|
17
|
+
const candidate = layers[layer]?.[resourceId];
|
|
18
|
+
if (candidate === void 0) continue;
|
|
19
|
+
value = candidate;
|
|
20
|
+
source = layer;
|
|
21
|
+
}
|
|
22
|
+
resources[resourceId] = {
|
|
23
|
+
id: resourceId,
|
|
24
|
+
definition: entry.definition,
|
|
25
|
+
owner: entry.owner,
|
|
26
|
+
value,
|
|
27
|
+
source,
|
|
28
|
+
availableScopes: scopes,
|
|
29
|
+
bindings: entry.definition.bindings ?? {},
|
|
30
|
+
sourceDefinition: entry.source
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return { resources };
|
|
34
|
+
}
|
|
35
|
+
function canApplyLayer(layer, policy) {
|
|
36
|
+
if (layer === "instance" && policy?.allowInstanceOverride === false) return false;
|
|
37
|
+
if (layer === "user" && policy?.allowUserOverride === false) return false;
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { resolveAutoSurfaceValues };
|
|
43
|
+
//# sourceMappingURL=layering.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layering.mjs","names":[],"sources":["../../src/auto-surface/layering.ts"],"sourcesContent":["import type {\n AutoSurfaceLayer,\n AutoSurfaceRegistry,\n AutoSurfaceResolvedRegistry,\n AutoSurfaceResolvedResource,\n AutoSurfaceValueLayers,\n AutoSurfaceValueSource,\n} from \"./types.js\";\n\nconst LAYER_ORDER: AutoSurfaceLayer[] = [\"system\", \"package\", \"instance\", \"user\"];\n\nexport function resolveAutoSurfaceValues(\n registry: AutoSurfaceRegistry,\n layers: AutoSurfaceValueLayers,\n): AutoSurfaceResolvedRegistry {\n const resources: Record<string, AutoSurfaceResolvedResource> = {};\n\n for (const [resourceId, entry] of Object.entries(registry.resources)) {\n const scopes = entry.definition.scopes ?? [\"instance\"];\n let value = entry.definition.defaultValue;\n let source: AutoSurfaceValueSource =\n entry.definition.defaultValue === undefined ? \"unset\" : \"default\";\n\n for (const layer of LAYER_ORDER) {\n if (!scopes.includes(layer)) continue;\n if (!canApplyLayer(layer, entry.definition.policy)) continue;\n const candidate = layers[layer]?.[resourceId];\n if (candidate === undefined) continue;\n value = candidate;\n source = layer;\n }\n\n resources[resourceId] = {\n id: resourceId,\n definition: entry.definition,\n owner: entry.owner,\n value,\n source,\n availableScopes: scopes,\n bindings: entry.definition.bindings ?? {},\n sourceDefinition: entry.source,\n };\n }\n\n return { resources };\n}\n\nfunction canApplyLayer(\n layer: AutoSurfaceLayer,\n policy: AutoSurfaceResolvedResource[\"definition\"][\"policy\"] | undefined,\n): boolean {\n if (layer === \"instance\" && policy?.allowInstanceOverride === false) return false;\n if (layer === \"user\" && policy?.allowUserOverride === false) return false;\n return true;\n}\n"],"mappings":";AASA,MAAM,cAAkC;CAAC;CAAU;CAAW;CAAY;CAAO;AAEjF,SAAgB,yBACd,UACA,QAC6B;CAC7B,MAAM,YAAyD,EAAE;AAEjE,MAAK,MAAM,CAAC,YAAY,UAAU,OAAO,QAAQ,SAAS,UAAU,EAAE;EACpE,MAAM,SAAS,MAAM,WAAW,UAAU,CAAC,WAAW;EACtD,IAAI,QAAQ,MAAM,WAAW;EAC7B,IAAI,SACF,MAAM,WAAW,iBAAiB,SAAY,UAAU;AAE1D,OAAK,MAAM,SAAS,aAAa;AAC/B,OAAI,CAAC,OAAO,SAAS,MAAM,CAAE;AAC7B,OAAI,CAAC,cAAc,OAAO,MAAM,WAAW,OAAO,CAAE;GACpD,MAAM,YAAY,OAAO,SAAS;AAClC,OAAI,cAAc,OAAW;AAC7B,WAAQ;AACR,YAAS;;AAGX,YAAU,cAAc;GACtB,IAAI;GACJ,YAAY,MAAM;GAClB,OAAO,MAAM;GACb;GACA;GACA,iBAAiB;GACjB,UAAU,MAAM,WAAW,YAAY,EAAE;GACzC,kBAAkB,MAAM;GACzB;;AAGH,QAAO,EAAE,WAAW;;AAGtB,SAAS,cACP,OACA,QACS;AACT,KAAI,UAAU,cAAc,QAAQ,0BAA0B,MAAO,QAAO;AAC5E,KAAI,UAAU,UAAU,QAAQ,sBAAsB,MAAO,QAAO;AACpE,QAAO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require_settings_shell = require('./projectors/settings-shell.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/auto-surface/projection.ts
|
|
4
|
+
function projectAutoSurface(resolved, options = {}) {
|
|
5
|
+
switch (options.projector ?? "settings-shell") {
|
|
6
|
+
case "settings-shell": return require_settings_shell.projectSettingsShell(resolved, { scope: options.scope });
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.projectAutoSurface = projectAutoSurface;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AutoSurfaceLayer, AutoSurfaceProjection, AutoSurfaceProjectorName, AutoSurfaceResolvedRegistry } from "./types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/auto-surface/projection.d.ts
|
|
4
|
+
interface ProjectAutoSurfaceOptions {
|
|
5
|
+
projector?: AutoSurfaceProjectorName;
|
|
6
|
+
scope?: AutoSurfaceLayer | "all";
|
|
7
|
+
}
|
|
8
|
+
declare function projectAutoSurface(resolved: AutoSurfaceResolvedRegistry, options?: ProjectAutoSurfaceOptions): AutoSurfaceProjection;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ProjectAutoSurfaceOptions, projectAutoSurface };
|
|
11
|
+
//# sourceMappingURL=projection.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.cts","names":[],"sources":["../../src/auto-surface/projection.ts"],"mappings":";;;UAQiB,yBAAA;EACf,SAAA,GAAY,wBAAA;EACZ,KAAA,GAAQ,gBAAA;AAAA;AAAA,iBAGM,kBAAA,CACd,QAAA,EAAU,2BAAA,EACV,OAAA,GAAS,yBAAA,GACR,qBAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AutoSurfaceLayer, AutoSurfaceProjection, AutoSurfaceProjectorName, AutoSurfaceResolvedRegistry } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/auto-surface/projection.d.ts
|
|
4
|
+
interface ProjectAutoSurfaceOptions {
|
|
5
|
+
projector?: AutoSurfaceProjectorName;
|
|
6
|
+
scope?: AutoSurfaceLayer | "all";
|
|
7
|
+
}
|
|
8
|
+
declare function projectAutoSurface(resolved: AutoSurfaceResolvedRegistry, options?: ProjectAutoSurfaceOptions): AutoSurfaceProjection;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ProjectAutoSurfaceOptions, projectAutoSurface };
|
|
11
|
+
//# sourceMappingURL=projection.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.mts","names":[],"sources":["../../src/auto-surface/projection.ts"],"mappings":";;;UAQiB,yBAAA;EACf,SAAA,GAAY,wBAAA;EACZ,KAAA,GAAQ,gBAAA;AAAA;AAAA,iBAGM,kBAAA,CACd,QAAA,EAAU,2BAAA,EACV,OAAA,GAAS,yBAAA,GACR,qBAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { projectSettingsShell } from "./projectors/settings-shell.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/auto-surface/projection.ts
|
|
4
|
+
function projectAutoSurface(resolved, options = {}) {
|
|
5
|
+
switch (options.projector ?? "settings-shell") {
|
|
6
|
+
case "settings-shell": return projectSettingsShell(resolved, { scope: options.scope });
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { projectAutoSurface };
|
|
12
|
+
//# sourceMappingURL=projection.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.mjs","names":[],"sources":["../../src/auto-surface/projection.ts"],"sourcesContent":["import { projectSettingsShell } from \"./projectors/settings-shell.js\";\nimport type {\n AutoSurfaceLayer,\n AutoSurfaceProjection,\n AutoSurfaceProjectorName,\n AutoSurfaceResolvedRegistry,\n} from \"./types.js\";\n\nexport interface ProjectAutoSurfaceOptions {\n projector?: AutoSurfaceProjectorName;\n scope?: AutoSurfaceLayer | \"all\";\n}\n\nexport function projectAutoSurface(\n resolved: AutoSurfaceResolvedRegistry,\n options: ProjectAutoSurfaceOptions = {},\n): AutoSurfaceProjection {\n const projector = options.projector ?? \"settings-shell\";\n\n switch (projector) {\n case \"settings-shell\":\n return projectSettingsShell(resolved, { scope: options.scope });\n }\n}\n"],"mappings":";;;AAaA,SAAgB,mBACd,UACA,UAAqC,EAAE,EAChB;AAGvB,SAFkB,QAAQ,aAAa,kBAEvC;EACE,KAAK,iBACH,QAAO,qBAAqB,UAAU,EAAE,OAAO,QAAQ,OAAO,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/auto-surface/projectors/settings-shell.ts
|
|
3
|
+
function projectSettingsShell(resolved, options = {}) {
|
|
4
|
+
const scope = options.scope ?? "all";
|
|
5
|
+
const groups = /* @__PURE__ */ new Map();
|
|
6
|
+
for (const resource of Object.values(resolved.resources)) {
|
|
7
|
+
if (scope !== "all" && !resource.availableScopes.includes(scope)) continue;
|
|
8
|
+
const presentation = resource.definition.presentations?.["settings-shell"];
|
|
9
|
+
const groupTitle = presentation?.group ?? "General";
|
|
10
|
+
const pageTitle = presentation?.page ?? "General";
|
|
11
|
+
const sectionTitle = presentation?.section ?? "General";
|
|
12
|
+
ensureSection(ensurePage(ensureGroup(groups, groupTitle, presentation).pages, pageTitle, presentation).sections, sectionTitle, presentation).node.fields.push(projectField(resource, presentation));
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
projector: "settings-shell",
|
|
16
|
+
scope,
|
|
17
|
+
groups: sortGroups(groups)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function ensureGroup(groups, title, presentation) {
|
|
21
|
+
const id = slugify(title);
|
|
22
|
+
let group = groups.get(id);
|
|
23
|
+
if (!group) {
|
|
24
|
+
group = {
|
|
25
|
+
order: presentation?.groupOrder ?? 0,
|
|
26
|
+
pages: /* @__PURE__ */ new Map(),
|
|
27
|
+
node: {
|
|
28
|
+
kind: "group",
|
|
29
|
+
id,
|
|
30
|
+
title,
|
|
31
|
+
pages: []
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
groups.set(id, group);
|
|
35
|
+
}
|
|
36
|
+
return group;
|
|
37
|
+
}
|
|
38
|
+
function ensurePage(pages, title, presentation) {
|
|
39
|
+
const id = slugify(title);
|
|
40
|
+
let page = pages.get(id);
|
|
41
|
+
if (!page) {
|
|
42
|
+
page = {
|
|
43
|
+
order: presentation?.pageOrder ?? 0,
|
|
44
|
+
sections: /* @__PURE__ */ new Map(),
|
|
45
|
+
node: {
|
|
46
|
+
kind: "page",
|
|
47
|
+
id,
|
|
48
|
+
title,
|
|
49
|
+
sections: []
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
pages.set(id, page);
|
|
53
|
+
}
|
|
54
|
+
return page;
|
|
55
|
+
}
|
|
56
|
+
function ensureSection(sections, title, presentation) {
|
|
57
|
+
const id = slugify(title);
|
|
58
|
+
let section = sections.get(id);
|
|
59
|
+
if (!section) {
|
|
60
|
+
section = {
|
|
61
|
+
order: presentation?.sectionOrder ?? 0,
|
|
62
|
+
node: {
|
|
63
|
+
kind: "section",
|
|
64
|
+
id,
|
|
65
|
+
title,
|
|
66
|
+
fields: []
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
sections.set(id, section);
|
|
70
|
+
}
|
|
71
|
+
return section;
|
|
72
|
+
}
|
|
73
|
+
function projectField(resource, presentation) {
|
|
74
|
+
return {
|
|
75
|
+
kind: "field",
|
|
76
|
+
id: resource.id,
|
|
77
|
+
title: presentation?.title ?? resource.definition.title ?? labelize(resource.id),
|
|
78
|
+
description: presentation?.description ?? resource.definition.description,
|
|
79
|
+
type: resource.definition.type,
|
|
80
|
+
value: resource.value,
|
|
81
|
+
source: resource.source,
|
|
82
|
+
options: resource.definition.options,
|
|
83
|
+
validation: resource.definition.validation,
|
|
84
|
+
policy: resource.definition.policy,
|
|
85
|
+
bindings: resource.definition.bindings
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function sortGroups(groups) {
|
|
89
|
+
return [...groups.values()].sort(compareByOrderThenTitle).map((group) => ({
|
|
90
|
+
...group.node,
|
|
91
|
+
pages: [...group.pages.values()].sort(compareByOrderThenTitle).map((page) => ({
|
|
92
|
+
...page.node,
|
|
93
|
+
sections: [...page.sections.values()].sort(compareByOrderThenTitle).map((section) => ({
|
|
94
|
+
...section.node,
|
|
95
|
+
fields: section.node.fields.sort(compareFields)
|
|
96
|
+
}))
|
|
97
|
+
}))
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
function compareByOrderThenTitle(left, right) {
|
|
101
|
+
return left.order - right.order || left.node.title.localeCompare(right.node.title);
|
|
102
|
+
}
|
|
103
|
+
function compareFields(left, right) {
|
|
104
|
+
return left.title.localeCompare(right.title);
|
|
105
|
+
}
|
|
106
|
+
function labelize(value) {
|
|
107
|
+
return (value.split(".").pop() ?? value).replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
108
|
+
}
|
|
109
|
+
function slugify(value) {
|
|
110
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "general";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
exports.projectSettingsShell = projectSettingsShell;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AutoSurfaceLayer, AutoSurfaceResolvedRegistry, AutoSurfaceSettingsShellProjection } from "../types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/auto-surface/projectors/settings-shell.d.ts
|
|
4
|
+
interface ProjectSettingsShellOptions {
|
|
5
|
+
scope?: AutoSurfaceLayer | "all";
|
|
6
|
+
}
|
|
7
|
+
declare function projectSettingsShell(resolved: AutoSurfaceResolvedRegistry, options?: ProjectSettingsShellOptions): AutoSurfaceSettingsShellProjection;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ProjectSettingsShellOptions, projectSettingsShell };
|
|
10
|
+
//# sourceMappingURL=settings-shell.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-shell.d.cts","names":[],"sources":["../../../src/auto-surface/projectors/settings-shell.ts"],"mappings":";;;UAYiB,2BAAA;EACf,KAAA,GAAQ,gBAAA;AAAA;AAAA,iBAoBM,oBAAA,CACd,QAAA,EAAU,2BAAA,EACV,OAAA,GAAS,2BAAA,GACR,kCAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AutoSurfaceLayer, AutoSurfaceResolvedRegistry, AutoSurfaceSettingsShellProjection } from "../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/auto-surface/projectors/settings-shell.d.ts
|
|
4
|
+
interface ProjectSettingsShellOptions {
|
|
5
|
+
scope?: AutoSurfaceLayer | "all";
|
|
6
|
+
}
|
|
7
|
+
declare function projectSettingsShell(resolved: AutoSurfaceResolvedRegistry, options?: ProjectSettingsShellOptions): AutoSurfaceSettingsShellProjection;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ProjectSettingsShellOptions, projectSettingsShell };
|
|
10
|
+
//# sourceMappingURL=settings-shell.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-shell.d.mts","names":[],"sources":["../../../src/auto-surface/projectors/settings-shell.ts"],"mappings":";;;UAYiB,2BAAA;EACf,KAAA,GAAQ,gBAAA;AAAA;AAAA,iBAoBM,oBAAA,CACd,QAAA,EAAU,2BAAA,EACV,OAAA,GAAS,2BAAA,GACR,kCAAA"}
|