@distilled.cloud/zendesk 1.0.0-rc.16 → 1.0.0-rc.17

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.
package/lib/.lazy.json ADDED
@@ -0,0 +1 @@
1
+ {"serviceDirs":["services"],"twins":["index.js"]}
@@ -0,0 +1,4 @@
1
+ import*as $0 from"./sdk.js";
2
+ import{api$lazyService as L}from"@distilled.cloud/core/_bundle/base";
3
+ const u=import.meta.url,N=[$0];
4
+ export const $L=(s,k,a,l,x)=>L(u,s,k,a===void 0?void 0:x?N.concat(x):N,a,l);
@@ -0,0 +1,2 @@
1
+ import{errors$API_ERRORS as e,errors$BadGateway as t,errors$BadRequest as n,errors$ConfigError as r,errors$Conflict as i,errors$DEFAULT_ERRORS as a,errors$Forbidden as o,errors$GatewayTimeout as s,errors$HTTP_STATUS_MAP as c,errors$InternalServerError as l,errors$Locked as u,errors$NotFound as ee,errors$ServiceUnavailable as te,errors$TooManyRequests as ne,errors$Unauthorized as re,errors$UnprocessableEntity as ie,protocol_rest$RawResponse as ae,protocol_rest$RawResponseRoot as oe,protocol_rest$SensitiveValue as d,protocol_rest$makeRestProtocol as f,protocol_rest$rawResponseRootSymbol as p,protocol_rest$rawResponseSymbol as m,protocol_rest$sensitiveValueSymbol as h,schema_lite$Array as g,schema_lite$Boolean as _,schema_lite$NullOr as v,schema_lite$Number as y,schema_lite$Record as b,schema_lite$String as x,schema_lite$Struct as S,schema_lite$TaggedError as C,schema_lite$Unknown as w,schema_lite$at as T,schema_lite$optional as E,schema_lite$suspend as D}from"@distilled.cloud/core/_bundle/rest";import{api$D as O,api$call as k,api$error as A,api$named as j,api$newError as M,api$op as N,api$opPaginated as P,category$withAuthError as F,category$withBadRequestError as I,category$withConflictError as L,category$withParseError as R,category$withServerError as z,pagination$paginateCursor as B,pagination$paginatePageNumber as V,retry$capped as H,retry$jittered as U,retry$makeDefault as W,retry$throttlingFactory as G,retry$throttlingOptions as K,retry$transientFactory as q,retry$transientOptions as se,trait$Body as ce,trait$FormDataFile as le,trait$Header as ue,trait$Http as de,trait$HttpBody as fe,trait$KeyDictionary as pe,trait$Label as me,trait$Query as he,trait$ResponseCode as ge,trait$UnionCases as _e,trait$applyErrorMatchers as ve,trait$bodySymbol as ye,trait$errorMatchersSymbol as be,trait$formDataFileSymbol as xe,trait$getErrorMatchers as Se,trait$headerSymbol as Ce,trait$httpBodySymbol as we,trait$httpSymbol as Te,trait$keyDictionarySymbol as Ee,trait$labelSymbol as De,trait$querySymbol as Oe,trait$responseCodeSymbol as ke,trait$unionCasesSymbol as Ae}from"@distilled.cloud/core/_bundle/base";import*as J from"effect/Context";import*as Y from"effect/Effect";import*as X from"effect/Layer";import*as Z from"effect/Redacted";import*as Q from"@distilled.cloud/core/schema-lite-typed";var Credentials=class extends (/*@__PURE__*/ J.Service()(`ZendeskCredentials`)){};const stripTrailingSlash=e=>e.replace(/\/+$/,``);const originFromSubdomain=e=>{const t=e.trim().replace(/^https?:\/\//,``).replace(/\/+$/,``);if(t.includes(`.`))return`https://${t}`;return`https://${t}.zendesk.com`};const basicToken=(e,t)=>Z.make(`Basic ${btoa(`${e}/token:${Z.value(t)}`)}`);const bearerToken=e=>Z.make(`Bearer ${Z.value(e)}`);const resolveBaseUrl=e=>{if(e.apiBaseUrl)return stripTrailingSlash(e.apiBaseUrl);if(e.subdomain)return originFromSubdomain(e.subdomain);throw new Error(`subdomain or apiBaseUrl is required`)};const fromApiToken=e=>X.succeed(Credentials,Y.succeed({authorization:basicToken(e.email,e.apiToken),apiBaseUrl:resolveBaseUrl(e)}));const fromAccessToken=e=>X.succeed(Credentials,Y.succeed({authorization:bearerToken(e.accessToken),apiBaseUrl:resolveBaseUrl(e)}));const $=/*@__PURE__*/ X.succeed(Credentials,/*@__PURE__*/ Y.gen(function*(){const e=process.env.ZENDESK_SUBDOMAIN;const t=process.env.ZENDESK_API_BASE_URL;const n=process.env.ZENDESK_EMAIL;const i=process.env.ZENDESK_API_TOKEN;const a=i?Z.make(i):void 0;const o=process.env.ZENDESK_ACCESS_TOKEN;const s=o?Z.make(o):void 0;if(!e&&!t)return yield*new r({message:`ZENDESK_SUBDOMAIN (or ZENDESK_API_BASE_URL) environment variable is required`});const c=t?stripTrailingSlash(t):originFromSubdomain(e);if(s)return{authorization:bearerToken(s),apiBaseUrl:c};if(!n||!a)return yield*new r({message:`ZENDESK_EMAIL and ZENDESK_API_TOKEN (or ZENDESK_ACCESS_TOKEN) environment variables are required`});return{authorization:basicToken(n,a),apiBaseUrl:c}}).pipe(Y.orDie));var UnknownZendeskError=class extends (/*@__PURE__*/ Q.TaggedError()(`UnknownZendeskError`,{code:/*@__PURE__*/ Q.optional(Q.String),message:/*@__PURE__*/ Q.optional(Q.String),body:Q.Unknown}).pipe(z)){};var ZendeskParseError=class extends (/*@__PURE__*/ Q.TaggedError()(`ZendeskParseError`,{body:Q.Unknown,cause:Q.Unknown}).pipe(R)){};const errorEnvelope=e=>{if(e===null||typeof e!==`object`)return void 0;const t=e;const n=typeof t.error===`string`?t.error:typeof t.code===`string`||typeof t.code===`number`?t.code:void 0;const r=typeof t.description===`string`?t.description:typeof t.message===`string`?t.message:typeof t.error===`string`?t.error:void 0;if(n===void 0&&r===void 0)return void 0;return{code:n,message:r}};const je=/*@__PURE__*/ f({credentials:/*@__PURE__*/ Y.flatMap(Credentials,e=>e),baseUrl:e=>e.apiBaseUrl,headers:e=>({Authorization:Z.value(e.authorization),Accept:`application/json`}),errorEnvelope,unknownError:({code:e,message:t,body:n})=>new UnknownZendeskError({code:typeof e===`string`?e:e!==void 0?String(e):void 0,message:t,body:n}),parseError:({body:e,cause:t})=>new ZendeskParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ J.Service()(`ZendeskRetry`)){};const policy=e=>Y.provide(X.succeed(Retry,e));const Me=/*@__PURE__*/ Y.provide(/*@__PURE__*/ X.succeed(Retry,{while:()=>false}));const Ne=/*@__PURE__*/ policy(G);const Pe=/*@__PURE__*/ policy(q);export{L as S,M as _,b as a,F as b,C as c,Credentials as credentials$Credentials,$ as credentials$CredentialsFromEnv,fromAccessToken as credentials$fromAccessToken,fromApiToken as credentials$fromApiToken,originFromSubdomain as credentials$originFromSubdomain,E as d,e as errors$API_ERRORS,t as errors$BadGateway,n as errors$BadRequest,r as errors$ConfigError,i as errors$Conflict,a as errors$DEFAULT_ERRORS,o as errors$Forbidden,s as errors$GatewayTimeout,c as errors$HTTP_STATUS_MAP,l as errors$InternalServerError,u as errors$Locked,ee as errors$NotFound,te as errors$ServiceUnavailable,ne as errors$TooManyRequests,re as errors$Unauthorized,UnknownZendeskError as errors$UnknownZendeskError,ie as errors$UnprocessableEntity,ZendeskParseError as errors$ZendeskParseError,D as f,j as g,A as h,y as i,w as l,k as m,_ as n,x as o,O as p,B as pagination$paginateCursor,V as pagination$paginatePageNumber,je as protocol$ZendeskProtocol,v as r,Retry as retry$Retry,H as retry$capped,U as retry$jittered,W as retry$makeDefault,Me as retry$none,policy as retry$policy,Ne as retry$throttling,G as retry$throttlingFactory,K as retry$throttlingOptions,Pe as retry$transient,q as retry$transientFactory,se as retry$transientOptions,S as s,g as t,ce as traits$Body,le as traits$FormDataFile,ue as traits$Header,de as traits$Http,fe as traits$HttpBody,pe as traits$KeyDictionary,me as traits$Label,he as traits$Query,ae as traits$RawResponse,oe as traits$RawResponseRoot,ge as traits$ResponseCode,d as traits$SensitiveValue,_e as traits$UnionCases,ve as traits$applyErrorMatchers,ye as traits$bodySymbol,be as traits$errorMatchersSymbol,xe as traits$formDataFileSymbol,Se as traits$getErrorMatchers,Ce as traits$headerSymbol,we as traits$httpBodySymbol,Te as traits$httpSymbol,Ee as traits$keyDictionarySymbol,De as traits$labelSymbol,Oe as traits$querySymbol,p as traits$rawResponseRootSymbol,m as traits$rawResponseSymbol,ke as traits$responseCodeSymbol,h as traits$sensitiveValueSymbol,Ae as traits$unionCasesSymbol,T as u,N as v,I as x,P as y};
2
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","names":["Category.withServerError","Category.withParseError","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","Locked","NotFound","ServiceUnavailable","TooManyRequests","Unauthorized","UnprocessableEntity","RawResponse","RawResponseRoot","SensitiveValue","makeRestProtocol","rawResponseRootSymbol","rawResponseSymbol","sensitiveValueSymbol","Array","Boolean","NullOr","Number","Record","String$1","Struct","TaggedError","Unknown","at","optional","suspend","D","call","error","named","newError","op","opPaginated","withAuthError","withBadRequestError","withConflictError","withParseError","withServerError","paginateCursor","paginatePageNumber","capped","jittered","makeDefault","throttlingFactory","throttlingOptions","transientFactory","transientOptions","Body","FormDataFile","Header","Http","HttpBody","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","errorMatchersSymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","Context","Effect","Layer","Redacted","Schema","url","host","subdomain","email","apiToken","accessToken","config","CredentialsFromEnv","apiBaseUrl","apiTokenEnv","accessTokenEnv","origin","body","b","code","message","ZendeskProtocol","resolve","creds","optionsOrFactory","none","throttling","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"2wEAyBA,IAAa,YAAb,eACwB,gBAAQ,QAA4C,CAAC,CACzE,oBACF,EAAA,AAAE,CAAC,EAEL,MAAM,mBAAsB,GAAwBsF,EAAI,QAAQ,OAAQ,EAAE,EAG1E,MAAa,oBAAuB,GAA8B,CAChE,MAAMC,EAAOC,EACV,KAAK,CAAC,CACN,QAAQ,eAAgB,EAAE,CAAC,CAC3B,QAAQ,OAAQ,EAAE,EACrB,GAAID,EAAK,SAAS,GAAG,EAAG,MAAO,WAAWA,IAC1C,MAAO,WAAWA,EAAK,aACzB,EAEA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,KAAM,OAAOJ,IAAS,SAAWA,EAAOA,IAAS,IAAA,GAAY,OAAOA,CAAI,EAAI,IAAA,GAC5E,UACA,MACF,CAAC,EACH,YAAa,CAAE,OAAM,WAAY,IAAI,kBAAkB,CAAE,OAAM,OAAM,CAAC,CACxE,CAAC,ECpDD,IAAa,MAAb,eAAyC,gBAAQ,QAAuB,CAAC,CAAC,cAAc,EAAA,AAAE,CAAC,EAG3F,MAAa,OAAU,GACrBlB,EAAO,QAAQC,EAAM,QAAQ,MAAOsB,CAAgB,CAAC,EAGvD,MAAaC,GAAqB,gBAAO,QACzB,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAGA,MAAaC,GAA2B,qBAAOrD,CAAiB,EAGhE,MAAasD,GAA0B,qBAAOpD,CAAgB"}
@@ -1,87 +1 @@
1
- import { ConfigError } from "@distilled.cloud/core/errors";
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
- import * as Context from "effect/Context";
17
- import * as Effect from "effect/Effect";
18
- import * as Layer from "effect/Layer";
19
- import * as Redacted from "effect/Redacted";
20
- export class Credentials extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("ZendeskCredentials") {
21
- }
22
- const stripTrailingSlash = (url) => url.replace(/\/+$/, "");
23
-
24
- export const originFromSubdomain = (subdomain) => {
25
- const host = subdomain
26
- .trim()
27
- .replace(/^https?:\/\//, "")
28
- .replace(/\/+$/, "");
29
- if (host.includes("."))
30
- return `https://${host}`;
31
- return `https://${host}.zendesk.com`;
32
- };
33
- const basicToken = (email, apiToken) => Redacted.make(`Basic ${btoa(`${email}/token:${Redacted.value(apiToken)}`)}`);
34
- const bearerToken = (accessToken) => Redacted.make(`Bearer ${Redacted.value(accessToken)}`);
35
- const resolveBaseUrl = (config) => {
36
- if (config.apiBaseUrl)
37
- return stripTrailingSlash(config.apiBaseUrl);
38
- if (config.subdomain)
39
- return originFromSubdomain(config.subdomain);
40
- throw new Error("subdomain or apiBaseUrl is required");
41
- };
42
-
43
- export const fromApiToken = (config) => Layer.succeed(Credentials, Effect.succeed({
44
- authorization: basicToken(config.email, config.apiToken),
45
- apiBaseUrl: resolveBaseUrl(config),
46
- }));
47
-
48
- export const fromAccessToken = (config) => Layer.succeed(Credentials, Effect.succeed({
49
- authorization: bearerToken(config.accessToken),
50
- apiBaseUrl: resolveBaseUrl(config),
51
- }));
52
-
53
-
54
-
55
-
56
- export const CredentialsFromEnv = /*@__PURE__*/ Layer.succeed(Credentials,
57
- /*@__PURE__*/ Effect.gen(function* () {
58
- const subdomain = process.env.ZENDESK_SUBDOMAIN;
59
- const apiBaseUrl = process.env.ZENDESK_API_BASE_URL;
60
- const email = process.env.ZENDESK_EMAIL;
61
- const apiTokenEnv = process.env.ZENDESK_API_TOKEN;
62
- const apiToken = apiTokenEnv ? Redacted.make(apiTokenEnv) : undefined;
63
- const accessTokenEnv = process.env.ZENDESK_ACCESS_TOKEN;
64
- const accessToken = accessTokenEnv ? Redacted.make(accessTokenEnv) : undefined;
65
- if (!subdomain && !apiBaseUrl) {
66
- return yield* new ConfigError({
67
- message: "ZENDESK_SUBDOMAIN (or ZENDESK_API_BASE_URL) environment variable is required",
68
- });
69
- }
70
- const origin = apiBaseUrl ? stripTrailingSlash(apiBaseUrl) : originFromSubdomain(subdomain);
71
- if (accessToken) {
72
- return {
73
- authorization: bearerToken(accessToken),
74
- apiBaseUrl: origin,
75
- };
76
- }
77
- if (!email || !apiToken) {
78
- return yield* new ConfigError({
79
- message: "ZENDESK_EMAIL and ZENDESK_API_TOKEN (or ZENDESK_ACCESS_TOKEN) environment variables are required",
80
- });
81
- }
82
- return {
83
- authorization: basicToken(email, apiToken),
84
- apiBaseUrl: origin,
85
- };
86
- }).pipe(Effect.orDie));
87
- //# sourceMappingURL=credentials.js.map
1
+ export { credentials$Credentials as Credentials, credentials$CredentialsFromEnv as CredentialsFromEnv, credentials$fromAccessToken as fromAccessToken, credentials$fromApiToken as fromApiToken, credentials$originFromSubdomain as originFromSubdomain } from "./_bundle/sdk.js";
package/lib/errors.js CHANGED
@@ -1,26 +1 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
- 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";
11
- import * as Category from "@distilled.cloud/core/category";
12
- import * as Schema from "@distilled.cloud/core/schema-lite-typed";
13
-
14
- export class UnknownZendeskError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("UnknownZendeskError", {
15
- code: /*@__PURE__*/ Schema.optional(Schema.String),
16
- message: /*@__PURE__*/ Schema.optional(Schema.String),
17
- body: Schema.Unknown,
18
- }).pipe(Category.withServerError) {
19
- }
20
-
21
- export class ZendeskParseError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("ZendeskParseError", {
22
- body: Schema.Unknown,
23
- cause: Schema.Unknown,
24
- }).pipe(Category.withParseError) {
25
- }
26
- //# sourceMappingURL=errors.js.map
1
+ export { errors$API_ERRORS as API_ERRORS, errors$BadGateway as BadGateway, errors$BadRequest as BadRequest, errors$ConfigError as ConfigError, errors$Conflict as Conflict, errors$DEFAULT_ERRORS as DEFAULT_ERRORS, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$Locked as Locked, errors$NotFound as NotFound, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownZendeskError as UnknownZendeskError, errors$UnprocessableEntity as UnprocessableEntity, errors$ZendeskParseError as ZendeskParseError } from "./_bundle/sdk.js";
package/lib/index.js CHANGED
@@ -1,17 +1,3 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
1
  export * from "./credentials.js";
16
2
  export * from "./errors.js";
17
3
  export * as T from "./traits.js";
@@ -19,10 +5,5 @@ export { ZendeskProtocol } from "./protocol.js";
19
5
  export { paginateCursor, paginatePageNumber } from "./pagination.js";
20
6
  export * as Retry from "./retry.js";
21
7
  export * as Services from "./services/index.js";
22
- // Operations (and their request/response types) are importable straight off
23
- // the package root. The service-local typed error classes shadow the
24
- // same-named shared ones from ./errors.ts -- the ops actually raise the
25
- // service-local classes.
26
8
  export * from "./services/zendesk.js";
27
- export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity, } from "./services/zendesk.js";
28
- //# sourceMappingURL=index.js.map
9
+ export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity } from "./services/zendesk.js";
@@ -0,0 +1,9 @@
1
+ export * from "./credentials.js";
2
+ export * from "./errors.js";
3
+ export * as T from "./traits.js";
4
+ export { ZendeskProtocol } from "./protocol.js";
5
+ export { paginateCursor, paginatePageNumber } from "./pagination.js";
6
+ export * as Retry from "./retry.js";
7
+ export * as Services from "./services.lazy/index.js";
8
+ export * from "./services.lazy/zendesk.js";
9
+ export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity } from "./services.lazy/zendesk.js";
package/lib/pagination.js CHANGED
@@ -1,10 +1 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
- export { paginateCursor, paginatePageNumber } from "@distilled.cloud/core/pagination";
10
- //# sourceMappingURL=pagination.js.map
1
+ export { pagination$paginateCursor as paginateCursor, pagination$paginatePageNumber as paginatePageNumber } from "./_bundle/sdk.js";
package/lib/protocol.js CHANGED
@@ -1,64 +1 @@
1
- import { makeRestProtocol } from "@distilled.cloud/core/protocol-rest";
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
- import * as Effect from "effect/Effect";
19
- import * as Redacted from "effect/Redacted";
20
- import { Credentials } from "./credentials.js";
21
- import { UnknownZendeskError, ZendeskParseError } from "./errors.js";
22
-
23
-
24
-
25
-
26
-
27
- const errorEnvelope = (body) => {
28
- if (body === null || typeof body !== "object")
29
- return undefined;
30
- const b = body;
31
- const code = typeof b.error === "string"
32
- ? b.error
33
- : typeof b.code === "string" || typeof b.code === "number"
34
- ? b.code
35
- : undefined;
36
- const message = typeof b.description === "string"
37
- ? b.description
38
- : typeof b.message === "string"
39
- ? b.message
40
- : typeof b.error === "string"
41
- ? b.error
42
- : undefined;
43
- if (code === undefined && message === undefined)
44
- return undefined;
45
- return { code, message };
46
- };
47
- export const ZendeskProtocol = /*@__PURE__*/ makeRestProtocol({
48
- // The Credentials service holds an effect -- resolving it here (per
49
- // request, on the calling fiber) picks up context-provided credentials.
50
- credentials: /*@__PURE__*/ Effect.flatMap(Credentials, (resolve) => resolve),
51
- baseUrl: (creds) => creds.apiBaseUrl,
52
- headers: (creds) => ({
53
- Authorization: Redacted.value(creds.authorization),
54
- Accept: "application/json",
55
- }),
56
- errorEnvelope,
57
- unknownError: ({ code, message, body }) => new UnknownZendeskError({
58
- code: typeof code === "string" ? code : code !== undefined ? String(code) : undefined,
59
- message,
60
- body,
61
- }),
62
- parseError: ({ body, cause }) => new ZendeskParseError({ body, cause }),
63
- });
64
- //# sourceMappingURL=protocol.js.map
1
+ export { protocol$ZendeskProtocol as ZendeskProtocol } from "./_bundle/sdk.js";
package/lib/retry.js CHANGED
@@ -1,33 +1 @@
1
- import { throttlingFactory, transientFactory } from "@distilled.cloud/core/retry";
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
- import * as Context from "effect/Context";
18
- import * as Effect from "effect/Effect";
19
- import * as Layer from "effect/Layer";
20
- export { makeDefault, jittered, capped, throttlingOptions, transientOptions, throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
21
-
22
- export class Retry extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("ZendeskRetry") {
23
- }
24
-
25
- export const policy = (optionsOrFactory) => Effect.provide(Layer.succeed(Retry, optionsOrFactory));
26
-
27
- export const none = /*@__PURE__*/ Effect.provide(
28
- /*@__PURE__*/ Layer.succeed(Retry, { while: () => false }));
29
-
30
- export const throttling = /*@__PURE__*/ policy(throttlingFactory);
31
-
32
- export const transient = /*@__PURE__*/ policy(transientFactory);
33
- //# sourceMappingURL=retry.js.map
1
+ export { retry$Retry as Retry, retry$capped as capped, retry$jittered as jittered, retry$makeDefault as makeDefault, retry$none as none, retry$policy as policy, retry$throttling as throttling, retry$throttlingFactory as throttlingFactory, retry$throttlingOptions as throttlingOptions, retry$transient as transient, retry$transientFactory as transientFactory, retry$transientOptions as transientOptions } from "./_bundle/sdk.js";
@@ -1,3 +1 @@
1
- // AUTO-GENERATED by scripts/generate.ts. Do not edit.
2
1
  export * as zendesk from "./zendesk.js";
3
- //# sourceMappingURL=index.js.map