@distilled.cloud/zendesk 1.0.0-rc.13 → 1.0.0-rc.14
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 +12 -11
- package/lib/credentials.js.map +1 -1
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -1
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/pagination.d.ts +1 -1
- package/lib/pagination.d.ts.map +1 -1
- package/lib/pagination.js +1 -1
- package/lib/pagination.js.map +1 -1
- package/lib/protocol.d.ts +3 -3
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +2 -6
- 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 +1 -1
- package/lib/retry.js.map +1 -1
- package/lib/services/zendesk.d.ts +1539 -722
- package/lib/services/zendesk.d.ts.map +1 -1
- package/lib/services/zendesk.js +1890 -3585
- package/lib/services/zendesk.js.map +1 -1
- package/package.json +12 -10
- package/src/credentials.ts +24 -20
- package/src/errors.ts +1 -1
- package/src/index.ts +1 -5
- package/src/pagination.ts +1 -4
- package/src/protocol.ts +25 -34
- package/src/retry.ts +2 -8
- package/src/services/zendesk.ts +7025 -9338
- package/lib/response-validation.test.d.ts +0 -4
- package/lib/response-validation.test.d.ts.map +0 -1
- package/lib/response-validation.test.js +0 -38
- package/lib/response-validation.test.js.map +0 -1
- package/src/response-validation.test.ts +0 -54
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response-validation.test.d.ts","sourceRoot":"","sources":["../src/response-validation.test.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA4CpD,eAAO,MAAM,oBAAoB,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC,cAAc,CAAC,GAC3E,IAAI,GACJ,KAAY,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { runValidationModes } from "@distilled.cloud/core/testing";
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
4
|
-
import { fromApiToken } from "./credentials.js";
|
|
5
|
-
import { ZendeskParseError } from "./errors.js";
|
|
6
|
-
import * as Retry from "./retry.js";
|
|
7
|
-
import { countTickets } from "./services/zendesk.js";
|
|
8
|
-
// countTickets declares `{ count?: { value?: number; refreshed_at?: string } }`;
|
|
9
|
-
// every member is optional, so the mismatch is a wrong primitive type.
|
|
10
|
-
const run = (body) => runValidationModes(countTickets({}).pipe(Retry.none, Effect.provide(fromApiToken({
|
|
11
|
-
email: "test@example.com",
|
|
12
|
-
apiToken: "test",
|
|
13
|
-
subdomain: "acme",
|
|
14
|
-
}))), { body });
|
|
15
|
-
describe("Zendesk response validation", () => {
|
|
16
|
-
test("a matching body succeeds unchanged in both modes", async () => {
|
|
17
|
-
const body = { count: { value: 5, refreshed_at: "2026-01-01T00:00:00Z" } };
|
|
18
|
-
const { lenient, strict } = await run(JSON.stringify(body));
|
|
19
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: body });
|
|
20
|
-
expect(strict).toMatchObject({ _tag: "Success", success: body });
|
|
21
|
-
});
|
|
22
|
-
test("a member with the wrong primitive type: lenient returns it, strict fails", async () => {
|
|
23
|
-
const body = { count: { value: "five" } };
|
|
24
|
-
const { lenient, strict } = await run(JSON.stringify(body));
|
|
25
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: body });
|
|
26
|
-
expect(strict._tag).toBe("Failure");
|
|
27
|
-
expect(strict.failure).toBeInstanceOf(ZendeskParseError);
|
|
28
|
-
});
|
|
29
|
-
test("a non-JSON body: lenient returns the text, strict fails", async () => {
|
|
30
|
-
const { lenient, strict } = await run("not json");
|
|
31
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: "not json" });
|
|
32
|
-
expect(strict._tag).toBe("Failure");
|
|
33
|
-
expect(strict.failure).toBeInstanceOf(ZendeskParseError);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
// ZendeskParseError is part of every operation's declared error type.
|
|
37
|
-
export const parseErrorIsDeclared = true;
|
|
38
|
-
//# sourceMappingURL=response-validation.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response-validation.test.js","sourceRoot":"","sources":["../src/response-validation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,iFAAiF;AACjF,uEAAuE;AACvE,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAC3B,kBAAkB,CAChB,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,CACnB,KAAK,CAAC,IAAI,EACV,MAAM,CAAC,OAAO,CACZ,YAAY,CAAC;IACX,KAAK,EAAE,kBAAkB;IACzB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;CAClB,CAAC,CACH,CACF,EACD,EAAE,IAAI,EAAE,CACT,CAAC;AAEJ,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,IAAI,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;QAClE,MAAM,IAA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,EAAE,UAAU,EAAE,CAAC,CAAC;QACxE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,MAAM,CAAE,MAAc,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAErB,IAAI,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { runValidationModes } from "@distilled.cloud/core/testing";
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
4
|
-
import { fromApiToken } from "./credentials.ts";
|
|
5
|
-
import { ZendeskParseError } from "./errors.ts";
|
|
6
|
-
import * as Retry from "./retry.ts";
|
|
7
|
-
import { countTickets } from "./services/zendesk.ts";
|
|
8
|
-
import type { ZendeskOpError } from "./protocol.ts";
|
|
9
|
-
|
|
10
|
-
// countTickets declares `{ count?: { value?: number; refreshed_at?: string } }`;
|
|
11
|
-
// every member is optional, so the mismatch is a wrong primitive type.
|
|
12
|
-
const run = (body: string) =>
|
|
13
|
-
runValidationModes(
|
|
14
|
-
countTickets({}).pipe(
|
|
15
|
-
Retry.none,
|
|
16
|
-
Effect.provide(
|
|
17
|
-
fromApiToken({
|
|
18
|
-
email: "test@example.com",
|
|
19
|
-
apiToken: "test",
|
|
20
|
-
subdomain: "acme",
|
|
21
|
-
}),
|
|
22
|
-
),
|
|
23
|
-
),
|
|
24
|
-
{ body },
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
describe("Zendesk response validation", () => {
|
|
28
|
-
test("a matching body succeeds unchanged in both modes", async () => {
|
|
29
|
-
const body = { count: { value: 5, refreshed_at: "2026-01-01T00:00:00Z" } };
|
|
30
|
-
const { lenient, strict } = await run(JSON.stringify(body));
|
|
31
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: body });
|
|
32
|
-
expect(strict).toMatchObject({ _tag: "Success", success: body });
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test("a member with the wrong primitive type: lenient returns it, strict fails", async () => {
|
|
36
|
-
const body = { count: { value: "five" } };
|
|
37
|
-
const { lenient, strict } = await run(JSON.stringify(body));
|
|
38
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: body });
|
|
39
|
-
expect(strict._tag).toBe("Failure");
|
|
40
|
-
expect((strict as any).failure).toBeInstanceOf(ZendeskParseError);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test("a non-JSON body: lenient returns the text, strict fails", async () => {
|
|
44
|
-
const { lenient, strict } = await run("not json");
|
|
45
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: "not json" });
|
|
46
|
-
expect(strict._tag).toBe("Failure");
|
|
47
|
-
expect((strict as any).failure).toBeInstanceOf(ZendeskParseError);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// ZendeskParseError is part of every operation's declared error type.
|
|
52
|
-
export const parseErrorIsDeclared: [ZendeskParseError] extends [ZendeskOpError]
|
|
53
|
-
? true
|
|
54
|
-
: false = true;
|