@workos-inc/node 10.14.0 → 12.0.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.
- package/README.md +49 -0
- package/lib/{factory-Dqju-gCl.mjs → factory-D2Ig6M1S.mjs} +1401 -461
- package/lib/factory-D2Ig6M1S.mjs.map +1 -0
- package/lib/{factory-BkKapXtb.cjs → factory-J5qx-wp3.cjs} +1439 -493
- package/lib/factory-J5qx-wp3.cjs.map +1 -0
- package/lib/{factory-zrNVaAD9.d.cts → factory-r4pCiC4E.d.cts} +3877 -2552
- package/lib/{factory-CW0E3JEC.d.mts → factory-r4pCiC4E.d.mts} +5172 -3846
- package/lib/index.cjs +206 -4
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +156 -78
- package/lib/index.d.mts +156 -78
- package/lib/index.mjs +185 -5
- package/lib/index.mjs.map +1 -1
- package/lib/index.worker.cjs +2 -1
- package/lib/index.worker.d.cts +2 -2
- package/lib/index.worker.d.mts +2 -2
- package/lib/index.worker.mjs +2 -2
- package/lib/{webapi-C2FQ2NNL.mjs → webapi-CfgZkeeN.mjs} +13 -2
- package/lib/{webapi-C2FQ2NNL.mjs.map → webapi-CfgZkeeN.mjs.map} +1 -1
- package/lib/webapi-MD5xmNba.cjs.map +1 -1
- package/package.json +2 -2
- package/lib/factory-BkKapXtb.cjs.map +0 -1
- package/lib/factory-Dqju-gCl.mjs.map +0 -1
- package/lib/rolldown-runtime-D7D4PA-g.mjs +0 -13
|
@@ -671,7 +671,9 @@ var SignatureProvider = class {
|
|
|
671
671
|
async verifyHeader({ payload, sigHeader, secret, tolerance = 18e4 }) {
|
|
672
672
|
const [timestamp, signatureHash] = this.getTimestampAndSignatureHash(sigHeader);
|
|
673
673
|
if (!signatureHash || Object.keys(signatureHash).length === 0) throw new SignatureVerificationException("No signature hash found with expected scheme v1");
|
|
674
|
-
|
|
674
|
+
const timestampMs = Number(timestamp);
|
|
675
|
+
if (!/^\d+$/.test(timestamp) || !Number.isSafeInteger(timestampMs)) throw new SignatureVerificationException("Invalid timestamp");
|
|
676
|
+
if (Math.abs(Date.now() - timestampMs) > tolerance) throw new SignatureVerificationException("Timestamp outside the tolerance zone");
|
|
675
677
|
const expectedSig = await this.computeSignature(timestamp, payload, secret);
|
|
676
678
|
if (await this.cryptoProvider.secureCompare(expectedSig, signatureHash) === false) throw new SignatureVerificationException("Signature hash does not match the expected signature hash for payload");
|
|
677
679
|
return true;
|
|
@@ -713,8 +715,8 @@ const deserializeOrganizationDomain = (organizationDomain) => ({
|
|
|
713
715
|
...organizationDomain.verification_token !== void 0 && { verificationToken: organizationDomain.verification_token },
|
|
714
716
|
verificationStrategy: organizationDomain.verification_strategy,
|
|
715
717
|
...organizationDomain.verification_prefix !== void 0 && { verificationPrefix: organizationDomain.verification_prefix },
|
|
716
|
-
createdAt: organizationDomain.created_at,
|
|
717
|
-
updatedAt: organizationDomain.updated_at
|
|
718
|
+
createdAt: new Date(organizationDomain.created_at),
|
|
719
|
+
updatedAt: new Date(organizationDomain.updated_at)
|
|
718
720
|
});
|
|
719
721
|
//#endregion
|
|
720
722
|
//#region src/organizations/serializers/organization.serializer.ts
|
|
@@ -725,8 +727,8 @@ const deserializeOrganization = (organization) => ({
|
|
|
725
727
|
allowProfilesOutsideOrganization: organization.allow_profiles_outside_organization,
|
|
726
728
|
domains: organization.domains.map(deserializeOrganizationDomain),
|
|
727
729
|
...typeof organization.stripe_customer_id === "undefined" ? void 0 : { stripeCustomerId: organization.stripe_customer_id },
|
|
728
|
-
createdAt: organization.created_at,
|
|
729
|
-
updatedAt: organization.updated_at,
|
|
730
|
+
createdAt: new Date(organization.created_at),
|
|
731
|
+
updatedAt: new Date(organization.updated_at),
|
|
730
732
|
externalId: organization.external_id ?? null,
|
|
731
733
|
metadata: organization.metadata ?? {}
|
|
732
734
|
});
|
|
@@ -845,9 +847,9 @@ const serializeAuthenticateWithTotpOptions = (options) => ({
|
|
|
845
847
|
//#endregion
|
|
846
848
|
//#region src/user-management/serializers/authentication-event.serializer.ts
|
|
847
849
|
const deserializeAuthenticationEventSso = (sso) => ({
|
|
848
|
-
connectionId: sso.connection_id,
|
|
849
|
-
organizationId: sso.organization_id,
|
|
850
|
-
|
|
850
|
+
connectionId: sso.connection_id ?? null,
|
|
851
|
+
organizationId: sso.organization_id ?? null,
|
|
852
|
+
sessionId: sso.session_id ?? null
|
|
851
853
|
});
|
|
852
854
|
const deserializeAuthenticationEvent = (authenticationEvent) => ({
|
|
853
855
|
email: authenticationEvent.email,
|
|
@@ -884,8 +886,8 @@ const deserializeTotpWithSecrets = (totp) => {
|
|
|
884
886
|
const deserializeFactor$1 = (factor) => ({
|
|
885
887
|
object: factor.object,
|
|
886
888
|
id: factor.id,
|
|
887
|
-
createdAt: factor.created_at,
|
|
888
|
-
updatedAt: factor.updated_at,
|
|
889
|
+
createdAt: new Date(factor.created_at),
|
|
890
|
+
updatedAt: new Date(factor.updated_at),
|
|
889
891
|
type: factor.type,
|
|
890
892
|
...factor.sms ? { sms: deserializeSms(factor.sms) } : {},
|
|
891
893
|
...factor.totp ? { totp: deserializeTotp(factor.totp) } : {},
|
|
@@ -894,8 +896,8 @@ const deserializeFactor$1 = (factor) => ({
|
|
|
894
896
|
const deserializeFactorWithSecrets$1 = (factor) => ({
|
|
895
897
|
object: factor.object,
|
|
896
898
|
id: factor.id,
|
|
897
|
-
createdAt: factor.created_at,
|
|
898
|
-
updatedAt: factor.updated_at,
|
|
899
|
+
createdAt: new Date(factor.created_at),
|
|
900
|
+
updatedAt: new Date(factor.updated_at),
|
|
899
901
|
type: factor.type,
|
|
900
902
|
totp: deserializeTotpWithSecrets(factor.totp),
|
|
901
903
|
userId: factor.user_id
|
|
@@ -919,10 +921,10 @@ const deserializeUser = (user) => ({
|
|
|
919
921
|
firstName: user.first_name,
|
|
920
922
|
profilePictureUrl: user.profile_picture_url,
|
|
921
923
|
lastName: user.last_name,
|
|
922
|
-
lastSignInAt: user.last_sign_in_at,
|
|
924
|
+
lastSignInAt: user.last_sign_in_at != null ? new Date(user.last_sign_in_at) : null,
|
|
923
925
|
locale: user.locale,
|
|
924
|
-
createdAt: user.created_at,
|
|
925
|
-
updatedAt: user.updated_at,
|
|
926
|
+
createdAt: new Date(user.created_at),
|
|
927
|
+
updatedAt: new Date(user.updated_at),
|
|
926
928
|
externalId: user.external_id ?? null,
|
|
927
929
|
metadata: user.metadata ?? {}
|
|
928
930
|
});
|
|
@@ -971,19 +973,19 @@ const deserializeEmailVerification = (emailVerification) => ({
|
|
|
971
973
|
id: emailVerification.id,
|
|
972
974
|
userId: emailVerification.user_id,
|
|
973
975
|
email: emailVerification.email,
|
|
974
|
-
expiresAt: emailVerification.expires_at,
|
|
976
|
+
expiresAt: new Date(emailVerification.expires_at),
|
|
975
977
|
code: emailVerification.code,
|
|
976
|
-
createdAt: emailVerification.created_at,
|
|
977
|
-
updatedAt: emailVerification.updated_at
|
|
978
|
+
createdAt: new Date(emailVerification.created_at),
|
|
979
|
+
updatedAt: new Date(emailVerification.updated_at)
|
|
978
980
|
});
|
|
979
981
|
const deserializeEmailVerificationEvent = (emailVerification) => ({
|
|
980
982
|
object: emailVerification.object,
|
|
981
983
|
id: emailVerification.id,
|
|
982
984
|
userId: emailVerification.user_id,
|
|
983
985
|
email: emailVerification.email,
|
|
984
|
-
expiresAt: emailVerification.expires_at,
|
|
985
|
-
createdAt: emailVerification.created_at,
|
|
986
|
-
updatedAt: emailVerification.updated_at
|
|
986
|
+
expiresAt: new Date(emailVerification.expires_at),
|
|
987
|
+
createdAt: new Date(emailVerification.created_at),
|
|
988
|
+
updatedAt: new Date(emailVerification.updated_at)
|
|
987
989
|
});
|
|
988
990
|
//#endregion
|
|
989
991
|
//#region src/user-management/serializers/enroll-auth-factor-options.serializer.ts
|
|
@@ -1000,32 +1002,32 @@ const deserializeInvitation = (invitation) => ({
|
|
|
1000
1002
|
id: invitation.id,
|
|
1001
1003
|
email: invitation.email,
|
|
1002
1004
|
state: invitation.state,
|
|
1003
|
-
acceptedAt: invitation.accepted_at,
|
|
1004
|
-
revokedAt: invitation.revoked_at,
|
|
1005
|
-
expiresAt: invitation.expires_at,
|
|
1005
|
+
acceptedAt: invitation.accepted_at != null ? new Date(invitation.accepted_at) : null,
|
|
1006
|
+
revokedAt: invitation.revoked_at != null ? new Date(invitation.revoked_at) : null,
|
|
1007
|
+
expiresAt: new Date(invitation.expires_at),
|
|
1006
1008
|
organizationId: invitation.organization_id,
|
|
1007
1009
|
inviterUserId: invitation.inviter_user_id,
|
|
1008
1010
|
acceptedUserId: invitation.accepted_user_id,
|
|
1009
1011
|
roleSlug: invitation.role_slug,
|
|
1010
1012
|
token: invitation.token,
|
|
1011
1013
|
acceptInvitationUrl: invitation.accept_invitation_url,
|
|
1012
|
-
createdAt: invitation.created_at,
|
|
1013
|
-
updatedAt: invitation.updated_at
|
|
1014
|
+
createdAt: new Date(invitation.created_at),
|
|
1015
|
+
updatedAt: new Date(invitation.updated_at)
|
|
1014
1016
|
});
|
|
1015
1017
|
const deserializeInvitationEvent = (invitation) => ({
|
|
1016
1018
|
object: invitation.object,
|
|
1017
1019
|
id: invitation.id,
|
|
1018
1020
|
email: invitation.email,
|
|
1019
1021
|
state: invitation.state,
|
|
1020
|
-
acceptedAt: invitation.accepted_at,
|
|
1021
|
-
revokedAt: invitation.revoked_at,
|
|
1022
|
-
expiresAt: invitation.expires_at,
|
|
1022
|
+
acceptedAt: invitation.accepted_at != null ? new Date(invitation.accepted_at) : null,
|
|
1023
|
+
revokedAt: invitation.revoked_at != null ? new Date(invitation.revoked_at) : null,
|
|
1024
|
+
expiresAt: new Date(invitation.expires_at),
|
|
1023
1025
|
organizationId: invitation.organization_id,
|
|
1024
1026
|
inviterUserId: invitation.inviter_user_id,
|
|
1025
1027
|
acceptedUserId: invitation.accepted_user_id,
|
|
1026
1028
|
roleSlug: invitation.role_slug,
|
|
1027
|
-
createdAt: invitation.created_at,
|
|
1028
|
-
updatedAt: invitation.updated_at
|
|
1029
|
+
createdAt: new Date(invitation.created_at),
|
|
1030
|
+
updatedAt: new Date(invitation.updated_at)
|
|
1029
1031
|
});
|
|
1030
1032
|
//#endregion
|
|
1031
1033
|
//#region src/user-management/serializers/list-sessions-options.serializer.ts
|
|
@@ -1048,19 +1050,19 @@ const deserializeMagicAuth = (magicAuth) => ({
|
|
|
1048
1050
|
id: magicAuth.id,
|
|
1049
1051
|
userId: magicAuth.user_id,
|
|
1050
1052
|
email: magicAuth.email,
|
|
1051
|
-
expiresAt: magicAuth.expires_at,
|
|
1053
|
+
expiresAt: new Date(magicAuth.expires_at),
|
|
1052
1054
|
code: magicAuth.code,
|
|
1053
|
-
createdAt: magicAuth.created_at,
|
|
1054
|
-
updatedAt: magicAuth.updated_at
|
|
1055
|
+
createdAt: new Date(magicAuth.created_at),
|
|
1056
|
+
updatedAt: new Date(magicAuth.updated_at)
|
|
1055
1057
|
});
|
|
1056
1058
|
const deserializeMagicAuthEvent = (magicAuth) => ({
|
|
1057
1059
|
object: magicAuth.object,
|
|
1058
1060
|
id: magicAuth.id,
|
|
1059
1061
|
userId: magicAuth.user_id,
|
|
1060
1062
|
email: magicAuth.email,
|
|
1061
|
-
expiresAt: magicAuth.expires_at,
|
|
1062
|
-
createdAt: magicAuth.created_at,
|
|
1063
|
-
updatedAt: magicAuth.updated_at
|
|
1063
|
+
expiresAt: new Date(magicAuth.expires_at),
|
|
1064
|
+
createdAt: new Date(magicAuth.created_at),
|
|
1065
|
+
updatedAt: new Date(magicAuth.updated_at)
|
|
1064
1066
|
});
|
|
1065
1067
|
//#endregion
|
|
1066
1068
|
//#region src/user-management/serializers/password-reset.serializer.ts
|
|
@@ -1071,16 +1073,16 @@ const deserializePasswordReset = (passwordReset) => ({
|
|
|
1071
1073
|
email: passwordReset.email,
|
|
1072
1074
|
passwordResetToken: passwordReset.password_reset_token,
|
|
1073
1075
|
passwordResetUrl: passwordReset.password_reset_url,
|
|
1074
|
-
expiresAt: passwordReset.expires_at,
|
|
1075
|
-
createdAt: passwordReset.created_at
|
|
1076
|
+
expiresAt: new Date(passwordReset.expires_at),
|
|
1077
|
+
createdAt: new Date(passwordReset.created_at)
|
|
1076
1078
|
});
|
|
1077
1079
|
const deserializePasswordResetEvent = (passwordReset) => ({
|
|
1078
1080
|
object: passwordReset.object,
|
|
1079
1081
|
id: passwordReset.id,
|
|
1080
1082
|
userId: passwordReset.user_id,
|
|
1081
1083
|
email: passwordReset.email,
|
|
1082
|
-
expiresAt: passwordReset.expires_at,
|
|
1083
|
-
createdAt: passwordReset.created_at
|
|
1084
|
+
expiresAt: new Date(passwordReset.expires_at),
|
|
1085
|
+
createdAt: new Date(passwordReset.created_at)
|
|
1084
1086
|
});
|
|
1085
1087
|
//#endregion
|
|
1086
1088
|
//#region src/user-management/serializers/reset-password-options.serializer.ts
|
|
@@ -1100,10 +1102,10 @@ const deserializeSession = (session) => ({
|
|
|
1100
1102
|
...session.impersonator !== void 0 && { impersonator: session.impersonator },
|
|
1101
1103
|
authMethod: session.auth_method,
|
|
1102
1104
|
status: session.status,
|
|
1103
|
-
expiresAt: session.expires_at,
|
|
1104
|
-
endedAt: session.ended_at,
|
|
1105
|
-
createdAt: session.created_at,
|
|
1106
|
-
updatedAt: session.updated_at
|
|
1105
|
+
expiresAt: new Date(session.expires_at),
|
|
1106
|
+
endedAt: session.ended_at != null ? new Date(session.ended_at) : null,
|
|
1107
|
+
createdAt: new Date(session.created_at),
|
|
1108
|
+
updatedAt: new Date(session.updated_at)
|
|
1107
1109
|
});
|
|
1108
1110
|
//#endregion
|
|
1109
1111
|
//#region src/user-management/serializers/create-user-options.serializer.ts
|
|
@@ -1159,11 +1161,11 @@ function deserializeUserApiKey(apiKey) {
|
|
|
1159
1161
|
},
|
|
1160
1162
|
name: apiKey.name,
|
|
1161
1163
|
obfuscatedValue: apiKey.obfuscated_value,
|
|
1162
|
-
lastUsedAt: apiKey.last_used_at,
|
|
1163
|
-
expiresAt: apiKey.expires_at,
|
|
1164
|
+
lastUsedAt: apiKey.last_used_at != null ? new Date(apiKey.last_used_at) : null,
|
|
1165
|
+
expiresAt: apiKey.expires_at != null ? new Date(apiKey.expires_at) : null,
|
|
1164
1166
|
permissions: apiKey.permissions,
|
|
1165
|
-
createdAt: apiKey.created_at,
|
|
1166
|
-
updatedAt: apiKey.updated_at
|
|
1167
|
+
createdAt: new Date(apiKey.created_at),
|
|
1168
|
+
updatedAt: new Date(apiKey.updated_at)
|
|
1167
1169
|
};
|
|
1168
1170
|
}
|
|
1169
1171
|
//#endregion
|
|
@@ -1179,8 +1181,8 @@ function deserializeUserApiKeyWithValue(apiKey) {
|
|
|
1179
1181
|
const deserializeWaitlist = (waitlist) => ({
|
|
1180
1182
|
object: waitlist.object,
|
|
1181
1183
|
id: waitlist.id,
|
|
1182
|
-
createdAt: waitlist.created_at,
|
|
1183
|
-
updatedAt: waitlist.updated_at
|
|
1184
|
+
createdAt: new Date(waitlist.created_at),
|
|
1185
|
+
updatedAt: new Date(waitlist.updated_at)
|
|
1184
1186
|
});
|
|
1185
1187
|
//#endregion
|
|
1186
1188
|
//#region src/user-management/serializers/waitlist-entry.serializer.ts
|
|
@@ -1189,11 +1191,24 @@ const deserializeWaitlistEntry = (waitlistEntry) => ({
|
|
|
1189
1191
|
id: waitlistEntry.id,
|
|
1190
1192
|
email: waitlistEntry.email,
|
|
1191
1193
|
state: waitlistEntry.state,
|
|
1192
|
-
approvedAt: waitlistEntry.approved_at,
|
|
1194
|
+
approvedAt: waitlistEntry.approved_at != null ? new Date(waitlistEntry.approved_at) : null,
|
|
1193
1195
|
additionalFields: waitlistEntry.additional_fields,
|
|
1194
1196
|
waitlistId: waitlistEntry.waitlist_id ?? null,
|
|
1195
|
-
createdAt: waitlistEntry.created_at,
|
|
1196
|
-
updatedAt: waitlistEntry.updated_at
|
|
1197
|
+
createdAt: new Date(waitlistEntry.created_at),
|
|
1198
|
+
updatedAt: new Date(waitlistEntry.updated_at)
|
|
1199
|
+
});
|
|
1200
|
+
//#endregion
|
|
1201
|
+
//#region src/user-management/serializers/waitlist-user-event.serializer.ts
|
|
1202
|
+
const deserializeWaitlistUserEvent = (data) => ({
|
|
1203
|
+
object: data.object,
|
|
1204
|
+
id: data.id,
|
|
1205
|
+
email: data.email,
|
|
1206
|
+
state: data.state,
|
|
1207
|
+
approvedAt: data.approved_at != null ? new Date(data.approved_at) : null,
|
|
1208
|
+
additionalFields: data.additional_fields,
|
|
1209
|
+
waitlistId: data.waitlist_id ?? null,
|
|
1210
|
+
createdAt: new Date(data.created_at),
|
|
1211
|
+
updatedAt: new Date(data.updated_at)
|
|
1197
1212
|
});
|
|
1198
1213
|
//#endregion
|
|
1199
1214
|
//#region src/user-management/serializers/organization-membership.serializer.ts
|
|
@@ -1205,11 +1220,12 @@ const deserializeOrganizationMembership = (organizationMembership) => ({
|
|
|
1205
1220
|
organizationName: organizationMembership.organization_name,
|
|
1206
1221
|
status: organizationMembership.status,
|
|
1207
1222
|
directoryManaged: organizationMembership.directory_managed ?? false,
|
|
1208
|
-
createdAt: organizationMembership.created_at,
|
|
1209
|
-
updatedAt: organizationMembership.updated_at,
|
|
1223
|
+
createdAt: new Date(organizationMembership.created_at),
|
|
1224
|
+
updatedAt: new Date(organizationMembership.updated_at),
|
|
1210
1225
|
role: organizationMembership.role,
|
|
1211
1226
|
...organizationMembership.roles && { roles: organizationMembership.roles },
|
|
1212
|
-
customAttributes: organizationMembership.custom_attributes ?? {}
|
|
1227
|
+
customAttributes: organizationMembership.custom_attributes ?? {},
|
|
1228
|
+
...organizationMembership.user && { user: deserializeUser(organizationMembership.user) }
|
|
1213
1229
|
});
|
|
1214
1230
|
const deserializeAuthorizationOrganizationMembership = (organizationMembership) => ({
|
|
1215
1231
|
object: organizationMembership.object,
|
|
@@ -1218,8 +1234,8 @@ const deserializeAuthorizationOrganizationMembership = (organizationMembership)
|
|
|
1218
1234
|
organizationId: organizationMembership.organization_id,
|
|
1219
1235
|
status: organizationMembership.status,
|
|
1220
1236
|
directoryManaged: organizationMembership.directory_managed ?? false,
|
|
1221
|
-
createdAt: organizationMembership.created_at,
|
|
1222
|
-
updatedAt: organizationMembership.updated_at,
|
|
1237
|
+
createdAt: new Date(organizationMembership.created_at),
|
|
1238
|
+
updatedAt: new Date(organizationMembership.updated_at),
|
|
1223
1239
|
customAttributes: organizationMembership.custom_attributes ?? {}
|
|
1224
1240
|
});
|
|
1225
1241
|
//#endregion
|
|
@@ -1325,9 +1341,11 @@ var AutoPaginatable = class {
|
|
|
1325
1341
|
return this.list.listMetadata;
|
|
1326
1342
|
}
|
|
1327
1343
|
async *generatePages(params) {
|
|
1344
|
+
const { before, ...options } = this.options;
|
|
1328
1345
|
const result = await this.apiCall({
|
|
1329
|
-
...
|
|
1346
|
+
...options,
|
|
1330
1347
|
limit: 100,
|
|
1348
|
+
...params.before ? { before } : {},
|
|
1331
1349
|
after: params.after
|
|
1332
1350
|
});
|
|
1333
1351
|
yield result.data;
|
|
@@ -1343,32 +1361,227 @@ var AutoPaginatable = class {
|
|
|
1343
1361
|
async autoPagination() {
|
|
1344
1362
|
if (this.options.limit) return this.data;
|
|
1345
1363
|
const results = [];
|
|
1346
|
-
for await (const page of this.generatePages({
|
|
1364
|
+
for await (const page of this.generatePages({
|
|
1365
|
+
before: this.options.before,
|
|
1366
|
+
after: this.options.after
|
|
1367
|
+
})) results.push(...page);
|
|
1347
1368
|
return results;
|
|
1348
1369
|
}
|
|
1349
1370
|
};
|
|
1350
1371
|
//#endregion
|
|
1351
|
-
//#region src/
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1372
|
+
//#region src/agents/serializers/agent-blueprint.serializer.ts
|
|
1373
|
+
function deserializeAgentBlueprint(blueprint) {
|
|
1374
|
+
return {
|
|
1375
|
+
object: blueprint.object,
|
|
1376
|
+
id: blueprint.id,
|
|
1377
|
+
name: blueprint.name,
|
|
1378
|
+
description: blueprint.description,
|
|
1379
|
+
permissions: blueprint.permissions,
|
|
1380
|
+
invocableBy: {
|
|
1381
|
+
roleSlugs: blueprint.invocable_by.role_slugs,
|
|
1382
|
+
organizationIds: blueprint.invocable_by.organization_ids
|
|
1383
|
+
},
|
|
1384
|
+
sessionSettings: {
|
|
1385
|
+
maxAgeSeconds: blueprint.session_settings.max_age_seconds,
|
|
1386
|
+
accessTokenTtlSeconds: blueprint.session_settings.access_token_ttl_seconds,
|
|
1387
|
+
refreshTokenTtlSeconds: blueprint.session_settings.refresh_token_ttl_seconds
|
|
1388
|
+
},
|
|
1389
|
+
createdAt: new Date(blueprint.created_at),
|
|
1390
|
+
updatedAt: new Date(blueprint.updated_at)
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
function serializeCreateAgentBlueprintOptions(options) {
|
|
1394
|
+
return {
|
|
1395
|
+
name: options.name,
|
|
1396
|
+
...options.description !== void 0 && { description: options.description },
|
|
1397
|
+
...options.permissions !== void 0 && { permissions: options.permissions },
|
|
1398
|
+
...options.invocableBy !== void 0 && { invocable_by: {
|
|
1399
|
+
...options.invocableBy.roleSlugs !== void 0 && { role_slugs: options.invocableBy.roleSlugs },
|
|
1400
|
+
...options.invocableBy.organizationIds !== void 0 && { organization_ids: options.invocableBy.organizationIds }
|
|
1401
|
+
} },
|
|
1402
|
+
session_settings: {
|
|
1403
|
+
max_age_seconds: options.sessionSettings.maxAgeSeconds,
|
|
1404
|
+
access_token_ttl_seconds: options.sessionSettings.accessTokenTtlSeconds,
|
|
1405
|
+
refresh_token_ttl_seconds: options.sessionSettings.refreshTokenTtlSeconds
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
function serializeUpdateAgentBlueprintOptions(options) {
|
|
1410
|
+
return {
|
|
1411
|
+
...options.name !== void 0 && { name: options.name },
|
|
1412
|
+
...options.description !== void 0 && { description: options.description },
|
|
1413
|
+
...options.permissions !== void 0 && { permissions: options.permissions },
|
|
1414
|
+
...options.invocableBy !== void 0 && { invocable_by: {
|
|
1415
|
+
...options.invocableBy.roleSlugs !== void 0 && { role_slugs: options.invocableBy.roleSlugs },
|
|
1416
|
+
...options.invocableBy.organizationIds !== void 0 && { organization_ids: options.invocableBy.organizationIds }
|
|
1417
|
+
} },
|
|
1418
|
+
...options.sessionSettings !== void 0 && { session_settings: {
|
|
1419
|
+
...options.sessionSettings.maxAgeSeconds !== void 0 && { max_age_seconds: options.sessionSettings.maxAgeSeconds },
|
|
1420
|
+
...options.sessionSettings.accessTokenTtlSeconds !== void 0 && { access_token_ttl_seconds: options.sessionSettings.accessTokenTtlSeconds },
|
|
1421
|
+
...options.sessionSettings.refreshTokenTtlSeconds !== void 0 && { refresh_token_ttl_seconds: options.sessionSettings.refreshTokenTtlSeconds }
|
|
1422
|
+
} }
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
//#endregion
|
|
1426
|
+
//#region src/agents/serializers/agent-event.serializer.ts
|
|
1427
|
+
const deserializeAgentBlueprintEvent = (data) => ({
|
|
1428
|
+
...deserializeAgentBlueprint(data),
|
|
1429
|
+
invocableAs: { instanceTypes: data.invocable_as.instance_types }
|
|
1430
|
+
});
|
|
1431
|
+
const deserializeAgentBlueprintDeletedEvent = (data) => ({
|
|
1432
|
+
object: data.object,
|
|
1433
|
+
id: data.id,
|
|
1434
|
+
name: data.name,
|
|
1435
|
+
createdAt: new Date(data.created_at),
|
|
1436
|
+
updatedAt: new Date(data.updated_at)
|
|
1437
|
+
});
|
|
1438
|
+
const deserializeAgentInstanceSessionEvent = (data) => ({
|
|
1439
|
+
object: data.object,
|
|
1440
|
+
id: data.id,
|
|
1441
|
+
agentInstanceId: data.agent_instance_id,
|
|
1442
|
+
organizationId: data.organization_id,
|
|
1443
|
+
expiresAt: new Date(data.expires_at),
|
|
1444
|
+
revokedAt: data.revoked_at != null ? new Date(data.revoked_at) : null,
|
|
1445
|
+
createdAt: new Date(data.created_at),
|
|
1446
|
+
updatedAt: new Date(data.updated_at)
|
|
1447
|
+
});
|
|
1448
|
+
const deserializeAgentInstanceSessionCreatedEvent = (data) => ({
|
|
1449
|
+
...deserializeAgentInstanceSessionEvent(data),
|
|
1450
|
+
permissionSlugs: data.permission_slugs
|
|
1451
|
+
});
|
|
1452
|
+
const deserializeAgentRegistrationCreatedEvent = (data) => ({
|
|
1453
|
+
object: data.object,
|
|
1454
|
+
id: data.id,
|
|
1455
|
+
agentIdentity: {
|
|
1456
|
+
object: data.agent_identity.object,
|
|
1457
|
+
id: data.agent_identity.id,
|
|
1458
|
+
userlandUserId: data.agent_identity.userland_user_id
|
|
1459
|
+
},
|
|
1460
|
+
organizationId: data.organization_id,
|
|
1461
|
+
status: data.status,
|
|
1462
|
+
kind: data.kind,
|
|
1463
|
+
method: data.method,
|
|
1464
|
+
createdAt: new Date(data.created_at),
|
|
1465
|
+
updatedAt: new Date(data.updated_at)
|
|
1466
|
+
});
|
|
1467
|
+
const deserializeAgentRegistrationClaimAttemptCreatedEvent = (data) => ({
|
|
1468
|
+
object: data.object,
|
|
1469
|
+
id: data.id,
|
|
1470
|
+
agentRegistrationId: data.agent_registration_id,
|
|
1471
|
+
agentRegistrationClaimId: data.agent_registration_claim_id,
|
|
1472
|
+
loginHint: data.login_hint,
|
|
1473
|
+
expiresAt: new Date(data.expires_at),
|
|
1474
|
+
createdAt: new Date(data.created_at),
|
|
1475
|
+
updatedAt: new Date(data.updated_at)
|
|
1476
|
+
});
|
|
1477
|
+
const deserializeAgentRegistrationClaimCompletedEvent = (data) => ({
|
|
1478
|
+
object: data.object,
|
|
1479
|
+
id: data.id,
|
|
1480
|
+
agentRegistrationId: data.agent_registration_id,
|
|
1481
|
+
completedByAttemptId: data.completed_by_attempt_id,
|
|
1482
|
+
claimedBy: {
|
|
1483
|
+
userId: data.claimed_by.user_id,
|
|
1484
|
+
organizationId: data.claimed_by.organization_id
|
|
1485
|
+
},
|
|
1486
|
+
completedAt: new Date(data.completed_at),
|
|
1487
|
+
createdAt: new Date(data.created_at),
|
|
1488
|
+
updatedAt: new Date(data.updated_at)
|
|
1489
|
+
});
|
|
1490
|
+
const deserializeAgentRegistrationCredentialDetail = (detail) => {
|
|
1491
|
+
switch (detail.kind) {
|
|
1492
|
+
case "api_key": return {
|
|
1493
|
+
kind: detail.kind,
|
|
1494
|
+
apiKeyId: detail.api_key_id
|
|
1495
|
+
};
|
|
1496
|
+
case "access_token": return {
|
|
1497
|
+
kind: detail.kind,
|
|
1498
|
+
jti: detail.jti,
|
|
1499
|
+
expiresAt: detail.expires_at != null ? new Date(detail.expires_at) : null
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
const deserializeAgentRegistrationCredentialIssuedEvent = (data) => ({
|
|
1504
|
+
object: data.object,
|
|
1505
|
+
id: data.id,
|
|
1506
|
+
agentRegistrationId: data.agent_registration_id,
|
|
1507
|
+
detail: deserializeAgentRegistrationCredentialDetail(data.detail),
|
|
1508
|
+
createdAt: new Date(data.created_at),
|
|
1509
|
+
updatedAt: new Date(data.updated_at)
|
|
1361
1510
|
});
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1511
|
+
const deserializeAgentRegistrationOrganizationSwitchedEvent = (data) => ({
|
|
1512
|
+
agentRegistrationId: data.agent_registration_id,
|
|
1513
|
+
fromOrganizationId: data.from_organization_id,
|
|
1514
|
+
toOrganizationId: data.to_organization_id
|
|
1515
|
+
});
|
|
1516
|
+
const deserializeAgentRegistrationLifecycleEvent = (data) => ({ agentRegistrationId: data.agent_registration_id });
|
|
1517
|
+
//#endregion
|
|
1518
|
+
//#region src/agents/serializers/agent-instance.serializer.ts
|
|
1519
|
+
function deserializeAgentInstance(instance) {
|
|
1520
|
+
return {
|
|
1521
|
+
object: instance.object,
|
|
1522
|
+
id: instance.id,
|
|
1523
|
+
agentBlueprintId: instance.agent_blueprint_id,
|
|
1524
|
+
organizationId: instance.organization_id,
|
|
1525
|
+
organizationMembershipId: instance.organization_membership_id,
|
|
1526
|
+
type: instance.type,
|
|
1527
|
+
createdAt: new Date(instance.created_at),
|
|
1528
|
+
updatedAt: new Date(instance.updated_at)
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
function serializeListAgentInstancesOptions(options) {
|
|
1532
|
+
return {
|
|
1533
|
+
organization_id: options.organizationId,
|
|
1534
|
+
agent_blueprint_id: options.agentBlueprintId,
|
|
1535
|
+
limit: options.limit,
|
|
1536
|
+
before: options.before,
|
|
1537
|
+
after: options.after,
|
|
1538
|
+
order: options.order
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
//#endregion
|
|
1542
|
+
//#region src/directory-sync/serializers/directory-metadata-user.serializer.ts
|
|
1543
|
+
const deserializeDirectoryMetadataUser = (response) => ({
|
|
1544
|
+
active: response.active,
|
|
1545
|
+
inactive: response.inactive
|
|
1546
|
+
});
|
|
1547
|
+
//#endregion
|
|
1548
|
+
//#region src/directory-sync/serializers/directory-metadata.serializer.ts
|
|
1549
|
+
const deserializeDirectoryMetadata = (response) => ({
|
|
1550
|
+
users: deserializeDirectoryMetadataUser(response.users),
|
|
1551
|
+
groups: response.groups
|
|
1552
|
+
});
|
|
1553
|
+
//#endregion
|
|
1554
|
+
//#region src/directory-sync/serializers/directory.serializer.ts
|
|
1555
|
+
const deserializeDirectoryState = (value) => {
|
|
1556
|
+
if (value === "linked") return "active";
|
|
1557
|
+
if (value === "unlinked") return "inactive";
|
|
1558
|
+
return value;
|
|
1559
|
+
};
|
|
1560
|
+
const deserializeDirectory = (response) => ({
|
|
1561
|
+
object: response.object,
|
|
1562
|
+
id: response.id,
|
|
1563
|
+
organizationId: response.organization_id,
|
|
1564
|
+
externalKey: response.external_key,
|
|
1565
|
+
type: response.type,
|
|
1566
|
+
state: deserializeDirectoryState(response.state),
|
|
1567
|
+
name: response.name,
|
|
1568
|
+
domain: response.domain,
|
|
1569
|
+
metadata: response.metadata != null ? deserializeDirectoryMetadata(response.metadata) : void 0,
|
|
1570
|
+
createdAt: new Date(response.created_at),
|
|
1571
|
+
updatedAt: new Date(response.updated_at)
|
|
1572
|
+
});
|
|
1573
|
+
//#endregion
|
|
1574
|
+
//#region src/directory-sync/serializers/directory-group.serializer.ts
|
|
1575
|
+
const deserializeDirectoryGroup = (response) => ({
|
|
1576
|
+
object: response.object,
|
|
1577
|
+
id: response.id,
|
|
1578
|
+
idpId: response.idp_id,
|
|
1579
|
+
directoryId: response.directory_id,
|
|
1580
|
+
organizationId: response.organization_id,
|
|
1581
|
+
name: response.name,
|
|
1582
|
+
rawAttributes: response.raw_attributes,
|
|
1583
|
+
createdAt: new Date(response.created_at),
|
|
1584
|
+
updatedAt: new Date(response.updated_at)
|
|
1372
1585
|
});
|
|
1373
1586
|
//#endregion
|
|
1374
1587
|
//#region src/directory-sync/serializers/directory-user.serializer.ts
|
|
@@ -1383,11 +1596,12 @@ const deserializeDirectoryUser = (directoryUser) => ({
|
|
|
1383
1596
|
firstName: directoryUser.first_name,
|
|
1384
1597
|
email: directoryUser.email,
|
|
1385
1598
|
lastName: directoryUser.last_name,
|
|
1599
|
+
name: directoryUser.name ?? null,
|
|
1386
1600
|
state: directoryUser.state,
|
|
1387
1601
|
...directoryUser.role !== void 0 && { role: directoryUser.role },
|
|
1388
1602
|
...directoryUser.roles !== void 0 && { roles: directoryUser.roles },
|
|
1389
|
-
createdAt: directoryUser.created_at,
|
|
1390
|
-
updatedAt: directoryUser.updated_at
|
|
1603
|
+
createdAt: new Date(directoryUser.created_at),
|
|
1604
|
+
updatedAt: new Date(directoryUser.updated_at)
|
|
1391
1605
|
});
|
|
1392
1606
|
const deserializeDirectoryUserWithGroups = (directoryUserWithGroups) => ({
|
|
1393
1607
|
...deserializeDirectoryUser(directoryUserWithGroups),
|
|
@@ -1404,32 +1618,16 @@ const deserializeUpdatedEventDirectoryUser = (directoryUser) => ({
|
|
|
1404
1618
|
firstName: directoryUser.first_name,
|
|
1405
1619
|
email: directoryUser.email,
|
|
1406
1620
|
lastName: directoryUser.last_name,
|
|
1621
|
+
name: directoryUser.name ?? null,
|
|
1407
1622
|
state: directoryUser.state,
|
|
1408
1623
|
...directoryUser.role !== void 0 && { role: directoryUser.role },
|
|
1409
1624
|
...directoryUser.roles !== void 0 && { roles: directoryUser.roles },
|
|
1410
|
-
createdAt: directoryUser.created_at,
|
|
1411
|
-
updatedAt: directoryUser.updated_at,
|
|
1625
|
+
createdAt: new Date(directoryUser.created_at),
|
|
1626
|
+
updatedAt: new Date(directoryUser.updated_at),
|
|
1412
1627
|
previousAttributes: directoryUser.previous_attributes
|
|
1413
1628
|
});
|
|
1414
1629
|
//#endregion
|
|
1415
|
-
//#region src/directory-sync/serializers/directory.serializer.ts
|
|
1416
|
-
const deserializeDirectory = (directory) => ({
|
|
1417
|
-
object: directory.object,
|
|
1418
|
-
id: directory.id,
|
|
1419
|
-
domain: directory.domain,
|
|
1420
|
-
externalKey: directory.external_key,
|
|
1421
|
-
name: directory.name,
|
|
1422
|
-
organizationId: directory.organization_id,
|
|
1423
|
-
state: deserializeDirectoryState(directory.state),
|
|
1424
|
-
type: directory.type,
|
|
1425
|
-
createdAt: directory.created_at,
|
|
1426
|
-
updatedAt: directory.updated_at
|
|
1427
|
-
});
|
|
1428
|
-
const deserializeDirectoryState = (state) => {
|
|
1429
|
-
if (state === "linked") return "active";
|
|
1430
|
-
if (state === "unlinked") return "inactive";
|
|
1431
|
-
return state;
|
|
1432
|
-
};
|
|
1630
|
+
//#region src/directory-sync/serializers/event-directory.serializer.ts
|
|
1433
1631
|
const deserializeEventDirectory = (directory) => ({
|
|
1434
1632
|
object: directory.object,
|
|
1435
1633
|
id: directory.id,
|
|
@@ -1439,8 +1637,8 @@ const deserializeEventDirectory = (directory) => ({
|
|
|
1439
1637
|
name: directory.name,
|
|
1440
1638
|
organizationId: directory.organization_id,
|
|
1441
1639
|
domains: directory.domains,
|
|
1442
|
-
createdAt: directory.created_at,
|
|
1443
|
-
updatedAt: directory.updated_at
|
|
1640
|
+
createdAt: new Date(directory.created_at),
|
|
1641
|
+
updatedAt: new Date(directory.updated_at)
|
|
1444
1642
|
});
|
|
1445
1643
|
const deserializeDeletedEventDirectory = (directory) => ({
|
|
1446
1644
|
object: directory.object,
|
|
@@ -1449,18 +1647,22 @@ const deserializeDeletedEventDirectory = (directory) => ({
|
|
|
1449
1647
|
state: directory.state,
|
|
1450
1648
|
name: directory.name,
|
|
1451
1649
|
organizationId: directory.organization_id,
|
|
1452
|
-
createdAt: directory.created_at,
|
|
1453
|
-
updatedAt: directory.updated_at
|
|
1650
|
+
createdAt: new Date(directory.created_at),
|
|
1651
|
+
updatedAt: new Date(directory.updated_at)
|
|
1652
|
+
});
|
|
1653
|
+
const deserializeUpdatedEventDirectoryGroup = (directoryGroup) => ({
|
|
1654
|
+
...deserializeDirectoryGroup(directoryGroup),
|
|
1655
|
+
previousAttributes: directoryGroup.previous_attributes
|
|
1454
1656
|
});
|
|
1455
1657
|
//#endregion
|
|
1456
|
-
//#region src/directory-sync/serializers/
|
|
1457
|
-
const
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1658
|
+
//#region src/directory-sync/serializers/directory-token.serializer.ts
|
|
1659
|
+
const deserializeDirectoryToken = (token) => ({
|
|
1660
|
+
object: token.object,
|
|
1661
|
+
id: token.id,
|
|
1662
|
+
directoryId: token.directory_id,
|
|
1663
|
+
...token.organization_id !== void 0 && { organizationId: token.organization_id },
|
|
1664
|
+
tokenSuffix: token.token_suffix,
|
|
1665
|
+
createdAt: new Date(token.created_at)
|
|
1464
1666
|
});
|
|
1465
1667
|
//#endregion
|
|
1466
1668
|
//#region src/organizations/serializers/create-organization-options.serializer.ts
|
|
@@ -1480,8 +1682,8 @@ const deserializeItContact = (itContact) => ({
|
|
|
1480
1682
|
object: itContact.object,
|
|
1481
1683
|
id: itContact.id,
|
|
1482
1684
|
email: itContact.email,
|
|
1483
|
-
createdAt: itContact.created_at,
|
|
1484
|
-
updatedAt: itContact.updated_at
|
|
1685
|
+
createdAt: new Date(itContact.created_at),
|
|
1686
|
+
updatedAt: new Date(itContact.updated_at)
|
|
1485
1687
|
});
|
|
1486
1688
|
//#endregion
|
|
1487
1689
|
//#region src/organizations/serializers/update-organization-options.serializer.ts
|
|
@@ -1502,8 +1704,31 @@ const deserializeConnection = (connection) => ({
|
|
|
1502
1704
|
type: connection.connection_type,
|
|
1503
1705
|
state: connection.state,
|
|
1504
1706
|
domains: connection.domains,
|
|
1505
|
-
createdAt: connection.created_at,
|
|
1506
|
-
updatedAt: connection.updated_at
|
|
1707
|
+
createdAt: new Date(connection.created_at),
|
|
1708
|
+
updatedAt: new Date(connection.updated_at)
|
|
1709
|
+
});
|
|
1710
|
+
//#endregion
|
|
1711
|
+
//#region src/sso/serializers/connection-event.serializer.ts
|
|
1712
|
+
const deserializeConnectionEventConnection = (connection) => ({
|
|
1713
|
+
id: connection.id,
|
|
1714
|
+
...connection.organization_id !== void 0 && { organizationId: connection.organization_id }
|
|
1715
|
+
});
|
|
1716
|
+
const deserializeConnectionSamlCertificateRenewalRequiredEvent = (data) => ({
|
|
1717
|
+
connection: deserializeConnectionEventConnection(data.connection),
|
|
1718
|
+
certificate: {
|
|
1719
|
+
certificateType: data.certificate.certificate_type,
|
|
1720
|
+
expiryDate: new Date(data.certificate.expiry_date),
|
|
1721
|
+
isExpired: data.certificate.is_expired
|
|
1722
|
+
},
|
|
1723
|
+
daysUntilExpiry: data.days_until_expiry
|
|
1724
|
+
});
|
|
1725
|
+
const deserializeConnectionSamlCertificateRenewedEvent = (data) => ({
|
|
1726
|
+
connection: deserializeConnectionEventConnection(data.connection),
|
|
1727
|
+
certificate: {
|
|
1728
|
+
certificateType: data.certificate.certificate_type,
|
|
1729
|
+
expiryDate: new Date(data.certificate.expiry_date)
|
|
1730
|
+
},
|
|
1731
|
+
renewedAt: new Date(data.renewed_at)
|
|
1507
1732
|
});
|
|
1508
1733
|
//#endregion
|
|
1509
1734
|
//#region src/sso/serializers/list-connections-options.serializer.ts
|
|
@@ -1519,20 +1744,21 @@ const serializeListConnectionsOptions = (options) => ({
|
|
|
1519
1744
|
//#endregion
|
|
1520
1745
|
//#region src/sso/serializers/profile.serializer.ts
|
|
1521
1746
|
const deserializeProfile = (profile) => ({
|
|
1747
|
+
object: profile.object,
|
|
1522
1748
|
id: profile.id,
|
|
1523
1749
|
idpId: profile.idp_id,
|
|
1524
|
-
|
|
1750
|
+
organizationId: profile.organization_id ?? null,
|
|
1525
1751
|
connectionId: profile.connection_id,
|
|
1526
1752
|
connectionType: profile.connection_type,
|
|
1527
1753
|
email: profile.email,
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1754
|
+
name: profile.name ?? null,
|
|
1755
|
+
firstName: profile.first_name ?? null,
|
|
1756
|
+
lastName: profile.last_name ?? null,
|
|
1531
1757
|
...profile.role !== void 0 && { role: profile.role },
|
|
1532
1758
|
...profile.roles !== void 0 && { roles: profile.roles },
|
|
1533
1759
|
...profile.groups !== void 0 && { groups: profile.groups },
|
|
1534
1760
|
...profile.custom_attributes !== void 0 && { customAttributes: profile.custom_attributes },
|
|
1535
|
-
|
|
1761
|
+
rawAttributes: profile.raw_attributes
|
|
1536
1762
|
});
|
|
1537
1763
|
//#endregion
|
|
1538
1764
|
//#region src/sso/serializers/profile-and-token.serializer.ts
|
|
@@ -1548,8 +1774,8 @@ const deserializeRoleEvent = (role) => ({
|
|
|
1548
1774
|
slug: role.slug,
|
|
1549
1775
|
resourceTypeSlug: role.resource_type_slug,
|
|
1550
1776
|
permissions: role.permissions,
|
|
1551
|
-
createdAt: role.created_at,
|
|
1552
|
-
updatedAt: role.updated_at
|
|
1777
|
+
createdAt: new Date(role.created_at),
|
|
1778
|
+
updatedAt: new Date(role.updated_at)
|
|
1553
1779
|
});
|
|
1554
1780
|
//#endregion
|
|
1555
1781
|
//#region src/user-management/serializers/authentication-radar-risk-event-serializer.ts
|
|
@@ -1576,10 +1802,11 @@ function deserializeApiKey(apiKey) {
|
|
|
1576
1802
|
} : apiKey.owner,
|
|
1577
1803
|
name: apiKey.name,
|
|
1578
1804
|
obfuscatedValue: apiKey.obfuscated_value,
|
|
1579
|
-
lastUsedAt: apiKey.last_used_at,
|
|
1805
|
+
lastUsedAt: apiKey.last_used_at != null ? new Date(apiKey.last_used_at) : null,
|
|
1806
|
+
expiresAt: apiKey.expires_at != null ? new Date(apiKey.expires_at) : null,
|
|
1580
1807
|
permissions: apiKey.permissions,
|
|
1581
|
-
createdAt: apiKey.created_at,
|
|
1582
|
-
updatedAt: apiKey.updated_at
|
|
1808
|
+
createdAt: new Date(apiKey.created_at),
|
|
1809
|
+
updatedAt: new Date(apiKey.updated_at)
|
|
1583
1810
|
};
|
|
1584
1811
|
}
|
|
1585
1812
|
//#endregion
|
|
@@ -1593,8 +1820,8 @@ const deserializeRole = (role) => ({
|
|
|
1593
1820
|
permissions: role.permissions,
|
|
1594
1821
|
resourceTypeSlug: role.resource_type_slug,
|
|
1595
1822
|
type: role.type,
|
|
1596
|
-
createdAt: role.created_at,
|
|
1597
|
-
updatedAt: role.updated_at
|
|
1823
|
+
createdAt: new Date(role.created_at),
|
|
1824
|
+
updatedAt: new Date(role.updated_at)
|
|
1598
1825
|
});
|
|
1599
1826
|
const deserializeOrganizationRole = (role) => ({
|
|
1600
1827
|
object: role.object,
|
|
@@ -1605,8 +1832,8 @@ const deserializeOrganizationRole = (role) => ({
|
|
|
1605
1832
|
permissions: role.permissions,
|
|
1606
1833
|
resourceTypeSlug: role.resource_type_slug,
|
|
1607
1834
|
type: "OrganizationRole",
|
|
1608
|
-
createdAt: role.created_at,
|
|
1609
|
-
updatedAt: role.updated_at
|
|
1835
|
+
createdAt: new Date(role.created_at),
|
|
1836
|
+
updatedAt: new Date(role.updated_at)
|
|
1610
1837
|
});
|
|
1611
1838
|
const deserializeOrganizationRoleEvent = (event) => ({
|
|
1612
1839
|
object: event.object,
|
|
@@ -1616,8 +1843,8 @@ const deserializeOrganizationRoleEvent = (event) => ({
|
|
|
1616
1843
|
description: event.description,
|
|
1617
1844
|
resourceTypeSlug: event.resource_type_slug,
|
|
1618
1845
|
permissions: event.permissions,
|
|
1619
|
-
createdAt: event.created_at,
|
|
1620
|
-
updatedAt: event.updated_at
|
|
1846
|
+
createdAt: new Date(event.created_at),
|
|
1847
|
+
updatedAt: new Date(event.updated_at)
|
|
1621
1848
|
});
|
|
1622
1849
|
//#endregion
|
|
1623
1850
|
//#region src/authorization/serializers/permission.serializer.ts
|
|
@@ -1629,8 +1856,8 @@ const deserializePermission = (permission) => ({
|
|
|
1629
1856
|
description: permission.description,
|
|
1630
1857
|
resourceTypeSlug: permission.resource_type_slug,
|
|
1631
1858
|
system: permission.system,
|
|
1632
|
-
createdAt: permission.created_at,
|
|
1633
|
-
updatedAt: permission.updated_at
|
|
1859
|
+
createdAt: new Date(permission.created_at),
|
|
1860
|
+
updatedAt: new Date(permission.updated_at)
|
|
1634
1861
|
});
|
|
1635
1862
|
//#endregion
|
|
1636
1863
|
//#region src/feature-flags/serializers/feature-flag.serializer.ts
|
|
@@ -1643,8 +1870,8 @@ const deserializeFeatureFlag = (featureFlag) => ({
|
|
|
1643
1870
|
tags: featureFlag.tags,
|
|
1644
1871
|
enabled: featureFlag.enabled,
|
|
1645
1872
|
defaultValue: featureFlag.default_value,
|
|
1646
|
-
createdAt: featureFlag.created_at,
|
|
1647
|
-
updatedAt: featureFlag.updated_at
|
|
1873
|
+
createdAt: new Date(featureFlag.created_at),
|
|
1874
|
+
updatedAt: new Date(featureFlag.updated_at)
|
|
1648
1875
|
});
|
|
1649
1876
|
//#endregion
|
|
1650
1877
|
//#region src/groups/serializers/create-group.serializer.ts
|
|
@@ -1724,6 +1951,20 @@ const deserializeVaultByokKeyVerificationCompletedEvent = (data) => ({
|
|
|
1724
1951
|
keyProvider: data.key_provider,
|
|
1725
1952
|
verified: data.verified
|
|
1726
1953
|
});
|
|
1954
|
+
const deserializeVaultKekDeletedEvent = (data) => ({
|
|
1955
|
+
...deserializeVaultActor(data),
|
|
1956
|
+
keyName: data.key_name,
|
|
1957
|
+
keyId: data.key_id
|
|
1958
|
+
});
|
|
1959
|
+
const deserializeVaultDekRekeyedEvent = (data) => ({
|
|
1960
|
+
...deserializeVaultActor(data),
|
|
1961
|
+
keyIds: data.key_ids,
|
|
1962
|
+
keyContext: data.key_context
|
|
1963
|
+
});
|
|
1964
|
+
const deserializeVaultByokKeyDeletedEvent = (data) => ({
|
|
1965
|
+
organizationId: data.organization_id,
|
|
1966
|
+
keyProvider: data.key_provider
|
|
1967
|
+
});
|
|
1727
1968
|
//#endregion
|
|
1728
1969
|
//#region src/organization-domains/serializers/organization-domain-verification-failed.serializer.ts
|
|
1729
1970
|
const deserializeOrganizationDomainVerificationFailed = (organizationDomainVerificationFailed) => ({
|
|
@@ -1731,6 +1972,51 @@ const deserializeOrganizationDomainVerificationFailed = (organizationDomainVerif
|
|
|
1731
1972
|
organizationDomain: deserializeOrganizationDomain(organizationDomainVerificationFailed.organization_domain)
|
|
1732
1973
|
});
|
|
1733
1974
|
//#endregion
|
|
1975
|
+
//#region src/actions/serializers/action-event.serializer.ts
|
|
1976
|
+
const deserializeActionAuthenticationDeniedEvent = (data) => ({
|
|
1977
|
+
actionEndpointId: data.action_endpoint_id,
|
|
1978
|
+
actionExecutionId: data.action_execution_id,
|
|
1979
|
+
type: data.type,
|
|
1980
|
+
verdict: data.verdict,
|
|
1981
|
+
userId: data.user_id,
|
|
1982
|
+
organizationId: data.organization_id,
|
|
1983
|
+
email: data.email,
|
|
1984
|
+
ipAddress: data.ip_address,
|
|
1985
|
+
userAgent: data.user_agent
|
|
1986
|
+
});
|
|
1987
|
+
const deserializeActionUserRegistrationDeniedEvent = (data) => ({
|
|
1988
|
+
actionEndpointId: data.action_endpoint_id,
|
|
1989
|
+
actionExecutionId: data.action_execution_id,
|
|
1990
|
+
type: data.type,
|
|
1991
|
+
verdict: data.verdict,
|
|
1992
|
+
organizationId: data.organization_id,
|
|
1993
|
+
email: data.email,
|
|
1994
|
+
ipAddress: data.ip_address,
|
|
1995
|
+
userAgent: data.user_agent
|
|
1996
|
+
});
|
|
1997
|
+
//#endregion
|
|
1998
|
+
//#region src/api-keys/serializers/api-key-event.serializer.ts
|
|
1999
|
+
function deserializeApiKeyUpdatedEvent(data) {
|
|
2000
|
+
return {
|
|
2001
|
+
...deserializeApiKey(data),
|
|
2002
|
+
previousAttributes: { expiresAt: data.previous_attributes.expires_at != null ? new Date(data.previous_attributes.expires_at) : null }
|
|
2003
|
+
};
|
|
2004
|
+
}
|
|
2005
|
+
//#endregion
|
|
2006
|
+
//#region src/radar/serializers/radar-event.serializer.ts
|
|
2007
|
+
const deserializeRadarChallengeCreatedEvent = (data) => ({
|
|
2008
|
+
type: data.type,
|
|
2009
|
+
radarChallengeId: data.radar_challenge_id,
|
|
2010
|
+
userId: data.user_id,
|
|
2011
|
+
email: data.email
|
|
2012
|
+
});
|
|
2013
|
+
//#endregion
|
|
2014
|
+
//#region src/common/serializers/resource-export-event.serializer.ts
|
|
2015
|
+
const deserializeResourceExportEvent = (data) => ({
|
|
2016
|
+
id: data.id,
|
|
2017
|
+
resourceType: data.resource_type
|
|
2018
|
+
});
|
|
2019
|
+
//#endregion
|
|
1734
2020
|
//#region src/common/serializers/event.serializer.ts
|
|
1735
2021
|
const deserializePipesConnectedAccount = (connectedAccount) => ({
|
|
1736
2022
|
object: connectedAccount.object,
|
|
@@ -1741,8 +2027,8 @@ const deserializePipesConnectedAccount = (connectedAccount) => ({
|
|
|
1741
2027
|
organizationId: connectedAccount.organization_id,
|
|
1742
2028
|
scopes: connectedAccount.scopes,
|
|
1743
2029
|
state: connectedAccount.state,
|
|
1744
|
-
createdAt: connectedAccount.created_at,
|
|
1745
|
-
updatedAt: connectedAccount.updated_at
|
|
2030
|
+
createdAt: new Date(connectedAccount.created_at),
|
|
2031
|
+
updatedAt: new Date(connectedAccount.updated_at)
|
|
1746
2032
|
});
|
|
1747
2033
|
const deserializePipesConnectionFailed = (connectionFailed) => ({
|
|
1748
2034
|
object: connectionFailed.object,
|
|
@@ -1750,22 +2036,95 @@ const deserializePipesConnectionFailed = (connectionFailed) => ({
|
|
|
1750
2036
|
providerSlug: connectionFailed.provider_slug,
|
|
1751
2037
|
userId: connectionFailed.user_id,
|
|
1752
2038
|
organizationId: connectionFailed.organization_id,
|
|
2039
|
+
...connectionFailed.account_identifier !== void 0 && { accountIdentifier: connectionFailed.account_identifier },
|
|
1753
2040
|
errorCode: connectionFailed.error_code,
|
|
1754
2041
|
errorReason: connectionFailed.error_reason,
|
|
1755
2042
|
providerError: connectionFailed.provider_error,
|
|
1756
2043
|
providerErrorDescription: connectionFailed.provider_error_description,
|
|
1757
|
-
createdAt: connectionFailed.created_at
|
|
2044
|
+
createdAt: new Date(connectionFailed.created_at)
|
|
1758
2045
|
});
|
|
1759
2046
|
const deserializeEvent = (event) => {
|
|
1760
2047
|
const eventBase = {
|
|
1761
2048
|
id: event.id,
|
|
1762
|
-
createdAt: event.created_at,
|
|
2049
|
+
createdAt: new Date(event.created_at),
|
|
1763
2050
|
context: event.context
|
|
1764
2051
|
};
|
|
2052
|
+
const knownEvent = deserializeKnownEvent(event, eventBase);
|
|
2053
|
+
if (knownEvent) return knownEvent;
|
|
2054
|
+
const unknownEvent = event;
|
|
2055
|
+
return {
|
|
2056
|
+
...eventBase,
|
|
2057
|
+
event: unknownEvent.event,
|
|
2058
|
+
data: unknownEvent.data
|
|
2059
|
+
};
|
|
2060
|
+
};
|
|
2061
|
+
function deserializeKnownEvent(event, eventBase) {
|
|
1765
2062
|
switch (event.event) {
|
|
2063
|
+
case "agent.blueprint.created":
|
|
2064
|
+
case "agent.blueprint.updated": return {
|
|
2065
|
+
...eventBase,
|
|
2066
|
+
event: event.event,
|
|
2067
|
+
data: deserializeAgentBlueprintEvent(event.data)
|
|
2068
|
+
};
|
|
2069
|
+
case "agent.blueprint.deleted": return {
|
|
2070
|
+
...eventBase,
|
|
2071
|
+
event: event.event,
|
|
2072
|
+
data: deserializeAgentBlueprintDeletedEvent(event.data)
|
|
2073
|
+
};
|
|
2074
|
+
case "agent.instance.created":
|
|
2075
|
+
case "agent.instance.deleted": return {
|
|
2076
|
+
...eventBase,
|
|
2077
|
+
event: event.event,
|
|
2078
|
+
data: deserializeAgentInstance(event.data)
|
|
2079
|
+
};
|
|
2080
|
+
case "agent.instance.session.created": return {
|
|
2081
|
+
...eventBase,
|
|
2082
|
+
event: event.event,
|
|
2083
|
+
data: deserializeAgentInstanceSessionCreatedEvent(event.data)
|
|
2084
|
+
};
|
|
2085
|
+
case "agent.instance.session.revoked": return {
|
|
2086
|
+
...eventBase,
|
|
2087
|
+
event: event.event,
|
|
2088
|
+
data: deserializeAgentInstanceSessionEvent(event.data)
|
|
2089
|
+
};
|
|
2090
|
+
case "agent.registration.created": return {
|
|
2091
|
+
...eventBase,
|
|
2092
|
+
event: event.event,
|
|
2093
|
+
data: deserializeAgentRegistrationCreatedEvent(event.data)
|
|
2094
|
+
};
|
|
2095
|
+
case "agent.registration.claim.attempt.created": return {
|
|
2096
|
+
...eventBase,
|
|
2097
|
+
event: event.event,
|
|
2098
|
+
data: deserializeAgentRegistrationClaimAttemptCreatedEvent(event.data)
|
|
2099
|
+
};
|
|
2100
|
+
case "agent.registration.claim.completed": return {
|
|
2101
|
+
...eventBase,
|
|
2102
|
+
event: event.event,
|
|
2103
|
+
data: deserializeAgentRegistrationClaimCompletedEvent(event.data)
|
|
2104
|
+
};
|
|
2105
|
+
case "agent.registration.credential.issued": return {
|
|
2106
|
+
...eventBase,
|
|
2107
|
+
event: event.event,
|
|
2108
|
+
data: deserializeAgentRegistrationCredentialIssuedEvent(event.data)
|
|
2109
|
+
};
|
|
2110
|
+
case "agent.registration.organization.switched": return {
|
|
2111
|
+
...eventBase,
|
|
2112
|
+
event: event.event,
|
|
2113
|
+
data: deserializeAgentRegistrationOrganizationSwitchedEvent(event.data)
|
|
2114
|
+
};
|
|
2115
|
+
case "agent.registration.refreshed":
|
|
2116
|
+
case "agent.registration.expired":
|
|
2117
|
+
case "agent.registration.revoked":
|
|
2118
|
+
case "agent.registration.deleted": return {
|
|
2119
|
+
...eventBase,
|
|
2120
|
+
event: event.event,
|
|
2121
|
+
data: deserializeAgentRegistrationLifecycleEvent(event.data)
|
|
2122
|
+
};
|
|
2123
|
+
case "authentication.email_verification_failed":
|
|
1766
2124
|
case "authentication.email_verification_succeeded":
|
|
1767
2125
|
case "authentication.magic_auth_failed":
|
|
1768
2126
|
case "authentication.magic_auth_succeeded":
|
|
2127
|
+
case "authentication.mfa_failed":
|
|
1769
2128
|
case "authentication.mfa_succeeded":
|
|
1770
2129
|
case "authentication.oauth_failed":
|
|
1771
2130
|
case "authentication.oauth_succeeded":
|
|
@@ -1773,8 +2132,11 @@ const deserializeEvent = (event) => {
|
|
|
1773
2132
|
case "authentication.passkey_succeeded":
|
|
1774
2133
|
case "authentication.password_failed":
|
|
1775
2134
|
case "authentication.password_succeeded":
|
|
2135
|
+
case "authentication.reauthentication_succeeded":
|
|
1776
2136
|
case "authentication.sso_failed":
|
|
1777
|
-
case "authentication.
|
|
2137
|
+
case "authentication.sso_started":
|
|
2138
|
+
case "authentication.sso_succeeded":
|
|
2139
|
+
case "authentication.sso_timed_out": return {
|
|
1778
2140
|
...eventBase,
|
|
1779
2141
|
event: event.event,
|
|
1780
2142
|
data: deserializeAuthenticationEvent(event.data)
|
|
@@ -2010,13 +2372,88 @@ const deserializeEvent = (event) => {
|
|
|
2010
2372
|
event: event.event,
|
|
2011
2373
|
data: deserializeVaultByokKeyVerificationCompletedEvent(event.data)
|
|
2012
2374
|
};
|
|
2013
|
-
|
|
2375
|
+
case "action.authentication.denied": return {
|
|
2376
|
+
...eventBase,
|
|
2377
|
+
event: event.event,
|
|
2378
|
+
data: deserializeActionAuthenticationDeniedEvent(event.data)
|
|
2379
|
+
};
|
|
2380
|
+
case "action.user_registration.denied": return {
|
|
2381
|
+
...eventBase,
|
|
2382
|
+
event: event.event,
|
|
2383
|
+
data: deserializeActionUserRegistrationDeniedEvent(event.data)
|
|
2384
|
+
};
|
|
2385
|
+
case "api_key.updated": return {
|
|
2386
|
+
...eventBase,
|
|
2387
|
+
event: event.event,
|
|
2388
|
+
data: deserializeApiKeyUpdatedEvent(event.data)
|
|
2389
|
+
};
|
|
2390
|
+
case "connection.saml_certificate_renewal_required": return {
|
|
2391
|
+
...eventBase,
|
|
2392
|
+
event: event.event,
|
|
2393
|
+
data: deserializeConnectionSamlCertificateRenewalRequiredEvent(event.data)
|
|
2394
|
+
};
|
|
2395
|
+
case "connection.saml_certificate_renewed": return {
|
|
2014
2396
|
...eventBase,
|
|
2015
2397
|
event: event.event,
|
|
2016
|
-
data: event.data
|
|
2398
|
+
data: deserializeConnectionSamlCertificateRenewedEvent(event.data)
|
|
2017
2399
|
};
|
|
2400
|
+
case "dsync.token.created":
|
|
2401
|
+
case "dsync.token.revoked": return {
|
|
2402
|
+
...eventBase,
|
|
2403
|
+
event: event.event,
|
|
2404
|
+
data: deserializeDirectoryToken(event.data)
|
|
2405
|
+
};
|
|
2406
|
+
case "pipes.account_connection.connected":
|
|
2407
|
+
case "pipes.account_connection.disconnected":
|
|
2408
|
+
case "pipes.account_connection.reauthorization_needed": return {
|
|
2409
|
+
...eventBase,
|
|
2410
|
+
event: event.event,
|
|
2411
|
+
data: deserializePipesConnectedAccount(event.data)
|
|
2412
|
+
};
|
|
2413
|
+
case "pipes.account_connection.add_failed":
|
|
2414
|
+
case "pipes.account_connection.connection_failed": return {
|
|
2415
|
+
...eventBase,
|
|
2416
|
+
event: event.event,
|
|
2417
|
+
data: deserializePipesConnectionFailed(event.data)
|
|
2418
|
+
};
|
|
2419
|
+
case "radar.challenge_created": return {
|
|
2420
|
+
...eventBase,
|
|
2421
|
+
event: event.event,
|
|
2422
|
+
data: deserializeRadarChallengeCreatedEvent(event.data)
|
|
2423
|
+
};
|
|
2424
|
+
case "resource_export.completed":
|
|
2425
|
+
case "resource_export.created":
|
|
2426
|
+
case "resource_export.downloaded":
|
|
2427
|
+
case "resource_export.failed": return {
|
|
2428
|
+
...eventBase,
|
|
2429
|
+
event: event.event,
|
|
2430
|
+
data: deserializeResourceExportEvent(event.data)
|
|
2431
|
+
};
|
|
2432
|
+
case "vault.byok_key.deleted": return {
|
|
2433
|
+
...eventBase,
|
|
2434
|
+
event: event.event,
|
|
2435
|
+
data: deserializeVaultByokKeyDeletedEvent(event.data)
|
|
2436
|
+
};
|
|
2437
|
+
case "vault.dek.rekeyed": return {
|
|
2438
|
+
...eventBase,
|
|
2439
|
+
event: event.event,
|
|
2440
|
+
data: deserializeVaultDekRekeyedEvent(event.data)
|
|
2441
|
+
};
|
|
2442
|
+
case "vault.kek.deleted": return {
|
|
2443
|
+
...eventBase,
|
|
2444
|
+
event: event.event,
|
|
2445
|
+
data: deserializeVaultKekDeletedEvent(event.data)
|
|
2446
|
+
};
|
|
2447
|
+
case "waitlist_user.approved":
|
|
2448
|
+
case "waitlist_user.created":
|
|
2449
|
+
case "waitlist_user.denied": return {
|
|
2450
|
+
...eventBase,
|
|
2451
|
+
event: event.event,
|
|
2452
|
+
data: deserializeWaitlistUserEvent(event.data)
|
|
2453
|
+
};
|
|
2454
|
+
default: return;
|
|
2018
2455
|
}
|
|
2019
|
-
}
|
|
2456
|
+
}
|
|
2020
2457
|
//#endregion
|
|
2021
2458
|
//#region src/common/serializers/list.serializer.ts
|
|
2022
2459
|
const deserializeList = (list, deserializer) => ({
|
|
@@ -2241,61 +2678,7 @@ let _josePromise;
|
|
|
2241
2678
|
* @returns Promise that resolves to the jose module
|
|
2242
2679
|
*/
|
|
2243
2680
|
function getJose() {
|
|
2244
|
-
return _josePromise ??= import("./webapi-
|
|
2245
|
-
}
|
|
2246
|
-
//#endregion
|
|
2247
|
-
//#region src/agents/serializers/agent-blueprint.serializer.ts
|
|
2248
|
-
function deserializeAgentBlueprint(blueprint) {
|
|
2249
|
-
return {
|
|
2250
|
-
object: blueprint.object,
|
|
2251
|
-
id: blueprint.id,
|
|
2252
|
-
name: blueprint.name,
|
|
2253
|
-
description: blueprint.description,
|
|
2254
|
-
permissions: blueprint.permissions,
|
|
2255
|
-
invocableBy: {
|
|
2256
|
-
roleSlugs: blueprint.invocable_by.role_slugs,
|
|
2257
|
-
organizationIds: blueprint.invocable_by.organization_ids
|
|
2258
|
-
},
|
|
2259
|
-
sessionSettings: {
|
|
2260
|
-
maxAgeSeconds: blueprint.session_settings.max_age_seconds,
|
|
2261
|
-
accessTokenTtlSeconds: blueprint.session_settings.access_token_ttl_seconds,
|
|
2262
|
-
refreshTokenTtlSeconds: blueprint.session_settings.refresh_token_ttl_seconds
|
|
2263
|
-
},
|
|
2264
|
-
createdAt: blueprint.created_at,
|
|
2265
|
-
updatedAt: blueprint.updated_at
|
|
2266
|
-
};
|
|
2267
|
-
}
|
|
2268
|
-
function serializeCreateAgentBlueprintOptions(options) {
|
|
2269
|
-
return {
|
|
2270
|
-
name: options.name,
|
|
2271
|
-
...options.description !== void 0 && { description: options.description },
|
|
2272
|
-
...options.permissions !== void 0 && { permissions: options.permissions },
|
|
2273
|
-
...options.invocableBy !== void 0 && { invocable_by: {
|
|
2274
|
-
...options.invocableBy.roleSlugs !== void 0 && { role_slugs: options.invocableBy.roleSlugs },
|
|
2275
|
-
...options.invocableBy.organizationIds !== void 0 && { organization_ids: options.invocableBy.organizationIds }
|
|
2276
|
-
} },
|
|
2277
|
-
session_settings: {
|
|
2278
|
-
max_age_seconds: options.sessionSettings.maxAgeSeconds,
|
|
2279
|
-
access_token_ttl_seconds: options.sessionSettings.accessTokenTtlSeconds,
|
|
2280
|
-
refresh_token_ttl_seconds: options.sessionSettings.refreshTokenTtlSeconds
|
|
2281
|
-
}
|
|
2282
|
-
};
|
|
2283
|
-
}
|
|
2284
|
-
function serializeUpdateAgentBlueprintOptions(options) {
|
|
2285
|
-
return {
|
|
2286
|
-
...options.name !== void 0 && { name: options.name },
|
|
2287
|
-
...options.description !== void 0 && { description: options.description },
|
|
2288
|
-
...options.permissions !== void 0 && { permissions: options.permissions },
|
|
2289
|
-
...options.invocableBy !== void 0 && { invocable_by: {
|
|
2290
|
-
...options.invocableBy.roleSlugs !== void 0 && { role_slugs: options.invocableBy.roleSlugs },
|
|
2291
|
-
...options.invocableBy.organizationIds !== void 0 && { organization_ids: options.invocableBy.organizationIds }
|
|
2292
|
-
} },
|
|
2293
|
-
...options.sessionSettings !== void 0 && { session_settings: {
|
|
2294
|
-
...options.sessionSettings.maxAgeSeconds !== void 0 && { max_age_seconds: options.sessionSettings.maxAgeSeconds },
|
|
2295
|
-
...options.sessionSettings.accessTokenTtlSeconds !== void 0 && { access_token_ttl_seconds: options.sessionSettings.accessTokenTtlSeconds },
|
|
2296
|
-
...options.sessionSettings.refreshTokenTtlSeconds !== void 0 && { refresh_token_ttl_seconds: options.sessionSettings.refreshTokenTtlSeconds }
|
|
2297
|
-
} }
|
|
2298
|
-
};
|
|
2681
|
+
return _josePromise ??= import("./webapi-CfgZkeeN.mjs");
|
|
2299
2682
|
}
|
|
2300
2683
|
//#endregion
|
|
2301
2684
|
//#region src/agents/serializers/agent-instance-session.serializer.ts
|
|
@@ -2305,10 +2688,10 @@ function deserializeAgentInstanceSession(session) {
|
|
|
2305
2688
|
id: session.id,
|
|
2306
2689
|
agentInstanceId: session.agent_instance_id,
|
|
2307
2690
|
status: session.status,
|
|
2308
|
-
expiresAt: session.expires_at,
|
|
2309
|
-
revokedAt: session.revoked_at,
|
|
2310
|
-
createdAt: session.created_at,
|
|
2311
|
-
updatedAt: session.updated_at
|
|
2691
|
+
expiresAt: new Date(session.expires_at),
|
|
2692
|
+
revokedAt: session.revoked_at != null ? new Date(session.revoked_at) : null,
|
|
2693
|
+
createdAt: new Date(session.created_at),
|
|
2694
|
+
updatedAt: new Date(session.updated_at)
|
|
2312
2695
|
};
|
|
2313
2696
|
}
|
|
2314
2697
|
function serializeListAgentInstanceSessionsOptions(options) {
|
|
@@ -2322,30 +2705,6 @@ function serializeListAgentInstanceSessionsOptions(options) {
|
|
|
2322
2705
|
};
|
|
2323
2706
|
}
|
|
2324
2707
|
//#endregion
|
|
2325
|
-
//#region src/agents/serializers/agent-instance.serializer.ts
|
|
2326
|
-
function deserializeAgentInstance(instance) {
|
|
2327
|
-
return {
|
|
2328
|
-
object: instance.object,
|
|
2329
|
-
id: instance.id,
|
|
2330
|
-
agentBlueprintId: instance.agent_blueprint_id,
|
|
2331
|
-
organizationId: instance.organization_id,
|
|
2332
|
-
organizationMembershipId: instance.organization_membership_id,
|
|
2333
|
-
type: instance.type,
|
|
2334
|
-
createdAt: instance.created_at,
|
|
2335
|
-
updatedAt: instance.updated_at
|
|
2336
|
-
};
|
|
2337
|
-
}
|
|
2338
|
-
function serializeListAgentInstancesOptions(options) {
|
|
2339
|
-
return {
|
|
2340
|
-
organization_id: options.organizationId,
|
|
2341
|
-
agent_blueprint_id: options.agentBlueprintId,
|
|
2342
|
-
limit: options.limit,
|
|
2343
|
-
before: options.before,
|
|
2344
|
-
after: options.after,
|
|
2345
|
-
order: options.order
|
|
2346
|
-
};
|
|
2347
|
-
}
|
|
2348
|
-
//#endregion
|
|
2349
2708
|
//#region src/agents/serializers/agent-registration.serializer.ts
|
|
2350
2709
|
function deserializeAgentRegistration(registration) {
|
|
2351
2710
|
return {
|
|
@@ -2353,27 +2712,28 @@ function deserializeAgentRegistration(registration) {
|
|
|
2353
2712
|
agentIdentity: {
|
|
2354
2713
|
id: registration.agent_identity.id,
|
|
2355
2714
|
userlandUserId: registration.agent_identity.userland_user_id,
|
|
2356
|
-
createdAt: registration.agent_identity.created_at,
|
|
2357
|
-
updatedAt: registration.agent_identity.updated_at
|
|
2715
|
+
createdAt: new Date(registration.agent_identity.created_at),
|
|
2716
|
+
updatedAt: new Date(registration.agent_identity.updated_at)
|
|
2358
2717
|
},
|
|
2359
2718
|
organizationId: registration.organization_id,
|
|
2360
2719
|
status: registration.status,
|
|
2361
2720
|
kind: registration.kind,
|
|
2721
|
+
revokedAt: registration.revoked_at != null ? new Date(registration.revoked_at) : null,
|
|
2362
2722
|
claim: registration.claim ? {
|
|
2363
2723
|
id: registration.claim.id,
|
|
2364
2724
|
claimCompletion: registration.claim.claim_completion ? {
|
|
2365
2725
|
id: registration.claim.claim_completion.id,
|
|
2366
|
-
createdAt: registration.claim.claim_completion.created_at,
|
|
2367
|
-
updatedAt: registration.claim.claim_completion.updated_at,
|
|
2368
|
-
expiresAt: registration.claim.claim_completion.expires_at,
|
|
2369
|
-
claimedAt: registration.claim.claim_completion.claimed_at
|
|
2726
|
+
createdAt: new Date(registration.claim.claim_completion.created_at),
|
|
2727
|
+
updatedAt: new Date(registration.claim.claim_completion.updated_at),
|
|
2728
|
+
expiresAt: new Date(registration.claim.claim_completion.expires_at),
|
|
2729
|
+
claimedAt: new Date(registration.claim.claim_completion.claimed_at)
|
|
2370
2730
|
} : null,
|
|
2371
|
-
createdAt: registration.claim.created_at,
|
|
2372
|
-
updatedAt: registration.claim.updated_at,
|
|
2373
|
-
expiresAt: registration.claim.expires_at
|
|
2731
|
+
createdAt: new Date(registration.claim.created_at),
|
|
2732
|
+
updatedAt: new Date(registration.claim.updated_at),
|
|
2733
|
+
expiresAt: new Date(registration.claim.expires_at)
|
|
2374
2734
|
} : null,
|
|
2375
|
-
createdAt: registration.created_at,
|
|
2376
|
-
updatedAt: registration.updated_at
|
|
2735
|
+
createdAt: new Date(registration.created_at),
|
|
2736
|
+
updatedAt: new Date(registration.updated_at)
|
|
2377
2737
|
};
|
|
2378
2738
|
}
|
|
2379
2739
|
//#endregion
|
|
@@ -2455,7 +2815,7 @@ function deserializeAgentCredentialValidation(validation) {
|
|
|
2455
2815
|
return {
|
|
2456
2816
|
valid: true,
|
|
2457
2817
|
registrationId: validation.registration_id,
|
|
2458
|
-
expiresAt: validation.expires_at,
|
|
2818
|
+
expiresAt: validation.expires_at != null ? new Date(validation.expires_at) : null,
|
|
2459
2819
|
claims: null
|
|
2460
2820
|
};
|
|
2461
2821
|
}
|
|
@@ -2733,7 +3093,7 @@ var Agents = class {
|
|
|
2733
3093
|
if (!options.checkForRevoked) return {
|
|
2734
3094
|
valid: true,
|
|
2735
3095
|
registrationId: claims.registrationId,
|
|
2736
|
-
expiresAt:
|
|
3096
|
+
expiresAt: /* @__PURE__ */ new Date(claims.expiresAt * 1e3),
|
|
2737
3097
|
claims
|
|
2738
3098
|
};
|
|
2739
3099
|
const remote = await this.validateCredentialRemotely(options);
|
|
@@ -2802,10 +3162,11 @@ function deserializeCreatedApiKey(apiKey) {
|
|
|
2802
3162
|
name: apiKey.name,
|
|
2803
3163
|
obfuscatedValue: apiKey.obfuscated_value,
|
|
2804
3164
|
value: apiKey.value,
|
|
2805
|
-
lastUsedAt: apiKey.last_used_at,
|
|
3165
|
+
lastUsedAt: apiKey.last_used_at != null ? new Date(apiKey.last_used_at) : null,
|
|
3166
|
+
expiresAt: apiKey.expires_at != null ? new Date(apiKey.expires_at) : null,
|
|
2806
3167
|
permissions: apiKey.permissions,
|
|
2807
|
-
createdAt: apiKey.created_at,
|
|
2808
|
-
updatedAt: apiKey.updated_at
|
|
3168
|
+
createdAt: new Date(apiKey.created_at),
|
|
3169
|
+
updatedAt: new Date(apiKey.updated_at)
|
|
2809
3170
|
};
|
|
2810
3171
|
}
|
|
2811
3172
|
//#endregion
|
|
@@ -3241,44 +3602,18 @@ var Connect = class {
|
|
|
3241
3602
|
}
|
|
3242
3603
|
};
|
|
3243
3604
|
//#endregion
|
|
3244
|
-
//#region src/common/utils/encode-path-parameter.ts
|
|
3245
|
-
/**
|
|
3246
|
-
* Encode a caller-supplied identifier for safe interpolation into a single URL
|
|
3247
|
-
* path segment.
|
|
3248
|
-
*
|
|
3249
|
-
* SDK path templates interpolate caller-supplied identifiers (user IDs,
|
|
3250
|
-
* invitation tokens, MFA factor IDs, organization IDs, external IDs, role and
|
|
3251
|
-
* permission slugs, ...) into the request path. Without encoding, a value such
|
|
3252
|
-
* as `../../user_management/users/user_01ABC` would be resolved by the WHATWG
|
|
3253
|
-
* `URL` parser (see `HttpClient.getResourceURL`) into a different API path,
|
|
3254
|
-
* letting an attacker who influences one identifier retarget the request to an
|
|
3255
|
-
* arbitrary same-verb endpoint. `encodeURIComponent` neutralizes this by
|
|
3256
|
-
* percent-encoding the path/query/fragment metacharacters (`/`, `?`, `#`, ...)
|
|
3257
|
-
* that enable the injection, keeping one parameter mapped to exactly one path
|
|
3258
|
-
* segment.
|
|
3259
|
-
*
|
|
3260
|
-
* `encodeURIComponent` alone is not sufficient for the two dot-only segments
|
|
3261
|
-
* `.` and `..`: it leaves them unchanged, and the WHATWG `URL` parser then
|
|
3262
|
-
* removes them as relative path segments (even when a value like `..` is a
|
|
3263
|
-
* single segment, a template such as `/feature-flags/${slug}/enable` supplies
|
|
3264
|
-
* the trailing segment, so `..` still climbs and retargets the request).
|
|
3265
|
-
* Percent-encoding the dots does not help because the parser also treats the
|
|
3266
|
-
* `%2e` forms as dot segments. A `.` or `..` is never a valid WorkOS
|
|
3267
|
-
* identifier, so we fail closed and throw rather than emit an ambiguous path.
|
|
3268
|
-
*
|
|
3269
|
-
* The one deviation from `encodeURIComponent` is that a literal `:` is kept
|
|
3270
|
-
* unescaped. Colons are valid path-segment characters (RFC 3986 `pchar`) and
|
|
3271
|
-
* are used by WorkOS RBAC slugs (e.g. `users:read`); an interpolated value is
|
|
3272
|
-
* always preceded by a `/`-delimited segment, so a `:` can never be read as a
|
|
3273
|
-
* URL scheme. Preserving it keeps the wire format identical for existing slugs.
|
|
3274
|
-
*/
|
|
3275
|
-
function encodePathParameter(value) {
|
|
3276
|
-
const encoded = encodeURIComponent(value).replace(/%3A/gi, ":");
|
|
3277
|
-
if (encoded === "." || encoded === "..") throw new TypeError("Invalid path parameter: a path parameter must not be \".\" or \"..\".");
|
|
3278
|
-
return encoded;
|
|
3279
|
-
}
|
|
3280
|
-
//#endregion
|
|
3281
3605
|
//#region src/directory-sync/directory-sync.ts
|
|
3606
|
+
const serializeListDirectoriesOptions = (options) => {
|
|
3607
|
+
const wire = {
|
|
3608
|
+
limit: options.limit,
|
|
3609
|
+
before: options.before,
|
|
3610
|
+
after: options.after,
|
|
3611
|
+
order: options.order
|
|
3612
|
+
};
|
|
3613
|
+
if (options.organizationId !== void 0) wire.organization_id = options.organizationId;
|
|
3614
|
+
if (options.search !== void 0) wire.search = options.search;
|
|
3615
|
+
return wire;
|
|
3616
|
+
};
|
|
3282
3617
|
var DirectorySync = class {
|
|
3283
3618
|
workos;
|
|
3284
3619
|
constructor(workos) {
|
|
@@ -3289,8 +3624,8 @@ var DirectorySync = class {
|
|
|
3289
3624
|
*
|
|
3290
3625
|
* Get a list of all of your existing directories matching the criteria specified.
|
|
3291
3626
|
* @param options - Pagination and filter options.
|
|
3292
|
-
* @returns {Promise<AutoPaginatable<Directory,
|
|
3293
|
-
* @throws 403
|
|
3627
|
+
* @returns {Promise<AutoPaginatable<Directory, PaginationOptions>>}
|
|
3628
|
+
* @throws {AuthorizationException} 403
|
|
3294
3629
|
* @throws {UnprocessableEntityException} 422
|
|
3295
3630
|
*/
|
|
3296
3631
|
async listDirectories(options) {
|
|
@@ -3300,33 +3635,31 @@ var DirectorySync = class {
|
|
|
3300
3635
|
* Get a Directory
|
|
3301
3636
|
*
|
|
3302
3637
|
* Get the details of an existing directory.
|
|
3303
|
-
* @param
|
|
3304
|
-
*
|
|
3305
|
-
* @example
|
|
3306
|
-
* "directory_01ECAZ4NV9QMV47GW873HDCX74"
|
|
3307
|
-
*
|
|
3638
|
+
* @param options - The request options.
|
|
3639
|
+
* @param options.id - Unique identifier for the Directory.
|
|
3640
|
+
* @example "directory_01ECAZ4NV9QMV47GW873HDCX74"
|
|
3308
3641
|
* @returns {Promise<Directory>}
|
|
3309
|
-
* @throws 403
|
|
3642
|
+
* @throws {AuthorizationException} 403
|
|
3310
3643
|
* @throws {NotFoundException} 404
|
|
3311
3644
|
*/
|
|
3312
|
-
async getDirectory(
|
|
3313
|
-
const {
|
|
3645
|
+
async getDirectory(options) {
|
|
3646
|
+
const { id } = options;
|
|
3647
|
+
const { data } = await this.workos.get(`/directories/${encodeURIComponent(id)}`);
|
|
3314
3648
|
return deserializeDirectory(data);
|
|
3315
3649
|
}
|
|
3316
3650
|
/**
|
|
3317
3651
|
* Delete a Directory
|
|
3318
3652
|
*
|
|
3319
3653
|
* Permanently deletes an existing directory. It cannot be undone.
|
|
3320
|
-
* @param
|
|
3321
|
-
*
|
|
3322
|
-
* @example
|
|
3323
|
-
* "directory_01ECAZ4NV9QMV47GW873HDCX74"
|
|
3324
|
-
*
|
|
3654
|
+
* @param options - The request options.
|
|
3655
|
+
* @param options.id - Unique identifier for the Directory.
|
|
3656
|
+
* @example "directory_01ECAZ4NV9QMV47GW873HDCX74"
|
|
3325
3657
|
* @returns {Promise<void>}
|
|
3326
|
-
* @throws 403
|
|
3658
|
+
* @throws {AuthorizationException} 403
|
|
3327
3659
|
*/
|
|
3328
|
-
async deleteDirectory(
|
|
3329
|
-
|
|
3660
|
+
async deleteDirectory(options) {
|
|
3661
|
+
const { id } = options;
|
|
3662
|
+
await this.workos.delete(`/directories/${encodeURIComponent(id)}`);
|
|
3330
3663
|
}
|
|
3331
3664
|
/**
|
|
3332
3665
|
* List Directory Groups
|
|
@@ -3334,12 +3667,29 @@ var DirectorySync = class {
|
|
|
3334
3667
|
* Get a list of all of existing directory groups matching the criteria specified.
|
|
3335
3668
|
* @param options - Pagination and filter options.
|
|
3336
3669
|
* @returns {Promise<AutoPaginatable<DirectoryGroup, ListDirectoryGroupsOptions>>}
|
|
3337
|
-
* @throws 403
|
|
3670
|
+
* @throws {AuthorizationException} 403
|
|
3338
3671
|
* @throws {NotFoundException} 404
|
|
3339
3672
|
* @throws {UnprocessableEntityException} 422
|
|
3340
3673
|
*/
|
|
3341
3674
|
async listGroups(options) {
|
|
3342
|
-
|
|
3675
|
+
const paginationOptions = options;
|
|
3676
|
+
return new AutoPaginatable(await fetchAndDeserialize(this.workos, "/directory_groups", deserializeDirectoryGroup, paginationOptions), (params) => fetchAndDeserialize(this.workos, "/directory_groups", deserializeDirectoryGroup, params), paginationOptions);
|
|
3677
|
+
}
|
|
3678
|
+
/**
|
|
3679
|
+
* Get a Directory Group
|
|
3680
|
+
*
|
|
3681
|
+
* Get the details of an existing Directory Group.
|
|
3682
|
+
* @param options - The request options.
|
|
3683
|
+
* @param options.id - Unique identifier for the Directory Group.
|
|
3684
|
+
* @example "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z"
|
|
3685
|
+
* @returns {Promise<DirectoryGroup>}
|
|
3686
|
+
* @throws {AuthorizationException} 403
|
|
3687
|
+
* @throws {NotFoundException} 404
|
|
3688
|
+
*/
|
|
3689
|
+
async getGroup(options) {
|
|
3690
|
+
const { id } = options;
|
|
3691
|
+
const { data } = await this.workos.get(`/directory_groups/${encodeURIComponent(id)}`);
|
|
3692
|
+
return deserializeDirectoryGroup(data);
|
|
3343
3693
|
}
|
|
3344
3694
|
/**
|
|
3345
3695
|
* List Directory Users
|
|
@@ -3347,7 +3697,7 @@ var DirectorySync = class {
|
|
|
3347
3697
|
* Get a list of all of existing Directory Users matching the criteria specified.
|
|
3348
3698
|
* @param options - Pagination and filter options.
|
|
3349
3699
|
* @returns {Promise<AutoPaginatable<DirectoryUserWithGroups<TCustomAttributes>, ListDirectoryUsersOptions>>}
|
|
3350
|
-
* @throws 403
|
|
3700
|
+
* @throws {AuthorizationException} 403
|
|
3351
3701
|
* @throws {NotFoundException} 404
|
|
3352
3702
|
* @throws {UnprocessableEntityException} 422
|
|
3353
3703
|
* @throws {RateLimitExceededException} 429
|
|
@@ -3359,34 +3709,18 @@ var DirectorySync = class {
|
|
|
3359
3709
|
* Get a Directory User
|
|
3360
3710
|
*
|
|
3361
3711
|
* Get the details of an existing Directory User.
|
|
3362
|
-
* @param
|
|
3363
|
-
*
|
|
3364
|
-
* @example
|
|
3365
|
-
* "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ"
|
|
3712
|
+
* @param options - The request options.
|
|
3713
|
+
* @param options.id - Unique identifier for the Directory User.
|
|
3714
|
+
* @example "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ"
|
|
3366
3715
|
* @returns {Promise<DirectoryUserWithGroups<TCustomAttributes>>}
|
|
3367
|
-
* @throws 403
|
|
3716
|
+
* @throws {AuthorizationException} 403
|
|
3368
3717
|
* @throws {NotFoundException} 404
|
|
3369
3718
|
*/
|
|
3370
|
-
async getUser(
|
|
3371
|
-
const {
|
|
3719
|
+
async getUser(options) {
|
|
3720
|
+
const { id } = options;
|
|
3721
|
+
const { data } = await this.workos.get(`/directory_users/${encodeURIComponent(id)}`);
|
|
3372
3722
|
return deserializeDirectoryUserWithGroups(data);
|
|
3373
3723
|
}
|
|
3374
|
-
/**
|
|
3375
|
-
* Get a Directory Group
|
|
3376
|
-
*
|
|
3377
|
-
* Get the details of an existing Directory Group.
|
|
3378
|
-
* @param group - Unique identifier for the Directory Group.
|
|
3379
|
-
*
|
|
3380
|
-
* @example
|
|
3381
|
-
* "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z"
|
|
3382
|
-
* @returns {Promise<DirectoryGroup>}
|
|
3383
|
-
* @throws 403 response from the API.
|
|
3384
|
-
* @throws {NotFoundException} 404
|
|
3385
|
-
*/
|
|
3386
|
-
async getGroup(group) {
|
|
3387
|
-
const { data } = await this.workos.get(`/directory_groups/${encodePathParameter(group)}`);
|
|
3388
|
-
return deserializeDirectoryGroup(data);
|
|
3389
|
-
}
|
|
3390
3724
|
};
|
|
3391
3725
|
//#endregion
|
|
3392
3726
|
//#region src/events/serializers/list-event-options.serializer.ts
|
|
@@ -3421,6 +3755,43 @@ var Events = class {
|
|
|
3421
3755
|
}
|
|
3422
3756
|
};
|
|
3423
3757
|
//#endregion
|
|
3758
|
+
//#region src/common/utils/encode-path-parameter.ts
|
|
3759
|
+
/**
|
|
3760
|
+
* Encode a caller-supplied identifier for safe interpolation into a single URL
|
|
3761
|
+
* path segment.
|
|
3762
|
+
*
|
|
3763
|
+
* SDK path templates interpolate caller-supplied identifiers (user IDs,
|
|
3764
|
+
* invitation tokens, MFA factor IDs, organization IDs, external IDs, role and
|
|
3765
|
+
* permission slugs, ...) into the request path. Without encoding, a value such
|
|
3766
|
+
* as `../../user_management/users/user_01ABC` would be resolved by the WHATWG
|
|
3767
|
+
* `URL` parser (see `HttpClient.getResourceURL`) into a different API path,
|
|
3768
|
+
* letting an attacker who influences one identifier retarget the request to an
|
|
3769
|
+
* arbitrary same-verb endpoint. `encodeURIComponent` neutralizes this by
|
|
3770
|
+
* percent-encoding the path/query/fragment metacharacters (`/`, `?`, `#`, ...)
|
|
3771
|
+
* that enable the injection, keeping one parameter mapped to exactly one path
|
|
3772
|
+
* segment.
|
|
3773
|
+
*
|
|
3774
|
+
* `encodeURIComponent` alone is not sufficient for the two dot-only segments
|
|
3775
|
+
* `.` and `..`: it leaves them unchanged, and the WHATWG `URL` parser then
|
|
3776
|
+
* removes them as relative path segments (even when a value like `..` is a
|
|
3777
|
+
* single segment, a template such as `/feature-flags/${slug}/enable` supplies
|
|
3778
|
+
* the trailing segment, so `..` still climbs and retargets the request).
|
|
3779
|
+
* Percent-encoding the dots does not help because the parser also treats the
|
|
3780
|
+
* `%2e` forms as dot segments. A `.` or `..` is never a valid WorkOS
|
|
3781
|
+
* identifier, so we fail closed and throw rather than emit an ambiguous path.
|
|
3782
|
+
*
|
|
3783
|
+
* The one deviation from `encodeURIComponent` is that a literal `:` is kept
|
|
3784
|
+
* unescaped. Colons are valid path-segment characters (RFC 3986 `pchar`) and
|
|
3785
|
+
* are used by WorkOS RBAC slugs (e.g. `users:read`); an interpolated value is
|
|
3786
|
+
* always preceded by a `/`-delimited segment, so a `:` can never be read as a
|
|
3787
|
+
* URL scheme. Preserving it keeps the wire format identical for existing slugs.
|
|
3788
|
+
*/
|
|
3789
|
+
function encodePathParameter(value) {
|
|
3790
|
+
const encoded = encodeURIComponent(value).replace(/%3A/gi, ":");
|
|
3791
|
+
if (encoded === "." || encoded === "..") throw new TypeError("Invalid path parameter: a path parameter must not be \".\" or \"..\".");
|
|
3792
|
+
return encoded;
|
|
3793
|
+
}
|
|
3794
|
+
//#endregion
|
|
3424
3795
|
//#region src/organizations/organizations.ts
|
|
3425
3796
|
var Organizations = class {
|
|
3426
3797
|
workos;
|
|
@@ -3677,7 +4048,7 @@ var OrganizationDomains = class {
|
|
|
3677
4048
|
const deserializePasswordlessSession = (passwordlessSession) => ({
|
|
3678
4049
|
id: passwordlessSession.id,
|
|
3679
4050
|
email: passwordlessSession.email,
|
|
3680
|
-
expiresAt: passwordlessSession.expires_at,
|
|
4051
|
+
expiresAt: new Date(passwordlessSession.expires_at),
|
|
3681
4052
|
link: passwordlessSession.link,
|
|
3682
4053
|
object: passwordlessSession.object
|
|
3683
4054
|
});
|
|
@@ -3709,6 +4080,17 @@ const deserializeDataIntegrationCredential = (response) => ({
|
|
|
3709
4080
|
redactedClientSecret: response.redacted_client_secret ?? null
|
|
3710
4081
|
});
|
|
3711
4082
|
//#endregion
|
|
4083
|
+
//#region src/pipes/serializers/data-integration-installation.serializer.ts
|
|
4084
|
+
const deserializeDataIntegrationInstallation = (response) => ({
|
|
4085
|
+
id: response.id,
|
|
4086
|
+
connectionRole: response.connection_role,
|
|
4087
|
+
accountIdentifier: response.account_identifier ?? null,
|
|
4088
|
+
accountDisplayName: response.account_display_name ?? null,
|
|
4089
|
+
userId: response.user_id ?? null,
|
|
4090
|
+
organizationId: response.organization_id ?? null,
|
|
4091
|
+
apiKeyLast4: response.api_key_last_4 ?? null
|
|
4092
|
+
});
|
|
4093
|
+
//#endregion
|
|
3712
4094
|
//#region src/pipes/serializers/data-integration-custom-provider.serializer.ts
|
|
3713
4095
|
const deserializeDataIntegrationCustomProvider = (response) => ({
|
|
3714
4096
|
name: response.name,
|
|
@@ -3730,12 +4112,16 @@ const deserializeDataIntegration = (response) => ({
|
|
|
3730
4112
|
id: response.id,
|
|
3731
4113
|
slug: response.slug,
|
|
3732
4114
|
integrationType: response.integration_type,
|
|
4115
|
+
ownership: response.ownership,
|
|
3733
4116
|
description: response.description ?? null,
|
|
3734
4117
|
enabled: response.enabled,
|
|
3735
4118
|
state: response.state,
|
|
3736
4119
|
scopes: response.scopes ?? null,
|
|
3737
4120
|
redirectUri: response.redirect_uri,
|
|
3738
|
-
|
|
4121
|
+
authMethods: response.auth_methods,
|
|
4122
|
+
credentials: response.credentials != null ? deserializeDataIntegrationCredential(response.credentials) : null,
|
|
4123
|
+
installation: response.installation != null ? deserializeDataIntegrationInstallation(response.installation) : null,
|
|
4124
|
+
config: response.config,
|
|
3739
4125
|
customProvider: response.custom_provider != null ? deserializeDataIntegrationCustomProvider(response.custom_provider) : null,
|
|
3740
4126
|
createdAt: new Date(response.created_at),
|
|
3741
4127
|
updatedAt: new Date(response.updated_at)
|
|
@@ -3745,35 +4131,71 @@ const deserializeDataIntegration = (response) => ({
|
|
|
3745
4131
|
const deserializeConnectedAccount = (response) => ({
|
|
3746
4132
|
object: response.object,
|
|
3747
4133
|
id: response.id,
|
|
4134
|
+
connectionRole: response.connection_role,
|
|
4135
|
+
accountIdentifier: response.account_identifier ?? null,
|
|
4136
|
+
accountDisplayName: response.account_display_name ?? null,
|
|
3748
4137
|
userId: response.user_id ?? null,
|
|
3749
4138
|
organizationId: response.organization_id ?? null,
|
|
3750
4139
|
scopes: response.scopes,
|
|
3751
4140
|
authMethod: response.auth_method,
|
|
3752
4141
|
apiKeyLast4: response.api_key_last_4 ?? null,
|
|
4142
|
+
clientId: response.client_id ?? null,
|
|
4143
|
+
clientSecretLast4: response.client_secret_last_4 ?? null,
|
|
4144
|
+
config: response.config,
|
|
3753
4145
|
state: response.state,
|
|
3754
|
-
createdAt: response.created_at,
|
|
3755
|
-
updatedAt: response.updated_at
|
|
4146
|
+
createdAt: new Date(response.created_at),
|
|
4147
|
+
updatedAt: new Date(response.updated_at)
|
|
3756
4148
|
});
|
|
3757
4149
|
//#endregion
|
|
3758
4150
|
//#region src/pipes/serializers/data-integration-authorize-url-response.serializer.ts
|
|
3759
4151
|
const deserializeDataIntegrationAuthorizeUrlResponse = (response) => ({ url: response.url });
|
|
3760
4152
|
//#endregion
|
|
3761
|
-
//#region src/pipes/serializers/data-integration-
|
|
3762
|
-
const
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
4153
|
+
//#region src/pipes/serializers/data-integration-vended-credential.serializer.ts
|
|
4154
|
+
const deserializeDataIntegrationVendedCredential = (response) => {
|
|
4155
|
+
switch (response.auth_method) {
|
|
4156
|
+
case "oauth": return {
|
|
4157
|
+
authMethod: "oauth",
|
|
4158
|
+
object: response.object,
|
|
4159
|
+
value: response.value,
|
|
4160
|
+
expiresAt: response.expires_at != null ? new Date(response.expires_at) : null,
|
|
4161
|
+
scopes: response.scopes,
|
|
4162
|
+
missingScopes: response.missing_scopes,
|
|
4163
|
+
config: response.config
|
|
4164
|
+
};
|
|
4165
|
+
case "api_key": return {
|
|
4166
|
+
authMethod: "api_key",
|
|
4167
|
+
object: response.object,
|
|
4168
|
+
value: response.value,
|
|
4169
|
+
config: response.config
|
|
4170
|
+
};
|
|
4171
|
+
case "client_credentials": return {
|
|
4172
|
+
authMethod: "client_credentials",
|
|
4173
|
+
object: response.object,
|
|
4174
|
+
value: response.value,
|
|
4175
|
+
expiresAt: response.expires_at != null ? new Date(response.expires_at) : null,
|
|
4176
|
+
scopes: response.scopes,
|
|
4177
|
+
missingScopes: response.missing_scopes,
|
|
4178
|
+
metadata: response.metadata,
|
|
4179
|
+
config: response.config
|
|
4180
|
+
};
|
|
4181
|
+
default: throw new Error("Unknown auth_method: " + String(response.auth_method));
|
|
4182
|
+
}
|
|
4183
|
+
};
|
|
3770
4184
|
//#endregion
|
|
3771
4185
|
//#region src/pipes/serializers/data-integration-credentials-response.serializer.ts
|
|
3772
|
-
const deserializeDataIntegrationCredentialsResponse = (response) =>
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
4186
|
+
const deserializeDataIntegrationCredentialsResponse = (response) => {
|
|
4187
|
+
switch (response.active) {
|
|
4188
|
+
case true: return {
|
|
4189
|
+
active: true,
|
|
4190
|
+
credential: deserializeDataIntegrationVendedCredential(response.credential)
|
|
4191
|
+
};
|
|
4192
|
+
case false: return {
|
|
4193
|
+
active: false,
|
|
4194
|
+
error: response.error
|
|
4195
|
+
};
|
|
4196
|
+
default: throw new Error("Unknown active: " + String(response.active));
|
|
4197
|
+
}
|
|
4198
|
+
};
|
|
3777
4199
|
//#endregion
|
|
3778
4200
|
//#region src/pipes/serializers/data-integration-access-token-response-access-token.serializer.ts
|
|
3779
4201
|
const deserializeDataIntegrationAccessTokenResponseAccessToken = (response) => ({
|
|
@@ -3803,14 +4225,20 @@ const deserializeDataIntegrationAccessTokenResponse = (response) => {
|
|
|
3803
4225
|
const deserializeDataIntegrationsListResponseDataConnectedAccount = (response) => ({
|
|
3804
4226
|
object: response.object,
|
|
3805
4227
|
id: response.id,
|
|
4228
|
+
connectionRole: response.connection_role,
|
|
4229
|
+
accountIdentifier: response.account_identifier ?? null,
|
|
4230
|
+
accountDisplayName: response.account_display_name ?? null,
|
|
3806
4231
|
userId: response.user_id ?? null,
|
|
3807
4232
|
organizationId: response.organization_id ?? null,
|
|
3808
4233
|
scopes: response.scopes,
|
|
3809
4234
|
authMethod: response.auth_method,
|
|
3810
4235
|
apiKeyLast4: response.api_key_last_4 ?? null,
|
|
4236
|
+
clientId: response.client_id ?? null,
|
|
4237
|
+
clientSecretLast4: response.client_secret_last_4 ?? null,
|
|
4238
|
+
config: response.config,
|
|
3811
4239
|
state: response.state,
|
|
3812
|
-
createdAt: response.created_at,
|
|
3813
|
-
updatedAt: response.updated_at,
|
|
4240
|
+
createdAt: new Date(response.created_at),
|
|
4241
|
+
updatedAt: new Date(response.updated_at),
|
|
3814
4242
|
userlandUserId: response.userland_user_id ?? null
|
|
3815
4243
|
});
|
|
3816
4244
|
//#endregion
|
|
@@ -3825,10 +4253,12 @@ const deserializeDataIntegrationsListResponseData = (response) => ({
|
|
|
3825
4253
|
credentialsType: response.credentials_type,
|
|
3826
4254
|
scopes: response.scopes ?? null,
|
|
3827
4255
|
authMethods: response.auth_methods,
|
|
4256
|
+
connectionOwner: response.connection_owner,
|
|
3828
4257
|
ownership: response.ownership,
|
|
3829
|
-
createdAt: response.created_at,
|
|
3830
|
-
updatedAt: response.updated_at,
|
|
3831
|
-
connectedAccount: response.connected_account != null ? deserializeDataIntegrationsListResponseDataConnectedAccount(response.connected_account) : null
|
|
4258
|
+
createdAt: new Date(response.created_at),
|
|
4259
|
+
updatedAt: new Date(response.updated_at),
|
|
4260
|
+
connectedAccount: response.connected_account != null ? deserializeDataIntegrationsListResponseDataConnectedAccount(response.connected_account) : null,
|
|
4261
|
+
connectedAccounts: response.connected_accounts != null ? response.connected_accounts.map(deserializeDataIntegrationsListResponseDataConnectedAccount) : void 0
|
|
3832
4262
|
});
|
|
3833
4263
|
//#endregion
|
|
3834
4264
|
//#region src/pipes/serializers/data-integrations-list-response.serializer.ts
|
|
@@ -3837,13 +4267,20 @@ const deserializeDataIntegrationsListResponse = (response) => ({
|
|
|
3837
4267
|
data: response.data.map(deserializeDataIntegrationsListResponseData)
|
|
3838
4268
|
});
|
|
3839
4269
|
//#endregion
|
|
3840
|
-
//#region src/pipes/serializers/data-integration-credentials-
|
|
3841
|
-
const
|
|
4270
|
+
//#region src/pipes/serializers/data-integration-credentials-input.serializer.ts
|
|
4271
|
+
const serializeDataIntegrationCredentialsInput = (model) => ({
|
|
3842
4272
|
type: model.type,
|
|
3843
4273
|
client_id: model.clientId,
|
|
3844
4274
|
client_secret: model.clientSecret
|
|
3845
4275
|
});
|
|
3846
4276
|
//#endregion
|
|
4277
|
+
//#region src/pipes/serializers/api-key-installation.serializer.ts
|
|
4278
|
+
const serializeApiKeyInstallation = (model) => ({
|
|
4279
|
+
secret: model.secret,
|
|
4280
|
+
user_id: model.userId,
|
|
4281
|
+
organization_id: model.organizationId
|
|
4282
|
+
});
|
|
4283
|
+
//#endregion
|
|
3847
4284
|
//#region src/pipes/serializers/custom-provider-definition.serializer.ts
|
|
3848
4285
|
const serializeCustomProviderDefinition = (model) => ({
|
|
3849
4286
|
name: model.name,
|
|
@@ -3859,14 +4296,59 @@ const serializeCustomProviderDefinition = (model) => ({
|
|
|
3859
4296
|
authenticate_via: model.authenticateVia
|
|
3860
4297
|
});
|
|
3861
4298
|
//#endregion
|
|
3862
|
-
//#region src/pipes/serializers/create-data-integration.serializer.ts
|
|
3863
|
-
const serializeCreateDataIntegration = (model) => ({
|
|
3864
|
-
provider: model.provider,
|
|
3865
|
-
|
|
3866
|
-
|
|
4299
|
+
//#region src/pipes/serializers/create-data-integration.serializer.ts
|
|
4300
|
+
const serializeCreateDataIntegration = (model) => ({
|
|
4301
|
+
provider: model.provider,
|
|
4302
|
+
ownership: model.ownership,
|
|
4303
|
+
auth_methods: model.authMethods,
|
|
4304
|
+
config: model.config,
|
|
4305
|
+
api_key: model.apiKey != null ? serializeApiKeyInstallation(model.apiKey) : void 0,
|
|
4306
|
+
description: model.description,
|
|
4307
|
+
enabled: model.enabled,
|
|
4308
|
+
scopes: model.scopes,
|
|
4309
|
+
credentials: model.credentials != null ? serializeDataIntegrationCredentialsInput(model.credentials) : void 0,
|
|
4310
|
+
custom_provider: model.customProvider != null ? serializeCustomProviderDefinition(model.customProvider) : void 0
|
|
4311
|
+
});
|
|
4312
|
+
//#endregion
|
|
4313
|
+
//#region src/pipes/serializers/data-integrations-create-api-key-connection-request.serializer.ts
|
|
4314
|
+
const serializeDataIntegrationsCreateApiKeyConnectionRequest = (model) => ({
|
|
4315
|
+
user_id: model.userId,
|
|
4316
|
+
organization_id: model.organizationId,
|
|
4317
|
+
connection_owner: model.connectionOwner,
|
|
4318
|
+
secret: model.secret,
|
|
4319
|
+
connection_intent: model.connectionIntent
|
|
4320
|
+
});
|
|
4321
|
+
//#endregion
|
|
4322
|
+
//#region src/pipes/serializers/data-integrations-create-client-credentials-connection-request.serializer.ts
|
|
4323
|
+
const serializeDataIntegrationsCreateClientCredentialsConnectionRequest = (model) => ({
|
|
4324
|
+
user_id: model.userId,
|
|
4325
|
+
organization_id: model.organizationId,
|
|
4326
|
+
connection_owner: model.connectionOwner,
|
|
4327
|
+
client_id: model.clientId,
|
|
4328
|
+
client_secret: model.clientSecret,
|
|
4329
|
+
config: model.config,
|
|
4330
|
+
connection_intent: model.connectionIntent
|
|
4331
|
+
});
|
|
4332
|
+
//#endregion
|
|
4333
|
+
//#region src/pipes/serializers/create-connected-account.serializer.ts
|
|
4334
|
+
const serializeCreateConnectedAccount = (model) => ({
|
|
4335
|
+
access_token: model.accessToken,
|
|
4336
|
+
refresh_token: model.refreshToken,
|
|
4337
|
+
expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
|
|
3867
4338
|
scopes: model.scopes,
|
|
3868
|
-
|
|
3869
|
-
|
|
4339
|
+
state: model.state,
|
|
4340
|
+
connection_intent: model.connectionIntent
|
|
4341
|
+
});
|
|
4342
|
+
//#endregion
|
|
4343
|
+
//#region src/pipes/serializers/create-organization-connected-account.serializer.ts
|
|
4344
|
+
const serializeCreateOrganizationConnectedAccount = (model) => ({
|
|
4345
|
+
access_token: model.accessToken,
|
|
4346
|
+
refresh_token: model.refreshToken,
|
|
4347
|
+
expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
|
|
4348
|
+
scopes: model.scopes,
|
|
4349
|
+
state: model.state,
|
|
4350
|
+
user_id: model.userId,
|
|
4351
|
+
connection_intent: model.connectionIntent
|
|
3870
4352
|
});
|
|
3871
4353
|
//#endregion
|
|
3872
4354
|
//#region src/pipes/serializers/update-custom-provider-definition.serializer.ts
|
|
@@ -3889,7 +4371,8 @@ const serializeUpdateDataIntegration = (model) => ({
|
|
|
3889
4371
|
description: model.description,
|
|
3890
4372
|
enabled: model.enabled,
|
|
3891
4373
|
scopes: model.scopes,
|
|
3892
|
-
|
|
4374
|
+
api_key: model.apiKey != null ? serializeApiKeyInstallation(model.apiKey) : void 0,
|
|
4375
|
+
credentials: model.credentials != null ? serializeDataIntegrationCredentialsInput(model.credentials) : void 0,
|
|
3893
4376
|
custom_provider: model.customProvider != null ? serializeUpdateCustomProviderDefinition(model.customProvider) : void 0
|
|
3894
4377
|
});
|
|
3895
4378
|
//#endregion
|
|
@@ -3897,6 +4380,9 @@ const serializeUpdateDataIntegration = (model) => ({
|
|
|
3897
4380
|
const serializeDataIntegrationsUpsertApiKeyRequest = (model) => ({
|
|
3898
4381
|
user_id: model.userId,
|
|
3899
4382
|
organization_id: model.organizationId,
|
|
4383
|
+
connected_account_id: model.connectedAccountId,
|
|
4384
|
+
connection_intent: model.connectionIntent,
|
|
4385
|
+
connection_owner: model.connectionOwner,
|
|
3900
4386
|
secret: model.secret
|
|
3901
4387
|
});
|
|
3902
4388
|
//#endregion
|
|
@@ -3904,23 +4390,53 @@ const serializeDataIntegrationsUpsertApiKeyRequest = (model) => ({
|
|
|
3904
4390
|
const serializeDataIntegrationsGetDataIntegrationAuthorizeUrlRequest = (model) => ({
|
|
3905
4391
|
user_id: model.userId,
|
|
3906
4392
|
organization_id: model.organizationId,
|
|
3907
|
-
|
|
4393
|
+
connection_owner: model.connectionOwner,
|
|
4394
|
+
return_to: model.returnTo,
|
|
4395
|
+
config: model.config
|
|
4396
|
+
});
|
|
4397
|
+
//#endregion
|
|
4398
|
+
//#region src/pipes/serializers/data-integrations-upsert-client-credentials-request.serializer.ts
|
|
4399
|
+
const serializeDataIntegrationsUpsertClientCredentialsRequest = (model) => ({
|
|
4400
|
+
user_id: model.userId,
|
|
4401
|
+
organization_id: model.organizationId,
|
|
4402
|
+
connected_account_id: model.connectedAccountId,
|
|
4403
|
+
connection_intent: model.connectionIntent,
|
|
4404
|
+
connection_owner: model.connectionOwner,
|
|
4405
|
+
client_id: model.clientId,
|
|
4406
|
+
client_secret: model.clientSecret,
|
|
4407
|
+
config: model.config
|
|
3908
4408
|
});
|
|
3909
4409
|
//#endregion
|
|
3910
4410
|
//#region src/pipes/serializers/data-integrations-vend-credentials-request.serializer.ts
|
|
3911
4411
|
const serializeDataIntegrationsVendCredentialsRequest = (model) => ({
|
|
3912
4412
|
user_id: model.userId,
|
|
3913
|
-
organization_id: model.organizationId
|
|
4413
|
+
organization_id: model.organizationId,
|
|
4414
|
+
connected_account_id: model.connectedAccountId,
|
|
4415
|
+
connection_owner: model.connectionOwner,
|
|
4416
|
+
supports_multiple_connections: model.supportsMultipleConnections
|
|
3914
4417
|
});
|
|
3915
4418
|
//#endregion
|
|
3916
4419
|
//#region src/pipes/serializers/data-integrations-get-user-token-request.serializer.ts
|
|
3917
4420
|
const serializeDataIntegrationsGetUserTokenRequest = (model) => ({
|
|
3918
4421
|
user_id: model.userId,
|
|
3919
|
-
organization_id: model.organizationId
|
|
4422
|
+
organization_id: model.organizationId,
|
|
4423
|
+
connected_account_id: model.connectedAccountId,
|
|
4424
|
+
connection_owner: model.connectionOwner,
|
|
4425
|
+
supports_multiple_connections: model.supportsMultipleConnections
|
|
4426
|
+
});
|
|
4427
|
+
//#endregion
|
|
4428
|
+
//#region src/pipes/serializers/organization-connected-account.serializer.ts
|
|
4429
|
+
const serializeOrganizationConnectedAccount = (model) => ({
|
|
4430
|
+
access_token: model.accessToken,
|
|
4431
|
+
refresh_token: model.refreshToken,
|
|
4432
|
+
expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
|
|
4433
|
+
scopes: model.scopes,
|
|
4434
|
+
state: model.state,
|
|
4435
|
+
user_id: model.userId
|
|
3920
4436
|
});
|
|
3921
4437
|
//#endregion
|
|
3922
|
-
//#region src/pipes/serializers/connected-account-
|
|
3923
|
-
const
|
|
4438
|
+
//#region src/pipes/serializers/connected-account-input.serializer.ts
|
|
4439
|
+
const serializeConnectedAccountInput = (model) => ({
|
|
3924
4440
|
access_token: model.accessToken,
|
|
3925
4441
|
refresh_token: model.refreshToken,
|
|
3926
4442
|
expires_at: model.expiresAt != null ? model.expiresAt.toISOString() : void 0,
|
|
@@ -3937,10 +4453,12 @@ var Pipes = class {
|
|
|
3937
4453
|
/**
|
|
3938
4454
|
* List data integrations
|
|
3939
4455
|
*
|
|
3940
|
-
* Lists the environment's data integrations configured with `custom` or `organization` credentials, including custom providers.
|
|
4456
|
+
* Lists the environment's data integrations configured with `custom` or `organization` credentials, including custom providers and API key integrations. Both user-owned and organization-owned roots are returned, each as its own row with an `ownership`; filter with `ownership` to return only one kind.
|
|
3941
4457
|
* @param options - Pagination and filter options.
|
|
3942
|
-
* @returns {Promise<AutoPaginatable<DataIntegration,
|
|
4458
|
+
* @returns {Promise<AutoPaginatable<DataIntegration, ListDataIntegrationsOptions>>}
|
|
3943
4459
|
* @throws {UnauthorizedException} 401
|
|
4460
|
+
* @throws {NotFoundException} 404
|
|
4461
|
+
* @throws {UnprocessableEntityException} 422
|
|
3944
4462
|
*/
|
|
3945
4463
|
async listDataIntegrations(options) {
|
|
3946
4464
|
const paginationOptions = options;
|
|
@@ -3949,22 +4467,31 @@ var Pipes = class {
|
|
|
3949
4467
|
/**
|
|
3950
4468
|
* Create a data integration
|
|
3951
4469
|
*
|
|
3952
|
-
* Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials
|
|
4470
|
+
* Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. Set `ownership` to `organization` to create the integration organizations connect to instead of the default user-owned one; a provider may have one of each. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition, or the slug of an existing custom provider (without `custom_provider`) to add the other ownership.
|
|
3953
4471
|
* @param options - Object containing provider.
|
|
3954
4472
|
* @param options.provider - The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
|
|
3955
4473
|
* @example "github"
|
|
4474
|
+
* @param options.ownership - Who owns the Data Integration. `user` (the default) creates the integration users connect their own accounts to; `organization` creates the root organizations connect to. Ownership is fixed at creation, and one integration of each ownership may exist per provider. Independent of `credentials.type`.
|
|
4475
|
+
* @example "user"
|
|
3956
4476
|
* @param options.description - An optional description of the Data Integration.
|
|
3957
4477
|
* @example "Production GitHub app"
|
|
3958
4478
|
* @param options.enabled - Whether the Data Integration is enabled. Defaults to `false`.
|
|
3959
4479
|
* @example true
|
|
3960
4480
|
* @param options.scopes - The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
|
3961
4481
|
* @example ["repo","read:org"]
|
|
3962
|
-
* @param options.
|
|
4482
|
+
* @param options.authMethods - How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.
|
|
4483
|
+
* @example ["oauth"]
|
|
4484
|
+
* @param options.config - Provider-specific config values (e.g. a Snowflake `account`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
|
4485
|
+
* @example {"account":"myorg-myaccount"}
|
|
4486
|
+
* @param options.credentials - The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
|
4487
|
+
* @param options.apiKey - An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
3963
4488
|
* @param options.customProvider - The OAuth definition for a custom provider. Supply this to define a custom provider; omit it to create an integration for a built-in provider.
|
|
3964
4489
|
* @returns {Promise<DataIntegration>}
|
|
3965
4490
|
* @throws {BadRequestException} 400
|
|
3966
4491
|
* @throws {UnauthorizedException} 401
|
|
4492
|
+
* @throws {AuthorizationException} 403
|
|
3967
4493
|
* @throws {NotFoundException} 404
|
|
4494
|
+
* @throws {ConflictException} 409
|
|
3968
4495
|
* @throws {UnprocessableEntityException} 422
|
|
3969
4496
|
*/
|
|
3970
4497
|
async createDataIntegration(options) {
|
|
@@ -3975,7 +4502,7 @@ var Pipes = class {
|
|
|
3975
4502
|
/**
|
|
3976
4503
|
* Get a data integration
|
|
3977
4504
|
*
|
|
3978
|
-
* Retrieves
|
|
4505
|
+
* Retrieves the user-owned data integration by its slug.
|
|
3979
4506
|
* @param options - The request options.
|
|
3980
4507
|
* @param options.slug - The slug identifier of the data integration.
|
|
3981
4508
|
* @example "github"
|
|
@@ -3991,7 +4518,7 @@ var Pipes = class {
|
|
|
3991
4518
|
/**
|
|
3992
4519
|
* Update a data integration
|
|
3993
4520
|
*
|
|
3994
|
-
* Updates the description, enabled state, or custom credentials of
|
|
4521
|
+
* Updates the description, enabled state, or custom credentials of the user-owned data integration. For custom providers, `custom_provider` updates the OAuth definition.
|
|
3995
4522
|
* @param options - The request body.
|
|
3996
4523
|
* @param options.slug - The slug identifier of the data integration.
|
|
3997
4524
|
* @example "github"
|
|
@@ -4001,12 +4528,15 @@ var Pipes = class {
|
|
|
4001
4528
|
* @example true
|
|
4002
4529
|
* @param options.scopes - The OAuth scopes to request for the Data Integration. Pass `null` to reset to the provider's configured scopes.
|
|
4003
4530
|
* @example ["repo","read:org"]
|
|
4004
|
-
* @param options.credentials - New credentials for the Data Integration. When provided, rotates the stored client secret.
|
|
4531
|
+
* @param options.credentials - New OAuth credentials for the Data Integration. When provided, rotates the stored client secret. Mutually exclusive with `api_key`.
|
|
4532
|
+
* @param options.apiKey - An API key to install or rotate for a tenant on an `api_key` integration. Upserts the tenant installation identified by `user_id` (and optional `organization_id`).
|
|
4005
4533
|
* @param options.customProvider - Updates to a custom provider's OAuth definition. Only valid for custom-provider integrations.
|
|
4006
4534
|
* @returns {Promise<DataIntegration>}
|
|
4007
4535
|
* @throws {BadRequestException} 400
|
|
4008
4536
|
* @throws {UnauthorizedException} 401
|
|
4537
|
+
* @throws {AuthorizationException} 403
|
|
4009
4538
|
* @throws {NotFoundException} 404
|
|
4539
|
+
* @throws {ConflictException} 409
|
|
4010
4540
|
* @throws {UnprocessableEntityException} 422
|
|
4011
4541
|
*/
|
|
4012
4542
|
async updateDataIntegration(options) {
|
|
@@ -4017,7 +4547,7 @@ var Pipes = class {
|
|
|
4017
4547
|
/**
|
|
4018
4548
|
* Delete a data integration
|
|
4019
4549
|
*
|
|
4020
|
-
* Deletes
|
|
4550
|
+
* Deletes the user-owned data integration and all of its connected installations. For a custom provider, the provider definition is deleted once no organization-owned root references it either.
|
|
4021
4551
|
* @param options - The request options.
|
|
4022
4552
|
* @param options.slug - The slug identifier of the data integration.
|
|
4023
4553
|
* @example "github"
|
|
@@ -4030,16 +4560,34 @@ var Pipes = class {
|
|
|
4030
4560
|
await this.workos.delete(`/data-integrations/${encodeURIComponent(slug)}`);
|
|
4031
4561
|
}
|
|
4032
4562
|
/**
|
|
4563
|
+
* Create another API key connected account
|
|
4564
|
+
*
|
|
4565
|
+
* Requires `connectionIntent: 'add'` and does not accept an account selector.
|
|
4566
|
+
* Until additional connections are available, this creates the first connection
|
|
4567
|
+
* or returns 404 `multiple_connections_unavailable` if one already exists.
|
|
4568
|
+
* Use `updateDataIntegrationApiKey` to rotate the compatibility connection or
|
|
4569
|
+
* update an exact connection.
|
|
4570
|
+
*/
|
|
4571
|
+
async createDataIntegrationApiKey(options) {
|
|
4572
|
+
const { slug, ...payload } = options;
|
|
4573
|
+
const { data } = await this.workos.post(`/data-integrations/${encodeURIComponent(slug)}/api-key`, serializeDataIntegrationsCreateApiKeyConnectionRequest(payload));
|
|
4574
|
+
return deserializeConnectedAccount(data);
|
|
4575
|
+
}
|
|
4576
|
+
/**
|
|
4033
4577
|
* Upsert an API key for a connected account
|
|
4034
4578
|
*
|
|
4035
|
-
* Creates or updates an API-key-based installation for the specified integration
|
|
4579
|
+
* Creates or updates an API-key-based installation for the specified integration, owned by the user or, when `connection_owner` is `organization`, shared by the organization. If an installation already exists, the stored API key is rotated to the new value.
|
|
4036
4580
|
* @param options - Object containing userId, secret.
|
|
4037
4581
|
* @param options.slug - The identifier of the integration.
|
|
4038
4582
|
* @example "github"
|
|
4039
4583
|
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
4040
4584
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4041
|
-
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
|
4585
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
|
|
4042
4586
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4587
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to rotate a specific existing connection.
|
|
4588
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4589
|
+
* @param options.connectionOwner - Whose connection to create or rotate. `user` (the default) addresses the connection owned by `user_id`. `organization` addresses the connection shared by every member of `organization_id`; `user_id` then identifies the member performing the request and must be an active member of the organization.
|
|
4590
|
+
* @example "user"
|
|
4043
4591
|
* @param options.secret - The API key secret to store for this integration.
|
|
4044
4592
|
* @example "sk-1234567890abcdef"
|
|
4045
4593
|
* @returns {Promise<ConnectedAccount>}
|
|
@@ -4047,6 +4595,7 @@ var Pipes = class {
|
|
|
4047
4595
|
* @throws {UnauthorizedException} 401
|
|
4048
4596
|
* @throws {AuthorizationException} 403
|
|
4049
4597
|
* @throws {NotFoundException} 404
|
|
4598
|
+
* @throws {ConflictException} 409
|
|
4050
4599
|
* @throws {UnprocessableEntityException} 422
|
|
4051
4600
|
*/
|
|
4052
4601
|
async updateDataIntegrationApiKey(options) {
|
|
@@ -4061,12 +4610,16 @@ var Pipes = class {
|
|
|
4061
4610
|
* @param options - Object containing userId.
|
|
4062
4611
|
* @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
|
|
4063
4612
|
* @example "github"
|
|
4064
|
-
* @param options.userId - The ID of the user to authorize.
|
|
4613
|
+
* @param options.userId - The ID of the user to authorize. When `connection_owner` is `organization`, this is the user authorizing on behalf of the organization; they must be an active member of the organization and do not become the owner of the resulting connected account.
|
|
4065
4614
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4066
|
-
* @param options.organizationId - An organization ID to scope the authorization to a specific organization.
|
|
4615
|
+
* @param options.organizationId - An organization ID to scope the authorization to a specific organization. Required when `connection_owner` is `organization`.
|
|
4067
4616
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4617
|
+
* @param options.connectionOwner - Who will own the connected account. `user` (the default) connects the user's own account. `organization` connects the organization's shared account and requires `organization_id`.
|
|
4618
|
+
* @example "user"
|
|
4068
4619
|
* @param options.returnTo - The URL to redirect the user to after authorization.
|
|
4069
4620
|
* @example "https://example.com/callback"
|
|
4621
|
+
* @param options.config - Connect-time config values for the provider-declared `installation`-scope fields (e.g. a Zendesk `subdomain`), keyed by the config field. Only fields the provider declares may be supplied, and required fields must be provided unless already pinned on the integration.
|
|
4622
|
+
* @example {"subdomain":"acme"}
|
|
4070
4623
|
* @returns {Promise<DataIntegrationAuthorizeUrlResponse>}
|
|
4071
4624
|
* @throws {BadRequestException} 400
|
|
4072
4625
|
* @throws {UnauthorizedException} 401
|
|
@@ -4079,20 +4632,63 @@ var Pipes = class {
|
|
|
4079
4632
|
return deserializeDataIntegrationAuthorizeUrlResponse(data);
|
|
4080
4633
|
}
|
|
4081
4634
|
/**
|
|
4635
|
+
* Create another client credentials connected account
|
|
4636
|
+
*
|
|
4637
|
+
* Requires `connectionIntent: 'add'` and does not accept an account selector.
|
|
4638
|
+
* Until additional connections are available, this creates the first connection
|
|
4639
|
+
* or returns 404 `multiple_connections_unavailable` if one already exists.
|
|
4640
|
+
* Use `updateDataIntegrationClientCredentials` to rotate the compatibility
|
|
4641
|
+
* connection or update an exact connection.
|
|
4642
|
+
*/
|
|
4643
|
+
async createDataIntegrationClientCredential(options) {
|
|
4644
|
+
const { slug, ...payload } = options;
|
|
4645
|
+
const { data } = await this.workos.post(`/data-integrations/${encodeURIComponent(slug)}/client-credentials`, serializeDataIntegrationsCreateClientCredentialsConnectionRequest(payload));
|
|
4646
|
+
return deserializeConnectedAccount(data);
|
|
4647
|
+
}
|
|
4648
|
+
/**
|
|
4649
|
+
* Upsert client credentials for a connected account
|
|
4650
|
+
*
|
|
4651
|
+
* Creates or updates a client-credentials-based installation for the specified integration, owned by the user or, when `connection_owner` is `organization`, shared by the organization. If an installation already exists, the stored client credentials are rotated to the new values.
|
|
4652
|
+
* @param options - The request options.
|
|
4653
|
+
* @param options.slug - The identifier of the integration.
|
|
4654
|
+
* @example "salesforce"
|
|
4655
|
+
* @returns {Promise<ConnectedAccount>}
|
|
4656
|
+
* @throws {BadRequestException} 400
|
|
4657
|
+
* @throws {UnauthorizedException} 401
|
|
4658
|
+
* @throws {AuthorizationException} 403
|
|
4659
|
+
* @throws {NotFoundException} 404
|
|
4660
|
+
* @throws {ConflictException} 409
|
|
4661
|
+
* @throws {UnprocessableEntityException} 422
|
|
4662
|
+
*/
|
|
4663
|
+
async updateDataIntegrationClientCredentials(options) {
|
|
4664
|
+
const { slug, ...payload } = options;
|
|
4665
|
+
const { data } = await this.workos.put(`/data-integrations/${encodeURIComponent(slug)}/client-credentials`, serializeDataIntegrationsUpsertClientCredentialsRequest(payload));
|
|
4666
|
+
return deserializeConnectedAccount(data);
|
|
4667
|
+
}
|
|
4668
|
+
/**
|
|
4082
4669
|
* Vend credentials for a connected account
|
|
4083
4670
|
*
|
|
4084
|
-
* Returns credentials for a user
|
|
4671
|
+
* Returns credentials for a user-owned or organization-owned connected account. OAuth and client-credentials installations return an access token; API-key installations return the stored secret. Every active credential includes provider-declared, non-secret `config` from the connection snapshot with current defaults. Client-credentials responses also include provider token `metadata`.
|
|
4085
4672
|
* @param options - Object containing userId.
|
|
4086
4673
|
* @param options.slug - The identifier of the integration.
|
|
4087
4674
|
* @example "github"
|
|
4088
|
-
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
4675
|
+
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier. When `connection_owner` is `organization`, this is the user the credentials are vended on behalf of; they must be an active member of the organization.
|
|
4089
4676
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4090
|
-
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
|
4677
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
|
|
4091
4678
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4679
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
|
|
4680
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4681
|
+
* @param options.connectionOwner - Which connection to vend from. `user` (the default) vends the user's own connection and requires `user_id`. `organization` vends the organization's shared connection and requires `organization_id`.
|
|
4682
|
+
* @example "user"
|
|
4683
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. If no `connected_account_id` is supplied and several connections match, the request returns `account_selection_required`. When omitted or `false`, only the compatibility connection is considered.
|
|
4684
|
+
* @example true
|
|
4092
4685
|
* @returns {Promise<DataIntegrationCredentialsResponse>}
|
|
4093
4686
|
* @throws {BadRequestException} 400
|
|
4094
4687
|
* @throws {UnauthorizedException} 401
|
|
4688
|
+
* @throws {AuthorizationException} 403
|
|
4095
4689
|
* @throws {NotFoundException} 404
|
|
4690
|
+
* @throws {ConflictException} 409
|
|
4691
|
+
* @throws {UnprocessableEntityException} 422
|
|
4096
4692
|
*/
|
|
4097
4693
|
async createDataIntegrationCredential(options) {
|
|
4098
4694
|
const { slug, ...payload } = options;
|
|
@@ -4100,20 +4696,79 @@ var Pipes = class {
|
|
|
4100
4696
|
return deserializeDataIntegrationCredentialsResponse(data);
|
|
4101
4697
|
}
|
|
4102
4698
|
/**
|
|
4699
|
+
* Get an organization-owned data integration
|
|
4700
|
+
*
|
|
4701
|
+
* Retrieves the organization-owned data integration for a provider by its slug. The `/organization` suffix selects the environment-level organization-owned root for the provider; it does not name a particular organization.
|
|
4702
|
+
* @param options - The request options.
|
|
4703
|
+
* @param options.slug - The slug identifier of the data integration.
|
|
4704
|
+
* @example "github"
|
|
4705
|
+
* @returns {Promise<DataIntegration>}
|
|
4706
|
+
* @throws {UnauthorizedException} 401
|
|
4707
|
+
* @throws {NotFoundException} 404
|
|
4708
|
+
*/
|
|
4709
|
+
async getOrganizationDataIntegration(options) {
|
|
4710
|
+
const { slug } = options;
|
|
4711
|
+
const { data } = await this.workos.get(`/data-integrations/${encodeURIComponent(slug)}/organization`);
|
|
4712
|
+
return deserializeDataIntegration(data);
|
|
4713
|
+
}
|
|
4714
|
+
/**
|
|
4715
|
+
* Update an organization-owned data integration
|
|
4716
|
+
*
|
|
4717
|
+
* Updates the description, enabled state, or custom credentials of the organization-owned data integration for a provider. For custom providers, `custom_provider` updates the OAuth definition, which is shared with the user-owned root. The `/organization` suffix selects the environment-level organization-owned root for the provider; it does not name a particular organization.
|
|
4718
|
+
* @param options - The request options.
|
|
4719
|
+
* @param options.slug - The slug identifier of the data integration.
|
|
4720
|
+
* @example "github"
|
|
4721
|
+
* @returns {Promise<DataIntegration>}
|
|
4722
|
+
* @throws {BadRequestException} 400
|
|
4723
|
+
* @throws {UnauthorizedException} 401
|
|
4724
|
+
* @throws {AuthorizationException} 403
|
|
4725
|
+
* @throws {NotFoundException} 404
|
|
4726
|
+
* @throws {ConflictException} 409
|
|
4727
|
+
* @throws {UnprocessableEntityException} 422
|
|
4728
|
+
*/
|
|
4729
|
+
async updateOrganizationDataIntegration(options) {
|
|
4730
|
+
const { slug, ...payload } = options;
|
|
4731
|
+
const { data } = await this.workos.put(`/data-integrations/${encodeURIComponent(slug)}/organization`, serializeUpdateDataIntegration(payload));
|
|
4732
|
+
return deserializeDataIntegration(data);
|
|
4733
|
+
}
|
|
4734
|
+
/**
|
|
4735
|
+
* Delete an organization-owned data integration
|
|
4736
|
+
*
|
|
4737
|
+
* Deletes the organization-owned data integration for a provider and all of its connected installations. For a custom provider, the provider definition is deleted once no user-owned root references it either. The `/organization` suffix selects the environment-level organization-owned root for the provider; it does not name a particular organization.
|
|
4738
|
+
* @param options - The request options.
|
|
4739
|
+
* @param options.slug - The slug identifier of the data integration.
|
|
4740
|
+
* @example "github"
|
|
4741
|
+
* @returns {Promise<void>}
|
|
4742
|
+
* @throws {UnauthorizedException} 401
|
|
4743
|
+
* @throws {NotFoundException} 404
|
|
4744
|
+
*/
|
|
4745
|
+
async deleteOrganizationDataIntegration(options) {
|
|
4746
|
+
const { slug } = options;
|
|
4747
|
+
await this.workos.delete(`/data-integrations/${encodeURIComponent(slug)}/organization`);
|
|
4748
|
+
}
|
|
4749
|
+
/**
|
|
4103
4750
|
* Get an access token for a connected account
|
|
4104
4751
|
*
|
|
4105
4752
|
* Fetches a valid OAuth access token for a user's connected account. WorkOS automatically handles token refresh, ensuring you always receive a valid, non-expired token.
|
|
4106
4753
|
* @param options - Object containing userId.
|
|
4107
4754
|
* @param options.provider - The identifier of the integration.
|
|
4108
4755
|
* @example "github"
|
|
4109
|
-
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
4756
|
+
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier. When `connection_owner` is `organization`, this is the user the credentials are vended on behalf of; they must be an active member of the organization.
|
|
4110
4757
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4111
|
-
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
|
4758
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. Required when `connection_owner` is `organization`.
|
|
4112
4759
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4760
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
|
|
4761
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4762
|
+
* @param options.connectionOwner - Which connection to vend from. `user` (the default) vends the user's own connection and requires `user_id`. `organization` vends the organization's shared connection and requires `organization_id`.
|
|
4763
|
+
* @example "user"
|
|
4764
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. If no `connected_account_id` is supplied and several connections match, the request returns `account_selection_required`. When omitted or `false`, only the compatibility connection is considered.
|
|
4765
|
+
* @example true
|
|
4113
4766
|
* @returns {Promise<DataIntegrationAccessTokenResponse>}
|
|
4114
4767
|
* @throws {BadRequestException} 400
|
|
4115
4768
|
* @throws {UnauthorizedException} 401
|
|
4769
|
+
* @throws {AuthorizationException} 403
|
|
4116
4770
|
* @throws {NotFoundException} 404
|
|
4771
|
+
* @throws {ConflictException} 409
|
|
4117
4772
|
* @throws {UnprocessableEntityException} 422
|
|
4118
4773
|
*/
|
|
4119
4774
|
async getAccessToken(options) {
|
|
@@ -4122,6 +4777,128 @@ var Pipes = class {
|
|
|
4122
4777
|
return deserializeDataIntegrationAccessTokenResponse(data);
|
|
4123
4778
|
}
|
|
4124
4779
|
/**
|
|
4780
|
+
* Get an organization connected account
|
|
4781
|
+
*
|
|
4782
|
+
* Retrieves an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) for a specific provider.
|
|
4783
|
+
* @param options - Additional query options.
|
|
4784
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
|
|
4785
|
+
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4786
|
+
* @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
|
|
4787
|
+
* @example "github"
|
|
4788
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
4789
|
+
* @example true
|
|
4790
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the organization has several for this provider.
|
|
4791
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4792
|
+
* @returns {Promise<ConnectedAccount>}
|
|
4793
|
+
* @throws {BadRequestException} 400
|
|
4794
|
+
* @throws {UnauthorizedException} 401
|
|
4795
|
+
* @throws {NotFoundException} 404
|
|
4796
|
+
* @throws {ConflictException} 409
|
|
4797
|
+
*/
|
|
4798
|
+
async getOrganizationConnectedAccount(options) {
|
|
4799
|
+
const { organizationId, slug } = options;
|
|
4800
|
+
const { data } = await this.workos.get(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, { query: {
|
|
4801
|
+
...options.supportsMultipleConnections !== void 0 && { supports_multiple_connections: options.supportsMultipleConnections },
|
|
4802
|
+
...options.connectedAccountId !== void 0 && { connected_account_id: options.connectedAccountId }
|
|
4803
|
+
} });
|
|
4804
|
+
return deserializeConnectedAccount(data);
|
|
4805
|
+
}
|
|
4806
|
+
/**
|
|
4807
|
+
* Import an organization connected account
|
|
4808
|
+
*
|
|
4809
|
+
* Imports an organization-owned [connected account](https://workos.com/docs/reference/pipes/connected-account) by providing OAuth tokens directly. Omit `connectionIntent` for compatibility behavior or set it to `add` to explicitly create a connection. Additional connection creation is subject to API availability.
|
|
4810
|
+
* @param options - The request options.
|
|
4811
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
|
|
4812
|
+
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4813
|
+
* @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
|
|
4814
|
+
* @example "github"
|
|
4815
|
+
* @returns {Promise<ConnectedAccount>}
|
|
4816
|
+
* @throws {UnauthorizedException} 401
|
|
4817
|
+
* @throws {AuthorizationException} 403
|
|
4818
|
+
* @throws {NotFoundException} 404
|
|
4819
|
+
* @throws {ConflictException} 409
|
|
4820
|
+
* @throws {UnprocessableEntityException} 422
|
|
4821
|
+
*/
|
|
4822
|
+
async createOrganizationConnectedAccount(options) {
|
|
4823
|
+
const { organizationId, slug, ...payload } = options;
|
|
4824
|
+
const { data } = await this.workos.post(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeCreateOrganizationConnectedAccount(payload));
|
|
4825
|
+
return deserializeConnectedAccount(data);
|
|
4826
|
+
}
|
|
4827
|
+
/**
|
|
4828
|
+
* Update an organization connected account
|
|
4829
|
+
*
|
|
4830
|
+
* Updates an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, or state for a specific provider.
|
|
4831
|
+
* @param options - Additional query options.
|
|
4832
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
|
|
4833
|
+
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4834
|
+
* @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
|
|
4835
|
+
* @example "github"
|
|
4836
|
+
* @param options.supportsMultipleConnections - Accepted for compatibility; does not change update targeting.
|
|
4837
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update.
|
|
4838
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4839
|
+
* @param options.connectionIntent - Set to `reauthorize` with `connectedAccountId`, or omit both to update the compatibility connection.
|
|
4840
|
+
* @returns {Promise<ConnectedAccount>}
|
|
4841
|
+
* @throws {BadRequestException} 400
|
|
4842
|
+
* @throws {UnauthorizedException} 401
|
|
4843
|
+
* @throws {AuthorizationException} 403
|
|
4844
|
+
* @throws {NotFoundException} 404
|
|
4845
|
+
* @throws {ConflictException} 409
|
|
4846
|
+
* @throws {UnprocessableEntityException} 422
|
|
4847
|
+
*/
|
|
4848
|
+
async updateOrganizationConnectedAccount(options) {
|
|
4849
|
+
const { organizationId, slug, supportsMultipleConnections, connectedAccountId, connectionIntent, ...payload } = options;
|
|
4850
|
+
const { data } = await this.workos.put(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeOrganizationConnectedAccount(payload), { query: {
|
|
4851
|
+
supports_multiple_connections: supportsMultipleConnections,
|
|
4852
|
+
connected_account_id: connectedAccountId,
|
|
4853
|
+
connection_intent: connectionIntent
|
|
4854
|
+
} });
|
|
4855
|
+
return deserializeConnectedAccount(data);
|
|
4856
|
+
}
|
|
4857
|
+
/**
|
|
4858
|
+
* Delete an organization connected account
|
|
4859
|
+
*
|
|
4860
|
+
* Disconnects the organization's account for the provider, including removing any stored access and refresh tokens. A member will need to reauthorize if the organization wants to reconnect. This does not revoke access on the provider side.
|
|
4861
|
+
* @param options - Additional query options.
|
|
4862
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier.
|
|
4863
|
+
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4864
|
+
* @param options.slug - The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
|
|
4865
|
+
* @example "github"
|
|
4866
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
4867
|
+
* @example true
|
|
4868
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
|
|
4869
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4870
|
+
* @returns {Promise<void>}
|
|
4871
|
+
* @throws {BadRequestException} 400
|
|
4872
|
+
* @throws {UnauthorizedException} 401
|
|
4873
|
+
* @throws {NotFoundException} 404
|
|
4874
|
+
* @throws {ConflictException} 409
|
|
4875
|
+
*/
|
|
4876
|
+
async deleteOrganizationConnectedAccount(options) {
|
|
4877
|
+
const { organizationId, slug } = options;
|
|
4878
|
+
await this.workos.delete(`/organizations/${encodeURIComponent(organizationId)}/connected_accounts/${encodeURIComponent(slug)}`, {
|
|
4879
|
+
supports_multiple_connections: options.supportsMultipleConnections,
|
|
4880
|
+
connected_account_id: options.connectedAccountId
|
|
4881
|
+
});
|
|
4882
|
+
}
|
|
4883
|
+
/**
|
|
4884
|
+
* List providers for an organization
|
|
4885
|
+
*
|
|
4886
|
+
* Retrieves the organization-owned providers configured for your environment and the organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) information for each. Providers owned by individual users are not included.
|
|
4887
|
+
* @param options - Additional query options.
|
|
4888
|
+
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier to list providers and connected accounts for.
|
|
4889
|
+
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4890
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
4891
|
+
* @example true
|
|
4892
|
+
* @returns {Promise<DataIntegrationsListResponse>}
|
|
4893
|
+
* @throws {UnauthorizedException} 401
|
|
4894
|
+
* @throws {NotFoundException} 404
|
|
4895
|
+
*/
|
|
4896
|
+
async listOrganizationDataProviders(options) {
|
|
4897
|
+
const { organizationId } = options;
|
|
4898
|
+
const { data } = await this.workos.get(`/organizations/${encodeURIComponent(organizationId)}/data_providers`, { query: { ...options.supportsMultipleConnections !== void 0 && { supports_multiple_connections: options.supportsMultipleConnections } } });
|
|
4899
|
+
return deserializeDataIntegrationsListResponse(data);
|
|
4900
|
+
}
|
|
4901
|
+
/**
|
|
4125
4902
|
* Get a connected account
|
|
4126
4903
|
*
|
|
4127
4904
|
* Retrieves a user's [connected account](https://workos.com/docs/reference/pipes/connected-account) for a specific provider.
|
|
@@ -4132,19 +4909,29 @@ var Pipes = class {
|
|
|
4132
4909
|
* @example "github"
|
|
4133
4910
|
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
|
|
4134
4911
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4912
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
4913
|
+
* @example true
|
|
4914
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
|
|
4915
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4135
4916
|
* @returns {Promise<ConnectedAccount>}
|
|
4917
|
+
* @throws {BadRequestException} 400
|
|
4136
4918
|
* @throws {UnauthorizedException} 401
|
|
4137
4919
|
* @throws {NotFoundException} 404
|
|
4920
|
+
* @throws {ConflictException} 409
|
|
4138
4921
|
*/
|
|
4139
4922
|
async getUserConnectedAccount(options) {
|
|
4140
4923
|
const { userId, slug } = options;
|
|
4141
|
-
const { data } = await this.workos.get(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, { query: {
|
|
4924
|
+
const { data } = await this.workos.get(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, { query: {
|
|
4925
|
+
...options.organizationId !== void 0 && { organization_id: options.organizationId },
|
|
4926
|
+
...options.supportsMultipleConnections !== void 0 && { supports_multiple_connections: options.supportsMultipleConnections },
|
|
4927
|
+
...options.connectedAccountId !== void 0 && { connected_account_id: options.connectedAccountId }
|
|
4928
|
+
} });
|
|
4142
4929
|
return deserializeConnectedAccount(data);
|
|
4143
4930
|
}
|
|
4144
4931
|
/**
|
|
4145
4932
|
* Import a connected account
|
|
4146
4933
|
*
|
|
4147
|
-
* Imports a [connected account](https://workos.com/docs/reference/pipes/connected-account) for a user by providing OAuth tokens directly.
|
|
4934
|
+
* Imports a [connected account](https://workos.com/docs/reference/pipes/connected-account) for a user by providing OAuth tokens directly. Omit `connectionIntent` for compatibility behavior or set it to `add` to explicitly create a connection. Additional connection creation is subject to API availability.
|
|
4148
4935
|
* @param options - The request body.
|
|
4149
4936
|
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
4150
4937
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
@@ -4170,7 +4957,7 @@ var Pipes = class {
|
|
|
4170
4957
|
*/
|
|
4171
4958
|
async createUserConnectedAccount(options) {
|
|
4172
4959
|
const { userId, slug, organizationId, ...payload } = options;
|
|
4173
|
-
const { data } = await this.workos.post(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`,
|
|
4960
|
+
const { data } = await this.workos.post(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeCreateConnectedAccount(payload), { query: { organization_id: organizationId } });
|
|
4174
4961
|
return deserializeConnectedAccount(data);
|
|
4175
4962
|
}
|
|
4176
4963
|
/**
|
|
@@ -4184,6 +4971,10 @@ var Pipes = class {
|
|
|
4184
4971
|
* @example "github"
|
|
4185
4972
|
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
|
|
4186
4973
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4974
|
+
* @param options.supportsMultipleConnections - Accepted for compatibility; does not change update targeting.
|
|
4975
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update.
|
|
4976
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4977
|
+
* @param options.connectionIntent - Set to `reauthorize` with `connectedAccountId`, or omit both to update the compatibility connection.
|
|
4187
4978
|
* @param options.accessToken - The OAuth access token for the connected account.
|
|
4188
4979
|
* @example "gho_16C7e42F292c6912E7710c838347Ae178B4a"
|
|
4189
4980
|
* @param options.refreshToken - The OAuth refresh token for the connected account.
|
|
@@ -4195,18 +4986,26 @@ var Pipes = class {
|
|
|
4195
4986
|
* @param options.state - Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
|
|
4196
4987
|
* @example "connected"
|
|
4197
4988
|
* @returns {Promise<ConnectedAccount>}
|
|
4989
|
+
* @throws {BadRequestException} 400
|
|
4198
4990
|
* @throws {UnauthorizedException} 401
|
|
4199
4991
|
* @throws {NotFoundException} 404
|
|
4992
|
+
* @throws {ConflictException} 409
|
|
4993
|
+
* @throws {UnprocessableEntityException} 422
|
|
4200
4994
|
*/
|
|
4201
4995
|
async updateUserConnectedAccount(options) {
|
|
4202
|
-
const { userId, slug, organizationId, ...payload } = options;
|
|
4203
|
-
const { data } = await this.workos.put(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`,
|
|
4996
|
+
const { userId, slug, organizationId, supportsMultipleConnections, connectedAccountId, connectionIntent, ...payload } = options;
|
|
4997
|
+
const { data } = await this.workos.put(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, serializeConnectedAccountInput(payload), { query: {
|
|
4998
|
+
organization_id: organizationId,
|
|
4999
|
+
supports_multiple_connections: supportsMultipleConnections,
|
|
5000
|
+
connected_account_id: connectedAccountId,
|
|
5001
|
+
connection_intent: connectionIntent
|
|
5002
|
+
} });
|
|
4204
5003
|
return deserializeConnectedAccount(data);
|
|
4205
5004
|
}
|
|
4206
5005
|
/**
|
|
4207
5006
|
* Delete a connected account
|
|
4208
5007
|
*
|
|
4209
|
-
* Disconnects WorkOS's account for the user, including removing any stored access and refresh tokens. The user will need to reauthorize if they want to reconnect.
|
|
5008
|
+
* Disconnects WorkOS's account for the user, including removing any stored access and refresh tokens. The user will need to reauthorize if they want to reconnect. Access is not revoked on the provider side, except for the WorkOS OAuth provider, whose underlying AuthKit grant is revoked.
|
|
4210
5009
|
* @param options - Additional query options.
|
|
4211
5010
|
* @param options.userId - A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
4212
5011
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
@@ -4214,13 +5013,23 @@ var Pipes = class {
|
|
|
4214
5013
|
* @example "github"
|
|
4215
5014
|
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
|
|
4216
5015
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
5016
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
5017
|
+
* @example true
|
|
5018
|
+
* @param options.connectedAccountId - A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
|
|
5019
|
+
* @example "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4217
5020
|
* @returns {Promise<void>}
|
|
5021
|
+
* @throws {BadRequestException} 400
|
|
4218
5022
|
* @throws {UnauthorizedException} 401
|
|
4219
5023
|
* @throws {NotFoundException} 404
|
|
5024
|
+
* @throws {ConflictException} 409
|
|
4220
5025
|
*/
|
|
4221
5026
|
async deleteUserConnectedAccount(options) {
|
|
4222
5027
|
const { userId, slug } = options;
|
|
4223
|
-
await this.workos.delete(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, {
|
|
5028
|
+
await this.workos.delete(`/user_management/users/${encodeURIComponent(userId)}/connected_accounts/${encodeURIComponent(slug)}`, {
|
|
5029
|
+
organization_id: options.organizationId,
|
|
5030
|
+
supports_multiple_connections: options.supportsMultipleConnections,
|
|
5031
|
+
connected_account_id: options.connectedAccountId
|
|
5032
|
+
});
|
|
4224
5033
|
}
|
|
4225
5034
|
/**
|
|
4226
5035
|
* List providers for a user
|
|
@@ -4231,13 +5040,18 @@ var Pipes = class {
|
|
|
4231
5040
|
* @example "user_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
4232
5041
|
* @param options.organizationId - An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to filter connections for a specific organization.
|
|
4233
5042
|
* @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
|
|
5043
|
+
* @param options.supportsMultipleConnections - Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered.
|
|
5044
|
+
* @example true
|
|
4234
5045
|
* @returns {Promise<DataIntegrationsListResponse>}
|
|
4235
5046
|
* @throws {UnauthorizedException} 401
|
|
4236
5047
|
* @throws {NotFoundException} 404
|
|
4237
5048
|
*/
|
|
4238
5049
|
async listUserDataProviders(options) {
|
|
4239
5050
|
const { userId } = options;
|
|
4240
|
-
const { data } = await this.workos.get(`/user_management/users/${encodeURIComponent(userId)}/data_providers`, { query: {
|
|
5051
|
+
const { data } = await this.workos.get(`/user_management/users/${encodeURIComponent(userId)}/data_providers`, { query: {
|
|
5052
|
+
...options.organizationId !== void 0 && { organization_id: options.organizationId },
|
|
5053
|
+
...options.supportsMultipleConnections !== void 0 && { supports_multiple_connections: options.supportsMultipleConnections }
|
|
5054
|
+
} });
|
|
4241
5055
|
return deserializeDataIntegrationsListResponse(data);
|
|
4242
5056
|
}
|
|
4243
5057
|
};
|
|
@@ -4334,12 +5148,13 @@ var Radar = class {
|
|
|
4334
5148
|
* @example "block"
|
|
4335
5149
|
* @param options.entry - The value to add to the list. Must match the format of the list type (e.g. a valid IP address for `ip_address`, a valid email for `email`).
|
|
4336
5150
|
* @example "198.51.100.42"
|
|
4337
|
-
* @returns {Promise<RadarListEntryAlreadyPresentResponse>}
|
|
5151
|
+
* @returns {Promise<RadarListEntryAlreadyPresentResponse | null>}
|
|
4338
5152
|
* @throws {BadRequestException} 400
|
|
4339
5153
|
*/
|
|
4340
5154
|
async addListEntry(options) {
|
|
4341
5155
|
const { type, action, ...payload } = options;
|
|
4342
5156
|
const { data } = await this.workos.post(`/radar/lists/${encodeURIComponent(type)}/${encodeURIComponent(action)}`, serializeRadarStandaloneUpdateRadarListRequest(payload));
|
|
5157
|
+
if (!data) return null;
|
|
4343
5158
|
return deserializeRadarListEntryAlreadyPresentResponse(data);
|
|
4344
5159
|
}
|
|
4345
5160
|
/**
|
|
@@ -4380,7 +5195,7 @@ var AdminPortal = class {
|
|
|
4380
5195
|
* @throws {NotFoundException} 404
|
|
4381
5196
|
* @throws {UnprocessableEntityException} 422
|
|
4382
5197
|
*/
|
|
4383
|
-
async generateLink({ intent, organization, returnUrl, successUrl, intentOptions,
|
|
5198
|
+
async generateLink({ intent, organization, returnUrl, successUrl, intentOptions, itContactEmails }) {
|
|
4384
5199
|
const { data } = await this.workos.post("/portal/generate_link", {
|
|
4385
5200
|
intent,
|
|
4386
5201
|
organization,
|
|
@@ -4390,7 +5205,7 @@ var AdminPortal = class {
|
|
|
4390
5205
|
bookmark_slug: intentOptions.sso.bookmarkSlug,
|
|
4391
5206
|
provider_type: intentOptions.sso.providerType
|
|
4392
5207
|
} } : void 0,
|
|
4393
|
-
|
|
5208
|
+
it_contact_emails: itContactEmails
|
|
4394
5209
|
});
|
|
4395
5210
|
return data;
|
|
4396
5211
|
}
|
|
@@ -4594,9 +5409,9 @@ var SSO = class {
|
|
|
4594
5409
|
const deserializeChallenge = (challenge) => ({
|
|
4595
5410
|
object: challenge.object,
|
|
4596
5411
|
id: challenge.id,
|
|
4597
|
-
createdAt: challenge.created_at,
|
|
4598
|
-
updatedAt: challenge.updated_at,
|
|
4599
|
-
expiresAt: challenge.expires_at,
|
|
5412
|
+
createdAt: new Date(challenge.created_at),
|
|
5413
|
+
updatedAt: new Date(challenge.updated_at),
|
|
5414
|
+
expiresAt: challenge.expires_at != null ? new Date(challenge.expires_at) : void 0,
|
|
4600
5415
|
code: challenge.code,
|
|
4601
5416
|
authenticationFactorId: challenge.authentication_factor_id
|
|
4602
5417
|
});
|
|
@@ -4605,8 +5420,8 @@ const deserializeChallenge = (challenge) => ({
|
|
|
4605
5420
|
const deserializeFactor = (factor) => ({
|
|
4606
5421
|
object: factor.object,
|
|
4607
5422
|
id: factor.id,
|
|
4608
|
-
createdAt: factor.created_at,
|
|
4609
|
-
updatedAt: factor.updated_at,
|
|
5423
|
+
createdAt: new Date(factor.created_at),
|
|
5424
|
+
updatedAt: new Date(factor.updated_at),
|
|
4610
5425
|
type: factor.type,
|
|
4611
5426
|
...factor.sms ? { sms: deserializeSms(factor.sms) } : {},
|
|
4612
5427
|
...factor.totp ? { totp: deserializeTotp(factor.totp) } : {}
|
|
@@ -4614,8 +5429,8 @@ const deserializeFactor = (factor) => ({
|
|
|
4614
5429
|
const deserializeFactorWithSecrets = (factor) => ({
|
|
4615
5430
|
object: factor.object,
|
|
4616
5431
|
id: factor.id,
|
|
4617
|
-
createdAt: factor.created_at,
|
|
4618
|
-
updatedAt: factor.updated_at,
|
|
5432
|
+
createdAt: new Date(factor.created_at),
|
|
5433
|
+
updatedAt: new Date(factor.updated_at),
|
|
4619
5434
|
type: factor.type,
|
|
4620
5435
|
...factor.sms ? { sms: deserializeSms(factor.sms) } : {},
|
|
4621
5436
|
...factor.totp ? { totp: deserializeTotpWithSecrets(factor.totp) } : {}
|
|
@@ -4750,8 +5565,8 @@ const deserializeAuditLogExport = (auditLogExport) => ({
|
|
|
4750
5565
|
id: auditLogExport.id,
|
|
4751
5566
|
state: auditLogExport.state,
|
|
4752
5567
|
url: auditLogExport.url,
|
|
4753
|
-
createdAt: auditLogExport.created_at,
|
|
4754
|
-
updatedAt: auditLogExport.updated_at
|
|
5568
|
+
createdAt: new Date(auditLogExport.created_at),
|
|
5569
|
+
updatedAt: new Date(auditLogExport.updated_at)
|
|
4755
5570
|
});
|
|
4756
5571
|
//#endregion
|
|
4757
5572
|
//#region src/audit-logs/serializers/audit-log-export-options.serializer.ts
|
|
@@ -4826,7 +5641,7 @@ const deserializeAuditLogSchema = (auditLogSchema) => ({
|
|
|
4826
5641
|
})),
|
|
4827
5642
|
actor: auditLogSchema.actor ? { metadata: deserializeMetadata(auditLogSchema.actor.metadata) } : void 0,
|
|
4828
5643
|
metadata: auditLogSchema.metadata ? deserializeMetadata(auditLogSchema.metadata) : void 0,
|
|
4829
|
-
createdAt: auditLogSchema.created_at
|
|
5644
|
+
createdAt: new Date(auditLogSchema.created_at)
|
|
4830
5645
|
});
|
|
4831
5646
|
//#endregion
|
|
4832
5647
|
//#region src/audit-logs/serializers/audit-logs-retention.serializer.ts
|
|
@@ -5247,6 +6062,21 @@ async function unsealData(encryptedData, { password }) {
|
|
|
5247
6062
|
return data;
|
|
5248
6063
|
}
|
|
5249
6064
|
//#endregion
|
|
6065
|
+
//#region src/user-management/serializers/session-cookie-data.serializer.ts
|
|
6066
|
+
const toDate = (value) => value instanceof Date ? value : new Date(value);
|
|
6067
|
+
const deserializeSessionCookieData = (data) => {
|
|
6068
|
+
if (!data.user) return data;
|
|
6069
|
+
return {
|
|
6070
|
+
...data,
|
|
6071
|
+
user: {
|
|
6072
|
+
...data.user,
|
|
6073
|
+
createdAt: toDate(data.user.createdAt),
|
|
6074
|
+
updatedAt: toDate(data.user.updatedAt),
|
|
6075
|
+
lastSignInAt: data.user.lastSignInAt != null ? toDate(data.user.lastSignInAt) : null
|
|
6076
|
+
}
|
|
6077
|
+
};
|
|
6078
|
+
};
|
|
6079
|
+
//#endregion
|
|
5250
6080
|
//#region src/common/utils/env.ts
|
|
5251
6081
|
let detectedRuntime = null;
|
|
5252
6082
|
/**
|
|
@@ -5452,7 +6282,7 @@ var CookieSession = class {
|
|
|
5452
6282
|
authenticated: false,
|
|
5453
6283
|
reason: "no_session_cookie_provided"
|
|
5454
6284
|
};
|
|
5455
|
-
const session = await unsealData(this.sessionData, { password: this.cookiePassword });
|
|
6285
|
+
const session = deserializeSessionCookieData(await unsealData(this.sessionData, { password: this.cookiePassword }));
|
|
5456
6286
|
if (!session.accessToken) return {
|
|
5457
6287
|
authenticated: false,
|
|
5458
6288
|
reason: "invalid_session_cookie"
|
|
@@ -5488,7 +6318,7 @@ var CookieSession = class {
|
|
|
5488
6318
|
*/
|
|
5489
6319
|
async refresh(options = {}) {
|
|
5490
6320
|
const { decodeJwt } = await getJose();
|
|
5491
|
-
const session = await unsealData(this.sessionData, { password: this.cookiePassword });
|
|
6321
|
+
const session = deserializeSessionCookieData(await unsealData(this.sessionData, { password: this.cookiePassword }));
|
|
5492
6322
|
if (!session.refreshToken || !session.user) return {
|
|
5493
6323
|
authenticated: false,
|
|
5494
6324
|
reason: "invalid_session_cookie",
|
|
@@ -5624,7 +6454,7 @@ function isNetworkError(error) {
|
|
|
5624
6454
|
}
|
|
5625
6455
|
//#endregion
|
|
5626
6456
|
//#region src/user-management/user-management.ts
|
|
5627
|
-
var UserManagement = class {
|
|
6457
|
+
var UserManagement = class UserManagement {
|
|
5628
6458
|
workos;
|
|
5629
6459
|
_jwks;
|
|
5630
6460
|
clientId;
|
|
@@ -5905,7 +6735,7 @@ var UserManagement = class {
|
|
|
5905
6735
|
authenticated: false,
|
|
5906
6736
|
reason: "no_session_cookie_provided"
|
|
5907
6737
|
};
|
|
5908
|
-
const session = await unsealData(sessionData, { password: cookiePassword });
|
|
6738
|
+
const session = deserializeSessionCookieData(await unsealData(sessionData, { password: cookiePassword }));
|
|
5909
6739
|
if (!session.accessToken) return {
|
|
5910
6740
|
authenticated: false,
|
|
5911
6741
|
reason: "invalid_session_cookie"
|
|
@@ -5929,18 +6759,74 @@ var UserManagement = class {
|
|
|
5929
6759
|
authenticationMethod: session.authenticationMethod
|
|
5930
6760
|
};
|
|
5931
6761
|
}
|
|
5932
|
-
|
|
6762
|
+
/**
|
|
6763
|
+
* Verify an access token and return its claims.
|
|
6764
|
+
*
|
|
6765
|
+
* Checks the token's signature against the environment's JWKS and its
|
|
6766
|
+
* expiry, plus the issuer when one was configured on the client, and that
|
|
6767
|
+
* the payload carries the claims of a WorkOS user access token. Tokens the
|
|
6768
|
+
* environment signed for another purpose, such as agent or widget session
|
|
6769
|
+
* tokens, are rejected. Resolves to `null` when the token fails any of
|
|
6770
|
+
* those checks, is not a JWT, or was signed by a key the JWKS does not
|
|
6771
|
+
* have. Errors that are not JWT validation failures, such as a network
|
|
6772
|
+
* error while fetching the JWKS, propagate.
|
|
6773
|
+
*
|
|
6774
|
+
* @param accessToken - The access token to verify, for example from an `Authorization: Bearer` header.
|
|
6775
|
+
* @returns {Promise<AccessTokenClaims | null>} The token's claims, or `null` when the token is invalid.
|
|
6776
|
+
* @throws {Error} When no client ID was provided when initializing WorkOS.
|
|
6777
|
+
*/
|
|
6778
|
+
async verifyAccessToken(accessToken) {
|
|
6779
|
+
const payload = await this.verifyJwt(accessToken);
|
|
6780
|
+
if (payload === null || !UserManagement.hasRequiredAccessTokenClaims(payload)) return null;
|
|
6781
|
+
return payload;
|
|
6782
|
+
}
|
|
6783
|
+
/**
|
|
6784
|
+
* Several token families are signed with an environment's key pair, so a
|
|
6785
|
+
* valid signature alone does not prove a token is a user access token. This
|
|
6786
|
+
* mirrors how the API identifies one: `sid` and `auth_time` are always
|
|
6787
|
+
* minted together on user access tokens, agent tokens classify themselves
|
|
6788
|
+
* with a `sub_profile` other than `user`, and widget session tokens carry
|
|
6789
|
+
* `sub_type`. The registered claims `AccessTokenClaims` guarantees are
|
|
6790
|
+
* checked too, so a token is rejected rather than returned with missing
|
|
6791
|
+
* values.
|
|
6792
|
+
*
|
|
6793
|
+
* Consent tokens for interactive Connect grants also mint `sid` and
|
|
6794
|
+
* `auth_time`. The API excludes those by resolving `sid` to a live
|
|
6795
|
+
* session, which cannot be done offline here.
|
|
6796
|
+
*/
|
|
6797
|
+
static hasRequiredAccessTokenClaims(payload) {
|
|
6798
|
+
return typeof payload.sub === "string" && typeof payload.sid === "string" && typeof payload.iss === "string" && typeof payload.exp === "number" && typeof payload.iat === "number" && typeof payload.auth_time === "number" && (payload.sub_profile === void 0 || payload.sub_profile === "user") && payload.sub_type === void 0;
|
|
6799
|
+
}
|
|
6800
|
+
/**
|
|
6801
|
+
* Verify a JWT's signature, expiry and, when configured, issuer against the
|
|
6802
|
+
* environment's JWKS. Resolves to the payload, or `null` when jose rejects
|
|
6803
|
+
* the token; errors that are not JWT validation failures propagate.
|
|
6804
|
+
*/
|
|
6805
|
+
async verifyJwt(accessToken) {
|
|
5933
6806
|
const jwks = await this.getJWKS();
|
|
5934
6807
|
const { jwtVerify } = await getJose();
|
|
5935
6808
|
if (!jwks) throw new Error("Must provide clientId to initialize JWKS");
|
|
5936
6809
|
try {
|
|
5937
|
-
await jwtVerify(accessToken, jwks, this.issuer ? { issuer: this.issuer } : void 0);
|
|
5938
|
-
return
|
|
6810
|
+
const { payload } = await jwtVerify(accessToken, jwks, this.issuer ? { issuer: this.issuer } : void 0);
|
|
6811
|
+
return payload;
|
|
5939
6812
|
} catch (e) {
|
|
5940
|
-
if (
|
|
6813
|
+
if (UserManagement.isJwtValidationError(e)) return null;
|
|
5941
6814
|
throw e;
|
|
5942
6815
|
}
|
|
5943
6816
|
}
|
|
6817
|
+
/**
|
|
6818
|
+
* Whether a jose error means the presented token is invalid, as opposed to
|
|
6819
|
+
* a failure to verify it at all. Network errors, JWKS timeouts and crypto
|
|
6820
|
+
* failures propagate so they surface as errors rather than as rejected
|
|
6821
|
+
* tokens.
|
|
6822
|
+
*/
|
|
6823
|
+
static isJwtValidationError(e) {
|
|
6824
|
+
if (!(e instanceof Error) || !("code" in e) || typeof e.code !== "string") return false;
|
|
6825
|
+
return e.code.startsWith("ERR_JWT_") || e.code.startsWith("ERR_JWS_") || e.code === "ERR_JWKS_NO_MATCHING_KEY" || e.code === "ERR_JWKS_MULTIPLE_MATCHING_KEYS" || e.code === "ERR_JOSE_NOT_SUPPORTED" || e.code === "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
6826
|
+
}
|
|
6827
|
+
async isValidJwt(accessToken) {
|
|
6828
|
+
return await this.verifyJwt(accessToken) !== null;
|
|
6829
|
+
}
|
|
5944
6830
|
async prepareAuthenticationResponse({ authenticationResponse, session }) {
|
|
5945
6831
|
if (session?.sealSession) {
|
|
5946
6832
|
if (!this.workos.key) throw new Error("Session sealing requires server-side usage with an API key. Public clients should store tokens directly (e.g., secure storage on mobile, keychain on desktop).");
|
|
@@ -5969,7 +6855,7 @@ var UserManagement = class {
|
|
|
5969
6855
|
}
|
|
5970
6856
|
async getSessionFromCookie({ sessionData, cookiePassword = getEnv("WORKOS_COOKIE_PASSWORD") }) {
|
|
5971
6857
|
if (!cookiePassword) throw new Error("Cookie password is required");
|
|
5972
|
-
if (sessionData) return unsealData(sessionData, { password: cookiePassword });
|
|
6858
|
+
if (sessionData) return deserializeSessionCookieData(await unsealData(sessionData, { password: cookiePassword }));
|
|
5973
6859
|
}
|
|
5974
6860
|
/**
|
|
5975
6861
|
* Get an email verification code
|
|
@@ -6637,7 +7523,7 @@ var InMemoryStore = class {
|
|
|
6637
7523
|
this.flags = { ...newFlags };
|
|
6638
7524
|
}
|
|
6639
7525
|
get(slug) {
|
|
6640
|
-
return this.flags[slug];
|
|
7526
|
+
return Object.hasOwn(this.flags, slug) ? this.flags[slug] : void 0;
|
|
6641
7527
|
}
|
|
6642
7528
|
getAll() {
|
|
6643
7529
|
return { ...this.flags };
|
|
@@ -6665,15 +7551,23 @@ var Evaluator = class {
|
|
|
6665
7551
|
getAllFlags(context = {}) {
|
|
6666
7552
|
const normalizedContext = this.normalizeContext(context);
|
|
6667
7553
|
const flags = this.store.getAll();
|
|
6668
|
-
|
|
6669
|
-
for (const slug of Object.keys(flags)) result[slug] = this.evaluate(flags[slug], normalizedContext, false);
|
|
6670
|
-
return result;
|
|
7554
|
+
return Object.fromEntries(Object.entries(flags).map(([slug, flag]) => [slug, this.evaluate(flag, normalizedContext, false)]));
|
|
6671
7555
|
}
|
|
6672
7556
|
evaluate(entry, normalizedContext, defaultValue) {
|
|
6673
7557
|
if (!entry) return defaultValue;
|
|
6674
|
-
if (!entry.enabled) return
|
|
6675
|
-
for (const
|
|
6676
|
-
|
|
7558
|
+
if (!entry.enabled) return this.servedValue(entry.off_value, defaultValue);
|
|
7559
|
+
for (const rule of entry.rules) {
|
|
7560
|
+
if (rule.kind !== "conditions" || !rule.conditions?.length) continue;
|
|
7561
|
+
if (rule.conditions.every((condition) => {
|
|
7562
|
+
if (condition.operator !== "one_of" || !condition.target_type || !Array.isArray(condition.values)) return false;
|
|
7563
|
+
const id = normalizedContext.get(condition.target_type);
|
|
7564
|
+
return id !== void 0 && condition.values.includes(id);
|
|
7565
|
+
})) return this.servedValue(rule.value, defaultValue);
|
|
7566
|
+
}
|
|
7567
|
+
return this.servedValue(entry.default_value, defaultValue);
|
|
7568
|
+
}
|
|
7569
|
+
servedValue(value, defaultValue) {
|
|
7570
|
+
return typeof value === "boolean" ? value : defaultValue;
|
|
6677
7571
|
}
|
|
6678
7572
|
/**
|
|
6679
7573
|
* Reduces either context form to target type → ID pairs. Evaluation must
|
|
@@ -6683,6 +7577,10 @@ var Evaluator = class {
|
|
|
6683
7577
|
*/
|
|
6684
7578
|
normalizeContext(context) {
|
|
6685
7579
|
const normalized = /* @__PURE__ */ new Map();
|
|
7580
|
+
if (typeof context !== "object" || context === null || Array.isArray(context)) {
|
|
7581
|
+
this.logger?.warn("Ignoring invalid evaluation context");
|
|
7582
|
+
return normalized;
|
|
7583
|
+
}
|
|
6686
7584
|
const record = context;
|
|
6687
7585
|
const legacyEntries = [];
|
|
6688
7586
|
const typedKeys = [];
|
|
@@ -6723,18 +7621,37 @@ var Evaluator = class {
|
|
|
6723
7621
|
}
|
|
6724
7622
|
return normalized;
|
|
6725
7623
|
}
|
|
6726
|
-
/**
|
|
6727
|
-
* A target participates in evaluation only while its `enabled` is true. A
|
|
6728
|
-
* `false` value is reserved for future disabled overrides and is treated
|
|
6729
|
-
* as if the target were absent.
|
|
6730
|
-
*/
|
|
6731
|
-
hasEnabledTarget(entry, targetType, targetId) {
|
|
6732
|
-
if (targetType === "user") return entry.targets.users.some((t) => t.id === targetId && t.enabled);
|
|
6733
|
-
if (targetType === "organization") return entry.targets.organizations.some((t) => t.id === targetId && t.enabled);
|
|
6734
|
-
return (entry.targets.custom_targets ?? []).some((t) => t.type === targetType && t.id === targetId && t.enabled);
|
|
6735
|
-
}
|
|
6736
7624
|
};
|
|
6737
7625
|
//#endregion
|
|
7626
|
+
//#region src/feature-flags/payload.ts
|
|
7627
|
+
function isRecord(value) {
|
|
7628
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7629
|
+
}
|
|
7630
|
+
function isCondition(value) {
|
|
7631
|
+
return isRecord(value) && typeof value.operator === "string" && (value.target_type === void 0 || typeof value.target_type === "string") && (value.operator !== "one_of" || Array.isArray(value.values));
|
|
7632
|
+
}
|
|
7633
|
+
function isRule(value) {
|
|
7634
|
+
return isRecord(value) && typeof value.id === "string" && typeof value.kind === "string" && (value.conditions === void 0 || Array.isArray(value.conditions) && value.conditions.every(isCondition));
|
|
7635
|
+
}
|
|
7636
|
+
function isEntry(value) {
|
|
7637
|
+
return isRecord(value) && typeof value.slug === "string" && typeof value.enabled === "boolean" && "default_value" in value && "off_value" in value && Array.isArray(value.rules) && value.rules.every(isRule);
|
|
7638
|
+
}
|
|
7639
|
+
/** Validate a payload before swapping the store. One invalid entry rejects the
|
|
7640
|
+
* whole payload, so the store never holds a partial snapshot and the last good
|
|
7641
|
+
* one stays intact; bootstrap callers can still be ready. */
|
|
7642
|
+
function parseFlagPollResponse(response) {
|
|
7643
|
+
if (!isRecord(response) || response.version !== 2 || !isRecord(response.flags)) return;
|
|
7644
|
+
const entries = [];
|
|
7645
|
+
for (const [slug, entry] of Object.entries(response.flags)) {
|
|
7646
|
+
if (!isEntry(entry)) return void 0;
|
|
7647
|
+
entries.push([slug, entry]);
|
|
7648
|
+
}
|
|
7649
|
+
return {
|
|
7650
|
+
version: 2,
|
|
7651
|
+
flags: Object.fromEntries(entries)
|
|
7652
|
+
};
|
|
7653
|
+
}
|
|
7654
|
+
//#endregion
|
|
6738
7655
|
//#region src/feature-flags/runtime-client.ts
|
|
6739
7656
|
const DEFAULT_POLLING_INTERVAL_MS = 3e4;
|
|
6740
7657
|
const MIN_POLLING_INTERVAL_MS = 5e3;
|
|
@@ -6754,6 +7671,7 @@ var FeatureFlagsRuntimeClient = class extends EventEmitter {
|
|
|
6754
7671
|
closed = false;
|
|
6755
7672
|
initialized = false;
|
|
6756
7673
|
consecutiveErrors = 0;
|
|
7674
|
+
warnedUnobservedError = false;
|
|
6757
7675
|
pollTimer = null;
|
|
6758
7676
|
pollAbortController = null;
|
|
6759
7677
|
readyResolve = null;
|
|
@@ -6780,8 +7698,10 @@ var FeatureFlagsRuntimeClient = class extends EventEmitter {
|
|
|
6780
7698
|
this.readyReject = reject;
|
|
6781
7699
|
});
|
|
6782
7700
|
this.readyPromise.catch(() => {});
|
|
6783
|
-
if (options.bootstrapFlags) {
|
|
6784
|
-
|
|
7701
|
+
if (options.bootstrapFlags !== void 0) {
|
|
7702
|
+
const bootstrap = parseFlagPollResponse(options.bootstrapFlags);
|
|
7703
|
+
if (bootstrap) this.store.swap(bootstrap.flags);
|
|
7704
|
+
else this.logger?.warn("Ignoring bootstrapFlags: expected a v2 flag payload ({ version: 2, flags }). Flags will load on the first successful poll.");
|
|
6785
7705
|
this.stats.flagCount = this.store.size;
|
|
6786
7706
|
this.resolveReady();
|
|
6787
7707
|
}
|
|
@@ -6834,12 +7754,13 @@ var FeatureFlagsRuntimeClient = class extends EventEmitter {
|
|
|
6834
7754
|
try {
|
|
6835
7755
|
this.stats.pollCount++;
|
|
6836
7756
|
this.stats.lastPollAt = /* @__PURE__ */ new Date();
|
|
6837
|
-
const data = await this.fetchWithTimeout();
|
|
6838
|
-
|
|
7757
|
+
const data = parseFlagPollResponse(await this.fetchWithTimeout());
|
|
7758
|
+
if (!data) throw new Error("Feature flag poll returned a payload this SDK can't read; keeping the last good flags");
|
|
7759
|
+
this.store.swap(data.flags);
|
|
6839
7760
|
this.stats.lastSuccessfulPollAt = /* @__PURE__ */ new Date();
|
|
6840
7761
|
this.stats.flagCount = this.store.size;
|
|
6841
7762
|
this.consecutiveErrors = 0;
|
|
6842
|
-
if (this.initialized) this.emitChanges(previousFlags, data);
|
|
7763
|
+
if (this.initialized) this.emitChanges(previousFlags, data.flags);
|
|
6843
7764
|
this.initialized = true;
|
|
6844
7765
|
this.resolveReady();
|
|
6845
7766
|
this.logger?.debug("Poll successful", { flagCount: this.store.size });
|
|
@@ -6848,7 +7769,14 @@ var FeatureFlagsRuntimeClient = class extends EventEmitter {
|
|
|
6848
7769
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
6849
7770
|
this.consecutiveErrors++;
|
|
6850
7771
|
this.stats.pollErrorCount++;
|
|
6851
|
-
this.emit("error", err);
|
|
7772
|
+
if (this.listenerCount("error") > 0) this.emit("error", err);
|
|
7773
|
+
else if (!this.logger) {
|
|
7774
|
+
if (err instanceof UnauthorizedException) this.workos.emitWarning(`Feature flag sync stopped after a 401 and no 'error' listener or logger is attached; keeping the last good flags. Recreate the client with a valid API key to resume. ${err.message}`);
|
|
7775
|
+
else if (!this.warnedUnobservedError) {
|
|
7776
|
+
this.warnedUnobservedError = true;
|
|
7777
|
+
this.workos.emitWarning(`Feature flag sync failed and no 'error' listener or logger is attached; keeping the last good flags and retrying. ${err.message}`);
|
|
7778
|
+
}
|
|
7779
|
+
}
|
|
6852
7780
|
this.logger?.error("Poll failed", err);
|
|
6853
7781
|
if (err instanceof UnauthorizedException) {
|
|
6854
7782
|
this.emit("failed", err);
|
|
@@ -6865,7 +7793,7 @@ var FeatureFlagsRuntimeClient = class extends EventEmitter {
|
|
|
6865
7793
|
this.pollAbortController = new AbortController();
|
|
6866
7794
|
const { signal } = this.pollAbortController;
|
|
6867
7795
|
let timeoutId;
|
|
6868
|
-
const fetchPromise = this.workos.get("/sdk/feature-flags").then(({ data }) => data);
|
|
7796
|
+
const fetchPromise = this.workos.get("/sdk/feature-flags?payload_version=2").then(({ data }) => data);
|
|
6869
7797
|
const timeoutPromise = new Promise((_, reject) => {
|
|
6870
7798
|
timeoutId = setTimeout(() => {
|
|
6871
7799
|
this.pollAbortController?.abort();
|
|
@@ -6902,8 +7830,8 @@ var FeatureFlagsRuntimeClient = class extends EventEmitter {
|
|
|
6902
7830
|
if (!previous || !current) return;
|
|
6903
7831
|
const allKeys = /* @__PURE__ */ new Set([...Object.keys(previous), ...Object.keys(current)]);
|
|
6904
7832
|
for (const key of allKeys) {
|
|
6905
|
-
const prev = previous[key];
|
|
6906
|
-
const curr = current[key];
|
|
7833
|
+
const prev = Object.hasOwn(previous, key) ? previous[key] : void 0;
|
|
7834
|
+
const curr = Object.hasOwn(current, key) ? current[key] : void 0;
|
|
6907
7835
|
if (this.hasEntryChanged(prev, curr)) this.emit("change", {
|
|
6908
7836
|
key,
|
|
6909
7837
|
previous: prev ?? null,
|
|
@@ -6913,18 +7841,22 @@ var FeatureFlagsRuntimeClient = class extends EventEmitter {
|
|
|
6913
7841
|
}
|
|
6914
7842
|
hasEntryChanged(a, b) {
|
|
6915
7843
|
if (!a || !b) return a !== b;
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
7844
|
+
const signature = (entry) => JSON.stringify([
|
|
7845
|
+
entry.enabled,
|
|
7846
|
+
entry.default_value,
|
|
7847
|
+
entry.off_value,
|
|
7848
|
+
entry.rules.map((rule) => [
|
|
7849
|
+
rule.id,
|
|
7850
|
+
rule.kind,
|
|
7851
|
+
rule.value,
|
|
7852
|
+
rule.conditions?.map((condition) => JSON.stringify([
|
|
7853
|
+
condition.operator,
|
|
7854
|
+
condition.target_type,
|
|
7855
|
+
Array.isArray(condition.values) ? [...new Set(condition.values)].sort() : condition.values
|
|
7856
|
+
])).sort()
|
|
7857
|
+
])
|
|
7858
|
+
]);
|
|
7859
|
+
return signature(a) !== signature(b);
|
|
6928
7860
|
}
|
|
6929
7861
|
};
|
|
6930
7862
|
//#endregion
|
|
@@ -7257,8 +8189,8 @@ const deserializeEnvironmentRole = (role) => ({
|
|
|
7257
8189
|
permissions: role.permissions,
|
|
7258
8190
|
resourceTypeSlug: role.resource_type_slug,
|
|
7259
8191
|
type: role.type,
|
|
7260
|
-
createdAt: role.created_at,
|
|
7261
|
-
updatedAt: role.updated_at
|
|
8192
|
+
createdAt: new Date(role.created_at),
|
|
8193
|
+
updatedAt: new Date(role.updated_at)
|
|
7262
8194
|
});
|
|
7263
8195
|
//#endregion
|
|
7264
8196
|
//#region src/authorization/serializers/create-environment-role-options.serializer.ts
|
|
@@ -7313,8 +8245,8 @@ const deserializeAuthorizationResource = (resource) => ({
|
|
|
7313
8245
|
resourceTypeSlug: resource.resource_type_slug,
|
|
7314
8246
|
organizationId: resource.organization_id,
|
|
7315
8247
|
parentResourceId: resource.parent_resource_id,
|
|
7316
|
-
createdAt: resource.created_at,
|
|
7317
|
-
updatedAt: resource.updated_at
|
|
8248
|
+
createdAt: new Date(resource.created_at),
|
|
8249
|
+
updatedAt: new Date(resource.updated_at)
|
|
7318
8250
|
});
|
|
7319
8251
|
//#endregion
|
|
7320
8252
|
//#region src/authorization/serializers/create-authorization-resource-options.serializer.ts
|
|
@@ -7396,8 +8328,8 @@ const deserializeRoleAssignment = (response) => ({
|
|
|
7396
8328
|
type: response.source.type,
|
|
7397
8329
|
groupRoleAssignmentId: response.source.group_role_assignment_id
|
|
7398
8330
|
},
|
|
7399
|
-
createdAt: response.created_at,
|
|
7400
|
-
updatedAt: response.updated_at
|
|
8331
|
+
createdAt: new Date(response.created_at),
|
|
8332
|
+
updatedAt: new Date(response.updated_at)
|
|
7401
8333
|
});
|
|
7402
8334
|
//#endregion
|
|
7403
8335
|
//#region src/authorization/serializers/list-role-assignments-options.serializer.ts
|
|
@@ -7445,8 +8377,8 @@ const deserializeGroupRoleAssignment = (response) => ({
|
|
|
7445
8377
|
externalId: response.resource.external_id,
|
|
7446
8378
|
resourceTypeSlug: response.resource.resource_type_slug
|
|
7447
8379
|
},
|
|
7448
|
-
createdAt: response.created_at,
|
|
7449
|
-
updatedAt: response.updated_at
|
|
8380
|
+
createdAt: new Date(response.created_at),
|
|
8381
|
+
updatedAt: new Date(response.updated_at)
|
|
7450
8382
|
});
|
|
7451
8383
|
//#endregion
|
|
7452
8384
|
//#region src/authorization/serializers/create-group-role-assignment-options.serializer.ts
|
|
@@ -8840,7 +9772,7 @@ var Vault = class {
|
|
|
8840
9772
|
};
|
|
8841
9773
|
//#endregion
|
|
8842
9774
|
//#region package.json
|
|
8843
|
-
var version = "
|
|
9775
|
+
var version = "12.0.0";
|
|
8844
9776
|
//#endregion
|
|
8845
9777
|
//#region src/workos.ts
|
|
8846
9778
|
const DEFAULT_HOSTNAME = "api.workos.com";
|
|
@@ -9166,6 +10098,13 @@ const GenerateLinkIntent = {
|
|
|
9166
10098
|
BringYourOwnKey: "bring_your_own_key"
|
|
9167
10099
|
};
|
|
9168
10100
|
//#endregion
|
|
10101
|
+
//#region src/directory-sync/interfaces/directory-user-with-groups-state.interface.ts
|
|
10102
|
+
const DirectoryUserWithGroupsState = {
|
|
10103
|
+
Active: "active",
|
|
10104
|
+
Suspended: "suspended",
|
|
10105
|
+
Inactive: "inactive"
|
|
10106
|
+
};
|
|
10107
|
+
//#endregion
|
|
9169
10108
|
//#region src/organizations/interfaces/domain-data.interface.ts
|
|
9170
10109
|
let DomainDataState = /* @__PURE__ */ function(DomainDataState) {
|
|
9171
10110
|
DomainDataState["Verified"] = "verified";
|
|
@@ -9186,6 +10125,7 @@ const ItContactIntent = {
|
|
|
9186
10125
|
let OrganizationDomainState = /* @__PURE__ */ function(OrganizationDomainState) {
|
|
9187
10126
|
OrganizationDomainState["Verified"] = "verified";
|
|
9188
10127
|
OrganizationDomainState["Pending"] = "pending";
|
|
10128
|
+
OrganizationDomainState["Unverified"] = "unverified";
|
|
9189
10129
|
OrganizationDomainState["Failed"] = "failed";
|
|
9190
10130
|
return OrganizationDomainState;
|
|
9191
10131
|
}({});
|
|
@@ -9243,6 +10183,6 @@ function createWorkOS(options) {
|
|
|
9243
10183
|
return new WorkOS(options);
|
|
9244
10184
|
}
|
|
9245
10185
|
//#endregion
|
|
9246
|
-
export {
|
|
10186
|
+
export { isAuthenticationErrorData as A, RateLimitExceededException as C, ConflictException as D, NoApiKeyProvidedException as E, ApiKeyRequiredException as M, FetchHttpClient as N, BadRequestException as O, SubtleCryptoProvider as P, SignatureVerificationException as S, NotFoundException as T, Webhooks as _, ItContactIntent as a, UnprocessableEntityException as b, GenerateLinkIntent as c, FeatureFlagsRuntimeClient as d, CookieSession as f, PKCE as g, AuthenticateWithSessionCookieFailureReason as h, OrganizationDomainVerificationStrategy as i, GenericServerException as j, AuthenticationException as k, UpdateAuditLogsRetentionRetentionPeriod as l, serializeRevokeSessionOptions as m, ConnectionType as n, DomainDataState as o, RefreshSessionFailureReason as p, OrganizationDomainState as r, DirectoryUserWithGroupsState as s, createWorkOS as t, WorkOS as u, AutoPaginatable as v, OauthException as w, UnauthorizedException as x, Actions as y };
|
|
9247
10187
|
|
|
9248
|
-
//# sourceMappingURL=factory-
|
|
10188
|
+
//# sourceMappingURL=factory-D2Ig6M1S.mjs.map
|