@workos-inc/node 7.30.0 → 7.31.0-beta.actions1
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/actions/actions.d.ts +19 -0
- package/lib/actions/actions.js +53 -0
- package/lib/actions/actions.spec.d.ts +1 -0
- package/lib/actions/actions.spec.js +78 -0
- package/lib/actions/fixtures/action-context.json +39 -0
- package/lib/actions/interfaces/response-payload.d.ts +23 -0
- package/lib/actions/interfaces/response-payload.js +2 -0
- package/lib/common/crypto/CryptoProvider.d.ts +32 -0
- package/lib/common/crypto/CryptoProvider.js +13 -0
- package/lib/common/crypto/CryptoProvider.spec.d.ts +1 -0
- package/lib/common/crypto/CryptoProvider.spec.js +57 -0
- package/lib/common/crypto/NodeCryptoProvider.d.ts +12 -0
- package/lib/common/crypto/NodeCryptoProvider.js +73 -0
- package/lib/common/crypto/SignatureProvider.d.ts +13 -0
- package/lib/common/crypto/SignatureProvider.js +53 -0
- package/lib/common/crypto/SignatureProvider.spec.d.ts +1 -0
- package/lib/common/crypto/SignatureProvider.spec.js +66 -0
- package/lib/common/crypto/SubtleCryptoProvider.d.ts +15 -0
- package/lib/common/crypto/SubtleCryptoProvider.js +75 -0
- package/lib/common/crypto/index.d.ts +4 -0
- package/lib/common/crypto/index.js +20 -0
- package/lib/common/net/fetch-client.spec.d.ts +1 -0
- package/lib/common/net/fetch-client.spec.js +140 -0
- package/lib/common/net/index.d.ts +5 -0
- package/lib/common/net/index.js +31 -0
- package/lib/common/net/node-client.js +1 -0
- package/lib/common/net/node-client.spec.d.ts +1 -0
- package/lib/common/net/node-client.spec.js +140 -0
- package/lib/common/utils/unreachable.d.ts +10 -0
- package/lib/common/utils/unreachable.js +18 -0
- package/lib/fga/fga.spec.js +0 -609
- package/lib/index.d.ts +3 -0
- package/lib/index.js +12 -0
- package/lib/index.worker.d.ts +3 -0
- package/lib/index.worker.js +6 -0
- package/lib/organizations/fixtures/clear-stripe-customer-id.json +13 -0
- package/lib/organizations/fixtures/set-stripe-customer-id-disabled.json +4 -0
- package/lib/organizations/fixtures/set-stripe-customer-id.json +14 -0
- package/lib/organizations/interfaces/organization.interface.d.ts +2 -0
- package/lib/organizations/interfaces/update-organization-options.interface.d.ts +2 -0
- package/lib/organizations/organizations.spec.js +39 -0
- package/lib/organizations/serializers/organization.serializer.js +3 -9
- package/lib/organizations/serializers/update-organization-options.serializer.js +1 -0
- package/lib/user-management/interfaces/authenticate-with-session-cookie.interface.d.ts +2 -0
- package/lib/user-management/session.js +2 -1
- package/lib/user-management/session.spec.js +2 -1
- package/lib/user-management/user-management.js +2 -1
- package/lib/user-management/user-management.spec.js +2 -1
- package/lib/webhooks/webhooks.d.ts +9 -9
- package/lib/webhooks/webhooks.js +11 -36
- package/lib/webhooks/webhooks.spec.js +23 -46
- package/lib/widgets/fixtures/get-token-error.json +5 -0
- package/lib/widgets/fixtures/token.json +3 -0
- package/lib/widgets/interfaces/get-token.d.ts +19 -0
- package/lib/widgets/interfaces/get-token.js +13 -0
- package/lib/widgets/widgets.d.ts +7 -0
- package/lib/widgets/widgets.js +25 -0
- package/lib/widgets/widgets.spec.d.ts +1 -0
- package/lib/widgets/widgets.spec.js +49 -0
- package/lib/workos.d.ts +5 -0
- package/lib/workos.js +9 -2
- package/lib/workos.spec.js +5 -1
- package/package.json +2 -1
package/lib/workos.d.ts
CHANGED
|
@@ -13,12 +13,15 @@ import { UserManagement } from './user-management/user-management';
|
|
|
13
13
|
import { FGA } from './fga/fga';
|
|
14
14
|
import { HttpClient } from './common/net/http-client';
|
|
15
15
|
import { IronSessionProvider } from './common/iron-session/iron-session-provider';
|
|
16
|
+
import { Widgets } from './widgets/widgets';
|
|
17
|
+
import { Actions } from './actions/actions';
|
|
16
18
|
export declare class WorkOS {
|
|
17
19
|
readonly key?: string | undefined;
|
|
18
20
|
readonly options: WorkOSOptions;
|
|
19
21
|
readonly baseURL: string;
|
|
20
22
|
readonly client: HttpClient;
|
|
21
23
|
readonly clientId?: string;
|
|
24
|
+
readonly actions: Actions;
|
|
22
25
|
readonly auditLogs: AuditLogs;
|
|
23
26
|
readonly directorySync: DirectorySync;
|
|
24
27
|
readonly organizations: Organizations;
|
|
@@ -31,8 +34,10 @@ export declare class WorkOS {
|
|
|
31
34
|
readonly events: Events;
|
|
32
35
|
readonly userManagement: UserManagement;
|
|
33
36
|
readonly fga: FGA;
|
|
37
|
+
readonly widgets: Widgets;
|
|
34
38
|
constructor(key?: string | undefined, options?: WorkOSOptions);
|
|
35
39
|
createWebhookClient(): Webhooks;
|
|
40
|
+
createActionsClient(): Actions;
|
|
36
41
|
createHttpClient(options: WorkOSOptions, userAgent: string): HttpClient;
|
|
37
42
|
createIronSessionProvider(): IronSessionProvider;
|
|
38
43
|
get version(): string;
|
package/lib/workos.js
CHANGED
|
@@ -27,7 +27,9 @@ const bad_request_exception_1 = require("./common/exceptions/bad-request.excepti
|
|
|
27
27
|
const http_client_1 = require("./common/net/http-client");
|
|
28
28
|
const subtle_crypto_provider_1 = require("./common/crypto/subtle-crypto-provider");
|
|
29
29
|
const fetch_client_1 = require("./common/net/fetch-client");
|
|
30
|
-
const
|
|
30
|
+
const widgets_1 = require("./widgets/widgets");
|
|
31
|
+
const actions_1 = require("./actions/actions");
|
|
32
|
+
const VERSION = '7.30.1';
|
|
31
33
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
32
34
|
const HEADER_AUTHORIZATION = 'Authorization';
|
|
33
35
|
const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|
|
@@ -46,6 +48,7 @@ class WorkOS {
|
|
|
46
48
|
this.mfa = new mfa_1.Mfa(this);
|
|
47
49
|
this.events = new events_1.Events(this);
|
|
48
50
|
this.fga = new fga_1.FGA(this);
|
|
51
|
+
this.widgets = new widgets_1.Widgets(this);
|
|
49
52
|
if (!key) {
|
|
50
53
|
// process might be undefined in some environments
|
|
51
54
|
this.key =
|
|
@@ -76,6 +79,7 @@ class WorkOS {
|
|
|
76
79
|
userAgent += ` ${name}: ${version}`;
|
|
77
80
|
}
|
|
78
81
|
this.webhooks = this.createWebhookClient();
|
|
82
|
+
this.actions = this.createActionsClient();
|
|
79
83
|
// Must initialize UserManagement after baseURL is configured
|
|
80
84
|
this.userManagement = new user_management_1.UserManagement(this, this.createIronSessionProvider());
|
|
81
85
|
this.client = this.createHttpClient(options, userAgent);
|
|
@@ -83,6 +87,9 @@ class WorkOS {
|
|
|
83
87
|
createWebhookClient() {
|
|
84
88
|
return new webhooks_1.Webhooks(new subtle_crypto_provider_1.SubtleCryptoProvider());
|
|
85
89
|
}
|
|
90
|
+
createActionsClient() {
|
|
91
|
+
return new actions_1.Actions(new subtle_crypto_provider_1.SubtleCryptoProvider());
|
|
92
|
+
}
|
|
86
93
|
createHttpClient(options, userAgent) {
|
|
87
94
|
var _a;
|
|
88
95
|
return new fetch_client_1.FetchHttpClient(this.baseURL, Object.assign(Object.assign({}, options.config), { headers: Object.assign(Object.assign({}, (_a = options.config) === null || _a === void 0 ? void 0 : _a.headers), { Authorization: `Bearer ${this.key}`, 'User-Agent': userAgent }) }));
|
|
@@ -176,7 +183,7 @@ class WorkOS {
|
|
|
176
183
|
handleHttpError({ path, error }) {
|
|
177
184
|
var _a;
|
|
178
185
|
if (!(error instanceof http_client_1.HttpClientError)) {
|
|
179
|
-
throw new Error(`Unexpected error: ${error}
|
|
186
|
+
throw new Error(`Unexpected error: ${error}`, { cause: error });
|
|
180
187
|
}
|
|
181
188
|
const { response } = error;
|
|
182
189
|
if (response) {
|
package/lib/workos.spec.js
CHANGED
|
@@ -246,8 +246,12 @@ describe('WorkOS', () => {
|
|
|
246
246
|
const workos = new index_worker_1.WorkOS('sk_test_key');
|
|
247
247
|
// tslint:disable-next-line
|
|
248
248
|
expect(workos['client']).toBeInstanceOf(fetch_client_1.FetchHttpClient);
|
|
249
|
+
expect(
|
|
249
250
|
// tslint:disable-next-line
|
|
250
|
-
|
|
251
|
+
workos.webhooks['signatureProvider']['cryptoProvider']).toBeInstanceOf(subtle_crypto_provider_1.SubtleCryptoProvider);
|
|
252
|
+
expect(
|
|
253
|
+
// tslint:disable-next-line
|
|
254
|
+
workos.actions['signatureProvider']['cryptoProvider']).toBeInstanceOf(subtle_crypto_provider_1.SubtleCryptoProvider);
|
|
251
255
|
});
|
|
252
256
|
it('uses console.warn to emit warnings', () => {
|
|
253
257
|
const workos = new index_worker_1.WorkOS('sk_test_key');
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "7.
|
|
2
|
+
"version": "7.31.0-beta.actions1",
|
|
3
3
|
"name": "@workos-inc/node",
|
|
4
4
|
"author": "WorkOS",
|
|
5
5
|
"description": "A Node wrapper for the WorkOS API",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"jest": "29.6.2",
|
|
51
51
|
"jest-environment-miniflare": "^2.14.2",
|
|
52
52
|
"jest-fetch-mock": "^3.0.3",
|
|
53
|
+
"nock": "^13.5.5",
|
|
53
54
|
"prettier": "2.8.8",
|
|
54
55
|
"supertest": "6.3.3",
|
|
55
56
|
"ts-jest": "29.1.3",
|