@workos-inc/node 7.40.1 → 7.41.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.
@@ -118,6 +118,7 @@ describe('Actions', () => {
118
118
  domains: [],
119
119
  createdAt: '2024-10-22T17:12:50.746Z',
120
120
  updatedAt: '2024-10-22T17:12:50.746Z',
121
+ externalId: null,
121
122
  },
122
123
  organizationMembership: {
123
124
  object: 'organization_membership',
@@ -3,6 +3,7 @@ import { DomainData } from './domain-data.interface';
3
3
  export interface CreateOrganizationOptions {
4
4
  name: string;
5
5
  domainData?: DomainData[];
6
+ externalId?: string | null;
6
7
  /**
7
8
  * @deprecated If you need to allow sign-ins from any email domain, contact support@workos.com.
8
9
  */
@@ -15,6 +16,7 @@ export interface CreateOrganizationOptions {
15
16
  export interface SerializedCreateOrganizationOptions {
16
17
  name: string;
17
18
  domain_data?: DomainData[];
19
+ external_id?: string | null;
18
20
  /**
19
21
  * @deprecated If you need to allow sign-ins from any email domain, contact support@workos.com.
20
22
  */
@@ -8,6 +8,7 @@ export interface Organization {
8
8
  stripeCustomerId?: string;
9
9
  createdAt: string;
10
10
  updatedAt: string;
11
+ externalId: string | null;
11
12
  }
12
13
  export interface OrganizationResponse {
13
14
  object: 'organization';
@@ -18,4 +19,5 @@ export interface OrganizationResponse {
18
19
  stripe_customer_id?: string;
19
20
  created_at: string;
20
21
  updated_at: string;
22
+ external_id?: string | null;
21
23
  }
@@ -4,6 +4,7 @@ export interface UpdateOrganizationOptions {
4
4
  name?: string;
5
5
  domainData?: DomainData[];
6
6
  stripeCustomerId?: string | null;
7
+ externalId?: string | null;
7
8
  /**
8
9
  * @deprecated If you need to allow sign-ins from any email domain, contact support@workos.com.
9
10
  */
@@ -17,6 +18,7 @@ export interface SerializedUpdateOrganizationOptions {
17
18
  name?: string;
18
19
  domain_data?: DomainData[];
19
20
  stripe_customer_id?: string | null;
21
+ external_id?: string | null;
20
22
  /**
21
23
  * @deprecated If you need to allow sign-ins from any email domain, contact support@workos.com.
22
24
  */
@@ -10,6 +10,7 @@ export declare class Organizations {
10
10
  createOrganization(payload: CreateOrganizationOptions, requestOptions?: CreateOrganizationRequestOptions): Promise<Organization>;
11
11
  deleteOrganization(id: string): Promise<void>;
12
12
  getOrganization(id: string): Promise<Organization>;
13
+ getOrganizationByExternalId(externalId: string): Promise<Organization>;
13
14
  updateOrganization(options: UpdateOrganizationOptions): Promise<Organization>;
14
15
  listOrganizationRoles(options: ListOrganizationRolesOptions): Promise<RoleList>;
15
16
  }
@@ -51,6 +51,12 @@ class Organizations {
51
51
  return (0, serializers_1.deserializeOrganization)(data);
52
52
  });
53
53
  }
54
+ getOrganizationByExternalId(externalId) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const { data } = yield this.workos.get(`/organizations/external_id/${externalId}`);
57
+ return (0, serializers_1.deserializeOrganization)(data);
58
+ });
59
+ }
54
60
  updateOrganization(options) {
55
61
  return __awaiter(this, void 0, void 0, function* () {
56
62
  const { organization: organizationId } = options, payload = __rest(options, ["organization"]);
@@ -194,6 +194,19 @@ describe('Organizations', () => {
194
194
  ]);
195
195
  }));
196
196
  });
197
+ describe('getOrganizationByExternalId', () => {
198
+ it('sends request', () => __awaiter(void 0, void 0, void 0, function* () {
199
+ const externalId = 'user_external_id';
200
+ const apiResponse = Object.assign(Object.assign({}, get_organization_json_1.default), { external_id: externalId });
201
+ (0, test_utils_1.fetchOnce)(apiResponse);
202
+ const organization = yield workos.organizations.getOrganizationByExternalId(externalId);
203
+ expect((0, test_utils_1.fetchURL)()).toContain(`/organizations/external_id/${externalId}`);
204
+ expect(organization).toMatchObject({
205
+ id: apiResponse.id,
206
+ externalId: apiResponse.external_id,
207
+ });
208
+ }));
209
+ });
197
210
  describe('deleteOrganization', () => {
198
211
  it('sends request to delete an Organization', () => __awaiter(void 0, void 0, void 0, function* () {
199
212
  (0, test_utils_1.fetchOnce)();
@@ -6,5 +6,6 @@ const serializeCreateOrganizationOptions = (options) => ({
6
6
  allow_profiles_outside_organization: options.allowProfilesOutsideOrganization,
7
7
  domain_data: options.domainData,
8
8
  domains: options.domains,
9
+ external_id: options.externalId,
9
10
  });
10
11
  exports.serializeCreateOrganizationOptions = serializeCreateOrganizationOptions;
@@ -2,7 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deserializeOrganization = void 0;
4
4
  const organization_domain_serializer_1 = require("../../organization-domains/serializers/organization-domain.serializer");
5
- const deserializeOrganization = (organization) => (Object.assign(Object.assign({ object: organization.object, id: organization.id, name: organization.name, allowProfilesOutsideOrganization: organization.allow_profiles_outside_organization, domains: organization.domains.map(organization_domain_serializer_1.deserializeOrganizationDomain) }, (typeof organization.stripe_customer_id === 'undefined'
6
- ? undefined
7
- : { stripeCustomerId: organization.stripe_customer_id })), { createdAt: organization.created_at, updatedAt: organization.updated_at }));
5
+ const deserializeOrganization = (organization) => {
6
+ var _a;
7
+ return (Object.assign(Object.assign({ object: organization.object, id: organization.id, name: organization.name, allowProfilesOutsideOrganization: organization.allow_profiles_outside_organization, domains: organization.domains.map(organization_domain_serializer_1.deserializeOrganizationDomain) }, (typeof organization.stripe_customer_id === 'undefined'
8
+ ? undefined
9
+ : { stripeCustomerId: organization.stripe_customer_id })), { createdAt: organization.created_at, updatedAt: organization.updated_at, externalId: (_a = organization.external_id) !== null && _a !== void 0 ? _a : null }));
10
+ };
8
11
  exports.deserializeOrganization = deserializeOrganization;
@@ -7,5 +7,6 @@ const serializeUpdateOrganizationOptions = (options) => ({
7
7
  domain_data: options.domainData,
8
8
  domains: options.domains,
9
9
  stripe_customer_id: options.stripeCustomerId,
10
+ external_id: options.externalId,
10
11
  });
11
12
  exports.serializeUpdateOrganizationOptions = serializeUpdateOrganizationOptions;
package/lib/workos.js CHANGED
@@ -29,7 +29,7 @@ const subtle_crypto_provider_1 = require("./common/crypto/subtle-crypto-provider
29
29
  const fetch_client_1 = require("./common/net/fetch-client");
30
30
  const widgets_1 = require("./widgets/widgets");
31
31
  const actions_1 = require("./actions/actions");
32
- const VERSION = '7.40.1';
32
+ const VERSION = '7.41.0';
33
33
  const DEFAULT_HOSTNAME = 'api.workos.com';
34
34
  const HEADER_AUTHORIZATION = 'Authorization';
35
35
  const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.40.1",
2
+ "version": "7.41.0",
3
3
  "name": "@workos-inc/node",
4
4
  "author": "WorkOS",
5
5
  "description": "A Node wrapper for the WorkOS API",
@@ -73,4 +73,3 @@
73
73
  }
74
74
  }
75
75
  }
76
-