@soulcraft/sdk 3.7.6 → 3.8.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/auth/config.d.ts +0 -30
- package/dist/modules/auth/config.d.ts.map +1 -1
- package/dist/modules/auth/config.js +0 -52
- package/dist/modules/auth/config.js.map +1 -1
- package/dist/modules/auth/products.d.ts +36 -99
- package/dist/modules/auth/products.d.ts.map +1 -1
- package/dist/modules/auth/products.js +32 -78
- package/dist/modules/auth/products.js.map +1 -1
- package/dist/modules/auth/sveltekit.d.ts +53 -45
- package/dist/modules/auth/sveltekit.d.ts.map +1 -1
- package/dist/modules/auth/sveltekit.js +78 -217
- package/dist/modules/auth/sveltekit.js.map +1 -1
- package/dist/modules/auth/types.d.ts +0 -28
- package/dist/modules/auth/types.d.ts.map +1 -1
- package/dist/server/index.d.ts +2 -4
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +5 -4
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export { isWriteMethod, WRITE_METHODS } from './read-only.js';
|
|
|
21
21
|
export type { VfsModule } from './modules/vfs/types.js';
|
|
22
22
|
export type { VersionsModule } from './modules/versions/types.js';
|
|
23
23
|
export type { HallModule, HallRoom, HallRoomHandle, HallPubsubHandle, HallRoomEvents, HallRoomHandleEvents, HallPubsubHandleEvents, HallPubsubEvents, HallConnectionOptions, HallPeerRole, ScreenShareMode, RoomOptions, ConceptInput, RecordingManifest, RoleChangedEvent, TranscriptEvent, ConceptMentionEvent, RelationProposedEvent, SpeakerChangedEvent, PeerJoinedEvent, PeerLeftEvent, PeerPromotedEvent, PeerDemotedEvent, ViewerCountEvent, ScreenShareThumbnailEvent, ChatMessage as HallChatMessage, ChatHistoryEvent, MediaInfo as HallMediaInfo, MediaReadyEvent, MediaErrorEvent, TranscodeTarget, ReplayEntry, TopicSubscribedEvent, TopicUnsubscribedEvent, TopicMessageEvent, PresenceUpdateEvent, PresenceEntry, PresenceSnapshotEvent, } from './modules/hall/types.js';
|
|
24
|
-
export type { AuthModule, PlatformRole, SoulcraftAuthProvider, SoulcraftOrganization, SoulcraftUserFields, SoulcraftSessionUser, SoulcraftSession,
|
|
24
|
+
export type { AuthModule, PlatformRole, SoulcraftAuthProvider, SoulcraftOrganization, SoulcraftUserFields, SoulcraftSessionUser, SoulcraftSession, } from './modules/auth/types.js';
|
|
25
25
|
export { SOULCRAFT_USER_FIELDS, SOULCRAFT_SESSION_CONFIG, } from './modules/auth/config.js';
|
|
26
26
|
export type { AiModule, AiCompleteOptions, AiCompleteResult, AiStreamOptions, AiStreamEvent, AiToolCall, AiMessage, AiContentBlock, AiTool, AiModel, } from './modules/ai/types.js';
|
|
27
27
|
export { AI_MODELS } from './modules/ai/types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC5E,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAGlE,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,YAAY,EACV,MAAM,EACN,QAAQ,EACR,MAAM,EACN,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,4BAA4B,EAC5B,qBAAqB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,EACjB,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -17,8 +17,7 @@ export { SDKError, SDKDisconnectedError, SDKTimeoutError, SDKAuthError, SDKForbi
|
|
|
17
17
|
// ── Read-only enforcement (shared registry) ─────────────────────────────────
|
|
18
18
|
export { isWriteMethod, WRITE_METHODS } from './read-only.js';
|
|
19
19
|
// SOULCRAFT_USER_FIELDS and SOULCRAFT_SESSION_CONFIG are pure constants — safe on shared entry.
|
|
20
|
-
// computeEmailHash
|
|
21
|
-
// Import those from @soulcraft/sdk/server.
|
|
20
|
+
// computeEmailHash uses node:crypto — import from @soulcraft/sdk/server.
|
|
22
21
|
export { SOULCRAFT_USER_FIELDS, SOULCRAFT_SESSION_CONFIG, } from './modules/auth/config.js';
|
|
23
22
|
export { AI_MODELS } from './modules/ai/types.js';
|
|
24
23
|
export { SOULCRAFT_FORMATS } from './modules/formats/types.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA+BH,iFAAiF;AACjF,qCAAqC;AACrC,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,sBAAsB,GACvB,MAAM,4BAA4B,CAAA;AAEnC,+EAA+E;AAC/E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA+BH,iFAAiF;AACjF,qCAAqC;AACrC,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,sBAAsB,GACvB,MAAM,4BAA4B,CAAA;AAEnC,+EAA+E;AAC/E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AA4D7D,gGAAgG;AAChG,yEAAyE;AACzE,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,0BAA0B,CAAA;AAejC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAoFjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA"}
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
* })
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
import type { AuthMode, OIDCClientConfig } from './types.js';
|
|
42
41
|
/**
|
|
43
42
|
* Additional fields to register on the better-auth `user` table.
|
|
44
43
|
*
|
|
@@ -90,33 +89,4 @@ export declare const SOULCRAFT_SESSION_CONFIG: {
|
|
|
90
89
|
* // → 'b4c9a289522dd28a04617a41d7b14cf18d43d06febe513d9e27b5da67c17e52e'
|
|
91
90
|
*/
|
|
92
91
|
export declare function computeEmailHash(email: string): string;
|
|
93
|
-
/**
|
|
94
|
-
* Determine the authentication mode from environment variables.
|
|
95
|
-
*
|
|
96
|
-
* - `'standalone'` — each product runs its own better-auth instance with a local
|
|
97
|
-
* SQLite database. No cross-product SSO. Default before `auth.soulcraft.com` is live.
|
|
98
|
-
* - `'oidc-client'` — set `SOULCRAFT_IDP_URL` to activate. The product's better-auth
|
|
99
|
-
* instance delegates all authentication to the central IdP.
|
|
100
|
-
*
|
|
101
|
-
* @returns The current auth mode derived from `SOULCRAFT_IDP_URL`.
|
|
102
|
-
*/
|
|
103
|
-
export declare function getAuthMode(): AuthMode;
|
|
104
|
-
/**
|
|
105
|
-
* Read OIDC client configuration from environment variables.
|
|
106
|
-
*
|
|
107
|
-
* Returns `null` in standalone mode (when `SOULCRAFT_IDP_URL` is unset).
|
|
108
|
-
* Throws with a descriptive message if the URL is set but required variables
|
|
109
|
-
* are missing — prevents silent misconfiguration.
|
|
110
|
-
*
|
|
111
|
-
* | Variable | Required | Description |
|
|
112
|
-
* |------------------------------|----------|-----------------------------------------|
|
|
113
|
-
* | `SOULCRAFT_IDP_URL` | Yes | Central IdP base URL |
|
|
114
|
-
* | `SOULCRAFT_OIDC_CLIENT_ID` | Yes | This product's registered client ID |
|
|
115
|
-
* | `SOULCRAFT_OIDC_CLIENT_SECRET` | Yes | This product's registered client secret |
|
|
116
|
-
* | `SOULCRAFT_OIDC_REDIRECT_URI` | No | Deprecated — auto-derived from BETTER_AUTH_URL |
|
|
117
|
-
*
|
|
118
|
-
* @returns OIDC client config or null in standalone mode.
|
|
119
|
-
* @throws {Error} If `SOULCRAFT_IDP_URL` is set but client ID or secret are missing.
|
|
120
|
-
*/
|
|
121
|
-
export declare function getOIDCClientConfig(): OIDCClientConfig | null;
|
|
122
92
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAQH;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;CAWxB,CAAA;AAMV;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB;;;CAG3B,CAAA;AAMV;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAItD"}
|
|
@@ -103,56 +103,4 @@ export function computeEmailHash(email) {
|
|
|
103
103
|
.update(email.toLowerCase().trim())
|
|
104
104
|
.digest('hex');
|
|
105
105
|
}
|
|
106
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
107
|
-
// SSO / OIDC environment helpers
|
|
108
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
109
|
-
/**
|
|
110
|
-
* Determine the authentication mode from environment variables.
|
|
111
|
-
*
|
|
112
|
-
* - `'standalone'` — each product runs its own better-auth instance with a local
|
|
113
|
-
* SQLite database. No cross-product SSO. Default before `auth.soulcraft.com` is live.
|
|
114
|
-
* - `'oidc-client'` — set `SOULCRAFT_IDP_URL` to activate. The product's better-auth
|
|
115
|
-
* instance delegates all authentication to the central IdP.
|
|
116
|
-
*
|
|
117
|
-
* @returns The current auth mode derived from `SOULCRAFT_IDP_URL`.
|
|
118
|
-
*/
|
|
119
|
-
export function getAuthMode() {
|
|
120
|
-
return process.env['SOULCRAFT_IDP_URL'] ? 'oidc-client' : 'standalone';
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Read OIDC client configuration from environment variables.
|
|
124
|
-
*
|
|
125
|
-
* Returns `null` in standalone mode (when `SOULCRAFT_IDP_URL` is unset).
|
|
126
|
-
* Throws with a descriptive message if the URL is set but required variables
|
|
127
|
-
* are missing — prevents silent misconfiguration.
|
|
128
|
-
*
|
|
129
|
-
* | Variable | Required | Description |
|
|
130
|
-
* |------------------------------|----------|-----------------------------------------|
|
|
131
|
-
* | `SOULCRAFT_IDP_URL` | Yes | Central IdP base URL |
|
|
132
|
-
* | `SOULCRAFT_OIDC_CLIENT_ID` | Yes | This product's registered client ID |
|
|
133
|
-
* | `SOULCRAFT_OIDC_CLIENT_SECRET` | Yes | This product's registered client secret |
|
|
134
|
-
* | `SOULCRAFT_OIDC_REDIRECT_URI` | No | Deprecated — auto-derived from BETTER_AUTH_URL |
|
|
135
|
-
*
|
|
136
|
-
* @returns OIDC client config or null in standalone mode.
|
|
137
|
-
* @throws {Error} If `SOULCRAFT_IDP_URL` is set but client ID or secret are missing.
|
|
138
|
-
*/
|
|
139
|
-
export function getOIDCClientConfig() {
|
|
140
|
-
const idpUrl = process.env['SOULCRAFT_IDP_URL'];
|
|
141
|
-
if (!idpUrl)
|
|
142
|
-
return null;
|
|
143
|
-
const clientId = process.env['SOULCRAFT_OIDC_CLIENT_ID'];
|
|
144
|
-
const clientSecret = process.env['SOULCRAFT_OIDC_CLIENT_SECRET'];
|
|
145
|
-
if (!clientId || !clientSecret) {
|
|
146
|
-
const missing = [
|
|
147
|
-
!clientId && 'SOULCRAFT_OIDC_CLIENT_ID',
|
|
148
|
-
!clientSecret && 'SOULCRAFT_OIDC_CLIENT_SECRET',
|
|
149
|
-
].filter(Boolean).join(', ');
|
|
150
|
-
throw new Error(`SOULCRAFT_IDP_URL is set to "${idpUrl}" but the following required OIDC ` +
|
|
151
|
-
`client environment variables are missing: ${missing}. ` +
|
|
152
|
-
`Either set both variables for OIDC client mode, or unset SOULCRAFT_IDP_URL ` +
|
|
153
|
-
`to run in standalone mode.`);
|
|
154
|
-
}
|
|
155
|
-
const redirectUri = process.env['SOULCRAFT_OIDC_REDIRECT_URI'];
|
|
156
|
-
return { idpUrl, clientId, clientSecret, ...(redirectUri ? { redirectUri } : {}) };
|
|
157
|
-
}
|
|
158
106
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/modules/auth/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/modules/auth/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,gFAAgF;AAChF,gCAAgC;AAChC,gFAAgF;AAEhF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,YAAY,EAAE;QACZ,IAAI,EAAE,QAAiB;QACvB,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,SAAS;KACxB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,QAAiB;QACvB,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,EAAE;KACjB;CACO,CAAA;AAEV,gFAAgF;AAChF,+BAA+B;AAC/B,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;IAC5B,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;CACf,CAAA;AAEV,gFAAgF;AAChF,yBAAyB;AACzB,gFAAgF;AAEhF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,UAAU,CAAC,QAAQ,CAAC;SACxB,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;SAClC,MAAM,CAAC,KAAK,CAAC,CAAA;AAClB,CAAC"}
|
|
@@ -1,34 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module modules/auth/products
|
|
3
|
-
* @description Centralized registry of all Soulcraft platform products
|
|
4
|
-
*
|
|
3
|
+
* @description Centralized registry of all Soulcraft platform products.
|
|
4
|
+
* Single source of truth for:
|
|
5
5
|
*
|
|
6
6
|
* - Which products exist on the platform
|
|
7
7
|
* - Their production domains and local dev ports
|
|
8
|
-
* - Their
|
|
9
|
-
* - Whether they require backchannel logout support
|
|
10
|
-
* - Which env var holds their OIDC client secret
|
|
8
|
+
* - Their product identifiers
|
|
11
9
|
*
|
|
12
|
-
* The auth server (`auth.soulcraft.com`) consumes this registry to derive
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* The auth server (`auth.soulcraft.com`) consumes this registry to derive
|
|
11
|
+
* trusted origins and CORS allowlists. Products authenticate via shared
|
|
12
|
+
* `.soulcraft.com` session cookies — no OIDC, no client secrets.
|
|
15
13
|
*
|
|
16
14
|
* ## Adding a new product
|
|
17
15
|
*
|
|
18
|
-
* 1. Add an entry to `SOULCRAFT_PRODUCTS` below
|
|
19
|
-
* 2.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* 4. Deploy the auth server — it will pick up the new product automatically.
|
|
23
|
-
* 5. Set `SOULCRAFT_IDP_URL` in the product's own `.env.production`.
|
|
24
|
-
*
|
|
25
|
-
* @see ADR-002-product-registry.md for design rationale.
|
|
16
|
+
* 1. Add an entry to `SOULCRAFT_PRODUCTS` below.
|
|
17
|
+
* 2. Publish a new version of `@soulcraft/sdk`.
|
|
18
|
+
* 3. Deploy the auth server — it picks up the new product automatically.
|
|
19
|
+
* 4. Set `SOULCRAFT_AUTH_URL` in the product's `.env.production`.
|
|
26
20
|
*/
|
|
27
21
|
/**
|
|
28
|
-
*
|
|
22
|
+
* Auth configuration for a single Soulcraft platform product.
|
|
29
23
|
*
|
|
30
|
-
* Consumed by the auth server to derive trusted origins
|
|
31
|
-
*
|
|
24
|
+
* Consumed by the auth server to derive trusted origins and CORS origins.
|
|
25
|
+
* Products authenticate via shared `.soulcraft.com` session cookie — no OIDC,
|
|
26
|
+
* no client secrets, no token exchange.
|
|
32
27
|
*/
|
|
33
28
|
export interface ProductRegistration {
|
|
34
29
|
/** Human-readable display name, e.g. `"Soulcraft Workshop"`. */
|
|
@@ -41,43 +36,10 @@ export interface ProductRegistration {
|
|
|
41
36
|
/** Local development port. Used to derive `http://localhost:{devPort}` origins. */
|
|
42
37
|
devPort: number;
|
|
43
38
|
/**
|
|
44
|
-
*
|
|
39
|
+
* Product identifier. Used in login URLs and session metadata.
|
|
45
40
|
* Must be unique across all products. e.g. `"workshop"`.
|
|
46
41
|
*/
|
|
47
42
|
clientId: string;
|
|
48
|
-
/**
|
|
49
|
-
* Name of the environment variable that holds this product's OIDC client secret
|
|
50
|
-
* (or backchannel secret for cookie-proxy products). e.g. `"WORKSHOP_OIDC_CLIENT_SECRET"`.
|
|
51
|
-
*/
|
|
52
|
-
secretEnvVar: string;
|
|
53
|
-
/**
|
|
54
|
-
* How this product authenticates users:
|
|
55
|
-
* - `'oidc-redirect'` — full OIDC authorization code flow with redirect callbacks
|
|
56
|
-
* - `'cookie-proxy'` — validates the shared `.soulcraft.com` session cookie directly
|
|
57
|
-
* against `GET /api/auth/get-session`; no OIDC redirect involved
|
|
58
|
-
*/
|
|
59
|
-
authMode: 'oidc-redirect' | 'cookie-proxy';
|
|
60
|
-
/**
|
|
61
|
-
* Paths on this product's origin that the auth server should register as OIDC
|
|
62
|
-
* redirect URIs. Empty array for cookie-proxy products. Both production and dev
|
|
63
|
-
* variants are derived automatically via `deriveRedirectUrls`.
|
|
64
|
-
*/
|
|
65
|
-
callbackPaths: string[];
|
|
66
|
-
/**
|
|
67
|
-
* Additional paths to include as OIDC redirect URIs beyond the callback paths.
|
|
68
|
-
* Typically the homepage (`"/"`) which is used as `post_logout_redirect_uri`.
|
|
69
|
-
* Defaults to `["/"]` when omitted.
|
|
70
|
-
*/
|
|
71
|
-
extraRedirectPaths?: string[];
|
|
72
|
-
/**
|
|
73
|
-
* When `true`, the auth server includes this product in its OIDC backchannel
|
|
74
|
-
* logout registry. The product's `{domain}/api/auth/backchannel-logout` endpoint
|
|
75
|
-
* will be notified on every sign-out so it can terminate local sessions immediately.
|
|
76
|
-
*
|
|
77
|
-
* Set to `false` only for products that do not implement a backchannel endpoint
|
|
78
|
-
* (e.g. read-only dashboards, analytics tools).
|
|
79
|
-
*/
|
|
80
|
-
backchannelRequired: boolean;
|
|
81
43
|
}
|
|
82
44
|
/**
|
|
83
45
|
* Central registry of all Soulcraft platform products.
|
|
@@ -97,66 +59,36 @@ export declare const SOULCRAFT_PRODUCTS: {
|
|
|
97
59
|
readonly domain: "workshop.soulcraft.com";
|
|
98
60
|
readonly devPort: 5001;
|
|
99
61
|
readonly clientId: "workshop";
|
|
100
|
-
readonly secretEnvVar: "WORKSHOP_OIDC_CLIENT_SECRET";
|
|
101
|
-
readonly authMode: "oidc-redirect";
|
|
102
|
-
readonly callbackPaths: ["/api/auth/oauth2/callback/soulcraft-idp", "/api/auth/callback/soulcraft-idp"];
|
|
103
|
-
readonly extraRedirectPaths: ["/"];
|
|
104
|
-
readonly backchannelRequired: true;
|
|
105
62
|
};
|
|
106
63
|
readonly venue: {
|
|
107
64
|
readonly name: "Soulcraft Venue";
|
|
108
65
|
readonly domain: "venue.soulcraft.com";
|
|
109
66
|
readonly devPort: 5174;
|
|
110
67
|
readonly clientId: "venue";
|
|
111
|
-
readonly secretEnvVar: "VENUE_OIDC_CLIENT_SECRET";
|
|
112
|
-
readonly authMode: "oidc-redirect";
|
|
113
|
-
readonly callbackPaths: ["/api/auth/callback/soulcraft-idp"];
|
|
114
|
-
readonly extraRedirectPaths: ["/"];
|
|
115
|
-
readonly backchannelRequired: true;
|
|
116
68
|
};
|
|
117
69
|
readonly portal: {
|
|
118
70
|
readonly name: "Soulcraft Portal";
|
|
119
71
|
readonly domain: "soulcraft.com";
|
|
120
72
|
readonly devPort: 8080;
|
|
121
73
|
readonly clientId: "portal";
|
|
122
|
-
readonly secretEnvVar: "PORTAL_OIDC_CLIENT_SECRET";
|
|
123
|
-
readonly authMode: "oidc-redirect";
|
|
124
|
-
readonly callbackPaths: ["/api/auth/callback/soulcraft-idp", "/auth/callback"];
|
|
125
|
-
readonly extraRedirectPaths: ["/"];
|
|
126
|
-
readonly backchannelRequired: true;
|
|
127
74
|
};
|
|
128
75
|
readonly academy: {
|
|
129
76
|
readonly name: "Soulcraft Academy";
|
|
130
77
|
readonly domain: "academy.soulcraft.com";
|
|
131
78
|
readonly devPort: 5002;
|
|
132
79
|
readonly clientId: "academy";
|
|
133
|
-
readonly secretEnvVar: "ACADEMY_OIDC_CLIENT_SECRET";
|
|
134
|
-
readonly authMode: "oidc-redirect";
|
|
135
|
-
readonly callbackPaths: ["/api/auth/callback/soulcraft-idp"];
|
|
136
|
-
readonly extraRedirectPaths: ["/"];
|
|
137
|
-
readonly backchannelRequired: true;
|
|
138
80
|
};
|
|
139
81
|
readonly pulse: {
|
|
140
82
|
readonly name: "Soulcraft Pulse";
|
|
141
83
|
readonly domain: "pulse.soulcraft.com";
|
|
142
84
|
readonly devPort: 5004;
|
|
143
85
|
readonly clientId: "pulse";
|
|
144
|
-
readonly secretEnvVar: "PULSE_BACKCHANNEL_SECRET";
|
|
145
|
-
readonly authMode: "cookie-proxy";
|
|
146
|
-
readonly callbackPaths: [];
|
|
147
|
-
readonly extraRedirectPaths: ["/"];
|
|
148
|
-
readonly backchannelRequired: false;
|
|
149
86
|
};
|
|
150
87
|
readonly imagine: {
|
|
151
88
|
readonly name: "Soulcraft Imagine";
|
|
152
89
|
readonly domain: "imagine.soulcraft.com";
|
|
153
90
|
readonly devPort: 5005;
|
|
154
91
|
readonly clientId: "imagine";
|
|
155
|
-
readonly secretEnvVar: "IMAGINE_OIDC_SECRET";
|
|
156
|
-
readonly authMode: "oidc-redirect";
|
|
157
|
-
readonly callbackPaths: ["/api/auth/callback/soulcraft-idp"];
|
|
158
|
-
readonly extraRedirectPaths: ["/"];
|
|
159
|
-
readonly backchannelRequired: false;
|
|
160
92
|
};
|
|
161
93
|
};
|
|
162
94
|
/**
|
|
@@ -195,25 +127,30 @@ export type SoulcraftProduct = keyof typeof SOULCRAFT_PRODUCTS;
|
|
|
195
127
|
*/
|
|
196
128
|
export declare function deriveOrigins(): string[];
|
|
197
129
|
/**
|
|
198
|
-
*
|
|
130
|
+
* Build a login URL that redirects the user to auth.soulcraft.com.
|
|
199
131
|
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
132
|
+
* After authentication, the user is redirected back to the `redirect` URL
|
|
133
|
+
* with the `.soulcraft.com` session cookie set. For custom domains, the
|
|
134
|
+
* auth server uses a one-time code exchange instead.
|
|
203
135
|
*
|
|
204
|
-
* @param
|
|
205
|
-
* @returns
|
|
136
|
+
* @param options - Login URL parameters.
|
|
137
|
+
* @returns Fully-qualified login URL string.
|
|
206
138
|
*
|
|
207
139
|
* @example
|
|
208
|
-
*
|
|
209
|
-
* // →
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* //
|
|
213
|
-
* // 'http://localhost:5001/api/auth/oauth2/callback/soulcraft-idp',
|
|
214
|
-
* // 'http://localhost:5001/api/auth/callback/soulcraft-idp',
|
|
215
|
-
* // 'http://localhost:5001/',
|
|
216
|
-
* // ]
|
|
140
|
+
* getLoginUrl({ product: 'venue', redirect: 'https://venue.soulcraft.com/dashboard' })
|
|
141
|
+
* // → 'https://auth.soulcraft.com/login?product=venue&redirect=https%3A%2F%2Fvenue.soulcraft.com%2Fdashboard'
|
|
142
|
+
*
|
|
143
|
+
* getLoginUrl({ product: 'venue', redirect: '/book', tenant: 'wicks-and-whiskers' })
|
|
144
|
+
* // → 'https://auth.soulcraft.com/login?product=venue&redirect=%2Fbook&tenant=wicks-and-whiskers'
|
|
217
145
|
*/
|
|
218
|
-
export declare function
|
|
146
|
+
export declare function getLoginUrl(options: {
|
|
147
|
+
/** Product identifier. */
|
|
148
|
+
product: string;
|
|
149
|
+
/** URL to redirect to after successful authentication. */
|
|
150
|
+
redirect: string;
|
|
151
|
+
/** Venue tenant slug for branded login page. */
|
|
152
|
+
tenant?: string;
|
|
153
|
+
/** Auth server base URL. Defaults to SOULCRAFT_AUTH_URL env var or https://auth.soulcraft.com. */
|
|
154
|
+
authUrl?: string;
|
|
155
|
+
}): string;
|
|
219
156
|
//# sourceMappingURL=products.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/products.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/products.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB;AAMD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCyB,CAAA;AAExD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,kBAAkB,CAAA;AAM9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAcxC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE;IACnC,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAA;IAChB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,MAAM,CAUT"}
|
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module modules/auth/products
|
|
3
|
-
* @description Centralized registry of all Soulcraft platform products
|
|
4
|
-
*
|
|
3
|
+
* @description Centralized registry of all Soulcraft platform products.
|
|
4
|
+
* Single source of truth for:
|
|
5
5
|
*
|
|
6
6
|
* - Which products exist on the platform
|
|
7
7
|
* - Their production domains and local dev ports
|
|
8
|
-
* - Their
|
|
9
|
-
* - Whether they require backchannel logout support
|
|
10
|
-
* - Which env var holds their OIDC client secret
|
|
8
|
+
* - Their product identifiers
|
|
11
9
|
*
|
|
12
|
-
* The auth server (`auth.soulcraft.com`) consumes this registry to derive
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* The auth server (`auth.soulcraft.com`) consumes this registry to derive
|
|
11
|
+
* trusted origins and CORS allowlists. Products authenticate via shared
|
|
12
|
+
* `.soulcraft.com` session cookies — no OIDC, no client secrets.
|
|
15
13
|
*
|
|
16
14
|
* ## Adding a new product
|
|
17
15
|
*
|
|
18
|
-
* 1. Add an entry to `SOULCRAFT_PRODUCTS` below
|
|
19
|
-
* 2.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* 4. Deploy the auth server — it will pick up the new product automatically.
|
|
23
|
-
* 5. Set `SOULCRAFT_IDP_URL` in the product's own `.env.production`.
|
|
24
|
-
*
|
|
25
|
-
* @see ADR-002-product-registry.md for design rationale.
|
|
16
|
+
* 1. Add an entry to `SOULCRAFT_PRODUCTS` below.
|
|
17
|
+
* 2. Publish a new version of `@soulcraft/sdk`.
|
|
18
|
+
* 3. Deploy the auth server — it picks up the new product automatically.
|
|
19
|
+
* 4. Set `SOULCRAFT_AUTH_URL` in the product's `.env.production`.
|
|
26
20
|
*/
|
|
27
21
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
28
22
|
// Registry
|
|
@@ -45,73 +39,36 @@ export const SOULCRAFT_PRODUCTS = {
|
|
|
45
39
|
domain: 'workshop.soulcraft.com',
|
|
46
40
|
devPort: 5001,
|
|
47
41
|
clientId: 'workshop',
|
|
48
|
-
secretEnvVar: 'WORKSHOP_OIDC_CLIENT_SECRET',
|
|
49
|
-
authMode: 'oidc-redirect',
|
|
50
|
-
callbackPaths: [
|
|
51
|
-
'/api/auth/oauth2/callback/soulcraft-idp',
|
|
52
|
-
// Legacy path kept for in-flight sessions during transitions
|
|
53
|
-
'/api/auth/callback/soulcraft-idp',
|
|
54
|
-
],
|
|
55
|
-
extraRedirectPaths: ['/'],
|
|
56
|
-
backchannelRequired: true,
|
|
57
42
|
},
|
|
58
43
|
venue: {
|
|
59
44
|
name: 'Soulcraft Venue',
|
|
60
45
|
domain: 'venue.soulcraft.com',
|
|
61
46
|
devPort: 5174,
|
|
62
47
|
clientId: 'venue',
|
|
63
|
-
secretEnvVar: 'VENUE_OIDC_CLIENT_SECRET',
|
|
64
|
-
authMode: 'oidc-redirect',
|
|
65
|
-
callbackPaths: ['/api/auth/callback/soulcraft-idp'],
|
|
66
|
-
extraRedirectPaths: ['/'],
|
|
67
|
-
backchannelRequired: true,
|
|
68
48
|
},
|
|
69
49
|
portal: {
|
|
70
50
|
name: 'Soulcraft Portal',
|
|
71
51
|
domain: 'soulcraft.com',
|
|
72
52
|
devPort: 8080,
|
|
73
53
|
clientId: 'portal',
|
|
74
|
-
secretEnvVar: 'PORTAL_OIDC_CLIENT_SECRET',
|
|
75
|
-
authMode: 'oidc-redirect',
|
|
76
|
-
callbackPaths: ['/api/auth/callback/soulcraft-idp', '/auth/callback'],
|
|
77
|
-
extraRedirectPaths: ['/'],
|
|
78
|
-
backchannelRequired: true,
|
|
79
54
|
},
|
|
80
55
|
academy: {
|
|
81
56
|
name: 'Soulcraft Academy',
|
|
82
57
|
domain: 'academy.soulcraft.com',
|
|
83
58
|
devPort: 5002,
|
|
84
59
|
clientId: 'academy',
|
|
85
|
-
secretEnvVar: 'ACADEMY_OIDC_CLIENT_SECRET',
|
|
86
|
-
authMode: 'oidc-redirect',
|
|
87
|
-
callbackPaths: ['/api/auth/callback/soulcraft-idp'],
|
|
88
|
-
extraRedirectPaths: ['/'],
|
|
89
|
-
backchannelRequired: true,
|
|
90
60
|
},
|
|
91
61
|
pulse: {
|
|
92
62
|
name: 'Soulcraft Pulse',
|
|
93
63
|
domain: 'pulse.soulcraft.com',
|
|
94
64
|
devPort: 5004,
|
|
95
65
|
clientId: 'pulse',
|
|
96
|
-
// Pulse uses cookie-proxy; PULSE_BACKCHANNEL_SECRET doubles as the OIDC client
|
|
97
|
-
// secret for the minimal OIDC client entry that registers the homepage as a valid
|
|
98
|
-
// post_logout_redirect_uri. Backchannel is best-effort; no startup failure if absent.
|
|
99
|
-
secretEnvVar: 'PULSE_BACKCHANNEL_SECRET',
|
|
100
|
-
authMode: 'cookie-proxy',
|
|
101
|
-
callbackPaths: [],
|
|
102
|
-
extraRedirectPaths: ['/'],
|
|
103
|
-
backchannelRequired: false,
|
|
104
66
|
},
|
|
105
67
|
imagine: {
|
|
106
68
|
name: 'Soulcraft Imagine',
|
|
107
69
|
domain: 'imagine.soulcraft.com',
|
|
108
70
|
devPort: 5005,
|
|
109
71
|
clientId: 'imagine',
|
|
110
|
-
secretEnvVar: 'IMAGINE_OIDC_SECRET',
|
|
111
|
-
authMode: 'oidc-redirect',
|
|
112
|
-
callbackPaths: ['/api/auth/callback/soulcraft-idp'],
|
|
113
|
-
extraRedirectPaths: ['/'],
|
|
114
|
-
backchannelRequired: false,
|
|
115
72
|
},
|
|
116
73
|
};
|
|
117
74
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -152,35 +109,32 @@ export function deriveOrigins() {
|
|
|
152
109
|
return origins;
|
|
153
110
|
}
|
|
154
111
|
/**
|
|
155
|
-
*
|
|
112
|
+
* Build a login URL that redirects the user to auth.soulcraft.com.
|
|
156
113
|
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
114
|
+
* After authentication, the user is redirected back to the `redirect` URL
|
|
115
|
+
* with the `.soulcraft.com` session cookie set. For custom domains, the
|
|
116
|
+
* auth server uses a one-time code exchange instead.
|
|
160
117
|
*
|
|
161
|
-
* @param
|
|
162
|
-
* @returns
|
|
118
|
+
* @param options - Login URL parameters.
|
|
119
|
+
* @returns Fully-qualified login URL string.
|
|
163
120
|
*
|
|
164
121
|
* @example
|
|
165
|
-
*
|
|
166
|
-
* // →
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* //
|
|
170
|
-
* // 'http://localhost:5001/api/auth/oauth2/callback/soulcraft-idp',
|
|
171
|
-
* // 'http://localhost:5001/api/auth/callback/soulcraft-idp',
|
|
172
|
-
* // 'http://localhost:5001/',
|
|
173
|
-
* // ]
|
|
122
|
+
* getLoginUrl({ product: 'venue', redirect: 'https://venue.soulcraft.com/dashboard' })
|
|
123
|
+
* // → 'https://auth.soulcraft.com/login?product=venue&redirect=https%3A%2F%2Fvenue.soulcraft.com%2Fdashboard'
|
|
124
|
+
*
|
|
125
|
+
* getLoginUrl({ product: 'venue', redirect: '/book', tenant: 'wicks-and-whiskers' })
|
|
126
|
+
* // → 'https://auth.soulcraft.com/login?product=venue&redirect=%2Fbook&tenant=wicks-and-whiskers'
|
|
174
127
|
*/
|
|
175
|
-
export function
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
128
|
+
export function getLoginUrl(options) {
|
|
129
|
+
const base = options.authUrl
|
|
130
|
+
?? process.env['SOULCRAFT_AUTH_URL']
|
|
131
|
+
?? 'https://auth.soulcraft.com';
|
|
132
|
+
const params = new URLSearchParams({
|
|
133
|
+
product: options.product,
|
|
134
|
+
redirect: options.redirect,
|
|
135
|
+
});
|
|
136
|
+
if (options.tenant)
|
|
137
|
+
params.set('tenant', options.tenant);
|
|
138
|
+
return `${base}/login?${params}`;
|
|
185
139
|
}
|
|
186
140
|
//# sourceMappingURL=products.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../src/modules/auth/products.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../src/modules/auth/products.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA8BH,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,QAAQ,EAAE;QACR,IAAI,EAAE,oBAAoB;QAC1B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