@storyshelf/core 0.6.1 → 0.7.0
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/README.md +49 -32
- package/dist/adapter/capture-queue.d.mts +44 -2
- package/dist/adapter/capture-runner.d.mts +127 -10
- package/dist/adapter/capture-runner.mjs +5 -12
- package/dist/adapter/database.d.mts +27 -8
- package/dist/adapter/database.mjs.map +1 -1
- package/dist/adapter/design.d.mts +85 -0
- package/dist/adapter/design.mjs +28 -0
- package/dist/adapter/design.mjs.map +1 -0
- package/dist/adapter/metadata.d.mts +3 -10
- package/dist/adapter/notifier.d.mts +6 -3
- package/dist/adapter/notifier.mjs +5 -1
- package/dist/adapter/oauth.d.mts +52 -0
- package/dist/adapter/setup.d.mts +4 -5
- package/dist/adapter/setup.mjs +2 -1
- package/dist/adapter/setup.mjs.map +1 -1
- package/dist/adapter/webhook-events.mjs +1 -1
- package/dist/adapters/capture-target-offers.d.mts +28 -0
- package/dist/adapters/capture-target-offers.mjs +58 -0
- package/dist/adapters/capture-target-offers.mjs.map +1 -0
- package/dist/adapters/capture-target.d.mts +71 -0
- package/dist/adapters/capture-target.mjs +76 -0
- package/dist/adapters/capture-target.mjs.map +1 -0
- package/dist/adapters/notifier/build-comment.d.mts +24 -0
- package/dist/adapters/notifier/build-comment.mjs +24 -0
- package/dist/adapters/notifier/build-comment.mjs.map +1 -0
- package/dist/adapters/notifier/build-state.d.mts +99 -0
- package/dist/adapters/notifier/build-state.mjs +218 -0
- package/dist/adapters/notifier/build-state.mjs.map +1 -0
- package/dist/adapters/notifier/events.d.mts +4 -2
- package/dist/adapters/notifier/events.mjs +31 -18
- package/dist/adapters/notifier/events.mjs.map +1 -1
- package/dist/adapters/notifier/provider.d.mts +53 -7
- package/dist/adapters/notifier/provider.mjs +12 -0
- package/dist/adapters/notifier/provider.mjs.map +1 -0
- package/dist/adapters/notifier/state.d.mts +24 -0
- package/dist/adapters/notifier/state.mjs +66 -0
- package/dist/adapters/notifier/state.mjs.map +1 -0
- package/dist/adapters/notifier/types.d.mts +51 -2
- package/dist/adapters/remote-browser.d.mts +87 -0
- package/dist/adapters/remote-browser.mjs +103 -0
- package/dist/adapters/remote-browser.mjs.map +1 -0
- package/dist/adapters/render-runs.d.mts +25 -0
- package/dist/adapters/render-runs.mjs +41 -0
- package/dist/adapters/render-runs.mjs.map +1 -0
- package/dist/adapters/setup-runner.mjs +2 -4
- package/dist/adapters/setup-runner.mjs.map +1 -1
- package/dist/adapters/sources.d.mts +12 -0
- package/dist/adapters/sources.mjs +20 -0
- package/dist/adapters/sources.mjs.map +1 -0
- package/dist/adapters/validate.mjs +25 -18
- package/dist/adapters/validate.mjs.map +1 -1
- package/dist/ai.d.mts +105 -0
- package/dist/ai.mjs +19 -0
- package/dist/ai.mjs.map +1 -0
- package/dist/auth.d.mts +8 -1
- package/dist/auth.mjs +14 -1
- package/dist/auth.mjs.map +1 -0
- package/dist/capture/a11y/axe-source.d.mts +18 -0
- package/dist/capture/a11y/axe-source.mjs +37 -0
- package/dist/capture/a11y/axe-source.mjs.map +1 -0
- package/dist/capture/a11y/in-page.d.mts +27 -0
- package/dist/capture/a11y/in-page.mjs +60 -0
- package/dist/capture/a11y/in-page.mjs.map +1 -0
- package/dist/capture/a11y/map.d.mts +24 -0
- package/dist/capture/a11y/map.mjs +48 -0
- package/dist/capture/a11y/map.mjs.map +1 -0
- package/dist/capture/a11y/options.d.mts +23 -0
- package/dist/capture/a11y/options.mjs +75 -0
- package/dist/capture/a11y/options.mjs.map +1 -0
- package/dist/capture/adapter.d.mts +41 -3
- package/dist/capture/adapter.mjs.map +1 -1
- package/dist/capture/affected.d.mts +2 -0
- package/dist/capture/affected.mjs +13 -4
- package/dist/capture/affected.mjs.map +1 -1
- package/dist/capture/attempt-logger.mjs +84 -0
- package/dist/capture/attempt-logger.mjs.map +1 -0
- package/dist/capture/browsers.d.mts +35 -0
- package/dist/capture/browsers.mjs +67 -0
- package/dist/capture/browsers.mjs.map +1 -0
- package/dist/capture/build-state/deliver.d.mts +32 -0
- package/dist/capture/build-state/deliver.mjs +118 -0
- package/dist/capture/build-state/deliver.mjs.map +1 -0
- package/dist/capture/build-state/index.d.mts +8 -0
- package/dist/capture/build-state/notify-job.d.mts +56 -0
- package/dist/capture/build-state/notify-job.mjs +133 -0
- package/dist/capture/build-state/notify-job.mjs.map +1 -0
- package/dist/capture/build-state/publisher.d.mts +23 -0
- package/dist/capture/build-state/publisher.mjs +107 -0
- package/dist/capture/build-state/publisher.mjs.map +1 -0
- package/dist/capture/build-state/resume.d.mts +9 -0
- package/dist/capture/build-state/resume.mjs +47 -0
- package/dist/capture/build-state/resume.mjs.map +1 -0
- package/dist/capture/build-state/types.d.mts +49 -0
- package/dist/capture/catalog/catalogue.d.mts +22 -0
- package/dist/capture/catalog/catalogue.mjs +53 -0
- package/dist/capture/catalog/catalogue.mjs.map +1 -0
- package/dist/capture/catalog/components.d.mts +23 -0
- package/dist/capture/catalog/components.mjs +55 -0
- package/dist/capture/catalog/components.mjs.map +1 -0
- package/dist/capture/catalog/history.d.mts +30 -0
- package/dist/capture/catalog/history.mjs +51 -0
- package/dist/capture/catalog/history.mjs.map +1 -0
- package/dist/capture/catalog/hook.d.mts +14 -0
- package/dist/capture/catalog/hook.mjs +19 -0
- package/dist/capture/catalog/hook.mjs.map +1 -0
- package/dist/capture/catalog/index.d.mts +11 -0
- package/dist/capture/catalog/load.d.mts +26 -0
- package/dist/capture/catalog/load.mjs +49 -0
- package/dist/capture/catalog/load.mjs.map +1 -0
- package/dist/capture/catalog/parse.d.mts +15 -0
- package/dist/capture/catalog/parse.mjs +56 -0
- package/dist/capture/catalog/parse.mjs.map +1 -0
- package/dist/capture/catalog/read.d.mts +12 -0
- package/dist/capture/catalog/read.mjs +33 -0
- package/dist/capture/catalog/read.mjs.map +1 -0
- package/dist/capture/catalog/types.d.mts +33 -0
- package/dist/capture/consumer/capture-handler.d.mts +58 -0
- package/dist/capture/consumer/capture-handler.mjs +118 -0
- package/dist/capture/consumer/capture-handler.mjs.map +1 -0
- package/dist/capture/consumer/idle.d.mts +17 -0
- package/dist/capture/consumer/idle.mjs +25 -0
- package/dist/capture/consumer/idle.mjs.map +1 -0
- package/dist/capture/consumer/index.d.mts +13 -0
- package/dist/capture/consumer/index.mjs +139 -0
- package/dist/capture/consumer/index.mjs.map +1 -0
- package/dist/capture/consumer/loop.mjs +110 -0
- package/dist/capture/consumer/loop.mjs.map +1 -0
- package/dist/capture/consumer/metrics.d.mts +41 -0
- package/dist/capture/consumer/metrics.mjs +38 -0
- package/dist/capture/consumer/metrics.mjs.map +1 -0
- package/dist/capture/consumer/retry.d.mts +33 -0
- package/dist/capture/consumer/retry.mjs +34 -0
- package/dist/capture/consumer/retry.mjs.map +1 -0
- package/dist/capture/consumer/run-job.mjs +195 -0
- package/dist/capture/consumer/run-job.mjs.map +1 -0
- package/dist/capture/consumer/startup.mjs +38 -0
- package/dist/capture/consumer/startup.mjs.map +1 -0
- package/dist/capture/consumer/types.d.mts +97 -0
- package/dist/capture/crash-failure.d.mts +25 -0
- package/dist/capture/crash-failure.mjs +70 -0
- package/dist/capture/crash-failure.mjs.map +1 -0
- package/dist/capture/db-queue/cadence.d.mts +32 -0
- package/dist/capture/db-queue/cadence.mjs +38 -0
- package/dist/capture/db-queue/cadence.mjs.map +1 -0
- package/dist/capture/db-queue/claim.d.mts +9 -0
- package/dist/capture/db-queue/claim.mjs +132 -0
- package/dist/capture/db-queue/claim.mjs.map +1 -0
- package/dist/capture/db-queue/clock.mjs +12 -0
- package/dist/capture/db-queue/clock.mjs.map +1 -0
- package/dist/capture/db-queue/codec.mjs +76 -0
- package/dist/capture/db-queue/codec.mjs.map +1 -0
- package/dist/capture/db-queue/index.d.mts +20 -0
- package/dist/capture/db-queue/index.mjs +89 -0
- package/dist/capture/db-queue/index.mjs.map +1 -0
- package/dist/capture/db-queue/keeper.d.mts +36 -0
- package/dist/capture/db-queue/keeper.mjs +92 -0
- package/dist/capture/db-queue/keeper.mjs.map +1 -0
- package/dist/capture/db-queue/lease.mjs +46 -0
- package/dist/capture/db-queue/lease.mjs.map +1 -0
- package/dist/capture/db-queue/lifecycle.mjs +36 -0
- package/dist/capture/db-queue/lifecycle.mjs.map +1 -0
- package/dist/capture/db-queue/operations.mjs +94 -0
- package/dist/capture/db-queue/operations.mjs.map +1 -0
- package/dist/capture/db-queue/poll-loop.d.mts +30 -0
- package/dist/capture/db-queue/poll-loop.mjs +89 -0
- package/dist/capture/db-queue/poll-loop.mjs.map +1 -0
- package/dist/capture/db-queue/poll.d.mts +10 -0
- package/dist/capture/db-queue/poll.mjs +69 -0
- package/dist/capture/db-queue/poll.mjs.map +1 -0
- package/dist/capture/db-queue/timers.d.mts +12 -0
- package/dist/capture/db-queue/timers.mjs +37 -0
- package/dist/capture/db-queue/timers.mjs.map +1 -0
- package/dist/capture/db-queue/types.d.mts +83 -0
- package/dist/capture/db-queue/types.mjs +12 -0
- package/dist/capture/db-queue/types.mjs.map +1 -0
- package/dist/capture/db-queue/wake.mjs +48 -0
- package/dist/capture/db-queue/wake.mjs.map +1 -0
- package/dist/capture/design.mjs +39 -0
- package/dist/capture/design.mjs.map +1 -0
- package/dist/capture/diff-record.mjs +23 -3
- package/dist/capture/diff-record.mjs.map +1 -1
- package/dist/capture/dispatch.d.mts +12 -7
- package/dist/capture/dispatch.mjs +86 -107
- package/dist/capture/dispatch.mjs.map +1 -1
- package/dist/capture/enrich.mjs +60 -0
- package/dist/capture/enrich.mjs.map +1 -0
- package/dist/capture/failure-sets.mjs +22 -0
- package/dist/capture/failure-sets.mjs.map +1 -0
- package/dist/capture/fingerprint.d.mts +42 -0
- package/dist/capture/fingerprint.mjs +83 -0
- package/dist/capture/fingerprint.mjs.map +1 -0
- package/dist/capture/forked/channel.d.mts +25 -0
- package/dist/capture/forked/child.d.mts +34 -0
- package/dist/capture/forked/child.mjs +202 -0
- package/dist/capture/forked/child.mjs.map +1 -0
- package/dist/capture/forked/crash-tracker.mjs +23 -0
- package/dist/capture/forked/crash-tracker.mjs.map +1 -0
- package/dist/capture/forked/decision.d.mts +26 -0
- package/dist/capture/forked/decision.mjs +27 -0
- package/dist/capture/forked/decision.mjs.map +1 -0
- package/dist/capture/forked/exit.mjs +12 -0
- package/dist/capture/forked/exit.mjs.map +1 -0
- package/dist/capture/forked/fork.d.mts +31 -0
- package/dist/capture/forked/fork.mjs +93 -0
- package/dist/capture/forked/fork.mjs.map +1 -0
- package/dist/capture/forked/forked-capture.d.mts +40 -0
- package/dist/capture/forked/forked-capture.mjs +240 -0
- package/dist/capture/forked/forked-capture.mjs.map +1 -0
- package/dist/capture/forked/lease-book.mjs +46 -0
- package/dist/capture/forked/lease-book.mjs.map +1 -0
- package/dist/capture/forked/protocol.d.mts +38 -0
- package/dist/capture/forked/protocol.mjs +25 -0
- package/dist/capture/forked/protocol.mjs.map +1 -0
- package/dist/capture/forked/runs.mjs +75 -0
- package/dist/capture/forked/runs.mjs.map +1 -0
- package/dist/capture/isolate.mjs +141 -0
- package/dist/capture/isolate.mjs.map +1 -0
- package/dist/capture/job-lease.d.mts +28 -0
- package/dist/capture/job-lease.mjs +57 -0
- package/dist/capture/job-lease.mjs.map +1 -0
- package/dist/capture/matrix.mjs +298 -0
- package/dist/capture/matrix.mjs.map +1 -0
- package/dist/capture/modes.d.mts +25 -0
- package/dist/capture/modes.mjs +107 -0
- package/dist/capture/modes.mjs.map +1 -0
- package/dist/capture/orchestrator.d.mts +37 -5
- package/dist/capture/orchestrator.mjs +118 -107
- package/dist/capture/orchestrator.mjs.map +1 -1
- package/dist/capture/pipeline.d.mts +9 -2
- package/dist/capture/pipeline.mjs +250 -45
- package/dist/capture/pipeline.mjs.map +1 -1
- package/dist/capture/progress.d.mts +11 -0
- package/dist/capture/progress.mjs +28 -0
- package/dist/capture/progress.mjs.map +1 -0
- package/dist/capture/publish/accept.d.mts +39 -0
- package/dist/capture/publish/accept.mjs +28 -0
- package/dist/capture/publish/accept.mjs.map +1 -0
- package/dist/capture/publish/complete.d.mts +46 -0
- package/dist/capture/publish/complete.mjs +64 -0
- package/dist/capture/publish/complete.mjs.map +1 -0
- package/dist/capture/publish/extract.d.mts +20 -0
- package/dist/capture/publish/extract.mjs +119 -0
- package/dist/capture/publish/extract.mjs.map +1 -0
- package/dist/capture/publish/handler.d.mts +28 -0
- package/dist/capture/publish/handler.mjs +62 -0
- package/dist/capture/publish/handler.mjs.map +1 -0
- package/dist/capture/publish/index.d.mts +10 -0
- package/dist/capture/publish/limits.d.mts +37 -0
- package/dist/capture/publish/limits.mjs +39 -0
- package/dist/capture/publish/limits.mjs.map +1 -0
- package/dist/capture/publish/published.d.mts +15 -0
- package/dist/capture/publish/published.mjs +18 -0
- package/dist/capture/publish/published.mjs.map +1 -0
- package/dist/capture/publish/run.d.mts +33 -0
- package/dist/capture/publish/run.mjs +30 -0
- package/dist/capture/publish/run.mjs.map +1 -0
- package/dist/capture/rediff.d.mts +1 -1
- package/dist/capture/rediff.mjs +4 -3
- package/dist/capture/rediff.mjs.map +1 -1
- package/dist/capture/render.mjs +53 -0
- package/dist/capture/render.mjs.map +1 -0
- package/dist/capture/scratch.d.mts +44 -0
- package/dist/capture/scratch.mjs +138 -0
- package/dist/capture/scratch.mjs.map +1 -0
- package/dist/capture/shard-plan.mjs +128 -0
- package/dist/capture/shard-plan.mjs.map +1 -0
- package/dist/capture/shards/context.mjs +51 -0
- package/dist/capture/shards/context.mjs.map +1 -0
- package/dist/capture/shards/execute.mjs +174 -0
- package/dist/capture/shards/execute.mjs.map +1 -0
- package/dist/capture/shards/fan-out.mjs +126 -0
- package/dist/capture/shards/fan-out.mjs.map +1 -0
- package/dist/capture/shards/history.mjs +35 -0
- package/dist/capture/shards/history.mjs.map +1 -0
- package/dist/capture/shards/reduce.mjs +97 -0
- package/dist/capture/shards/reduce.mjs.map +1 -0
- package/dist/capture/sizing.mjs +1 -11
- package/dist/capture/sizing.mjs.map +1 -1
- package/dist/capture/skip-checks.mjs +2 -65
- package/dist/capture/skip-checks.mjs.map +1 -1
- package/dist/capture/statics.d.mts +7 -8
- package/dist/capture/statics.mjs +25 -71
- package/dist/capture/statics.mjs.map +1 -1
- package/dist/capture/storybook-urls.d.mts +40 -0
- package/dist/capture/storybook-urls.mjs +41 -0
- package/dist/capture/storybook-urls.mjs.map +1 -0
- package/dist/capture/storybook.d.mts +12 -4
- package/dist/capture/storybook.mjs +56 -16
- package/dist/capture/storybook.mjs.map +1 -1
- package/dist/capture/target.mjs +21 -0
- package/dist/capture/target.mjs.map +1 -0
- package/dist/capture/targets.d.mts +25 -0
- package/dist/capture/targets.mjs +32 -0
- package/dist/capture/targets.mjs.map +1 -0
- package/dist/capture/tests.d.mts +37 -0
- package/dist/capture/tests.mjs +126 -0
- package/dist/capture/tests.mjs.map +1 -0
- package/dist/capture/token-chunks.mjs +74 -0
- package/dist/capture/token-chunks.mjs.map +1 -0
- package/dist/capture.d.mts +60 -7
- package/dist/capture.mjs +48 -3
- package/dist/config.d.mts +121 -12
- package/dist/config.mjs +9 -6
- package/dist/config.mjs.map +1 -1
- package/dist/diff.d.mts +9 -3
- package/dist/diff.mjs +16 -3
- package/dist/diff.mjs.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/insights/budget.d.mts +20 -0
- package/dist/insights/budget.mjs +33 -0
- package/dist/insights/budget.mjs.map +1 -0
- package/dist/insights/envelope.d.mts +59 -0
- package/dist/insights/envelope.mjs +60 -0
- package/dist/insights/envelope.mjs.map +1 -0
- package/dist/insights/evidence-health.d.mts +32 -0
- package/dist/insights/evidence-health.mjs +28 -0
- package/dist/insights/evidence-health.mjs.map +1 -0
- package/dist/insights/evidence.d.mts +55 -0
- package/dist/insights/evidence.mjs +64 -0
- package/dist/insights/evidence.mjs.map +1 -0
- package/dist/insights/hash.d.mts +18 -0
- package/dist/insights/hash.mjs +21 -0
- package/dist/insights/hash.mjs.map +1 -0
- package/dist/insights/limits.d.mts +24 -0
- package/dist/insights/limits.mjs +24 -0
- package/dist/insights/limits.mjs.map +1 -0
- package/dist/insights/prompts/v1.d.mts +13 -0
- package/dist/insights/prompts/v1.mjs +34 -0
- package/dist/insights/prompts/v1.mjs.map +1 -0
- package/dist/insights/redact.d.mts +9 -0
- package/dist/insights/redact.mjs +24 -0
- package/dist/insights/redact.mjs.map +1 -0
- package/dist/insights/text.mjs +44 -0
- package/dist/insights/text.mjs.map +1 -0
- package/dist/insights.d.mts +11 -0
- package/dist/insights.mjs +12 -0
- package/dist/logger.mjs +17 -1
- package/dist/logger.mjs.map +1 -1
- package/dist/models/ai-budget-alert.d.mts +23 -0
- package/dist/models/ai-budget-alert.mjs +38 -0
- package/dist/models/ai-budget-alert.mjs.map +1 -0
- package/dist/models/ai-usage.d.mts +40 -0
- package/dist/models/ai-usage.mjs +61 -0
- package/dist/models/ai-usage.mjs.map +1 -0
- package/dist/models/baseline-archive.d.mts +84 -0
- package/dist/models/baseline-archive.mjs +106 -0
- package/dist/models/baseline-archive.mjs.map +1 -0
- package/dist/models/baseline-export.d.mts +19 -0
- package/dist/models/baseline-export.mjs +136 -0
- package/dist/models/baseline-export.mjs.map +1 -0
- package/dist/models/baseline-import.mjs +118 -0
- package/dist/models/baseline-import.mjs.map +1 -0
- package/dist/models/baseline-transfer.d.mts +49 -0
- package/dist/models/baseline-transfer.mjs +121 -0
- package/dist/models/baseline-transfer.mjs.map +1 -0
- package/dist/models/baseline.d.mts +32 -5
- package/dist/models/baseline.mjs +65 -20
- package/dist/models/baseline.mjs.map +1 -1
- package/dist/models/build-component.d.mts +28 -0
- package/dist/models/build-component.mjs +55 -0
- package/dist/models/build-component.mjs.map +1 -0
- package/dist/models/build-review-status.d.mts +29 -0
- package/dist/models/build-review-status.mjs +37 -0
- package/dist/models/build-review-status.mjs.map +1 -0
- package/dist/models/build-review.d.mts +28 -0
- package/dist/models/build-review.mjs +54 -0
- package/dist/models/build-review.mjs.map +1 -0
- package/dist/models/build.d.mts +25 -3
- package/dist/models/build.mjs +50 -11
- package/dist/models/build.mjs.map +1 -1
- package/dist/models/capture-attempt.d.mts +7 -1
- package/dist/models/capture-attempt.mjs +29 -4
- package/dist/models/capture-attempt.mjs.map +1 -1
- package/dist/models/capture-job.d.mts +106 -0
- package/dist/models/capture-job.mjs +288 -0
- package/dist/models/capture-job.mjs.map +1 -0
- package/dist/models/capture-log.d.mts +1 -1
- package/dist/models/capture-log.mjs +4 -3
- package/dist/models/capture-log.mjs.map +1 -1
- package/dist/models/capture-shard.d.mts +62 -0
- package/dist/models/capture-shard.mjs +190 -0
- package/dist/models/capture-shard.mjs.map +1 -0
- package/dist/models/changeset.d.mts +48 -0
- package/dist/models/changeset.mjs +81 -0
- package/dist/models/changeset.mjs.map +1 -0
- package/dist/models/columns.mjs +19 -0
- package/dist/models/columns.mjs.map +1 -0
- package/dist/models/comment.d.mts +4 -1
- package/dist/models/comment.mjs +7 -4
- package/dist/models/comment.mjs.map +1 -1
- package/dist/models/component.d.mts +43 -0
- package/dist/models/component.mjs +60 -0
- package/dist/models/component.mjs.map +1 -0
- package/dist/models/connections.d.mts +41 -0
- package/dist/models/connections.mjs +112 -0
- package/dist/models/connections.mjs.map +1 -0
- package/dist/models/content-ref.d.mts +1 -1
- package/dist/models/content-ref.mjs +1 -1
- package/dist/models/content-ref.mjs.map +1 -1
- package/dist/models/credentials.mjs +12 -2
- package/dist/models/credentials.mjs.map +1 -1
- package/dist/models/design-credentials.d.mts +41 -0
- package/dist/models/design-credentials.mjs +86 -0
- package/dist/models/design-credentials.mjs.map +1 -0
- package/dist/models/design-health.d.mts +16 -0
- package/dist/models/design-health.mjs +25 -0
- package/dist/models/design-health.mjs.map +1 -0
- package/dist/models/design-nodes.d.mts +83 -0
- package/dist/models/design-nodes.mjs +222 -0
- package/dist/models/design-nodes.mjs.map +1 -0
- package/dist/models/design-renders.mjs +74 -0
- package/dist/models/design-renders.mjs.map +1 -0
- package/dist/models/design-resolve.d.mts +29 -0
- package/dist/models/design-resolve.mjs +41 -0
- package/dist/models/design-resolve.mjs.map +1 -0
- package/dist/models/design.d.mts +39 -0
- package/dist/models/design.mjs +90 -0
- package/dist/models/design.mjs.map +1 -0
- package/dist/models/inherited-ratio.d.mts +21 -0
- package/dist/models/inherited-ratio.mjs +22 -0
- package/dist/models/inherited-ratio.mjs.map +1 -0
- package/dist/models/insight.d.mts +70 -0
- package/dist/models/insight.mjs +162 -0
- package/dist/models/insight.mjs.map +1 -0
- package/dist/models/label.d.mts +4 -2
- package/dist/models/label.mjs +25 -10
- package/dist/models/label.mjs.map +1 -1
- package/dist/models/member.d.mts +1 -1
- package/dist/models/member.mjs +5 -4
- package/dist/models/member.mjs.map +1 -1
- package/dist/models/notification-channel.d.mts +37 -3
- package/dist/models/notification-channel.mjs +88 -9
- package/dist/models/notification-channel.mjs.map +1 -1
- package/dist/models/notification-subscription.d.mts +1 -2
- package/dist/models/notification-subscription.mjs +7 -9
- package/dist/models/notification-subscription.mjs.map +1 -1
- package/dist/models/project-group-mapping.d.mts +6 -1
- package/dist/models/project-group-mapping.mjs +14 -4
- package/dist/models/project-group-mapping.mjs.map +1 -1
- package/dist/models/project.d.mts +9 -1
- package/dist/models/project.mjs +9 -4
- package/dist/models/project.mjs.map +1 -1
- package/dist/models/public-origin.d.mts +63 -0
- package/dist/models/public-origin.mjs +114 -0
- package/dist/models/public-origin.mjs.map +1 -0
- package/dist/models/review-switch-off.d.mts +14 -0
- package/dist/models/review-switch-off.mjs +26 -0
- package/dist/models/review-switch-off.mjs.map +1 -0
- package/dist/models/site-settings.d.mts +23 -0
- package/dist/models/site-settings.mjs +48 -0
- package/dist/models/site-settings.mjs.map +1 -0
- package/dist/models/snapshot.d.mts +36 -1
- package/dist/models/snapshot.mjs +50 -3
- package/dist/models/snapshot.mjs.map +1 -1
- package/dist/models/token.d.mts +13 -1
- package/dist/models/token.mjs +23 -5
- package/dist/models/token.mjs.map +1 -1
- package/dist/models/usage.d.mts +76 -0
- package/dist/models/usage.mjs +149 -0
- package/dist/models/usage.mjs.map +1 -0
- package/dist/models/user.d.mts +1 -1
- package/dist/models/user.mjs +4 -3
- package/dist/models/user.mjs.map +1 -1
- package/dist/models/webhook.d.mts +15 -1
- package/dist/models/webhook.mjs +33 -4
- package/dist/models/webhook.mjs.map +1 -1
- package/dist/models.d.mts +26 -3
- package/dist/models.mjs +27 -5
- package/dist/options.d.mts +18 -0
- package/dist/options.mjs +90 -0
- package/dist/options.mjs.map +1 -0
- package/dist/paths.d.mts +19 -4
- package/dist/paths.mjs +51 -10
- package/dist/paths.mjs.map +1 -1
- package/dist/retention/ai.d.mts +18 -0
- package/dist/retention/ai.mjs +23 -0
- package/dist/retention/ai.mjs.map +1 -0
- package/dist/retention/pending.mjs +47 -0
- package/dist/retention/pending.mjs.map +1 -0
- package/dist/retention/screenshot-sweep.d.mts +51 -0
- package/dist/retention/screenshot-sweep.mjs +128 -0
- package/dist/retention/screenshot-sweep.mjs.map +1 -0
- package/dist/retention.d.mts +16 -2
- package/dist/retention.mjs +71 -14
- package/dist/retention.mjs.map +1 -1
- package/dist/schema/baseline.d.mts +6 -0
- package/dist/schema/build-component.d.mts +25 -0
- package/dist/schema/build-review.d.mts +17 -0
- package/dist/schema/build.d.mts +7 -0
- package/dist/schema/capture-job.d.mts +60 -0
- package/dist/schema/capture-shard.d.mts +35 -0
- package/dist/schema/comment.d.mts +2 -0
- package/dist/schema/connection.d.mts +24 -0
- package/dist/schema/design.d.mts +58 -0
- package/dist/schema/insight.d.mts +54 -0
- package/dist/schema/notification.d.mts +4 -0
- package/dist/schema/project.d.mts +21 -0
- package/dist/schema/site-setting.d.mts +21 -0
- package/dist/schema/snapshot.d.mts +12 -0
- package/dist/schema/usage.d.mts +30 -0
- package/dist/schema.d.mts +11 -3
- package/dist/serverless.d.mts +21 -0
- package/dist/serverless.mjs +37 -0
- package/dist/serverless.mjs.map +1 -0
- package/dist/test-helpers/create-project.d.mts +1 -1
- package/dist/test-helpers/deferred.d.mts +39 -0
- package/dist/test-helpers/deferred.mjs +61 -0
- package/dist/test-helpers/deferred.mjs.map +1 -0
- package/dist/test-helpers/design-contract.d.mts +21 -0
- package/dist/test-helpers/design-contract.mjs +40 -0
- package/dist/test-helpers/design-contract.mjs.map +1 -0
- package/dist/test-helpers/fake-database.mjs +14 -2
- package/dist/test-helpers/fake-database.mjs.map +1 -1
- package/dist/test-helpers/fake-design.d.mts +43 -0
- package/dist/test-helpers/fake-design.mjs +114 -0
- package/dist/test-helpers/fake-design.mjs.map +1 -0
- package/dist/test-helpers/fake-notifier.d.mts +21 -0
- package/dist/test-helpers/fake-notifier.mjs +44 -0
- package/dist/test-helpers/fake-notifier.mjs.map +1 -0
- package/dist/test-helpers/fake-tables.mjs +255 -67
- package/dist/test-helpers/fake-tables.mjs.map +1 -1
- package/dist/test-helpers/manual-clock.d.mts +27 -0
- package/dist/test-helpers/manual-clock.mjs +56 -0
- package/dist/test-helpers/manual-clock.mjs.map +1 -0
- package/dist/test-helpers/notifier-contract.d.mts +7 -1
- package/dist/test-helpers/notifier-contract.mjs +32 -3
- package/dist/test-helpers/notifier-contract.mjs.map +1 -1
- package/dist/test-helpers/queue-contract.d.mts +16 -2
- package/dist/test-helpers/queue-contract.mjs +195 -1
- package/dist/test-helpers/queue-contract.mjs.map +1 -1
- package/dist/test-helpers/queue-multi-instance.d.mts +20 -0
- package/dist/test-helpers/queue-multi-instance.mjs +206 -0
- package/dist/test-helpers/queue-multi-instance.mjs.map +1 -0
- package/dist/test-helpers/runner-contract.mjs +11 -0
- package/dist/test-helpers/runner-contract.mjs.map +1 -1
- package/dist/test-helpers/sql-chunks.mjs +23 -0
- package/dist/test-helpers/sql-chunks.mjs.map +1 -1
- package/dist/test-helpers/storage-contract.mjs +1 -1
- package/dist/test-helpers.d.mts +9 -4
- package/dist/test-helpers.mjs +8 -3
- package/dist/types.d.mts +14 -3
- package/dist/types.mjs +21 -4
- package/dist/types.mjs.map +1 -1
- package/dist/urls.d.mts +4 -0
- package/dist/urls.mjs +11 -2
- package/dist/urls.mjs.map +1 -1
- package/dist/utils/adaptive-concurrency.d.mts +66 -0
- package/dist/utils/adaptive-concurrency.mjs +149 -0
- package/dist/utils/adaptive-concurrency.mjs.map +1 -0
- package/dist/utils/connect-retry.d.mts +26 -0
- package/dist/utils/connect-retry.mjs +43 -0
- package/dist/utils/connect-retry.mjs.map +1 -0
- package/dist/utils/environment.d.mts +19 -0
- package/dist/utils/environment.mjs +59 -0
- package/dist/utils/environment.mjs.map +1 -0
- package/dist/utils/http.d.mts +17 -1
- package/dist/utils/http.mjs +22 -3
- package/dist/utils/http.mjs.map +1 -1
- package/dist/utils/map-adaptive.d.mts +15 -0
- package/dist/utils/map-adaptive.mjs +72 -0
- package/dist/utils/map-adaptive.mjs.map +1 -0
- package/dist/utils/map-limit.d.mts +10 -0
- package/dist/utils/map-limit.mjs +32 -0
- package/dist/utils/map-limit.mjs.map +1 -0
- package/dist/utils/page-limiter.d.mts +37 -0
- package/dist/utils/page-limiter.mjs +56 -0
- package/dist/utils/page-limiter.mjs.map +1 -0
- package/dist/utils/public-origin.d.mts +20 -0
- package/dist/utils/public-origin.mjs +75 -0
- package/dist/utils/public-origin.mjs.map +1 -0
- package/dist/utils/redact.mjs +3 -0
- package/dist/utils/redact.mjs.map +1 -1
- package/dist/utils/remote-environment.d.mts +39 -0
- package/dist/utils/remote-environment.mjs +114 -0
- package/dist/utils/remote-environment.mjs.map +1 -0
- package/dist/utils/resources.d.mts +64 -0
- package/dist/utils/resources.mjs +122 -0
- package/dist/utils/resources.mjs.map +1 -0
- package/dist/utils/screenshot-store.d.mts +15 -0
- package/dist/utils/screenshot-store.mjs +41 -0
- package/dist/utils/screenshot-store.mjs.map +1 -0
- package/dist/utils/session-gate.d.mts +22 -0
- package/dist/utils/session-gate.mjs +53 -0
- package/dist/utils/session-gate.mjs.map +1 -0
- package/dist/utils/storybook-token.d.mts +81 -0
- package/dist/utils/storybook-token.mjs +134 -0
- package/dist/utils/storybook-token.mjs.map +1 -0
- package/dist/utils/storybook-url.d.mts +15 -0
- package/dist/utils/storybook-url.mjs +21 -0
- package/dist/utils/storybook-url.mjs.map +1 -0
- package/dist/utils/timing.mjs +1 -1
- package/dist/utils/timing.mjs.map +1 -1
- package/dist/utils/zip-read.mjs +129 -0
- package/dist/utils/zip-read.mjs.map +1 -0
- package/dist/utils/zip-write.d.mts +18 -0
- package/dist/utils/zip-write.mjs +188 -0
- package/dist/utils/zip-write.mjs.map +1 -0
- package/dist/utils.d.mts +17 -3
- package/dist/utils.mjs +18 -4
- package/package.json +32 -20
- package/dist/adapter/capture-runner.mjs.map +0 -1
- package/dist/adapter/git-host/comments.d.mts +0 -41
- package/dist/adapter/git-host/comments.mjs +0 -54
- package/dist/adapter/git-host/comments.mjs.map +0 -1
- package/dist/adapter/git-host/helpers.d.mts +0 -13
- package/dist/adapter/git-host/helpers.mjs +0 -30
- package/dist/adapter/git-host/helpers.mjs.map +0 -1
- package/dist/adapter/git-host.d.mts +0 -42
- package/dist/capture/queue.d.mts +0 -38
- package/dist/capture/queue.mjs +0 -98
- package/dist/capture/queue.mjs.map +0 -1
- package/dist/capture/recovery.d.mts +0 -21
- package/dist/capture/recovery.mjs +0 -83
- package/dist/capture/recovery.mjs.map +0 -1
- package/dist/capture/status-fanout.mjs +0 -72
- package/dist/capture/status-fanout.mjs.map +0 -1
- package/dist/diff/engine.d.mts +0 -16
- package/dist/diff/engine.mjs +0 -87
- package/dist/diff/engine.mjs.map +0 -1
- package/dist/diff/options.d.mts +0 -42
- package/dist/diff/options.mjs +0 -15
- package/dist/diff/options.mjs.map +0 -1
- package/dist/models/status-config.d.mts +0 -38
- package/dist/models/status-config.mjs +0 -63
- package/dist/models/status-config.mjs.map +0 -1
- package/dist/schema/status-config.d.mts +0 -16
- package/dist/test-helpers/git-contract.d.mts +0 -11
- package/dist/test-helpers/git-contract.mjs +0 -34
- package/dist/test-helpers/git-contract.mjs.map +0 -1
- /package/dist/adapter/{git-host.mjs → oauth.mjs} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/schema/design.d.ts
|
|
4
|
+
/** A design link: a project-level file link (`importPath` null) or a component mapping override. */
|
|
5
|
+
interface DesignLink {
|
|
6
|
+
id: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
/** Story file the URL is mapped to; null for a project-level design file link. */
|
|
9
|
+
importPath: string | null;
|
|
10
|
+
/** Display label of a project-level link. */
|
|
11
|
+
label: string | null;
|
|
12
|
+
url: string;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
}
|
|
16
|
+
/** The project-wide token of a design provider (an admin pastes it; encrypted at rest). */
|
|
17
|
+
interface DesignCredential {
|
|
18
|
+
id: string;
|
|
19
|
+
projectId: string;
|
|
20
|
+
/** Provider `metadata.kind`, e.g. `figma`. */
|
|
21
|
+
provider: string;
|
|
22
|
+
tokenEncrypted: string;
|
|
23
|
+
/** Last API outcome: `unknown` | `ok` | `unauthorized` | `forbidden`. */
|
|
24
|
+
status: string;
|
|
25
|
+
checkedAt: string | null;
|
|
26
|
+
/** When the credential was set or replaced; drives the rotation clock. */
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
}
|
|
30
|
+
/** Cached design file/node metadata, keyed by project, provider, viewer, file key and node id. */
|
|
31
|
+
interface DesignNode {
|
|
32
|
+
id: string;
|
|
33
|
+
projectId: string;
|
|
34
|
+
/** Provider `metadata.kind`. */
|
|
35
|
+
provider: string;
|
|
36
|
+
/** Whose access fetched the entry: `""` for the project credential, else a user id. */
|
|
37
|
+
viewerId: string;
|
|
38
|
+
fileKey: string;
|
|
39
|
+
/** Provider node id; empty string for a whole-file link. */
|
|
40
|
+
nodeId: string;
|
|
41
|
+
name: string | null;
|
|
42
|
+
/** File version at fetch time. */
|
|
43
|
+
version: string | null;
|
|
44
|
+
/** File `lastModified` at fetch time. */
|
|
45
|
+
lastModified: string | null;
|
|
46
|
+
/** `ok` | `deleted` | `unauthorized` | `forbidden`. */
|
|
47
|
+
state: string;
|
|
48
|
+
/** Storage path of the cached PNG render (node links only); null when none was fetched. */
|
|
49
|
+
renderPath: string | null;
|
|
50
|
+
/** File `version` the cached render was taken at; a newer file version refetches. */
|
|
51
|
+
renderVersion: string | null;
|
|
52
|
+
fetchedAt: string;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
updatedAt: string;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { DesignCredential, DesignLink, DesignNode };
|
|
58
|
+
//# sourceMappingURL=design.d.mts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/schema/insight.d.ts
|
|
4
|
+
/** Insight kinds: a build triage or a project-health digest. */
|
|
5
|
+
type InsightKind = "triage" | "health";
|
|
6
|
+
/** Lifecycle of an insight run. */
|
|
7
|
+
type InsightStatus = "pending" | "running" | "done" | "failed";
|
|
8
|
+
/** An insight row (result is an opaque, validated JSON string). */
|
|
9
|
+
interface InsightRow {
|
|
10
|
+
id: string;
|
|
11
|
+
projectId: string;
|
|
12
|
+
/** Null for project-health rows. */
|
|
13
|
+
buildId: string | null;
|
|
14
|
+
kind: InsightKind;
|
|
15
|
+
/** Health window key (e.g. `30d`); null for triage rows. */
|
|
16
|
+
windowKey: string | null;
|
|
17
|
+
inputHash: string;
|
|
18
|
+
status: InsightStatus;
|
|
19
|
+
profile: string;
|
|
20
|
+
model: string;
|
|
21
|
+
promptVersion: string;
|
|
22
|
+
verdict: string | null;
|
|
23
|
+
summary: string | null;
|
|
24
|
+
result: string | null;
|
|
25
|
+
errorCode: string | null;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
startedAt: string | null;
|
|
28
|
+
finishedAt: string | null;
|
|
29
|
+
}
|
|
30
|
+
/** One provider call's usage; survives build purge so budgets stay accurate. */
|
|
31
|
+
interface AiUsageRow {
|
|
32
|
+
id: string;
|
|
33
|
+
insightId: string | null;
|
|
34
|
+
projectId: string;
|
|
35
|
+
profile: string;
|
|
36
|
+
task: string;
|
|
37
|
+
model: string;
|
|
38
|
+
inputTokens: number;
|
|
39
|
+
outputTokens: number;
|
|
40
|
+
estimated: boolean;
|
|
41
|
+
images: number;
|
|
42
|
+
status: "ok" | "failed";
|
|
43
|
+
createdAt: string;
|
|
44
|
+
}
|
|
45
|
+
/** A budget-threshold alert claim (`id` is `${day}:${threshold}`). */
|
|
46
|
+
interface AiBudgetAlertRow {
|
|
47
|
+
id: string;
|
|
48
|
+
day: string;
|
|
49
|
+
threshold: number;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { AiBudgetAlertRow, AiUsageRow, InsightKind, InsightRow, InsightStatus };
|
|
54
|
+
//# sourceMappingURL=insight.d.mts.map
|
|
@@ -15,6 +15,10 @@ interface NotificationChannelRow {
|
|
|
15
15
|
/** JSON array of subscribed events, or null for all. */
|
|
16
16
|
events: string | null;
|
|
17
17
|
enabled: boolean;
|
|
18
|
+
/** Last delivery error (sanitized), null while the channel delivers cleanly. */
|
|
19
|
+
lastError: string | null;
|
|
20
|
+
/** ISO-8601 time of {@link lastError}. */
|
|
21
|
+
lastErrorAt: string | null;
|
|
18
22
|
createdAt: string;
|
|
19
23
|
updatedAt: string;
|
|
20
24
|
}
|
|
@@ -14,10 +14,31 @@ interface Project {
|
|
|
14
14
|
storybookMeta: string | null | undefined;
|
|
15
15
|
executePlay: boolean;
|
|
16
16
|
playTimeoutMs: number;
|
|
17
|
+
/** Run axe accessibility checks during capture; on by default (annotations never block). */
|
|
17
18
|
runA11y?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Run the Storybook 10 `.test()` entries as interaction tests during capture (ADR 0004,
|
|
21
|
+
* decision 11); off by default because it changes what a build contains.
|
|
22
|
+
*/
|
|
23
|
+
runTests?: boolean;
|
|
18
24
|
browser?: string;
|
|
19
25
|
viewports?: string | null;
|
|
26
|
+
/** JSON list of browsers to capture (null: legacy single `browser`). */
|
|
27
|
+
browsers?: string | null;
|
|
28
|
+
/** JSON list of mode names to capture (null: all declared modes). */
|
|
29
|
+
modesAllowlist?: string | null;
|
|
20
30
|
automigrate?: boolean;
|
|
31
|
+
/** AI profile gate: null = AI off for this project; otherwise a profile name. */
|
|
32
|
+
aiProfile?: string | null;
|
|
33
|
+
/** Review is on for this project (ADR 0013, decision 1); the column defaults to true. */
|
|
34
|
+
reviewEnabled?: boolean;
|
|
35
|
+
/** Approvals a build needs when `testing` is off (ADR 0013, decision 3); default 1. */
|
|
36
|
+
reviewApprovals?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Lifetime in seconds of the signed Storybook URLs of this project's renders (ADR 0007,
|
|
39
|
+
* decision 5); null derives it from the build's stories.
|
|
40
|
+
*/
|
|
41
|
+
storybookUrlTtlSeconds?: number | null;
|
|
21
42
|
createdAt: string;
|
|
22
43
|
updatedAt: string;
|
|
23
44
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/schema/site-setting.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Row type of `site_settings`: a small key-value table for facts the app learns while running and
|
|
6
|
+
* must share between instances (ADR 0007, decision 6: the public origin an admin's browser reported).
|
|
7
|
+
*/
|
|
8
|
+
/** One site-wide setting; `id` is the setting's key. */
|
|
9
|
+
interface SiteSetting {
|
|
10
|
+
/** Setting key (`public_origin`). */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Value, as text (JSON for structured settings). */
|
|
13
|
+
value: string;
|
|
14
|
+
/** User that last wrote it, when a person did. */
|
|
15
|
+
updatedBy: string | null;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { SiteSetting };
|
|
21
|
+
//# sourceMappingURL=site-setting.d.mts.map
|
|
@@ -11,6 +11,8 @@ interface Snapshot {
|
|
|
11
11
|
storyName: string;
|
|
12
12
|
storyTitle: string;
|
|
13
13
|
storyImportPath: string | null;
|
|
14
|
+
/** Figma URL declared by the story at capture time; null when none. */
|
|
15
|
+
designUrl: string | null;
|
|
14
16
|
viewportName: string;
|
|
15
17
|
viewportWidth: number;
|
|
16
18
|
viewportHeight: number;
|
|
@@ -23,12 +25,22 @@ interface Snapshot {
|
|
|
23
25
|
reviewedBy: string | null;
|
|
24
26
|
reviewedAt: string | null;
|
|
25
27
|
infraHash: string | null;
|
|
28
|
+
/** JSON `EnvironmentChange` when the capture environment differed from the baseline and the snapshot was accepted as a migration. */
|
|
29
|
+
envChange: string | null;
|
|
26
30
|
/** True when inherited unchanged from the baseline without rendering. */
|
|
27
31
|
inherited: boolean;
|
|
28
32
|
/** Baseline row the diff was computed against (null: no baseline, or legacy row). */
|
|
29
33
|
baselineId: string | null;
|
|
30
34
|
/** That baseline's `updatedAt` at diff time; compared on approval to detect drift. */
|
|
31
35
|
baselineVersion: string | null;
|
|
36
|
+
/** Resolved mode definition (JSON) — display/capture only; identity is `viewportName`. */
|
|
37
|
+
mode?: string | null;
|
|
38
|
+
/** Engine the image was captured with. */
|
|
39
|
+
browser?: string;
|
|
40
|
+
/** Milliseconds the renderer spent on this capture; null when it reported none or nothing rendered. */
|
|
41
|
+
durationMs: number | null;
|
|
42
|
+
/** JSON array of the axe violations found on this capture (never blocking); null when none or not checked. */
|
|
43
|
+
a11yViolations?: string | null;
|
|
32
44
|
createdAt: string;
|
|
33
45
|
updatedAt: string;
|
|
34
46
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/schema/usage.d.ts
|
|
4
|
+
/** A link from a downstream project to the upstream project that publishes a package it consumes. */
|
|
5
|
+
interface ProjectLink {
|
|
6
|
+
id: string;
|
|
7
|
+
/** Project that consumes the package (the app). */
|
|
8
|
+
downstreamId: string;
|
|
9
|
+
/** Project whose Storybook publishes the package's components (the design system). */
|
|
10
|
+
upstreamId: string;
|
|
11
|
+
packageName: string;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
}
|
|
14
|
+
/** A dependency package a story file reaches in a build. */
|
|
15
|
+
interface BuildPackageUsage {
|
|
16
|
+
id: string;
|
|
17
|
+
projectId: string;
|
|
18
|
+
buildId: string;
|
|
19
|
+
/** Story import path, joined to `snapshots.storyImportPath` at read time. */
|
|
20
|
+
storyImportPath: string;
|
|
21
|
+
packageName: string;
|
|
22
|
+
/** First module inside the package the story reaches. */
|
|
23
|
+
modulePath: string;
|
|
24
|
+
/** Installed package version at upload time; null when it could not be resolved. */
|
|
25
|
+
version: string | null;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { BuildPackageUsage, ProjectLink };
|
|
30
|
+
//# sourceMappingURL=usage.d.mts.map
|
package/dist/schema.d.mts
CHANGED
|
@@ -2,21 +2,29 @@ import __tsdown_shims_path from 'node:path';
|
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
3
|
import { Webhook } from "./schema/webhook.mjs";
|
|
4
4
|
import { Build } from "./schema/build.mjs";
|
|
5
|
-
import { CaptureAttempt, CaptureLog, CaptureLogLevel } from "./schema/capture-attempt.mjs";
|
|
6
5
|
import { Project, StorybookMeta } from "./schema/project.mjs";
|
|
6
|
+
import { CaptureAttempt, CaptureLog, CaptureLogLevel } from "./schema/capture-attempt.mjs";
|
|
7
7
|
import { Baseline } from "./schema/baseline.mjs";
|
|
8
8
|
import { Snapshot } from "./schema/snapshot.mjs";
|
|
9
|
-
import {
|
|
9
|
+
import { CaptureAttemptStatus, CaptureJobEntry, CaptureJobKind, CaptureJobRow, CaptureJobStatus } from "./schema/capture-job.mjs";
|
|
10
|
+
import { BuildComponent } from "./schema/build-component.mjs";
|
|
11
|
+
import { CaptureShard, CaptureShardKind, CaptureShardStatus } from "./schema/capture-shard.mjs";
|
|
12
|
+
import { AiBudgetAlertRow, AiUsageRow, InsightKind, InsightRow, InsightStatus } from "./schema/insight.mjs";
|
|
13
|
+
import { BuildReview } from "./schema/build-review.mjs";
|
|
10
14
|
import { Comment } from "./schema/comment.mjs";
|
|
15
|
+
import { UserConnection } from "./schema/connection.mjs";
|
|
16
|
+
import { DesignCredential, DesignLink, DesignNode } from "./schema/design.mjs";
|
|
11
17
|
import { BuildLabel, LabelType } from "./schema/label.mjs";
|
|
18
|
+
import { BuildPackageUsage, ProjectLink } from "./schema/usage.mjs";
|
|
12
19
|
import { ProjectMember } from "./schema/member.mjs";
|
|
13
20
|
import { NotificationChannelRow, NotificationSubscriptionRow } from "./schema/notification.mjs";
|
|
14
21
|
import { ProjectGroupMapping } from "./schema/project-group-mapping.mjs";
|
|
15
22
|
import { Token } from "./schema/token.mjs";
|
|
16
23
|
import { User } from "./schema/user.mjs";
|
|
24
|
+
import { SiteSetting } from "./schema/site-setting.mjs";
|
|
17
25
|
//#region src/schema/index.d.ts
|
|
18
26
|
/** Placeholder schema type — Drizzle schema lives in the db adapters. */
|
|
19
27
|
type Schema = Record<string, unknown>;
|
|
20
28
|
//#endregion
|
|
21
|
-
export { type Baseline, type Build, type BuildLabel, type CaptureAttempt, type CaptureLog, type CaptureLogLevel, type Comment, type LabelType, type NotificationChannelRow, type NotificationSubscriptionRow, type Project, type ProjectGroupMapping, type
|
|
29
|
+
export { type AiBudgetAlertRow, type AiUsageRow, type Baseline, type Build, type BuildComponent, type BuildLabel, type BuildPackageUsage, type BuildReview, type CaptureAttempt, type CaptureAttemptStatus, type CaptureJobEntry, type CaptureJobKind, type CaptureJobRow, type CaptureJobStatus, type CaptureLog, type CaptureLogLevel, type CaptureShard, type CaptureShardKind, type CaptureShardStatus, type Comment, type DesignCredential, type DesignLink, type DesignNode, type InsightKind, type InsightRow, type InsightStatus, type LabelType, type NotificationChannelRow, type NotificationSubscriptionRow, type Project, type ProjectGroupMapping, type ProjectLink, type ProjectMember, Schema, type SiteSetting, type Snapshot, type StorybookMeta, type Token, type User, type UserConnection, type Webhook };
|
|
22
30
|
//# sourceMappingURL=schema.d.mts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/serverless.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Serverless hosts (ADR 0006, decision 3): `testing` needs a process that keeps running between
|
|
6
|
+
* requests, so it is refused on AWS Lambda and warned about on the other platforms that freeze or
|
|
7
|
+
* end the process after each request. Hosting only works everywhere.
|
|
8
|
+
*/
|
|
9
|
+
/** Escape hatch for hosts that look serverless but keep a process alive. */
|
|
10
|
+
declare const ALLOW_SERVERLESS_ENV = "STORYSHELF_ALLOW_SERVERLESS";
|
|
11
|
+
/** Whether the host ends or freezes the process after each request (Lambda, Vercel, Netlify). */
|
|
12
|
+
declare function isServerlessHost(env?: NodeJS.ProcessEnv): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Boot check for `testing` on a serverless host. Returns a warning to log, or `undefined` when
|
|
15
|
+
* there is nothing to say; throws on AWS Lambda. Does nothing without `testing`, or when
|
|
16
|
+
* `STORYSHELF_ALLOW_SERVERLESS=1`.
|
|
17
|
+
*/
|
|
18
|
+
declare function assertServerless(testing: boolean, env?: NodeJS.ProcessEnv): string | undefined;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { ALLOW_SERVERLESS_ENV, assertServerless, isServerlessHost };
|
|
21
|
+
//# sourceMappingURL=serverless.d.mts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/serverless.ts
|
|
5
|
+
/**
|
|
6
|
+
* Serverless hosts (ADR 0006, decision 3): `testing` needs a process that keeps running between
|
|
7
|
+
* requests, so it is refused on AWS Lambda and warned about on the other platforms that freeze or
|
|
8
|
+
* end the process after each request. Hosting only works everywhere.
|
|
9
|
+
*/
|
|
10
|
+
/** Set by AWS Lambda; the one host where `testing` is refused outright. */
|
|
11
|
+
const LAMBDA_ENV = "AWS_LAMBDA_FUNCTION_NAME";
|
|
12
|
+
/** Platforms that freeze or end the process after each request. */
|
|
13
|
+
const SERVERLESS_ENV = [
|
|
14
|
+
LAMBDA_ENV,
|
|
15
|
+
"VERCEL",
|
|
16
|
+
"NETLIFY"
|
|
17
|
+
];
|
|
18
|
+
/** Escape hatch for hosts that look serverless but keep a process alive. */
|
|
19
|
+
const ALLOW_SERVERLESS_ENV = "STORYSHELF_ALLOW_SERVERLESS";
|
|
20
|
+
/** Whether the host ends or freezes the process after each request (Lambda, Vercel, Netlify). */
|
|
21
|
+
function isServerlessHost(env = process.env) {
|
|
22
|
+
return SERVERLESS_ENV.some((name) => Boolean(env[name]));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Boot check for `testing` on a serverless host. Returns a warning to log, or `undefined` when
|
|
26
|
+
* there is nothing to say; throws on AWS Lambda. Does nothing without `testing`, or when
|
|
27
|
+
* `STORYSHELF_ALLOW_SERVERLESS=1`.
|
|
28
|
+
*/
|
|
29
|
+
function assertServerless(testing, env = process.env) {
|
|
30
|
+
if (!testing || env["STORYSHELF_ALLOW_SERVERLESS"] === "1" || !isServerlessHost(env)) return;
|
|
31
|
+
if (env[LAMBDA_ENV]) throw new Error(`testing needs a long-running server, and AWS Lambda ends the process after each request. Remove the testing option to host Storybooks only, or run on a container; set ${ALLOW_SERVERLESS_ENV}=1 to override.`);
|
|
32
|
+
return `testing is configured on a serverless host: capture jobs run in the background and may be cut off when the platform ends the process. Run on a container for testing; set ${ALLOW_SERVERLESS_ENV}=1 to silence this warning.`;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { ALLOW_SERVERLESS_ENV, assertServerless, isServerlessHost };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=serverless.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverless.mjs","names":[],"sources":["../src/serverless.ts"],"sourcesContent":["/**\n * Serverless hosts (ADR 0006, decision 3): `testing` needs a process that keeps running between\n * requests, so it is refused on AWS Lambda and warned about on the other platforms that freeze or\n * end the process after each request. Hosting only works everywhere.\n */\n\n/** Set by AWS Lambda; the one host where `testing` is refused outright. */\nconst LAMBDA_ENV = \"AWS_LAMBDA_FUNCTION_NAME\";\n\n/** Platforms that freeze or end the process after each request. */\nconst SERVERLESS_ENV = [LAMBDA_ENV, \"VERCEL\", \"NETLIFY\"] as const;\n\n/** Escape hatch for hosts that look serverless but keep a process alive. */\nexport const ALLOW_SERVERLESS_ENV = \"STORYSHELF_ALLOW_SERVERLESS\";\n\n/** Whether the host ends or freezes the process after each request (Lambda, Vercel, Netlify). */\nexport function isServerlessHost(env: NodeJS.ProcessEnv = process.env): boolean {\n return SERVERLESS_ENV.some((name) => Boolean(env[name]));\n}\n\n/**\n * Boot check for `testing` on a serverless host. Returns a warning to log, or `undefined` when\n * there is nothing to say; throws on AWS Lambda. Does nothing without `testing`, or when\n * `STORYSHELF_ALLOW_SERVERLESS=1`.\n */\nexport function assertServerless(\n testing: boolean,\n env: NodeJS.ProcessEnv = process.env,\n): string | undefined {\n if (!testing || env[ALLOW_SERVERLESS_ENV] === \"1\" || !isServerlessHost(env)) {\n return undefined;\n }\n if (env[LAMBDA_ENV]) {\n throw new Error(\n `testing needs a long-running server, and AWS Lambda ends the process after each request. ` +\n `Remove the testing option to host Storybooks only, or run on a container; set ` +\n `${ALLOW_SERVERLESS_ENV}=1 to override.`,\n );\n }\n return (\n `testing is configured on a serverless host: capture jobs run in the background and may be ` +\n `cut off when the platform ends the process. Run on a container for testing; set ` +\n `${ALLOW_SERVERLESS_ENV}=1 to silence this warning.`\n );\n}\n"],"mappings":";;;;;;;;;;AAOA,MAAM,aAAa;;AAGnB,MAAM,iBAAiB;CAAC;CAAY;CAAU;AAAS;;AAGvD,MAAa,uBAAuB;;AAGpC,SAAgB,iBAAiB,MAAyB,QAAQ,KAAc;CAC9E,OAAO,eAAe,MAAM,SAAS,QAAQ,IAAI,KAAK,CAAC;AACzD;;;;;;AAOA,SAAgB,iBACd,SACA,MAAyB,QAAQ,KACb;CACpB,IAAI,CAAC,WAAW,IAAA,mCAA8B,OAAO,CAAC,iBAAiB,GAAG,GACxE;CAEF,IAAI,IAAI,aACN,MAAM,IAAI,MACR,0KAEK,qBAAqB,gBAC5B;CAEF,OACE,6KAEG,qBAAqB;AAE5B"}
|
|
@@ -2,8 +2,8 @@ import __tsdown_shims_path from 'node:path';
|
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
3
|
import { DatabaseAdapter } from "../adapter/database.mjs";
|
|
4
4
|
import { Build } from "../schema/build.mjs";
|
|
5
|
-
import { BuildTables } from "../models/build.mjs";
|
|
6
5
|
import { Project } from "../schema/project.mjs";
|
|
6
|
+
import { BuildTables } from "../models/build.mjs";
|
|
7
7
|
import { ProjectTables } from "../models/project.mjs";
|
|
8
8
|
//#region src/test-helpers/create-project.d.ts
|
|
9
9
|
/** Create a test project with owner/repo defaults. */
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/test-helpers/deferred.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A promise a test resolves by hand, for asserting concurrency and ordering without sleeping.
|
|
6
|
+
* Tests wait on `promise` to observe an in-flight state, then call `resolve()` to let it finish.
|
|
7
|
+
*/
|
|
8
|
+
/** A manually settled promise. */
|
|
9
|
+
interface Deferred<T = void> {
|
|
10
|
+
readonly promise: Promise<T>;
|
|
11
|
+
resolve(value: T): void;
|
|
12
|
+
reject(reason?: unknown): void;
|
|
13
|
+
}
|
|
14
|
+
/** Create a promise the test settles explicitly. */
|
|
15
|
+
declare function deferred<T = void>(): Deferred<T>;
|
|
16
|
+
/** A gate that holds every waiter until opened, then lets all future calls through. */
|
|
17
|
+
interface Latch {
|
|
18
|
+
wait(): Promise<void>;
|
|
19
|
+
open(): void;
|
|
20
|
+
readonly opened: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Create a latch that stays open once opened. */
|
|
23
|
+
declare function createLatch(): Latch;
|
|
24
|
+
/** A set of deferreds a test can release one at a time, in order. */
|
|
25
|
+
interface ReleaseQueue {
|
|
26
|
+
/** The next deferred to hand to a task. */
|
|
27
|
+
next(): Promise<void>;
|
|
28
|
+
/** Release the oldest waiter. */
|
|
29
|
+
release(): void;
|
|
30
|
+
/** Release every waiter created so far. */
|
|
31
|
+
releaseAll(): void;
|
|
32
|
+
/** Waiters created but not released yet. */
|
|
33
|
+
readonly pending: number;
|
|
34
|
+
}
|
|
35
|
+
/** Create a FIFO release queue. */
|
|
36
|
+
declare function createReleaseQueue(): ReleaseQueue;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { Deferred, Latch, ReleaseQueue, createLatch, createReleaseQueue, deferred };
|
|
39
|
+
//# sourceMappingURL=deferred.d.mts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/test-helpers/deferred.ts
|
|
5
|
+
/** Create a promise the test settles explicitly. */
|
|
6
|
+
function deferred() {
|
|
7
|
+
let resolve;
|
|
8
|
+
let reject;
|
|
9
|
+
return {
|
|
10
|
+
promise: new Promise((promiseResolve, promiseReject) => {
|
|
11
|
+
resolve = promiseResolve;
|
|
12
|
+
reject = promiseReject;
|
|
13
|
+
}),
|
|
14
|
+
resolve,
|
|
15
|
+
reject
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** Create a latch that stays open once opened. */
|
|
19
|
+
function createLatch() {
|
|
20
|
+
let opened = false;
|
|
21
|
+
const waiters = [];
|
|
22
|
+
return {
|
|
23
|
+
wait: () => {
|
|
24
|
+
if (opened) return Promise.resolve();
|
|
25
|
+
const waiter = deferred();
|
|
26
|
+
waiters.push(waiter);
|
|
27
|
+
return waiter.promise;
|
|
28
|
+
},
|
|
29
|
+
open: () => {
|
|
30
|
+
opened = true;
|
|
31
|
+
for (const waiter of waiters.splice(0)) waiter.resolve();
|
|
32
|
+
},
|
|
33
|
+
get opened() {
|
|
34
|
+
return opened;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Create a FIFO release queue. */
|
|
39
|
+
function createReleaseQueue() {
|
|
40
|
+
const waiters = [];
|
|
41
|
+
return {
|
|
42
|
+
next: () => {
|
|
43
|
+
const waiter = deferred();
|
|
44
|
+
waiters.push(waiter);
|
|
45
|
+
return waiter.promise;
|
|
46
|
+
},
|
|
47
|
+
release: () => {
|
|
48
|
+
waiters.shift()?.resolve();
|
|
49
|
+
},
|
|
50
|
+
releaseAll: () => {
|
|
51
|
+
for (const waiter of waiters.splice(0)) waiter.resolve();
|
|
52
|
+
},
|
|
53
|
+
get pending() {
|
|
54
|
+
return waiters.length;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { createLatch, createReleaseQueue, deferred };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=deferred.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deferred.mjs","names":[],"sources":["../../src/test-helpers/deferred.ts"],"sourcesContent":["/**\n * A promise a test resolves by hand, for asserting concurrency and ordering without sleeping.\n * Tests wait on `promise` to observe an in-flight state, then call `resolve()` to let it finish.\n */\n\n/** A manually settled promise. */\nexport interface Deferred<T = void> {\n readonly promise: Promise<T>;\n resolve(value: T): void;\n reject(reason?: unknown): void;\n}\n\n/** Create a promise the test settles explicitly. */\nexport function deferred<T = void>(): Deferred<T> {\n let resolve!: (value: T) => void;\n let reject!: (reason?: unknown) => void;\n const promise = new Promise<T>((promiseResolve, promiseReject) => {\n resolve = promiseResolve;\n reject = promiseReject;\n });\n return { promise, resolve, reject };\n}\n\n/** A gate that holds every waiter until opened, then lets all future calls through. */\nexport interface Latch {\n wait(): Promise<void>;\n open(): void;\n readonly opened: boolean;\n}\n\n/** Create a latch that stays open once opened. */\nexport function createLatch(): Latch {\n let opened = false;\n const waiters: Deferred[] = [];\n return {\n wait: () => {\n if (opened) return Promise.resolve();\n const waiter = deferred();\n waiters.push(waiter);\n return waiter.promise;\n },\n open: () => {\n opened = true;\n for (const waiter of waiters.splice(0)) waiter.resolve();\n },\n get opened() {\n return opened;\n },\n };\n}\n\n/** A set of deferreds a test can release one at a time, in order. */\nexport interface ReleaseQueue {\n /** The next deferred to hand to a task. */\n next(): Promise<void>;\n /** Release the oldest waiter. */\n release(): void;\n /** Release every waiter created so far. */\n releaseAll(): void;\n /** Waiters created but not released yet. */\n readonly pending: number;\n}\n\n/** Create a FIFO release queue. */\nexport function createReleaseQueue(): ReleaseQueue {\n const waiters: Deferred[] = [];\n return {\n next: () => {\n const waiter = deferred();\n waiters.push(waiter);\n return waiter.promise;\n },\n release: () => {\n waiters.shift()?.resolve();\n },\n releaseAll: () => {\n for (const waiter of waiters.splice(0)) waiter.resolve();\n },\n get pending() {\n return waiters.length;\n },\n };\n}\n"],"mappings":";;;;;AAaA,SAAgB,WAAkC;CAChD,IAAI;CACJ,IAAI;CAKJ,OAAO;EAAE,SAAA,IAJW,SAAY,gBAAgB,kBAAkB;GAChE,UAAU;GACV,SAAS;EACX,CACe;EAAG;EAAS;CAAO;AACpC;;AAUA,SAAgB,cAAqB;CACnC,IAAI,SAAS;CACb,MAAM,UAAsB,CAAC;CAC7B,OAAO;EACL,YAAY;GACV,IAAI,QAAQ,OAAO,QAAQ,QAAQ;GACnC,MAAM,SAAS,SAAS;GACxB,QAAQ,KAAK,MAAM;GACnB,OAAO,OAAO;EAChB;EACA,YAAY;GACV,SAAS;GACT,KAAK,MAAM,UAAU,QAAQ,OAAO,CAAC,GAAG,OAAO,QAAQ;EACzD;EACA,IAAI,SAAS;GACX,OAAO;EACT;CACF;AACF;;AAeA,SAAgB,qBAAmC;CACjD,MAAM,UAAsB,CAAC;CAC7B,OAAO;EACL,YAAY;GACV,MAAM,SAAS,SAAS;GACxB,QAAQ,KAAK,MAAM;GACnB,OAAO,OAAO;EAChB;EACA,eAAe;GACb,QAAQ,MAAM,CAAC,EAAE,QAAQ;EAC3B;EACA,kBAAkB;GAChB,KAAK,MAAM,UAAU,QAAQ,OAAO,CAAC,GAAG,OAAO,QAAQ;EACzD;EACA,IAAI,UAAU;GACZ,OAAO,QAAQ;EACjB;CACF;AACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { DesignProvider } from "../adapter/design.mjs";
|
|
4
|
+
//#region src/test-helpers/design-contract.d.ts
|
|
5
|
+
/** Build the provider under test (sync or async factories both work). */
|
|
6
|
+
type DesignFactory = () => DesignProvider | Promise<DesignProvider>;
|
|
7
|
+
/** Links the suite uses to probe `parseUrl`. */
|
|
8
|
+
interface DesignContractSamples {
|
|
9
|
+
/** A link the provider must accept, with the file key it must yield. */
|
|
10
|
+
valid: {
|
|
11
|
+
url: string;
|
|
12
|
+
fileKey: string;
|
|
13
|
+
};
|
|
14
|
+
/** A link the provider must reject. */
|
|
15
|
+
invalid: string;
|
|
16
|
+
}
|
|
17
|
+
/** Run the design-provider contract against a factory. */
|
|
18
|
+
declare function designContractSuite(label: string, make: DesignFactory, samples: DesignContractSamples): void;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { DesignContractSamples, DesignFactory, designContractSuite };
|
|
21
|
+
//# sourceMappingURL=design-contract.d.mts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
//#region src/test-helpers/design-contract.ts
|
|
6
|
+
/**
|
|
7
|
+
* Published design-provider contract suite for first- and third-party providers.
|
|
8
|
+
*
|
|
9
|
+
* Structural conformance (identity, descriptor, link parsing). Vendor API calls
|
|
10
|
+
* stay per-package behind faked transports.
|
|
11
|
+
*/
|
|
12
|
+
/** Run the design-provider contract against a factory. */
|
|
13
|
+
function designContractSuite(label, make, samples) {
|
|
14
|
+
describe(`design contract: ${label}`, () => {
|
|
15
|
+
it("exposes design metadata with credential copy", async () => {
|
|
16
|
+
const { metadata } = await make();
|
|
17
|
+
expect(metadata.category).toBe("design");
|
|
18
|
+
expect(metadata.kind.length).toBeGreaterThan(0);
|
|
19
|
+
expect(metadata.credentialLabel.length).toBeGreaterThan(0);
|
|
20
|
+
expect(metadata.credentialHelp.length).toBeGreaterThan(0);
|
|
21
|
+
expect(metadata.urlHint.length).toBeGreaterThan(0);
|
|
22
|
+
});
|
|
23
|
+
it("parses its own links and rejects foreign ones", async () => {
|
|
24
|
+
const provider = await make();
|
|
25
|
+
expect(provider.parseUrl(samples.valid.url)?.fileKey).toBe(samples.valid.fileKey);
|
|
26
|
+
expect(provider.parseUrl(samples.invalid)).toBeNull();
|
|
27
|
+
expect(provider.parseUrl("not a url")).toBeNull();
|
|
28
|
+
expect(provider.parseUrl("")).toBeNull();
|
|
29
|
+
});
|
|
30
|
+
it("creates a client with both fetch methods", async () => {
|
|
31
|
+
const client = (await make()).create({ credential: "test-credential" });
|
|
32
|
+
expect(typeof client.fetchMetas).toBe("function");
|
|
33
|
+
expect(typeof client.fetchRenders).toBe("function");
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { designContractSuite };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=design-contract.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-contract.mjs","names":[],"sources":["../../src/test-helpers/design-contract.ts"],"sourcesContent":["/**\n * Published design-provider contract suite for first- and third-party providers.\n *\n * Structural conformance (identity, descriptor, link parsing). Vendor API calls\n * stay per-package behind faked transports.\n */\nimport { describe, expect, it } from \"vitest\";\nimport type { DesignProvider } from \"../adapters/design.ts\";\n\n/** Build the provider under test (sync or async factories both work). */\nexport type DesignFactory = () => DesignProvider | Promise<DesignProvider>;\n\n/** Links the suite uses to probe `parseUrl`. */\nexport interface DesignContractSamples {\n /** A link the provider must accept, with the file key it must yield. */\n valid: { url: string; fileKey: string };\n /** A link the provider must reject. */\n invalid: string;\n}\n\n/** Run the design-provider contract against a factory. */\nexport function designContractSuite(\n label: string,\n make: DesignFactory,\n samples: DesignContractSamples,\n): void {\n describe(`design contract: ${label}`, () => {\n it(\"exposes design metadata with credential copy\", async () => {\n const { metadata } = await make();\n expect(metadata.category).toBe(\"design\");\n expect(metadata.kind.length).toBeGreaterThan(0);\n expect(metadata.credentialLabel.length).toBeGreaterThan(0);\n expect(metadata.credentialHelp.length).toBeGreaterThan(0);\n expect(metadata.urlHint.length).toBeGreaterThan(0);\n });\n\n it(\"parses its own links and rejects foreign ones\", async () => {\n const provider = await make();\n expect(provider.parseUrl(samples.valid.url)?.fileKey).toBe(samples.valid.fileKey);\n expect(provider.parseUrl(samples.invalid)).toBeNull();\n expect(provider.parseUrl(\"not a url\")).toBeNull();\n expect(provider.parseUrl(\"\")).toBeNull();\n });\n\n it(\"creates a client with both fetch methods\", async () => {\n const client = (await make()).create({ credential: \"test-credential\" });\n expect(typeof client.fetchMetas).toBe(\"function\");\n expect(typeof client.fetchRenders).toBe(\"function\");\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;AAqBA,SAAgB,oBACd,OACA,MACA,SACM;CACN,SAAS,oBAAoB,eAAe;EAC1C,GAAG,gDAAgD,YAAY;GAC7D,MAAM,EAAE,aAAa,MAAM,KAAK;GAChC,OAAO,SAAS,QAAQ,CAAC,CAAC,KAAK,QAAQ;GACvC,OAAO,SAAS,KAAK,MAAM,CAAC,CAAC,gBAAgB,CAAC;GAC9C,OAAO,SAAS,gBAAgB,MAAM,CAAC,CAAC,gBAAgB,CAAC;GACzD,OAAO,SAAS,eAAe,MAAM,CAAC,CAAC,gBAAgB,CAAC;GACxD,OAAO,SAAS,QAAQ,MAAM,CAAC,CAAC,gBAAgB,CAAC;EACnD,CAAC;EAED,GAAG,iDAAiD,YAAY;GAC9D,MAAM,WAAW,MAAM,KAAK;GAC5B,OAAO,SAAS,SAAS,QAAQ,MAAM,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,KAAK,QAAQ,MAAM,OAAO;GAChF,OAAO,SAAS,SAAS,QAAQ,OAAO,CAAC,CAAC,CAAC,SAAS;GACpD,OAAO,SAAS,SAAS,WAAW,CAAC,CAAC,CAAC,SAAS;GAChD,OAAO,SAAS,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS;EACzC,CAAC;EAED,GAAG,4CAA4C,YAAY;GACzD,MAAM,UAAU,MAAM,KAAK,EAAA,CAAG,OAAO,EAAE,YAAY,kBAAkB,CAAC;GACtE,OAAO,OAAO,OAAO,UAAU,CAAC,CAAC,KAAK,UAAU;GAChD,OAAO,OAAO,OAAO,YAAY,CAAC,CAAC,KAAK,UAAU;EACpD,CAAC;CACH,CAAC;AACH"}
|
|
@@ -4,10 +4,16 @@ import.meta.url;
|
|
|
4
4
|
import { clampListLimit } from "../adapter/database.mjs";
|
|
5
5
|
import { fakeSchema } from "./fake-tables.mjs";
|
|
6
6
|
import { orderRows, whereMatches } from "./sql-chunks.mjs";
|
|
7
|
+
import { getTableName } from "drizzle-orm";
|
|
7
8
|
//#region src/test-helpers/fake-database.ts
|
|
8
9
|
function withoutUndefined(values) {
|
|
9
10
|
return Object.fromEntries(Object.entries(values).filter((pair) => pair[1] !== void 0));
|
|
10
11
|
}
|
|
12
|
+
/** Column defaults real drivers apply on insert (the fake has no DDL). */
|
|
13
|
+
const INSERT_DEFAULTS = {
|
|
14
|
+
snapshots: { browser: "chromium" },
|
|
15
|
+
baselines: { browser: "chromium" }
|
|
16
|
+
};
|
|
11
17
|
/** Create an in-memory database adapter for capture pipeline tests. */
|
|
12
18
|
function makeDatabase() {
|
|
13
19
|
const store = /* @__PURE__ */ new Map();
|
|
@@ -20,8 +26,12 @@ function makeDatabase() {
|
|
|
20
26
|
return rowMap;
|
|
21
27
|
};
|
|
22
28
|
const insertRow = async (table, values) => {
|
|
23
|
-
const row =
|
|
29
|
+
const row = {
|
|
30
|
+
...INSERT_DEFAULTS[getTableName(table)],
|
|
31
|
+
...withoutUndefined(values)
|
|
32
|
+
};
|
|
24
33
|
const key = row["id"] ?? row["hash"];
|
|
34
|
+
if (rowsOf(table).has(key)) throw new Error(`UNIQUE constraint failed: duplicate key ${key}`);
|
|
25
35
|
rowsOf(table).set(key, row);
|
|
26
36
|
return row;
|
|
27
37
|
};
|
|
@@ -47,7 +57,9 @@ function makeDatabase() {
|
|
|
47
57
|
current = current.filter((row) => whereMatches(where, row, table));
|
|
48
58
|
}
|
|
49
59
|
if (opts.orderBy) current = orderRows(current, opts.orderBy, table);
|
|
50
|
-
|
|
60
|
+
const start = opts.offset ?? 0;
|
|
61
|
+
if (opts.limit !== void 0) current = current.slice(start, start + (clampListLimit(opts.limit) ?? 0));
|
|
62
|
+
else if (start > 0) current = current.slice(start);
|
|
51
63
|
return current;
|
|
52
64
|
};
|
|
53
65
|
const countRows = async (table, where) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fake-database.mjs","names":[],"sources":["../../src/test-helpers/fake-database.ts"],"sourcesContent":["import type { SQL, Table } from \"drizzle-orm\";\nimport type { DatabaseAdapter, ListOptions, TxStore } from \"../adapters/database.ts\";\nimport { clampListLimit } from \"../adapters/database.ts\";\nimport { fakeSchema } from \"./fake-tables.ts\";\nimport { orderRows, whereMatches } from \"./sql-chunks.ts\";\n\nfunction withoutUndefined(values: unknown): Record<string, unknown> {\n return Object.fromEntries(\n Object.entries(values as Record<string, unknown>).filter((pair) => pair[1] !== undefined),\n );\n}\n\n// The in-memory fake back-fills Drizzle's inferred row types from raw maps\n// Without a driver, so the casts and await-free `async` methods are unavoidable.\n/* eslint-disable require-await, no-unnecessary-type-assertion, no-unnecessary-type-parameters, non-nullable-type-assertion-style */\n/** Create an in-memory database adapter for capture pipeline tests. */\nexport function makeDatabase(): { db: DatabaseAdapter } {\n const store = new Map<Table, Map<string, unknown>>();\n\n const rowsOf = (table: Table): Map<string, unknown> => {\n let rowMap = store.get(table);\n if (!rowMap) {\n rowMap = new Map();\n store.set(table, rowMap);\n }\n return rowMap;\n };\n\n const insertRow = async <T extends Table>(\n table: T,\n values: T[\"$inferInsert\"],\n ): Promise<T[\"$inferSelect\"]> => {\n const row = withoutUndefined(values);\n const key = (row[\"id\"] ?? row[\"hash\"]) as string;\n rowsOf(table).set(key, row);\n return row as T[\"$inferSelect\"];\n };\n\n const updateRow = async <T extends Table>(\n table: T,\n id: string,\n values: Partial<T[\"$inferInsert\"]>,\n ): Promise<T[\"$inferSelect\"]> => {\n const current = rowsOf(table).get(id) as Record<string, unknown> | undefined;\n if (current === undefined) {\n throw new Error(\"row not found\");\n }\n const merged = withoutUndefined({ ...current, ...values });\n rowsOf(table).set(id, merged);\n return merged as T[\"$inferSelect\"];\n };\n\n const getRow = async <T extends Table>(\n table: T,\n id: string,\n ): Promise<T[\"$inferSelect\"] | null> => {\n const found = rowsOf(table).get(id);\n if (found === undefined) {\n return null;\n }\n return found as T[\"$inferSelect\"];\n };\n\n const listRows = async <T extends Table>(\n table: T,\n opts: ListOptions = {},\n ): Promise<T[\"$inferSelect\"][]> => {\n let current = [...rowsOf(table).values()];\n if (opts.where) {\n const { where } = opts;\n current = current.filter((row) => whereMatches(where, row as Record<string, unknown>, table));\n }\n if (opts.orderBy) {\n current = orderRows(current, opts.orderBy, table);\n }\n if (opts.limit !== undefined) {\n current = current.slice(
|
|
1
|
+
{"version":3,"file":"fake-database.mjs","names":[],"sources":["../../src/test-helpers/fake-database.ts"],"sourcesContent":["import { getTableName } from \"drizzle-orm\";\nimport type { SQL, Table } from \"drizzle-orm\";\nimport type { DatabaseAdapter, ListOptions, TxStore } from \"../adapters/database.ts\";\nimport { clampListLimit } from \"../adapters/database.ts\";\nimport { fakeSchema } from \"./fake-tables.ts\";\nimport { orderRows, whereMatches } from \"./sql-chunks.ts\";\n\nfunction withoutUndefined(values: unknown): Record<string, unknown> {\n return Object.fromEntries(\n Object.entries(values as Record<string, unknown>).filter((pair) => pair[1] !== undefined),\n );\n}\n\n/** Column defaults real drivers apply on insert (the fake has no DDL). */\nconst INSERT_DEFAULTS: Record<string, Record<string, unknown>> = {\n snapshots: { browser: \"chromium\" },\n baselines: { browser: \"chromium\" },\n};\n\n// The in-memory fake back-fills Drizzle's inferred row types from raw maps\n// Without a driver, so the casts and await-free `async` methods are unavoidable.\n/* eslint-disable require-await, no-unnecessary-type-assertion, no-unnecessary-type-parameters, non-nullable-type-assertion-style */\n/** Create an in-memory database adapter for capture pipeline tests. */\nexport function makeDatabase(): { db: DatabaseAdapter } {\n const store = new Map<Table, Map<string, unknown>>();\n\n const rowsOf = (table: Table): Map<string, unknown> => {\n let rowMap = store.get(table);\n if (!rowMap) {\n rowMap = new Map();\n store.set(table, rowMap);\n }\n return rowMap;\n };\n\n const insertRow = async <T extends Table>(\n table: T,\n values: T[\"$inferInsert\"],\n ): Promise<T[\"$inferSelect\"]> => {\n const row = { ...INSERT_DEFAULTS[getTableName(table)], ...withoutUndefined(values) };\n const key = (row[\"id\"] ?? row[\"hash\"]) as string;\n if (rowsOf(table).has(key)) {\n throw new Error(`UNIQUE constraint failed: duplicate key ${key}`);\n }\n rowsOf(table).set(key, row);\n return row as T[\"$inferSelect\"];\n };\n\n const updateRow = async <T extends Table>(\n table: T,\n id: string,\n values: Partial<T[\"$inferInsert\"]>,\n ): Promise<T[\"$inferSelect\"]> => {\n const current = rowsOf(table).get(id) as Record<string, unknown> | undefined;\n if (current === undefined) {\n throw new Error(\"row not found\");\n }\n const merged = withoutUndefined({ ...current, ...values });\n rowsOf(table).set(id, merged);\n return merged as T[\"$inferSelect\"];\n };\n\n const getRow = async <T extends Table>(\n table: T,\n id: string,\n ): Promise<T[\"$inferSelect\"] | null> => {\n const found = rowsOf(table).get(id);\n if (found === undefined) {\n return null;\n }\n return found as T[\"$inferSelect\"];\n };\n\n const listRows = async <T extends Table>(\n table: T,\n opts: ListOptions = {},\n ): Promise<T[\"$inferSelect\"][]> => {\n let current = [...rowsOf(table).values()];\n if (opts.where) {\n const { where } = opts;\n current = current.filter((row) => whereMatches(where, row as Record<string, unknown>, table));\n }\n if (opts.orderBy) {\n current = orderRows(current, opts.orderBy, table);\n }\n const start = opts.offset ?? 0;\n if (opts.limit !== undefined) {\n current = current.slice(start, start + (clampListLimit(opts.limit) ?? 0));\n } else if (start > 0) {\n current = current.slice(start);\n }\n return current as T[\"$inferSelect\"][];\n };\n\n const countRows = async (table: Table, where?: SQL): Promise<number> => {\n const matching = await listRows(table, where ? { where } : {});\n return matching.length;\n };\n\n const transactRows = async <R>(fn: (tx: TxStore) => Promise<R>): Promise<R> => {\n const snapshot = new Map<Table, Map<string, unknown>>();\n for (const [table, rows] of store) {\n snapshot.set(\n table,\n new Map([...rows].map(([id, row]) => [id, { ...(row as Record<string, unknown>) }])),\n );\n }\n const tx: TxStore = {\n insert: insertRow,\n update: updateRow,\n get: getRow,\n remove: async (table, id) => {\n rowsOf(table).delete(id);\n },\n list: listRows,\n count: countRows,\n };\n try {\n return await fn(tx);\n } catch (error) {\n store.clear();\n for (const [table, rows] of snapshot) {\n store.set(table, rows);\n }\n throw error;\n }\n };\n\n const db: DatabaseAdapter = {\n metadata: { name: \"Fake Database\", version: \"0.0.0\", kind: \"memory\", category: \"database\" },\n tables: fakeSchema,\n insert: insertRow,\n update: updateRow,\n get: getRow,\n remove: async (table, id) => {\n rowsOf(table).delete(id);\n },\n list: listRows,\n count: countRows,\n transact: transactRows,\n all: async (_query: SQL) => {\n const results: Record<string, unknown>[] = [];\n for (const rows of store.values()) {\n for (const row of rows.values()) {\n results.push(row as Record<string, unknown>);\n }\n }\n return results as never[];\n },\n };\n return { db };\n}\n/* eslint-enable require-await, no-unnecessary-type-assertion, no-unnecessary-type-parameters, non-nullable-type-assertion-style */\n"],"mappings":";;;;;;;;AAOA,SAAS,iBAAiB,QAA0C;CAClE,OAAO,OAAO,YACZ,OAAO,QAAQ,MAAiC,CAAC,CAAC,QAAQ,SAAS,KAAK,OAAO,KAAA,CAAS,CAC1F;AACF;;AAGA,MAAM,kBAA2D;CAC/D,WAAW,EAAE,SAAS,WAAW;CACjC,WAAW,EAAE,SAAS,WAAW;AACnC;;AAMA,SAAgB,eAAwC;CACtD,MAAM,wBAAQ,IAAI,IAAiC;CAEnD,MAAM,UAAU,UAAuC;EACrD,IAAI,SAAS,MAAM,IAAI,KAAK;EAC5B,IAAI,CAAC,QAAQ;GACX,yBAAS,IAAI,IAAI;GACjB,MAAM,IAAI,OAAO,MAAM;EACzB;EACA,OAAO;CACT;CAEA,MAAM,YAAY,OAChB,OACA,WAC+B;EAC/B,MAAM,MAAM;GAAE,GAAG,gBAAgB,aAAa,KAAK;GAAI,GAAG,iBAAiB,MAAM;EAAE;EACnF,MAAM,MAAO,IAAI,SAAS,IAAI;EAC9B,IAAI,OAAO,KAAK,CAAC,CAAC,IAAI,GAAG,GACvB,MAAM,IAAI,MAAM,2CAA2C,KAAK;EAElE,OAAO,KAAK,CAAC,CAAC,IAAI,KAAK,GAAG;EAC1B,OAAO;CACT;CAEA,MAAM,YAAY,OAChB,OACA,IACA,WAC+B;EAC/B,MAAM,UAAU,OAAO,KAAK,CAAC,CAAC,IAAI,EAAE;EACpC,IAAI,YAAY,KAAA,GACd,MAAM,IAAI,MAAM,eAAe;EAEjC,MAAM,SAAS,iBAAiB;GAAE,GAAG;GAAS,GAAG;EAAO,CAAC;EACzD,OAAO,KAAK,CAAC,CAAC,IAAI,IAAI,MAAM;EAC5B,OAAO;CACT;CAEA,MAAM,SAAS,OACb,OACA,OACsC;EACtC,MAAM,QAAQ,OAAO,KAAK,CAAC,CAAC,IAAI,EAAE;EAClC,IAAI,UAAU,KAAA,GACZ,OAAO;EAET,OAAO;CACT;CAEA,MAAM,WAAW,OACf,OACA,OAAoB,CAAC,MACY;EACjC,IAAI,UAAU,CAAC,GAAG,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC;EACxC,IAAI,KAAK,OAAO;GACd,MAAM,EAAE,UAAU;GAClB,UAAU,QAAQ,QAAQ,QAAQ,aAAa,OAAO,KAAgC,KAAK,CAAC;EAC9F;EACA,IAAI,KAAK,SACP,UAAU,UAAU,SAAS,KAAK,SAAS,KAAK;EAElD,MAAM,QAAQ,KAAK,UAAU;EAC7B,IAAI,KAAK,UAAU,KAAA,GACjB,UAAU,QAAQ,MAAM,OAAO,SAAS,eAAe,KAAK,KAAK,KAAK,EAAE;OACnE,IAAI,QAAQ,GACjB,UAAU,QAAQ,MAAM,KAAK;EAE/B,OAAO;CACT;CAEA,MAAM,YAAY,OAAO,OAAc,UAAiC;EAEtE,QAAO,MADgB,SAAS,OAAO,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAC,EAAA,CAC7C;CAClB;CAEA,MAAM,eAAe,OAAU,OAAgD;EAC7E,MAAM,2BAAW,IAAI,IAAiC;EACtD,KAAK,MAAM,CAAC,OAAO,SAAS,OAC1B,SAAS,IACP,OACA,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE,GAAI,IAAgC,CAAC,CAAC,CAAC,CACrF;EAEF,MAAM,KAAc;GAClB,QAAQ;GACR,QAAQ;GACR,KAAK;GACL,QAAQ,OAAO,OAAO,OAAO;IAC3B,OAAO,KAAK,CAAC,CAAC,OAAO,EAAE;GACzB;GACA,MAAM;GACN,OAAO;EACT;EACA,IAAI;GACF,OAAO,MAAM,GAAG,EAAE;EACpB,SAAS,OAAO;GACd,MAAM,MAAM;GACZ,KAAK,MAAM,CAAC,OAAO,SAAS,UAC1B,MAAM,IAAI,OAAO,IAAI;GAEvB,MAAM;EACR;CACF;CAwBA,OAAO,EAAE,IAAA;EArBP,UAAU;GAAE,MAAM;GAAiB,SAAS;GAAS,MAAM;GAAU,UAAU;EAAW;EAC1F,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,KAAK;EACL,QAAQ,OAAO,OAAO,OAAO;GAC3B,OAAO,KAAK,CAAC,CAAC,OAAO,EAAE;EACzB;EACA,MAAM;EACN,OAAO;EACP,UAAU;EACV,KAAK,OAAO,WAAgB;GAC1B,MAAM,UAAqC,CAAC;GAC5C,KAAK,MAAM,QAAQ,MAAM,OAAO,GAC9B,KAAK,MAAM,OAAO,KAAK,OAAO,GAC5B,QAAQ,KAAK,GAA8B;GAG/C,OAAO;EACT;CAEQ,EAAE;AACd"}
|