@distilled.cloud/okta 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 +2 -2
- 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 +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/protocol.d.ts +3 -3
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +3 -11
- 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/okta.d.ts +276 -46
- package/lib/services/okta.d.ts.map +1 -1
- package/lib/services/okta.js +1330 -3801
- package/lib/services/okta.js.map +1 -1
- package/package.json +12 -10
- package/src/credentials.ts +9 -12
- package/src/errors.ts +10 -16
- package/src/index.ts +2 -12
- package/src/protocol.ts +22 -36
- package/src/retry.ts +2 -8
- package/src/services/okta.ts +5503 -10330
- 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 -40
- package/lib/response-validation.test.js.map +0 -1
- package/src/response-validation.test.ts +0 -56
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response-validation.test.d.ts","sourceRoot":"","sources":["../src/response-validation.test.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AA8CjD,eAAO,MAAM,oBAAoB,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,GACrE,IAAI,GACJ,KAAY,CAAC"}
|
|
@@ -1,40 +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 { OktaParseError } from "./errors.js";
|
|
6
|
-
import * as Retry from "./retry.js";
|
|
7
|
-
import { getDRStatus } from "./services/okta.js";
|
|
8
|
-
// getDRStatus declares `{ status?: { domain?: string; isFailedOver?: boolean }[] }`.
|
|
9
|
-
// Its members are all optional, so the mismatch is a wrong primitive.
|
|
10
|
-
const run = (body) => runValidationModes(getDRStatus({}).pipe(Retry.none, Effect.provide(fromApiToken({
|
|
11
|
-
apiToken: "test",
|
|
12
|
-
apiBaseUrl: "https://example.okta.com",
|
|
13
|
-
}))), { body });
|
|
14
|
-
describe("Okta response validation", () => {
|
|
15
|
-
test("a matching body succeeds unchanged in both modes", async () => {
|
|
16
|
-
const body = {
|
|
17
|
-
status: [{ domain: "example.okta.com", isFailedOver: false }],
|
|
18
|
-
};
|
|
19
|
-
const { lenient, strict } = await run(JSON.stringify(body));
|
|
20
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: body });
|
|
21
|
-
expect(strict).toMatchObject({ _tag: "Success", success: body });
|
|
22
|
-
});
|
|
23
|
-
test("a member with the wrong primitive type: lenient returns it, strict fails", async () => {
|
|
24
|
-
const body = {
|
|
25
|
-
status: [{ domain: "example.okta.com", isFailedOver: "no" }],
|
|
26
|
-
};
|
|
27
|
-
const { lenient, strict } = await run(JSON.stringify(body));
|
|
28
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: body });
|
|
29
|
-
expect(strict._tag).toBe("Failure");
|
|
30
|
-
expect(strict.failure).toBeInstanceOf(OktaParseError);
|
|
31
|
-
});
|
|
32
|
-
test("a non-JSON body: lenient returns the text, strict fails", async () => {
|
|
33
|
-
const { lenient, strict } = await run("not json");
|
|
34
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: "not json" });
|
|
35
|
-
expect(strict.failure).toBeInstanceOf(OktaParseError);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
// OktaParseError is part of every operation's declared error type.
|
|
39
|
-
export const parseErrorIsDeclared = true;
|
|
40
|
-
//# 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,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,qFAAqF;AACrF,sEAAsE;AACtE,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAC3B,kBAAkB,CAChB,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,CAClB,KAAK,CAAC,IAAI,EACV,MAAM,CAAC,OAAO,CACZ,YAAY,CAAC;IACX,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,0BAA0B;CACvC,CAAC,CACH,CACF,EACD,EAAE,IAAI,EAAE,CACT,CAAC;AAEJ,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,IAAI,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;QAClE,MAAM,IAAI,GAAG;YACX,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;SAC9D,CAAC;QACF,MAAM,EAAE,OAAO,EAAE,MAA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,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAErB,IAAI,CAAC"}
|
|
@@ -1,56 +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 { OktaParseError } from "./errors.ts";
|
|
6
|
-
import * as Retry from "./retry.ts";
|
|
7
|
-
import { getDRStatus } from "./services/okta.ts";
|
|
8
|
-
import type { OktaOpError } from "./protocol.ts";
|
|
9
|
-
|
|
10
|
-
// getDRStatus declares `{ status?: { domain?: string; isFailedOver?: boolean }[] }`.
|
|
11
|
-
// Its members are all optional, so the mismatch is a wrong primitive.
|
|
12
|
-
const run = (body: string) =>
|
|
13
|
-
runValidationModes(
|
|
14
|
-
getDRStatus({}).pipe(
|
|
15
|
-
Retry.none,
|
|
16
|
-
Effect.provide(
|
|
17
|
-
fromApiToken({
|
|
18
|
-
apiToken: "test",
|
|
19
|
-
apiBaseUrl: "https://example.okta.com",
|
|
20
|
-
}),
|
|
21
|
-
),
|
|
22
|
-
),
|
|
23
|
-
{ body },
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
describe("Okta response validation", () => {
|
|
27
|
-
test("a matching body succeeds unchanged in both modes", async () => {
|
|
28
|
-
const body = {
|
|
29
|
-
status: [{ domain: "example.okta.com", isFailedOver: false }],
|
|
30
|
-
};
|
|
31
|
-
const { lenient, strict } = await run(JSON.stringify(body));
|
|
32
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: body });
|
|
33
|
-
expect(strict).toMatchObject({ _tag: "Success", success: body });
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test("a member with the wrong primitive type: lenient returns it, strict fails", async () => {
|
|
37
|
-
const body = {
|
|
38
|
-
status: [{ domain: "example.okta.com", isFailedOver: "no" }],
|
|
39
|
-
};
|
|
40
|
-
const { lenient, strict } = await run(JSON.stringify(body));
|
|
41
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: body });
|
|
42
|
-
expect(strict._tag).toBe("Failure");
|
|
43
|
-
expect((strict as any).failure).toBeInstanceOf(OktaParseError);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test("a non-JSON body: lenient returns the text, strict fails", async () => {
|
|
47
|
-
const { lenient, strict } = await run("not json");
|
|
48
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: "not json" });
|
|
49
|
-
expect((strict as any).failure).toBeInstanceOf(OktaParseError);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// OktaParseError is part of every operation's declared error type.
|
|
54
|
-
export const parseErrorIsDeclared: [OktaParseError] extends [OktaOpError]
|
|
55
|
-
? true
|
|
56
|
-
: false = true;
|