@workos-inc/node 7.62.1 → 7.64.0

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.
@@ -6,4 +6,5 @@ export declare class OrganizationDomains {
6
6
  get(id: string): Promise<OrganizationDomain>;
7
7
  verify(id: string): Promise<OrganizationDomain>;
8
8
  create(payload: CreateOrganizationDomainOptions): Promise<OrganizationDomain>;
9
+ delete(id: string): Promise<void>;
9
10
  }
@@ -34,5 +34,10 @@ class OrganizationDomains {
34
34
  return (0, organization_domain_serializer_1.deserializeOrganizationDomain)(data);
35
35
  });
36
36
  }
37
+ delete(id) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ yield this.workos.delete(`/organization_domains/${id}`);
40
+ });
41
+ }
37
42
  }
38
43
  exports.OrganizationDomains = OrganizationDomains;
@@ -78,4 +78,11 @@ describe('OrganizationDomains', () => {
78
78
  expect(subject.verificationStrategy).toEqual('dns');
79
79
  }));
80
80
  });
81
+ describe('delete', () => {
82
+ it('deletes an Organization Domain', () => __awaiter(void 0, void 0, void 0, function* () {
83
+ (0, test_utils_1.fetchOnce)();
84
+ yield workos.organizationDomains.delete('org_domain_01HCZRAP3TPQ0X0DKJHR32TATG');
85
+ expect((0, test_utils_1.fetchURL)()).toContain('/organization_domains/org_domain_01HCZRAP3TPQ0X0DKJHR32TATG');
86
+ }));
87
+ });
81
88
  });
@@ -0,0 +1,33 @@
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
+ "created_at": "2024-01-01T00:00:00.000Z",
11
+ "updated_at": "2024-01-01T00:00:00.000Z"
12
+ },
13
+ {
14
+ "object": "feature_flag",
15
+ "id": "flag_01EHQMYV6MBK39QC5PZXHY59C6",
16
+ "name": "Beta Features",
17
+ "slug": "beta-features",
18
+ "description": null,
19
+ "created_at": "2024-01-01T00:00:00.000Z",
20
+ "updated_at": "2024-01-01T00:00:00.000Z"
21
+ },
22
+ {
23
+ "object": "feature_flag",
24
+ "id": "flag_01EHQMYV6MBK39QC5PZXHY59C7",
25
+ "name": "Premium Support",
26
+ "slug": "premium-support",
27
+ "description": "Access to premium support features",
28
+ "created_at": "2024-01-01T00:00:00.000Z",
29
+ "updated_at": "2024-01-01T00:00:00.000Z"
30
+ }
31
+ ],
32
+ "list_metadata": {}
33
+ }
@@ -0,0 +1,18 @@
1
+ export interface FeatureFlag {
2
+ object: 'feature_flag';
3
+ id: string;
4
+ name: string;
5
+ slug: string;
6
+ description?: string;
7
+ createdAt: string;
8
+ updatedAt: string;
9
+ }
10
+ export interface FeatureFlagResponse {
11
+ object: 'feature_flag';
12
+ id: string;
13
+ name: string;
14
+ slug: string;
15
+ description?: string;
16
+ created_at: string;
17
+ updated_at: string;
18
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,7 @@
1
1
  export * from './create-organization-options.interface';
2
2
  export * from './domain-data.interface';
3
+ export * from './feature-flag.interface';
4
+ export * from './list-organization-feature-flags-options.interface';
3
5
  export * from './list-organizations-options.interface';
4
6
  export * from './organization.interface';
5
7
  export * from './update-organization-options.interface';
@@ -16,6 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./create-organization-options.interface"), exports);
18
18
  __exportStar(require("./domain-data.interface"), exports);
19
+ __exportStar(require("./feature-flag.interface"), exports);
20
+ __exportStar(require("./list-organization-feature-flags-options.interface"), exports);
19
21
  __exportStar(require("./list-organizations-options.interface"), exports);
20
22
  __exportStar(require("./organization.interface"), exports);
21
23
  __exportStar(require("./update-organization-options.interface"), exports);
@@ -0,0 +1,3 @@
1
+ export interface ListOrganizationFeatureFlagsOptions {
2
+ organizationId: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,11 @@
1
1
  import { AutoPaginatable } from '../common/utils/pagination';
2
2
  import { WorkOS } from '../workos';
3
3
  import { CreateOrganizationOptions, CreateOrganizationRequestOptions, ListOrganizationsOptions, Organization, UpdateOrganizationOptions } from './interfaces';
4
+ import { FeatureFlag } from './interfaces/feature-flag.interface';
5
+ import { List } from '../common/interfaces';
4
6
  import { RoleList } from '../roles/interfaces';
5
7
  import { ListOrganizationRolesOptions } from './interfaces/list-organization-roles-options.interface';
8
+ import { ListOrganizationFeatureFlagsOptions } from './interfaces/list-organization-feature-flags-options.interface';
6
9
  export declare class Organizations {
7
10
  private readonly workos;
8
11
  constructor(workos: WorkOS);
@@ -13,4 +16,5 @@ export declare class Organizations {
13
16
  getOrganizationByExternalId(externalId: string): Promise<Organization>;
14
17
  updateOrganization(options: UpdateOrganizationOptions): Promise<Organization>;
15
18
  listOrganizationRoles(options: ListOrganizationRolesOptions): Promise<RoleList>;
19
+ listOrganizationFeatureFlags(options: ListOrganizationFeatureFlagsOptions): Promise<List<FeatureFlag>>;
16
20
  }
@@ -24,7 +24,9 @@ exports.Organizations = void 0;
24
24
  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
+ const serializers_2 = require("../common/serializers");
27
28
  const role_serializer_1 = require("../roles/serializers/role.serializer");
29
+ const feature_flag_serializer_1 = require("./serializers/feature-flag.serializer");
28
30
  class Organizations {
29
31
  constructor(workos) {
30
32
  this.workos = workos;
@@ -74,5 +76,12 @@ class Organizations {
74
76
  };
75
77
  });
76
78
  }
79
+ listOrganizationFeatureFlags(options) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const { organizationId } = options;
82
+ const { data } = yield this.workos.get(`/organizations/${organizationId}/feature_flags`);
83
+ return (0, serializers_2.deserializeList)(data, feature_flag_serializer_1.deserializeFeatureFlag);
84
+ });
85
+ }
77
86
  }
78
87
  exports.Organizations = Organizations;
@@ -21,6 +21,7 @@ const create_organization_json_1 = __importDefault(require("./fixtures/create-or
21
21
  const get_organization_json_1 = __importDefault(require("./fixtures/get-organization.json"));
22
22
  const list_organizations_json_1 = __importDefault(require("./fixtures/list-organizations.json"));
23
23
  const list_organization_roles_json_1 = __importDefault(require("./fixtures/list-organization-roles.json"));
24
+ const list_organization_feature_flags_json_1 = __importDefault(require("./fixtures/list-organization-feature-flags.json"));
24
25
  const update_organization_json_1 = __importDefault(require("./fixtures/update-organization.json"));
25
26
  const set_stripe_customer_id_json_1 = __importDefault(require("./fixtures/set-stripe-customer-id.json"));
26
27
  const set_stripe_customer_id_disabled_json_1 = __importDefault(require("./fixtures/set-stripe-customer-id-disabled.json"));
@@ -355,4 +356,45 @@ describe('Organizations', () => {
355
356
  ]);
356
357
  }));
357
358
  });
359
+ describe('listOrganizationFeatureFlags', () => {
360
+ it('returns feature flags for the organization', () => __awaiter(void 0, void 0, void 0, function* () {
361
+ (0, test_utils_1.fetchOnce)(list_organization_feature_flags_json_1.default);
362
+ const { data, object, listMetadata } = yield workos.organizations.listOrganizationFeatureFlags({
363
+ organizationId: 'org_01EHT88Z8J8795GZNQ4ZP1J81T',
364
+ });
365
+ expect((0, test_utils_1.fetchURL)()).toContain('/organizations/org_01EHT88Z8J8795GZNQ4ZP1J81T/feature_flags');
366
+ expect(object).toEqual('list');
367
+ expect(listMetadata).toEqual({});
368
+ expect(data).toHaveLength(3);
369
+ expect(data).toEqual([
370
+ {
371
+ object: 'feature_flag',
372
+ id: 'flag_01EHQMYV6MBK39QC5PZXHY59C5',
373
+ name: 'Advanced Dashboard',
374
+ slug: 'advanced-dashboard',
375
+ description: 'Enable advanced dashboard features',
376
+ createdAt: '2024-01-01T00:00:00.000Z',
377
+ updatedAt: '2024-01-01T00:00:00.000Z',
378
+ },
379
+ {
380
+ object: 'feature_flag',
381
+ id: 'flag_01EHQMYV6MBK39QC5PZXHY59C6',
382
+ name: 'Beta Features',
383
+ slug: 'beta-features',
384
+ description: null,
385
+ createdAt: '2024-01-01T00:00:00.000Z',
386
+ updatedAt: '2024-01-01T00:00:00.000Z',
387
+ },
388
+ {
389
+ object: 'feature_flag',
390
+ id: 'flag_01EHQMYV6MBK39QC5PZXHY59C7',
391
+ name: 'Premium Support',
392
+ slug: 'premium-support',
393
+ description: 'Access to premium support features',
394
+ createdAt: '2024-01-01T00:00:00.000Z',
395
+ updatedAt: '2024-01-01T00:00:00.000Z',
396
+ },
397
+ ]);
398
+ }));
399
+ });
358
400
  });
@@ -0,0 +1,2 @@
1
+ import { FeatureFlag, FeatureFlagResponse } from '../interfaces/feature-flag.interface';
2
+ export declare const deserializeFeatureFlag: (featureFlag: FeatureFlagResponse) => FeatureFlag;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeFeatureFlag = void 0;
4
+ const deserializeFeatureFlag = (featureFlag) => ({
5
+ object: featureFlag.object,
6
+ id: featureFlag.id,
7
+ name: featureFlag.name,
8
+ slug: featureFlag.slug,
9
+ description: featureFlag.description,
10
+ createdAt: featureFlag.created_at,
11
+ updatedAt: featureFlag.updated_at,
12
+ });
13
+ exports.deserializeFeatureFlag = deserializeFeatureFlag;
package/lib/workos.js CHANGED
@@ -32,7 +32,7 @@ const actions_1 = require("./actions/actions");
32
32
  const vault_1 = require("./vault/vault");
33
33
  const conflict_exception_1 = require("./common/exceptions/conflict.exception");
34
34
  const parse_error_1 = require("./common/exceptions/parse-error");
35
- const VERSION = '7.62.1';
35
+ const VERSION = '7.64.0';
36
36
  const DEFAULT_HOSTNAME = 'api.workos.com';
37
37
  const HEADER_AUTHORIZATION = 'Authorization';
38
38
  const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.62.1",
2
+ "version": "7.64.0",
3
3
  "name": "@workos-inc/node",
4
4
  "author": "WorkOS",
5
5
  "description": "A Node wrapper for the WorkOS API",