@ref0/git 0.12.0 → 0.14.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/private-refs.mjs +3 -3
- package/dist/auth/auth.d.mts +2 -2
- package/dist/auth/auth.mjs +3 -6
- package/dist/auth/authorize.mjs +1 -17
- package/dist/auth/helpers.mjs +3 -11
- package/dist/auth/host-services.mjs +11 -0
- package/dist/auth/policy.d.mts +27 -7
- package/dist/auth/policy.mjs +8 -4
- package/dist/auth/tokens-layer.d.mts +1 -2
- package/dist/auth/tokens-layer.mjs +2 -3
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens.d.mts +1 -8
- package/dist/auth/tokens.mjs +1 -8
- package/dist/auth.d.mts +1 -4
- package/dist/auth.mjs +1 -3
- package/dist/client/git-http.mjs +18 -4
- package/dist/client/push-upload.mjs +33 -7
- package/dist/client/remote.mjs +94 -28
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/contracts/access.d.mts +8 -8
- package/dist/contracts/actors.d.mts +2 -34
- package/dist/contracts/blobs.d.mts +2 -2
- package/dist/contracts/client.d.mts +8 -3
- package/dist/contracts/commits.d.mts +10 -2
- package/dist/contracts/commits.mjs +9 -1
- package/dist/contracts/files.d.mts +2 -2
- package/dist/contracts/forks.d.mts +11 -1
- package/dist/contracts/git.d.mts +18 -7
- package/dist/contracts/git.mjs +3 -2
- package/dist/contracts/lfs.d.mts +0 -7
- package/dist/contracts/objects.d.mts +80 -10
- package/dist/contracts/operations.d.mts +3 -0
- package/dist/contracts/operations.mjs +12 -2
- package/dist/contracts/push-uploads.d.mts +44 -5
- package/dist/contracts/push-uploads.mjs +7 -3
- package/dist/contracts/refs.d.mts +28 -6
- package/dist/contracts/remote.mjs +1 -3
- package/dist/contracts/repo-records.d.mts +1 -0
- package/dist/contracts/repos.d.mts +90 -2
- package/dist/contracts/repos.mjs +29 -2
- package/dist/contracts/result.d.mts +23 -18
- package/dist/contracts/result.mjs +17 -4
- package/dist/contracts/rules.d.mts +22 -22
- package/dist/contracts/server.d.mts +28 -77
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/sync.d.mts +79 -19
- package/dist/contracts/sync.mjs +34 -10
- package/dist/contracts/tokens.d.mts +1 -6
- package/dist/contracts/tokens.mjs +1 -2
- package/dist/contracts/topics.d.mts +0 -5
- package/dist/contracts/work.d.mts +66 -2
- package/dist/contracts/work.mjs +8 -1
- package/dist/core/access.mjs +27 -5
- package/dist/core/ancestry.d.mts +9 -0
- package/dist/core/ancestry.mjs +6 -6
- package/dist/core/asked.mjs +42 -4
- package/dist/core/call-names.mjs +1 -0
- package/dist/core/call-services.mjs +2 -1
- package/dist/core/events/deliver.mjs +10 -2
- package/dist/core/forks.mjs +3 -3
- package/dist/core/imports.mjs +147 -9
- package/dist/core/index-job.mjs +9 -6
- package/dist/core/job-view.mjs +8 -9
- package/dist/core/mirror-rows.mjs +19 -4
- package/dist/core/objects/commits.mjs +16 -6
- package/dist/core/parts.d.mts +6 -1
- package/dist/core/parts.mjs +1 -4
- package/dist/core/purge.mjs +76 -6
- package/dist/core/push-decide.mjs +1 -1
- package/dist/core/push-files.d.mts +12 -0
- package/dist/core/push-files.mjs +225 -0
- package/dist/core/push-repo.d.mts +8 -0
- package/dist/core/push-repo.mjs +56 -0
- package/dist/core/push.d.mts +17 -0
- package/dist/core/push.mjs +98 -26
- package/dist/core/receipts.mjs +26 -10
- package/dist/core/ref-view.mjs +59 -5
- package/dist/core/refs.mjs +13 -8
- package/dist/core/repack.mjs +11 -8
- package/dist/core/repo-info.mjs +16 -9
- package/dist/core/repos.mjs +30 -14
- package/dist/core/seam.mjs +2 -2
- package/dist/core/view.d.mts +6 -0
- package/dist/core/view.mjs +45 -12
- package/dist/core/work.mjs +47 -22
- package/dist/effect.d.mts +3 -1
- package/dist/effect.mjs +3 -1
- package/dist/engine/reads.mjs +13 -6
- package/dist/engine/walk.mjs +4 -4
- package/dist/event-streams/event-streams.d.mts +1 -1
- package/dist/event-streams/event-streams.mjs +1 -1
- package/dist/event-streams/stream.d.mts +1 -1
- package/dist/event-streams/stream.mjs +1 -1
- package/dist/extend.d.mts +3 -3
- package/dist/extend.mjs +2 -2
- package/dist/http/answers.mjs +4 -2
- package/dist/http/core-parts.mjs +64 -15
- package/dist/http/handler.mjs +2 -2
- package/dist/http/node.mjs +5 -4
- package/dist/http/parts.d.mts +1 -0
- package/dist/http/push-upload-job.mjs +503 -0
- package/dist/http/push-uploads.d.mts +1 -0
- package/dist/http/push-uploads.mjs +114 -56
- package/dist/http/upload-pack.mjs +7 -6
- package/dist/index.d.mts +23 -24
- package/dist/index.mjs +4 -7
- package/dist/lfs/base.d.mts +7 -3
- package/dist/lfs/base.mjs +2 -1
- package/dist/lfs/copy.d.mts +46 -0
- package/dist/lfs/copy.mjs +26 -0
- package/dist/lfs/layer.mjs +4 -2
- package/dist/lfs/objects.d.mts +6 -0
- package/dist/lfs/objects.mjs +68 -41
- package/dist/lfs/rows.d.mts +13 -0
- package/dist/lfs/service.d.mts +1 -7
- package/dist/lfs/service.mjs +1 -9
- package/dist/lfs/upload-most.mjs +5 -5
- package/dist/node.d.mts +2 -2
- package/dist/protocol/bytes/sha256-hasher.d.mts +15 -0
- package/dist/protocol/bytes/sha256.d.mts +32 -0
- package/dist/protocol/bytes/sha256.mjs +105 -49
- package/dist/protocol/wire/advertisement.mjs +9 -4
- package/dist/protocol/wire/lines.d.mts +4 -2
- package/dist/protocol/wire/lines.mjs +11 -5
- package/dist/protocol/wire/push-uploads.mjs +13 -1
- package/dist/protocol/wire/v2.mjs +2 -2
- package/dist/protocol.d.mts +3 -1
- package/dist/protocol.mjs +3 -1
- package/dist/queue/advance.mjs +1 -1
- package/dist/queue/host.d.mts +1 -7
- package/dist/queue/host.mjs +1 -7
- package/dist/queue/layer.mjs +1 -1
- package/dist/queue/trim.mjs +1 -1
- package/dist/rest/blobs.d.mts +31 -23
- package/dist/rest/blobs.mjs +1 -1
- package/dist/rest/caller.d.mts +49 -9
- package/dist/rest/caller.mjs +1 -1
- package/dist/rest/client.d.mts +10 -3
- package/dist/rest/client.mjs +4 -0
- package/dist/rest/commits.d.mts +273 -240
- package/dist/rest/errors.d.mts +24 -4
- package/dist/rest/events.d.mts +9 -6
- package/dist/rest/events.mjs +1 -2
- package/dist/rest/files.d.mts +127 -115
- package/dist/rest/forks.d.mts +121 -97
- package/dist/rest/handler.mjs +4 -57
- package/dist/rest/handlers.d.mts +1 -1
- package/dist/rest/handlers.mjs +18 -4
- package/dist/rest/layer.mjs +2 -1
- package/dist/rest/me.d.mts +8 -4
- package/dist/rest/merges.d.mts +8 -4
- package/dist/rest/paths.mjs +1 -0
- package/dist/rest/queue.d.mts +282 -226
- package/dist/rest/refs.d.mts +205 -176
- package/dist/rest/repos.d.mts +108 -80
- package/dist/rest/tags.d.mts +24 -12
- package/dist/rest/tokens.d.mts +235 -211
- package/dist/rest/topics.d.mts +53 -33
- package/dist/rest/trees.d.mts +105 -89
- package/dist/rest/work.d.mts +467 -20
- package/dist/rest/work.mjs +8 -0
- package/dist/server/edge-node.d.mts +9 -13
- package/dist/server/edge-node.mjs +9 -12
- package/dist/server/git-layer.d.mts +1 -6
- package/dist/server/git-layer.mjs +2 -2
- package/dist/server/git-namespace.d.mts +3 -3
- package/dist/server/joined.d.mts +15 -22
- package/dist/server/joined.mjs +5 -29
- package/dist/server/lifecycle.mjs +107 -23
- package/dist/server/registry.mjs +9 -1
- package/dist/server/server.mjs +133 -212
- package/dist/storage/budget.mjs +2 -2
- package/dist/storage/clean-up.mjs +13 -10
- package/dist/storage/fetch.mjs +13 -8
- package/dist/storage/file-limits.mjs +24 -0
- package/dist/storage/index-build.d.mts +1 -0
- package/dist/storage/index-build.mjs +106 -62
- package/dist/storage/index-fetch.mjs +16 -3
- package/dist/storage/index-reach.mjs +33 -5
- package/dist/storage/index-remap.mjs +8 -1
- package/dist/storage/index-shallow.mjs +5 -3
- package/dist/storage/largest-files.mjs +48 -0
- package/dist/storage/lfs-pointers.mjs +10 -1
- package/dist/storage/loose.mjs +3 -1
- package/dist/storage/memory-budget.mjs +28 -4
- package/dist/storage/pack-reads.mjs +8 -8
- package/dist/storage/pack-receive.mjs +83 -25
- package/dist/storage/packs.mjs +37 -21
- package/dist/storage/prune-keep.mjs +203 -34
- package/dist/storage/prune-walk.mjs +54 -16
- package/dist/storage/prune.mjs +629 -196
- package/dist/storage/push-uploads.mjs +36 -12
- package/dist/storage/quarantine.mjs +9 -9
- package/dist/storage/ready.mjs +47 -19
- package/dist/storage/receive-bounds.mjs +29 -8
- package/dist/storage/receive-state.mjs +8 -0
- package/dist/storage/receive-steps.mjs +71 -18
- package/dist/storage/repack.d.mts +1 -1
- package/dist/storage/repack.mjs +1 -8
- package/dist/storage/rows.mjs +12 -1
- package/dist/storage/shallow.d.mts +1 -0
- package/dist/storage/shallow.mjs +26 -4
- package/dist/storage/stream-whole.mjs +5 -2
- package/dist/storage/visible.mjs +29 -1
- package/dist/storage/walk.mjs +2 -1
- package/dist/store/catalogue.mjs +1 -0
- package/dist/store/cursor-seal-namespace.d.mts +2 -0
- package/dist/store/cursor-seal-public.d.mts +5 -0
- package/dist/store/cursor-seal-public.mjs +5 -0
- package/dist/store/cursor-seal.d.mts +16 -2
- package/dist/store/cursor-seal.mjs +26 -14
- package/dist/store/errors.mjs +9 -1
- package/dist/store/records.d.mts +2 -0
- package/dist/store/records.mjs +9 -6
- package/dist/store/repo-record.d.mts +9 -7
- package/dist/store/repo-record.mjs +102 -19
- package/dist/store/scopes.mjs +10 -2
- package/dist/sync/bound.d.mts +2 -0
- package/dist/sync/bound.mjs +11 -2
- package/dist/sync/github.d.mts +6 -1
- package/dist/sync/github.mjs +55 -43
- package/dist/sync/http.mjs +36 -1
- package/dist/sync/import.mjs +1 -0
- package/dist/sync/layer.mjs +6 -2
- package/dist/sync/lfs-batch.mjs +119 -0
- package/dist/sync/lfs-copy.mjs +251 -0
- package/dist/sync/mirror.mjs +210 -137
- package/dist/sync/smart-http.mjs +4 -2
- package/dist/sync/step.mjs +25 -5
- package/dist/sync/tries.mjs +45 -14
- package/dist/sync.d.mts +2 -2
- package/dist/topics/host.mjs +1 -19
- package/dist/topics/layer.mjs +1 -1
- package/package.json +3 -8
- package/dist/auth/bridge.mjs +0 -30
- package/dist/auth/helpers.d.mts +0 -17
- package/dist/core/purge.d.mts +0 -8
- package/dist/core/registered-rows.d.mts +0 -5
- package/dist/core/repack.d.mts +0 -11
- package/dist/http/handler.d.mts +0 -2
- package/dist/rest/handler.d.mts +0 -21
- package/dist/rest.d.mts +0 -2
- package/dist/rest.mjs +0 -1
- package/dist/server/registry.d.mts +0 -16
- package/dist/server/server.d.mts +0 -36
- package/dist/storage/repack-job.d.mts +0 -3
- package/dist/topics/host.d.mts +0 -7
package/dist/sync/tries.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { runnerIn } from "../store/crossing.mjs";
|
|
1
|
+
import { runnerIn, untilAborted } from "../store/crossing.mjs";
|
|
2
2
|
import { gitError, gitErrorFrom, isGitError } from "../contracts/result.mjs";
|
|
3
3
|
import { openRepo } from "../core/access.mjs";
|
|
4
4
|
import { CoreParts } from "../core/parts.mjs";
|
|
@@ -13,10 +13,12 @@ import { collections } from "../store/scopes.mjs";
|
|
|
13
13
|
import { ProviderRefused, saidOf } from "./said.mjs";
|
|
14
14
|
import { quoted } from "../protocol/bytes/text.mjs";
|
|
15
15
|
import { responseToWeb } from "./http.mjs";
|
|
16
|
-
import { callLimitIn,
|
|
16
|
+
import { callLimitIn, spentAt, spentOf, spentRefusalOf } from "../contracts/calls-spent.mjs";
|
|
17
|
+
import { chargeCall } from "../store/call-count.mjs";
|
|
17
18
|
import * as Effect from "effect/Effect";
|
|
18
19
|
import * as HttpClient from "effect/http/HttpClient";
|
|
19
20
|
import * as Schema from "effect/Schema";
|
|
21
|
+
import * as Cause from "effect/Cause";
|
|
20
22
|
import * as Predicate from "effect/Predicate";
|
|
21
23
|
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
22
24
|
// src/sync/tries.ts
|
|
@@ -74,17 +76,32 @@ const unknownProvider = (name) => gitError("INVALID_ARGUMENT", `No provider name
|
|
|
74
76
|
});
|
|
75
77
|
/** `message`, then what a refusal said when its provider kept some of it, quoted. */
|
|
76
78
|
const withSaid = (message, said) => said === void 0 ? message : `${message}. Its refusal said: ${quoted(said)}`;
|
|
77
|
-
/**
|
|
78
|
-
const
|
|
79
|
+
/** The refusal a provider failed with: itself when it died of one, or the cause its `GitError` holds. */
|
|
80
|
+
const refusalIn = (cause) => {
|
|
81
|
+
if (cause instanceof ProviderRefused) return cause;
|
|
82
|
+
return isGitError(cause) && cause.cause instanceof ProviderRefused ? cause.cause : void 0;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* A provider that failed: what its own call's refusal said when it kept some, as a
|
|
86
|
+
* `ProviderRefused` it failed with or under, else nothing of it.
|
|
87
|
+
*/
|
|
88
|
+
const providerFailed = (name, cause) => gitError("UNAVAILABLE", withSaid(`The '${name}' provider made no remote for this try`, refusalIn(cause)?.said), { hint: "The job tries again" });
|
|
79
89
|
/**
|
|
80
|
-
* The provider's remote for this try
|
|
81
|
-
*
|
|
90
|
+
* The provider's remote for this try, its Effect run in the try's fiber, so the calls it makes are
|
|
91
|
+
* charged to the try's budget, and interrupted once `signal` aborts: a provider that has gone
|
|
92
|
+
* since fails the job for good, naming it, and one that fails or dies fails this try with a
|
|
93
|
+
* message that names no secret. A spent call bound stays the defect it is, so the try stops whole.
|
|
82
94
|
*/
|
|
83
95
|
const remoteOf = /* @__PURE__ */ Effect.fnUntraced(function* (bound, source, signal, access = "read") {
|
|
84
96
|
const { provider: name, repo } = source;
|
|
85
97
|
const provider = bound.providers.get(name);
|
|
86
98
|
if (provider === void 0) return yield* forGood(unknownProvider(name));
|
|
87
|
-
return yield*
|
|
99
|
+
return yield* untilAborted(provider.remote(repo, access), signal).pipe(Effect.catchCause((cause) => {
|
|
100
|
+
if (Cause.hasInterruptsOnly(cause)) return Effect.interrupt;
|
|
101
|
+
const thrown = spentOf(cause) ?? Cause.squash(cause);
|
|
102
|
+
if (spentAt(thrown) !== void 0) return Effect.die(thrown);
|
|
103
|
+
return Effect.fail(providerFailed(name, thrown));
|
|
104
|
+
}));
|
|
88
105
|
});
|
|
89
106
|
/**
|
|
90
107
|
* `send`, each refusal's body dropped once `heard` keeps what its provider's `fields` said: the
|
|
@@ -115,17 +132,31 @@ const fromRemote = (call, heard) => (error) => spentRefusalOf(error) ?? gitError
|
|
|
115
132
|
/** The fields of a refusal's JSON body `source`'s provider marks safe to keep: none it doesn't. */
|
|
116
133
|
const keptFieldsOf = (bound, source) => bound.providers.get(source.provider)?.keptFields ?? [];
|
|
117
134
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
135
|
+
* Requests to `remote` as sent, no credential added: through the bound's charged client, or
|
|
136
|
+
* `remote.transport`, whose each call is charged one subrequest before it runs, so a host's
|
|
137
|
+
* sender, a service binding's say, is counted as Git's own client is. A body streams through
|
|
138
|
+
* either, never collected.
|
|
120
139
|
*/
|
|
121
|
-
const
|
|
140
|
+
const senderOf = /* @__PURE__ */ Effect.fnUntraced(function* (remote) {
|
|
122
141
|
const client = yield* HttpClient.HttpClient;
|
|
123
|
-
const
|
|
142
|
+
const { transport } = remote;
|
|
143
|
+
return (request) => transport === void 0 ? client.execute(HttpClientRequest.fromWeb(request)).pipe(Effect.flatMap(responseToWeb)) : Effect.andThen(chargeCall("fetch"), transport(request));
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* The client's smart HTTP to `remote`, with its credentials, each request run in the caller's
|
|
147
|
+
* context: through the bound's charged client, or `remote.transport`, whose each call is charged
|
|
148
|
+
* one subrequest before it runs, so a host's sender, a service binding's say, is counted as Git's
|
|
149
|
+
* own client is. A request the transport sends again it charges itself. It answers what its
|
|
150
|
+
* refusals said in `fields` beside it, as `bodiless` keeps it.
|
|
151
|
+
*/
|
|
152
|
+
const httpOf = /* @__PURE__ */ Effect.fnUntraced(function* (remote, fields) {
|
|
153
|
+
const sent = yield* senderOf(remote);
|
|
154
|
+
const run = runnerIn(yield* Effect.context());
|
|
124
155
|
const heard = { said: void 0 };
|
|
125
|
-
const send = (request) =>
|
|
156
|
+
const send = (request) => run(sent(request), request.signal);
|
|
126
157
|
const options = {
|
|
127
158
|
url: remote.url,
|
|
128
|
-
transport: bodiless(
|
|
159
|
+
transport: bodiless(send, fields, heard)
|
|
129
160
|
};
|
|
130
161
|
if (remote.credentials !== void 0) options.credentials = remote.credentials;
|
|
131
162
|
return {
|
|
@@ -164,4 +195,4 @@ const openedFor = /* @__PURE__ */ Effect.fnUntraced(function* (caller, internalI
|
|
|
164
195
|
refs
|
|
165
196
|
};
|
|
166
197
|
});
|
|
167
|
-
export { ForGood, SyncTryError, forGood, fromRemote, httpOf, keptFieldsOf, openedFor, remoteOf, syncObjects, syncRetry, syncTryError, syncWhole, thrownOf, tried, unknownProvider };
|
|
198
|
+
export { ForGood, SyncTryError, forGood, fromRemote, httpOf, keptFieldsOf, openedFor, remoteOf, senderOf, syncObjects, syncRetry, syncTryError, syncWhole, thrownOf, tried, unknownProvider };
|
package/dist/sync.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GitHubAppCredentials, ImportJobData, ImportPhase, ImportProgress, ImportState, ImportedMove, MirrorJobData, MirrorPause, MirrorState, ReportImportProgress, Sync, SyncCancelInput, SyncGitHubOptions, SyncImportInput, SyncLayerOptions, SyncMirrorInput, SyncMirrorsInput, SyncProvider, SyncPublishInput, SyncRemote, SyncRemoveMirrorInput, SyncSource, SyncTrigger, cancelImport, importRepo, importedPullRefs, mirror, mirrors, publishImported, removeMirror } from "./contracts/sync.mjs";
|
|
1
|
+
import { GitHubAppCredentials, ImportJobData, ImportLfsMissed, ImportLfsReason, ImportPhase, ImportProgress, ImportState, ImportStatus, ImportedMove, MirrorJobData, MirrorPause, MirrorState, ReportImportProgress, Sync, SyncCancelInput, SyncGitHubOptions, SyncImportInput, SyncLayerOptions, SyncMirrorInput, SyncMirrorsInput, SyncProvider, SyncPublishInput, SyncRemote, SyncRemoveMirrorInput, SyncSource, SyncTransport, SyncTrigger, cancelImport, importRepo, importedPullRefs, mirror, mirrors, publishImported, removeMirror } from "./contracts/sync.mjs";
|
|
2
2
|
import { github, webhookBodyBytes } from "./sync/github.mjs";
|
|
3
3
|
import { partialImporter } from "./sync/import.mjs";
|
|
4
4
|
import { layer } from "./sync/layer.mjs";
|
|
5
5
|
import { smartHttp } from "./sync/smart-http.mjs";
|
|
6
|
-
export { type GitHubAppCredentials, type ImportJobData, type ImportPhase, type ImportProgress, type ImportState, type ImportedMove, type MirrorJobData, type MirrorPause, type MirrorState, type ReportImportProgress, Sync, type SyncCancelInput, type SyncGitHubOptions, type SyncImportInput, type SyncLayerOptions, type SyncMirrorInput, type SyncMirrorsInput, type SyncProvider, type SyncPublishInput, type SyncRemote, type SyncRemoveMirrorInput, type SyncSource, type SyncTrigger, cancelImport, github, importRepo as import, importedPullRefs, layer, mirror, mirrors, partialImporter, publishImported, removeMirror, smartHttp, webhookBodyBytes };
|
|
6
|
+
export { type GitHubAppCredentials, type ImportJobData, type ImportLfsMissed, type ImportLfsReason, type ImportPhase, type ImportProgress, type ImportState, type ImportStatus, type ImportedMove, type MirrorJobData, type MirrorPause, type MirrorState, type ReportImportProgress, Sync, type SyncCancelInput, type SyncGitHubOptions, type SyncImportInput, type SyncLayerOptions, type SyncMirrorInput, type SyncMirrorsInput, type SyncProvider, type SyncPublishInput, type SyncRemote, type SyncRemoveMirrorInput, type SyncSource, type SyncTransport, type SyncTrigger, cancelImport, github, importRepo as import, importedPullRefs, layer, mirror, mirrors, partialImporter, publishImported, removeMirror, smartHttp, webhookBodyBytes };
|
package/dist/topics/host.mjs
CHANGED
|
@@ -4,14 +4,6 @@ import "../queue/schedule.mjs";
|
|
|
4
4
|
import * as Predicate from "effect/Predicate";
|
|
5
5
|
import * as Context from "effect/Context";
|
|
6
6
|
// src/topics/host.ts
|
|
7
|
-
/** What `topics()` checked, by the factory it made, so a server takes only those. */
|
|
8
|
-
var TopicsFactoryValue = class {
|
|
9
|
-
kind = "topics";
|
|
10
|
-
options;
|
|
11
|
-
constructor(options) {
|
|
12
|
-
this.options = options;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
7
|
/** The topics host, private to its calls and jobs. */
|
|
16
8
|
var TopicsHost = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/topics/TopicsHost")) {};
|
|
17
9
|
/** What a `prepare` try may run past its call, to save the answer. */
|
|
@@ -71,14 +63,4 @@ const checkTopics = (options) => {
|
|
|
71
63
|
if (prepare !== void 0) checked.prepare = checkPrepare(prepare);
|
|
72
64
|
return checked;
|
|
73
65
|
};
|
|
74
|
-
|
|
75
|
-
const topics = (options = {}) => {
|
|
76
|
-
checkTopics(options);
|
|
77
|
-
return Object.freeze(new TopicsFactoryValue(options));
|
|
78
|
-
};
|
|
79
|
-
/** The options held by a factory this bridge made; other values are a setup error. */
|
|
80
|
-
const topicsOptions = (factory) => {
|
|
81
|
-
if (!(factory instanceof TopicsFactoryValue)) throw new TypeError("options.topics must be one topics() made");
|
|
82
|
-
return factory.options;
|
|
83
|
-
};
|
|
84
|
-
export { TopicsHost, checkTopics, saveMargin, topics, topicsOptions };
|
|
66
|
+
export { TopicsHost, checkTopics, saveMargin };
|
package/dist/topics/layer.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { Events } from "../contracts/events.mjs";
|
|
|
3
3
|
import { register } from "../contracts/git.mjs";
|
|
4
4
|
import { MergeQueue } from "../contracts/queue.mjs";
|
|
5
5
|
import { gitError } from "../contracts/result.mjs";
|
|
6
|
-
import { acting } from "../core/
|
|
6
|
+
import { acting } from "../core/access.mjs";
|
|
7
7
|
import { QueueInternals } from "../queue/host.mjs";
|
|
8
8
|
import { topicJobs } from "./advance.mjs";
|
|
9
9
|
import { topicCalls } from "./calls.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ref0/git",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Git hosting as a library: a server, a client and their merges",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -50,11 +50,6 @@
|
|
|
50
50
|
"import": "./dist/remote-helper.mjs",
|
|
51
51
|
"default": "./dist/remote-helper.mjs"
|
|
52
52
|
},
|
|
53
|
-
"./rest": {
|
|
54
|
-
"types": "./dist/rest.d.mts",
|
|
55
|
-
"import": "./dist/rest.mjs",
|
|
56
|
-
"default": "./dist/rest.mjs"
|
|
57
|
-
},
|
|
58
53
|
"./sync": {
|
|
59
54
|
"types": "./dist/sync.d.mts",
|
|
60
55
|
"import": "./dist/sync.mjs",
|
|
@@ -62,12 +57,12 @@
|
|
|
62
57
|
}
|
|
63
58
|
},
|
|
64
59
|
"dependencies": {
|
|
65
|
-
"@ref0/infra": "0.
|
|
60
|
+
"@ref0/infra": "0.14.0",
|
|
66
61
|
"pako": "2.1.0"
|
|
67
62
|
},
|
|
68
63
|
"devDependencies": {
|
|
69
64
|
"@effect/vitest": "4.1.7",
|
|
70
|
-
"@ref0/xdiff-wasm": "0.
|
|
65
|
+
"@ref0/xdiff-wasm": "0.14.0",
|
|
71
66
|
"effect": "4.1.7",
|
|
72
67
|
"vite-plus": "1.8.0",
|
|
73
68
|
"vitest": "5.1.1"
|
package/dist/auth/bridge.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { aboutOf, inputOf } from "./authorize.mjs";
|
|
2
|
-
import { runIn, uncounted } from "../store/crossing.mjs";
|
|
3
|
-
import { hostCall } from "./host-function.mjs";
|
|
4
|
-
import { signedIn } from "./policy.mjs";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
|
-
import * as Option from "effect/Option";
|
|
7
|
-
// src/auth/bridge.ts
|
|
8
|
-
/**
|
|
9
|
-
* The `Policy` of a server made with `authorize`, or `Policy.signedIn` with none. Each answer runs
|
|
10
|
-
* as a host function: a throw is `UNAVAILABLE`, and the host's log names it as `'authorize'`'s.
|
|
11
|
-
*/
|
|
12
|
-
const policyOf = (hook) => hook === void 0 ? signedIn : { authorize: (input) => hostCall("authorize", aboutOf(input.caller, input.operation), (signal) => hook({
|
|
13
|
-
...inputOf(input),
|
|
14
|
-
signal
|
|
15
|
-
})) };
|
|
16
|
-
/** A host's own `Policy` and `Auth` make no call through Git's doors. */
|
|
17
|
-
const hostDecider = /* @__PURE__ */ uncounted("the host's own Policy and Auth");
|
|
18
|
-
/**
|
|
19
|
-
* The host's `Policy` as `Git.layer` asks it: a host function, like the `authorize` option,
|
|
20
|
-
* so a failure or a defect is `UNAVAILABLE` and reaches the host's log, never the caller as it is.
|
|
21
|
-
*/
|
|
22
|
-
const hostPolicy = (policy) => ({ authorize: (input) => hostCall("authorize", aboutOf(input.caller, input.operation), (signal) => runIn(policy.authorize(input), hostDecider, signal)) });
|
|
23
|
-
/** The host's `Auth` as `Git.layer` asks it, a host function like the `auth` option. */
|
|
24
|
-
const hostAuth = (auth) => auth === void 0 ? void 0 : { identify: (input) => hostCall("auth", {}, (signal) => runIn(auth.identify(input), hostDecider, signal)) };
|
|
25
|
-
/** The `Auth` of a server made with `auth`, which runs as a host function, as `'auth'`'s. */
|
|
26
|
-
const authOf = (hook) => hook === void 0 ? void 0 : { identify: (input) => Effect.map(hostCall("auth", {}, (signal) => hook({
|
|
27
|
-
...input,
|
|
28
|
-
signal
|
|
29
|
-
})), Option.fromNullishOr) };
|
|
30
|
-
export { authOf, hostAuth, hostPolicy, policyOf };
|
package/dist/auth/helpers.d.mts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { GitAuth, NamedActor } from "../contracts/actors.mjs";
|
|
2
|
-
export interface BearerOptions {
|
|
3
|
-
readonly token: string;
|
|
4
|
-
readonly actor: NamedActor;
|
|
5
|
-
}
|
|
6
|
-
export interface BasicOptions {
|
|
7
|
-
readonly username: string;
|
|
8
|
-
readonly password: string;
|
|
9
|
-
readonly actor: NamedActor;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* An `auth` that knows one secret, as `actor`: sent as a Bearer token, or as Basic's password,
|
|
13
|
-
* as Git sends one from its credential helper. The admin's secret is an ordinary actor this way.
|
|
14
|
-
*/
|
|
15
|
-
export declare const bearer: (options: BearerOptions) => GitAuth;
|
|
16
|
-
/** An `auth` that knows one Basic username and password, as `actor`. */
|
|
17
|
-
export declare const basic: (options: BasicOptions) => GitAuth;
|
package/dist/core/purge.d.mts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "../contracts/promises.mjs";
|
|
2
|
-
import "../contracts/git.mjs";
|
|
3
|
-
import "../contracts/result.mjs";
|
|
4
|
-
import "../contracts/ids.mjs";
|
|
5
|
-
import "../contracts/objects.mjs";
|
|
6
|
-
import "effect/Effect";
|
|
7
|
-
import "effect/Schema";
|
|
8
|
-
import { JobDefinition, JobInput, Moment } from "@ref0/infra";
|
package/dist/core/repack.d.mts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import "../contracts/events.mjs";
|
|
2
|
-
import "../contracts/promises.mjs";
|
|
3
|
-
import "../contracts/ids.mjs";
|
|
4
|
-
import "../contracts/git.mjs";
|
|
5
|
-
import "../contracts/objects.mjs";
|
|
6
|
-
import "../contracts/result.mjs";
|
|
7
|
-
import "../storage/repack-job.mjs";
|
|
8
|
-
import "./events/deliver.mjs";
|
|
9
|
-
import "./view.mjs";
|
|
10
|
-
import "effect/Effect";
|
|
11
|
-
import { JobDefinition, JobInput, Moment } from "@ref0/infra";
|
package/dist/http/handler.d.mts
DELETED
package/dist/rest/handler.d.mts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import "../contracts/ids.mjs";
|
|
2
|
-
import "../contracts/result.mjs";
|
|
3
|
-
import { GitServer } from "../contracts/server.mjs";
|
|
4
|
-
import "../store/call-count.mjs";
|
|
5
|
-
import "../store/promises.mjs";
|
|
6
|
-
import "./caller.mjs";
|
|
7
|
-
import "effect/Effect";
|
|
8
|
-
import "effect/Context";
|
|
9
|
-
/** A URL's answer, or `undefined` for a URL the route doesn't own. */
|
|
10
|
-
export type RestRoute = (request: Request) => Promise<Response | undefined>;
|
|
11
|
-
export interface RestHandler {
|
|
12
|
-
/** REST's URLs, then Git's, then a JSON 404. */
|
|
13
|
-
readonly fetch: (request: Request) => Promise<Response>;
|
|
14
|
-
/** REST's URLs, then Git's; `undefined` for a URL neither owns. */
|
|
15
|
-
readonly route: RestRoute;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Git's REST API over a server `createGitServer` made: `fetch` answers REST's URLs, then Git's
|
|
19
|
-
* `route`, then a JSON `404`; `route` answers the same and `undefined` outside them.
|
|
20
|
-
*/
|
|
21
|
-
export declare const createRestHandler: (git: GitServer) => RestHandler;
|
package/dist/rest.d.mts
DELETED
package/dist/rest.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createRestHandler } from "./rest/handler.mjs";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "../contracts/git.mjs";
|
|
2
|
-
import "../contracts/grants.mjs";
|
|
3
|
-
import "../contracts/ids.mjs";
|
|
4
|
-
import "../core/registered-rows.mjs";
|
|
5
|
-
import "../core/events/deliver.mjs";
|
|
6
|
-
import "../core/purge.mjs";
|
|
7
|
-
import "../core/parts.mjs";
|
|
8
|
-
import "../contracts/result.mjs";
|
|
9
|
-
import "../contracts/rules.mjs";
|
|
10
|
-
import "../core/hooks/groups.mjs";
|
|
11
|
-
import "../core/hooks/order.mjs";
|
|
12
|
-
import "../core/repack.mjs";
|
|
13
|
-
import "../core/rules/context.mjs";
|
|
14
|
-
import "../protocol/wire/lines.mjs";
|
|
15
|
-
import "effect/Effect";
|
|
16
|
-
import { JobDefinition, Records } from "@ref0/infra";
|
package/dist/server/server.d.mts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import "../core/seam.mjs";
|
|
2
|
-
import "./git-layer.mjs";
|
|
3
|
-
import "../contracts/actors.mjs";
|
|
4
|
-
import "../contracts/result.mjs";
|
|
5
|
-
import "../contracts/authorize.mjs";
|
|
6
|
-
import "../contracts/repo-records.mjs";
|
|
7
|
-
import "../contracts/refs.mjs";
|
|
8
|
-
import "../contracts/rules.mjs";
|
|
9
|
-
import { GitAdapter, GitServer, ProvidedBy, ServerSetup } from "../contracts/server.mjs";
|
|
10
|
-
import "../contracts/services.mjs";
|
|
11
|
-
import "../auth/auth.mjs";
|
|
12
|
-
import "../auth/identify.mjs";
|
|
13
|
-
import "../auth/policy.mjs";
|
|
14
|
-
import "../auth/tokens-layer.mjs";
|
|
15
|
-
import "../contracts/events.mjs";
|
|
16
|
-
import "../event-streams/event-streams.mjs";
|
|
17
|
-
import "../lfs/base.mjs";
|
|
18
|
-
import "./uploads.mjs";
|
|
19
|
-
import "../http/handler.mjs";
|
|
20
|
-
import "../queue/host.mjs";
|
|
21
|
-
import "../topics/layer.mjs";
|
|
22
|
-
import "./joined.mjs";
|
|
23
|
-
import "./registry.mjs";
|
|
24
|
-
import "../core/parts.mjs";
|
|
25
|
-
import "../core/saved-caller-views.mjs";
|
|
26
|
-
import "../core/objects/objects.mjs";
|
|
27
|
-
import "effect/Effect";
|
|
28
|
-
import "effect/Context";
|
|
29
|
-
import "effect/Layer";
|
|
30
|
-
/**
|
|
31
|
-
* A Git server over one adapter: its calls, `identify`, and `fetch` and `route`, Git's Smart HTTP
|
|
32
|
-
* over its core and its sign-in, which answer `404` and `undefined` outside their URLs. Its
|
|
33
|
-
* runtime builds the adapter's Layers and Git's wiring once the tick that made it ends, which
|
|
34
|
-
* registers Git's jobs on the adapter's queue, and never runs them: the host starts them.
|
|
35
|
-
*/
|
|
36
|
-
export declare const createGitServer: <const A extends GitAdapter>(options: ServerSetup<A>) => GitServer<ProvidedBy<A>>;
|
package/dist/topics/host.d.mts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "../contracts/promises.mjs";
|
|
2
|
-
import "../contracts/git.mjs";
|
|
3
|
-
import { TopicsFactory, TopicsLayerOptions } from "../contracts/topics.mjs";
|
|
4
|
-
import "../queue/host.mjs";
|
|
5
|
-
import "effect/Context";
|
|
6
|
-
/** The temporary factory, holding the checked options until 2c removes createGitServer. */
|
|
7
|
-
export declare const topics: (options?: TopicsLayerOptions) => TopicsFactory;
|