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

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 (230) hide show
  1. package/lib/credentials.d.ts +21 -0
  2. package/lib/credentials.d.ts.map +1 -0
  3. package/lib/credentials.js +40 -0
  4. package/lib/credentials.js.map +1 -0
  5. package/lib/errors.d.ts +80 -0
  6. package/lib/errors.d.ts.map +1 -0
  7. package/lib/errors.js +50 -0
  8. package/lib/errors.js.map +1 -0
  9. package/lib/index.d.ts +15 -0
  10. package/lib/index.d.ts.map +1 -0
  11. package/lib/index.js +15 -0
  12. package/lib/index.js.map +1 -0
  13. package/lib/protocol.d.ts +18 -0
  14. package/lib/protocol.d.ts.map +1 -0
  15. package/lib/protocol.js +69 -0
  16. package/lib/protocol.js.map +1 -0
  17. package/lib/retry.d.ts +54 -0
  18. package/lib/retry.d.ts.map +1 -0
  19. package/lib/retry.js +47 -0
  20. package/lib/retry.js.map +1 -0
  21. package/lib/services/access_groups.d.ts +459 -0
  22. package/lib/services/access_groups.d.ts.map +1 -0
  23. package/lib/services/access_groups.js +453 -0
  24. package/lib/services/access_groups.js.map +1 -0
  25. package/lib/services/ai_gateway.d.ts +124 -0
  26. package/lib/services/ai_gateway.d.ts.map +1 -0
  27. package/lib/services/ai_gateway.js +126 -0
  28. package/lib/services/ai_gateway.js.map +1 -0
  29. package/lib/services/aliases.d.ts +591 -0
  30. package/lib/services/aliases.d.ts.map +1 -0
  31. package/lib/services/aliases.js +508 -0
  32. package/lib/services/aliases.js.map +1 -0
  33. package/lib/services/artifacts.d.ts +228 -0
  34. package/lib/services/artifacts.d.ts.map +1 -0
  35. package/lib/services/artifacts.js +216 -0
  36. package/lib/services/artifacts.js.map +1 -0
  37. package/lib/services/authentication.d.ts +373 -0
  38. package/lib/services/authentication.d.ts.map +1 -0
  39. package/lib/services/authentication.js +310 -0
  40. package/lib/services/authentication.js.map +1 -0
  41. package/lib/services/billing.d.ts +792 -0
  42. package/lib/services/billing.d.ts.map +1 -0
  43. package/lib/services/billing.js +616 -0
  44. package/lib/services/billing.js.map +1 -0
  45. package/lib/services/bulk_redirects.d.ts +308 -0
  46. package/lib/services/bulk_redirects.d.ts.map +1 -0
  47. package/lib/services/bulk_redirects.js +306 -0
  48. package/lib/services/bulk_redirects.js.map +1 -0
  49. package/lib/services/certs.d.ts +171 -0
  50. package/lib/services/certs.d.ts.map +1 -0
  51. package/lib/services/certs.js +165 -0
  52. package/lib/services/certs.js.map +1 -0
  53. package/lib/services/checks_v2.d.ts +1162 -0
  54. package/lib/services/checks_v2.d.ts.map +1 -0
  55. package/lib/services/checks_v2.js +1252 -0
  56. package/lib/services/checks_v2.js.map +1 -0
  57. package/lib/services/connect.d.ts +1034 -0
  58. package/lib/services/connect.d.ts.map +1 -0
  59. package/lib/services/connect.js +993 -0
  60. package/lib/services/connect.js.map +1 -0
  61. package/lib/services/deployments.d.ts +9111 -0
  62. package/lib/services/deployments.d.ts.map +1 -0
  63. package/lib/services/deployments.js +8664 -0
  64. package/lib/services/deployments.js.map +1 -0
  65. package/lib/services/dns.d.ts +279 -0
  66. package/lib/services/dns.d.ts.map +1 -0
  67. package/lib/services/dns.js +282 -0
  68. package/lib/services/dns.js.map +1 -0
  69. package/lib/services/domains.d.ts +539 -0
  70. package/lib/services/domains.d.ts.map +1 -0
  71. package/lib/services/domains.js +464 -0
  72. package/lib/services/domains.js.map +1 -0
  73. package/lib/services/domains_registrar.d.ts +798 -0
  74. package/lib/services/domains_registrar.d.ts.map +1 -0
  75. package/lib/services/domains_registrar.js +968 -0
  76. package/lib/services/domains_registrar.js.map +1 -0
  77. package/lib/services/drains.d.ts +2263 -0
  78. package/lib/services/drains.d.ts.map +1 -0
  79. package/lib/services/drains.js +2406 -0
  80. package/lib/services/drains.js.map +1 -0
  81. package/lib/services/edge_cache.d.ts +125 -0
  82. package/lib/services/edge_cache.d.ts.map +1 -0
  83. package/lib/services/edge_cache.js +140 -0
  84. package/lib/services/edge_cache.js.map +1 -0
  85. package/lib/services/environment.d.ts +1020 -0
  86. package/lib/services/environment.d.ts.map +1 -0
  87. package/lib/services/environment.js +842 -0
  88. package/lib/services/environment.js.map +1 -0
  89. package/lib/services/feature_flags.d.ts +3109 -0
  90. package/lib/services/feature_flags.d.ts.map +1 -0
  91. package/lib/services/feature_flags.js +3074 -0
  92. package/lib/services/feature_flags.js.map +1 -0
  93. package/lib/services/global_config.d.ts +618 -0
  94. package/lib/services/global_config.d.ts.map +1 -0
  95. package/lib/services/global_config.js +716 -0
  96. package/lib/services/global_config.js.map +1 -0
  97. package/lib/services/index.d.ts +39 -0
  98. package/lib/services/index.d.ts.map +1 -0
  99. package/lib/services/index.js +40 -0
  100. package/lib/services/index.js.map +1 -0
  101. package/lib/services/integrations.d.ts +2987 -0
  102. package/lib/services/integrations.d.ts.map +1 -0
  103. package/lib/services/integrations.js +2903 -0
  104. package/lib/services/integrations.js.map +1 -0
  105. package/lib/services/log_drains.d.ts +848 -0
  106. package/lib/services/log_drains.d.ts.map +1 -0
  107. package/lib/services/log_drains.js +866 -0
  108. package/lib/services/log_drains.js.map +1 -0
  109. package/lib/services/logs.d.ts +40 -0
  110. package/lib/services/logs.d.ts.map +1 -0
  111. package/lib/services/logs.js +43 -0
  112. package/lib/services/logs.js.map +1 -0
  113. package/lib/services/marketplace.d.ts +991 -0
  114. package/lib/services/marketplace.d.ts.map +1 -0
  115. package/lib/services/marketplace.js +1044 -0
  116. package/lib/services/marketplace.js.map +1 -0
  117. package/lib/services/microfrontends.d.ts +3210 -0
  118. package/lib/services/microfrontends.d.ts.map +1 -0
  119. package/lib/services/microfrontends.js +3300 -0
  120. package/lib/services/microfrontends.js.map +1 -0
  121. package/lib/services/networking.d.ts +239 -0
  122. package/lib/services/networking.d.ts.map +1 -0
  123. package/lib/services/networking.js +224 -0
  124. package/lib/services/networking.js.map +1 -0
  125. package/lib/services/observability.d.ts +168 -0
  126. package/lib/services/observability.d.ts.map +1 -0
  127. package/lib/services/observability.js +191 -0
  128. package/lib/services/observability.js.map +1 -0
  129. package/lib/services/project_members.d.ts +142 -0
  130. package/lib/services/project_members.d.ts.map +1 -0
  131. package/lib/services/project_members.js +139 -0
  132. package/lib/services/project_members.js.map +1 -0
  133. package/lib/services/project_routes.d.ts +1990 -0
  134. package/lib/services/project_routes.d.ts.map +1 -0
  135. package/lib/services/project_routes.js +2026 -0
  136. package/lib/services/project_routes.js.map +1 -0
  137. package/lib/services/projects.d.ts +23449 -0
  138. package/lib/services/projects.d.ts.map +1 -0
  139. package/lib/services/projects.js +23570 -0
  140. package/lib/services/projects.js.map +1 -0
  141. package/lib/services/rolling_release.d.ts +764 -0
  142. package/lib/services/rolling_release.d.ts.map +1 -0
  143. package/lib/services/rolling_release.js +630 -0
  144. package/lib/services/rolling_release.js.map +1 -0
  145. package/lib/services/sandboxes.d.ts +2183 -0
  146. package/lib/services/sandboxes.d.ts.map +1 -0
  147. package/lib/services/sandboxes.js +1756 -0
  148. package/lib/services/sandboxes.js.map +1 -0
  149. package/lib/services/security.d.ts +3932 -0
  150. package/lib/services/security.d.ts.map +1 -0
  151. package/lib/services/security.js +4411 -0
  152. package/lib/services/security.js.map +1 -0
  153. package/lib/services/storage.d.ts +251 -0
  154. package/lib/services/storage.d.ts.map +1 -0
  155. package/lib/services/storage.js +270 -0
  156. package/lib/services/storage.js.map +1 -0
  157. package/lib/services/teams.d.ts +1577 -0
  158. package/lib/services/teams.d.ts.map +1 -0
  159. package/lib/services/teams.js +1359 -0
  160. package/lib/services/teams.js.map +1 -0
  161. package/lib/services/user.d.ts +7972 -0
  162. package/lib/services/user.d.ts.map +1 -0
  163. package/lib/services/user.js +7093 -0
  164. package/lib/services/user.js.map +1 -0
  165. package/lib/services/vcr.d.ts +793 -0
  166. package/lib/services/vcr.d.ts.map +1 -0
  167. package/lib/services/vcr.js +882 -0
  168. package/lib/services/vcr.js.map +1 -0
  169. package/lib/services/web_analytics.d.ts +694 -0
  170. package/lib/services/web_analytics.d.ts.map +1 -0
  171. package/lib/services/web_analytics.js +695 -0
  172. package/lib/services/web_analytics.js.map +1 -0
  173. package/lib/services/webhooks.d.ts +207 -0
  174. package/lib/services/webhooks.d.ts.map +1 -0
  175. package/lib/services/webhooks.js +171 -0
  176. package/lib/services/webhooks.js.map +1 -0
  177. package/lib/traits.d.ts +10 -0
  178. package/lib/traits.d.ts.map +1 -0
  179. package/lib/traits.js +11 -0
  180. package/lib/traits.js.map +1 -0
  181. package/package.json +77 -7
  182. package/src/credentials.ts +70 -0
  183. package/src/errors.ts +93 -0
  184. package/src/index.ts +18 -0
  185. package/src/protocol.ts +98 -0
  186. package/src/retry.ts +78 -0
  187. package/src/services/access_groups.ts +1165 -0
  188. package/src/services/ai_gateway.ts +272 -0
  189. package/src/services/aliases.ts +1323 -0
  190. package/src/services/artifacts.ts +542 -0
  191. package/src/services/authentication.ts +829 -0
  192. package/src/services/billing.ts +1776 -0
  193. package/src/services/bulk_redirects.ts +748 -0
  194. package/src/services/certs.ts +377 -0
  195. package/src/services/checks_v2.ts +3136 -0
  196. package/src/services/connect.ts +2607 -0
  197. package/src/services/deployments.ts +23682 -0
  198. package/src/services/dns.ts +718 -0
  199. package/src/services/domains.ts +1209 -0
  200. package/src/services/domains_registrar.ts +2290 -0
  201. package/src/services/drains.ts +5989 -0
  202. package/src/services/edge_cache.ts +303 -0
  203. package/src/services/environment.ts +2388 -0
  204. package/src/services/feature_flags.ts +8302 -0
  205. package/src/services/global_config.ts +1668 -0
  206. package/src/services/index.ts +39 -0
  207. package/src/services/integrations.ts +8846 -0
  208. package/src/services/log_drains.ts +2413 -0
  209. package/src/services/logs.ts +78 -0
  210. package/src/services/marketplace.ts +2626 -0
  211. package/src/services/microfrontends.ts +9650 -0
  212. package/src/services/networking.ts +530 -0
  213. package/src/services/observability.ts +436 -0
  214. package/src/services/project_members.ts +328 -0
  215. package/src/services/project_routes.ts +5259 -0
  216. package/src/services/projects.ts +67377 -0
  217. package/src/services/rolling_release.ts +1869 -0
  218. package/src/services/sandboxes.ts +5259 -0
  219. package/src/services/security.ts +12408 -0
  220. package/src/services/storage.ts +849 -0
  221. package/src/services/teams.ts +3995 -0
  222. package/src/services/user.ts +21687 -0
  223. package/src/services/vcr.ts +2165 -0
  224. package/src/services/web_analytics.ts +1570 -0
  225. package/src/services/webhooks.ts +1073 -0
  226. package/src/traits.ts +44 -0
  227. package/README.md +0 -15
  228. package/bun.lock +0 -26
  229. package/index.ts +0 -1
  230. package/tsconfig.json +0 -29
@@ -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
+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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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zE,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,OAA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U,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"}
package/lib/retry.js ADDED
@@ -0,0 +1,47 @@
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 Layer from "effect/Layer";
23
+ import * as Retries from "@distilled.cloud/core/retry";
24
+ /** Context tag for configuring retry behavior of Vercel API calls. */
25
+ export class Retry extends Context.Service()("VercelRetry") {
26
+ }
27
+ /** Provides a custom retry policy to every Vercel API call below it. */
28
+ export const policy = (optionsOrFactory) => Effect.provide(Layer.succeed(Retry, optionsOrFactory));
29
+ /** Disables all automatic retries. */
30
+ export const none = Effect.provide(Layer.succeed(Retry, { while: () => false }));
31
+ /**
32
+ * The default retry policy (core's): transient/throttling/retryable errors,
33
+ * capped exponential backoff with jitter, server `retryAfter` hints honored
34
+ * with precedence.
35
+ */
36
+ export const makeDefault = Retries.makeDefault;
37
+ export const jittered = Retries.jittered;
38
+ export const capped = Retries.capped;
39
+ /** Retry options that retry all throttling errors indefinitely. */
40
+ export const throttlingOptions = Retries.throttlingOptions;
41
+ /** Retries all throttling errors indefinitely (honoring server hints). */
42
+ export const throttling = policy(Retries.throttlingFactory);
43
+ /** Retry options that retry all transient errors indefinitely. */
44
+ export const transientOptions = Retries.transientOptions;
45
+ /** Retries all transient errors indefinitely (honoring server hints). */
46
+ export const transient = policy(Retries.transientFactory);
47
+ //# sourceMappingURL=retry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AAMvD,sEAAsE;AACtE,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,OAAO,EAAiB,CAAC,aAAa,CAAC;CAAG;AAE7E,wEAAwE;AACxE,MAAM,CAAC,MAAM,MAAM,GAWf,CAAC,gBAAmC,EAAE,EAAE,CAC1C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEzD,sCAAsC;AACtC,MAAM,CAAC,MAAM,IAAI,GAE6B,MAAM,CAAC,OAAO,CAC1D,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAA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