workos 0.11.2 → 0.12.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.
Files changed (186) hide show
  1. package/README.md +165 -6
  2. package/dist/bin.js +22 -1
  3. package/dist/bin.js.map +1 -1
  4. package/dist/check-coverage.ts +237 -0
  5. package/dist/commands/debug.js +0 -1
  6. package/dist/commands/debug.js.map +1 -1
  7. package/dist/commands/dev.d.ts +23 -0
  8. package/dist/commands/dev.js +139 -0
  9. package/dist/commands/dev.js.map +1 -0
  10. package/dist/commands/emulate.d.ts +6 -0
  11. package/dist/commands/emulate.js +64 -0
  12. package/dist/commands/emulate.js.map +1 -0
  13. package/dist/commands/login.js +0 -4
  14. package/dist/commands/login.js.map +1 -1
  15. package/dist/emulate/core/id.d.ts +48 -0
  16. package/dist/emulate/core/id.js +73 -0
  17. package/dist/emulate/core/id.js.map +1 -0
  18. package/dist/emulate/core/index.d.ts +8 -0
  19. package/dist/emulate/core/index.js +8 -0
  20. package/dist/emulate/core/index.js.map +1 -0
  21. package/dist/emulate/core/jwt.d.ts +28 -0
  22. package/dist/emulate/core/jwt.js +78 -0
  23. package/dist/emulate/core/jwt.js.map +1 -0
  24. package/dist/emulate/core/middleware/auth.d.ts +15 -0
  25. package/dist/emulate/core/middleware/auth.js +17 -0
  26. package/dist/emulate/core/middleware/auth.js.map +1 -0
  27. package/dist/emulate/core/middleware/error-handler.d.ts +22 -0
  28. package/dist/emulate/core/middleware/error-handler.js +72 -0
  29. package/dist/emulate/core/middleware/error-handler.js.map +1 -0
  30. package/dist/emulate/core/pagination.d.ts +27 -0
  31. package/dist/emulate/core/pagination.js +43 -0
  32. package/dist/emulate/core/pagination.js.map +1 -0
  33. package/dist/emulate/core/plugin.d.ts +15 -0
  34. package/dist/emulate/core/plugin.js +2 -0
  35. package/dist/emulate/core/plugin.js.map +1 -0
  36. package/dist/emulate/core/server.d.ts +17 -0
  37. package/dist/emulate/core/server.js +90 -0
  38. package/dist/emulate/core/server.js.map +1 -0
  39. package/dist/emulate/core/store.d.ts +44 -0
  40. package/dist/emulate/core/store.js +169 -0
  41. package/dist/emulate/core/store.js.map +1 -0
  42. package/dist/emulate/index.d.ts +25 -0
  43. package/dist/emulate/index.js +47 -0
  44. package/dist/emulate/index.js.map +1 -0
  45. package/dist/emulate/workos/constants.d.ts +56 -0
  46. package/dist/emulate/workos/constants.js +56 -0
  47. package/dist/emulate/workos/constants.js.map +1 -0
  48. package/dist/emulate/workos/entities.d.ts +360 -0
  49. package/dist/emulate/workos/entities.js +2 -0
  50. package/dist/emulate/workos/entities.js.map +1 -0
  51. package/dist/emulate/workos/event-bus.d.ts +17 -0
  52. package/dist/emulate/workos/event-bus.js +70 -0
  53. package/dist/emulate/workos/event-bus.js.map +1 -0
  54. package/dist/emulate/workos/helpers.d.ts +72 -0
  55. package/dist/emulate/workos/helpers.js +211 -0
  56. package/dist/emulate/workos/helpers.js.map +1 -0
  57. package/dist/emulate/workos/index.d.ts +91 -0
  58. package/dist/emulate/workos/index.js +322 -0
  59. package/dist/emulate/workos/index.js.map +1 -0
  60. package/dist/emulate/workos/role-helpers.d.ts +21 -0
  61. package/dist/emulate/workos/role-helpers.js +130 -0
  62. package/dist/emulate/workos/role-helpers.js.map +1 -0
  63. package/dist/emulate/workos/routes/api-keys.d.ts +2 -0
  64. package/dist/emulate/workos/routes/api-keys.js +32 -0
  65. package/dist/emulate/workos/routes/api-keys.js.map +1 -0
  66. package/dist/emulate/workos/routes/audit-logs.d.ts +2 -0
  67. package/dist/emulate/workos/routes/audit-logs.js +104 -0
  68. package/dist/emulate/workos/routes/audit-logs.js.map +1 -0
  69. package/dist/emulate/workos/routes/auth-challenges.d.ts +2 -0
  70. package/dist/emulate/workos/routes/auth-challenges.js +51 -0
  71. package/dist/emulate/workos/routes/auth-challenges.js.map +1 -0
  72. package/dist/emulate/workos/routes/auth-factors.d.ts +2 -0
  73. package/dist/emulate/workos/routes/auth-factors.js +51 -0
  74. package/dist/emulate/workos/routes/auth-factors.js.map +1 -0
  75. package/dist/emulate/workos/routes/auth.d.ts +2 -0
  76. package/dist/emulate/workos/routes/auth.js +350 -0
  77. package/dist/emulate/workos/routes/auth.js.map +1 -0
  78. package/dist/emulate/workos/routes/authorization-checks.d.ts +10 -0
  79. package/dist/emulate/workos/routes/authorization-checks.js +123 -0
  80. package/dist/emulate/workos/routes/authorization-checks.js.map +1 -0
  81. package/dist/emulate/workos/routes/authorization-org-roles.d.ts +2 -0
  82. package/dist/emulate/workos/routes/authorization-org-roles.js +64 -0
  83. package/dist/emulate/workos/routes/authorization-org-roles.js.map +1 -0
  84. package/dist/emulate/workos/routes/authorization-permissions.d.ts +2 -0
  85. package/dist/emulate/workos/routes/authorization-permissions.js +67 -0
  86. package/dist/emulate/workos/routes/authorization-permissions.js.map +1 -0
  87. package/dist/emulate/workos/routes/authorization-resources.d.ts +2 -0
  88. package/dist/emulate/workos/routes/authorization-resources.js +117 -0
  89. package/dist/emulate/workos/routes/authorization-resources.js.map +1 -0
  90. package/dist/emulate/workos/routes/authorization-roles.d.ts +2 -0
  91. package/dist/emulate/workos/routes/authorization-roles.js +13 -0
  92. package/dist/emulate/workos/routes/authorization-roles.js.map +1 -0
  93. package/dist/emulate/workos/routes/config.d.ts +2 -0
  94. package/dist/emulate/workos/routes/config.js +57 -0
  95. package/dist/emulate/workos/routes/config.js.map +1 -0
  96. package/dist/emulate/workos/routes/connect.d.ts +2 -0
  97. package/dist/emulate/workos/routes/connect.js +65 -0
  98. package/dist/emulate/workos/routes/connect.js.map +1 -0
  99. package/dist/emulate/workos/routes/connections.d.ts +2 -0
  100. package/dist/emulate/workos/routes/connections.js +73 -0
  101. package/dist/emulate/workos/routes/connections.js.map +1 -0
  102. package/dist/emulate/workos/routes/data-integrations.d.ts +2 -0
  103. package/dist/emulate/workos/routes/data-integrations.js +55 -0
  104. package/dist/emulate/workos/routes/data-integrations.js.map +1 -0
  105. package/dist/emulate/workos/routes/directories.d.ts +2 -0
  106. package/dist/emulate/workos/routes/directories.js +90 -0
  107. package/dist/emulate/workos/routes/directories.js.map +1 -0
  108. package/dist/emulate/workos/routes/email-verification.d.ts +2 -0
  109. package/dist/emulate/workos/routes/email-verification.js +49 -0
  110. package/dist/emulate/workos/routes/email-verification.js.map +1 -0
  111. package/dist/emulate/workos/routes/events.d.ts +2 -0
  112. package/dist/emulate/workos/routes/events.js +18 -0
  113. package/dist/emulate/workos/routes/events.js.map +1 -0
  114. package/dist/emulate/workos/routes/feature-flags.d.ts +2 -0
  115. package/dist/emulate/workos/routes/feature-flags.js +103 -0
  116. package/dist/emulate/workos/routes/feature-flags.js.map +1 -0
  117. package/dist/emulate/workos/routes/invitations.d.ts +2 -0
  118. package/dist/emulate/workos/routes/invitations.js +122 -0
  119. package/dist/emulate/workos/routes/invitations.js.map +1 -0
  120. package/dist/emulate/workos/routes/legacy-mfa.d.ts +2 -0
  121. package/dist/emulate/workos/routes/legacy-mfa.js +75 -0
  122. package/dist/emulate/workos/routes/legacy-mfa.js.map +1 -0
  123. package/dist/emulate/workos/routes/magic-auth.d.ts +2 -0
  124. package/dist/emulate/workos/routes/magic-auth.js +32 -0
  125. package/dist/emulate/workos/routes/magic-auth.js.map +1 -0
  126. package/dist/emulate/workos/routes/memberships.d.ts +2 -0
  127. package/dist/emulate/workos/routes/memberships.js +114 -0
  128. package/dist/emulate/workos/routes/memberships.js.map +1 -0
  129. package/dist/emulate/workos/routes/organization-domains.d.ts +2 -0
  130. package/dist/emulate/workos/routes/organization-domains.js +58 -0
  131. package/dist/emulate/workos/routes/organization-domains.js.map +1 -0
  132. package/dist/emulate/workos/routes/organizations.d.ts +2 -0
  133. package/dist/emulate/workos/routes/organizations.js +131 -0
  134. package/dist/emulate/workos/routes/organizations.js.map +1 -0
  135. package/dist/emulate/workos/routes/password-reset.d.ts +2 -0
  136. package/dist/emulate/workos/routes/password-reset.js +61 -0
  137. package/dist/emulate/workos/routes/password-reset.js.map +1 -0
  138. package/dist/emulate/workos/routes/pipes.d.ts +2 -0
  139. package/dist/emulate/workos/routes/pipes.js +82 -0
  140. package/dist/emulate/workos/routes/pipes.js.map +1 -0
  141. package/dist/emulate/workos/routes/portal.d.ts +2 -0
  142. package/dist/emulate/workos/routes/portal.js +18 -0
  143. package/dist/emulate/workos/routes/portal.js.map +1 -0
  144. package/dist/emulate/workos/routes/radar.d.ts +2 -0
  145. package/dist/emulate/workos/routes/radar.js +41 -0
  146. package/dist/emulate/workos/routes/radar.js.map +1 -0
  147. package/dist/emulate/workos/routes/sessions.d.ts +2 -0
  148. package/dist/emulate/workos/routes/sessions.js +51 -0
  149. package/dist/emulate/workos/routes/sessions.js.map +1 -0
  150. package/dist/emulate/workos/routes/sso.d.ts +2 -0
  151. package/dist/emulate/workos/routes/sso.js +161 -0
  152. package/dist/emulate/workos/routes/sso.js.map +1 -0
  153. package/dist/emulate/workos/routes/user-features.d.ts +2 -0
  154. package/dist/emulate/workos/routes/user-features.js +50 -0
  155. package/dist/emulate/workos/routes/user-features.js.map +1 -0
  156. package/dist/emulate/workos/routes/users.d.ts +2 -0
  157. package/dist/emulate/workos/routes/users.js +129 -0
  158. package/dist/emulate/workos/routes/users.js.map +1 -0
  159. package/dist/emulate/workos/routes/webhook-endpoints.d.ts +2 -0
  160. package/dist/emulate/workos/routes/webhook-endpoints.js +66 -0
  161. package/dist/emulate/workos/routes/webhook-endpoints.js.map +1 -0
  162. package/dist/emulate/workos/routes/widgets.d.ts +2 -0
  163. package/dist/emulate/workos/routes/widgets.js +27 -0
  164. package/dist/emulate/workos/routes/widgets.js.map +1 -0
  165. package/dist/emulate/workos/store.d.ts +48 -0
  166. package/dist/emulate/workos/store.js +102 -0
  167. package/dist/emulate/workos/store.js.map +1 -0
  168. package/dist/emulate/workos/webhook-signer.d.ts +1 -0
  169. package/dist/emulate/workos/webhook-signer.js +8 -0
  170. package/dist/emulate/workos/webhook-signer.js.map +1 -0
  171. package/dist/gen-routes-lib.spec.ts +659 -0
  172. package/dist/gen-routes-lib.ts +647 -0
  173. package/dist/gen-routes.ts +96 -0
  174. package/dist/lib/dev-command.d.ts +26 -0
  175. package/dist/lib/dev-command.js +122 -0
  176. package/dist/lib/dev-command.js.map +1 -0
  177. package/dist/lib/run-with-core.js +0 -3
  178. package/dist/lib/run-with-core.js.map +1 -1
  179. package/dist/lib/settings.js +1 -1
  180. package/dist/lib/settings.js.map +1 -1
  181. package/dist/utils/help-json.js +1 -0
  182. package/dist/utils/help-json.js.map +1 -1
  183. package/dist/utils/register-subcommand.d.ts +5 -2
  184. package/dist/utils/register-subcommand.js +16 -19
  185. package/dist/utils/register-subcommand.js.map +1 -1
  186. package/package.json +21 -8
@@ -0,0 +1,27 @@
1
+ import { parseJsonBody, validationError } from '../../core/index.js';
2
+ export function widgetRoutes(ctx) {
3
+ const { app, jwt } = ctx;
4
+ app.post('/widgets/token', async (c) => {
5
+ const body = await parseJsonBody(c);
6
+ const organizationId = body.organization_id;
7
+ const userId = body.user_id;
8
+ const scopes = body.scopes;
9
+ if (!organizationId) {
10
+ throw validationError('organization_id is required', [{ field: 'organization_id', code: 'required' }]);
11
+ }
12
+ if (!userId) {
13
+ throw validationError('user_id is required', [{ field: 'user_id', code: 'required' }]);
14
+ }
15
+ if (!scopes || !Array.isArray(scopes)) {
16
+ throw validationError('scopes is required', [{ field: 'scopes', code: 'required' }]);
17
+ }
18
+ const token = jwt.sign({
19
+ sub: userId,
20
+ org_id: organizationId,
21
+ aud: 'widgets',
22
+ scopes,
23
+ });
24
+ return c.json({ token });
25
+ });
26
+ }
27
+ //# sourceMappingURL=widgets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.js","sourceRoot":"","sources":["../../../../src/emulate/workos/routes/widgets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAExF,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC5C,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAEzB,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,cAAc,GAAG,IAAI,CAAC,eAAqC,CAAC;QAClE,MAAM,MAAM,GAAG,IAAI,CAAC,OAA6B,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,MAA8B,CAAC;QAEnD,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,eAAe,CAAC,6BAA6B,EAAE,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QACzG,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,eAAe,CAAC,qBAAqB,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QACzF,CAAC;QACD,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,MAAM,eAAe,CAAC,oBAAoB,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QACvF,CAAC;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC;YACrB,GAAG,EAAE,MAAM;YACX,MAAM,EAAE,cAAc;YACtB,GAAG,EAAE,SAAS;YACd,MAAM;SACA,CAAC,CAAC;QAEV,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { type RouteContext, parseJsonBody, validationError } from '../../core/index.js';\n\nexport function widgetRoutes(ctx: RouteContext): void {\n const { app, jwt } = ctx;\n\n app.post('/widgets/token', async (c) => {\n const body = await parseJsonBody(c);\n const organizationId = body.organization_id as string | undefined;\n const userId = body.user_id as string | undefined;\n const scopes = body.scopes as string[] | undefined;\n\n if (!organizationId) {\n throw validationError('organization_id is required', [{ field: 'organization_id', code: 'required' }]);\n }\n if (!userId) {\n throw validationError('user_id is required', [{ field: 'user_id', code: 'required' }]);\n }\n if (!scopes || !Array.isArray(scopes)) {\n throw validationError('scopes is required', [{ field: 'scopes', code: 'required' }]);\n }\n\n const token = jwt.sign({\n sub: userId,\n org_id: organizationId,\n aud: 'widgets',\n scopes,\n } as any);\n\n return c.json({ token });\n });\n}\n"]}
@@ -0,0 +1,48 @@
1
+ import { type Store, type Collection } from '../core/index.js';
2
+ import type { WorkOSOrganization, WorkOSOrganizationDomain, WorkOSOrganizationMembership, WorkOSUser, WorkOSSession, WorkOSEmailVerification, WorkOSPasswordReset, WorkOSMagicAuth, WorkOSAuthenticationFactor, WorkOSAuthorizationCode, WorkOSIdentity, WorkOSConnection, WorkOSSSOProfile, WorkOSSSOAuthorization, WorkOSPipeConnection, WorkOSRefreshToken, WorkOSAuthenticationChallenge, WorkOSDeviceAuthorization, WorkOSInvitation, WorkOSRedirectUri, WorkOSCorsOrigin, WorkOSAuthorizedApplication, WorkOSConnectedAccount, WorkOSRole, WorkOSPermission, WorkOSRolePermission, WorkOSAuthorizationResource, WorkOSRoleAssignment, WorkOSDirectory, WorkOSDirectoryUser, WorkOSDirectoryGroup, WorkOSAuditLogAction, WorkOSAuditLogEvent, WorkOSAuditLogExport, WorkOSFeatureFlag, WorkOSFlagTarget, WorkOSConnectApplication, WorkOSClientSecret, WorkOSDataIntegrationAuth, WorkOSRadarAttempt, WorkOSApiKey, WorkOSEvent, WorkOSWebhookEndpoint } from './entities.js';
3
+ export interface WorkOSStore {
4
+ organizations: Collection<WorkOSOrganization>;
5
+ organizationDomains: Collection<WorkOSOrganizationDomain>;
6
+ organizationMemberships: Collection<WorkOSOrganizationMembership>;
7
+ users: Collection<WorkOSUser>;
8
+ sessions: Collection<WorkOSSession>;
9
+ emailVerifications: Collection<WorkOSEmailVerification>;
10
+ passwordResets: Collection<WorkOSPasswordReset>;
11
+ magicAuths: Collection<WorkOSMagicAuth>;
12
+ authFactors: Collection<WorkOSAuthenticationFactor>;
13
+ authCodes: Collection<WorkOSAuthorizationCode>;
14
+ identities: Collection<WorkOSIdentity>;
15
+ connections: Collection<WorkOSConnection>;
16
+ ssoProfiles: Collection<WorkOSSSOProfile>;
17
+ ssoAuthorizations: Collection<WorkOSSSOAuthorization>;
18
+ pipeConnections: Collection<WorkOSPipeConnection>;
19
+ refreshTokens: Collection<WorkOSRefreshToken>;
20
+ authChallenges: Collection<WorkOSAuthenticationChallenge>;
21
+ deviceAuthorizations: Collection<WorkOSDeviceAuthorization>;
22
+ invitations: Collection<WorkOSInvitation>;
23
+ redirectUris: Collection<WorkOSRedirectUri>;
24
+ corsOrigins: Collection<WorkOSCorsOrigin>;
25
+ authorizedApplications: Collection<WorkOSAuthorizedApplication>;
26
+ connectedAccounts: Collection<WorkOSConnectedAccount>;
27
+ roles: Collection<WorkOSRole>;
28
+ permissions: Collection<WorkOSPermission>;
29
+ rolePermissions: Collection<WorkOSRolePermission>;
30
+ authorizationResources: Collection<WorkOSAuthorizationResource>;
31
+ roleAssignments: Collection<WorkOSRoleAssignment>;
32
+ directories: Collection<WorkOSDirectory>;
33
+ directoryUsers: Collection<WorkOSDirectoryUser>;
34
+ directoryGroups: Collection<WorkOSDirectoryGroup>;
35
+ auditLogActions: Collection<WorkOSAuditLogAction>;
36
+ auditLogEvents: Collection<WorkOSAuditLogEvent>;
37
+ auditLogExports: Collection<WorkOSAuditLogExport>;
38
+ featureFlags: Collection<WorkOSFeatureFlag>;
39
+ flagTargets: Collection<WorkOSFlagTarget>;
40
+ connectApplications: Collection<WorkOSConnectApplication>;
41
+ clientSecrets: Collection<WorkOSClientSecret>;
42
+ dataIntegrationAuths: Collection<WorkOSDataIntegrationAuth>;
43
+ radarAttempts: Collection<WorkOSRadarAttempt>;
44
+ apiKeyRecords: Collection<WorkOSApiKey>;
45
+ events: Collection<WorkOSEvent>;
46
+ webhookEndpoints: Collection<WorkOSWebhookEndpoint>;
47
+ }
48
+ export declare function getWorkOSStore(store: Store): WorkOSStore;
@@ -0,0 +1,102 @@
1
+ import { ID_PREFIXES } from '../core/index.js';
2
+ import { STORE_KEYS } from './constants.js';
3
+ export function getWorkOSStore(store) {
4
+ const cached = store.getData(STORE_KEYS.workosStore);
5
+ if (cached)
6
+ return cached;
7
+ const ws = {
8
+ organizations: store.collection('workos.organizations', ID_PREFIXES.organization, [
9
+ 'name',
10
+ 'external_id',
11
+ ]),
12
+ organizationDomains: store.collection('workos.organization_domains', ID_PREFIXES.organization_domain, ['organization_id', 'domain']),
13
+ organizationMemberships: store.collection('workos.organization_memberships', ID_PREFIXES.organization_membership, ['organization_id', 'user_id']),
14
+ users: store.collection('workos.users', ID_PREFIXES.user, ['email', 'external_id']),
15
+ sessions: store.collection('workos.sessions', ID_PREFIXES.session, ['user_id']),
16
+ emailVerifications: store.collection('workos.email_verifications', ID_PREFIXES.email_verification, ['user_id']),
17
+ passwordResets: store.collection('workos.password_resets', ID_PREFIXES.password_reset, [
18
+ 'user_id',
19
+ ]),
20
+ magicAuths: store.collection('workos.magic_auths', ID_PREFIXES.magic_auth, ['user_id']),
21
+ authFactors: store.collection('workos.auth_factors', ID_PREFIXES.authentication_factor, ['user_id']),
22
+ authCodes: store.collection('workos.auth_codes', ID_PREFIXES.authorization_code, [
23
+ 'user_id',
24
+ 'code',
25
+ ]),
26
+ identities: store.collection('workos.identities', ID_PREFIXES.identity, ['user_id']),
27
+ connections: store.collection('workos.connections', ID_PREFIXES.connection, ['organization_id']),
28
+ ssoProfiles: store.collection('workos.sso_profiles', ID_PREFIXES.profile, [
29
+ 'connection_id',
30
+ 'email',
31
+ ]),
32
+ ssoAuthorizations: store.collection('workos.sso_authorizations', ID_PREFIXES.sso_authorization, ['code']),
33
+ pipeConnections: store.collection('workos.pipe_connections', ID_PREFIXES.pipe_connection, [
34
+ 'user_id',
35
+ 'provider',
36
+ ]),
37
+ refreshTokens: store.collection('workos.refresh_tokens', ID_PREFIXES.refresh_token, [
38
+ 'token',
39
+ 'user_id',
40
+ 'session_id',
41
+ ]),
42
+ authChallenges: store.collection('workos.auth_challenges', ID_PREFIXES.authentication_challenge, ['user_id', 'factor_id']),
43
+ deviceAuthorizations: store.collection('workos.device_authorizations', ID_PREFIXES.device_authorization, ['device_code', 'user_code']),
44
+ invitations: store.collection('workos.invitations', ID_PREFIXES.invitation, [
45
+ 'email',
46
+ 'token',
47
+ 'organization_id',
48
+ ]),
49
+ redirectUris: store.collection('workos.redirect_uris', ID_PREFIXES.redirect_uri, ['uri']),
50
+ corsOrigins: store.collection('workos.cors_origins', ID_PREFIXES.cors_origin, ['origin']),
51
+ authorizedApplications: store.collection('workos.authorized_applications', ID_PREFIXES.authorized_application, ['user_id']),
52
+ connectedAccounts: store.collection('workos.connected_accounts', ID_PREFIXES.connected_account, ['user_id', 'provider']),
53
+ roles: store.collection('workos.roles', ID_PREFIXES.role, ['slug', 'organization_id']),
54
+ permissions: store.collection('workos.permissions', ID_PREFIXES.permission, ['slug']),
55
+ rolePermissions: store.collection('workos.role_permissions', ID_PREFIXES.role_permission, [
56
+ 'role_id',
57
+ 'permission_id',
58
+ ]),
59
+ authorizationResources: store.collection('workos.authorization_resources', ID_PREFIXES.authorization_resource, ['organization_id', 'resource_type_slug']),
60
+ roleAssignments: store.collection('workos.role_assignments', ID_PREFIXES.role_assignment, [
61
+ 'organization_membership_id',
62
+ 'role_id',
63
+ ]),
64
+ directories: store.collection('workos.directories', ID_PREFIXES.directory, ['organization_id']),
65
+ directoryUsers: store.collection('workos.directory_users', ID_PREFIXES.directory_user, [
66
+ 'directory_id',
67
+ 'organization_id',
68
+ ]),
69
+ directoryGroups: store.collection('workos.directory_groups', ID_PREFIXES.directory_group, [
70
+ 'directory_id',
71
+ 'organization_id',
72
+ ]),
73
+ auditLogActions: store.collection('workos.audit_log_actions', ID_PREFIXES.audit_log_action, [
74
+ 'name',
75
+ ]),
76
+ auditLogEvents: store.collection('workos.audit_log_events', ID_PREFIXES.audit_log_event, [
77
+ 'organization_id',
78
+ ]),
79
+ auditLogExports: store.collection('workos.audit_log_exports', ID_PREFIXES.audit_log_export, [
80
+ 'organization_id',
81
+ ]),
82
+ featureFlags: store.collection('workos.feature_flags', ID_PREFIXES.feature_flag, ['slug']),
83
+ flagTargets: store.collection('workos.flag_targets', ID_PREFIXES.flag_target, [
84
+ 'flag_slug',
85
+ 'resource_id',
86
+ ]),
87
+ connectApplications: store.collection('workos.connect_applications', ID_PREFIXES.connect_application, ['client_id']),
88
+ clientSecrets: store.collection('workos.client_secrets', ID_PREFIXES.client_secret, [
89
+ 'application_id',
90
+ ]),
91
+ dataIntegrationAuths: store.collection('workos.data_integration_auths', ID_PREFIXES.data_integration_auth, ['code', 'slug']),
92
+ radarAttempts: store.collection('workos.radar_attempts', ID_PREFIXES.radar_attempt, [
93
+ 'ip_address',
94
+ ]),
95
+ apiKeyRecords: store.collection('workos.api_keys', ID_PREFIXES.api_key, ['key', 'environment']),
96
+ events: store.collection('workos.events', ID_PREFIXES.event, ['event']),
97
+ webhookEndpoints: store.collection('workos.webhook_endpoints', ID_PREFIXES.webhook_endpoint, ['url']),
98
+ };
99
+ store.setData(STORE_KEYS.workosStore, ws);
100
+ return ws;
101
+ }
102
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/emulate/workos/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA6F5C,MAAM,UAAU,cAAc,CAAC,KAAY;IACzC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAc,UAAU,CAAC,WAAW,CAAC,CAAC;IAClE,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,MAAM,EAAE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CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC1C,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import { type Store, type Collection, ID_PREFIXES } from '../core/index.js';\nimport { STORE_KEYS } from './constants.js';\nimport type {\n WorkOSOrganization,\n WorkOSOrganizationDomain,\n WorkOSOrganizationMembership,\n WorkOSUser,\n WorkOSSession,\n WorkOSEmailVerification,\n WorkOSPasswordReset,\n WorkOSMagicAuth,\n WorkOSAuthenticationFactor,\n WorkOSAuthorizationCode,\n WorkOSIdentity,\n WorkOSConnection,\n WorkOSSSOProfile,\n WorkOSSSOAuthorization,\n WorkOSPipeConnection,\n WorkOSRefreshToken,\n WorkOSAuthenticationChallenge,\n WorkOSDeviceAuthorization,\n WorkOSInvitation,\n WorkOSRedirectUri,\n WorkOSCorsOrigin,\n WorkOSAuthorizedApplication,\n WorkOSConnectedAccount,\n WorkOSRole,\n WorkOSPermission,\n WorkOSRolePermission,\n WorkOSAuthorizationResource,\n WorkOSRoleAssignment,\n WorkOSDirectory,\n WorkOSDirectoryUser,\n WorkOSDirectoryGroup,\n WorkOSAuditLogAction,\n WorkOSAuditLogEvent,\n WorkOSAuditLogExport,\n WorkOSFeatureFlag,\n WorkOSFlagTarget,\n WorkOSConnectApplication,\n WorkOSClientSecret,\n WorkOSDataIntegrationAuth,\n WorkOSRadarAttempt,\n WorkOSApiKey,\n WorkOSEvent,\n WorkOSWebhookEndpoint,\n} from './entities.js';\n\nexport interface WorkOSStore {\n organizations: Collection<WorkOSOrganization>;\n organizationDomains: Collection<WorkOSOrganizationDomain>;\n organizationMemberships: Collection<WorkOSOrganizationMembership>;\n users: Collection<WorkOSUser>;\n sessions: Collection<WorkOSSession>;\n emailVerifications: Collection<WorkOSEmailVerification>;\n passwordResets: Collection<WorkOSPasswordReset>;\n magicAuths: Collection<WorkOSMagicAuth>;\n authFactors: Collection<WorkOSAuthenticationFactor>;\n authCodes: Collection<WorkOSAuthorizationCode>;\n identities: Collection<WorkOSIdentity>;\n connections: Collection<WorkOSConnection>;\n ssoProfiles: Collection<WorkOSSSOProfile>;\n ssoAuthorizations: Collection<WorkOSSSOAuthorization>;\n pipeConnections: Collection<WorkOSPipeConnection>;\n refreshTokens: Collection<WorkOSRefreshToken>;\n authChallenges: Collection<WorkOSAuthenticationChallenge>;\n deviceAuthorizations: Collection<WorkOSDeviceAuthorization>;\n invitations: Collection<WorkOSInvitation>;\n redirectUris: Collection<WorkOSRedirectUri>;\n corsOrigins: Collection<WorkOSCorsOrigin>;\n authorizedApplications: Collection<WorkOSAuthorizedApplication>;\n connectedAccounts: Collection<WorkOSConnectedAccount>;\n roles: Collection<WorkOSRole>;\n permissions: Collection<WorkOSPermission>;\n rolePermissions: Collection<WorkOSRolePermission>;\n authorizationResources: Collection<WorkOSAuthorizationResource>;\n roleAssignments: Collection<WorkOSRoleAssignment>;\n directories: Collection<WorkOSDirectory>;\n directoryUsers: Collection<WorkOSDirectoryUser>;\n directoryGroups: Collection<WorkOSDirectoryGroup>;\n auditLogActions: Collection<WorkOSAuditLogAction>;\n auditLogEvents: Collection<WorkOSAuditLogEvent>;\n auditLogExports: Collection<WorkOSAuditLogExport>;\n featureFlags: Collection<WorkOSFeatureFlag>;\n flagTargets: Collection<WorkOSFlagTarget>;\n connectApplications: Collection<WorkOSConnectApplication>;\n clientSecrets: Collection<WorkOSClientSecret>;\n dataIntegrationAuths: Collection<WorkOSDataIntegrationAuth>;\n radarAttempts: Collection<WorkOSRadarAttempt>;\n apiKeyRecords: Collection<WorkOSApiKey>;\n events: Collection<WorkOSEvent>;\n webhookEndpoints: Collection<WorkOSWebhookEndpoint>;\n}\n\nexport function getWorkOSStore(store: Store): WorkOSStore {\n const cached = store.getData<WorkOSStore>(STORE_KEYS.workosStore);\n if (cached) return cached;\n\n const ws: WorkOSStore = {\n organizations: store.collection<WorkOSOrganization>('workos.organizations', ID_PREFIXES.organization, [\n 'name',\n 'external_id',\n ]),\n organizationDomains: store.collection<WorkOSOrganizationDomain>(\n 'workos.organization_domains',\n ID_PREFIXES.organization_domain,\n ['organization_id', 'domain'],\n ),\n organizationMemberships: store.collection<WorkOSOrganizationMembership>(\n 'workos.organization_memberships',\n ID_PREFIXES.organization_membership,\n ['organization_id', 'user_id'],\n ),\n users: store.collection<WorkOSUser>('workos.users', ID_PREFIXES.user, ['email', 'external_id']),\n sessions: store.collection<WorkOSSession>('workos.sessions', ID_PREFIXES.session, ['user_id']),\n emailVerifications: store.collection<WorkOSEmailVerification>(\n 'workos.email_verifications',\n ID_PREFIXES.email_verification,\n ['user_id'],\n ),\n passwordResets: store.collection<WorkOSPasswordReset>('workos.password_resets', ID_PREFIXES.password_reset, [\n 'user_id',\n ]),\n magicAuths: store.collection<WorkOSMagicAuth>('workos.magic_auths', ID_PREFIXES.magic_auth, ['user_id']),\n authFactors: store.collection<WorkOSAuthenticationFactor>(\n 'workos.auth_factors',\n ID_PREFIXES.authentication_factor,\n ['user_id'],\n ),\n authCodes: store.collection<WorkOSAuthorizationCode>('workos.auth_codes', ID_PREFIXES.authorization_code, [\n 'user_id',\n 'code',\n ]),\n identities: store.collection<WorkOSIdentity>('workos.identities', ID_PREFIXES.identity, ['user_id']),\n connections: store.collection<WorkOSConnection>('workos.connections', ID_PREFIXES.connection, ['organization_id']),\n ssoProfiles: store.collection<WorkOSSSOProfile>('workos.sso_profiles', ID_PREFIXES.profile, [\n 'connection_id',\n 'email',\n ]),\n ssoAuthorizations: store.collection<WorkOSSSOAuthorization>(\n 'workos.sso_authorizations',\n ID_PREFIXES.sso_authorization,\n ['code'],\n ),\n pipeConnections: store.collection<WorkOSPipeConnection>('workos.pipe_connections', ID_PREFIXES.pipe_connection, [\n 'user_id',\n 'provider',\n ]),\n refreshTokens: store.collection<WorkOSRefreshToken>('workos.refresh_tokens', ID_PREFIXES.refresh_token, [\n 'token',\n 'user_id',\n 'session_id',\n ]),\n authChallenges: store.collection<WorkOSAuthenticationChallenge>(\n 'workos.auth_challenges',\n ID_PREFIXES.authentication_challenge,\n ['user_id', 'factor_id'],\n ),\n deviceAuthorizations: store.collection<WorkOSDeviceAuthorization>(\n 'workos.device_authorizations',\n ID_PREFIXES.device_authorization,\n ['device_code', 'user_code'],\n ),\n invitations: store.collection<WorkOSInvitation>('workos.invitations', ID_PREFIXES.invitation, [\n 'email',\n 'token',\n 'organization_id',\n ]),\n redirectUris: store.collection<WorkOSRedirectUri>('workos.redirect_uris', ID_PREFIXES.redirect_uri, ['uri']),\n corsOrigins: store.collection<WorkOSCorsOrigin>('workos.cors_origins', ID_PREFIXES.cors_origin, ['origin']),\n authorizedApplications: store.collection<WorkOSAuthorizedApplication>(\n 'workos.authorized_applications',\n ID_PREFIXES.authorized_application,\n ['user_id'],\n ),\n connectedAccounts: store.collection<WorkOSConnectedAccount>(\n 'workos.connected_accounts',\n ID_PREFIXES.connected_account,\n ['user_id', 'provider'],\n ),\n roles: store.collection<WorkOSRole>('workos.roles', ID_PREFIXES.role, ['slug', 'organization_id']),\n permissions: store.collection<WorkOSPermission>('workos.permissions', ID_PREFIXES.permission, ['slug']),\n rolePermissions: store.collection<WorkOSRolePermission>('workos.role_permissions', ID_PREFIXES.role_permission, [\n 'role_id',\n 'permission_id',\n ]),\n authorizationResources: store.collection<WorkOSAuthorizationResource>(\n 'workos.authorization_resources',\n ID_PREFIXES.authorization_resource,\n ['organization_id', 'resource_type_slug'],\n ),\n roleAssignments: store.collection<WorkOSRoleAssignment>('workos.role_assignments', ID_PREFIXES.role_assignment, [\n 'organization_membership_id',\n 'role_id',\n ]),\n directories: store.collection<WorkOSDirectory>('workos.directories', ID_PREFIXES.directory, ['organization_id']),\n directoryUsers: store.collection<WorkOSDirectoryUser>('workos.directory_users', ID_PREFIXES.directory_user, [\n 'directory_id',\n 'organization_id',\n ]),\n directoryGroups: store.collection<WorkOSDirectoryGroup>('workos.directory_groups', ID_PREFIXES.directory_group, [\n 'directory_id',\n 'organization_id',\n ]),\n auditLogActions: store.collection<WorkOSAuditLogAction>('workos.audit_log_actions', ID_PREFIXES.audit_log_action, [\n 'name',\n ]),\n auditLogEvents: store.collection<WorkOSAuditLogEvent>('workos.audit_log_events', ID_PREFIXES.audit_log_event, [\n 'organization_id',\n ]),\n auditLogExports: store.collection<WorkOSAuditLogExport>('workos.audit_log_exports', ID_PREFIXES.audit_log_export, [\n 'organization_id',\n ]),\n featureFlags: store.collection<WorkOSFeatureFlag>('workos.feature_flags', ID_PREFIXES.feature_flag, ['slug']),\n flagTargets: store.collection<WorkOSFlagTarget>('workos.flag_targets', ID_PREFIXES.flag_target, [\n 'flag_slug',\n 'resource_id',\n ]),\n connectApplications: store.collection<WorkOSConnectApplication>(\n 'workos.connect_applications',\n ID_PREFIXES.connect_application,\n ['client_id'],\n ),\n clientSecrets: store.collection<WorkOSClientSecret>('workos.client_secrets', ID_PREFIXES.client_secret, [\n 'application_id',\n ]),\n dataIntegrationAuths: store.collection<WorkOSDataIntegrationAuth>(\n 'workos.data_integration_auths',\n ID_PREFIXES.data_integration_auth,\n ['code', 'slug'],\n ),\n radarAttempts: store.collection<WorkOSRadarAttempt>('workos.radar_attempts', ID_PREFIXES.radar_attempt, [\n 'ip_address',\n ]),\n apiKeyRecords: store.collection<WorkOSApiKey>('workos.api_keys', ID_PREFIXES.api_key, ['key', 'environment']),\n events: store.collection<WorkOSEvent>('workos.events', ID_PREFIXES.event, ['event']),\n webhookEndpoints: store.collection<WorkOSWebhookEndpoint>(\n 'workos.webhook_endpoints',\n ID_PREFIXES.webhook_endpoint,\n ['url'],\n ),\n };\n\n store.setData(STORE_KEYS.workosStore, ws);\n return ws;\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function signWebhookPayload(payload: string, secret: string): string;
@@ -0,0 +1,8 @@
1
+ import { createHmac } from 'node:crypto';
2
+ export function signWebhookPayload(payload, secret) {
3
+ const timestamp = Math.floor(Date.now() / 1000).toString();
4
+ const signedPayload = `${timestamp}.${payload}`;
5
+ const signature = createHmac('sha256', secret).update(signedPayload).digest('hex');
6
+ return `t=${timestamp},v1=${signature}`;
7
+ }
8
+ //# sourceMappingURL=webhook-signer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-signer.js","sourceRoot":"","sources":["../../../src/emulate/workos/webhook-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,MAAc;IAChE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3D,MAAM,aAAa,GAAG,GAAG,SAAS,IAAI,OAAO,EAAE,CAAC;IAChD,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEnF,OAAO,KAAK,SAAS,OAAO,SAAS,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["import { createHmac } from 'node:crypto';\n\nexport function signWebhookPayload(payload: string, secret: string): string {\n const timestamp = Math.floor(Date.now() / 1000).toString();\n const signedPayload = `${timestamp}.${payload}`;\n const signature = createHmac('sha256', secret).update(signedPayload).digest('hex');\n\n return `t=${timestamp},v1=${signature}`;\n}\n"]}