@workos-inc/node 8.0.0-rc.6 → 8.0.0-rc.8
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/README.md +54 -0
- package/lib/api-keys/api-keys.cjs +3 -0
- package/lib/api-keys/api-keys.cjs.map +1 -1
- package/lib/api-keys/api-keys.d.cts +2 -1
- package/lib/api-keys/api-keys.d.ts +2 -1
- package/lib/api-keys/api-keys.js +3 -0
- package/lib/api-keys/api-keys.js.map +1 -1
- package/lib/api-keys/interfaces/create-organization-api-key-options.interface.cjs +0 -0
- package/lib/api-keys/interfaces/create-organization-api-key-options.interface.d.cts +16 -0
- package/lib/api-keys/interfaces/create-organization-api-key-options.interface.d.ts +16 -0
- package/lib/api-keys/interfaces/create-organization-api-key-options.interface.js +1 -0
- package/lib/api-keys/interfaces/created-api-key.interface.cjs +0 -0
- package/lib/api-keys/interfaces/created-api-key.interface.d.cts +34 -0
- package/lib/api-keys/interfaces/created-api-key.interface.d.ts +34 -0
- package/lib/api-keys/interfaces/created-api-key.interface.js +1 -0
- package/lib/api-keys/interfaces/index.cjs +0 -0
- package/lib/api-keys/interfaces/index.d.cts +6 -0
- package/lib/api-keys/interfaces/index.d.ts +6 -0
- package/lib/api-keys/interfaces/index.js +1 -0
- package/lib/api-keys/interfaces/list-organization-api-keys-options.interface.cjs +0 -0
- package/lib/api-keys/interfaces/list-organization-api-keys-options.interface.d.cts +9 -0
- package/lib/api-keys/interfaces/list-organization-api-keys-options.interface.d.ts +9 -0
- package/lib/api-keys/interfaces/list-organization-api-keys-options.interface.js +1 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.cjs +12 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.cjs.map +1 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.d.cts +7 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.d.ts +7 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.js +11 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.js.map +1 -0
- package/lib/api-keys/serializers/created-api-key.serializer.cjs +20 -0
- package/lib/api-keys/serializers/created-api-key.serializer.cjs.map +1 -0
- package/lib/api-keys/serializers/created-api-key.serializer.d.cts +7 -0
- package/lib/api-keys/serializers/created-api-key.serializer.d.ts +7 -0
- package/lib/api-keys/serializers/created-api-key.serializer.js +19 -0
- package/lib/api-keys/serializers/created-api-key.serializer.js.map +1 -0
- package/lib/api-keys/serializers/index.cjs +9 -0
- package/lib/api-keys/serializers/index.d.cts +5 -0
- package/lib/api-keys/serializers/index.d.ts +5 -0
- package/lib/api-keys/serializers/index.js +6 -0
- package/lib/common/crypto/seal.cjs +7 -7
- package/lib/common/crypto/seal.cjs.map +1 -1
- package/lib/common/crypto/seal.js +1 -1
- package/lib/common/exceptions/api-key-required.exception.cjs +15 -0
- package/lib/common/exceptions/api-key-required.exception.cjs.map +1 -0
- package/lib/common/exceptions/api-key-required.exception.d.cts +10 -0
- package/lib/common/exceptions/api-key-required.exception.d.ts +10 -0
- package/lib/common/exceptions/api-key-required.exception.js +14 -0
- package/lib/common/exceptions/api-key-required.exception.js.map +1 -0
- package/lib/common/exceptions/index.cjs +2 -0
- package/lib/common/exceptions/index.d.cts +2 -1
- package/lib/common/exceptions/index.d.ts +2 -1
- package/lib/common/exceptions/index.js +2 -1
- package/lib/common/interfaces/event.interface.d.cts +28 -3
- package/lib/common/interfaces/event.interface.d.ts +28 -3
- package/lib/common/interfaces/get-options.interface.d.cts +2 -0
- package/lib/common/interfaces/get-options.interface.d.ts +2 -0
- package/lib/common/interfaces/index.d.cts +2 -2
- package/lib/common/interfaces/index.d.ts +2 -2
- package/lib/common/interfaces/post-options.interface.d.cts +2 -0
- package/lib/common/interfaces/post-options.interface.d.ts +2 -0
- package/lib/common/interfaces/put-options.interface.d.cts +2 -0
- package/lib/common/interfaces/put-options.interface.d.ts +2 -0
- package/lib/common/interfaces/workos-options.interface.d.cts +1 -0
- package/lib/common/interfaces/workos-options.interface.d.ts +1 -0
- package/lib/common/net/http-client.cjs.map +1 -1
- package/lib/common/net/http-client.js.map +1 -1
- package/lib/common/serializers/event.serializer.cjs +13 -5
- package/lib/common/serializers/event.serializer.cjs.map +1 -1
- package/lib/common/serializers/event.serializer.js +13 -5
- package/lib/common/serializers/event.serializer.js.map +1 -1
- package/lib/directory-sync/directory-sync.cjs +1 -1
- package/lib/directory-sync/directory-sync.js +1 -1
- package/lib/factory.cjs +10 -0
- package/lib/factory.cjs.map +1 -0
- package/lib/factory.d.cts +83 -0
- package/lib/factory.d.ts +83 -0
- package/lib/factory.js +10 -0
- package/lib/factory.js.map +1 -0
- package/lib/feature-flags/feature-flags.cjs +37 -0
- package/lib/feature-flags/feature-flags.cjs.map +1 -0
- package/lib/feature-flags/feature-flags.d.cts +21 -0
- package/lib/feature-flags/feature-flags.d.ts +21 -0
- package/lib/feature-flags/feature-flags.js +37 -0
- package/lib/feature-flags/feature-flags.js.map +1 -0
- package/lib/feature-flags/interfaces/add-flag-target-options.interface.cjs +0 -0
- package/lib/feature-flags/interfaces/add-flag-target-options.interface.d.cts +8 -0
- package/lib/feature-flags/interfaces/add-flag-target-options.interface.d.ts +8 -0
- package/lib/feature-flags/interfaces/add-flag-target-options.interface.js +1 -0
- package/lib/feature-flags/interfaces/feature-flag.interface.d.cts +8 -2
- package/lib/feature-flags/interfaces/feature-flag.interface.d.ts +8 -2
- package/lib/feature-flags/interfaces/index.d.cts +4 -1
- package/lib/feature-flags/interfaces/index.d.ts +4 -1
- package/lib/feature-flags/interfaces/list-feature-flags-options.interface.cjs +0 -0
- package/lib/feature-flags/interfaces/list-feature-flags-options.interface.d.cts +7 -0
- package/lib/feature-flags/interfaces/list-feature-flags-options.interface.d.ts +7 -0
- package/lib/feature-flags/interfaces/list-feature-flags-options.interface.js +1 -0
- package/lib/feature-flags/interfaces/remove-flag-target-options.interface.cjs +0 -0
- package/lib/feature-flags/interfaces/remove-flag-target-options.interface.d.cts +8 -0
- package/lib/feature-flags/interfaces/remove-flag-target-options.interface.d.ts +8 -0
- package/lib/feature-flags/interfaces/remove-flag-target-options.interface.js +1 -0
- package/lib/feature-flags/serializers/feature-flag.serializer.cjs +3 -0
- package/lib/feature-flags/serializers/feature-flag.serializer.cjs.map +1 -1
- package/lib/feature-flags/serializers/feature-flag.serializer.js +3 -0
- package/lib/feature-flags/serializers/feature-flag.serializer.js.map +1 -1
- package/lib/feature-flags/serializers/index.cjs +3 -0
- package/lib/feature-flags/serializers/index.d.cts +2 -0
- package/lib/feature-flags/serializers/index.d.ts +2 -0
- package/lib/feature-flags/serializers/index.js +3 -0
- package/lib/fga/serializers/query-result.serializer.cjs.map +1 -1
- package/lib/fga/serializers/query-result.serializer.js.map +1 -1
- package/lib/index.cjs +18 -9
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +18 -5
- package/lib/index.d.ts +18 -5
- package/lib/index.js +16 -10
- package/lib/index.js.map +1 -1
- package/lib/index.worker.cjs +15 -9
- package/lib/index.worker.cjs.map +1 -1
- package/lib/index.worker.d.cts +10 -5
- package/lib/index.worker.d.ts +10 -5
- package/lib/index.worker.js +13 -10
- package/lib/index.worker.js.map +1 -1
- package/lib/node_modules/iron-webcrypto/index.cjs +218 -0
- package/lib/node_modules/iron-webcrypto/index.cjs.map +1 -0
- package/lib/node_modules/iron-webcrypto/index.js +216 -0
- package/lib/node_modules/iron-webcrypto/index.js.map +1 -0
- package/lib/node_modules/uint8array-extras/index.cjs +55 -0
- package/lib/node_modules/uint8array-extras/index.cjs.map +1 -0
- package/lib/node_modules/uint8array-extras/index.js +52 -0
- package/lib/node_modules/uint8array-extras/index.js.map +1 -0
- package/lib/organizations/organizations.cjs +14 -2
- package/lib/organizations/organizations.cjs.map +1 -1
- package/lib/organizations/organizations.d.cts +6 -0
- package/lib/organizations/organizations.d.ts +6 -0
- package/lib/organizations/organizations.js +14 -2
- package/lib/organizations/organizations.js.map +1 -1
- package/lib/organizations/serializers/index.cjs +1 -1
- package/lib/organizations/serializers/index.js +1 -1
- package/lib/pkce/pkce.cjs +54 -0
- package/lib/pkce/pkce.cjs.map +1 -0
- package/lib/pkce/pkce.d.cts +38 -0
- package/lib/pkce/pkce.d.ts +38 -0
- package/lib/pkce/pkce.js +53 -0
- package/lib/pkce/pkce.js.map +1 -0
- package/lib/sso/interfaces/authorization-url-options.interface.d.cts +34 -8
- package/lib/sso/interfaces/authorization-url-options.interface.d.ts +34 -8
- package/lib/sso/interfaces/get-profile-and-token-options.interface.d.cts +6 -0
- package/lib/sso/interfaces/get-profile-and-token-options.interface.d.ts +6 -0
- package/lib/sso/interfaces/index.d.cts +2 -2
- package/lib/sso/interfaces/index.d.ts +2 -2
- package/lib/sso/sso.cjs +90 -8
- package/lib/sso/sso.cjs.map +1 -1
- package/lib/sso/sso.d.cts +41 -2
- package/lib/sso/sso.d.ts +41 -2
- package/lib/sso/sso.js +90 -8
- package/lib/sso/sso.js.map +1 -1
- package/lib/user-management/interfaces/authenticate-with-code-and-verifier-options.interface.d.cts +2 -2
- package/lib/user-management/interfaces/authenticate-with-code-and-verifier-options.interface.d.ts +2 -2
- package/lib/user-management/interfaces/authenticate-with-options-base.interface.d.cts +19 -3
- package/lib/user-management/interfaces/authenticate-with-options-base.interface.d.ts +19 -3
- package/lib/user-management/interfaces/authenticate-with-refresh-token-public-client-options.interface.cjs +0 -0
- package/lib/user-management/interfaces/authenticate-with-refresh-token-public-client-options.interface.d.cts +16 -0
- package/lib/user-management/interfaces/authenticate-with-refresh-token-public-client-options.interface.d.ts +16 -0
- package/lib/user-management/interfaces/authenticate-with-refresh-token-public-client-options.interface.js +1 -0
- package/lib/user-management/interfaces/authorization-url-options.interface.d.cts +30 -5
- package/lib/user-management/interfaces/authorization-url-options.interface.d.ts +30 -5
- package/lib/user-management/interfaces/index.d.cts +5 -3
- package/lib/user-management/interfaces/index.d.ts +5 -3
- package/lib/user-management/interfaces/logout-url-options.interface.cjs +0 -0
- package/lib/user-management/interfaces/logout-url-options.interface.d.cts +8 -0
- package/lib/user-management/interfaces/logout-url-options.interface.d.ts +8 -0
- package/lib/user-management/interfaces/logout-url-options.interface.js +1 -0
- package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-code-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-code-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-code-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-code-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-email-verification.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-email-verification.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-email-verification.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-email-verification.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-magic-auth-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-magic-auth-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-magic-auth-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-magic-auth-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-organization-selection-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-organization-selection-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-organization-selection-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-organization-selection-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-password-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-password-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-password-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-password-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.cjs +14 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.cjs.map +1 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.d.cts +8 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.d.ts +8 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.js +13 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.js.map +1 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token.options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-refresh-token.options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-refresh-token.options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-refresh-token.options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-totp-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-totp-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-totp-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-totp-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/index.cjs +2 -0
- package/lib/user-management/serializers/index.d.cts +2 -1
- package/lib/user-management/serializers/index.d.ts +2 -1
- package/lib/user-management/serializers/index.js +2 -1
- package/lib/user-management/session.cjs +3 -10
- package/lib/user-management/session.cjs.map +1 -1
- package/lib/user-management/session.js +3 -10
- package/lib/user-management/session.js.map +1 -1
- package/lib/user-management/user-management.cjs +186 -31
- package/lib/user-management/user-management.cjs.map +1 -1
- package/lib/user-management/user-management.d.cts +71 -2
- package/lib/user-management/user-management.d.ts +71 -2
- package/lib/user-management/user-management.js +186 -31
- package/lib/user-management/user-management.js.map +1 -1
- package/lib/vault/vault.cjs +4 -0
- package/lib/vault/vault.cjs.map +1 -1
- package/lib/vault/vault.d.cts +1 -0
- package/lib/vault/vault.d.ts +1 -0
- package/lib/vault/vault.js +4 -0
- package/lib/vault/vault.js.map +1 -1
- package/lib/webhooks/webhooks.cjs +1 -1
- package/lib/webhooks/webhooks.js +1 -1
- package/lib/workos.cjs +68 -26
- package/lib/workos.cjs.map +1 -1
- package/lib/workos.d.cts +37 -8
- package/lib/workos.d.ts +37 -8
- package/lib/workos.js +68 -26
- package/lib/workos.js.map +1 -1
- package/package.json +4 -21
- package/lib/_virtual/rolldown_runtime.cjs +0 -19
- package/lib/_virtual/rolldown_runtime.js +0 -18
- package/lib/client/index.cjs +0 -15
- package/lib/client/index.d.cts +0 -3
- package/lib/client/index.d.ts +0 -3
- package/lib/client/index.js +0 -4
- package/lib/client/sso.cjs +0 -40
- package/lib/client/sso.cjs.map +0 -1
- package/lib/client/sso.d.cts +0 -21
- package/lib/client/sso.d.ts +0 -21
- package/lib/client/sso.js +0 -34
- package/lib/client/sso.js.map +0 -1
- package/lib/client/user-management.cjs +0 -80
- package/lib/client/user-management.cjs.map +0 -1
- package/lib/client/user-management.d.cts +0 -58
- package/lib/client/user-management.d.ts +0 -58
- package/lib/client/user-management.js +0 -72
- package/lib/client/user-management.js.map +0 -1
- package/lib/index.client.cjs +0 -15
- package/lib/index.client.d.cts +0 -3
- package/lib/index.client.d.ts +0 -3
- package/lib/index.client.js +0 -4
package/README.md
CHANGED
|
@@ -37,6 +37,60 @@ import { WorkOS } from '@workos-inc/node';
|
|
|
37
37
|
const workos = new WorkOS('sk_1234');
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
## Public Client Mode (Browser/Mobile/CLI)
|
|
41
|
+
|
|
42
|
+
For apps that can't securely store secrets, initialize with just a client ID:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { WorkOS } from '@workos-inc/node';
|
|
46
|
+
|
|
47
|
+
const workos = new WorkOS({ clientId: 'client_...' }); // No API key needed
|
|
48
|
+
|
|
49
|
+
// Generate auth URL with automatic PKCE
|
|
50
|
+
const { url, codeVerifier } =
|
|
51
|
+
await workos.userManagement.getAuthorizationUrlWithPKCE({
|
|
52
|
+
provider: 'authkit',
|
|
53
|
+
redirectUri: 'myapp://callback',
|
|
54
|
+
clientId: 'client_...',
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// After user authenticates, exchange code for tokens
|
|
58
|
+
const { accessToken, refreshToken } =
|
|
59
|
+
await workos.userManagement.authenticateWithCode({
|
|
60
|
+
code: authorizationCode,
|
|
61
|
+
codeVerifier,
|
|
62
|
+
clientId: 'client_...',
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> [!IMPORTANT]
|
|
67
|
+
> Store `codeVerifier` securely on-device between generating the auth URL and handling the callback. For mobile apps, use platform secure storage (iOS Keychain, Android Keystore). For CLI apps, consider OS credential storage. The verifier must survive app restarts during the auth flow.
|
|
68
|
+
|
|
69
|
+
See the [AuthKit documentation](https://workos.com/docs/authkit) for details on PKCE authentication.
|
|
70
|
+
|
|
71
|
+
### PKCE with Confidential Clients
|
|
72
|
+
|
|
73
|
+
Server-side apps can also use PKCE alongside the client secret for defense in depth (recommended by OAuth 2.1):
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const workos = new WorkOS('sk_...'); // With API key
|
|
77
|
+
|
|
78
|
+
// Use PKCE even with API key for additional security
|
|
79
|
+
const { url, codeVerifier } =
|
|
80
|
+
await workos.userManagement.getAuthorizationUrlWithPKCE({
|
|
81
|
+
provider: 'authkit',
|
|
82
|
+
redirectUri: 'https://example.com/callback',
|
|
83
|
+
clientId: 'client_...',
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Both client_secret AND code_verifier will be sent
|
|
87
|
+
const { accessToken } = await workos.userManagement.authenticateWithCode({
|
|
88
|
+
code: authorizationCode,
|
|
89
|
+
codeVerifier,
|
|
90
|
+
clientId: 'client_...',
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
40
94
|
## SDK Versioning
|
|
41
95
|
|
|
42
96
|
For our SDKs WorkOS follows a Semantic Versioning ([SemVer](https://semver.org/)) process where all releases will have a version X.Y.Z (like 1.0.0) pattern wherein Z would be a bug fix (e.g., 1.0.1), Y would be a minor release (1.1.0) and X would be a major release (2.0.0). We permit any breaking changes to only be released in major versions and strongly recommend reading changelogs before making any major version upgrades.
|
|
@@ -9,6 +9,9 @@ var ApiKeys = class {
|
|
|
9
9
|
const { data } = await this.workos.post("/api_keys/validations", payload);
|
|
10
10
|
return require_api_keys_serializers_validate_api_key_serializer.deserializeValidateApiKeyResponse(data);
|
|
11
11
|
}
|
|
12
|
+
async deleteApiKey(id) {
|
|
13
|
+
await this.workos.delete(`/api_keys/${id}`);
|
|
14
|
+
}
|
|
12
15
|
};
|
|
13
16
|
|
|
14
17
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.cjs","names":["workos: WorkOS","deserializeValidateApiKeyResponse"],"sources":["../../src/api-keys/api-keys.ts"],"sourcesContent":["import { WorkOS } from '../workos';\nimport {\n SerializedValidateApiKeyResponse,\n ValidateApiKeyOptions,\n ValidateApiKeyResponse,\n} from './interfaces/validate-api-key.interface';\nimport { deserializeValidateApiKeyResponse } from './serializers/validate-api-key.serializer';\n\nexport class ApiKeys {\n constructor(private readonly workos: WorkOS) {}\n\n async validateApiKey(\n payload: ValidateApiKeyOptions,\n ): Promise<ValidateApiKeyResponse> {\n const { data } = await this.workos.post<SerializedValidateApiKeyResponse>(\n '/api_keys/validations',\n payload,\n );\n\n return deserializeValidateApiKeyResponse(data);\n }\n}\n"],"mappings":";;;AAQA,IAAa,UAAb,MAAqB;CACnB,YAAY,AAAiBA,QAAgB;EAAhB;;CAE7B,MAAM,eACJ,SACiC;EACjC,MAAM,EAAE,SAAS,MAAM,KAAK,OAAO,KACjC,yBACA,QACD;AAED,SAAOC,2FAAkC,KAAK"}
|
|
1
|
+
{"version":3,"file":"api-keys.cjs","names":["workos: WorkOS","deserializeValidateApiKeyResponse"],"sources":["../../src/api-keys/api-keys.ts"],"sourcesContent":["import { WorkOS } from '../workos';\nimport {\n SerializedValidateApiKeyResponse,\n ValidateApiKeyOptions,\n ValidateApiKeyResponse,\n} from './interfaces/validate-api-key.interface';\nimport { deserializeValidateApiKeyResponse } from './serializers/validate-api-key.serializer';\n\nexport class ApiKeys {\n constructor(private readonly workos: WorkOS) {}\n\n async validateApiKey(\n payload: ValidateApiKeyOptions,\n ): Promise<ValidateApiKeyResponse> {\n const { data } = await this.workos.post<SerializedValidateApiKeyResponse>(\n '/api_keys/validations',\n payload,\n );\n\n return deserializeValidateApiKeyResponse(data);\n }\n\n async deleteApiKey(id: string): Promise<void> {\n await this.workos.delete(`/api_keys/${id}`);\n }\n}\n"],"mappings":";;;AAQA,IAAa,UAAb,MAAqB;CACnB,YAAY,AAAiBA,QAAgB;EAAhB;;CAE7B,MAAM,eACJ,SACiC;EACjC,MAAM,EAAE,SAAS,MAAM,KAAK,OAAO,KACjC,yBACA,QACD;AAED,SAAOC,2FAAkC,KAAK;;CAGhD,MAAM,aAAa,IAA2B;AAC5C,QAAM,KAAK,OAAO,OAAO,aAAa,KAAK"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { WorkOS } from "../workos.cjs";
|
|
2
1
|
import { ValidateApiKeyOptions, ValidateApiKeyResponse } from "./interfaces/validate-api-key.interface.cjs";
|
|
2
|
+
import { WorkOS } from "../workos.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/api-keys/api-keys.d.ts
|
|
5
5
|
declare class ApiKeys {
|
|
6
6
|
private readonly workos;
|
|
7
7
|
constructor(workos: WorkOS);
|
|
8
8
|
validateApiKey(payload: ValidateApiKeyOptions): Promise<ValidateApiKeyResponse>;
|
|
9
|
+
deleteApiKey(id: string): Promise<void>;
|
|
9
10
|
}
|
|
10
11
|
//#endregion
|
|
11
12
|
export { ApiKeys };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { WorkOS } from "../workos.js";
|
|
2
1
|
import { ValidateApiKeyOptions, ValidateApiKeyResponse } from "./interfaces/validate-api-key.interface.js";
|
|
2
|
+
import { WorkOS } from "../workos.js";
|
|
3
3
|
|
|
4
4
|
//#region src/api-keys/api-keys.d.ts
|
|
5
5
|
declare class ApiKeys {
|
|
6
6
|
private readonly workos;
|
|
7
7
|
constructor(workos: WorkOS);
|
|
8
8
|
validateApiKey(payload: ValidateApiKeyOptions): Promise<ValidateApiKeyResponse>;
|
|
9
|
+
deleteApiKey(id: string): Promise<void>;
|
|
9
10
|
}
|
|
10
11
|
//#endregion
|
|
11
12
|
export { ApiKeys };
|
package/lib/api-keys/api-keys.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.js","names":["workos: WorkOS"],"sources":["../../src/api-keys/api-keys.ts"],"sourcesContent":["import { WorkOS } from '../workos';\nimport {\n SerializedValidateApiKeyResponse,\n ValidateApiKeyOptions,\n ValidateApiKeyResponse,\n} from './interfaces/validate-api-key.interface';\nimport { deserializeValidateApiKeyResponse } from './serializers/validate-api-key.serializer';\n\nexport class ApiKeys {\n constructor(private readonly workos: WorkOS) {}\n\n async validateApiKey(\n payload: ValidateApiKeyOptions,\n ): Promise<ValidateApiKeyResponse> {\n const { data } = await this.workos.post<SerializedValidateApiKeyResponse>(\n '/api_keys/validations',\n payload,\n );\n\n return deserializeValidateApiKeyResponse(data);\n }\n}\n"],"mappings":";;;AAQA,IAAa,UAAb,MAAqB;CACnB,YAAY,AAAiBA,QAAgB;EAAhB;;CAE7B,MAAM,eACJ,SACiC;EACjC,MAAM,EAAE,SAAS,MAAM,KAAK,OAAO,KACjC,yBACA,QACD;AAED,SAAO,kCAAkC,KAAK"}
|
|
1
|
+
{"version":3,"file":"api-keys.js","names":["workos: WorkOS"],"sources":["../../src/api-keys/api-keys.ts"],"sourcesContent":["import { WorkOS } from '../workos';\nimport {\n SerializedValidateApiKeyResponse,\n ValidateApiKeyOptions,\n ValidateApiKeyResponse,\n} from './interfaces/validate-api-key.interface';\nimport { deserializeValidateApiKeyResponse } from './serializers/validate-api-key.serializer';\n\nexport class ApiKeys {\n constructor(private readonly workos: WorkOS) {}\n\n async validateApiKey(\n payload: ValidateApiKeyOptions,\n ): Promise<ValidateApiKeyResponse> {\n const { data } = await this.workos.post<SerializedValidateApiKeyResponse>(\n '/api_keys/validations',\n payload,\n );\n\n return deserializeValidateApiKeyResponse(data);\n }\n\n async deleteApiKey(id: string): Promise<void> {\n await this.workos.delete(`/api_keys/${id}`);\n }\n}\n"],"mappings":";;;AAQA,IAAa,UAAb,MAAqB;CACnB,YAAY,AAAiBA,QAAgB;EAAhB;;CAE7B,MAAM,eACJ,SACiC;EACjC,MAAM,EAAE,SAAS,MAAM,KAAK,OAAO,KACjC,yBACA,QACD;AAED,SAAO,kCAAkC,KAAK;;CAGhD,MAAM,aAAa,IAA2B;AAC5C,QAAM,KAAK,OAAO,OAAO,aAAa,KAAK"}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PostOptions } from "../../common/interfaces/post-options.interface.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/api-keys/interfaces/create-organization-api-key-options.interface.d.ts
|
|
4
|
+
interface CreateOrganizationApiKeyOptions {
|
|
5
|
+
organizationId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
permissions?: string[];
|
|
8
|
+
}
|
|
9
|
+
interface SerializedCreateOrganizationApiKeyOptions {
|
|
10
|
+
name: string;
|
|
11
|
+
permissions?: string[];
|
|
12
|
+
}
|
|
13
|
+
interface CreateOrganizationApiKeyRequestOptions extends Pick<PostOptions, 'idempotencyKey'> {}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { CreateOrganizationApiKeyOptions, CreateOrganizationApiKeyRequestOptions, SerializedCreateOrganizationApiKeyOptions };
|
|
16
|
+
//# sourceMappingURL=create-organization-api-key-options.interface.d.cts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PostOptions } from "../../common/interfaces/post-options.interface.js";
|
|
2
|
+
|
|
3
|
+
//#region src/api-keys/interfaces/create-organization-api-key-options.interface.d.ts
|
|
4
|
+
interface CreateOrganizationApiKeyOptions {
|
|
5
|
+
organizationId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
permissions?: string[];
|
|
8
|
+
}
|
|
9
|
+
interface SerializedCreateOrganizationApiKeyOptions {
|
|
10
|
+
name: string;
|
|
11
|
+
permissions?: string[];
|
|
12
|
+
}
|
|
13
|
+
interface CreateOrganizationApiKeyRequestOptions extends Pick<PostOptions, 'idempotencyKey'> {}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { CreateOrganizationApiKeyOptions, CreateOrganizationApiKeyRequestOptions, SerializedCreateOrganizationApiKeyOptions };
|
|
16
|
+
//# sourceMappingURL=create-organization-api-key-options.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/api-keys/interfaces/created-api-key.interface.d.ts
|
|
2
|
+
interface CreatedApiKey {
|
|
3
|
+
object: 'api_key';
|
|
4
|
+
id: string;
|
|
5
|
+
owner: {
|
|
6
|
+
type: 'organization';
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
name: string;
|
|
10
|
+
obfuscatedValue: string;
|
|
11
|
+
value: string;
|
|
12
|
+
lastUsedAt: string | null;
|
|
13
|
+
permissions: string[];
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
}
|
|
17
|
+
interface SerializedCreatedApiKey {
|
|
18
|
+
object: 'api_key';
|
|
19
|
+
id: string;
|
|
20
|
+
owner: {
|
|
21
|
+
type: 'organization';
|
|
22
|
+
id: string;
|
|
23
|
+
};
|
|
24
|
+
name: string;
|
|
25
|
+
obfuscated_value: string;
|
|
26
|
+
value: string;
|
|
27
|
+
last_used_at: string | null;
|
|
28
|
+
permissions: string[];
|
|
29
|
+
created_at: string;
|
|
30
|
+
updated_at: string;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { CreatedApiKey, SerializedCreatedApiKey };
|
|
34
|
+
//# sourceMappingURL=created-api-key.interface.d.cts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/api-keys/interfaces/created-api-key.interface.d.ts
|
|
2
|
+
interface CreatedApiKey {
|
|
3
|
+
object: 'api_key';
|
|
4
|
+
id: string;
|
|
5
|
+
owner: {
|
|
6
|
+
type: 'organization';
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
name: string;
|
|
10
|
+
obfuscatedValue: string;
|
|
11
|
+
value: string;
|
|
12
|
+
lastUsedAt: string | null;
|
|
13
|
+
permissions: string[];
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
}
|
|
17
|
+
interface SerializedCreatedApiKey {
|
|
18
|
+
object: 'api_key';
|
|
19
|
+
id: string;
|
|
20
|
+
owner: {
|
|
21
|
+
type: 'organization';
|
|
22
|
+
id: string;
|
|
23
|
+
};
|
|
24
|
+
name: string;
|
|
25
|
+
obfuscated_value: string;
|
|
26
|
+
value: string;
|
|
27
|
+
last_used_at: string | null;
|
|
28
|
+
permissions: string[];
|
|
29
|
+
created_at: string;
|
|
30
|
+
updated_at: string;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { CreatedApiKey, SerializedCreatedApiKey };
|
|
34
|
+
//# sourceMappingURL=created-api-key.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApiKey, SerializedApiKey } from "./api-key.interface.cjs";
|
|
2
|
+
import { CreateOrganizationApiKeyOptions, CreateOrganizationApiKeyRequestOptions, SerializedCreateOrganizationApiKeyOptions } from "./create-organization-api-key-options.interface.cjs";
|
|
3
|
+
import { CreatedApiKey, SerializedCreatedApiKey } from "./created-api-key.interface.cjs";
|
|
4
|
+
import { ListOrganizationApiKeysOptions } from "./list-organization-api-keys-options.interface.cjs";
|
|
5
|
+
import { SerializedValidateApiKeyResponse, ValidateApiKeyOptions, ValidateApiKeyResponse } from "./validate-api-key.interface.cjs";
|
|
6
|
+
export { ApiKey, CreateOrganizationApiKeyOptions, CreateOrganizationApiKeyRequestOptions, CreatedApiKey, ListOrganizationApiKeysOptions, SerializedApiKey, SerializedCreateOrganizationApiKeyOptions, SerializedCreatedApiKey, SerializedValidateApiKeyResponse, ValidateApiKeyOptions, ValidateApiKeyResponse };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApiKey, SerializedApiKey } from "./api-key.interface.js";
|
|
2
|
+
import { CreateOrganizationApiKeyOptions, CreateOrganizationApiKeyRequestOptions, SerializedCreateOrganizationApiKeyOptions } from "./create-organization-api-key-options.interface.js";
|
|
3
|
+
import { CreatedApiKey, SerializedCreatedApiKey } from "./created-api-key.interface.js";
|
|
4
|
+
import { ListOrganizationApiKeysOptions } from "./list-organization-api-keys-options.interface.js";
|
|
5
|
+
import { SerializedValidateApiKeyResponse, ValidateApiKeyOptions, ValidateApiKeyResponse } from "./validate-api-key.interface.js";
|
|
6
|
+
export { ApiKey, CreateOrganizationApiKeyOptions, CreateOrganizationApiKeyRequestOptions, CreatedApiKey, ListOrganizationApiKeysOptions, SerializedApiKey, SerializedCreateOrganizationApiKeyOptions, SerializedCreatedApiKey, SerializedValidateApiKeyResponse, ValidateApiKeyOptions, ValidateApiKeyResponse };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PaginationOptions } from "../../common/interfaces/pagination-options.interface.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/api-keys/interfaces/list-organization-api-keys-options.interface.d.ts
|
|
4
|
+
interface ListOrganizationApiKeysOptions extends PaginationOptions {
|
|
5
|
+
organizationId: string;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ListOrganizationApiKeysOptions };
|
|
9
|
+
//# sourceMappingURL=list-organization-api-keys-options.interface.d.cts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PaginationOptions } from "../../common/interfaces/pagination-options.interface.js";
|
|
2
|
+
|
|
3
|
+
//#region src/api-keys/interfaces/list-organization-api-keys-options.interface.d.ts
|
|
4
|
+
interface ListOrganizationApiKeysOptions extends PaginationOptions {
|
|
5
|
+
organizationId: string;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ListOrganizationApiKeysOptions };
|
|
9
|
+
//# sourceMappingURL=list-organization-api-keys-options.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/api-keys/serializers/create-organization-api-key-options.serializer.ts
|
|
3
|
+
function serializeCreateOrganizationApiKeyOptions(options) {
|
|
4
|
+
return {
|
|
5
|
+
name: options.name,
|
|
6
|
+
permissions: options.permissions
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.serializeCreateOrganizationApiKeyOptions = serializeCreateOrganizationApiKeyOptions;
|
|
12
|
+
//# sourceMappingURL=create-organization-api-key-options.serializer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-organization-api-key-options.serializer.cjs","names":[],"sources":["../../../src/api-keys/serializers/create-organization-api-key-options.serializer.ts"],"sourcesContent":["import {\n CreateOrganizationApiKeyOptions,\n SerializedCreateOrganizationApiKeyOptions,\n} from '../interfaces/create-organization-api-key-options.interface';\n\nexport function serializeCreateOrganizationApiKeyOptions(\n options: CreateOrganizationApiKeyOptions,\n): SerializedCreateOrganizationApiKeyOptions {\n return {\n name: options.name,\n permissions: options.permissions,\n };\n}\n"],"mappings":";;AAKA,SAAgB,yCACd,SAC2C;AAC3C,QAAO;EACL,MAAM,QAAQ;EACd,aAAa,QAAQ;EACtB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreateOrganizationApiKeyOptions, SerializedCreateOrganizationApiKeyOptions } from "../interfaces/create-organization-api-key-options.interface.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/api-keys/serializers/create-organization-api-key-options.serializer.d.ts
|
|
4
|
+
declare function serializeCreateOrganizationApiKeyOptions(options: CreateOrganizationApiKeyOptions): SerializedCreateOrganizationApiKeyOptions;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { serializeCreateOrganizationApiKeyOptions };
|
|
7
|
+
//# sourceMappingURL=create-organization-api-key-options.serializer.d.cts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreateOrganizationApiKeyOptions, SerializedCreateOrganizationApiKeyOptions } from "../interfaces/create-organization-api-key-options.interface.js";
|
|
2
|
+
|
|
3
|
+
//#region src/api-keys/serializers/create-organization-api-key-options.serializer.d.ts
|
|
4
|
+
declare function serializeCreateOrganizationApiKeyOptions(options: CreateOrganizationApiKeyOptions): SerializedCreateOrganizationApiKeyOptions;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { serializeCreateOrganizationApiKeyOptions };
|
|
7
|
+
//# sourceMappingURL=create-organization-api-key-options.serializer.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/api-keys/serializers/create-organization-api-key-options.serializer.ts
|
|
2
|
+
function serializeCreateOrganizationApiKeyOptions(options) {
|
|
3
|
+
return {
|
|
4
|
+
name: options.name,
|
|
5
|
+
permissions: options.permissions
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { serializeCreateOrganizationApiKeyOptions };
|
|
11
|
+
//# sourceMappingURL=create-organization-api-key-options.serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-organization-api-key-options.serializer.js","names":[],"sources":["../../../src/api-keys/serializers/create-organization-api-key-options.serializer.ts"],"sourcesContent":["import {\n CreateOrganizationApiKeyOptions,\n SerializedCreateOrganizationApiKeyOptions,\n} from '../interfaces/create-organization-api-key-options.interface';\n\nexport function serializeCreateOrganizationApiKeyOptions(\n options: CreateOrganizationApiKeyOptions,\n): SerializedCreateOrganizationApiKeyOptions {\n return {\n name: options.name,\n permissions: options.permissions,\n };\n}\n"],"mappings":";AAKA,SAAgB,yCACd,SAC2C;AAC3C,QAAO;EACL,MAAM,QAAQ;EACd,aAAa,QAAQ;EACtB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/api-keys/serializers/created-api-key.serializer.ts
|
|
3
|
+
function deserializeCreatedApiKey(apiKey) {
|
|
4
|
+
return {
|
|
5
|
+
object: apiKey.object,
|
|
6
|
+
id: apiKey.id,
|
|
7
|
+
owner: apiKey.owner,
|
|
8
|
+
name: apiKey.name,
|
|
9
|
+
obfuscatedValue: apiKey.obfuscated_value,
|
|
10
|
+
value: apiKey.value,
|
|
11
|
+
lastUsedAt: apiKey.last_used_at,
|
|
12
|
+
permissions: apiKey.permissions,
|
|
13
|
+
createdAt: apiKey.created_at,
|
|
14
|
+
updatedAt: apiKey.updated_at
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.deserializeCreatedApiKey = deserializeCreatedApiKey;
|
|
20
|
+
//# sourceMappingURL=created-api-key.serializer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"created-api-key.serializer.cjs","names":[],"sources":["../../../src/api-keys/serializers/created-api-key.serializer.ts"],"sourcesContent":["import {\n CreatedApiKey,\n SerializedCreatedApiKey,\n} from '../interfaces/created-api-key.interface';\n\nexport function deserializeCreatedApiKey(\n apiKey: SerializedCreatedApiKey,\n): CreatedApiKey {\n return {\n object: apiKey.object,\n id: apiKey.id,\n owner: apiKey.owner,\n name: apiKey.name,\n obfuscatedValue: apiKey.obfuscated_value,\n value: apiKey.value,\n lastUsedAt: apiKey.last_used_at,\n permissions: apiKey.permissions,\n createdAt: apiKey.created_at,\n updatedAt: apiKey.updated_at,\n };\n}\n"],"mappings":";;AAKA,SAAgB,yBACd,QACe;AACf,QAAO;EACL,QAAQ,OAAO;EACf,IAAI,OAAO;EACX,OAAO,OAAO;EACd,MAAM,OAAO;EACb,iBAAiB,OAAO;EACxB,OAAO,OAAO;EACd,YAAY,OAAO;EACnB,aAAa,OAAO;EACpB,WAAW,OAAO;EAClB,WAAW,OAAO;EACnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreatedApiKey, SerializedCreatedApiKey } from "../interfaces/created-api-key.interface.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/api-keys/serializers/created-api-key.serializer.d.ts
|
|
4
|
+
declare function deserializeCreatedApiKey(apiKey: SerializedCreatedApiKey): CreatedApiKey;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { deserializeCreatedApiKey };
|
|
7
|
+
//# sourceMappingURL=created-api-key.serializer.d.cts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreatedApiKey, SerializedCreatedApiKey } from "../interfaces/created-api-key.interface.js";
|
|
2
|
+
|
|
3
|
+
//#region src/api-keys/serializers/created-api-key.serializer.d.ts
|
|
4
|
+
declare function deserializeCreatedApiKey(apiKey: SerializedCreatedApiKey): CreatedApiKey;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { deserializeCreatedApiKey };
|
|
7
|
+
//# sourceMappingURL=created-api-key.serializer.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/api-keys/serializers/created-api-key.serializer.ts
|
|
2
|
+
function deserializeCreatedApiKey(apiKey) {
|
|
3
|
+
return {
|
|
4
|
+
object: apiKey.object,
|
|
5
|
+
id: apiKey.id,
|
|
6
|
+
owner: apiKey.owner,
|
|
7
|
+
name: apiKey.name,
|
|
8
|
+
obfuscatedValue: apiKey.obfuscated_value,
|
|
9
|
+
value: apiKey.value,
|
|
10
|
+
lastUsedAt: apiKey.last_used_at,
|
|
11
|
+
permissions: apiKey.permissions,
|
|
12
|
+
createdAt: apiKey.created_at,
|
|
13
|
+
updatedAt: apiKey.updated_at
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { deserializeCreatedApiKey };
|
|
19
|
+
//# sourceMappingURL=created-api-key.serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"created-api-key.serializer.js","names":[],"sources":["../../../src/api-keys/serializers/created-api-key.serializer.ts"],"sourcesContent":["import {\n CreatedApiKey,\n SerializedCreatedApiKey,\n} from '../interfaces/created-api-key.interface';\n\nexport function deserializeCreatedApiKey(\n apiKey: SerializedCreatedApiKey,\n): CreatedApiKey {\n return {\n object: apiKey.object,\n id: apiKey.id,\n owner: apiKey.owner,\n name: apiKey.name,\n obfuscatedValue: apiKey.obfuscated_value,\n value: apiKey.value,\n lastUsedAt: apiKey.last_used_at,\n permissions: apiKey.permissions,\n createdAt: apiKey.created_at,\n updatedAt: apiKey.updated_at,\n };\n}\n"],"mappings":";AAKA,SAAgB,yBACd,QACe;AACf,QAAO;EACL,QAAQ,OAAO;EACf,IAAI,OAAO;EACX,OAAO,OAAO;EACd,MAAM,OAAO;EACb,iBAAiB,OAAO;EACxB,OAAO,OAAO;EACd,YAAY,OAAO;EACnB,aAAa,OAAO;EACpB,WAAW,OAAO;EAClB,WAAW,OAAO;EACnB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const require_api_keys_serializers_api_key_serializer = require('./api-key.serializer.cjs');
|
|
2
|
+
const require_api_keys_serializers_validate_api_key_serializer = require('./validate-api-key.serializer.cjs');
|
|
3
|
+
const require_api_keys_serializers_create_organization_api_key_options_serializer = require('./create-organization-api-key-options.serializer.cjs');
|
|
4
|
+
const require_api_keys_serializers_created_api_key_serializer = require('./created-api-key.serializer.cjs');
|
|
5
|
+
|
|
6
|
+
exports.deserializeApiKey = require_api_keys_serializers_api_key_serializer.deserializeApiKey;
|
|
7
|
+
exports.deserializeCreatedApiKey = require_api_keys_serializers_created_api_key_serializer.deserializeCreatedApiKey;
|
|
8
|
+
exports.deserializeValidateApiKeyResponse = require_api_keys_serializers_validate_api_key_serializer.deserializeValidateApiKeyResponse;
|
|
9
|
+
exports.serializeCreateOrganizationApiKeyOptions = require_api_keys_serializers_create_organization_api_key_options_serializer.serializeCreateOrganizationApiKeyOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { deserializeApiKey } from "./api-key.serializer.cjs";
|
|
2
|
+
import { serializeCreateOrganizationApiKeyOptions } from "./create-organization-api-key-options.serializer.cjs";
|
|
3
|
+
import { deserializeCreatedApiKey } from "./created-api-key.serializer.cjs";
|
|
4
|
+
import { deserializeValidateApiKeyResponse } from "./validate-api-key.serializer.cjs";
|
|
5
|
+
export { deserializeApiKey, deserializeCreatedApiKey, deserializeValidateApiKeyResponse, serializeCreateOrganizationApiKeyOptions };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { deserializeApiKey } from "./api-key.serializer.js";
|
|
2
|
+
import { serializeCreateOrganizationApiKeyOptions } from "./create-organization-api-key-options.serializer.js";
|
|
3
|
+
import { deserializeCreatedApiKey } from "./created-api-key.serializer.js";
|
|
4
|
+
import { deserializeValidateApiKeyResponse } from "./validate-api-key.serializer.js";
|
|
5
|
+
export { deserializeApiKey, deserializeCreatedApiKey, deserializeValidateApiKeyResponse, serializeCreateOrganizationApiKeyOptions };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { deserializeApiKey } from "./api-key.serializer.js";
|
|
2
|
+
import { deserializeValidateApiKeyResponse } from "./validate-api-key.serializer.js";
|
|
3
|
+
import { serializeCreateOrganizationApiKeyOptions } from "./create-organization-api-key-options.serializer.js";
|
|
4
|
+
import { deserializeCreatedApiKey } from "./created-api-key.serializer.js";
|
|
5
|
+
|
|
6
|
+
export { deserializeApiKey, deserializeCreatedApiKey, deserializeValidateApiKeyResponse, serializeCreateOrganizationApiKeyOptions };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
const require_index = require('../../node_modules/iron-webcrypto/index.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/common/crypto/seal.ts
|
|
4
4
|
const VERSION_DELIMITER = "~";
|
|
5
5
|
const CURRENT_MAJOR_VERSION = 2;
|
|
6
|
-
function parseSeal(seal) {
|
|
7
|
-
const [sealWithoutVersion = "", tokenVersionAsString] = seal.split(VERSION_DELIMITER);
|
|
6
|
+
function parseSeal(seal$1) {
|
|
7
|
+
const [sealWithoutVersion = "", tokenVersionAsString] = seal$1.split(VERSION_DELIMITER);
|
|
8
8
|
return {
|
|
9
9
|
sealWithoutVersion,
|
|
10
10
|
tokenVersion: tokenVersionAsString == null ? null : parseInt(tokenVersionAsString, 10)
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
async function sealData(data, { password }) {
|
|
14
|
-
return `${await
|
|
14
|
+
return `${await require_index.seal(data, {
|
|
15
15
|
id: "1",
|
|
16
16
|
secret: password
|
|
17
17
|
}, {
|
|
18
|
-
...
|
|
18
|
+
...require_index.defaults,
|
|
19
19
|
ttl: 0,
|
|
20
20
|
encode: JSON.stringify
|
|
21
21
|
})}${VERSION_DELIMITER}${CURRENT_MAJOR_VERSION}`;
|
|
@@ -25,8 +25,8 @@ async function unsealData(encryptedData, { password }) {
|
|
|
25
25
|
const passwordMap = { 1: password };
|
|
26
26
|
let data;
|
|
27
27
|
try {
|
|
28
|
-
data = await
|
|
29
|
-
...
|
|
28
|
+
data = await require_index.unseal(sealWithoutVersion, passwordMap, {
|
|
29
|
+
...require_index.defaults,
|
|
30
30
|
ttl: 0
|
|
31
31
|
}) ?? {};
|
|
32
32
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seal.cjs","names":["defaults","data: unknown"],"sources":["../../../src/common/crypto/seal.ts"],"sourcesContent":["import {\n seal as ironSeal,\n unseal as ironUnseal,\n defaults,\n} from 'iron-webcrypto';\n\nconst VERSION_DELIMITER = '~';\nconst CURRENT_MAJOR_VERSION = 2;\n\ninterface SealOptions {\n password: string;\n}\n\ninterface UnsealOptions {\n password: string;\n}\n\nfunction parseSeal(seal: string): {\n sealWithoutVersion: string;\n tokenVersion: number | null;\n} {\n const [sealWithoutVersion = '', tokenVersionAsString] =\n seal.split(VERSION_DELIMITER);\n const tokenVersion =\n tokenVersionAsString == null ? null : parseInt(tokenVersionAsString, 10);\n return { sealWithoutVersion, tokenVersion };\n}\n\nexport async function sealData(\n data: unknown,\n { password }: SealOptions,\n): Promise<string> {\n const passwordObj = {\n id: '1',\n secret: password,\n };\n\n const seal = await ironSeal(data, passwordObj, {\n ...defaults,\n ttl: 0,\n encode: JSON.stringify,\n });\n\n return `${seal}${VERSION_DELIMITER}${CURRENT_MAJOR_VERSION}`;\n}\n\nexport async function unsealData<T = unknown>(\n encryptedData: string,\n { password }: UnsealOptions,\n): Promise<T> {\n const { sealWithoutVersion, tokenVersion } = parseSeal(encryptedData);\n\n const passwordMap = { 1: password };\n\n let data: unknown;\n try {\n data =\n (await ironUnseal(sealWithoutVersion, passwordMap, {\n ...defaults,\n ttl: 0,\n })) ?? {};\n } catch (error) {\n if (\n error instanceof Error &&\n /^(Expired seal|Bad hmac value|Cannot find password|Incorrect number of sealed components|Wrong mac prefix)/.test(\n error.message,\n )\n ) {\n return {} as T;\n }\n throw error;\n }\n\n if (tokenVersion === 2) {\n return data as T;\n } else if (tokenVersion !== null) {\n const record = data as Record<string, unknown>;\n return (record.persistent ?? data) as T;\n }\n\n return data as T;\n}\n"],"mappings":";;;AAMA,MAAM,oBAAoB;AAC1B,MAAM,wBAAwB;AAU9B,SAAS,UAAU,
|
|
1
|
+
{"version":3,"file":"seal.cjs","names":["seal","ironSeal","defaults","data: unknown","ironUnseal"],"sources":["../../../src/common/crypto/seal.ts"],"sourcesContent":["import {\n seal as ironSeal,\n unseal as ironUnseal,\n defaults,\n} from 'iron-webcrypto';\n\nconst VERSION_DELIMITER = '~';\nconst CURRENT_MAJOR_VERSION = 2;\n\ninterface SealOptions {\n password: string;\n}\n\ninterface UnsealOptions {\n password: string;\n}\n\nfunction parseSeal(seal: string): {\n sealWithoutVersion: string;\n tokenVersion: number | null;\n} {\n const [sealWithoutVersion = '', tokenVersionAsString] =\n seal.split(VERSION_DELIMITER);\n const tokenVersion =\n tokenVersionAsString == null ? null : parseInt(tokenVersionAsString, 10);\n return { sealWithoutVersion, tokenVersion };\n}\n\nexport async function sealData(\n data: unknown,\n { password }: SealOptions,\n): Promise<string> {\n const passwordObj = {\n id: '1',\n secret: password,\n };\n\n const seal = await ironSeal(data, passwordObj, {\n ...defaults,\n ttl: 0,\n encode: JSON.stringify,\n });\n\n return `${seal}${VERSION_DELIMITER}${CURRENT_MAJOR_VERSION}`;\n}\n\nexport async function unsealData<T = unknown>(\n encryptedData: string,\n { password }: UnsealOptions,\n): Promise<T> {\n const { sealWithoutVersion, tokenVersion } = parseSeal(encryptedData);\n\n const passwordMap = { 1: password };\n\n let data: unknown;\n try {\n data =\n (await ironUnseal(sealWithoutVersion, passwordMap, {\n ...defaults,\n ttl: 0,\n })) ?? {};\n } catch (error) {\n if (\n error instanceof Error &&\n /^(Expired seal|Bad hmac value|Cannot find password|Incorrect number of sealed components|Wrong mac prefix)/.test(\n error.message,\n )\n ) {\n return {} as T;\n }\n throw error;\n }\n\n if (tokenVersion === 2) {\n return data as T;\n } else if (tokenVersion !== null) {\n const record = data as Record<string, unknown>;\n return (record.persistent ?? data) as T;\n }\n\n return data as T;\n}\n"],"mappings":";;;AAMA,MAAM,oBAAoB;AAC1B,MAAM,wBAAwB;AAU9B,SAAS,UAAU,QAGjB;CACA,MAAM,CAAC,qBAAqB,IAAI,wBAC9BA,OAAK,MAAM,kBAAkB;AAG/B,QAAO;EAAE;EAAoB,cAD3B,wBAAwB,OAAO,OAAO,SAAS,sBAAsB,GAAG;EAC/B;;AAG7C,eAAsB,SACpB,MACA,EAAE,YACe;AAYjB,QAAO,GANM,MAAMC,mBAAS,MALR;EAClB,IAAI;EACJ,QAAQ;EACT,EAE8C;EAC7C,GAAGC;EACH,KAAK;EACL,QAAQ,KAAK;EACd,CAAC,GAEe,oBAAoB;;AAGvC,eAAsB,WACpB,eACA,EAAE,YACU;CACZ,MAAM,EAAE,oBAAoB,iBAAiB,UAAU,cAAc;CAErE,MAAM,cAAc,EAAE,GAAG,UAAU;CAEnC,IAAIC;AACJ,KAAI;AACF,SACG,MAAMC,qBAAW,oBAAoB,aAAa;GACjD,GAAGF;GACH,KAAK;GACN,CAAC,IAAK,EAAE;UACJ,OAAO;AACd,MACE,iBAAiB,SACjB,6GAA6G,KAC3G,MAAM,QACP,CAED,QAAO,EAAE;AAEX,QAAM;;AAGR,KAAI,iBAAiB,EACnB,QAAO;UACE,iBAAiB,KAE1B,QADe,KACA,cAAc;AAG/B,QAAO"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/common/exceptions/api-key-required.exception.ts
|
|
3
|
+
var ApiKeyRequiredException = class extends Error {
|
|
4
|
+
status = 403;
|
|
5
|
+
name = "ApiKeyRequiredException";
|
|
6
|
+
path;
|
|
7
|
+
constructor(path) {
|
|
8
|
+
super(`API key required for "${path}". For server-side apps, initialize with: new WorkOS("sk_..."). For browser/mobile/CLI apps, use authenticateWithCodeAndVerifier() and authenticateWithRefreshToken() which work without an API key.`);
|
|
9
|
+
this.path = path;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.ApiKeyRequiredException = ApiKeyRequiredException;
|
|
15
|
+
//# sourceMappingURL=api-key-required.exception.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key-required.exception.cjs","names":[],"sources":["../../../src/common/exceptions/api-key-required.exception.ts"],"sourcesContent":["export class ApiKeyRequiredException extends Error {\n readonly status = 403;\n readonly name = 'ApiKeyRequiredException';\n readonly path: string;\n\n constructor(path: string) {\n super(\n `API key required for \"${path}\". ` +\n `For server-side apps, initialize with: new WorkOS(\"sk_...\"). ` +\n `For browser/mobile/CLI apps, use authenticateWithCodeAndVerifier() and authenticateWithRefreshToken() which work without an API key.`,\n );\n this.path = path;\n }\n}\n"],"mappings":";;AAAA,IAAa,0BAAb,cAA6C,MAAM;CACjD,AAAS,SAAS;CAClB,AAAS,OAAO;CAChB,AAAS;CAET,YAAY,MAAc;AACxB,QACE,yBAAyB,KAAK,sMAG/B;AACD,OAAK,OAAO"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/common/exceptions/api-key-required.exception.d.ts
|
|
2
|
+
declare class ApiKeyRequiredException extends Error {
|
|
3
|
+
readonly status = 403;
|
|
4
|
+
readonly name = "ApiKeyRequiredException";
|
|
5
|
+
readonly path: string;
|
|
6
|
+
constructor(path: string);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ApiKeyRequiredException };
|
|
10
|
+
//# sourceMappingURL=api-key-required.exception.d.cts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/common/exceptions/api-key-required.exception.d.ts
|
|
2
|
+
declare class ApiKeyRequiredException extends Error {
|
|
3
|
+
readonly status = 403;
|
|
4
|
+
readonly name = "ApiKeyRequiredException";
|
|
5
|
+
readonly path: string;
|
|
6
|
+
constructor(path: string);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ApiKeyRequiredException };
|
|
10
|
+
//# sourceMappingURL=api-key-required.exception.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/common/exceptions/api-key-required.exception.ts
|
|
2
|
+
var ApiKeyRequiredException = class extends Error {
|
|
3
|
+
status = 403;
|
|
4
|
+
name = "ApiKeyRequiredException";
|
|
5
|
+
path;
|
|
6
|
+
constructor(path) {
|
|
7
|
+
super(`API key required for "${path}". For server-side apps, initialize with: new WorkOS("sk_..."). For browser/mobile/CLI apps, use authenticateWithCodeAndVerifier() and authenticateWithRefreshToken() which work without an API key.`);
|
|
8
|
+
this.path = path;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ApiKeyRequiredException };
|
|
14
|
+
//# sourceMappingURL=api-key-required.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key-required.exception.js","names":[],"sources":["../../../src/common/exceptions/api-key-required.exception.ts"],"sourcesContent":["export class ApiKeyRequiredException extends Error {\n readonly status = 403;\n readonly name = 'ApiKeyRequiredException';\n readonly path: string;\n\n constructor(path: string) {\n super(\n `API key required for \"${path}\". ` +\n `For server-side apps, initialize with: new WorkOS(\"sk_...\"). ` +\n `For browser/mobile/CLI apps, use authenticateWithCodeAndVerifier() and authenticateWithRefreshToken() which work without an API key.`,\n );\n this.path = path;\n }\n}\n"],"mappings":";AAAA,IAAa,0BAAb,cAA6C,MAAM;CACjD,AAAS,SAAS;CAClB,AAAS,OAAO;CAChB,AAAS;CAET,YAAY,MAAc;AACxB,QACE,yBAAyB,KAAK,sMAG/B;AACD,OAAK,OAAO"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_common_exceptions_api_key_required_exception = require('./api-key-required.exception.cjs');
|
|
1
2
|
const require_common_exceptions_generic_server_exception = require('./generic-server.exception.cjs');
|
|
2
3
|
const require_common_exceptions_bad_request_exception = require('./bad-request.exception.cjs');
|
|
3
4
|
const require_common_exceptions_no_api_key_provided_exception = require('./no-api-key-provided.exception.cjs');
|
|
@@ -8,6 +9,7 @@ const require_common_exceptions_signature_verification_exception = require('./si
|
|
|
8
9
|
const require_common_exceptions_unauthorized_exception = require('./unauthorized.exception.cjs');
|
|
9
10
|
const require_common_exceptions_unprocessable_entity_exception = require('./unprocessable-entity.exception.cjs');
|
|
10
11
|
|
|
12
|
+
exports.ApiKeyRequiredException = require_common_exceptions_api_key_required_exception.ApiKeyRequiredException;
|
|
11
13
|
exports.BadRequestException = require_common_exceptions_bad_request_exception.BadRequestException;
|
|
12
14
|
exports.GenericServerException = require_common_exceptions_generic_server_exception.GenericServerException;
|
|
13
15
|
exports.NoApiKeyProvidedException = require_common_exceptions_no_api_key_provided_exception.NoApiKeyProvidedException;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApiKeyRequiredException } from "./api-key-required.exception.cjs";
|
|
1
2
|
import { GenericServerException } from "./generic-server.exception.cjs";
|
|
2
3
|
import { BadRequestException } from "./bad-request.exception.cjs";
|
|
3
4
|
import { NoApiKeyProvidedException } from "./no-api-key-provided.exception.cjs";
|
|
@@ -7,4 +8,4 @@ import { RateLimitExceededException } from "./rate-limit-exceeded.exception.cjs"
|
|
|
7
8
|
import { SignatureVerificationException } from "./signature-verification.exception.cjs";
|
|
8
9
|
import { UnauthorizedException } from "./unauthorized.exception.cjs";
|
|
9
10
|
import { UnprocessableEntityException } from "./unprocessable-entity.exception.cjs";
|
|
10
|
-
export { BadRequestException, GenericServerException, NoApiKeyProvidedException, NotFoundException, OauthException, RateLimitExceededException, SignatureVerificationException, UnauthorizedException, UnprocessableEntityException };
|
|
11
|
+
export { ApiKeyRequiredException, BadRequestException, GenericServerException, NoApiKeyProvidedException, NotFoundException, OauthException, RateLimitExceededException, SignatureVerificationException, UnauthorizedException, UnprocessableEntityException };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApiKeyRequiredException } from "./api-key-required.exception.js";
|
|
1
2
|
import { GenericServerException } from "./generic-server.exception.js";
|
|
2
3
|
import { BadRequestException } from "./bad-request.exception.js";
|
|
3
4
|
import { NoApiKeyProvidedException } from "./no-api-key-provided.exception.js";
|
|
@@ -7,4 +8,4 @@ import { RateLimitExceededException } from "./rate-limit-exceeded.exception.js";
|
|
|
7
8
|
import { SignatureVerificationException } from "./signature-verification.exception.js";
|
|
8
9
|
import { UnauthorizedException } from "./unauthorized.exception.js";
|
|
9
10
|
import { UnprocessableEntityException } from "./unprocessable-entity.exception.js";
|
|
10
|
-
export { BadRequestException, GenericServerException, NoApiKeyProvidedException, NotFoundException, OauthException, RateLimitExceededException, SignatureVerificationException, UnauthorizedException, UnprocessableEntityException };
|
|
11
|
+
export { ApiKeyRequiredException, BadRequestException, GenericServerException, NoApiKeyProvidedException, NotFoundException, OauthException, RateLimitExceededException, SignatureVerificationException, UnauthorizedException, UnprocessableEntityException };
|