@workos-inc/node 8.0.0-rc.1 → 8.0.0-rc.3
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/cjs/api-keys/api-keys.cjs +45 -0
- package/lib/cjs/api-keys/api-keys.cjs.map +1 -0
- package/lib/cjs/api-keys/api-keys.d.cts +130 -0
- package/lib/cjs/api-keys/interfaces/api-key.interface.cjs +17 -0
- package/lib/cjs/api-keys/interfaces/api-key.interface.cjs.map +1 -0
- package/lib/cjs/api-keys/interfaces/api-key.interface.d.cts +30 -0
- package/lib/cjs/api-keys/interfaces/validate-api-key.interface.cjs +17 -0
- package/lib/cjs/api-keys/interfaces/validate-api-key.interface.cjs.map +1 -0
- package/lib/cjs/api-keys/interfaces/validate-api-key.interface.d.cts +13 -0
- package/lib/cjs/api-keys/serializers/api-key.serializer.cjs +43 -0
- package/lib/cjs/api-keys/serializers/api-key.serializer.cjs.map +1 -0
- package/lib/cjs/api-keys/serializers/api-key.serializer.d.cts +5 -0
- package/lib/cjs/api-keys/serializers/validate-api-key.serializer.cjs +36 -0
- package/lib/cjs/api-keys/serializers/validate-api-key.serializer.cjs.map +1 -0
- package/lib/cjs/api-keys/serializers/validate-api-key.serializer.d.cts +6 -0
- package/lib/cjs/audit-logs/audit-logs.d.cts +11 -9
- package/lib/cjs/client/sso.cjs +2 -2
- package/lib/cjs/client/sso.cjs.map +1 -1
- package/lib/cjs/client/user-management.cjs +2 -2
- package/lib/cjs/client/user-management.cjs.map +1 -1
- package/lib/cjs/common/exceptions/unprocessable-entity.exception.cjs +1 -12
- package/lib/cjs/common/exceptions/unprocessable-entity.exception.cjs.map +1 -1
- package/lib/cjs/common/net/fetch-client.cjs +4 -4
- package/lib/cjs/common/net/fetch-client.cjs.map +1 -1
- package/lib/cjs/common/net/http-client.cjs +4 -1
- package/lib/cjs/common/net/http-client.cjs.map +1 -1
- package/lib/cjs/common/net/http-client.d.cts +1 -0
- package/lib/cjs/common/utils/fetch-and-deserialize.d.cts +9 -7
- package/lib/cjs/common/utils/leb128.cjs +101 -0
- package/lib/cjs/common/utils/leb128.cjs.map +1 -0
- package/lib/cjs/common/utils/leb128.d.cts +24 -0
- package/lib/cjs/common/utils/query-string.cjs +66 -0
- package/lib/cjs/common/utils/query-string.cjs.map +1 -0
- package/lib/cjs/common/utils/query-string.d.cts +11 -0
- package/lib/cjs/directory-sync/directory-sync.d.cts +3 -1
- package/lib/cjs/events/events.d.cts +10 -8
- package/lib/cjs/fga/fga.d.cts +9 -7
- package/lib/cjs/fga/utils/fetch-and-deserialize-list.d.cts +10 -8
- package/lib/cjs/index.d.cts +3 -1
- package/lib/cjs/index.worker.d.cts +3 -1
- package/lib/cjs/mfa/mfa.d.cts +11 -9
- package/lib/cjs/organization-domains/organization-domains.d.cts +11 -9
- package/lib/cjs/organizations/organizations.d.cts +8 -6
- package/lib/cjs/passwordless/passwordless.d.cts +11 -9
- package/lib/cjs/portal/portal.d.cts +11 -9
- package/lib/cjs/sso/sso.d.cts +8 -6
- package/lib/cjs/user-management/session.cjs +10 -8
- package/lib/cjs/user-management/session.cjs.map +1 -1
- package/lib/cjs/user-management/session.d.cts +11 -9
- package/lib/cjs/user-management/user-management.cjs +14 -8
- package/lib/cjs/user-management/user-management.cjs.map +1 -1
- package/lib/cjs/user-management/user-management.d.cts +8 -6
- package/lib/cjs/{client/utils.cjs → utils/jose.cjs} +11 -16
- package/lib/cjs/utils/jose.cjs.map +1 -0
- package/lib/cjs/utils/jose.d.cts +17 -0
- package/lib/cjs/vault/vault.cjs +3 -3
- package/lib/cjs/vault/vault.cjs.map +1 -1
- package/lib/cjs/vault/vault.d.cts +9 -7
- package/lib/cjs/widgets/interfaces/get-token.cjs.map +1 -1
- package/lib/cjs/widgets/interfaces/get-token.d.cts +1 -1
- package/lib/cjs/widgets/widgets.d.cts +11 -9
- package/lib/cjs/{workos-BcNRiAbw.d.cts → workos-X1cDErJB.d.cts} +18 -11
- package/lib/cjs/workos.cjs +3 -1
- package/lib/cjs/workos.cjs.map +1 -1
- package/lib/cjs/workos.d.cts +11 -9
- package/lib/esm/api-keys/api-keys.d.ts +130 -0
- package/lib/esm/api-keys/api-keys.js +22 -0
- package/lib/esm/api-keys/api-keys.js.map +1 -0
- package/lib/esm/api-keys/interfaces/api-key.interface.d.ts +30 -0
- package/lib/esm/api-keys/interfaces/api-key.interface.js +1 -0
- package/lib/esm/api-keys/interfaces/api-key.interface.js.map +1 -0
- package/lib/esm/api-keys/interfaces/validate-api-key.interface.d.ts +13 -0
- package/lib/esm/api-keys/interfaces/validate-api-key.interface.js +1 -0
- package/lib/esm/api-keys/interfaces/validate-api-key.interface.js.map +1 -0
- package/lib/esm/api-keys/serializers/api-key.serializer.d.ts +5 -0
- package/lib/esm/api-keys/serializers/api-key.serializer.js +20 -0
- package/lib/esm/api-keys/serializers/api-key.serializer.js.map +1 -0
- package/lib/esm/api-keys/serializers/validate-api-key.serializer.d.ts +6 -0
- package/lib/esm/api-keys/serializers/validate-api-key.serializer.js +13 -0
- package/lib/esm/api-keys/serializers/validate-api-key.serializer.js.map +1 -0
- package/lib/esm/audit-logs/audit-logs.d.ts +11 -9
- package/lib/esm/client/sso.js +1 -1
- package/lib/esm/client/sso.js.map +1 -1
- package/lib/esm/client/user-management.js +1 -1
- package/lib/esm/client/user-management.js.map +1 -1
- package/lib/esm/common/exceptions/unprocessable-entity.exception.js +1 -2
- package/lib/esm/common/exceptions/unprocessable-entity.exception.js.map +1 -1
- package/lib/esm/common/net/fetch-client.js +4 -4
- package/lib/esm/common/net/fetch-client.js.map +1 -1
- package/lib/esm/common/net/http-client.d.ts +1 -0
- package/lib/esm/common/net/http-client.js +4 -1
- package/lib/esm/common/net/http-client.js.map +1 -1
- package/lib/esm/common/utils/fetch-and-deserialize.d.ts +9 -7
- package/lib/esm/common/utils/leb128.d.ts +24 -0
- package/lib/esm/common/utils/leb128.js +77 -0
- package/lib/esm/common/utils/leb128.js.map +1 -0
- package/lib/esm/common/utils/query-string.d.ts +11 -0
- package/lib/esm/common/utils/query-string.js +43 -0
- package/lib/esm/common/utils/query-string.js.map +1 -0
- package/lib/esm/directory-sync/directory-sync.d.ts +3 -1
- package/lib/esm/events/events.d.ts +10 -8
- package/lib/esm/fga/fga.d.ts +9 -7
- package/lib/esm/fga/utils/fetch-and-deserialize-list.d.ts +10 -8
- package/lib/esm/index.d.ts +3 -1
- package/lib/esm/index.worker.d.ts +3 -1
- package/lib/esm/mfa/mfa.d.ts +11 -9
- package/lib/esm/organization-domains/organization-domains.d.ts +11 -9
- package/lib/esm/organizations/organizations.d.ts +8 -6
- package/lib/esm/passwordless/passwordless.d.ts +11 -9
- package/lib/esm/portal/portal.d.ts +11 -9
- package/lib/esm/sso/sso.d.ts +8 -6
- package/lib/esm/user-management/session.d.ts +11 -9
- package/lib/esm/user-management/session.js +7 -5
- package/lib/esm/user-management/session.js.map +1 -1
- package/lib/esm/user-management/user-management.d.ts +8 -6
- package/lib/esm/user-management/user-management.js +11 -5
- package/lib/esm/user-management/user-management.js.map +1 -1
- package/lib/esm/utils/jose.d.ts +17 -0
- package/lib/esm/utils/jose.js +11 -0
- package/lib/esm/utils/jose.js.map +1 -0
- package/lib/esm/vault/vault.d.ts +9 -7
- package/lib/esm/vault/vault.js +1 -1
- package/lib/esm/vault/vault.js.map +1 -1
- package/lib/esm/widgets/interfaces/get-token.d.ts +1 -1
- package/lib/esm/widgets/interfaces/get-token.js.map +1 -1
- package/lib/esm/widgets/widgets.d.ts +11 -9
- package/lib/esm/{workos-e5MfmByv.d.ts → workos-DLj13cxf.d.ts} +18 -11
- package/lib/esm/workos.d.ts +11 -9
- package/lib/esm/workos.js +3 -1
- package/lib/esm/workos.js.map +1 -1
- package/package.json +7 -7
- package/lib/cjs/client/utils.cjs.map +0 -1
- package/lib/cjs/client/utils.d.cts +0 -7
- package/lib/esm/client/utils.d.ts +0 -7
- package/lib/esm/client/utils.js +0 -16
- package/lib/esm/client/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/common/net/fetch-client.ts"],"sourcesContent":["import {\n HttpClientInterface,\n HttpClientResponseInterface,\n RequestHeaders,\n RequestOptions,\n ResponseHeaders,\n} from '../interfaces/http-client.interface';\nimport { HttpClient, HttpClientError, HttpClientResponse } from './http-client';\nimport { ParseError } from '../exceptions/parse-error';\n\ninterface FetchHttpClientOptions extends RequestInit {\n timeout?: number;\n}\n\nconst DEFAULT_FETCH_TIMEOUT = 60_000; // 60 seconds\nexport class FetchHttpClient extends HttpClient implements HttpClientInterface {\n private readonly _fetchFn;\n\n constructor(\n readonly baseURL: string,\n readonly options?: FetchHttpClientOptions,\n fetchFn?: typeof fetch,\n ) {\n super(baseURL, options);\n\n // Default to global fetch if available\n if (!fetchFn) {\n if (!globalThis.fetch) {\n throw new Error(\n 'Fetch function not defined in the global scope and no replacement was provided.',\n );\n }\n fetchFn = globalThis.fetch;\n }\n\n this._fetchFn = fetchFn.bind(globalThis);\n }\n\n /** @override */\n getClientName(): string {\n return 'fetch';\n }\n\n async get(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'GET',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(resourceURL, 'GET', null, options.headers);\n }\n }\n\n async post<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async put<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async delete(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n }\n }\n\n private async fetchRequest(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n // For methods which expect payloads, we should always pass a body value\n // even when it is empty. Without this, some JS runtimes (eg. Deno) will\n // inject a second Content-Length header.\n const methodHasPayload =\n method === 'POST' || method === 'PUT' || method === 'PATCH';\n\n const requestBody = body || (methodHasPayload ? '' : undefined);\n\n const { 'User-Agent': userAgent } = (this.options?.headers ||\n {}) as RequestHeaders;\n\n // Access timeout from the options with default of 60 seconds\n const timeout = this.options?.timeout ?? DEFAULT_FETCH_TIMEOUT; // Default 60 seconds\n const abortController = new AbortController();\n const timeoutId = setTimeout(() => {\n abortController?.abort();\n }, timeout);\n\n try {\n const res = await this._fetchFn(url, {\n method,\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n ...this.options?.headers,\n ...headers,\n 'User-Agent': this.addClientToUserAgent(\n (userAgent || 'workos-node').toString(),\n ),\n },\n body: requestBody,\n signal: abortController?.signal,\n });\n\n // Clear timeout if request completed successfully\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n if (!res.ok) {\n const requestID = res.headers.get('X-Request-ID') ?? '';\n const rawBody = await res.text();\n\n let responseJson: any;\n\n try {\n responseJson = JSON.parse(rawBody);\n } catch (error) {\n if (error instanceof SyntaxError) {\n throw new ParseError({\n message: error.message,\n rawBody,\n requestID,\n rawStatus: res.status,\n });\n }\n throw error;\n }\n\n throw new HttpClientError({\n message: res.statusText,\n response: {\n status: res.status,\n headers: res.headers,\n data: responseJson,\n },\n });\n }\n return new FetchHttpClientResponse(res);\n } catch (error) {\n // Clear timeout if request failed\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n // Handle timeout errors\n if (error instanceof Error && error.name === 'AbortError') {\n throw new HttpClientError({\n message: `Request timeout after ${timeout}ms`,\n response: {\n status: 408,\n headers: {},\n data: { error: 'Request timeout' },\n },\n });\n }\n\n throw error;\n }\n }\n\n private async fetchRequestWithRetry(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n let response: HttpClientResponseInterface;\n let retryAttempts = 1;\n\n const makeRequest = async (): Promise<HttpClientResponseInterface> => {\n let requestError: any = null;\n\n try {\n response = await this.fetchRequest(url, method, body, headers);\n } catch (e) {\n requestError = e;\n }\n\n if (this.shouldRetryRequest(requestError, retryAttempts)) {\n retryAttempts++;\n await this.sleep(retryAttempts);\n return makeRequest();\n }\n\n if (requestError != null) {\n throw requestError;\n }\n\n return response;\n };\n\n return makeRequest();\n }\n\n private shouldRetryRequest(requestError: any, retryAttempt: number): boolean {\n if (retryAttempt > this.MAX_RETRY_ATTEMPTS) {\n return false;\n }\n\n if (requestError != null) {\n if (requestError instanceof TypeError) {\n return true;\n }\n\n if (\n requestError instanceof HttpClientError &&\n this.RETRY_STATUS_CODES.includes(requestError.response.status)\n ) {\n return true;\n }\n }\n\n return false;\n }\n}\n\n// tslint:disable-next-line\nexport class FetchHttpClientResponse\n extends HttpClientResponse\n implements HttpClientResponseInterface\n{\n _res: Response;\n\n constructor(res: Response) {\n super(\n res.status,\n FetchHttpClientResponse._transformHeadersToObject(res.headers),\n );\n this._res = res;\n }\n\n getRawResponse(): Response {\n return this._res;\n }\n\n toJSON(): Promise<any> | null {\n const contentType = this._res.headers.get('content-type');\n const isJsonResponse = contentType?.includes('application/json');\n\n return isJsonResponse ? this._res.json() : null;\n }\n\n static _transformHeadersToObject(headers: Headers): ResponseHeaders {\n // Fetch uses a Headers instance so this must be converted to a barebones\n // JS object to meet the HttpClient interface.\n const headersObj: ResponseHeaders = {};\n for (const entry of Object.entries(headers)) {\n if (!Array.isArray(entry) || entry.length !== 2) {\n throw new Error(\n 'Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.',\n );\n }\n\n headersObj[entry[0]] = entry[1];\n }\n\n return headersObj;\n }\n}\n"],"mappings":";;AAOA,SAAS,YAAY,iBAAiB,0BAA0B;AAChE,SAAS,kBAAkB;AAM3B,MAAM,wBAAwB;AACvB,MAAM,wBAAwB,WAA0C;AAAA,EAG7E,YACW,SACA,SACT,SACA;AACA,UAAM,SAAS,OAAO;AAJb;AACA;AAMT,QAAI,CAAC,SAAS;AACZ,UAAI,CAAC,WAAW,OAAO;AACrB,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AACA,gBAAU,WAAW;AAAA,IACvB;AAEA,SAAK,WAAW,QAAQ,KAAK,UAAU;AAAA,EACzC;AAAA,EApCF,OAe+E;AAAA;AAAA;AAAA,EAC5D;AAAA;AAAA,EAuBjB,gBAAwB;AACtB,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,IACJ,MACA,SACsC;AACtC,UAAM,cAAc,WAAW;AAAA,MAC7B,KAAK;AAAA,MACL;AAAA,MACA,QAAQ;AAAA,IACV;AAEA,QAAI,KAAK,WAAW,OAAO,GAAG;AAC5B,a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AA,EACrB;AAAA,EAEQ,mBAAmB,cAAmB,cAA+B;AAC3E,QAAI,eAAe,KAAK,oBAAoB;AAC1C,aAAO;AAAA,IACT;AAEA,QAAI,gBAAgB,MAAM;AACxB,UAAI,wBAAwB,WAAW;AACrC,eAAO;AAAA,MACT;AAEA,UACE,wBAAwB,mBACxB,KAAK,mBAAmB,SAAS,aAAa,SAAS,MAAM,GAC7D;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAGO,MAAM,gCACH,mBAEV;AAAA,EA7TA,OA6TA;AAAA;AAAA;AAAA,EACE;AAAA,EAEA,YAAY,KAAe;AACzB;AAAA,MACE,IAAI;AAAA,MACJ,wBAAwB,0BAA0B,IAAI,OAAO;AAAA,IAC/D;AACA,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,iBAA2B;AACzB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,SAA8B;AAC5B,UAAM,cAAc,KAAK,KAAK,QAAQ,IAAI,cAAc;AACxD,UAAM,iBAAiB,aAAa,SAAS,kBAAkB;AAE/D,WAAO,iBAAiB,KAAK,KAAK,KAAK,IAAI;AAAA,EAC7C;AAAA,EAEA,OAAO,0BAA0B,SAAmC;AAGlE,UAAM,aAA8B,CAAC;AACrC,eAAW,SAAS,OAAO,QAAQ,OAAO,GAAG;AAC3C,UAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG;AAC/C,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAEA,iBAAW,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC;AAAA,IAChC;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/common/net/fetch-client.ts"],"sourcesContent":["import {\n HttpClientInterface,\n HttpClientResponseInterface,\n RequestHeaders,\n RequestOptions,\n ResponseHeaders,\n} from '../interfaces/http-client.interface';\nimport { HttpClient, HttpClientError, HttpClientResponse } from './http-client';\nimport { ParseError } from '../exceptions/parse-error';\n\ninterface FetchHttpClientOptions extends RequestInit {\n timeout?: number;\n}\n\nconst DEFAULT_FETCH_TIMEOUT = 60_000; // 60 seconds\nexport class FetchHttpClient extends HttpClient implements HttpClientInterface {\n private readonly _fetchFn;\n\n constructor(\n readonly baseURL: string,\n readonly options?: FetchHttpClientOptions,\n fetchFn?: typeof fetch,\n ) {\n super(baseURL, options);\n\n // Default to global fetch if available\n if (!fetchFn) {\n if (!globalThis.fetch) {\n throw new Error(\n 'Fetch function not defined in the global scope and no replacement was provided.',\n );\n }\n fetchFn = globalThis.fetch;\n }\n\n this._fetchFn = fetchFn.bind(globalThis);\n }\n\n /** @override */\n getClientName(): string {\n return 'fetch';\n }\n\n async get(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (HttpClient.isPathRetryable(path)) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'GET',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(resourceURL, 'GET', null, options.headers);\n }\n }\n\n async post<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (HttpClient.isPathRetryable(path)) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async put<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (HttpClient.isPathRetryable(path)) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async delete(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (HttpClient.isPathRetryable(path)) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n }\n }\n\n private async fetchRequest(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n // For methods which expect payloads, we should always pass a body value\n // even when it is empty. Without this, some JS runtimes (eg. Deno) will\n // inject a second Content-Length header.\n const methodHasPayload =\n method === 'POST' || method === 'PUT' || method === 'PATCH';\n\n const requestBody = body || (methodHasPayload ? '' : undefined);\n\n const { 'User-Agent': userAgent } = (this.options?.headers ||\n {}) as RequestHeaders;\n\n // Access timeout from the options with default of 60 seconds\n const timeout = this.options?.timeout ?? DEFAULT_FETCH_TIMEOUT; // Default 60 seconds\n const abortController = new AbortController();\n const timeoutId = setTimeout(() => {\n abortController?.abort();\n }, timeout);\n\n try {\n const res = await this._fetchFn(url, {\n method,\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n ...this.options?.headers,\n ...headers,\n 'User-Agent': this.addClientToUserAgent(\n (userAgent || 'workos-node').toString(),\n ),\n },\n body: requestBody,\n signal: abortController?.signal,\n });\n\n // Clear timeout if request completed successfully\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n if (!res.ok) {\n const requestID = res.headers.get('X-Request-ID') ?? '';\n const rawBody = await res.text();\n\n let responseJson: any;\n\n try {\n responseJson = JSON.parse(rawBody);\n } catch (error) {\n if (error instanceof SyntaxError) {\n throw new ParseError({\n message: error.message,\n rawBody,\n requestID,\n rawStatus: res.status,\n });\n }\n throw error;\n }\n\n throw new HttpClientError({\n message: res.statusText,\n response: {\n status: res.status,\n headers: res.headers,\n data: responseJson,\n },\n });\n }\n return new FetchHttpClientResponse(res);\n } catch (error) {\n // Clear timeout if request failed\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n // Handle timeout errors\n if (error instanceof Error && error.name === 'AbortError') {\n throw new HttpClientError({\n message: `Request timeout after ${timeout}ms`,\n response: {\n status: 408,\n headers: {},\n data: { error: 'Request timeout' },\n },\n });\n }\n\n throw error;\n }\n }\n\n private async fetchRequestWithRetry(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n let response: HttpClientResponseInterface;\n let retryAttempts = 1;\n\n const makeRequest = async (): Promise<HttpClientResponseInterface> => {\n let requestError: any = null;\n\n try {\n response = await this.fetchRequest(url, method, body, headers);\n } catch (e) {\n requestError = e;\n }\n\n if (this.shouldRetryRequest(requestError, retryAttempts)) {\n retryAttempts++;\n await this.sleep(retryAttempts);\n return makeRequest();\n }\n\n if (requestError != null) {\n throw requestError;\n }\n\n return response;\n };\n\n return makeRequest();\n }\n\n private shouldRetryRequest(requestError: any, retryAttempt: number): boolean {\n if (retryAttempt > this.MAX_RETRY_ATTEMPTS) {\n return false;\n }\n\n if (requestError != null) {\n if (requestError instanceof TypeError) {\n return true;\n }\n\n if (\n requestError instanceof HttpClientError &&\n this.RETRY_STATUS_CODES.includes(requestError.response.status)\n ) {\n return true;\n }\n }\n\n return false;\n }\n}\n\n// tslint:disable-next-line\nexport class FetchHttpClientResponse\n extends HttpClientResponse\n implements HttpClientResponseInterface\n{\n _res: Response;\n\n constructor(res: Response) {\n super(\n res.status,\n FetchHttpClientResponse._transformHeadersToObject(res.headers),\n );\n this._res = res;\n }\n\n getRawResponse(): Response {\n return this._res;\n }\n\n toJSON(): Promise<any> | null {\n const contentType = this._res.headers.get('content-type');\n const isJsonResponse = contentType?.includes('application/json');\n\n return isJsonResponse ? this._res.json() : null;\n }\n\n static _transformHeadersToObject(headers: Headers): ResponseHeaders {\n // Fetch uses a Headers instance so this must be converted to a barebones\n // JS object to meet the HttpClient interface.\n const headersObj: ResponseHeaders = {};\n for (const entry of Object.entries(headers)) {\n if (!Array.isArray(entry) || entry.length !== 2) {\n throw new Error(\n 'Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.',\n );\n }\n\n headersObj[entry[0]] = entry[1];\n }\n\n return headersObj;\n }\n}\n"],"mappings":";;AAOA,SAAS,YAAY,iBAAiB,0BAA0B;AAChE,SAAS,kBAAkB;AAM3B,MAAM,wBAAwB;AACvB,MAAM,wBAAwB,WAA0C;AAAA,EAG7E,YACW,SACA,SACT,SACA;AACA,UAAM,SAAS,OAAO;AAJb;AACA;AAMT,QAAI,CAAC,SAAS;AACZ,UAAI,CAAC,WAAW,OAAO;AACrB,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AACA,gBAAU,WAAW;AAAA,IACvB;AAEA,SAAK,WAAW,QAAQ,KAAK,UAAU;AAAA,EACzC;AAAA,EApCF,OAe+E;AAAA;AAAA;AAAA,EAC5D;AAAA;AAAA,EAuBjB,gBAAwB;AACtB,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,IACJ,MACA,SACsC;AACtC,UAAM,cAAc,WAAW;AAAA,MAC7B,KAAK;AAAA,MACL;AAAA,MACA,QAAQ;AAAA,IACV;AAEA,QAAI,WAAW,gBAAgB,IAAI,GAAG;AACpC,aAAO,MAAM,KAAK;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ;AAAA,MACV;AAAA,IACF,OAAO;AACL,aAAO,MAAM,KAAK,aAAa,aAAa,OAAO,MAAM,QAAQ,OAAO;AAAA,IAC1E;AAA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AAA,MACT;AAEA,UACE,wBAAwB,mBACxB,KAAK,mBAAmB,SAAS,aAAa,SAAS,MAAM,GAC7D;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAGO,MAAM,gCACH,mBAEV;AAAA,EA7TA,OA6TA;AAAA;AAAA;AAAA,EACE;AAAA,EAEA,YAAY,KAAe;AACzB;AAAA,MACE,IAAI;AAAA,MACJ,wBAAwB,0BAA0B,IAAI,OAAO;AAAA,IAC/D;AACA,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,iBAA2B;AACzB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,SAA8B;AAC5B,UAAM,cAAc,KAAK,KAAK,QAAQ,IAAI,cAAc;AACxD,UAAM,iBAAiB,aAAa,SAAS,kBAAkB;AAE/D,WAAO,iBAAiB,KAAK,KAAK,KAAK,IAAI;AAAA,EAC7C;AAAA,EAEA,OAAO,0BAA0B,SAAmC;AAGlE,UAAM,aAA8B,CAAC;AACrC,eAAW,SAAS,OAAO,QAAQ,OAAO,GAAG;AAC3C,UAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG;AAC/C,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAEA,iBAAW,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC;AAAA,IAChC;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -19,6 +19,7 @@ declare abstract class HttpClient implements HttpClientInterface {
|
|
|
19
19
|
static getQueryString(queryObj?: Record<string, any>): string | undefined;
|
|
20
20
|
static getContentTypeHeader(entity: any): RequestHeaders | undefined;
|
|
21
21
|
static getBody(entity: any): BodyInit | null | undefined;
|
|
22
|
+
static isPathRetryable(path: string): boolean;
|
|
22
23
|
private getSleepTimeInMilliseconds;
|
|
23
24
|
sleep: (retryAttempt: number) => Promise<unknown>;
|
|
24
25
|
}
|
|
@@ -11,7 +11,7 @@ class HttpClient {
|
|
|
11
11
|
MAX_RETRY_ATTEMPTS = 3;
|
|
12
12
|
BACKOFF_MULTIPLIER = 1.5;
|
|
13
13
|
MINIMUM_SLEEP_TIME_IN_MILLISECONDS = 500;
|
|
14
|
-
RETRY_STATUS_CODES = [500, 502, 504];
|
|
14
|
+
RETRY_STATUS_CODES = [408, 500, 502, 504];
|
|
15
15
|
/** The HTTP client name used for diagnostics */
|
|
16
16
|
getClientName() {
|
|
17
17
|
throw new Error("getClientName not implemented");
|
|
@@ -50,6 +50,9 @@ class HttpClient {
|
|
|
50
50
|
}
|
|
51
51
|
return JSON.stringify(entity);
|
|
52
52
|
}
|
|
53
|
+
static isPathRetryable(path) {
|
|
54
|
+
return path.startsWith("/fga/") || path.startsWith("/vault/");
|
|
55
|
+
}
|
|
53
56
|
getSleepTimeInMilliseconds(retryAttempt) {
|
|
54
57
|
const sleepTime = this.MINIMUM_SLEEP_TIME_IN_MILLISECONDS * Math.pow(this.BACKOFF_MULTIPLIER, retryAttempt);
|
|
55
58
|
const jitter = Math.random() + 0.5;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/common/net/http-client.ts"],"sourcesContent":["import {\n HttpClientInterface,\n HttpClientResponseInterface,\n RequestHeaders,\n RequestOptions,\n ResponseHeaders,\n} from '../interfaces/http-client.interface';\n\nexport abstract class HttpClient implements HttpClientInterface {\n readonly MAX_RETRY_ATTEMPTS = 3;\n readonly BACKOFF_MULTIPLIER = 1.5;\n readonly MINIMUM_SLEEP_TIME_IN_MILLISECONDS = 500;\n readonly RETRY_STATUS_CODES = [500, 502, 504];\n\n constructor(\n readonly baseURL: string,\n readonly options?: RequestInit,\n ) {}\n\n /** The HTTP client name used for diagnostics */\n getClientName(): string {\n throw new Error('getClientName not implemented');\n }\n\n abstract get(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract post<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract put<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract delete(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n addClientToUserAgent(userAgent: string): string {\n if (userAgent.indexOf(' ') > -1) {\n return userAgent.replace(/\\b\\s/, `/${this.getClientName()} `);\n } else {\n return (userAgent += `/${this.getClientName()}`);\n }\n }\n\n static getResourceURL(\n baseURL: string,\n path: string,\n params?: Record<string, any>,\n ) {\n const queryString = HttpClient.getQueryString(params);\n const url = new URL([path, queryString].filter(Boolean).join('?'), baseURL);\n return url.toString();\n }\n\n static getQueryString(queryObj?: Record<string, any>) {\n if (!queryObj) return undefined;\n\n const sanitizedQueryObj: Record<string, any> = {};\n\n Object.entries(queryObj).forEach(([param, value]) => {\n if (value !== '' && value !== undefined) sanitizedQueryObj[param] = value;\n });\n\n return new URLSearchParams(sanitizedQueryObj).toString();\n }\n\n static getContentTypeHeader(entity: any): RequestHeaders | undefined {\n if (entity instanceof URLSearchParams) {\n return {\n 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',\n };\n }\n return undefined;\n }\n\n static getBody(entity: any): BodyInit | null | undefined {\n if (entity === null || entity instanceof URLSearchParams) {\n return entity;\n }\n\n return JSON.stringify(entity);\n }\n\n private getSleepTimeInMilliseconds(retryAttempt: number): number {\n const sleepTime =\n this.MINIMUM_SLEEP_TIME_IN_MILLISECONDS *\n Math.pow(this.BACKOFF_MULTIPLIER, retryAttempt);\n const jitter = Math.random() + 0.5;\n return sleepTime * jitter;\n }\n\n sleep = (retryAttempt: number) =>\n new Promise((resolve) =>\n setTimeout(resolve, this.getSleepTimeInMilliseconds(retryAttempt)),\n );\n}\n\n// tslint:disable-next-line\nexport abstract class HttpClientResponse\n implements HttpClientResponseInterface\n{\n _statusCode: number;\n _headers: ResponseHeaders;\n\n constructor(statusCode: number, headers: ResponseHeaders) {\n this._statusCode = statusCode;\n this._headers = headers;\n }\n\n getStatusCode(): number {\n return this._statusCode;\n }\n\n getHeaders(): ResponseHeaders {\n return this._headers;\n }\n\n abstract getRawResponse(): unknown;\n\n abstract toJSON(): any | null;\n}\n\n// tslint:disable-next-line\nexport class HttpClientError<T> extends Error {\n readonly name: string = 'HttpClientError';\n readonly message: string = 'The request could not be completed.';\n readonly response: { status: number; headers: any; data: T };\n\n constructor({\n message,\n response,\n }: {\n message: string;\n readonly response: HttpClientError<T>['response'];\n }) {\n super(message);\n this.message = message;\n this.response = response;\n }\n}\n"],"mappings":";;AAQO,MAAe,WAA0C;AAAA,EAM9D,YACW,SACA,SACT;AAFS;AACA;AAAA,EACR;AAAA,EAjBL,OAQgE;AAAA;AAAA;AAAA,EACrD,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qCAAqC;AAAA,EACrC,qBAAqB,CAAC,KAAK,KAAK,GAAG;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/common/net/http-client.ts"],"sourcesContent":["import {\n HttpClientInterface,\n HttpClientResponseInterface,\n RequestHeaders,\n RequestOptions,\n ResponseHeaders,\n} from '../interfaces/http-client.interface';\n\nexport abstract class HttpClient implements HttpClientInterface {\n readonly MAX_RETRY_ATTEMPTS = 3;\n readonly BACKOFF_MULTIPLIER = 1.5;\n readonly MINIMUM_SLEEP_TIME_IN_MILLISECONDS = 500;\n readonly RETRY_STATUS_CODES = [408, 500, 502, 504];\n\n constructor(\n readonly baseURL: string,\n readonly options?: RequestInit,\n ) {}\n\n /** The HTTP client name used for diagnostics */\n getClientName(): string {\n throw new Error('getClientName not implemented');\n }\n\n abstract get(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract post<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract put<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract delete(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n addClientToUserAgent(userAgent: string): string {\n if (userAgent.indexOf(' ') > -1) {\n return userAgent.replace(/\\b\\s/, `/${this.getClientName()} `);\n } else {\n return (userAgent += `/${this.getClientName()}`);\n }\n }\n\n static getResourceURL(\n baseURL: string,\n path: string,\n params?: Record<string, any>,\n ) {\n const queryString = HttpClient.getQueryString(params);\n const url = new URL([path, queryString].filter(Boolean).join('?'), baseURL);\n return url.toString();\n }\n\n static getQueryString(queryObj?: Record<string, any>) {\n if (!queryObj) return undefined;\n\n const sanitizedQueryObj: Record<string, any> = {};\n\n Object.entries(queryObj).forEach(([param, value]) => {\n if (value !== '' && value !== undefined) sanitizedQueryObj[param] = value;\n });\n\n return new URLSearchParams(sanitizedQueryObj).toString();\n }\n\n static getContentTypeHeader(entity: any): RequestHeaders | undefined {\n if (entity instanceof URLSearchParams) {\n return {\n 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',\n };\n }\n return undefined;\n }\n\n static getBody(entity: any): BodyInit | null | undefined {\n if (entity === null || entity instanceof URLSearchParams) {\n return entity;\n }\n\n return JSON.stringify(entity);\n }\n\n static isPathRetryable(path: string): boolean {\n return path.startsWith('/fga/') || path.startsWith('/vault/');\n }\n\n private getSleepTimeInMilliseconds(retryAttempt: number): number {\n const sleepTime =\n this.MINIMUM_SLEEP_TIME_IN_MILLISECONDS *\n Math.pow(this.BACKOFF_MULTIPLIER, retryAttempt);\n const jitter = Math.random() + 0.5;\n return sleepTime * jitter;\n }\n\n sleep = (retryAttempt: number) =>\n new Promise((resolve) =>\n setTimeout(resolve, this.getSleepTimeInMilliseconds(retryAttempt)),\n );\n}\n\n// tslint:disable-next-line\nexport abstract class HttpClientResponse\n implements HttpClientResponseInterface\n{\n _statusCode: number;\n _headers: ResponseHeaders;\n\n constructor(statusCode: number, headers: ResponseHeaders) {\n this._statusCode = statusCode;\n this._headers = headers;\n }\n\n getStatusCode(): number {\n return this._statusCode;\n }\n\n getHeaders(): ResponseHeaders {\n return this._headers;\n }\n\n abstract getRawResponse(): unknown;\n\n abstract toJSON(): any | null;\n}\n\n// tslint:disable-next-line\nexport class HttpClientError<T> extends Error {\n readonly name: string = 'HttpClientError';\n readonly message: string = 'The request could not be completed.';\n readonly response: { status: number; headers: any; data: T };\n\n constructor({\n message,\n response,\n }: {\n message: string;\n readonly response: HttpClientError<T>['response'];\n }) {\n super(message);\n this.message = message;\n this.response = response;\n }\n}\n"],"mappings":";;AAQO,MAAe,WAA0C;AAAA,EAM9D,YACW,SACA,SACT;AAFS;AACA;AAAA,EACR;AAAA,EAjBL,OAQgE;AAAA;AAAA;AAAA,EACrD,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qCAAqC;AAAA,EACrC,qBAAqB,CAAC,KAAK,KAAK,KAAK,GAAG;AAAA;AAAA,EAQjD,gBAAwB;AACtB,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAAA,EAwBA,qBAAqB,WAA2B;AAC9C,QAAI,UAAU,QAAQ,GAAG,IAAI,IAAI;AAC/B,aAAO,UAAU,QAAQ,QAAQ,IAAI,KAAK,cAAc,CAAC,GAAG;AAAA,IAC9D,OAAO;AACL,aAAQ,aAAa,IAAI,KAAK,cAAc,CAAC;AAAA,IAC/C;AAAA,EACF;AAAA,EAEA,OAAO,eACL,SACA,MACA,QACA;AACA,UAAM,cAAc,WAAW,eAAe,MAAM;AACpD,UAAM,MAAM,IAAI,IAAI,CAAC,MAAM,WAAW,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAAG,OAAO;AAC1E,WAAO,IAAI,SAAS;AAAA,EACtB;AAAA,EAEA,OAAO,eAAe,UAAgC;AACpD,QAAI,CAAC,SAAU,QAAO;AAEtB,UAAM,oBAAyC,CAAC;AAEhD,WAAO,QAAQ,QAAQ,EAAE,QAAQ,CAAC,CAAC,OAAO,KAAK,MAAM;AACnD,UAAI,UAAU,MAAM,UAAU,OAAW,mBAAkB,KAAK,IAAI;AAAA,IACtE,CAAC;AAED,WAAO,I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 @@
|
|
|
1
|
-
import { W as WorkOS } from '../../workos-
|
|
1
|
+
import { W as WorkOS } from '../../workos-DLj13cxf.js';
|
|
2
2
|
import { PaginationOptions } from '../interfaces/pagination-options.interface.js';
|
|
3
3
|
import { GetOptions } from '../interfaces/get-options.interface.js';
|
|
4
4
|
import { List } from '../interfaces/list.interface.js';
|
|
@@ -6,12 +6,16 @@ import '../interfaces/post-options.interface.js';
|
|
|
6
6
|
import '../interfaces/put-options.interface.js';
|
|
7
7
|
import '../interfaces/workos-options.interface.js';
|
|
8
8
|
import '../interfaces/app-info.interface.js';
|
|
9
|
-
import '
|
|
10
|
-
import '../interfaces/event.interface.js';
|
|
9
|
+
import './pagination.js';
|
|
11
10
|
import '../../directory-sync/interfaces/directory.interface.js';
|
|
12
11
|
import '../../directory-sync/interfaces/directory-group.interface.js';
|
|
12
|
+
import '../../directory-sync/interfaces/list-directories-options.interface.js';
|
|
13
|
+
import '../../directory-sync/interfaces/list-groups-options.interface.js';
|
|
14
|
+
import '../../directory-sync/interfaces/list-directory-users-options.interface.js';
|
|
13
15
|
import '../../directory-sync/interfaces/directory-user.interface.js';
|
|
14
16
|
import '../../roles/interfaces/role.interface.js';
|
|
17
|
+
import '../../events/interfaces/list-events-options.interface.js';
|
|
18
|
+
import '../interfaces/event.interface.js';
|
|
15
19
|
import '../../organizations/interfaces/organization.interface.js';
|
|
16
20
|
import '../../organization-domains/interfaces/organization-domain.interface.js';
|
|
17
21
|
import '../../sso/interfaces/connection.interface.js';
|
|
@@ -26,7 +30,6 @@ import '../../user-management/interfaces/magic-auth.interface.js';
|
|
|
26
30
|
import '../../user-management/interfaces/password-reset.interface.js';
|
|
27
31
|
import '../../user-management/interfaces/session.interface.js';
|
|
28
32
|
import '../../user-management/interfaces/impersonator.interface.js';
|
|
29
|
-
import './pagination.js';
|
|
30
33
|
import '../../organizations/interfaces/create-organization-options.interface.js';
|
|
31
34
|
import '../../organizations/interfaces/domain-data.interface.js';
|
|
32
35
|
import '../../organizations/interfaces/list-organization-feature-flags-options.interface.js';
|
|
@@ -123,9 +126,8 @@ import '../../vault/interfaces/object/delete-object.interface.js';
|
|
|
123
126
|
import '../../vault/interfaces/object/read-object.interface.js';
|
|
124
127
|
import '../../vault/interfaces/object.interface.js';
|
|
125
128
|
import '../../vault/interfaces/object/update-object.interface.js';
|
|
126
|
-
import '../../
|
|
127
|
-
import '../../
|
|
128
|
-
import '../../directory-sync/interfaces/list-directory-users-options.interface.js';
|
|
129
|
+
import '../../api-keys/interfaces/validate-api-key.interface.js';
|
|
130
|
+
import '../../api-keys/interfaces/api-key.interface.js';
|
|
129
131
|
|
|
130
132
|
declare const fetchAndDeserialize: <T, U>(workos: WorkOS, endpoint: string, deserializeFn: (data: T) => U, options?: PaginationOptions, requestOptions?: GetOptions) => Promise<List<U>>;
|
|
131
133
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LEB128 (Little Endian Base 128) encoding for unsigned 32-bit integers.
|
|
3
|
+
* Variable-length encoding: each byte stores 7 bits of data, bit 7 is continuation flag.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Encodes an unsigned 32-bit integer into LEB128 format.
|
|
7
|
+
*
|
|
8
|
+
* @param value - Unsigned 32-bit integer (0 to 4,294,967,295)
|
|
9
|
+
* @returns Encoded bytes (1-5 bytes depending on value)
|
|
10
|
+
*/
|
|
11
|
+
declare function encodeUInt32(value: number): Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* Decodes an unsigned 32-bit integer from LEB128 format.
|
|
14
|
+
*
|
|
15
|
+
* @param data - Buffer containing LEB128 encoded data
|
|
16
|
+
* @param offset - Starting position in buffer (default: 0)
|
|
17
|
+
* @returns Decoded value and index after last byte read
|
|
18
|
+
*/
|
|
19
|
+
declare function decodeUInt32(data: Uint8Array, offset?: number): {
|
|
20
|
+
value: number;
|
|
21
|
+
nextIndex: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { decodeUInt32, encodeUInt32 };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
const MAX_UINT32 = 4294967295;
|
|
4
|
+
const CONTINUATION_BIT = 128;
|
|
5
|
+
const DATA_BITS_MASK = 127;
|
|
6
|
+
const DATA_BITS_PER_BYTE = 7;
|
|
7
|
+
const MAX_BYTES_FOR_UINT32 = 5;
|
|
8
|
+
function encodeUInt32(value) {
|
|
9
|
+
validateUInt32(value);
|
|
10
|
+
if (value === 0) {
|
|
11
|
+
return new Uint8Array([0]);
|
|
12
|
+
}
|
|
13
|
+
const bytes = [];
|
|
14
|
+
do {
|
|
15
|
+
let byte = value & DATA_BITS_MASK;
|
|
16
|
+
value >>>= DATA_BITS_PER_BYTE;
|
|
17
|
+
if (value !== 0) {
|
|
18
|
+
byte |= CONTINUATION_BIT;
|
|
19
|
+
}
|
|
20
|
+
bytes.push(byte);
|
|
21
|
+
} while (value !== 0);
|
|
22
|
+
return new Uint8Array(bytes);
|
|
23
|
+
}
|
|
24
|
+
__name(encodeUInt32, "encodeUInt32");
|
|
25
|
+
function decodeUInt32(data, offset = 0) {
|
|
26
|
+
validateOffset(data, offset);
|
|
27
|
+
let result = 0;
|
|
28
|
+
let shift = 0;
|
|
29
|
+
let index = offset;
|
|
30
|
+
let bytesRead = 0;
|
|
31
|
+
while (index < data.length) {
|
|
32
|
+
const byte = data[index++];
|
|
33
|
+
bytesRead++;
|
|
34
|
+
if (bytesRead > MAX_BYTES_FOR_UINT32) {
|
|
35
|
+
throw new Error("LEB128 sequence exceeds maximum length for uint32");
|
|
36
|
+
}
|
|
37
|
+
result |= (byte & DATA_BITS_MASK) << shift;
|
|
38
|
+
if (!hasContinuationBit(byte)) {
|
|
39
|
+
return { value: result >>> 0, nextIndex: index };
|
|
40
|
+
}
|
|
41
|
+
shift += DATA_BITS_PER_BYTE;
|
|
42
|
+
}
|
|
43
|
+
throw new Error("Truncated LEB128 encoding");
|
|
44
|
+
}
|
|
45
|
+
__name(decodeUInt32, "decodeUInt32");
|
|
46
|
+
function validateUInt32(value) {
|
|
47
|
+
if (!Number.isFinite(value)) {
|
|
48
|
+
throw new Error("Value must be a finite number");
|
|
49
|
+
}
|
|
50
|
+
if (!Number.isInteger(value)) {
|
|
51
|
+
throw new Error("Value must be an integer");
|
|
52
|
+
}
|
|
53
|
+
if (value < 0) {
|
|
54
|
+
throw new Error("Value must be non-negative");
|
|
55
|
+
}
|
|
56
|
+
if (value > MAX_UINT32) {
|
|
57
|
+
throw new Error(`Value must not exceed ${MAX_UINT32} (MAX_UINT32)`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
__name(validateUInt32, "validateUInt32");
|
|
61
|
+
function validateOffset(data, offset) {
|
|
62
|
+
if (offset < 0 || offset >= data.length) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
`Offset ${offset} is out of bounds (buffer length: ${data.length})`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
__name(validateOffset, "validateOffset");
|
|
69
|
+
function hasContinuationBit(byte) {
|
|
70
|
+
return (byte & CONTINUATION_BIT) !== 0;
|
|
71
|
+
}
|
|
72
|
+
__name(hasContinuationBit, "hasContinuationBit");
|
|
73
|
+
export {
|
|
74
|
+
decodeUInt32,
|
|
75
|
+
encodeUInt32
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=leb128.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/common/utils/leb128.ts"],"sourcesContent":["/**\n * LEB128 (Little Endian Base 128) encoding for unsigned 32-bit integers.\n * Variable-length encoding: each byte stores 7 bits of data, bit 7 is continuation flag.\n */\n\nconst MAX_UINT32 = 0xffffffff;\nconst CONTINUATION_BIT = 0x80;\nconst DATA_BITS_MASK = 0x7f;\nconst DATA_BITS_PER_BYTE = 7;\nconst MAX_BYTES_FOR_UINT32 = 5;\n\n/**\n * Encodes an unsigned 32-bit integer into LEB128 format.\n *\n * @param value - Unsigned 32-bit integer (0 to 4,294,967,295)\n * @returns Encoded bytes (1-5 bytes depending on value)\n */\nexport function encodeUInt32(value: number): Uint8Array {\n validateUInt32(value);\n\n if (value === 0) {\n return new Uint8Array([0]);\n }\n\n const bytes: number[] = [];\n\n do {\n let byte = value & DATA_BITS_MASK;\n value >>>= DATA_BITS_PER_BYTE;\n\n if (value !== 0) {\n byte |= CONTINUATION_BIT;\n }\n\n bytes.push(byte);\n } while (value !== 0);\n\n return new Uint8Array(bytes);\n}\n\n/**\n * Decodes an unsigned 32-bit integer from LEB128 format.\n *\n * @param data - Buffer containing LEB128 encoded data\n * @param offset - Starting position in buffer (default: 0)\n * @returns Decoded value and index after last byte read\n */\nexport function decodeUInt32(\n data: Uint8Array,\n offset = 0,\n): { value: number; nextIndex: number } {\n validateOffset(data, offset);\n\n let result = 0;\n let shift = 0;\n let index = offset;\n let bytesRead = 0;\n\n while (index < data.length) {\n const byte = data[index++];\n bytesRead++;\n\n if (bytesRead > MAX_BYTES_FOR_UINT32) {\n throw new Error('LEB128 sequence exceeds maximum length for uint32');\n }\n\n result |= (byte & DATA_BITS_MASK) << shift;\n\n if (!hasContinuationBit(byte)) {\n return { value: result >>> 0, nextIndex: index };\n }\n\n shift += DATA_BITS_PER_BYTE;\n }\n\n throw new Error('Truncated LEB128 encoding');\n}\n\nfunction validateUInt32(value: number): void {\n if (!Number.isFinite(value)) {\n throw new Error('Value must be a finite number');\n }\n if (!Number.isInteger(value)) {\n throw new Error('Value must be an integer');\n }\n if (value < 0) {\n throw new Error('Value must be non-negative');\n }\n if (value > MAX_UINT32) {\n throw new Error(`Value must not exceed ${MAX_UINT32} (MAX_UINT32)`);\n }\n}\n\nfunction validateOffset(data: Uint8Array, offset: number): void {\n if (offset < 0 || offset >= data.length) {\n throw new Error(\n `Offset ${offset} is out of bounds (buffer length: ${data.length})`,\n );\n }\n}\n\nfunction hasContinuationBit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B;AAAA,EAC9C;AACA,MAAI,QAAQ,YAAY;AACtB,UAAM,IAAI,MAAM,yBAAyB,UAAU,eAAe;AAAA,EACpE;AACF;AAbS;AAeT,SAAS,eAAe,MAAkB,QAAsB;AAC9D,MAAI,SAAS,KAAK,UAAU,KAAK,QAAQ;AACvC,UAAM,IAAI;AAAA,MACR,UAAU,MAAM,qCAAqC,KAAK,MAAM;AAAA,IAClE;AAAA,EACF;AACF;AANS;AAQT,SAAS,mBAAmB,MAAuB;AACjD,UAAQ,OAAO,sBAAsB;AACvC;AAFS;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type QueryValue = string | string[] | Record<string, string | boolean | number> | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* Converts options to a query string.
|
|
4
|
+
* - Arrays: scope=read&scope=write (repeat format)
|
|
5
|
+
* - Objects: params[key]=value (bracket notation)
|
|
6
|
+
* - Encoding: RFC1738 (space as +)
|
|
7
|
+
* - Keys sorted alphabetically
|
|
8
|
+
*/
|
|
9
|
+
declare function toQueryString(options: Record<string, QueryValue>): string;
|
|
10
|
+
|
|
11
|
+
export { toQueryString };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
function toQueryString(options) {
|
|
4
|
+
const params = [];
|
|
5
|
+
const sortedKeys = Object.keys(options).sort((a, b) => a.localeCompare(b));
|
|
6
|
+
for (const key of sortedKeys) {
|
|
7
|
+
const value = options[key];
|
|
8
|
+
if (value === void 0) {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
if (Array.isArray(value)) {
|
|
12
|
+
for (const item of value) {
|
|
13
|
+
params.push([key, String(item)]);
|
|
14
|
+
}
|
|
15
|
+
} else if (typeof value === "object" && value !== null) {
|
|
16
|
+
const sortedSubKeys = Object.keys(value).sort(
|
|
17
|
+
(a, b) => a.localeCompare(b)
|
|
18
|
+
);
|
|
19
|
+
for (const subKey of sortedSubKeys) {
|
|
20
|
+
const subValue = value[subKey];
|
|
21
|
+
if (subValue !== void 0) {
|
|
22
|
+
params.push([`${key}[${subKey}]`, String(subValue)]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
params.push([key, String(value)]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return params.map(([key, value]) => {
|
|
30
|
+
const encodedKey = encodeRFC1738(key);
|
|
31
|
+
const encodedValue = encodeRFC1738(value);
|
|
32
|
+
return `${encodedKey}=${encodedValue}`;
|
|
33
|
+
}).join("&");
|
|
34
|
+
}
|
|
35
|
+
__name(toQueryString, "toQueryString");
|
|
36
|
+
function encodeRFC1738(str) {
|
|
37
|
+
return encodeURIComponent(str).replace(/%20/g, "+").replace(/[!'*]/g, (c) => "%" + c.charCodeAt(0).toString(16).toUpperCase());
|
|
38
|
+
}
|
|
39
|
+
__name(encodeRFC1738, "encodeRFC1738");
|
|
40
|
+
export {
|
|
41
|
+
toQueryString
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=query-string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/common/utils/query-string.ts"],"sourcesContent":["type QueryValue =\n | string\n | string[]\n | Record<string, string | boolean | number>\n | undefined;\n\n/**\n * Converts options to a query string.\n * - Arrays: scope=read&scope=write (repeat format)\n * - Objects: params[key]=value (bracket notation)\n * - Encoding: RFC1738 (space as +)\n * - Keys sorted alphabetically\n */\nexport function toQueryString(options: Record<string, QueryValue>): string {\n const params: Array<[string, string]> = [];\n const sortedKeys = Object.keys(options).sort((a, b) => a.localeCompare(b));\n\n for (const key of sortedKeys) {\n const value = options[key];\n\n if (value === undefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n params.push([key, String(item)]);\n }\n } else if (typeof value === 'object' && value !== null) {\n const sortedSubKeys = Object.keys(value).sort((a, b) =>\n a.localeCompare(b),\n );\n for (const subKey of sortedSubKeys) {\n const subValue = value[subKey];\n if (subValue !== undefined) {\n params.push([`${key}[${subKey}]`, String(subValue)]);\n }\n }\n } else {\n params.push([key, String(value)]);\n }\n }\n\n return params\n .map(([key, value]) => {\n const encodedKey = encodeRFC1738(key);\n const encodedValue = encodeRFC1738(value);\n return `${encodedKey}=${encodedValue}`;\n })\n .join('&');\n}\n\nfunction encodeRFC1738(str: string): string {\n return encodeURIComponent(str)\n .replace(/%20/g, '+')\n .replace(/[!'*]/g, (c) => '%' + c.charCodeAt(0).toString(16).toUpperCase());\n}\n"],"mappings":";;AAaO,SAAS,cAAc,SAA6C;AACzE,QAAM,SAAkC,CAAC;AACzC,QAAM,aAAa,OAAO,KAAK,OAAO,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;AAEzE,aAAW,OAAO,YAAY;AAC5B,UAAM,QAAQ,QAAQ,GAAG;AAEzB,QAAI,UAAU,QAAW;AACvB;AAAA,IACF;AAEA,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,iBAAW,QAAQ,OAAO;AACxB,eAAO,KAAK,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC;AAAA,MACjC;AAAA,IACF,WAAW,OAAO,UAAU,YAAY,UAAU,MAAM;AACtD,YAAM,gBAAgB,OAAO,KAAK,KAAK,EAAE;AAAA,QAAK,CAAC,GAAG,MAChD,EAAE,cAAc,CAAC;AAAA,MACnB;AACA,iBAAW,UAAU,eAAe;AAClC,cAAM,WAAW,MAAM,MAAM;AAC7B,YAAI,aAAa,QAAW;AAC1B,iBAAO,KAAK,CAAC,GAAG,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,CAAC,CAAC;AAAA,QACrD;AAAA,MACF;AAAA,IACF,OAAO;AACL,aAAO,KAAK,CAAC,KAAK,OAAO,KAAK,CAAC,CAAC;AAAA,IAClC;AAAA,EACF;AAEA,SAAO,OACJ,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACrB,UAAM,aAAa,cAAc,GAAG;AACpC,UAAM,eAAe,cAAc,KAAK;AACxC,WAAO,GAAG,UAAU,IAAI,YAAY;AAAA,EACtC,CAAC,EACA,KAAK,GAAG;AACb;AArCgB;AAuChB,SAAS,cAAc,KAAqB;AAC1C,SAAO,mBAAmB,GAAG,EAC1B,QAAQ,QAAQ,GAAG,EACnB,QAAQ,UAAU,CAAC,MAAM,MAAM,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,YAAY,CAAC;AAC9E;AAJS;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { D as DirectorySync } from '../workos-
|
|
1
|
+
export { D as DirectorySync } from '../workos-DLj13cxf.js';
|
|
2
2
|
import '../common/utils/pagination.js';
|
|
3
3
|
import './interfaces/directory.interface.js';
|
|
4
4
|
import './interfaces/directory-group.interface.js';
|
|
@@ -126,3 +126,5 @@ import '../vault/interfaces/object/delete-object.interface.js';
|
|
|
126
126
|
import '../vault/interfaces/object/read-object.interface.js';
|
|
127
127
|
import '../vault/interfaces/object.interface.js';
|
|
128
128
|
import '../vault/interfaces/object/update-object.interface.js';
|
|
129
|
+
import '../api-keys/interfaces/validate-api-key.interface.js';
|
|
130
|
+
import '../api-keys/interfaces/api-key.interface.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { E as Events } from '../workos-
|
|
1
|
+
export { E as Events } from '../workos-DLj13cxf.js';
|
|
2
2
|
import './interfaces/list-events-options.interface.js';
|
|
3
3
|
import '../common/interfaces/event.interface.js';
|
|
4
4
|
import '../common/interfaces/list.interface.js';
|
|
@@ -9,6 +9,13 @@ import '../common/interfaces/workos-options.interface.js';
|
|
|
9
9
|
import '../common/interfaces/app-info.interface.js';
|
|
10
10
|
import '../common/utils/pagination.js';
|
|
11
11
|
import '../common/interfaces/pagination-options.interface.js';
|
|
12
|
+
import '../directory-sync/interfaces/directory.interface.js';
|
|
13
|
+
import '../directory-sync/interfaces/directory-group.interface.js';
|
|
14
|
+
import '../directory-sync/interfaces/list-directories-options.interface.js';
|
|
15
|
+
import '../directory-sync/interfaces/list-groups-options.interface.js';
|
|
16
|
+
import '../directory-sync/interfaces/list-directory-users-options.interface.js';
|
|
17
|
+
import '../directory-sync/interfaces/directory-user.interface.js';
|
|
18
|
+
import '../roles/interfaces/role.interface.js';
|
|
12
19
|
import '../organizations/interfaces/create-organization-options.interface.js';
|
|
13
20
|
import '../organizations/interfaces/domain-data.interface.js';
|
|
14
21
|
import '../organizations/interfaces/list-organization-feature-flags-options.interface.js';
|
|
@@ -17,7 +24,6 @@ import '../organizations/interfaces/organization.interface.js';
|
|
|
17
24
|
import '../organization-domains/interfaces/organization-domain.interface.js';
|
|
18
25
|
import '../organizations/interfaces/update-organization-options.interface.js';
|
|
19
26
|
import '../feature-flags/interfaces/feature-flag.interface.js';
|
|
20
|
-
import '../roles/interfaces/role.interface.js';
|
|
21
27
|
import '../organizations/interfaces/list-organization-roles-options.interface.js';
|
|
22
28
|
import '../organization-domains/interfaces/create-organization-domain-options.interface.js';
|
|
23
29
|
import '../passwordless/interfaces/passwordless-session.interface.js';
|
|
@@ -36,9 +42,6 @@ import '../user-management/interfaces/oauth-tokens.interface.js';
|
|
|
36
42
|
import '../sso/interfaces/profile.interface.js';
|
|
37
43
|
import '../webhooks/webhooks.js';
|
|
38
44
|
import '../common/crypto/crypto-provider.js';
|
|
39
|
-
import '../directory-sync/interfaces/directory.interface.js';
|
|
40
|
-
import '../directory-sync/interfaces/directory-group.interface.js';
|
|
41
|
-
import '../directory-sync/interfaces/directory-user.interface.js';
|
|
42
45
|
import '../user-management/interfaces/user.interface.js';
|
|
43
46
|
import '../user-management/interfaces/authentication-event.interface.js';
|
|
44
47
|
import '../user-management/interfaces/authentication-radar-risk-detected-event.interface.js';
|
|
@@ -123,6 +126,5 @@ import '../vault/interfaces/object/delete-object.interface.js';
|
|
|
123
126
|
import '../vault/interfaces/object/read-object.interface.js';
|
|
124
127
|
import '../vault/interfaces/object.interface.js';
|
|
125
128
|
import '../vault/interfaces/object/update-object.interface.js';
|
|
126
|
-
import '../
|
|
127
|
-
import '../
|
|
128
|
-
import '../directory-sync/interfaces/list-directory-users-options.interface.js';
|
|
129
|
+
import '../api-keys/interfaces/validate-api-key.interface.js';
|
|
130
|
+
import '../api-keys/interfaces/api-key.interface.js';
|
package/lib/esm/fga/fga.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { F as FGA } from '../workos-
|
|
1
|
+
export { F as FGA } from '../workos-DLj13cxf.js';
|
|
2
2
|
import './interfaces/check.interface.js';
|
|
3
3
|
import './interfaces/query.interface.js';
|
|
4
4
|
import './interfaces/resource.interface.js';
|
|
@@ -11,12 +11,16 @@ import '../common/interfaces/post-options.interface.js';
|
|
|
11
11
|
import '../common/interfaces/put-options.interface.js';
|
|
12
12
|
import '../common/interfaces/workos-options.interface.js';
|
|
13
13
|
import '../common/interfaces/app-info.interface.js';
|
|
14
|
-
import '../events/interfaces/list-events-options.interface.js';
|
|
15
|
-
import '../common/interfaces/event.interface.js';
|
|
16
14
|
import '../directory-sync/interfaces/directory.interface.js';
|
|
17
15
|
import '../directory-sync/interfaces/directory-group.interface.js';
|
|
16
|
+
import '../directory-sync/interfaces/list-directories-options.interface.js';
|
|
17
|
+
import '../common/interfaces/pagination-options.interface.js';
|
|
18
|
+
import '../directory-sync/interfaces/list-groups-options.interface.js';
|
|
19
|
+
import '../directory-sync/interfaces/list-directory-users-options.interface.js';
|
|
18
20
|
import '../directory-sync/interfaces/directory-user.interface.js';
|
|
19
21
|
import '../roles/interfaces/role.interface.js';
|
|
22
|
+
import '../events/interfaces/list-events-options.interface.js';
|
|
23
|
+
import '../common/interfaces/event.interface.js';
|
|
20
24
|
import '../organizations/interfaces/organization.interface.js';
|
|
21
25
|
import '../organization-domains/interfaces/organization-domain.interface.js';
|
|
22
26
|
import '../sso/interfaces/connection.interface.js';
|
|
@@ -35,7 +39,6 @@ import '../common/interfaces/list.interface.js';
|
|
|
35
39
|
import '../organizations/interfaces/create-organization-options.interface.js';
|
|
36
40
|
import '../organizations/interfaces/domain-data.interface.js';
|
|
37
41
|
import '../organizations/interfaces/list-organization-feature-flags-options.interface.js';
|
|
38
|
-
import '../common/interfaces/pagination-options.interface.js';
|
|
39
42
|
import '../organizations/interfaces/list-organizations-options.interface.js';
|
|
40
43
|
import '../organizations/interfaces/update-organization-options.interface.js';
|
|
41
44
|
import '../feature-flags/interfaces/feature-flag.interface.js';
|
|
@@ -118,9 +121,8 @@ import '../vault/interfaces/object/delete-object.interface.js';
|
|
|
118
121
|
import '../vault/interfaces/object/read-object.interface.js';
|
|
119
122
|
import '../vault/interfaces/object.interface.js';
|
|
120
123
|
import '../vault/interfaces/object/update-object.interface.js';
|
|
121
|
-
import '../
|
|
122
|
-
import '../
|
|
123
|
-
import '../directory-sync/interfaces/list-directory-users-options.interface.js';
|
|
124
|
+
import '../api-keys/interfaces/validate-api-key.interface.js';
|
|
125
|
+
import '../api-keys/interfaces/api-key.interface.js';
|
|
124
126
|
import './interfaces/check-op.enum.js';
|
|
125
127
|
import './interfaces/warning.interface.js';
|
|
126
128
|
import './interfaces/resource-op.enum.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as WorkOS } from '../../workos-
|
|
1
|
+
import { W as WorkOS } from '../../workos-DLj13cxf.js';
|
|
2
2
|
import { FGAList } from '../interfaces/list.interface.js';
|
|
3
3
|
import { PaginationOptions } from '../../common/interfaces/pagination-options.interface.js';
|
|
4
4
|
import { QueryRequestOptions } from '../interfaces/query.interface.js';
|
|
@@ -7,12 +7,17 @@ import '../../common/interfaces/post-options.interface.js';
|
|
|
7
7
|
import '../../common/interfaces/put-options.interface.js';
|
|
8
8
|
import '../../common/interfaces/workos-options.interface.js';
|
|
9
9
|
import '../../common/interfaces/app-info.interface.js';
|
|
10
|
-
import '../../
|
|
11
|
-
import '../../common/interfaces/
|
|
10
|
+
import '../../common/utils/pagination.js';
|
|
11
|
+
import '../../common/interfaces/list.interface.js';
|
|
12
12
|
import '../../directory-sync/interfaces/directory.interface.js';
|
|
13
13
|
import '../../directory-sync/interfaces/directory-group.interface.js';
|
|
14
|
+
import '../../directory-sync/interfaces/list-directories-options.interface.js';
|
|
15
|
+
import '../../directory-sync/interfaces/list-groups-options.interface.js';
|
|
16
|
+
import '../../directory-sync/interfaces/list-directory-users-options.interface.js';
|
|
14
17
|
import '../../directory-sync/interfaces/directory-user.interface.js';
|
|
15
18
|
import '../../roles/interfaces/role.interface.js';
|
|
19
|
+
import '../../events/interfaces/list-events-options.interface.js';
|
|
20
|
+
import '../../common/interfaces/event.interface.js';
|
|
16
21
|
import '../../organizations/interfaces/organization.interface.js';
|
|
17
22
|
import '../../organization-domains/interfaces/organization-domain.interface.js';
|
|
18
23
|
import '../../sso/interfaces/connection.interface.js';
|
|
@@ -27,8 +32,6 @@ import '../../user-management/interfaces/magic-auth.interface.js';
|
|
|
27
32
|
import '../../user-management/interfaces/password-reset.interface.js';
|
|
28
33
|
import '../../user-management/interfaces/session.interface.js';
|
|
29
34
|
import '../../user-management/interfaces/impersonator.interface.js';
|
|
30
|
-
import '../../common/interfaces/list.interface.js';
|
|
31
|
-
import '../../common/utils/pagination.js';
|
|
32
35
|
import '../../organizations/interfaces/create-organization-options.interface.js';
|
|
33
36
|
import '../../organizations/interfaces/domain-data.interface.js';
|
|
34
37
|
import '../../organizations/interfaces/list-organization-feature-flags-options.interface.js';
|
|
@@ -123,9 +126,8 @@ import '../../vault/interfaces/object/delete-object.interface.js';
|
|
|
123
126
|
import '../../vault/interfaces/object/read-object.interface.js';
|
|
124
127
|
import '../../vault/interfaces/object.interface.js';
|
|
125
128
|
import '../../vault/interfaces/object/update-object.interface.js';
|
|
126
|
-
import '../../
|
|
127
|
-
import '../../
|
|
128
|
-
import '../../directory-sync/interfaces/list-directory-users-options.interface.js';
|
|
129
|
+
import '../../api-keys/interfaces/validate-api-key.interface.js';
|
|
130
|
+
import '../../api-keys/interfaces/api-key.interface.js';
|
|
129
131
|
|
|
130
132
|
declare const fetchAndDeserializeFGAList: <T, U>(workos: WorkOS, endpoint: string, deserializeFn: (data: T) => U, options?: PaginationOptions, requestOptions?: QueryRequestOptions) => Promise<FGAList<U>>;
|
|
131
133
|
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CryptoProvider } from './common/crypto/crypto-provider.js';
|
|
|
2
2
|
import { HttpClient } from './common/net/http-client.js';
|
|
3
3
|
import { Actions } from './actions/actions.js';
|
|
4
4
|
import { Webhooks } from './webhooks/webhooks.js';
|
|
5
|
-
import { W as WorkOS } from './workos-
|
|
5
|
+
import { W as WorkOS } from './workos-DLj13cxf.js';
|
|
6
6
|
export { AuthenticationEmailVerificationSucceededEvent, AuthenticationEmailVerificationSucceededEventResponse, AuthenticationMagicAuthFailedEvent, AuthenticationMagicAuthFailedEventResponse, AuthenticationMagicAuthSucceededEvent, AuthenticationMagicAuthSucceededEventResponse, AuthenticationMfaSucceededEvent, AuthenticationMfaSucceededEventResponse, AuthenticationOAuthFailedEvent, AuthenticationOAuthFailedEventResponse, AuthenticationOAuthSucceededEvent, AuthenticationOAuthSucceededEventResponse, AuthenticationPasswordFailedEvent, AuthenticationPasswordFailedEventResponse, AuthenticationPasswordSucceededEvent, AuthenticationPasswordSucceededEventResponse, AuthenticationRadarRiskDetectedEvent, AuthenticationRadarRiskDetectedEventResponse, AuthenticationSSOFailedEvent, AuthenticationSSOFailedEventResponse, AuthenticationSSOSucceededEvent, AuthenticationSSOSucceededEventResponse, ConnectionActivatedEvent, ConnectionActivatedEventResponse, ConnectionDeactivatedEvent, ConnectionDeactivatedEventResponse, ConnectionDeletedEvent, ConnectionDeletedEventResponse, DsyncActivatedEvent, DsyncActivatedEventResponse, DsyncDeletedEvent, DsyncDeletedEventResponse, DsyncGroupCreatedEvent, DsyncGroupCreatedEventResponse, DsyncGroupDeletedEvent, DsyncGroupDeletedEventResponse, DsyncGroupUpdatedEvent, DsyncGroupUpdatedEventResponse, DsyncGroupUserAddedEvent, DsyncGroupUserAddedEventResponse, DsyncGroupUserRemovedEvent, DsyncGroupUserRemovedEventResponse, DsyncUserCreatedEvent, DsyncUserCreatedEventResponse, DsyncUserDeletedEvent, DsyncUserDeletedEventResponse, DsyncUserUpdatedEvent, DsyncUserUpdatedEventResponse, EmailVerificationCreatedEvent, EmailVerificationCreatedEventResponse, Event, EventBase, EventName, EventResponse, InvitationAcceptedEvent, InvitationAcceptedEventResponse, InvitationCreatedEvent, InvitationCreatedEventResponse, InvitationRevokedEvent, InvitationRevokedEventResponse, MagicAuthCreatedEvent, MagicAuthCreatedEventResponse, OrganizationCreatedEvent, OrganizationCreatedResponse, OrganizationDeletedEvent, OrganizationDeletedResponse, OrganizationDomainCreatedEvent, OrganizationDomainCreatedEventResponse, OrganizationDomainDeletedEvent, OrganizationDomainDeletedEventResponse, OrganizationDomainUpdatedEvent, OrganizationDomainUpdatedEventResponse, OrganizationDomainVerificationFailedEvent, OrganizationDomainVerificationFailedEventResponse, OrganizationDomainVerifiedEvent, OrganizationDomainVerifiedEventResponse, OrganizationMembershipCreated, OrganizationMembershipCreatedResponse, OrganizationMembershipDeleted, OrganizationMembershipDeletedResponse, OrganizationMembershipUpdated, OrganizationMembershipUpdatedResponse, OrganizationUpdatedEvent, OrganizationUpdatedResponse, PasswordResetCreatedEvent, PasswordResetCreatedEventResponse, PasswordResetSucceededEvent, PasswordResetSucceededEventResponse, RoleCreatedEvent, RoleCreatedEventResponse, RoleDeletedEvent, RoleDeletedEventResponse, RoleUpdatedEvent, RoleUpdatedEventResponse, SessionCreatedEvent, SessionCreatedEventResponse, SessionRevokedEvent, SessionRevokedEventResponse, UserCreatedEvent, UserCreatedEventResponse, UserDeletedEvent, UserDeletedEventResponse, UserUpdatedEvent, UserUpdatedEventResponse } from './common/interfaces/event.interface.js';
|
|
7
7
|
export { GetOptions } from './common/interfaces/get-options.interface.js';
|
|
8
8
|
export { List, ListResponse } from './common/interfaces/list.interface.js';
|
|
@@ -136,6 +136,8 @@ import './vault/interfaces/object/delete-object.interface.js';
|
|
|
136
136
|
import './vault/interfaces/object/read-object.interface.js';
|
|
137
137
|
import './vault/interfaces/object.interface.js';
|
|
138
138
|
import './vault/interfaces/object/update-object.interface.js';
|
|
139
|
+
import './api-keys/interfaces/validate-api-key.interface.js';
|
|
140
|
+
import './api-keys/interfaces/api-key.interface.js';
|
|
139
141
|
import './common/interfaces/app-info.interface.js';
|
|
140
142
|
import './common/interfaces/request-exception.interface.js';
|
|
141
143
|
import './user-management/interfaces/password-hash-type.interface.js';
|
|
@@ -2,7 +2,7 @@ import { Actions } from './actions/actions.js';
|
|
|
2
2
|
import { CryptoProvider } from './common/crypto/crypto-provider.js';
|
|
3
3
|
import { HttpClient } from './common/net/http-client.js';
|
|
4
4
|
import { Webhooks } from './webhooks/webhooks.js';
|
|
5
|
-
import { W as WorkOS } from './workos-
|
|
5
|
+
import { W as WorkOS } from './workos-DLj13cxf.js';
|
|
6
6
|
export { ActionContext, ActionPayload, UserData, UserDataPayload, UserRegistrationActionPayload } from './actions/interfaces/action.interface.js';
|
|
7
7
|
export { AuthenticationActionResponseData, ResponsePayload, UserRegistrationActionResponseData } from './actions/interfaces/response-payload.interface.js';
|
|
8
8
|
export { AuditLogExportOptions, SerializedAuditLogExportOptions } from './audit-logs/interfaces/audit-log-export-options.interface.js';
|
|
@@ -136,6 +136,8 @@ import './vault/interfaces/object/delete-object.interface.js';
|
|
|
136
136
|
import './vault/interfaces/object/read-object.interface.js';
|
|
137
137
|
import './vault/interfaces/object.interface.js';
|
|
138
138
|
import './vault/interfaces/object/update-object.interface.js';
|
|
139
|
+
import './api-keys/interfaces/validate-api-key.interface.js';
|
|
140
|
+
import './api-keys/interfaces/api-key.interface.js';
|
|
139
141
|
import './common/interfaces/request-exception.interface.js';
|
|
140
142
|
import './common/interfaces/app-info.interface.js';
|
|
141
143
|
import './user-management/interfaces/password-hash-type.interface.js';
|
package/lib/esm/mfa/mfa.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { M as Mfa } from '../workos-
|
|
1
|
+
export { M as Mfa } from '../workos-DLj13cxf.js';
|
|
2
2
|
import './interfaces/challenge-factor-options.js';
|
|
3
3
|
import './interfaces/challenge.interface.js';
|
|
4
4
|
import './interfaces/enroll-factor-options.js';
|
|
@@ -10,12 +10,18 @@ import '../common/interfaces/post-options.interface.js';
|
|
|
10
10
|
import '../common/interfaces/put-options.interface.js';
|
|
11
11
|
import '../common/interfaces/workos-options.interface.js';
|
|
12
12
|
import '../common/interfaces/app-info.interface.js';
|
|
13
|
-
import '../
|
|
14
|
-
import '../common/interfaces/
|
|
13
|
+
import '../common/utils/pagination.js';
|
|
14
|
+
import '../common/interfaces/pagination-options.interface.js';
|
|
15
|
+
import '../common/interfaces/list.interface.js';
|
|
15
16
|
import '../directory-sync/interfaces/directory.interface.js';
|
|
16
17
|
import '../directory-sync/interfaces/directory-group.interface.js';
|
|
18
|
+
import '../directory-sync/interfaces/list-directories-options.interface.js';
|
|
19
|
+
import '../directory-sync/interfaces/list-groups-options.interface.js';
|
|
20
|
+
import '../directory-sync/interfaces/list-directory-users-options.interface.js';
|
|
17
21
|
import '../directory-sync/interfaces/directory-user.interface.js';
|
|
18
22
|
import '../roles/interfaces/role.interface.js';
|
|
23
|
+
import '../events/interfaces/list-events-options.interface.js';
|
|
24
|
+
import '../common/interfaces/event.interface.js';
|
|
19
25
|
import '../organizations/interfaces/organization.interface.js';
|
|
20
26
|
import '../organization-domains/interfaces/organization-domain.interface.js';
|
|
21
27
|
import '../sso/interfaces/connection.interface.js';
|
|
@@ -30,9 +36,6 @@ import '../user-management/interfaces/magic-auth.interface.js';
|
|
|
30
36
|
import '../user-management/interfaces/password-reset.interface.js';
|
|
31
37
|
import '../user-management/interfaces/session.interface.js';
|
|
32
38
|
import '../user-management/interfaces/impersonator.interface.js';
|
|
33
|
-
import '../common/interfaces/list.interface.js';
|
|
34
|
-
import '../common/utils/pagination.js';
|
|
35
|
-
import '../common/interfaces/pagination-options.interface.js';
|
|
36
39
|
import '../organizations/interfaces/create-organization-options.interface.js';
|
|
37
40
|
import '../organizations/interfaces/domain-data.interface.js';
|
|
38
41
|
import '../organizations/interfaces/list-organization-feature-flags-options.interface.js';
|
|
@@ -122,7 +125,6 @@ import '../vault/interfaces/object/delete-object.interface.js';
|
|
|
122
125
|
import '../vault/interfaces/object/read-object.interface.js';
|
|
123
126
|
import '../vault/interfaces/object.interface.js';
|
|
124
127
|
import '../vault/interfaces/object/update-object.interface.js';
|
|
125
|
-
import '../
|
|
126
|
-
import '../
|
|
127
|
-
import '../directory-sync/interfaces/list-directory-users-options.interface.js';
|
|
128
|
+
import '../api-keys/interfaces/validate-api-key.interface.js';
|
|
129
|
+
import '../api-keys/interfaces/api-key.interface.js';
|
|
128
130
|
import './interfaces/sms.interface.js';
|