@lunora/bindings 1.0.0-alpha.9 → 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.
Files changed (67) hide show
  1. package/README.md +11 -9
  2. package/dist/ai-search/index.d.mts +741 -0
  3. package/dist/ai-search/index.d.ts +741 -0
  4. package/dist/ai-search/index.mjs +0 -0
  5. package/dist/analytics/index.d.mts +21 -25
  6. package/dist/analytics/index.d.ts +21 -25
  7. package/dist/analytics/index.mjs +1 -2
  8. package/dist/artifacts/index.d.mts +426 -0
  9. package/dist/artifacts/index.d.ts +426 -0
  10. package/dist/artifacts/index.mjs +1 -0
  11. package/dist/images/index.d.mts +37 -52
  12. package/dist/images/index.d.ts +37 -52
  13. package/dist/images/index.mjs +1 -3
  14. package/dist/kv/index.d.mts +4 -81
  15. package/dist/kv/index.d.ts +4 -81
  16. package/dist/kv/index.mjs +1 -2
  17. package/dist/packem_shared/AnalyticsSqlError-CeQ3A5Eb.mjs +1 -0
  18. package/dist/packem_shared/R2SqlError-ZHgOWClB.mjs +1 -0
  19. package/dist/packem_shared/SelectBuilder-DJXNSdqC.mjs +1 -0
  20. package/dist/packem_shared/SetOperation-kiI5Wnlm.mjs +1 -0
  21. package/dist/packem_shared/Sql-BfnxRway.mjs +1 -0
  22. package/dist/packem_shared/WindowExpression-VX7EEV3h.mjs +1 -0
  23. package/dist/packem_shared/WindowFunction-CL4jYy2l.mjs +1 -0
  24. package/dist/packem_shared/asc-DP_WFiAE.mjs +1 -0
  25. package/dist/packem_shared/authenticatedRemote-CPm87dLq.mjs +1 -0
  26. package/dist/packem_shared/buildImageDeliveryUrl-Brqs-dcZ.mjs +1 -0
  27. package/dist/packem_shared/buildSignedImageUrl-BV-iSJKA.mjs +4 -0
  28. package/dist/packem_shared/cap-error-body-YBKO32BF.mjs +1 -0
  29. package/dist/packem_shared/concurrent-vRmSvRpF.mjs +1 -0
  30. package/dist/packem_shared/createAnalytics-BXTNc57d.mjs +1 -0
  31. package/dist/packem_shared/createArtifacts-cXCusYbi.mjs +1 -0
  32. package/dist/packem_shared/createContextVectors-DiyO3pZU.mjs +6 -0
  33. package/dist/packem_shared/createImages-D7JExfqF.mjs +1 -0
  34. package/dist/packem_shared/createKv-mAHanD5g.mjs +1 -0
  35. package/dist/packem_shared/createKvIntrospector-BpRiFRFQ.mjs +1 -0
  36. package/dist/packem_shared/createPipelines-CIvqrc7E.mjs +1 -0
  37. package/dist/packem_shared/createVectorAdminIntrospector-Ct8v6PxJ.mjs +1 -0
  38. package/dist/packem_shared/createVectors-Dzv0ilKE.mjs +1 -0
  39. package/dist/pipelines/index.d.mts +1 -1
  40. package/dist/pipelines/index.d.ts +1 -1
  41. package/dist/pipelines/index.mjs +1 -1
  42. package/dist/r2sql/index.d.mts +54 -10
  43. package/dist/r2sql/index.d.ts +54 -10
  44. package/dist/r2sql/index.mjs +1 -7
  45. package/dist/vectors/index.d.mts +236 -71
  46. package/dist/vectors/index.d.ts +236 -71
  47. package/dist/vectors/index.mjs +1 -3
  48. package/package.json +14 -3
  49. package/dist/packem_shared/AnalyticsSqlError-C2nz3jpH.mjs +0 -41
  50. package/dist/packem_shared/R2SqlError-drPKSCZ3.mjs +0 -65
  51. package/dist/packem_shared/SelectBuilder-BOqJQHEv.mjs +0 -168
  52. package/dist/packem_shared/SetOperation-DmPgUL8W.mjs +0 -81
  53. package/dist/packem_shared/Sql-B3zq2YGx.mjs +0 -74
  54. package/dist/packem_shared/WindowExpression-BT_uA6g1.mjs +0 -44
  55. package/dist/packem_shared/WindowFunction-DrnuZUF6.mjs +0 -82
  56. package/dist/packem_shared/asc-DZbQCxh1.mjs +0 -16
  57. package/dist/packem_shared/buildImageDeliveryUrl-qZ7XbqTL.mjs +0 -35
  58. package/dist/packem_shared/buildSignedImageUrl-DNUFfyGP.mjs +0 -130
  59. package/dist/packem_shared/concurrent-CkCEVwqP.mjs +0 -39
  60. package/dist/packem_shared/createAnalytics-CEEI69o9.mjs +0 -57
  61. package/dist/packem_shared/createContextVectors-DwZtnPeC.mjs +0 -140
  62. package/dist/packem_shared/createImages-BzRnsz3H.mjs +0 -85
  63. package/dist/packem_shared/createKv-C8Iyu5hD.mjs +0 -145
  64. package/dist/packem_shared/createKvIntrospector-Byk4GfsY.mjs +0 -77
  65. package/dist/packem_shared/createPipelines-CfyJ6VGu.mjs +0 -10
  66. package/dist/packem_shared/createVectorAdminIntrospector-DuSvcBa5.mjs +0 -53
  67. package/dist/packem_shared/createVectors-CTSrctiK.mjs +0 -95
@@ -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 };
@@ -0,0 +1 @@
1
+ import{createArtifacts as r}from"../packem_shared/createArtifacts-cXCusYbi.mjs";import{authenticatedRemote as a}from"../packem_shared/authenticatedRemote-CPm87dLq.mjs";export{a as authenticatedRemote,r as createArtifacts};
@@ -8,12 +8,11 @@
8
8
  * (`input(stream).transform(opts).output(opts)` + `info(stream)`), not the full
9
9
  * hosted-images CRUD surface.
10
10
  *
11
- * TODO(workers-types): the 2026-06-16 optimization features — the `aspect-crop`
12
- * / `scale-up` fit modes and the `upscale` param — are modeled here by hand
13
- * because `@cloudflare/workers-types` (through 4.20260616.1) does not type them
14
- * yet. Re-check on the next `@cloudflare/workers-types` bump: once `ImageTransform`
15
- * carries `fit: "aspect-crop" | "scale-up"` and `upscale`, drop our hand-rolled
16
- * additions and lean on the upstream type.
11
+ * TODO(workers-types): the `aspect-crop` fit mode is modeled here by hand because
12
+ * `@cloudflare/workers-types` still does not type it — checked at the pinned
13
+ * 5.20260811.1, whose `ImageTransform` now carries `fit: "scale-up"` and `upscale`.
14
+ * Re-check on the next bump: once `ImageTransform` also carries
15
+ * `fit: "aspect-crop"`, drop our hand-rolled addition and lean on the upstream type.
17
16
  */
18
17
  /**
19
18
  * Porter-Duff compositing operation controlling how an overlay is blended onto
@@ -27,37 +26,6 @@
27
26
  * - `lighter` — foreground and backdrop channels added (brightening).
28
27
  */
29
28
  type ImageCompositeMode = "atop" | "in" | "lighter" | "out" | "over" | "xor";
30
- /**
31
- * One overlay in a {@link TransformOptions.draw} list — the **URL-form** overlay
32
- * (the `cf.image.draw` / `/cdn-cgi/image` shape), where the overlay image is
33
- * referenced by absolute `url`. For the **binding** path use {@link ImageOverlay}
34
- * instead, which carries the overlay bytes as a stream.
35
- *
36
- * `width`/`height` accept either an integer (pixels) or a decimal in `(0, 1]`
37
- * interpreted as a fraction of the base image's corresponding dimension.
38
- */
39
- interface DrawOverlay {
40
- /** Offset, in pixels, from the bottom edge. */
41
- bottom?: number;
42
- /** Blend mode for compositing this overlay onto the image. Default `over`. */
43
- composite?: ImageCompositeMode;
44
- /** Overlay height — pixels (integer) or a `0–1` fraction of the base height. */
45
- height?: number;
46
- /** Offset, in pixels, from the left edge. */
47
- left?: number;
48
- /** Overlay opacity, `0.0` (transparent) – `1.0` (opaque). */
49
- opacity?: number;
50
- /** Tile the overlay across the base image: `true`, or a single axis `"x"`/`"y"`. */
51
- repeat?: "x" | "y" | boolean;
52
- /** Offset, in pixels, from the right edge. */
53
- right?: number;
54
- /** Offset, in pixels, from the top edge. */
55
- top?: number;
56
- /** Absolute URL of the overlay image. */
57
- url: string;
58
- /** Overlay width — pixels (integer) or a `0–1` fraction of the base width. */
59
- width?: number;
60
- }
61
29
  /**
62
30
  * Transform parameters threaded into `binding.input(stream).transform(...)`.
63
31
  * A structural subset of the real `ImageTransform`; the keys here are the
@@ -73,13 +41,6 @@ interface TransformOptions {
73
41
  brightness?: number;
74
42
  /** Contrast multiplier (1 = unchanged). */
75
43
  contrast?: number;
76
- /**
77
- * URL-form overlays composited over the result, in paint order (last entry on
78
- * top). Consumed by the URL builders ({@link DrawOverlay} references each
79
- * overlay by `url`); the binding path applies overlays via the `overlays`
80
- * argument to `Images.transform` instead, so this key is ignored there.
81
- */
82
- draw?: DrawOverlay[];
83
44
  /**
84
45
  * Resize mode. Affects how `width`/`height` are interpreted.
85
46
  *
@@ -157,9 +118,9 @@ type ImageInfoLike = {
157
118
  };
158
119
  /**
159
120
  * Binding-side overlay options for `transformer.draw(image, options)` — the
160
- * blend/position/opacity knobs. Unlike {@link DrawOverlay} there is no `url`
161
- * (the overlay bytes are passed as the stream) and no `width`/`height` (the
162
- * overlay is pre-sized via its own transform); mirrors `ImageDrawOptions`.
121
+ * blend/position/opacity knobs. There is no `url` (the overlay bytes are passed
122
+ * as the stream) and no `width`/`height` (the overlay is pre-sized via its own
123
+ * transform); mirrors `ImageDrawOptions`.
163
124
  */
164
125
  interface ImageDrawOptions {
165
126
  /** Offset, in pixels, from the bottom edge. */
@@ -266,7 +227,7 @@ interface ImageDeliveryUrlOptions {
266
227
  baseUrl: string;
267
228
  /**
268
229
  * Hosted-Images image id. When set, the **delivery-variant** form is built
269
- * (`&lt;baseUrl>/&lt;imageId>/&lt;variant>`) and `transform`/`key` are ignored.
230
+ * (`<baseUrl>/<imageId>/<variant>`) and `transform`/`key` are ignored.
270
231
  */
271
232
  imageId?: string;
272
233
  /**
@@ -274,7 +235,7 @@ interface ImageDeliveryUrlOptions {
274
235
  * `/cdn-cgi/image/...` transform form. Ignored when `imageId` is set.
275
236
  */
276
237
  key?: string;
277
- /** Transform options for the `/cdn-cgi/image/&lt;options>/&lt;source>` form. */
238
+ /** Transform options for the `/cdn-cgi/image/<options>/<source>` form. */
278
239
  transform?: TransformOptions;
279
240
  /** Named delivery variant (e.g. `public`, `thumbnail`). Used with `imageId`; default `public`. */
280
241
  variant?: string;
@@ -282,12 +243,27 @@ interface ImageDeliveryUrlOptions {
282
243
  /**
283
244
  * Build a Cloudflare Images delivery / transform URL.
284
245
  *
285
- * - With `imageId`: `&lt;baseUrl>/&lt;imageId>/&lt;variant>` (hosted delivery variant).
286
- * - With `key`: `&lt;baseUrl>/cdn-cgi/image/&lt;options>/&lt;source>` (URL-based transform).
246
+ * - With `imageId`: `<baseUrl>/<imageId>/<variant>` (hosted delivery variant).
247
+ * - With `key`: `<baseUrl>/cdn-cgi/image/<options>/<source>` (URL-based transform).
287
248
  *
288
249
  * Pure and deterministic — usable from any handler.
289
250
  */
290
251
  declare const buildImageDeliveryUrl: (options: ImageDeliveryUrlOptions) => string;
252
+ /**
253
+ * Parse a verified transform string (the `t` query value handed back by
254
+ * {@link verifySignedImageUrl}) back into the {@link TransformOptions} it was
255
+ * serialized from, so the Worker can apply exactly the signed transform via
256
+ * `ctx.images.transform(...)` without hand-writing the inverse encoding.
257
+ *
258
+ * The exact inverse of `serializeTransform` above — the two MUST evolve
259
+ * together (the round-trip test in
260
+ * `__tests__/images/signed-delivery-url.test.ts` pins the pairing). Throws a
261
+ * `TypeError` on an unknown key or an uncoercible value: the input is meant to
262
+ * be a string whose HMAC already verified, so a parse failure means
263
+ * encoder/decoder drift in the library, never user input — fail loud rather
264
+ * than silently un-binding the transform the signature protects.
265
+ */
266
+ declare const parseSignedTransform: (t: string) => TransformOptions;
291
267
  interface SignedImageUrlOptions {
292
268
  /** Delivery / Worker origin the signed URL points at (e.g. `https://cdn.acme.test`). */
293
269
  baseUrl: string;
@@ -324,6 +300,15 @@ interface VerifyImageResult {
324
300
  reason?: "bad_signature" | "expired" | "malformed";
325
301
  /** The raw, verified transform string (the `t` query value), when present. */
326
302
  transform?: string;
303
+ /**
304
+ * The verified transform decoded back into the options object to pass to
305
+ * `ctx.images.transform(...)` — {@link parseSignedTransform} applied to
306
+ * `transform`. Left `undefined` when `transform` is absent, and also when a
307
+ * genuinely signed transform carries a key this build does not know (an
308
+ * old URL minted before a key was renamed): the request stays `valid`, the
309
+ * raw `transform` is still returned, and the caller decides.
310
+ */
311
+ transformOptions?: TransformOptions;
327
312
  valid: boolean;
328
313
  }
329
314
  /**
@@ -335,4 +320,4 @@ interface VerifyImageResult {
335
320
  declare const verifySignedImageUrl: (input: string | URL, secret: string, options?: {
336
321
  expectedHost?: string;
337
322
  }) => Promise<VerifyImageResult>;
338
- export { type DrawOverlay, type ImageCompositeMode, type ImageDeliveryUrlOptions, type ImageDrawOptions, type ImageInfoLike, type ImageInput, type ImageOutputFormat, type ImageOverlay, type ImageTransformationResultLike, type ImageTransformerLike, type Images, type ImagesBindingLike, type LunoraImagesOptions, type OutputOptions, type R2ObjectBodyLike, type SignedImageUrlOptions, type TransformOptions, type VerifyImageResult, buildImageDeliveryUrl, buildSignedImageUrl, createImages, verifySignedImageUrl };
323
+ export { type ImageCompositeMode, type ImageDeliveryUrlOptions, type ImageDrawOptions, type ImageInfoLike, type ImageInput, type ImageOutputFormat, type ImageOverlay, type ImageTransformationResultLike, type ImageTransformerLike, type Images, type ImagesBindingLike, type LunoraImagesOptions, type OutputOptions, type R2ObjectBodyLike, type SignedImageUrlOptions, type TransformOptions, type VerifyImageResult, buildImageDeliveryUrl, buildSignedImageUrl, createImages, parseSignedTransform, verifySignedImageUrl };