@betterportal/auth-workos 0.0.1

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 (70) hide show
  1. package/README.md +18 -0
  2. package/betterportal-logo.png +0 -0
  3. package/bsb-plugin.json +23 -0
  4. package/lib/index.d.ts +2 -0
  5. package/lib/index.d.ts.map +1 -0
  6. package/lib/index.js +2 -0
  7. package/lib/index.js.map +1 -0
  8. package/lib/plugins/service-betterportal-auth-workos/.bp-generated/registry.d.ts +3 -0
  9. package/lib/plugins/service-betterportal-auth-workos/.bp-generated/registry.d.ts.map +1 -0
  10. package/lib/plugins/service-betterportal-auth-workos/.bp-generated/registry.js +97 -0
  11. package/lib/plugins/service-betterportal-auth-workos/.bp-generated/registry.js.map +1 -0
  12. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/GET.d.ts +3 -0
  13. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/GET.d.ts.map +1 -0
  14. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/GET.js +3 -0
  15. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/GET.js.map +1 -0
  16. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/GET.d.ts +5 -0
  17. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/GET.d.ts.map +1 -0
  18. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/GET.js +61 -0
  19. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/GET.js.map +1 -0
  20. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_background.monitor.GET.d.ts +5 -0
  21. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_background.monitor.GET.d.ts.map +1 -0
  22. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_background.monitor.GET.js +5 -0
  23. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_background.monitor.GET.js.map +1 -0
  24. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_nav.profile.GET.d.ts +5 -0
  25. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_nav.profile.GET.d.ts.map +1 -0
  26. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_nav.profile.GET.js +10 -0
  27. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_nav.profile.GET.js.map +1 -0
  28. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.embedded/_background.monitor.GET.d.ts +3 -0
  29. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.embedded/_background.monitor.GET.d.ts.map +1 -0
  30. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.embedded/_background.monitor.GET.js +3 -0
  31. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.embedded/_background.monitor.GET.js.map +1 -0
  32. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/index.d.ts +2 -0
  33. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/index.d.ts.map +1 -0
  34. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/index.js +2 -0
  35. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/index.js.map +1 -0
  36. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/route.impl.d.ts +60 -0
  37. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/route.impl.d.ts.map +1 -0
  38. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/route.impl.js +154 -0
  39. package/lib/plugins/service-betterportal-auth-workos/bp-routes/login/route.impl.js.map +1 -0
  40. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/GET.d.ts +3 -0
  41. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/GET.d.ts.map +1 -0
  42. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/GET.js +3 -0
  43. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/GET.js.map +1 -0
  44. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/index.d.ts +2 -0
  45. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/index.d.ts.map +1 -0
  46. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/index.js +2 -0
  47. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/index.js.map +1 -0
  48. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/route.impl.d.ts +27 -0
  49. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/route.impl.d.ts.map +1 -0
  50. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/route.impl.js +35 -0
  51. package/lib/plugins/service-betterportal-auth-workos/bp-routes/logout/route.impl.js.map +1 -0
  52. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/POST.d.ts +3 -0
  53. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/POST.d.ts.map +1 -0
  54. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/POST.js +3 -0
  55. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/POST.js.map +1 -0
  56. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/index.d.ts +2 -0
  57. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/index.d.ts.map +1 -0
  58. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/index.js +2 -0
  59. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/index.js.map +1 -0
  60. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/route.impl.d.ts +32 -0
  61. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/route.impl.d.ts.map +1 -0
  62. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/route.impl.js +78 -0
  63. package/lib/plugins/service-betterportal-auth-workos/bp-routes/refresh/route.impl.js.map +1 -0
  64. package/lib/plugins/service-betterportal-auth-workos/index.d.ts +166 -0
  65. package/lib/plugins/service-betterportal-auth-workos/index.d.ts.map +1 -0
  66. package/lib/plugins/service-betterportal-auth-workos/index.js +575 -0
  67. package/lib/plugins/service-betterportal-auth-workos/index.js.map +1 -0
  68. package/lib/schemas/service-betterportal-auth-workos.json +138 -0
  69. package/lib/schemas/service-betterportal-auth-workos.plugin.json +151 -0
  70. package/package.json +69 -0
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # BetterPortal WorkOS Auth Service
2
+
3
+ WorkOS AuthKit provider for BetterPortal. The service redirects users to WorkOS, exchanges the callback code server-side with the WorkOS Node SDK, issues BetterPortal tokens, and refreshes BP tokens from the WorkOS refresh token.
4
+
5
+ Per-app service config requires:
6
+
7
+ - `clientId`
8
+ - `apiKey`
9
+
10
+ Optional config:
11
+
12
+ - `provider` defaults to `authkit`
13
+ - `connectionId`, `organizationId`, `domainHint`
14
+ - `scopes`
15
+ - `loginRedirectPath`, `logoutRedirectPath`
16
+ - `roleClaimPath` defaults to `roles`
17
+
18
+ Registry org: `betterportal`.
Binary file
@@ -0,0 +1,23 @@
1
+ {
2
+ "nodejs": [
3
+ {
4
+ "id": "service-betterportal-auth-workos",
5
+ "name": "service.betterportal.auth.workos",
6
+ "basePath": "./",
7
+ "description": "BetterPortal WorkOS auth service",
8
+ "tags": [
9
+ "betterportal",
10
+ "auth",
11
+ "workos"
12
+ ],
13
+ "documentation": [
14
+ "./README.md"
15
+ ],
16
+ "pluginPath": "src/plugins/service-betterportal-auth-workos/",
17
+ "image": "./betterportal-logo.png",
18
+ "links": {
19
+ "github": "git+https://github.com/BetterCorp/BetterPortal.git"
20
+ }
21
+ }
22
+ ]
23
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./plugins/service-betterportal-auth-workos/index.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qDAAqD,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./plugins/service-betterportal-auth-workos/index.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qDAAqD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { BetterPortalRegistry } from "@betterportal/framework";
2
+ export declare const registry: BetterPortalRegistry;
3
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/plugins/service-betterportal-auth-workos/.bp-generated/registry.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,eAAO,MAAM,QAAQ,EAAE,oBAoFtB,CAAC"}
@@ -0,0 +1,97 @@
1
+ // AUTO-GENERATED by BetterPortal codegen - DO NOT EDIT
2
+ import * as loginRoute from "../bp-routes/login/index.js";
3
+ import * as loginGETRoute from "../bp-routes/login/GET.js";
4
+ import * as loginBootstrap1PageGET from "../bp-routes/login/_theme.bootstrap1/GET.js";
5
+ import * as loginBootstrap1BackgroundMonitorGET from "../bp-routes/login/_theme.bootstrap1/_background.monitor.GET.js";
6
+ import * as loginBootstrap1NavProfileGET from "../bp-routes/login/_theme.bootstrap1/_nav.profile.GET.js";
7
+ import * as loginEmbeddedBackgroundMonitorGET from "../bp-routes/login/_theme.embedded/_background.monitor.GET.js";
8
+ import * as logoutRoute from "../bp-routes/logout/index.js";
9
+ import * as logoutGETRoute from "../bp-routes/logout/GET.js";
10
+ import * as refreshRoute from "../bp-routes/refresh/index.js";
11
+ import * as refreshPOSTRoute from "../bp-routes/refresh/POST.js";
12
+ export const registry = {
13
+ routes: [
14
+ {
15
+ viewId: "login.index",
16
+ path: "/login",
17
+ methods: ["GET"],
18
+ paramNames: [],
19
+ schemas: {
20
+ response: loginGETRoute.ResponseSchema,
21
+ query: loginGETRoute.QuerySchema,
22
+ headers: loginGETRoute.HeadersSchema
23
+ },
24
+ methodRoutes: { GET: { method: "GET", schemas: {
25
+ response: loginGETRoute.ResponseSchema,
26
+ query: loginGETRoute.QuerySchema,
27
+ headers: loginGETRoute.HeadersSchema
28
+ }, handler: loginGETRoute.default } },
29
+ handlers: { GET: loginGETRoute.default },
30
+ title: loginRoute.title,
31
+ description: loginRoute.description,
32
+ auth: loginRoute.auth,
33
+ role: loginRoute.role,
34
+ dependencies: loginRoute.dependencies,
35
+ chrome: loginRoute.chrome,
36
+ cacheHints: loginRoute.cacheHints,
37
+ demoScenarios: [],
38
+ themeRenderers: {
39
+ "bootstrap1": {
40
+ pages: [{ rendererId: "default", type: "page", method: "GET", render: loginBootstrap1PageGET.render }],
41
+ components: [],
42
+ fragments: [{ rendererId: "background.monitor", type: "fragment", method: "GET", fragmentLocation: "background", fragmentId: "monitor", render: loginBootstrap1BackgroundMonitorGET.render }, { rendererId: "nav.profile", type: "fragment", method: "GET", fragmentLocation: "nav", fragmentId: "profile", render: loginBootstrap1NavProfileGET.render }]
43
+ },
44
+ "embedded": {
45
+ pages: [],
46
+ components: [],
47
+ fragments: [{ rendererId: "background.monitor", type: "fragment", method: "GET", fragmentLocation: "background", fragmentId: "monitor", render: loginEmbeddedBackgroundMonitorGET.render }]
48
+ }
49
+ }
50
+ },
51
+ {
52
+ viewId: "logout.index",
53
+ path: "/logout",
54
+ methods: ["GET"],
55
+ paramNames: [],
56
+ schemas: {
57
+ response: logoutGETRoute.ResponseSchema,
58
+ query: logoutGETRoute.QuerySchema
59
+ },
60
+ methodRoutes: { GET: { method: "GET", schemas: {
61
+ response: logoutGETRoute.ResponseSchema,
62
+ query: logoutGETRoute.QuerySchema
63
+ }, handler: logoutGETRoute.default } },
64
+ handlers: { GET: logoutGETRoute.default },
65
+ title: logoutRoute.title,
66
+ description: logoutRoute.description,
67
+ auth: logoutRoute.auth,
68
+ role: logoutRoute.role,
69
+ cacheHints: logoutRoute.cacheHints,
70
+ demoScenarios: [],
71
+ themeRenderers: {}
72
+ },
73
+ {
74
+ viewId: "refresh.index",
75
+ path: "/refresh",
76
+ methods: ["POST"],
77
+ paramNames: [],
78
+ schemas: {
79
+ response: refreshPOSTRoute.ResponseSchema,
80
+ request: refreshPOSTRoute.RequestSchema
81
+ },
82
+ methodRoutes: { POST: { method: "POST", schemas: {
83
+ response: refreshPOSTRoute.ResponseSchema,
84
+ request: refreshPOSTRoute.RequestSchema
85
+ }, handler: refreshPOSTRoute.default } },
86
+ handlers: { POST: refreshPOSTRoute.default },
87
+ title: refreshRoute.title,
88
+ description: refreshRoute.description,
89
+ auth: refreshRoute.auth,
90
+ role: refreshRoute.role,
91
+ cacheHints: refreshRoute.cacheHints,
92
+ demoScenarios: [],
93
+ themeRenderers: {}
94
+ }
95
+ ]
96
+ };
97
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/plugins/service-betterportal-auth-workos/.bp-generated/registry.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,sBAAsB,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,mCAAmC,MAAM,iEAAiE,CAAC;AACvH,OAAO,KAAK,4BAA4B,MAAM,0DAA0D,CAAC;AACzG,OAAO,KAAK,iCAAiC,MAAM,+DAA+D,CAAC;AACnH,OAAO,KAAK,WAAW,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAC;AAGjE,MAAM,CAAC,MAAM,QAAQ,GAA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eAAe;YACvB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,UAAU,EAAE,EAAE;YACd,OAAO,EAAE;gBACP,QAAQ,EAAE,gBAAgB,CAAC,cAAc;gBACzC,OAAO,EAAE,gBAAgB,CAAC,aAAa;aACxC;YACD,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;wBAC/C,QAAQ,EAAE,gBAAgB,CAAC,cAAc;wBACzC,OAAO,EAAE,gBAAgB,CAAC,aAAa;qBACxC,EAAE,OAAO,EAAE,gBAAgB,CAAC,OAAO,EAAE,EAAE;YACxC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE;YAC5C,KAAK,EAAE,YAAY,CAAC,KAAK;YACzB,WAAW,EAAE,YAAY,CAAC,WAAW;YACrC,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,aAAa,EAAE,EAAE;YACjB,cAAc,EAAE,EAAE;SACnB;KACF;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ResponseSchema, QuerySchema, HeadersSchema } from "./route.impl.js";
2
+ export { handleGet as default } from "./route.impl.js";
3
+ //# sourceMappingURL=GET.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GET.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/GET.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ResponseSchema, QuerySchema, HeadersSchema } from "./route.impl.js";
2
+ export { handleGet as default } from "./route.impl.js";
3
+ //# sourceMappingURL=GET.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GET.js","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/GET.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** @jsxImportSource jsx-htmx */
2
+ import type { HtmlRenderable } from "@betterportal/framework";
3
+ import type { ResponseData } from "../route.impl.js";
4
+ export declare function render(data: ResponseData): HtmlRenderable;
5
+ //# sourceMappingURL=GET.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GET.d.ts","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/GET.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc,CAyFzD"}
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "jsx-htmx/jsx-runtime";
2
+ import { js } from "jsx-htmx";
3
+ export function render(data) {
4
+ const next = data.nextUrl || "/";
5
+ if (data.loggedOut) {
6
+ return (_jsx("div", { class: "container py-5", style: "max-width: 420px;", children: _jsx("div", { class: "card border-0 shadow-sm", children: _jsxs("div", { class: "card-body text-center", children: [_jsx("h3", { class: "card-title mb-1", children: "Signed out" }), _jsx("p", { class: "text-secondary small mb-4", children: "You have been signed out." }), _jsx("a", { class: "btn btn-primary w-100", href: next, children: "Continue" })] }) }) }));
7
+ }
8
+ const redirectUrl = data.authorizationUrl || (data.alreadyLoggedIn || data.signedIn ? next : "");
9
+ return (_jsxs("main", { class: "bp-workos-shell", "data-redirect-url": redirectUrl, "data-mode": data.status, children: [_jsxs("section", { class: "bp-workos-panel", children: [_jsx("div", { class: "bp-workos-mark", "aria-hidden": "true", children: "W" }), _jsx("h1", { children: "Sign in" }), _jsx("p", { class: "bp-workos-copy", children: "Continue with WorkOS." }), data.status === "error" ? (_jsx("div", { class: "alert alert-danger mb-0", role: "alert", children: data.message || "WorkOS sign in failed." })) : (_jsx("a", { class: "btn btn-primary w-100", href: redirectUrl || next, children: "Continue" }))] }), _jsx("script", { children: js(() => {
10
+ const root = document.currentScript?.closest(".bp-workos-shell");
11
+ const url = root?.dataset.redirectUrl;
12
+ if (!url || root?.dataset.mode === "error")
13
+ return;
14
+ const link = document.createElement("a");
15
+ link.href = url;
16
+ document.body.appendChild(link);
17
+ link.click();
18
+ link.remove();
19
+ }) }), _jsx("style", { children: `
20
+ .bp-workos-shell {
21
+ min-height: 100vh;
22
+ width: 100%;
23
+ display: grid;
24
+ place-items: center;
25
+ padding: 24px;
26
+ background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
27
+ color: #111827;
28
+ }
29
+ .bp-workos-panel {
30
+ width: min(420px, 100%);
31
+ border: 1px solid rgba(15, 23, 42, 0.1);
32
+ border-radius: 8px;
33
+ background: rgba(255, 255, 255, 0.96);
34
+ padding: 32px;
35
+ box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
36
+ }
37
+ .bp-workos-mark {
38
+ width: 44px;
39
+ height: 44px;
40
+ display: grid;
41
+ place-items: center;
42
+ border-radius: 8px;
43
+ background: #111827;
44
+ color: #fff;
45
+ font-weight: 700;
46
+ margin-bottom: 18px;
47
+ }
48
+ .bp-workos-panel h1 {
49
+ margin: 0 0 6px;
50
+ font-size: 26px;
51
+ line-height: 1.2;
52
+ font-weight: 700;
53
+ }
54
+ .bp-workos-copy {
55
+ margin: 0 0 24px;
56
+ color: #64748b;
57
+ font-size: 14px;
58
+ }
59
+ ` })] }));
60
+ }
61
+ //# sourceMappingURL=GET.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GET.js","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/GET.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAG9B,MAAM,UAAU,MAAM,CAAC,IAAkB;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,IAAI,GAAG,CAAC;IACjC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,OAAO,CACL,cAAK,KAAK,EAAC,gBAAgB,EAAC,KAAK,EAAC,mBAAmB,YACnD,cAAK,KAAK,EAAC,yBAAyB,YAClC,eAAK,KAAK,EAAC,uBAAuB,aAChC,aAAI,KAAK,EAAC,iBAAiB,2BAAgB,EAC3C,YAAG,KAAK,EAAC,2BAA2B,0CAA8B,EAClE,YAAG,KAAK,EAAC,uBAAuB,EAAC,IAAI,EAAE,IAAI,yBAAc,IACrD,GACF,GACF,CACP,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEjG,OAAO,CACL,gBAAM,KAAK,EAAC,iBAAiB,uBAAoB,WAAW,eAAa,IAAI,CAAC,MAAM,aAClF,mBAAS,KAAK,EAAC,iBAAiB,aAC9B,cAAK,KAAK,EAAC,gBAAgB,iBAAa,MAAM,kBAAQ,EACtD,mCAAgB,EAChB,YAAG,KAAK,EAAC,gBAAgB,sCAA0B,EAClD,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CACzB,cAAK,KAAK,EAAC,yBAAyB,EAAC,IAAI,EAAC,OAAO,YAAE,IAAI,CAAC,OAAO,IAAI,wBAAwB,GAAO,CACnG,CAAC,CAAC,CAAC,CACF,YAAG,KAAK,EAAC,uBAAuB,EAAC,IAAI,EAAE,WAAW,IAAI,IAAI,yBAEtD,CACL,IACO,EACV,2BACG,EAAE,CAAC,GAAG,EAAE;oBACP,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,kBAAkB,CAAuB,CAAC;oBACvF,MAAM,GAAG,GAAG,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC;oBACtC,IAAI,CAAC,GAAG,IAAI,IAAI,EAAE,OAAO,CAAC,IAAI,KAAK,OAAO;wBAAE,OAAO;oBACnD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;oBACzC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;oBAChB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;oBAChC,IAAI,CAAC,KAAK,EAAE,CAAC;oBACb,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,CAAC,CAAC,GACK,EACT,0BACG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAwCA,GACK,IACH,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** @jsxImportSource jsx-htmx */
2
+ import type { HtmlRenderable } from "@betterportal/framework";
3
+ import type { ResponseData } from "../route.impl.js";
4
+ export declare function render(_data: ResponseData): HtmlRenderable;
5
+ //# sourceMappingURL=_background.monitor.GET.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_background.monitor.GET.d.ts","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_background.monitor.GET.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,cAAc,CAE1D"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "jsx-htmx/jsx-runtime";
2
+ export function render(_data) {
3
+ return _jsx("div", {});
4
+ }
5
+ //# sourceMappingURL=_background.monitor.GET.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_background.monitor.GET.js","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_background.monitor.GET.tsx"],"names":[],"mappings":";AAKA,MAAM,UAAU,MAAM,CAAC,KAAmB;IACxC,OAAO,eAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** @jsxImportSource jsx-htmx */
2
+ import type { HtmlRenderable } from "@betterportal/framework";
3
+ import type { ResponseData } from "../route.impl.js";
4
+ export declare function render(data: ResponseData): HtmlRenderable;
5
+ //# sourceMappingURL=_nav.profile.GET.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_nav.profile.GET.d.ts","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_nav.profile.GET.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc,CA4BzD"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "jsx-htmx/jsx-runtime";
2
+ export function render(data) {
3
+ if (!data.alreadyLoggedIn || !data.user) {
4
+ return (_jsx("a", { class: "btn btn-sm btn-primary", href: "/login", children: "Sign in" }));
5
+ }
6
+ const displayName = data.user.name || data.user.email || data.user.id || "Account";
7
+ const detail = data.user.email || data.user.id || displayName;
8
+ return (_jsxs("div", { class: "dropdown", children: [_jsx("button", { class: "btn btn-sm btn-light dropdown-toggle", type: "button", "data-bs-toggle": "dropdown", "aria-expanded": "false", children: displayName }), _jsxs("ul", { class: "dropdown-menu dropdown-menu-end", children: [_jsx("li", { children: _jsx("h6", { class: "dropdown-header", children: detail }) }), _jsx("li", { children: _jsx("hr", { class: "dropdown-divider" }) }), _jsx("li", { children: _jsx("a", { class: "dropdown-item", href: "/login?action=logout", children: "Logout" }) })] })] }));
9
+ }
10
+ //# sourceMappingURL=_nav.profile.GET.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_nav.profile.GET.js","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.bootstrap1/_nav.profile.GET.tsx"],"names":[],"mappings":";AAIA,MAAM,UAAU,MAAM,CAAC,IAAkB;IACvC,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACxC,OAAO,CACL,YAAG,KAAK,EAAC,wBAAwB,EAAC,IAAI,EAAC,QAAQ,wBAE3C,CACL,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,SAAS,CAAC;IACnF,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,WAAW,CAAC;IAE9D,OAAO,CACL,eAAK,KAAK,EAAC,UAAU,aACnB,iBAAQ,KAAK,EAAC,sCAAsC,EAAC,IAAI,EAAC,QAAQ,oBAAgB,UAAU,mBAAe,OAAO,YAC/G,WAAW,GACL,EACT,cAAI,KAAK,EAAC,iCAAiC,aACzC,uBAAI,aAAI,KAAK,EAAC,iBAAiB,YAAE,MAAM,GAAM,GAAK,EAClD,uBAAI,aAAI,KAAK,EAAC,kBAAkB,GAAG,GAAK,EACxC,uBACI,YAAG,KAAK,EAAC,eAAe,EAAC,IAAI,EAAC,sBAAsB,uBAEhD,GACH,IACF,IACD,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** @jsxImportSource jsx-htmx */
2
+ export { render } from "../_theme.bootstrap1/_background.monitor.GET.js";
3
+ //# sourceMappingURL=_background.monitor.GET.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_background.monitor.GET.d.ts","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.embedded/_background.monitor.GET.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,iDAAiD,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** @jsxImportSource jsx-htmx */
2
+ export { render } from "../_theme.bootstrap1/_background.monitor.GET.js";
3
+ //# sourceMappingURL=_background.monitor.GET.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_background.monitor.GET.js","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/_theme.embedded/_background.monitor.GET.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,iDAAiD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { title, description, auth, role, dependencies, chrome, cacheHints } from "./route.impl.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { title, description, auth, role, dependencies, chrome, cacheHints } from "./route.impl.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,60 @@
1
+ import * as av from "anyvali";
2
+ import type { Infer } from "anyvali";
3
+ import { type ApiAuthRequirement, type BetterPortalRouteChrome, type CacheHints } from "@betterportal/framework";
4
+ export declare const QuerySchema: av.ObjectSchema<{
5
+ action: av.OptionalSchema<av.StringSchema>;
6
+ code: av.OptionalSchema<av.StringSchema>;
7
+ state: av.OptionalSchema<av.StringSchema>;
8
+ next: av.OptionalSchema<av.StringSchema>;
9
+ redirect: av.OptionalSchema<av.StringSchema>;
10
+ error: av.OptionalSchema<av.StringSchema>;
11
+ error_description: av.OptionalSchema<av.StringSchema>;
12
+ }>;
13
+ export declare const HeadersSchema: av.ObjectSchema<{}>;
14
+ export declare const ResponseSchema: av.ObjectSchema<{
15
+ status: av.EnumSchema<readonly ["ok", "error"]>;
16
+ message: av.OptionalSchema<av.StringSchema>;
17
+ authorizationUrl: av.OptionalSchema<av.StringSchema>;
18
+ alreadyLoggedIn: av.OptionalSchema<av.BoolSchema>;
19
+ loggedOut: av.OptionalSchema<av.BoolSchema>;
20
+ signedIn: av.OptionalSchema<av.BoolSchema>;
21
+ nextUrl: av.OptionalSchema<av.StringSchema>;
22
+ user: av.OptionalSchema<av.ObjectSchema<{
23
+ id: av.OptionalSchema<av.StringSchema>;
24
+ name: av.OptionalSchema<av.StringSchema>;
25
+ email: av.OptionalSchema<av.StringSchema>;
26
+ picture: av.OptionalSchema<av.StringSchema>;
27
+ }>>;
28
+ }>;
29
+ export type ResponseData = Infer<typeof ResponseSchema>;
30
+ export declare const title = "WorkOS Login";
31
+ export declare const description = "Authenticate with WorkOS AuthKit and store BetterPortal auth headers.";
32
+ export declare const role = "auth.login";
33
+ export declare const dependencies: string[];
34
+ export declare const chrome: BetterPortalRouteChrome;
35
+ export declare const auth: ApiAuthRequirement;
36
+ export declare const cacheHints: CacheHints;
37
+ export declare const handleGet: import("@betterportal/framework").RouteHandler<Record<string, string>, {
38
+ action?: string | undefined;
39
+ code?: string | undefined;
40
+ state?: string | undefined;
41
+ next?: string | undefined;
42
+ redirect?: string | undefined;
43
+ error?: string | undefined;
44
+ error_description?: string | undefined;
45
+ }, {}, Record<string, unknown>, {
46
+ status: "error" | "ok";
47
+ message?: string | undefined;
48
+ authorizationUrl?: string | undefined;
49
+ alreadyLoggedIn?: boolean | undefined;
50
+ loggedOut?: boolean | undefined;
51
+ signedIn?: boolean | undefined;
52
+ nextUrl?: string | undefined;
53
+ user?: {
54
+ id?: string | undefined;
55
+ name?: string | undefined;
56
+ email?: string | undefined;
57
+ picture?: string | undefined;
58
+ } | undefined;
59
+ }, unknown, Record<string, unknown>>;
60
+ //# sourceMappingURL=route.impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.impl.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/route.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAQjC,eAAO,MAAM,WAAW;;;;;;;;EAQI,CAAC;AAE7B,eAAO,MAAM,aAAa,qBAA0C,CAAC;AAErE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;EAcC,CAAC;AAC7B,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAExD,eAAO,MAAM,KAAK,iBAAiB,CAAC;AACpC,eAAO,MAAM,WAAW,0EAA0E,CAAC;AACnG,eAAO,MAAM,IAAI,eAAe,CAAC;AACjC,eAAO,MAAM,YAAY,UAAoC,CAAC;AAC9D,eAAO,MAAM,MAAM,EAAE,uBAA8C,CAAC;AACpE,eAAO,MAAM,IAAI,EAAE,kBAAyD,CAAC;AAC7E,eAAO,MAAM,UAAU,EAAE,UAA0C,CAAC;AAmBpE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;oCA2GrB,CAAC"}
@@ -0,0 +1,154 @@
1
+ import * as av from "anyvali";
2
+ import { createHandler } from "@betterportal/framework";
3
+ import { resolveWorkOSAppConfig, rolesFromWorkOSAccessToken, secondsUntilJwtExpiry } from "../../index.js";
4
+ export const QuerySchema = av.object({
5
+ action: av.optional(av.string()),
6
+ code: av.optional(av.string()),
7
+ state: av.optional(av.string()),
8
+ next: av.optional(av.string()),
9
+ redirect: av.optional(av.string()),
10
+ error: av.optional(av.string()),
11
+ error_description: av.optional(av.string())
12
+ }, { unknownKeys: "strip" });
13
+ export const HeadersSchema = av.object({}, { unknownKeys: "strip" });
14
+ export const ResponseSchema = av.object({
15
+ status: av.enum_(["ok", "error"]),
16
+ message: av.optional(av.string()),
17
+ authorizationUrl: av.optional(av.string()),
18
+ alreadyLoggedIn: av.optional(av.bool()),
19
+ loggedOut: av.optional(av.bool()),
20
+ signedIn: av.optional(av.bool()),
21
+ nextUrl: av.optional(av.string()),
22
+ user: av.optional(av.object({
23
+ id: av.optional(av.string()),
24
+ name: av.optional(av.string()),
25
+ email: av.optional(av.string()),
26
+ picture: av.optional(av.string())
27
+ }, { unknownKeys: "strip" }))
28
+ }, { unknownKeys: "strip" });
29
+ export const title = "WorkOS Login";
30
+ export const description = "Authenticate with WorkOS AuthKit and store BetterPortal auth headers.";
31
+ export const role = "auth.login";
32
+ export const dependencies = ["logout.index", "refresh.index"];
33
+ export const chrome = { fullScreen: true };
34
+ export const auth = { required: false, permissions: [] };
35
+ export const cacheHints = { ttlSeconds: 0, varyBy: [] };
36
+ function pluginFrom(ctx) {
37
+ const plugin = ctx.plugin;
38
+ if (!plugin)
39
+ throw new Error("WorkOS plugin not available on handler context");
40
+ return plugin;
41
+ }
42
+ function normalizeRedirect(raw) {
43
+ const redirect = raw?.trim();
44
+ if (!redirect)
45
+ return "/";
46
+ if (redirect.startsWith("http://") || redirect.startsWith("https://"))
47
+ return redirect;
48
+ return redirect.startsWith("/") ? redirect : `/${redirect}`;
49
+ }
50
+ function firstString(...values) {
51
+ return values.find((value) => typeof value === "string" && value.trim().length > 0)?.trim();
52
+ }
53
+ export const handleGet = createHandler({ response: ResponseSchema, query: QuerySchema, headers: HeadersSchema }, async (ctx) => {
54
+ const query = ctx.query;
55
+ const config = resolveWorkOSAppConfig(ctx.config);
56
+ const nextUrl = normalizeRedirect(query.state ?? query.next ?? query.redirect ?? config?.loginRedirectPath);
57
+ if (query.action === "logout") {
58
+ ctx.bpHeaders?.remove("Authorization");
59
+ ctx.bpHeaders?.remove("X-BP-Refresh");
60
+ if (ctx.serviceId)
61
+ ctx.responseHeaders?.set("HX-Trigger", `bp:fragments:${ctx.serviceId}`);
62
+ return {
63
+ status: "ok",
64
+ message: "Signed out.",
65
+ loggedOut: true,
66
+ nextUrl: normalizeRedirect(config?.logoutRedirectPath)
67
+ };
68
+ }
69
+ if (!config) {
70
+ return { status: "error", message: "WorkOS config is missing clientId or apiKey.", nextUrl };
71
+ }
72
+ if (query.error) {
73
+ return {
74
+ status: "error",
75
+ message: query.error_description || query.error,
76
+ nextUrl
77
+ };
78
+ }
79
+ if (query.code) {
80
+ try {
81
+ const auth = await pluginFrom(ctx).authenticateWithCode(config, query.code);
82
+ const roles = rolesFromWorkOSAccessToken(auth.accessToken, config.roleClaimPath ?? "roles");
83
+ const issued = pluginFrom(ctx).issueTokenPair({
84
+ sub: auth.user.id,
85
+ tenantId: ctx.tenant.id,
86
+ appId: ctx.app.id,
87
+ roles,
88
+ authProvider: "workos",
89
+ providerSubject: auth.user.id,
90
+ provider: {
91
+ accountId: auth.user.id,
92
+ scope: auth.organizationId ? `organization:${auth.organizationId}` : undefined
93
+ },
94
+ name: firstString(auth.user.name, [auth.user.firstName, auth.user.lastName].filter(Boolean).join(" ")),
95
+ email: auth.user.email,
96
+ picture: auth.user.profilePictureUrl ?? undefined
97
+ }, { includeRefreshToken: false });
98
+ ctx.bpHeaders?.set("Authorization", `Bearer ${issued.accessToken}`, {
99
+ locked: true,
100
+ expiresInSeconds: issued.accessTokenExpiresInSeconds,
101
+ refreshPath: "/refresh",
102
+ refreshBeforeSeconds: 60
103
+ });
104
+ ctx.bpHeaders?.set("X-BP-Refresh", auth.refreshToken, {
105
+ locked: true,
106
+ scopeToOwner: true,
107
+ expiresInSeconds: secondsUntilJwtExpiry(auth.accessToken)
108
+ });
109
+ ctx.responseHeaders?.set("HX-Redirect", nextUrl);
110
+ if (ctx.serviceId)
111
+ ctx.responseHeaders?.set("HX-Trigger", `bp:fragments:${ctx.serviceId}`);
112
+ return {
113
+ status: "ok",
114
+ message: "Signed in.",
115
+ signedIn: true,
116
+ nextUrl,
117
+ user: {
118
+ id: auth.user.id,
119
+ name: firstString(auth.user.name, [auth.user.firstName, auth.user.lastName].filter(Boolean).join(" ")),
120
+ email: auth.user.email,
121
+ picture: auth.user.profilePictureUrl ?? undefined
122
+ }
123
+ };
124
+ }
125
+ catch (error) {
126
+ ctx.obs?.error(error);
127
+ return { status: "error", message: `WorkOS sign in failed: ${error.message}`, nextUrl };
128
+ }
129
+ }
130
+ if (ctx.user) {
131
+ return {
132
+ status: "ok",
133
+ message: "Already signed in.",
134
+ alreadyLoggedIn: true,
135
+ nextUrl,
136
+ user: {
137
+ id: ctx.user.sub,
138
+ name: ctx.user.name,
139
+ email: ctx.user.email,
140
+ picture: ctx.user.picture
141
+ }
142
+ };
143
+ }
144
+ const redirectUri = ctx.uiRouteUrl?.("login.index", { absolute: true }) ??
145
+ ctx.routeUrl?.("login.index", { absolute: true }) ??
146
+ "/login";
147
+ return {
148
+ status: "ok",
149
+ message: "Continue to WorkOS.",
150
+ authorizationUrl: pluginFrom(ctx).getAuthorizationUrl(config, { redirectUri, state: nextUrl }),
151
+ nextUrl
152
+ };
153
+ });
154
+ //# sourceMappingURL=route.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.impl.js","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/login/route.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EACL,aAAa,EAId,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;IAChC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;IAC9B,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;IAC/B,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;IAC9B,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;IAClC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;IAC/B,iBAAiB,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;CAC5C,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;AAE7B,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,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,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG;gBAChB,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI;gBACnB,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK;gBACrB,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO;aAC1B;SACF,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GACf,GAAG,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACnD,GAAG,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACjD,QAAQ,CAAC;IACX,OAAO;QACL,MAAM,EAAE,IAAa;QACrB,OAAO,EAAE,qBAAqB;QAC9B,gBAAgB,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QAC9F,OAAO;KACR,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ResponseSchema, QuerySchema } from "./route.impl.js";
2
+ export { handleGet as default } from "./route.impl.js";
3
+ //# sourceMappingURL=GET.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GET.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/logout/GET.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ResponseSchema, QuerySchema } from "./route.impl.js";
2
+ export { handleGet as default } from "./route.impl.js";
3
+ //# sourceMappingURL=GET.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GET.js","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/logout/GET.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { title, description, auth, role, cacheHints } from "./route.impl.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-workos/bp-routes/logout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}