@distilled.cloud/zendesk 1.0.0-rc.15 → 1.0.0-rc.16
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/credentials.d.ts +2 -2
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +24 -23
- package/lib/credentials.js.map +1 -1
- package/lib/errors.d.ts +15 -15
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +16 -16
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +15 -15
- package/lib/index.js.map +1 -1
- package/lib/pagination.d.ts +1 -1
- package/lib/pagination.js +8 -8
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +24 -27
- package/lib/protocol.js.map +1 -1
- package/lib/retry.d.ts +1 -1
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +25 -24
- package/lib/retry.js.map +1 -1
- package/lib/services/zendesk.d.ts +34 -2397
- package/lib/services/zendesk.d.ts.map +1 -1
- package/lib/services/zendesk.js +2098 -15938
- package/lib/traits.d.ts +1 -1
- package/lib/traits.js +8 -8
- package/package.json +13 -9
- package/src/credentials.ts +7 -6
- package/src/errors.ts +12 -16
- package/src/index.ts +2 -2
- package/src/pagination.ts +1 -1
- package/src/protocol.ts +5 -8
- package/src/retry.ts +6 -4
- package/src/services/zendesk.ts +17192 -18934
- package/src/traits.ts +1 -1
- package/lib/services/zendesk.js.map +0 -1
package/lib/traits.d.ts
CHANGED
package/lib/traits.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
9
|
export { Body, Header, Query, Label, Http, ResponseCode, HttpBody, FormDataFile, KeyDictionary, UnionCases, applyErrorMatchers, getErrorMatchers, bodySymbol, headerSymbol, querySymbol, labelSymbol, httpSymbol, responseCodeSymbol, httpBodySymbol, formDataFileSymbol, keyDictionarySymbol, unionCasesSymbol, errorMatchersSymbol, } from "@distilled.cloud/core/trait";
|
|
10
10
|
export { SensitiveValue, RawResponse, RawResponseRoot, sensitiveValueSymbol, rawResponseSymbol, rawResponseRootSymbol, } from "@distilled.cloud/core/protocol-rest";
|
|
11
11
|
//# sourceMappingURL=traits.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distilled.cloud/zendesk",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"types": "./lib/index.d.ts",
|
|
19
19
|
"bun": "./src/index.ts",
|
|
20
20
|
"worker": "./src/index.ts",
|
|
21
|
-
"
|
|
21
|
+
"module": "./lib/index.full.js",
|
|
22
|
+
"module-sync": "./lib/index.js",
|
|
23
|
+
"default": "./lib/index.full.js"
|
|
22
24
|
},
|
|
23
25
|
"./Credentials": {
|
|
24
26
|
"types": "./lib/credentials.d.ts",
|
|
@@ -60,27 +62,29 @@
|
|
|
60
62
|
"types": "./lib/services/*.d.ts",
|
|
61
63
|
"bun": "./src/services/*.ts",
|
|
62
64
|
"worker": "./src/services/*.ts",
|
|
63
|
-
"
|
|
65
|
+
"module": "./lib/services.full/*.js",
|
|
66
|
+
"module-sync": "./lib/services/*.js",
|
|
67
|
+
"default": "./lib/services.full/*.js"
|
|
64
68
|
}
|
|
65
69
|
},
|
|
66
70
|
"dependencies": {
|
|
67
|
-
"@distilled.cloud/core": "1.0.0-rc.
|
|
71
|
+
"@distilled.cloud/core": "1.0.0-rc.16"
|
|
68
72
|
},
|
|
69
73
|
"devDependencies": {
|
|
70
|
-
"@types/node": "26.
|
|
74
|
+
"@types/node": "26.6.5"
|
|
71
75
|
},
|
|
72
76
|
"peerDependencies": {
|
|
73
|
-
"effect": "^4.0.
|
|
77
|
+
"effect": "^4.0.5"
|
|
74
78
|
},
|
|
75
79
|
"distilled": {
|
|
76
|
-
"generatedAt": "2026-10-
|
|
80
|
+
"generatedAt": "2026-10-09",
|
|
77
81
|
"specUpdatedAt": "2026-10-06"
|
|
78
82
|
},
|
|
79
83
|
"scripts": {
|
|
80
|
-
"build": "
|
|
84
|
+
"build": "tsrs -b",
|
|
81
85
|
"convert": "node --conditions=bun scripts/convert.ts",
|
|
82
86
|
"generate": "node --conditions=bun scripts/convert.ts && node --conditions=bun scripts/generate.ts",
|
|
83
|
-
"typecheck": "
|
|
87
|
+
"typecheck": "tsrs -p tsconfig.json",
|
|
84
88
|
"specs:fetch": "git submodule update --force --init --depth=1 specs/spec-mirror-zendesk",
|
|
85
89
|
"specs:update": "git submodule update --remote --force --depth=1 specs/spec-mirror-zendesk"
|
|
86
90
|
}
|
package/src/credentials.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
2
2
|
/**
|
|
3
|
-
* Zendesk credentials
|
|
3
|
+
* Zendesk credentials -- hand-written.
|
|
4
4
|
*
|
|
5
5
|
* The `Credentials` service holds an *effect* that resolves the current
|
|
6
6
|
* credentials on every request (the protocol layer resolves it per request
|
|
@@ -23,9 +23,10 @@ export interface Config {
|
|
|
23
23
|
readonly apiBaseUrl: string;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export class Credentials
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export class Credentials
|
|
27
|
+
extends /*@__PURE__*/ Context.Service<Credentials, Effect.Effect<Config>>()(
|
|
28
|
+
"ZendeskCredentials",
|
|
29
|
+
) {}
|
|
29
30
|
|
|
30
31
|
const stripTrailingSlash = (url: string): string => url.replace(/\/+$/, "");
|
|
31
32
|
|
|
@@ -90,9 +91,9 @@ export const fromAccessToken = (config: {
|
|
|
90
91
|
* Reads ZENDESK_SUBDOMAIN (or ZENDESK_API_BASE_URL) plus either
|
|
91
92
|
* ZENDESK_EMAIL + ZENDESK_API_TOKEN or ZENDESK_ACCESS_TOKEN.
|
|
92
93
|
*/
|
|
93
|
-
export const CredentialsFromEnv: Layer.Layer<Credentials> = Layer.succeed(
|
|
94
|
+
export const CredentialsFromEnv: Layer.Layer<Credentials> = /*@__PURE__*/ Layer.succeed(
|
|
94
95
|
Credentials,
|
|
95
|
-
Effect.gen(function* () {
|
|
96
|
+
/*@__PURE__*/ Effect.gen(function* () {
|
|
96
97
|
const subdomain = process.env.ZENDESK_SUBDOMAIN;
|
|
97
98
|
const apiBaseUrl = process.env.ZENDESK_API_BASE_URL;
|
|
98
99
|
const email = process.env.ZENDESK_EMAIL;
|
package/src/errors.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Re-exports the common HTTP errors from core and adds the Zendesk fallback
|
|
5
5
|
* errors. Note the generated service module additionally defines its own
|
|
6
|
-
* per-status matcher classes (BadRequest/NotFound
|
|
7
|
-
* operation declares
|
|
6
|
+
* per-status matcher classes (BadRequest/NotFound/...) for the statuses each
|
|
7
|
+
* operation declares -- those share `_tag`s with the core classes here, so
|
|
8
8
|
* `catchTag` works against either.
|
|
9
9
|
*/
|
|
10
10
|
export {
|
|
@@ -28,23 +28,19 @@ export {
|
|
|
28
28
|
export type { DefaultErrors } from "@distilled.cloud/core/errors";
|
|
29
29
|
|
|
30
30
|
import * as Category from "@distilled.cloud/core/category";
|
|
31
|
-
import * as Schema from "
|
|
31
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
32
32
|
|
|
33
|
-
/** Unknown Zendesk error
|
|
34
|
-
export class UnknownZendeskError
|
|
35
|
-
"UnknownZendeskError",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
message: Schema.optional(Schema.String),
|
|
33
|
+
/** Unknown Zendesk error -- returned when nothing else matches the failure. */
|
|
34
|
+
export class UnknownZendeskError
|
|
35
|
+
extends /*@__PURE__*/ Schema.TaggedError<UnknownZendeskError>()("UnknownZendeskError", {
|
|
36
|
+
code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
37
|
+
message: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
39
38
|
body: Schema.Unknown,
|
|
40
|
-
}
|
|
41
|
-
).pipe(Category.withServerError) {}
|
|
39
|
+
}).pipe(Category.withServerError) {}
|
|
42
40
|
|
|
43
41
|
/** Schema parse error wrapper (kept for surface parity with other SDKs). */
|
|
44
|
-
export class ZendeskParseError
|
|
45
|
-
"ZendeskParseError",
|
|
46
|
-
{
|
|
42
|
+
export class ZendeskParseError
|
|
43
|
+
extends /*@__PURE__*/ Schema.TaggedError<ZendeskParseError>()("ZendeskParseError", {
|
|
47
44
|
body: Schema.Unknown,
|
|
48
45
|
cause: Schema.Unknown,
|
|
49
|
-
}
|
|
50
|
-
).pipe(Category.withParseError) {}
|
|
46
|
+
}).pipe(Category.withParseError) {}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @distilled.cloud/zendesk
|
|
2
|
+
* @distilled.cloud/zendesk -- Zendesk Support SDK for Effect.
|
|
3
3
|
*
|
|
4
4
|
* `./services` is generated by `scripts/generate.ts` from the Smithy model
|
|
5
5
|
* in `.generated-specs` (written by `scripts/convert.ts` from the OpenAPI
|
|
@@ -21,7 +21,7 @@ export * as Retry from "./retry.ts";
|
|
|
21
21
|
export * as Services from "./services/index.ts";
|
|
22
22
|
// Operations (and their request/response types) are importable straight off
|
|
23
23
|
// the package root. The service-local typed error classes shadow the
|
|
24
|
-
// same-named shared ones from ./errors.ts
|
|
24
|
+
// same-named shared ones from ./errors.ts -- the ops actually raise the
|
|
25
25
|
// service-local classes.
|
|
26
26
|
export * from "./services/zendesk.ts";
|
|
27
27
|
export {
|
package/src/pagination.ts
CHANGED
package/src/protocol.ts
CHANGED
|
@@ -2,12 +2,12 @@ import type * as API from "@distilled.cloud/core/api";
|
|
|
2
2
|
import type { API_ERRORS, ConfigError } from "@distilled.cloud/core/errors";
|
|
3
3
|
import { makeRestProtocol, type RestErrorEnvelope } from "@distilled.cloud/core/protocol-rest";
|
|
4
4
|
/**
|
|
5
|
-
* ZendeskProtocol
|
|
5
|
+
* ZendeskProtocol -- hand-written.
|
|
6
6
|
*
|
|
7
7
|
* Zendesk Support speaks JSON REST (no response envelope), so the whole
|
|
8
8
|
* protocol is one `makeRestProtocol` call from `core/protocol-rest`:
|
|
9
9
|
*
|
|
10
|
-
* request: credentials
|
|
10
|
+
* request: credentials -> `Authorization: Basic {email}/token:{apiToken}`
|
|
11
11
|
* or `Bearer <oauth>` + account origin
|
|
12
12
|
* (`https://{subdomain}.zendesk.com`), resolved from the calling
|
|
13
13
|
* fiber on every request
|
|
@@ -67,13 +67,10 @@ const errorEnvelope = (body: unknown): RestErrorEnvelope | undefined => {
|
|
|
67
67
|
return { code, message };
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
export const ZendeskProtocol: Layer.Layer<API.Protocol> = makeRestProtocol<Config>({
|
|
71
|
-
// The Credentials service holds an effect
|
|
70
|
+
export const ZendeskProtocol: Layer.Layer<API.Protocol> = /*@__PURE__*/ makeRestProtocol<Config>({
|
|
71
|
+
// The Credentials service holds an effect -- resolving it here (per
|
|
72
72
|
// request, on the calling fiber) picks up context-provided credentials.
|
|
73
|
-
credentials: Effect.
|
|
74
|
-
const resolve = yield* Credentials;
|
|
75
|
-
return yield* resolve;
|
|
76
|
-
}),
|
|
73
|
+
credentials: /*@__PURE__*/ Effect.flatMap(Credentials, (resolve) => resolve),
|
|
77
74
|
baseUrl: (creds) => creds.apiBaseUrl,
|
|
78
75
|
headers: (creds) => ({
|
|
79
76
|
Authorization: Redacted.value(creds.authorization),
|
package/src/retry.ts
CHANGED
|
@@ -32,17 +32,19 @@ export {
|
|
|
32
32
|
} from "@distilled.cloud/core/retry";
|
|
33
33
|
|
|
34
34
|
/** Context tag for configuring retry behavior of Zendesk API calls. */
|
|
35
|
-
export class Retry extends Context.Service<Retry, Policy>()("ZendeskRetry") {}
|
|
35
|
+
export class Retry extends /*@__PURE__*/ Context.Service<Retry, Policy>()("ZendeskRetry") {}
|
|
36
36
|
|
|
37
37
|
/** Provides a custom retry policy to every Zendesk API call below it. */
|
|
38
38
|
export const policy = (optionsOrFactory: Policy) =>
|
|
39
39
|
Effect.provide(Layer.succeed(Retry, optionsOrFactory));
|
|
40
40
|
|
|
41
41
|
/** Disables all automatic retries. */
|
|
42
|
-
export const none = Effect.provide(
|
|
42
|
+
export const none = /*@__PURE__*/ Effect.provide(
|
|
43
|
+
/*@__PURE__*/ Layer.succeed(Retry, { while: () => false }),
|
|
44
|
+
);
|
|
43
45
|
|
|
44
46
|
/** Apply the throttling retry policy (retries throttling errors indefinitely). */
|
|
45
|
-
export const throttling = policy(throttlingFactory);
|
|
47
|
+
export const throttling = /*@__PURE__*/ policy(throttlingFactory);
|
|
46
48
|
|
|
47
49
|
/** Apply the transient retry policy (retries all transient errors indefinitely). */
|
|
48
|
-
export const transient = policy(transientFactory);
|
|
50
|
+
export const transient = /*@__PURE__*/ policy(transientFactory);
|