@scenarist/nextjs-adapter 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -0
- package/dist/app/endpoints.d.ts +16 -0
- package/dist/app/endpoints.d.ts.map +1 -1
- package/dist/app/endpoints.js +23 -1
- package/dist/app/impl.d.ts +13 -1
- package/dist/app/impl.d.ts.map +1 -1
- package/dist/app/impl.js +2 -1
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/app/production.d.ts +8 -0
- package/dist/app/production.d.ts.map +1 -1
- package/dist/app/production.js +12 -0
- package/dist/common/endpoint-handlers.d.ts +25 -0
- package/dist/common/endpoint-handlers.d.ts.map +1 -1
- package/dist/common/endpoint-handlers.js +23 -0
- package/dist/pages/endpoints.d.ts +16 -0
- package/dist/pages/endpoints.d.ts.map +1 -1
- package/dist/pages/endpoints.js +23 -1
- package/dist/pages/impl.d.ts +13 -1
- package/dist/pages/impl.d.ts.map +1 -1
- package/dist/pages/impl.js +2 -1
- package/dist/pages/index.d.ts +1 -1
- package/dist/pages/index.d.ts.map +1 -1
- package/dist/pages/index.js +1 -1
- package/dist/pages/production.d.ts +8 -0
- package/dist/pages/production.d.ts.map +1 -1
- package/dist/pages/production.js +12 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -764,6 +764,57 @@ const data = await response.json();
|
|
|
764
764
|
console.log(data.scenarioId); // 'user-logged-in'
|
|
765
765
|
```
|
|
766
766
|
|
|
767
|
+
#### `GET /__scenarist__/state` - Debug State Endpoint
|
|
768
|
+
|
|
769
|
+
Inspect the current test state for debugging. Useful when testing multi-stage flows with `afterResponse.setState`.
|
|
770
|
+
|
|
771
|
+
**Response (200):**
|
|
772
|
+
|
|
773
|
+
```typescript
|
|
774
|
+
{
|
|
775
|
+
testId: string;
|
|
776
|
+
state: Record<string, unknown>; // Current test state
|
|
777
|
+
}
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
**Example:**
|
|
781
|
+
|
|
782
|
+
```typescript
|
|
783
|
+
const response = await fetch("http://localhost:3000/__scenarist__/state", {
|
|
784
|
+
headers: { "x-scenarist-test-id": "test-123" },
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
const data = await response.json();
|
|
788
|
+
console.log(data.state); // { submitted: true, phase: "review" }
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
**Creating the debug endpoint:**
|
|
792
|
+
|
|
793
|
+
**Pages Router:**
|
|
794
|
+
|
|
795
|
+
```typescript
|
|
796
|
+
// pages/api/__scenarist__/state.ts
|
|
797
|
+
import { scenarist } from "@/lib/scenarist";
|
|
798
|
+
|
|
799
|
+
export default scenarist?.createStateEndpoint();
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
**App Router:**
|
|
803
|
+
|
|
804
|
+
```typescript
|
|
805
|
+
// app/api/%5F%5Fscenarist%5F%5F/state/route.ts
|
|
806
|
+
import { scenarist } from "@/lib/scenarist";
|
|
807
|
+
|
|
808
|
+
const handler = scenarist?.createStateEndpoint();
|
|
809
|
+
export const GET = handler;
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
**When to use:**
|
|
813
|
+
|
|
814
|
+
- Debugging failing tests with state-aware mocking
|
|
815
|
+
- Verifying `afterResponse.setState` mutations
|
|
816
|
+
- Testing conditional `afterResponse` behavior (see [ADR-0020](../../docs/adrs/0020-conditional-afterresponse.md))
|
|
817
|
+
|
|
767
818
|
## Core Concepts
|
|
768
819
|
|
|
769
820
|
Scenarist's core functionality is framework-agnostic. For deep understanding of these concepts (request matching, sequences, stateful mocks), see **[Core Functionality Documentation](../../docs/core-functionality.md)**.
|
package/dist/app/endpoints.d.ts
CHANGED
|
@@ -17,4 +17,20 @@ import type { ScenarioManager, ScenaristConfig } from "@scenarist/core";
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
export declare const createScenarioEndpoint: (manager: ScenarioManager, config: ScenaristConfig) => (req: Request) => Promise<Response>;
|
|
20
|
+
/**
|
|
21
|
+
* Create state debug endpoint handler for Next.js App Router.
|
|
22
|
+
*
|
|
23
|
+
* Returns a Web standard Request/Response handler for GET requests
|
|
24
|
+
* that returns the current test state for debugging.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // app/api/%5F%5Fscenarist%5F%5F/state/route.ts
|
|
29
|
+
* import { createStateEndpoint } from '@scenarist/nextjs-adapter/app';
|
|
30
|
+
* import { scenarist } from '@/lib/scenarist';
|
|
31
|
+
*
|
|
32
|
+
* export const GET = scenarist.createStateEndpoint();
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const createStateEndpoint: (manager: ScenarioManager, config: ScenaristConfig) => (req: Request) => Promise<Response>;
|
|
20
36
|
//# sourceMappingURL=endpoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/app/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/app/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAyExE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,eAAe,EACxB,QAAQ,eAAe,MAKT,KAAK,OAAO,KAAG,OAAO,CAAC,QAAQ,CAgB9C,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,eAAe,EACxB,QAAQ,eAAe,MAET,KAAK,OAAO,KAAG,OAAO,CAAC,QAAQ,CAM9C,CAAC"}
|
package/dist/app/endpoints.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppRequestContext } from "./context.js";
|
|
2
|
-
import { handlePostLogic, handleGetLogic, } from "../common/endpoint-handlers.js";
|
|
2
|
+
import { handlePostLogic, handleGetLogic, handleGetStateLogic, } from "../common/endpoint-handlers.js";
|
|
3
3
|
/**
|
|
4
4
|
* Handle POST request to switch scenarios.
|
|
5
5
|
*
|
|
@@ -82,3 +82,25 @@ export const createScenarioEndpoint = (manager, config) => {
|
|
|
82
82
|
}, { status: 405 });
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* Create state debug endpoint handler for Next.js App Router.
|
|
87
|
+
*
|
|
88
|
+
* Returns a Web standard Request/Response handler for GET requests
|
|
89
|
+
* that returns the current test state for debugging.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* // app/api/%5F%5Fscenarist%5F%5F/state/route.ts
|
|
94
|
+
* import { createStateEndpoint } from '@scenarist/nextjs-adapter/app';
|
|
95
|
+
* import { scenarist } from '@/lib/scenarist';
|
|
96
|
+
*
|
|
97
|
+
* export const GET = scenarist.createStateEndpoint();
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export const createStateEndpoint = (manager, config) => {
|
|
101
|
+
return async (req) => {
|
|
102
|
+
const context = new AppRequestContext(req, config);
|
|
103
|
+
const result = handleGetStateLogic(context, manager);
|
|
104
|
+
return Response.json(result, { status: 200 });
|
|
105
|
+
};
|
|
106
|
+
};
|
package/dist/app/impl.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseAdapterOptions, ScenaristAdapter, ScenarioRegistry, ScenarioStore } from "@scenarist/core";
|
|
2
|
-
import { createScenarioEndpoint } from "./endpoints.js";
|
|
2
|
+
import { createScenarioEndpoint, createStateEndpoint } from "./endpoints.js";
|
|
3
3
|
/**
|
|
4
4
|
* Global state for Next.js App Router adapter.
|
|
5
5
|
*
|
|
@@ -50,6 +50,18 @@ export type AppScenarist = Omit<ScenaristAdapter<never>, "middleware"> & {
|
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
52
|
createScenarioEndpoint: () => ReturnType<typeof createScenarioEndpoint>;
|
|
53
|
+
/**
|
|
54
|
+
* Create state debug endpoint handler for use in app/api/%5F%5Fscenarist%5F%5F/state/route.ts
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* // app/api/%5F%5Fscenarist%5F%5F/state/route.ts
|
|
59
|
+
* import { scenarist } from '@/lib/scenarist';
|
|
60
|
+
*
|
|
61
|
+
* export const GET = scenarist?.createStateEndpoint();
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
createStateEndpoint: () => ReturnType<typeof createStateEndpoint>;
|
|
53
65
|
};
|
|
54
66
|
/**
|
|
55
67
|
* Create a Scenarist instance for Next.js App Router (implementation).
|
package/dist/app/impl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl.d.ts","sourceRoot":"","sources":["../../src/app/impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACd,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"impl.d.ts","sourceRoot":"","sources":["../../src/app/impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACd,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE7E;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,uBAAuB,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjD,IAAI,oBAAoB,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAEvD,IAAI,iBAAiB,EAAE,aAAa,GAAG,SAAS,CAAC;IAEjD,IAAI,oBAAoB,EAAE,YAAY,GAAG,SAAS,CAAC;CACpD;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,GAAG;IACvE;;;;;;;;;;;;OAYG;IACH,sBAAsB,EAAE,MAAM,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;IAExE;;;;;;;;;;OAUG;IACH,mBAAmB,EAAE,MAAM,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACnE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,iBAAiB,KACzB,YAqDF,CAAC"}
|
package/dist/app/impl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InMemoryScenarioRegistry, InMemoryScenarioStore, } from "@scenarist/core";
|
|
2
2
|
import { createScenaristBase } from "../common/create-scenarist-base.js";
|
|
3
|
-
import { createScenarioEndpoint } from "./endpoints.js";
|
|
3
|
+
import { createScenarioEndpoint, createStateEndpoint } from "./endpoints.js";
|
|
4
4
|
/**
|
|
5
5
|
* Create a Scenarist instance for Next.js App Router (implementation).
|
|
6
6
|
*
|
|
@@ -67,6 +67,7 @@ export const createScenaristImpl = (options) => {
|
|
|
67
67
|
listScenarios: () => manager.listScenarios(),
|
|
68
68
|
clearScenario: (testId) => manager.clearScenario(testId),
|
|
69
69
|
createScenarioEndpoint: () => createScenarioEndpoint(manager, config),
|
|
70
|
+
createStateEndpoint: () => createStateEndpoint(manager, config),
|
|
70
71
|
start: () => {
|
|
71
72
|
// Singleton guard - prevents duplicate MSW initialization
|
|
72
73
|
// Next.js (Turbopack) creates multiple module instances, so this ensures
|
package/dist/app/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
*/
|
|
33
33
|
export { createScenarist } from "./setup.js";
|
|
34
34
|
export { AppRequestContext } from "./context.js";
|
|
35
|
-
export { createScenarioEndpoint } from "./endpoints.js";
|
|
35
|
+
export { createScenarioEndpoint, createStateEndpoint } from "./endpoints.js";
|
|
36
36
|
export { getScenaristHeaders, getScenaristHeadersFromReadonlyHeaders, getScenaristTestId, getScenaristTestIdFromReadonlyHeaders, } from "./helpers.js";
|
|
37
37
|
export type { AppAdapterOptions, AppScenarist } from "./setup.js";
|
|
38
38
|
export { SCENARIST_TEST_ID_HEADER } from "@scenarist/core";
|
package/dist/app/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EACL,mBAAmB,EACnB,sCAAsC,EACtC,kBAAkB,EAClB,qCAAqC,GACtC,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGlE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,SAAS,GACV,MAAM,iBAAiB,CAAC"}
|
package/dist/app/index.js
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
*/
|
|
33
33
|
export { createScenarist } from "./setup.js";
|
|
34
34
|
export { AppRequestContext } from "./context.js";
|
|
35
|
-
export { createScenarioEndpoint } from "./endpoints.js";
|
|
35
|
+
export { createScenarioEndpoint, createStateEndpoint } from "./endpoints.js";
|
|
36
36
|
export { getScenaristHeaders, getScenaristHeadersFromReadonlyHeaders, getScenaristTestId, getScenaristTestIdFromReadonlyHeaders, } from "./helpers.js";
|
|
37
37
|
// Re-export core types and constants for user convenience (users should only install this adapter)
|
|
38
38
|
export { SCENARIST_TEST_ID_HEADER } from "@scenarist/core";
|
package/dist/app/production.d.ts
CHANGED
|
@@ -36,4 +36,12 @@ export declare function getScenaristTestId(_req: Request): string;
|
|
|
36
36
|
export declare function getScenaristTestIdFromReadonlyHeaders(_headers: {
|
|
37
37
|
get(name: string): string | null;
|
|
38
38
|
}): string;
|
|
39
|
+
/**
|
|
40
|
+
* Production stub: Returns undefined (no endpoint handler in production)
|
|
41
|
+
*/
|
|
42
|
+
export declare const createScenarioEndpoint: () => undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Production stub: Returns undefined (no state endpoint handler in production)
|
|
45
|
+
*/
|
|
46
|
+
export declare const createStateEndpoint: () => undefined;
|
|
39
47
|
//# sourceMappingURL=production.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"production.d.ts","sourceRoot":"","sources":["../../src/app/production.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGlE,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,UAAU,EACV,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,OAAO,YAAY,EAAE,iBAAiB,KAC/C,OAAO,YAAY,EAAE,YAAY,GAAG,SAEtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,OAAO,iBAAiB,EAAE,mBAAmB,KACrD,OAAO,iBAAiB,EAAE,MAAM,GAAG,SAErC,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEzE;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CAAC,QAAQ,EAAE;IAC/D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAClC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEzB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAExD;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CAAC,QAAQ,EAAE;IAC9D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAClC,GAAG,MAAM,CAET"}
|
|
1
|
+
{"version":3,"file":"production.d.ts","sourceRoot":"","sources":["../../src/app/production.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGlE,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,UAAU,EACV,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,OAAO,YAAY,EAAE,iBAAiB,KAC/C,OAAO,YAAY,EAAE,YAAY,GAAG,SAEtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,OAAO,iBAAiB,EAAE,mBAAmB,KACrD,OAAO,iBAAiB,EAAE,MAAM,GAAG,SAErC,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEzE;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CAAC,QAAQ,EAAE;IAC/D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAClC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEzB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAExD;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CAAC,QAAQ,EAAE;IAC9D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAClC,GAAG,MAAM,CAET;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAO,SAEzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAO,SAEtC,CAAC"}
|
package/dist/app/production.js
CHANGED
|
@@ -42,3 +42,15 @@ export function getScenaristTestId(_req) {
|
|
|
42
42
|
export function getScenaristTestIdFromReadonlyHeaders(_headers) {
|
|
43
43
|
return "default-test";
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Production stub: Returns undefined (no endpoint handler in production)
|
|
47
|
+
*/
|
|
48
|
+
export const createScenarioEndpoint = () => {
|
|
49
|
+
return undefined;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Production stub: Returns undefined (no state endpoint handler in production)
|
|
53
|
+
*/
|
|
54
|
+
export const createStateEndpoint = () => {
|
|
55
|
+
return undefined;
|
|
56
|
+
};
|
|
@@ -96,4 +96,29 @@ export type GetResult = {
|
|
|
96
96
|
* ```
|
|
97
97
|
*/
|
|
98
98
|
export declare const handleGetLogic: (context: RequestContext, manager: ScenarioManager) => GetResult;
|
|
99
|
+
/**
|
|
100
|
+
* Result type for GET state endpoint business logic.
|
|
101
|
+
*
|
|
102
|
+
* Always succeeds - returns testId and state (empty object if no state).
|
|
103
|
+
*/
|
|
104
|
+
export type GetStateResult = {
|
|
105
|
+
readonly testId: string;
|
|
106
|
+
readonly state: Readonly<Record<string, unknown>>;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Business logic for GET state endpoint.
|
|
110
|
+
*
|
|
111
|
+
* Retrieves the current test state for debugging.
|
|
112
|
+
* Framework-agnostic - can be used by any adapter.
|
|
113
|
+
*
|
|
114
|
+
* Steps:
|
|
115
|
+
* 1. Extract test ID from request context
|
|
116
|
+
* 2. Get state from manager
|
|
117
|
+
* 3. Return testId and state
|
|
118
|
+
*
|
|
119
|
+
* @param context - Request context for test ID extraction
|
|
120
|
+
* @param manager - Scenario manager for retrieving state
|
|
121
|
+
* @returns Result with testId and state object
|
|
122
|
+
*/
|
|
123
|
+
export declare const handleGetStateLogic: (context: RequestContext, manager: ScenarioManager) => GetStateResult;
|
|
99
124
|
//# sourceMappingURL=endpoint-handlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-handlers.d.ts","sourceRoot":"","sources":["../../src/common/endpoint-handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB;IACE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,GACD;IACE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,OAAO,EACb,SAAS,cAAc,EACvB,SAAS,eAAe,KACvB,OAAO,CAAC,UAAU,CA0CpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACjB;IACE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,GACD;IACE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,cAAc,EACvB,SAAS,eAAe,KACvB,SAqBF,CAAC"}
|
|
1
|
+
{"version":3,"file":"endpoint-handlers.d.ts","sourceRoot":"","sources":["../../src/common/endpoint-handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB;IACE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,GACD;IACE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,OAAO,EACb,SAAS,cAAc,EACvB,SAAS,eAAe,KACvB,OAAO,CAAC,UAAU,CA0CpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACjB;IACE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,GACD;IACE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,cAAc,EACvB,SAAS,eAAe,KACvB,SAqBF,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,cAAc,EACvB,SAAS,eAAe,KACvB,cAQF,CAAC"}
|
|
@@ -120,3 +120,26 @@ export const handleGetLogic = (context, manager) => {
|
|
|
120
120
|
...(scenarioDefinition && { scenarioName: scenarioDefinition.name }),
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
|
+
/**
|
|
124
|
+
* Business logic for GET state endpoint.
|
|
125
|
+
*
|
|
126
|
+
* Retrieves the current test state for debugging.
|
|
127
|
+
* Framework-agnostic - can be used by any adapter.
|
|
128
|
+
*
|
|
129
|
+
* Steps:
|
|
130
|
+
* 1. Extract test ID from request context
|
|
131
|
+
* 2. Get state from manager
|
|
132
|
+
* 3. Return testId and state
|
|
133
|
+
*
|
|
134
|
+
* @param context - Request context for test ID extraction
|
|
135
|
+
* @param manager - Scenario manager for retrieving state
|
|
136
|
+
* @returns Result with testId and state object
|
|
137
|
+
*/
|
|
138
|
+
export const handleGetStateLogic = (context, manager) => {
|
|
139
|
+
const testId = context.getTestId();
|
|
140
|
+
const state = manager.getState(testId);
|
|
141
|
+
return {
|
|
142
|
+
testId,
|
|
143
|
+
state,
|
|
144
|
+
};
|
|
145
|
+
};
|
|
@@ -17,4 +17,20 @@ import type { ScenarioManager, ScenaristConfig } from "@scenarist/core";
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
export declare const createScenarioEndpoint: (manager: ScenarioManager, config: ScenaristConfig) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Create state debug endpoint handler for Next.js Pages Router.
|
|
22
|
+
*
|
|
23
|
+
* Returns a Next.js API route handler for GET requests
|
|
24
|
+
* that returns the current test state for debugging.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // pages/api/__scenarist__/state.ts
|
|
29
|
+
* import { createStateEndpoint } from '@scenarist/nextjs-adapter/pages';
|
|
30
|
+
* import { scenarist } from '../../../lib/scenarist';
|
|
31
|
+
*
|
|
32
|
+
* export default createStateEndpoint(scenarist.manager, scenarist.config);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const createStateEndpoint: (manager: ScenarioManager, config: ScenaristConfig) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
|
|
20
36
|
//# sourceMappingURL=endpoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/pages/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/pages/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAiExE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,eAAe,EACxB,QAAQ,eAAe,MAKT,KAAK,cAAc,EAAE,KAAK,eAAe,KAAG,OAAO,CAAC,IAAI,CAavE,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,eAAe,EACxB,QAAQ,eAAe,MAET,KAAK,cAAc,EAAE,KAAK,eAAe,KAAG,OAAO,CAAC,IAAI,CAMvE,CAAC"}
|
package/dist/pages/endpoints.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PagesRequestContext } from "./context.js";
|
|
2
|
-
import { handlePostLogic, handleGetLogic, } from "../common/endpoint-handlers.js";
|
|
2
|
+
import { handlePostLogic, handleGetLogic, handleGetStateLogic, } from "../common/endpoint-handlers.js";
|
|
3
3
|
/**
|
|
4
4
|
* Handle POST request to switch scenarios.
|
|
5
5
|
*
|
|
@@ -82,3 +82,25 @@ export const createScenarioEndpoint = (manager, config) => {
|
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* Create state debug endpoint handler for Next.js Pages Router.
|
|
87
|
+
*
|
|
88
|
+
* Returns a Next.js API route handler for GET requests
|
|
89
|
+
* that returns the current test state for debugging.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* // pages/api/__scenarist__/state.ts
|
|
94
|
+
* import { createStateEndpoint } from '@scenarist/nextjs-adapter/pages';
|
|
95
|
+
* import { scenarist } from '../../../lib/scenarist';
|
|
96
|
+
*
|
|
97
|
+
* export default createStateEndpoint(scenarist.manager, scenarist.config);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export const createStateEndpoint = (manager, config) => {
|
|
101
|
+
return async (req, res) => {
|
|
102
|
+
const context = new PagesRequestContext(req, config);
|
|
103
|
+
const result = handleGetStateLogic(context, manager);
|
|
104
|
+
res.status(200).json(result);
|
|
105
|
+
};
|
|
106
|
+
};
|
package/dist/pages/impl.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseAdapterOptions, ScenaristAdapter, ScenarioRegistry, ScenarioStore } from "@scenarist/core";
|
|
2
|
-
import { createScenarioEndpoint } from "./endpoints.js";
|
|
2
|
+
import { createScenarioEndpoint, createStateEndpoint } from "./endpoints.js";
|
|
3
3
|
/**
|
|
4
4
|
* Global state for Next.js Pages Router adapter.
|
|
5
5
|
*
|
|
@@ -48,6 +48,18 @@ export type PagesScenarist = Omit<ScenaristAdapter<never>, "middleware"> & {
|
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
50
|
createScenarioEndpoint: () => ReturnType<typeof createScenarioEndpoint>;
|
|
51
|
+
/**
|
|
52
|
+
* Create state debug endpoint handler for use in pages/api/__scenarist__/state.ts
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* // pages/api/__scenarist__/state.ts
|
|
57
|
+
* import { scenarist } from '../../../lib/scenarist';
|
|
58
|
+
*
|
|
59
|
+
* export default scenarist?.createStateEndpoint();
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
createStateEndpoint: () => ReturnType<typeof createStateEndpoint>;
|
|
51
63
|
};
|
|
52
64
|
/**
|
|
53
65
|
* Create a Scenarist instance for Next.js Pages Router (implementation).
|
package/dist/pages/impl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl.d.ts","sourceRoot":"","sources":["../../src/pages/impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACd,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"impl.d.ts","sourceRoot":"","sources":["../../src/pages/impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACd,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE7E;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,6BAA6B,EAAE,OAAO,GAAG,SAAS,CAAC;IAEvD,IAAI,0BAA0B,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAE7D,IAAI,uBAAuB,EAAE,aAAa,GAAG,SAAS,CAAC;IAEvD,IAAI,0BAA0B,EAAE,cAAc,GAAG,SAAS,CAAC;CAC5D;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,GAAG;IACzE;;;;;;;;;;OAUG;IACH,sBAAsB,EAAE,MAAM,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;IAExE;;;;;;;;;;OAUG;IACH,mBAAmB,EAAE,MAAM,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACnE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,mBAAmB,KAC3B,cAuDF,CAAC"}
|
package/dist/pages/impl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InMemoryScenarioRegistry, InMemoryScenarioStore, } from "@scenarist/core";
|
|
2
2
|
import { createScenaristBase } from "../common/create-scenarist-base.js";
|
|
3
|
-
import { createScenarioEndpoint } from "./endpoints.js";
|
|
3
|
+
import { createScenarioEndpoint, createStateEndpoint } from "./endpoints.js";
|
|
4
4
|
/**
|
|
5
5
|
* Create a Scenarist instance for Next.js Pages Router (implementation).
|
|
6
6
|
*
|
|
@@ -65,6 +65,7 @@ export const createScenaristImpl = (options) => {
|
|
|
65
65
|
listScenarios: () => manager.listScenarios(),
|
|
66
66
|
clearScenario: (testId) => manager.clearScenario(testId),
|
|
67
67
|
createScenarioEndpoint: () => createScenarioEndpoint(manager, config),
|
|
68
|
+
createStateEndpoint: () => createStateEndpoint(manager, config),
|
|
68
69
|
start: () => {
|
|
69
70
|
// Singleton guard - prevents duplicate MSW initialization
|
|
70
71
|
// Next.js dev mode with HMR creates multiple module instances, so this ensures
|
package/dist/pages/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
*/
|
|
30
30
|
export { createScenarist } from "./setup.js";
|
|
31
31
|
export { PagesRequestContext } from "./context.js";
|
|
32
|
-
export { createScenarioEndpoint } from "./endpoints.js";
|
|
32
|
+
export { createScenarioEndpoint, createStateEndpoint } from "./endpoints.js";
|
|
33
33
|
export { getScenaristHeaders } from "./helpers.js";
|
|
34
34
|
export type { PagesAdapterOptions, PagesScenarist } from "./setup.js";
|
|
35
35
|
export { SCENARIST_TEST_ID_HEADER } from "@scenarist/core";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,SAAS,GACV,MAAM,iBAAiB,CAAC"}
|
package/dist/pages/index.js
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
*/
|
|
30
30
|
export { createScenarist } from "./setup.js";
|
|
31
31
|
export { PagesRequestContext } from "./context.js";
|
|
32
|
-
export { createScenarioEndpoint } from "./endpoints.js";
|
|
32
|
+
export { createScenarioEndpoint, createStateEndpoint } from "./endpoints.js";
|
|
33
33
|
export { getScenaristHeaders } from "./helpers.js";
|
|
34
34
|
// Re-export core types and constants for user convenience (users should only install this adapter)
|
|
35
35
|
export { SCENARIST_TEST_ID_HEADER } from "@scenarist/core";
|
|
@@ -20,4 +20,12 @@ export declare const createConsoleLogger: (_config: import("@scenarist/core").Co
|
|
|
20
20
|
* Production stub: Returns empty object (no test headers needed in production)
|
|
21
21
|
*/
|
|
22
22
|
export declare function getScenaristHeaders(_req: import("next").NextApiRequest): Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Production stub: Returns undefined (no endpoint handler in production)
|
|
25
|
+
*/
|
|
26
|
+
export declare const createScenarioEndpoint: () => undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Production stub: Returns undefined (no state endpoint handler in production)
|
|
29
|
+
*/
|
|
30
|
+
export declare const createStateEndpoint: () => undefined;
|
|
23
31
|
//# sourceMappingURL=production.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"production.d.ts","sourceRoot":"","sources":["../../src/pages/production.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGtE,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,UAAU,EACV,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,OAAO,YAAY,EAAE,mBAAmB,KACjD,OAAO,YAAY,EAAE,cAAc,GAAG,SAExC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,OAAO,iBAAiB,EAAE,mBAAmB,KACrD,OAAO,iBAAiB,EAAE,MAAM,GAAG,SAErC,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,MAAM,EAAE,cAAc,GAClC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB"}
|
|
1
|
+
{"version":3,"file":"production.d.ts","sourceRoot":"","sources":["../../src/pages/production.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGtE,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,UAAU,EACV,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,OAAO,YAAY,EAAE,mBAAmB,KACjD,OAAO,YAAY,EAAE,cAAc,GAAG,SAExC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,OAAO,iBAAiB,EAAE,mBAAmB,KACrD,OAAO,iBAAiB,EAAE,MAAM,GAAG,SAErC,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,MAAM,EAAE,cAAc,GAClC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAO,SAEzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAO,SAEtC,CAAC"}
|
package/dist/pages/production.js
CHANGED
|
@@ -24,3 +24,15 @@ export const createConsoleLogger = (_config) => {
|
|
|
24
24
|
export function getScenaristHeaders(_req) {
|
|
25
25
|
return {};
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Production stub: Returns undefined (no endpoint handler in production)
|
|
29
|
+
*/
|
|
30
|
+
export const createScenarioEndpoint = () => {
|
|
31
|
+
return undefined;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Production stub: Returns undefined (no state endpoint handler in production)
|
|
35
|
+
*/
|
|
36
|
+
export const createStateEndpoint = () => {
|
|
37
|
+
return undefined;
|
|
38
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scenarist/nextjs-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Next.js adapter for Scenarist (Pages Router and App Router)",
|
|
5
5
|
"author": "Paul Hammond (citypaul) <paul@packsoftware.co.uk>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"zod": "^4.1.13",
|
|
62
|
-
"@scenarist/core": "0.
|
|
63
|
-
"@scenarist/msw-adapter": "0.
|
|
62
|
+
"@scenarist/core": "0.4.0",
|
|
63
|
+
"@scenarist/msw-adapter": "0.4.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"msw": "^2.0.0",
|