@storyshelf/core 0.6.2 → 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/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 -23
- 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,85 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { Logger } from "../logger.mjs";
|
|
4
|
+
import { OAuthClient } from "./oauth.mjs";
|
|
5
|
+
import { Adapter, AdapterMetadata } from "./metadata.mjs";
|
|
6
|
+
import { Buffer } from "node:buffer";
|
|
7
|
+
//#region src/adapters/design.d.ts
|
|
8
|
+
/** Design-provider metadata: identity plus the copy the settings UI shows for its credential. */
|
|
9
|
+
interface DesignAdapterMetadata extends AdapterMetadata {
|
|
10
|
+
readonly category: "design";
|
|
11
|
+
/** Credential field label, e.g. "Figma access token". */
|
|
12
|
+
readonly credentialLabel: string;
|
|
13
|
+
/** Help text under the credential field (scopes needed, expiry). */
|
|
14
|
+
readonly credentialHelp: string;
|
|
15
|
+
/** Placeholder for the credential input, e.g. "figd_…". */
|
|
16
|
+
readonly credentialPlaceholder?: string;
|
|
17
|
+
/** Example of a link this provider accepts, shown on rejection. */
|
|
18
|
+
readonly urlHint: string;
|
|
19
|
+
/** Longest lifetime of a credential, so the UI can count down to rotation. */
|
|
20
|
+
readonly credentialMaxAgeDays?: number;
|
|
21
|
+
}
|
|
22
|
+
/** A parsed design link. */
|
|
23
|
+
interface DesignRef {
|
|
24
|
+
/** Provider file identifier. */
|
|
25
|
+
fileKey: string;
|
|
26
|
+
/** Node id inside the file, or null when the link targets the whole file. */
|
|
27
|
+
nodeId: string | null;
|
|
28
|
+
/** URL to open: the pasted link without credentials or fragment. */
|
|
29
|
+
url: string;
|
|
30
|
+
}
|
|
31
|
+
/** Outcome of a metadata fetch. `error` is transient (outage/rate limit) and never persisted. */
|
|
32
|
+
type DesignState = "ok" | "deleted" | "unauthorized" | "forbidden" | "error";
|
|
33
|
+
/** Metadata of a design file or node. */
|
|
34
|
+
interface DesignMeta {
|
|
35
|
+
state: DesignState;
|
|
36
|
+
name: string | null;
|
|
37
|
+
version: string | null;
|
|
38
|
+
lastModified: string | null;
|
|
39
|
+
}
|
|
40
|
+
/** Per-call options: a signal cancelling the whole call (page-render budget) plus a logger. */
|
|
41
|
+
interface DesignCallOptions {
|
|
42
|
+
logger?: Logger;
|
|
43
|
+
signal?: AbortSignal;
|
|
44
|
+
}
|
|
45
|
+
/** How a stored credential authenticates: a pasted personal token or a user's OAuth access token. */
|
|
46
|
+
type DesignAuthType = "token" | "oauth";
|
|
47
|
+
/** Descriptor — registered at startup, parses links and binds a credential. */
|
|
48
|
+
interface DesignProvider extends Adapter<DesignAdapterMetadata> {
|
|
49
|
+
/** Parse a pasted link; null when it is not one of this provider's links. */
|
|
50
|
+
parseUrl(raw: string): DesignRef | null;
|
|
51
|
+
/** Create a client bound to a decrypted credential (`authType` defaults to a personal token). */
|
|
52
|
+
create(opts: {
|
|
53
|
+
credential: string;
|
|
54
|
+
authType?: DesignAuthType;
|
|
55
|
+
logger?: Logger;
|
|
56
|
+
}): DesignClient;
|
|
57
|
+
/** Present only when the operator configured OAuth for this provider. */
|
|
58
|
+
readonly oauth?: OAuthClient;
|
|
59
|
+
}
|
|
60
|
+
/** Runtime — bound to a credential, talks to the vendor API. */
|
|
61
|
+
interface DesignClient {
|
|
62
|
+
/**
|
|
63
|
+
* Metadata for several refs of one file, keyed by node id (`""` = whole file).
|
|
64
|
+
* API failures map to a {@link DesignState} per ref rather than throwing.
|
|
65
|
+
*/
|
|
66
|
+
fetchMetas(fileKey: string, refs: readonly DesignRef[], options?: DesignCallOptions): Promise<Map<string, DesignMeta>>;
|
|
67
|
+
/**
|
|
68
|
+
* PNG renders of several nodes of one file, keyed by node id. Nodes the vendor
|
|
69
|
+
* cannot render are omitted; throws when the render API call itself fails.
|
|
70
|
+
*/
|
|
71
|
+
fetchRenders(fileKey: string, nodeIds: readonly string[], options?: DesignCallOptions): Promise<Map<string, Buffer>>;
|
|
72
|
+
}
|
|
73
|
+
/** Thrown when a design link is not accepted by any configured provider. */
|
|
74
|
+
declare class InvalidDesignUrlError extends Error {
|
|
75
|
+
readonly value: string;
|
|
76
|
+
constructor(value: string, hint?: string);
|
|
77
|
+
}
|
|
78
|
+
/** First provider that accepts the link, with its parsed ref. */
|
|
79
|
+
declare function parseDesignUrl(providers: readonly DesignProvider[], raw: string): {
|
|
80
|
+
provider: DesignProvider;
|
|
81
|
+
ref: DesignRef;
|
|
82
|
+
} | null;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { DesignAdapterMetadata, DesignAuthType, DesignCallOptions, DesignClient, DesignMeta, DesignProvider, DesignRef, DesignState, InvalidDesignUrlError, parseDesignUrl };
|
|
85
|
+
//# sourceMappingURL=design.d.mts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/adapters/design.ts
|
|
5
|
+
/** Thrown when a design link is not accepted by any configured provider. */
|
|
6
|
+
var InvalidDesignUrlError = class extends Error {
|
|
7
|
+
value;
|
|
8
|
+
constructor(value, hint) {
|
|
9
|
+
super(hint ? `Enter a supported design link, e.g. ${hint}` : "No design provider is configured");
|
|
10
|
+
this.value = value;
|
|
11
|
+
this.name = "InvalidDesignUrlError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/** First provider that accepts the link, with its parsed ref. */
|
|
15
|
+
function parseDesignUrl(providers, raw) {
|
|
16
|
+
for (const provider of providers) {
|
|
17
|
+
const ref = provider.parseUrl(raw);
|
|
18
|
+
if (ref) return {
|
|
19
|
+
provider,
|
|
20
|
+
ref
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { InvalidDesignUrlError, parseDesignUrl };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=design.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design.mjs","names":[],"sources":["../../src/adapters/design.ts"],"sourcesContent":["/**\n * Design-provider adapter interface: link validation, file/node metadata and\n * rendered previews from a design tool (Figma, …). Core owns link resolution,\n * the metadata/render cache and credential storage; a provider owns only the\n * vendor specifics below.\n */\nimport type { Buffer } from \"node:buffer\";\nimport type { Logger } from \"../logger.ts\";\nimport type { Adapter, AdapterMetadata } from \"./metadata.ts\";\nimport type { OAuthClient } from \"./oauth.ts\";\n\n/** Design-provider metadata: identity plus the copy the settings UI shows for its credential. */\nexport interface DesignAdapterMetadata extends AdapterMetadata {\n readonly category: \"design\";\n /** Credential field label, e.g. \"Figma access token\". */\n readonly credentialLabel: string;\n /** Help text under the credential field (scopes needed, expiry). */\n readonly credentialHelp: string;\n /** Placeholder for the credential input, e.g. \"figd_…\". */\n readonly credentialPlaceholder?: string;\n /** Example of a link this provider accepts, shown on rejection. */\n readonly urlHint: string;\n /** Longest lifetime of a credential, so the UI can count down to rotation. */\n readonly credentialMaxAgeDays?: number;\n}\n\n/** A parsed design link. */\nexport interface DesignRef {\n /** Provider file identifier. */\n fileKey: string;\n /** Node id inside the file, or null when the link targets the whole file. */\n nodeId: string | null;\n /** URL to open: the pasted link without credentials or fragment. */\n url: string;\n}\n\n/** Outcome of a metadata fetch. `error` is transient (outage/rate limit) and never persisted. */\nexport type DesignState = \"ok\" | \"deleted\" | \"unauthorized\" | \"forbidden\" | \"error\";\n\n/** Metadata of a design file or node. */\nexport interface DesignMeta {\n state: DesignState;\n name: string | null;\n version: string | null;\n lastModified: string | null;\n}\n\n/** Per-call options: a signal cancelling the whole call (page-render budget) plus a logger. */\nexport interface DesignCallOptions {\n logger?: Logger;\n signal?: AbortSignal;\n}\n\n/** How a stored credential authenticates: a pasted personal token or a user's OAuth access token. */\nexport type DesignAuthType = \"token\" | \"oauth\";\n\n/** Descriptor — registered at startup, parses links and binds a credential. */\nexport interface DesignProvider extends Adapter<DesignAdapterMetadata> {\n /** Parse a pasted link; null when it is not one of this provider's links. */\n parseUrl(raw: string): DesignRef | null;\n /** Create a client bound to a decrypted credential (`authType` defaults to a personal token). */\n create(opts: { credential: string; authType?: DesignAuthType; logger?: Logger }): DesignClient;\n /** Present only when the operator configured OAuth for this provider. */\n readonly oauth?: OAuthClient;\n}\n\n/** Runtime — bound to a credential, talks to the vendor API. */\nexport interface DesignClient {\n /**\n * Metadata for several refs of one file, keyed by node id (`\"\"` = whole file).\n * API failures map to a {@link DesignState} per ref rather than throwing.\n */\n fetchMetas(\n fileKey: string,\n refs: readonly DesignRef[],\n options?: DesignCallOptions,\n ): Promise<Map<string, DesignMeta>>;\n /**\n * PNG renders of several nodes of one file, keyed by node id. Nodes the vendor\n * cannot render are omitted; throws when the render API call itself fails.\n */\n fetchRenders(\n fileKey: string,\n nodeIds: readonly string[],\n options?: DesignCallOptions,\n ): Promise<Map<string, Buffer>>;\n}\n\n/** Thrown when a design link is not accepted by any configured provider. */\nexport class InvalidDesignUrlError extends Error {\n readonly value: string;\n\n constructor(value: string, hint?: string) {\n super(\n hint ? `Enter a supported design link, e.g. ${hint}` : \"No design provider is configured\",\n );\n this.value = value;\n this.name = \"InvalidDesignUrlError\";\n }\n}\n\n/** First provider that accepts the link, with its parsed ref. */\nexport function parseDesignUrl(\n providers: readonly DesignProvider[],\n raw: string,\n): { provider: DesignProvider; ref: DesignRef } | null {\n for (const provider of providers) {\n const ref = provider.parseUrl(raw);\n if (ref) return { provider, ref };\n }\n return null;\n}\n"],"mappings":";;;;;AAyFA,IAAa,wBAAb,cAA2C,MAAM;CAC/C;CAEA,YAAY,OAAe,MAAe;EACxC,MACE,OAAO,uCAAuC,SAAS,kCACzD;EACA,KAAK,QAAQ;EACb,KAAK,OAAO;CACd;AACF;;AAGA,SAAgB,eACd,WACA,KACqD;CACrD,KAAK,MAAM,YAAY,WAAW;EAChC,MAAM,MAAM,SAAS,SAAS,GAAG;EACjC,IAAI,KAAK,OAAO;GAAE;GAAU;EAAI;CAClC;CACA,OAAO;AACT"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import __tsdown_shims_path from 'node:path';
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { ShelfConfig } from "../config.mjs";
|
|
4
3
|
import { Logger } from "../logger.mjs";
|
|
5
|
-
import {
|
|
4
|
+
import { ShelfConfig } from "../config.mjs";
|
|
6
5
|
//#region src/adapters/metadata.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Adapter family — which concern an adapter supplies.
|
|
@@ -11,7 +10,7 @@ import { z } from "zod";
|
|
|
11
10
|
* `category` tells a reader which slot the adapter fills without knowing
|
|
12
11
|
* which adapter instance supplied the metadata.
|
|
13
12
|
*/
|
|
14
|
-
type AdapterCategory = "database" | "storage" | "capture-runner" | "capture-queue" | "
|
|
13
|
+
type AdapterCategory = "database" | "storage" | "capture-runner" | "capture-queue" | "design" | "notifier";
|
|
15
14
|
/** Common adapter identity — every adapter instance exposes this. */
|
|
16
15
|
interface AdapterMetadata {
|
|
17
16
|
/** Human label for UI/logs. */
|
|
@@ -25,12 +24,6 @@ interface AdapterMetadata {
|
|
|
25
24
|
/** Adapter family — which concern this adapter supplies. */
|
|
26
25
|
readonly category: AdapterCategory;
|
|
27
26
|
}
|
|
28
|
-
/** Git-specific metadata extension (adds logo + validation schema). */
|
|
29
|
-
interface GitAdapterMetadata extends AdapterMetadata {
|
|
30
|
-
readonly category: "git-host";
|
|
31
|
-
readonly logo?: string;
|
|
32
|
-
readonly schema: z.ZodType;
|
|
33
|
-
}
|
|
34
27
|
/** Context passed to an adapter's `setup` on server startup. */
|
|
35
28
|
interface AdapterSetupContext {
|
|
36
29
|
/** Resolved shelf configuration (scratchDir, secret, …). Never log the secret. */
|
|
@@ -85,5 +78,5 @@ interface Adapter<Extra extends object = Record<string, unknown>> {
|
|
|
85
78
|
setLogger?(logger: Logger): void;
|
|
86
79
|
}
|
|
87
80
|
//#endregion
|
|
88
|
-
export { Adapter, AdapterCategory, AdapterHealth, AdapterLifecycle, AdapterMetadata, AdapterSetupContext
|
|
81
|
+
export { Adapter, AdapterCategory, AdapterHealth, AdapterLifecycle, AdapterMetadata, AdapterSetupContext };
|
|
89
82
|
//# sourceMappingURL=metadata.d.mts.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import __tsdown_shims_path from 'node:path';
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { ChannelToggles, FormattedNotification, NotificationBrand, NotificationChannel, NotificationEvent, SystemEventName, SystemNotification } from "../adapters/notifier/types.mjs";
|
|
4
|
-
import { NotifierAdapter, NotifierMetadata, NotifierProvider } from "../adapters/notifier/provider.mjs";
|
|
3
|
+
import { ChannelOutcome, ChannelToggles, FormattedNotification, NotificationBrand, NotificationChannel, NotificationEvent, NotifierState, NotifierStateTarget, StateAnnotation, SystemEventName, SystemNotification } from "../adapters/notifier/types.mjs";
|
|
4
|
+
import { MessageNotifierAdapter, MessageNotifierMetadata, MessageNotifierProvider, NotifierAdapter, NotifierDelivery, NotifierMetadata, NotifierProvider, SetStateInput, StateNotifierAdapter, StateNotifierMetadata, StateNotifierProvider, isStateProvider } from "../adapters/notifier/provider.mjs";
|
|
5
5
|
import { emitNotifications, emitSystemNotification } from "../adapters/notifier/events.mjs";
|
|
6
|
+
import { BuildStateBuild, BuildStateChange, BuildStateFlags, BuildStateInput, BuildStateSet, DesiredComment, DesiredStatus, MAX_ANNOTATIONS, PublishingState, StatusName, statusesForBuild } from "../adapters/notifier/build-state.mjs";
|
|
7
|
+
import { buildCommentMarkdown } from "../adapters/notifier/build-comment.mjs";
|
|
8
|
+
import { DEFAULT_STATUS_PREFIX, channelPrefix, writeBuildState } from "../adapters/notifier/state.mjs";
|
|
6
9
|
import { formatNotification, formatSystemNotification } from "../adapters/notifier/format.mjs";
|
|
7
|
-
export { type ChannelToggles, type FormattedNotification, type NotificationBrand, type NotificationChannel, type NotificationEvent, type NotifierAdapter, type NotifierMetadata, type NotifierProvider, type SystemEventName, type SystemNotification, emitNotifications, emitSystemNotification, formatNotification, formatSystemNotification };
|
|
10
|
+
export { type BuildStateBuild, type BuildStateChange, type BuildStateFlags, type BuildStateInput, type BuildStateSet, type ChannelOutcome, type ChannelToggles, DEFAULT_STATUS_PREFIX, type DesiredComment, type DesiredStatus, type FormattedNotification, MAX_ANNOTATIONS, type MessageNotifierAdapter, type MessageNotifierMetadata, type MessageNotifierProvider, type NotificationBrand, type NotificationChannel, type NotificationEvent, type NotifierAdapter, type NotifierDelivery, type NotifierMetadata, type NotifierProvider, type NotifierState, type NotifierStateTarget, type PublishingState, type SetStateInput, type StateAnnotation, type StateNotifierAdapter, type StateNotifierMetadata, type StateNotifierProvider, type StatusName, type SystemEventName, type SystemNotification, buildCommentMarkdown, channelPrefix, emitNotifications, emitSystemNotification, formatNotification, formatSystemNotification, isStateProvider, statusesForBuild, writeBuildState };
|
|
@@ -2,5 +2,9 @@ import "node:path";
|
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { formatNotification, formatSystemNotification } from "../adapters/notifier/format.mjs";
|
|
5
|
+
import { isStateProvider } from "../adapters/notifier/provider.mjs";
|
|
5
6
|
import { emitNotifications, emitSystemNotification } from "../adapters/notifier/events.mjs";
|
|
6
|
-
|
|
7
|
+
import { buildCommentMarkdown } from "../adapters/notifier/build-comment.mjs";
|
|
8
|
+
import { MAX_ANNOTATIONS, statusesForBuild } from "../adapters/notifier/build-state.mjs";
|
|
9
|
+
import { DEFAULT_STATUS_PREFIX, channelPrefix, writeBuildState } from "../adapters/notifier/state.mjs";
|
|
10
|
+
export { DEFAULT_STATUS_PREFIX, MAX_ANNOTATIONS, buildCommentMarkdown, channelPrefix, emitNotifications, emitSystemNotification, formatNotification, formatSystemNotification, isStateProvider, statusesForBuild, writeBuildState };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/adapters/oauth.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Service-neutral OAuth 2 contract for "connect your own account" flows. Any
|
|
6
|
+
* adapter that talks to a third party on behalf of a user (design tools,
|
|
7
|
+
* issue trackers, …) can expose an {@link OAuthClient}; the app owns the
|
|
8
|
+
* redirect/callback routes and core owns token storage and refresh.
|
|
9
|
+
*/
|
|
10
|
+
/** Tokens returned by an authorization-code exchange or a refresh. */
|
|
11
|
+
interface OAuthTokens {
|
|
12
|
+
accessToken: string;
|
|
13
|
+
/** Absent when the service keeps the previous refresh token valid. */
|
|
14
|
+
refreshToken?: string | null;
|
|
15
|
+
/** ISO time the access token stops working, or null when it never expires. */
|
|
16
|
+
expiresAt: string | null;
|
|
17
|
+
}
|
|
18
|
+
/** Authorization-code grant against one service, with the operator's client credentials held inside. */
|
|
19
|
+
interface OAuthClient {
|
|
20
|
+
/** Consent-screen URL to send the user to. */
|
|
21
|
+
authorizeUrl(opts: {
|
|
22
|
+
state: string;
|
|
23
|
+
redirectUri: string;
|
|
24
|
+
}): string;
|
|
25
|
+
/** Exchange the callback `code` for tokens. */
|
|
26
|
+
exchangeCode(opts: {
|
|
27
|
+
code: string;
|
|
28
|
+
redirectUri: string;
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
}): Promise<OAuthTokens>;
|
|
31
|
+
/** Mint a new access token from a refresh token. */
|
|
32
|
+
refresh(opts: {
|
|
33
|
+
refreshToken: string;
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
}): Promise<OAuthTokens>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Anything a user can connect an account to. Structurally satisfied by adapters
|
|
39
|
+
* (`metadata.kind` identifies the service), so registering one is just
|
|
40
|
+
* listing its adapter.
|
|
41
|
+
*/
|
|
42
|
+
interface OAuthConnectable {
|
|
43
|
+
readonly metadata: {
|
|
44
|
+
readonly kind: string;
|
|
45
|
+
readonly name: string;
|
|
46
|
+
};
|
|
47
|
+
/** Present only when the operator configured OAuth for the service. */
|
|
48
|
+
readonly oauth?: OAuthClient;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { OAuthClient, OAuthConnectable, OAuthTokens };
|
|
52
|
+
//# sourceMappingURL=oauth.d.mts.map
|
package/dist/adapter/setup.d.mts
CHANGED
|
@@ -2,22 +2,21 @@ import __tsdown_shims_path from 'node:path';
|
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
3
|
import { CaptureRunner } from "./capture-runner.mjs";
|
|
4
4
|
import { DatabaseAdapter } from "./database.mjs";
|
|
5
|
+
import { DesignProvider } from "./design.mjs";
|
|
5
6
|
import { EmailSender } from "./email-sender.mjs";
|
|
6
|
-
import { GitHostProvider } from "./git-host.mjs";
|
|
7
7
|
import { NotifierProvider } from "../adapters/notifier/provider.mjs";
|
|
8
8
|
import { StorageAdapter } from "./storage.mjs";
|
|
9
9
|
import { AdapterSetupContext } from "./metadata.mjs";
|
|
10
|
-
import { CaptureQueue } from "./capture-queue.mjs";
|
|
11
10
|
import { bindAdapterLoggers, collectSetups, collectTeardowns, runAdapterSetups, runAdapterTeardowns } from "../adapters/setup-runner.mjs";
|
|
12
11
|
import { validateAdapter, validateAdapterSources, validateAuth, validateBootAssembly } from "../adapters/validate.mjs";
|
|
12
|
+
import { adapterSourcesOf } from "../adapters/sources.mjs";
|
|
13
13
|
//#region src/adapters/setup.d.ts
|
|
14
14
|
/** Adapters that can take part in lifecycle runs. */
|
|
15
15
|
interface AdapterSetupSources {
|
|
16
16
|
database: DatabaseAdapter;
|
|
17
17
|
storage: StorageAdapter;
|
|
18
18
|
captureRunner?: CaptureRunner;
|
|
19
|
-
|
|
20
|
-
gitHosts?: GitHostProvider[];
|
|
19
|
+
design?: DesignProvider[];
|
|
21
20
|
notifiers?: NotifierProvider[];
|
|
22
21
|
emailSender?: EmailSender;
|
|
23
22
|
}
|
|
@@ -57,5 +56,5 @@ declare class AdapterLifecycleError extends Error {
|
|
|
57
56
|
constructor(phase: LifecyclePhase, failures: AdapterSetupFailure[]);
|
|
58
57
|
}
|
|
59
58
|
//#endregion
|
|
60
|
-
export { AdapterLifecycleError, AdapterSetupFailure, AdapterSetupResult, AdapterSetupSources, HookEntry, LifecyclePhase, bindAdapterLoggers, collectSetups, collectTeardowns, runAdapterSetups, runAdapterTeardowns, validateAdapter, validateAdapterSources, validateAuth, validateBootAssembly };
|
|
59
|
+
export { AdapterLifecycleError, AdapterSetupFailure, AdapterSetupResult, AdapterSetupSources, HookEntry, LifecyclePhase, adapterSourcesOf, bindAdapterLoggers, collectSetups, collectTeardowns, runAdapterSetups, runAdapterTeardowns, validateAdapter, validateAdapterSources, validateAuth, validateBootAssembly };
|
|
61
60
|
//# sourceMappingURL=setup.d.mts.map
|
package/dist/adapter/setup.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import "node:url";
|
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { bindAdapterLoggers, collectSetups, collectTeardowns, runAdapterSetups, runAdapterTeardowns } from "../adapters/setup-runner.mjs";
|
|
5
5
|
import { validateAdapter, validateAdapterSources, validateAuth, validateBootAssembly } from "../adapters/validate.mjs";
|
|
6
|
+
import { adapterSourcesOf } from "../adapters/sources.mjs";
|
|
6
7
|
//#region src/adapters/setup.ts
|
|
7
8
|
/**
|
|
8
9
|
* Thrown when an `app.lifecycle.setup()` or `teardown()` run finishes with failures.
|
|
@@ -24,6 +25,6 @@ var AdapterLifecycleError = class extends Error {
|
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
//#endregion
|
|
27
|
-
export { AdapterLifecycleError, bindAdapterLoggers, collectSetups, collectTeardowns, runAdapterSetups, runAdapterTeardowns, validateAdapter, validateAdapterSources, validateAuth, validateBootAssembly };
|
|
28
|
+
export { AdapterLifecycleError, adapterSourcesOf, bindAdapterLoggers, collectSetups, collectTeardowns, runAdapterSetups, runAdapterTeardowns, validateAdapter, validateAdapterSources, validateAuth, validateBootAssembly };
|
|
28
29
|
|
|
29
30
|
//# sourceMappingURL=setup.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.mjs","names":[],"sources":["../../src/adapters/setup.ts"],"sourcesContent":["/**\n * Adapter lifecycle contract: hooks every adapter can expose, plus the\n * settled-result and error types. The runner (`setup-runner.ts`) collects\n * and executes the hooks; `createShelfApp` kicks `setup` eagerly and\n * gates the first request on the shared result. All hooks must be\n * idempotent.\n */\nimport type {
|
|
1
|
+
{"version":3,"file":"setup.mjs","names":[],"sources":["../../src/adapters/setup.ts"],"sourcesContent":["/**\n * Adapter lifecycle contract: hooks every adapter can expose, plus the\n * settled-result and error types. The runner (`setup-runner.ts`) collects\n * and executes the hooks; `createShelfApp` kicks `setup` eagerly and\n * gates the first request on the shared result. All hooks must be\n * idempotent.\n */\nimport type { CaptureRunner } from \"./capture-runner.ts\";\nimport type { DatabaseAdapter } from \"./database.ts\";\nimport type { DesignProvider } from \"./design.ts\";\nimport type { EmailSender } from \"./email-sender.ts\";\nimport type { AdapterSetupContext } from \"./metadata.ts\";\nimport type { NotifierProvider } from \"./notifier/provider.ts\";\nimport type { StorageAdapter } from \"./storage.ts\";\n\n/** Adapters that can take part in lifecycle runs. */\nexport interface AdapterSetupSources {\n database: DatabaseAdapter;\n storage: StorageAdapter;\n captureRunner?: CaptureRunner;\n design?: DesignProvider[];\n notifiers?: NotifierProvider[];\n emailSender?: EmailSender;\n}\n\n/** One collected hook bound to its adapter identity. */\nexport interface HookEntry {\n readonly category: string;\n readonly kind: string;\n readonly name: string;\n readonly run: (ctx: AdapterSetupContext) => Promise<void>;\n}\n\n/** One failed hook, with its adapter identity attached. */\nexport interface AdapterSetupFailure {\n readonly category: string;\n readonly kind: string;\n readonly name: string;\n readonly error: string;\n}\n\n/** Settled outcome of a lifecycle run (never rejects — use `ok`). */\nexport interface AdapterSetupResult {\n readonly ok: boolean;\n readonly failures: AdapterSetupFailure[];\n}\n\n/** Lifecycle phase a run covers. */\nexport type LifecyclePhase = \"setup\" | \"teardown\";\n\n/**\n * Thrown when an `app.lifecycle.setup()` or `teardown()` run finishes with failures.\n *\n * Inspect `phase` to know which hook failed and `failures` for per-adapter\n * diagnostics. The router converts this into a 500 with structured details\n * during health checks.\n */\nexport class AdapterLifecycleError extends Error {\n /** Which lifecycle phase failed (`setup` or `teardown`). */\n readonly phase: LifecyclePhase;\n /** One entry per adapter hook that failed. */\n readonly failures: AdapterSetupFailure[];\n constructor(phase: LifecyclePhase, failures: AdapterSetupFailure[]) {\n super(`Adapter ${phase} failed: ${failures.map((f) => `${f.category}/${f.kind}`).join(\", \")}`);\n this.name = \"AdapterLifecycleError\";\n this.phase = phase;\n this.failures = failures;\n }\n}\n\n/** Collect every `setup` hook from the configured adapters. */\nexport {\n bindAdapterLoggers,\n collectSetups,\n collectTeardowns,\n runAdapterSetups,\n runAdapterTeardowns,\n} from \"./setup-runner.ts\";\n\n/** Boot-time shape validation for third-party adapters. */\nexport {\n validateAdapter,\n validateAdapterSources,\n validateAuth,\n validateBootAssembly,\n} from \"./validate.ts\";\nexport { adapterSourcesOf } from \"./sources.ts\";\n"],"mappings":";;;;;;;;;;;;;;AAyDA,IAAa,wBAAb,cAA2C,MAAM;;CAE/C;;CAEA;CACA,YAAY,OAAuB,UAAiC;EAClE,MAAM,WAAW,MAAM,WAAW,SAAS,KAAK,MAAM,GAAG,EAAE,SAAS,GAAG,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,GAAG;EAC7F,KAAK,OAAO;EACZ,KAAK,QAAQ;EACb,KAAK,WAAW;CAClB;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
import { WebhookModel } from "../models/webhook.mjs";
|
|
5
4
|
import { hmacSha256 } from "../utils/hash.mjs";
|
|
5
|
+
import { WebhookModel } from "../models/webhook.mjs";
|
|
6
6
|
//#region src/adapters/webhook-events.ts
|
|
7
7
|
/** Per-delivery budget: single attempt, no retries (events already fan out). */
|
|
8
8
|
const WEBHOOK_TIMEOUT_MS = 1e4;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { CaptureTarget, RunnerTarget } from "./capture-target.mjs";
|
|
4
|
+
import { AdapterLifecycle } from "../adapter/metadata.mjs";
|
|
5
|
+
//#region src/adapters/capture-target-offers.d.ts
|
|
6
|
+
/** A runner's live target list. */
|
|
7
|
+
interface TargetOffers {
|
|
8
|
+
/** First declared target: what a project with no `browsers` setting resolves to. */
|
|
9
|
+
readonly defaultTarget: CaptureTarget;
|
|
10
|
+
/** The targets with their current status; reads `metadata.targets`. */
|
|
11
|
+
current(): readonly RunnerTarget[];
|
|
12
|
+
/**
|
|
13
|
+
* Wrap `launch` so a target the runner does not offer fails with a {@link TargetLaunchError}, and
|
|
14
|
+
* a launch that fails marks its target unavailable with the launch error as the reason (not a
|
|
15
|
+
* transient one: a remote service that is down stays offered).
|
|
16
|
+
*/
|
|
17
|
+
guard<T, Rest extends unknown[]>(launch: (target: CaptureTarget, ...rest: Rest) => Promise<T>): (target: CaptureTarget, ...rest: Rest) => Promise<T>;
|
|
18
|
+
/** Lifecycle whose `setup` replaces the statuses with what `verify` finds, and `health` reports them. */
|
|
19
|
+
lifecycle(verify: () => Promise<readonly RunnerTarget[]>): AdapterLifecycle;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Offer `declared`, default first. Until verified every target reads as ready, so a runner used
|
|
23
|
+
* without `lifecycle.setup` behaves as before and a failed launch still marks its target.
|
|
24
|
+
*/
|
|
25
|
+
declare function createTargetOffers(declared: readonly RunnerTarget[]): TargetOffers;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { TargetOffers, createTargetOffers };
|
|
28
|
+
//# sourceMappingURL=capture-target-offers.d.mts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { TargetLaunchError } from "./capture-target.mjs";
|
|
5
|
+
//#region src/adapters/capture-target-offers.ts
|
|
6
|
+
/**
|
|
7
|
+
* What a runner offers right now, shared by the runners (ADR 0007): the targets it declared, whether
|
|
8
|
+
* each can render, and the lifecycle that keeps that honest. A launch failure marks its target
|
|
9
|
+
* unavailable from then on.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Offer `declared`, default first. Until verified every target reads as ready, so a runner used
|
|
13
|
+
* without `lifecycle.setup` behaves as before and a failed launch still marks its target.
|
|
14
|
+
*/
|
|
15
|
+
function createTargetOffers(declared) {
|
|
16
|
+
let targets = declared;
|
|
17
|
+
const first = declared[0];
|
|
18
|
+
if (first === void 0) throw new Error("A runner must offer at least one target");
|
|
19
|
+
const fail = (target, reason) => {
|
|
20
|
+
targets = targets.map((entry) => entry.target === target ? {
|
|
21
|
+
...entry,
|
|
22
|
+
status: { unavailable: reason }
|
|
23
|
+
} : entry);
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
defaultTarget: first.target,
|
|
27
|
+
current: () => targets,
|
|
28
|
+
guard: (launch) => async (target, ...rest) => {
|
|
29
|
+
if (!targets.some((entry) => entry.target === target)) throw new TargetLaunchError(target, "not offered by this runner");
|
|
30
|
+
try {
|
|
31
|
+
return await launch(target, ...rest);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (error instanceof TargetLaunchError && !error.transient) fail(target, error.reason);
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
lifecycle: (verify) => ({
|
|
38
|
+
setup: async () => {
|
|
39
|
+
targets = await verify();
|
|
40
|
+
},
|
|
41
|
+
teardown: async () => {
|
|
42
|
+
await Promise.resolve();
|
|
43
|
+
},
|
|
44
|
+
health: async () => {
|
|
45
|
+
await Promise.resolve();
|
|
46
|
+
const down = targets.flatMap((entry) => entry.status === "ready" ? [] : [`${entry.target}: ${entry.status.unavailable}`]);
|
|
47
|
+
return {
|
|
48
|
+
ok: down.length < targets.length,
|
|
49
|
+
...down.length > 0 ? { detail: down.join("; ") } : {}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { createTargetOffers };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=capture-target-offers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-target-offers.mjs","names":[],"sources":["../../src/adapters/capture-target-offers.ts"],"sourcesContent":["/**\n * What a runner offers right now, shared by the runners (ADR 0007): the targets it declared, whether\n * each can render, and the lifecycle that keeps that honest. A launch failure marks its target\n * unavailable from then on.\n */\nimport { TargetLaunchError, type CaptureTarget, type RunnerTarget } from \"./capture-target.ts\";\nimport type { AdapterLifecycle } from \"./metadata.ts\";\n\n/** A runner's live target list. */\nexport interface TargetOffers {\n /** First declared target: what a project with no `browsers` setting resolves to. */\n readonly defaultTarget: CaptureTarget;\n /** The targets with their current status; reads `metadata.targets`. */\n current(): readonly RunnerTarget[];\n /**\n * Wrap `launch` so a target the runner does not offer fails with a {@link TargetLaunchError}, and\n * a launch that fails marks its target unavailable with the launch error as the reason (not a\n * transient one: a remote service that is down stays offered).\n */\n guard<T, Rest extends unknown[]>(\n launch: (target: CaptureTarget, ...rest: Rest) => Promise<T>,\n ): (target: CaptureTarget, ...rest: Rest) => Promise<T>;\n /** Lifecycle whose `setup` replaces the statuses with what `verify` finds, and `health` reports them. */\n lifecycle(verify: () => Promise<readonly RunnerTarget[]>): AdapterLifecycle;\n}\n\n/**\n * Offer `declared`, default first. Until verified every target reads as ready, so a runner used\n * without `lifecycle.setup` behaves as before and a failed launch still marks its target.\n */\nexport function createTargetOffers(declared: readonly RunnerTarget[]): TargetOffers {\n let targets: readonly RunnerTarget[] = declared;\n const first = declared[0];\n if (first === undefined) {\n throw new Error(\"A runner must offer at least one target\");\n }\n const fail = (target: CaptureTarget, reason: string): void => {\n targets = targets.map((entry) =>\n entry.target === target ? { ...entry, status: { unavailable: reason } } : entry,\n );\n };\n return {\n defaultTarget: first.target,\n current: () => targets,\n guard:\n (launch) =>\n async (target, ...rest) => {\n if (!targets.some((entry) => entry.target === target)) {\n throw new TargetLaunchError(target, \"not offered by this runner\");\n }\n try {\n return await launch(target, ...rest);\n } catch (error) {\n if (error instanceof TargetLaunchError && !error.transient) {\n fail(target, error.reason);\n }\n throw error;\n }\n },\n lifecycle: (verify) => ({\n setup: async () => {\n targets = await verify();\n },\n teardown: async () => {\n await Promise.resolve();\n },\n health: async () => {\n await Promise.resolve();\n const down = targets.flatMap((entry) =>\n entry.status === \"ready\" ? [] : [`${entry.target}: ${entry.status.unavailable}`],\n );\n return {\n ok: down.length < targets.length,\n ...(down.length > 0 ? { detail: down.join(\"; \") } : {}),\n };\n },\n }),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AA8BA,SAAgB,mBAAmB,UAAiD;CAClF,IAAI,UAAmC;CACvC,MAAM,QAAQ,SAAS;CACvB,IAAI,UAAU,KAAA,GACZ,MAAM,IAAI,MAAM,yCAAyC;CAE3D,MAAM,QAAQ,QAAuB,WAAyB;EAC5D,UAAU,QAAQ,KAAK,UACrB,MAAM,WAAW,SAAS;GAAE,GAAG;GAAO,QAAQ,EAAE,aAAa,OAAO;EAAE,IAAI,KAC5E;CACF;CACA,OAAO;EACL,eAAe,MAAM;EACrB,eAAe;EACf,QACG,WACD,OAAO,QAAQ,GAAG,SAAS;GACzB,IAAI,CAAC,QAAQ,MAAM,UAAU,MAAM,WAAW,MAAM,GAClD,MAAM,IAAI,kBAAkB,QAAQ,4BAA4B;GAElE,IAAI;IACF,OAAO,MAAM,OAAO,QAAQ,GAAG,IAAI;GACrC,SAAS,OAAO;IACd,IAAI,iBAAiB,qBAAqB,CAAC,MAAM,WAC/C,KAAK,QAAQ,MAAM,MAAM;IAE3B,MAAM;GACR;EACF;EACF,YAAY,YAAY;GACtB,OAAO,YAAY;IACjB,UAAU,MAAM,OAAO;GACzB;GACA,UAAU,YAAY;IACpB,MAAM,QAAQ,QAAQ;GACxB;GACA,QAAQ,YAAY;IAClB,MAAM,QAAQ,QAAQ;IACtB,MAAM,OAAO,QAAQ,SAAS,UAC5B,MAAM,WAAW,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,OAAO,IAAI,MAAM,OAAO,aAAa,CACjF;IACA,OAAO;KACL,IAAI,KAAK,SAAS,QAAQ;KAC1B,GAAI,KAAK,SAAS,IAAI,EAAE,QAAQ,KAAK,KAAK,IAAI,EAAE,IAAI,CAAC;IACvD;GACF;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/adapters/capture-target.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Capture targets (ADR 0007, decision 3): what a project names to render on. A target is a rendering
|
|
6
|
+
* engine (`chromium`) or a remote one, `<engine>@<name>` (`chromium@grid`), which has its own
|
|
7
|
+
* baselines and fingerprint.
|
|
8
|
+
*/
|
|
9
|
+
/** A rendering engine. */
|
|
10
|
+
type BrowserName = "chromium" | "firefox" | "webkit" | "chrome";
|
|
11
|
+
/** Engine names accepted for capture rendering (Chromium default). */
|
|
12
|
+
declare const BROWSER_NAMES: readonly ["chromium", "firefox", "webkit", "chrome"];
|
|
13
|
+
/** Engine that legacy rows and single-browser projects belong to. */
|
|
14
|
+
declare const DEFAULT_BROWSER: BrowserName;
|
|
15
|
+
/** What a project's `browsers` setting, a snapshot's `browser` and a baseline key hold. */
|
|
16
|
+
type CaptureTarget = BrowserName | `${BrowserName}@${string}`;
|
|
17
|
+
/** Remote target names: they become part of a storage key and a unique index. */
|
|
18
|
+
declare const TARGET_NAME_PATTERN: RegExp;
|
|
19
|
+
/** How a runner's browser reaches the Storybook (ADR 0007, decision 5). */
|
|
20
|
+
type TargetReach = "loopback" | "url";
|
|
21
|
+
/** Whether a target can render now; `unavailable` carries the reason shown to operators. */
|
|
22
|
+
type TargetStatus = "ready" | {
|
|
23
|
+
readonly unavailable: string;
|
|
24
|
+
};
|
|
25
|
+
/** One target a runner offers, in its metadata. */
|
|
26
|
+
interface RunnerTarget {
|
|
27
|
+
target: CaptureTarget;
|
|
28
|
+
reach: TargetReach;
|
|
29
|
+
status: TargetStatus;
|
|
30
|
+
}
|
|
31
|
+
/** A target split into its engine and, for a remote one, its name. */
|
|
32
|
+
interface ParsedTarget {
|
|
33
|
+
engine: BrowserName;
|
|
34
|
+
/** Set for `<engine>@<name>`; absent for a local engine. */
|
|
35
|
+
name?: string;
|
|
36
|
+
}
|
|
37
|
+
/** Whether `value` is an engine name. */
|
|
38
|
+
declare function isBrowserName(value: unknown): value is BrowserName;
|
|
39
|
+
/** Split a target into engine and name; `null` when it is not a valid target. */
|
|
40
|
+
declare function tryParseTarget(value: unknown): ParsedTarget | null;
|
|
41
|
+
/** Split a target into engine and name; throws on anything that is not a target. */
|
|
42
|
+
declare function parseTarget(value: string): ParsedTarget;
|
|
43
|
+
/** Whether `value` is a capture target. */
|
|
44
|
+
declare function isCaptureTarget(value: unknown): value is CaptureTarget;
|
|
45
|
+
/** The engine half of a target. */
|
|
46
|
+
declare function engineOf(target: CaptureTarget): BrowserName;
|
|
47
|
+
/** The reason a status is unavailable, or `null` when it is ready. */
|
|
48
|
+
declare function unavailableReason(status: TargetStatus): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* A launch or connect failure: the browser never started, so the job fails at once with this
|
|
51
|
+
* reason. Crash isolation (`capture/isolate.ts`) must not see it, since no story is at fault
|
|
52
|
+
* (ADR 0007, decision 7).
|
|
53
|
+
*/
|
|
54
|
+
declare class TargetLaunchError extends Error {
|
|
55
|
+
readonly name = "TargetLaunchError";
|
|
56
|
+
readonly target: CaptureTarget;
|
|
57
|
+
/** Why it did not start, without the target's name. */
|
|
58
|
+
readonly reason: string;
|
|
59
|
+
/**
|
|
60
|
+
* The failure may pass (a remote browser service that is down or full): the target is not marked
|
|
61
|
+
* unavailable for it, though the job still fails at once. A wrong version or credentials do not.
|
|
62
|
+
*/
|
|
63
|
+
readonly transient: boolean;
|
|
64
|
+
constructor(target: CaptureTarget, reason: string, options?: {
|
|
65
|
+
cause?: unknown;
|
|
66
|
+
transient?: boolean;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { BROWSER_NAMES, BrowserName, CaptureTarget, DEFAULT_BROWSER, ParsedTarget, RunnerTarget, TARGET_NAME_PATTERN, TargetLaunchError, TargetReach, TargetStatus, engineOf, isBrowserName, isCaptureTarget, parseTarget, tryParseTarget, unavailableReason };
|
|
71
|
+
//# sourceMappingURL=capture-target.d.mts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/adapters/capture-target.ts
|
|
5
|
+
/** Engine names accepted for capture rendering (Chromium default). */
|
|
6
|
+
const BROWSER_NAMES = [
|
|
7
|
+
"chromium",
|
|
8
|
+
"firefox",
|
|
9
|
+
"webkit",
|
|
10
|
+
"chrome"
|
|
11
|
+
];
|
|
12
|
+
/** Engine that legacy rows and single-browser projects belong to. */
|
|
13
|
+
const DEFAULT_BROWSER = "chromium";
|
|
14
|
+
/** Remote target names: they become part of a storage key and a unique index. */
|
|
15
|
+
const TARGET_NAME_PATTERN = /^[a-z0-9][a-z0-9-]{0,31}$/u;
|
|
16
|
+
/** Whether `value` is an engine name. */
|
|
17
|
+
function isBrowserName(value) {
|
|
18
|
+
return typeof value === "string" && BROWSER_NAMES.includes(value);
|
|
19
|
+
}
|
|
20
|
+
/** Split a target into engine and name; `null` when it is not a valid target. */
|
|
21
|
+
function tryParseTarget(value) {
|
|
22
|
+
if (typeof value !== "string") return null;
|
|
23
|
+
const at = value.indexOf("@");
|
|
24
|
+
const engine = at === -1 ? value : value.slice(0, at);
|
|
25
|
+
if (!isBrowserName(engine)) return null;
|
|
26
|
+
if (at === -1) return { engine };
|
|
27
|
+
const name = value.slice(at + 1);
|
|
28
|
+
return TARGET_NAME_PATTERN.test(name) ? {
|
|
29
|
+
engine,
|
|
30
|
+
name
|
|
31
|
+
} : null;
|
|
32
|
+
}
|
|
33
|
+
/** Split a target into engine and name; throws on anything that is not a target. */
|
|
34
|
+
function parseTarget(value) {
|
|
35
|
+
const parsed = tryParseTarget(value);
|
|
36
|
+
if (parsed === null) throw new Error(`Invalid capture target "${value}": expected one of ${BROWSER_NAMES.join(", ")}, or <engine>@<name> with a lowercase name of at most 32 letters, digits and hyphens`);
|
|
37
|
+
return parsed;
|
|
38
|
+
}
|
|
39
|
+
/** Whether `value` is a capture target. */
|
|
40
|
+
function isCaptureTarget(value) {
|
|
41
|
+
return tryParseTarget(value) !== null;
|
|
42
|
+
}
|
|
43
|
+
/** The engine half of a target. */
|
|
44
|
+
function engineOf(target) {
|
|
45
|
+
return parseTarget(target).engine;
|
|
46
|
+
}
|
|
47
|
+
/** The reason a status is unavailable, or `null` when it is ready. */
|
|
48
|
+
function unavailableReason(status) {
|
|
49
|
+
return status === "ready" ? null : status.unavailable;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A launch or connect failure: the browser never started, so the job fails at once with this
|
|
53
|
+
* reason. Crash isolation (`capture/isolate.ts`) must not see it, since no story is at fault
|
|
54
|
+
* (ADR 0007, decision 7).
|
|
55
|
+
*/
|
|
56
|
+
var TargetLaunchError = class extends Error {
|
|
57
|
+
name = "TargetLaunchError";
|
|
58
|
+
target;
|
|
59
|
+
/** Why it did not start, without the target's name. */
|
|
60
|
+
reason;
|
|
61
|
+
/**
|
|
62
|
+
* The failure may pass (a remote browser service that is down or full): the target is not marked
|
|
63
|
+
* unavailable for it, though the job still fails at once. A wrong version or credentials do not.
|
|
64
|
+
*/
|
|
65
|
+
transient;
|
|
66
|
+
constructor(target, reason, options) {
|
|
67
|
+
super(`Cannot launch ${target}: ${reason}`, options);
|
|
68
|
+
this.target = target;
|
|
69
|
+
this.reason = reason;
|
|
70
|
+
this.transient = options?.transient ?? false;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { BROWSER_NAMES, DEFAULT_BROWSER, TARGET_NAME_PATTERN, TargetLaunchError, engineOf, isBrowserName, isCaptureTarget, parseTarget, tryParseTarget, unavailableReason };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=capture-target.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-target.mjs","names":[],"sources":["../../src/adapters/capture-target.ts"],"sourcesContent":["/**\n * Capture targets (ADR 0007, decision 3): what a project names to render on. A target is a rendering\n * engine (`chromium`) or a remote one, `<engine>@<name>` (`chromium@grid`), which has its own\n * baselines and fingerprint.\n */\n\n/** A rendering engine. */\nexport type BrowserName = \"chromium\" | \"firefox\" | \"webkit\" | \"chrome\";\n\n/** Engine names accepted for capture rendering (Chromium default). */\nexport const BROWSER_NAMES = [\"chromium\", \"firefox\", \"webkit\", \"chrome\"] as const;\n\n/** Engine that legacy rows and single-browser projects belong to. */\nexport const DEFAULT_BROWSER: BrowserName = \"chromium\";\n\n/** What a project's `browsers` setting, a snapshot's `browser` and a baseline key hold. */\nexport type CaptureTarget = BrowserName | `${BrowserName}@${string}`;\n\n/** Remote target names: they become part of a storage key and a unique index. */\nexport const TARGET_NAME_PATTERN = /^[a-z0-9][a-z0-9-]{0,31}$/u;\n\n/** How a runner's browser reaches the Storybook (ADR 0007, decision 5). */\nexport type TargetReach = \"loopback\" | \"url\";\n\n/** Whether a target can render now; `unavailable` carries the reason shown to operators. */\nexport type TargetStatus = \"ready\" | { readonly unavailable: string };\n\n/** One target a runner offers, in its metadata. */\nexport interface RunnerTarget {\n target: CaptureTarget;\n reach: TargetReach;\n status: TargetStatus;\n}\n\n/** A target split into its engine and, for a remote one, its name. */\nexport interface ParsedTarget {\n engine: BrowserName;\n /** Set for `<engine>@<name>`; absent for a local engine. */\n name?: string;\n}\n\n/** Whether `value` is an engine name. */\nexport function isBrowserName(value: unknown): value is BrowserName {\n return typeof value === \"string\" && (BROWSER_NAMES as readonly string[]).includes(value);\n}\n\n/** Split a target into engine and name; `null` when it is not a valid target. */\nexport function tryParseTarget(value: unknown): ParsedTarget | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const at = value.indexOf(\"@\");\n const engine = at === -1 ? value : value.slice(0, at);\n if (!isBrowserName(engine)) {\n return null;\n }\n if (at === -1) {\n return { engine };\n }\n const name = value.slice(at + 1);\n return TARGET_NAME_PATTERN.test(name) ? { engine, name } : null;\n}\n\n/** Split a target into engine and name; throws on anything that is not a target. */\nexport function parseTarget(value: string): ParsedTarget {\n const parsed = tryParseTarget(value);\n if (parsed === null) {\n throw new Error(\n `Invalid capture target \"${value}\": expected one of ${BROWSER_NAMES.join(\", \")}, or <engine>@<name> with a lowercase name of at most 32 letters, digits and hyphens`,\n );\n }\n return parsed;\n}\n\n/** Whether `value` is a capture target. */\nexport function isCaptureTarget(value: unknown): value is CaptureTarget {\n return tryParseTarget(value) !== null;\n}\n\n/** The engine half of a target. */\nexport function engineOf(target: CaptureTarget): BrowserName {\n return parseTarget(target).engine;\n}\n\n/** The reason a status is unavailable, or `null` when it is ready. */\nexport function unavailableReason(status: TargetStatus): string | null {\n return status === \"ready\" ? null : status.unavailable;\n}\n\n/**\n * A launch or connect failure: the browser never started, so the job fails at once with this\n * reason. Crash isolation (`capture/isolate.ts`) must not see it, since no story is at fault\n * (ADR 0007, decision 7).\n */\nexport class TargetLaunchError extends Error {\n override readonly name = \"TargetLaunchError\";\n readonly target: CaptureTarget;\n /** Why it did not start, without the target's name. */\n readonly reason: string;\n /**\n * The failure may pass (a remote browser service that is down or full): the target is not marked\n * unavailable for it, though the job still fails at once. A wrong version or credentials do not.\n */\n readonly transient: boolean;\n\n constructor(\n target: CaptureTarget,\n reason: string,\n options?: { cause?: unknown; transient?: boolean },\n ) {\n super(`Cannot launch ${target}: ${reason}`, options);\n this.target = target;\n this.reason = reason;\n this.transient = options?.transient ?? false;\n }\n}\n"],"mappings":";;;;;AAUA,MAAa,gBAAgB;CAAC;CAAY;CAAW;CAAU;AAAQ;;AAGvE,MAAa,kBAA+B;;AAM5C,MAAa,sBAAsB;;AAuBnC,SAAgB,cAAc,OAAsC;CAClE,OAAO,OAAO,UAAU,YAAa,cAAoC,SAAS,KAAK;AACzF;;AAGA,SAAgB,eAAe,OAAqC;CAClE,IAAI,OAAO,UAAU,UACnB,OAAO;CAET,MAAM,KAAK,MAAM,QAAQ,GAAG;CAC5B,MAAM,SAAS,OAAO,KAAK,QAAQ,MAAM,MAAM,GAAG,EAAE;CACpD,IAAI,CAAC,cAAc,MAAM,GACvB,OAAO;CAET,IAAI,OAAO,IACT,OAAO,EAAE,OAAO;CAElB,MAAM,OAAO,MAAM,MAAM,KAAK,CAAC;CAC/B,OAAO,oBAAoB,KAAK,IAAI,IAAI;EAAE;EAAQ;CAAK,IAAI;AAC7D;;AAGA,SAAgB,YAAY,OAA6B;CACvD,MAAM,SAAS,eAAe,KAAK;CACnC,IAAI,WAAW,MACb,MAAM,IAAI,MACR,2BAA2B,MAAM,qBAAqB,cAAc,KAAK,IAAI,EAAE,qFACjF;CAEF,OAAO;AACT;;AAGA,SAAgB,gBAAgB,OAAwC;CACtE,OAAO,eAAe,KAAK,MAAM;AACnC;;AAGA,SAAgB,SAAS,QAAoC;CAC3D,OAAO,YAAY,MAAM,CAAC,CAAC;AAC7B;;AAGA,SAAgB,kBAAkB,QAAqC;CACrE,OAAO,WAAW,UAAU,OAAO,OAAO;AAC5C;;;;;;AAOA,IAAa,oBAAb,cAAuC,MAAM;CAC3C,OAAyB;CACzB;;CAEA;;;;;CAKA;CAEA,YACE,QACA,QACA,SACA;EACA,MAAM,iBAAiB,OAAO,IAAI,UAAU,OAAO;EACnD,KAAK,SAAS;EACd,KAAK,SAAS;EACd,KAAK,YAAY,SAAS,aAAa;CACzC;AACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { DesiredStatus } from "./build-state.mjs";
|
|
4
|
+
//#region src/adapters/notifier/build-comment.d.ts
|
|
5
|
+
/** Inputs of {@link buildCommentMarkdown}. */
|
|
6
|
+
interface BuildCommentInput {
|
|
7
|
+
buildUrl: string;
|
|
8
|
+
/** Present once the Storybook is published. */
|
|
9
|
+
storybookUrl?: string | undefined;
|
|
10
|
+
/** The gating statuses (`testing` or `review`), in display order. */
|
|
11
|
+
gates: readonly DesiredStatus[];
|
|
12
|
+
/** Present when `testing` or review is on: the snapshot totals to summarize. */
|
|
13
|
+
counts?: {
|
|
14
|
+
snapshotCount: number;
|
|
15
|
+
changedCount: number;
|
|
16
|
+
approvedCount: number;
|
|
17
|
+
rejectedCount: number;
|
|
18
|
+
} | undefined;
|
|
19
|
+
}
|
|
20
|
+
/** Comment body (below the idempotency marker): links to the build, the Storybook and a summary. */
|
|
21
|
+
declare function buildCommentMarkdown(input: BuildCommentInput): string;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { BuildCommentInput, buildCommentMarkdown };
|
|
24
|
+
//# sourceMappingURL=build-comment.d.mts.map
|