workos 0.18.0 → 0.19.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 +8 -145
- package/dist/bin.js +129 -50
- package/dist/bin.js.map +1 -1
- package/dist/commands/api/index.js +18 -10
- package/dist/commands/api/index.js.map +1 -1
- package/dist/commands/api/interactive.js +11 -11
- package/dist/commands/api/interactive.js.map +1 -1
- package/dist/commands/claim.js +28 -16
- package/dist/commands/claim.js.map +1 -1
- package/dist/commands/connection.js +3 -3
- package/dist/commands/connection.js.map +1 -1
- package/dist/commands/debug.js +6 -6
- package/dist/commands/debug.js.map +1 -1
- package/dist/commands/dev.d.ts +7 -8
- package/dist/commands/dev.js +14 -14
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/directory.js +3 -3
- package/dist/commands/directory.js.map +1 -1
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/emulate.d.ts +1 -0
- package/dist/commands/emulate.js +3 -2
- package/dist/commands/emulate.js.map +1 -1
- package/dist/commands/env.d.ts +10 -0
- package/dist/commands/env.js +94 -18
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/install.js +8 -13
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/login.d.ts +25 -15
- package/dist/commands/login.js +126 -71
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +4 -4
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/mcp.js +7 -16
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/migrations.js +2 -1
- package/dist/commands/migrations.js.map +1 -1
- package/dist/commands/seed.js +5 -4
- package/dist/commands/seed.js.map +1 -1
- package/dist/commands/setup.d.ts +50 -0
- package/dist/commands/setup.js +237 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/vault-run.js +3 -2
- package/dist/commands/vault-run.js.map +1 -1
- package/dist/commands/verify-login.d.ts +25 -0
- package/dist/commands/verify-login.js +158 -0
- package/dist/commands/verify-login.js.map +1 -0
- package/dist/doctor/issues.js +3 -2
- package/dist/doctor/issues.js.map +1 -1
- package/dist/doctor/output.js +2 -1
- package/dist/doctor/output.js.map +1 -1
- package/dist/integrations/dotnet/index.js +1 -1
- package/dist/integrations/dotnet/index.js.map +1 -1
- package/dist/integrations/elixir/index.js +1 -1
- package/dist/integrations/elixir/index.js.map +1 -1
- package/dist/integrations/go/index.js +1 -1
- package/dist/integrations/go/index.js.map +1 -1
- package/dist/integrations/nextjs/index.js +8 -5
- package/dist/integrations/nextjs/index.js.map +1 -1
- package/dist/integrations/nextjs/utils.d.ts +1 -1
- package/dist/integrations/nextjs/utils.js +21 -6
- package/dist/integrations/nextjs/utils.js.map +1 -1
- package/dist/integrations/react-router/index.js +5 -5
- package/dist/integrations/react-router/index.js.map +1 -1
- package/dist/integrations/react-router/utils.js +28 -12
- package/dist/integrations/react-router/utils.js.map +1 -1
- package/dist/integrations/ruby/index.js +1 -1
- package/dist/integrations/ruby/index.js.map +1 -1
- package/dist/lib/adapters/cli-adapter.d.ts +33 -4
- package/dist/lib/adapters/cli-adapter.js +251 -135
- package/dist/lib/adapters/cli-adapter.js.map +1 -1
- package/dist/lib/adapters/dashboard-adapter.js +3 -3
- package/dist/lib/adapters/dashboard-adapter.js.map +1 -1
- package/dist/lib/adapters/headless-adapter.d.ts +7 -0
- package/dist/lib/adapters/headless-adapter.js +42 -5
- package/dist/lib/adapters/headless-adapter.js.map +1 -1
- package/dist/lib/agent-interface.js +15 -1
- package/dist/lib/agent-interface.js.map +1 -1
- package/dist/lib/agent-runner.js +1 -1
- package/dist/lib/agent-runner.js.map +1 -1
- package/dist/lib/api-key.js +2 -1
- package/dist/lib/api-key.js.map +1 -1
- package/dist/lib/completion-data.d.ts +33 -0
- package/dist/lib/completion-data.js +33 -0
- package/dist/lib/completion-data.js.map +1 -0
- package/dist/lib/config-store.d.ts +13 -0
- package/dist/lib/config-store.js +24 -0
- package/dist/lib/config-store.js.map +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/constants.d.ts +8 -0
- package/dist/lib/constants.js +8 -0
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/events.d.ts +34 -1
- package/dist/lib/events.js.map +1 -1
- package/dist/lib/framework-config.d.ts +6 -0
- package/dist/lib/framework-config.js.map +1 -1
- package/dist/lib/installer-core.d.ts +14 -1
- package/dist/lib/installer-core.js +24 -5
- package/dist/lib/installer-core.js.map +1 -1
- package/dist/lib/installer-core.types.d.ts +3 -1
- package/dist/lib/installer-core.types.js.map +1 -1
- package/dist/lib/mcp-clients.d.ts +6 -0
- package/dist/lib/mcp-clients.js +13 -0
- package/dist/lib/mcp-clients.js.map +1 -1
- package/dist/lib/port-detection.js +19 -13
- package/dist/lib/port-detection.js.map +1 -1
- package/dist/lib/preferences.d.ts +30 -2
- package/dist/lib/preferences.js +34 -8
- package/dist/lib/preferences.js.map +1 -1
- package/dist/lib/run-with-core.js +40 -3
- package/dist/lib/run-with-core.js.map +1 -1
- package/dist/lib/telemetry-notice.d.ts +5 -5
- package/dist/lib/telemetry-notice.js +7 -8
- package/dist/lib/telemetry-notice.js.map +1 -1
- package/dist/lib/unclaimed-env-provision.js +15 -12
- package/dist/lib/unclaimed-env-provision.js.map +1 -1
- package/dist/lib/unclaimed-warning.js +4 -3
- package/dist/lib/unclaimed-warning.js.map +1 -1
- package/dist/lib/validation/security-checks.js +2 -1
- package/dist/lib/validation/security-checks.js.map +1 -1
- package/dist/lib/validation/validator.js +30 -3
- package/dist/lib/validation/validator.js.map +1 -1
- package/dist/lib/workos-management.js +26 -19
- package/dist/lib/workos-management.js.map +1 -1
- package/dist/run.d.ts +1 -0
- package/dist/run.js +5 -1
- package/dist/run.js.map +1 -1
- package/dist/steps/add-or-update-environment-variables.js +10 -10
- package/dist/steps/add-or-update-environment-variables.js.map +1 -1
- package/dist/steps/run-prettier.js +3 -3
- package/dist/steps/run-prettier.js.map +1 -1
- package/dist/steps/upload-environment-variables/index.js +15 -3
- package/dist/steps/upload-environment-variables/index.js.map +1 -1
- package/dist/steps/upload-environment-variables/providers/vercel.js +2 -2
- package/dist/steps/upload-environment-variables/providers/vercel.js.map +1 -1
- package/dist/utils/box.d.ts +6 -30
- package/dist/utils/box.js +8 -95
- package/dist/utils/box.js.map +1 -1
- package/dist/utils/cli-symbols.d.ts +14 -2
- package/dist/utils/cli-symbols.js +12 -0
- package/dist/utils/cli-symbols.js.map +1 -1
- package/dist/utils/debug.js +3 -3
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/environment.js +1 -1
- package/dist/utils/environment.js.map +1 -1
- package/dist/utils/help-json.js +115 -4
- package/dist/utils/help-json.js.map +1 -1
- package/dist/utils/package-manager.js +1 -1
- package/dist/utils/package-manager.js.map +1 -1
- package/dist/utils/recovery-hints.d.ts +5 -0
- package/dist/utils/recovery-hints.js +12 -0
- package/dist/utils/recovery-hints.js.map +1 -1
- package/dist/utils/summary-box.d.ts +8 -1
- package/dist/utils/summary-box.js +67 -4
- package/dist/utils/summary-box.js.map +1 -1
- package/dist/utils/types.d.ts +10 -0
- package/dist/utils/types.js.map +1 -1
- package/dist/utils/{clack-utils.d.ts → ui-utils.d.ts} +1 -1
- package/dist/utils/{clack-utils.js → ui-utils.js} +64 -37
- package/dist/utils/ui-utils.js.map +1 -0
- package/dist/utils/ui.d.ts +148 -0
- package/dist/utils/ui.js +368 -0
- package/dist/utils/ui.js.map +1 -0
- package/package.json +5 -13
- package/dist/check-coverage.ts +0 -237
- package/dist/emulate/core/id.d.ts +0 -48
- package/dist/emulate/core/id.js +0 -73
- package/dist/emulate/core/id.js.map +0 -1
- package/dist/emulate/core/index.d.ts +0 -8
- package/dist/emulate/core/index.js +0 -8
- package/dist/emulate/core/index.js.map +0 -1
- package/dist/emulate/core/jwt.d.ts +0 -28
- package/dist/emulate/core/jwt.js +0 -78
- package/dist/emulate/core/jwt.js.map +0 -1
- package/dist/emulate/core/middleware/auth.d.ts +0 -15
- package/dist/emulate/core/middleware/auth.js +0 -17
- package/dist/emulate/core/middleware/auth.js.map +0 -1
- package/dist/emulate/core/middleware/error-handler.d.ts +0 -22
- package/dist/emulate/core/middleware/error-handler.js +0 -72
- package/dist/emulate/core/middleware/error-handler.js.map +0 -1
- package/dist/emulate/core/pagination.d.ts +0 -27
- package/dist/emulate/core/pagination.js +0 -43
- package/dist/emulate/core/pagination.js.map +0 -1
- package/dist/emulate/core/plugin.d.ts +0 -15
- package/dist/emulate/core/plugin.js +0 -2
- package/dist/emulate/core/plugin.js.map +0 -1
- package/dist/emulate/core/server.d.ts +0 -17
- package/dist/emulate/core/server.js +0 -90
- package/dist/emulate/core/server.js.map +0 -1
- package/dist/emulate/core/store.d.ts +0 -44
- package/dist/emulate/core/store.js +0 -169
- package/dist/emulate/core/store.js.map +0 -1
- package/dist/emulate/index.d.ts +0 -25
- package/dist/emulate/index.js +0 -47
- package/dist/emulate/index.js.map +0 -1
- package/dist/emulate/workos/constants.d.ts +0 -56
- package/dist/emulate/workos/constants.js +0 -56
- package/dist/emulate/workos/constants.js.map +0 -1
- package/dist/emulate/workos/entities.d.ts +0 -360
- package/dist/emulate/workos/entities.js +0 -2
- package/dist/emulate/workos/entities.js.map +0 -1
- package/dist/emulate/workos/event-bus.d.ts +0 -17
- package/dist/emulate/workos/event-bus.js +0 -70
- package/dist/emulate/workos/event-bus.js.map +0 -1
- package/dist/emulate/workos/helpers.d.ts +0 -72
- package/dist/emulate/workos/helpers.js +0 -211
- package/dist/emulate/workos/helpers.js.map +0 -1
- package/dist/emulate/workos/index.d.ts +0 -93
- package/dist/emulate/workos/index.js +0 -326
- package/dist/emulate/workos/index.js.map +0 -1
- package/dist/emulate/workos/role-helpers.d.ts +0 -21
- package/dist/emulate/workos/role-helpers.js +0 -130
- package/dist/emulate/workos/role-helpers.js.map +0 -1
- package/dist/emulate/workos/routes/api-keys.d.ts +0 -2
- package/dist/emulate/workos/routes/api-keys.js +0 -32
- package/dist/emulate/workos/routes/api-keys.js.map +0 -1
- package/dist/emulate/workos/routes/audit-logs.d.ts +0 -2
- package/dist/emulate/workos/routes/audit-logs.js +0 -104
- package/dist/emulate/workos/routes/audit-logs.js.map +0 -1
- package/dist/emulate/workos/routes/auth-challenges.d.ts +0 -2
- package/dist/emulate/workos/routes/auth-challenges.js +0 -51
- package/dist/emulate/workos/routes/auth-challenges.js.map +0 -1
- package/dist/emulate/workos/routes/auth-factors.d.ts +0 -2
- package/dist/emulate/workos/routes/auth-factors.js +0 -51
- package/dist/emulate/workos/routes/auth-factors.js.map +0 -1
- package/dist/emulate/workos/routes/auth.d.ts +0 -2
- package/dist/emulate/workos/routes/auth.js +0 -350
- package/dist/emulate/workos/routes/auth.js.map +0 -1
- package/dist/emulate/workos/routes/authorization-checks.d.ts +0 -10
- package/dist/emulate/workos/routes/authorization-checks.js +0 -123
- package/dist/emulate/workos/routes/authorization-checks.js.map +0 -1
- package/dist/emulate/workos/routes/authorization-org-roles.d.ts +0 -2
- package/dist/emulate/workos/routes/authorization-org-roles.js +0 -64
- package/dist/emulate/workos/routes/authorization-org-roles.js.map +0 -1
- package/dist/emulate/workos/routes/authorization-permissions.d.ts +0 -2
- package/dist/emulate/workos/routes/authorization-permissions.js +0 -67
- package/dist/emulate/workos/routes/authorization-permissions.js.map +0 -1
- package/dist/emulate/workos/routes/authorization-resources.d.ts +0 -2
- package/dist/emulate/workos/routes/authorization-resources.js +0 -117
- package/dist/emulate/workos/routes/authorization-resources.js.map +0 -1
- package/dist/emulate/workos/routes/authorization-roles.d.ts +0 -2
- package/dist/emulate/workos/routes/authorization-roles.js +0 -13
- package/dist/emulate/workos/routes/authorization-roles.js.map +0 -1
- package/dist/emulate/workos/routes/config.d.ts +0 -2
- package/dist/emulate/workos/routes/config.js +0 -57
- package/dist/emulate/workos/routes/config.js.map +0 -1
- package/dist/emulate/workos/routes/connect.d.ts +0 -2
- package/dist/emulate/workos/routes/connect.js +0 -65
- package/dist/emulate/workos/routes/connect.js.map +0 -1
- package/dist/emulate/workos/routes/connections.d.ts +0 -2
- package/dist/emulate/workos/routes/connections.js +0 -73
- package/dist/emulate/workos/routes/connections.js.map +0 -1
- package/dist/emulate/workos/routes/data-integrations.d.ts +0 -2
- package/dist/emulate/workos/routes/data-integrations.js +0 -55
- package/dist/emulate/workos/routes/data-integrations.js.map +0 -1
- package/dist/emulate/workos/routes/directories.d.ts +0 -2
- package/dist/emulate/workos/routes/directories.js +0 -90
- package/dist/emulate/workos/routes/directories.js.map +0 -1
- package/dist/emulate/workos/routes/email-verification.d.ts +0 -2
- package/dist/emulate/workos/routes/email-verification.js +0 -49
- package/dist/emulate/workos/routes/email-verification.js.map +0 -1
- package/dist/emulate/workos/routes/events.d.ts +0 -2
- package/dist/emulate/workos/routes/events.js +0 -18
- package/dist/emulate/workos/routes/events.js.map +0 -1
- package/dist/emulate/workos/routes/feature-flags.d.ts +0 -2
- package/dist/emulate/workos/routes/feature-flags.js +0 -103
- package/dist/emulate/workos/routes/feature-flags.js.map +0 -1
- package/dist/emulate/workos/routes/invitations.d.ts +0 -2
- package/dist/emulate/workos/routes/invitations.js +0 -122
- package/dist/emulate/workos/routes/invitations.js.map +0 -1
- package/dist/emulate/workos/routes/legacy-mfa.d.ts +0 -2
- package/dist/emulate/workos/routes/legacy-mfa.js +0 -75
- package/dist/emulate/workos/routes/legacy-mfa.js.map +0 -1
- package/dist/emulate/workos/routes/magic-auth.d.ts +0 -2
- package/dist/emulate/workos/routes/magic-auth.js +0 -32
- package/dist/emulate/workos/routes/magic-auth.js.map +0 -1
- package/dist/emulate/workos/routes/memberships.d.ts +0 -2
- package/dist/emulate/workos/routes/memberships.js +0 -114
- package/dist/emulate/workos/routes/memberships.js.map +0 -1
- package/dist/emulate/workos/routes/organization-domains.d.ts +0 -2
- package/dist/emulate/workos/routes/organization-domains.js +0 -58
- package/dist/emulate/workos/routes/organization-domains.js.map +0 -1
- package/dist/emulate/workos/routes/organizations.d.ts +0 -2
- package/dist/emulate/workos/routes/organizations.js +0 -131
- package/dist/emulate/workos/routes/organizations.js.map +0 -1
- package/dist/emulate/workos/routes/password-reset.d.ts +0 -2
- package/dist/emulate/workos/routes/password-reset.js +0 -61
- package/dist/emulate/workos/routes/password-reset.js.map +0 -1
- package/dist/emulate/workos/routes/pipes.d.ts +0 -2
- package/dist/emulate/workos/routes/pipes.js +0 -82
- package/dist/emulate/workos/routes/pipes.js.map +0 -1
- package/dist/emulate/workos/routes/portal.d.ts +0 -2
- package/dist/emulate/workos/routes/portal.js +0 -18
- package/dist/emulate/workos/routes/portal.js.map +0 -1
- package/dist/emulate/workos/routes/radar.d.ts +0 -2
- package/dist/emulate/workos/routes/radar.js +0 -41
- package/dist/emulate/workos/routes/radar.js.map +0 -1
- package/dist/emulate/workos/routes/sessions.d.ts +0 -2
- package/dist/emulate/workos/routes/sessions.js +0 -51
- package/dist/emulate/workos/routes/sessions.js.map +0 -1
- package/dist/emulate/workos/routes/sso.d.ts +0 -2
- package/dist/emulate/workos/routes/sso.js +0 -161
- package/dist/emulate/workos/routes/sso.js.map +0 -1
- package/dist/emulate/workos/routes/user-features.d.ts +0 -2
- package/dist/emulate/workos/routes/user-features.js +0 -50
- package/dist/emulate/workos/routes/user-features.js.map +0 -1
- package/dist/emulate/workos/routes/users.d.ts +0 -2
- package/dist/emulate/workos/routes/users.js +0 -129
- package/dist/emulate/workos/routes/users.js.map +0 -1
- package/dist/emulate/workos/routes/webhook-endpoints.d.ts +0 -2
- package/dist/emulate/workos/routes/webhook-endpoints.js +0 -67
- package/dist/emulate/workos/routes/webhook-endpoints.js.map +0 -1
- package/dist/emulate/workos/routes/widgets.d.ts +0 -2
- package/dist/emulate/workos/routes/widgets.js +0 -27
- package/dist/emulate/workos/routes/widgets.js.map +0 -1
- package/dist/emulate/workos/store.d.ts +0 -48
- package/dist/emulate/workos/store.js +0 -102
- package/dist/emulate/workos/store.js.map +0 -1
- package/dist/emulate/workos/webhook-signer.d.ts +0 -1
- package/dist/emulate/workos/webhook-signer.js +0 -8
- package/dist/emulate/workos/webhook-signer.js.map +0 -1
- package/dist/gen-routes-lib.spec.ts +0 -659
- package/dist/gen-routes-lib.ts +0 -647
- package/dist/gen-routes.ts +0 -96
- package/dist/lib/mcp-notice.d.ts +0 -72
- package/dist/lib/mcp-notice.js +0 -275
- package/dist/lib/mcp-notice.js.map +0 -1
- package/dist/utils/clack-utils.js.map +0 -1
- package/dist/utils/clack.d.ts +0 -5
- package/dist/utils/clack.js +0 -34
- package/dist/utils/clack.js.map +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widgets.js","sourceRoot":"","sources":["../../../../src/emulate/workos/routes/widgets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa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Context, 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"]}
|
|
@@ -1,48 +0,0 @@
|
|
|
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;
|
|
@@ -1,102 +0,0 @@
|
|
|
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, ['endpoint_url']),
|
|
98
|
-
};
|
|
99
|
-
store.setData(STORE_KEYS.workosStore, ws);
|
|
100
|
-
return ws;
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,GAAgB;QACtB,aAAa,EAAE,KAAK,C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AE,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 ['endpoint_url'],\n ),\n };\n\n store.setData(STORE_KEYS.workosStore, ws);\n return ws;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function signWebhookPayload(payload: string, secret: string): string;
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|