@plitzi/sdk-server 0.37.1 → 0.37.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1296 -0
- package/README.md +126 -7
- package/dist/actions.d.ts +20 -8
- package/dist/actions.js +11 -4
- package/dist/adapters/cloudAdapters.js +4 -3
- package/dist/adapters/jsonAdapters.js +28 -6
- package/dist/auth.d.ts +7 -4
- package/dist/auth.js +8 -6
- package/dist/core/auth/api.d.ts +29 -1
- package/dist/core/auth/api.js +47 -13
- package/dist/core/auth/createAuth.d.ts +4 -0
- package/dist/core/auth/createAuth.js +3 -3
- package/dist/core/auth/credentials.d.ts +3 -0
- package/dist/core/auth/credentials.js +1 -1
- package/dist/core/auth/csrf.d.ts +25 -1
- package/dist/core/auth/csrf.js +29 -4
- package/dist/core/auth/renewal.d.ts +26 -0
- package/dist/core/auth/renewal.js +24 -0
- package/dist/core/auth/routes.js +8 -6
- package/dist/core/auth/session.d.ts +45 -0
- package/dist/core/auth/session.js +47 -1
- package/dist/core/auth/sessionActivity.d.ts +11 -0
- package/dist/core/auth/sessionActivity.js +14 -0
- package/dist/core/auth/throttle.d.ts +15 -0
- package/dist/core/auth/throttle.js +29 -1
- package/dist/core/auth/totp.d.ts +9 -1
- package/dist/core/auth/totp.js +11 -6
- package/dist/core/createServer.actions.test.d.ts +1 -0
- package/dist/core/createServer.d.ts +14 -1
- package/dist/core/createServer.functions.test.d.ts +1 -0
- package/dist/core/createServer.js +22 -12
- package/dist/core/fontStore.js +1 -1
- package/dist/core/handlers/authRouteHandlers.d.ts +1 -1
- package/dist/core/handlers/authRouteHandlers.js +57 -21
- package/dist/core/handlers/csrfMiddleware.d.ts +23 -0
- package/dist/core/handlers/csrfMiddleware.js +31 -7
- package/dist/core/handlers/csrfMiddleware.test.d.ts +1 -0
- package/dist/core/handlers/oauthRouteHandlers.js +5 -3
- package/dist/core/handlers/socialRouteHandlers.d.ts +1 -1
- package/dist/core/handlers/socialRouteHandlers.js +2 -1
- package/dist/core/http/dispatcher.d.ts +9 -1
- package/dist/core/http/dispatcher.js +38 -11
- package/dist/core/http/navigation.d.ts +5 -2
- package/dist/core/http/navigation.js +7 -4
- package/dist/core/http/socketResponse.d.ts +18 -0
- package/dist/core/http/socketResponse.js +59 -0
- package/dist/core/http/sse.d.ts +26 -0
- package/dist/core/http/sse.js +78 -0
- package/dist/core/http/stages/authRoutes.js +3 -1
- package/dist/core/http/stages/exchangeRoute.test.d.ts +1 -0
- package/dist/core/http/stages/middlewares.d.ts +1 -1
- package/dist/core/http/stages/middlewares.js +16 -10
- package/dist/core/http/stages/middlewares.test.d.ts +1 -0
- package/dist/core/http/stages/oauth.js +2 -2
- package/dist/core/http/stages/sessionRenewal.d.ts +16 -0
- package/dist/core/http/stages/sessionRenewal.js +81 -0
- package/dist/core/http/stages/sessionRenewal.test.d.ts +1 -0
- package/dist/core/http/stages/signInRoute.d.ts +2 -0
- package/dist/core/http/stages/signInRoute.js +139 -0
- package/dist/core/http/stages/signInRoute.test.d.ts +1 -0
- package/dist/core/http/types.d.ts +9 -0
- package/dist/core/http/webExchange.d.ts +18 -0
- package/dist/core/http/webExchange.js +53 -0
- package/dist/core/oauth/authorize.js +37 -13
- package/dist/core/oauth/consentPage.js +11 -0
- package/dist/core/oauth/issueContext.d.ts +14 -0
- package/dist/core/oauth/issueContext.js +32 -0
- package/dist/core/oauth/records.d.ts +7 -0
- package/dist/core/oauth/register.d.ts +2 -0
- package/dist/core/oauth/register.js +32 -11
- package/dist/core/oauth/register.test.d.ts +1 -0
- package/dist/core/oauth/token.js +21 -6
- package/dist/core/oauth/token.test.d.ts +1 -0
- package/dist/core/requestParser.d.ts +4 -0
- package/dist/core/requestParser.js +14 -7
- package/dist/core/sdkAssets.js +1 -1
- package/dist/core/server/baseServer.d.ts +14 -1
- package/dist/core/server/baseServer.js +43 -11
- package/dist/core/server/closeOnSignals.d.ts +28 -0
- package/dist/core/server/closeOnSignals.js +47 -0
- package/dist/core/server/closeOnSignals.test.d.ts +1 -0
- package/dist/core/server/drain.d.ts +18 -0
- package/dist/core/server/drain.js +62 -0
- package/dist/core/server/drain.test.d.ts +1 -0
- package/dist/core/server/fleet/channel.d.ts +103 -0
- package/dist/core/server/fleet/channel.js +191 -0
- package/dist/core/server/fleet/channel.test.d.ts +1 -0
- package/dist/core/server/fleet/fixtures/fleetServer.d.ts +1 -0
- package/dist/core/server/fleet/fleet.integration.test.d.ts +1 -0
- package/dist/core/server/fleet/link.d.ts +23 -0
- package/dist/core/server/fleet/link.js +70 -0
- package/dist/core/server/fleet/relay.d.ts +11 -0
- package/dist/core/server/fleet/relay.js +104 -0
- package/dist/core/server/fleet/relay.test.d.ts +1 -0
- package/dist/core/server/fleet/role.d.ts +46 -0
- package/dist/core/server/fleet/role.js +59 -0
- package/dist/core/server/fleet/role.test.d.ts +1 -0
- package/dist/core/server/fleet/stores.d.ts +7 -0
- package/dist/core/server/fleet/stores.js +19 -0
- package/dist/core/server/fleet/supervisor.d.ts +26 -0
- package/dist/core/server/fleet/supervisor.js +108 -0
- package/dist/core/server/fleet/supervisor.test.d.ts +1 -0
- package/dist/core/server/pageServer.js +36 -5
- package/dist/core/services/action.js +10 -2
- package/dist/core/services/functionRoutes.d.ts +9 -0
- package/dist/core/services/functionRoutes.js +47 -0
- package/dist/core/services/realtime.d.ts +8 -0
- package/dist/core/services/realtime.js +57 -0
- package/dist/core/services/registry.js +6 -2
- package/dist/core/staticFiles.js +12 -4
- package/dist/core/staticFiles.test.d.ts +1 -0
- package/dist/core/transports.d.ts +13 -3
- package/dist/core/transports.js +14 -5
- package/dist/functions-api.d.ts +281 -0
- package/dist/functions.d.ts +19 -0
- package/dist/functions.js +5 -0
- package/dist/functionsRunner.d.ts +15 -0
- package/dist/functionsRunner.js +6 -0
- package/dist/handlers.d.ts +2 -2
- package/dist/handlers.js +2 -2
- package/dist/helpers/atomicFile.d.ts +10 -0
- package/dist/helpers/atomicFile.js +33 -0
- package/dist/helpers/atomicFile.test.d.ts +1 -0
- package/dist/helpers/buildResponseHelpers.js +35 -11
- package/dist/helpers/buildServerInfo.js +4 -2
- package/dist/helpers/buildServerInfo.test.d.ts +1 -0
- package/dist/helpers/cache/CompressedFileCache.d.ts +18 -0
- package/dist/helpers/cache/CompressedFileCache.js +44 -0
- package/dist/helpers/cache/CompressedFileCache.test.d.ts +1 -0
- package/dist/helpers/cache/cacheManager.d.ts +1 -1
- package/dist/helpers/cache/cacheManager.js +2 -1
- package/dist/helpers/cache/cacheManager.test.d.ts +1 -0
- package/dist/helpers/cache/index.d.ts +1 -1
- package/dist/helpers/cache/keys.d.ts +15 -1
- package/dist/helpers/cache/keys.js +47 -5
- package/dist/helpers/cache/serverCaches.d.ts +7 -1
- package/dist/helpers/compress.d.ts +3 -1
- package/dist/helpers/compress.js +11 -3
- package/dist/helpers/hydrationPayload.d.ts +11 -0
- package/dist/helpers/hydrationPayload.js +51 -0
- package/dist/helpers/hydrationPayload.test.d.ts +1 -0
- package/dist/helpers/metrics.d.ts +1 -1
- package/dist/helpers/metrics.js +3 -2
- package/dist/helpers/outboundGuard.d.ts +14 -6
- package/dist/helpers/outboundGuard.js +132 -8
- package/dist/helpers/paintedCookie.d.ts +8 -0
- package/dist/helpers/paintedCookie.js +13 -0
- package/dist/helpers/reportReactBuild.d.ts +9 -0
- package/dist/helpers/reportReactBuild.js +18 -0
- package/dist/helpers/reportReactBuild.test.d.ts +1 -0
- package/dist/helpers/serverLog.d.ts +25 -1
- package/dist/helpers/serverLog.js +68 -3
- package/dist/helpers/serverLog.test.d.ts +1 -0
- package/dist/helpers/wsFrame.d.ts +3 -0
- package/dist/helpers/wsFrame.js +5 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +6 -2
- package/dist/kernel.d.ts +2 -1
- package/dist/kernel.js +3 -2
- package/dist/modules/actions/connectorWrite.js +2 -1
- package/dist/modules/actions/index.d.ts +41 -13
- package/dist/modules/actions/index.js +52 -9
- package/dist/modules/actions/jobs/failureStreak.d.ts +17 -0
- package/dist/modules/actions/jobs/failureStreak.js +47 -0
- package/dist/modules/actions/jobs/failureStreak.test.d.ts +1 -0
- package/dist/modules/actions/jobs/index.d.ts +33 -0
- package/dist/modules/actions/jobs/index.js +59 -0
- package/dist/modules/actions/jobs/memoryQueue.d.ts +33 -0
- package/dist/modules/actions/jobs/memoryQueue.js +194 -0
- package/dist/modules/actions/jobs/memoryStores.test.d.ts +1 -0
- package/dist/modules/actions/jobs/scheduler.d.ts +64 -0
- package/dist/modules/actions/jobs/scheduler.js +130 -0
- package/dist/modules/actions/jobs/scheduler.test.d.ts +1 -0
- package/dist/modules/actions/jobs/schedules.d.ts +23 -0
- package/dist/modules/actions/jobs/schedules.js +47 -0
- package/dist/modules/actions/jobs/storeClock.d.ts +16 -0
- package/dist/modules/actions/jobs/storeClock.js +32 -0
- package/dist/modules/actions/jobs/testing/jobQueueContract.d.ts +25 -0
- package/dist/modules/actions/jobs/worker.d.ts +64 -0
- package/dist/modules/actions/jobs/worker.js +267 -0
- package/dist/modules/actions/jobs/worker.test.d.ts +1 -0
- package/dist/modules/actions/moduleFor.js +6 -2
- package/dist/modules/actions/runtime/errors.d.ts +12 -0
- package/dist/modules/actions/runtime/errors.js +16 -1
- package/dist/modules/actions/runtime/kvChange.d.ts +27 -0
- package/dist/modules/actions/runtime/kvChange.js +23 -0
- package/dist/modules/actions/runtime/kvList.d.ts +51 -0
- package/dist/modules/actions/runtime/kvList.js +52 -0
- package/dist/modules/actions/runtime/kvStore.d.ts +8 -0
- package/dist/modules/actions/runtime/kvStore.js +46 -20
- package/dist/modules/actions/runtime/memoryKv.d.ts +3 -0
- package/dist/modules/actions/runtime/memoryKv.js +19 -1
- package/dist/modules/actions/runtime/namespaceKv.d.ts +4 -6
- package/dist/modules/actions/runtime/namespaceKv.js +15 -3
- package/dist/modules/actions/runtime/namespaceKv.test.d.ts +1 -0
- package/dist/modules/actions/runtime/precheck.js +5 -9
- package/dist/modules/actions/runtime/rateLimit.d.ts +19 -0
- package/dist/modules/actions/runtime/rateLimit.js +19 -0
- package/dist/modules/actions/runtime/redisKv.d.ts +27 -0
- package/dist/modules/actions/runtime/redisKv.integration.test.d.ts +1 -0
- package/dist/modules/actions/runtime/redisKv.js +46 -0
- package/dist/modules/actions/runtime/renderResolver.js +2 -2
- package/dist/modules/actions/runtime/report.js +2 -1
- package/dist/modules/actions/runtime/runAction.d.ts +10 -2
- package/dist/modules/actions/runtime/runAction.js +52 -116
- package/dist/modules/actions/runtime/runLogger.d.ts +5 -0
- package/dist/modules/actions/runtime/runLogger.js +8 -2
- package/dist/modules/actions/runtime/signing.d.ts +20 -0
- package/dist/modules/actions/runtime/signing.js +25 -0
- package/dist/modules/actions/runtime/signing.test.d.ts +1 -0
- package/dist/modules/actions/runtime/taskContext.d.ts +33 -0
- package/dist/modules/actions/runtime/taskContext.js +124 -0
- package/dist/modules/actions/tasks/builtins.js +5 -1
- package/dist/modules/actions/tasks/flow.js +81 -10
- package/dist/modules/actions/tasks/helpers.js +2 -2
- package/dist/modules/actions/tasks/http.js +2 -3
- package/dist/modules/actions/tasks/kv.js +39 -0
- package/dist/modules/actions/tasks/list.d.ts +2 -0
- package/dist/modules/actions/tasks/list.js +145 -0
- package/dist/modules/actions/tasks/realtime.d.ts +2 -0
- package/dist/modules/actions/tasks/realtime.js +104 -0
- package/dist/modules/actions/tasks/registry.d.ts +10 -1
- package/dist/modules/actions/tasks/registry.js +17 -6
- package/dist/modules/actions/transport/callHandler.js +6 -3
- package/dist/modules/actions/transport/catalogHandler.d.ts +5 -2
- package/dist/modules/actions/transport/catalogHandler.js +3 -2
- package/dist/modules/actions/transport/stream.d.ts +4 -5
- package/dist/modules/actions/transport/stream.js +12 -76
- package/dist/modules/actions/transport/webhookHandler.js +5 -4
- package/dist/modules/actions/types.d.ts +162 -4
- package/dist/modules/connectors/engine.js +3 -5
- package/dist/modules/functions/build.d.ts +22 -0
- package/dist/modules/functions/build.js +122 -0
- package/dist/modules/functions/build.test.d.ts +1 -0
- package/dist/modules/functions/capabilities.d.ts +22 -0
- package/dist/modules/functions/capabilities.js +228 -0
- package/dist/modules/functions/config.d.ts +34 -0
- package/dist/modules/functions/config.js +24 -0
- package/dist/modules/functions/context.d.ts +17 -0
- package/dist/modules/functions/context.js +88 -0
- package/dist/modules/functions/contract.d.ts +121 -0
- package/dist/modules/functions/contract.js +9 -0
- package/dist/modules/functions/driver.d.ts +36 -0
- package/dist/modules/functions/driver.js +150 -0
- package/dist/modules/functions/load.d.ts +15 -0
- package/dist/modules/functions/load.js +45 -0
- package/dist/modules/functions/load.test.d.ts +1 -0
- package/dist/modules/functions/local.d.ts +29 -0
- package/dist/modules/functions/local.js +61 -0
- package/dist/modules/functions/local.test.d.ts +1 -0
- package/dist/modules/functions/manifest.d.ts +24 -0
- package/dist/modules/functions/manifest.js +163 -0
- package/dist/modules/functions/manifest.test.d.ts +1 -0
- package/dist/modules/functions/native.d.ts +8 -0
- package/dist/modules/functions/native.js +21 -0
- package/dist/modules/functions/native.test.d.ts +1 -0
- package/dist/modules/functions/protocol.d.ts +216 -0
- package/dist/modules/functions/protocol.js +18 -0
- package/dist/modules/functions/routes.d.ts +36 -0
- package/dist/modules/functions/routes.js +181 -0
- package/dist/modules/functions/routes.test.d.ts +1 -0
- package/dist/modules/functions/runner/messages.d.ts +5 -0
- package/dist/modules/functions/runner/messages.js +188 -0
- package/dist/modules/functions/runner/remote.d.ts +19 -0
- package/dist/modules/functions/runner/remote.js +116 -0
- package/dist/modules/functions/runner/remote.test.d.ts +1 -0
- package/dist/modules/functions/runner/service.d.ts +32 -0
- package/dist/modules/functions/runner/service.js +209 -0
- package/dist/modules/functions/sandbox/guest.d.ts +45 -0
- package/dist/modules/functions/sandbox/guest.js +660 -0
- package/dist/modules/functions/sandbox/isolate.d.ts +37 -0
- package/dist/modules/functions/sandbox/isolate.js +347 -0
- package/dist/modules/functions/sandbox/isolate.test.d.ts +1 -0
- package/dist/modules/functions/sandbox/prelude.d.ts +2 -0
- package/dist/modules/functions/sandbox/prelude.js +49 -0
- package/dist/modules/functions/space.d.ts +40 -0
- package/dist/modules/functions/space.js +162 -0
- package/dist/modules/functions/testing/tasksOf.d.ts +4 -0
- package/dist/modules/functions/tryEntry.d.ts +9 -0
- package/dist/modules/functions/tryEntry.js +49 -0
- package/dist/modules/mongo/index.d.ts +4 -0
- package/dist/modules/mongo/jobQueue.d.ts +38 -0
- package/dist/modules/mongo/jobQueue.js +335 -0
- package/dist/modules/mongo/kv.d.ts +15 -0
- package/dist/modules/mongo/kv.js +129 -0
- package/dist/modules/mongo/stores.integration.test.d.ts +1 -0
- package/dist/modules/mysql/accounts.js +19 -9
- package/dist/modules/mysql/index.d.ts +2 -1
- package/dist/modules/mysql/jobs/index.d.ts +5 -0
- package/dist/modules/mysql/jobs/jobQueue.d.ts +40 -0
- package/dist/modules/mysql/jobs/jobQueue.js +375 -0
- package/dist/modules/mysql/jobs/kv.d.ts +18 -0
- package/dist/modules/mysql/jobs/kv.js +108 -0
- package/dist/modules/mysql/jobs/schema.d.ts +33 -0
- package/dist/modules/mysql/jobs/schema.js +113 -0
- package/dist/modules/mysql/jobs/stores.integration.test.d.ts +1 -0
- package/dist/modules/mysql/schema.js +25 -0
- package/dist/modules/mysql/sessions.d.ts +1 -11
- package/dist/modules/mysql/sessions.js +6 -1
- package/dist/modules/realtime/declarations.d.ts +11 -0
- package/dist/modules/realtime/declarations.js +26 -0
- package/dist/modules/realtime/grants.d.ts +23 -0
- package/dist/modules/realtime/grants.js +61 -0
- package/dist/modules/realtime/handlers.d.ts +74 -0
- package/dist/modules/realtime/handlers.js +224 -0
- package/dist/modules/realtime/hub.d.ts +62 -0
- package/dist/modules/realtime/hub.js +141 -0
- package/dist/modules/realtime/index.d.ts +51 -0
- package/dist/modules/realtime/index.js +62 -0
- package/dist/modules/realtime/memoryPubSub.d.ts +10 -0
- package/dist/modules/realtime/memoryPubSub.js +43 -0
- package/dist/modules/realtime/realtime.test.d.ts +1 -0
- package/dist/modules/realtime/redisPubSub.d.ts +24 -0
- package/dist/modules/realtime/redisPubSub.js +36 -0
- package/dist/modules/realtime/redisPubSub.test.d.ts +1 -0
- package/dist/modules/realtime/socket.d.ts +25 -0
- package/dist/modules/realtime/socket.js +122 -0
- package/dist/modules/realtime/socket.test.d.ts +1 -0
- package/dist/modules/rsc/handler.d.ts +16 -0
- package/dist/modules/rsc/handler.js +17 -10
- package/dist/modules/rsc/handler.test.d.ts +1 -0
- package/dist/modules/rsc/resolveRscData.js +2 -1
- package/dist/modules/runtime/bundle.d.ts +24 -0
- package/dist/modules/runtime/bundle.js +102 -0
- package/dist/modules/runtime/contract.d.ts +37 -0
- package/dist/modules/runtime/contract.js +21 -0
- package/dist/modules/runtime/entry.test.d.ts +1 -0
- package/dist/modules/runtime/host.d.ts +38 -0
- package/dist/modules/runtime/host.js +68 -0
- package/dist/modules/runtime/inside.d.ts +15 -0
- package/dist/modules/runtime/inside.js +47 -0
- package/dist/modules/runtime/inside.test.d.ts +1 -0
- package/dist/modules/runtime/runner.d.ts +11 -0
- package/dist/modules/runtime/runner.js +38 -0
- package/dist/modules/runtime/runtime.test.d.ts +1 -0
- package/dist/modules/runtime/stages.d.ts +50 -0
- package/dist/modules/runtime/stages.js +117 -0
- package/dist/modules/ssr/Component.d.ts +4 -5
- package/dist/modules/ssr/Component.js +2 -2
- package/dist/modules/ssr/handler.js +10 -2
- package/dist/modules/ssr/loadPluginComponents.js +2 -1
- package/dist/modules/ssr/prepareRender.js +39 -13
- package/dist/modules/ssr/preview.d.ts +3 -0
- package/dist/modules/ssr/preview.js +17 -7
- package/dist/modules/ssr/redirect.test.d.ts +1 -0
- package/dist/modules/ssr/registerExternalPlugins.d.ts +6 -1
- package/dist/modules/ssr/registerExternalPlugins.js +19 -16
- package/dist/modules/ssr/registerExternalPlugins.test.d.ts +1 -0
- package/dist/modules/ssr/reportMissingPlugins.d.ts +9 -0
- package/dist/modules/ssr/reportMissingPlugins.js +24 -0
- package/dist/modules/ssr/reportMissingPlugins.test.d.ts +1 -0
- package/dist/modules/ssr/streamBody.d.ts +2 -2
- package/dist/modules/ssr/streamBody.js +4 -1
- package/dist/modules/ssr/template.js +1 -1
- package/dist/modules/ssr/views/template.ejs +8 -5
- package/dist/mongo.d.ts +25 -0
- package/dist/mongo.js +3 -0
- package/dist/mysql.d.ts +11 -0
- package/dist/mysql.js +4 -1
- package/dist/oauth.js +2 -2
- package/dist/plugins/compile.js +9 -4
- package/dist/plugins/copy.js +3 -3
- package/dist/plugins/manager.d.ts +35 -3
- package/dist/plugins/manager.js +109 -38
- package/dist/runtime.d.ts +15 -0
- package/dist/runtime.js +7 -0
- package/package.json +52 -11
- package/skills/plitzi-authoring/SKILL.md +153 -263
- package/skills/plitzi-authoring/reference/accessibility.md +111 -0
- package/skills/plitzi-authoring/reference/authoring-errors.md +70 -0
- package/skills/plitzi-authoring/reference/data-and-visibility.md +180 -0
- package/skills/plitzi-authoring/reference/elements-and-styles.md +161 -0
- package/skills/plitzi-authoring/reference/flows.md +171 -0
- package/skills/plitzi-authoring/reference/layouts.md +140 -0
- package/skills/plitzi-authoring/reference/lists.md +74 -0
- package/skills/plitzi-authoring/reference/performance.md +67 -0
- package/skills/plitzi-authoring/reference/plugins.md +167 -0
- package/skills/plitzi-authoring/reference/review-checklist.md +67 -0
- package/skills/plitzi-authoring/reference/structure.md +83 -0
- package/skills/plitzi-authoring/reference/templates-and-export.md +54 -0
- package/skills/plitzi-authoring/reference/templates.md +109 -0
- package/skills/plitzi-authoring/reference/testing.md +119 -0
- package/skills/plitzi-authoring/reference/validation.md +73 -0
- package/dist/modules/actions/runtime/schedule.d.ts +0 -35
- package/dist/modules/actions/runtime/schedule.js +0 -76
- /package/dist/{modules/actions/runtime/schedule.test.d.ts → adapters/jsonAdapters.test.d.ts} +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Testing what you authored
|
|
2
|
+
|
|
3
|
+
## One call: `inspectPage`
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { authorSpace, inspectPage } from '@plitzi/sdk-authoring';
|
|
7
|
+
|
|
8
|
+
const { handles } = authorSpace(space);
|
|
9
|
+
await page.goto('/');
|
|
10
|
+
expect((await inspectPage(page, handles)).problems).toEqual([]);
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
It checks the open page and returns EVERY problem at once, one sentence each, naming the element and the reason:
|
|
14
|
+
|
|
15
|
+
- every element the page owes is present and visible — its own and those of the layouts around it
|
|
16
|
+
(`heading "hero-title" is on the page but not visible: display:none on "hero"`);
|
|
17
|
+
- every image arrived — an image element that failed says so (`data-plitzi-failed`), though its fallback loads;
|
|
18
|
+
- nothing scrolls sideways (`the page scrolls sideways by 37px — widest: "cards"`);
|
|
19
|
+
- no text is drawn in the colour painted behind it.
|
|
20
|
+
|
|
21
|
+
It retries for up to 5 s like an assertion does (`timeout`), so a provider still answering is not a failure. Options:
|
|
22
|
+
`page` (id or slug; the home page by default), `elements: 'all'` to owe the unnamed elements too, `ignore: ['id']` for
|
|
23
|
+
what a test knows is not there yet (a typo is refused), `skip: ['images']` for a check a page breaks on purpose.
|
|
24
|
+
`inspectDocument(page)` runs the page checks alone, for a page whose space is not in hand.
|
|
25
|
+
|
|
26
|
+
## Handles
|
|
27
|
+
|
|
28
|
+
`authorSpace` returns `handles`: every element by id, with the selector that finds it in the rendered page
|
|
29
|
+
(`[data-plitzi-el="<id>"]`). `handles.element(id)` throws on a name that does not exist, and `locate(page, handles)`
|
|
30
|
+
turns an id into a Playwright locator. Pages are in `handles.pages` (each with its `path`, `elements` and `layout`); a
|
|
31
|
+
layout's elements are in `handles.layouts` and render on every page that names the layout. `onScreen(handles, page)` is
|
|
32
|
+
the list `inspectPage` holds a page to.
|
|
33
|
+
|
|
34
|
+
Three flags say what a bare visit cannot promise, and `onScreen` leaves out:
|
|
35
|
+
|
|
36
|
+
- `conditional` — on screen only under a condition of its own or of an ancestor;
|
|
37
|
+
- `repeated` — inside a list row, so rendered once per row: several copies, or none while the list is empty. Address
|
|
38
|
+
one with `.first()` / `.nth(i)`, in a test that knows the data;
|
|
39
|
+
- `boxless` — a provider with no tag, which renders its children and no element of its own.
|
|
40
|
+
|
|
41
|
+
A `formControl`'s id names its wrapper: type into `locate('email').locator('input')`.
|
|
42
|
+
|
|
43
|
+
Select by `data-plitzi-el`, never by a generated class name: authoring derives `<type>-<hash>` for an element's own
|
|
44
|
+
rules, and that name changes when the rules do.
|
|
45
|
+
|
|
46
|
+
## Pressing a shortcut
|
|
47
|
+
|
|
48
|
+
`pressShortcut(page, 'mod+z')` presses a shortcut written the way `onKey` writes it, with the keys the PAGE listens
|
|
49
|
+
for: `mod` is ⌘ where the page's user agent is a Mac and Ctrl anywhere else. A driver's own "Control or Meta" asks the
|
|
50
|
+
machine running the suite instead, so a suite on a Mac driving an emulated desktop Chrome presses ⌘ at a page waiting
|
|
51
|
+
for Ctrl — the flow never runs and nothing says why. Point at the page first (a click on it) so it has the keys.
|
|
52
|
+
|
|
53
|
+
## Counting what an interaction renders
|
|
54
|
+
|
|
55
|
+
`inspectRenders(page, act, { max })` runs `act` and answers every element that rendered, how often and what changed
|
|
56
|
+
for it; over `max`, `problems` says so. It reads the SDK's render tracing, which is on only under `debugMode` — render
|
|
57
|
+
the space with it (the e2e harness: `renderSpace(page, space, { debugMode: true })`). What to do with the answer is in
|
|
58
|
+
[performance](performance.md).
|
|
59
|
+
|
|
60
|
+
## Spaces written for a test
|
|
61
|
+
|
|
62
|
+
Author them like any space — never as JSON: the validator is what tells a fixture that tests something from one that
|
|
63
|
+
tests nothing.
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { authorSpace, heading, singlePageSpace, withElement } from '@plitzi/sdk-authoring';
|
|
67
|
+
|
|
68
|
+
const space = singlePageSpace([heading('Hi', { id: 'title', subType: 'h1' })]); // one page, nothing else
|
|
69
|
+
const edited = withElement(space, 'title', { attributes: { content: 'Changed' } }); // same page, one thing different
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
A fixture that must break a check ON PURPOSE — the runtime's answer to a document no author would write is the
|
|
73
|
+
subject — names the break: `authorSpace(spec, { allow: [{ code: 'template-unknown-name', element: 'feed', why: '…' }] })`.
|
|
74
|
+
One code on one element; it comes back in `warnings` with the reason, and an entry that no longer matches is refused.
|
|
75
|
+
|
|
76
|
+
## What to check
|
|
77
|
+
|
|
78
|
+
- **Every viewport and both themes.** Desktop, tablet (48–64rem) and mobile (below 48rem); `colorScheme: 'dark'` as well
|
|
79
|
+
as light.
|
|
80
|
+
- **No horizontal scroll on a phone.** A column child grows to its content unless its parent stretches it; a code
|
|
81
|
+
block or a wide table is what finds out.
|
|
82
|
+
- **The loading frame, not only the finished one.** A screenshot after the page settles cannot see an element that
|
|
83
|
+
flashed and went. Watch from the first frame:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
await page.addInitScript(ids => {
|
|
87
|
+
const painted: string[] = [];
|
|
88
|
+
(window as unknown as { __painted: string[] }).__painted = painted;
|
|
89
|
+
const watch = (): void => {
|
|
90
|
+
for (const id of ids) {
|
|
91
|
+
const element = document.querySelector(`[data-plitzi-el="${id}"]`);
|
|
92
|
+
if (element && element.getClientRects().length > 0 && !painted.includes(id)) {
|
|
93
|
+
painted.push(id);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
requestAnimationFrame(watch);
|
|
98
|
+
};
|
|
99
|
+
requestAnimationFrame(watch);
|
|
100
|
+
}, ['empty-state', 'first-steps']);
|
|
101
|
+
|
|
102
|
+
await page.goto('/', { waitUntil: 'load' });
|
|
103
|
+
// … wait for the data to be on screen …
|
|
104
|
+
expect(await page.evaluate(() => (window as unknown as { __painted: string[] }).__painted)).toEqual([]);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- **Both sides of every condition.** An account that has done everything must not see "get started"; a new one must.
|
|
108
|
+
An empty list shows its empty state; a full one does not.
|
|
109
|
+
- **Navigation lands on the new page's content.** After `waitForURL`, wait for an element of the NEW page before typing:
|
|
110
|
+
for a frame the previous page is still mounted, and a form field with the same name there takes the keystrokes.
|
|
111
|
+
- **Console errors are failures.** Collect them and assert the list is empty.
|
|
112
|
+
|
|
113
|
+
## Screenshots and scrolling
|
|
114
|
+
|
|
115
|
+
The page scrolls the document in development exactly as in production while the dev-tools panel is folded away (the
|
|
116
|
+
badge). With the panel OPEN, the page shares the window with it and scrolls inside its own pane — close the panel, or
|
|
117
|
+
run with `debugMode: false`, before a `fullPage` screenshot or a scroll measurement. For a screenshot at a width and a
|
|
118
|
+
theme: `page.setViewportSize({ width: 390, height: 844 })`, `page.emulateMedia({ colorScheme: 'dark' })`, and seed state
|
|
119
|
+
with `render(…, { state })` or a flow the test drives.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# How `authorSpace` checks — and the loop that wastes no attempts
|
|
2
|
+
|
|
3
|
+
`authorSpace(space, options)` is the whole check. It either returns `{ schema, style, handles, warnings }` or throws, and
|
|
4
|
+
knowing HOW it throws is what turns ten attempts into two.
|
|
5
|
+
|
|
6
|
+
## Three stages, two ways of failing
|
|
7
|
+
|
|
8
|
+
| Stage | What it checks | How it fails |
|
|
9
|
+
| --- | --- | --- |
|
|
10
|
+
| 1. Assembly | Each spec as it is turned into a document: fields that exist, CSS properties the editor can read, a class declared twice with different rules, fonts, selector names | **Throws at the FIRST problem**, naming where it was written (`Element "text" (price) at shop/home/0/2`) |
|
|
11
|
+
| 2. Structure | The documents: parents, roots, pages, cycles, style targets | Collected, then thrown together |
|
|
12
|
+
| 3. Linter | What the documents MEAN: every template, binding, flow step, trigger, callback, attribute and link, read the way the runtime reads them | **All errors at once**, one line each: `Invalid space (…):\n - [code] message` |
|
|
13
|
+
|
|
14
|
+
The linter only runs once stage 2 holds, so the pattern of a session is: a few single refusals (fix, re-run), then one
|
|
15
|
+
list — **fix every line of the list in one pass** before running again. Each message says what to write instead; do
|
|
16
|
+
exactly that (see [authoring-errors](authoring-errors.md) for every code).
|
|
17
|
+
|
|
18
|
+
Warnings come back in `warnings` and never throw. Each one is written code that will not do what it says — zero is the
|
|
19
|
+
bar.
|
|
20
|
+
|
|
21
|
+
## The loop
|
|
22
|
+
|
|
23
|
+
0. **Before writing an element you have not used, print what it takes.** One command answers attributes, values,
|
|
24
|
+
triggers, callbacks and slots, and saves a refusal per guess:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
node --input-type=module -e "import * as a from '@plitzi/sdk-authoring'; const t = 'dropdown'; console.log({ attributes: a.elementDefaultAttributes[t], values: a.elementAttributeValues[t], triggers: a.elementTriggers[t], callbacks: a.elementCallbacks[t], slots: a.elementSlots[t] })"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
1. **Author once, print everything.** In a project `plitzi create` wrote, `npm run author`. Anywhere else, a file you run
|
|
31
|
+
with `node` (≥ 22.18 strips the types) — outside the project's source, never committed:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { authorSpace } from '@plitzi/sdk-authoring';
|
|
35
|
+
|
|
36
|
+
import { space } from './src/space.ts';
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const { schema, warnings } = authorSpace(space, { plugins: [] /* your declarations */ });
|
|
40
|
+
console.log(`${Object.keys(schema.flat).length} elements, ${warnings.length} warnings`);
|
|
41
|
+
warnings.forEach(warning => console.log(`[${warning.code}] ${warning.message}`));
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.log((error as Error).message);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. **Fix, re-run, until it prints zero warnings.** Then typecheck the project.
|
|
48
|
+
3. **Look at it** — in a browser, at desktop and phone width, in both themes (see [testing](testing.md)). Stage 3 is
|
|
49
|
+
thorough about MEANING and blind to what follows.
|
|
50
|
+
|
|
51
|
+
## What it cannot see
|
|
52
|
+
|
|
53
|
+
A space that authors cleanly can still render wrong. These are the places to look with your own eyes:
|
|
54
|
+
|
|
55
|
+
- **The shape of data it does not have.** A binding to `feed.records` is checked to name a provider; whether the
|
|
56
|
+
action's output HAS `records`, or its rows a `magnitude`, is known only at run time. Render with real data.
|
|
57
|
+
- **Layout and cascade.** Overflow, stacking, a type's default style under your class (a `button` or `text` default
|
|
58
|
+
applies beneath your rules), a `gap` holding a slot for a hidden element.
|
|
59
|
+
- **A plugin's inside** — and, unless you hand its declaration over (`plugins: [declaration]`, see
|
|
60
|
+
[plugins](plugins.md)), its events, actions and attributes too.
|
|
61
|
+
- **Anything positioned by a component.** A map marker, a dropdown popup, a tooltip: the component sets `position` on
|
|
62
|
+
its root. A class that sets `position` on it (a panel preset spread into it, say) takes that away, and it lands in
|
|
63
|
+
the page flow — offset, or holding its container open while hidden.
|
|
64
|
+
- **What an ancestor's `backdrop-filter`, `filter` or `transform` does**: it becomes the containing block of every
|
|
65
|
+
`position: fixed` descendant and a stacking context of its own, so a popup inside it opens offset and paints UNDER
|
|
66
|
+
its siblings.
|
|
67
|
+
|
|
68
|
+
## When a CSS property is refused
|
|
69
|
+
|
|
70
|
+
The style vocabulary is the closed list the editor can read back. What is outside it — `zoom`, `mask`, a custom
|
|
71
|
+
property (`--seismic-accent`), a pseudo-element, a keyframe — is not an error to work around: it goes in the space's
|
|
72
|
+
`customCss`, addressed by the class name (`.panel`, and `.panel--open` for a variant `variantFrom` applies). Shorthands
|
|
73
|
+
inside it ARE accepted and expanded: `inset`, `grid-area`, `outline`, `border`, `padding` all work in `css`.
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ActionsModule } from '../index';
|
|
2
|
-
import { ActionLookups } from '../types';
|
|
3
|
-
import { Environment } from '@plitzi/sdk-shared';
|
|
4
|
-
export type ScheduleTick = {
|
|
5
|
-
spaceId: number;
|
|
6
|
-
environment?: Environment;
|
|
7
|
-
/** The minute being asked about. Passed in rather than read here so a tick is testable and a missed one can be
|
|
8
|
-
* replayed deliberately — never guessed at. */
|
|
9
|
-
at?: Date;
|
|
10
|
-
};
|
|
11
|
-
export type ScheduleResult = {
|
|
12
|
-
ran: {
|
|
13
|
-
actionId: string;
|
|
14
|
-
runId: string;
|
|
15
|
-
status: string;
|
|
16
|
-
}[];
|
|
17
|
-
skipped: {
|
|
18
|
-
actionId: string;
|
|
19
|
-
reason: string;
|
|
20
|
-
}[];
|
|
21
|
-
};
|
|
22
|
-
export type ScheduleRunner = {
|
|
23
|
-
tick: (params: ScheduleTick) => Promise<ScheduleResult>;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Runs the actions a space has scheduled for this minute.
|
|
27
|
-
*
|
|
28
|
-
* It owns no timer, on purpose. What ticks it is the deployment's: a leader-locked interval in one role, a k8s
|
|
29
|
-
* CronJob hitting an endpoint, a queue consumer — all of which have to answer "which replica" and "what happens
|
|
30
|
-
* on restart", and none of which the SDK can answer for a deployment it cannot see.
|
|
31
|
-
*
|
|
32
|
-
* Missed ticks are NOT replayed. A scheduler that catches up fires an hour of digests at once after an outage,
|
|
33
|
-
* which is worse than the digest nobody got; the caller that wants a replay asks for that minute explicitly.
|
|
34
|
-
*/
|
|
35
|
-
export declare const createScheduleRunner: (lookups: ActionLookups, module: ActionsModule) => ScheduleRunner;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { ActionRunError } from "./errors.js";
|
|
2
|
-
import { findTriggerNode, triggerParams } from "./triggers.js";
|
|
3
|
-
import { cronMatches } from "@plitzi/sdk-shared/actions";
|
|
4
|
-
//#region src/modules/actions/runtime/schedule.ts
|
|
5
|
-
/**
|
|
6
|
-
* Runs the actions a space has scheduled for this minute.
|
|
7
|
-
*
|
|
8
|
-
* It owns no timer, on purpose. What ticks it is the deployment's: a leader-locked interval in one role, a k8s
|
|
9
|
-
* CronJob hitting an endpoint, a queue consumer — all of which have to answer "which replica" and "what happens
|
|
10
|
-
* on restart", and none of which the SDK can answer for a deployment it cannot see.
|
|
11
|
-
*
|
|
12
|
-
* Missed ticks are NOT replayed. A scheduler that catches up fires an hour of digests at once after an outage,
|
|
13
|
-
* which is worse than the digest nobody got; the caller that wants a replay asks for that minute explicitly.
|
|
14
|
-
*/
|
|
15
|
-
var createScheduleRunner = (lookups, module) => {
|
|
16
|
-
const tick = async ({ spaceId, environment = "main", at = /* @__PURE__ */ new Date() }) => {
|
|
17
|
-
const result = {
|
|
18
|
-
ran: [],
|
|
19
|
-
skipped: []
|
|
20
|
-
};
|
|
21
|
-
const entries = await lookups.listActions?.(spaceId) ?? [];
|
|
22
|
-
for (const entry of entries) {
|
|
23
|
-
const schedule = findTriggerNode(entry.document.nodes, "schedule");
|
|
24
|
-
const params = schedule ? triggerParams(schedule) : void 0;
|
|
25
|
-
const cron = params?.cron;
|
|
26
|
-
if (!schedule?.enabled || !cron) continue;
|
|
27
|
-
if (!cronMatches(cron, at, typeof params.timezone === "string" ? params.timezone : void 0)) continue;
|
|
28
|
-
let run;
|
|
29
|
-
try {
|
|
30
|
-
run = await module.guards.begin({
|
|
31
|
-
spaceId,
|
|
32
|
-
actionId: entry.id,
|
|
33
|
-
callerId: "schedule",
|
|
34
|
-
input: {},
|
|
35
|
-
idempotencyKey: `schedule:${at.toISOString().slice(0, 16)}`,
|
|
36
|
-
sharedKey: true,
|
|
37
|
-
ttlMs: module.limitsFor(entry.document).timeoutMs
|
|
38
|
-
});
|
|
39
|
-
} catch (error) {
|
|
40
|
-
result.skipped.push({
|
|
41
|
-
actionId: entry.id,
|
|
42
|
-
reason: error instanceof ActionRunError ? error.reason : "failed"
|
|
43
|
-
});
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
const run_ = await module.runAction({
|
|
48
|
-
entry,
|
|
49
|
-
input: {},
|
|
50
|
-
spaceId,
|
|
51
|
-
environment,
|
|
52
|
-
trigger: "schedule",
|
|
53
|
-
callerId: "schedule",
|
|
54
|
-
runId: run.runId,
|
|
55
|
-
signal: run.controller.signal
|
|
56
|
-
});
|
|
57
|
-
result.ran.push({
|
|
58
|
-
actionId: entry.id,
|
|
59
|
-
runId: run_.runId,
|
|
60
|
-
status: run_.status
|
|
61
|
-
});
|
|
62
|
-
} catch (error) {
|
|
63
|
-
result.skipped.push({
|
|
64
|
-
actionId: entry.id,
|
|
65
|
-
reason: error instanceof ActionRunError ? error.reason : "failed"
|
|
66
|
-
});
|
|
67
|
-
} finally {
|
|
68
|
-
await module.guards.end(run);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return result;
|
|
72
|
-
};
|
|
73
|
-
return { tick };
|
|
74
|
-
};
|
|
75
|
-
//#endregion
|
|
76
|
-
export { createScheduleRunner };
|
/package/dist/{modules/actions/runtime/schedule.test.d.ts → adapters/jsonAdapters.test.d.ts}
RENAMED
|
File without changes
|