@distilled.cloud/okta 1.0.0-rc.16 → 1.0.0-rc.18

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 ee,errors$Forbidden as a,errors$GatewayTimeout as te,errors$HTTP_STATUS_MAP as ne,errors$InternalServerError as re,errors$Locked as o,errors$NotFound as s,errors$ServiceUnavailable as c,errors$TooManyRequests as ie,errors$Unauthorized as ae,errors$UnprocessableEntity as oe,protocol_rest$RawResponse as se,protocol_rest$RawResponseRoot as l,protocol_rest$SensitiveValue as u,protocol_rest$makeRestProtocol as d,protocol_rest$rawResponseRootSymbol as f,protocol_rest$rawResponseSymbol as p,protocol_rest$sensitiveValueSymbol as m,schema_lite$Array as h,schema_lite$Boolean as g,schema_lite$NullOr as _,schema_lite$Number as v,schema_lite$Record as y,schema_lite$String as b,schema_lite$Struct as x,schema_lite$StructWithRest 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,category$withAuthError as P,category$withBadRequestError as F,category$withConflictError as I,category$withParseError as L,category$withServerError as R,retry$capped as z,retry$jittered as B,retry$makeDefault as V,retry$throttlingFactory as H,retry$throttlingOptions as U,retry$transientFactory as W,retry$transientOptions as G,schema_lite_typed$String as K,schema_lite_typed$TaggedError as q,schema_lite_typed$Unknown as J,schema_lite_typed$optional as Y,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 X from"effect/Context";import*as Z from"effect/Effect";import*as Q from"effect/Layer";import*as $ from"effect/Redacted";var Credentials=class extends (/*@__PURE__*/ X.Service()(`OktaCredentials`)){};const stripTrailingSlash=e=>e.replace(/\/+$/,``);const fromApiToken=e=>Q.succeed(Credentials,Z.succeed({apiToken:e.apiToken,apiBaseUrl:stripTrailingSlash(e.apiBaseUrl),authScheme:e.authScheme??`SSWS`}));const fromAccessToken=e=>fromApiToken({apiToken:e.accessToken,apiBaseUrl:e.apiBaseUrl,authScheme:`Bearer`});const je=/*@__PURE__*/ Q.succeed(Credentials,/*@__PURE__*/ Z.gen(function*(){const e=process.env.OKTA_API_TOKEN;const t=process.env.OKTA_ORG_URL;const n=process.env.OKTA_AUTH_SCHEME;if(!e||!t)return yield*new r({message:`OKTA_API_TOKEN and OKTA_ORG_URL environment variables are required`});const i=n===`Bearer`||n===`SSWS`?n:`SSWS`;return{apiToken:$.make(e),apiBaseUrl:stripTrailingSlash(t),authScheme:i}}));const formatHeaders=e=>({Authorization:`${e.authScheme} ${$.value(e.apiToken)}`,Accept:`application/json`});var UnknownOktaError=class extends (/*@__PURE__*/ q()(`UnknownOktaError`,{code:/*@__PURE__*/ Y(K),message:/*@__PURE__*/ Y(K),body:J}).pipe(R)){};var OktaParseError=class extends (/*@__PURE__*/ q()(`OktaParseError`,{body:J,cause:J}).pipe(L)){};const errorEnvelope=e=>{if(e===null||typeof e!==`object`)return void 0;const t=e;const n=typeof t.errorCode===`string`?t.errorCode:typeof t.code===`string`?t.code:void 0;const r=typeof t.errorSummary===`string`?t.errorSummary:typeof t.message===`string`?t.message:void 0;if(n===void 0&&r===void 0)return void 0;return{code:n,message:r}};const Me=/*@__PURE__*/ d({credentials:/*@__PURE__*/ Z.flatMap(Credentials,e=>e),baseUrl:e=>e.apiBaseUrl,headers:e=>formatHeaders(e),errorEnvelope,unknownError:({code:e,message:t,body:n})=>new UnknownOktaError({code:typeof e===`string`?e:e!==void 0?String(e):void 0,message:t,body:n}),parseError:({body:e,cause:t})=>new OktaParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ X.Service()(`OktaRetry`)){};const policy=e=>Z.provide(Q.succeed(Retry,e));const Ne=/*@__PURE__*/ Z.provide(/*@__PURE__*/ Q.succeed(Retry,{while:()=>false}));const Pe=/*@__PURE__*/ policy(H);const Fe=/*@__PURE__*/ policy(W);export{h as Jb,g as Kb,_ as Rb,v as Sb,y as Tb,b as Vb,x as Wb,S as Xb,C as Yb,O as a,w as ac,k as c,T as cc,Credentials as credentials$Credentials,je as credentials$CredentialsFromEnv,formatHeaders as credentials$formatHeaders,fromAccessToken as credentials$fromAccessToken,fromApiToken as credentials$fromApiToken,A as e,e as errors$API_ERRORS,t as errors$BadGateway,n as errors$BadRequest,r as errors$ConfigError,i as errors$Conflict,ee as errors$DEFAULT_ERRORS,a as errors$Forbidden,te as errors$GatewayTimeout,ne as errors$HTTP_STATUS_MAP,re as errors$InternalServerError,o as errors$Locked,s as errors$NotFound,OktaParseError as errors$OktaParseError,c as errors$ServiceUnavailable,ie as errors$TooManyRequests,ae as errors$Unauthorized,UnknownOktaError as errors$UnknownOktaError,oe as errors$UnprocessableEntity,E as hc,D as ic,j,M as k,N as l,Me as protocol$OktaProtocol,Retry as retry$Retry,z as retry$capped,B as retry$jittered,V as retry$makeDefault,Ne as retry$none,policy as retry$policy,Pe as retry$throttling,H as retry$throttlingFactory,U as retry$throttlingOptions,Fe as retry$transient,W as retry$transientFactory,G as retry$transientOptions,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,se as traits$RawResponse,l as traits$RawResponseRoot,ge as traits$ResponseCode,u 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,f as traits$rawResponseRootSymbol,p as traits$rawResponseSymbol,ke as traits$responseCodeSymbol,m as traits$sensitiveValueSymbol,Ae as traits$unionCasesSymbol,P as va,F as wa,I as za};
2
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","names":["Schema.String","Schema.Unknown","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","StructWithRest","TaggedError","Unknown","at","optional","suspend","D","call","error","named","newError","op","withAuthError","withBadRequestError","withConflictError","withParseError","withServerError","capped","jittered","makeDefault","throttlingFactory","throttlingOptions","transientFactory","transientOptions","String$2","TaggedError$1","Unknown$1","optional$1","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","url","config","CredentialsFromEnv","apiToken","apiBaseUrl","scheme","authScheme","body","b","code","message","OktaProtocol","resolve","creds","optionsOrFactory","none","throttling","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"0xEA6BA,IAAa,YAAb,eACwB,gBAAQ,QAAyD,CAAC,CACtF,iBACF,EAAA,AAAE,CAAC,EAEL,MAAM,mBAAsB,GAAwByF,EAAI,QAAQ,OAAQ,EAAE,EAG1E,MAAa,aAAgB,GAK3BF,EAAM,QACJ,YACAD,EAAO,QAAQ,CACb,SAAUI,EAAO,SACjB,WAAY,mBAAmBA,EAAO,UAAU,EAChD,WAAYA,EAAO,YAAc,MACnC,CAAC,CACH,EAGF,MAAa,gBAAmB,GAI9B,aAAa,CACX,SAAUA,EAAO,YACjB,WAAYA,EAAO,WACnB,WAAY,QACd,CAAC,EAMH,MAAaC,GAA6D,gBAAM,QAC9E,YACc,gBAAO,IAAI,WAAa,CACpC,MAAMC,EAAW,QAAQ,IAAI,eAC7B,MAAMC,EAAa,QAAQ,IAAI,aAC/B,MAAMC,EAAS,QAAQ,IAAI,iBAE3B,GAAI,CAACF,GAAY,CAACC,EAChB,OAAO,MAAO,IAAItF,EAAY,CAC5B,QAAS,oEACX,CAAC,EAGH,MAAMwF,EAAyBD,IAAW,UAAYA,IAAW,OAASA,EAAS,OAEnF,MAAO,CACL,SAAUN,EAAS,KAAKI,CAAQ,EAChC,WAAY,mBAAmBC,CAAU,EACzC,YACF,CACF,CAAC,CACH,EAGA,MAAa,cAAiB,IAA4C,CACxE,cAAe,GAAGH,EAAO,WAAW,GAAGF,EAAS,MAAME,EAAO,QAAQ,IACrE,OAAQ,kBACV,GC5DA,IAAa,iBAAb,eACwB,gBAAqC,CAAC,CAAC,m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AO,QACzB,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAGA,MAAaC,GAA2B,qBAAOnD,CAAiB,EAGhE,MAAaoD,GAA0B,qBAAOlD,CAAgB"}
@@ -1,3 +1,4 @@
1
+ import { ConfigError } from "@distilled.cloud/core/errors";
1
2
  /**
2
3
  * Okta credentials -- hand-written.
3
4
  *
@@ -23,7 +24,7 @@ export interface Config {
23
24
  readonly apiBaseUrl: string;
24
25
  readonly authScheme: AuthScheme;
25
26
  }
26
- declare const Credentials_base: Context.ServiceClass<Credentials, "OktaCredentials", Effect.Effect<Config, never, never>>;
27
+ declare const Credentials_base: Context.ServiceClass<Credentials, "OktaCredentials", Effect.Effect<Config, ConfigError, never>>;
27
28
  export declare class Credentials extends /*@__PURE__*/ Credentials_base {
28
29
  }
29
30
  /** Layer from an SSWS API token + org base URL. */
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE3C,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAAwE;CAAG;AAInG,mDAAmD;AACnD,eAAO,MAAM,YAAY,WAAY;IACnC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAA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B;CAAG;AAIN,mDAAmD;AACnD,eAAO,MAAM,YAAY,WAAY;IACnC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;CAClC,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAQxB,CAAC;AAEJ,2DAA2D;AAC3D,eAAO,MAAM,eAAe,WAAY;IACtC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAKvB,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAqBvD,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,aAAa,WAAY,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAGlE,CAAC"}
@@ -1,61 +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()("OktaCredentials") {
21
- }
22
- const stripTrailingSlash = (url) => url.replace(/\/+$/, "");
23
-
24
- export const fromApiToken = (config) => Layer.succeed(Credentials, Effect.succeed({
25
- apiToken: config.apiToken,
26
- apiBaseUrl: stripTrailingSlash(config.apiBaseUrl),
27
- authScheme: config.authScheme ?? "SSWS",
28
- }));
29
-
30
- export const fromAccessToken = (config) => fromApiToken({
31
- apiToken: config.accessToken,
32
- apiBaseUrl: config.apiBaseUrl,
33
- authScheme: "Bearer",
34
- });
35
-
36
-
37
-
38
-
39
- export const CredentialsFromEnv = /*@__PURE__*/ Layer.succeed(Credentials,
40
- /*@__PURE__*/ Effect.gen(function* () {
41
- const apiToken = process.env.OKTA_API_TOKEN;
42
- const apiBaseUrl = process.env.OKTA_ORG_URL;
43
- const scheme = process.env.OKTA_AUTH_SCHEME;
44
- if (!apiToken || !apiBaseUrl) {
45
- return yield* new ConfigError({
46
- message: "OKTA_API_TOKEN and OKTA_ORG_URL environment variables are required",
47
- });
48
- }
49
- const authScheme = scheme === "Bearer" || scheme === "SSWS" ? scheme : "SSWS";
50
- return {
51
- apiToken: Redacted.make(apiToken),
52
- apiBaseUrl: stripTrailingSlash(apiBaseUrl),
53
- authScheme,
54
- };
55
- }).pipe(Effect.orDie));
56
-
57
- export const formatHeaders = (config) => ({
58
- Authorization: `${config.authScheme} ${Redacted.value(config.apiToken)}`,
59
- Accept: "application/json",
60
- });
61
- //# sourceMappingURL=credentials.js.map
1
+ export { credentials$Credentials as Credentials, credentials$CredentialsFromEnv as CredentialsFromEnv, credentials$formatHeaders as formatHeaders, credentials$fromAccessToken as fromAccessToken, credentials$fromApiToken as fromApiToken } 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 UnknownOktaError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("UnknownOktaError", {
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 OktaParseError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("OktaParseError", {
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$OktaParseError as OktaParseError, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownOktaError as UnknownOktaError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
package/lib/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @distilled.cloud/okta -- Okta Management SDK for Effect.
3
3
  *
4
- * `./services` is generated by `scripts/generate.ts` from the Smithy model
5
- * in `.generated-specs` (written by `scripts/convert.ts` from the OpenAPI
6
- * spec). Everything else in this folder is hand-written.
4
+ * `./services` is generated by `scripts/generate.ts` from the Smithy model that
5
+ * `scripts/convert.ts` converts from the OpenAPI spec. Everything else in this
6
+ * folder is hand-written.
7
7
  *
8
8
  * @example
9
9
  * ```ts
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 { OktaProtocol } from "./protocol.js";
19
5
  export { paginateCursor } 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/okta.js";
27
9
  export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity } from "./services/okta.js";
28
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ export * from "./credentials.js";
2
+ export * from "./errors.js";
3
+ export * as T from "./traits.js";
4
+ export { OktaProtocol } from "./protocol.js";
5
+ export { paginateCursor } from "./pagination.js";
6
+ export * as Retry from "./retry.js";
7
+ export * as Services from "./services.lazy/index.js";
8
+ export * from "./services.lazy/okta.js";
9
+ export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity } from "./services.lazy/okta.js";
package/lib/pagination.js CHANGED
@@ -1,10 +1 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
- export { paginateCursor } from "@distilled.cloud/core/pagination";
10
- //# sourceMappingURL=pagination.js.map
1
+ import{pagination$paginateCursor as e}from"@distilled.cloud/core/_bundle/base";export{e as paginateCursor};
package/lib/protocol.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type * as API from "@distilled.cloud/core/api";
2
- import type { API_ERRORS, ConfigError } from "@distilled.cloud/core/errors";
2
+ import type { API_ERRORS, ConfigError, InvalidInput } from "@distilled.cloud/core/errors";
3
3
  import type * as HttpClient from "effect/http/HttpClient";
4
4
  import type * as HttpClientError from "effect/http/HttpClientError";
5
5
  import type * as Layer from "effect/Layer";
@@ -11,7 +11,7 @@ import { UnknownOktaError, OktaParseError } from "./errors.ts";
11
11
  * OktaOpContext>` explicitly so the compiler never infers these back out of
12
12
  * the schema generics.
13
13
  */
14
- export type OktaOpError = InstanceType<(typeof API_ERRORS)[number]> | UnknownOktaError | ConfigError | HttpClientError.HttpClientError | OktaParseError;
14
+ export type OktaOpError = InstanceType<(typeof API_ERRORS)[number]> | UnknownOktaError | ConfigError | HttpClientError.HttpClientError | OktaParseError | InvalidInput;
15
15
  /** Context (requirements) shared by every generated Okta operation. */
16
16
  export type OktaOpContext = Credentials | HttpClient.HttpClient;
17
17
  export declare const OktaProtocol: Layer.Layer<API.Protocol>;
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAmB5E,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAA8B,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,gBAAgB,GAChB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,cAAc,CAAC;AAEnB,uEAAuE;AACvE,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAsBhE,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAcjD,CAAC"}
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAmB1F,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAA8B,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,gBAAgB,GAChB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,cAAc,GACd,YAAY,CAAC;AAEjB,uEAAuE;AACvE,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAsBhE,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAcjD,CAAC"}
package/lib/protocol.js CHANGED
@@ -1,54 +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 { Credentials, formatHeaders } from "./credentials.js";
20
- import { UnknownOktaError, OktaParseError } from "./errors.js";
21
-
22
-
23
-
24
-
25
-
26
- const errorEnvelope = (body) => {
27
- if (body === null || typeof body !== "object")
28
- return undefined;
29
- const b = body;
30
- const code = typeof b.errorCode === "string" ? b.errorCode : typeof b.code === "string" ? b.code : undefined;
31
- const message = typeof b.errorSummary === "string"
32
- ? b.errorSummary
33
- : typeof b.message === "string"
34
- ? b.message
35
- : undefined;
36
- if (code === undefined && message === undefined)
37
- return undefined;
38
- return { code, message };
39
- };
40
- export const OktaProtocol = /*@__PURE__*/ makeRestProtocol({
41
- // The Credentials service holds an effect -- resolving it here (per
42
- // request, on the calling fiber) picks up context-provided credentials.
43
- credentials: /*@__PURE__*/ Effect.flatMap(Credentials, (resolve) => resolve),
44
- baseUrl: (creds) => creds.apiBaseUrl,
45
- headers: (creds) => formatHeaders(creds),
46
- errorEnvelope,
47
- unknownError: ({ code, message, body }) => new UnknownOktaError({
48
- code: typeof code === "string" ? code : code !== undefined ? String(code) : undefined,
49
- message,
50
- body,
51
- }),
52
- parseError: ({ body, cause }) => new OktaParseError({ body, cause }),
53
- });
54
- //# sourceMappingURL=protocol.js.map
1
+ export { protocol$OktaProtocol as OktaProtocol } 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()("OktaRetry") {
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 okta from "./okta.js";
3
- //# sourceMappingURL=index.js.map
@@ -81,6 +81,7 @@ export interface HrefObjectSelfLink {
81
81
  templated?: boolean;
82
82
  /** The media type of the link. If omitted, it is implicitly `application/json`. */
83
83
  type?: string;
84
+ [key: string]: unknown;
84
85
  }
85
86
  /** Specifies link relations (see [Web Linking](https://www.rfc-editor.org/rfc/rfc8288)) available using the [JSON Hypertext Application Language](https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-06) specification. This object is used for dynamic discovery of related resources and lifecycle operations. */
86
87
  export interface LinksSelf {
@@ -1015,6 +1016,7 @@ export interface IdentityProviderLinks {
1015
1016
  activate?: HrefObjectSelfLink;
1016
1017
  /** IdP keys */
1017
1018
  keys?: HrefObjectSelfLink;
1019
+ [key: string]: unknown;
1018
1020
  }
1019
1021
  export interface IdentityProvider {
1020
1022
  created?: string;
@@ -1873,6 +1875,7 @@ export type GroupAssignmentProfile = {
1873
1875
  export interface HrefObjectSelfLinkInput {
1874
1876
  /** Link URI */
1875
1877
  href: string;
1878
+ [key: string]: unknown;
1876
1879
  }
1877
1880
  export type HrefObjectAppLinkInput = HrefObjectSelfLinkInput;
1878
1881
  export type HrefObjectGroupLinkInput = HrefObjectSelfLinkInput;
@@ -2326,6 +2329,7 @@ export interface IdPKeyCredential {
2326
2329
  x5c?: X5c;
2327
2330
  /** Base64url-encoded SHA-256 thumbprint of the DER encoding of an X.509 certificate */
2328
2331
  x5t_S256?: string;
2332
+ [key: string]: unknown;
2329
2333
  }
2330
2334
  export interface ClonePolicyRequest {
2331
2335
  /** `id` of the policy */
@@ -3115,6 +3119,7 @@ export interface OrgCreationAdminProfile {
3115
3119
  email: string;
3116
3120
  /** The unique identifier for the User (`username`) */
3117
3121
  login: string;
3122
+ [key: string]: unknown;
3118
3123
  }
3119
3124
  /** Profile and credential information for the first super admin user of the child org. If you plan to configure and manage the org programmatically, create a system user with a dedicated email address and a strong password. > **Note:** If you don't provide `credentials`, the super admin user is prompted to set up their credentials when they sign in to the org for the first time. */
3120
3125
  export interface OrgCreationAdmin {
@@ -3816,6 +3821,7 @@ export interface CreateIdentityProviderRequestLinks {
3816
3821
  activate?: HrefObjectSelfLinkInput;
3817
3822
  /** IdP keys */
3818
3823
  keys?: HrefObjectSelfLinkInput;
3824
+ [key: string]: unknown;
3819
3825
  }
3820
3826
  export interface CreateIdentityProviderRequest {
3821
3827
  issuerMode?: IdentityProviderIssuerMode | (string & {});
@@ -4803,6 +4809,7 @@ export interface UserProfile {
4803
4809
  userType?: string | null;
4804
4810
  /** The ZIP code or postal code component of the user's address (`postalCode`) */
4805
4811
  zipCode?: string | null;
4812
+ [key: string]: unknown;
4806
4813
  }
4807
4814
  /** The ID of the user type. Add this value if you want to create a user with a non-default [User Type](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/UserType/). The user type determines which [schema](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Schema/) applies to that user. After a user has been created, the user can only be assigned a different user type by an administrator through a full replacement (`PUT`) operation. */
4808
4815
  export interface CreateUserRequestType {
@@ -4837,6 +4844,7 @@ export type UserOutputEmbeddedMap = {
4837
4844
  };
4838
4845
  /** Specifies link relations (see [Web Linking](https://datatracker.ietf.org/doc/html/rfc8288) available for the current status of a user. The links object is used for dynamic discovery of related resources, lifecycle operations, and credential operations. The links object is read-only. For an individual user result, the links object contains a full set of link relations available for that user as determined by your policies. For a collection of users, the links object contains only the `self` link. Operations that return a collection of users include [List all users](https://developer.okta.com/docs/api/openapi/okta-management/management/user/listusers) and [List all group member users](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Group/#tag/Group/operation/listGroupUsers). */
4839
4846
  export interface UserOutputLinks {
4847
+ /** URL to the individual user */
4840
4848
  self?: HrefObjectSelfLink;
4841
4849
  /** URL to activate the user */
4842
4850
  activate?: HrefObjectSelfLink;
@@ -6608,6 +6616,7 @@ export interface IdPCsrLinks {
6608
6616
  self?: HrefObjectSelfLink;
6609
6617
  /** Publish the CSR */
6610
6618
  publish?: HrefObjectSelfLink;
6619
+ [key: string]: unknown;
6611
6620
  }
6612
6621
  /** Defines a CSR for a signature or decryption credential for an IdP */
6613
6622
  export interface IdPCsr {
@@ -8544,6 +8553,7 @@ export interface IdentityProviderApplicationUserLinks {
8544
8553
  idp?: HrefObjectSelfLink;
8545
8554
  /** The linked Okta user */
8546
8555
  user?: HrefObjectSelfLink;
8556
+ [key: string]: unknown;
8547
8557
  }
8548
8558
  export interface IdentityProviderApplicationUser {
8549
8559
  created?: string;
@@ -9445,10 +9455,25 @@ export interface GetUserRequest {
9445
9455
  export type GetUserResponseTransitioningToStatus = "ACTIVE" | "DEPROVISIONED" | "PROVISIONED";
9446
9456
  /** The user type that determines the schema for the user's profile. The `type` property is a map that identifies the [User Types](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/UserType/#tag/UserType). Currently it contains a single element, `id`. It can be specified when creating a new user, and can be updated by an admin on a full replace of an existing user (but not a partial update). */
9447
9457
  export type GetUserResponseType = CreateUserRequestType;
9458
+ /** The devices that the block applies to */
9459
+ export type UserBlockAppliesTo = "ANY_DEVICES" | "UNKNOWN_DEVICES";
9460
+ /** Type of access block */
9461
+ export type UserBlockType = "DEVICE_BASED";
9462
+ /** Describes how the account is blocked from access. If `appliesTo` is `ANY_DEVICES`, then the account is blocked for all devices. If `appliesTo` is `UNKNOWN_DEVICES`, then the account is only blocked for unknown devices. */
9463
+ export interface UserBlock {
9464
+ /** The devices that the block applies to */
9465
+ appliesTo?: UserBlockAppliesTo;
9466
+ /** Type of access block */
9467
+ type?: UserBlockType;
9468
+ }
9469
+ /** A list of access block details for the user account */
9470
+ export type GetUserResponseEmbeddedBlocksList = Array<UserBlock>;
9448
9471
  /** Embedded resources related to the user using the [JSON Hypertext Application Language](https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-06) specification */
9449
- export type GetUserResponseEmbeddedMap = {
9450
- [key: string]: unknown | undefined;
9451
- };
9472
+ export interface GetUserResponseEmbedded {
9473
+ /** A list of access block details for the user account */
9474
+ blocks?: GetUserResponseEmbeddedBlocksList;
9475
+ [key: string]: unknown;
9476
+ }
9452
9477
  /** Specifies link relations (see [Web Linking](https://datatracker.ietf.org/doc/html/rfc8288) available for the current status of a user. The links object is used for dynamic discovery of related resources, lifecycle operations, and credential operations. The links object is read-only. For an individual user result, the links object contains a full set of link relations available for that user as determined by your policies. For a collection of users, the links object contains only the `self` link. Operations that return a collection of users include [List all users](https://developer.okta.com/docs/api/openapi/okta-management/management/user/listusers) and [List all group member users](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Group/#tag/Group/operation/listGroupUsers). */
9453
9478
  export type GetUserResponseLinks = UserOutputLinks;
9454
9479
  export interface GetUserResponse {
@@ -9476,7 +9501,7 @@ export interface GetUserResponse {
9476
9501
  /** The user type that determines the schema for the user's profile. The `type` property is a map that identifies the [User Types](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/UserType/#tag/UserType). Currently it contains a single element, `id`. It can be specified when creating a new user, and can be updated by an admin on a full replace of an existing user (but not a partial update). */
9477
9502
  type?: CreateUserRequestType;
9478
9503
  /** Embedded resources related to the user using the [JSON Hypertext Application Language](https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-06) specification */
9479
- _embedded?: GetUserResponseEmbeddedMap;
9504
+ _embedded?: GetUserResponseEmbedded;
9480
9505
  /** Specifies link relations (see [Web Linking](https://datatracker.ietf.org/doc/html/rfc8288) available for the current status of a user. The links object is used for dynamic discovery of related resources, lifecycle operations, and credential operations. The links object is read-only. For an individual user result, the links object contains a full set of link relations available for that user as determined by your policies. For a collection of users, the links object contains only the `self` link. Operations that return a collection of users include [List all users](https://developer.okta.com/docs/api/openapi/okta-management/management/user/listusers) and [List all group member users](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Group/#tag/Group/operation/listGroupUsers). */
9481
9506
  _links?: UserOutputLinks;
9482
9507
  }
@@ -11468,17 +11493,6 @@ export interface ListUserBlocksRequest {
11468
11493
  /** An ID, login, or login shortname (as long as the shortname is unambiguous) of an existing Okta user */
11469
11494
  id: string;
11470
11495
  }
11471
- /** The devices that the block applies to */
11472
- export type UserBlockAppliesTo = "ANY_DEVICES" | "UNKNOWN_DEVICES";
11473
- /** Type of access block */
11474
- export type UserBlockType = "DEVICE_BASED";
11475
- /** Describes how the account is blocked from access. If `appliesTo` is `ANY_DEVICES`, then the account is blocked for all devices. If `appliesTo` is `UNKNOWN_DEVICES`, then the account is only blocked for unknown devices. */
11476
- export interface UserBlock {
11477
- /** The devices that the block applies to */
11478
- appliesTo?: UserBlockAppliesTo;
11479
- /** Type of access block */
11480
- type?: UserBlockType;
11481
- }
11482
11496
  export type ListUserBlocksResponseBodyList = Array<UserBlock>;
11483
11497
  export type ListUserBlocksResponse = ListUserBlocksResponseBodyList;
11484
11498
  export interface ListUserClientsRequest {