@workos-inc/node 7.63.0 → 7.65.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.
@@ -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,4 @@
1
+ import { PaginationOptions } from '../../common/interfaces/pagination-options.interface';
2
+ export interface ListOrganizationFeatureFlagsOptions extends PaginationOptions {
3
+ organizationId: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,10 @@
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';
4
5
  import { RoleList } from '../roles/interfaces';
5
6
  import { ListOrganizationRolesOptions } from './interfaces/list-organization-roles-options.interface';
7
+ import { ListOrganizationFeatureFlagsOptions } from './interfaces/list-organization-feature-flags-options.interface';
6
8
  export declare class Organizations {
7
9
  private readonly workos;
8
10
  constructor(workos: WorkOS);
@@ -13,4 +15,5 @@ export declare class Organizations {
13
15
  getOrganizationByExternalId(externalId: string): Promise<Organization>;
14
16
  updateOrganization(options: UpdateOrganizationOptions): Promise<Organization>;
15
17
  listOrganizationRoles(options: ListOrganizationRolesOptions): Promise<RoleList>;
18
+ listOrganizationFeatureFlags(options: ListOrganizationFeatureFlagsOptions): Promise<AutoPaginatable<FeatureFlag>>;
16
19
  }
@@ -25,6 +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("./serializers/feature-flag.serializer");
28
29
  class Organizations {
29
30
  constructor(workos) {
30
31
  this.workos = workos;
@@ -74,5 +75,11 @@ class Organizations {
74
75
  };
75
76
  });
76
77
  }
78
+ listOrganizationFeatureFlags(options) {
79
+ return __awaiter(this, void 0, void 0, function* () {
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);
82
+ });
83
+ }
77
84
  }
78
85
  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,90 @@ 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
+ describe('with the before option', () => {
400
+ it('forms the proper request to the API', () => __awaiter(void 0, void 0, void 0, function* () {
401
+ (0, test_utils_1.fetchOnce)(list_organization_feature_flags_json_1.default);
402
+ const { data } = yield workos.organizations.listOrganizationFeatureFlags({
403
+ organizationId: 'org_01EHT88Z8J8795GZNQ4ZP1J81T',
404
+ before: 'flag_before_id',
405
+ });
406
+ expect((0, test_utils_1.fetchSearchParams)()).toEqual({
407
+ before: 'flag_before_id',
408
+ order: 'desc',
409
+ });
410
+ expect((0, test_utils_1.fetchURL)()).toContain('/organizations/org_01EHT88Z8J8795GZNQ4ZP1J81T/feature_flags');
411
+ expect(data).toHaveLength(3);
412
+ }));
413
+ });
414
+ describe('with the after option', () => {
415
+ it('forms the proper request to the API', () => __awaiter(void 0, void 0, void 0, function* () {
416
+ (0, test_utils_1.fetchOnce)(list_organization_feature_flags_json_1.default);
417
+ const { data } = yield workos.organizations.listOrganizationFeatureFlags({
418
+ organizationId: 'org_01EHT88Z8J8795GZNQ4ZP1J81T',
419
+ after: 'flag_after_id',
420
+ });
421
+ expect((0, test_utils_1.fetchSearchParams)()).toEqual({
422
+ after: 'flag_after_id',
423
+ order: 'desc',
424
+ });
425
+ expect((0, test_utils_1.fetchURL)()).toContain('/organizations/org_01EHT88Z8J8795GZNQ4ZP1J81T/feature_flags');
426
+ expect(data).toHaveLength(3);
427
+ }));
428
+ });
429
+ describe('with the limit option', () => {
430
+ it('forms the proper request to the API', () => __awaiter(void 0, void 0, void 0, function* () {
431
+ (0, test_utils_1.fetchOnce)(list_organization_feature_flags_json_1.default);
432
+ const { data } = yield workos.organizations.listOrganizationFeatureFlags({
433
+ organizationId: 'org_01EHT88Z8J8795GZNQ4ZP1J81T',
434
+ limit: 10,
435
+ });
436
+ expect((0, test_utils_1.fetchSearchParams)()).toEqual({
437
+ limit: '10',
438
+ order: 'desc',
439
+ });
440
+ expect((0, test_utils_1.fetchURL)()).toContain('/organizations/org_01EHT88Z8J8795GZNQ4ZP1J81T/feature_flags');
441
+ expect(data).toHaveLength(3);
442
+ }));
443
+ });
444
+ });
358
445
  });
@@ -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.63.0';
35
+ const VERSION = '7.65.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.63.0",
2
+ "version": "7.65.0",
3
3
  "name": "@workos-inc/node",
4
4
  "author": "WorkOS",
5
5
  "description": "A Node wrapper for the WorkOS API",