@storystick/astro 0.2.0-rc.0 → 0.2.0-rc.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.
package/PUBLIC-API.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @storystick/astro API contract
2
2
 
3
- Install this candidate explicitly with `@storystick/astro@0.2.0-rc.0` after registry bootstrap and publication. This repository alone does not make the candidate or beta channel available on npm.
3
+ Install this candidate explicitly with `@storystick/astro@0.2.0-rc.1` after registry bootstrap and publication. This repository alone does not make the candidate or beta channel available on npm.
4
4
 
5
- Version 0.2.0-rc.0, cohort `sdk-0.2.0-rc.0`. ESM distribution; no CommonJS or universal Edge compatibility is promised.
5
+ Version 0.2.0-rc.1, cohort `sdk-0.2.0-rc.1`. ESM distribution; no CommonJS or universal Edge compatibility is promised.
6
6
 
7
7
  This package is a product integration facade. Reserved contracts are required between SDK packages and must be upgraded with the same cohort. Their public export paths do not promise independent stability.
8
8
 
package/dist/.source-hash CHANGED
@@ -1 +1 @@
1
- 6ccd25d1d5248b215be3edafa1caaca6ae7bbab95237b6e0e047ab6de79fddd5
1
+ 5f6f45338c96bd1cce60a00414498f8a9c138c04f19a80cf4bcc6d988b517a46
package/dist/control.js CHANGED
@@ -26,7 +26,10 @@ export function createControlHandler(configuration) {
26
26
  if (action === 'preview' && ctx.request.method === 'GET') {
27
27
  const sessionId = ctx.url.searchParams.get('_ss_session');
28
28
  if (!isSafePreviewSessionId(sessionId))
29
- return json({ code: 'PREVIEW_SESSION_MISSING' }, 400);
29
+ return previewInitialRouteErrorResponse(ctx.request, {
30
+ status: 400, code: 'PREVIEW_SESSION_MISSING', message: 'Preview session selector is required.',
31
+ category: 'validation', recoverable: true, retryable: false,
32
+ });
30
33
  const activation = parsePreviewActivation(ctx.url.searchParams.get('_ss_activation'));
31
34
  const target = assertSafePreviewRedirect(ctx.url.searchParams.get('redirect') || '/', '');
32
35
  const previewScope = createPreviewScope({ variantId: ctx.url.searchParams.get('_ss_variant'), releaseId: ctx.url.searchParams.get('_ss_release') });
@@ -109,10 +112,16 @@ export function createControlHandler(configuration) {
109
112
  }
110
113
  catch (error) {
111
114
  console.error('[storystick/astro control]', error.code ?? error.message);
112
- if (error instanceof PreviewActivationError)
113
- return previewErrorResponse(400, 'PREVIEW_ACTIVATION_INVALID', 'Preview activation is missing or malformed.', { category: 'validation', recoverable: true });
114
- if (error instanceof PreviewRedirectError)
115
- return previewErrorResponse(400, 'PREVIEW_REDIRECT_UNSAFE', 'Unsafe Preview redirect.', { category: 'validation', recoverable: true });
115
+ if (error instanceof PreviewActivationError) {
116
+ const failure = { status: 400, code: 'PREVIEW_ACTIVATION_INVALID', message: 'Preview activation is missing or malformed.',
117
+ category: 'validation', recoverable: true, retryable: false };
118
+ return action === 'preview' ? previewInitialRouteErrorResponse(ctx.request, failure) : previewErrorResponse(failure);
119
+ }
120
+ if (error instanceof PreviewRedirectError) {
121
+ const failure = { status: 400, code: 'PREVIEW_REDIRECT_UNSAFE', message: 'Unsafe Preview redirect.',
122
+ category: 'validation', recoverable: true, retryable: false };
123
+ return action === 'preview' ? previewInitialRouteErrorResponse(ctx.request, failure) : previewErrorResponse(failure);
124
+ }
116
125
  if (error instanceof PreviewGrantExchangeError) {
117
126
  const failure = classifyPreviewGrantError(error, action === 'preview' ? 'activate' : action === 'preview/authoring' ? 'authoring' : 'exchange');
118
127
  return action === 'preview' ? previewInitialRouteErrorResponse(ctx.request, failure) : previewErrorResponse(failure);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storystick/astro",
3
- "version": "0.2.0-rc.0",
3
+ "version": "0.2.0-rc.1",
4
4
  "license": "FSL-1.1-MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -35,11 +35,11 @@
35
35
  "dependencies": {
36
36
  "react": "19.2.8",
37
37
  "react-dom": "19.2.8",
38
- "@storystick/client": "0.2.0-rc.0",
39
- "@storystick/types": "0.1.0-rc.0",
40
- "@storystick/preview": "0.2.0-rc.0",
41
- "@storystick/media": "0.2.0-rc.0",
42
- "@storystick/react": "0.2.0-rc.0"
38
+ "@storystick/client": "0.2.0-rc.1",
39
+ "@storystick/media": "0.2.0-rc.1",
40
+ "@storystick/preview": "0.2.0-rc.1",
41
+ "@storystick/types": "0.1.0-rc.1",
42
+ "@storystick/react": "0.2.0-rc.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@astrojs/check": "0.9.12",