@leed-ai/git-gateway-contract 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 (286) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +50 -2
  3. package/dist/behaviour/assertions.d.ts +23 -0
  4. package/dist/behaviour/assertions.js +56 -0
  5. package/dist/behaviour/assertions.js.map +1 -0
  6. package/dist/behaviour/behaviour-case.d.ts +19 -0
  7. package/dist/behaviour/behaviour-case.js +12 -0
  8. package/dist/behaviour/behaviour-case.js.map +1 -0
  9. package/dist/behaviour/behaviour-suite.d.ts +30 -0
  10. package/dist/behaviour/behaviour-suite.js +50 -0
  11. package/dist/behaviour/behaviour-suite.js.map +1 -0
  12. package/dist/behaviour/commit-action-cases.d.ts +4 -0
  13. package/dist/behaviour/commit-action-cases.js +342 -0
  14. package/dist/behaviour/commit-action-cases.js.map +1 -0
  15. package/dist/behaviour/commit-write-cases.d.ts +4 -0
  16. package/dist/behaviour/commit-write-cases.js +234 -0
  17. package/dist/behaviour/commit-write-cases.js.map +1 -0
  18. package/dist/behaviour/fixtures.d.ts +29 -0
  19. package/dist/behaviour/fixtures.js +83 -0
  20. package/dist/behaviour/fixtures.js.map +1 -0
  21. package/dist/behaviour/lifecycle-cases.d.ts +4 -0
  22. package/dist/behaviour/lifecycle-cases.js +158 -0
  23. package/dist/behaviour/lifecycle-cases.js.map +1 -0
  24. package/dist/behaviour/promote-cases.d.ts +4 -0
  25. package/dist/behaviour/promote-cases.js +122 -0
  26. package/dist/behaviour/promote-cases.js.map +1 -0
  27. package/dist/behaviour/read-cases.d.ts +4 -0
  28. package/dist/behaviour/read-cases.js +248 -0
  29. package/dist/behaviour/read-cases.js.map +1 -0
  30. package/dist/behaviour/sync-cases.d.ts +4 -0
  31. package/dist/behaviour/sync-cases.js +205 -0
  32. package/dist/behaviour/sync-cases.js.map +1 -0
  33. package/dist/clock-B3MlpmVY.d.ts +10 -0
  34. package/dist/commit-BEZmeAOl.d.ts +23 -0
  35. package/dist/file-map-CxUveLWz.d.ts +18 -0
  36. package/dist/gateway-config-oVsdTEeK.d.ts +39 -0
  37. package/dist/gateway-error-body-BWzZFAQI.d.ts +214 -0
  38. package/dist/gateway-error.d.ts +30 -0
  39. package/dist/gateway-error.js +63 -0
  40. package/dist/gateway-error.js.map +1 -0
  41. package/dist/git-gateway-VA9Tc5tn.d.ts +358 -0
  42. package/dist/git-gateway.d.ts +2 -0
  43. package/dist/git-gateway.js +65 -0
  44. package/dist/git-gateway.js.map +1 -0
  45. package/dist/health.d.ts +9 -0
  46. package/dist/health.js +18 -0
  47. package/dist/health.js.map +1 -0
  48. package/dist/history-CqvHaUE-.d.ts +20 -0
  49. package/dist/package-name.d.ts +3 -0
  50. package/dist/package-name.js +6 -0
  51. package/dist/package-name.js.map +1 -0
  52. package/dist/proxy/audit-event.d.ts +61 -0
  53. package/dist/proxy/audit-event.js +97 -0
  54. package/dist/proxy/audit-event.js.map +1 -0
  55. package/dist/proxy/branch-rule.d.ts +72 -0
  56. package/dist/proxy/branch-rule.js +106 -0
  57. package/dist/proxy/branch-rule.js.map +1 -0
  58. package/dist/proxy/gateway-hooks.d.ts +58 -0
  59. package/dist/proxy/gateway-hooks.js +0 -0
  60. package/dist/proxy/git-operation.d.ts +17 -0
  61. package/dist/proxy/git-operation.js +32 -0
  62. package/dist/proxy/git-operation.js.map +1 -0
  63. package/dist/proxy/policy-result.d.ts +51 -0
  64. package/dist/proxy/policy-result.js +90 -0
  65. package/dist/proxy/policy-result.js.map +1 -0
  66. package/dist/proxy/principal.d.ts +18 -0
  67. package/dist/proxy/principal.js +32 -0
  68. package/dist/proxy/principal.js.map +1 -0
  69. package/dist/proxy/push-policy-result.d.ts +34 -0
  70. package/dist/proxy/push-policy-result.js +48 -0
  71. package/dist/proxy/push-policy-result.js.map +1 -0
  72. package/dist/proxy/push-policy.d.ts +146 -0
  73. package/dist/proxy/push-policy.js +112 -0
  74. package/dist/proxy/push-policy.js.map +1 -0
  75. package/dist/proxy/request-credential.d.ts +22 -0
  76. package/dist/proxy/request-credential.js +46 -0
  77. package/dist/proxy/request-credential.js.map +1 -0
  78. package/dist/proxy/smart-http-config.d.ts +22 -0
  79. package/dist/proxy/smart-http-config.js +40 -0
  80. package/dist/proxy/smart-http-config.js.map +1 -0
  81. package/dist/reference/apply-actions.d.ts +9 -0
  82. package/dist/reference/apply-actions.js +84 -0
  83. package/dist/reference/apply-actions.js.map +1 -0
  84. package/dist/reference/branch-methods.d.ts +7 -0
  85. package/dist/reference/branch-methods.js +105 -0
  86. package/dist/reference/branch-methods.js.map +1 -0
  87. package/dist/reference/bytes.d.ts +22 -0
  88. package/dist/reference/bytes.js +62 -0
  89. package/dist/reference/bytes.js.map +1 -0
  90. package/dist/reference/clock.d.ts +2 -0
  91. package/dist/reference/clock.js +18 -0
  92. package/dist/reference/clock.js.map +1 -0
  93. package/dist/reference/commit-method.d.ts +5 -0
  94. package/dist/reference/commit-method.js +83 -0
  95. package/dist/reference/commit-method.js.map +1 -0
  96. package/dist/reference/file-map.d.ts +2 -0
  97. package/dist/reference/file-map.js +24 -0
  98. package/dist/reference/file-map.js.map +1 -0
  99. package/dist/reference/hash.d.ts +10 -0
  100. package/dist/reference/hash.js +25 -0
  101. package/dist/reference/hash.js.map +1 -0
  102. package/dist/reference/history.d.ts +2 -0
  103. package/dist/reference/history.js +65 -0
  104. package/dist/reference/history.js.map +1 -0
  105. package/dist/reference/lifecycle-methods.d.ts +9 -0
  106. package/dist/reference/lifecycle-methods.js +48 -0
  107. package/dist/reference/lifecycle-methods.js.map +1 -0
  108. package/dist/reference/read-methods.d.ts +13 -0
  109. package/dist/reference/read-methods.js +68 -0
  110. package/dist/reference/read-methods.js.map +1 -0
  111. package/dist/reference/reference-gateway.d.ts +18 -0
  112. package/dist/reference/reference-gateway.js +35 -0
  113. package/dist/reference/reference-gateway.js.map +1 -0
  114. package/dist/reference/repo-state.d.ts +43 -0
  115. package/dist/reference/repo-state.js +45 -0
  116. package/dist/reference/repo-state.js.map +1 -0
  117. package/dist/reference/run-method.d.ts +13 -0
  118. package/dist/reference/run-method.js +15 -0
  119. package/dist/reference/run-method.js.map +1 -0
  120. package/dist/reference/three-way-merge.d.ts +16 -0
  121. package/dist/reference/three-way-merge.js +45 -0
  122. package/dist/reference/three-way-merge.js.map +1 -0
  123. package/dist/reference/trailer.d.ts +7 -0
  124. package/dist/reference/trailer.js +16 -0
  125. package/dist/reference/trailer.js.map +1 -0
  126. package/dist/reference/tree-index.d.ts +2 -0
  127. package/dist/reference/tree-index.js +66 -0
  128. package/dist/reference/tree-index.js.map +1 -0
  129. package/dist/reference/write-commit.d.ts +15 -0
  130. package/dist/reference/write-commit.js +44 -0
  131. package/dist/reference/write-commit.js.map +1 -0
  132. package/dist/rpc/commit-exists.d.ts +16 -0
  133. package/dist/rpc/commit-exists.js +30 -0
  134. package/dist/rpc/commit-exists.js.map +1 -0
  135. package/dist/rpc/commit.d.ts +172 -0
  136. package/dist/rpc/commit.js +115 -0
  137. package/dist/rpc/commit.js.map +1 -0
  138. package/dist/rpc/list-tree.d.ts +59 -0
  139. package/dist/rpc/list-tree.js +54 -0
  140. package/dist/rpc/list-tree.js.map +1 -0
  141. package/dist/rpc/log.d.ts +35 -0
  142. package/dist/rpc/log.js +41 -0
  143. package/dist/rpc/log.js.map +1 -0
  144. package/dist/rpc/mint-read-token.d.ts +17 -0
  145. package/dist/rpc/mint-read-token.js +36 -0
  146. package/dist/rpc/mint-read-token.js.map +1 -0
  147. package/dist/rpc/promote.d.ts +39 -0
  148. package/dist/rpc/promote.js +69 -0
  149. package/dist/rpc/promote.js.map +1 -0
  150. package/dist/rpc/read-file.d.ts +44 -0
  151. package/dist/rpc/read-file.js +56 -0
  152. package/dist/rpc/read-file.js.map +1 -0
  153. package/dist/rpc/repo-lifecycle.d.ts +39 -0
  154. package/dist/rpc/repo-lifecycle.js +64 -0
  155. package/dist/rpc/repo-lifecycle.js.map +1 -0
  156. package/dist/rpc/resolve-ref.d.ts +15 -0
  157. package/dist/rpc/resolve-ref.js +28 -0
  158. package/dist/rpc/resolve-ref.js.map +1 -0
  159. package/dist/rpc/sync-branch.d.ts +107 -0
  160. package/dist/rpc/sync-branch.js +114 -0
  161. package/dist/rpc/sync-branch.js.map +1 -0
  162. package/dist/schemas/commit-action.d.ts +100 -0
  163. package/dist/schemas/commit-action.js +138 -0
  164. package/dist/schemas/commit-action.js.map +1 -0
  165. package/dist/schemas/commit.d.ts +2 -0
  166. package/dist/schemas/commit.js +24 -0
  167. package/dist/schemas/commit.js.map +1 -0
  168. package/dist/schemas/content-encoding.d.ts +24 -0
  169. package/dist/schemas/content-encoding.js +41 -0
  170. package/dist/schemas/content-encoding.js.map +1 -0
  171. package/dist/schemas/examples.d.ts +38 -0
  172. package/dist/schemas/examples.js +32 -0
  173. package/dist/schemas/examples.js.map +1 -0
  174. package/dist/schemas/gateway-config.d.ts +2 -0
  175. package/dist/schemas/gateway-config.js +72 -0
  176. package/dist/schemas/gateway-config.js.map +1 -0
  177. package/dist/schemas/gateway-error-body.d.ts +2 -0
  178. package/dist/schemas/gateway-error-body.js +188 -0
  179. package/dist/schemas/gateway-error-body.js.map +1 -0
  180. package/dist/schemas/identity.d.ts +21 -0
  181. package/dist/schemas/identity.js +40 -0
  182. package/dist/schemas/identity.js.map +1 -0
  183. package/dist/schemas/names.d.ts +26 -0
  184. package/dist/schemas/names.js +58 -0
  185. package/dist/schemas/names.js.map +1 -0
  186. package/dist/schemas/ref-update.d.ts +10 -0
  187. package/dist/schemas/ref-update.js +25 -0
  188. package/dist/schemas/ref-update.js.map +1 -0
  189. package/dist/schemas/sha.d.ts +8 -0
  190. package/dist/schemas/sha.js +14 -0
  191. package/dist/schemas/sha.js.map +1 -0
  192. package/dist/schemas/tree-entry.d.ts +2 -0
  193. package/dist/schemas/tree-entry.js +62 -0
  194. package/dist/schemas/tree-entry.js.map +1 -0
  195. package/dist/storage/git-remote.d.ts +17 -0
  196. package/dist/storage/git-remote.js +31 -0
  197. package/dist/storage/git-remote.js.map +1 -0
  198. package/dist/storage/storage-backend.d.ts +61 -0
  199. package/dist/storage/storage-backend.js +0 -0
  200. package/dist/storage/storage-errors.d.ts +12 -0
  201. package/dist/storage/storage-errors.js +22 -0
  202. package/dist/storage/storage-errors.js.map +1 -0
  203. package/dist/storage/storage-input.d.ts +7 -0
  204. package/dist/storage/storage-input.js +14 -0
  205. package/dist/storage/storage-input.js.map +1 -0
  206. package/dist/storage/storage-read.d.ts +13 -0
  207. package/dist/storage/storage-read.js +30 -0
  208. package/dist/storage/storage-read.js.map +1 -0
  209. package/dist/storage/storage-repo-info.d.ts +16 -0
  210. package/dist/storage/storage-repo-info.js +30 -0
  211. package/dist/storage/storage-repo-info.js.map +1 -0
  212. package/dist/storage/storage-tree-entry.d.ts +21 -0
  213. package/dist/storage/storage-tree-entry.js +17 -0
  214. package/dist/storage/storage-tree-entry.js.map +1 -0
  215. package/dist/tree-entry-BM_1gou1.d.ts +41 -0
  216. package/dist/tree-index-Bk721Phv.d.ts +14 -0
  217. package/package.json +401 -4
  218. package/src/behaviour/assertions.ts +75 -0
  219. package/src/behaviour/behaviour-case.ts +28 -0
  220. package/src/behaviour/behaviour-suite.ts +76 -0
  221. package/src/behaviour/commit-action-cases.ts +253 -0
  222. package/src/behaviour/commit-write-cases.ts +205 -0
  223. package/src/behaviour/fixtures.ts +103 -0
  224. package/src/behaviour/lifecycle-cases.ts +104 -0
  225. package/src/behaviour/promote-cases.ts +78 -0
  226. package/src/behaviour/read-cases.ts +176 -0
  227. package/src/behaviour/sync-cases.ts +156 -0
  228. package/src/gateway-error.ts +72 -0
  229. package/src/git-gateway.ts +76 -0
  230. package/src/health.ts +26 -0
  231. package/src/package-name.ts +4 -0
  232. package/src/proxy/audit-event.ts +135 -0
  233. package/src/proxy/branch-rule.ts +190 -0
  234. package/src/proxy/gateway-hooks.ts +67 -0
  235. package/src/proxy/git-operation.ts +36 -0
  236. package/src/proxy/policy-result.ts +127 -0
  237. package/src/proxy/principal.ts +81 -0
  238. package/src/proxy/push-policy-result.ts +86 -0
  239. package/src/proxy/push-policy.ts +158 -0
  240. package/src/proxy/request-credential.ts +47 -0
  241. package/src/proxy/smart-http-config.ts +158 -0
  242. package/src/reference/apply-actions.ts +96 -0
  243. package/src/reference/branch-methods.ts +105 -0
  244. package/src/reference/bytes.ts +66 -0
  245. package/src/reference/clock.ts +19 -0
  246. package/src/reference/commit-method.ts +97 -0
  247. package/src/reference/file-map.ts +35 -0
  248. package/src/reference/hash.ts +25 -0
  249. package/src/reference/history.ts +78 -0
  250. package/src/reference/lifecycle-methods.ts +52 -0
  251. package/src/reference/read-methods.ts +87 -0
  252. package/src/reference/reference-gateway.ts +50 -0
  253. package/src/reference/repo-state.ts +83 -0
  254. package/src/reference/run-method.ts +25 -0
  255. package/src/reference/three-way-merge.ts +42 -0
  256. package/src/reference/trailer.ts +18 -0
  257. package/src/reference/tree-index.ts +65 -0
  258. package/src/reference/write-commit.ts +44 -0
  259. package/src/rpc/commit-exists.ts +46 -0
  260. package/src/rpc/commit.ts +156 -0
  261. package/src/rpc/list-tree.ts +78 -0
  262. package/src/rpc/log.ts +51 -0
  263. package/src/rpc/mint-read-token.ts +59 -0
  264. package/src/rpc/promote.ts +72 -0
  265. package/src/rpc/read-file.ts +75 -0
  266. package/src/rpc/repo-lifecycle.ts +103 -0
  267. package/src/rpc/resolve-ref.ts +41 -0
  268. package/src/rpc/sync-branch.ts +149 -0
  269. package/src/schemas/commit-action.ts +157 -0
  270. package/src/schemas/commit.ts +43 -0
  271. package/src/schemas/content-encoding.ts +58 -0
  272. package/src/schemas/examples.ts +24 -0
  273. package/src/schemas/gateway-config.ts +116 -0
  274. package/src/schemas/gateway-error-body.ts +230 -0
  275. package/src/schemas/identity.ts +57 -0
  276. package/src/schemas/names.ts +126 -0
  277. package/src/schemas/ref-update.ts +38 -0
  278. package/src/schemas/sha.ts +20 -0
  279. package/src/schemas/tree-entry.ts +72 -0
  280. package/src/storage/git-remote.ts +58 -0
  281. package/src/storage/storage-backend.ts +65 -0
  282. package/src/storage/storage-errors.ts +24 -0
  283. package/src/storage/storage-input.ts +14 -0
  284. package/src/storage/storage-read.ts +45 -0
  285. package/src/storage/storage-repo-info.ts +46 -0
  286. package/src/storage/storage-tree-entry.ts +20 -0
@@ -0,0 +1,62 @@
1
+ import { FilePath } from "./names.js";
2
+ import { Sha } from "./sha.js";
3
+ import { z } from "zod";
4
+ // src/schemas/tree-entry.ts
5
+ /** The git file mode of a tree entry. */
6
+ const FileMode = z.enum([
7
+ "100644",
8
+ "100755",
9
+ "120000",
10
+ "040000",
11
+ "160000"
12
+ ]).meta({
13
+ id: "FileMode",
14
+ title: "File mode",
15
+ description: "The git mode of a tree entry, as the six-digit octal string git records.",
16
+ enumDescriptions: {
17
+ "100644": "A regular file, not executable.",
18
+ "100755": "A regular file with the executable bit set.",
19
+ "120000": "A symbolic link; the blob holds the link target.",
20
+ "040000": "A directory (a subtree).",
21
+ "160000": "A submodule; the id names a commit in another repository."
22
+ },
23
+ examples: ["100644", "040000"]
24
+ });
25
+ /** The kind of object a tree entry names. */
26
+ const TreeEntryType = z.enum([
27
+ "blob",
28
+ "tree",
29
+ "commit"
30
+ ]).meta({
31
+ id: "TreeEntryType",
32
+ title: "Tree entry type",
33
+ description: "The kind of object a tree entry names.",
34
+ enumDescriptions: {
35
+ blob: "A file or symbolic link (modes 100644, 100755, 120000).",
36
+ tree: "A directory (mode 040000).",
37
+ commit: "A submodule commit in another repository (mode 160000)."
38
+ },
39
+ examples: ["blob", "tree"]
40
+ });
41
+ /** One entry of a directory listing. */
42
+ const TreeEntry = z.object({
43
+ path: FilePath.describe("Full path of the entry from the repository root."),
44
+ name: z.string().min(1).max(255).regex(/^[^/\0]+$/).describe("Last segment of the path: 1–255 characters without \"/\" or NUL."),
45
+ type: TreeEntryType,
46
+ mode: FileMode,
47
+ sha: Sha.describe("Id of the blob, tree or submodule commit the entry names.")
48
+ }).strict().meta({
49
+ id: "TreeEntry",
50
+ title: "Tree entry",
51
+ description: "One entry of a directory listing: a file, directory, symbolic link or submodule.",
52
+ examples: [{
53
+ path: "content/about.md",
54
+ name: "about.md",
55
+ type: "blob",
56
+ mode: "100644",
57
+ sha: "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
58
+ }]
59
+ });
60
+ export { FileMode, TreeEntry, TreeEntryType };
61
+
62
+ //# sourceMappingURL=tree-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-entry.js","names":[],"sources":["../../src/schemas/tree-entry.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\nimport { FilePath } from './names.ts';\nimport { Sha } from './sha.ts';\n\n/** The git file mode of a tree entry. */\nexport const FileMode = z.enum(['100644', '100755', '120000', '040000', '160000']).meta({\n id: 'FileMode',\n title: 'File mode',\n description: 'The git mode of a tree entry, as the six-digit octal string git records.',\n enumDescriptions: {\n '100644': 'A regular file, not executable.',\n '100755': 'A regular file with the executable bit set.',\n '120000': 'A symbolic link; the blob holds the link target.',\n '040000': 'A directory (a subtree).',\n '160000': 'A submodule; the id names a commit in another repository.',\n },\n examples: ['100644', '040000'],\n});\n\n/** A git file mode, inferred from {@link FileMode}. */\nexport type FileMode = z.infer<typeof FileMode>;\n\n/** The kind of object a tree entry names. */\nexport const TreeEntryType = z.enum(['blob', 'tree', 'commit']).meta({\n id: 'TreeEntryType',\n title: 'Tree entry type',\n description: 'The kind of object a tree entry names.',\n enumDescriptions: {\n blob: 'A file or symbolic link (modes 100644, 100755, 120000).',\n tree: 'A directory (mode 040000).',\n commit: 'A submodule commit in another repository (mode 160000).',\n },\n examples: ['blob', 'tree'],\n});\n\n/** A tree entry type, inferred from {@link TreeEntryType}. */\nexport type TreeEntryType = z.infer<typeof TreeEntryType>;\n\n/** One entry of a directory listing. */\nexport const TreeEntry = z\n .object({\n path: FilePath.describe('Full path of the entry from the repository root.'),\n name: z\n .string()\n .min(1)\n .max(255)\n .regex(/^[^/\\0]+$/)\n .describe('Last segment of the path: 1–255 characters without \"/\" or NUL.'),\n type: TreeEntryType,\n mode: FileMode,\n sha: Sha.describe('Id of the blob, tree or submodule commit the entry names.'),\n })\n .strict()\n .meta({\n id: 'TreeEntry',\n title: 'Tree entry',\n description: 'One entry of a directory listing: a file, directory, symbolic link or submodule.',\n examples: [\n {\n path: 'content/about.md',\n name: 'about.md',\n type: 'blob',\n mode: '100644',\n sha: 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391',\n },\n ],\n });\n\n/** A tree entry, inferred from {@link TreeEntry}. */\nexport type TreeEntry = z.infer<typeof TreeEntry>;\n"],"mappings":";;;;;AAOA,MAAa,WAAW,EAAE,KAAK;CAAC;CAAU;CAAU;CAAU;CAAU;AAAQ,CAAC,CAAC,CAAC,KAAK;CACtF,IAAI;CACJ,OAAO;CACP,aAAa;CACb,kBAAkB;EAChB,UAAU;EACV,UAAU;EACV,UAAU;EACV,UAAU;EACV,UAAU;CACZ;CACA,UAAU,CAAC,UAAU,QAAQ;AAC/B,CAAC;;AAMD,MAAa,gBAAgB,EAAE,KAAK;CAAC;CAAQ;CAAQ;AAAQ,CAAC,CAAC,CAAC,KAAK;CACnE,IAAI;CACJ,OAAO;CACP,aAAa;CACb,kBAAkB;EAChB,MAAM;EACN,MAAM;EACN,QAAQ;CACV;CACA,UAAU,CAAC,QAAQ,MAAM;AAC3B,CAAC;;AAMD,MAAa,YAAY,EACtB,OAAO;CACN,MAAM,SAAS,SAAS,kDAAkD;CAC1E,MAAM,EACH,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,IAAI,GAAG,CAAC,CACR,MAAM,WAAW,CAAC,CAClB,SAAS,kEAAgE;CAC5E,MAAM;CACN,MAAM;CACN,KAAK,IAAI,SAAS,2DAA2D;AAC/E,CAAC,CAAC,CACD,OAAO,CAAC,CACR,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACb,UAAU,CACR;EACE,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,KAAK;CACP,CACF;AACF,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ /** What a git remote is minted for. */
3
+ export declare const GitAccess: z.ZodEnum<{
4
+ read: "read";
5
+ write: "write";
6
+ }>;
7
+ /** A git access level, inferred from {@link GitAccess}. */
8
+ export type GitAccess = z.infer<typeof GitAccess>;
9
+ /** Where and how to reach a repository over git smart HTTP on the storage host. */
10
+ export declare const GitRemote: z.ZodObject<{
11
+ url: z.ZodURL;
12
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
13
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
14
+ }, z.core.$strict>;
15
+ /** A storage-host git remote, inferred from {@link GitRemote}. */
16
+ export type GitRemote = z.infer<typeof GitRemote>;
17
+ //# sourceMappingURL=git-remote.d.ts.map
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ // src/storage/git-remote.ts
3
+ /** What a git remote is minted for. */
4
+ const GitAccess = z.enum(["read", "write"]).meta({
5
+ id: "GitAccess",
6
+ title: "Git access",
7
+ description: "What a git remote from StorageBackend.gitRemote() is allowed to do on the storage host.",
8
+ enumDescriptions: {
9
+ read: "Fetch and clone only (git-upload-pack).",
10
+ write: "Fetch, clone and push (git-upload-pack and git-receive-pack)."
11
+ },
12
+ examples: ["read", "write"]
13
+ });
14
+ /** Where and how to reach a repository over git smart HTTP on the storage host. */
15
+ const GitRemote = z.object({
16
+ url: z.url({ protocol: /^https?$/ }).describe("The repository's smart-HTTP base URL on the storage host, ending in \".git\"; append \"/info/refs?service=…\", \"/git-upload-pack\" or \"/git-receive-pack\". Never holds a credential."),
17
+ headers: z.record(z.string().min(1).describe("HTTP header name, e.g. \"Authorization\"."), z.string().describe("HTTP header value. Secret when it carries a credential.")).describe("HTTP headers every request to the remote must carry, typically the short-lived credential as \"Authorization\". Secret: never log it or hand it to a git client."),
18
+ expiresAt: z.iso.datetime().nullable().describe("When the credential in `headers` stops working, as an ISO 8601 UTC timestamp; null when the host does not say (for example a long-lived access token).")
19
+ }).strict().meta({
20
+ id: "GitRemote",
21
+ title: "Git remote",
22
+ description: "A storage-host git remote minted for one use: the smart-HTTP URL plus the headers that authorize it. The gateway proxies to it; the credential never reaches a git client.",
23
+ examples: [{
24
+ url: "https://artifacts.example.com/git/default/acme-raw-content.git",
25
+ headers: { Authorization: "Bearer art_v2_example" },
26
+ expiresAt: "2026-11-20T09:35:00.000Z"
27
+ }]
28
+ });
29
+ export { GitAccess, GitRemote };
30
+
31
+ //# sourceMappingURL=git-remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-remote.js","names":[],"sources":["../../src/storage/git-remote.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\n/** What a git remote is minted for. */\nexport const GitAccess = z.enum(['read', 'write']).meta({\n id: 'GitAccess',\n title: 'Git access',\n description: 'What a git remote from StorageBackend.gitRemote() is allowed to do on the storage host.',\n enumDescriptions: {\n read: 'Fetch and clone only (git-upload-pack).',\n write: 'Fetch, clone and push (git-upload-pack and git-receive-pack).',\n },\n examples: ['read', 'write'],\n});\n\n/** A git access level, inferred from {@link GitAccess}. */\nexport type GitAccess = z.infer<typeof GitAccess>;\n\n/** Where and how to reach a repository over git smart HTTP on the storage host. */\nexport const GitRemote = z\n .object({\n url: z\n .url({ protocol: /^https?$/ })\n .describe(\n 'The repository\\'s smart-HTTP base URL on the storage host, ending in \".git\"; append \"/info/refs?service=…\", \"/git-upload-pack\" or \"/git-receive-pack\". Never holds a credential.',\n ),\n headers: z\n .record(\n z.string().min(1).describe('HTTP header name, e.g. \"Authorization\".'),\n z.string().describe('HTTP header value. Secret when it carries a credential.'),\n )\n .describe(\n 'HTTP headers every request to the remote must carry, typically the short-lived credential as \"Authorization\". Secret: never log it or hand it to a git client.',\n ),\n expiresAt: z.iso\n .datetime()\n .nullable()\n .describe(\n 'When the credential in `headers` stops working, as an ISO 8601 UTC timestamp; null when the host does not say (for example a long-lived access token).',\n ),\n })\n .strict()\n .meta({\n id: 'GitRemote',\n title: 'Git remote',\n description:\n 'A storage-host git remote minted for one use: the smart-HTTP URL plus the headers that authorize it. The gateway proxies to it; the credential never reaches a git client.',\n examples: [\n {\n url: 'https://artifacts.example.com/git/default/acme-raw-content.git',\n headers: { Authorization: 'Bearer art_v2_example' },\n expiresAt: '2026-11-20T09:35:00.000Z',\n },\n ],\n });\n\n/** A storage-host git remote, inferred from {@link GitRemote}. */\nexport type GitRemote = z.infer<typeof GitRemote>;\n"],"mappings":";;;AAIA,MAAa,YAAY,EAAE,KAAK,CAAC,QAAQ,OAAO,CAAC,CAAC,CAAC,KAAK;CACtD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,kBAAkB;EAChB,MAAM;EACN,OAAO;CACT;CACA,UAAU,CAAC,QAAQ,OAAO;AAC5B,CAAC;;AAMD,MAAa,YAAY,EACtB,OAAO;CACN,KAAK,EACF,IAAI,EAAE,UAAU,WAAW,CAAC,CAAC,CAC7B,SACC,yLACF;CACF,SAAS,EACN,OACC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,2CAAyC,GACpE,EAAE,OAAO,CAAC,CAAC,SAAS,yDAAyD,CAC/E,CAAC,CACA,SACC,kKACF;CACF,WAAW,EAAE,IACV,SAAS,CAAC,CACV,SAAS,CAAC,CACV,SACC,wJACF;AACJ,CAAC,CAAC,CACD,OAAO,CAAC,CACR,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CACR;EACE,KAAK;EACL,SAAS,EAAE,eAAe,wBAAwB;EAClD,WAAW;CACb,CACF;AACF,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { t as Commit } from "../commit-BEZmeAOl.js";
2
+ import { FilePath, RepoName, Revision } from "../schemas/names.js";
3
+ import { Sha } from "../schemas/sha.js";
4
+ import { GitAccess, GitRemote } from "./git-remote.js";
5
+ import { StorageLogOptions, StorageRef } from "./storage-read.js";
6
+ import { CreateStorageRepoOptions, StorageRepoInfo } from "./storage-repo-info.js";
7
+ import { StorageTreeEntry } from "./storage-tree-entry.js";
8
+ /**
9
+ * Where repositories are stored: Cloudflare Artifacts, GitLab, an in-memory test double. A
10
+ * backend provides only what every git host provides — repository lifecycle, reads by id and by
11
+ * ref, and a git smart-HTTP remote. Every write is a git-receive-pack push to that remote; a
12
+ * backend never needs a commits or refs API.
13
+ *
14
+ * Conventions every implementation follows (the backend contract suite in
15
+ * `@leed-ai/git-gateway-testkit` pins them):
16
+ *
17
+ * - Inputs are validated with the contract schemas; a bad value throws an `invalid_input`
18
+ * GatewayError before the host is called.
19
+ * - Every call on a repository that does not exist throws `repo_not_found`, except
20
+ * {@link repoInfo} (null) and {@link deleteRepo} (no-op).
21
+ * - A missing object, ref or path is `null` (an empty array for {@link log}), never an error.
22
+ * - A host failure throws `storage_unavailable`. Everything the host returns is parsed with Zod
23
+ * before it is handed back.
24
+ */
25
+ export interface StorageBackend {
26
+ /** Creates an empty repository. Throws `repo_exists` when the name is taken. */
27
+ createRepo(name: RepoName, options?: CreateStorageRepoOptions): Promise<StorageRepoInfo>;
28
+ /** Deletes a repository with all its refs and objects; deleting a missing one does nothing. */
29
+ deleteRepo(name: RepoName): Promise<void>;
30
+ /** The repository's description, or null when it does not exist. */
31
+ repoInfo(name: RepoName): Promise<StorageRepoInfo | null>;
32
+ /** The commit a ref names, or null when the ref does not exist (always null in an empty repository). */
33
+ resolveRef(repo: RepoName, ref: StorageRef): Promise<Sha | null>;
34
+ /** A commit by id, or null when no commit has that id. */
35
+ readCommit(repo: RepoName, sha: Sha): Promise<Commit | null>;
36
+ /** One level of a tree by id, in stored order, or null when no tree has that id. */
37
+ readTree(repo: RepoName, sha: Sha): Promise<StorageTreeEntry[] | null>;
38
+ /** A blob's bytes by id, or null when no blob has that id. */
39
+ readBlob(repo: RepoName, sha: Sha): Promise<Uint8Array | null>;
40
+ /** A file's bytes at a revision, or null when the revision or the file does not exist. */
41
+ readFile(repo: RepoName, ref: Revision, path: FilePath): Promise<Uint8Array | null>;
42
+ /** The first-parent chain from a revision, newest first; empty when the revision does not exist. */
43
+ log(repo: RepoName, ref: Revision, options: StorageLogOptions): Promise<Commit[]>;
44
+ /**
45
+ * Optional capability: whether `ancestor` is `descendant` itself or one of its ancestors, as
46
+ * `git merge-base --is-ancestor` answers it, or null when either commit is not in the
47
+ * repository. A backend implements it only when its host can answer in one or a few calls (a
48
+ * merge-base API, say); the gateway then proves fast-forwards with it instead of walking
49
+ * history one {@link readCommit} at a time, and falls back to that walk when it is absent.
50
+ * Follows the same conventions as the reads: invalid ids are `invalid_input`, a missing
51
+ * repository `repo_not_found`, a host failure `storage_unavailable`.
52
+ */
53
+ isAncestor?(repo: RepoName, ancestor: Sha, descendant: Sha): Promise<boolean | null>;
54
+ /**
55
+ * A freshly minted smart-HTTP remote for the repository: URL plus the headers that authorize
56
+ * `access`. The credential is short-lived where the host allows it and must never reach a
57
+ * git client.
58
+ */
59
+ gitRemote(repo: RepoName, access: GitAccess): Promise<GitRemote>;
60
+ }
61
+ //# sourceMappingURL=storage-backend.d.ts.map
File without changes
@@ -0,0 +1,12 @@
1
+ import { GatewayError } from "../gateway-error.js";
2
+ /** The repo_not_found error a backend throws for a call on a missing repository. */
3
+ export declare function repoNotFound(repo: string): GatewayError;
4
+ /** The repo_exists error a backend throws when createRepo names a taken repository. */
5
+ export declare function repoExists(repo: string): GatewayError;
6
+ /**
7
+ * The storage_unavailable error a backend throws when its host fails or answers with something
8
+ * the contract cannot represent. `cause` is summarised in the message; callers pass host errors,
9
+ * never credentials.
10
+ */
11
+ export declare function storageUnavailable(what: string, cause: unknown): GatewayError;
12
+ //# sourceMappingURL=storage-errors.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { gatewayError } from "../gateway-error.js";
2
+ // src/storage/storage-errors.ts
3
+ /** The repo_not_found error a backend throws for a call on a missing repository. */
4
+ function repoNotFound(repo) {
5
+ return gatewayError("repo_not_found", `Repository not found: ${repo}`, { repo });
6
+ }
7
+ /** The repo_exists error a backend throws when createRepo names a taken repository. */
8
+ function repoExists(repo) {
9
+ return gatewayError("repo_exists", `Repository already exists: ${repo}`, { repo });
10
+ }
11
+ /**
12
+ * The storage_unavailable error a backend throws when its host fails or answers with something
13
+ * the contract cannot represent. `cause` is summarised in the message; callers pass host errors,
14
+ * never credentials.
15
+ */
16
+ function storageUnavailable(what, cause) {
17
+ const reason = cause instanceof Error ? cause.message : String(cause);
18
+ return gatewayError("storage_unavailable", `Storage backend failed: ${what}: ${reason}`, { retryable: true });
19
+ }
20
+ export { repoExists, repoNotFound, storageUnavailable };
21
+
22
+ //# sourceMappingURL=storage-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-errors.js","names":[],"sources":["../../src/storage/storage-errors.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { gatewayError, type GatewayError } from '../gateway-error.ts';\n\n/** The repo_not_found error a backend throws for a call on a missing repository. */\nexport function repoNotFound(repo: string): GatewayError {\n return gatewayError('repo_not_found', `Repository not found: ${repo}`, { repo });\n}\n\n/** The repo_exists error a backend throws when createRepo names a taken repository. */\nexport function repoExists(repo: string): GatewayError {\n return gatewayError('repo_exists', `Repository already exists: ${repo}`, { repo });\n}\n\n/**\n * The storage_unavailable error a backend throws when its host fails or answers with something\n * the contract cannot represent. `cause` is summarised in the message; callers pass host errors,\n * never credentials.\n */\nexport function storageUnavailable(what: string, cause: unknown): GatewayError {\n const reason = cause instanceof Error ? cause.message : String(cause);\n return gatewayError('storage_unavailable', `Storage backend failed: ${what}: ${reason}`, {\n retryable: true,\n });\n}\n"],"mappings":";;;AAIA,SAAgB,aAAa,MAA4B;CACvD,OAAO,aAAa,kBAAkB,yBAAyB,QAAQ,EAAE,KAAK,CAAC;AACjF;;AAGA,SAAgB,WAAW,MAA4B;CACrD,OAAO,aAAa,eAAe,8BAA8B,QAAQ,EAAE,KAAK,CAAC;AACnF;;;;;;AAOA,SAAgB,mBAAmB,MAAc,OAA8B;CAC7E,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACpE,OAAO,aAAa,uBAAuB,2BAA2B,KAAK,IAAI,UAAU,EACvF,WAAW,KACb,CAAC;AACH"}
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Parses one argument of a {@link StorageBackend} call with its contract schema, throwing an
4
+ * invalid_input GatewayError (never a ZodError) when it does not match.
5
+ */
6
+ export declare function parseStorageInput<S extends z.ZodType>(schema: S, value: unknown): z.output<S>;
7
+ //# sourceMappingURL=storage-input.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { invalidInput } from "../gateway-error.js";
2
+ // src/storage/storage-input.ts
3
+ /**
4
+ * Parses one argument of a {@link StorageBackend} call with its contract schema, throwing an
5
+ * invalid_input GatewayError (never a ZodError) when it does not match.
6
+ */
7
+ function parseStorageInput(schema, value) {
8
+ const parsed = schema.safeParse(value);
9
+ if (!parsed.success) throw invalidInput(parsed.error);
10
+ return parsed.data;
11
+ }
12
+ export { parseStorageInput };
13
+
14
+ //# sourceMappingURL=storage-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-input.js","names":[],"sources":["../../src/storage/storage-input.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport type { z } from 'zod';\n\nimport { invalidInput } from '../gateway-error.ts';\n\n/**\n * Parses one argument of a {@link StorageBackend} call with its contract schema, throwing an\n * invalid_input GatewayError (never a ZodError) when it does not match.\n */\nexport function parseStorageInput<S extends z.ZodType>(schema: S, value: unknown): z.output<S> {\n const parsed = schema.safeParse(value);\n if (!parsed.success) throw invalidInput(parsed.error);\n return parsed.data;\n}\n"],"mappings":";;;;;;AASA,SAAgB,kBAAuC,QAAW,OAA6B;CAC7F,MAAM,SAAS,OAAO,UAAU,KAAK;CACrC,IAAI,CAAC,OAAO,SAAS,MAAM,aAAa,OAAO,KAAK;CACpD,OAAO,OAAO;AAChB"}
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ /** A ref a storage backend resolves. */
3
+ export declare const StorageRef: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
4
+ /** A ref a backend resolves, inferred from {@link StorageRef}. */
5
+ export type StorageRef = z.infer<typeof StorageRef>;
6
+ /** Paging of `StorageBackend.log`. */
7
+ export declare const StorageLogOptions: z.ZodObject<{
8
+ limit: z.ZodInt;
9
+ offset: z.ZodDefault<z.ZodInt>;
10
+ }, z.core.$strict>;
11
+ /** Paging of `log` as accepted (defaults optional). */
12
+ export type StorageLogOptions = z.input<typeof StorageLogOptions>;
13
+ //# sourceMappingURL=storage-read.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { BranchName, FullRefName } from "../schemas/names.js";
2
+ import { z } from "zod";
3
+ // src/storage/storage-read.ts
4
+ /** A ref a storage backend resolves. */
5
+ const StorageRef = z.union([FullRefName.describe("A fully qualified ref, \"refs/heads/<branch>\" or \"refs/tags/<tag>\", resolved exactly."), BranchName.describe("A short branch name, resolved as \"refs/heads/<name>\".")]).meta({
6
+ id: "StorageRef",
7
+ title: "Storage ref",
8
+ description: "A ref StorageBackend.resolveRef() resolves: a fully qualified \"refs/heads/…\" or \"refs/tags/…\" ref, or a short branch name meaning \"refs/heads/<name>\".",
9
+ examples: [
10
+ "main",
11
+ "refs/heads/staging",
12
+ "refs/tags/v1.0.0"
13
+ ]
14
+ });
15
+ /** Paging of `StorageBackend.log`. */
16
+ const StorageLogOptions = z.object({
17
+ limit: z.int().min(1).max(1e3).describe("Most commits returned: 1–1000. Fewer come back when the history is shorter."),
18
+ offset: z.int().min(0).default(0).describe("Commits skipped from the newest before listing. Default 0.")
19
+ }).strict().meta({
20
+ id: "StorageLogOptions",
21
+ title: "Storage log options",
22
+ description: "Paging of StorageBackend.log(), which lists the first-parent chain from a revision, newest first: skip `offset` commits, then return up to `limit`.",
23
+ examples: [{
24
+ limit: 50,
25
+ offset: 0
26
+ }]
27
+ });
28
+ export { StorageLogOptions, StorageRef };
29
+
30
+ //# sourceMappingURL=storage-read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-read.js","names":[],"sources":["../../src/storage/storage-read.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\nimport { BranchName, FullRefName } from '../schemas/names.ts';\n\n/** A ref a storage backend resolves. */\nexport const StorageRef = z\n .union([\n FullRefName.describe(\n 'A fully qualified ref, \"refs/heads/<branch>\" or \"refs/tags/<tag>\", resolved exactly.',\n ),\n BranchName.describe('A short branch name, resolved as \"refs/heads/<name>\".'),\n ])\n .meta({\n id: 'StorageRef',\n title: 'Storage ref',\n description:\n 'A ref StorageBackend.resolveRef() resolves: a fully qualified \"refs/heads/…\" or \"refs/tags/…\" ref, or a short branch name meaning \"refs/heads/<name>\".',\n examples: ['main', 'refs/heads/staging', 'refs/tags/v1.0.0'],\n });\n\n/** A ref a backend resolves, inferred from {@link StorageRef}. */\nexport type StorageRef = z.infer<typeof StorageRef>;\n\n/** Paging of `StorageBackend.log`. */\nexport const StorageLogOptions = z\n .object({\n limit: z\n .int()\n .min(1)\n .max(1000)\n .describe('Most commits returned: 1–1000. Fewer come back when the history is shorter.'),\n offset: z.int().min(0).default(0).describe('Commits skipped from the newest before listing. Default 0.'),\n })\n .strict()\n .meta({\n id: 'StorageLogOptions',\n title: 'Storage log options',\n description:\n 'Paging of StorageBackend.log(), which lists the first-parent chain from a revision, newest first: skip `offset` commits, then return up to `limit`.',\n examples: [{ limit: 50, offset: 0 }],\n });\n\n/** Paging of `log` as accepted (defaults optional). */\nexport type StorageLogOptions = z.input<typeof StorageLogOptions>;\n"],"mappings":";;;;AAMA,MAAa,aAAa,EACvB,MAAM,CACL,YAAY,SACV,0FACF,GACA,WAAW,SAAS,yDAAuD,CAC7E,CAAC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU;EAAC;EAAQ;EAAsB;CAAkB;AAC7D,CAAC;;AAMH,MAAa,oBAAoB,EAC9B,OAAO;CACN,OAAO,EACJ,IAAI,CAAC,CACL,IAAI,CAAC,CAAC,CACN,IAAI,GAAI,CAAC,CACT,SAAS,6EAA6E;CACzF,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,4DAA4D;AACzG,CAAC,CAAC,CACD,OAAO,CAAC,CACR,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CAAC;EAAE,OAAO;EAAI,QAAQ;CAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ /** Options of `StorageBackend.createRepo`. */
3
+ export declare const CreateStorageRepoOptions: z.ZodObject<{
4
+ defaultBranch: z.ZodDefault<z.ZodString>;
5
+ }, z.core.$strict>;
6
+ /** Options of `StorageBackend.createRepo` as accepted (defaults optional). */
7
+ export type CreateStorageRepoOptions = z.input<typeof CreateStorageRepoOptions>;
8
+ /** A repository as the storage host describes it. */
9
+ export declare const StorageRepoInfo: z.ZodObject<{
10
+ name: z.ZodString;
11
+ defaultBranch: z.ZodString;
12
+ createdAt: z.ZodNullable<z.ZodISODateTime>;
13
+ }, z.core.$strict>;
14
+ /** A repository on the storage host, inferred from {@link StorageRepoInfo}. */
15
+ export type StorageRepoInfo = z.infer<typeof StorageRepoInfo>;
16
+ //# sourceMappingURL=storage-repo-info.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { EXAMPLE_TIMESTAMP } from "../schemas/examples.js";
2
+ import { Timestamp } from "../schemas/identity.js";
3
+ import { BranchName, RepoName } from "../schemas/names.js";
4
+ import { z } from "zod";
5
+ // src/storage/storage-repo-info.ts
6
+ /** Options of `StorageBackend.createRepo`. */
7
+ const CreateStorageRepoOptions = z.object({ defaultBranch: BranchName.default("main").describe("Branch the new repository's HEAD names. It holds no commits until the first push to it. Default \"main\".") }).strict().meta({
8
+ id: "CreateStorageRepoOptions",
9
+ title: "Storage createRepo options",
10
+ description: "Options of StorageBackend.createRepo(): how the empty repository is set up on the storage host.",
11
+ examples: [{ defaultBranch: "main" }]
12
+ });
13
+ /** A repository as the storage host describes it. */
14
+ const StorageRepoInfo = z.object({
15
+ name: RepoName.describe("The repository name, the same name the gateway serves it under."),
16
+ defaultBranch: BranchName.describe("The branch the repository's HEAD names on the storage host."),
17
+ createdAt: Timestamp.nullable().describe("When the storage host created the repository, as an ISO 8601 UTC timestamp; null when the host does not report it.")
18
+ }).strict().meta({
19
+ id: "StorageRepoInfo",
20
+ title: "Storage repository",
21
+ description: "A repository as a StorageBackend reports it: name, default branch and creation time. Carries no host URL or credential; those come only from gitRemote().",
22
+ examples: [{
23
+ name: "acme-raw-content",
24
+ defaultBranch: "main",
25
+ createdAt: EXAMPLE_TIMESTAMP
26
+ }]
27
+ });
28
+ export { CreateStorageRepoOptions, StorageRepoInfo };
29
+
30
+ //# sourceMappingURL=storage-repo-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-repo-info.js","names":[],"sources":["../../src/storage/storage-repo-info.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\nimport { EXAMPLE_TIMESTAMP } from '../schemas/examples.ts';\nimport { Timestamp } from '../schemas/identity.ts';\nimport { BranchName, RepoName } from '../schemas/names.ts';\n\n/** Options of `StorageBackend.createRepo`. */\nexport const CreateStorageRepoOptions = z\n .object({\n defaultBranch: BranchName.default('main').describe(\n 'Branch the new repository\\'s HEAD names. It holds no commits until the first push to it. Default \"main\".',\n ),\n })\n .strict()\n .meta({\n id: 'CreateStorageRepoOptions',\n title: 'Storage createRepo options',\n description:\n 'Options of StorageBackend.createRepo(): how the empty repository is set up on the storage host.',\n examples: [{ defaultBranch: 'main' }],\n });\n\n/** Options of `StorageBackend.createRepo` as accepted (defaults optional). */\nexport type CreateStorageRepoOptions = z.input<typeof CreateStorageRepoOptions>;\n\n/** A repository as the storage host describes it. */\nexport const StorageRepoInfo = z\n .object({\n name: RepoName.describe('The repository name, the same name the gateway serves it under.'),\n defaultBranch: BranchName.describe(\"The branch the repository's HEAD names on the storage host.\"),\n createdAt: Timestamp.nullable().describe(\n 'When the storage host created the repository, as an ISO 8601 UTC timestamp; null when the host does not report it.',\n ),\n })\n .strict()\n .meta({\n id: 'StorageRepoInfo',\n title: 'Storage repository',\n description:\n 'A repository as a StorageBackend reports it: name, default branch and creation time. Carries no host URL or credential; those come only from gitRemote().',\n examples: [{ name: 'acme-raw-content', defaultBranch: 'main', createdAt: EXAMPLE_TIMESTAMP }],\n });\n\n/** A repository on the storage host, inferred from {@link StorageRepoInfo}. */\nexport type StorageRepoInfo = z.infer<typeof StorageRepoInfo>;\n"],"mappings":";;;;;;AAQA,MAAa,2BAA2B,EACrC,OAAO,EACN,eAAe,WAAW,QAAQ,MAAM,CAAC,CAAC,SACxC,2GACF,EACF,CAAC,CAAC,CACD,OAAO,CAAC,CACR,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CAAC,EAAE,eAAe,OAAO,CAAC;AACtC,CAAC;;AAMH,MAAa,kBAAkB,EAC5B,OAAO;CACN,MAAM,SAAS,SAAS,iEAAiE;CACzF,eAAe,WAAW,SAAS,6DAA6D;CAChG,WAAW,UAAU,SAAS,CAAC,CAAC,SAC9B,oHACF;AACF,CAAC,CAAC,CACD,OAAO,CAAC,CACR,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CAAC;EAAE,MAAM;EAAoB,eAAe;EAAQ,WAAW;CAAkB,CAAC;AAC9F,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ /** One entry of a tree object read by id. */
3
+ export declare const StorageTreeEntry: z.ZodObject<{
4
+ name: z.ZodString;
5
+ type: z.ZodEnum<{
6
+ blob: "blob";
7
+ commit: "commit";
8
+ tree: "tree";
9
+ }>;
10
+ mode: z.ZodEnum<{
11
+ "040000": "040000";
12
+ 100644: "100644";
13
+ 100755: "100755";
14
+ 120000: "120000";
15
+ 160000: "160000";
16
+ }>;
17
+ sha: z.ZodString;
18
+ }, z.core.$strict>;
19
+ /** A tree entry read by tree id, inferred from {@link StorageTreeEntry}. */
20
+ export type StorageTreeEntry = z.infer<typeof StorageTreeEntry>;
21
+ //# sourceMappingURL=storage-tree-entry.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { TreeEntry } from "../schemas/tree-entry.js";
2
+ // src/storage/storage-tree-entry.ts
3
+ /** One entry of a tree object read by id. */
4
+ const StorageTreeEntry = TreeEntry.omit({ path: true }).strict().meta({
5
+ id: "StorageTreeEntry",
6
+ title: "Storage tree entry",
7
+ description: "One entry of a git tree object read by its id through StorageBackend.readTree(): the name within that tree, the kind of object, its mode and its id. A contract TreeEntry without the path, which a tree read by id cannot know. Entries come back in the order git stores them.",
8
+ examples: [{
9
+ name: "about.md",
10
+ type: "blob",
11
+ mode: "100644",
12
+ sha: "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
13
+ }]
14
+ });
15
+ export { StorageTreeEntry };
16
+
17
+ //# sourceMappingURL=storage-tree-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-tree-entry.js","names":[],"sources":["../../src/storage/storage-tree-entry.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport type { z } from 'zod';\n\nimport { TreeEntry } from '../schemas/tree-entry.ts';\n\n/** One entry of a tree object read by id. */\nexport const StorageTreeEntry = TreeEntry.omit({ path: true })\n .strict()\n .meta({\n id: 'StorageTreeEntry',\n title: 'Storage tree entry',\n description:\n 'One entry of a git tree object read by its id through StorageBackend.readTree(): the name within that tree, the kind of object, its mode and its id. A contract TreeEntry without the path, which a tree read by id cannot know. Entries come back in the order git stores them.',\n examples: [\n { name: 'about.md', type: 'blob', mode: '100644', sha: 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391' },\n ],\n });\n\n/** A tree entry read by tree id, inferred from {@link StorageTreeEntry}. */\nexport type StorageTreeEntry = z.infer<typeof StorageTreeEntry>;\n"],"mappings":";;;AAMA,MAAa,mBAAmB,UAAU,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC,CAC3D,OAAO,CAAC,CACR,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CACR;EAAE,MAAM;EAAY,MAAM;EAAQ,MAAM;EAAU,KAAK;CAA2C,CACpG;AACF,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ /** The git file mode of a tree entry. */
3
+ declare const FileMode: z.ZodEnum<{
4
+ "040000": "040000";
5
+ 100644: "100644";
6
+ 100755: "100755";
7
+ 120000: "120000";
8
+ 160000: "160000";
9
+ }>;
10
+ /** A git file mode, inferred from {@link FileMode}. */
11
+ type FileMode = z.infer<typeof FileMode>;
12
+ /** The kind of object a tree entry names. */
13
+ declare const TreeEntryType: z.ZodEnum<{
14
+ blob: "blob";
15
+ commit: "commit";
16
+ tree: "tree";
17
+ }>;
18
+ /** A tree entry type, inferred from {@link TreeEntryType}. */
19
+ type TreeEntryType = z.infer<typeof TreeEntryType>;
20
+ /** One entry of a directory listing. */
21
+ declare const TreeEntry: z.ZodObject<{
22
+ path: z.ZodString;
23
+ name: z.ZodString;
24
+ type: z.ZodEnum<{
25
+ blob: "blob";
26
+ commit: "commit";
27
+ tree: "tree";
28
+ }>;
29
+ mode: z.ZodEnum<{
30
+ "040000": "040000";
31
+ 100644: "100644";
32
+ 100755: "100755";
33
+ 120000: "120000";
34
+ 160000: "160000";
35
+ }>;
36
+ sha: z.ZodString;
37
+ }, z.core.$strict>;
38
+ /** A tree entry, inferred from {@link TreeEntry}. */
39
+ type TreeEntry = z.infer<typeof TreeEntry>;
40
+ export { TreeEntry as n, TreeEntryType as r, FileMode as t };
41
+ //# sourceMappingURL=tree-entry-BM_1gou1.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { n as TreeEntry } from "./tree-entry-BM_1gou1.js";
2
+ import { t as FileMap } from "./file-map-CxUveLWz.js";
3
+ /** Every directory of a snapshot with its entries, and the root tree id. */
4
+ interface TreeIndex {
5
+ readonly rootSha: string;
6
+ /** Directory path ('' for the root) → its direct entries, sorted by path in byte order. */
7
+ readonly directories: ReadonlyMap<string, readonly TreeEntry[]>;
8
+ }
9
+ /** Builds the directory index of a snapshot, computing each tree id from its entries bottom-up. */
10
+ declare function buildTreeIndex(files: FileMap): Promise<TreeIndex>;
11
+ /** Every entry beneath a directory ('' for the root), sorted by full path in byte order. */
12
+ declare function entriesBeneath(index: TreeIndex, dir: string, recursive: boolean): TreeEntry[];
13
+ export { buildTreeIndex as n, entriesBeneath as r, TreeIndex as t };
14
+ //# sourceMappingURL=tree-index-Bk721Phv.d.ts.map