@ref0/git 0.6.0 → 0.8.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/dist/access/namespace.d.mts +2 -0
- package/dist/access/private-refs.d.mts +6 -29
- package/dist/access/private-refs.mjs +26 -13
- package/dist/access/public.d.mts +6 -0
- package/dist/access/public.mjs +9 -0
- package/dist/auth/access-jwt.d.mts +10 -6
- package/dist/auth/access-jwt.mjs +59 -40
- package/dist/auth/auth-namespace.d.mts +6 -0
- package/dist/auth/auth-namespace.mjs +12 -0
- package/dist/auth/auth.d.mts +3 -6
- package/dist/auth/auth.mjs +2 -9
- package/dist/auth/authorize.mjs +35 -29
- package/dist/auth/bridge.mjs +8 -8
- package/dist/auth/fences.d.mts +1 -2
- package/dist/auth/fences.mjs +1 -1
- package/dist/auth/grants.d.mts +0 -1
- package/dist/auth/grants.mjs +2 -2
- package/dist/auth/host-function.d.mts +1 -7
- package/dist/auth/host-function.mjs +51 -42
- package/dist/auth/identify.d.mts +0 -1
- package/dist/auth/identify.mjs +3 -2
- package/dist/auth/namespaces.d.mts +2 -2
- package/dist/auth/policy.d.mts +7 -4
- package/dist/auth/policy.mjs +13 -10
- package/dist/auth/token-rows.mjs +3 -6
- package/dist/auth/tokens-layer.d.mts +40 -0
- package/dist/auth/tokens-layer.mjs +29 -0
- package/dist/auth/tokens-namespace.d.mts +2 -0
- package/dist/auth/tokens-public.d.mts +6 -0
- package/dist/auth/tokens-public.mjs +31 -0
- package/dist/auth/tokens.d.mts +19 -7
- package/dist/auth/tokens.mjs +12 -6
- package/dist/auth.d.mts +2 -2
- package/dist/auth.mjs +2 -2
- package/dist/client/client.d.mts +22 -15
- package/dist/client/client.mjs +31 -27
- package/dist/client/git-http.mjs +23 -6
- package/dist/client/local.mjs +5 -4
- package/dist/client/namespace.d.mts +2 -0
- package/dist/client/push-upload.d.mts +1 -0
- package/dist/client/push-upload.mjs +169 -2
- package/dist/client/remote-helper.mjs +5 -12
- package/dist/client/remote.mjs +63 -22
- package/dist/client/run-remote-helper.d.mts +1 -1
- package/dist/client/run-remote-helper.mjs +6 -6
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +26 -19
- package/dist/contracts/access.d.mts +18 -10
- package/dist/contracts/access.mjs +17 -0
- package/dist/contracts/actors.d.mts +73 -28
- package/dist/contracts/actors.mjs +45 -2
- package/dist/contracts/authorize.d.mts +26 -17
- package/dist/contracts/blobs.d.mts +1 -1
- package/dist/contracts/blobs.mjs +1 -1
- package/dist/contracts/callers.mjs +40 -0
- package/dist/contracts/calls-spent.d.mts +6 -4
- package/dist/contracts/calls-spent.mjs +10 -8
- package/dist/contracts/client.d.mts +16 -9
- package/dist/contracts/commits.d.mts +2 -2
- package/dist/contracts/commits.mjs +1 -1
- package/dist/contracts/engine.d.mts +1 -1
- package/dist/contracts/events.d.mts +45 -32
- package/dist/contracts/events.mjs +21 -10
- package/dist/contracts/files.d.mts +44 -44
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +34 -58
- package/dist/contracts/forks.mjs +1 -1
- package/dist/contracts/git-events.d.mts +50 -0
- package/dist/contracts/git-events.mjs +23 -0
- package/dist/contracts/git-hooks.d.mts +254 -0
- package/dist/contracts/git-hooks.mjs +12 -0
- package/dist/contracts/git.d.mts +93 -42
- package/dist/contracts/git.mjs +6 -5
- package/dist/contracts/grants.d.mts +46 -27
- package/dist/contracts/ids.d.mts +16 -0
- package/dist/contracts/ids.mjs +19 -4
- package/dist/contracts/lfs.d.mts +19 -4
- package/dist/contracts/merges.d.mts +7 -7
- package/dist/contracts/namespaces.d.mts +2 -2
- package/dist/contracts/objects.d.mts +21 -5
- package/dist/contracts/opaque.mjs +27 -0
- package/dist/contracts/operations.d.mts +301 -101
- package/dist/contracts/operations.mjs +209 -0
- package/dist/contracts/promises.d.mts +2 -0
- package/dist/contracts/push-uploads.d.mts +4 -1
- package/dist/contracts/push-uploads.mjs +9 -4
- package/dist/contracts/queue.d.mts +220 -49
- package/dist/contracts/queue.mjs +68 -6
- package/dist/contracts/refs.d.mts +30 -8
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +53 -23
- package/dist/contracts/remote.mjs +22 -0
- package/dist/contracts/repo-records.d.mts +2 -2
- package/dist/contracts/repos.d.mts +100 -82
- package/dist/contracts/repos.mjs +47 -8
- package/dist/contracts/result.d.mts +73 -41
- package/dist/contracts/result.mjs +74 -17
- package/dist/contracts/rules.d.mts +734 -68
- package/dist/contracts/rules.mjs +84 -1
- package/dist/contracts/server.d.mts +20 -206
- package/dist/contracts/services.d.mts +1 -10
- package/dist/contracts/services.mjs +1 -5
- package/dist/contracts/signin.d.mts +140 -43
- package/dist/contracts/signin.mjs +36 -3
- package/dist/contracts/store.d.mts +1 -1
- package/dist/contracts/sync.d.mts +109 -90
- package/dist/contracts/sync.mjs +34 -7
- package/dist/contracts/tags.d.mts +1 -1
- package/dist/contracts/tags.mjs +1 -1
- package/dist/contracts/tokens.d.mts +247 -60
- package/dist/contracts/tokens.mjs +93 -21
- package/dist/contracts/topics.d.mts +59 -20
- package/dist/contracts/topics.mjs +14 -5
- package/dist/contracts/trees.d.mts +2 -2
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +2 -2
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +10 -12
- package/dist/core/access.mjs +45 -11
- package/dist/core/clock.mjs +1 -1
- package/dist/core/events/deliver.d.mts +3 -2
- package/dist/core/events/deliver.mjs +188 -92
- package/dist/core/forks.mjs +78 -34
- package/dist/core/hooks/groups.d.mts +26 -0
- package/dist/core/hooks/groups.mjs +73 -0
- package/dist/core/hooks/namespace.d.mts +2 -0
- package/dist/core/hooks/order.d.mts +2 -2
- package/dist/core/hooks/order.mjs +6 -6
- package/dist/core/hooks/public.d.mts +7 -0
- package/dist/core/hooks/public.mjs +5 -0
- package/dist/core/imports.mjs +94 -10
- package/dist/core/index-job.mjs +11 -8
- package/dist/core/loose-tally.mjs +46 -0
- package/dist/core/merge-parts.d.mts +1 -1
- package/dist/core/merge-parts.mjs +1 -1
- package/dist/core/mirror-rows.mjs +18 -0
- package/dist/core/names.mjs +1 -1
- package/dist/core/namespaces.d.mts +2 -1
- package/dist/core/objects/commit-writes.mjs +5 -5
- package/dist/core/objects/merges.mjs +1 -1
- package/dist/core/objects/objects-layer.mjs +1 -1
- package/dist/core/objects/reading.mjs +52 -7
- package/dist/core/objects/tree-edits.mjs +13 -28
- package/dist/core/objects/trees.mjs +4 -4
- package/dist/core/objects/writing.mjs +4 -3
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +22 -3
- package/dist/core/parts.mjs +5 -3
- package/dist/core/promise.mjs +23 -17
- package/dist/core/purge.d.mts +2 -2
- package/dist/core/purge.mjs +89 -34
- package/dist/core/push.mjs +67 -79
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +28 -4
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +16 -8
- package/dist/core/refs.mjs +41 -10
- package/dist/core/registered-records.mjs +30 -0
- package/dist/core/{claim-rows.mjs → registered-rows.mjs} +6 -6
- package/dist/core/repack.d.mts +2 -2
- package/dist/core/repack.mjs +30 -23
- package/dist/core/repo-info.mjs +62 -26
- package/dist/core/repos.mjs +18 -11
- package/dist/core/rules/changes.mjs +2 -2
- package/dist/core/rules/check.mjs +10 -10
- package/dist/core/rules/commit-changes.mjs +1 -1
- package/dist/core/rules/context.d.mts +7 -6
- package/dist/core/rules/context.mjs +18 -16
- package/dist/core/rules/fetch.mjs +78 -31
- package/dist/core/saved-caller-views.d.mts +72 -0
- package/dist/core/saved-caller-views.mjs +123 -0
- package/dist/core/saved-callers-public.d.mts +5 -0
- package/dist/core/saved-callers-public.mjs +10 -0
- package/dist/core/saved-callers.mjs +95 -0
- package/dist/core/seam.d.mts +12 -1
- package/dist/core/seam.mjs +4 -2
- package/dist/core/tokens.mjs +7 -2
- package/dist/core/view.d.mts +1 -1
- package/dist/core/view.mjs +1 -1
- package/dist/core/work.mjs +6 -5
- package/dist/effect.d.mts +2 -4
- package/dist/effect.mjs +2 -4
- package/dist/engine/commits.mjs +19 -47
- package/dist/engine/content.d.mts +2 -2
- package/dist/engine/content.mjs +1 -1
- package/dist/engine/diff.mjs +2 -2
- package/dist/engine/failures.d.mts +1 -2
- package/dist/engine/failures.mjs +1 -3
- package/dist/engine/merge-base-walk.mjs +57 -142
- package/dist/engine/merge-bases.mjs +5 -5
- package/dist/engine/merge-renames.mjs +1 -1
- package/dist/engine/merge.mjs +16 -14
- package/dist/engine/reads.d.mts +2 -2
- package/dist/engine/reads.mjs +1 -1
- package/dist/engine/xdiff.d.mts +1 -1
- package/dist/engine/xdiff.mjs +2 -2
- package/dist/event-streams/event-streams.d.mts +6 -2
- package/dist/event-streams/event-streams.mjs +6 -2
- package/dist/event-streams/stream.mjs +5 -2
- package/dist/extend.d.mts +2 -3
- package/dist/extend.mjs +2 -2
- package/dist/http/answers.mjs +4 -3
- package/dist/http/core-parts.mjs +3 -4
- package/dist/http/handler.mjs +12 -32
- package/dist/http/parts.d.mts +1 -1
- package/dist/http/push-uploads.mjs +7 -5
- package/dist/http/receive-pack.mjs +3 -3
- package/dist/http/upload-pack.mjs +6 -5
- package/dist/index.d.mts +44 -24
- package/dist/index.mjs +17 -8
- package/dist/lfs/base.d.mts +8 -5
- package/dist/lfs/base.mjs +2 -1
- package/dist/lfs/calls.mjs +3 -2
- package/dist/lfs/layer.d.mts +9 -7
- package/dist/lfs/layer.mjs +37 -22
- package/dist/lfs/locks.mjs +3 -3
- package/dist/lfs/objects.d.mts +3 -2
- package/dist/lfs/objects.mjs +235 -71
- package/dist/lfs/pointers.mjs +70 -19
- package/dist/lfs/purge.mjs +7 -3
- package/dist/lfs/rows.mjs +25 -8
- package/dist/lfs/service.d.mts +6 -3
- package/dist/lfs/service.mjs +8 -2
- package/dist/lfs/upkeep.mjs +53 -31
- package/dist/lfs/upload-most.mjs +41 -0
- package/dist/lfs/uploaded.mjs +59 -0
- package/dist/lfs/wire.mjs +1 -1
- package/dist/protocol/bytes/buffers.d.mts +1 -1
- package/dist/protocol/bytes/buffers.mjs +1 -1
- package/dist/protocol/bytes/deflate.d.mts +1 -1
- package/dist/protocol/bytes/deflate.mjs +1 -1
- package/dist/protocol/bytes/hmac-sha256.mjs +3 -6
- package/dist/protocol/bytes/inflate.d.mts +1 -1
- package/dist/protocol/bytes/inflate.mjs +1 -1
- package/dist/protocol/bytes/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +2 -2
- package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
- package/dist/protocol/bytes/text.mjs +6 -1
- package/dist/protocol/diff/read.d.mts +1 -1
- package/dist/protocol/diff/read.mjs +1 -1
- package/dist/protocol/diff/tree-diff.d.mts +1 -1
- package/dist/protocol/diff/tree-diff.mjs +11 -11
- package/dist/protocol/objects/fsck.mjs +6 -3
- package/dist/protocol/objects/lfs-pointer.mjs +6 -1
- package/dist/protocol/objects/tag.mjs +1 -1
- package/dist/protocol/objects/tree.mjs +1 -1
- package/dist/protocol/packs/graph.mjs +1 -1
- package/dist/protocol/packs/idx.d.mts +1 -1
- package/dist/protocol/packs/idx.mjs +1 -1
- package/dist/protocol/packs/parts.mjs +1 -1
- package/dist/protocol/packs/reader.d.mts +1 -1
- package/dist/protocol/packs/reader.mjs +2 -2
- package/dist/protocol/packs/write-error.d.mts +1 -1
- package/dist/protocol/packs/write-error.mjs +1 -1
- package/dist/protocol/packs/writer.mjs +4 -4
- package/dist/protocol/wire/advertisement.d.mts +1 -1
- package/dist/protocol/wire/advertisement.mjs +1 -1
- package/dist/protocol/wire/fetch.d.mts +1 -1
- package/dist/protocol/wire/fetch.mjs +1 -1
- package/dist/protocol/wire/lines.d.mts +1 -1
- package/dist/protocol/wire/lines.mjs +2 -2
- package/dist/protocol/wire/push-uploads.mjs +4 -2
- package/dist/protocol/wire/receive-pack.d.mts +1 -1
- package/dist/protocol/wire/receive-pack.mjs +1 -1
- package/dist/protocol/wire/report-status.d.mts +1 -1
- package/dist/protocol/wire/report-status.mjs +1 -1
- package/dist/protocol/wire/v2.d.mts +2 -2
- package/dist/protocol/wire/v2.mjs +2 -2
- package/dist/queue/advance.mjs +190 -68
- package/dist/queue/callers.mjs +56 -69
- package/dist/queue/calls.mjs +10 -11
- package/dist/queue/commit.mjs +28 -22
- package/dist/queue/host.d.mts +10 -11
- package/dist/queue/host.mjs +15 -7
- package/dist/queue/lanes.mjs +9 -18
- package/dist/queue/layer.d.mts +3 -3
- package/dist/queue/layer.mjs +11 -10
- package/dist/queue/limits.mjs +17 -5
- package/dist/queue/rows.mjs +13 -10
- package/dist/queue/schedule.mjs +7 -6
- package/dist/queue/search.mjs +11 -17
- package/dist/queue/state.mjs +7 -2
- package/dist/queue/trim.mjs +10 -5
- package/dist/rest/api.d.mts +1 -1
- package/dist/rest/blobs.d.mts +20 -20
- package/dist/rest/caller.d.mts +22 -20
- package/dist/rest/client-namespace.d.mts +2 -0
- package/dist/rest/client.d.mts +32 -8
- package/dist/rest/client.mjs +314 -388
- package/dist/rest/commits.d.mts +284 -284
- package/dist/rest/errors.d.mts +10 -10
- package/dist/rest/errors.mjs +1 -1
- package/dist/rest/events.d.mts +13 -11
- package/dist/rest/events.mjs +3 -1
- package/dist/rest/files.d.mts +48 -48
- package/dist/rest/forks.d.mts +131 -143
- package/dist/rest/handler.mjs +4 -3
- package/dist/rest/handlers.mjs +15 -8
- package/dist/rest/layer.d.mts +3 -3
- package/dist/rest/layer.mjs +8 -7
- package/dist/rest/listen.d.mts +8 -6
- package/dist/rest/listen.mjs +33 -77
- package/dist/rest/me.d.mts +18 -20
- package/dist/rest/me.mjs +1 -1
- package/dist/rest/merges.d.mts +17 -17
- package/dist/rest/queue.d.mts +140 -140
- package/dist/rest/queue.mjs +1 -1
- package/dist/rest/refs.d.mts +214 -214
- package/dist/rest/refs.mjs +1 -1
- package/dist/rest/repos.d.mts +123 -135
- package/dist/rest/tags.d.mts +30 -30
- package/dist/rest/tokens.d.mts +250 -260
- package/dist/rest/tokens.mjs +10 -42
- package/dist/rest/topics.d.mts +162 -162
- package/dist/rest/topics.mjs +1 -1
- package/dist/rest/trees.d.mts +117 -117
- package/dist/rest/wire.d.mts +7 -5
- package/dist/rest/wire.mjs +4 -3
- package/dist/rest/work.d.mts +69 -69
- package/dist/rest/work.mjs +1 -1
- package/dist/rest.d.mts +1 -7
- package/dist/rest.mjs +1 -5
- package/dist/server/check-fetch.mjs +9 -0
- package/dist/server/extension.mjs +3 -115
- package/dist/server/git-layer.d.mts +30 -5
- package/dist/server/git-layer.mjs +59 -29
- package/dist/server/git-namespace.d.mts +4 -4
- package/dist/server/git-namespace.mjs +6 -4
- package/dist/server/joined.d.mts +83 -0
- package/dist/server/joined.mjs +91 -0
- package/dist/server/registry.d.mts +7 -3
- package/dist/server/registry.mjs +135 -31
- package/dist/server/server.d.mts +9 -3
- package/dist/server/server.mjs +277 -208
- package/dist/signin/context.d.mts +2 -2
- package/dist/signin/context.mjs +28 -37
- package/dist/signin/device.mjs +5 -5
- package/dist/signin/forms.mjs +1 -1
- package/dist/signin/grants.d.mts +2 -3
- package/dist/signin/grants.mjs +5 -5
- package/dist/signin/layer.d.mts +9 -0
- package/dist/signin/layer.mjs +41 -0
- package/dist/signin/namespace.d.mts +2 -0
- package/dist/signin/public.d.mts +6 -0
- package/dist/signin/public.mjs +5 -0
- package/dist/signin/route.mjs +47 -21
- package/dist/signin/web.mjs +3 -3
- package/dist/signin/wire.mjs +1 -1
- package/dist/storage/calls.d.mts +1 -1
- package/dist/storage/calls.mjs +4 -4
- package/dist/storage/clean-up.mjs +15 -6
- package/dist/storage/counted-bucket.mjs +34 -51
- package/dist/storage/fetch.mjs +1 -1
- package/dist/storage/fsck.mjs +12 -2
- package/dist/storage/graph-rebuild.mjs +262 -0
- package/dist/storage/host-bucket.mjs +1 -1
- package/dist/storage/index-build.d.mts +2 -2
- package/dist/storage/index-build.mjs +103 -15
- package/dist/storage/index-fetch.mjs +10 -6
- package/dist/storage/index-graph.mjs +1 -1
- package/dist/storage/index-layers.mjs +1 -1
- package/dist/storage/index-visible.mjs +1 -1
- package/dist/storage/lfs-pointers.d.mts +5 -5
- package/dist/storage/lfs-pointers.mjs +37 -11
- package/dist/storage/loose.mjs +4 -1
- package/dist/storage/memory-budget.mjs +8 -2
- package/dist/storage/merge-cut.mjs +24 -1
- package/dist/storage/merge-fence.mjs +82 -20
- package/dist/storage/merge-most.mjs +1 -0
- package/dist/storage/merge-plan.mjs +5 -2
- package/dist/storage/merge-row.mjs +17 -5
- package/dist/storage/merge-stream.mjs +25 -13
- package/dist/storage/merge-write.mjs +1 -1
- package/dist/storage/merge.d.mts +2 -2
- package/dist/storage/merge.mjs +1 -1
- package/dist/storage/object-rows.d.mts +2 -2
- package/dist/storage/object-rows.mjs +20 -4
- package/dist/storage/pack-ranges.d.mts +3 -1
- package/dist/storage/pack-ranges.mjs +168 -69
- package/dist/storage/pack-reads.mjs +4 -4
- package/dist/storage/pack-receive.d.mts +1 -1
- package/dist/storage/pack-receive.mjs +17 -15
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +103 -79
- package/dist/storage/placed-reads.mjs +81 -15
- package/dist/storage/prune-seen.mjs +126 -0
- package/dist/storage/prune-walk.mjs +87 -99
- package/dist/storage/prune.mjs +113 -50
- package/dist/storage/push-uploads.mjs +4 -2
- package/dist/storage/quarantine.d.mts +2 -2
- package/dist/storage/ready.d.mts +2 -2
- package/dist/storage/ready.mjs +15 -6
- package/dist/storage/receive-files.mjs +1 -1
- package/dist/storage/receive-links.mjs +1 -1
- package/dist/storage/receive-state.d.mts +2 -2
- package/dist/storage/receive-state.mjs +2 -2
- package/dist/storage/receive-steps.mjs +1 -1
- package/dist/storage/repack-contained.mjs +24 -16
- package/dist/storage/repack-job.d.mts +2 -2
- package/dist/storage/repack-job.mjs +5 -4
- package/dist/storage/repack.d.mts +2 -2
- package/dist/storage/repack.mjs +12 -5
- package/dist/storage/rows.d.mts +2 -2
- package/dist/storage/rows.mjs +1 -1
- package/dist/storage/runs.d.mts +2 -2
- package/dist/storage/runs.mjs +15 -6
- package/dist/storage/send-list.mjs +6 -6
- package/dist/storage/single-flight.mjs +2 -2
- package/dist/storage/swap-walk.mjs +1 -1
- package/dist/storage/unpack.mjs +8 -1
- package/dist/store/call-count.d.mts +24 -4
- package/dist/store/call-count.mjs +158 -44
- package/dist/store/catalogue.d.mts +1 -1
- package/dist/store/catalogue.mjs +2 -2
- package/dist/store/crossing.mjs +2 -6
- package/dist/store/cursor-seal.mjs +1 -1
- package/dist/store/errors.d.mts +7 -3
- package/dist/store/errors.mjs +41 -13
- package/dist/store/job-try.mjs +119 -15
- package/dist/store/list-job.mjs +5 -5
- package/dist/store/outbox.d.mts +2 -2
- package/dist/store/outbox.mjs +75 -16
- package/dist/store/promises.d.mts +2 -2
- package/dist/store/promises.mjs +31 -6
- package/dist/store/queue-jobs.mjs +1 -1
- package/dist/store/records.d.mts +2 -2
- package/dist/store/records.mjs +22 -24
- package/dist/store/ref-rows.d.mts +2 -2
- package/dist/store/ref-rows.mjs +6 -6
- package/dist/store/repo-record.mjs +29 -12
- package/dist/store/reservations.mjs +35 -8
- package/dist/store/scopes.mjs +12 -5
- package/dist/store/topic-jobs.mjs +8 -8
- package/dist/sync/bound.d.mts +1 -3
- package/dist/sync/bound.mjs +30 -42
- package/dist/sync/github.d.mts +5 -6
- package/dist/sync/github.mjs +37 -42
- package/dist/sync/http.mjs +15 -0
- package/dist/sync/import.mjs +30 -19
- package/dist/sync/layer.d.mts +13 -0
- package/dist/sync/layer.mjs +73 -0
- package/dist/sync/mirror.mjs +137 -58
- package/dist/sync/publish.mjs +3 -6
- package/dist/sync/step.mjs +223 -85
- package/dist/sync/tries.mjs +22 -15
- package/dist/sync.d.mts +3 -6
- package/dist/sync.mjs +3 -6
- package/dist/topics/advance.mjs +210 -94
- package/dist/topics/calls.mjs +8 -8
- package/dist/topics/directory.mjs +35 -12
- package/dist/topics/host.d.mts +5 -8
- package/dist/topics/host.mjs +42 -19
- package/dist/topics/layer.d.mts +381 -0
- package/dist/topics/layer.mjs +62 -0
- package/dist/topics/members.mjs +39 -10
- package/dist/topics/namespace.d.mts +2 -0
- package/dist/topics/public.d.mts +6 -0
- package/dist/topics/public.mjs +13 -0
- package/dist/topics/rows.mjs +12 -3
- package/dist/topics/topic.mjs +11 -10
- package/package.json +8 -13
- package/dist/access.d.mts +0 -2
- package/dist/access.mjs +0 -1
- package/dist/core/hooks/post-receive.mjs +0 -216
- package/dist/core/hooks/pre-receive.d.mts +0 -12
- package/dist/core/hooks/pre-receive.mjs +0 -36
- package/dist/engine/merge-base-walk.d.mts +0 -3
- package/dist/server/extension.d.mts +0 -21
- package/dist/server/routes.d.mts +0 -32
- package/dist/server/routes.mjs +0 -69
- package/dist/sync/import.d.mts +0 -10
- package/dist/sync/jobs.d.mts +0 -9
- package/dist/sync/jobs.mjs +0 -75
- package/dist/sync/mirror.d.mts +0 -13
- package/dist/sync/publish.d.mts +0 -6
- /package/dist/core/{claim-rows.d.mts → registered-rows.d.mts} +0 -0
|
@@ -1,72 +1,174 @@
|
|
|
1
1
|
import { GitError, Result } from "./result.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { RepoName } from "./ids.mjs";
|
|
2
|
+
import { CallInput, NamedActor } from "./actors.mjs";
|
|
4
3
|
import { EffectCalls } from "./services.mjs";
|
|
5
|
-
import { Listing, Moment, Page } from "@ref0/infra";
|
|
6
|
-
import * as Schema from "effect/Schema";
|
|
7
4
|
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Schema from "effect/Schema";
|
|
6
|
+
import { Listing } from "@ref0/infra";
|
|
8
7
|
import * as Context from "effect/Context";
|
|
9
|
-
declare namespace tokens_d_exports {
|
|
10
|
-
export { CreatedToken, PrefixTarget, TokenCalls, TokenCoverage, TokenCreateInput, TokenFields, TokenId, TokenInfo, TokenKeyInput, TokenListInput, TokenRecord, TokenScope, TokenState, TokenTarget, Tokens, TokensFeature, TrustedWriteInput, VerifiedToken, create, get, list, revoke, revokeKey, tokenScopes, tokenStates };
|
|
11
|
-
}
|
|
12
8
|
export declare const TokenId: Schema.String;
|
|
13
9
|
export type TokenId = typeof TokenId.Type;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The scopes a grant may hold, a sign-in's or an extension's, and what Git's ceiling on a repo
|
|
12
|
+
* answers: `read`, then `report`, then `write`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const grantScopes: readonly ['read', 'report', 'write'];
|
|
15
|
+
export declare const GrantScope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
16
|
+
export type GrantScope = typeof GrantScope.Type;
|
|
17
|
+
/**
|
|
18
|
+
* Each scope a token can have, a ceiling `authorize` can narrow: the grant scopes, then `admin`.
|
|
19
|
+
* An `admin` token reaches every operation kind, as a host's own sign-in does, and covers only
|
|
20
|
+
* the whole host, `{ prefix: '' }`. Its ceiling never opens past the host's `Policy`: a policy
|
|
21
|
+
* that doesn't accept `admin` refuses it, as `Policy.signedIn` does.
|
|
22
|
+
*/
|
|
23
|
+
export declare const tokenScopes: readonly ["read", "report", "write", "admin"];
|
|
24
|
+
export declare const TokenScope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
17
25
|
export type TokenScope = typeof TokenScope.Type;
|
|
18
26
|
/** One repo, or every repo whose ID starts with `prefix`, which ends in `/` or is empty. */
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
27
|
+
export declare const TokenCoverage: Schema.Union<readonly [Schema.Struct<{
|
|
28
|
+
repo: Schema.String;
|
|
29
|
+
prefix: Schema.optionalKey<Schema.Never>;
|
|
30
|
+
}>, Schema.Struct<{
|
|
31
|
+
prefix: Schema.String;
|
|
32
|
+
repo: Schema.optionalKey<Schema.Never>;
|
|
33
|
+
}>]>;
|
|
34
|
+
export type TokenCoverage = typeof TokenCoverage.Type;
|
|
26
35
|
/**
|
|
27
36
|
* `createdAt`: when Git's store wrote the token's row, by Git's clock, which no caller sets. A
|
|
28
37
|
* host can bind a token to what held when it was made, such as a membership no older than it.
|
|
29
38
|
*/
|
|
30
|
-
export
|
|
31
|
-
readonly id:
|
|
32
|
-
readonly scope:
|
|
33
|
-
readonly expiresAt:
|
|
34
|
-
readonly createdAt:
|
|
35
|
-
}
|
|
36
|
-
export type
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
export declare const TokenFields: Schema.Struct<{
|
|
40
|
+
readonly id: Schema.String;
|
|
41
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
42
|
+
readonly expiresAt: Schema.Number;
|
|
43
|
+
readonly createdAt: Schema.Number;
|
|
44
|
+
}>;
|
|
45
|
+
export type TokenFields = typeof TokenFields.Type;
|
|
46
|
+
/** What a token covers and allows. */
|
|
47
|
+
export declare const TokenInfo: Schema.Union<readonly [Schema.Struct<{
|
|
48
|
+
readonly repo: Schema.String;
|
|
49
|
+
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
50
|
+
readonly id: Schema.String;
|
|
51
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
52
|
+
readonly expiresAt: Schema.Number;
|
|
53
|
+
readonly createdAt: Schema.Number;
|
|
54
|
+
}>, Schema.Struct<{
|
|
55
|
+
readonly prefix: Schema.String;
|
|
56
|
+
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
57
|
+
readonly id: Schema.String;
|
|
58
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
59
|
+
readonly expiresAt: Schema.Number;
|
|
60
|
+
readonly createdAt: Schema.Number;
|
|
61
|
+
}>]>;
|
|
62
|
+
export type TokenInfo = typeof TokenInfo.Type;
|
|
63
|
+
export declare const TokenRecord: Schema.Union<readonly [Schema.Struct<{
|
|
64
|
+
readonly repo: Schema.String;
|
|
65
|
+
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
66
|
+
readonly id: Schema.String;
|
|
67
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
68
|
+
readonly expiresAt: Schema.Number;
|
|
69
|
+
readonly createdAt: Schema.Number;
|
|
70
|
+
readonly subject: Schema.Struct<{
|
|
71
|
+
readonly id: Schema.String;
|
|
72
|
+
}>;
|
|
73
|
+
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
74
|
+
readonly id: Schema.String;
|
|
75
|
+
}>>;
|
|
76
|
+
readonly revokedAt: Schema.optionalKey<Schema.Number>;
|
|
77
|
+
}>, Schema.Struct<{
|
|
78
|
+
readonly prefix: Schema.String;
|
|
79
|
+
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
80
|
+
readonly id: Schema.String;
|
|
81
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
82
|
+
readonly expiresAt: Schema.Number;
|
|
83
|
+
readonly createdAt: Schema.Number;
|
|
84
|
+
readonly subject: Schema.Struct<{
|
|
85
|
+
readonly id: Schema.String;
|
|
86
|
+
}>;
|
|
87
|
+
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
88
|
+
readonly id: Schema.String;
|
|
89
|
+
}>>;
|
|
90
|
+
readonly revokedAt: Schema.optionalKey<Schema.Number>;
|
|
91
|
+
}>]>;
|
|
92
|
+
export type TokenRecord = typeof TokenRecord.Type;
|
|
93
|
+
/** `secret` is the credential, shown once: only its hash is kept. */
|
|
94
|
+
export declare const CreatedToken: Schema.Union<readonly [Schema.Struct<{
|
|
95
|
+
readonly repo: Schema.String;
|
|
96
|
+
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
97
|
+
readonly id: Schema.String;
|
|
98
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
99
|
+
readonly expiresAt: Schema.Number;
|
|
100
|
+
readonly createdAt: Schema.Number;
|
|
101
|
+
readonly subject: Schema.Struct<{
|
|
102
|
+
readonly id: Schema.String;
|
|
103
|
+
}>;
|
|
104
|
+
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
105
|
+
readonly id: Schema.String;
|
|
106
|
+
}>>;
|
|
107
|
+
readonly revokedAt: Schema.optionalKey<Schema.Number>;
|
|
108
|
+
readonly secret: Schema.String;
|
|
109
|
+
}>, Schema.Struct<{
|
|
110
|
+
readonly prefix: Schema.String;
|
|
111
|
+
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
112
|
+
readonly id: Schema.String;
|
|
113
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
114
|
+
readonly expiresAt: Schema.Number;
|
|
115
|
+
readonly createdAt: Schema.Number;
|
|
116
|
+
readonly subject: Schema.Struct<{
|
|
117
|
+
readonly id: Schema.String;
|
|
118
|
+
}>;
|
|
119
|
+
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
120
|
+
readonly id: Schema.String;
|
|
121
|
+
}>>;
|
|
122
|
+
readonly revokedAt: Schema.optionalKey<Schema.Number>;
|
|
123
|
+
readonly secret: Schema.String;
|
|
124
|
+
}>]>;
|
|
125
|
+
export type CreatedToken = typeof CreatedToken.Type;
|
|
126
|
+
export declare const PrefixTarget: Schema.Struct<{
|
|
127
|
+
readonly prefix: Schema.String;
|
|
128
|
+
}>;
|
|
129
|
+
export type PrefixTarget = typeof PrefixTarget.Type;
|
|
130
|
+
export declare const TokenTarget: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
131
|
+
readonly prefix: Schema.String;
|
|
132
|
+
}>]>;
|
|
133
|
+
export type TokenTarget = typeof TokenTarget.Type;
|
|
41
134
|
/** `subject` answers for the token; `actor` acts for them, and is left out when it's the same party. */
|
|
42
|
-
export
|
|
43
|
-
readonly scope:
|
|
44
|
-
readonly expiresAt:
|
|
45
|
-
readonly subject:
|
|
46
|
-
|
|
135
|
+
export declare const TokenCreate: Schema.Struct<{
|
|
136
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
137
|
+
readonly expiresAt: Schema.Union<readonly [Schema.Number, Schema.Date]>;
|
|
138
|
+
readonly subject: Schema.Struct<{
|
|
139
|
+
readonly id: Schema.String;
|
|
140
|
+
readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
|
|
141
|
+
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
142
|
+
}>;
|
|
143
|
+
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
144
|
+
readonly id: Schema.String;
|
|
145
|
+
readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
|
|
146
|
+
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
147
|
+
}>>;
|
|
47
148
|
/** At most `maxWriteKeyLength` bytes in UTF-8: a longer one is `INVALID_ARGUMENT`. */
|
|
48
|
-
readonly key
|
|
49
|
-
}
|
|
149
|
+
readonly key: Schema.optionalKey<Schema.String>;
|
|
150
|
+
}>;
|
|
151
|
+
export type TokenCreate = typeof TokenCreate.Type;
|
|
152
|
+
export interface TokenCreateInput extends CallInput, TokenCreate {}
|
|
50
153
|
/** Until when a key no token has made yet stays held: no create naming it can come after. */
|
|
51
|
-
export
|
|
52
|
-
readonly until:
|
|
53
|
-
}
|
|
154
|
+
export declare const TokenKey: Schema.Struct<{
|
|
155
|
+
readonly until: Schema.Union<readonly [Schema.Number, Schema.Date]>;
|
|
156
|
+
}>;
|
|
157
|
+
export type TokenKey = typeof TokenKey.Type;
|
|
158
|
+
export interface TokenKeyInput extends CallInput, TokenKey {}
|
|
54
159
|
/** Which tokens a list reads: `active` ones, `expired` or `revoked` ones, or `all`. */
|
|
55
160
|
export declare const tokenStates: readonly ['active', 'expired', 'revoked', 'all'];
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
readonly
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
export type CreatedToken = TokenRecord & {
|
|
68
|
-
readonly secret: string;
|
|
69
|
-
};
|
|
161
|
+
export declare const TokenState: Schema.Literals<readonly ["active", "expired", "revoked", "all"]>;
|
|
162
|
+
export type TokenState = typeof TokenState.Type;
|
|
163
|
+
export declare const TokenList: Schema.Struct<{
|
|
164
|
+
readonly state: Schema.optionalKey<Schema.Literals<readonly ["active", "expired", "revoked", "all"]>>;
|
|
165
|
+
readonly page: Schema.optionalKey<Schema.Struct<{
|
|
166
|
+
readonly after: Schema.optionalKey<Schema.String>;
|
|
167
|
+
readonly limit: Schema.optionalKey<Schema.Int>;
|
|
168
|
+
}>>;
|
|
169
|
+
}>;
|
|
170
|
+
export type TokenList = typeof TokenList.Type;
|
|
171
|
+
export interface TokenListInput extends CallInput, TokenList {}
|
|
70
172
|
/** A call host code makes for itself: it names no actor. */
|
|
71
173
|
export interface TrustedWriteInput extends CallInput {
|
|
72
174
|
readonly key?: string;
|
|
@@ -98,15 +200,100 @@ export interface TokensFeature {
|
|
|
98
200
|
}
|
|
99
201
|
declare const Tokens_base: Context.ServiceClass<Tokens, "@ref0/git/Tokens", EffectCalls<TokenCalls, never>>;
|
|
100
202
|
/**
|
|
101
|
-
* Git's own tokens: `TokenCalls` as Effects, deciding for no caller, as host code's do.
|
|
102
|
-
*
|
|
103
|
-
* there, so code that may run without it reads it with `Effect.serviceOption`.
|
|
104
|
-
* which replaces the `tokens` option, is step 2a2's.
|
|
203
|
+
* Git's own tokens: `TokenCalls` as Effects, deciding for no caller, as host code's do.
|
|
204
|
+
* `Tokens.layer()` provides it, and so does `createGitServer`'s `tokens()` bridge until 2c. With
|
|
205
|
+
* neither it isn't there, so code that may run without it reads it with `Effect.serviceOption`.
|
|
105
206
|
*/
|
|
106
207
|
export declare class Tokens extends /* @__PURE__ */ Tokens_base {}
|
|
107
|
-
export declare const create: (target: TokenTarget, input: TokenCreateInput) => Effect.Effect<
|
|
108
|
-
|
|
109
|
-
|
|
208
|
+
export declare const create: (target: TokenTarget, input: TokenCreateInput) => Effect.Effect<{
|
|
209
|
+
readonly repo: string;
|
|
210
|
+
readonly prefix?: never;
|
|
211
|
+
readonly id: string;
|
|
212
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
213
|
+
readonly expiresAt: number;
|
|
214
|
+
readonly createdAt: number;
|
|
215
|
+
readonly subject: {
|
|
216
|
+
readonly id: string;
|
|
217
|
+
};
|
|
218
|
+
readonly actor?: {
|
|
219
|
+
readonly id: string;
|
|
220
|
+
};
|
|
221
|
+
readonly revokedAt?: number;
|
|
222
|
+
readonly secret: string;
|
|
223
|
+
} | {
|
|
224
|
+
readonly prefix: string;
|
|
225
|
+
readonly repo?: never;
|
|
226
|
+
readonly id: string;
|
|
227
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
228
|
+
readonly expiresAt: number;
|
|
229
|
+
readonly createdAt: number;
|
|
230
|
+
readonly subject: {
|
|
231
|
+
readonly id: string;
|
|
232
|
+
};
|
|
233
|
+
readonly actor?: {
|
|
234
|
+
readonly id: string;
|
|
235
|
+
};
|
|
236
|
+
readonly revokedAt?: number;
|
|
237
|
+
readonly secret: string;
|
|
238
|
+
}, GitError, Tokens>;
|
|
239
|
+
export declare const list: (target: TokenTarget, input?: TokenListInput) => Effect.Effect<Listing<{
|
|
240
|
+
readonly repo: string;
|
|
241
|
+
readonly prefix?: never;
|
|
242
|
+
readonly id: string;
|
|
243
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
244
|
+
readonly expiresAt: number;
|
|
245
|
+
readonly createdAt: number;
|
|
246
|
+
readonly subject: {
|
|
247
|
+
readonly id: string;
|
|
248
|
+
};
|
|
249
|
+
readonly actor?: {
|
|
250
|
+
readonly id: string;
|
|
251
|
+
};
|
|
252
|
+
readonly revokedAt?: number;
|
|
253
|
+
} | {
|
|
254
|
+
readonly prefix: string;
|
|
255
|
+
readonly repo?: never;
|
|
256
|
+
readonly id: string;
|
|
257
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
258
|
+
readonly expiresAt: number;
|
|
259
|
+
readonly createdAt: number;
|
|
260
|
+
readonly subject: {
|
|
261
|
+
readonly id: string;
|
|
262
|
+
};
|
|
263
|
+
readonly actor?: {
|
|
264
|
+
readonly id: string;
|
|
265
|
+
};
|
|
266
|
+
readonly revokedAt?: number;
|
|
267
|
+
}>, GitError, Tokens>;
|
|
268
|
+
export declare const get: (token: TokenId, input?: CallInput) => Effect.Effect<{
|
|
269
|
+
readonly repo: string;
|
|
270
|
+
readonly prefix?: never;
|
|
271
|
+
readonly id: string;
|
|
272
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
273
|
+
readonly expiresAt: number;
|
|
274
|
+
readonly createdAt: number;
|
|
275
|
+
readonly subject: {
|
|
276
|
+
readonly id: string;
|
|
277
|
+
};
|
|
278
|
+
readonly actor?: {
|
|
279
|
+
readonly id: string;
|
|
280
|
+
};
|
|
281
|
+
readonly revokedAt?: number;
|
|
282
|
+
} | {
|
|
283
|
+
readonly prefix: string;
|
|
284
|
+
readonly repo?: never;
|
|
285
|
+
readonly id: string;
|
|
286
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
287
|
+
readonly expiresAt: number;
|
|
288
|
+
readonly createdAt: number;
|
|
289
|
+
readonly subject: {
|
|
290
|
+
readonly id: string;
|
|
291
|
+
};
|
|
292
|
+
readonly actor?: {
|
|
293
|
+
readonly id: string;
|
|
294
|
+
};
|
|
295
|
+
readonly revokedAt?: number;
|
|
296
|
+
}, GitError, Tokens>;
|
|
110
297
|
export declare const revoke: (token: TokenId, input?: TrustedWriteInput) => Effect.Effect<void, GitError, Tokens>;
|
|
111
298
|
export declare const revokeKey: (target: TokenTarget, key: string, input: TokenKeyInput) => Effect.Effect<void, GitError, Tokens>;
|
|
112
|
-
export {
|
|
299
|
+
export {};
|
|
@@ -1,28 +1,96 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { ActorId, NamedActor } from "./actors.mjs";
|
|
2
|
+
import { Page } from "./engine.mjs";
|
|
3
|
+
import { RepoName } from "./ids.mjs";
|
|
4
|
+
import { Moment } from "./repos.mjs";
|
|
3
5
|
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
4
7
|
import * as Context from "effect/Context";
|
|
5
8
|
// src/contracts/tokens.ts
|
|
6
|
-
var tokens_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
-
TokenId: () => TokenId,
|
|
8
|
-
TokenScope: () => TokenScope,
|
|
9
|
-
Tokens: () => Tokens,
|
|
10
|
-
create: () => create,
|
|
11
|
-
get: () => get,
|
|
12
|
-
list: () => list,
|
|
13
|
-
revoke: () => revoke,
|
|
14
|
-
revokeKey: () => revokeKey,
|
|
15
|
-
tokenScopes: () => tokenScopes,
|
|
16
|
-
tokenStates: () => tokenStates
|
|
17
|
-
});
|
|
18
9
|
const TokenId = Schema.String;
|
|
19
|
-
/**
|
|
20
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The scopes a grant may hold, a sign-in's or an extension's, and what Git's ceiling on a repo
|
|
12
|
+
* answers: `read`, then `report`, then `write`.
|
|
13
|
+
*/
|
|
14
|
+
const grantScopes = [
|
|
21
15
|
"read",
|
|
22
16
|
"report",
|
|
23
17
|
"write"
|
|
24
18
|
];
|
|
19
|
+
const GrantScope = /* @__PURE__ */ Schema.Literals(grantScopes);
|
|
20
|
+
/**
|
|
21
|
+
* Each scope a token can have, a ceiling `authorize` can narrow: the grant scopes, then `admin`.
|
|
22
|
+
* An `admin` token reaches every operation kind, as a host's own sign-in does, and covers only
|
|
23
|
+
* the whole host, `{ prefix: '' }`. Its ceiling never opens past the host's `Policy`: a policy
|
|
24
|
+
* that doesn't accept `admin` refuses it, as `Policy.signedIn` does.
|
|
25
|
+
*/
|
|
26
|
+
const tokenScopes = [...grantScopes, "admin"];
|
|
25
27
|
const TokenScope = /* @__PURE__ */ Schema.Literals(tokenScopes);
|
|
28
|
+
const repoCoverage = {
|
|
29
|
+
repo: RepoName,
|
|
30
|
+
prefix: Schema.optionalKey(Schema.Never)
|
|
31
|
+
};
|
|
32
|
+
const prefixCoverage = {
|
|
33
|
+
prefix: Schema.String,
|
|
34
|
+
repo: Schema.optionalKey(Schema.Never)
|
|
35
|
+
};
|
|
36
|
+
/** One repo, or every repo whose ID starts with `prefix`, which ends in `/` or is empty. */
|
|
37
|
+
const TokenCoverage = /* @__PURE__ */ Schema.Union([Schema.Struct(repoCoverage), Schema.Struct(prefixCoverage)]);
|
|
38
|
+
/**
|
|
39
|
+
* `createdAt`: when Git's store wrote the token's row, by Git's clock, which no caller sets. A
|
|
40
|
+
* host can bind a token to what held when it was made, such as a membership no older than it.
|
|
41
|
+
*/
|
|
42
|
+
const TokenFields = /* @__PURE__ */ Schema.Struct({
|
|
43
|
+
id: TokenId,
|
|
44
|
+
scope: TokenScope,
|
|
45
|
+
expiresAt: Moment,
|
|
46
|
+
createdAt: Moment
|
|
47
|
+
});
|
|
48
|
+
/** What a token covers and allows. */
|
|
49
|
+
const TokenInfo = /* @__PURE__ */ Schema.Union([Schema.Struct({
|
|
50
|
+
...TokenFields.fields,
|
|
51
|
+
...repoCoverage
|
|
52
|
+
}), Schema.Struct({
|
|
53
|
+
...TokenFields.fields,
|
|
54
|
+
...prefixCoverage
|
|
55
|
+
})]).annotate({ identifier: "TokenInfo" });
|
|
56
|
+
const recordFields = {
|
|
57
|
+
...TokenFields.fields,
|
|
58
|
+
subject: ActorId,
|
|
59
|
+
actor: Schema.optionalKey(ActorId),
|
|
60
|
+
revokedAt: Schema.optionalKey(Moment)
|
|
61
|
+
};
|
|
62
|
+
const TokenRecord = /* @__PURE__ */ Schema.Union([Schema.Struct({
|
|
63
|
+
...recordFields,
|
|
64
|
+
...repoCoverage
|
|
65
|
+
}), Schema.Struct({
|
|
66
|
+
...recordFields,
|
|
67
|
+
...prefixCoverage
|
|
68
|
+
})]).annotate({ identifier: "TokenRecord" });
|
|
69
|
+
/** `secret` is the credential, shown once: only its hash is kept. */
|
|
70
|
+
const CreatedToken = /* @__PURE__ */ Schema.Union([Schema.Struct({
|
|
71
|
+
...recordFields,
|
|
72
|
+
secret: Schema.String,
|
|
73
|
+
...repoCoverage
|
|
74
|
+
}), Schema.Struct({
|
|
75
|
+
...recordFields,
|
|
76
|
+
secret: Schema.String,
|
|
77
|
+
...prefixCoverage
|
|
78
|
+
})]).annotate({ identifier: "CreatedToken" });
|
|
79
|
+
const PrefixTarget = /* @__PURE__ */ Schema.Struct({ prefix: Schema.String });
|
|
80
|
+
const TokenTarget = /* @__PURE__ */ Schema.Union([RepoName, PrefixTarget]);
|
|
81
|
+
/** A moment a direct call takes: milliseconds since the epoch, or a `Date`. On the wire, only milliseconds. */
|
|
82
|
+
const MomentOrDate = /* @__PURE__ */ Schema.Union([Moment, Schema.Date]);
|
|
83
|
+
/** `subject` answers for the token; `actor` acts for them, and is left out when it's the same party. */
|
|
84
|
+
const TokenCreate = /* @__PURE__ */ Schema.Struct({
|
|
85
|
+
scope: TokenScope,
|
|
86
|
+
expiresAt: MomentOrDate,
|
|
87
|
+
subject: NamedActor,
|
|
88
|
+
actor: Schema.optionalKey(NamedActor),
|
|
89
|
+
/** At most `maxWriteKeyLength` bytes in UTF-8: a longer one is `INVALID_ARGUMENT`. */
|
|
90
|
+
key: Schema.optionalKey(Schema.String)
|
|
91
|
+
});
|
|
92
|
+
/** Until when a key no token has made yet stays held: no create naming it can come after. */
|
|
93
|
+
const TokenKey = /* @__PURE__ */ Schema.Struct({ until: MomentOrDate });
|
|
26
94
|
/** Which tokens a list reads: `active` ones, `expired` or `revoked` ones, or `all`. */
|
|
27
95
|
const tokenStates = [
|
|
28
96
|
"active",
|
|
@@ -30,11 +98,15 @@ const tokenStates = [
|
|
|
30
98
|
"revoked",
|
|
31
99
|
"all"
|
|
32
100
|
];
|
|
101
|
+
const TokenState = /* @__PURE__ */ Schema.Literals(tokenStates);
|
|
102
|
+
const TokenList = /* @__PURE__ */ Schema.Struct({
|
|
103
|
+
state: Schema.optionalKey(TokenState),
|
|
104
|
+
page: Schema.optionalKey(Page)
|
|
105
|
+
});
|
|
33
106
|
/**
|
|
34
|
-
* Git's own tokens: `TokenCalls` as Effects, deciding for no caller, as host code's do.
|
|
35
|
-
*
|
|
36
|
-
* there, so code that may run without it reads it with `Effect.serviceOption`.
|
|
37
|
-
* which replaces the `tokens` option, is step 2a2's.
|
|
107
|
+
* Git's own tokens: `TokenCalls` as Effects, deciding for no caller, as host code's do.
|
|
108
|
+
* `Tokens.layer()` provides it, and so does `createGitServer`'s `tokens()` bridge until 2c. With
|
|
109
|
+
* neither it isn't there, so code that may run without it reads it with `Effect.serviceOption`.
|
|
38
110
|
*/
|
|
39
111
|
var Tokens = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/Tokens")) {};
|
|
40
112
|
const create = (target, input) => Effect.flatMap(Effect.service(Tokens), (tokens) => tokens.create(target, input));
|
|
@@ -42,4 +114,4 @@ const list = (target, input) => Effect.flatMap(Effect.service(Tokens), (tokens)
|
|
|
42
114
|
const get = (token, input) => Effect.flatMap(Effect.service(Tokens), (tokens) => tokens.get(token, input));
|
|
43
115
|
const revoke = (token, input) => Effect.flatMap(Effect.service(Tokens), (tokens) => tokens.revoke(token, input));
|
|
44
116
|
const revokeKey = (target, key, input) => Effect.flatMap(Effect.service(Tokens), (tokens) => tokens.revokeKey(target, key, input));
|
|
45
|
-
export { TokenId, TokenScope, Tokens, create, get, list, revoke, revokeKey, tokenScopes, tokenStates
|
|
117
|
+
export { CreatedToken, GrantScope, PrefixTarget, TokenCoverage, TokenCreate, TokenFields, TokenId, TokenInfo, TokenKey, TokenList, TokenRecord, TokenScope, TokenState, TokenTarget, Tokens, create, get, grantScopes, list, revoke, revokeKey, tokenScopes, tokenStates };
|
|
@@ -3,9 +3,10 @@ import { ActorInput, WriteInput } from "./actors.mjs";
|
|
|
3
3
|
import { HandlerOptions } from "./handlers.mjs";
|
|
4
4
|
import { TopicId } from "./ids.mjs";
|
|
5
5
|
import { CandidateId, Report, ReportOptions, ReportResult } from "./queue.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
6
|
+
import { DecisionAnswer, GitError, Result } from "./result.mjs";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Schema from "effect/Schema";
|
|
9
|
+
import { Listing, Page } from "@ref0/infra";
|
|
9
10
|
/** One repo's target in a topic: at most one entry a repo and target. */
|
|
10
11
|
export declare const TopicTarget: Schema.Struct<{
|
|
11
12
|
readonly repo: Schema.String;
|
|
@@ -45,6 +46,8 @@ export type TopicFailureReason = typeof TopicFailureReason.Type;
|
|
|
45
46
|
/**
|
|
46
47
|
* Why a topic failed, for good: it holds nothing. `hint` says to add the change under a new key,
|
|
47
48
|
* needing no `topics.remove` of it (Q624); after a `timeout`, it names the timeout and each target.
|
|
49
|
+
* A `refused` past the publish decision, by a rule changed since its check, leaves each member that
|
|
50
|
+
* already published merged: `repo` names the one refused, and `summary` those (Q1159).
|
|
48
51
|
*/
|
|
49
52
|
export declare const TopicFailure: Schema.Struct<{
|
|
50
53
|
readonly reason: Schema.Literals<readonly ["entry-failed", "reported", "cancelled", "refused", "host-error", "work-failed", "timeout", "report-timeout", "prepare-rejected"]>;
|
|
@@ -57,7 +60,7 @@ export declare const TopicFailure: Schema.Struct<{
|
|
|
57
60
|
readonly error: Schema.optionalKey<Schema.String>;
|
|
58
61
|
readonly hint: Schema.String;
|
|
59
62
|
/**
|
|
60
|
-
* The host's own step, as raising a `
|
|
63
|
+
* The host's own step, as raising a `Topics.layer()` timeout: in-process calls keep it, and REST's
|
|
61
64
|
* body and the `topic.failed` event leave it out, as a `GitError`'s `hostHint` (Q851).
|
|
62
65
|
*/
|
|
63
66
|
readonly hostHint: Schema.optionalKey<Schema.String>;
|
|
@@ -66,8 +69,9 @@ export type TopicFailure = typeof TopicFailure.Type;
|
|
|
66
69
|
/**
|
|
67
70
|
* `reserving` while it takes each target, which `waitingOn` says it waits on, `checking` while it
|
|
68
71
|
* holds them all and its members check, `publishing` once its publish decision is saved, and then
|
|
69
|
-
* `merged`; or, before the decision, `failed` or `removed`.
|
|
70
|
-
*
|
|
72
|
+
* `merged`; or, before the decision, `failed` or `removed`. Past it, only a member's publish
|
|
73
|
+
* refused fails it, with those that published merged. `failed`, `merged` and `removed` are final:
|
|
74
|
+
* each holds nothing, and its key never opens again (Q624).
|
|
71
75
|
*/
|
|
72
76
|
export declare const TopicState: Schema.Literals<readonly ["reserving", "checking", "publishing", "failed", "merged", "removed"]>;
|
|
73
77
|
export type TopicState = typeof TopicState.Type;
|
|
@@ -134,7 +138,7 @@ export declare const Topic: Schema.Struct<{
|
|
|
134
138
|
readonly error: Schema.optionalKey<Schema.String>;
|
|
135
139
|
readonly hint: Schema.String;
|
|
136
140
|
/**
|
|
137
|
-
* The host's own step, as raising a `
|
|
141
|
+
* The host's own step, as raising a `Topics.layer()` timeout: in-process calls keep it, and REST's
|
|
138
142
|
* body and the `topic.failed` event leave it out, as a `GitError`'s `hostHint` (Q851).
|
|
139
143
|
*/
|
|
140
144
|
readonly hostHint: Schema.optionalKey<Schema.String>;
|
|
@@ -183,23 +187,48 @@ export interface TopicCalls {
|
|
|
183
187
|
report(topic: TopicId, input: TopicReportInput): Promise<ReportResult>;
|
|
184
188
|
}
|
|
185
189
|
/** What the topic report and `prepare` are asked about. */
|
|
186
|
-
export
|
|
187
|
-
readonly topic:
|
|
188
|
-
readonly entries:
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
export declare const TopicReportQuestion: Schema.Struct<{
|
|
191
|
+
readonly topic: Schema.String;
|
|
192
|
+
readonly entries: Schema.$Array<Schema.Struct<{
|
|
193
|
+
readonly repo: Schema.String;
|
|
194
|
+
readonly target: Schema.String;
|
|
195
|
+
readonly entry: Schema.String;
|
|
196
|
+
readonly key: Schema.String;
|
|
197
|
+
readonly source: Schema.String;
|
|
198
|
+
readonly head: Schema.String;
|
|
199
|
+
}>>;
|
|
200
|
+
}>;
|
|
201
|
+
export type TopicReportQuestion = typeof TopicReportQuestion.Type;
|
|
202
|
+
export declare const PrepareInput: Schema.Struct<{
|
|
203
|
+
readonly topic: Schema.String;
|
|
204
|
+
readonly entries: Schema.$Array<Schema.Struct<{
|
|
205
|
+
readonly repo: Schema.String;
|
|
206
|
+
readonly target: Schema.String;
|
|
207
|
+
readonly entry: Schema.String;
|
|
208
|
+
readonly key: Schema.String;
|
|
209
|
+
readonly source: Schema.String;
|
|
210
|
+
readonly head: Schema.String;
|
|
211
|
+
}>>;
|
|
212
|
+
readonly candidates: Schema.$Array<Schema.Struct<{
|
|
213
|
+
readonly repo: Schema.String;
|
|
214
|
+
readonly target: Schema.String;
|
|
215
|
+
readonly candidate: Schema.String;
|
|
216
|
+
readonly ref: Schema.String;
|
|
217
|
+
readonly commit: Schema.String;
|
|
218
|
+
}>>;
|
|
192
219
|
/** The set key of these exact candidates: the same for the same set, whatever the call's try. */
|
|
193
|
-
readonly key:
|
|
220
|
+
readonly key: Schema.String;
|
|
194
221
|
/** This call's try, from 1: a try the server died in runs again. Not a topic's attempt (Q624). */
|
|
195
|
-
readonly attempt:
|
|
196
|
-
|
|
197
|
-
|
|
222
|
+
readonly attempt: Schema.Number;
|
|
223
|
+
}>;
|
|
224
|
+
export type PrepareInput = typeof PrepareInput.Type;
|
|
198
225
|
/**
|
|
199
226
|
* Called once a set has passed, while every target is reserved, before the publish decision: it
|
|
200
227
|
* must be repeatable and reversible, since `topics.remove` may let go of the targets while it runs,
|
|
201
228
|
* and its answer then counts for nothing. An accept lets the topic decide; a reject fails it
|
|
202
|
-
* `prepare-rejected`, and a throw
|
|
229
|
+
* `prepare-rejected`, and a throw, a timeout or an answer that is neither `accept()` nor
|
|
230
|
+
* `reject()` `host-error`, all final (Q648).
|
|
231
|
+
* A typed `GitError` failure also ends as `host-error`; a timeout interrupts the Effect.
|
|
203
232
|
*
|
|
204
233
|
* The call is never made again once it answered, a throw or a timeout included: only a call the
|
|
205
234
|
* server died in runs again. A save of its answer that fails is retried from the job's row, with
|
|
@@ -211,16 +240,16 @@ export interface PrepareInput extends TopicReportQuestion {
|
|
|
211
240
|
* Its `timeout`, in `{ handler, timeout }`, is 30 seconds unless set, and 12 minutes at most: a
|
|
212
241
|
* Git job's 13-minute try keeps a minute to save the answer.
|
|
213
242
|
*/
|
|
214
|
-
export type Prepare = (input: PrepareInput) =>
|
|
243
|
+
export type Prepare = (input: PrepareInput) => Effect.Effect<DecisionAnswer, GitError>;
|
|
215
244
|
/**
|
|
216
245
|
* A topic report, required where `required` says. `timeout` limits how long a set waits for its
|
|
217
246
|
* report once `topic.opened` names it, 60 minutes by default, 1 millisecond to 365 days; past it
|
|
218
|
-
* the topic fails `report-timeout`. `
|
|
247
|
+
* the topic fails `report-timeout`. `Topics.layer({ timeout })` limits the topic's whole hold.
|
|
219
248
|
*/
|
|
220
249
|
export interface TopicReportOptions extends ReportOptions {
|
|
221
250
|
readonly required: (input: TopicReportQuestion) => boolean;
|
|
222
251
|
}
|
|
223
|
-
export interface
|
|
252
|
+
export interface TopicsLayerOptions {
|
|
224
253
|
readonly prepare?: Prepare | HandlerOptions<Prepare>;
|
|
225
254
|
readonly report?: TopicReportOptions;
|
|
226
255
|
/**
|
|
@@ -229,8 +258,18 @@ export interface TopicsOptions {
|
|
|
229
258
|
* The queue's `report.timeout` limits one candidate's report; this, the topic's whole hold.
|
|
230
259
|
*/
|
|
231
260
|
readonly timeout?: Duration;
|
|
261
|
+
/**
|
|
262
|
+
* How long a topic that holds no target yet waits for its first, from when it first waits: 1
|
|
263
|
+
* millisecond to 365 days, and no longer than `timeout`. By default it's the shorter of 2 hours
|
|
264
|
+
* and `timeout`, so with a `timeout` of 30 minutes a topic waits 30 minutes at most. Past it,
|
|
265
|
+
* the topic fails `timeout`, naming what it waited for. Halfway, a member freezes the target it
|
|
266
|
+
* waits on: its queue opens nothing new in another lane or at a higher priority, so the target
|
|
267
|
+
* drains of what's open.
|
|
268
|
+
*/
|
|
269
|
+
readonly waitTimeout?: Duration;
|
|
232
270
|
}
|
|
233
271
|
/** What `topics()` returns: the options it checked, which only `createGitServer` reads. */
|
|
234
272
|
export interface TopicsFactory {
|
|
235
273
|
readonly kind: 'topics';
|
|
274
|
+
readonly options: TopicsLayerOptions;
|
|
236
275
|
}
|