{"_id":"@dg-superapp/scenario-schema","name":"@dg-superapp/scenario-schema","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@dg-superapp/scenario-schema","version":"0.2.0","description":"Versioned zod schema + loader for DG SuperApp simulator scenarios. Shared contract for simulator, bridge-testing, admin portal Bridge Mock Preview, and downstream tooling.","type":"module","main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./package.json":"./package.json"},"dependencies":{"zod":"^3.25.0"},"devDependencies":{"@types/node":"^22.0.0","typescript":"^5.7.0","unbuild":"^3.0.0","vitest":"^4.0.17"},"keywords":["super-app","bridge","simulator","scenario","zod","schema","dg"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/dg-superapp/dg-superapp-bridge.git","directory":"packages/scenario-schema"},"publishConfig":{"registry":"https://registry.npmjs.org","access":"public"},"sideEffects":false,"scripts":{"build":"unbuild","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit"},"_id":"@dg-superapp/scenario-schema@0.2.0","bugs":{"url":"https://github.com/dg-superapp/dg-superapp-bridge/issues"},"homepage":"https://github.com/dg-superapp/dg-superapp-bridge#readme","_integrity":"sha512-zF+kIMOfjbLpPkY/wffLFuKyqvznh1kIUevoChF4gy9Er7oePo0+E6/cA5feNvJAlaidkslsjHSnn5ME/bKGGA==","_resolved":"/tmp/ea8a34aeffc1b64d571c90b6c35374eb/dg-superapp-scenario-schema-0.2.0.tgz","_from":"file:dg-superapp-scenario-schema-0.2.0.tgz","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-zF+kIMOfjbLpPkY/wffLFuKyqvznh1kIUevoChF4gy9Er7oePo0+E6/cA5feNvJAlaidkslsjHSnn5ME/bKGGA==","shasum":"bbdb446b87198685b30193c5f2d084004b420d53","tarball":"https://registry.npmjs.org/@dg-superapp/scenario-schema/-/scenario-schema-0.2.0.tgz","fileCount":7,"unpackedSize":50246,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDLA185HTZiKUbwJDPwZVoCuqgOR3O03xoRYcaLqsa7rQIhAPGRU1GCGfVyS0pE5a6hDiBMmhUNzjiE255rOmAiR3TH"}]},"_npmUser":{"name":"chantysothy","email":"chanty.sothy@gmail.com"},"directories":{},"maintainers":[{"name":"chantysothy","email":"chanty.sothy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/scenario-schema_0.2.0_1779155723821_0.844140394265184"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-19T01:55:23.760Z","0.2.0":"2026-05-19T01:55:23.950Z","modified":"2026-05-19T01:55:24.117Z"},"maintainers":[{"name":"chantysothy","email":"chanty.sothy@gmail.com"}],"description":"Versioned zod schema + loader for DG SuperApp simulator scenarios. Shared contract for simulator, bridge-testing, admin portal Bridge Mock Preview, and downstream tooling.","homepage":"https://github.com/dg-superapp/dg-superapp-bridge#readme","keywords":["super-app","bridge","simulator","scenario","zod","schema","dg"],"repository":{"type":"git","url":"git+https://github.com/dg-superapp/dg-superapp-bridge.git","directory":"packages/scenario-schema"},"bugs":{"url":"https://github.com/dg-superapp/dg-superapp-bridge/issues"},"license":"MIT","readme":"# @dg-superapp/scenario-schema\n\nVersioned zod schema + loader for **DG SuperApp simulator scenarios**.\nThe shared contract used by the simulator desktop app, `@dg-superapp/bridge-testing`,\nthe admin portal Bridge Mock Preview, and the MCP simulator server.\n\n## Install\n\n```bash\npnpm add @dg-superapp/scenario-schema\n```\n\n## Use\n\n```ts\nimport {\n  type Scenario,\n  loadScenario,\n  scenarioSchema,\n  serializeScenario,\n  SCHEMA_VERSION,\n} from \"@dg-superapp/scenario-schema\";\n\n// 1. Validate an in-memory object\nconst scenario: Scenario = scenarioSchema.parse({\n  schemaVersion: SCHEMA_VERSION,\n  name: \"offline\",\n  profile: { level: \"1\" },\n  network: { throttle: \"offline\" },\n});\n\n// 2. Load from a URL, filesystem path, or object\nconst loaded = await loadScenario(\"./scenarios/offline.dg-scenario.json\");\n\n// 3. Serialize with stable key ordering for diffable on-disk files\nawait fs.writeFile(\"offline.dg-scenario.json\", serializeScenario(loaded));\n```\n\n## Schema\n\n`Scenario` is a superset of v1.0 BridgeMockPreview state:\n\n| Field           | Purpose                                                           |\n| --------------- | ----------------------------------------------------------------- |\n| `schemaVersion` | Literal `\"1.0.0\"` (loader rejects incompatible majors)            |\n| `name`          | Display name                                                      |\n| `description`   | Free-form description                                             |\n| `tags`          | Searchable labels                                                 |\n| `profile`       | Maturity level `\"0\" \\| \"1\" \\| \"2\"` plus optional fixture data     |\n| `responses`     | Per-handler response config: `default \\| success \\| error \\| delay` |\n| `consent`       | Per-handler consent state + audit history                         |\n| `network`       | Throttle preset + extra latency                                   |\n| `metadata`      | Opaque escape hatch (NOT covered by SemVer)                       |\n\n## Versioning\n\nAny **breaking** change to the wire format bumps `schemaVersion`.\n`loadScenario()` rejects scenarios whose `schemaVersion` major differs\nfrom the package's `SCHEMA_VERSION`.\n\n## Closes\n\n- v1.0 Phase 8.1 (response-config → handler-dispatch wiring) — **SIM-17**\n- v3.0 KEYSTONE — **SIM-02**\n","readmeFilename":"README.md","_rev":"1-e1f786021cc190ef3df4734f9b64bf54"}