@lunora/bindings 1.0.0-alpha.90 → 1.0.0-alpha.91
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 +11 -9
- package/dist/ai-search/index.d.mts +741 -0
- package/dist/ai-search/index.d.ts +741 -0
- package/dist/ai-search/index.mjs +0 -0
- package/dist/artifacts/index.d.mts +426 -0
- package/dist/artifacts/index.d.ts +426 -0
- package/dist/artifacts/index.mjs +1 -0
- package/dist/packem_shared/authenticatedRemote-CPm87dLq.mjs +1 -0
- package/dist/packem_shared/createArtifacts-cXCusYbi.mjs +1 -0
- package/package.json +14 -4
|
File without changes
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural projections of the Cloudflare **Artifacts** binding (`env.ARTIFACTS`)
|
|
3
|
+
* — a versioned file system that speaks Git. Namespaces hold repos; the binding
|
|
4
|
+
* creates, imports, forks, lists and deletes them, mints repo-scoped Git tokens,
|
|
5
|
+
* and READS commits, trees, blobs and files. It has no write method: every write
|
|
6
|
+
* is a `git push` over HTTPS with one of those tokens.
|
|
7
|
+
*
|
|
8
|
+
* Declared structurally (the `ImagesBindingLike` pattern) rather than leaning on
|
|
9
|
+
* the global `Artifacts` type, because the pinned `@cloudflare/workers-types`
|
|
10
|
+
* lags the runtime: it lacks `info()`, `log()`, `readCommit()`, `readTree()`,
|
|
11
|
+
* `readBlob()` and `readFile()`, and it models `ArtifactsRepo` as carrying its
|
|
12
|
+
* metadata as properties, which the deployed binding does not do (call
|
|
13
|
+
* `info()`). The shapes here follow the Workers-binding docs and
|
|
14
|
+
* `@cloudflare/workers-types@5.20261002.1`, the first release that matches them.
|
|
15
|
+
*
|
|
16
|
+
* TODO(workers-types): once the catalog pin includes the read methods, add a
|
|
17
|
+
* type test asserting the global `Artifacts` is assignable to
|
|
18
|
+
* {@link ArtifactsBindingLike}.
|
|
19
|
+
*/
|
|
20
|
+
/** A repo-scoped Git token's scope: `read` covers clone/fetch/pull, `write` adds push. */
|
|
21
|
+
type ArtifactsTokenScope = "read" | "write";
|
|
22
|
+
/** Current metadata for one repository, from `repo.info()`. */
|
|
23
|
+
interface ArtifactsRepoInfo {
|
|
24
|
+
/** ISO 8601 creation timestamp. */
|
|
25
|
+
createdAt: string;
|
|
26
|
+
/** Default branch name, e.g. `main`. */
|
|
27
|
+
defaultBranch: string;
|
|
28
|
+
/** Repository description, or `null` when unset. */
|
|
29
|
+
description: string | null;
|
|
30
|
+
/** Unique repository id. */
|
|
31
|
+
id: string;
|
|
32
|
+
/** ISO 8601 timestamp of the last push, or `null` when never pushed. */
|
|
33
|
+
lastPushAt: string | null;
|
|
34
|
+
/** Repository name. */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Whether the repository is read-only. */
|
|
37
|
+
readOnly: boolean;
|
|
38
|
+
/** The HTTPS Git remote URL. */
|
|
39
|
+
remote: string;
|
|
40
|
+
/** Fork source (`github:owner/repo`, `artifacts:namespace/repo`), or `null` when not a fork. */
|
|
41
|
+
source: string | null;
|
|
42
|
+
/** ISO 8601 last-updated timestamp. */
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The result of `create()`, `import()` and `fork()`: the new repo plus an
|
|
47
|
+
* initial Git token. `token` is a secret — never log it or return it to a client
|
|
48
|
+
* that should not push.
|
|
49
|
+
*/
|
|
50
|
+
interface ArtifactsCreateRepoResult {
|
|
51
|
+
/** Default branch name. */
|
|
52
|
+
defaultBranch: string;
|
|
53
|
+
/** Repository description, or `null` when unset. */
|
|
54
|
+
description: string | null;
|
|
55
|
+
/** Unique repository id. */
|
|
56
|
+
id: string;
|
|
57
|
+
/** Repository name. */
|
|
58
|
+
name: string;
|
|
59
|
+
/** The HTTPS Git remote URL. */
|
|
60
|
+
remote: string;
|
|
61
|
+
/** Plaintext initial access token, returned only at creation time. */
|
|
62
|
+
token: string;
|
|
63
|
+
}
|
|
64
|
+
/** One page of `list()`. */
|
|
65
|
+
interface ArtifactsRepoListResult {
|
|
66
|
+
/** Cursor for the next page; absent on the last page. */
|
|
67
|
+
cursor?: string;
|
|
68
|
+
/** The repos on this page (without `remote`). */
|
|
69
|
+
repos: Omit<ArtifactsRepoInfo, "remote">[];
|
|
70
|
+
/** Total number of repos in the namespace. */
|
|
71
|
+
total: number;
|
|
72
|
+
}
|
|
73
|
+
/** A freshly minted Git token. `plaintext` is a secret. */
|
|
74
|
+
interface ArtifactsCreateTokenResult {
|
|
75
|
+
/** ISO 8601 expiry timestamp. */
|
|
76
|
+
expiresAt: string;
|
|
77
|
+
/** Unique token id — pass it to `revokeToken` instead of the plaintext where you can. */
|
|
78
|
+
id: string;
|
|
79
|
+
/** The Git token string, returned only at creation time. */
|
|
80
|
+
plaintext: string;
|
|
81
|
+
/** The token's scope. */
|
|
82
|
+
scope: ArtifactsTokenScope;
|
|
83
|
+
}
|
|
84
|
+
/** Token metadata (never the plaintext). */
|
|
85
|
+
interface ArtifactsTokenInfo {
|
|
86
|
+
/** ISO 8601 creation timestamp. */
|
|
87
|
+
createdAt: string;
|
|
88
|
+
/** ISO 8601 expiry timestamp. */
|
|
89
|
+
expiresAt: string;
|
|
90
|
+
/** Unique token id. */
|
|
91
|
+
id: string;
|
|
92
|
+
/** The token's scope. */
|
|
93
|
+
scope: ArtifactsTokenScope;
|
|
94
|
+
/** Whether the token can still be used. */
|
|
95
|
+
state: "active" | "expired" | "revoked";
|
|
96
|
+
}
|
|
97
|
+
/** The tokens minted for one repo. */
|
|
98
|
+
interface ArtifactsTokenListResult {
|
|
99
|
+
/** The tokens. */
|
|
100
|
+
tokens: ArtifactsTokenInfo[];
|
|
101
|
+
/** Total number of tokens for the repo. */
|
|
102
|
+
total: number;
|
|
103
|
+
}
|
|
104
|
+
/** A Git tree entry's kind, derived from its mode. */
|
|
105
|
+
type ArtifactsTreeEntryType = "blob" | "exec" | "gitlink" | "symlink" | "tree";
|
|
106
|
+
/** An immediate child of a Git tree, from `readTree()`. */
|
|
107
|
+
interface ArtifactsTreeEntry {
|
|
108
|
+
/** Lowercase, 40-character SHA-1 object id. */
|
|
109
|
+
hash: string;
|
|
110
|
+
/** Canonical Git mode, such as `100644` for a file or `40000` for a tree. */
|
|
111
|
+
mode: string;
|
|
112
|
+
/** Name relative to the tree being read. */
|
|
113
|
+
name: string;
|
|
114
|
+
/** Kind derived from `mode`. */
|
|
115
|
+
type: ArtifactsTreeEntryType;
|
|
116
|
+
}
|
|
117
|
+
/** A Git identity on a commit. */
|
|
118
|
+
interface ArtifactsCommitIdentity {
|
|
119
|
+
email: string;
|
|
120
|
+
name: string;
|
|
121
|
+
}
|
|
122
|
+
/** Decoded commit metadata, from `readCommit()` and `log()`. */
|
|
123
|
+
interface ArtifactsCommitMetadata {
|
|
124
|
+
/** The commit's author. */
|
|
125
|
+
author: ArtifactsCommitIdentity;
|
|
126
|
+
/** Author timestamp in Unix seconds. */
|
|
127
|
+
authoredAt: number;
|
|
128
|
+
/** Committer timestamp in Unix seconds. */
|
|
129
|
+
committedAt: number;
|
|
130
|
+
/** The commit's committer. */
|
|
131
|
+
committer: ArtifactsCommitIdentity;
|
|
132
|
+
/** Lowercase, 40-character SHA-1 commit id. */
|
|
133
|
+
hash: string;
|
|
134
|
+
/** Commit message with one trailing newline removed. */
|
|
135
|
+
message: string;
|
|
136
|
+
/** Parent commit ids in Git order; empty for a root commit. */
|
|
137
|
+
parents: string[];
|
|
138
|
+
/** SHA-1 id of the commit's root tree. */
|
|
139
|
+
treeHash: string;
|
|
140
|
+
}
|
|
141
|
+
/** Options for `create()`. */
|
|
142
|
+
interface ArtifactsCreateOptions {
|
|
143
|
+
description?: string;
|
|
144
|
+
readOnly?: boolean;
|
|
145
|
+
/** The default branch name (the binding's `setDefaultBranch`). */
|
|
146
|
+
setDefaultBranch?: string;
|
|
147
|
+
}
|
|
148
|
+
/** Options for `repo.fork()`. */
|
|
149
|
+
interface ArtifactsForkOptions {
|
|
150
|
+
/** Copy only the default branch. The binding defaults this to `true`. */
|
|
151
|
+
defaultBranchOnly?: boolean;
|
|
152
|
+
description?: string;
|
|
153
|
+
readOnly?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/** Parameters for `import()`: an external HTTPS Git remote and the repo it lands in. */
|
|
156
|
+
interface ArtifactsImportParams {
|
|
157
|
+
source: {
|
|
158
|
+
/** Branch to import; defaults to the remote's default branch. */
|
|
159
|
+
branch?: string;
|
|
160
|
+
/** Shallow-clone depth. */
|
|
161
|
+
depth?: number;
|
|
162
|
+
/** HTTPS URL of the source repository. */
|
|
163
|
+
url: string;
|
|
164
|
+
};
|
|
165
|
+
target: {
|
|
166
|
+
name: string;
|
|
167
|
+
opts?: {
|
|
168
|
+
description?: string;
|
|
169
|
+
readOnly?: boolean;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/** Options for `list()`. */
|
|
174
|
+
interface ArtifactsListOptions {
|
|
175
|
+
cursor?: string;
|
|
176
|
+
/** Page size, 1–200 (the binding defaults to 50). */
|
|
177
|
+
limit?: number;
|
|
178
|
+
}
|
|
179
|
+
/** Options for `repo.log()`. */
|
|
180
|
+
interface ArtifactsLogOptions {
|
|
181
|
+
/** Page size; the binding defaults to 50 and caps at 1000. */
|
|
182
|
+
limit?: number;
|
|
183
|
+
offset?: number;
|
|
184
|
+
/** Branch, tag or commit id; defaults to `HEAD`. */
|
|
185
|
+
ref?: string;
|
|
186
|
+
}
|
|
187
|
+
/** Arguments for `repo.readFile()`. */
|
|
188
|
+
interface ArtifactsReadFileArgs {
|
|
189
|
+
/** Non-empty repository-relative path. */
|
|
190
|
+
path: string;
|
|
191
|
+
/** Branch, tag or commit id. */
|
|
192
|
+
ref: string;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The repo operations — the methods of the handle `binding.get(name)` returns,
|
|
196
|
+
* which `createArtifacts` wraps with the Lunora error mapping and hands to
|
|
197
|
+
* {@link ArtifactsClient.withRepo}'s callback.
|
|
198
|
+
*
|
|
199
|
+
* Declared on its own rather than derived from {@link ArtifactsRepoLike} by
|
|
200
|
+
* omitting `Symbol.dispose`: without `lib.esnext.disposable` or `@types/node`
|
|
201
|
+
* (an app on `lib: ["ES2024"]` + workers-types) `typeof Symbol.dispose` is
|
|
202
|
+
* `any`, and `Omit<…, any>` drops every member.
|
|
203
|
+
*/
|
|
204
|
+
interface ArtifactsRepoClient {
|
|
205
|
+
/**
|
|
206
|
+
* Mint a repo-scoped Git token. `ttl` is in seconds (60 to one year; the
|
|
207
|
+
* binding defaults to 86,400). Keep write tokens short-lived and revoke them
|
|
208
|
+
* when the session that needed them ends.
|
|
209
|
+
*/
|
|
210
|
+
createToken: (scope?: ArtifactsTokenScope, ttl?: number) => Promise<ArtifactsCreateTokenResult>;
|
|
211
|
+
/** Fork this repo into a new repo in the same namespace. */
|
|
212
|
+
fork: (name: string, options?: ArtifactsForkOptions) => Promise<ArtifactsCreateRepoResult>;
|
|
213
|
+
/** Fresh repository metadata. */
|
|
214
|
+
info: () => Promise<ArtifactsRepoInfo>;
|
|
215
|
+
/** Token metadata for this repo (never plaintext). */
|
|
216
|
+
listTokens: () => Promise<ArtifactsTokenListResult>;
|
|
217
|
+
/** First-parent history, newest first. An unresolvable ref yields `[]`. */
|
|
218
|
+
log: (options?: ArtifactsLogOptions) => Promise<ArtifactsCommitMetadata[]>;
|
|
219
|
+
/** A blob's raw bytes as an untyped `Blob` (returned unbuffered), or `null` when missing. */
|
|
220
|
+
readBlob: (hash: string) => Promise<Blob | null>;
|
|
221
|
+
/** One decoded commit, or `null` when missing. */
|
|
222
|
+
readCommit: (hash: string) => Promise<ArtifactsCommitMetadata | null>;
|
|
223
|
+
/** A file at a ref as a MIME-typed `Blob` (returned unbuffered), or `null` when the path is missing or a directory. */
|
|
224
|
+
readFile: (args: ArtifactsReadFileArgs) => Promise<Blob | null>;
|
|
225
|
+
/** A tree's immediate children, or `null` when missing. */
|
|
226
|
+
readTree: (hash: string) => Promise<ArtifactsTreeEntry[] | null>;
|
|
227
|
+
/** Revoke a token by id (preferred) or plaintext. `false` when it was not found. */
|
|
228
|
+
revokeToken: (tokenOrId: string) => Promise<boolean>;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* The repo capability `binding.get(name)` returns: an RPC stub that has to be
|
|
232
|
+
* disposed before the request ends. `Disposable` is `Partial` only so a
|
|
233
|
+
* plain-object test double satisfies the shape; the real handle always has it.
|
|
234
|
+
*/
|
|
235
|
+
interface ArtifactsRepoLike extends ArtifactsRepoClient, Partial<Disposable> {}
|
|
236
|
+
/** The namespace-level `env.ARTIFACTS` binding. */
|
|
237
|
+
interface ArtifactsBindingLike {
|
|
238
|
+
/** Create a repo. The first `create` against a missing namespace creates that namespace, unrestricted. */
|
|
239
|
+
create: (name: string, options?: ArtifactsCreateOptions) => Promise<ArtifactsCreateRepoResult>;
|
|
240
|
+
/** Delete a repo and its tokens. `false` when it did not exist. */
|
|
241
|
+
delete: (name: string) => Promise<boolean>;
|
|
242
|
+
/** Open a repo handle. It must be disposed of before the request ends — prefer `ArtifactsClient.withRepo`. */
|
|
243
|
+
get: (name: string) => Promise<ArtifactsRepoLike>;
|
|
244
|
+
/** Import a repo from an external HTTPS Git remote. */
|
|
245
|
+
import: (params: ArtifactsImportParams) => Promise<ArtifactsCreateRepoResult>;
|
|
246
|
+
/** One page of the namespace's repos. */
|
|
247
|
+
list: (options?: ArtifactsListOptions) => Promise<ArtifactsRepoListResult>;
|
|
248
|
+
}
|
|
249
|
+
/** The `code` an `ArtifactsError` carries. */
|
|
250
|
+
type ArtifactsErrorCode = "ALREADY_EXISTS" | "CREATE_IN_PROGRESS" | "FORK_IN_PROGRESS" | "IMPORT_IN_PROGRESS" | "INTERNAL_ERROR" | "INVALID_INPUT" | "INVALID_REPO_NAME" | "INVALID_TTL" | "INVALID_URL" | "MEMORY_LIMIT" | "NOT_FOUND" | "REMOTE_AUTH_REQUIRED" | "UPSTREAM_UNAVAILABLE";
|
|
251
|
+
/** The `data` a mapped `LunoraError` carries: the binding's own codes, never its message. */
|
|
252
|
+
interface ArtifactsErrorData {
|
|
253
|
+
/** The binding's string code. */
|
|
254
|
+
code: string;
|
|
255
|
+
/** The binding's numeric code (matches the REST API's `errors[].code`), when it sent one. */
|
|
256
|
+
numericCode?: number;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The action-only `ctx.artifacts` client: the binding's namespace operations,
|
|
260
|
+
* with the raw `get` replaced by the disposing `withRepo`, plus two helpers.
|
|
261
|
+
* Every call is a billed, remote operation, and every `ArtifactsError` is
|
|
262
|
+
* rethrown as a `LunoraError` (see `createArtifacts`). It cannot write files —
|
|
263
|
+
* push with a Git client using a token from `ArtifactsRepoClient.createToken`
|
|
264
|
+
* and `authenticatedRemote`.
|
|
265
|
+
*/
|
|
266
|
+
type ArtifactsClient = {
|
|
267
|
+
/**
|
|
268
|
+
* Build the `https://x:<token>@host/…` remote a Git client pushes to. Pure: no
|
|
269
|
+
* I/O. With a write token the result is a push credential — never return it
|
|
270
|
+
* from a public function, log it, or put it in a command argument.
|
|
271
|
+
*/
|
|
272
|
+
authenticatedRemote: (remote: string, token: string) => string;
|
|
273
|
+
/** Fresh metadata for one repo — shorthand for `withRepo(name, (repo) => repo.info())`. */
|
|
274
|
+
info: (name: string) => Promise<ArtifactsRepoInfo>;
|
|
275
|
+
/**
|
|
276
|
+
* Open a repo handle, run `callback` with it, and dispose of the handle whether
|
|
277
|
+
* `callback` returns or throws, so it cannot outlive the request. Use the
|
|
278
|
+
* handle only inside `callback`.
|
|
279
|
+
*/
|
|
280
|
+
withRepo: <T>(name: string, callback: (repo: ArtifactsRepoClient) => Promise<T> | T) => Promise<T>;
|
|
281
|
+
} & Omit<ArtifactsBindingLike, "get">;
|
|
282
|
+
/** Options for `createArtifacts`. */
|
|
283
|
+
interface LunoraArtifactsOptions {
|
|
284
|
+
/** The `env.ARTIFACTS` binding (wrangler `artifacts[]`). */
|
|
285
|
+
binding: ArtifactsBindingLike;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Envelope fields shared by every Artifacts Queues event (`eventSchemaVersion: 1`).
|
|
289
|
+
* @experimental
|
|
290
|
+
*/
|
|
291
|
+
interface ArtifactsEventMetadata {
|
|
292
|
+
accountId: string;
|
|
293
|
+
eventSchemaVersion: 1;
|
|
294
|
+
eventSubscriptionId: string;
|
|
295
|
+
eventTimestamp: string;
|
|
296
|
+
}
|
|
297
|
+
/** The repo-state payload the account-level lifecycle events carry. */
|
|
298
|
+
interface ArtifactsRepoEventState {
|
|
299
|
+
createdAt: string;
|
|
300
|
+
defaultBranch: string;
|
|
301
|
+
description: string | null;
|
|
302
|
+
lastPushAt: string | null;
|
|
303
|
+
readOnly: boolean;
|
|
304
|
+
repoId: string;
|
|
305
|
+
updatedAt: string;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Envelope of an account-level event (source `artifacts`). For a fork, `source`
|
|
309
|
+
* names the repo forked FROM; the payload names the new one.
|
|
310
|
+
* @experimental
|
|
311
|
+
*/
|
|
312
|
+
interface ArtifactsLifecycleEnvelope {
|
|
313
|
+
metadata: ArtifactsEventMetadata;
|
|
314
|
+
source: {
|
|
315
|
+
namespace: string;
|
|
316
|
+
repoName: string;
|
|
317
|
+
type: "artifacts";
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Envelope of a repo-level event (source `artifacts.repo`, subscribed per
|
|
322
|
+
* namespace + repo).
|
|
323
|
+
* @experimental
|
|
324
|
+
*/
|
|
325
|
+
interface ArtifactsActivityEnvelope {
|
|
326
|
+
metadata: ArtifactsEventMetadata;
|
|
327
|
+
source: {
|
|
328
|
+
namespace: string;
|
|
329
|
+
repoName: string;
|
|
330
|
+
type: "artifacts.repo";
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
/** One commit in a `cf.artifacts.repo.pushed` payload. */
|
|
334
|
+
interface ArtifactsPushedCommit {
|
|
335
|
+
author: ArtifactsCommitIdentity;
|
|
336
|
+
committer: ArtifactsCommitIdentity;
|
|
337
|
+
id: string;
|
|
338
|
+
message: string;
|
|
339
|
+
messageTruncated: boolean;
|
|
340
|
+
parents: string[];
|
|
341
|
+
timestamp: string;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* An account-level repo lifecycle event: `created`, `deleted`, `forked` or
|
|
345
|
+
* `imported`. Narrow on `type`.
|
|
346
|
+
* @experimental
|
|
347
|
+
*/
|
|
348
|
+
type ArtifactsRepoLifecycleEvent = (ArtifactsLifecycleEnvelope & {
|
|
349
|
+
payload: ArtifactsRepoEventState & {
|
|
350
|
+
branch: string;
|
|
351
|
+
sourceUrl: string;
|
|
352
|
+
};
|
|
353
|
+
type: "cf.artifacts.repo.imported";
|
|
354
|
+
}) | (ArtifactsLifecycleEnvelope & {
|
|
355
|
+
payload: ArtifactsRepoEventState & {
|
|
356
|
+
namespace: string;
|
|
357
|
+
repoName: string;
|
|
358
|
+
};
|
|
359
|
+
type: "cf.artifacts.repo.forked";
|
|
360
|
+
}) | (ArtifactsLifecycleEnvelope & {
|
|
361
|
+
payload: ArtifactsRepoEventState;
|
|
362
|
+
type: "cf.artifacts.repo.created";
|
|
363
|
+
}) | (ArtifactsLifecycleEnvelope & {
|
|
364
|
+
payload: ArtifactsRepoEventState;
|
|
365
|
+
type: "cf.artifacts.repo.deleted";
|
|
366
|
+
});
|
|
367
|
+
/**
|
|
368
|
+
* A repo-level activity event: `pushed`, `cloned`, `fetched`,
|
|
369
|
+
* `token.created` or `token.revoked`. Narrow on `type`. Token events carry the
|
|
370
|
+
* token id, never the plaintext.
|
|
371
|
+
* @experimental
|
|
372
|
+
*/
|
|
373
|
+
type ArtifactsRepoActivityEvent = (ArtifactsActivityEnvelope & {
|
|
374
|
+
payload: {
|
|
375
|
+
after: string;
|
|
376
|
+
before: string;
|
|
377
|
+
commits: ArtifactsPushedCommit[];
|
|
378
|
+
commitsTruncated: boolean;
|
|
379
|
+
ref: string;
|
|
380
|
+
totalCommitsCount: number;
|
|
381
|
+
};
|
|
382
|
+
type: "cf.artifacts.repo.pushed";
|
|
383
|
+
}) | (ArtifactsActivityEnvelope & {
|
|
384
|
+
payload: {
|
|
385
|
+
expiresAt: string;
|
|
386
|
+
scope: ArtifactsTokenScope;
|
|
387
|
+
tokenId: string;
|
|
388
|
+
};
|
|
389
|
+
type: "cf.artifacts.repo.token.created";
|
|
390
|
+
}) | (ArtifactsActivityEnvelope & {
|
|
391
|
+
payload: {
|
|
392
|
+
tokenId: string;
|
|
393
|
+
};
|
|
394
|
+
type: "cf.artifacts.repo.token.revoked";
|
|
395
|
+
}) | (ArtifactsActivityEnvelope & {
|
|
396
|
+
payload: Record<string, never>;
|
|
397
|
+
type: "cf.artifacts.repo.cloned";
|
|
398
|
+
}) | (ArtifactsActivityEnvelope & {
|
|
399
|
+
payload: Record<string, never>;
|
|
400
|
+
type: "cf.artifacts.repo.fetched";
|
|
401
|
+
});
|
|
402
|
+
/**
|
|
403
|
+
* Any Artifacts event a Queue subscription delivers — type a `defineQueue`
|
|
404
|
+
* consumer's messages with it and narrow on `type`.
|
|
405
|
+
* @experimental
|
|
406
|
+
*/
|
|
407
|
+
type ArtifactsEvent = ArtifactsRepoActivityEvent | ArtifactsRepoLifecycleEvent;
|
|
408
|
+
/**
|
|
409
|
+
* Build the action-only {@link ArtifactsClient} over an Artifacts binding.
|
|
410
|
+
*
|
|
411
|
+
* ```ts
|
|
412
|
+
* const artifacts = createArtifacts({ binding: env.ARTIFACTS });
|
|
413
|
+
* const readme = await artifacts.withRepo("docs", (repo) => repo.readFile({ ref: "main", path: "README.md" }));
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
declare const createArtifacts: (options: LunoraArtifactsOptions) => ArtifactsClient;
|
|
417
|
+
/**
|
|
418
|
+
* Build `https://x:<secret>@host/…` from a repo `remote` and a Git token.
|
|
419
|
+
*
|
|
420
|
+
* A token can carry an `?expires=…` suffix; that is not part of the secret Git
|
|
421
|
+
* sends, so it is stripped first. The result embeds the secret — hand it to a
|
|
422
|
+
* Git client through an environment variable and keep it out of logs, command
|
|
423
|
+
* arguments and error messages. Errors raised here never quote the token.
|
|
424
|
+
*/
|
|
425
|
+
declare const authenticatedRemote: (remote: string, token: string) => string;
|
|
426
|
+
export { type ArtifactsActivityEnvelope, type ArtifactsBindingLike, type ArtifactsClient, type ArtifactsCommitIdentity, type ArtifactsCommitMetadata, type ArtifactsCreateOptions, type ArtifactsCreateRepoResult, type ArtifactsCreateTokenResult, type ArtifactsErrorCode, type ArtifactsErrorData, type ArtifactsEvent, type ArtifactsEventMetadata, type ArtifactsForkOptions, type ArtifactsImportParams, type ArtifactsLifecycleEnvelope, type ArtifactsListOptions, type ArtifactsLogOptions, type ArtifactsPushedCommit, type ArtifactsReadFileArgs, type ArtifactsRepoActivityEvent, type ArtifactsRepoClient, type ArtifactsRepoEventState, type ArtifactsRepoInfo, type ArtifactsRepoLifecycleEvent, type ArtifactsRepoLike, type ArtifactsRepoListResult, type ArtifactsTokenInfo, type ArtifactsTokenListResult, type ArtifactsTokenScope, type ArtifactsTreeEntry, type ArtifactsTreeEntryType, type LunoraArtifactsOptions, authenticatedRemote, createArtifacts };
|