@leed-ai/git-gateway-backend-artifacts 0.0.0-stage → 0.1.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.
Files changed (39) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +29 -2
  3. package/dist/artifacts-backend.d.ts +45 -0
  4. package/dist/artifacts-backend.js +198 -0
  5. package/dist/artifacts-backend.js.map +1 -0
  6. package/dist/artifacts-binding.d.ts +38 -0
  7. package/dist/artifacts-binding.js +9 -0
  8. package/dist/artifacts-binding.js.map +1 -0
  9. package/dist/artifacts-errors.d.ts +29 -0
  10. package/dist/artifacts-errors.js +65 -0
  11. package/dist/artifacts-errors.js.map +1 -0
  12. package/dist/artifacts-git-reads.d.ts +24 -0
  13. package/dist/artifacts-git-reads.js +67 -0
  14. package/dist/artifacts-git-reads.js.map +1 -0
  15. package/dist/artifacts-mapping.d.ts +15 -0
  16. package/dist/artifacts-mapping.js +67 -0
  17. package/dist/artifacts-mapping.js.map +1 -0
  18. package/dist/artifacts-rest.d.ts +35 -0
  19. package/dist/artifacts-rest.js +91 -0
  20. package/dist/artifacts-rest.js.map +1 -0
  21. package/dist/package-name.d.ts +3 -0
  22. package/dist/package-name.js +6 -0
  23. package/dist/package-name.js.map +1 -0
  24. package/dist/schemas/artifacts-binding-results.d.ts +80 -0
  25. package/dist/schemas/artifacts-binding-results.js +160 -0
  26. package/dist/schemas/artifacts-binding-results.js.map +1 -0
  27. package/dist/schemas/artifacts-rest-results.d.ts +38 -0
  28. package/dist/schemas/artifacts-rest-results.js +66 -0
  29. package/dist/schemas/artifacts-rest-results.js.map +1 -0
  30. package/package.json +111 -4
  31. package/src/artifacts-backend.ts +256 -0
  32. package/src/artifacts-binding.ts +36 -0
  33. package/src/artifacts-errors.ts +85 -0
  34. package/src/artifacts-git-reads.ts +76 -0
  35. package/src/artifacts-mapping.ts +57 -0
  36. package/src/artifacts-rest.ts +112 -0
  37. package/src/package-name.ts +4 -0
  38. package/src/schemas/artifacts-binding-results.ts +205 -0
  39. package/src/schemas/artifacts-rest-results.ts +100 -0
@@ -0,0 +1,160 @@
1
+ import { z } from "zod";
2
+ // src/schemas/artifacts-binding-results.ts
3
+ const SHA = /^[0-9a-f]{40}$/;
4
+ const EXAMPLE_SHA = "8f3c2a9e1b7d4c6f0a5e2d9b8c7a6f5e4d3c2b1a";
5
+ const EXAMPLE_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
6
+ const timestamp = z.iso.datetime({ offset: true });
7
+ /** Repository metadata from `ArtifactsRepo.info()`. */
8
+ const ArtifactsRepoInfo = z.object({
9
+ id: z.string().min(1).describe("Unique repository id assigned by Artifacts."),
10
+ name: z.string().min(1).describe("Repository name within the namespace."),
11
+ description: z.string().nullable().describe("Repository description; null when none was set."),
12
+ defaultBranch: z.string().min(1).describe("Default branch name, e.g. \"main\"."),
13
+ createdAt: timestamp.describe("When the repository was created, ISO 8601."),
14
+ updatedAt: timestamp.describe("When the repository metadata last changed, ISO 8601."),
15
+ lastPushAt: timestamp.nullable().describe("When the repository was last pushed to, ISO 8601; null if never."),
16
+ source: z.string().nullable().describe("Fork or import source such as \"github:owner/repo\"; null when neither."),
17
+ readOnly: z.boolean().describe("true when the repository refuses pushes."),
18
+ remote: z.url().describe("HTTPS (HTTP locally) git remote URL of the repository, ending in \".git\".")
19
+ }).meta({
20
+ id: "ArtifactsRepoInfo",
21
+ title: "Artifacts repository info",
22
+ description: "What ArtifactsRepo.info() returns: the repository metadata, including its git remote URL. Unknown extra fields are ignored.",
23
+ examples: [{
24
+ id: "tq6o4x0af6vky45b",
25
+ name: "acme-raw-content",
26
+ description: null,
27
+ defaultBranch: "main",
28
+ createdAt: "2026-11-20T21:55:53.422Z",
29
+ updatedAt: "2026-11-20T21:55:53.422Z",
30
+ lastPushAt: null,
31
+ source: null,
32
+ readOnly: false,
33
+ remote: "https://acct.artifacts.cloudflare.net/git/default/acme-raw-content.git"
34
+ }]
35
+ });
36
+ /** The result of `Artifacts.create()`. */
37
+ const ArtifactsCreateResult = z.object({
38
+ id: z.string().min(1).describe("Unique repository id assigned by Artifacts."),
39
+ name: z.string().min(1).describe("Repository name within the namespace."),
40
+ defaultBranch: z.string().min(1).describe("Default branch name."),
41
+ remote: z.url().describe("Git remote URL of the new repository."),
42
+ token: z.string().min(1).describe("Initial write token, plaintext. Secret: the backend revokes it immediately and never returns it.")
43
+ }).meta({
44
+ id: "ArtifactsCreateResult",
45
+ title: "Artifacts create result",
46
+ description: "What Artifacts.create() returns: the new repository and an initial write token.",
47
+ examples: [{
48
+ id: "tq6o4x0af6vky45b",
49
+ name: "acme-raw-content",
50
+ defaultBranch: "main",
51
+ remote: "https://acct.artifacts.cloudflare.net/git/default/acme-raw-content.git",
52
+ token: "art_v2_example?expires=1795298153"
53
+ }]
54
+ });
55
+ /** The result of `ArtifactsRepo.createToken()`. */
56
+ const ArtifactsToken = z.object({
57
+ id: z.string().min(1).describe("Unique token id, usable to revoke it."),
58
+ plaintext: z.string().min(1).describe("The token itself. Secret: sent only as a Bearer header to the remote."),
59
+ scope: z.enum(["read", "write"]).meta({
60
+ description: "What the token allows.",
61
+ enumDescriptions: {
62
+ read: "Fetch and clone only.",
63
+ write: "Fetch, clone and push."
64
+ }
65
+ }),
66
+ expiresAt: timestamp.describe("When the token stops working, ISO 8601.")
67
+ }).meta({
68
+ id: "ArtifactsToken",
69
+ title: "Artifacts token",
70
+ description: "A repository access token minted by ArtifactsRepo.createToken(); authenticates git only.",
71
+ examples: [{
72
+ id: "hh50uo1kos7zorfv",
73
+ plaintext: "art_v2_example?expires=1795212353",
74
+ scope: "write",
75
+ expiresAt: "2026-11-20T22:05:53.602Z"
76
+ }]
77
+ });
78
+ /** One entry from `ArtifactsRepo.readTree()`. */
79
+ const ArtifactsTreeEntry = z.object({
80
+ name: z.string().min(1).describe("Entry name within the tree."),
81
+ mode: z.string().regex(/^[0-7]{5,6}$/).describe("Canonical git mode as Artifacts reports it, e.g. \"100644\" or \"40000\" (no leading zero)."),
82
+ hash: z.string().regex(SHA).describe("40-character lowercase hex id of the object the entry names."),
83
+ type: z.enum([
84
+ "tree",
85
+ "blob",
86
+ "symlink",
87
+ "gitlink",
88
+ "exec"
89
+ ]).meta({
90
+ description: "Classification Artifacts derives from the mode.",
91
+ enumDescriptions: {
92
+ tree: "A directory (mode 40000).",
93
+ blob: "A regular file (mode 100644).",
94
+ symlink: "A symbolic link (mode 120000).",
95
+ gitlink: "A submodule commit (mode 160000).",
96
+ exec: "An executable file (mode 100755)."
97
+ }
98
+ })
99
+ }).meta({
100
+ id: "ArtifactsTreeEntry",
101
+ title: "Artifacts tree entry",
102
+ description: "One immediate child of a tree, as ArtifactsRepo.readTree() returns it.",
103
+ examples: [{
104
+ name: "about.md",
105
+ mode: "100644",
106
+ hash: "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
107
+ type: "blob"
108
+ }]
109
+ });
110
+ const person = z.object({
111
+ name: z.string().describe("Name as recorded in the commit."),
112
+ email: z.string().describe("Email as recorded in the commit.")
113
+ }).describe("An identity recorded in a commit.");
114
+ /** Commit metadata from `ArtifactsRepo.readCommit()` and `log()`. */
115
+ const ArtifactsCommit = z.object({
116
+ hash: z.string().regex(SHA).describe("40-character lowercase hex commit id."),
117
+ treeHash: z.string().regex(SHA).describe("Id of the commit's root tree."),
118
+ message: z.string().describe("Commit message with one trailing newline removed, if it had one."),
119
+ author: person.describe("Author identity."),
120
+ committer: person.describe("Committer identity."),
121
+ parents: z.array(z.string().regex(SHA).describe("A parent commit id.")).describe("Parent ids in git order; empty for a root commit."),
122
+ authoredAt: z.int().min(0).describe("Author timestamp, Unix seconds."),
123
+ committedAt: z.int().min(0).describe("Committer timestamp, Unix seconds.")
124
+ }).meta({
125
+ id: "ArtifactsCommit",
126
+ title: "Artifacts commit",
127
+ description: "Decoded commit metadata from ArtifactsRepo.readCommit() and log(). Time zones are not reported and one trailing newline of the message is removed.",
128
+ examples: [{
129
+ hash: EXAMPLE_SHA,
130
+ treeHash: EXAMPLE_TREE,
131
+ message: "Update about page",
132
+ author: {
133
+ name: "Ada Lovelace",
134
+ email: "ada@example.com"
135
+ },
136
+ committer: {
137
+ name: "Ada Lovelace",
138
+ email: "ada@example.com"
139
+ },
140
+ parents: [],
141
+ authoredAt: 1795211753,
142
+ committedAt: 1795211753
143
+ }]
144
+ });
145
+ /** The identifying fields of an error thrown by the Artifacts binding. */
146
+ const ArtifactsBindingError = z.object({
147
+ code: z.string().min(1).describe("String error code, e.g. \"NOT_FOUND\" or \"ALREADY_EXISTS\"."),
148
+ message: z.string().describe("Human-readable message from the binding.")
149
+ }).meta({
150
+ id: "ArtifactsBindingError",
151
+ title: "Artifacts binding error",
152
+ description: "The fields of an ArtifactsError the backend relies on. Parsed from whatever was thrown, since an error crossing the binding's RPC boundary may lose its prototype.",
153
+ examples: [{
154
+ code: "NOT_FOUND",
155
+ message: "Repository not found: acme"
156
+ }]
157
+ });
158
+ export { ArtifactsBindingError, ArtifactsCommit, ArtifactsCreateResult, ArtifactsRepoInfo, ArtifactsToken, ArtifactsTreeEntry };
159
+
160
+ //# sourceMappingURL=artifacts-binding-results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts-binding-results.js","names":[],"sources":["../../src/schemas/artifacts-binding-results.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\nconst SHA = /^[0-9a-f]{40}$/;\nconst EXAMPLE_SHA = '8f3c2a9e1b7d4c6f0a5e2d9b8c7a6f5e4d3c2b1a';\nconst EXAMPLE_TREE = '4b825dc642cb6eb9a060e54bf8d69288fbee4904';\nconst timestamp = z.iso.datetime({ offset: true });\n\n/** Repository metadata from `ArtifactsRepo.info()`. */\nexport const ArtifactsRepoInfo = z\n .object({\n id: z.string().min(1).describe('Unique repository id assigned by Artifacts.'),\n name: z.string().min(1).describe('Repository name within the namespace.'),\n description: z.string().nullable().describe('Repository description; null when none was set.'),\n defaultBranch: z.string().min(1).describe('Default branch name, e.g. \"main\".'),\n createdAt: timestamp.describe('When the repository was created, ISO 8601.'),\n updatedAt: timestamp.describe('When the repository metadata last changed, ISO 8601.'),\n lastPushAt: timestamp\n .nullable()\n .describe('When the repository was last pushed to, ISO 8601; null if never.'),\n source: z\n .string()\n .nullable()\n .describe('Fork or import source such as \"github:owner/repo\"; null when neither.'),\n readOnly: z.boolean().describe('true when the repository refuses pushes.'),\n remote: z.url().describe('HTTPS (HTTP locally) git remote URL of the repository, ending in \".git\".'),\n })\n .meta({\n id: 'ArtifactsRepoInfo',\n title: 'Artifacts repository info',\n description:\n 'What ArtifactsRepo.info() returns: the repository metadata, including its git remote URL. Unknown extra fields are ignored.',\n examples: [\n {\n id: 'tq6o4x0af6vky45b',\n name: 'acme-raw-content',\n description: null,\n defaultBranch: 'main',\n createdAt: '2026-11-20T21:55:53.422Z',\n updatedAt: '2026-11-20T21:55:53.422Z',\n lastPushAt: null,\n source: null,\n readOnly: false,\n remote: 'https://acct.artifacts.cloudflare.net/git/default/acme-raw-content.git',\n },\n ],\n });\n\n/** Repository metadata from Artifacts, inferred from {@link ArtifactsRepoInfo}. */\nexport type ArtifactsRepoInfo = z.infer<typeof ArtifactsRepoInfo>;\n\n/** The result of `Artifacts.create()`. */\nexport const ArtifactsCreateResult = z\n .object({\n id: z.string().min(1).describe('Unique repository id assigned by Artifacts.'),\n name: z.string().min(1).describe('Repository name within the namespace.'),\n defaultBranch: z.string().min(1).describe('Default branch name.'),\n remote: z.url().describe('Git remote URL of the new repository.'),\n token: z\n .string()\n .min(1)\n .describe(\n 'Initial write token, plaintext. Secret: the backend revokes it immediately and never returns it.',\n ),\n })\n .meta({\n id: 'ArtifactsCreateResult',\n title: 'Artifacts create result',\n description: 'What Artifacts.create() returns: the new repository and an initial write token.',\n examples: [\n {\n id: 'tq6o4x0af6vky45b',\n name: 'acme-raw-content',\n defaultBranch: 'main',\n remote: 'https://acct.artifacts.cloudflare.net/git/default/acme-raw-content.git',\n token: 'art_v2_example?expires=1795298153',\n },\n ],\n });\n\n/** The result of creating an Artifacts repository, inferred from {@link ArtifactsCreateResult}. */\nexport type ArtifactsCreateResult = z.infer<typeof ArtifactsCreateResult>;\n\n/** The result of `ArtifactsRepo.createToken()`. */\nexport const ArtifactsToken = z\n .object({\n id: z.string().min(1).describe('Unique token id, usable to revoke it.'),\n plaintext: z\n .string()\n .min(1)\n .describe('The token itself. Secret: sent only as a Bearer header to the remote.'),\n scope: z.enum(['read', 'write']).meta({\n description: 'What the token allows.',\n enumDescriptions: { read: 'Fetch and clone only.', write: 'Fetch, clone and push.' },\n }),\n expiresAt: timestamp.describe('When the token stops working, ISO 8601.'),\n })\n .meta({\n id: 'ArtifactsToken',\n title: 'Artifacts token',\n description: 'A repository access token minted by ArtifactsRepo.createToken(); authenticates git only.',\n examples: [\n {\n id: 'hh50uo1kos7zorfv',\n plaintext: 'art_v2_example?expires=1795212353',\n scope: 'write',\n expiresAt: '2026-11-20T22:05:53.602Z',\n },\n ],\n });\n\n/** An Artifacts token, inferred from {@link ArtifactsToken}. */\nexport type ArtifactsToken = z.infer<typeof ArtifactsToken>;\n\n/** One entry from `ArtifactsRepo.readTree()`. */\nexport const ArtifactsTreeEntry = z\n .object({\n name: z.string().min(1).describe('Entry name within the tree.'),\n mode: z\n .string()\n .regex(/^[0-7]{5,6}$/)\n .describe('Canonical git mode as Artifacts reports it, e.g. \"100644\" or \"40000\" (no leading zero).'),\n hash: z.string().regex(SHA).describe('40-character lowercase hex id of the object the entry names.'),\n type: z.enum(['tree', 'blob', 'symlink', 'gitlink', 'exec']).meta({\n description: 'Classification Artifacts derives from the mode.',\n enumDescriptions: {\n tree: 'A directory (mode 40000).',\n blob: 'A regular file (mode 100644).',\n symlink: 'A symbolic link (mode 120000).',\n gitlink: 'A submodule commit (mode 160000).',\n exec: 'An executable file (mode 100755).',\n },\n }),\n })\n .meta({\n id: 'ArtifactsTreeEntry',\n title: 'Artifacts tree entry',\n description: 'One immediate child of a tree, as ArtifactsRepo.readTree() returns it.',\n examples: [\n { name: 'about.md', mode: '100644', hash: 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391', type: 'blob' },\n ],\n });\n\n/** An Artifacts tree entry, inferred from {@link ArtifactsTreeEntry}. */\nexport type ArtifactsTreeEntry = z.infer<typeof ArtifactsTreeEntry>;\n\nconst person = z\n .object({\n name: z.string().describe('Name as recorded in the commit.'),\n email: z.string().describe('Email as recorded in the commit.'),\n })\n .describe('An identity recorded in a commit.');\n\n/** Commit metadata from `ArtifactsRepo.readCommit()` and `log()`. */\nexport const ArtifactsCommit = z\n .object({\n hash: z.string().regex(SHA).describe('40-character lowercase hex commit id.'),\n treeHash: z.string().regex(SHA).describe(\"Id of the commit's root tree.\"),\n message: z.string().describe('Commit message with one trailing newline removed, if it had one.'),\n author: person.describe('Author identity.'),\n committer: person.describe('Committer identity.'),\n parents: z\n .array(z.string().regex(SHA).describe('A parent commit id.'))\n .describe('Parent ids in git order; empty for a root commit.'),\n authoredAt: z.int().min(0).describe('Author timestamp, Unix seconds.'),\n committedAt: z.int().min(0).describe('Committer timestamp, Unix seconds.'),\n })\n .meta({\n id: 'ArtifactsCommit',\n title: 'Artifacts commit',\n description:\n 'Decoded commit metadata from ArtifactsRepo.readCommit() and log(). Time zones are not reported and one trailing newline of the message is removed.',\n examples: [\n {\n hash: EXAMPLE_SHA,\n treeHash: EXAMPLE_TREE,\n message: 'Update about page',\n author: { name: 'Ada Lovelace', email: 'ada@example.com' },\n committer: { name: 'Ada Lovelace', email: 'ada@example.com' },\n parents: [],\n authoredAt: 1795211753,\n committedAt: 1795211753,\n },\n ],\n });\n\n/** Artifacts commit metadata, inferred from {@link ArtifactsCommit}. */\nexport type ArtifactsCommit = z.infer<typeof ArtifactsCommit>;\n\n/** The identifying fields of an error thrown by the Artifacts binding. */\nexport const ArtifactsBindingError = z\n .object({\n code: z.string().min(1).describe('String error code, e.g. \"NOT_FOUND\" or \"ALREADY_EXISTS\".'),\n message: z.string().describe('Human-readable message from the binding.'),\n })\n .meta({\n id: 'ArtifactsBindingError',\n title: 'Artifacts binding error',\n description:\n \"The fields of an ArtifactsError the backend relies on. Parsed from whatever was thrown, since an error crossing the binding's RPC boundary may lose its prototype.\",\n examples: [{ code: 'NOT_FOUND', message: 'Repository not found: acme' }],\n });\n\n/** An Artifacts binding error, inferred from {@link ArtifactsBindingError}. */\nexport type ArtifactsBindingError = z.infer<typeof ArtifactsBindingError>;\n"],"mappings":";;AAGA,MAAM,MAAM;AACZ,MAAM,cAAc;AACpB,MAAM,eAAe;AACrB,MAAM,YAAY,EAAE,IAAI,SAAS,EAAE,QAAQ,KAAK,CAAC;;AAGjD,MAAa,oBAAoB,EAC9B,OAAO;CACN,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,6CAA6C;CAC5E,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,uCAAuC;CACxE,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,iDAAiD;CAC7F,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,qCAAmC;CAC7E,WAAW,UAAU,SAAS,4CAA4C;CAC1E,WAAW,UAAU,SAAS,sDAAsD;CACpF,YAAY,UACT,SAAS,CAAC,CACV,SAAS,kEAAkE;CAC9E,QAAQ,EACL,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,yEAAuE;CACnF,UAAU,EAAE,QAAQ,CAAC,CAAC,SAAS,0CAA0C;CACzE,QAAQ,EAAE,IAAI,CAAC,CAAC,SAAS,4EAA0E;AACrG,CAAC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CACR;EACE,IAAI;EACJ,MAAM;EACN,aAAa;EACb,eAAe;EACf,WAAW;EACX,WAAW;EACX,YAAY;EACZ,QAAQ;EACR,UAAU;EACV,QAAQ;CACV,CACF;AACF,CAAC;;AAMH,MAAa,wBAAwB,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AE,MAAM;GAAgB,OAAO;EAAkB;EACzD,WAAW;GAAE,MAAM;GAAgB,OAAO;EAAkB;EAC5D,SAAS,CAAC;EACV,YAAY;EACZ,aAAa;CACf,CACF;AACF,CAAC;;AAMH,MAAa,wBAAwB,EAClC,OAAO;CACN,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,8DAA0D;CAC3F,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,0CAA0C;AACzE,CAAC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CAAC;EAAE,MAAM;EAAa,SAAS;CAA6B,CAAC;AACzE,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { z } from "zod";
2
+ /** The Cloudflare API v4 response envelope around a result. */
3
+ export declare function cloudflareEnvelope<S extends z.ZodType>(result: S): z.ZodObject<{
4
+ success: z.ZodLiteral<true>;
5
+ result: S;
6
+ errors: z.ZodArray<z.ZodUnknown>;
7
+ messages: z.ZodArray<z.ZodUnknown>;
8
+ }, z.core.$strip>;
9
+ /** A repository as the Artifacts REST API describes it. */
10
+ export declare const ArtifactsRestRepo: z.ZodObject<{
11
+ id: z.ZodString;
12
+ name: z.ZodString;
13
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
+ default_branch: z.ZodString;
15
+ created_at: z.ZodOptional<z.ZodISODateTime>;
16
+ remote: z.ZodURL;
17
+ }, z.core.$strip>;
18
+ /** An Artifacts repository from the REST API, inferred from {@link ArtifactsRestRepo}. */
19
+ export type ArtifactsRestRepo = z.infer<typeof ArtifactsRestRepo>;
20
+ /** A token from the Artifacts REST API. */
21
+ export declare const ArtifactsRestToken: z.ZodObject<{
22
+ id: z.ZodString;
23
+ plaintext: z.ZodString;
24
+ scope: z.ZodEnum<{
25
+ read: "read";
26
+ write: "write";
27
+ }>;
28
+ expires_at: z.ZodISODateTime;
29
+ }, z.core.$strip>;
30
+ /** An Artifacts token from the REST API, inferred from {@link ArtifactsRestToken}. */
31
+ export type ArtifactsRestToken = z.infer<typeof ArtifactsRestToken>;
32
+ /** A namespace from the Artifacts REST API. */
33
+ export declare const ArtifactsRestNamespace: z.ZodObject<{
34
+ name: z.ZodString;
35
+ }, z.core.$strip>;
36
+ /** An Artifacts namespace from the REST API, inferred from {@link ArtifactsRestNamespace}. */
37
+ export type ArtifactsRestNamespace = z.infer<typeof ArtifactsRestNamespace>;
38
+ //# sourceMappingURL=artifacts-rest-results.d.ts.map
@@ -0,0 +1,66 @@
1
+ import { z } from "zod";
2
+ // src/schemas/artifacts-rest-results.ts
3
+ const timestamp = z.iso.datetime({ offset: true });
4
+ /** The Cloudflare API v4 response envelope around a result. */
5
+ function cloudflareEnvelope(result) {
6
+ return z.object({
7
+ success: z.literal(true).describe("Always true for a successful response; failures are thrown by the SDK."),
8
+ result: result.describe("The payload of the response."),
9
+ errors: z.array(z.unknown().describe("An error entry; empty on success.")).describe("Errors; empty on success."),
10
+ messages: z.array(z.unknown().describe("An informational message.")).describe("Informational messages.")
11
+ }).describe("The Cloudflare API v4 envelope: success flag, result, errors and messages.");
12
+ }
13
+ /** A repository as the Artifacts REST API describes it. */
14
+ const ArtifactsRestRepo = z.object({
15
+ id: z.string().min(1).describe("Unique repository id."),
16
+ name: z.string().min(1).describe("Repository name within the namespace."),
17
+ description: z.string().nullable().optional().describe("Repository description; null or absent when none."),
18
+ default_branch: z.string().min(1).describe("Default branch name."),
19
+ created_at: timestamp.optional().describe("Creation time, ISO 8601; absent in a create result."),
20
+ remote: z.url().describe("Git remote URL of the repository.")
21
+ }).meta({
22
+ id: "ArtifactsRestRepo",
23
+ title: "Artifacts REST repository",
24
+ description: "A repository from the Artifacts REST API (GET or POST …/namespaces/{namespace}/repos). Extra fields are ignored.",
25
+ examples: [{
26
+ id: "tq6o4x0af6vky45b",
27
+ name: "acme-raw-content",
28
+ description: null,
29
+ default_branch: "main",
30
+ created_at: "2026-11-20T09:30:00.000Z",
31
+ remote: "https://acct.artifacts.cloudflare.net/git/default/acme-raw-content.git"
32
+ }]
33
+ });
34
+ /** A token from the Artifacts REST API. */
35
+ const ArtifactsRestToken = z.object({
36
+ id: z.string().min(1).describe("Unique token id, used to revoke it."),
37
+ plaintext: z.string().min(1).describe("The token. Secret: authenticates git only, never REST."),
38
+ scope: z.enum(["read", "write"]).meta({
39
+ description: "What the token allows.",
40
+ enumDescriptions: {
41
+ read: "Fetch and clone only.",
42
+ write: "Fetch, clone and push."
43
+ }
44
+ }),
45
+ expires_at: timestamp.describe("When the token stops working, ISO 8601.")
46
+ }).meta({
47
+ id: "ArtifactsRestToken",
48
+ title: "Artifacts REST token",
49
+ description: "A repository token minted through POST …/namespaces/{namespace}/tokens.",
50
+ examples: [{
51
+ id: "hh50uo1kos7zorfv",
52
+ plaintext: "art_v2_example",
53
+ scope: "read",
54
+ expires_at: "2026-11-20T09:35:00.000Z"
55
+ }]
56
+ });
57
+ /** A namespace from the Artifacts REST API. */
58
+ const ArtifactsRestNamespace = z.object({ name: z.string().min(1).describe("The namespace name.") }).meta({
59
+ id: "ArtifactsRestNamespace",
60
+ title: "Artifacts REST namespace",
61
+ description: "A namespace from the Artifacts REST API; only its name is relied on, other fields are ignored.",
62
+ examples: [{ name: "default" }]
63
+ });
64
+ export { ArtifactsRestNamespace, ArtifactsRestRepo, ArtifactsRestToken, cloudflareEnvelope };
65
+
66
+ //# sourceMappingURL=artifacts-rest-results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts-rest-results.js","names":[],"sources":["../../src/schemas/artifacts-rest-results.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\nconst timestamp = z.iso.datetime({ offset: true });\n\n/** The Cloudflare API v4 response envelope around a result. */\nexport function cloudflareEnvelope<S extends z.ZodType>(result: S) {\n return z\n .object({\n success: z\n .literal(true)\n .describe('Always true for a successful response; failures are thrown by the SDK.'),\n result: result.describe('The payload of the response.'),\n errors: z\n .array(z.unknown().describe('An error entry; empty on success.'))\n .describe('Errors; empty on success.'),\n messages: z\n .array(z.unknown().describe('An informational message.'))\n .describe('Informational messages.'),\n })\n .describe('The Cloudflare API v4 envelope: success flag, result, errors and messages.');\n}\n\n/** A repository as the Artifacts REST API describes it. */\nexport const ArtifactsRestRepo = z\n .object({\n id: z.string().min(1).describe('Unique repository id.'),\n name: z.string().min(1).describe('Repository name within the namespace.'),\n description: z\n .string()\n .nullable()\n .optional()\n .describe('Repository description; null or absent when none.'),\n default_branch: z.string().min(1).describe('Default branch name.'),\n created_at: timestamp.optional().describe('Creation time, ISO 8601; absent in a create result.'),\n remote: z.url().describe('Git remote URL of the repository.'),\n })\n .meta({\n id: 'ArtifactsRestRepo',\n title: 'Artifacts REST repository',\n description:\n 'A repository from the Artifacts REST API (GET or POST …/namespaces/{namespace}/repos). Extra fields are ignored.',\n examples: [\n {\n id: 'tq6o4x0af6vky45b',\n name: 'acme-raw-content',\n description: null,\n default_branch: 'main',\n created_at: '2026-11-20T09:30:00.000Z',\n remote: 'https://acct.artifacts.cloudflare.net/git/default/acme-raw-content.git',\n },\n ],\n });\n\n/** An Artifacts repository from the REST API, inferred from {@link ArtifactsRestRepo}. */\nexport type ArtifactsRestRepo = z.infer<typeof ArtifactsRestRepo>;\n\n/** A token from the Artifacts REST API. */\nexport const ArtifactsRestToken = z\n .object({\n id: z.string().min(1).describe('Unique token id, used to revoke it.'),\n plaintext: z.string().min(1).describe('The token. Secret: authenticates git only, never REST.'),\n scope: z.enum(['read', 'write']).meta({\n description: 'What the token allows.',\n enumDescriptions: { read: 'Fetch and clone only.', write: 'Fetch, clone and push.' },\n }),\n expires_at: timestamp.describe('When the token stops working, ISO 8601.'),\n })\n .meta({\n id: 'ArtifactsRestToken',\n title: 'Artifacts REST token',\n description: 'A repository token minted through POST …/namespaces/{namespace}/tokens.',\n examples: [\n {\n id: 'hh50uo1kos7zorfv',\n plaintext: 'art_v2_example',\n scope: 'read',\n expires_at: '2026-11-20T09:35:00.000Z',\n },\n ],\n });\n\n/** An Artifacts token from the REST API, inferred from {@link ArtifactsRestToken}. */\nexport type ArtifactsRestToken = z.infer<typeof ArtifactsRestToken>;\n\n/** A namespace from the Artifacts REST API. */\nexport const ArtifactsRestNamespace = z\n .object({\n name: z.string().min(1).describe('The namespace name.'),\n })\n .meta({\n id: 'ArtifactsRestNamespace',\n title: 'Artifacts REST namespace',\n description:\n 'A namespace from the Artifacts REST API; only its name is relied on, other fields are ignored.',\n examples: [{ name: 'default' }],\n });\n\n/** An Artifacts namespace from the REST API, inferred from {@link ArtifactsRestNamespace}. */\nexport type ArtifactsRestNamespace = z.infer<typeof ArtifactsRestNamespace>;\n"],"mappings":";;AAGA,MAAM,YAAY,EAAE,IAAI,SAAS,EAAE,QAAQ,KAAK,CAAC;;AAGjD,SAAgB,mBAAwC,QAAW;CACjE,OAAO,EACJ,OAAO;EACN,SAAS,EACN,QAAQ,IAAI,CAAC,CACb,SAAS,wEAAwE;EACpF,QAAQ,OAAO,SAAS,8BAA8B;EACtD,QAAQ,EACL,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS,mCAAmC,CAAC,CAAC,CAChE,SAAS,2BAA2B;EACvC,UAAU,EACP,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS,2BAA2B,CAAC,CAAC,CACxD,SAAS,yBAAyB;CACvC,CAAC,CAAC,CACD,SAAS,4EAA4E;AAC1F;;AAGA,MAAa,oBAAoB,EAC9B,OAAO;CACN,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,uBAAuB;CACtD,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,uCAAuC;CACxE,aAAa,EACV,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,CAAC,CACV,SAAS,mDAAmD;CAC/D,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,sBAAsB;CACjE,YAAY,UAAU,SAAS,CAAC,CAAC,SAAS,qDAAqD;CAC/F,QAAQ,EAAE,IAAI,CAAC,CAAC,SAAS,mCAAmC;AAC9D,CAAC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CACR;EACE,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,YAAY;EACZ,QAAQ;CACV,CACF;AACF,CAAC;;AAMH,MAAa,qBAAqB,EAC/B,OAAO;CACN,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,qCAAqC;CACpE,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,wDAAwD;CAC9F,OAAO,EAAE,KAAK,CAAC,QAAQ,OAAO,CAAC,CAAC,CAAC,KAAK;EACpC,aAAa;EACb,kBAAkB;GAAE,MAAM;GAAyB,OAAO;EAAyB;CACrF,CAAC;CACD,YAAY,UAAU,SAAS,yCAAyC;AAC1E,CAAC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACb,UAAU,CACR;EACE,IAAI;EACJ,WAAW;EACX,OAAO;EACP,YAAY;CACd,CACF;AACF,CAAC;;AAMH,MAAa,yBAAyB,EACnC,OAAO,EACN,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,qBAAqB,EACxD,CAAC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CAAC,EAAE,MAAM,UAAU,CAAC;AAChC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,113 @@
1
1
  {
2
2
  "name": "@leed-ai/git-gateway-backend-artifacts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "git-gateway storage backend over Cloudflare Artifacts.",
5
+ "keywords": [
6
+ "cloudflare-artifacts",
7
+ "cloudflare-workers",
8
+ "git",
9
+ "git-gateway",
10
+ "storage-backend"
11
+ ],
12
+ "homepage": "https://github.com/leed-ai/git-gateway/tree/main/packages/backend-artifacts#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/leed-ai/git-gateway/issues"
15
+ },
16
+ "license": "Apache-2.0",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/leed-ai/git-gateway.git",
20
+ "directory": "packages/backend-artifacts"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "src"
25
+ ],
26
+ "type": "module",
27
+ "sideEffects": false,
28
+ "exports": {
29
+ "./artifacts-backend": {
30
+ "source": "./src/artifacts-backend.ts",
31
+ "types": "./dist/artifacts-backend.d.ts",
32
+ "default": "./dist/artifacts-backend.js"
33
+ },
34
+ "./artifacts-binding": {
35
+ "source": "./src/artifacts-binding.ts",
36
+ "types": "./dist/artifacts-binding.d.ts",
37
+ "default": "./dist/artifacts-binding.js"
38
+ },
39
+ "./artifacts-errors": {
40
+ "source": "./src/artifacts-errors.ts",
41
+ "types": "./dist/artifacts-errors.d.ts",
42
+ "default": "./dist/artifacts-errors.js"
43
+ },
44
+ "./artifacts-git-reads": {
45
+ "source": "./src/artifacts-git-reads.ts",
46
+ "types": "./dist/artifacts-git-reads.d.ts",
47
+ "default": "./dist/artifacts-git-reads.js"
48
+ },
49
+ "./artifacts-mapping": {
50
+ "source": "./src/artifacts-mapping.ts",
51
+ "types": "./dist/artifacts-mapping.d.ts",
52
+ "default": "./dist/artifacts-mapping.js"
53
+ },
54
+ "./artifacts-rest": {
55
+ "source": "./src/artifacts-rest.ts",
56
+ "types": "./dist/artifacts-rest.d.ts",
57
+ "default": "./dist/artifacts-rest.js"
58
+ },
59
+ "./package-name": {
60
+ "source": "./src/package-name.ts",
61
+ "types": "./dist/package-name.d.ts",
62
+ "default": "./dist/package-name.js"
63
+ },
64
+ "./schemas/artifacts-binding-results": {
65
+ "source": "./src/schemas/artifacts-binding-results.ts",
66
+ "types": "./dist/schemas/artifacts-binding-results.d.ts",
67
+ "default": "./dist/schemas/artifacts-binding-results.js"
68
+ },
69
+ "./schemas/artifacts-rest-results": {
70
+ "source": "./src/schemas/artifacts-rest-results.ts",
71
+ "types": "./dist/schemas/artifacts-rest-results.d.ts",
72
+ "default": "./dist/schemas/artifacts-rest-results.js"
73
+ },
74
+ "./package.json": "./package.json"
75
+ },
76
+ "publishConfig": {
77
+ "access": "public",
78
+ "provenance": true
79
+ },
80
+ "scripts": {
81
+ "build": "vp pack",
82
+ "check": "vp check",
83
+ "test": "vp test",
84
+ "test:contract": "vp test test/contract/"
85
+ },
86
+ "dependencies": {
87
+ "@leed-ai/git-gateway-contract": "0.1.0",
88
+ "@leed-ai/git-gateway-core": "0.1.0"
89
+ },
90
+ "devDependencies": {
91
+ "@cloudflare/vitest-plugin": "^1.8.5",
92
+ "@cloudflare/workers-types": "^5.20261120.1",
93
+ "@leed-ai/git-gateway-repo-tools": "0.0.0",
94
+ "@leed-ai/git-gateway-schema-docs": "0.0.0",
95
+ "@leed-ai/git-gateway-testkit": "0.1.0",
96
+ "cloudflare": "^5.2.0",
97
+ "typescript": "^7.0.2",
98
+ "vite-plus": "^1.7.0",
99
+ "zod": "^4.6.7"
100
+ },
101
+ "peerDependencies": {
102
+ "cloudflare": "^5",
103
+ "zod": "^4"
104
+ },
105
+ "peerDependenciesMeta": {
106
+ "cloudflare": {
107
+ "optional": true
108
+ }
109
+ },
110
+ "engines": {
111
+ "node": ">=22.18.0"
112
+ }
113
+ }