@platform-x-shp/shopify-adapter 0.4.0 → 0.5.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.
@@ -0,0 +1,44 @@
1
+ import { Router } from 'express';
2
+ export declare const SESSION_COOKIE_NAME = "shp_delivery_sid";
3
+ export interface MintedSession {
4
+ accessToken: string;
5
+ expiresIn: number;
6
+ customer: {
7
+ id: string;
8
+ email: string;
9
+ };
10
+ }
11
+ export interface DeliverySsoConfig {
12
+ /**
13
+ * Public base URL this module's Shopify-callback route is reachable at —
14
+ * e.g. `https://dev.hep-ecommerce-service.hcl-x.com/hep-ecommerce-service/auth/delivery`.
15
+ * `/shopify/callback` is appended to build the `redirect_uri` sent to
16
+ * Shopify, which must exactly match what's registered in the Customer
17
+ * Account API app's allowed redirect URIs.
18
+ */
19
+ callbackBaseUrl: string;
20
+ /**
21
+ * Path the router below is mounted at (e.g.
22
+ * `/hep-ecommerce-service/auth/delivery`) — used only to scope the session
23
+ * cookie, so it isn't sent on unrelated routes.
24
+ */
25
+ sessionCookiePath: string;
26
+ /** Allow-list `beginDeliverySso`'s `returnUrl` and the session/logout endpoints' CORS are locked to. */
27
+ allowedReturnOrigins: string[];
28
+ }
29
+ /** Step 1: validate returnUrl, stash PKCE/nonce under a fresh `state`, and build Shopify's own authorize URL. */
30
+ export declare function beginDeliverySso(siteName: string, returnUrl: string, config: DeliverySsoConfig): Promise<{
31
+ authorizeUrl: string;
32
+ }>;
33
+ /**
34
+ * Express router exposing the 3 HTTP legs of delivery SSO: Shopify's own
35
+ * callback (GET `/shopify/callback`), and the SPA's own credentialed calls
36
+ * to mint (POST `/session`) and end (POST `/logout`) a bearer. Mount this at
37
+ * `config.callbackBaseUrl`'s path (e.g.
38
+ * `/hep-ecommerce-service/auth/delivery`) so the routes resolve to exactly
39
+ * the URLs `config` describes. `beginDeliverySso` is a plain function, not a
40
+ * route here — call it from your own GraphQL/REST mutation, same as every
41
+ * other write in this package.
42
+ */
43
+ export declare function createDeliverySsoRouter(config: DeliverySsoConfig): Router;
44
+ //# sourceMappingURL=delivery-sso.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-sso.d.ts","sourceRoot":"","sources":["../../src/delivery-sso.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAqE,MAAM,SAAS,CAAC;AA8CpG,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AA0BtD,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wGAAwG;IACxG,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAqGD,iHAAiH;AACjH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CAwBnC;AAwLD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAqEzE"}
@@ -0,0 +1,404 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SESSION_COOKIE_NAME = void 0;
7
+ exports.beginDeliverySso = beginDeliverySso;
8
+ exports.createDeliverySsoRouter = createDeliverySsoRouter;
9
+ const node_crypto_1 = __importDefault(require("node:crypto"));
10
+ const express_1 = require("express");
11
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
12
+ const redis_connector_1 = require("./redis-connector");
13
+ const platformx_auth_1 = require("./platformx-auth");
14
+ const tenant_config_1 = require("./tenant-config");
15
+ const logger_1 = require("./utils/logger");
16
+ /**
17
+ * Delivery-channel SSO: the browser is redirected straight to Shopify's
18
+ * Customer Account API authorize endpoint. Shopify itself — via the external
19
+ * identity provider connection a merchant configures in Shopify Admin — does
20
+ * a browser-visible redirect to the tenant's configured IdP, and
21
+ * auto-matches-or-creates the Shopify customer from the ID token's
22
+ * `email`/`sub` claims. This package never talks to the tenant's IdP
23
+ * directly for this flow: the only thing it ever sees is Shopify's own
24
+ * callback, below.
25
+ *
26
+ * Ported from shp-auth-service's `modules/deliverySso` — moved here (rather
27
+ * than merely referenced) because shp-auth-service is slated for
28
+ * decommission once hep-ecommerce-service fully replaces the 5 legacy
29
+ * services, so the SSO issuer can't keep living there. Unlike shp-auth-service,
30
+ * this is a library — no global `env`, no app-wide `cors()` to lean on, no
31
+ * shared error-handling middleware. Callers pass a {@link DeliverySsoConfig}
32
+ * explicitly and mount the returned router themselves.
33
+ *
34
+ * State is threaded through Redis rather than a cookie/session for the OAuth
35
+ * dance itself, since the Shopify callback is a third-party redirect target
36
+ * with no `sitename` header. Once signed in, the customer's own session IS a
37
+ * cookie (`SESSION_COOKIE_NAME`) — but that cookie carries only an opaque
38
+ * session id, with `siteName` stored in the Redis record it keys, so the
39
+ * session/logout endpoints need no tenant header either.
40
+ */
41
+ const SHOPIFY_STATE_TTL_SECONDS = 10 * 60;
42
+ const SHOPIFY_DISCOVERY_TTL_SECONDS = 24 * 60 * 60;
43
+ // Shopify does not publish a fixed Customer Account API refresh-token
44
+ // lifetime — 30 days is a conservative default. The session record (and the
45
+ // cookie naming it) share this lifetime, since the record is useless once
46
+ // the refresh token in it can no longer mint anything.
47
+ const SESSION_TTL_SECONDS = 30 * 24 * 60 * 60;
48
+ // Short-lived on purpose — kept in memory only by the frontend, never in
49
+ // localStorage. SESSION_COOKIE_NAME is what lets it be re-minted silently.
50
+ const PLATFORMX_TOKEN_EXPIRES_IN = '10m';
51
+ const PLATFORMX_TOKEN_EXPIRES_IN_SECONDS = 10 * 60;
52
+ exports.SESSION_COOKIE_NAME = 'shp_delivery_sid';
53
+ const shopifyStateKey = (state) => `delivery-sso:shopify-state:${state}`;
54
+ const shopifyDiscoveryKey = (shopDomain) => `delivery-sso:shopify-discovery:${shopDomain}`;
55
+ const sessionKey = (sessionId) => `delivery-sso:session:${sessionId}`;
56
+ class HttpError extends Error {
57
+ statusCode;
58
+ details;
59
+ constructor(statusCode, message, details) {
60
+ super(message);
61
+ this.statusCode = statusCode;
62
+ this.details = details;
63
+ this.name = 'HttpError';
64
+ }
65
+ }
66
+ function base64url(input) {
67
+ return input.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
68
+ }
69
+ function generatePkcePair() {
70
+ const codeVerifier = base64url(node_crypto_1.default.randomBytes(32));
71
+ const codeChallenge = base64url(node_crypto_1.default.createHash('sha256').update(codeVerifier).digest());
72
+ return { codeVerifier, codeChallenge };
73
+ }
74
+ /**
75
+ * Shopify's Customer Account API id_token's `sub` claim is the customer's
76
+ * raw numeric id (e.g. `10357569290403`, typed as a JSON number) — NOT a GID
77
+ * string, unlike every other Shopify customer id in this package. Normalizes
78
+ * to that GID form for consistency with the rest of shopify-adapter. Also
79
+ * accepts a bare numeric string or an already-GID string defensively, in
80
+ * case Shopify's behavior differs by API version/app configuration.
81
+ */
82
+ function normalizeShopifyCustomerId(sub) {
83
+ if (typeof sub === 'string' && sub.startsWith('gid://'))
84
+ return sub;
85
+ if (typeof sub === 'string' && sub.trim())
86
+ return `gid://shopify/Customer/${sub.trim()}`;
87
+ if (typeof sub === 'number' && Number.isFinite(sub))
88
+ return `gid://shopify/Customer/${sub}`;
89
+ return '';
90
+ }
91
+ function isAllowedReturnOrigin(origin, allowedReturnOrigins) {
92
+ return allowedReturnOrigins.includes(origin);
93
+ }
94
+ /**
95
+ * Rejects any `returnUrl` whose origin isn't explicitly allow-listed. Without
96
+ * this, `beginDeliverySso` is an open redirect: any external page could call
97
+ * it and redirect a victim's completed SSO session hand-off to an
98
+ * attacker-controlled origin.
99
+ */
100
+ function assertAllowedReturnUrl(returnUrl, allowedReturnOrigins) {
101
+ let origin;
102
+ try {
103
+ origin = new URL(returnUrl).origin;
104
+ }
105
+ catch {
106
+ throw new HttpError(400, 'returnUrl must be an absolute URL');
107
+ }
108
+ if (!isAllowedReturnOrigin(origin, allowedReturnOrigins)) {
109
+ logger_1.Logger.warn('rejected returnUrl with a disallowed origin', 'assertAllowedReturnUrl', { origin });
110
+ throw new HttpError(400, 'returnUrl is not an allowed origin');
111
+ }
112
+ }
113
+ function withReturnUrl(err, returnUrl) {
114
+ if (err instanceof HttpError) {
115
+ return new HttpError(err.statusCode, err.message, { ...err.details, returnUrl });
116
+ }
117
+ const cause = err instanceof Error ? { message: err.message, stack: err.stack } : { message: String(err) };
118
+ return new HttpError(502, 'Delivery SSO failed', { returnUrl, cause });
119
+ }
120
+ /**
121
+ * `setRedisValue` degrades a Redis outage to a silent no-op ('skipped') by
122
+ * design — the right behavior for a *cache*, where a miss just means "fetch
123
+ * fresh". The state/session records written here are not a cache, though:
124
+ * they're the only copy of data the next hop needs, so losing one silently
125
+ * would otherwise surface as a confusing "state expired or invalid" error
126
+ * several redirects later. Fail loudly and immediately instead.
127
+ */
128
+ async function requireRedisWrite(write, message) {
129
+ const result = await write;
130
+ if (result === 'skipped') {
131
+ throw new HttpError(503, message);
132
+ }
133
+ }
134
+ /** Discovers (and caches for 24h) a shop's Customer Account API OIDC endpoints. */
135
+ async function discoverShopifyEndpoints(shopDomain) {
136
+ const cached = await (0, redis_connector_1.getRedisValue)(shopifyDiscoveryKey(shopDomain), true);
137
+ if (cached)
138
+ return cached;
139
+ let res;
140
+ try {
141
+ res = await fetch(`https://${shopDomain}/.well-known/openid-configuration`);
142
+ }
143
+ catch {
144
+ throw new HttpError(502, 'Unable to reach Shopify for OIDC discovery');
145
+ }
146
+ if (!res.ok)
147
+ throw new HttpError(502, 'Shopify OIDC discovery failed');
148
+ const doc = (await res.json());
149
+ await (0, redis_connector_1.setRedisValue)(shopifyDiscoveryKey(shopDomain), doc, SHOPIFY_DISCOVERY_TTL_SECONDS, true);
150
+ return doc;
151
+ }
152
+ /** Step 1: validate returnUrl, stash PKCE/nonce under a fresh `state`, and build Shopify's own authorize URL. */
153
+ async function beginDeliverySso(siteName, returnUrl, config) {
154
+ assertAllowedReturnUrl(returnUrl, config.allowedReturnOrigins);
155
+ const { shopify } = await (0, tenant_config_1.getTenantConfig)(siteName);
156
+ const { codeVerifier, codeChallenge } = generatePkcePair();
157
+ const nonce = base64url(node_crypto_1.default.randomBytes(16));
158
+ const state = base64url(node_crypto_1.default.randomBytes(24));
159
+ const record = { siteName, returnUrl, codeVerifier, nonce };
160
+ await requireRedisWrite((0, redis_connector_1.setRedisValue)(shopifyStateKey(state), record, SHOPIFY_STATE_TTL_SECONDS, true), 'Delivery sign-in is temporarily unavailable. Please try again shortly.');
161
+ const discovery = await discoverShopifyEndpoints(shopify.storeDomain);
162
+ const authorizeUrl = new URL(discovery.authorization_endpoint);
163
+ authorizeUrl.searchParams.set('client_id', shopify.customerAccountApiClientId);
164
+ authorizeUrl.searchParams.set('redirect_uri', `${config.callbackBaseUrl}/shopify/callback`);
165
+ authorizeUrl.searchParams.set('scope', 'openid email customer-account-api:full');
166
+ authorizeUrl.searchParams.set('response_type', 'code');
167
+ authorizeUrl.searchParams.set('code_challenge', codeChallenge);
168
+ authorizeUrl.searchParams.set('code_challenge_method', 'S256');
169
+ authorizeUrl.searchParams.set('state', state);
170
+ authorizeUrl.searchParams.set('nonce', nonce);
171
+ return { authorizeUrl: authorizeUrl.toString() };
172
+ }
173
+ /**
174
+ * Step 2 (Shopify's redirect back to us — the only callback in this flow):
175
+ * exchange `code` + PKCE verifier for a Shopify Customer Account API token
176
+ * pair, resolve the Shopify customer id from the ID token Shopify hands
177
+ * back, and open a new session. Returns the session id so the route can set
178
+ * it as an HttpOnly cookie.
179
+ */
180
+ async function handleShopifyCallback(code, state, config) {
181
+ const record = await (0, redis_connector_1.getRedisValue)(shopifyStateKey(state), true);
182
+ if (!record)
183
+ throw new HttpError(400, 'Delivery SSO state expired or invalid');
184
+ await (0, redis_connector_1.deleteFromRedis)(shopifyStateKey(state));
185
+ const { siteName, returnUrl, codeVerifier, nonce } = record;
186
+ try {
187
+ const { shopify } = await (0, tenant_config_1.getTenantConfig)(siteName);
188
+ const discovery = await discoverShopifyEndpoints(shopify.storeDomain);
189
+ const body = new URLSearchParams({
190
+ grant_type: 'authorization_code',
191
+ client_id: shopify.customerAccountApiClientId,
192
+ redirect_uri: `${config.callbackBaseUrl}/shopify/callback`,
193
+ code,
194
+ code_verifier: codeVerifier,
195
+ });
196
+ const headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
197
+ if (shopify.customerAccountApiClientSecret) {
198
+ headers.Authorization = `Basic ${Buffer.from(`${shopify.customerAccountApiClientId}:${shopify.customerAccountApiClientSecret}`).toString('base64')}`;
199
+ }
200
+ let res;
201
+ try {
202
+ res = await fetch(discovery.token_endpoint, { method: 'POST', headers, body });
203
+ }
204
+ catch {
205
+ throw new HttpError(502, 'Unable to reach Shopify token endpoint');
206
+ }
207
+ if (!res.ok)
208
+ throw new HttpError(502, 'Shopify token exchange failed');
209
+ const tokens = (await res.json());
210
+ if (!tokens.id_token) {
211
+ throw new HttpError(502, "Shopify did not return an id_token — can't resolve the customer id. Confirm the Customer Account API app requests the 'openid' scope.");
212
+ }
213
+ const idPayload = jsonwebtoken_1.default.decode(tokens.id_token);
214
+ if (!idPayload || typeof idPayload !== 'object') {
215
+ throw new HttpError(502, 'Shopify id_token could not be decoded');
216
+ }
217
+ if (idPayload.nonce !== nonce) {
218
+ throw new HttpError(502, 'Shopify id_token nonce mismatch');
219
+ }
220
+ const shopifyCustomerId = normalizeShopifyCustomerId(idPayload.sub);
221
+ const email = typeof idPayload.email === 'string' ? idPayload.email : '';
222
+ if (!shopifyCustomerId) {
223
+ // Diagnostic only — logs the full decoded payload so the real claim
224
+ // name for the customer id can be found if Shopify's id_token shape
225
+ // ever differs from what's assumed above. Safe to log: this is our own
226
+ // signed-in-to-the-IdP customer's own identity claims, and the shared
227
+ // Logger auto-masks anything matching a sensitive-field keyword anyway.
228
+ logger_1.Logger.error('Shopify id_token has no usable sub claim — dumping decoded claims for diagnosis', 'handleShopifyCallback', {
229
+ siteName,
230
+ claims: idPayload,
231
+ });
232
+ throw new HttpError(502, 'Shopify id_token has no sub claim');
233
+ }
234
+ if (!tokens.refresh_token) {
235
+ logger_1.Logger.warn('Shopify Customer Account API did not return a refresh token — the app/client may not be registered as a headless storefront', 'handleShopifyCallback', { siteName });
236
+ }
237
+ const sessionId = base64url(node_crypto_1.default.randomBytes(24));
238
+ const sessionRecord = { siteName, shopifyCustomerId, email, refreshToken: tokens.refresh_token };
239
+ await requireRedisWrite((0, redis_connector_1.setRedisValue)(sessionKey(sessionId), sessionRecord, SESSION_TTL_SECONDS, true), 'Delivery sign-in is temporarily unavailable. Please try again shortly.');
240
+ const redirectUrl = new URL('/auth/delivery-callback', returnUrl).toString();
241
+ return { redirectUrl, sessionId };
242
+ }
243
+ catch (err) {
244
+ throw withReturnUrl(err, returnUrl);
245
+ }
246
+ }
247
+ /**
248
+ * Called right after the callback above (frontend's very first call, to get
249
+ * its initial bearer) and later, on demand, to re-mint the bearer before it
250
+ * expires. Reads the session purely from the opaque `sessionId` (the
251
+ * cookie's value) — no tenant header needed, since `siteName` lives inside
252
+ * the record.
253
+ */
254
+ async function mintSession(sessionId) {
255
+ const record = await (0, redis_connector_1.getRedisValue)(sessionKey(sessionId), true);
256
+ if (!record)
257
+ throw new HttpError(404, 'Delivery session expired or invalid');
258
+ const { siteName, shopifyCustomerId, email } = record;
259
+ const signingConfig = await (0, platformx_auth_1.platformXSigningConfigForTenant)(siteName);
260
+ if (!signingConfig.privateKey) {
261
+ throw new HttpError(502, 'PlatformX signing key is not configured for this tenant');
262
+ }
263
+ const accessToken = (0, platformx_auth_1.signPlatformXToken)({ sub: shopifyCustomerId, sid: sessionId, tenant: siteName, email }, signingConfig, PLATFORMX_TOKEN_EXPIRES_IN);
264
+ return { accessToken, expiresIn: PLATFORMX_TOKEN_EXPIRES_IN_SECONDS, customer: { id: shopifyCustomerId, email } };
265
+ }
266
+ /** Idempotent — logging out twice is a no-op the second time. */
267
+ async function logout(sessionId) {
268
+ await (0, redis_connector_1.deleteFromRedis)(sessionKey(sessionId));
269
+ }
270
+ function parseCookie(header, name) {
271
+ if (!header)
272
+ return undefined;
273
+ for (const part of header.split(';')) {
274
+ const [key, ...rest] = part.trim().split('=');
275
+ if (key === name)
276
+ return decodeURIComponent(rest.join('='));
277
+ }
278
+ return undefined;
279
+ }
280
+ function detailsFrom(err) {
281
+ return err instanceof HttpError && typeof err.details?.returnUrl === 'string'
282
+ ? err.details.returnUrl
283
+ : undefined;
284
+ }
285
+ /**
286
+ * Forces a CORS preflight (a custom header can't be set by a simple
287
+ * cross-site form submission, and only an allow-listed origin's own script
288
+ * can set it after that preflight succeeds) — combined with the per-request
289
+ * origin check below and the cookie's `SameSite=None`, this is the
290
+ * session/logout endpoints' CSRF defense.
291
+ */
292
+ function requireCsrfHeader(req, res, next) {
293
+ if (req.header('x-platformx-csrf') !== '1') {
294
+ res.status(403).json({ error: 'Missing CSRF header' });
295
+ return;
296
+ }
297
+ next();
298
+ }
299
+ /**
300
+ * Locks CORS on the session/logout routes to `config.allowedReturnOrigins`,
301
+ * with credentials enabled (the cookie must ride along). No `cors` package
302
+ * dependency — this package stays dependency-light; the allow-list check and
303
+ * preflight response are both this simple.
304
+ */
305
+ function sessionCors(config) {
306
+ return (req, res, next) => {
307
+ const origin = req.header('origin');
308
+ if (origin && isAllowedReturnOrigin(origin, config.allowedReturnOrigins)) {
309
+ res.setHeader('Access-Control-Allow-Origin', origin);
310
+ res.setHeader('Access-Control-Allow-Credentials', 'true');
311
+ res.setHeader('Vary', 'Origin');
312
+ }
313
+ if (req.method === 'OPTIONS') {
314
+ res.setHeader('Access-Control-Allow-Methods', 'POST, OPTIONS');
315
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type, x-platformx-csrf');
316
+ res.status(204).end();
317
+ return;
318
+ }
319
+ next();
320
+ };
321
+ }
322
+ /**
323
+ * Express router exposing the 3 HTTP legs of delivery SSO: Shopify's own
324
+ * callback (GET `/shopify/callback`), and the SPA's own credentialed calls
325
+ * to mint (POST `/session`) and end (POST `/logout`) a bearer. Mount this at
326
+ * `config.callbackBaseUrl`'s path (e.g.
327
+ * `/hep-ecommerce-service/auth/delivery`) so the routes resolve to exactly
328
+ * the URLs `config` describes. `beginDeliverySso` is a plain function, not a
329
+ * route here — call it from your own GraphQL/REST mutation, same as every
330
+ * other write in this package.
331
+ */
332
+ function createDeliverySsoRouter(config) {
333
+ const router = (0, express_1.Router)();
334
+ router.get('/shopify/callback', async (req, res) => {
335
+ const { code, state } = req.query;
336
+ if (!code || !state) {
337
+ res.status(400).send('Delivery sign-in failed: missing code/state. Please return to the app and try again.');
338
+ return;
339
+ }
340
+ try {
341
+ const { redirectUrl, sessionId } = await handleShopifyCallback(code, state, config);
342
+ res.cookie(exports.SESSION_COOKIE_NAME, sessionId, {
343
+ httpOnly: true,
344
+ // The frontend and this route are genuinely cross-site (e.g. a local
345
+ // https://localhost:5173 dev server against a deployed service, or
346
+ // two unrelated production domains) — SameSite=Lax would only ever
347
+ // send this cookie back on a top-level navigation, never on the
348
+ // frontend's own POST .../session fetch. SameSite=None requires
349
+ // Secure, which is fine here: every legitimate origin runs HTTPS.
350
+ // CSRF exposure from the relaxed SameSite is covered separately by
351
+ // sessionCors's strict origin allow-list + the required
352
+ // x-platformx-csrf header.
353
+ secure: true,
354
+ sameSite: 'none',
355
+ path: config.sessionCookiePath,
356
+ maxAge: SESSION_TTL_SECONDS * 1000,
357
+ });
358
+ res.redirect(redirectUrl);
359
+ }
360
+ catch (err) {
361
+ logger_1.Logger.error('delivery SSO shopify callback failed', 'createDeliverySsoRouter', {
362
+ err: err instanceof Error ? err.message : String(err),
363
+ details: err instanceof HttpError ? err.details : undefined,
364
+ });
365
+ const returnUrl = detailsFrom(err);
366
+ if (returnUrl) {
367
+ res.redirect(`${returnUrl}/login?error=delivery_sso_failed`);
368
+ }
369
+ else {
370
+ res.status(400).send('Delivery sign-in failed. Please return to the app and try again.');
371
+ }
372
+ }
373
+ });
374
+ // The two routes below are called directly by the SPA (credentialed
375
+ // fetch, cookie sent automatically) rather than by a third-party redirect.
376
+ router.post('/session', sessionCors(config), requireCsrfHeader, async (req, res) => {
377
+ try {
378
+ const sessionId = parseCookie(req.header('cookie'), exports.SESSION_COOKIE_NAME);
379
+ if (!sessionId)
380
+ throw new HttpError(401, 'No delivery session');
381
+ const session = await mintSession(sessionId);
382
+ res.json(session);
383
+ }
384
+ catch (err) {
385
+ const statusCode = err instanceof HttpError ? err.statusCode : 500;
386
+ res.status(statusCode).json({ error: err instanceof Error ? err.message : 'Delivery session mint failed' });
387
+ }
388
+ });
389
+ router.post('/logout', sessionCors(config), requireCsrfHeader, async (req, res) => {
390
+ try {
391
+ const sessionId = parseCookie(req.header('cookie'), exports.SESSION_COOKIE_NAME);
392
+ if (sessionId)
393
+ await logout(sessionId);
394
+ res.clearCookie(exports.SESSION_COOKIE_NAME, { path: config.sessionCookiePath, secure: true, sameSite: 'none' });
395
+ res.status(204).end();
396
+ }
397
+ catch (err) {
398
+ const statusCode = err instanceof HttpError ? err.statusCode : 500;
399
+ res.status(statusCode).json({ error: err instanceof Error ? err.message : 'Delivery logout failed' });
400
+ }
401
+ });
402
+ return router;
403
+ }
404
+ //# sourceMappingURL=delivery-sso.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-sso.js","sourceRoot":"","sources":["../../src/delivery-sso.ts"],"names":[],"mappings":";;;;;;AAuMA,4CA4BC;AAkMD,0DAqEC;AA1eD,8DAAiC;AAEjC,qCAAoG;AACpG,gEAA+B;A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;YACnE,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAC,CAAC;QACxG,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -47,6 +47,8 @@ export { extractBearer, verifyKeycloakToken, keycloakConfigForTenant, requireKey
47
47
  export type { KeycloakTokenPayload, KeycloakVerifyConfig } from './keycloak-auth';
48
48
  export { signPlatformXToken, verifyPlatformXToken, platformXConfigForTenant, platformXSigningConfigForTenant, requirePlatformXAuth, } from './platformx-auth';
49
49
  export type { PlatformXTokenPayload, PlatformXSigningConfig, PlatformXVerifyConfig } from './platformx-auth';
50
+ export { beginDeliverySso, createDeliverySsoRouter, SESSION_COOKIE_NAME } from './delivery-sso';
51
+ export type { DeliverySsoConfig, MintedSession } from './delivery-sso';
50
52
  export { Logger } from './utils/logger';
51
53
  export type { LoggerInterface } from './utils/logger';
52
54
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAC7F,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EACL,U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iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,+BAA+B,EAC/B,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAChG,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/src/index.js CHANGED
@@ -19,7 +19,7 @@
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.getGraphQLClient = exports.HepSecretProvider = exports.createConfigProvider = exports.buildSecretId = exports.extractSiteName = exports.getClientTenantDetails = exports.setConfigProvider = exports.clearTenantCache = exports.getTenantConfig = exports.registerShopifyWebhooks = exports.createShopifyWebhookRouter = exports.shopifyTopicToRoutingKey = exports.ORDER_WEBHOOK_TOPICS = exports.cartCreatedEvent = exports.setDefaultCustomerAddress = exports.deleteCustomerAddress = exports.updateCustomerAddress = exports.createCustomerAddress = exports.getCustomerAddress = exports.listCustomerAddresses = exports.updateCustomer = exports.getCustomerByEmail = exports.getCustomerById = exports.sendDraftOrderInvoice = exports.completeDraftOrder = exports.createDraftOrder = exports.createRefund = exports.calculateRefund = exports.markOrderAsPaid = exports.captureOrderPayment = exports.reopenOrder = exports.closeOrder = exports.cancelOrder = exports.updateOrder = exports.getOrderById = exports.listOrders = exports.linkCartToCustomer = exports.removeCartLines = exports.updateCartLines = exports.addCartLines = exports.getCart = exports.createCart = exports.fetchProductByIdOrThrow = exports.fetchProductById = exports.fetchProducts = exports.ShopifyUserErrorsError = exports.ShopifyNotFoundError = exports.ShopifyAdapterError = exports.storefrontGraphql = exports.adminGraphql = void 0;
22
- exports.Logger = exports.requirePlatformXAuth = exports.platformXSigningConfigForTenant = exports.platformXConfigForTenant = exports.verifyPlatformXToken = exports.signPlatformXToken = exports.requireKeycloakAuth = exports.keycloakConfigForTenant = exports.verifyKeycloakToken = exports.extractBearer = exports.UnauthorizedError = exports.TokenInvalidError = exports.TokenExpiredError = exports.SecretNotFoundError = exports.TenantNotFoundError = exports.CircuitOpenError = exports.TimeoutError = exports.CircuitBreaker = exports.withTimeout = exports.withRetry = exports.ClientError = exports.gql = exports.clearGraphQLClientCache = void 0;
22
+ exports.Logger = exports.SESSION_COOKIE_NAME = exports.createDeliverySsoRouter = exports.beginDeliverySso = exports.requirePlatformXAuth = exports.platformXSigningConfigForTenant = exports.platformXConfigForTenant = exports.verifyPlatformXToken = exports.signPlatformXToken = exports.requireKeycloakAuth = exports.keycloakConfigForTenant = exports.verifyKeycloakToken = exports.extractBearer = exports.UnauthorizedError = exports.TokenInvalidError = exports.TokenExpiredError = exports.SecretNotFoundError = exports.TenantNotFoundError = exports.CircuitOpenError = exports.TimeoutError = exports.CircuitBreaker = exports.withTimeout = exports.withRetry = exports.ClientError = exports.gql = exports.clearGraphQLClientCache = void 0;
23
23
  var client_1 = require("./client");
24
24
  Object.defineProperty(exports, "adminGraphql", { enumerable: true, get: function () { return client_1.adminGraphql; } });
25
25
  Object.defineProperty(exports, "storefrontGraphql", { enumerable: true, get: function () { return client_1.storefrontGraphql; } });
@@ -111,6 +111,10 @@ Object.defineProperty(exports, "verifyPlatformXToken", { enumerable: true, get:
111
111
  Object.defineProperty(exports, "platformXConfigForTenant", { enumerable: true, get: function () { return platformx_auth_1.platformXConfigForTenant; } });
112
112
  Object.defineProperty(exports, "platformXSigningConfigForTenant", { enumerable: true, get: function () { return platformx_auth_1.platformXSigningConfigForTenant; } });
113
113
  Object.defineProperty(exports, "requirePlatformXAuth", { enumerable: true, get: function () { return platformx_auth_1.requirePlatformXAuth; } });
114
+ var delivery_sso_1 = require("./delivery-sso");
115
+ Object.defineProperty(exports, "beginDeliverySso", { enumerable: true, get: function () { return delivery_sso_1.beginDeliverySso; } });
116
+ Object.defineProperty(exports, "createDeliverySsoRouter", { enumerable: true, get: function () { return delivery_sso_1.createDeliverySsoRouter; } });
117
+ Object.defineProperty(exports, "SESSION_COOKIE_NAME", { enumerable: true, get: function () { return delivery_sso_1.SESSION_COOKIE_NAME; } });
114
118
  var logger_1 = require("./utils/logger");
115
119
  Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
116
120
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;AAEH,mCAA2D;AAAlD,sGAAA,YAAY,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAExC,mCAA6F;AAApF,6GAAA,mBAAmB,OAAA;AAAE,8GAAA,oBAAoB,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAE1E,uCAIoB;AAHlB,yGAAA,aAAa,OAAA;AACb,4GAAA,gBAAgB,OAAA;AAChB,mHAAA,uBAAuB,OAAA;AAGzB,+BAOgB;AANd,kGAAA,UAAU,OAAA;AACV,+FAAA,OAAO,OAAA;AACP,oGAAA,YAAY,OAAA;AACZ,uGAAA,eAAe,OAAA;AACf,uGAAA,eAAe,OAAA;AACf,0GAAA,kBAAkB,OAAA;AAGp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AgB,OAAA;AAC/E,iDAMyB;AALvB,oHAAA,mBAAmB,OAAA;AACnB,oHAAA,mBAAmB,OAAA;AACnB,kHAAA,iBAAiB,OAAA;AACjB,kHAAA,iBAAiB,OAAA;AACjB,kHAAA,iBAAiB,OAAA;AAUnB,iDAKyB;AAJvB,8GAAA,aAAa,OAAA;AACb,oHAAA,mBAAmB,OAAA;AACnB,wHAAA,uBAAuB,OAAA;AACvB,oHAAA,mBAAmB,OAAA;AAGrB,mDAM0B;AALxB,oHAAA,kBAAkB,OAAA;AAClB,sHAAA,oBAAoB,OAAA;AACpB,0HAAA,wBAAwB,OAAA;AACxB,iIAAA,+BAA+B,OAAA;AAC/B,sHAAA,oBAAoB,OAAA;AAGtB,+CAAgG;AAAvF,gHAAA,gBAAgB,OAAA;AAAE,uHAAA,uBAAuB,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AAEvE,yCAAwC;AAA/B,gGAAA,MAAM,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-x-shp/shopify-adapter",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Shopify commerce adapter — Admin API client, read-model mappers, tenant-config resolution, and Keycloak/PlatformX auth verification, consumed by hep-ecommerce-service. Self-contained: does not depend on shp-auth-client.",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",