@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,214 @@
1
+ import { z } from "zod";
2
+ /** The input failed schema validation. */
3
+ declare const InvalidInputError: z.ZodObject<{
4
+ code: z.ZodLiteral<"invalid_input">;
5
+ message: z.ZodString;
6
+ details: z.ZodObject<{
7
+ issues: z.ZodArray<z.ZodObject<{
8
+ path: z.ZodString;
9
+ message: z.ZodString;
10
+ }, z.core.$strict>>;
11
+ }, z.core.$strict>;
12
+ }, z.core.$strict>;
13
+ /** The named repository does not exist. */
14
+ declare const RepoNotFoundError: z.ZodObject<{
15
+ code: z.ZodLiteral<"repo_not_found">;
16
+ message: z.ZodString;
17
+ details: z.ZodObject<{
18
+ repo: z.ZodString;
19
+ }, z.core.$strict>;
20
+ }, z.core.$strict>;
21
+ /** A repository with that name already exists. */
22
+ declare const RepoExistsError: z.ZodObject<{
23
+ code: z.ZodLiteral<"repo_exists">;
24
+ message: z.ZodString;
25
+ details: z.ZodObject<{
26
+ repo: z.ZodString;
27
+ }, z.core.$strict>;
28
+ }, z.core.$strict>;
29
+ /** The named branch or commit does not exist. */
30
+ declare const RefNotFoundError: z.ZodObject<{
31
+ code: z.ZodLiteral<"ref_not_found">;
32
+ message: z.ZodString;
33
+ details: z.ZodObject<{
34
+ ref: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
35
+ }, z.core.$strict>;
36
+ }, z.core.$strict>;
37
+ /** A create or move target already exists. */
38
+ declare const PathExistsError: z.ZodObject<{
39
+ code: z.ZodLiteral<"path_exists">;
40
+ message: z.ZodString;
41
+ details: z.ZodObject<{
42
+ path: z.ZodString;
43
+ }, z.core.$strict>;
44
+ }, z.core.$strict>;
45
+ /** An action needed a file that does not exist. */
46
+ declare const PathNotFoundError: z.ZodObject<{
47
+ code: z.ZodLiteral<"path_not_found">;
48
+ message: z.ZodString;
49
+ details: z.ZodObject<{
50
+ path: z.ZodString;
51
+ }, z.core.$strict>;
52
+ }, z.core.$strict>;
53
+ /** A parent of the target path is a file. */
54
+ declare const PathConflictError: z.ZodObject<{
55
+ code: z.ZodLiteral<"path_conflict">;
56
+ message: z.ZodString;
57
+ details: z.ZodObject<{
58
+ path: z.ZodString;
59
+ conflictingPath: z.ZodString;
60
+ }, z.core.$strict>;
61
+ }, z.core.$strict>;
62
+ /** The branch head is not the head the caller expected. */
63
+ declare const StaleHeadError: z.ZodObject<{
64
+ code: z.ZodLiteral<"stale_head">;
65
+ message: z.ZodString;
66
+ details: z.ZodObject<{
67
+ branch: z.ZodString;
68
+ expectedHead: z.ZodNullable<z.ZodString>;
69
+ actualHead: z.ZodNullable<z.ZodString>;
70
+ }, z.core.$strict>;
71
+ }, z.core.$strict>;
72
+ /** promote named a commit that is not the head of the source branch. */
73
+ declare const NotHeadOfSourceError: z.ZodObject<{
74
+ code: z.ZodLiteral<"not_head_of_source">;
75
+ message: z.ZodString;
76
+ details: z.ZodObject<{
77
+ from: z.ZodString;
78
+ sha: z.ZodString;
79
+ head: z.ZodString;
80
+ }, z.core.$strict>;
81
+ }, z.core.$strict>;
82
+ /** promote would not be a fast-forward. */
83
+ declare const NotFastForwardError: z.ZodObject<{
84
+ code: z.ZodLiteral<"not_fast_forward">;
85
+ message: z.ZodString;
86
+ details: z.ZodObject<{
87
+ into: z.ZodString;
88
+ sha: z.ZodString;
89
+ head: z.ZodString;
90
+ }, z.core.$strict>;
91
+ }, z.core.$strict>;
92
+ /** syncBranch found no common ancestor. */
93
+ declare const UnrelatedHistoriesError: z.ZodObject<{
94
+ code: z.ZodLiteral<"unrelated_histories">;
95
+ message: z.ZodString;
96
+ details: z.ZodObject<{
97
+ from: z.ZodString;
98
+ into: z.ZodString;
99
+ }, z.core.$strict>;
100
+ }, z.core.$strict>;
101
+ /** The storage backend failed. */
102
+ declare const StorageUnavailableError: z.ZodObject<{
103
+ code: z.ZodLiteral<"storage_unavailable">;
104
+ message: z.ZodString;
105
+ details: z.ZodObject<{
106
+ retryable: z.ZodLiteral<true>;
107
+ }, z.core.$strict>;
108
+ }, z.core.$strict>;
109
+ /** Every error a gateway call can report, discriminated by `code`. */
110
+ declare const GatewayErrorBody: z.ZodDiscriminatedUnion<[z.ZodObject<{
111
+ code: z.ZodLiteral<"invalid_input">;
112
+ message: z.ZodString;
113
+ details: z.ZodObject<{
114
+ issues: z.ZodArray<z.ZodObject<{
115
+ path: z.ZodString;
116
+ message: z.ZodString;
117
+ }, z.core.$strict>>;
118
+ }, z.core.$strict>;
119
+ }, z.core.$strict>, z.ZodObject<{
120
+ code: z.ZodLiteral<"repo_not_found">;
121
+ message: z.ZodString;
122
+ details: z.ZodObject<{
123
+ repo: z.ZodString;
124
+ }, z.core.$strict>;
125
+ }, z.core.$strict>, z.ZodObject<{
126
+ code: z.ZodLiteral<"repo_exists">;
127
+ message: z.ZodString;
128
+ details: z.ZodObject<{
129
+ repo: z.ZodString;
130
+ }, z.core.$strict>;
131
+ }, z.core.$strict>, z.ZodObject<{
132
+ code: z.ZodLiteral<"ref_not_found">;
133
+ message: z.ZodString;
134
+ details: z.ZodObject<{
135
+ ref: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
136
+ }, z.core.$strict>;
137
+ }, z.core.$strict>, z.ZodObject<{
138
+ code: z.ZodLiteral<"path_exists">;
139
+ message: z.ZodString;
140
+ details: z.ZodObject<{
141
+ path: z.ZodString;
142
+ }, z.core.$strict>;
143
+ }, z.core.$strict>, z.ZodObject<{
144
+ code: z.ZodLiteral<"path_not_found">;
145
+ message: z.ZodString;
146
+ details: z.ZodObject<{
147
+ path: z.ZodString;
148
+ }, z.core.$strict>;
149
+ }, z.core.$strict>, z.ZodObject<{
150
+ code: z.ZodLiteral<"path_conflict">;
151
+ message: z.ZodString;
152
+ details: z.ZodObject<{
153
+ path: z.ZodString;
154
+ conflictingPath: z.ZodString;
155
+ }, z.core.$strict>;
156
+ }, z.core.$strict>, z.ZodObject<{
157
+ code: z.ZodLiteral<"stale_head">;
158
+ message: z.ZodString;
159
+ details: z.ZodObject<{
160
+ branch: z.ZodString;
161
+ expectedHead: z.ZodNullable<z.ZodString>;
162
+ actualHead: z.ZodNullable<z.ZodString>;
163
+ }, z.core.$strict>;
164
+ }, z.core.$strict>, z.ZodObject<{
165
+ code: z.ZodLiteral<"not_head_of_source">;
166
+ message: z.ZodString;
167
+ details: z.ZodObject<{
168
+ from: z.ZodString;
169
+ sha: z.ZodString;
170
+ head: z.ZodString;
171
+ }, z.core.$strict>;
172
+ }, z.core.$strict>, z.ZodObject<{
173
+ code: z.ZodLiteral<"not_fast_forward">;
174
+ message: z.ZodString;
175
+ details: z.ZodObject<{
176
+ into: z.ZodString;
177
+ sha: z.ZodString;
178
+ head: z.ZodString;
179
+ }, z.core.$strict>;
180
+ }, z.core.$strict>, z.ZodObject<{
181
+ code: z.ZodLiteral<"unrelated_histories">;
182
+ message: z.ZodString;
183
+ details: z.ZodObject<{
184
+ from: z.ZodString;
185
+ into: z.ZodString;
186
+ }, z.core.$strict>;
187
+ }, z.core.$strict>, z.ZodObject<{
188
+ code: z.ZodLiteral<"storage_unavailable">;
189
+ message: z.ZodString;
190
+ details: z.ZodObject<{
191
+ retryable: z.ZodLiteral<true>;
192
+ }, z.core.$strict>;
193
+ }, z.core.$strict>], "code">;
194
+ /** A gateway error body, inferred from {@link GatewayErrorBody}. */
195
+ type GatewayErrorBody = z.infer<typeof GatewayErrorBody>;
196
+ /** The code of every gateway error; the same set as the `code` branches of {@link GatewayErrorBody}. */
197
+ declare const GatewayErrorCode: z.ZodEnum<{
198
+ invalid_input: "invalid_input";
199
+ not_fast_forward: "not_fast_forward";
200
+ not_head_of_source: "not_head_of_source";
201
+ path_conflict: "path_conflict";
202
+ path_exists: "path_exists";
203
+ path_not_found: "path_not_found";
204
+ ref_not_found: "ref_not_found";
205
+ repo_exists: "repo_exists";
206
+ repo_not_found: "repo_not_found";
207
+ stale_head: "stale_head";
208
+ storage_unavailable: "storage_unavailable";
209
+ unrelated_histories: "unrelated_histories";
210
+ }>;
211
+ /** The code of a gateway error, inferred from {@link GatewayErrorCode}. */
212
+ type GatewayErrorCode = z.infer<typeof GatewayErrorCode>;
213
+ export { NotHeadOfSourceError as a, PathNotFoundError as c, RepoNotFoundError as d, StaleHeadError as f, NotFastForwardError as i, RefNotFoundError as l, UnrelatedHistoriesError as m, GatewayErrorCode as n, PathConflictError as o, StorageUnavailableError as p, InvalidInputError as r, PathExistsError as s, GatewayErrorBody as t, RepoExistsError as u };
214
+ //# sourceMappingURL=gateway-error-body-BWzZFAQI.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { n as GatewayErrorCode, t as GatewayErrorBody } from "./gateway-error-body-BWzZFAQI.js";
2
+ import { z } from "zod";
3
+ /** The body of the error with a given code. */
4
+ export type GatewayErrorOf<C extends GatewayErrorCode> = Extract<GatewayErrorBody, {
5
+ code: C;
6
+ }>;
7
+ /**
8
+ * The error every gateway call throws. `body` is a {@link GatewayErrorBody}; the message carries
9
+ * the same body as JSON after a fixed prefix, so it survives transports (such as Workers RPC)
10
+ * that keep only an error's message.
11
+ */
12
+ export declare class GatewayError<C extends GatewayErrorCode = GatewayErrorCode> extends Error {
13
+ readonly name = "GatewayError";
14
+ readonly body: GatewayErrorOf<C>;
15
+ constructor(body: GatewayErrorOf<C>);
16
+ /** The error's code. */
17
+ get code(): C;
18
+ }
19
+ /** Builds a {@link GatewayError} from a code, message and details, validating them against the schema. */
20
+ export declare function gatewayError<C extends GatewayErrorCode>(code: C, message: string, details: GatewayErrorOf<C>['details']): GatewayError;
21
+ /**
22
+ * Recovers the body of a gateway error from anything thrown: a {@link GatewayError}, or any error
23
+ * whose message is one (e.g. after crossing a Workers RPC boundary). Null for anything else.
24
+ */
25
+ export declare function readGatewayError(thrown: unknown): GatewayErrorBody | null;
26
+ /** True when `thrown` is a gateway error, and has `code` when one is given. */
27
+ export declare function isGatewayError(thrown: unknown, code?: GatewayErrorCode): boolean;
28
+ /** Converts Zod validation issues into an invalid_input {@link GatewayError}. */
29
+ export declare function invalidInput(error: z.ZodError): GatewayError;
30
+ //# sourceMappingURL=gateway-error.d.ts.map
@@ -0,0 +1,63 @@
1
+ import { GatewayErrorBody } from "./schemas/gateway-error-body.js";
2
+ // src/gateway-error.ts
3
+ const PREFIX = "GatewayError ";
4
+ /**
5
+ * The error every gateway call throws. `body` is a {@link GatewayErrorBody}; the message carries
6
+ * the same body as JSON after a fixed prefix, so it survives transports (such as Workers RPC)
7
+ * that keep only an error's message.
8
+ */
9
+ var GatewayError = class extends Error {
10
+ name = "GatewayError";
11
+ body;
12
+ constructor(body) {
13
+ super(`${PREFIX}${JSON.stringify(body)}`);
14
+ this.body = body;
15
+ }
16
+ /** The error's code. */
17
+ get code() {
18
+ return this.body.code;
19
+ }
20
+ };
21
+ /** Builds a {@link GatewayError} from a code, message and details, validating them against the schema. */
22
+ function gatewayError(code, message, details) {
23
+ return new GatewayError(GatewayErrorBody.parse({
24
+ code,
25
+ message,
26
+ details
27
+ }));
28
+ }
29
+ /**
30
+ * Recovers the body of a gateway error from anything thrown: a {@link GatewayError}, or any error
31
+ * whose message is one (e.g. after crossing a Workers RPC boundary). Null for anything else.
32
+ */
33
+ function readGatewayError(thrown) {
34
+ if (thrown instanceof GatewayError) return thrown.body;
35
+ if (!(thrown instanceof Error)) return null;
36
+ const at = thrown.message.indexOf(PREFIX);
37
+ if (at === -1) return null;
38
+ try {
39
+ const parsed = GatewayErrorBody.safeParse(JSON.parse(thrown.message.slice(at + 13)));
40
+ return parsed.success ? parsed.data : null;
41
+ } catch {
42
+ return null;
43
+ }
44
+ }
45
+ /** True when `thrown` is a gateway error, and has `code` when one is given. */
46
+ function isGatewayError(thrown, code) {
47
+ const body = readGatewayError(thrown);
48
+ return body !== null && (code === void 0 || body.code === code);
49
+ }
50
+ /** Converts Zod validation issues into an invalid_input {@link GatewayError}. */
51
+ function invalidInput(error) {
52
+ const issues = error.issues.map((issue) => ({
53
+ path: issue.path.map(String).join("."),
54
+ message: issue.message.length > 0 ? issue.message : "Invalid value"
55
+ }));
56
+ return gatewayError("invalid_input", "Invalid input", { issues: issues.length > 0 ? issues : [{
57
+ path: "",
58
+ message: "Invalid value"
59
+ }] });
60
+ }
61
+ export { GatewayError, gatewayError, invalidInput, isGatewayError, readGatewayError };
62
+
63
+ //# sourceMappingURL=gateway-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway-error.js","names":[],"sources":["../src/gateway-error.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport type { z } from 'zod';\n\nimport { GatewayErrorBody, type GatewayErrorCode } from './schemas/gateway-error-body.ts';\n\n/** The body of the error with a given code. */\nexport type GatewayErrorOf<C extends GatewayErrorCode> = Extract<GatewayErrorBody, { code: C }>;\n\nconst PREFIX = 'GatewayError ';\n\n/**\n * The error every gateway call throws. `body` is a {@link GatewayErrorBody}; the message carries\n * the same body as JSON after a fixed prefix, so it survives transports (such as Workers RPC)\n * that keep only an error's message.\n */\nexport class GatewayError<C extends GatewayErrorCode = GatewayErrorCode> extends Error {\n override readonly name = 'GatewayError';\n readonly body: GatewayErrorOf<C>;\n\n constructor(body: GatewayErrorOf<C>) {\n super(`${PREFIX}${JSON.stringify(body)}`);\n this.body = body;\n }\n\n /** The error's code. */\n get code(): C {\n return this.body.code;\n }\n}\n\n/** Builds a {@link GatewayError} from a code, message and details, validating them against the schema. */\nexport function gatewayError<C extends GatewayErrorCode>(\n code: C,\n message: string,\n details: GatewayErrorOf<C>['details'],\n): GatewayError {\n return new GatewayError(GatewayErrorBody.parse({ code, message, details }));\n}\n\n/**\n * Recovers the body of a gateway error from anything thrown: a {@link GatewayError}, or any error\n * whose message is one (e.g. after crossing a Workers RPC boundary). Null for anything else.\n */\nexport function readGatewayError(thrown: unknown): GatewayErrorBody | null {\n if (thrown instanceof GatewayError) return thrown.body;\n if (!(thrown instanceof Error)) return null;\n const at = thrown.message.indexOf(PREFIX);\n if (at === -1) return null;\n try {\n const parsed = GatewayErrorBody.safeParse(JSON.parse(thrown.message.slice(at + PREFIX.length)));\n return parsed.success ? parsed.data : null;\n } catch {\n return null;\n }\n}\n\n/** True when `thrown` is a gateway error, and has `code` when one is given. */\nexport function isGatewayError(thrown: unknown, code?: GatewayErrorCode): boolean {\n const body = readGatewayError(thrown);\n return body !== null && (code === undefined || body.code === code);\n}\n\n/** Converts Zod validation issues into an invalid_input {@link GatewayError}. */\nexport function invalidInput(error: z.ZodError): GatewayError {\n const issues = error.issues.map((issue) => ({\n path: issue.path.map(String).join('.'),\n message: issue.message.length > 0 ? issue.message : 'Invalid value',\n }));\n return gatewayError('invalid_input', 'Invalid input', {\n issues: issues.length > 0 ? issues : [{ path: '', message: 'Invalid value' }],\n });\n}\n"],"mappings":";;AAQA,MAAM,SAAS;;;;;;AAOf,IAAa,eAAb,cAAiF,MAAM;CACrF,OAAyB;CACzB;CAEA,YAAY,MAAyB;EACnC,MAAM,GAAG,SAAS,KAAK,UAAU,IAAI,GAAG;EACxC,KAAK,OAAO;CACd;;CAGA,IAAI,OAAU;EACZ,OAAO,KAAK,KAAK;CACnB;AACF;;AAGA,SAAgB,aACd,MACA,SACA,SACc;CACd,OAAO,IAAI,aAAa,iBAAiB,MAAM;EAAE;EAAM;EAAS;CAAQ,CAAC,CAAC;AAC5E;;;;;AAMA,SAAgB,iBAAiB,QAA0C;CACzE,IAAI,kBAAkB,cAAc,OAAO,OAAO;CAClD,IAAI,EAAE,kBAAkB,QAAQ,OAAO;CACvC,MAAM,KAAK,OAAO,QAAQ,QAAQ,MAAM;CACxC,IAAI,OAAO,IAAI,OAAO;CACtB,IAAI;EACF,MAAM,SAAS,iBAAiB,UAAU,KAAK,MAAM,OAAO,QAAQ,MAAM,KAAK,EAAa,CAAC,CAAC;EAC9F,OAAO,OAAO,UAAU,OAAO,OAAO;CACxC,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,SAAgB,eAAe,QAAiB,MAAkC;CAChF,MAAM,OAAO,iBAAiB,MAAM;CACpC,OAAO,SAAS,SAAS,SAAS,KAAA,KAAa,KAAK,SAAS;AAC/D;;AAGA,SAAgB,aAAa,OAAiC;CAC5D,MAAM,SAAS,MAAM,OAAO,KAAK,WAAW;EAC1C,MAAM,MAAM,KAAK,IAAI,MAAM,CAAC,CAAC,KAAK,GAAG;EACrC,SAAS,MAAM,QAAQ,SAAS,IAAI,MAAM,UAAU;CACtD,EAAE;CACF,OAAO,aAAa,iBAAiB,iBAAiB,EACpD,QAAQ,OAAO,SAAS,IAAI,SAAS,CAAC;EAAE,MAAM;EAAI,SAAS;CAAgB,CAAC,EAC9E,CAAC;AACH"}
@@ -0,0 +1,358 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * The input and output schema of every RPC method. An implementation parses each input with its
4
+ * schema before acting and returns a value its output schema accepts; failures are thrown as
5
+ * {@link GatewayError}s.
6
+ */
7
+ declare const RPC_SCHEMAS: {
8
+ readonly commit: {
9
+ readonly input: z.ZodObject<{
10
+ repo: z.ZodString;
11
+ branch: z.ZodString;
12
+ startBranch: z.ZodOptional<z.ZodString>;
13
+ expectedHead: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
+ message: z.ZodString;
15
+ author: z.ZodObject<{
16
+ name: z.ZodString;
17
+ email: z.ZodEmail;
18
+ }, z.core.$strict>;
19
+ committer: z.ZodOptional<z.ZodObject<{
20
+ name: z.ZodString;
21
+ email: z.ZodEmail;
22
+ }, z.core.$strict>>;
23
+ actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
24
+ action: z.ZodLiteral<"create">;
25
+ path: z.ZodString;
26
+ content: z.ZodString;
27
+ encoding: z.ZodDefault<z.ZodEnum<{
28
+ base64: "base64";
29
+ text: "text";
30
+ }>>;
31
+ }, z.core.$strict>, z.ZodObject<{
32
+ action: z.ZodLiteral<"update">;
33
+ path: z.ZodString;
34
+ content: z.ZodString;
35
+ encoding: z.ZodDefault<z.ZodEnum<{
36
+ base64: "base64";
37
+ text: "text";
38
+ }>>;
39
+ }, z.core.$strict>, z.ZodObject<{
40
+ action: z.ZodLiteral<"upsert">;
41
+ path: z.ZodString;
42
+ content: z.ZodString;
43
+ encoding: z.ZodDefault<z.ZodEnum<{
44
+ base64: "base64";
45
+ text: "text";
46
+ }>>;
47
+ }, z.core.$strict>, z.ZodObject<{
48
+ action: z.ZodLiteral<"delete">;
49
+ path: z.ZodString;
50
+ }, z.core.$strict>, z.ZodObject<{
51
+ action: z.ZodLiteral<"move">;
52
+ path: z.ZodString;
53
+ previousPath: z.ZodString;
54
+ content: z.ZodOptional<z.ZodString>;
55
+ encoding: z.ZodDefault<z.ZodEnum<{
56
+ base64: "base64";
57
+ text: "text";
58
+ }>>;
59
+ }, z.core.$strict>, z.ZodObject<{
60
+ action: z.ZodLiteral<"chmod">;
61
+ path: z.ZodString;
62
+ executeFilemode: z.ZodBoolean;
63
+ }, z.core.$strict>], "action">>;
64
+ idempotencyKey: z.ZodString;
65
+ }, z.core.$strict>;
66
+ readonly output: z.ZodDiscriminatedUnion<[z.ZodObject<{
67
+ status: z.ZodLiteral<"committed">;
68
+ commit: z.ZodObject<{
69
+ sha: z.ZodString;
70
+ tree: z.ZodString;
71
+ parents: z.ZodArray<z.ZodString>;
72
+ author: z.ZodObject<{
73
+ name: z.ZodString;
74
+ email: z.ZodEmail;
75
+ date: z.ZodISODateTime;
76
+ }, z.core.$strict>;
77
+ committer: z.ZodObject<{
78
+ name: z.ZodString;
79
+ email: z.ZodEmail;
80
+ date: z.ZodISODateTime;
81
+ }, z.core.$strict>;
82
+ message: z.ZodString;
83
+ idempotencyKey: z.ZodNullable<z.ZodString>;
84
+ }, z.core.$strict>;
85
+ refUpdate: z.ZodObject<{
86
+ ref: z.ZodString;
87
+ oldSha: z.ZodString;
88
+ newSha: z.ZodString;
89
+ }, z.core.$strict>;
90
+ }, z.core.$strict>, z.ZodObject<{
91
+ status: z.ZodLiteral<"replayed">;
92
+ commit: z.ZodObject<{
93
+ sha: z.ZodString;
94
+ tree: z.ZodString;
95
+ parents: z.ZodArray<z.ZodString>;
96
+ author: z.ZodObject<{
97
+ name: z.ZodString;
98
+ email: z.ZodEmail;
99
+ date: z.ZodISODateTime;
100
+ }, z.core.$strict>;
101
+ committer: z.ZodObject<{
102
+ name: z.ZodString;
103
+ email: z.ZodEmail;
104
+ date: z.ZodISODateTime;
105
+ }, z.core.$strict>;
106
+ message: z.ZodString;
107
+ idempotencyKey: z.ZodNullable<z.ZodString>;
108
+ }, z.core.$strict>;
109
+ }, z.core.$strict>, z.ZodObject<{
110
+ status: z.ZodLiteral<"noop">;
111
+ head: z.ZodNullable<z.ZodString>;
112
+ }, z.core.$strict>, z.ZodObject<{
113
+ status: z.ZodLiteral<"queued">;
114
+ workflowInstanceId: z.ZodString;
115
+ }, z.core.$strict>], "status">;
116
+ };
117
+ readonly readFile: {
118
+ readonly input: z.ZodObject<{
119
+ repo: z.ZodString;
120
+ ref: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
121
+ path: z.ZodString;
122
+ encoding: z.ZodDefault<z.ZodEnum<{
123
+ base64: "base64";
124
+ text: "text";
125
+ }>>;
126
+ }, z.core.$strict>;
127
+ readonly output: z.ZodNullable<z.ZodObject<{
128
+ path: z.ZodString;
129
+ commit: z.ZodString;
130
+ sha: z.ZodString;
131
+ size: z.ZodInt;
132
+ executable: z.ZodBoolean;
133
+ encoding: z.ZodEnum<{
134
+ base64: "base64";
135
+ text: "text";
136
+ }>;
137
+ content: z.ZodString;
138
+ }, z.core.$strict>>;
139
+ };
140
+ readonly listTree: {
141
+ readonly input: z.ZodObject<{
142
+ repo: z.ZodString;
143
+ ref: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
144
+ path: z.ZodOptional<z.ZodString>;
145
+ recursive: z.ZodDefault<z.ZodBoolean>;
146
+ }, z.core.$strict>;
147
+ readonly output: z.ZodNullable<z.ZodObject<{
148
+ commit: z.ZodString;
149
+ path: z.ZodNullable<z.ZodString>;
150
+ entries: z.ZodArray<z.ZodObject<{
151
+ path: z.ZodString;
152
+ name: z.ZodString;
153
+ type: z.ZodEnum<{
154
+ blob: "blob";
155
+ commit: "commit";
156
+ tree: "tree";
157
+ }>;
158
+ mode: z.ZodEnum<{
159
+ "040000": "040000";
160
+ 100644: "100644";
161
+ 100755: "100755";
162
+ 120000: "120000";
163
+ 160000: "160000";
164
+ }>;
165
+ sha: z.ZodString;
166
+ }, z.core.$strict>>;
167
+ }, z.core.$strict>>;
168
+ };
169
+ readonly resolveRef: {
170
+ readonly input: z.ZodObject<{
171
+ repo: z.ZodString;
172
+ ref: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
173
+ }, z.core.$strict>;
174
+ readonly output: z.ZodNullable<z.ZodObject<{
175
+ sha: z.ZodString;
176
+ }, z.core.$strict>>;
177
+ };
178
+ readonly log: {
179
+ readonly input: z.ZodObject<{
180
+ repo: z.ZodString;
181
+ ref: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
182
+ limit: z.ZodDefault<z.ZodInt>;
183
+ offset: z.ZodDefault<z.ZodInt>;
184
+ since: z.ZodOptional<z.ZodISODateTime>;
185
+ }, z.core.$strict>;
186
+ readonly output: z.ZodObject<{
187
+ commits: z.ZodArray<z.ZodObject<{
188
+ sha: z.ZodString;
189
+ tree: z.ZodString;
190
+ parents: z.ZodArray<z.ZodString>;
191
+ author: z.ZodObject<{
192
+ name: z.ZodString;
193
+ email: z.ZodEmail;
194
+ date: z.ZodISODateTime;
195
+ }, z.core.$strict>;
196
+ committer: z.ZodObject<{
197
+ name: z.ZodString;
198
+ email: z.ZodEmail;
199
+ date: z.ZodISODateTime;
200
+ }, z.core.$strict>;
201
+ message: z.ZodString;
202
+ idempotencyKey: z.ZodNullable<z.ZodString>;
203
+ }, z.core.$strict>>;
204
+ hasMore: z.ZodBoolean;
205
+ }, z.core.$strict>;
206
+ };
207
+ readonly commitExists: {
208
+ readonly input: z.ZodObject<{
209
+ repo: z.ZodString;
210
+ sha: z.ZodString;
211
+ branch: z.ZodOptional<z.ZodString>;
212
+ }, z.core.$strict>;
213
+ readonly output: z.ZodObject<{
214
+ exists: z.ZodBoolean;
215
+ }, z.core.$strict>;
216
+ };
217
+ readonly syncBranch: {
218
+ readonly input: z.ZodObject<{
219
+ repo: z.ZodString;
220
+ from: z.ZodString;
221
+ into: z.ZodString;
222
+ author: z.ZodOptional<z.ZodObject<{
223
+ name: z.ZodString;
224
+ email: z.ZodEmail;
225
+ }, z.core.$strict>>;
226
+ message: z.ZodOptional<z.ZodString>;
227
+ }, z.core.$strict>;
228
+ readonly output: z.ZodDiscriminatedUnion<[z.ZodObject<{
229
+ status: z.ZodLiteral<"up_to_date">;
230
+ head: z.ZodString;
231
+ }, z.core.$strict>, z.ZodObject<{
232
+ status: z.ZodLiteral<"fast_forward">;
233
+ refUpdate: z.ZodObject<{
234
+ ref: z.ZodString;
235
+ oldSha: z.ZodString;
236
+ newSha: z.ZodString;
237
+ }, z.core.$strict>;
238
+ }, z.core.$strict>, z.ZodObject<{
239
+ status: z.ZodLiteral<"merged">;
240
+ commit: z.ZodObject<{
241
+ sha: z.ZodString;
242
+ tree: z.ZodString;
243
+ parents: z.ZodArray<z.ZodString>;
244
+ author: z.ZodObject<{
245
+ name: z.ZodString;
246
+ email: z.ZodEmail;
247
+ date: z.ZodISODateTime;
248
+ }, z.core.$strict>;
249
+ committer: z.ZodObject<{
250
+ name: z.ZodString;
251
+ email: z.ZodEmail;
252
+ date: z.ZodISODateTime;
253
+ }, z.core.$strict>;
254
+ message: z.ZodString;
255
+ idempotencyKey: z.ZodNullable<z.ZodString>;
256
+ }, z.core.$strict>;
257
+ refUpdate: z.ZodObject<{
258
+ ref: z.ZodString;
259
+ oldSha: z.ZodString;
260
+ newSha: z.ZodString;
261
+ }, z.core.$strict>;
262
+ }, z.core.$strict>, z.ZodObject<{
263
+ status: z.ZodLiteral<"conflict">;
264
+ paths: z.ZodArray<z.ZodString>;
265
+ base: z.ZodString;
266
+ fromHead: z.ZodString;
267
+ intoHead: z.ZodString;
268
+ }, z.core.$strict>], "status">;
269
+ };
270
+ readonly promote: {
271
+ readonly input: z.ZodObject<{
272
+ repo: z.ZodString;
273
+ from: z.ZodString;
274
+ into: z.ZodString;
275
+ sha: z.ZodString;
276
+ }, z.core.$strict>;
277
+ readonly output: z.ZodDiscriminatedUnion<[z.ZodObject<{
278
+ status: z.ZodLiteral<"promoted">;
279
+ refUpdate: z.ZodObject<{
280
+ ref: z.ZodString;
281
+ oldSha: z.ZodString;
282
+ newSha: z.ZodString;
283
+ }, z.core.$strict>;
284
+ }, z.core.$strict>, z.ZodObject<{
285
+ status: z.ZodLiteral<"up_to_date">;
286
+ head: z.ZodString;
287
+ }, z.core.$strict>], "status">;
288
+ };
289
+ readonly createRepo: {
290
+ readonly input: z.ZodObject<{
291
+ repo: z.ZodString;
292
+ defaultBranch: z.ZodDefault<z.ZodString>;
293
+ }, z.core.$strict>;
294
+ readonly output: z.ZodObject<{
295
+ name: z.ZodString;
296
+ defaultBranch: z.ZodString;
297
+ createdAt: z.ZodISODateTime;
298
+ remoteUrl: z.ZodURL;
299
+ }, z.core.$strict>;
300
+ };
301
+ readonly deleteRepo: {
302
+ readonly input: z.ZodObject<{
303
+ repo: z.ZodString;
304
+ }, z.core.$strict>;
305
+ readonly output: z.ZodObject<{
306
+ deleted: z.ZodBoolean;
307
+ }, z.core.$strict>;
308
+ };
309
+ readonly mintReadToken: {
310
+ readonly input: z.ZodObject<{
311
+ repo: z.ZodString;
312
+ ttlSeconds: z.ZodDefault<z.ZodInt>;
313
+ }, z.core.$strict>;
314
+ readonly output: z.ZodObject<{
315
+ token: z.ZodString;
316
+ expiresAt: z.ZodISODateTime;
317
+ remoteUrl: z.ZodURL;
318
+ }, z.core.$strict>;
319
+ };
320
+ };
321
+ /** The name of an RPC method. */
322
+ type RpcMethod = keyof typeof RPC_SCHEMAS;
323
+ /** What a caller passes to an RPC method (defaults optional). */
324
+ type RpcInput<M extends RpcMethod> = z.input<(typeof RPC_SCHEMAS)[M]['input']>;
325
+ /** What an implementation works with after parsing the input (defaults applied). */
326
+ type RpcParsedInput<M extends RpcMethod> = z.output<(typeof RPC_SCHEMAS)[M]['input']>;
327
+ /** What an RPC method resolves to. */
328
+ type RpcOutput<M extends RpcMethod> = z.output<(typeof RPC_SCHEMAS)[M]['output']>;
329
+ /**
330
+ * The git-gateway RPC API, reached over a Workers service binding. Every method's signature is
331
+ * the inferred type of its schemas in {@link RPC_SCHEMAS}; errors are thrown as GatewayErrors.
332
+ */
333
+ interface GitGateway {
334
+ /** A multi-file commit to one branch, built without a clone; idempotent by key. */
335
+ commit(input: RpcInput<'commit'>): Promise<RpcOutput<'commit'>>;
336
+ /** One file at a branch or commit, or null when no file is at the path. */
337
+ readFile(input: RpcInput<'readFile'>): Promise<RpcOutput<'readFile'>>;
338
+ /** A directory listing at a branch or commit, or null when the path is not a directory. */
339
+ listTree(input: RpcInput<'listTree'>): Promise<RpcOutput<'listTree'>>;
340
+ /** The commit a branch names, or null when it does not exist. */
341
+ resolveRef(input: RpcInput<'resolveRef'>): Promise<RpcOutput<'resolveRef'>>;
342
+ /** A page of history reachable from a branch or commit. */
343
+ log(input: RpcInput<'log'>): Promise<RpcOutput<'log'>>;
344
+ /** Whether a commit exists, optionally reachable from a branch. */
345
+ commitExists(input: RpcInput<'commitExists'>): Promise<RpcOutput<'commitExists'>>;
346
+ /** Bring one branch up to date with another without rewriting it. */
347
+ syncBranch(input: RpcInput<'syncBranch'>): Promise<RpcOutput<'syncBranch'>>;
348
+ /** Fast-forward one branch to the head of another, never merging or forcing. */
349
+ promote(input: RpcInput<'promote'>): Promise<RpcOutput<'promote'>>;
350
+ /** Create an empty repository. */
351
+ createRepo(input: RpcInput<'createRepo'>): Promise<RpcOutput<'createRepo'>>;
352
+ /** Permanently delete a repository. */
353
+ deleteRepo(input: RpcInput<'deleteRepo'>): Promise<RpcOutput<'deleteRepo'>>;
354
+ /** A short-lived credential that can read one repository through the gateway. */
355
+ mintReadToken(input: RpcInput<'mintReadToken'>): Promise<RpcOutput<'mintReadToken'>>;
356
+ }
357
+ export { RpcOutput as a, RpcMethod as i, RPC_SCHEMAS as n, RpcParsedInput as o, RpcInput as r, GitGateway as t };
358
+ //# sourceMappingURL=git-gateway-VA9Tc5tn.d.ts.map
@@ -0,0 +1,2 @@
1
+ import { a as RpcOutput, i as RpcMethod, n as RPC_SCHEMAS, o as RpcParsedInput, r as RpcInput, t as GitGateway } from "./git-gateway-VA9Tc5tn.js";
2
+ export { GitGateway, RPC_SCHEMAS, RpcInput, RpcMethod, RpcOutput, RpcParsedInput };