@distilled.cloud/vercel 0.0.0 → 1.0.0-rc.10

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 (246) hide show
  1. package/LICENSE +201 -0
  2. package/lib/credentials.d.ts +21 -0
  3. package/lib/credentials.d.ts.map +1 -0
  4. package/lib/credentials.js +40 -0
  5. package/lib/credentials.js.map +1 -0
  6. package/lib/errors.d.ts +80 -0
  7. package/lib/errors.d.ts.map +1 -0
  8. package/lib/errors.js +50 -0
  9. package/lib/errors.js.map +1 -0
  10. package/lib/index.d.ts +15 -0
  11. package/lib/index.d.ts.map +1 -0
  12. package/lib/index.js +15 -0
  13. package/lib/index.js.map +1 -0
  14. package/lib/protocol.d.ts +18 -0
  15. package/lib/protocol.d.ts.map +1 -0
  16. package/lib/protocol.js +69 -0
  17. package/lib/protocol.js.map +1 -0
  18. package/lib/retry.d.ts +54 -0
  19. package/lib/retry.d.ts.map +1 -0
  20. package/lib/retry.js +47 -0
  21. package/lib/retry.js.map +1 -0
  22. package/lib/services/access_groups.d.ts +459 -0
  23. package/lib/services/access_groups.d.ts.map +1 -0
  24. package/lib/services/access_groups.js +449 -0
  25. package/lib/services/access_groups.js.map +1 -0
  26. package/lib/services/ai_gateway.d.ts +122 -0
  27. package/lib/services/ai_gateway.d.ts.map +1 -0
  28. package/lib/services/ai_gateway.js +125 -0
  29. package/lib/services/ai_gateway.js.map +1 -0
  30. package/lib/services/aliases.d.ts +591 -0
  31. package/lib/services/aliases.d.ts.map +1 -0
  32. package/lib/services/aliases.js +482 -0
  33. package/lib/services/aliases.js.map +1 -0
  34. package/lib/services/api_ai_gateway.d.ts +275 -0
  35. package/lib/services/api_ai_gateway.d.ts.map +1 -0
  36. package/lib/services/api_ai_gateway.js +227 -0
  37. package/lib/services/api_ai_gateway.js.map +1 -0
  38. package/lib/services/artifacts.d.ts +228 -0
  39. package/lib/services/artifacts.d.ts.map +1 -0
  40. package/lib/services/artifacts.js +214 -0
  41. package/lib/services/artifacts.js.map +1 -0
  42. package/lib/services/authentication.d.ts +373 -0
  43. package/lib/services/authentication.d.ts.map +1 -0
  44. package/lib/services/authentication.js +304 -0
  45. package/lib/services/authentication.js.map +1 -0
  46. package/lib/services/billing.d.ts +930 -0
  47. package/lib/services/billing.d.ts.map +1 -0
  48. package/lib/services/billing.js +695 -0
  49. package/lib/services/billing.js.map +1 -0
  50. package/lib/services/bulk_redirects.d.ts +308 -0
  51. package/lib/services/bulk_redirects.d.ts.map +1 -0
  52. package/lib/services/bulk_redirects.js +302 -0
  53. package/lib/services/bulk_redirects.js.map +1 -0
  54. package/lib/services/certs.d.ts +171 -0
  55. package/lib/services/certs.d.ts.map +1 -0
  56. package/lib/services/certs.js +163 -0
  57. package/lib/services/certs.js.map +1 -0
  58. package/lib/services/checks_v2.d.ts +1167 -0
  59. package/lib/services/checks_v2.d.ts.map +1 -0
  60. package/lib/services/checks_v2.js +1141 -0
  61. package/lib/services/checks_v2.js.map +1 -0
  62. package/lib/services/connect.d.ts +2228 -0
  63. package/lib/services/connect.d.ts.map +1 -0
  64. package/lib/services/connect.js +1575 -0
  65. package/lib/services/connect.js.map +1 -0
  66. package/lib/services/deployments.d.ts +9419 -0
  67. package/lib/services/deployments.d.ts.map +1 -0
  68. package/lib/services/deployments.js +8248 -0
  69. package/lib/services/deployments.js.map +1 -0
  70. package/lib/services/dns.d.ts +279 -0
  71. package/lib/services/dns.d.ts.map +1 -0
  72. package/lib/services/dns.js +277 -0
  73. package/lib/services/dns.js.map +1 -0
  74. package/lib/services/domains.d.ts +564 -0
  75. package/lib/services/domains.d.ts.map +1 -0
  76. package/lib/services/domains.js +469 -0
  77. package/lib/services/domains.js.map +1 -0
  78. package/lib/services/domains_registrar.d.ts +798 -0
  79. package/lib/services/domains_registrar.d.ts.map +1 -0
  80. package/lib/services/domains_registrar.js +916 -0
  81. package/lib/services/domains_registrar.js.map +1 -0
  82. package/lib/services/drains.d.ts +2263 -0
  83. package/lib/services/drains.d.ts.map +1 -0
  84. package/lib/services/drains.js +2121 -0
  85. package/lib/services/drains.js.map +1 -0
  86. package/lib/services/edge_cache.d.ts +125 -0
  87. package/lib/services/edge_cache.d.ts.map +1 -0
  88. package/lib/services/edge_cache.js +138 -0
  89. package/lib/services/edge_cache.js.map +1 -0
  90. package/lib/services/environment.d.ts +1020 -0
  91. package/lib/services/environment.d.ts.map +1 -0
  92. package/lib/services/environment.js +805 -0
  93. package/lib/services/environment.js.map +1 -0
  94. package/lib/services/feature_flags.d.ts +2893 -0
  95. package/lib/services/feature_flags.d.ts.map +1 -0
  96. package/lib/services/feature_flags.js +2707 -0
  97. package/lib/services/feature_flags.js.map +1 -0
  98. package/lib/services/global_config.d.ts +618 -0
  99. package/lib/services/global_config.d.ts.map +1 -0
  100. package/lib/services/global_config.js +709 -0
  101. package/lib/services/global_config.js.map +1 -0
  102. package/lib/services/index.d.ts +42 -0
  103. package/lib/services/index.d.ts.map +1 -0
  104. package/lib/services/index.js +43 -0
  105. package/lib/services/index.js.map +1 -0
  106. package/lib/services/integrations.d.ts +3014 -0
  107. package/lib/services/integrations.d.ts.map +1 -0
  108. package/lib/services/integrations.js +2544 -0
  109. package/lib/services/integrations.js.map +1 -0
  110. package/lib/services/kms.d.ts +1095 -0
  111. package/lib/services/kms.d.ts.map +1 -0
  112. package/lib/services/kms.js +956 -0
  113. package/lib/services/kms.js.map +1 -0
  114. package/lib/services/log_drains.d.ts +848 -0
  115. package/lib/services/log_drains.d.ts.map +1 -0
  116. package/lib/services/log_drains.js +782 -0
  117. package/lib/services/log_drains.js.map +1 -0
  118. package/lib/services/logs.d.ts +40 -0
  119. package/lib/services/logs.d.ts.map +1 -0
  120. package/lib/services/logs.js +43 -0
  121. package/lib/services/logs.js.map +1 -0
  122. package/lib/services/marketplace.d.ts +1053 -0
  123. package/lib/services/marketplace.d.ts.map +1 -0
  124. package/lib/services/marketplace.js +1116 -0
  125. package/lib/services/marketplace.js.map +1 -0
  126. package/lib/services/microfrontends.d.ts +3250 -0
  127. package/lib/services/microfrontends.d.ts.map +1 -0
  128. package/lib/services/microfrontends.js +3154 -0
  129. package/lib/services/microfrontends.js.map +1 -0
  130. package/lib/services/misc.d.ts +192 -0
  131. package/lib/services/misc.d.ts.map +1 -0
  132. package/lib/services/misc.js +124 -0
  133. package/lib/services/misc.js.map +1 -0
  134. package/lib/services/networking.d.ts +360 -0
  135. package/lib/services/networking.d.ts.map +1 -0
  136. package/lib/services/networking.js +353 -0
  137. package/lib/services/networking.js.map +1 -0
  138. package/lib/services/observability.d.ts +168 -0
  139. package/lib/services/observability.d.ts.map +1 -0
  140. package/lib/services/observability.js +190 -0
  141. package/lib/services/observability.js.map +1 -0
  142. package/lib/services/project_members.d.ts +142 -0
  143. package/lib/services/project_members.d.ts.map +1 -0
  144. package/lib/services/project_members.js +135 -0
  145. package/lib/services/project_members.js.map +1 -0
  146. package/lib/services/project_routes.d.ts +1990 -0
  147. package/lib/services/project_routes.d.ts.map +1 -0
  148. package/lib/services/project_routes.js +1883 -0
  149. package/lib/services/project_routes.js.map +1 -0
  150. package/lib/services/projects.d.ts +23677 -0
  151. package/lib/services/projects.d.ts.map +1 -0
  152. package/lib/services/projects.js +22223 -0
  153. package/lib/services/projects.js.map +1 -0
  154. package/lib/services/rolling_release.d.ts +764 -0
  155. package/lib/services/rolling_release.d.ts.map +1 -0
  156. package/lib/services/rolling_release.js +583 -0
  157. package/lib/services/rolling_release.js.map +1 -0
  158. package/lib/services/sandboxes.d.ts +2777 -0
  159. package/lib/services/sandboxes.d.ts.map +1 -0
  160. package/lib/services/sandboxes.js +2142 -0
  161. package/lib/services/sandboxes.js.map +1 -0
  162. package/lib/services/security.d.ts +4247 -0
  163. package/lib/services/security.d.ts.map +1 -0
  164. package/lib/services/security.js +4377 -0
  165. package/lib/services/security.js.map +1 -0
  166. package/lib/services/storage.d.ts +251 -0
  167. package/lib/services/storage.d.ts.map +1 -0
  168. package/lib/services/storage.js +257 -0
  169. package/lib/services/storage.js.map +1 -0
  170. package/lib/services/teams.d.ts +1600 -0
  171. package/lib/services/teams.d.ts.map +1 -0
  172. package/lib/services/teams.js +1314 -0
  173. package/lib/services/teams.js.map +1 -0
  174. package/lib/services/user.d.ts +8559 -0
  175. package/lib/services/user.d.ts.map +1 -0
  176. package/lib/services/user.js +7407 -0
  177. package/lib/services/user.js.map +1 -0
  178. package/lib/services/vcr.d.ts +751 -0
  179. package/lib/services/vcr.d.ts.map +1 -0
  180. package/lib/services/vcr.js +826 -0
  181. package/lib/services/vcr.js.map +1 -0
  182. package/lib/services/web_analytics.d.ts +726 -0
  183. package/lib/services/web_analytics.d.ts.map +1 -0
  184. package/lib/services/web_analytics.js +707 -0
  185. package/lib/services/web_analytics.js.map +1 -0
  186. package/lib/services/webhooks.d.ts +219 -0
  187. package/lib/services/webhooks.d.ts.map +1 -0
  188. package/lib/services/webhooks.js +177 -0
  189. package/lib/services/webhooks.js.map +1 -0
  190. package/lib/traits.d.ts +10 -0
  191. package/lib/traits.d.ts.map +1 -0
  192. package/lib/traits.js +11 -0
  193. package/lib/traits.js.map +1 -0
  194. package/package.json +78 -7
  195. package/src/credentials.ts +70 -0
  196. package/src/errors.ts +93 -0
  197. package/src/index.ts +18 -0
  198. package/src/protocol.ts +98 -0
  199. package/src/retry.ts +78 -0
  200. package/src/services/access_groups.ts +1165 -0
  201. package/src/services/ai_gateway.ts +267 -0
  202. package/src/services/aliases.ts +1315 -0
  203. package/src/services/api_ai_gateway.ts +607 -0
  204. package/src/services/artifacts.ts +542 -0
  205. package/src/services/authentication.ts +827 -0
  206. package/src/services/billing.ts +2104 -0
  207. package/src/services/bulk_redirects.ts +748 -0
  208. package/src/services/certs.ts +371 -0
  209. package/src/services/checks_v2.ts +3084 -0
  210. package/src/services/connect.ts +4805 -0
  211. package/src/services/deployments.ts +24576 -0
  212. package/src/services/dns.ts +715 -0
  213. package/src/services/domains.ts +1257 -0
  214. package/src/services/domains_registrar.ts +2257 -0
  215. package/src/services/drains.ts +5828 -0
  216. package/src/services/edge_cache.ts +303 -0
  217. package/src/services/environment.ts +2379 -0
  218. package/src/services/feature_flags.ts +7722 -0
  219. package/src/services/global_config.ts +1668 -0
  220. package/src/services/index.ts +42 -0
  221. package/src/services/integrations.ts +9022 -0
  222. package/src/services/kms.ts +2614 -0
  223. package/src/services/log_drains.ts +2434 -0
  224. package/src/services/logs.ts +78 -0
  225. package/src/services/marketplace.ts +2849 -0
  226. package/src/services/microfrontends.ts +9921 -0
  227. package/src/services/misc.ts +364 -0
  228. package/src/services/networking.ts +865 -0
  229. package/src/services/observability.ts +435 -0
  230. package/src/services/project_members.ts +326 -0
  231. package/src/services/project_routes.ts +5229 -0
  232. package/src/services/projects.ts +68139 -0
  233. package/src/services/rolling_release.ts +1860 -0
  234. package/src/services/sandboxes.ts +6988 -0
  235. package/src/services/security.ts +13931 -0
  236. package/src/services/storage.ts +850 -0
  237. package/src/services/teams.ts +4055 -0
  238. package/src/services/user.ts +23195 -0
  239. package/src/services/vcr.ts +2070 -0
  240. package/src/services/web_analytics.ts +1638 -0
  241. package/src/services/webhooks.ts +1102 -0
  242. package/src/traits.ts +46 -0
  243. package/README.md +0 -15
  244. package/bun.lock +0 -26
  245. package/index.ts +0 -1
  246. package/tsconfig.json +0 -29
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,21 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import * as Redacted from "effect/Redacted";
5
+ /** Vercel's REST API root. */
6
+ export declare const DEFAULT_API_BASE_URL = "https://api.vercel.com";
7
+ export interface Config {
8
+ readonly token: Redacted.Redacted<string>;
9
+ readonly apiBaseUrl: string;
10
+ }
11
+ declare const Credentials_base: Context.ServiceClass<Credentials, "VercelCredentials", Effect.Effect<Config, never, never>>;
12
+ export declare class Credentials extends Credentials_base {
13
+ }
14
+ export declare const CredentialsFromEnv: Layer.Layer<Credentials, never, never>;
15
+ /** Convenience layer from a plain token + optional base URL. */
16
+ export declare const credentials: (config: {
17
+ readonly token: string;
18
+ readonly apiBaseUrl?: string;
19
+ }) => Layer.Layer<Credentials>;
20
+ export {};
21
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C,8BAA8B;AAC9B,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAGT;CAAG;AAU3B,eAAO,MAAM,kBAAkB,wCAe9B,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,WAAW,WAAY;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAOxB,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Vercel credentials — hand-written.
3
+ *
4
+ * The `Credentials` service resolves `{ token, apiBaseUrl }` per request; the
5
+ * protocol layer formats the `Authorization: Bearer <token>` header from it.
6
+ * The token is a Vercel access token — personal, team, or an OAuth
7
+ * integration's — the REST API accepts all of them as bearer tokens.
8
+ *
9
+ * Vercel scopes most requests to a team via the `teamId`/`slug` QUERY
10
+ * parameters, which the spec declares per operation; they stay ordinary input
11
+ * fields rather than credential state, because a single token routinely spans
12
+ * several teams.
13
+ */
14
+ import * as EffectConfig from "effect/Config";
15
+ import * as Context from "effect/Context";
16
+ import * as Effect from "effect/Effect";
17
+ import * as Layer from "effect/Layer";
18
+ import * as Redacted from "effect/Redacted";
19
+ import { ConfigError } from "@distilled.cloud/core/errors";
20
+ /** Vercel's REST API root. */
21
+ export const DEFAULT_API_BASE_URL = "https://api.vercel.com";
22
+ export class Credentials extends Context.Service()("VercelCredentials") {
23
+ }
24
+ const envConfig = EffectConfig.all({
25
+ // `VERCEL_TOKEN` is what the Vercel CLI and the official SDK read.
26
+ token: EffectConfig.String("VERCEL_TOKEN"),
27
+ apiBaseUrl: EffectConfig.String("VERCEL_API_URL").pipe(EffectConfig.withDefault(DEFAULT_API_BASE_URL)),
28
+ });
29
+ export const CredentialsFromEnv = Layer.succeed(Credentials, envConfig.pipe(Effect.mapError(() => new ConfigError({
30
+ message: "VERCEL_TOKEN environment variable is required",
31
+ })), Effect.map(({ token, apiBaseUrl }) => ({
32
+ token: Redacted.make(token),
33
+ apiBaseUrl,
34
+ })), Effect.orDie));
35
+ /** Convenience layer from a plain token + optional base URL. */
36
+ export const credentials = (config) => Layer.succeed(Credentials, Effect.succeed({
37
+ token: Redacted.make(config.token),
38
+ apiBaseUrl: config.apiBaseUrl ?? DEFAULT_API_BASE_URL,
39
+ }));
40
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,8BAA8B;AAC9B,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAO7D,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EAG7C,CAAC,mBAAmB,CAAC;CAAG;AAE3B,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC;IACjC,mEAAmE;IACnE,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC;IAC1C,UAAU,EAAE,YAAY,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,IAAI,CACpD,YAAY,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAC/C;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAC7C,WAAW,EACX,SAAS,CAAC,IAAI,CACZ,MAAM,CAAC,QAAQ,CACb,GAAG,EAAE,CACH,IAAI,WAAW,CAAC;IACd,OAAO,EAAE,+CAA+C;CACzD,CAAC,CACL,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IACrC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;IAC3B,UAAU;CACX,CAAC,CAAC,EACH,MAAM,CAAC,KAAK,CACb,CACF,CAAC;AAEF,gEAAgE;AAChE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAG3B,EAA4B,EAAE,CAC7B,KAAK,CAAC,OAAO,CACX,WAAW,EACX,MAAM,CAAC,OAAO,CAAC;IACb,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,oBAAoB;CACtD,CAAC,CACH,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Vercel-specific error types.
3
+ *
4
+ * Re-exports the common HTTP errors from core and adds the two statuses
5
+ * Vercel uses that core's shared map has no entry for, plus the
6
+ * unknown-error and parse-error wrappers.
7
+ */
8
+ export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
9
+ import type { DefaultErrors as CoreDefaultErrors } from "@distilled.cloud/core/errors";
10
+ import * as Schema from "effect/Schema";
11
+ declare const PaymentRequired_base: Schema.Class<PaymentRequired, Schema.TaggedStruct<"PaymentRequired", {
12
+ readonly message: Schema.String;
13
+ }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
14
+ "@distilled.cloud/error/categories": {
15
+ QuotaError: true;
16
+ };
17
+ });
18
+ /**
19
+ * HTTP 402 — the account cannot be billed for the request: a missing payment
20
+ * method, an unpaid invoice, or a spend cap the team has already hit (Vercel
21
+ * pauses the account at the cap until an owner disables it). Declared on the
22
+ * ~95 operations that provision billable resources; the rest reach it through
23
+ * the protocol's status map.
24
+ */
25
+ export declare class PaymentRequired extends PaymentRequired_base {
26
+ }
27
+ declare const Gone_base: Schema.Class<Gone, Schema.TaggedStruct<"Gone", {
28
+ readonly message: Schema.String;
29
+ }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
30
+ "@distilled.cloud/error/categories": {
31
+ NotFoundError: true;
32
+ };
33
+ });
34
+ /**
35
+ * HTTP 410 — Vercel's "Invalid API version": the versioned path segment
36
+ * (`/v5/domains`, `/v9/projects`) is no longer served. The spec declares it on
37
+ * nearly every operation as boilerplate, so it rides the common error channel
38
+ * instead of every generated operation's error list — a 410 means the SDK's
39
+ * pinned path version was retired and needs a regeneration, not something a
40
+ * caller can branch on per operation.
41
+ */
42
+ export declare class Gone extends Gone_base {
43
+ }
44
+ declare const UnknownVercelError_base: Schema.Class<UnknownVercelError, Schema.TaggedStruct<"UnknownVercelError", {
45
+ readonly code: Schema.optional<Schema.String>;
46
+ readonly message: Schema.optional<Schema.String>;
47
+ readonly body: Schema.Unknown;
48
+ }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
49
+ "@distilled.cloud/error/categories": {
50
+ ServerError: true;
51
+ };
52
+ });
53
+ /**
54
+ * Unknown Vercel error — returned when a failed response's HTTP status has no
55
+ * mapped error class. Carries the raw body for later cataloging.
56
+ */
57
+ export declare class UnknownVercelError extends UnknownVercelError_base {
58
+ }
59
+ declare const VercelParseError_base: Schema.Class<VercelParseError, Schema.TaggedStruct<"VercelParseError", {
60
+ readonly body: Schema.Unknown;
61
+ readonly cause: Schema.Unknown;
62
+ }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
63
+ "@distilled.cloud/error/categories": {
64
+ ParseError: true;
65
+ };
66
+ });
67
+ /** Schema parse error wrapper. */
68
+ export declare class VercelParseError extends VercelParseError_base {
69
+ }
70
+ /**
71
+ * Errors any Vercel operation may surface in addition to the per-operation
72
+ * typed status errors.
73
+ */
74
+ export type ClientErrors = UnknownVercelError | VercelParseError | PaymentRequired | Gone;
75
+ /**
76
+ * Default Vercel operation errors: the shared HTTP status errors from core
77
+ * plus the client-level fallback/decode errors.
78
+ */
79
+ export type DefaultErrors = CoreDefaultErrors | ClientErrors;
80
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEvF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;;;;;AAGxC;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,oBAKN;CAAG;;;;;;;;AAElC;;;;;;;GAOG;AACH,qBAAa,IAAK,SAAQ,SAES;CAAG;;;;;;;;;;AAEtC;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,uBAOR;CAAG;;;;;;;;;AAEnC,kCAAkC;AAClC,qBAAa,gBAAiB,SAAQ,qBAMP;CAAG;AAElC;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,gBAAgB,GAChB,eAAe,GACf,IAAI,CAAC;AAET;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,YAAY,CAAC"}
package/lib/errors.js ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Vercel-specific error types.
3
+ *
4
+ * Re-exports the common HTTP errors from core and adds the two statuses
5
+ * Vercel uses that core's shared map has no entry for, plus the
6
+ * unknown-error and parse-error wrappers.
7
+ */
8
+ export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
9
+ import * as Schema from "effect/Schema";
10
+ import * as Category from "@distilled.cloud/core/category";
11
+ /**
12
+ * HTTP 402 — the account cannot be billed for the request: a missing payment
13
+ * method, an unpaid invoice, or a spend cap the team has already hit (Vercel
14
+ * pauses the account at the cap until an owner disables it). Declared on the
15
+ * ~95 operations that provision billable resources; the rest reach it through
16
+ * the protocol's status map.
17
+ */
18
+ export class PaymentRequired extends Schema.TaggedError()("PaymentRequired", {
19
+ message: Schema.String,
20
+ }).pipe(Category.withQuotaError) {
21
+ }
22
+ /**
23
+ * HTTP 410 — Vercel's "Invalid API version": the versioned path segment
24
+ * (`/v5/domains`, `/v9/projects`) is no longer served. The spec declares it on
25
+ * nearly every operation as boilerplate, so it rides the common error channel
26
+ * instead of every generated operation's error list — a 410 means the SDK's
27
+ * pinned path version was retired and needs a regeneration, not something a
28
+ * caller can branch on per operation.
29
+ */
30
+ export class Gone extends Schema.TaggedError()("Gone", {
31
+ message: Schema.String,
32
+ }).pipe(Category.withNotFoundError) {
33
+ }
34
+ /**
35
+ * Unknown Vercel error — returned when a failed response's HTTP status has no
36
+ * mapped error class. Carries the raw body for later cataloging.
37
+ */
38
+ export class UnknownVercelError extends Schema.TaggedError()("UnknownVercelError", {
39
+ code: Schema.optional(Schema.String),
40
+ message: Schema.optional(Schema.String),
41
+ body: Schema.Unknown,
42
+ }).pipe(Category.withServerError) {
43
+ }
44
+ /** Schema parse error wrapper. */
45
+ export class VercelParseError extends Schema.TaggedError()("VercelParseError", {
46
+ body: Schema.Unknown,
47
+ cause: Schema.Unknown,
48
+ }).pipe(Category.withParseError) {
49
+ }
50
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,gCAAgC,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,WAAW,EAAmB,CACxE,iBAAiB,EACjB;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;CAAG;AAElC;;;;;;;GAOG;AACH,MAAM,OAAO,IAAK,SAAQ,MAAM,CAAC,WAAW,EAAQ,CAAC,MAAM,EAAE;IAC3D,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC;CAAG;AAEtC;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,MAAM,CAAC,WAAW,EAAsB,CAC9E,oBAAoB,EACpB;IACE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC,OAAO;CACrB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;CAAG;AAEnC,kCAAkC;AAClC,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,WAAW,EAAoB,CAC1E,kBAAkB,EAClB;IACE,IAAI,EAAE,MAAM,CAAC,OAAO;IACpB,KAAK,EAAE,MAAM,CAAC,OAAO;CACtB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;CAAG"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @distilled.cloud/vercel — Vercel REST API SDK for Effect.
3
+ *
4
+ * `./services` is generated by `scripts/generate.ts` from the Smithy models in
5
+ * `.generated-specs` (written by `scripts/convert.ts` from the OpenAPI
6
+ * document `scripts/download-spec.ts` downloads into `specs/`). Everything
7
+ * else in this folder is hand-written.
8
+ */
9
+ export * from "./credentials.ts";
10
+ export * from "./errors.ts";
11
+ export * as T from "./traits.ts";
12
+ export { VercelProtocol, type VercelOpError, type VercelOpContext, } from "./protocol.ts";
13
+ export * as Retry from "./retry.ts";
14
+ export * as Services from "./services/index.ts";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @distilled.cloud/vercel — Vercel REST API SDK for Effect.
3
+ *
4
+ * `./services` is generated by `scripts/generate.ts` from the Smithy models in
5
+ * `.generated-specs` (written by `scripts/convert.ts` from the OpenAPI
6
+ * document `scripts/download-spec.ts` downloads into `specs/`). Everything
7
+ * else in this folder is hand-written.
8
+ */
9
+ export * from "./credentials.js";
10
+ export * from "./errors.js";
11
+ export * as T from "./traits.js";
12
+ export { VercelProtocol, } from "./protocol.js";
13
+ export * as Retry from "./retry.js";
14
+ export * as Services from "./services/index.js";
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,cAAc,GAGf,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type * as Layer from "effect/Layer";
2
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
3
+ import type * as HttpClientError from "effect/unstable/http/HttpClientError";
4
+ import type * as API from "@distilled.cloud/core/api";
5
+ import type { ConfigError } from "@distilled.cloud/core/errors";
6
+ import { Credentials } from "./credentials.ts";
7
+ import { type DefaultErrors } from "./errors.ts";
8
+ /**
9
+ * Error channel shared by every generated Vercel operation. Generated service
10
+ * files annotate operations with `API.OperationMethod<I, O, VercelOpError,
11
+ * VercelOpContext>` explicitly so the compiler never infers these back out of
12
+ * the schema generics.
13
+ */
14
+ export type VercelOpError = DefaultErrors | ConfigError | HttpClientError.HttpClientError;
15
+ /** Context (requirements) shared by every generated Vercel operation. */
16
+ export type VercelOpContext = Credentials | HttpClient.HttpClient;
17
+ export declare const VercelProtocol: Layer.Layer<API.Protocol>;
18
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,KAAK,UAAU,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,KAAK,eAAe,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAMhE,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACrB,aAAa,GACb,WAAW,GACX,eAAe,CAAC,eAAe,CAAC;AAEpC,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAkBlE,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAkCjD,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * VercelProtocol — the shared bearer-REST protocol instantiated for Vercel.
3
+ *
4
+ * Vercel speaks plain JSON with no success envelope: a list endpoint returns
5
+ * its collection object (`{ projects: [...], pagination: {...} }`), a single
6
+ * resource returns the object itself. FAILURES are enveloped, and uniformly
7
+ * so — `{ "error": { "code": "forbidden", "message": "Not authorized" } }` —
8
+ * with `code` a machine-readable string that error matchers can key on.
9
+ *
10
+ * The API version is part of the PATH (`/v9/projects`, `/v5/domains`), not a
11
+ * header, so each generated operation carries the version it was generated
12
+ * from; a retired version answers 410 (see `Gone` in errors.ts).
13
+ */
14
+ import * as Effect from "effect/Effect";
15
+ import * as Redacted from "effect/Redacted";
16
+ import { HTTP_STATUS_MAP } from "@distilled.cloud/core/errors";
17
+ import { makeRestProtocol, } from "@distilled.cloud/core/protocol-rest";
18
+ import { Credentials } from "./credentials.js";
19
+ import { Gone, PaymentRequired, UnknownVercelError, } from "./errors.js";
20
+ /**
21
+ * Vercel error bodies nest under `error`: `{ error: { code, message } }`.
22
+ * A handful of edge paths (proxy 502s, HTML error pages) answer without that
23
+ * envelope — those fall through to the protocol's `HTTP <status>` default.
24
+ */
25
+ const errorEnvelope = (body) => {
26
+ if (body === null || typeof body !== "object")
27
+ return undefined;
28
+ const err = body.error;
29
+ if (err === null || typeof err !== "object")
30
+ return undefined;
31
+ const e = err;
32
+ return {
33
+ code: typeof e.code === "string" ? e.code : undefined,
34
+ message: typeof e.message === "string" ? e.message : undefined,
35
+ };
36
+ };
37
+ export const VercelProtocol = makeRestProtocol({
38
+ // Resolved on the CALLING fiber per request (the layer is memoized per
39
+ // process); the Credentials service holds an effect, so a token rotated
40
+ // between calls is picked up without rebuilding the layer.
41
+ credentials: Effect.gen(function* () {
42
+ const resolve = yield* Credentials;
43
+ return yield* resolve;
44
+ }),
45
+ baseUrl: (creds) => creds.apiBaseUrl,
46
+ headers: (creds) => ({
47
+ Authorization: `Bearer ${Redacted.value(creds.token)}`,
48
+ }),
49
+ errorEnvelope,
50
+ // Core's shared map plus the two statuses Vercel uses that it doesn't
51
+ // cover: 402 (billing) and 410 (retired path version). Both are declared
52
+ // so broadly in the spec that leaving them unmapped would funnel routine
53
+ // failures into UnknownVercelError.
54
+ statusMap: {
55
+ ...HTTP_STATUS_MAP,
56
+ 402: PaymentRequired,
57
+ 410: Gone,
58
+ },
59
+ unknownError: ({ code, message, body }) => new UnknownVercelError({
60
+ code: typeof code === "string"
61
+ ? code
62
+ : code !== undefined
63
+ ? String(code)
64
+ : undefined,
65
+ message,
66
+ body,
67
+ }),
68
+ });
69
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAK5C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACL,gBAAgB,GAEjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EACL,IAAI,EACJ,eAAe,EACf,kBAAkB,GAEnB,MAAM,aAAa,CAAC;AAgBrB;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAC,IAAa,EAAiC,EAAE;IACrE,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChE,MAAM,GAAG,GAAI,IAAgC,CAAC,KAAK,CAAC;IACpD,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC9D,MAAM,CAAC,GAAG,GAA8B,CAAC;IACzC,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QACrD,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;KAC/D,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GACzB,gBAAgB,CAAS;IACvB,uEAAuE;IACvE,wEAAwE;IACxE,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC;QACnC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC;IACxB,CAAC,CAAC;IACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU;IACpC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACnB,aAAa,EAAE,UAAU,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;KACvD,CAAC;IACF,aAAa;IACb,sEAAsE;IACtE,yEAAyE;IACzE,yEAAyE;IACzE,oCAAoC;IACpC,SAAS,EAAE;QACT,GAAG,eAAe;QAClB,GAAG,EAAE,eAAe;QACpB,GAAG,EAAE,IAAI;KACV;IACD,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CACxC,IAAI,kBAAkB,CAAC;QACrB,IAAI,EACF,OAAO,IAAI,KAAK,QAAQ;YACtB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,IAAI,KAAK,SAAS;gBAClB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,SAAS;QACjB,OAAO;QACP,IAAI;KACL,CAAC;CACL,CAAC,CAAC"}
package/lib/retry.d.ts ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Vercel retry surface — a veneer over `@distilled.cloud/core/retry`.
3
+ *
4
+ * The `Retry` service tag is threaded into every generated operation via
5
+ * `API.make({ retry: Retry })`, so a caller-installed policy applies to all
6
+ * Vercel calls below it and core's `makeDefault` is the fallback when none is
7
+ * provided.
8
+ *
9
+ * Vercel answers a tripped rate limit with `429` plus `Retry-After`; the REST
10
+ * protocol stamps that onto the retryable error classes, and the default
11
+ * policy honors it ahead of its own backoff.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import * as Vercel from "@distilled.cloud/vercel";
16
+ *
17
+ * myEffect.pipe(Vercel.Retry.transient);
18
+ * ```
19
+ */
20
+ import * as Context from "effect/Context";
21
+ import * as Effect from "effect/Effect";
22
+ import * as Retries from "@distilled.cloud/core/retry";
23
+ export type Options = Retries.Options;
24
+ export type Factory = Retries.Factory;
25
+ export type Policy = Retries.Policy;
26
+ declare const Retry_base: Context.ServiceClass<Retry, "VercelRetry", Retries.Policy>;
27
+ /** Context tag for configuring retry behavior of Vercel API calls. */
28
+ export declare class Retry extends Retry_base {
29
+ }
30
+ /** Provides a custom retry policy to every Vercel API call below it. */
31
+ export declare const policy: {
32
+ (options: Options): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
33
+ (factory: Factory): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
34
+ };
35
+ /** Disables all automatic retries. */
36
+ export declare const none: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
37
+ /**
38
+ * The default retry policy (core's): transient/throttling/retryable errors,
39
+ * capped exponential backoff with jitter, server `retryAfter` hints honored
40
+ * with precedence.
41
+ */
42
+ export declare const makeDefault: Factory;
43
+ export declare const jittered: <Error, Env>(self: import("effect/Schedule").Schedule<unknown, unknown, Error, Env>) => import("effect/Schedule").Schedule<unknown, unknown, Error, Env>;
44
+ export declare const capped: (max: import("effect/Duration").Duration) => <Error, Env>(self: import("effect/Schedule").Schedule<unknown, unknown, Error, Env>) => import("effect/Schedule").Schedule<unknown, unknown, Error, Env>;
45
+ /** Retry options that retry all throttling errors indefinitely. */
46
+ export declare const throttlingOptions: Options;
47
+ /** Retries all throttling errors indefinitely (honoring server hints). */
48
+ export declare const throttling: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
49
+ /** Retry options that retry all transient errors indefinitely. */
50
+ export declare const transientOptions: Options;
51
+ /** Retries all transient errors indefinitely (honoring server hints). */
52
+ export declare const transient: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
53
+ export {};
54
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AAEvD,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACtC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACtC,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;;AAEpC,sEAAsE;AACtE,qBAAa,KAAM,SAAQ,UAA+C;CAAG;AAE7E,wEAAwE;AACxE,eAAO,MAAM,MAAM,EAAE;IACnB,CACE,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAC5C,CACE,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;CAEU,CAAC;AAEzD,sCAAsC;AACtC,eAAO,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACzB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAEzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,OAA6B,CAAC;AAExD,eAAO,MAAM,QAAQ,0JAAmB,CAAC;AACzC,eAAO,MAAM,MAAM,uMAAiB,CAAC;AAErC,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,EAAE,OAAmC,CAAC;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAqC,CAAC;AAEhF,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,EAAE,OAAkC,CAAC;AAElE,yEAAyE;AACzE,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAoC,CAAC"}