@workos-inc/node 7.77.0 → 7.79.2

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.
Files changed (35) hide show
  1. package/lib/feature-flags/feature-flags.d.ts +13 -0
  2. package/lib/feature-flags/feature-flags.js +56 -0
  3. package/lib/feature-flags/feature-flags.spec.d.ts +1 -0
  4. package/lib/feature-flags/feature-flags.spec.js +173 -0
  5. package/lib/feature-flags/fixtures/disable-feature-flag.json +12 -0
  6. package/lib/feature-flags/fixtures/enable-feature-flag.json +12 -0
  7. package/lib/feature-flags/fixtures/get-feature-flag.json +12 -0
  8. package/lib/feature-flags/fixtures/list-feature-flags.json +45 -0
  9. package/lib/feature-flags/interfaces/add-flag-target-options.interface.d.ts +4 -0
  10. package/lib/feature-flags/interfaces/add-flag-target-options.interface.js +2 -0
  11. package/lib/feature-flags/interfaces/feature-flag.interface.d.ts +8 -2
  12. package/lib/feature-flags/interfaces/index.d.ts +3 -0
  13. package/lib/feature-flags/interfaces/index.js +3 -0
  14. package/lib/feature-flags/interfaces/list-feature-flags-options.interface.d.ts +2 -0
  15. package/lib/feature-flags/interfaces/list-feature-flags-options.interface.js +2 -0
  16. package/lib/feature-flags/interfaces/remove-flag-target-options.interface.d.ts +4 -0
  17. package/lib/feature-flags/interfaces/remove-flag-target-options.interface.js +2 -0
  18. package/lib/feature-flags/serializers/feature-flag.serializer.js +3 -0
  19. package/lib/feature-flags/serializers/index.d.ts +1 -0
  20. package/lib/feature-flags/serializers/index.js +17 -0
  21. package/lib/organizations/fixtures/list-organization-feature-flags.json +10 -1
  22. package/lib/organizations/organizations.js +2 -2
  23. package/lib/organizations/organizations.spec.js +10 -1
  24. package/lib/user-management/fixtures/list-user-feature-flags.json +10 -1
  25. package/lib/user-management/interfaces/authenticate-with-session-cookie.interface.d.ts +3 -2
  26. package/lib/user-management/session.js +2 -0
  27. package/lib/user-management/user-management.js +42 -40
  28. package/lib/user-management/user-management.spec.js +10 -1
  29. package/lib/vault/vault-live-test.spec.js +33 -4
  30. package/lib/vault/vault.d.ts +1 -0
  31. package/lib/vault/vault.js +6 -0
  32. package/lib/vault/vault.spec.js +25 -0
  33. package/lib/workos.d.ts +7 -5
  34. package/lib/workos.js +7 -5
  35. package/package.json +4 -4
@@ -0,0 +1,13 @@
1
+ import { AutoPaginatable } from '../common/utils/pagination';
2
+ import { WorkOS } from '../workos';
3
+ import { AddFlagTargetOptions, FeatureFlag, ListFeatureFlagsOptions, RemoveFlagTargetOptions } from './interfaces';
4
+ export declare class FeatureFlags {
5
+ private readonly workos;
6
+ constructor(workos: WorkOS);
7
+ listFeatureFlags(options?: ListFeatureFlagsOptions): Promise<AutoPaginatable<FeatureFlag>>;
8
+ getFeatureFlag(slug: string): Promise<FeatureFlag>;
9
+ enableFeatureFlag(slug: string): Promise<FeatureFlag>;
10
+ disableFeatureFlag(slug: string): Promise<FeatureFlag>;
11
+ addFlagTarget(options: AddFlagTargetOptions): Promise<void>;
12
+ removeFlagTarget(options: RemoveFlagTargetOptions): Promise<void>;
13
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.FeatureFlags = void 0;
13
+ const pagination_1 = require("../common/utils/pagination");
14
+ const serializers_1 = require("./serializers");
15
+ const fetch_and_deserialize_1 = require("../common/utils/fetch-and-deserialize");
16
+ class FeatureFlags {
17
+ constructor(workos) {
18
+ this.workos = workos;
19
+ }
20
+ listFeatureFlags(options) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/feature-flags', serializers_1.deserializeFeatureFlag, options), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/feature-flags', serializers_1.deserializeFeatureFlag, params), options);
23
+ });
24
+ }
25
+ getFeatureFlag(slug) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const { data } = yield this.workos.get(`/feature-flags/${slug}`);
28
+ return (0, serializers_1.deserializeFeatureFlag)(data);
29
+ });
30
+ }
31
+ enableFeatureFlag(slug) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ const { data } = yield this.workos.put(`/feature-flags/${slug}/enable`, {});
34
+ return (0, serializers_1.deserializeFeatureFlag)(data);
35
+ });
36
+ }
37
+ disableFeatureFlag(slug) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const { data } = yield this.workos.put(`/feature-flags/${slug}/disable`, {});
40
+ return (0, serializers_1.deserializeFeatureFlag)(data);
41
+ });
42
+ }
43
+ addFlagTarget(options) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const { slug, targetId } = options;
46
+ yield this.workos.post(`/feature-flags/${slug}/targets/${targetId}`, {});
47
+ });
48
+ }
49
+ removeFlagTarget(options) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const { slug, targetId } = options;
52
+ yield this.workos.delete(`/feature-flags/${slug}/targets/${targetId}`);
53
+ });
54
+ }
55
+ }
56
+ exports.FeatureFlags = FeatureFlags;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const jest_fetch_mock_1 = __importDefault(require("jest-fetch-mock"));
16
+ const test_utils_1 = require("../common/utils/test-utils");
17
+ const workos_1 = require("../workos");
18
+ const list_feature_flags_json_1 = __importDefault(require("./fixtures/list-feature-flags.json"));
19
+ const get_feature_flag_json_1 = __importDefault(require("./fixtures/get-feature-flag.json"));
20
+ const enable_feature_flag_json_1 = __importDefault(require("./fixtures/enable-feature-flag.json"));
21
+ const disable_feature_flag_json_1 = __importDefault(require("./fixtures/disable-feature-flag.json"));
22
+ const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
23
+ describe('FeatureFlags', () => {
24
+ beforeEach(() => jest_fetch_mock_1.default.resetMocks());
25
+ describe('listFeatureFlags', () => {
26
+ describe('without any options', () => {
27
+ it('returns feature flags and metadata', () => __awaiter(void 0, void 0, void 0, function* () {
28
+ (0, test_utils_1.fetchOnce)(list_feature_flags_json_1.default);
29
+ const { data, listMetadata } = yield workos.featureFlags.listFeatureFlags();
30
+ expect((0, test_utils_1.fetchSearchParams)()).toEqual({
31
+ order: 'desc',
32
+ });
33
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags');
34
+ expect(data).toHaveLength(3);
35
+ expect(data[0]).toEqual({
36
+ object: 'feature_flag',
37
+ id: 'flag_01EHQMYV6MBK39QC5PZXHY59C5',
38
+ name: 'Advanced Dashboard',
39
+ slug: 'advanced-dashboard',
40
+ description: 'Enable advanced dashboard features',
41
+ tags: ['ui'],
42
+ enabled: true,
43
+ defaultValue: false,
44
+ createdAt: '2024-01-01T00:00:00.000Z',
45
+ updatedAt: '2024-01-01T00:00:00.000Z',
46
+ });
47
+ expect(listMetadata).toEqual({
48
+ before: null,
49
+ after: 'flag_01EHQMYV6MBK39QC5PZXHY59C7',
50
+ });
51
+ }));
52
+ });
53
+ describe('with the before option', () => {
54
+ it('forms the proper request to the API', () => __awaiter(void 0, void 0, void 0, function* () {
55
+ (0, test_utils_1.fetchOnce)(list_feature_flags_json_1.default);
56
+ const { data } = yield workos.featureFlags.listFeatureFlags({
57
+ before: 'flag_before_id',
58
+ });
59
+ expect((0, test_utils_1.fetchSearchParams)()).toEqual({
60
+ before: 'flag_before_id',
61
+ order: 'desc',
62
+ });
63
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags');
64
+ expect(data).toHaveLength(3);
65
+ }));
66
+ });
67
+ describe('with the after option', () => {
68
+ it('forms the proper request to the API', () => __awaiter(void 0, void 0, void 0, function* () {
69
+ (0, test_utils_1.fetchOnce)(list_feature_flags_json_1.default);
70
+ const { data } = yield workos.featureFlags.listFeatureFlags({
71
+ after: 'flag_after_id',
72
+ });
73
+ expect((0, test_utils_1.fetchSearchParams)()).toEqual({
74
+ after: 'flag_after_id',
75
+ order: 'desc',
76
+ });
77
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags');
78
+ expect(data).toHaveLength(3);
79
+ }));
80
+ });
81
+ describe('with the limit option', () => {
82
+ it('forms the proper request to the API', () => __awaiter(void 0, void 0, void 0, function* () {
83
+ (0, test_utils_1.fetchOnce)(list_feature_flags_json_1.default);
84
+ const { data } = yield workos.featureFlags.listFeatureFlags({
85
+ limit: 10,
86
+ });
87
+ expect((0, test_utils_1.fetchSearchParams)()).toEqual({
88
+ limit: '10',
89
+ order: 'desc',
90
+ });
91
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags');
92
+ expect(data).toHaveLength(3);
93
+ }));
94
+ });
95
+ });
96
+ describe('getFeatureFlag', () => {
97
+ it('requests a feature flag by slug', () => __awaiter(void 0, void 0, void 0, function* () {
98
+ (0, test_utils_1.fetchOnce)(get_feature_flag_json_1.default);
99
+ const subject = yield workos.featureFlags.getFeatureFlag('advanced-dashboard');
100
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags/advanced-dashboard');
101
+ expect(subject).toEqual({
102
+ object: 'feature_flag',
103
+ id: 'flag_01EHQMYV6MBK39QC5PZXHY59C5',
104
+ name: 'Advanced Dashboard',
105
+ slug: 'advanced-dashboard',
106
+ description: 'Enable advanced dashboard features',
107
+ tags: ['ui'],
108
+ enabled: true,
109
+ defaultValue: false,
110
+ createdAt: '2024-01-01T00:00:00.000Z',
111
+ updatedAt: '2024-01-01T00:00:00.000Z',
112
+ });
113
+ }));
114
+ });
115
+ describe('enableFeatureFlag', () => {
116
+ it('enables a feature flag by slug', () => __awaiter(void 0, void 0, void 0, function* () {
117
+ (0, test_utils_1.fetchOnce)(enable_feature_flag_json_1.default);
118
+ const subject = yield workos.featureFlags.enableFeatureFlag('advanced-dashboard');
119
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags/advanced-dashboard/enable');
120
+ expect((0, test_utils_1.fetchMethod)()).toBe('PUT');
121
+ expect(subject.enabled).toBe(true);
122
+ }));
123
+ });
124
+ describe('disableFeatureFlag', () => {
125
+ it('disables a feature flag by slug', () => __awaiter(void 0, void 0, void 0, function* () {
126
+ (0, test_utils_1.fetchOnce)(disable_feature_flag_json_1.default);
127
+ const subject = yield workos.featureFlags.disableFeatureFlag('advanced-dashboard');
128
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags/advanced-dashboard/disable');
129
+ expect((0, test_utils_1.fetchMethod)()).toBe('PUT');
130
+ expect(subject.enabled).toBe(false);
131
+ }));
132
+ });
133
+ describe('addFlagTarget', () => {
134
+ it('adds a target to a feature flag', () => __awaiter(void 0, void 0, void 0, function* () {
135
+ (0, test_utils_1.fetchOnce)({}, { status: 204 });
136
+ yield workos.featureFlags.addFlagTarget({
137
+ slug: 'advanced-dashboard',
138
+ targetId: 'user_01EHQMYV6MBK39QC5PZXHY59C5',
139
+ });
140
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags/advanced-dashboard/targets/user_01EHQMYV6MBK39QC5PZXHY59C5');
141
+ expect((0, test_utils_1.fetchMethod)()).toBe('POST');
142
+ }));
143
+ it('adds an organization target to a feature flag', () => __awaiter(void 0, void 0, void 0, function* () {
144
+ (0, test_utils_1.fetchOnce)({}, { status: 204 });
145
+ yield workos.featureFlags.addFlagTarget({
146
+ slug: 'advanced-dashboard',
147
+ targetId: 'org_01EHQMYV6MBK39QC5PZXHY59C5',
148
+ });
149
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags/advanced-dashboard/targets/org_01EHQMYV6MBK39QC5PZXHY59C5');
150
+ expect((0, test_utils_1.fetchMethod)()).toBe('POST');
151
+ }));
152
+ });
153
+ describe('removeFlagTarget', () => {
154
+ it('removes a target from a feature flag', () => __awaiter(void 0, void 0, void 0, function* () {
155
+ (0, test_utils_1.fetchOnce)({}, { status: 204 });
156
+ yield workos.featureFlags.removeFlagTarget({
157
+ slug: 'advanced-dashboard',
158
+ targetId: 'user_01EHQMYV6MBK39QC5PZXHY59C5',
159
+ });
160
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags/advanced-dashboard/targets/user_01EHQMYV6MBK39QC5PZXHY59C5');
161
+ expect((0, test_utils_1.fetchMethod)()).toBe('DELETE');
162
+ }));
163
+ it('removes an organization target from a feature flag', () => __awaiter(void 0, void 0, void 0, function* () {
164
+ (0, test_utils_1.fetchOnce)({}, { status: 204 });
165
+ yield workos.featureFlags.removeFlagTarget({
166
+ slug: 'advanced-dashboard',
167
+ targetId: 'org_01EHQMYV6MBK39QC5PZXHY59C5',
168
+ });
169
+ expect((0, test_utils_1.fetchURL)()).toContain('/feature-flags/advanced-dashboard/targets/org_01EHQMYV6MBK39QC5PZXHY59C5');
170
+ expect((0, test_utils_1.fetchMethod)()).toBe('DELETE');
171
+ }));
172
+ });
173
+ });
@@ -0,0 +1,12 @@
1
+ {
2
+ "object": "feature_flag",
3
+ "id": "flag_01EHQMYV6MBK39QC5PZXHY59C5",
4
+ "name": "Advanced Dashboard",
5
+ "slug": "advanced-dashboard",
6
+ "description": "Enable advanced dashboard features",
7
+ "tags": ["ui"],
8
+ "enabled": false,
9
+ "default_value": false,
10
+ "created_at": "2024-01-01T00:00:00.000Z",
11
+ "updated_at": "2024-01-01T00:00:00.000Z"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "object": "feature_flag",
3
+ "id": "flag_01EHQMYV6MBK39QC5PZXHY59C5",
4
+ "name": "Advanced Dashboard",
5
+ "slug": "advanced-dashboard",
6
+ "description": "Enable advanced dashboard features",
7
+ "tags": ["ui"],
8
+ "enabled": true,
9
+ "default_value": false,
10
+ "created_at": "2024-01-01T00:00:00.000Z",
11
+ "updated_at": "2024-01-01T00:00:00.000Z"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "object": "feature_flag",
3
+ "id": "flag_01EHQMYV6MBK39QC5PZXHY59C5",
4
+ "name": "Advanced Dashboard",
5
+ "slug": "advanced-dashboard",
6
+ "description": "Enable advanced dashboard features",
7
+ "tags": ["ui"],
8
+ "enabled": true,
9
+ "default_value": false,
10
+ "created_at": "2024-01-01T00:00:00.000Z",
11
+ "updated_at": "2024-01-01T00:00:00.000Z"
12
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "object": "list",
3
+ "data": [
4
+ {
5
+ "object": "feature_flag",
6
+ "id": "flag_01EHQMYV6MBK39QC5PZXHY59C5",
7
+ "name": "Advanced Dashboard",
8
+ "slug": "advanced-dashboard",
9
+ "description": "Enable advanced dashboard features",
10
+ "tags": ["ui"],
11
+ "enabled": true,
12
+ "default_value": false,
13
+ "created_at": "2024-01-01T00:00:00.000Z",
14
+ "updated_at": "2024-01-01T00:00:00.000Z"
15
+ },
16
+ {
17
+ "object": "feature_flag",
18
+ "id": "flag_01EHQMYV6MBK39QC5PZXHY59C6",
19
+ "name": "Beta Features",
20
+ "slug": "beta-features",
21
+ "description": "",
22
+ "tags": [],
23
+ "enabled": false,
24
+ "default_value": false,
25
+ "created_at": "2024-01-01T00:00:00.000Z",
26
+ "updated_at": "2024-01-01T00:00:00.000Z"
27
+ },
28
+ {
29
+ "object": "feature_flag",
30
+ "id": "flag_01EHQMYV6MBK39QC5PZXHY59C7",
31
+ "name": "Premium Support",
32
+ "slug": "premium-support",
33
+ "description": "Access to premium support features",
34
+ "tags": ["dev-support"],
35
+ "enabled": false,
36
+ "default_value": true,
37
+ "created_at": "2024-01-01T00:00:00.000Z",
38
+ "updated_at": "2024-01-01T00:00:00.000Z"
39
+ }
40
+ ],
41
+ "list_metadata": {
42
+ "before": null,
43
+ "after": "flag_01EHQMYV6MBK39QC5PZXHY59C7"
44
+ }
45
+ }
@@ -0,0 +1,4 @@
1
+ export interface AddFlagTargetOptions {
2
+ slug: string;
3
+ targetId: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,7 +3,10 @@ export interface FeatureFlag {
3
3
  id: string;
4
4
  name: string;
5
5
  slug: string;
6
- description?: string;
6
+ description: string;
7
+ tags: string[];
8
+ enabled: boolean;
9
+ defaultValue: boolean;
7
10
  createdAt: string;
8
11
  updatedAt: string;
9
12
  }
@@ -12,7 +15,10 @@ export interface FeatureFlagResponse {
12
15
  id: string;
13
16
  name: string;
14
17
  slug: string;
15
- description?: string;
18
+ description: string;
19
+ tags: string[];
20
+ enabled: boolean;
21
+ default_value: boolean;
16
22
  created_at: string;
17
23
  updated_at: string;
18
24
  }
@@ -1 +1,4 @@
1
+ export * from './add-flag-target-options.interface';
1
2
  export * from './feature-flag.interface';
3
+ export * from './list-feature-flags-options.interface';
4
+ export * from './remove-flag-target-options.interface';
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./add-flag-target-options.interface"), exports);
17
18
  __exportStar(require("./feature-flag.interface"), exports);
19
+ __exportStar(require("./list-feature-flags-options.interface"), exports);
20
+ __exportStar(require("./remove-flag-target-options.interface"), exports);
@@ -0,0 +1,2 @@
1
+ import { PaginationOptions } from '../../common/interfaces';
2
+ export type ListFeatureFlagsOptions = PaginationOptions;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export interface RemoveFlagTargetOptions {
2
+ slug: string;
3
+ targetId: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,6 +7,9 @@ const deserializeFeatureFlag = (featureFlag) => ({
7
7
  name: featureFlag.name,
8
8
  slug: featureFlag.slug,
9
9
  description: featureFlag.description,
10
+ tags: featureFlag.tags,
11
+ enabled: featureFlag.enabled,
12
+ defaultValue: featureFlag.default_value,
10
13
  createdAt: featureFlag.created_at,
11
14
  updatedAt: featureFlag.updated_at,
12
15
  });
@@ -0,0 +1 @@
1
+ export * from './feature-flag.serializer';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./feature-flag.serializer"), exports);
@@ -7,6 +7,9 @@
7
7
  "name": "Advanced Dashboard",
8
8
  "slug": "advanced-dashboard",
9
9
  "description": "Enable advanced dashboard features",
10
+ "tags": ["ui"],
11
+ "enabled": true,
12
+ "default_value": false,
10
13
  "created_at": "2024-01-01T00:00:00.000Z",
11
14
  "updated_at": "2024-01-01T00:00:00.000Z"
12
15
  },
@@ -15,7 +18,10 @@
15
18
  "id": "flag_01EHQMYV6MBK39QC5PZXHY59C6",
16
19
  "name": "Beta Features",
17
20
  "slug": "beta-features",
18
- "description": null,
21
+ "description": "",
22
+ "tags": [],
23
+ "enabled": false,
24
+ "default_value": false,
19
25
  "created_at": "2024-01-01T00:00:00.000Z",
20
26
  "updated_at": "2024-01-01T00:00:00.000Z"
21
27
  },
@@ -25,6 +31,9 @@
25
31
  "name": "Premium Support",
26
32
  "slug": "premium-support",
27
33
  "description": "Access to premium support features",
34
+ "tags": ["dev-support"],
35
+ "enabled": false,
36
+ "default_value": true,
28
37
  "created_at": "2024-01-01T00:00:00.000Z",
29
38
  "updated_at": "2024-01-01T00:00:00.000Z"
30
39
  }
@@ -25,7 +25,7 @@ const pagination_1 = require("../common/utils/pagination");
25
25
  const serializers_1 = require("./serializers");
26
26
  const fetch_and_deserialize_1 = require("../common/utils/fetch-and-deserialize");
27
27
  const role_serializer_1 = require("../roles/serializers/role.serializer");
28
- const feature_flag_serializer_1 = require("../feature-flags/serializers/feature-flag.serializer");
28
+ const serializers_2 = require("../feature-flags/serializers");
29
29
  class Organizations {
30
30
  constructor(workos) {
31
31
  this.workos = workos;
@@ -78,7 +78,7 @@ class Organizations {
78
78
  listOrganizationFeatureFlags(options) {
79
79
  return __awaiter(this, void 0, void 0, function* () {
80
80
  const { organizationId } = options, paginationOptions = __rest(options, ["organizationId"]);
81
- return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/organizations/${organizationId}/feature-flags`, feature_flag_serializer_1.deserializeFeatureFlag, paginationOptions), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/organizations/${organizationId}/feature-flags`, feature_flag_serializer_1.deserializeFeatureFlag, params), paginationOptions);
81
+ return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/organizations/${organizationId}/feature-flags`, serializers_2.deserializeFeatureFlag, paginationOptions), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/organizations/${organizationId}/feature-flags`, serializers_2.deserializeFeatureFlag, params), paginationOptions);
82
82
  });
83
83
  }
84
84
  }
@@ -373,6 +373,9 @@ describe('Organizations', () => {
373
373
  name: 'Advanced Dashboard',
374
374
  slug: 'advanced-dashboard',
375
375
  description: 'Enable advanced dashboard features',
376
+ tags: ['ui'],
377
+ enabled: true,
378
+ defaultValue: false,
376
379
  createdAt: '2024-01-01T00:00:00.000Z',
377
380
  updatedAt: '2024-01-01T00:00:00.000Z',
378
381
  },
@@ -381,7 +384,10 @@ describe('Organizations', () => {
381
384
  id: 'flag_01EHQMYV6MBK39QC5PZXHY59C6',
382
385
  name: 'Beta Features',
383
386
  slug: 'beta-features',
384
- description: null,
387
+ description: '',
388
+ tags: [],
389
+ enabled: false,
390
+ defaultValue: false,
385
391
  createdAt: '2024-01-01T00:00:00.000Z',
386
392
  updatedAt: '2024-01-01T00:00:00.000Z',
387
393
  },
@@ -391,6 +397,9 @@ describe('Organizations', () => {
391
397
  name: 'Premium Support',
392
398
  slug: 'premium-support',
393
399
  description: 'Access to premium support features',
400
+ tags: ['dev-support'],
401
+ enabled: false,
402
+ defaultValue: true,
394
403
  createdAt: '2024-01-01T00:00:00.000Z',
395
404
  updatedAt: '2024-01-01T00:00:00.000Z',
396
405
  },
@@ -7,6 +7,9 @@
7
7
  "name": "Advanced Dashboard",
8
8
  "slug": "advanced-dashboard",
9
9
  "description": "Enable advanced dashboard features",
10
+ "tags": ["ui"],
11
+ "enabled": true,
12
+ "default_value": false,
10
13
  "created_at": "2024-01-01T00:00:00.000Z",
11
14
  "updated_at": "2024-01-01T00:00:00.000Z"
12
15
  },
@@ -15,7 +18,10 @@
15
18
  "id": "flag_01EHQMYV6MBK39QC5PZXHY59C6",
16
19
  "name": "Beta Features",
17
20
  "slug": "beta-features",
18
- "description": null,
21
+ "description": "",
22
+ "tags": [],
23
+ "enabled": false,
24
+ "default_value": false,
19
25
  "created_at": "2024-01-01T00:00:00.000Z",
20
26
  "updated_at": "2024-01-01T00:00:00.000Z"
21
27
  },
@@ -25,6 +31,9 @@
25
31
  "name": "Premium Support",
26
32
  "slug": "premium-support",
27
33
  "description": "Access to premium support features",
34
+ "tags": ["dev-support"],
35
+ "enabled": false,
36
+ "default_value": true,
28
37
  "created_at": "2024-01-01T00:00:00.000Z",
29
38
  "updated_at": "2024-01-01T00:00:00.000Z"
30
39
  }
@@ -14,7 +14,7 @@ export interface AccessToken {
14
14
  entitlements?: string[];
15
15
  feature_flags?: string[];
16
16
  }
17
- export type SessionCookieData = Pick<AuthenticationResponse, 'accessToken' | 'impersonator' | 'organizationId' | 'refreshToken' | 'user'>;
17
+ export type SessionCookieData = Pick<AuthenticationResponse, 'accessToken' | 'authenticationMethod' | 'impersonator' | 'organizationId' | 'refreshToken' | 'user'>;
18
18
  export declare enum AuthenticateWithSessionCookieFailureReason {
19
19
  INVALID_JWT = "invalid_jwt",
20
20
  INVALID_SESSION_COOKIE = "invalid_session_cookie",
@@ -26,6 +26,8 @@ export type AuthenticateWithSessionCookieFailedResponse = {
26
26
  };
27
27
  export type AuthenticateWithSessionCookieSuccessResponse = {
28
28
  authenticated: true;
29
+ accessToken: string;
30
+ authenticationMethod: AuthenticationResponse['authenticationMethod'];
29
31
  sessionId: string;
30
32
  organizationId?: string;
31
33
  role?: string;
@@ -35,5 +37,4 @@ export type AuthenticateWithSessionCookieSuccessResponse = {
35
37
  featureFlags?: string[];
36
38
  user: User;
37
39
  impersonator?: Impersonator;
38
- accessToken: string;
39
40
  };
@@ -72,6 +72,7 @@ class CookieSession {
72
72
  entitlements,
73
73
  featureFlags,
74
74
  user: session.user,
75
+ authenticationMethod: session.authenticationMethod,
75
76
  impersonator: session.impersonator,
76
77
  accessToken: session.accessToken,
77
78
  };
@@ -122,6 +123,7 @@ class CookieSession {
122
123
  authenticated: true,
123
124
  sealedSession: authenticationResponse.sealedSession,
124
125
  session: authenticationResponse,
126
+ authenticationMethod: authenticationResponse.authenticationMethod,
125
127
  sessionId,
126
128
  organizationId,
127
129
  role,
@@ -30,11 +30,11 @@ const oauth_exception_1 = require("../common/exceptions/oauth.exception");
30
30
  const fetch_and_deserialize_1 = require("../common/utils/fetch-and-deserialize");
31
31
  const pagination_1 = require("../common/utils/pagination");
32
32
  const serializers_1 = require("../mfa/serializers");
33
- const feature_flag_serializer_1 = require("../feature-flags/serializers/feature-flag.serializer");
33
+ const serializers_2 = require("../feature-flags/serializers");
34
34
  const authenticate_with_session_cookie_interface_1 = require("./interfaces/authenticate-with-session-cookie.interface");
35
35
  const refresh_and_seal_session_data_interface_1 = require("./interfaces/refresh-and-seal-session-data.interface");
36
36
  const revoke_session_options_interface_1 = require("./interfaces/revoke-session-options.interface");
37
- const serializers_2 = require("./serializers");
37
+ const serializers_3 = require("./serializers");
38
38
  const authenticate_with_email_verification_serializer_1 = require("./serializers/authenticate-with-email-verification.serializer");
39
39
  const authenticate_with_organization_selection_options_serializer_1 = require("./serializers/authenticate-with-organization-selection-options.serializer");
40
40
  const create_organization_membership_options_serializer_1 = require("./serializers/create-organization-membership-options.serializer");
@@ -89,32 +89,32 @@ class UserManagement {
89
89
  getUser(userId) {
90
90
  return __awaiter(this, void 0, void 0, function* () {
91
91
  const { data } = yield this.workos.get(`/user_management/users/${userId}`);
92
- return (0, serializers_2.deserializeUser)(data);
92
+ return (0, serializers_3.deserializeUser)(data);
93
93
  });
94
94
  }
95
95
  getUserByExternalId(externalId) {
96
96
  return __awaiter(this, void 0, void 0, function* () {
97
97
  const { data } = yield this.workos.get(`/user_management/users/external_id/${externalId}`);
98
- return (0, serializers_2.deserializeUser)(data);
98
+ return (0, serializers_3.deserializeUser)(data);
99
99
  });
100
100
  }
101
101
  listUsers(options) {
102
102
  return __awaiter(this, void 0, void 0, function* () {
103
- return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/user_management/users', serializers_2.deserializeUser, options ? (0, list_users_options_serializer_1.serializeListUsersOptions)(options) : undefined), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/user_management/users', serializers_2.deserializeUser, params), options ? (0, list_users_options_serializer_1.serializeListUsersOptions)(options) : undefined);
103
+ return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/user_management/users', serializers_3.deserializeUser, options ? (0, list_users_options_serializer_1.serializeListUsersOptions)(options) : undefined), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/user_management/users', serializers_3.deserializeUser, params), options ? (0, list_users_options_serializer_1.serializeListUsersOptions)(options) : undefined);
104
104
  });
105
105
  }
106
106
  createUser(payload) {
107
107
  return __awaiter(this, void 0, void 0, function* () {
108
- const { data } = yield this.workos.post('/user_management/users', (0, serializers_2.serializeCreateUserOptions)(payload));
109
- return (0, serializers_2.deserializeUser)(data);
108
+ const { data } = yield this.workos.post('/user_management/users', (0, serializers_3.serializeCreateUserOptions)(payload));
109
+ return (0, serializers_3.deserializeUser)(data);
110
110
  });
111
111
  }
112
112
  authenticateWithMagicAuth(payload) {
113
113
  return __awaiter(this, void 0, void 0, function* () {
114
114
  const { session } = payload, remainingPayload = __rest(payload, ["session"]);
115
- const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_2.serializeAuthenticateWithMagicAuthOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
115
+ const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_3.serializeAuthenticateWithMagicAuthOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
116
116
  return this.prepareAuthenticationResponse({
117
- authenticationResponse: (0, serializers_2.deserializeAuthenticationResponse)(data),
117
+ authenticationResponse: (0, serializers_3.deserializeAuthenticationResponse)(data),
118
118
  session,
119
119
  });
120
120
  });
@@ -122,9 +122,9 @@ class UserManagement {
122
122
  authenticateWithPassword(payload) {
123
123
  return __awaiter(this, void 0, void 0, function* () {
124
124
  const { session } = payload, remainingPayload = __rest(payload, ["session"]);
125
- const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_2.serializeAuthenticateWithPasswordOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
125
+ const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_3.serializeAuthenticateWithPasswordOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
126
126
  return this.prepareAuthenticationResponse({
127
- authenticationResponse: (0, serializers_2.deserializeAuthenticationResponse)(data),
127
+ authenticationResponse: (0, serializers_3.deserializeAuthenticationResponse)(data),
128
128
  session,
129
129
  });
130
130
  });
@@ -132,9 +132,9 @@ class UserManagement {
132
132
  authenticateWithCode(payload) {
133
133
  return __awaiter(this, void 0, void 0, function* () {
134
134
  const { session } = payload, remainingPayload = __rest(payload, ["session"]);
135
- const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_2.serializeAuthenticateWithCodeOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
135
+ const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_3.serializeAuthenticateWithCodeOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
136
136
  return this.prepareAuthenticationResponse({
137
- authenticationResponse: (0, serializers_2.deserializeAuthenticationResponse)(data),
137
+ authenticationResponse: (0, serializers_3.deserializeAuthenticationResponse)(data),
138
138
  session,
139
139
  });
140
140
  });
@@ -142,9 +142,9 @@ class UserManagement {
142
142
  authenticateWithCodeAndVerifier(payload) {
143
143
  return __awaiter(this, void 0, void 0, function* () {
144
144
  const { session } = payload, remainingPayload = __rest(payload, ["session"]);
145
- const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_2.serializeAuthenticateWithCodeAndVerifierOptions)(remainingPayload));
145
+ const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_3.serializeAuthenticateWithCodeAndVerifierOptions)(remainingPayload));
146
146
  return this.prepareAuthenticationResponse({
147
- authenticationResponse: (0, serializers_2.deserializeAuthenticationResponse)(data),
147
+ authenticationResponse: (0, serializers_3.deserializeAuthenticationResponse)(data),
148
148
  session,
149
149
  });
150
150
  });
@@ -152,9 +152,9 @@ class UserManagement {
152
152
  authenticateWithRefreshToken(payload) {
153
153
  return __awaiter(this, void 0, void 0, function* () {
154
154
  const { session } = payload, remainingPayload = __rest(payload, ["session"]);
155
- const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_2.serializeAuthenticateWithRefreshTokenOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
155
+ const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_3.serializeAuthenticateWithRefreshTokenOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
156
156
  return this.prepareAuthenticationResponse({
157
- authenticationResponse: (0, serializers_2.deserializeAuthenticationResponse)(data),
157
+ authenticationResponse: (0, serializers_3.deserializeAuthenticationResponse)(data),
158
158
  session,
159
159
  });
160
160
  });
@@ -162,9 +162,9 @@ class UserManagement {
162
162
  authenticateWithTotp(payload) {
163
163
  return __awaiter(this, void 0, void 0, function* () {
164
164
  const { session } = payload, remainingPayload = __rest(payload, ["session"]);
165
- const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_2.serializeAuthenticateWithTotpOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
165
+ const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_3.serializeAuthenticateWithTotpOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
166
166
  return this.prepareAuthenticationResponse({
167
- authenticationResponse: (0, serializers_2.deserializeAuthenticationResponse)(data),
167
+ authenticationResponse: (0, serializers_3.deserializeAuthenticationResponse)(data),
168
168
  session,
169
169
  });
170
170
  });
@@ -174,7 +174,7 @@ class UserManagement {
174
174
  const { session } = payload, remainingPayload = __rest(payload, ["session"]);
175
175
  const { data } = yield this.workos.post('/user_management/authenticate', (0, authenticate_with_email_verification_serializer_1.serializeAuthenticateWithEmailVerificationOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
176
176
  return this.prepareAuthenticationResponse({
177
- authenticationResponse: (0, serializers_2.deserializeAuthenticationResponse)(data),
177
+ authenticationResponse: (0, serializers_3.deserializeAuthenticationResponse)(data),
178
178
  session,
179
179
  });
180
180
  });
@@ -184,7 +184,7 @@ class UserManagement {
184
184
  const { session } = payload, remainingPayload = __rest(payload, ["session"]);
185
185
  const { data } = yield this.workos.post('/user_management/authenticate', (0, authenticate_with_organization_selection_options_serializer_1.serializeAuthenticateWithOrganizationSelectionOptions)(Object.assign(Object.assign({}, remainingPayload), { clientSecret: this.workos.key })));
186
186
  return this.prepareAuthenticationResponse({
187
- authenticationResponse: (0, serializers_2.deserializeAuthenticationResponse)(data),
187
+ authenticationResponse: (0, serializers_3.deserializeAuthenticationResponse)(data),
188
188
  session,
189
189
  });
190
190
  });
@@ -230,6 +230,7 @@ class UserManagement {
230
230
  entitlements,
231
231
  featureFlags,
232
232
  accessToken: session.accessToken,
233
+ authenticationMethod: session.authenticationMethod,
233
234
  };
234
235
  });
235
236
  }
@@ -328,6 +329,7 @@ class UserManagement {
328
329
  user: authenticationResponse.user,
329
330
  accessToken: authenticationResponse.accessToken,
330
331
  refreshToken: authenticationResponse.refreshToken,
332
+ authenticationMethod: authenticationResponse.authenticationMethod,
331
333
  impersonator: authenticationResponse.impersonator,
332
334
  };
333
335
  return this.ironSessionProvider.sealData(sessionData, {
@@ -351,25 +353,25 @@ class UserManagement {
351
353
  getEmailVerification(emailVerificationId) {
352
354
  return __awaiter(this, void 0, void 0, function* () {
353
355
  const { data } = yield this.workos.get(`/user_management/email_verification/${emailVerificationId}`);
354
- return (0, serializers_2.deserializeEmailVerification)(data);
356
+ return (0, serializers_3.deserializeEmailVerification)(data);
355
357
  });
356
358
  }
357
359
  sendVerificationEmail({ userId, }) {
358
360
  return __awaiter(this, void 0, void 0, function* () {
359
361
  const { data } = yield this.workos.post(`/user_management/users/${userId}/email_verification/send`, {});
360
- return { user: (0, serializers_2.deserializeUser)(data.user) };
362
+ return { user: (0, serializers_3.deserializeUser)(data.user) };
361
363
  });
362
364
  }
363
365
  getMagicAuth(magicAuthId) {
364
366
  return __awaiter(this, void 0, void 0, function* () {
365
367
  const { data } = yield this.workos.get(`/user_management/magic_auth/${magicAuthId}`);
366
- return (0, serializers_2.deserializeMagicAuth)(data);
368
+ return (0, serializers_3.deserializeMagicAuth)(data);
367
369
  });
368
370
  }
369
371
  createMagicAuth(options) {
370
372
  return __awaiter(this, void 0, void 0, function* () {
371
- const { data } = yield this.workos.post('/user_management/magic_auth', (0, serializers_2.serializeCreateMagicAuthOptions)(Object.assign({}, options)));
372
- return (0, serializers_2.deserializeMagicAuth)(data);
373
+ const { data } = yield this.workos.post('/user_management/magic_auth', (0, serializers_3.serializeCreateMagicAuthOptions)(Object.assign({}, options)));
374
+ return (0, serializers_3.deserializeMagicAuth)(data);
373
375
  });
374
376
  }
375
377
  /**
@@ -378,7 +380,7 @@ class UserManagement {
378
380
  */
379
381
  sendMagicAuthCode(options) {
380
382
  return __awaiter(this, void 0, void 0, function* () {
381
- yield this.workos.post('/user_management/magic_auth/send', (0, serializers_2.serializeSendMagicAuthCodeOptions)(options));
383
+ yield this.workos.post('/user_management/magic_auth/send', (0, serializers_3.serializeSendMagicAuthCodeOptions)(options));
382
384
  });
383
385
  }
384
386
  verifyEmail({ code, userId, }) {
@@ -386,19 +388,19 @@ class UserManagement {
386
388
  const { data } = yield this.workos.post(`/user_management/users/${userId}/email_verification/confirm`, {
387
389
  code,
388
390
  });
389
- return { user: (0, serializers_2.deserializeUser)(data.user) };
391
+ return { user: (0, serializers_3.deserializeUser)(data.user) };
390
392
  });
391
393
  }
392
394
  getPasswordReset(passwordResetId) {
393
395
  return __awaiter(this, void 0, void 0, function* () {
394
396
  const { data } = yield this.workos.get(`/user_management/password_reset/${passwordResetId}`);
395
- return (0, serializers_2.deserializePasswordReset)(data);
397
+ return (0, serializers_3.deserializePasswordReset)(data);
396
398
  });
397
399
  }
398
400
  createPasswordReset(options) {
399
401
  return __awaiter(this, void 0, void 0, function* () {
400
- const { data } = yield this.workos.post('/user_management/password_reset', (0, serializers_2.serializeCreatePasswordResetOptions)(Object.assign({}, options)));
401
- return (0, serializers_2.deserializePasswordReset)(data);
402
+ const { data } = yield this.workos.post('/user_management/password_reset', (0, serializers_3.serializeCreatePasswordResetOptions)(Object.assign({}, options)));
403
+ return (0, serializers_3.deserializePasswordReset)(data);
402
404
  });
403
405
  }
404
406
  /**
@@ -406,26 +408,26 @@ class UserManagement {
406
408
  */
407
409
  sendPasswordResetEmail(payload) {
408
410
  return __awaiter(this, void 0, void 0, function* () {
409
- yield this.workos.post('/user_management/password_reset/send', (0, serializers_2.serializeSendPasswordResetEmailOptions)(payload));
411
+ yield this.workos.post('/user_management/password_reset/send', (0, serializers_3.serializeSendPasswordResetEmailOptions)(payload));
410
412
  });
411
413
  }
412
414
  resetPassword(payload) {
413
415
  return __awaiter(this, void 0, void 0, function* () {
414
- const { data } = yield this.workos.post('/user_management/password_reset/confirm', (0, serializers_2.serializeResetPasswordOptions)(payload));
415
- return { user: (0, serializers_2.deserializeUser)(data.user) };
416
+ const { data } = yield this.workos.post('/user_management/password_reset/confirm', (0, serializers_3.serializeResetPasswordOptions)(payload));
417
+ return { user: (0, serializers_3.deserializeUser)(data.user) };
416
418
  });
417
419
  }
418
420
  updateUser(payload) {
419
421
  return __awaiter(this, void 0, void 0, function* () {
420
- const { data } = yield this.workos.put(`/user_management/users/${payload.userId}`, (0, serializers_2.serializeUpdateUserOptions)(payload));
421
- return (0, serializers_2.deserializeUser)(data);
422
+ const { data } = yield this.workos.put(`/user_management/users/${payload.userId}`, (0, serializers_3.serializeUpdateUserOptions)(payload));
423
+ return (0, serializers_3.deserializeUser)(data);
422
424
  });
423
425
  }
424
426
  enrollAuthFactor(payload) {
425
427
  return __awaiter(this, void 0, void 0, function* () {
426
- const { data } = yield this.workos.post(`/user_management/users/${payload.userId}/auth_factors`, (0, serializers_2.serializeEnrollAuthFactorOptions)(payload));
428
+ const { data } = yield this.workos.post(`/user_management/users/${payload.userId}/auth_factors`, (0, serializers_3.serializeEnrollAuthFactorOptions)(payload));
427
429
  return {
428
- authenticationFactor: (0, serializers_2.deserializeFactorWithSecrets)(data.authentication_factor),
430
+ authenticationFactor: (0, serializers_3.deserializeFactorWithSecrets)(data.authentication_factor),
429
431
  authenticationChallenge: (0, serializers_1.deserializeChallenge)(data.authentication_challenge),
430
432
  };
431
433
  });
@@ -439,12 +441,12 @@ class UserManagement {
439
441
  listUserFeatureFlags(options) {
440
442
  return __awaiter(this, void 0, void 0, function* () {
441
443
  const { userId } = options, paginationOptions = __rest(options, ["userId"]);
442
- return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${userId}/feature-flags`, feature_flag_serializer_1.deserializeFeatureFlag, paginationOptions), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${userId}/feature-flags`, feature_flag_serializer_1.deserializeFeatureFlag, params), paginationOptions);
444
+ return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${userId}/feature-flags`, serializers_2.deserializeFeatureFlag, paginationOptions), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${userId}/feature-flags`, serializers_2.deserializeFeatureFlag, params), paginationOptions);
443
445
  });
444
446
  }
445
447
  listSessions(userId, options) {
446
448
  return __awaiter(this, void 0, void 0, function* () {
447
- return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${userId}/sessions`, serializers_2.deserializeSession, options ? (0, serializers_2.serializeListSessionsOptions)(options) : undefined), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${userId}/sessions`, serializers_2.deserializeSession, params), options ? (0, serializers_2.serializeListSessionsOptions)(options) : undefined);
449
+ return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${userId}/sessions`, serializers_3.deserializeSession, options ? (0, serializers_3.serializeListSessionsOptions)(options) : undefined), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${userId}/sessions`, serializers_3.deserializeSession, params), options ? (0, serializers_3.serializeListSessionsOptions)(options) : undefined);
448
450
  });
449
451
  }
450
452
  deleteUser(userId) {
@@ -1364,6 +1364,9 @@ describe('UserManagement', () => {
1364
1364
  name: 'Advanced Dashboard',
1365
1365
  slug: 'advanced-dashboard',
1366
1366
  description: 'Enable advanced dashboard features',
1367
+ tags: ['ui'],
1368
+ enabled: true,
1369
+ defaultValue: false,
1367
1370
  createdAt: '2024-01-01T00:00:00.000Z',
1368
1371
  updatedAt: '2024-01-01T00:00:00.000Z',
1369
1372
  },
@@ -1372,7 +1375,10 @@ describe('UserManagement', () => {
1372
1375
  id: 'flag_01EHQMYV6MBK39QC5PZXHY59C6',
1373
1376
  name: 'Beta Features',
1374
1377
  slug: 'beta-features',
1375
- description: null,
1378
+ description: '',
1379
+ tags: [],
1380
+ enabled: false,
1381
+ defaultValue: false,
1376
1382
  createdAt: '2024-01-01T00:00:00.000Z',
1377
1383
  updatedAt: '2024-01-01T00:00:00.000Z',
1378
1384
  },
@@ -1382,6 +1388,9 @@ describe('UserManagement', () => {
1382
1388
  name: 'Premium Support',
1383
1389
  slug: 'premium-support',
1384
1390
  description: 'Access to premium support features',
1391
+ tags: ['dev-support'],
1392
+ enabled: false,
1393
+ defaultValue: true,
1385
1394
  createdAt: '2024-01-01T00:00:00.000Z',
1386
1395
  updatedAt: '2024-01-01T00:00:00.000Z',
1387
1396
  },
@@ -69,6 +69,35 @@ describe.skip('Vault Live Test', () => {
69
69
  metadata: expectedMetadata,
70
70
  });
71
71
  }));
72
+ it('Reads objects by name', () => __awaiter(void 0, void 0, void 0, function* () {
73
+ const objectName = `${objectPrefix}-nazca`;
74
+ const newObject = yield workos.vault.createObject({
75
+ name: objectName,
76
+ value: 'Suri 10-15 micron',
77
+ context: { fiber: 'Alpalca' },
78
+ });
79
+ const expectedMetadata = {
80
+ id: expect.any(String),
81
+ context: {
82
+ fiber: 'Alpalca',
83
+ },
84
+ environmentId: expect.any(String),
85
+ keyId: expect.any(String),
86
+ updatedAt: expect.any(Date),
87
+ updatedBy: {
88
+ id: expect.any(String),
89
+ name: expect.any(String),
90
+ },
91
+ versionId: expect.any(String),
92
+ };
93
+ const objectValue = yield workos.vault.readObjectByName(objectName);
94
+ expect(objectValue).toStrictEqual({
95
+ id: newObject.id,
96
+ name: objectName,
97
+ value: 'Suri 10-15 micron',
98
+ metadata: expectedMetadata,
99
+ });
100
+ }));
72
101
  it('Fails to create objects with the same name', () => __awaiter(void 0, void 0, void 0, function* () {
73
102
  const objectName = `${objectPrefix}-lima`;
74
103
  yield workos.vault.createObject({
@@ -153,7 +182,7 @@ describe.skip('Vault Live Test', () => {
153
182
  const newObject = yield workos.vault.createObject({
154
183
  name: objectName,
155
184
  value: 'Qiviut 11-13 micron',
156
- context: { fiber: 'Musk Ox' },
185
+ context: { fiber: 'MuskOx' },
157
186
  });
158
187
  const objectDescription = yield workos.vault.describeObject({
159
188
  id: newObject.id,
@@ -161,7 +190,7 @@ describe.skip('Vault Live Test', () => {
161
190
  const expectedMetadata = {
162
191
  id: expect.any(String),
163
192
  context: {
164
- fiber: 'Musk Ox',
193
+ fiber: 'MuskOx',
165
194
  },
166
195
  environmentId: expect.any(String),
167
196
  keyId: expect.any(String),
@@ -188,7 +217,7 @@ describe.skip('Vault Live Test', () => {
188
217
  yield workos.vault.createObject({
189
218
  name: objectName,
190
219
  value: 'Qiviut 11-13 micron',
191
- context: { fiber: 'Musk Ox' },
220
+ context: { fiber: 'MuskOx' },
192
221
  });
193
222
  objectNames.push(objectName);
194
223
  }
@@ -254,7 +283,7 @@ describe.skip('Vault Live Test', () => {
254
283
  const keyContext = { everything: 'everywhere' };
255
284
  const aad = 'seq1';
256
285
  const encrypted = yield workos.vault.encrypt(data, keyContext, aad);
257
- yield expect(() => workos.vault.decrypt(encrypted)).rejects.toThrow('unable to authenticate data');
286
+ yield expect(() => workos.vault.decrypt(encrypted)).rejects.toThrow('The operation failed for an operation-specific reason');
258
287
  }));
259
288
  });
260
289
  });
@@ -11,6 +11,7 @@ export declare class Vault {
11
11
  listObjects(options?: PaginationOptions | undefined): Promise<List<ObjectDigest>>;
12
12
  listObjectVersions(options: ReadObjectOptions): Promise<ObjectVersion[]>;
13
13
  readObject(options: ReadObjectOptions): Promise<VaultObject>;
14
+ readObjectByName(name: string): Promise<VaultObject>;
14
15
  describeObject(options: ReadObjectOptions): Promise<VaultObject>;
15
16
  updateObject(options: UpdateObjectOptions): Promise<VaultObject>;
16
17
  deleteObject(options: DeleteObjectOptions): Promise<void>;
@@ -95,6 +95,12 @@ class Vault {
95
95
  return (0, vault_object_serializer_1.deserializeObject)(data);
96
96
  });
97
97
  }
98
+ readObjectByName(name) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ const { data } = yield this.workos.get(`/vault/v1/kv/name/${encodeURIComponent(name)}`);
101
+ return (0, vault_object_serializer_1.deserializeObject)(data);
102
+ });
103
+ }
98
104
  describeObject(options) {
99
105
  return __awaiter(this, void 0, void 0, function* () {
100
106
  const { data } = yield this.workos.get(`/vault/v1/kv/${encodeURIComponent(options.id)}/metadata`);
@@ -121,6 +121,31 @@ describe('Vault', () => {
121
121
  });
122
122
  }));
123
123
  });
124
+ describe('readObjectByName', () => {
125
+ it('reads an object by name', () => __awaiter(void 0, void 0, void 0, function* () {
126
+ const objectName = 'lima';
127
+ const objectId = 'secret1';
128
+ (0, test_utils_1.fetchOnce)({
129
+ id: objectId,
130
+ metadata: {
131
+ id: objectId,
132
+ context: { emporer: 'groove' },
133
+ environment_id: 'environment_d',
134
+ key_id: 'key1',
135
+ updated_at: '2025-03-11T02:18:54.250931Z',
136
+ updated_by: { id: 'key_xxx', name: 'Local Test Key' },
137
+ version_id: 'version1',
138
+ },
139
+ name: objectName,
140
+ value: 'Pull the lever Gronk',
141
+ });
142
+ const resource = yield workos.vault.readObjectByName(objectName);
143
+ expect((0, test_utils_1.fetchURL)()).toContain(`/vault/v1/kv/name/${objectName}`);
144
+ expect((0, test_utils_1.fetchMethod)()).toBe('GET');
145
+ expect(resource.name).toBe(objectName);
146
+ expect(resource.id).toBe(objectId);
147
+ }));
148
+ });
124
149
  describe('listSecrets', () => {
125
150
  it('gets a paginated list of secrets', () => __awaiter(void 0, void 0, void 0, function* () {
126
151
  (0, test_utils_1.fetchOnce)({
package/lib/workos.d.ts CHANGED
@@ -13,6 +13,7 @@ import { Mfa } from './mfa/mfa';
13
13
  import { AuditLogs } from './audit-logs/audit-logs';
14
14
  import { UserManagement } from './user-management/user-management';
15
15
  import { FGA } from './fga/fga';
16
+ import { FeatureFlags } from './feature-flags/feature-flags';
16
17
  import { HttpClient } from './common/net/http-client';
17
18
  import { IronSessionProvider } from './common/iron-session/iron-session-provider';
18
19
  import { Widgets } from './widgets/widgets';
@@ -29,19 +30,20 @@ export declare class WorkOS {
29
30
  readonly apiKeys: ApiKeys;
30
31
  readonly auditLogs: AuditLogs;
31
32
  readonly directorySync: DirectorySync;
33
+ readonly events: Events;
34
+ readonly featureFlags: FeatureFlags;
35
+ readonly fga: FGA;
36
+ readonly mfa: Mfa;
32
37
  readonly organizations: Organizations;
33
38
  readonly organizationDomains: OrganizationDomains;
34
39
  readonly passwordless: Passwordless;
35
40
  readonly pipes: Pipes;
36
41
  readonly portal: Portal;
37
42
  readonly sso: SSO;
38
- readonly webhooks: Webhooks;
39
- readonly mfa: Mfa;
40
- readonly events: Events;
41
43
  readonly userManagement: UserManagement;
42
- readonly fga: FGA;
43
- readonly widgets: Widgets;
44
44
  readonly vault: Vault;
45
+ readonly webhooks: Webhooks;
46
+ readonly widgets: Widgets;
45
47
  constructor(key?: string | undefined, options?: WorkOSOptions);
46
48
  createWebhookClient(): Webhooks;
47
49
  createActionsClient(): Actions;
package/lib/workos.js CHANGED
@@ -26,6 +26,7 @@ const audit_logs_1 = require("./audit-logs/audit-logs");
26
26
  const user_management_1 = require("./user-management/user-management");
27
27
  const fga_1 = require("./fga/fga");
28
28
  const bad_request_exception_1 = require("./common/exceptions/bad-request.exception");
29
+ const feature_flags_1 = require("./feature-flags/feature-flags");
29
30
  const http_client_1 = require("./common/net/http-client");
30
31
  const subtle_crypto_provider_1 = require("./common/crypto/subtle-crypto-provider");
31
32
  const fetch_client_1 = require("./common/net/fetch-client");
@@ -34,7 +35,7 @@ const actions_1 = require("./actions/actions");
34
35
  const vault_1 = require("./vault/vault");
35
36
  const conflict_exception_1 = require("./common/exceptions/conflict.exception");
36
37
  const parse_error_1 = require("./common/exceptions/parse-error");
37
- const VERSION = '7.77.0';
38
+ const VERSION = '7.79.2';
38
39
  const DEFAULT_HOSTNAME = 'api.workos.com';
39
40
  const HEADER_AUTHORIZATION = 'Authorization';
40
41
  const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
@@ -46,17 +47,18 @@ class WorkOS {
46
47
  this.apiKeys = new api_keys_1.ApiKeys(this);
47
48
  this.auditLogs = new audit_logs_1.AuditLogs(this);
48
49
  this.directorySync = new directory_sync_1.DirectorySync(this);
50
+ this.events = new events_1.Events(this);
51
+ this.featureFlags = new feature_flags_1.FeatureFlags(this);
52
+ this.fga = new fga_1.FGA(this);
53
+ this.mfa = new mfa_1.Mfa(this);
49
54
  this.organizations = new organizations_1.Organizations(this);
50
55
  this.organizationDomains = new organization_domains_1.OrganizationDomains(this);
51
56
  this.passwordless = new passwordless_1.Passwordless(this);
52
57
  this.pipes = new pipes_1.Pipes(this);
53
58
  this.portal = new portal_1.Portal(this);
54
59
  this.sso = new sso_1.SSO(this);
55
- this.mfa = new mfa_1.Mfa(this);
56
- this.events = new events_1.Events(this);
57
- this.fga = new fga_1.FGA(this);
58
- this.widgets = new widgets_1.Widgets(this);
59
60
  this.vault = new vault_1.Vault(this);
61
+ this.widgets = new widgets_1.Widgets(this);
60
62
  if (!key) {
61
63
  // process might be undefined in some environments
62
64
  this.key =
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
- "version": "7.77.0",
2
+ "version": "7.79.2",
3
3
  "name": "@workos-inc/node",
4
4
  "author": "WorkOS",
5
5
  "description": "A Node wrapper for the WorkOS API",
6
- "homepage": "https://github.com/workos-inc/workos-node",
6
+ "homepage": "https://github.com/workos/workos-node",
7
7
  "license": "MIT",
8
8
  "keywords": [
9
9
  "workos"
@@ -17,10 +17,10 @@
17
17
  ],
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "git+https://github.com/workos-inc/workos-node.git"
20
+ "url": "git+https://github.com/workos/workos-node.git"
21
21
  },
22
22
  "bugs": {
23
- "url": "https://github.com/workos-inc/workos-node/issues"
23
+ "url": "https://github.com/workos/workos-node/issues"
24
24
  },
25
25
  "scripts": {
26
26
  "clean": "rm -rf lib",