@distilled.cloud/okta 1.0.0-rc.13 → 1.0.0-rc.15

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/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@distilled.cloud/okta",
3
- "version": "1.0.0-rc.13",
3
+ "version": "1.0.0-rc.15",
4
+ "license": "Apache-2.0",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "https://github.com/alchemy-run/distilled",
7
8
  "directory": "packages/okta"
8
9
  },
9
- "license": "Apache-2.0",
10
- "type": "module",
11
- "sideEffects": false,
12
10
  "files": [
13
11
  "lib",
14
12
  "src"
15
13
  ],
14
+ "type": "module",
15
+ "sideEffects": false,
16
16
  "exports": {
17
17
  ".": {
18
18
  "types": "./lib/index.d.ts",
@@ -64,20 +64,22 @@
64
64
  }
65
65
  },
66
66
  "dependencies": {
67
- "@distilled.cloud/core": "1.0.0-rc.13"
67
+ "@distilled.cloud/core": "1.0.0-rc.15"
68
68
  },
69
69
  "devDependencies": {
70
- "@types/bun": "1.3.14",
71
- "@types/node": "26.2.0",
72
- "@effect/platform-bun": "^4.0.0"
70
+ "@types/node": "26.2.0"
73
71
  },
74
72
  "peerDependencies": {
75
73
  "effect": "^4.0.0"
76
74
  },
75
+ "distilled": {
76
+ "generatedAt": "2026-10-06",
77
+ "specUpdatedAt": "2026-10-05"
78
+ },
77
79
  "scripts": {
78
80
  "build": "tsc -b",
79
- "convert": "bun scripts/convert.ts",
80
- "generate": "bun scripts/convert.ts && bun scripts/generate.ts",
81
+ "convert": "node --conditions=bun scripts/convert.ts",
82
+ "generate": "node --conditions=bun scripts/convert.ts && node --conditions=bun scripts/generate.ts",
81
83
  "typecheck": "tsc -p tsconfig.json",
82
84
  "specs:fetch": "git submodule update --force --init --depth=1 specs/spec-mirror-okta",
83
85
  "specs:update": "git submodule update --remote --force --depth=1 specs/spec-mirror-okta"
@@ -1,3 +1,4 @@
1
+ import { ConfigError } from "@distilled.cloud/core/errors";
1
2
  /**
2
3
  * Okta credentials — hand-written.
3
4
  *
@@ -16,7 +17,6 @@ import * as Context from "effect/Context";
16
17
  import * as Effect from "effect/Effect";
17
18
  import * as Layer from "effect/Layer";
18
19
  import * as Redacted from "effect/Redacted";
19
- import { ConfigError } from "@distilled.cloud/core/errors";
20
20
 
21
21
  /** Okta Management API token schemes. */
22
22
  export type AuthScheme = "SSWS" | "Bearer";
@@ -27,23 +27,22 @@ export interface Config {
27
27
  readonly authScheme: AuthScheme;
28
28
  }
29
29
 
30
- export class Credentials extends Context.Service<
31
- Credentials,
32
- Effect.Effect<Config>
33
- >()("OktaCredentials") {}
30
+ export class Credentials extends Context.Service<Credentials, Effect.Effect<Config>>()(
31
+ "OktaCredentials",
32
+ ) {}
34
33
 
35
34
  const stripTrailingSlash = (url: string): string => url.replace(/\/+$/, "");
36
35
 
37
36
  /** Layer from an SSWS API token + org base URL. */
38
37
  export const fromApiToken = (config: {
39
- readonly apiToken: string;
38
+ readonly apiToken: Redacted.Redacted<string>;
40
39
  readonly apiBaseUrl: string;
41
40
  readonly authScheme?: AuthScheme;
42
41
  }): Layer.Layer<Credentials> =>
43
42
  Layer.succeed(
44
43
  Credentials,
45
44
  Effect.succeed({
46
- apiToken: Redacted.make(config.apiToken),
45
+ apiToken: config.apiToken,
47
46
  apiBaseUrl: stripTrailingSlash(config.apiBaseUrl),
48
47
  authScheme: config.authScheme ?? "SSWS",
49
48
  }),
@@ -51,7 +50,7 @@ export const fromApiToken = (config: {
51
50
 
52
51
  /** Layer from an OAuth 2.0 access token + org base URL. */
53
52
  export const fromAccessToken = (config: {
54
- readonly accessToken: string;
53
+ readonly accessToken: Redacted.Redacted<string>;
55
54
  readonly apiBaseUrl: string;
56
55
  }): Layer.Layer<Credentials> =>
57
56
  fromApiToken({
@@ -73,13 +72,11 @@ export const CredentialsFromEnv: Layer.Layer<Credentials> = Layer.succeed(
73
72
 
74
73
  if (!apiToken || !apiBaseUrl) {
75
74
  return yield* new ConfigError({
76
- message:
77
- "OKTA_API_TOKEN and OKTA_ORG_URL environment variables are required",
75
+ message: "OKTA_API_TOKEN and OKTA_ORG_URL environment variables are required",
78
76
  });
79
77
  }
80
78
 
81
- const authScheme: AuthScheme =
82
- scheme === "Bearer" || scheme === "SSWS" ? scheme : "SSWS";
79
+ const authScheme: AuthScheme = scheme === "Bearer" || scheme === "SSWS" ? scheme : "SSWS";
83
80
 
84
81
  return {
85
82
  apiToken: Redacted.make(apiToken),
package/src/errors.ts CHANGED
@@ -27,24 +27,18 @@ export {
27
27
  } from "@distilled.cloud/core/errors";
28
28
  export type { DefaultErrors } from "@distilled.cloud/core/errors";
29
29
 
30
- import * as Schema from "effect/Schema";
31
30
  import * as Category from "@distilled.cloud/core/category";
31
+ import * as Schema from "effect/Schema";
32
32
 
33
33
  /** Unknown Okta error — returned when nothing else matches the failure. */
34
- export class UnknownOktaError extends Schema.TaggedError<UnknownOktaError>()(
35
- "UnknownOktaError",
36
- {
37
- code: Schema.optional(Schema.String),
38
- message: Schema.optional(Schema.String),
39
- body: Schema.Unknown,
40
- },
41
- ).pipe(Category.withServerError) {}
34
+ export class UnknownOktaError extends Schema.TaggedError<UnknownOktaError>()("UnknownOktaError", {
35
+ code: Schema.optional(Schema.String),
36
+ message: Schema.optional(Schema.String),
37
+ body: Schema.Unknown,
38
+ }).pipe(Category.withServerError) {}
42
39
 
43
40
  /** Schema parse error wrapper (kept for surface parity with other SDKs). */
44
- export class OktaParseError extends Schema.TaggedError<OktaParseError>()(
45
- "OktaParseError",
46
- {
47
- body: Schema.Unknown,
48
- cause: Schema.Unknown,
49
- },
50
- ).pipe(Category.withParseError) {}
41
+ export class OktaParseError extends Schema.TaggedError<OktaParseError>()("OktaParseError", {
42
+ body: Schema.Unknown,
43
+ cause: Schema.Unknown,
44
+ }).pipe(Category.withParseError) {}
package/src/index.ts CHANGED
@@ -15,11 +15,7 @@
15
15
  export * from "./credentials.ts";
16
16
  export * from "./errors.ts";
17
17
  export * as T from "./traits.ts";
18
- export {
19
- OktaProtocol,
20
- type OktaOpError,
21
- type OktaOpContext,
22
- } from "./protocol.ts";
18
+ export { OktaProtocol, type OktaOpError, type OktaOpContext } from "./protocol.ts";
23
19
  export { paginateCursor } from "./pagination.ts";
24
20
  export * as Retry from "./retry.ts";
25
21
  export * as Services from "./services/index.ts";
@@ -28,10 +24,4 @@ export * as Services from "./services/index.ts";
28
24
  // same-named shared ones from ./errors.ts — the ops actually raise the
29
25
  // service-local classes.
30
26
  export * from "./services/okta.ts";
31
- export {
32
- BadRequest,
33
- Conflict,
34
- Forbidden,
35
- NotFound,
36
- UnprocessableEntity,
37
- } from "./services/okta.ts";
27
+ export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity } from "./services/okta.ts";
package/src/protocol.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import type * as API from "@distilled.cloud/core/api";
2
+ import type { API_ERRORS, ConfigError } from "@distilled.cloud/core/errors";
3
+ import { makeRestProtocol, type RestErrorEnvelope } from "@distilled.cloud/core/protocol-rest";
1
4
  /**
2
5
  * OktaProtocol — hand-written.
3
6
  *
@@ -15,15 +18,9 @@
15
18
  * shared HTTP-status classes, then {@link UnknownOktaError}.
16
19
  */
17
20
  import * as Effect from "effect/Effect";
18
- import type * as Layer from "effect/Layer";
19
21
  import type * as HttpClient from "effect/http/HttpClient";
20
22
  import type * as HttpClientError from "effect/http/HttpClientError";
21
- import type * as API from "@distilled.cloud/core/api";
22
- import {
23
- makeRestProtocol,
24
- type RestErrorEnvelope,
25
- } from "@distilled.cloud/core/protocol-rest";
26
- import type { API_ERRORS, ConfigError } from "@distilled.cloud/core/errors";
23
+ import type * as Layer from "effect/Layer";
27
24
  import { Credentials, formatHeaders, type Config } from "./credentials.ts";
28
25
  import { UnknownOktaError, OktaParseError } from "./errors.ts";
29
26
 
@@ -52,11 +49,7 @@ const errorEnvelope = (body: unknown): RestErrorEnvelope | undefined => {
52
49
  if (body === null || typeof body !== "object") return undefined;
53
50
  const b = body as Record<string, unknown>;
54
51
  const code =
55
- typeof b.errorCode === "string"
56
- ? b.errorCode
57
- : typeof b.code === "string"
58
- ? b.code
59
- : undefined;
52
+ typeof b.errorCode === "string" ? b.errorCode : typeof b.code === "string" ? b.code : undefined;
60
53
  const message =
61
54
  typeof b.errorSummary === "string"
62
55
  ? b.errorSummary
@@ -67,28 +60,21 @@ const errorEnvelope = (body: unknown): RestErrorEnvelope | undefined => {
67
60
  return { code, message };
68
61
  };
69
62
 
70
- export const OktaProtocol: Layer.Layer<API.Protocol> = makeRestProtocol<Config>(
71
- {
72
- // The Credentials service holds an effect — resolving it here (per
73
- // request, on the calling fiber) picks up context-provided credentials.
74
- credentials: Effect.gen(function* () {
75
- const resolve = yield* Credentials;
76
- return yield* resolve;
63
+ export const OktaProtocol: Layer.Layer<API.Protocol> = makeRestProtocol<Config>({
64
+ // The Credentials service holds an effect — resolving it here (per
65
+ // request, on the calling fiber) picks up context-provided credentials.
66
+ credentials: Effect.gen(function* () {
67
+ const resolve = yield* Credentials;
68
+ return yield* resolve;
69
+ }),
70
+ baseUrl: (creds) => creds.apiBaseUrl,
71
+ headers: (creds) => formatHeaders(creds),
72
+ errorEnvelope,
73
+ unknownError: ({ code, message, body }) =>
74
+ new UnknownOktaError({
75
+ code: typeof code === "string" ? code : code !== undefined ? String(code) : undefined,
76
+ message,
77
+ body,
77
78
  }),
78
- baseUrl: (creds) => creds.apiBaseUrl,
79
- headers: (creds) => formatHeaders(creds),
80
- errorEnvelope,
81
- unknownError: ({ code, message, body }) =>
82
- new UnknownOktaError({
83
- code:
84
- typeof code === "string"
85
- ? code
86
- : code !== undefined
87
- ? String(code)
88
- : undefined,
89
- message,
90
- body,
91
- }),
92
- parseError: ({ body, cause }) => new OktaParseError({ body, cause }),
93
- },
94
- );
79
+ parseError: ({ body, cause }) => new OktaParseError({ body, cause }),
80
+ });
package/src/retry.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type Policy, throttlingFactory, transientFactory } from "@distilled.cloud/core/retry";
1
2
  /**
2
3
  * Okta retry configuration.
3
4
  *
@@ -16,11 +17,6 @@
16
17
  import * as Context from "effect/Context";
17
18
  import * as Effect from "effect/Effect";
18
19
  import * as Layer from "effect/Layer";
19
- import {
20
- type Policy,
21
- throttlingFactory,
22
- transientFactory,
23
- } from "@distilled.cloud/core/retry";
24
20
 
25
21
  export {
26
22
  type Options,
@@ -43,9 +39,7 @@ export const policy = (optionsOrFactory: Policy) =>
43
39
  Effect.provide(Layer.succeed(Retry, optionsOrFactory));
44
40
 
45
41
  /** Disables all automatic retries. */
46
- export const none = Effect.provide(
47
- Layer.succeed(Retry, { while: () => false }),
48
- );
42
+ export const none = Effect.provide(Layer.succeed(Retry, { while: () => false }));
49
43
 
50
44
  /** Apply the throttling retry policy (retries throttling errors indefinitely). */
51
45
  export const throttling = policy(throttlingFactory);