@plitzi/sdk-server 0.32.25 → 0.33.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/CHANGELOG.md +21 -0
- package/README.md +326 -162
- package/dist/adapters/authAdapters.d.ts +21 -0
- package/dist/adapters/authAdapters.js +12 -0
- package/dist/adapters/jsonAdapters.d.ts +15 -0
- package/dist/adapters/jsonAdapters.js +9 -4
- package/dist/core/auth/api.d.ts +148 -0
- package/dist/core/auth/api.js +286 -0
- package/dist/core/auth/authorize.d.ts +96 -0
- package/dist/core/auth/authorize.js +92 -0
- package/dist/core/auth/createAuth.d.ts +165 -0
- package/dist/core/auth/createAuth.js +105 -0
- package/dist/core/auth/credentials.d.ts +29 -0
- package/dist/core/auth/credentials.js +48 -0
- package/dist/core/auth/domains.d.ts +41 -0
- package/dist/core/auth/domains.js +78 -0
- package/dist/core/auth/identity.d.ts +108 -0
- package/dist/core/auth/identity.js +164 -0
- package/dist/core/auth/oauth/client.d.ts +5 -0
- package/dist/core/auth/oauth/client.js +47 -0
- package/dist/core/auth/oauth/index.d.ts +78 -0
- package/dist/core/auth/oauth/index.js +113 -0
- package/dist/core/auth/oauth/providers/github.d.ts +2 -0
- package/dist/core/auth/oauth/providers/github.js +48 -0
- package/dist/core/auth/oauth/providers/google.d.ts +2 -0
- package/dist/core/auth/oauth/providers/google.js +30 -0
- package/dist/core/auth/oauth/state.d.ts +23 -0
- package/dist/core/auth/oauth/state.js +55 -0
- package/dist/core/auth/oauth/types.d.ts +51 -0
- package/dist/core/auth/oauth/types.js +13 -0
- package/dist/core/auth/routes.d.ts +50 -0
- package/dist/core/auth/routes.js +129 -0
- package/dist/core/auth/session.d.ts +128 -0
- package/dist/core/auth/session.js +165 -0
- package/dist/core/auth/spaceTokens.d.ts +137 -0
- package/dist/core/auth/spaceTokens.js +212 -0
- package/dist/core/auth/tokens.d.ts +151 -0
- package/dist/core/auth/tokens.js +221 -0
- package/dist/core/createServer.d.ts +29 -0
- package/dist/core/createServer.js +28 -14
- package/dist/core/handlers/authMiddleware.d.ts +27 -0
- package/dist/core/handlers/authMiddleware.js +38 -0
- package/dist/core/handlers/authRouteHandlers.d.ts +46 -0
- package/dist/core/handlers/authRouteHandlers.js +75 -0
- package/dist/core/handlers/types.d.ts +37 -0
- package/dist/{src/core → core}/http/dispatcher.d.ts +2 -2
- package/dist/core/http/dispatcher.js +8 -6
- package/dist/core/http/navigation.d.ts +11 -0
- package/dist/core/http/navigation.js +16 -0
- package/dist/core/http/securityHeaders.js +6 -4
- package/dist/core/http/stages/authApi.d.ts +17 -0
- package/dist/core/http/stages/authApi.js +66 -0
- package/dist/core/http/stages/authRoutes.js +40 -11
- package/dist/core/http/stages/exchangeRoute.d.ts +15 -0
- package/dist/core/http/stages/exchangeRoute.js +67 -0
- package/dist/core/http/stages/health.d.ts +11 -0
- package/dist/core/http/stages/health.js +25 -3
- package/dist/core/http/stages/middlewares.d.ts +2 -0
- package/dist/core/http/stages/static.d.ts +13 -0
- package/dist/core/http/stages/static.js +21 -6
- package/dist/core/http/types.d.ts +35 -0
- package/dist/{modules/mcp/constants.js → core/previewToken.js} +1 -1
- package/dist/core/sdkAssets.d.ts +16 -0
- package/dist/core/sdkAssets.js +46 -0
- package/dist/core/server/baseServer.js +40 -5
- package/dist/core/server/pageServer.d.ts +7 -0
- package/dist/core/server/pageServer.js +13 -17
- package/dist/core/services/action.d.ts +9 -0
- package/dist/core/services/action.js +21 -0
- package/dist/core/services/registry.d.ts +3 -0
- package/dist/core/services/registry.js +9 -19
- package/dist/{src/core → core}/services/resolve.d.ts +1 -0
- package/dist/core/services/resolve.js +6 -4
- package/dist/core/services/rsc.js +3 -2
- package/dist/core/staticFiles.js +1 -1
- package/dist/{src/core → core}/transports.d.ts +3 -0
- package/dist/core/transports.js +7 -6
- package/dist/handlers.d.ts +58 -0
- package/dist/handlers.js +3 -0
- package/dist/{src/helpers → helpers}/buildResponseHelpers.d.ts +2 -1
- package/dist/helpers/buildResponseHelpers.js +13 -4
- package/dist/helpers/buildServerInfo.d.ts +3 -0
- package/dist/helpers/buildServerInfo.js +25 -3
- package/dist/{src/helpers → helpers}/cache/keys.d.ts +5 -1
- package/dist/helpers/cache/keys.js +1 -1
- package/dist/helpers/compress.d.ts +18 -0
- package/dist/helpers/compress.js +47 -11
- package/dist/helpers/offlineDataLoader.d.ts +11 -0
- package/dist/helpers/offlineDataLoader.js +15 -0
- package/dist/helpers/resolveDebugMode.d.ts +10 -0
- package/dist/helpers/resolveDebugMode.js +13 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +9 -20
- package/dist/kernel.d.ts +41 -0
- package/dist/kernel.js +22 -0
- package/dist/middlewares/spaceDeployment.d.ts +2 -0
- package/dist/middlewares/spaceDeployment.js +2 -1
- package/dist/modules/actions/handler.d.ts +11 -0
- package/dist/modules/actions/handler.js +77 -0
- package/dist/modules/connectors/engine.d.ts +42 -0
- package/dist/modules/connectors/engine.js +221 -0
- package/dist/modules/connectors/getByPath.d.ts +8 -0
- package/dist/modules/connectors/getByPath.js +21 -0
- package/dist/modules/connectors/index.d.ts +7 -0
- package/dist/modules/connectors/projection.d.ts +18 -0
- package/dist/modules/connectors/projection.js +108 -0
- package/dist/modules/connectors/resolver.d.ts +18 -0
- package/dist/modules/connectors/resolver.js +68 -0
- package/dist/modules/connectors/types.d.ts +19 -0
- package/dist/{src/modules → modules}/rsc/handler.d.ts +2 -2
- package/dist/modules/rsc/handler.js +54 -2
- package/dist/modules/rsc/resolveRscData.d.ts +35 -0
- package/dist/modules/rsc/resolveRscData.js +74 -0
- package/dist/{src/modules → modules}/ssr/Component.d.ts +4 -1
- package/dist/modules/ssr/Component.js +10 -3
- package/dist/modules/ssr/buildBody.d.ts +9 -0
- package/dist/modules/ssr/handler.d.ts +4 -0
- package/dist/modules/ssr/handler.js +18 -1
- package/dist/{src/modules → modules}/ssr/loadPluginComponents.d.ts +5 -2
- package/dist/modules/ssr/loadPluginComponents.js +20 -2
- package/dist/{src/modules → modules}/ssr/prepareRender.d.ts +2 -2
- package/dist/modules/ssr/prepareRender.js +24 -7
- package/dist/modules/ssr/preview.d.ts +10 -0
- package/dist/modules/ssr/preview.js +5 -78
- package/dist/modules/ssr/registerExternalPlugins.js +1 -1
- package/dist/modules/ssr/streamBody.d.ts +5 -0
- package/dist/modules/ssr/streamBody.js +1 -1
- package/dist/modules/ssr/template.d.ts +2 -0
- package/dist/modules/ssr/template.js +1 -1
- package/dist/plugins/compile.js +1 -1
- package/dist/plugins/manager.js +12 -8
- package/dist/ssr.d.ts +15 -0
- package/dist/ssr.js +4 -0
- package/package.json +29 -25
- package/dist/.gitkeep +0 -0
- package/dist/core/server/mcpServer.js +0 -29
- package/dist/core/services/mcp.js +0 -27
- package/dist/core/services/oauth.js +0 -116
- package/dist/core/services/preview.js +0 -37
- package/dist/core/services/proxy.js +0 -12
- package/dist/mcp.d.ts +0 -2
- package/dist/mcp.js +0 -7
- package/dist/modules/ai/AIEngine.js +0 -120
- package/dist/modules/ai/toolkit.js +0 -59
- package/dist/modules/mcp/apps/example/view/index.tsx +0 -70
- package/dist/modules/mcp/apps/index.js +0 -16
- package/dist/modules/mcp/apps/render/index.js +0 -17
- package/dist/modules/mcp/apps/render/styles.js +0 -54
- package/dist/modules/mcp/apps/render/view/heldBatch.ts +0 -107
- package/dist/modules/mcp/apps/render/view/index.tsx +0 -314
- package/dist/modules/mcp/apps/render/view/streamProgress.ts +0 -137
- package/dist/modules/mcp/apps/shared/assets.js +0 -10
- package/dist/modules/mcp/apps/shared/bundle.js +0 -23
- package/dist/modules/mcp/apps/shared/page.js +0 -34
- package/dist/modules/mcp/apps/shared/registerApp.js +0 -43
- package/dist/modules/mcp/apps/shared/resolve.js +0 -5
- package/dist/modules/mcp/apps/shared/shell.ejs +0 -59
- package/dist/modules/mcp/apps/shared/zodEnglishOnly.js +0 -23
- package/dist/modules/mcp/catalogs/builtinCallbacks.js +0 -204
- package/dist/modules/mcp/catalogs/builtinComponents.js +0 -170
- package/dist/modules/mcp/catalogs/builtinElementCallbacks.js +0 -50
- package/dist/modules/mcp/catalogs/builtinTransformers.js +0 -148
- package/dist/modules/mcp/catalogs/builtinUtilities.js +0 -90
- package/dist/modules/mcp/catalogs/cssCatalog/border.js +0 -30
- package/dist/modules/mcp/catalogs/cssCatalog/box.js +0 -31
- package/dist/modules/mcp/catalogs/cssCatalog/helpers.js +0 -185
- package/dist/modules/mcp/catalogs/cssCatalog/index.js +0 -131
- package/dist/modules/mcp/catalogs/cssCatalog/layout.js +0 -98
- package/dist/modules/mcp/catalogs/cssCatalog/visual.js +0 -144
- package/dist/modules/mcp/catalogs/observed.js +0 -90
- package/dist/modules/mcp/catalogs/paramSpec.js +0 -69
- package/dist/modules/mcp/catalogs/registry.js +0 -89
- package/dist/modules/mcp/handler.js +0 -83
- package/dist/modules/mcp/helpers/agentPrompt.js +0 -104
- package/dist/modules/mcp/helpers/computeVersion.js +0 -16
- package/dist/modules/mcp/helpers/guide.js +0 -467
- package/dist/modules/mcp/helpers/interactions.js +0 -123
- package/dist/modules/mcp/helpers/log.js +0 -64
- package/dist/modules/mcp/helpers/opResult.js +0 -18
- package/dist/modules/mcp/helpers/space.js +0 -300
- package/dist/modules/mcp/helpers/uris.js +0 -44
- package/dist/modules/mcp/previewClient.js +0 -31
- package/dist/modules/mcp/proxy/config.js +0 -63
- package/dist/modules/mcp/proxy/fetch.js +0 -91
- package/dist/modules/mcp/proxy/grant.js +0 -67
- package/dist/modules/mcp/proxy/guard.js +0 -38
- package/dist/modules/mcp/proxy/handler.js +0 -99
- package/dist/modules/mcp/proxy/payload.js +0 -29
- package/dist/modules/mcp/proxy/rewrite.js +0 -138
- package/dist/modules/mcp/proxy/sign.js +0 -15
- package/dist/modules/mcp/proxy/types.js +0 -9
- package/dist/modules/mcp/resources/canonical.js +0 -30
- package/dist/modules/mcp/resources/core.js +0 -18
- package/dist/modules/mcp/resources/envelope.js +0 -14
- package/dist/modules/mcp/resources/primer.js +0 -31
- package/dist/modules/mcp/resources/register.js +0 -190
- package/dist/modules/mcp/resources/renderGuide.js +0 -451
- package/dist/modules/mcp/resources/router.js +0 -37
- package/dist/modules/mcp/resources/schema.js +0 -43
- package/dist/modules/mcp/resources/style.js +0 -34
- package/dist/modules/mcp/screenshotClient.js +0 -47
- package/dist/modules/mcp/server.js +0 -113
- package/dist/modules/mcp/tools/apply/dispatch.js +0 -105
- package/dist/modules/mcp/tools/apply/index.js +0 -150
- package/dist/modules/mcp/tools/apply/writeResult.js +0 -37
- package/dist/modules/mcp/tools/index.js +0 -24
- package/dist/modules/mcp/tools/operations/index.js +0 -45
- package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.js +0 -32
- package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.js +0 -36
- package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.js +0 -47
- package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.js +0 -29
- package/dist/modules/mcp/tools/operations/schema/elements/moveElement.js +0 -41
- package/dist/modules/mcp/tools/operations/schema/elements/patchElement.js +0 -58
- package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.js +0 -148
- package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.js +0 -65
- package/dist/modules/mcp/tools/operations/schema/folders/deleteFolder.js +0 -30
- package/dist/modules/mcp/tools/operations/schema/folders/upsertFolder.js +0 -49
- package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.js +0 -52
- package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.js +0 -47
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +0 -44
- package/dist/modules/mcp/tools/operations/schema/operations.js +0 -41
- package/dist/modules/mcp/tools/operations/schema/pages/deletePage.js +0 -25
- package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.js +0 -75
- package/dist/modules/mcp/tools/operations/schema/settings/patchSettings.js +0 -45
- package/dist/modules/mcp/tools/operations/schema/shared.js +0 -122
- package/dist/modules/mcp/tools/operations/schema/translator.js +0 -215
- package/dist/modules/mcp/tools/operations/schema/variables/deleteVariable.js +0 -18
- package/dist/modules/mcp/tools/operations/schema/variables/upsertVariable.js +0 -42
- package/dist/modules/mcp/tools/operations/schema/write.js +0 -109
- package/dist/modules/mcp/tools/operations/schemaIds.js +0 -54
- package/dist/modules/mcp/tools/operations/style/definitions/deleteDefinition.js +0 -21
- package/dist/modules/mcp/tools/operations/style/definitions/patchDefinition.js +0 -28
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinition.js +0 -24
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinitions.js +0 -40
- package/dist/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.js +0 -21
- package/dist/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.js +0 -28
- package/dist/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.js +0 -24
- package/dist/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.js +0 -21
- package/dist/modules/mcp/tools/operations/style/idStyles/patchIdStyle.js +0 -28
- package/dist/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.js +0 -24
- package/dist/modules/mcp/tools/operations/style/operations.js +0 -29
- package/dist/modules/mcp/tools/operations/style/shared.js +0 -59
- package/dist/modules/mcp/tools/operations/style/translator.js +0 -101
- package/dist/modules/mcp/tools/operations/style/variables/deleteStyleVariable.js +0 -21
- package/dist/modules/mcp/tools/operations/style/variables/upsertStyleVariable.js +0 -22
- package/dist/modules/mcp/tools/operations/style/write.js +0 -108
- package/dist/modules/mcp/tools/preview.js +0 -37
- package/dist/modules/mcp/tools/read.js +0 -51
- package/dist/modules/mcp/tools/render.js +0 -184
- package/dist/modules/mcp/tools/screenshot.js +0 -83
- package/dist/modules/mcp/tools/search.js +0 -115
- package/dist/modules/mcp/tools/shared/expandOperations.js +0 -44
- package/dist/modules/mcp/tools/shared/tool.js +0 -33
- package/dist/modules/mcp/tools/shared/validator/audit.js +0 -124
- package/dist/modules/mcp/tools/shared/validator/batch.js +0 -39
- package/dist/modules/mcp/tools/shared/validator/bindings.js +0 -70
- package/dist/modules/mcp/tools/shared/validator/context.js +0 -35
- package/dist/modules/mcp/tools/shared/validator/css.js +0 -39
- package/dist/modules/mcp/tools/shared/validator/elements.js +0 -68
- package/dist/modules/mcp/tools/shared/validator/index.js +0 -246
- package/dist/modules/mcp/tools/shared/validator/interactions.js +0 -103
- package/dist/modules/mcp/tools/shared/validator/refs.js +0 -28
- package/dist/modules/mcp/tools/validate.js +0 -47
- package/dist/modules/oauth/authorize.js +0 -177
- package/dist/modules/oauth/challenge.js +0 -33
- package/dist/modules/oauth/consentPage.js +0 -118
- package/dist/modules/oauth/metadata.js +0 -69
- package/dist/modules/oauth/params.js +0 -5
- package/dist/modules/oauth/pkce.js +0 -15
- package/dist/modules/oauth/records.js +0 -46
- package/dist/modules/oauth/register.js +0 -55
- package/dist/modules/oauth/respond.js +0 -44
- package/dist/modules/oauth/token.js +0 -100
- package/dist/public/.gitkeep +0 -0
- package/dist/src/adapters/jsonAdapters.d.ts +0 -7
- package/dist/src/core/createServer.d.ts +0 -14
- package/dist/src/core/http/stages/health.d.ts +0 -2
- package/dist/src/core/http/stages/middlewares.d.ts +0 -2
- package/dist/src/core/http/stages/static.d.ts +0 -5
- package/dist/src/core/http/types.d.ts +0 -22
- package/dist/src/core/server/mcpServer.d.ts +0 -2
- package/dist/src/core/server/pageServer.d.ts +0 -10
- package/dist/src/core/services/mcp.d.ts +0 -3
- package/dist/src/core/services/oauth.d.ts +0 -18
- package/dist/src/core/services/preview.d.ts +0 -2
- package/dist/src/core/services/proxy.d.ts +0 -2
- package/dist/src/core/services/registry.d.ts +0 -4
- package/dist/src/helpers/buildServerInfo.d.ts +0 -2
- package/dist/src/helpers/compress.d.ts +0 -3
- package/dist/src/index.d.ts +0 -15
- package/dist/src/mcp.d.ts +0 -14
- package/dist/src/middlewares/spaceDeployment.d.ts +0 -2
- package/dist/src/modules/ai/AIEngine.d.ts +0 -20
- package/dist/src/modules/ai/index.d.ts +0 -4
- package/dist/src/modules/ai/toolkit.d.ts +0 -17
- package/dist/src/modules/mcp/apps/example/index.d.ts +0 -8
- package/dist/src/modules/mcp/apps/index.d.ts +0 -11
- package/dist/src/modules/mcp/apps/render/index.d.ts +0 -4
- package/dist/src/modules/mcp/apps/render/styles.d.ts +0 -10
- package/dist/src/modules/mcp/apps/shared/assets.d.ts +0 -10
- package/dist/src/modules/mcp/apps/shared/bundle.d.ts +0 -4
- package/dist/src/modules/mcp/apps/shared/index.d.ts +0 -3
- package/dist/src/modules/mcp/apps/shared/page.d.ts +0 -2
- package/dist/src/modules/mcp/apps/shared/registerApp.d.ts +0 -5
- package/dist/src/modules/mcp/apps/shared/resolve.d.ts +0 -1
- package/dist/src/modules/mcp/apps/shared/zodEnglishOnly.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/builtinCallbacks.d.ts +0 -23
- package/dist/src/modules/mcp/catalogs/builtinComponents.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/builtinElementCallbacks.d.ts +0 -20
- package/dist/src/modules/mcp/catalogs/builtinTransformers.d.ts +0 -28
- package/dist/src/modules/mcp/catalogs/builtinUtilities.d.ts +0 -18
- package/dist/src/modules/mcp/catalogs/cssCatalog/border.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/cssCatalog/box.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/cssCatalog/helpers.d.ts +0 -34
- package/dist/src/modules/mcp/catalogs/cssCatalog/index.d.ts +0 -19
- package/dist/src/modules/mcp/catalogs/cssCatalog/layout.d.ts +0 -9
- package/dist/src/modules/mcp/catalogs/cssCatalog/visual.d.ts +0 -8
- package/dist/src/modules/mcp/catalogs/index.d.ts +0 -9
- package/dist/src/modules/mcp/catalogs/observed.d.ts +0 -48
- package/dist/src/modules/mcp/catalogs/paramSpec.d.ts +0 -42
- package/dist/src/modules/mcp/catalogs/registry.d.ts +0 -35
- package/dist/src/modules/mcp/e2e/index.d.ts +0 -6
- package/dist/src/modules/mcp/e2e/mcpEndpoint.d.ts +0 -27
- package/dist/src/modules/mcp/e2e/postMessageChannel.d.ts +0 -22
- package/dist/src/modules/mcp/e2e/renderingHost.d.ts +0 -34
- package/dist/src/modules/mcp/handler.d.ts +0 -22
- package/dist/src/modules/mcp/helpers/agentPrompt.d.ts +0 -4
- package/dist/src/modules/mcp/helpers/computeVersion.d.ts +0 -1
- package/dist/src/modules/mcp/helpers/guide.d.ts +0 -4
- package/dist/src/modules/mcp/helpers/index.d.ts +0 -8
- package/dist/src/modules/mcp/helpers/interactions.d.ts +0 -30
- package/dist/src/modules/mcp/helpers/log.d.ts +0 -8
- package/dist/src/modules/mcp/helpers/opResult.d.ts +0 -13
- package/dist/src/modules/mcp/helpers/space.d.ts +0 -115
- package/dist/src/modules/mcp/helpers/uris.d.ts +0 -28
- package/dist/src/modules/mcp/index.d.ts +0 -13
- package/dist/src/modules/mcp/previewClient.d.ts +0 -13
- package/dist/src/modules/mcp/proxy/config.d.ts +0 -19
- package/dist/src/modules/mcp/proxy/fetch.d.ts +0 -18
- package/dist/src/modules/mcp/proxy/grant.d.ts +0 -25
- package/dist/src/modules/mcp/proxy/guard.d.ts +0 -6
- package/dist/src/modules/mcp/proxy/handler.d.ts +0 -8
- package/dist/src/modules/mcp/proxy/index.d.ts +0 -8
- package/dist/src/modules/mcp/proxy/payload.d.ts +0 -8
- package/dist/src/modules/mcp/proxy/rewrite.d.ts +0 -18
- package/dist/src/modules/mcp/proxy/sign.d.ts +0 -6
- package/dist/src/modules/mcp/proxy/types.d.ts +0 -45
- package/dist/src/modules/mcp/resources/canonical.d.ts +0 -6
- package/dist/src/modules/mcp/resources/core.d.ts +0 -5
- package/dist/src/modules/mcp/resources/envelope.d.ts +0 -10
- package/dist/src/modules/mcp/resources/index.d.ts +0 -8
- package/dist/src/modules/mcp/resources/primer.d.ts +0 -7
- package/dist/src/modules/mcp/resources/register.d.ts +0 -10
- package/dist/src/modules/mcp/resources/renderGuide.d.ts +0 -10
- package/dist/src/modules/mcp/resources/router.d.ts +0 -10
- package/dist/src/modules/mcp/resources/schema.d.ts +0 -5
- package/dist/src/modules/mcp/resources/style.d.ts +0 -5
- package/dist/src/modules/mcp/screenshotClient.d.ts +0 -13
- package/dist/src/modules/mcp/server.d.ts +0 -31
- package/dist/src/modules/mcp/tests/helpers.d.ts +0 -13
- package/dist/src/modules/mcp/tools/apply/dispatch.d.ts +0 -6
- package/dist/src/modules/mcp/tools/apply/index.d.ts +0 -470
- package/dist/src/modules/mcp/tools/apply/writeResult.d.ts +0 -8
- package/dist/src/modules/mcp/tools/index.d.ts +0 -18
- package/dist/src/modules/mcp/tools/operations/index.d.ts +0 -928
- package/dist/src/modules/mcp/tools/operations/schema/bindings/deleteBinding.d.ts +0 -17
- package/dist/src/modules/mcp/tools/operations/schema/bindings/patchBinding.d.ts +0 -25
- package/dist/src/modules/mcp/tools/operations/schema/bindings/upsertBinding.d.ts +0 -27
- package/dist/src/modules/mcp/tools/operations/schema/elements/deleteElement.d.ts +0 -10
- package/dist/src/modules/mcp/tools/operations/schema/elements/moveElement.d.ts +0 -16
- package/dist/src/modules/mcp/tools/operations/schema/elements/patchElement.d.ts +0 -22
- package/dist/src/modules/mcp/tools/operations/schema/elements/repeatElement.d.ts +0 -55
- package/dist/src/modules/mcp/tools/operations/schema/elements/upsertElement.d.ts +0 -16
- package/dist/src/modules/mcp/tools/operations/schema/folders/deleteFolder.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/schema/folders/upsertFolder.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/schema/index.d.ts +0 -21
- package/dist/src/modules/mcp/tools/operations/schema/interactions/deleteInteraction.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.d.ts +0 -18
- package/dist/src/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.d.ts +0 -27
- package/dist/src/modules/mcp/tools/operations/schema/operations.d.ts +0 -229
- package/dist/src/modules/mcp/tools/operations/schema/pages/deletePage.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/schema/pages/upsertPage.d.ts +0 -14
- package/dist/src/modules/mcp/tools/operations/schema/settings/patchSettings.d.ts +0 -34
- package/dist/src/modules/mcp/tools/operations/schema/shared.d.ts +0 -92
- package/dist/src/modules/mcp/tools/operations/schema/translator.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/schema/variables/deleteVariable.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/schema/variables/upsertVariable.d.ts +0 -16
- package/dist/src/modules/mcp/tools/operations/schema/write.d.ts +0 -42
- package/dist/src/modules/mcp/tools/operations/schemaIds.d.ts +0 -6
- package/dist/src/modules/mcp/tools/operations/style/definitions/deleteDefinition.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/style/definitions/patchDefinition.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/definitions/upsertDefinition.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/definitions/upsertDefinitions.d.ts +0 -41
- package/dist/src/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/style/idStyles/patchIdStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/index.d.ts +0 -15
- package/dist/src/modules/mcp/tools/operations/style/operations.d.ts +0 -264
- package/dist/src/modules/mcp/tools/operations/style/shared.d.ts +0 -116
- package/dist/src/modules/mcp/tools/operations/style/translator.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/style/variables/deleteStyleVariable.d.ts +0 -15
- package/dist/src/modules/mcp/tools/operations/style/variables/upsertStyleVariable.d.ts +0 -20
- package/dist/src/modules/mcp/tools/operations/style/write.d.ts +0 -12
- package/dist/src/modules/mcp/tools/preview.d.ts +0 -465
- package/dist/src/modules/mcp/tools/read.d.ts +0 -9
- package/dist/src/modules/mcp/tools/render.d.ts +0 -499
- package/dist/src/modules/mcp/tools/render.test.d.ts +0 -1
- package/dist/src/modules/mcp/tools/screenshot.d.ts +0 -470
- package/dist/src/modules/mcp/tools/search.d.ts +0 -15
- package/dist/src/modules/mcp/tools/shared/expandOperations.d.ts +0 -13
- package/dist/src/modules/mcp/tools/shared/tool.d.ts +0 -72
- package/dist/src/modules/mcp/tools/shared/validator/audit.d.ts +0 -4
- package/dist/src/modules/mcp/tools/shared/validator/batch.d.ts +0 -5
- package/dist/src/modules/mcp/tools/shared/validator/bindings.d.ts +0 -6
- package/dist/src/modules/mcp/tools/shared/validator/context.d.ts +0 -38
- package/dist/src/modules/mcp/tools/shared/validator/css.d.ts +0 -4
- package/dist/src/modules/mcp/tools/shared/validator/elements.d.ts +0 -7
- package/dist/src/modules/mcp/tools/shared/validator/index.d.ts +0 -8
- package/dist/src/modules/mcp/tools/shared/validator/interactions.d.ts +0 -3
- package/dist/src/modules/mcp/tools/shared/validator/refs.d.ts +0 -4
- package/dist/src/modules/mcp/tools/validate.d.ts +0 -467
- package/dist/src/modules/mcp/types/aiSchema.d.ts +0 -218
- package/dist/src/modules/mcp/types/appTypes.d.ts +0 -26
- package/dist/src/modules/mcp/types/index.d.ts +0 -5
- package/dist/src/modules/mcp/types/previewTypes.d.ts +0 -25
- package/dist/src/modules/mcp/types/screenshotTypes.d.ts +0 -29
- package/dist/src/modules/mcp/types/toolTypes.d.ts +0 -138
- package/dist/src/modules/oauth/authorize.d.ts +0 -7
- package/dist/src/modules/oauth/challenge.d.ts +0 -11
- package/dist/src/modules/oauth/consentPage.d.ts +0 -7
- package/dist/src/modules/oauth/metadata.d.ts +0 -40
- package/dist/src/modules/oauth/params.d.ts +0 -5
- package/dist/src/modules/oauth/pkce.d.ts +0 -6
- package/dist/src/modules/oauth/records.d.ts +0 -71
- package/dist/src/modules/oauth/register.d.ts +0 -5
- package/dist/src/modules/oauth/respond.d.ts +0 -13
- package/dist/src/modules/oauth/token.d.ts +0 -5
- package/dist/src/modules/ssr/buildBody.d.ts +0 -9
- package/dist/src/modules/ssr/handler.d.ts +0 -4
- package/dist/src/modules/ssr/preview.d.ts +0 -16
- package/dist/src/modules/ssr/streamBody.d.ts +0 -5
- package/dist/src/modules/ssr/template.d.ts +0 -6
- package/dist/src/standalone/alias-loader.d.mts +0 -2
- package/dist/src/standalone/plugins/ClientInfo.d.ts +0 -2
- package/dist/src/standalone/plugins/ServerInfo.d.ts +0 -2
- package/dist/src/standalone/plugins/SharedInfo.d.ts +0 -2
- package/dist/src/standalone/plugins/styles.d.ts +0 -5
- package/dist/src/standalone/register-alias.d.mts +0 -1
- package/dist/src/standalone/server.d.ts +0 -1
- package/dist/src/standalone/stubs/react-syntax-highlighter.d.mts +0 -31
- package/skills/plitzi-render/SKILL.md +0 -174
- /package/dist/{src/core/http/dispatcher.test.d.ts → core/auth/api.test.d.ts} +0 -0
- /package/dist/{src/core/server/mcpServer.test.d.ts → core/auth/authorize.test.d.ts} +0 -0
- /package/dist/{src/modules/ai/toolkit.test.d.ts → core/auth/createAuth.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/apps/apps.test.d.ts → core/auth/domains.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/apps/render/styles.test.d.ts → core/auth/identity.test.d.ts} +0 -0
- /package/dist/{src/modules → core/auth}/oauth/oauth.test.d.ts +0 -0
- /package/dist/{src/modules/mcp/catalogs/builtinTransformers.test.d.ts → core/auth/routes.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/catalogs/cssCatalog/cssCatalog.test.d.ts → core/auth/session.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/e2e/connector.test.d.ts → core/auth/spaceTokens.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/e2e/host.test.d.ts → core/auth/tokens.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/e2e/oauthConnector.test.d.ts → core/createServer.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/helpers/log.test.d.ts → core/handlers/handlers.test.d.ts} +0 -0
- /package/dist/{src/core → core}/health.d.ts +0 -0
- /package/dist/{src/modules/mcp/mcp.bench.d.ts → core/http/dispatcher.test.d.ts} +0 -0
- /package/dist/{src/core → core}/http/securityHeaders.d.ts +0 -0
- /package/dist/{src/core → core}/http/stages/authRoutes.d.ts +0 -0
- /package/dist/{src/core → core}/http/stages/pluginAssets.d.ts +0 -0
- /package/dist/{src/core → core}/mimeTypes.d.ts +0 -0
- /package/dist/{src/modules/mcp/constants.d.ts → core/previewToken.d.ts} +0 -0
- /package/dist/{src/core → core}/requestParser.d.ts +0 -0
- /package/dist/{src/core → core}/server/baseServer.d.ts +0 -0
- /package/dist/{src/modules/mcp/proxy/endpoint.test.d.ts → core/server/baseServer.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/proxy/proxy.test.d.ts → core/services/resolve.test.d.ts} +0 -0
- /package/dist/{src/core → core}/services/rsc.d.ts +0 -0
- /package/dist/{src/core → core}/services/ssr.d.ts +0 -0
- /package/dist/{src/core → core}/staticFiles.d.ts +0 -0
- /package/dist/{src/modules/mcp/proxy/wiring.test.d.ts → helpers/buildResponseHelpers.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/cache/TtlCache.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/cache/cacheManager.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/cache/defaults.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/cache/index.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/apply.test.d.ts → helpers/cache/keys.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/cache/serverCaches.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/bindings.test.d.ts → helpers/compress.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/escapeJson.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/metrics.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/normalizePlugins.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/css.test.d.ts → helpers/offlineDataLoader.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/readCookie.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/interactions.test.d.ts → helpers/resolveDebugMode.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/runMiddlewares.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/serverLog.d.ts +0 -0
- /package/dist/{src/middlewares → middlewares}/auth.d.ts +0 -0
- /package/dist/{src/middlewares → middlewares}/basicAuth.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/pages.test.d.ts → middlewares/spaceDeployment.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/reads.test.d.ts → modules/actions/handler.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/schemaIds.test.d.ts → modules/connectors/engine.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/search.test.d.ts → modules/connectors/projection.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/skill.test.d.ts → modules/connectors/resolver.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/styles.test.d.ts → modules/rsc/resolveRscData.test.d.ts} +0 -0
- /package/dist/{src/modules → modules}/ssr/applySSRResult.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/tools.test.d.ts → modules/ssr/loadPluginComponents.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/validation.test.d.ts → modules/ssr/metering.test.d.ts} +0 -0
- /package/dist/{src/modules → modules}/ssr/registerExternalPlugins.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/compile.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/copy.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/detect.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/manager.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/validate.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/validate.test.d.ts +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { pageUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { bindingCategory, bindingInput } from "../shared.js";
|
|
4
|
-
import { resolveElement } from "../write.js";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
//#region src/modules/mcp/tools/operations/schema/bindings/patchBinding.ts
|
|
7
|
-
var patchBindingOp = z.object({
|
|
8
|
-
type: z.literal("patchBinding"),
|
|
9
|
-
pageRef: z.string().describe("Page ref or id"),
|
|
10
|
-
ref: z.string().describe("Element ref or id"),
|
|
11
|
-
category: bindingCategory,
|
|
12
|
-
to: z.string().describe("Target of the binding to patch"),
|
|
13
|
-
id: z.string().optional().describe("Match by id instead of to"),
|
|
14
|
-
source: bindingInput.shape.source.optional(),
|
|
15
|
-
transformers: bindingInput.shape.transformers,
|
|
16
|
-
when: bindingInput.shape.when,
|
|
17
|
-
enabled: bindingInput.shape.enabled
|
|
18
|
-
}).describe("Partially update an EXISTING binding (matched by id when given, else by to): only the fields you pass change. Never creates — fails if no binding matches.");
|
|
19
|
-
var patchBinding = (space, env, op) => {
|
|
20
|
-
const found = resolveElement(space, env, op.pageRef, op.ref);
|
|
21
|
-
if ("error" in found) return found.error;
|
|
22
|
-
const binding = (found.el.definition.bindings?.[op.category])?.find((b) => op.id ? b.id === op.id : b.to === op.to);
|
|
23
|
-
if (!binding) return fail("to", `No ${op.category} binding matching "${op.id ?? op.to}" on "${op.ref}"`, "Use upsertBinding to add it");
|
|
24
|
-
if (op.source !== void 0) binding.source = op.source;
|
|
25
|
-
if (op.transformers !== void 0) binding.transformers = op.transformers;
|
|
26
|
-
if (op.when !== void 0) binding.when = op.when;
|
|
27
|
-
if (op.enabled !== void 0) binding.enabled = op.enabled;
|
|
28
|
-
return {
|
|
29
|
-
...empty(),
|
|
30
|
-
updated: 1,
|
|
31
|
-
staleResources: [pageUri(env, op.pageRef)],
|
|
32
|
-
elementRefs: [op.ref]
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
//#endregion
|
|
36
|
-
export { patchBinding, patchBindingOp };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { generateObjectId } from "../../../../helpers/space.js";
|
|
2
|
-
import { pageUri } from "../../../../helpers/uris.js";
|
|
3
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
4
|
-
import { bindingCategory, bindingInput } from "../shared.js";
|
|
5
|
-
import { resolveElement } from "../write.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/modules/mcp/tools/operations/schema/bindings/upsertBinding.ts
|
|
8
|
-
var upsertBindingOp = z.object({
|
|
9
|
-
type: z.literal("upsertBinding"),
|
|
10
|
-
pageRef: z.string().describe("Page ref or id"),
|
|
11
|
-
ref: z.string().describe("Element ref or id"),
|
|
12
|
-
category: bindingCategory,
|
|
13
|
-
binding: bindingInput
|
|
14
|
-
}).describe("Add a data binding to an element, or replace the one already feeding the same target (matched by binding.id when given, else by binding.to). Connects a data source to a prop, style value, or initialState key.");
|
|
15
|
-
var upsertBinding = (space, env, op) => {
|
|
16
|
-
const found = resolveElement(space, env, op.pageRef, op.ref);
|
|
17
|
-
if ("error" in found) return found.error;
|
|
18
|
-
const bindings = found.el.definition.bindings ??= {};
|
|
19
|
-
const list = bindings[op.category] ??= [];
|
|
20
|
-
const index = list.findIndex((b) => op.binding.id ? b.id === op.binding.id : b.to === op.binding.to);
|
|
21
|
-
const binding = {
|
|
22
|
-
id: op.binding.id ?? (index >= 0 ? list[index].id : generateObjectId()),
|
|
23
|
-
to: op.binding.to,
|
|
24
|
-
source: op.binding.source
|
|
25
|
-
};
|
|
26
|
-
if (op.binding.transformers) binding.transformers = op.binding.transformers;
|
|
27
|
-
if (op.binding.when !== void 0) binding.when = op.binding.when;
|
|
28
|
-
if (op.binding.enabled !== void 0) binding.enabled = op.binding.enabled;
|
|
29
|
-
if (index >= 0) {
|
|
30
|
-
list[index] = binding;
|
|
31
|
-
return {
|
|
32
|
-
...empty(),
|
|
33
|
-
updated: 1,
|
|
34
|
-
staleResources: [pageUri(env, op.pageRef)],
|
|
35
|
-
elementRefs: [op.ref]
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
list.push(binding);
|
|
39
|
-
return {
|
|
40
|
-
...empty(),
|
|
41
|
-
created: 1,
|
|
42
|
-
staleResources: [pageUri(env, op.pageRef)],
|
|
43
|
-
elementRefs: [op.ref]
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
//#endregion
|
|
47
|
-
export { upsertBinding, upsertBindingOp };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { descendantIds, findPageByRef, indexRemoveElements, resolveRef } from "../../../../helpers/space.js";
|
|
2
|
-
import { pageUri } from "../../../../helpers/uris.js";
|
|
3
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
4
|
-
import { removeFromParent } from "../write.js";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
//#region src/modules/mcp/tools/operations/schema/elements/deleteElement.ts
|
|
7
|
-
var deleteElementOp = z.object({
|
|
8
|
-
type: z.literal("deleteElement"),
|
|
9
|
-
pageRef: z.string().describe("Page ref or id"),
|
|
10
|
-
ref: z.string().describe("Ref or id of the element to delete")
|
|
11
|
-
}).describe("Delete an element and all of its descendants from a page.");
|
|
12
|
-
var deleteElement = (space, env, op) => {
|
|
13
|
-
const page = findPageByRef(space.schema, op.pageRef);
|
|
14
|
-
if (!page) return fail("pageRef", `Page "${op.pageRef}" not found`, "Read the pages resource for valid refs");
|
|
15
|
-
const el = resolveRef(space.schema, page, op.ref);
|
|
16
|
-
if (!el || el.id === page.id) return fail("ref", `Element "${op.ref}" not found in page "${op.pageRef}"`, "Read the page resource for valid refs");
|
|
17
|
-
const ids = [...descendantIds(space.schema, el.id), el.id];
|
|
18
|
-
const removed = ids.map((id) => space.schema.flat[id]);
|
|
19
|
-
for (const id of ids) Reflect.deleteProperty(space.schema.flat, id);
|
|
20
|
-
removeFromParent(space, el);
|
|
21
|
-
indexRemoveElements(space.schema, removed);
|
|
22
|
-
return {
|
|
23
|
-
...empty(),
|
|
24
|
-
deleted: 1,
|
|
25
|
-
staleResources: [pageUri(env, op.pageRef)]
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
//#endregion
|
|
29
|
-
export { deleteElement, deleteElementOp };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { findPageByRef, indexInvalidateDetails, resolveRef } from "../../../../helpers/space.js";
|
|
2
|
-
import { pageUri } from "../../../../helpers/uris.js";
|
|
3
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
4
|
-
import { position } from "../shared.js";
|
|
5
|
-
import { placeChild, removeFromParent } from "../write.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/modules/mcp/tools/operations/schema/elements/moveElement.ts
|
|
8
|
-
var moveElementOp = z.object({
|
|
9
|
-
type: z.literal("moveElement"),
|
|
10
|
-
pageRef: z.string().describe("Page ref or id"),
|
|
11
|
-
ref: z.string().describe("Ref or id of the element to move"),
|
|
12
|
-
toParentRef: z.string().describe("Ref or id of the anchor the element moves relative to (see position)"),
|
|
13
|
-
position
|
|
14
|
-
}).describe("Move an existing element to a new parent, or reorder it — its placement is set by position.");
|
|
15
|
-
var moveElement = (space, env, op) => {
|
|
16
|
-
const page = findPageByRef(space.schema, op.pageRef);
|
|
17
|
-
if (!page) return fail("pageRef", `Page "${op.pageRef}" not found`, "Read the pages resource for valid refs");
|
|
18
|
-
const el = resolveRef(space.schema, page, op.ref);
|
|
19
|
-
const anchor = resolveRef(space.schema, page, op.toParentRef);
|
|
20
|
-
if (!el || el.id === page.id) return fail("ref", `Element "${op.ref}" not found`, "Read the page resource for valid refs");
|
|
21
|
-
if (!anchor) return fail("toParentRef", `Target "${op.toParentRef}" not found`, "Read the page resource for valid refs");
|
|
22
|
-
removeFromParent(space, el);
|
|
23
|
-
let parent = anchor;
|
|
24
|
-
let index;
|
|
25
|
-
if (op.position === "before" || op.position === "after") {
|
|
26
|
-
parent = anchor.definition.parentId ? space.schema.flat[anchor.definition.parentId] ?? page : page;
|
|
27
|
-
const at = (parent.definition.items ?? []).indexOf(anchor.id);
|
|
28
|
-
index = at < 0 ? void 0 : op.position === "after" ? at + 1 : at;
|
|
29
|
-
}
|
|
30
|
-
el.definition.parentId = parent.id;
|
|
31
|
-
placeChild(parent, el.id, index);
|
|
32
|
-
indexInvalidateDetails(space.schema);
|
|
33
|
-
return {
|
|
34
|
-
...empty(),
|
|
35
|
-
updated: 1,
|
|
36
|
-
staleResources: [pageUri(env, op.pageRef)],
|
|
37
|
-
elementRefs: [op.ref]
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
//#endregion
|
|
41
|
-
export { moveElement, moveElementOp };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { findPageByRef, resolveRef } from "../../../../helpers/space.js";
|
|
2
|
-
import { pageUri } from "../../../../helpers/uris.js";
|
|
3
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
4
|
-
import { initialStateInput, styleRefs } from "../shared.js";
|
|
5
|
-
import { guardNewRef, writeInitialState } from "../write.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
import { repointIdRefs } from "@plitzi/sdk-schema/helpers/idRef";
|
|
8
|
-
//#region src/modules/mcp/tools/operations/schema/elements/patchElement.ts
|
|
9
|
-
var patchElementOp = z.object({
|
|
10
|
-
type: z.literal("patchElement"),
|
|
11
|
-
pageRef: z.string().describe("Page ref or id"),
|
|
12
|
-
ref: z.string().describe("Existing element ref or id"),
|
|
13
|
-
idRef: z.string().optional().describe("Assign or rename this element idRef ([A-Za-z0-9_-], starting with a letter, unique in the space). Without one an element publishes no data source, so it is not bindable. A rename moves the source name with it: every binding and interaction that targeted the old one is repointed for you."),
|
|
14
|
-
label: z.string().optional(),
|
|
15
|
-
subType: z.string().optional(),
|
|
16
|
-
props: z.record(z.string(), z.unknown()).optional().describe("Merged onto existing props: listed keys change, null unsets a key, others are preserved"),
|
|
17
|
-
style: styleRefs.optional().describe("Merged onto existing style: base replaces base, listed slots replace slots"),
|
|
18
|
-
initialState: initialStateInput.optional().describe("Merged onto existing initialState: styleVariant overlays per class/selector, visibility overrides")
|
|
19
|
-
}).describe("Partially update an EXISTING element: only the fields you pass change (props/style/initialState are merged, not replaced). Never creates — fails if ref does not resolve. Use upsertElement to create or fully replace.");
|
|
20
|
-
var patchElement = (space, env, op) => {
|
|
21
|
-
const page = findPageByRef(space.schema, op.pageRef);
|
|
22
|
-
if (!page) return fail("pageRef", `Page "${op.pageRef}" not found`, "Read plitzi://schema/" + env + "/pages for valid refs");
|
|
23
|
-
const el = resolveRef(space.schema, page, op.ref);
|
|
24
|
-
if (!el || el.id === page.id) return fail("ref", `Element "${op.ref}" not found in page "${op.pageRef}"`, "patchElement only updates an existing element; use upsertElement to create one");
|
|
25
|
-
if (op.idRef !== void 0 && op.idRef !== el.idRef) {
|
|
26
|
-
const guard = guardNewRef(space, op.idRef, "idRef");
|
|
27
|
-
if (guard) return guard;
|
|
28
|
-
const previous = el.idRef;
|
|
29
|
-
el.idRef = op.idRef;
|
|
30
|
-
if (previous) repointIdRefs(space.schema.flat, { [previous]: op.idRef });
|
|
31
|
-
}
|
|
32
|
-
if (op.label !== void 0) el.definition.label = op.label;
|
|
33
|
-
if (op.subType !== void 0) el.attributes = {
|
|
34
|
-
...el.attributes,
|
|
35
|
-
subType: op.subType
|
|
36
|
-
};
|
|
37
|
-
if (op.props !== void 0) {
|
|
38
|
-
const merged = { ...el.attributes };
|
|
39
|
-
for (const [key, value] of Object.entries(op.props)) if (value === null) Reflect.deleteProperty(merged, key);
|
|
40
|
-
else merged[key] = value;
|
|
41
|
-
el.attributes = merged;
|
|
42
|
-
}
|
|
43
|
-
if (op.style !== void 0) {
|
|
44
|
-
const selectors = { ...el.definition.styleSelectors };
|
|
45
|
-
if (op.style.base !== void 0) selectors.base = op.style.base.join(" ");
|
|
46
|
-
for (const [slot, classes] of Object.entries(op.style.slots ?? {})) selectors[slot] = classes.join(" ");
|
|
47
|
-
el.definition.styleSelectors = selectors;
|
|
48
|
-
}
|
|
49
|
-
if (op.initialState !== void 0) writeInitialState(el, op.initialState, true);
|
|
50
|
-
return {
|
|
51
|
-
...empty(),
|
|
52
|
-
updated: 1,
|
|
53
|
-
staleResources: [pageUri(env, op.pageRef)],
|
|
54
|
-
elementRefs: [op.ref]
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
//#endregion
|
|
58
|
-
export { patchElement, patchElementOp };
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { elementInput, elementShape, position, styleRefs } from "../shared.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
//#region src/modules/mcp/tools/operations/schema/elements/repeatElement.ts
|
|
4
|
-
var item = z.record(z.string(), z.unknown());
|
|
5
|
-
var MAX_ITEMS = 100;
|
|
6
|
-
var MAX_ROWS = 500;
|
|
7
|
-
var templateElement = z.lazy(() => z.object({
|
|
8
|
-
...elementShape,
|
|
9
|
-
children: z.array(templateElement).optional(),
|
|
10
|
-
repeat: z.object({
|
|
11
|
-
items: z.string().describe("The row field holding the sub-list, as \"{{item.<field>}}\" (or just the field path)"),
|
|
12
|
-
template: elementInput.describe("Rendered once per entry of that sub-list (a plain element tree)")
|
|
13
|
-
}).optional().describe("Makes THIS element the wrapper of a nested list — a list inside each row")
|
|
14
|
-
}));
|
|
15
|
-
var repeatElementOp = z.object({
|
|
16
|
-
type: z.literal("repeatElement"),
|
|
17
|
-
pageRef: z.string().describe("Page ref or id"),
|
|
18
|
-
ref: z.string().describe("Ref of the WRAPPER element this creates; the rows become its children"),
|
|
19
|
-
elementType: z.string().optional().describe("Type of the wrapper; defaults to container"),
|
|
20
|
-
label: z.string().optional(),
|
|
21
|
-
style: styleRefs.optional().describe("Classes for the wrapper — this is where the row/grid layout goes"),
|
|
22
|
-
parentRef: z.string().optional().describe("Anchor ref/id; defaults to page root"),
|
|
23
|
-
position: position.optional(),
|
|
24
|
-
template: templateElement.describe("The subtree ONE row renders, with {{item.field}} placeholders"),
|
|
25
|
-
items: z.array(item).min(1).max(MAX_ITEMS).describe("One object per row; its fields fill the {{item.field}} placeholders of the template")
|
|
26
|
-
}).describe("Build a LIST from one template plus its `items` data, instead of repeating near-identical elements. Creates a wrapper whose children are the template rendered once per row. `{{item.<field>}}` is replaced by that row field — alone as the whole value it keeps the field type, mixed with text it interpolates. Every ref gets the row number appended (\"day\" → \"day-1\"), which is how you address a row later. A template node may carry `repeat: { items: \"{{item.<list>}}\", template: … }` to nest a list inside each row: it becomes the sub-list wrapper, refs number both levels (\"step-2-3\"), and `{{item.…}}` there reads the SUB-row. Other {{…}} names are untouched, so schema variables still work.");
|
|
27
|
-
var PLACEHOLDER = /\{\{\s*item\.([A-Za-z0-9_.-]+)\s*\}\}/g;
|
|
28
|
-
var WHOLE_PLACEHOLDER = /^\{\{\s*item\.([A-Za-z0-9_.-]+)\s*\}\}$/;
|
|
29
|
-
var lookup = (row, path) => path.split(".").reduce((value, key) => {
|
|
30
|
-
if (value === null || typeof value !== "object") return;
|
|
31
|
-
return value[key];
|
|
32
|
-
}, row);
|
|
33
|
-
/** One string of the template, with its placeholders resolved. A placeholder that IS the whole string yields the
|
|
34
|
-
* field's own value (a number stays a number, an array stays an array); mixed text interpolates. */
|
|
35
|
-
var fillString = (text, row) => {
|
|
36
|
-
const whole = WHOLE_PLACEHOLDER.exec(text);
|
|
37
|
-
if (whole) {
|
|
38
|
-
const value = lookup(row, whole[1]);
|
|
39
|
-
return value === void 0 ? {
|
|
40
|
-
value: text,
|
|
41
|
-
missing: whole[1]
|
|
42
|
-
} : { value };
|
|
43
|
-
}
|
|
44
|
-
let missing;
|
|
45
|
-
const value = text.replace(PLACEHOLDER, (match, path) => {
|
|
46
|
-
const found = lookup(row, path);
|
|
47
|
-
if (found === void 0) {
|
|
48
|
-
missing ??= path;
|
|
49
|
-
return match;
|
|
50
|
-
}
|
|
51
|
-
if (typeof found === "string") return found;
|
|
52
|
-
return typeof found === "number" || typeof found === "boolean" ? found.toString() : JSON.stringify(found);
|
|
53
|
-
});
|
|
54
|
-
return missing === void 0 ? { value } : {
|
|
55
|
-
value,
|
|
56
|
-
missing
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
var fillValue = (value, row, missing) => {
|
|
60
|
-
if (typeof value === "string") {
|
|
61
|
-
const filled = fillString(value, row);
|
|
62
|
-
if (filled.missing) missing.add(filled.missing);
|
|
63
|
-
return filled.value;
|
|
64
|
-
}
|
|
65
|
-
if (Array.isArray(value)) return value.map((entry) => fillValue(entry, row, missing));
|
|
66
|
-
if (value !== null && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, fillValue(entry, row, missing)]));
|
|
67
|
-
return value;
|
|
68
|
-
};
|
|
69
|
-
var listOf = (row, spec) => {
|
|
70
|
-
const whole = WHOLE_PLACEHOLDER.exec(spec);
|
|
71
|
-
const value = lookup(row, whole ? whole[1] : spec);
|
|
72
|
-
if (!Array.isArray(value)) return;
|
|
73
|
-
return value.map((entry) => entry !== null && typeof entry === "object" ? entry : { value: entry });
|
|
74
|
-
};
|
|
75
|
-
/** One template node against one row. `suffix` is the row numbering accumulated from the OUTSIDE in, so a nested
|
|
76
|
-
* row reads "step-2-3" (row 2, sub-row 3) rather than the other way round. */
|
|
77
|
-
var expandNode = (node, row, suffix, state) => {
|
|
78
|
-
const { children, repeat, ...own } = node;
|
|
79
|
-
const filled = fillValue(own, row, state.missing);
|
|
80
|
-
const element = {
|
|
81
|
-
...filled,
|
|
82
|
-
ref: `${filled.ref}${suffix}`
|
|
83
|
-
};
|
|
84
|
-
if (repeat) {
|
|
85
|
-
const rows = listOf(row, repeat.items);
|
|
86
|
-
if (!rows) {
|
|
87
|
-
state.notAList.add(repeat.items);
|
|
88
|
-
return element;
|
|
89
|
-
}
|
|
90
|
-
const capped = rows.slice(0, MAX_ITEMS);
|
|
91
|
-
state.rows += capped.length;
|
|
92
|
-
element.children = capped.map((subRow, index) => expandNode(repeat.template, subRow, `${suffix}-${index + 1}`, state));
|
|
93
|
-
return element;
|
|
94
|
-
}
|
|
95
|
-
if (children) element.children = children.map((child) => expandNode(child, row, suffix, state));
|
|
96
|
-
return element;
|
|
97
|
-
};
|
|
98
|
-
var rowError = (index, message, hint) => ({
|
|
99
|
-
path: `items[${index}]`,
|
|
100
|
-
message,
|
|
101
|
-
hint
|
|
102
|
-
});
|
|
103
|
-
var keysOf = (row) => Object.keys(row).join(", ") || "(nothing)";
|
|
104
|
-
/** Expand one repeat into the single upsertElement it stands for: the wrapper, with the template rendered once per
|
|
105
|
-
* row as its children. Returns the errors instead of throwing, so a bad row reads like every other op error. */
|
|
106
|
-
var expandRepeat = (op) => {
|
|
107
|
-
const errors = [];
|
|
108
|
-
const children = [];
|
|
109
|
-
let total = op.items.length;
|
|
110
|
-
for (const [index, row] of op.items.entries()) {
|
|
111
|
-
const state = {
|
|
112
|
-
missing: /* @__PURE__ */ new Set(),
|
|
113
|
-
notAList: /* @__PURE__ */ new Set(),
|
|
114
|
-
rows: 0
|
|
115
|
-
};
|
|
116
|
-
const expanded = expandNode(op.template, row, `-${index + 1}`, state);
|
|
117
|
-
total += state.rows;
|
|
118
|
-
if (state.missing.size > 0) {
|
|
119
|
-
const fields = [...state.missing];
|
|
120
|
-
errors.push(rowError(index, `Row ${index + 1} has no ${fields.map((field) => `"${field}"`).join(", ")}`, `The template reads it as {{item.${fields[0]}}}. This row carries: ${keysOf(row)}`));
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
if (state.notAList.size > 0) {
|
|
124
|
-
const [spec] = [...state.notAList];
|
|
125
|
-
errors.push(rowError(index, `Row ${index + 1} has no list at ${spec}`, `A nested repeat needs an ARRAY in that field. This row carries: ${keysOf(row)}`));
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
children.push(expanded);
|
|
129
|
-
}
|
|
130
|
-
if (errors.length > 0) return { errors };
|
|
131
|
-
if (total > MAX_ROWS) return { errors: [{
|
|
132
|
-
path: "items",
|
|
133
|
-
message: `This repeat expands to ${total} rows (max ${MAX_ROWS})`,
|
|
134
|
-
hint: "Shorten the lists, or split the widget into several repeats."
|
|
135
|
-
}] };
|
|
136
|
-
return {
|
|
137
|
-
element: {
|
|
138
|
-
ref: op.ref,
|
|
139
|
-
type: op.elementType ?? "container",
|
|
140
|
-
...op.label === void 0 ? {} : { label: op.label },
|
|
141
|
-
...op.style === void 0 ? {} : { style: op.style },
|
|
142
|
-
children
|
|
143
|
-
},
|
|
144
|
-
errors
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
//#endregion
|
|
148
|
-
export { expandRepeat, repeatElementOp };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { findPageByRef, resolveRef } from "../../../../helpers/space.js";
|
|
2
|
-
import { pageUri } from "../../../../helpers/uris.js";
|
|
3
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
4
|
-
import { elementInput, position } from "../shared.js";
|
|
5
|
-
import { collectInputRefs, createElement, guardNewRef, writeInitialState } from "../write.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/modules/mcp/tools/operations/schema/elements/upsertElement.ts
|
|
8
|
-
var upsertElementOp = z.object({
|
|
9
|
-
type: z.literal("upsertElement"),
|
|
10
|
-
pageRef: z.string().describe("Page ref or id"),
|
|
11
|
-
element: elementInput,
|
|
12
|
-
parentRef: z.string().optional().describe("Anchor ref/id; defaults to page root"),
|
|
13
|
-
position: position.optional()
|
|
14
|
-
}).describe("Add an element to a page, or fully update it when element.ref already exists (props and style are REPLACED, not merged). To change only some fields of an existing element, use patchElement instead.");
|
|
15
|
-
var upsertElement = (space, env, op) => {
|
|
16
|
-
const page = findPageByRef(space.schema, op.pageRef);
|
|
17
|
-
if (!page) return fail("pageRef", `Page "${op.pageRef}" not found`, "Read plitzi://schema/" + env + "/pages for valid refs");
|
|
18
|
-
const existing = resolveRef(space.schema, page, op.element.ref);
|
|
19
|
-
if (existing && existing.id !== page.id) {
|
|
20
|
-
if (op.element.label !== void 0) existing.definition.label = op.element.label;
|
|
21
|
-
if (op.element.props !== void 0 || op.element.subType !== void 0) {
|
|
22
|
-
const subType = op.element.subType ?? existing.attributes.subType;
|
|
23
|
-
existing.attributes = subType === void 0 ? { ...op.element.props } : {
|
|
24
|
-
subType,
|
|
25
|
-
...op.element.props
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
if (op.element.style !== void 0) {
|
|
29
|
-
const selectors = { base: (op.element.style.base ?? []).join(" ") };
|
|
30
|
-
for (const [slot, classes] of Object.entries(op.element.style.slots ?? {})) selectors[slot] = classes.join(" ");
|
|
31
|
-
existing.definition.styleSelectors = selectors;
|
|
32
|
-
}
|
|
33
|
-
if (op.element.initialState !== void 0) writeInitialState(existing, op.element.initialState, false);
|
|
34
|
-
return {
|
|
35
|
-
...empty(),
|
|
36
|
-
updated: 1,
|
|
37
|
-
staleResources: [pageUri(env, op.pageRef)],
|
|
38
|
-
elementRefs: [op.element.ref]
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
for (const ref of collectInputRefs(op.element)) {
|
|
42
|
-
const guard = guardNewRef(space, ref, "element.ref");
|
|
43
|
-
if (guard) return guard;
|
|
44
|
-
}
|
|
45
|
-
let parent = page;
|
|
46
|
-
let index;
|
|
47
|
-
if (op.parentRef) {
|
|
48
|
-
const anchor = resolveRef(space.schema, page, op.parentRef);
|
|
49
|
-
if (!anchor) return fail("parentRef", `Parent "${op.parentRef}" not found in page "${op.pageRef}"`, "Use an existing ref");
|
|
50
|
-
if (op.position === "before" || op.position === "after") {
|
|
51
|
-
parent = anchor.definition.parentId ? space.schema.flat[anchor.definition.parentId] : page;
|
|
52
|
-
const at = (parent.definition.items ?? []).indexOf(anchor.id);
|
|
53
|
-
index = at < 0 ? void 0 : op.position === "after" ? at + 1 : at;
|
|
54
|
-
} else parent = anchor;
|
|
55
|
-
}
|
|
56
|
-
createElement(space, page, op.element, parent, index);
|
|
57
|
-
return {
|
|
58
|
-
...empty(),
|
|
59
|
-
created: 1,
|
|
60
|
-
staleResources: [pageUri(env, op.pageRef)],
|
|
61
|
-
elementRefs: [op.element.ref]
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
//#endregion
|
|
65
|
-
export { upsertElement, upsertElementOp };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { findFolderByRef, isPageElement, pageFoldersOf, sortFolders } from "../../../../helpers/space.js";
|
|
2
|
-
import { folderUri, foldersUri, pagesUri } from "../../../../helpers/uris.js";
|
|
3
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/schema/folders/deleteFolder.ts
|
|
6
|
-
var deleteFolderOp = z.object({
|
|
7
|
-
type: z.literal("deleteFolder"),
|
|
8
|
-
ref: z.string()
|
|
9
|
-
}).describe("Delete a folder; its child folders and pages move up to its parent (or the root)");
|
|
10
|
-
var deleteFolder = (space, env, op) => {
|
|
11
|
-
const folders = pageFoldersOf(space.schema);
|
|
12
|
-
const folder = findFolderByRef(space.schema, op.ref);
|
|
13
|
-
if (!folder) return fail("ref", `Folder "${op.ref}" not found`, "Read plitzi://folders for valid refs");
|
|
14
|
-
const newParent = folder.parentId;
|
|
15
|
-
for (const child of folders) if (child.parentId === folder.id) if (newParent === void 0) Reflect.deleteProperty(child, "parentId");
|
|
16
|
-
else child.parentId = newParent;
|
|
17
|
-
for (const el of Object.values(space.schema.flat)) if (isPageElement(space.schema, el) && el.attributes.folder === folder.id) el.attributes.folder = newParent ?? "";
|
|
18
|
-
space.schema.pageFolders = sortFolders(folders.filter((f) => f.id !== folder.id));
|
|
19
|
-
return {
|
|
20
|
-
...empty(),
|
|
21
|
-
deleted: 1,
|
|
22
|
-
staleResources: [
|
|
23
|
-
folderUri(env, folder.id),
|
|
24
|
-
foldersUri(env),
|
|
25
|
-
pagesUri(env)
|
|
26
|
-
]
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
export { deleteFolder, deleteFolderOp };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { findFolderByRef, pageFoldersOf, slugify, sortFolders } from "../../../../helpers/space.js";
|
|
2
|
-
import { folderUri, foldersUri } from "../../../../helpers/uris.js";
|
|
3
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/schema/folders/upsertFolder.ts
|
|
6
|
-
var upsertFolderOp = z.object({
|
|
7
|
-
type: z.literal("upsertFolder"),
|
|
8
|
-
ref: z.string().describe("Folder ref: an existing folder id/name/slug to update, or a new id you choose"),
|
|
9
|
-
name: z.string().optional(),
|
|
10
|
-
slug: z.string().optional(),
|
|
11
|
-
parentId: z.string().nullable().optional().describe("Ref of the parent folder for nesting; null keeps it at root")
|
|
12
|
-
}).describe("Create a sidebar page-folder, or update it when ref already exists. Nest it under another via parentId.");
|
|
13
|
-
var upsertFolder = (space, env, op) => {
|
|
14
|
-
const folders = pageFoldersOf(space.schema);
|
|
15
|
-
let parentId;
|
|
16
|
-
if (op.parentId !== void 0 && op.parentId !== null) {
|
|
17
|
-
const parent = findFolderByRef(space.schema, op.parentId);
|
|
18
|
-
if (!parent) return fail("parentId", `Parent folder "${op.parentId}" not found`, "Create it with upsertFolder first");
|
|
19
|
-
parentId = parent.id;
|
|
20
|
-
}
|
|
21
|
-
const existing = findFolderByRef(space.schema, op.ref);
|
|
22
|
-
if (existing) {
|
|
23
|
-
if (op.name !== void 0) existing.name = op.name;
|
|
24
|
-
if (op.slug !== void 0) existing.slug = op.slug;
|
|
25
|
-
if (op.parentId === null) Reflect.deleteProperty(existing, "parentId");
|
|
26
|
-
else if (op.parentId !== void 0) existing.parentId = parentId;
|
|
27
|
-
space.schema.pageFolders = sortFolders(folders);
|
|
28
|
-
return {
|
|
29
|
-
...empty(),
|
|
30
|
-
updated: 1,
|
|
31
|
-
staleResources: [folderUri(env, existing.id), foldersUri(env)]
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const folder = {
|
|
35
|
-
id: op.ref,
|
|
36
|
-
name: op.name ?? op.ref,
|
|
37
|
-
slug: op.slug ?? slugify(op.ref)
|
|
38
|
-
};
|
|
39
|
-
if (parentId !== void 0) folder.parentId = parentId;
|
|
40
|
-
folders.push(folder);
|
|
41
|
-
space.schema.pageFolders = sortFolders(folders);
|
|
42
|
-
return {
|
|
43
|
-
...empty(),
|
|
44
|
-
created: 1,
|
|
45
|
-
staleResources: [folderUri(env, folder.id), foldersUri(env)]
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
//#endregion
|
|
49
|
-
export { upsertFolder, upsertFolderOp };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { pageUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { resolveElement } from "../write.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/schema/interactions/deleteInteraction.ts
|
|
6
|
-
var deleteInteractionOp = z.object({
|
|
7
|
-
type: z.literal("deleteInteraction"),
|
|
8
|
-
pageRef: z.string().describe("Page ref or id"),
|
|
9
|
-
ref: z.string().describe("Element ref or id"),
|
|
10
|
-
flowId: z.string().optional().describe("Remove the whole flow with this id (the trigger node id)"),
|
|
11
|
-
nodeId: z.string().optional().describe("Remove a single step; its neighbors are re-linked. Deleting a trigger removes its flow")
|
|
12
|
-
}).describe("DESTRUCTIVE, not undoable — remove a flow (by flowId) or a single step (by nodeId); provide exactly one. To turn a step OFF instead, patchInteractionNode { enabled: false }. Confirm with the user first.");
|
|
13
|
-
var removeFlow = (interactions, flowId) => {
|
|
14
|
-
let deleted = 0;
|
|
15
|
-
for (const [nodeId, node] of Object.entries(interactions)) if ((node.flowId || node.id) === flowId) {
|
|
16
|
-
Reflect.deleteProperty(interactions, nodeId);
|
|
17
|
-
deleted++;
|
|
18
|
-
}
|
|
19
|
-
return deleted;
|
|
20
|
-
};
|
|
21
|
-
var deleteInteraction = (space, env, op) => {
|
|
22
|
-
if (Boolean(op.flowId) === Boolean(op.nodeId)) return fail("nodeId", "Provide exactly one of flowId or nodeId", "flowId removes a whole flow; nodeId removes a step");
|
|
23
|
-
const found = resolveElement(space, env, op.pageRef, op.ref);
|
|
24
|
-
if ("error" in found) return found.error;
|
|
25
|
-
const interactions = found.el.definition.interactions;
|
|
26
|
-
if (!interactions) return fail("ref", `Element "${op.ref}" has no interactions`, "Nothing to delete");
|
|
27
|
-
let deleted = 0;
|
|
28
|
-
if (op.flowId) deleted = removeFlow(interactions, op.flowId);
|
|
29
|
-
else if (op.nodeId) {
|
|
30
|
-
if (!(op.nodeId in interactions)) return fail("nodeId", `Interaction node "${op.nodeId}" not found on "${op.ref}"`, "Read the element to list nodes");
|
|
31
|
-
const node = interactions[op.nodeId];
|
|
32
|
-
if (node.type === "trigger") deleted = removeFlow(interactions, node.flowId || node.id);
|
|
33
|
-
else {
|
|
34
|
-
const before = node.beforeNode ? interactions[node.beforeNode] : void 0;
|
|
35
|
-
const after = node.afterNode ? interactions[node.afterNode] : void 0;
|
|
36
|
-
if (before) before.afterNode = node.afterNode;
|
|
37
|
-
if (after) after.beforeNode = node.beforeNode;
|
|
38
|
-
Reflect.deleteProperty(interactions, op.nodeId);
|
|
39
|
-
deleted = 1;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (deleted === 0) return fail("flowId", `No interaction matching "${op.flowId ?? op.nodeId}" on "${op.ref}"`, "Nothing to delete");
|
|
43
|
-
if (Object.keys(interactions).length === 0) Reflect.deleteProperty(found.el.definition, "interactions");
|
|
44
|
-
return {
|
|
45
|
-
...empty(),
|
|
46
|
-
deleted,
|
|
47
|
-
staleResources: [pageUri(env, op.pageRef)],
|
|
48
|
-
elementRefs: [op.ref]
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
//#endregion
|
|
52
|
-
export { deleteInteraction, deleteInteractionOp };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { pageUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { NULLISH_ELEMENT_IDS } from "../../../../helpers/interactions.js";
|
|
3
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
4
|
-
import { interactionNode } from "../shared.js";
|
|
5
|
-
import { resolveElement, resolveTargetRef } from "../write.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.ts
|
|
8
|
-
var { title, action, params, enabled, when, elementId, preview } = interactionNode.shape;
|
|
9
|
-
var patchInteractionNodeOp = z.object({
|
|
10
|
-
type: z.literal("patchInteractionNode"),
|
|
11
|
-
pageRef: z.string().describe("Page ref or id"),
|
|
12
|
-
ref: z.string().describe("Element ref or id"),
|
|
13
|
-
nodeId: z.string().describe("Id of the interaction node to update"),
|
|
14
|
-
title: title.optional(),
|
|
15
|
-
action: action.optional(),
|
|
16
|
-
params: params.describe("Merged onto the node params: listed keys change, others are preserved"),
|
|
17
|
-
enabled,
|
|
18
|
-
when,
|
|
19
|
-
elementId,
|
|
20
|
-
preview
|
|
21
|
-
}).describe("Partially update ONE step of a flow (found by nodeId): only the fields you pass change, the order/links are untouched. This is how you DISABLE a step without removing it — { enabled: false } keeps it in the flow. deleteInteraction is for actually removing one. Fails if the node does not exist.");
|
|
22
|
-
var patchInteractionNode = (space, env, op) => {
|
|
23
|
-
const found = resolveElement(space, env, op.pageRef, op.ref);
|
|
24
|
-
if ("error" in found) return found.error;
|
|
25
|
-
const node = found.el.definition.interactions?.[op.nodeId];
|
|
26
|
-
if (!node) return fail("nodeId", `Interaction node "${op.nodeId}" not found on "${op.ref}"`, "Read the element to list nodes");
|
|
27
|
-
if (op.title !== void 0) node.title = op.title;
|
|
28
|
-
if (op.action !== void 0) node.action = op.action;
|
|
29
|
-
if (op.params !== void 0) node.params = {
|
|
30
|
-
...node.params,
|
|
31
|
-
...op.params
|
|
32
|
-
};
|
|
33
|
-
if (op.enabled !== void 0) node.enabled = op.enabled;
|
|
34
|
-
if (op.when !== void 0) node.when = op.when;
|
|
35
|
-
if (op.elementId !== void 0) node.elementId = resolveTargetRef(space, op.elementId);
|
|
36
|
-
if (node.type === "utility") node.elementId = null;
|
|
37
|
-
else if (typeof node.elementId === "string" && NULLISH_ELEMENT_IDS.has(node.elementId)) node.elementId = null;
|
|
38
|
-
if (op.preview !== void 0) node.preview = op.preview;
|
|
39
|
-
return {
|
|
40
|
-
...empty(),
|
|
41
|
-
updated: 1,
|
|
42
|
-
staleResources: [pageUri(env, op.pageRef)],
|
|
43
|
-
elementRefs: [op.ref]
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
//#endregion
|
|
47
|
-
export { patchInteractionNode, patchInteractionNodeOp };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { pageUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { materializeFlow } from "../../../../helpers/interactions.js";
|
|
3
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
4
|
-
import { interactionNode } from "../shared.js";
|
|
5
|
-
import { ensureIdRef, resolveElement, resolveTargetRef } from "../write.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.ts
|
|
8
|
-
var upsertInteractionFlowOp = z.object({
|
|
9
|
-
type: z.literal("upsertInteractionFlow"),
|
|
10
|
-
pageRef: z.string().describe("Page ref or id"),
|
|
11
|
-
ref: z.string().describe("Element ref or id"),
|
|
12
|
-
flowId: z.string().optional().describe("Existing flow to replace (the trigger node id). Omit to create a new flow"),
|
|
13
|
-
nodes: z.array(interactionNode).min(1).describe("Ordered steps of the flow: the FIRST must be a trigger, the rest run after it in order")
|
|
14
|
-
}).describe("Create or replace one interaction flow on an element from an ordered list of steps — pass them in execution order, the beforeNode/afterNode/flowId links are computed for you. For a globalCallback OMIT elementId: it is registered on a source module, not the host element, and the source and default params are filled in for you. To edit a single step in place use patchInteractionNode.");
|
|
15
|
-
var upsertInteractionFlow = (space, env, op) => {
|
|
16
|
-
const found = resolveElement(space, env, op.pageRef, op.ref);
|
|
17
|
-
if ("error" in found) return found.error;
|
|
18
|
-
const ownerRef = ensureIdRef(space, found.el);
|
|
19
|
-
const nodes = (op.flowId && !op.nodes[0].id ? [{
|
|
20
|
-
...op.nodes[0],
|
|
21
|
-
id: op.flowId
|
|
22
|
-
}, ...op.nodes.slice(1)] : op.nodes).map((node) => node.elementId === void 0 || node.nodeType === "utility" ? node : {
|
|
23
|
-
...node,
|
|
24
|
-
elementId: resolveTargetRef(space, node.elementId)
|
|
25
|
-
});
|
|
26
|
-
const { flowId, record } = materializeFlow(nodes, ownerRef);
|
|
27
|
-
const interactions = found.el.definition.interactions ?? {};
|
|
28
|
-
const targetFlow = op.flowId ?? flowId;
|
|
29
|
-
let replaced = false;
|
|
30
|
-
for (const [nodeId, node] of Object.entries(interactions)) if ((node.flowId || node.id) === targetFlow) {
|
|
31
|
-
Reflect.deleteProperty(interactions, nodeId);
|
|
32
|
-
replaced = true;
|
|
33
|
-
}
|
|
34
|
-
Object.assign(interactions, record);
|
|
35
|
-
found.el.definition.interactions = interactions;
|
|
36
|
-
return {
|
|
37
|
-
...empty(),
|
|
38
|
-
...replaced ? { updated: 1 } : { created: 1 },
|
|
39
|
-
staleResources: [pageUri(env, op.pageRef)],
|
|
40
|
-
elementRefs: [op.ref]
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
//#endregion
|
|
44
|
-
export { upsertInteractionFlow, upsertInteractionFlowOp };
|