@powerhousedao/vetra 6.2.0-dev.3 → 6.2.0-dev.30

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.
Files changed (84) hide show
  1. package/dist/codegen/index.d.ts +6 -91
  2. package/dist/codegen/index.d.ts.map +1 -1
  3. package/dist/codegen/index.js +2 -632
  4. package/dist/codegen/index.js.map +1 -1
  5. package/dist/codegen/spec.d.ts +2 -0
  6. package/dist/codegen/spec.js +2 -0
  7. package/dist/{connect-Bbz4cL8F.js → connect-CjGVphlq.js} +1 -1
  8. package/dist/{connect-Bbz4cL8F.js.map → connect-CjGVphlq.js.map} +1 -1
  9. package/dist/document-models/app-module/index.d.ts +1 -1
  10. package/dist/document-models/document-editor/index.d.ts +1 -1
  11. package/dist/document-models/index.d.ts +5 -5
  12. package/dist/document-models/processor-module/index.d.ts +1 -1
  13. package/dist/document-models/subgraph-module/index.d.ts +1 -1
  14. package/dist/document-models/vetra-package/index.d.ts +1 -1
  15. package/dist/{editor-Dz3cXtzn.js → editor-BmYxPe_4.js} +56 -56
  16. package/dist/editor-BmYxPe_4.js.map +1 -0
  17. package/dist/{editor-BamOOi9L.js → editor-CtN1Sy88.js} +11 -11
  18. package/dist/editor-CtN1Sy88.js.map +1 -0
  19. package/dist/{editor-je4HFt2f.js → editor-De5XaIXa.js} +32 -32
  20. package/dist/editor-De5XaIXa.js.map +1 -0
  21. package/dist/{editor-D-QqGEkw.js → editor-bA5TTxfU.js} +15 -15
  22. package/dist/editor-bA5TTxfU.js.map +1 -0
  23. package/dist/{editor-rYCWiter.js → editor-fNaLqnMc.js} +8 -8
  24. package/dist/editor-fNaLqnMc.js.map +1 -0
  25. package/dist/{editor-CM9tpwzR.js → editor-saGUzfCl.js} +17 -17
  26. package/dist/editor-saGUzfCl.js.map +1 -0
  27. package/dist/editors/components/index.js +1 -1
  28. package/dist/editors/components/index.js.map +1 -1
  29. package/dist/editors/hooks/index.js +1 -1
  30. package/dist/editors/index.js +1 -1
  31. package/dist/{factory-DcPyqWkY.js → factory-B6hBnFAf.js} +3 -3
  32. package/dist/{factory-DcPyqWkY.js.map → factory-B6hBnFAf.js.map} +1 -1
  33. package/dist/{factory-BkA-IvkR.js → factory-Cn0UwIFB.js} +2 -2
  34. package/dist/{factory-BkA-IvkR.js.map → factory-Cn0UwIFB.js.map} +1 -1
  35. package/dist/{hooks-Btogj1f0.js → hooks-D_8Uwk1s.js} +1 -1
  36. package/dist/{hooks-Btogj1f0.js.map → hooks-D_8Uwk1s.js.map} +1 -1
  37. package/dist/{index-BzDZOr5P.d.ts → index-BES2zg3c.d.ts} +4 -4
  38. package/dist/index-BES2zg3c.d.ts.map +1 -0
  39. package/dist/{index-DE_s19VI.d.ts → index-D2tNV62S.d.ts} +4 -4
  40. package/dist/index-D2tNV62S.d.ts.map +1 -0
  41. package/dist/{index-6u5B5ORH.d.ts → index-DMMMQaUe.d.ts} +4 -4
  42. package/dist/index-DMMMQaUe.d.ts.map +1 -0
  43. package/dist/{index-BL4jGAtJ.d.ts → index-HHjpYUNP.d.ts} +4 -4
  44. package/dist/index-HHjpYUNP.d.ts.map +1 -0
  45. package/dist/index.d.ts +5 -5
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +1 -1
  48. package/dist/{logger-CYkStoEb.js → logger-DLnGUZk9.js} +1 -1
  49. package/dist/{logger-CYkStoEb.js.map → logger-DLnGUZk9.js.map} +1 -1
  50. package/dist/module-1hr_ne9w.js.map +1 -1
  51. package/dist/{module-DvO77TZz.js → module-BhsG8kkn.js} +7 -7
  52. package/dist/{module-DvO77TZz.js.map → module-BhsG8kkn.js.map} +1 -1
  53. package/dist/{module-rS5YXFpM.d.ts → module-D3n9Z2mN.d.ts} +4 -4
  54. package/dist/module-D3n9Z2mN.d.ts.map +1 -0
  55. package/dist/{processor-BfQ_DU7u.js → processor-D2z8Eq93.js} +2 -2
  56. package/dist/{processor-BfQ_DU7u.js.map → processor-D2z8Eq93.js.map} +1 -1
  57. package/dist/processors/codegen/index.js +2 -2
  58. package/dist/processors/index.js +1 -1
  59. package/dist/processors/vetra-read-model/index.js +1 -1
  60. package/dist/spec-api-CT1DqmgF.js +640 -0
  61. package/dist/spec-api-CT1DqmgF.js.map +1 -0
  62. package/dist/specs-_7A7Tl_N.d.ts +90 -0
  63. package/dist/specs-_7A7Tl_N.d.ts.map +1 -0
  64. package/dist/switchboard-CvWiUgBP.js +8 -0
  65. package/dist/{switchboard-C_BapCdk.js.map → switchboard-CvWiUgBP.js.map} +1 -1
  66. package/dist/{useVetraDocument-tpjMF571.js → useVetraDocument-BpPD6DKR.js} +1 -1
  67. package/dist/{useVetraDocument-tpjMF571.js.map → useVetraDocument-BpPD6DKR.js.map} +1 -1
  68. package/dist/utils-B4KdjDnp.js.map +1 -1
  69. package/dist/utils-BiV3cs9Y.js.map +1 -1
  70. package/dist/utils-CkWB3DRk.js.map +1 -1
  71. package/dist/utils-D0ejTHeY.js.map +1 -1
  72. package/package.json +30 -11
  73. package/dist/editor-BamOOi9L.js.map +0 -1
  74. package/dist/editor-CM9tpwzR.js.map +0 -1
  75. package/dist/editor-D-QqGEkw.js.map +0 -1
  76. package/dist/editor-Dz3cXtzn.js.map +0 -1
  77. package/dist/editor-je4HFt2f.js.map +0 -1
  78. package/dist/editor-rYCWiter.js.map +0 -1
  79. package/dist/index-6u5B5ORH.d.ts.map +0 -1
  80. package/dist/index-BL4jGAtJ.d.ts.map +0 -1
  81. package/dist/index-BzDZOr5P.d.ts.map +0 -1
  82. package/dist/index-DE_s19VI.d.ts.map +0 -1
  83. package/dist/module-rS5YXFpM.d.ts.map +0 -1
  84. package/dist/switchboard-C_BapCdk.js +0 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-api-CT1DqmgF.js","names":["documentEditorReducer","documentEditorUtils","documentEditorActions","documentEditorSpec","processorModuleReducer","processorModuleUtils","processorModuleActions","processorModuleSpec","subgraphModuleReducer","subgraphModuleUtils","subgraphModuleActions","subgraphModuleSpec","appModuleReducer","appModuleUtils","appModuleActions","appModuleSpec"],"sources":["../document-models/app-module/app-module.json","../document-models/document-editor/document-editor.json","../document-models/processor-module/processor-module.json","../document-models/subgraph-module/subgraph-module.json","../codegen/specs.ts","../codegen/spec-api.ts"],"sourcesContent":["","","","","import type {\n Action,\n DocumentModelGlobalState,\n PHDocument,\n Reducer,\n} from \"@powerhousedao/shared/document-model\";\nimport { kebabCase } from \"change-case\";\nimport { documentModelDocumentModelModule } from \"document-model\";\nimport { baseSaveToFile } from \"document-model/node\";\nimport { mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\n/* Import from gen/ + actions.ts directly (not the top-level barrel) so we\n * don't pull in `hooks.ts`, which depends on `@powerhousedao/reactor-browser`\n * (a browser-only module that breaks Node-side spec tooling). */\nimport appModuleSpec from \"../document-models/app-module/app-module.json\" with { type: \"json\" };\nimport { actions as appModuleActions } from \"../document-models/app-module/v1/actions.js\";\nimport {\n appModuleDocumentType,\n createAppModuleDocument,\n reducer as appModuleReducer,\n utils as appModuleUtils,\n} from \"../document-models/app-module/v1/gen/index.js\";\nimport documentEditorSpec from \"../document-models/document-editor/document-editor.json\" with { type: \"json\" };\nimport { actions as documentEditorActions } from \"../document-models/document-editor/v1/actions.js\";\nimport {\n createDocumentEditorDocument,\n documentEditorDocumentType,\n reducer as documentEditorReducer,\n utils as documentEditorUtils,\n} from \"../document-models/document-editor/v1/gen/index.js\";\nimport processorModuleSpec from \"../document-models/processor-module/processor-module.json\" with { type: \"json\" };\nimport { actions as processorModuleActions } from \"../document-models/processor-module/v1/actions.js\";\nimport {\n createProcessorModuleDocument,\n processorModuleDocumentType,\n reducer as processorModuleReducer,\n utils as processorModuleUtils,\n} from \"../document-models/processor-module/v1/gen/index.js\";\nimport subgraphModuleSpec from \"../document-models/subgraph-module/subgraph-module.json\" with { type: \"json\" };\nimport { actions as subgraphModuleActions } from \"../document-models/subgraph-module/v1/actions.js\";\nimport {\n createSubgraphModuleDocument,\n subgraphModuleDocumentType,\n reducer as subgraphModuleReducer,\n utils as subgraphModuleUtils,\n} from \"../document-models/subgraph-module/v1/gen/index.js\";\n\nexport const SPECS_DIRNAME = \"specs\";\n\nconst documentModelDocumentType = \"powerhouse/document-model\";\n\ntype ActionsModule = Record<string, (input?: any) => Action>;\n\ntype SpecEntry = {\n documentType: string;\n subdir: string;\n reducer: Reducer<any>;\n utils: { fileExtension: string };\n actions: ActionsModule;\n createDocument: (state?: any) => PHDocument;\n jsonSpec: DocumentModelGlobalState;\n};\n\nconst SPECS: Record<string, SpecEntry> = {\n [documentModelDocumentType]: {\n documentType: documentModelDocumentType,\n subdir: \"document-models\",\n reducer: documentModelDocumentModelModule.reducer,\n utils: documentModelDocumentModelModule.utils,\n actions: documentModelDocumentModelModule.actions as ActionsModule,\n createDocument: documentModelDocumentModelModule.utils.createDocument,\n jsonSpec: documentModelDocumentModelModule.documentModel\n .global as DocumentModelGlobalState,\n },\n [documentEditorDocumentType]: {\n documentType: documentEditorDocumentType,\n subdir: \"editors\",\n reducer: documentEditorReducer as Reducer<any>,\n utils: documentEditorUtils,\n actions: documentEditorActions as unknown as ActionsModule,\n createDocument: createDocumentEditorDocument as (state?: any) => PHDocument,\n jsonSpec: documentEditorSpec as unknown as DocumentModelGlobalState,\n },\n [processorModuleDocumentType]: {\n documentType: processorModuleDocumentType,\n subdir: \"processors\",\n reducer: processorModuleReducer as Reducer<any>,\n utils: processorModuleUtils,\n actions: processorModuleActions as unknown as ActionsModule,\n createDocument: createProcessorModuleDocument as (\n state?: any,\n ) => PHDocument,\n jsonSpec: processorModuleSpec as unknown as DocumentModelGlobalState,\n },\n [subgraphModuleDocumentType]: {\n documentType: subgraphModuleDocumentType,\n subdir: \"subgraphs\",\n reducer: subgraphModuleReducer as Reducer<any>,\n utils: subgraphModuleUtils,\n actions: subgraphModuleActions as unknown as ActionsModule,\n createDocument: createSubgraphModuleDocument as (state?: any) => PHDocument,\n jsonSpec: subgraphModuleSpec as unknown as DocumentModelGlobalState,\n },\n [appModuleDocumentType]: {\n documentType: appModuleDocumentType,\n subdir: \"apps\",\n reducer: appModuleReducer as Reducer<any>,\n utils: appModuleUtils,\n actions: appModuleActions as unknown as ActionsModule,\n createDocument: createAppModuleDocument as (state?: any) => PHDocument,\n jsonSpec: appModuleSpec as unknown as DocumentModelGlobalState,\n },\n};\n\nexport function getSpecEntry(documentType: string): SpecEntry {\n const entry = SPECS[documentType];\n if (!entry) {\n throw new Error(`No spec handler registered for \"${documentType}\"`);\n }\n return entry;\n}\n\nexport function listSpecDocumentTypes(): string[] {\n return Object.keys(SPECS);\n}\n\n/** Returns the directory that holds specs for a given document type. */\nexport function specDir(projectDir: string, documentType: string): string {\n return join(projectDir, SPECS_DIRNAME, getSpecEntry(documentType).subdir);\n}\n\n/**\n * Deterministic path for a doc-type + display name.\n * Format: `<projectDir>/<specsDir>/<subdir>/<kebab-name>.<ext>.phd`.\n */\nexport function specPath(\n projectDir: string,\n documentType: string,\n name: string,\n): string {\n const entry = getSpecEntry(documentType);\n const baseName = kebabCase(name);\n const ext = stripLeadingDot(entry.utils.fileExtension);\n return join(specDir(projectDir, documentType), `${baseName}.${ext}.phd`);\n}\n\n/* baseSaveToFile expects the extension WITHOUT a leading dot (\"phdm\"), while the\n * document-model utils export it WITH one (\".phdm\"). Normalize so we can pass\n * either through. */\nexport function stripLeadingDot(ext: string): string {\n return ext.startsWith(\".\") ? ext.slice(1) : ext;\n}\n\n/** Saves a document into `<projectDir>/specs/<subdir>/<kebab-name>.<ext>.phd`. */\nexport async function saveSpec(\n doc: PHDocument,\n projectDir: string,\n): Promise<string> {\n const entry = getSpecEntry(doc.header.documentType);\n const dir = specDir(projectDir, doc.header.documentType);\n await mkdir(dir, { recursive: true });\n const name = kebabCase(doc.header.name || \"untitled\");\n return baseSaveToFile(\n doc,\n dir,\n stripLeadingDot(entry.utils.fileExtension),\n name,\n );\n}\n","/**\n * File-backed mirror of reactor-mcp's tool surface. Same function names and\n * input shapes — same agent code works whether it's targeting a live reactor\n * or a `specs/` folder on disk. The \"drive id\" is the project directory;\n * \"document id\" is the file path of the spec.\n *\n * See `packages/reactor-mcp/src/tools/reactor.ts` for the canonical schema.\n */\nimport type {\n Action,\n DocumentModelGlobalState,\n OperationSpecification,\n PHDocument,\n} from \"@powerhousedao/shared/document-model\";\nimport { camelCase } from \"change-case\";\nimport { baseLoadFromFile } from \"document-model/node\";\nimport { readdir, rm, stat } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport {\n getSpecEntry,\n listSpecDocumentTypes,\n saveSpec,\n specDir,\n SPECS_DIRNAME,\n} from \"./specs.js\";\n\nexport type DocumentModelInfo = {\n name: string;\n type: string;\n description: string;\n extension: string;\n authorName: string;\n authorWebsite: string;\n};\n\n/** Mirrors reactor-mcp `getDocumentModels`. */\nexport function getDocumentModels(): DocumentModelInfo[] {\n return listSpecDocumentTypes().map((documentType) => {\n const { jsonSpec } = getSpecEntry(documentType);\n return {\n name: jsonSpec.name,\n type: jsonSpec.id,\n description: jsonSpec.description ?? \"\",\n extension: jsonSpec.extension ?? \"\",\n authorName: jsonSpec.author?.name ?? \"\",\n authorWebsite: jsonSpec.author?.website ?? \"\",\n };\n });\n}\n\n/** Mirrors reactor-mcp `getDocumentModelSchema`. Returns the full\n * `DocumentModelGlobalState` (schema + operations + errors), same payload\n * shape reactor-mcp serves. */\nexport function getDocumentModelSchema(\n documentType: string,\n): DocumentModelGlobalState {\n return getSpecEntry(documentType).jsonSpec;\n}\n\n/** Mirrors reactor-mcp `getDocument`. Path = file location on disk. */\nexport async function getDocument(path: string): Promise<PHDocument> {\n // We don't know the documentType ahead of time, so try each registered\n // reducer until one loads cleanly. baseLoadFromFile validates against the\n // reducer; the wrong reducer rejects. Try the path's parent directory first\n // as a fast hint (matches our `specs/<subdir>/` convention).\n const subdir = pathSubdir(path);\n const hint = subdir\n ? listSpecDocumentTypes().find((t) => getSpecEntry(t).subdir === subdir)\n : undefined;\n const order = hint\n ? [hint, ...listSpecDocumentTypes().filter((t) => t !== hint)]\n : listSpecDocumentTypes();\n\n let lastError: unknown;\n for (const documentType of order) {\n const { reducer } = getSpecEntry(documentType);\n try {\n return await baseLoadFromFile(path, reducer);\n } catch (err) {\n lastError = err;\n }\n }\n throw new Error(\n `Failed to load spec at \"${path}\": no registered reducer accepted it. Last error: ${String(lastError)}`,\n );\n}\n\n/** Mirrors reactor-mcp `getDocuments`. `parentId` is the project directory\n * containing `specs/`. */\nexport async function getDocuments(\n projectDir: string,\n opts: { documentType?: string } = {},\n): Promise<PHDocument[]> {\n const documentTypes = opts.documentType\n ? [opts.documentType]\n : listSpecDocumentTypes();\n\n const results: PHDocument[] = [];\n for (const documentType of documentTypes) {\n const dir = specDir(projectDir, documentType);\n const exists = await stat(dir).then(\n (s) => s.isDirectory(),\n () => false,\n );\n if (!exists) continue;\n const entries = await readdir(dir);\n for (const entry of entries) {\n if (!entry.endsWith(\".phd\")) continue;\n results.push(await getDocument(join(dir, entry)));\n }\n }\n return results;\n}\n\n/** Mirrors reactor-mcp `createDocument`. Returns an in-memory document; the\n * caller persists with `saveSpec`. */\nexport function createDocument(\n documentType: string,\n opts: {\n name?: string;\n initialState?: { global?: unknown; local?: unknown };\n } = {},\n): PHDocument {\n const entry = getSpecEntry(documentType);\n const doc = entry.createDocument(opts.initialState);\n if (opts.name) doc.header.name = opts.name;\n return doc;\n}\n\nexport type ActionInput = {\n type: string;\n input?: unknown;\n scope?: string;\n};\n\n/** Mirrors reactor-mcp `addActions`. Validates every action up front against\n * the document model's latest specification, then applies them in order via\n * the reducer. If any action is invalid, throws an aggregated error and\n * leaves `doc` untouched. */\nexport function addActions(\n doc: PHDocument,\n actions: ActionInput[],\n): PHDocument {\n const entry = getSpecEntry(doc.header.documentType);\n const built = validateAndBuildActions(entry, actions);\n let current = doc;\n for (let i = 0; i < built.length; i++) {\n const action = built[i];\n current = entry.reducer(current, action);\n /* The base reducer wraps custom reducers in try/catch and records any\n * throw as `operation.error` instead of propagating. For an atomic\n * batch apply that's the wrong shape — surface the error so callers\n * (and `saveSpec`) bail out before persisting a half-applied doc. */\n const scope = action.scope ?? \"global\";\n const ops = current.operations[scope];\n const last = ops?.[ops.length - 1];\n if (last?.error) {\n const failures: ActionValidationError[] = [\n {\n index: i,\n type: actions[i].type ?? \"<missing>\",\n errors: [`Reducer error: ${last.error}`],\n },\n ];\n throw formatValidationError(failures);\n }\n }\n return current;\n}\n\nexport type ActionValidationError = {\n /** Position in the input array. */\n index: number;\n /** The action's `type` field (or `<missing>` when not a string). */\n type: string;\n /** Human-readable reasons the action was rejected. */\n errors: string[];\n};\n\n/** Validate a list of actions without applying them. Returns one entry per\n * invalid action with all of its problems aggregated. Used by `addActions`\n * and exposed for callers that want a dry-run check. */\nexport function validateActions(\n documentType: string,\n actions: ActionInput[],\n): ActionValidationError[] {\n const entry = getSpecEntry(documentType);\n const failures: ActionValidationError[] = [];\n for (let i = 0; i < actions.length; i++) {\n const errors = collectActionErrors(entry, actions[i]);\n if (errors.length > 0) {\n failures.push({ index: i, type: actions[i].type ?? \"<missing>\", errors });\n }\n }\n return failures;\n}\n\n/** Run validateActions across the batch and, on success, materialize the\n * built Action objects. On any failure throws with every action's errors\n * aggregated — the caller never sees a partial apply. */\nfunction validateAndBuildActions(\n entry: ReturnType<typeof getSpecEntry>,\n actions: ActionInput[],\n): Action[] {\n const built: Action[] = [];\n const failures: ActionValidationError[] = [];\n for (let i = 0; i < actions.length; i++) {\n const item = actions[i];\n const errors = collectActionErrors(entry, item);\n if (errors.length > 0) {\n failures.push({ index: i, type: item.type ?? \"<missing>\", errors });\n continue;\n }\n built.push(buildAction(entry.actions, item));\n }\n if (failures.length > 0) throw formatValidationError(failures);\n return built;\n}\n\n/* Mirrors reactor-mcp's `validateDocumentModelAction`: confirms the operation\n * is declared in the latest spec, looks up the action creator, runs the\n * creator's own input validation, and checks scope. */\nfunction collectActionErrors(\n entry: ReturnType<typeof getSpecEntry>,\n item: ActionInput,\n): string[] {\n const errors: string[] = [];\n if (typeof item.type !== \"string\" || item.type.length === 0) {\n errors.push(\"Missing `type` field\");\n return errors;\n }\n const specs = entry.jsonSpec.specifications;\n if (!specs || specs.length === 0) {\n errors.push(\"Document model has no specifications\");\n return errors;\n }\n const latest = specs[specs.length - 1];\n let operation: OperationSpecification | undefined;\n for (const module of latest.modules ?? []) {\n const found = (module.operations ?? []).find((op) => op.name === item.type);\n if (found) {\n operation = found;\n break;\n }\n }\n if (!operation) {\n errors.push(\n `Operation \"${item.type}\" is not defined in any module of the document model`,\n );\n }\n const creatorName = camelCase(item.type);\n const creator = entry.actions[creatorName];\n if (!creator) {\n errors.push(`No action creator found.`);\n } else {\n try {\n creator(item.input);\n } catch (err) {\n errors.push(\n `Input validation error: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n if (operation?.scope && item.scope && item.scope !== operation.scope) {\n errors.push(\n `Scope \"${item.scope}\" does not match operation scope \"${operation.scope}\"`,\n );\n }\n return errors;\n}\n\nfunction formatValidationError(failures: ActionValidationError[]): Error {\n const lines = failures.map(\n (f) => ` [${f.index}] ${f.type}: ${f.errors.join(\"; \")}`,\n );\n const header =\n failures.length === 1\n ? \"1 action failed validation:\"\n : `${failures.length} actions failed validation:`;\n const err = new Error([header, ...lines].join(\"\\n\")) as Error & {\n failures: ActionValidationError[];\n };\n err.failures = failures;\n return err;\n}\n\nfunction buildAction(\n actionsModule: Record<string, (input?: any) => Action>,\n item: ActionInput,\n): Action {\n const creatorName = camelCase(item.type);\n const creator = actionsModule[creatorName];\n if (!creator) {\n throw new Error(\n `No action creator found for \"${item.type}\" (looked up as \"${creatorName}\")`,\n );\n }\n const action = creator(item.input);\n // Caller may override the scope (creator picks a default).\n if (item.scope) action.scope = item.scope;\n return action;\n}\n\n/** Mirrors reactor-mcp `deleteDocument`. Removes the spec file from disk. */\nexport async function deleteDocument(\n path: string,\n): Promise<{ success: boolean }> {\n try {\n await rm(path);\n return { success: true };\n } catch {\n return { success: false };\n }\n}\n\n/* Convenience: persist after applying actions. Matches the typical agent\n * loop `getDocument → addActions → saveSpec` from the plan. */\nexport async function addActionsAndSave(\n path: string,\n projectDir: string,\n actions: ActionInput[],\n): Promise<{ doc: PHDocument; savedPath: string }> {\n const doc = await getDocument(path);\n const next = addActions(doc, actions);\n const savedPath = await saveSpec(next, projectDir);\n return { doc: next, savedPath };\n}\n\nfunction pathSubdir(filePath: string): string | undefined {\n const parts = filePath.split(/[/\\\\]/);\n const i = parts.lastIndexOf(SPECS_DIRNAME);\n if (i < 0 || i + 1 >= parts.length) return undefined;\n return parts[i + 1];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIgDA,MAAa,gBAAgB;AAE7B,MAAM,4BAA4B;AAclC,MAAM,QAAmC;EACtC,4BAA4B;EAC3B,cAAc;EACd,QAAQ;EACR,SAAS,iCAAiC;EAC1C,OAAO,iCAAiC;EACxC,SAAS,iCAAiC;EAC1C,gBAAgB,iCAAiC,MAAM;EACvD,UAAU,iCAAiC,cACxC;EACJ;EACA,6BAA6B;EAC5B,cAAc;EACd,QAAQ;EACR,SAASA;EACT,OAAOC;EACP,SAASC;EACT,gBAAgB;EAChB,UAAUC;EACX;EACA,8BAA8B;EAC7B,cAAc;EACd,QAAQ;EACR,SAASC;EACT,OAAOC;EACP,SAASC;EACT,gBAAgB;EAGhB,UAAUC;EACX;EACA,6BA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,CAAC,KAAK,KAAK,CAAC;AAGpD,KAAI,WAAW;AACf,QAAO;;AAGT,SAAS,YACP,eACA,MACQ;CACR,MAAM,cAAc,UAAU,KAAK,KAAK;CACxC,MAAM,UAAU,cAAc;AAC9B,KAAI,CAAC,QACH,OAAM,IAAI,MACR,gCAAgC,KAAK,KAAK,mBAAmB,YAAY,IAC1E;CAEH,MAAM,SAAS,QAAQ,KAAK,MAAM;AAElC,KAAI,KAAK,MAAO,QAAO,QAAQ,KAAK;AACpC,QAAO;;;AAIT,eAAsB,eACpB,MAC+B;AAC/B,KAAI;AACF,QAAM,GAAG,KAAK;AACd,SAAO,EAAE,SAAS,MAAM;SAClB;AACN,SAAO,EAAE,SAAS,OAAO;;;AAM7B,eAAsB,kBACpB,MACA,YACA,SACiD;CAEjD,MAAM,OAAO,WADD,MAAM,YAAY,KAAK,EACN,QAAQ;AAErC,QAAO;EAAE,KAAK;EAAM,WADF,MAAM,SAAS,MAAM,WAAW;EACnB;;AAGjC,SAAS,WAAW,UAAsC;CACxD,MAAM,QAAQ,SAAS,MAAM,QAAQ;CACrC,MAAM,IAAI,MAAM,YAAY,cAAc;AAC1C,KAAI,IAAI,KAAK,IAAI,KAAK,MAAM,OAAQ,QAAO,KAAA;AAC3C,QAAO,MAAM,IAAI"}
@@ -0,0 +1,90 @@
1
+ import { Action, DocumentModelGlobalState, PHDocument, Reducer } from "@powerhousedao/shared/document-model";
2
+
3
+ //#region codegen/spec-api.d.ts
4
+ type DocumentModelInfo = {
5
+ name: string;
6
+ type: string;
7
+ description: string;
8
+ extension: string;
9
+ authorName: string;
10
+ authorWebsite: string;
11
+ };
12
+ /** Mirrors reactor-mcp `getDocumentModels`. */
13
+ declare function getDocumentModels(): DocumentModelInfo[];
14
+ /** Mirrors reactor-mcp `getDocumentModelSchema`. Returns the full
15
+ * `DocumentModelGlobalState` (schema + operations + errors), same payload
16
+ * shape reactor-mcp serves. */
17
+ declare function getDocumentModelSchema(documentType: string): DocumentModelGlobalState;
18
+ /** Mirrors reactor-mcp `getDocument`. Path = file location on disk. */
19
+ declare function getDocument(path: string): Promise<PHDocument>;
20
+ /** Mirrors reactor-mcp `getDocuments`. `parentId` is the project directory
21
+ * containing `specs/`. */
22
+ declare function getDocuments(projectDir: string, opts?: {
23
+ documentType?: string;
24
+ }): Promise<PHDocument[]>;
25
+ /** Mirrors reactor-mcp `createDocument`. Returns an in-memory document; the
26
+ * caller persists with `saveSpec`. */
27
+ declare function createDocument(documentType: string, opts?: {
28
+ name?: string;
29
+ initialState?: {
30
+ global?: unknown;
31
+ local?: unknown;
32
+ };
33
+ }): PHDocument;
34
+ type ActionInput = {
35
+ type: string;
36
+ input?: unknown;
37
+ scope?: string;
38
+ };
39
+ /** Mirrors reactor-mcp `addActions`. Validates every action up front against
40
+ * the document model's latest specification, then applies them in order via
41
+ * the reducer. If any action is invalid, throws an aggregated error and
42
+ * leaves `doc` untouched. */
43
+ declare function addActions(doc: PHDocument, actions: ActionInput[]): PHDocument;
44
+ type ActionValidationError = {
45
+ /** Position in the input array. */index: number; /** The action's `type` field (or `<missing>` when not a string). */
46
+ type: string; /** Human-readable reasons the action was rejected. */
47
+ errors: string[];
48
+ };
49
+ /** Validate a list of actions without applying them. Returns one entry per
50
+ * invalid action with all of its problems aggregated. Used by `addActions`
51
+ * and exposed for callers that want a dry-run check. */
52
+ declare function validateActions(documentType: string, actions: ActionInput[]): ActionValidationError[];
53
+ /** Mirrors reactor-mcp `deleteDocument`. Removes the spec file from disk. */
54
+ declare function deleteDocument(path: string): Promise<{
55
+ success: boolean;
56
+ }>;
57
+ declare function addActionsAndSave(path: string, projectDir: string, actions: ActionInput[]): Promise<{
58
+ doc: PHDocument;
59
+ savedPath: string;
60
+ }>;
61
+ //#endregion
62
+ //#region codegen/specs.d.ts
63
+ declare const SPECS_DIRNAME = "specs";
64
+ type ActionsModule = Record<string, (input?: any) => Action>;
65
+ type SpecEntry = {
66
+ documentType: string;
67
+ subdir: string;
68
+ reducer: Reducer<any>;
69
+ utils: {
70
+ fileExtension: string;
71
+ };
72
+ actions: ActionsModule;
73
+ createDocument: (state?: any) => PHDocument;
74
+ jsonSpec: DocumentModelGlobalState;
75
+ };
76
+ declare function getSpecEntry(documentType: string): SpecEntry;
77
+ declare function listSpecDocumentTypes(): string[];
78
+ /** Returns the directory that holds specs for a given document type. */
79
+ declare function specDir(projectDir: string, documentType: string): string;
80
+ /**
81
+ * Deterministic path for a doc-type + display name.
82
+ * Format: `<projectDir>/<specsDir>/<subdir>/<kebab-name>.<ext>.phd`.
83
+ */
84
+ declare function specPath(projectDir: string, documentType: string, name: string): string;
85
+ declare function stripLeadingDot(ext: string): string;
86
+ /** Saves a document into `<projectDir>/specs/<subdir>/<kebab-name>.<ext>.phd`. */
87
+ declare function saveSpec(doc: PHDocument, projectDir: string): Promise<string>;
88
+ //#endregion
89
+ export { getDocumentModels as _, specDir as a, ActionInput as c, addActions as d, addActionsAndSave as f, getDocumentModelSchema as g, getDocument as h, saveSpec as i, ActionValidationError as l, deleteDocument as m, getSpecEntry as n, specPath as o, createDocument as p, listSpecDocumentTypes as r, stripLeadingDot as s, SPECS_DIRNAME as t, DocumentModelInfo as u, getDocuments as v, validateActions as y };
90
+ //# sourceMappingURL=specs-_7A7Tl_N.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specs-_7A7Tl_N.d.ts","names":[],"sources":["../codegen/spec-api.ts","../codegen/specs.ts"],"mappings":";;;KA2BY,iBAAA;EACV,IAAA;EACA,IAAA;EACA,WAAA;EACA,SAAA;EACA,UAAA;EACA,aAAA;AAAA;;iBAIc,iBAAA,CAAA,GAAqB,iBAAA;;AAiBrC;;iBAAgB,sBAAA,CACd,YAAA,WACC,wBAAA;;iBAKmB,WAAA,CAAY,IAAA,WAAe,OAAA,CAAQ,UAAA;AAAzD;;AAAA,iBA6BsB,YAAA,CACpB,UAAA,UACA,IAAA;EAAQ,YAAA;AAAA,IACP,OAAA,CAAQ,UAAA;;;iBAwBK,cAAA,CACd,YAAA,UACA,IAAA;EACE,IAAA;EACA,YAAA;IAAiB,MAAA;IAAkB,KAAA;EAAA;AAAA,IAEpC,UAAA;AAAA,KAOS,WAAA;EACV,IAAA;EACA,KAAA;EACA,KAAA;AAAA;;AAhBF;;;iBAuBgB,UAAA,CACd,GAAA,EAAK,UAAA,EACL,OAAA,EAAS,WAAA,KACR,UAAA;AAAA,KA4BS,qBAAA;EAnDR,mCAqDF,KAAA,UApDmB;EAsDnB,IAAA,UAxDA;EA0DA,MAAA;AAAA;;AA/CF;;iBAqDgB,eAAA,CACd,YAAA,UACA,OAAA,EAAS,WAAA,KACR,qBAAA;;iBAuHmB,cAAA,CACpB,IAAA,WACC,OAAA;EAAU,OAAA;AAAA;AAAA,iBAWS,iBAAA,CACpB,IAAA,UACA,UAAA,UACA,OAAA,EAAS,WAAA,KACR,OAAA;EAAU,GAAA,EAAK,UAAA;EAAY,SAAA;AAAA;;;cClRjB,aAAA;AAAA,KAIR,aAAA,GAAgB,MAAA,UAAgB,KAAA,WAAgB,MAAA;AAAA,KAEhD,SAAA;EACH,YAAA;EACA,MAAA;EACA,OAAA,EAAS,OAAA;EACT,KAAA;IAAS,aAAA;EAAA;EACT,OAAA,EAAS,aAAA;EACT,cAAA,GAAiB,KAAA,WAAgB,UAAA;EACjC,QAAA,EAAU,wBAAA;AAAA;AAAA,iBAsDI,YAAA,CAAa,YAAA,WAAuB,SAAA;AAAA,iBAQpC,qBAAA,CAAA;;iBAKA,OAAA,CAAQ,UAAA,UAAoB,YAAA;;;AD1E5C;;iBCkFgB,QAAA,CACd,UAAA,UACA,YAAA,UACA,IAAA;AAAA,iBAWc,eAAA,CAAgB,GAAA;;iBAKV,QAAA,CACpB,GAAA,EAAK,UAAA,EACL,UAAA,WACC,OAAA"}
@@ -0,0 +1,8 @@
1
+ import { t as codegenFactoryBuilder } from "./factory-B6hBnFAf.js";
2
+ import { t as vetraReadModelFactoryBuilder } from "./factory-Cn0UwIFB.js";
3
+ //#region processors/switchboard.ts
4
+ const processorFactoryBuilders = [vetraReadModelFactoryBuilder, codegenFactoryBuilder];
5
+ //#endregion
6
+ export { processorFactoryBuilders };
7
+
8
+ //# sourceMappingURL=switchboard-CvWiUgBP.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"switchboard-C_BapCdk.js","names":[],"sources":["../processors/switchboard.ts"],"sourcesContent":["/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { ProcessorFactoryBuilder } from \"@powerhousedao/reactor-browser\";\nimport { codegenFactoryBuilder } from \"./codegen/factory.js\";\nimport { vetraReadModelFactoryBuilder } from \"./vetra-read-model/factory.js\";\n\nexport const processorFactoryBuilders: ProcessorFactoryBuilder[] = [\n vetraReadModelFactoryBuilder,\n codegenFactoryBuilder,\n];\n"],"mappings":";;;AAQA,MAAa,2BAAsD,CACjE,8BACA,sBACD"}
1
+ {"version":3,"file":"switchboard-CvWiUgBP.js","names":[],"sources":["../processors/switchboard.ts"],"sourcesContent":["/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { ProcessorFactoryBuilder } from \"@powerhousedao/reactor-browser\";\nimport { codegenFactoryBuilder } from \"./codegen/factory.js\";\nimport { vetraReadModelFactoryBuilder } from \"./vetra-read-model/factory.js\";\n\nexport const processorFactoryBuilders: ProcessorFactoryBuilder[] = [\n vetraReadModelFactoryBuilder,\n codegenFactoryBuilder,\n];\n"],"mappings":";;;AAQA,MAAa,2BAAsD,CACjE,8BACA,sBACD"}
@@ -27,4 +27,4 @@ function useSelectedDriveVetraPackage() {
27
27
  //#endregion
28
28
  export { useSelectedProcessorModuleDocument as n, useSelectedSubgraphModuleDocument as r, useSelectedDriveVetraPackage as t };
29
29
 
30
- //# sourceMappingURL=useVetraDocument-tpjMF571.js.map
30
+ //# sourceMappingURL=useVetraDocument-BpPD6DKR.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useVetraDocument-tpjMF571.js","names":[],"sources":["../editors/hooks/useVetraDocument.ts"],"sourcesContent":["import {\n useDocumentOfType,\n useSelectedDocumentId,\n useSelectedDocumentOfType,\n useSelectedDrive,\n} from \"@powerhousedao/reactor-browser\";\nimport { isFileNode } from \"@powerhousedao/shared/document-drive\";\nimport type {\n AppModuleAction,\n AppModuleDocument,\n} from \"../../document-models/app-module/index.js\";\nimport {\n type DocumentEditorAction,\n type DocumentEditorDocument,\n} from \"../../document-models/document-editor/index.js\";\nimport type {\n ProcessorModuleAction,\n ProcessorModuleDocument,\n} from \"../../document-models/processor-module/index.js\";\nimport type {\n SubgraphModuleAction,\n SubgraphModuleDocument,\n} from \"../../document-models/subgraph-module/index.js\";\nimport type {\n VetraPackageAction,\n VetraPackageDocument,\n} from \"../../document-models/vetra-package/index.js\";\n\nconst VETRA_PACKAGE_DOCUMENT_TYPE = \"powerhouse/package\";\nconst DOCUMENT_EDITOR_DOCUMENT_TYPE = \"powerhouse/document-editor\";\nconst SUBGRAPH_MODULE_DOCUMENT_TYPE = \"powerhouse/subgraph\";\nconst PROCESSOR_MODULE_DOCUMENT_TYPE = \"powerhouse/processor\";\n\nexport function useAppModuleDocument(documentId: string | undefined | null) {\n return useDocumentOfType<AppModuleDocument, AppModuleAction>(\n documentId,\n \"powerhouse/app\",\n );\n}\n\nexport function useSelectedAppModuleDocument() {\n const documentId = useSelectedDocumentId();\n return useAppModuleDocument(documentId);\n}\n\nexport function useDocumentEditorDocument(\n documentId: string | undefined | null,\n) {\n return useDocumentOfType<DocumentEditorDocument, DocumentEditorAction>(\n documentId,\n DOCUMENT_EDITOR_DOCUMENT_TYPE,\n );\n}\n\nexport function useSelectedDocumentEditorDocument() {\n const documentId = useSelectedDocumentId();\n return useDocumentEditorDocument(documentId);\n}\n\nexport function useProcessorModuleDocument(\n documentId: string | undefined | null,\n) {\n return useDocumentOfType<ProcessorModuleDocument, ProcessorModuleAction>(\n documentId,\n PROCESSOR_MODULE_DOCUMENT_TYPE,\n );\n}\n\nexport function useSelectedProcessorModuleDocument() {\n const documentId = useSelectedDocumentId();\n return useProcessorModuleDocument(documentId);\n}\n\nexport function useSubgraphModuleDocument(\n documentId: string | undefined | null,\n) {\n return useDocumentOfType<SubgraphModuleDocument, SubgraphModuleAction>(\n documentId,\n SUBGRAPH_MODULE_DOCUMENT_TYPE,\n );\n}\n\nexport function useSelectedSubgraphModuleDocument() {\n const documentId = useSelectedDocumentId();\n return useSubgraphModuleDocument(documentId);\n}\n\nexport function useVetraPackageDocument(documentId: string | undefined | null) {\n return useDocumentOfType<VetraPackageDocument, VetraPackageAction>(\n documentId,\n VETRA_PACKAGE_DOCUMENT_TYPE,\n );\n}\n\nexport function useSelectedVetraPackageDocument() {\n return useSelectedDocumentOfType<VetraPackageDocument, VetraPackageAction>(\n VETRA_PACKAGE_DOCUMENT_TYPE,\n );\n}\n\nexport function useSelectedDriveVetraPackage() {\n const [selectedDrive] = useSelectedDrive();\n const documentId = selectedDrive.state.global.nodes.find(\n (node) =>\n isFileNode(node) && node.documentType === VETRA_PACKAGE_DOCUMENT_TYPE,\n )?.id;\n\n return useVetraPackageDocument(documentId);\n}\n"],"mappings":";;;AA4BA,MAAM,8BAA8B;AAEpC,MAAM,gCAAgC;AACtC,MAAM,iCAAiC;AA4BvC,SAAgB,2BACd,YACA;AACA,QAAO,kBACL,YACA,+BACD;;AAGH,SAAgB,qCAAqC;AAEnD,QAAO,2BADY,uBAAuB,CACG;;AAG/C,SAAgB,0BACd,YACA;AACA,QAAO,kBACL,YACA,8BACD;;AAGH,SAAgB,oCAAoC;AAElD,QAAO,0BADY,uBAAuB,CACE;;AAG9C,SAAgB,wBAAwB,YAAuC;AAC7E,QAAO,kBACL,YACA,4BACD;;AASH,SAAgB,+BAA+B;CAC7C,MAAM,CAAC,iBAAiB,kBAAkB;CAC1C,MAAM,aAAa,cAAc,MAAM,OAAO,MAAM,MACjD,SACC,WAAW,KAAK,IAAI,KAAK,iBAAiB,4BAC7C,EAAE;AAEH,QAAO,wBAAwB,WAAW"}
1
+ {"version":3,"file":"useVetraDocument-BpPD6DKR.js","names":[],"sources":["../editors/hooks/useVetraDocument.ts"],"sourcesContent":["import {\n useDocumentOfType,\n useSelectedDocumentId,\n useSelectedDocumentOfType,\n useSelectedDrive,\n} from \"@powerhousedao/reactor-browser\";\nimport { isFileNode } from \"@powerhousedao/shared/document-drive\";\nimport type {\n AppModuleAction,\n AppModuleDocument,\n} from \"../../document-models/app-module/index.js\";\nimport {\n type DocumentEditorAction,\n type DocumentEditorDocument,\n} from \"../../document-models/document-editor/index.js\";\nimport type {\n ProcessorModuleAction,\n ProcessorModuleDocument,\n} from \"../../document-models/processor-module/index.js\";\nimport type {\n SubgraphModuleAction,\n SubgraphModuleDocument,\n} from \"../../document-models/subgraph-module/index.js\";\nimport type {\n VetraPackageAction,\n VetraPackageDocument,\n} from \"../../document-models/vetra-package/index.js\";\n\nconst VETRA_PACKAGE_DOCUMENT_TYPE = \"powerhouse/package\";\nconst DOCUMENT_EDITOR_DOCUMENT_TYPE = \"powerhouse/document-editor\";\nconst SUBGRAPH_MODULE_DOCUMENT_TYPE = \"powerhouse/subgraph\";\nconst PROCESSOR_MODULE_DOCUMENT_TYPE = \"powerhouse/processor\";\n\nexport function useAppModuleDocument(documentId: string | undefined | null) {\n return useDocumentOfType<AppModuleDocument, AppModuleAction>(\n documentId,\n \"powerhouse/app\",\n );\n}\n\nexport function useSelectedAppModuleDocument() {\n const documentId = useSelectedDocumentId();\n return useAppModuleDocument(documentId);\n}\n\nexport function useDocumentEditorDocument(\n documentId: string | undefined | null,\n) {\n return useDocumentOfType<DocumentEditorDocument, DocumentEditorAction>(\n documentId,\n DOCUMENT_EDITOR_DOCUMENT_TYPE,\n );\n}\n\nexport function useSelectedDocumentEditorDocument() {\n const documentId = useSelectedDocumentId();\n return useDocumentEditorDocument(documentId);\n}\n\nexport function useProcessorModuleDocument(\n documentId: string | undefined | null,\n) {\n return useDocumentOfType<ProcessorModuleDocument, ProcessorModuleAction>(\n documentId,\n PROCESSOR_MODULE_DOCUMENT_TYPE,\n );\n}\n\nexport function useSelectedProcessorModuleDocument() {\n const documentId = useSelectedDocumentId();\n return useProcessorModuleDocument(documentId);\n}\n\nexport function useSubgraphModuleDocument(\n documentId: string | undefined | null,\n) {\n return useDocumentOfType<SubgraphModuleDocument, SubgraphModuleAction>(\n documentId,\n SUBGRAPH_MODULE_DOCUMENT_TYPE,\n );\n}\n\nexport function useSelectedSubgraphModuleDocument() {\n const documentId = useSelectedDocumentId();\n return useSubgraphModuleDocument(documentId);\n}\n\nexport function useVetraPackageDocument(documentId: string | undefined | null) {\n return useDocumentOfType<VetraPackageDocument, VetraPackageAction>(\n documentId,\n VETRA_PACKAGE_DOCUMENT_TYPE,\n );\n}\n\nexport function useSelectedVetraPackageDocument() {\n return useSelectedDocumentOfType<VetraPackageDocument, VetraPackageAction>(\n VETRA_PACKAGE_DOCUMENT_TYPE,\n );\n}\n\nexport function useSelectedDriveVetraPackage() {\n const [selectedDrive] = useSelectedDrive();\n const documentId = selectedDrive.state.global.nodes.find(\n (node) =>\n isFileNode(node) && node.documentType === VETRA_PACKAGE_DOCUMENT_TYPE,\n )?.id;\n\n return useVetraPackageDocument(documentId);\n}\n"],"mappings":";;;AA4BA,MAAM,8BAA8B;AAEpC,MAAM,gCAAgC;AACtC,MAAM,iCAAiC;AA4BvC,SAAgB,2BACd,YACA;AACA,QAAO,kBACL,YACA,+BACD;;AAGH,SAAgB,qCAAqC;AAEnD,QAAO,2BADY,uBAAuB,CACG;;AAG/C,SAAgB,0BACd,YACA;AACA,QAAO,kBACL,YACA,8BACD;;AAGH,SAAgB,oCAAoC;AAElD,QAAO,0BADY,uBAAuB,CACE;;AAG9C,SAAgB,wBAAwB,YAAuC;AAC7E,QAAO,kBACL,YACA,4BACD;;AASH,SAAgB,+BAA+B;CAC7C,MAAM,CAAC,iBAAiB,kBAAkB;CAC1C,MAAM,aAAa,cAAc,MAAM,OAAO,MAAM,MACjD,SACC,WAAW,KAAK,IAAI,KAAK,iBAAiB,4BAC7C,EAAE;AAEH,QAAO,wBAAwB,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils-B4KdjDnp.js","names":["z","appModuleBaseOperationsActions","appModuleDndOperationsActions"],"sources":["../document-models/app-module/v1/gen/schema/zod.ts","../document-models/app-module/v1/gen/base-operations/creators.ts","../document-models/app-module/v1/gen/dnd-operations/creators.ts","../document-models/app-module/v1/actions.ts","../document-models/app-module/v1/src/reducers/base-operations.ts","../document-models/app-module/v1/src/reducers/dnd-operations.ts","../document-models/app-module/v1/gen/reducer.ts","../document-models/app-module/v1/gen/document-type.ts","../document-models/app-module/v1/gen/document-schema.ts","../document-models/app-module/v1/gen/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddDocumentTypeInput,\n AppModuleState,\n RemoveDocumentTypeInput,\n SetAppNameInput,\n SetAppStatusInput,\n SetDocumentTypesInput,\n SetDragAndDropEnabledInput,\n StatusType,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const StatusTypeSchema = z.enum([\"CONFIRMED\", \"DRAFT\"]);\n\nexport function AddDocumentTypeInputSchema(): z.ZodObject<\n Properties<AddDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n });\n}\n\nexport function AppModuleStateSchema(): z.ZodObject<\n Properties<AppModuleState>\n> {\n return z.object({\n __typename: z.literal(\"AppModuleState\").optional(),\n allowedDocumentTypes: z.array(z.string()).nullish(),\n isDragAndDropEnabled: z.boolean(),\n name: z.string(),\n status: StatusTypeSchema,\n });\n}\n\nexport function RemoveDocumentTypeInputSchema(): z.ZodObject<\n Properties<RemoveDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n });\n}\n\nexport function SetAppNameInputSchema(): z.ZodObject<\n Properties<SetAppNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetAppStatusInputSchema(): z.ZodObject<\n Properties<SetAppStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n\nexport function SetDocumentTypesInputSchema(): z.ZodObject<\n Properties<SetDocumentTypesInput>\n> {\n return z.object({\n documentTypes: z.array(z.string()),\n });\n}\n\nexport function SetDragAndDropEnabledInputSchema(): z.ZodObject<\n Properties<SetDragAndDropEnabledInput>\n> {\n return z.object({\n enabled: z.boolean(),\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetAppNameInputSchema,\n SetAppStatusInputSchema,\n SetDocumentTypesInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddDocumentTypeInput,\n RemoveDocumentTypeInput,\n SetAppNameInput,\n SetAppStatusInput,\n SetDocumentTypesInput,\n} from \"../types.js\";\nimport type {\n AddDocumentTypeAction,\n RemoveDocumentTypeAction,\n SetAppNameAction,\n SetAppStatusAction,\n SetDocumentTypesAction,\n} from \"./actions.js\";\n\nexport const setAppName = (input: SetAppNameInput) =>\n createAction<SetAppNameAction>(\n \"SET_APP_NAME\",\n { ...input },\n undefined,\n SetAppNameInputSchema,\n \"global\",\n );\n\nexport const setAppStatus = (input: SetAppStatusInput) =>\n createAction<SetAppStatusAction>(\n \"SET_APP_STATUS\",\n { ...input },\n undefined,\n SetAppStatusInputSchema,\n \"global\",\n );\n\nexport const addDocumentType = (input: AddDocumentTypeInput) =>\n createAction<AddDocumentTypeAction>(\n \"ADD_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n AddDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const removeDocumentType = (input: RemoveDocumentTypeInput) =>\n createAction<RemoveDocumentTypeAction>(\n \"REMOVE_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n RemoveDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const setDocumentTypes = (input: SetDocumentTypesInput) =>\n createAction<SetDocumentTypesAction>(\n \"SET_DOCUMENT_TYPES\",\n { ...input },\n undefined,\n SetDocumentTypesInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { SetDragAndDropEnabledInputSchema } from \"../schema/zod.js\";\nimport type { SetDragAndDropEnabledInput } from \"../types.js\";\nimport type { SetDragAndDropEnabledAction } from \"./actions.js\";\n\nexport const setDragAndDropEnabled = (input: SetDragAndDropEnabledInput) =>\n createAction<SetDragAndDropEnabledAction>(\n \"SET_DRAG_AND_DROP_ENABLED\",\n { ...input },\n undefined,\n SetDragAndDropEnabledInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport {\n appModuleBaseOperationsActions,\n appModuleDndOperationsActions,\n} from \"./gen/creators.js\";\n\n/** Actions for the AppModule document model */\n\nexport const actions = {\n ...baseActions,\n ...appModuleBaseOperationsActions,\n ...appModuleDndOperationsActions,\n};\n","import type { AppModuleBaseOperationsOperations } from \"document-models/app-module/v1\";\n\nexport const appModuleBaseOperationsOperations: AppModuleBaseOperationsOperations =\n {\n setAppNameOperation(state, action, _dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"App name cannot be empty\");\n }\n state.name = trimmedName;\n },\n setAppStatusOperation(state, action, _dispatch) {\n state.status = action.input.status;\n },\n addDocumentTypeOperation(state, action, _dispatch) {\n const existingAllowedDocumentTypes = state.allowedDocumentTypes ?? [];\n const newDocumentType = action.input.documentType;\n const newAllowedDocumentTypesSet = new Set(\n existingAllowedDocumentTypes,\n ).add(newDocumentType);\n const newAllowedDocumentTypes = [...newAllowedDocumentTypesSet];\n state.allowedDocumentTypes = newAllowedDocumentTypes;\n },\n removeDocumentTypeOperation(state, action, _dispatch) {\n const existingAllowedDocumentTypes = state.allowedDocumentTypes;\n const documentTypeToRemove = action.input.documentType;\n const newAllowedDocumentTypes = existingAllowedDocumentTypes?.filter(\n (dt) => dt !== documentTypeToRemove,\n );\n state.allowedDocumentTypes = newAllowedDocumentTypes ?? [];\n },\n setDocumentTypesOperation(state, action, _dispatch) {\n state.allowedDocumentTypes = action.input.documentTypes;\n },\n };\n","import type { AppModuleDndOperationsOperations } from \"document-models/app-module/v1\";\n\nexport const appModuleDndOperationsOperations: AppModuleDndOperationsOperations =\n {\n setDragAndDropEnabledOperation(state, action, _dispatch) {\n state.isDragAndDropEnabled = action.input.enabled;\n },\n };\n","import type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { AppModulePHState } from \"document-models/app-module/v1\";\n\nimport { appModuleBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\nimport { appModuleDndOperationsOperations } from \"../src/reducers/dnd-operations.js\";\n\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetAppNameInputSchema,\n SetAppStatusInputSchema,\n SetDocumentTypesInputSchema,\n SetDragAndDropEnabledInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<AppModulePHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_APP_NAME\": {\n SetAppNameInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.setAppNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_APP_STATUS\": {\n SetAppStatusInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.setAppStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_DOCUMENT_TYPE\": {\n AddDocumentTypeInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.addDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_DOCUMENT_TYPE\": {\n RemoveDocumentTypeInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.removeDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_DOCUMENT_TYPES\": {\n SetDocumentTypesInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.setDocumentTypesOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_DRAG_AND_DROP_ENABLED\": {\n SetDragAndDropEnabledInputSchema().parse(action.input);\n\n appModuleDndOperationsOperations.setDragAndDropEnabledOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<AppModulePHState> = createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const appModuleDocumentType = \"powerhouse/app\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { appModuleDocumentType } from \"./document-type.js\";\nimport { AppModuleStateSchema } from \"./schema/zod.js\";\nimport type { AppModuleDocument, AppModulePHState } from \"./types.js\";\n\n/** Schema for validating the header object of a AppModule document */\nexport const AppModuleDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({\n documentType: z.literal(appModuleDocumentType),\n});\n\n/** Schema for validating the state object of a AppModule document */\nexport const AppModulePHStateSchema = BaseDocumentStateSchema.extend({\n global: AppModuleStateSchema(),\n});\n\nexport const AppModuleDocumentSchema = z.object({\n header: AppModuleDocumentHeaderSchema,\n state: AppModulePHStateSchema,\n initialState: AppModulePHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a AppModule document state object */\nexport function isAppModuleState(state: unknown): state is AppModulePHState {\n return AppModulePHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a AppModule document state object */\nexport function assertIsAppModuleState(\n state: unknown,\n): asserts state is AppModulePHState {\n AppModulePHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a AppModule document */\nexport function isAppModuleDocument(\n document: unknown,\n): document is AppModuleDocument {\n return AppModuleDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a AppModule document */\nexport function assertIsAppModuleDocument(\n document: unknown,\n): asserts document is AppModuleDocument {\n AppModuleDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInput,\n baseSaveToFileHandle,\n defaultBaseState,\n} from \"document-model\";\nimport {\n assertIsAppModuleDocument,\n assertIsAppModuleState,\n isAppModuleDocument,\n isAppModuleState,\n} from \"./document-schema.js\";\nimport { appModuleDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n AppModuleGlobalState,\n AppModuleLocalState,\n AppModulePHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: AppModuleGlobalState = {\n name: \"\",\n status: \"DRAFT\",\n allowedDocumentTypes: null,\n isDragAndDropEnabled: true,\n};\nexport const initialLocalState: AppModuleLocalState = {};\n\nexport const utils: DocumentModelUtils<AppModulePHState> = {\n fileExtension: \".app\",\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(utils.createState, state, appModuleDocumentType);\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInput(input, reducer);\n },\n isStateOfType(state) {\n return isAppModuleState(state);\n },\n assertIsStateOfType(state) {\n return assertIsAppModuleState(state);\n },\n isDocumentOfType(document) {\n return isAppModuleDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsAppModuleDocument(document);\n },\n};\n"],"mappings":";;;;;AAoBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO,EACd,cAAcA,IAAE,QAAQ,EACzB,CAAC;;AAGJ,SAAgB,uBAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,iBAAiB,CAAC,UAAU;EAClD,sBAAsBA,IAAE,MAAMA,IAAE,QAAQ,CAAC,CAAC,SAAS;EACnD,sBAAsBA,IAAE,SAAS;EACjC,MAAMA,IAAE,QAAQ;EAChB,QAAQ;EACT,CAAC;;AAGJ,SAAgB,gCAEd;AACA,QAAOA,IAAE,OAAO,EACd,cAAcA,IAAE,QAAQ,EACzB,CAAC;;AAGJ,SAAgB,wBAEd;AACA,QAAOA,IAAE,OAAO,EACd,MAAMA,IAAE,QAAQ,EACjB,CAAC;;AAGJ,SAAgB,0BAEd;AACA,QAAOA,IAAE,OAAO,EACd,QAAQ,kBACT,CAAC;;AAGJ,SAAgB,8BAEd;AACA,QAAOA,IAAE,OAAO,EACd,eAAeA,IAAE,MAAMA,IAAE,QAAQ,CAAC,EACnC,CAAC;;AAGJ,SAAgB,mCAEd;AACA,QAAOA,IAAE,OAAO,EACd,SAASA,IAAE,SAAS,EACrB,CAAC;;;;;;;;;;;;;;;AC3DJ,MAAa,cAAc,UACzB,aACE,gBACA,EAAE,GAAG,OAAO,EACZ,KAAA,GACA,uBACA,SACD;AAEH,MAAa,gBAAgB,UAC3B,aACE,kBACA,EAAE,GAAG,OAAO,EACZ,KAAA,GACA,yBACA,SACD;AAEH,MA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AS;;;;AC3BzC,MAAa,qBAA2C;CACtD,MAAM;CACN,QAAQ;CACR,sBAAsB;CACtB,sBAAsB;CACvB;AACD,MAAa,oBAAyC,EAAE;AAExD,MAAa,QAA8C;CACzD,eAAe;CACf,YAAY,OAAO;AACjB,SAAO;GACL,GAAG,kBAAkB;GACrB,QAAQ;IAAE,GAAG;IAAoB,GAAG,OAAO;IAAQ;GACnD,OAAO;IAAE,GAAG;IAAmB,GAAG,OAAO;IAAO;GACjD;;CAEH,eAAe,OAAO;AACpB,SAAO,mBAAmB,MAAM,aAAa,OAAO,sBAAsB;;CAE5E,iBAAiB,UAAU,OAAO;AAChC,SAAO,qBAAqB,UAAU,MAAM;;CAE9C,cAAc,OAAO;AACnB,SAAO,kBAAkB,OAAO,QAAQ;;CAE1C,cAAc,OAAO;AACnB,SAAO,iBAAiB,MAAM;;CAEhC,oBAAoB,OAAO;AACzB,SAAO,uBAAuB,MAAM;;CAEtC,iBAAiB,UAAU;AACzB,SAAO,oBAAoB,SAAS;;CAEtC,uBAAuB,UAAU;AAC/B,SAAO,0BAA0B,SAAS;;CAE7C"}
1
+ {"version":3,"file":"utils-B4KdjDnp.js","names":["z","appModuleBaseOperationsActions","appModuleDndOperationsActions"],"sources":["../document-models/app-module/v1/gen/schema/zod.ts","../document-models/app-module/v1/gen/base-operations/creators.ts","../document-models/app-module/v1/gen/dnd-operations/creators.ts","../document-models/app-module/v1/actions.ts","../document-models/app-module/v1/src/reducers/base-operations.ts","../document-models/app-module/v1/src/reducers/dnd-operations.ts","../document-models/app-module/v1/gen/reducer.ts","../document-models/app-module/v1/gen/document-type.ts","../document-models/app-module/v1/gen/document-schema.ts","../document-models/app-module/v1/gen/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddDocumentTypeInput,\n AppModuleState,\n RemoveDocumentTypeInput,\n SetAppNameInput,\n SetAppStatusInput,\n SetDocumentTypesInput,\n SetDragAndDropEnabledInput,\n StatusType,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const StatusTypeSchema = z.enum([\"CONFIRMED\", \"DRAFT\"]);\n\nexport function AddDocumentTypeInputSchema(): z.ZodObject<\n Properties<AddDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n });\n}\n\nexport function AppModuleStateSchema(): z.ZodObject<\n Properties<AppModuleState>\n> {\n return z.object({\n __typename: z.literal(\"AppModuleState\").optional(),\n allowedDocumentTypes: z.array(z.string()).nullish(),\n isDragAndDropEnabled: z.boolean(),\n name: z.string(),\n status: StatusTypeSchema,\n });\n}\n\nexport function RemoveDocumentTypeInputSchema(): z.ZodObject<\n Properties<RemoveDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n });\n}\n\nexport function SetAppNameInputSchema(): z.ZodObject<\n Properties<SetAppNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetAppStatusInputSchema(): z.ZodObject<\n Properties<SetAppStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n\nexport function SetDocumentTypesInputSchema(): z.ZodObject<\n Properties<SetDocumentTypesInput>\n> {\n return z.object({\n documentTypes: z.array(z.string()),\n });\n}\n\nexport function SetDragAndDropEnabledInputSchema(): z.ZodObject<\n Properties<SetDragAndDropEnabledInput>\n> {\n return z.object({\n enabled: z.boolean(),\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetAppNameInputSchema,\n SetAppStatusInputSchema,\n SetDocumentTypesInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddDocumentTypeInput,\n RemoveDocumentTypeInput,\n SetAppNameInput,\n SetAppStatusInput,\n SetDocumentTypesInput,\n} from \"../types.js\";\nimport type {\n AddDocumentTypeAction,\n RemoveDocumentTypeAction,\n SetAppNameAction,\n SetAppStatusAction,\n SetDocumentTypesAction,\n} from \"./actions.js\";\n\nexport const setAppName = (input: SetAppNameInput) =>\n createAction<SetAppNameAction>(\n \"SET_APP_NAME\",\n { ...input },\n undefined,\n SetAppNameInputSchema,\n \"global\",\n );\n\nexport const setAppStatus = (input: SetAppStatusInput) =>\n createAction<SetAppStatusAction>(\n \"SET_APP_STATUS\",\n { ...input },\n undefined,\n SetAppStatusInputSchema,\n \"global\",\n );\n\nexport const addDocumentType = (input: AddDocumentTypeInput) =>\n createAction<AddDocumentTypeAction>(\n \"ADD_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n AddDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const removeDocumentType = (input: RemoveDocumentTypeInput) =>\n createAction<RemoveDocumentTypeAction>(\n \"REMOVE_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n RemoveDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const setDocumentTypes = (input: SetDocumentTypesInput) =>\n createAction<SetDocumentTypesAction>(\n \"SET_DOCUMENT_TYPES\",\n { ...input },\n undefined,\n SetDocumentTypesInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { SetDragAndDropEnabledInputSchema } from \"../schema/zod.js\";\nimport type { SetDragAndDropEnabledInput } from \"../types.js\";\nimport type { SetDragAndDropEnabledAction } from \"./actions.js\";\n\nexport const setDragAndDropEnabled = (input: SetDragAndDropEnabledInput) =>\n createAction<SetDragAndDropEnabledAction>(\n \"SET_DRAG_AND_DROP_ENABLED\",\n { ...input },\n undefined,\n SetDragAndDropEnabledInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport {\n appModuleBaseOperationsActions,\n appModuleDndOperationsActions,\n} from \"./gen/creators.js\";\n\n/** Actions for the AppModule document model */\n\nexport const actions = {\n ...baseActions,\n ...appModuleBaseOperationsActions,\n ...appModuleDndOperationsActions,\n};\n","import type { AppModuleBaseOperationsOperations } from \"document-models/app-module/v1\";\n\nexport const appModuleBaseOperationsOperations: AppModuleBaseOperationsOperations =\n {\n setAppNameOperation(state, action, _dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"App name cannot be empty\");\n }\n state.name = trimmedName;\n },\n setAppStatusOperation(state, action, _dispatch) {\n state.status = action.input.status;\n },\n addDocumentTypeOperation(state, action, _dispatch) {\n const existingAllowedDocumentTypes = state.allowedDocumentTypes ?? [];\n const newDocumentType = action.input.documentType;\n const newAllowedDocumentTypesSet = new Set(\n existingAllowedDocumentTypes,\n ).add(newDocumentType);\n const newAllowedDocumentTypes = [...newAllowedDocumentTypesSet];\n state.allowedDocumentTypes = newAllowedDocumentTypes;\n },\n removeDocumentTypeOperation(state, action, _dispatch) {\n const existingAllowedDocumentTypes = state.allowedDocumentTypes;\n const documentTypeToRemove = action.input.documentType;\n const newAllowedDocumentTypes = existingAllowedDocumentTypes?.filter(\n (dt) => dt !== documentTypeToRemove,\n );\n state.allowedDocumentTypes = newAllowedDocumentTypes ?? [];\n },\n setDocumentTypesOperation(state, action, _dispatch) {\n state.allowedDocumentTypes = action.input.documentTypes;\n },\n };\n","import type { AppModuleDndOperationsOperations } from \"document-models/app-module/v1\";\n\nexport const appModuleDndOperationsOperations: AppModuleDndOperationsOperations =\n {\n setDragAndDropEnabledOperation(state, action, _dispatch) {\n state.isDragAndDropEnabled = action.input.enabled;\n },\n };\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { AppModulePHState } from \"document-models/app-module/v1\";\n\nimport { appModuleBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\nimport { appModuleDndOperationsOperations } from \"../src/reducers/dnd-operations.js\";\n\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetAppNameInputSchema,\n SetAppStatusInputSchema,\n SetDocumentTypesInputSchema,\n SetDragAndDropEnabledInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<AppModulePHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_APP_NAME\": {\n SetAppNameInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.setAppNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_APP_STATUS\": {\n SetAppStatusInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.setAppStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_DOCUMENT_TYPE\": {\n AddDocumentTypeInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.addDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_DOCUMENT_TYPE\": {\n RemoveDocumentTypeInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.removeDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_DOCUMENT_TYPES\": {\n SetDocumentTypesInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.setDocumentTypesOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_DRAG_AND_DROP_ENABLED\": {\n SetDragAndDropEnabledInputSchema().parse(action.input);\n\n appModuleDndOperationsOperations.setDragAndDropEnabledOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<AppModulePHState> = createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const appModuleDocumentType = \"powerhouse/app\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { appModuleDocumentType } from \"./document-type.js\";\nimport { AppModuleStateSchema } from \"./schema/zod.js\";\nimport type { AppModuleDocument, AppModulePHState } from \"./types.js\";\n\n/** Schema for validating the header object of a AppModule document */\nexport const AppModuleDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({\n documentType: z.literal(appModuleDocumentType),\n});\n\n/** Schema for validating the state object of a AppModule document */\nexport const AppModulePHStateSchema = BaseDocumentStateSchema.extend({\n global: AppModuleStateSchema(),\n});\n\nexport const AppModuleDocumentSchema = z.object({\n header: AppModuleDocumentHeaderSchema,\n state: AppModulePHStateSchema,\n initialState: AppModulePHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a AppModule document state object */\nexport function isAppModuleState(state: unknown): state is AppModulePHState {\n return AppModulePHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a AppModule document state object */\nexport function assertIsAppModuleState(\n state: unknown,\n): asserts state is AppModulePHState {\n AppModulePHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a AppModule document */\nexport function isAppModuleDocument(\n document: unknown,\n): document is AppModuleDocument {\n return AppModuleDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a AppModule document */\nexport function assertIsAppModuleDocument(\n document: unknown,\n): asserts document is AppModuleDocument {\n AppModuleDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInput,\n baseSaveToFileHandle,\n defaultBaseState,\n} from \"document-model\";\nimport {\n assertIsAppModuleDocument,\n assertIsAppModuleState,\n isAppModuleDocument,\n isAppModuleState,\n} from \"./document-schema.js\";\nimport { appModuleDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n AppModuleGlobalState,\n AppModuleLocalState,\n AppModulePHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: AppModuleGlobalState = {\n name: \"\",\n status: \"DRAFT\",\n allowedDocumentTypes: null,\n isDragAndDropEnabled: true,\n};\nexport const initialLocalState: AppModuleLocalState = {};\n\nexport const utils: DocumentModelUtils<AppModulePHState> = {\n fileExtension: \".app\",\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(utils.createState, state, appModuleDocumentType);\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInput(input, reducer);\n },\n isStateOfType(state) {\n return isAppModuleState(state);\n },\n assertIsStateOfType(state) {\n return assertIsAppModuleState(state);\n },\n isDocumentOfType(document) {\n return isAppModuleDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsAppModuleDocument(document);\n },\n};\n"],"mappings":";;;;;AAoBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO,EACd,cAAcA,IAAE,QAAQ,EACzB,CAAC;;AAGJ,SAAgB,uBAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,iBAAiB,CAAC,UAAU;EAClD,sBAAsBA,IAAE,MAAMA,IAAE,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AO,iBAAiB,MAAM;;CAEhC,oBAAoB,OAAO;AACzB,SAAO,uBAAuB,MAAM;;CAEtC,iBAAiB,UAAU;AACzB,SAAO,oBAAoB,SAAS;;CAEtC,uBAAuB,UAAU;AAC/B,SAAO,0BAA0B,SAAS;;CAE7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils-BiV3cs9Y.js","names":["z","subgraphModuleBaseOperationsActions"],"sources":["../document-models/subgraph-module/v1/gen/schema/zod.ts","../document-models/subgraph-module/v1/gen/base-operations/creators.ts","../document-models/subgraph-module/v1/actions.ts","../document-models/subgraph-module/v1/src/reducers/base-operations.ts","../document-models/subgraph-module/v1/gen/reducer.ts","../document-models/subgraph-module/v1/gen/document-type.ts","../document-models/subgraph-module/v1/gen/document-schema.ts","../document-models/subgraph-module/v1/gen/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n SetSubgraphNameInput,\n SetSubgraphStatusInput,\n StatusType,\n SubgraphModuleState,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const StatusTypeSchema = z.enum([\"CONFIRMED\", \"DRAFT\"]);\n\nexport function SetSubgraphNameInputSchema(): z.ZodObject<\n Properties<SetSubgraphNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetSubgraphStatusInputSchema(): z.ZodObject<\n Properties<SetSubgraphStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n\nexport function SubgraphModuleStateSchema(): z.ZodObject<\n Properties<SubgraphModuleState>\n> {\n return z.object({\n __typename: z.literal(\"SubgraphModuleState\").optional(),\n name: z.string(),\n status: StatusTypeSchema,\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n SetSubgraphNameInputSchema,\n SetSubgraphStatusInputSchema,\n} from \"../schema/zod.js\";\nimport type { SetSubgraphNameInput, SetSubgraphStatusInput } from \"../types.js\";\nimport type {\n SetSubgraphNameAction,\n SetSubgraphStatusAction,\n} from \"./actions.js\";\n\nexport const setSubgraphName = (input: SetSubgraphNameInput) =>\n createAction<SetSubgraphNameAction>(\n \"SET_SUBGRAPH_NAME\",\n { ...input },\n undefined,\n SetSubgraphNameInputSchema,\n \"global\",\n );\n\nexport const setSubgraphStatus = (input: SetSubgraphStatusInput) =>\n createAction<SetSubgraphStatusAction>(\n \"SET_SUBGRAPH_STATUS\",\n { ...input },\n undefined,\n SetSubgraphStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport { subgraphModuleBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the SubgraphModule document model */\n\nexport const actions = {\n ...baseActions,\n ...subgraphModuleBaseOperationsActions,\n};\n","import type { SubgraphModuleBaseOperationsOperations } from \"document-models/subgraph-module/v1\";\n\nexport const subgraphModuleBaseOperationsOperations: SubgraphModuleBaseOperationsOperations =\n {\n setSubgraphNameOperation(state, action, _dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"Subgraph name cannot be empty\");\n }\n state.name = trimmedName;\n },\n setSubgraphStatusOperation(state, action, _dispatch) {\n state.status = action.input.status;\n },\n };\n","import type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { SubgraphModulePHState } from \"document-models/subgraph-module/v1\";\n\nimport { subgraphModuleBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n SetSubgraphNameInputSchema,\n SetSubgraphStatusInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<SubgraphModulePHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_SUBGRAPH_NAME\": {\n SetSubgraphNameInputSchema().parse(action.input);\n\n subgraphModuleBaseOperationsOperations.setSubgraphNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_SUBGRAPH_STATUS\": {\n SetSubgraphStatusInputSchema().parse(action.input);\n\n subgraphModuleBaseOperationsOperations.setSubgraphStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<SubgraphModulePHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const subgraphModuleDocumentType = \"powerhouse/subgraph\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { subgraphModuleDocumentType } from \"./document-type.js\";\nimport { SubgraphModuleStateSchema } from \"./schema/zod.js\";\nimport type { SubgraphModuleDocument, SubgraphModulePHState } from \"./types.js\";\n\n/** Schema for validating the header object of a SubgraphModule document */\nexport const SubgraphModuleDocumentHeaderSchema =\n BaseDocumentHeaderSchema.extend({\n documentType: z.literal(subgraphModuleDocumentType),\n });\n\n/** Schema for validating the state object of a SubgraphModule document */\nexport const SubgraphModulePHStateSchema = BaseDocumentStateSchema.extend({\n global: SubgraphModuleStateSchema(),\n});\n\nexport const SubgraphModuleDocumentSchema = z.object({\n header: SubgraphModuleDocumentHeaderSchema,\n state: SubgraphModulePHStateSchema,\n initialState: SubgraphModulePHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a SubgraphModule document state object */\nexport function isSubgraphModuleState(\n state: unknown,\n): state is SubgraphModulePHState {\n return SubgraphModulePHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a SubgraphModule document state object */\nexport function assertIsSubgraphModuleState(\n state: unknown,\n): asserts state is SubgraphModulePHState {\n SubgraphModulePHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a SubgraphModule document */\nexport function isSubgraphModuleDocument(\n document: unknown,\n): document is SubgraphModuleDocument {\n return SubgraphModuleDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a SubgraphModule document */\nexport function assertIsSubgraphModuleDocument(\n document: unknown,\n): asserts document is SubgraphModuleDocument {\n SubgraphModuleDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInput,\n baseSaveToFileHandle,\n defaultBaseState,\n} from \"document-model\";\nimport {\n assertIsSubgraphModuleDocument,\n assertIsSubgraphModuleState,\n isSubgraphModuleDocument,\n isSubgraphModuleState,\n} from \"./document-schema.js\";\nimport { subgraphModuleDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n SubgraphModuleGlobalState,\n SubgraphModuleLocalState,\n SubgraphModulePHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: SubgraphModuleGlobalState = {\n name: \"\",\n status: \"DRAFT\",\n};\nexport const initialLocalState: SubgraphModuleLocalState = {};\n\nexport const utils: DocumentModelUtils<SubgraphModulePHState> = {\n fileExtension: \".subgraph\",\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(\n utils.createState,\n state,\n subgraphModuleDocumentType,\n );\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInput(input, reducer);\n },\n isStateOfType(state) {\n return isSubgraphModuleState(state);\n },\n assertIsStateOfType(state) {\n return assertIsSubgraphModuleState(state);\n },\n isDocumentOfType(document) {\n return isSubgraphModuleDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsSubgraphModuleDocument(document);\n },\n};\n"],"mappings":";;;;;AAgBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO,EACd,MAAMA,IAAE,QAAQ,EACjB,CAAC;;AAGJ,SAAgB,+BAEd;AACA,QAAOA,IAAE,OAAO,EACd,QAAQ,kBACT,CAAC;;AAGJ,SAAgB,4BAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,sBAAsB,CAAC,UAAU;EACvD,MAAMA,IAAE,QAAQ;EAChB,QAAQ;EACT,CAAC;;;;;;;;;;;;ACjCJ,MAAa,mBAAmB,UAC9B,aACE,qBACA,EAAE,GAAG,OAAO,EACZ,KAAA,GACA,4BACA,SACD;AAEH,MAAa,qBAAqB,UAChC,aACE,uBACA,EAAE,GAAG,OAAO,EACZ,KAAA,GACA,8BACA,SACD;;;;;;;;ACtBH,MAAa,UAAU;CACrB,GAAG;CACH,GAAGC;CACJ;;;ACVD,MAAa,yCACX;CACE,yBAAyB,OAAO,QAAQ,WAAW;EACjD,MAAM,cAAc,OAAO,MAAM,KAAK,MAAM;AAC5C,MAAI,gBAAgB,GAClB,OAAM,IAAI,MAAM,gCAAgC;AAElD,QAAM,OAAO;;CAEf,2BAA2B,OAAO,QAAQ,WAAW;AACnD,QAAM,SAAS,OAAO,MAAM;;CAE/B;;;ACHH,MAAM,gBACJ,OACA,QACA,aACG;AACH,KAAI,iBAAiB,OAAO,CAC1B,QAAO;AAET,SAAQ,OAAO,MAAf;EACE,KAAK;AACH,+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sB,MAAM;;CAErC,oBAAoB,OAAO;AACzB,SAAO,4BAA4B,MAAM;;CAE3C,iBAAiB,UAAU;AACzB,SAAO,yBAAyB,SAAS;;CAE3C,uBAAuB,UAAU;AAC/B,SAAO,+BAA+B,SAAS;;CAElD"}
1
+ {"version":3,"file":"utils-BiV3cs9Y.js","names":["z","subgraphModuleBaseOperationsActions"],"sources":["../document-models/subgraph-module/v1/gen/schema/zod.ts","../document-models/subgraph-module/v1/gen/base-operations/creators.ts","../document-models/subgraph-module/v1/actions.ts","../document-models/subgraph-module/v1/src/reducers/base-operations.ts","../document-models/subgraph-module/v1/gen/reducer.ts","../document-models/subgraph-module/v1/gen/document-type.ts","../document-models/subgraph-module/v1/gen/document-schema.ts","../document-models/subgraph-module/v1/gen/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n SetSubgraphNameInput,\n SetSubgraphStatusInput,\n StatusType,\n SubgraphModuleState,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const StatusTypeSchema = z.enum([\"CONFIRMED\", \"DRAFT\"]);\n\nexport function SetSubgraphNameInputSchema(): z.ZodObject<\n Properties<SetSubgraphNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetSubgraphStatusInputSchema(): z.ZodObject<\n Properties<SetSubgraphStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n\nexport function SubgraphModuleStateSchema(): z.ZodObject<\n Properties<SubgraphModuleState>\n> {\n return z.object({\n __typename: z.literal(\"SubgraphModuleState\").optional(),\n name: z.string(),\n status: StatusTypeSchema,\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n SetSubgraphNameInputSchema,\n SetSubgraphStatusInputSchema,\n} from \"../schema/zod.js\";\nimport type { SetSubgraphNameInput, SetSubgraphStatusInput } from \"../types.js\";\nimport type {\n SetSubgraphNameAction,\n SetSubgraphStatusAction,\n} from \"./actions.js\";\n\nexport const setSubgraphName = (input: SetSubgraphNameInput) =>\n createAction<SetSubgraphNameAction>(\n \"SET_SUBGRAPH_NAME\",\n { ...input },\n undefined,\n SetSubgraphNameInputSchema,\n \"global\",\n );\n\nexport const setSubgraphStatus = (input: SetSubgraphStatusInput) =>\n createAction<SetSubgraphStatusAction>(\n \"SET_SUBGRAPH_STATUS\",\n { ...input },\n undefined,\n SetSubgraphStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport { subgraphModuleBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the SubgraphModule document model */\n\nexport const actions = {\n ...baseActions,\n ...subgraphModuleBaseOperationsActions,\n};\n","import type { SubgraphModuleBaseOperationsOperations } from \"document-models/subgraph-module/v1\";\n\nexport const subgraphModuleBaseOperationsOperations: SubgraphModuleBaseOperationsOperations =\n {\n setSubgraphNameOperation(state, action, _dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"Subgraph name cannot be empty\");\n }\n state.name = trimmedName;\n },\n setSubgraphStatusOperation(state, action, _dispatch) {\n state.status = action.input.status;\n },\n };\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { SubgraphModulePHState } from \"document-models/subgraph-module/v1\";\n\nimport { subgraphModuleBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n SetSubgraphNameInputSchema,\n SetSubgraphStatusInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<SubgraphModulePHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_SUBGRAPH_NAME\": {\n SetSubgraphNameInputSchema().parse(action.input);\n\n subgraphModuleBaseOperationsOperations.setSubgraphNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_SUBGRAPH_STATUS\": {\n SetSubgraphStatusInputSchema().parse(action.input);\n\n subgraphModuleBaseOperationsOperations.setSubgraphStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<SubgraphModulePHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const subgraphModuleDocumentType = \"powerhouse/subgraph\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { subgraphModuleDocumentType } from \"./document-type.js\";\nimport { SubgraphModuleStateSchema } from \"./schema/zod.js\";\nimport type { SubgraphModuleDocument, SubgraphModulePHState } from \"./types.js\";\n\n/** Schema for validating the header object of a SubgraphModule document */\nexport const SubgraphModuleDocumentHeaderSchema =\n BaseDocumentHeaderSchema.extend({\n documentType: z.literal(subgraphModuleDocumentType),\n });\n\n/** Schema for validating the state object of a SubgraphModule document */\nexport const SubgraphModulePHStateSchema = BaseDocumentStateSchema.extend({\n global: SubgraphModuleStateSchema(),\n});\n\nexport const SubgraphModuleDocumentSchema = z.object({\n header: SubgraphModuleDocumentHeaderSchema,\n state: SubgraphModulePHStateSchema,\n initialState: SubgraphModulePHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a SubgraphModule document state object */\nexport function isSubgraphModuleState(\n state: unknown,\n): state is SubgraphModulePHState {\n return SubgraphModulePHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a SubgraphModule document state object */\nexport function assertIsSubgraphModuleState(\n state: unknown,\n): asserts state is SubgraphModulePHState {\n SubgraphModulePHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a SubgraphModule document */\nexport function isSubgraphModuleDocument(\n document: unknown,\n): document is SubgraphModuleDocument {\n return SubgraphModuleDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a SubgraphModule document */\nexport function assertIsSubgraphModuleDocument(\n document: unknown,\n): asserts document is SubgraphModuleDocument {\n SubgraphModuleDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInput,\n baseSaveToFileHandle,\n defaultBaseState,\n} from \"document-model\";\nimport {\n assertIsSubgraphModuleDocument,\n assertIsSubgraphModuleState,\n isSubgraphModuleDocument,\n isSubgraphModuleState,\n} from \"./document-schema.js\";\nimport { subgraphModuleDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n SubgraphModuleGlobalState,\n SubgraphModuleLocalState,\n SubgraphModulePHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: SubgraphModuleGlobalState = {\n name: \"\",\n status: \"DRAFT\",\n};\nexport const initialLocalState: SubgraphModuleLocalState = {};\n\nexport const utils: DocumentModelUtils<SubgraphModulePHState> = {\n fileExtension: \".subgraph\",\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(\n utils.createState,\n state,\n subgraphModuleDocumentType,\n );\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInput(input, reducer);\n },\n isStateOfType(state) {\n return isSubgraphModuleState(state);\n },\n assertIsStateOfType(state) {\n return assertIsSubgraphModuleState(state);\n },\n isDocumentOfType(document) {\n return isSubgraphModuleDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsSubgraphModuleDocument(document);\n },\n};\n"],"mappings":";;;;;AAgBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO,EACd,MAAMA,IAAE,QAAQ,EACjB,CAAC;;AAGJ,SAAgB,+BAEd;AACA,QAAOA,IAAE,OAAO,EACd,QAAQ,kBACT,CAAC;;AAGJ,SAAgB,4BAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,sBAAsB,CAAC,UAAU;EACvD,MAAMA,IAAE,QAAQ;EAChB,QAAQ;EACT,CAAC;;;;;;;;;;;;ACjCJ,MAAa,mBAAmB,UAC9B,aACE,qBACA,EAAE,GAAG,OAAO,EACZ,KAAA,GACA,4BACA,SACD;AAEH,MAAa,qBAAqB,UAChC,aACE,uBACA,EAAE,GAAG,OAAO,EACZ,KAAA,GACA,8BACA,SACD;;;;;;;;ACtBH,MAAa,UAAU;CACrB,GAAG;CACH,GAAGC;CACJ;;;ACVD,MAAa,yCACX;CACE,yBAAyB,OAAO,QAAQ,WAAW;EACjD,MAAM,cAAc,OAAO,MAAM,KAAK,MAAM;AAC5C,MAAI,gBAAgB,GAClB,OAAM,IAAI,MAAM,gCAAgC;AAElD,QAAM,OAAO;;CAEf,2BAA2B,OAAO,QAAQ,WAAW;AACnD,QAAM,SAAS,OAAO,MAAM;;CAE/B;;;ACDH,MAAM,gBACJ,OACA,QACA,aACG;AACH,KAAI,iBAAiB,OAAO,CAC1B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O,QAAQ;;CAE1C,cAAc,OAAO;AACnB,SAAO,sBAAsB,MAAM;;CAErC,oBAAoB,OAAO;AACzB,SAAO,4BAA4B,MAAM;;CAE3C,iBAAiB,UAAU;AACzB,SAAO,yBAAyB,SAAS;;CAE3C,uBAAuB,UAAU;AAC/B,SAAO,+BAA+B,SAAS;;CAElD"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils-CkWB3DRk.js","names":["z","processorModuleBaseOperationsActions"],"sources":["../document-models/processor-module/v1/gen/schema/zod.ts","../document-models/processor-module/v1/gen/base-operations/creators.ts","../document-models/processor-module/v1/actions.ts","../document-models/processor-module/v1/src/reducers/base-operations.ts","../document-models/processor-module/v1/gen/reducer.ts","../document-models/processor-module/v1/gen/document-type.ts","../document-models/processor-module/v1/gen/document-schema.ts","../document-models/processor-module/v1/gen/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddDocumentTypeInput,\n AddProcessorAppInput,\n DocumentTypeItem,\n ProcessorModuleState,\n RemoveDocumentTypeInput,\n RemoveProcessorAppInput,\n SetProcessorNameInput,\n SetProcessorStatusInput,\n SetProcessorTypeInput,\n StatusType,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const StatusTypeSchema = z.enum([\"CONFIRMED\", \"DRAFT\"]);\n\nexport function AddDocumentTypeInputSchema(): z.ZodObject<\n Properties<AddDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function AddProcessorAppInputSchema(): z.ZodObject<\n Properties<AddProcessorAppInput>\n> {\n return z.object({\n processorApp: z.string(),\n });\n}\n\nexport function DocumentTypeItemSchema(): z.ZodObject<\n Properties<DocumentTypeItem>\n> {\n return z.object({\n __typename: z.literal(\"DocumentTypeItem\").optional(),\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function ProcessorModuleStateSchema(): z.ZodObject<\n Properties<ProcessorModuleState>\n> {\n return z.object({\n __typename: z.literal(\"ProcessorModuleState\").optional(),\n documentTypes: z.array(z.lazy(() => DocumentTypeItemSchema())),\n name: z.string(),\n processorApps: z.array(z.string()),\n status: StatusTypeSchema,\n type: z.string(),\n });\n}\n\nexport function RemoveDocumentTypeInputSchema(): z.ZodObject<\n Properties<RemoveDocumentTypeInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RemoveProcessorAppInputSchema(): z.ZodObject<\n Properties<RemoveProcessorAppInput>\n> {\n return z.object({\n processorApp: z.string(),\n });\n}\n\nexport function SetProcessorNameInputSchema(): z.ZodObject<\n Properties<SetProcessorNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetProcessorStatusInputSchema(): z.ZodObject<\n Properties<SetProcessorStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n\nexport function SetProcessorTypeInputSchema(): z.ZodObject<\n Properties<SetProcessorTypeInput>\n> {\n return z.object({\n type: z.string(),\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddDocumentTypeInputSchema,\n AddProcessorAppInputSchema,\n RemoveDocumentTypeInputSchema,\n RemoveProcessorAppInputSchema,\n SetProcessorNameInputSchema,\n SetProcessorStatusInputSchema,\n SetProcessorTypeInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddDocumentTypeInput,\n AddProcessorAppInput,\n RemoveDocumentTypeInput,\n RemoveProcessorAppInput,\n SetProcessorNameInput,\n SetProcessorStatusInput,\n SetProcessorTypeInput,\n} from \"../types.js\";\nimport type {\n AddDocumentTypeAction,\n AddProcessorAppAction,\n RemoveDocumentTypeAction,\n RemoveProcessorAppAction,\n SetProcessorNameAction,\n SetProcessorStatusAction,\n SetProcessorTypeAction,\n} from \"./actions.js\";\n\nexport const setProcessorName = (input: SetProcessorNameInput) =>\n createAction<SetProcessorNameAction>(\n \"SET_PROCESSOR_NAME\",\n { ...input },\n undefined,\n SetProcessorNameInputSchema,\n \"global\",\n );\n\nexport const setProcessorType = (input: SetProcessorTypeInput) =>\n createAction<SetProcessorTypeAction>(\n \"SET_PROCESSOR_TYPE\",\n { ...input },\n undefined,\n SetProcessorTypeInputSchema,\n \"global\",\n );\n\nexport const addDocumentType = (input: AddDocumentTypeInput) =>\n createAction<AddDocumentTypeAction>(\n \"ADD_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n AddDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const removeDocumentType = (input: RemoveDocumentTypeInput) =>\n createAction<RemoveDocumentTypeAction>(\n \"REMOVE_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n RemoveDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const addProcessorApp = (input: AddProcessorAppInput) =>\n createAction<AddProcessorAppAction>(\n \"ADD_PROCESSOR_APP\",\n { ...input },\n undefined,\n AddProcessorAppInputSchema,\n \"global\",\n );\n\nexport const removeProcessorApp = (input: RemoveProcessorAppInput) =>\n createAction<RemoveProcessorAppAction>(\n \"REMOVE_PROCESSOR_APP\",\n { ...input },\n undefined,\n RemoveProcessorAppInputSchema,\n \"global\",\n );\n\nexport const setProcessorStatus = (input: SetProcessorStatusInput) =>\n createAction<SetProcessorStatusAction>(\n \"SET_PROCESSOR_STATUS\",\n { ...input },\n undefined,\n SetProcessorStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport { processorModuleBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the ProcessorModule document model */\n\nexport const actions = {\n ...baseActions,\n ...processorModuleBaseOperationsActions,\n};\n","import {\n PROCESSOR_APPS,\n type ProcessorApp,\n} from \"@powerhousedao/shared/processors\";\nimport type { ProcessorModuleBaseOperationsOperations } from \"document-models/processor-module/v1\";\n\nexport const processorModuleBaseOperationsOperations: ProcessorModuleBaseOperationsOperations =\n {\n setProcessorNameOperation(state, action, _dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"Processor name cannot be empty\");\n }\n state.name = trimmedName;\n },\n setProcessorTypeOperation(state, action, _dispatch) {\n const trimmedType = action.input.type.trim();\n if (trimmedType === \"\") {\n throw new Error(\"Processor type cannot be empty\");\n }\n state.type = trimmedType;\n },\n addDocumentTypeOperation(state, action, _dispatch) {\n // Check for duplicate ID\n const existingId = state.documentTypes.find(\n (dt) => dt.id === action.input.id,\n );\n if (existingId) {\n throw new Error(\n `Document type with id \"${action.input.id}\" already exists`,\n );\n }\n\n state.documentTypes.push({\n id: action.input.id,\n documentType: action.input.documentType,\n });\n },\n removeDocumentTypeOperation(state, action, _dispatch) {\n state.documentTypes = state.documentTypes.filter(\n (documentType) => documentType.id !== action.input.id,\n );\n },\n setProcessorStatusOperation(state, action, _dispatch) {\n state.status = action.input.status;\n },\n addProcessorAppOperation(state, action) {\n const { processorApp } = action.input;\n if (!PROCESSOR_APPS.includes(processorApp as ProcessorApp)) {\n throw new Error(\n `${processorApp} is not a valid processor app. Must be one of ${PROCESSOR_APPS.join(\", \")}.`,\n );\n }\n state.processorApps = [\n ...new Set([...state.processorApps, processorApp]),\n ];\n },\n removeProcessorAppOperation(state, action) {\n const { processorApp } = action.input;\n state.processorApps = state.processorApps.filter(\n (p) => p !== processorApp,\n );\n },\n };\n","import type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { ProcessorModulePHState } from \"document-models/processor-module/v1\";\n\nimport { processorModuleBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n AddDocumentTypeInputSchema,\n AddProcessorAppInputSchema,\n RemoveDocumentTypeInputSchema,\n RemoveProcessorAppInputSchema,\n SetProcessorNameInputSchema,\n SetProcessorStatusInputSchema,\n SetProcessorTypeInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<ProcessorModulePHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_PROCESSOR_NAME\": {\n SetProcessorNameInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.setProcessorNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PROCESSOR_TYPE\": {\n SetProcessorTypeInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.setProcessorTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_DOCUMENT_TYPE\": {\n AddDocumentTypeInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.addDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_DOCUMENT_TYPE\": {\n RemoveDocumentTypeInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.removeDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_PROCESSOR_APP\": {\n AddProcessorAppInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.addProcessorAppOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_PROCESSOR_APP\": {\n RemoveProcessorAppInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.removeProcessorAppOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PROCESSOR_STATUS\": {\n SetProcessorStatusInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.setProcessorStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<ProcessorModulePHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const processorModuleDocumentType = \"powerhouse/processor\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { processorModuleDocumentType } from \"./document-type.js\";\nimport { ProcessorModuleStateSchema } from \"./schema/zod.js\";\nimport type {\n ProcessorModuleDocument,\n ProcessorModulePHState,\n} from \"./types.js\";\n\n/** Schema for validating the header object of a ProcessorModule document */\nexport const ProcessorModuleDocumentHeaderSchema =\n BaseDocumentHeaderSchema.extend({\n documentType: z.literal(processorModuleDocumentType),\n });\n\n/** Schema for validating the state object of a ProcessorModule document */\nexport const ProcessorModulePHStateSchema = BaseDocumentStateSchema.extend({\n global: ProcessorModuleStateSchema(),\n});\n\nexport const ProcessorModuleDocumentSchema = z.object({\n header: ProcessorModuleDocumentHeaderSchema,\n state: ProcessorModulePHStateSchema,\n initialState: ProcessorModulePHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a ProcessorModule document state object */\nexport function isProcessorModuleState(\n state: unknown,\n): state is ProcessorModulePHState {\n return ProcessorModulePHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a ProcessorModule document state object */\nexport function assertIsProcessorModuleState(\n state: unknown,\n): asserts state is ProcessorModulePHState {\n ProcessorModulePHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a ProcessorModule document */\nexport function isProcessorModuleDocument(\n document: unknown,\n): document is ProcessorModuleDocument {\n return ProcessorModuleDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a ProcessorModule document */\nexport function assertIsProcessorModuleDocument(\n document: unknown,\n): asserts document is ProcessorModuleDocument {\n ProcessorModuleDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInput,\n baseSaveToFileHandle,\n defaultBaseState,\n} from \"document-model\";\nimport {\n assertIsProcessorModuleDocument,\n assertIsProcessorModuleState,\n isProcessorModuleDocument,\n isProcessorModuleState,\n} from \"./document-schema.js\";\nimport { processorModuleDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n ProcessorModuleGlobalState,\n ProcessorModuleLocalState,\n ProcessorModulePHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: ProcessorModuleGlobalState = {\n name: \"\",\n type: \"\",\n documentTypes: [],\n status: \"DRAFT\",\n processorApps: [],\n};\nexport const initialLocalState: ProcessorModuleLocalState = {};\n\nexport const utils: DocumentModelUtils<ProcessorModulePHState> = {\n fileExtension: \".processor\",\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(\n utils.createState,\n state,\n processorModuleDocumentType,\n );\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInput(input, reducer);\n },\n isStateOfType(state) {\n return isProcessorModuleState(state);\n },\n assertIsStateOfType(state) {\n return assertIsProcessorModuleState(state);\n },\n isDocumentOfType(document) {\n return isProcessorModuleDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsProcessorModuleDocument(document);\n },\n};\n"],"mappings":";;;;;;AAsBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO;EACd,cAAcA,I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processor-module/v1/gen/schema/zod.ts","../document-models/processor-module/v1/gen/base-operations/creators.ts","../document-models/processor-module/v1/actions.ts","../document-models/processor-module/v1/src/reducers/base-operations.ts","../document-models/processor-module/v1/gen/reducer.ts","../document-models/processor-module/v1/gen/document-type.ts","../document-models/processor-module/v1/gen/document-schema.ts","../document-models/processor-module/v1/gen/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddDocumentTypeInput,\n AddProcessorAppInput,\n DocumentTypeItem,\n ProcessorModuleState,\n RemoveDocumentTypeInput,\n RemoveProcessorAppInput,\n SetProcessorNameInput,\n SetProcessorStatusInput,\n SetProcessorTypeInput,\n StatusType,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const StatusTypeSchema = z.enum([\"CONFIRMED\", \"DRAFT\"]);\n\nexport function AddDocumentTypeInputSchema(): z.ZodObject<\n Properties<AddDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function AddProcessorAppInputSchema(): z.ZodObject<\n Properties<AddProcessorAppInput>\n> {\n return z.object({\n processorApp: z.string(),\n });\n}\n\nexport function DocumentTypeItemSchema(): z.ZodObject<\n Properties<DocumentTypeItem>\n> {\n return z.object({\n __typename: z.literal(\"DocumentTypeItem\").optional(),\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function ProcessorModuleStateSchema(): z.ZodObject<\n Properties<ProcessorModuleState>\n> {\n return z.object({\n __typename: z.literal(\"ProcessorModuleState\").optional(),\n documentTypes: z.array(z.lazy(() => DocumentTypeItemSchema())),\n name: z.string(),\n processorApps: z.array(z.string()),\n status: StatusTypeSchema,\n type: z.string(),\n });\n}\n\nexport function RemoveDocumentTypeInputSchema(): z.ZodObject<\n Properties<RemoveDocumentTypeInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RemoveProcessorAppInputSchema(): z.ZodObject<\n Properties<RemoveProcessorAppInput>\n> {\n return z.object({\n processorApp: z.string(),\n });\n}\n\nexport function SetProcessorNameInputSchema(): z.ZodObject<\n Properties<SetProcessorNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetProcessorStatusInputSchema(): z.ZodObject<\n Properties<SetProcessorStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n\nexport function SetProcessorTypeInputSchema(): z.ZodObject<\n Properties<SetProcessorTypeInput>\n> {\n return z.object({\n type: z.string(),\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddDocumentTypeInputSchema,\n AddProcessorAppInputSchema,\n RemoveDocumentTypeInputSchema,\n RemoveProcessorAppInputSchema,\n SetProcessorNameInputSchema,\n SetProcessorStatusInputSchema,\n SetProcessorTypeInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddDocumentTypeInput,\n AddProcessorAppInput,\n RemoveDocumentTypeInput,\n RemoveProcessorAppInput,\n SetProcessorNameInput,\n SetProcessorStatusInput,\n SetProcessorTypeInput,\n} from \"../types.js\";\nimport type {\n AddDocumentTypeAction,\n AddProcessorAppAction,\n RemoveDocumentTypeAction,\n RemoveProcessorAppAction,\n SetProcessorNameAction,\n SetProcessorStatusAction,\n SetProcessorTypeAction,\n} from \"./actions.js\";\n\nexport const setProcessorName = (input: SetProcessorNameInput) =>\n createAction<SetProcessorNameAction>(\n \"SET_PROCESSOR_NAME\",\n { ...input },\n undefined,\n SetProcessorNameInputSchema,\n \"global\",\n );\n\nexport const setProcessorType = (input: SetProcessorTypeInput) =>\n createAction<SetProcessorTypeAction>(\n \"SET_PROCESSOR_TYPE\",\n { ...input },\n undefined,\n SetProcessorTypeInputSchema,\n \"global\",\n );\n\nexport const addDocumentType = (input: AddDocumentTypeInput) =>\n createAction<AddDocumentTypeAction>(\n \"ADD_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n AddDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const removeDocumentType = (input: RemoveDocumentTypeInput) =>\n createAction<RemoveDocumentTypeAction>(\n \"REMOVE_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n RemoveDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const addProcessorApp = (input: AddProcessorAppInput) =>\n createAction<AddProcessorAppAction>(\n \"ADD_PROCESSOR_APP\",\n { ...input },\n undefined,\n AddProcessorAppInputSchema,\n \"global\",\n );\n\nexport const removeProcessorApp = (input: RemoveProcessorAppInput) =>\n createAction<RemoveProcessorAppAction>(\n \"REMOVE_PROCESSOR_APP\",\n { ...input },\n undefined,\n RemoveProcessorAppInputSchema,\n \"global\",\n );\n\nexport const setProcessorStatus = (input: SetProcessorStatusInput) =>\n createAction<SetProcessorStatusAction>(\n \"SET_PROCESSOR_STATUS\",\n { ...input },\n undefined,\n SetProcessorStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport { processorModuleBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the ProcessorModule document model */\n\nexport const actions = {\n ...baseActions,\n ...processorModuleBaseOperationsActions,\n};\n","import {\n PROCESSOR_APPS,\n type ProcessorApp,\n} from \"@powerhousedao/shared/processors\";\nimport type { ProcessorModuleBaseOperationsOperations } from \"document-models/processor-module/v1\";\n\nexport const processorModuleBaseOperationsOperations: ProcessorModuleBaseOperationsOperations =\n {\n setProcessorNameOperation(state, action, _dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"Processor name cannot be empty\");\n }\n state.name = trimmedName;\n },\n setProcessorTypeOperation(state, action, _dispatch) {\n const trimmedType = action.input.type.trim();\n if (trimmedType === \"\") {\n throw new Error(\"Processor type cannot be empty\");\n }\n state.type = trimmedType;\n },\n addDocumentTypeOperation(state, action, _dispatch) {\n // Check for duplicate ID\n const existingId = state.documentTypes.find(\n (dt) => dt.id === action.input.id,\n );\n if (existingId) {\n throw new Error(\n `Document type with id \"${action.input.id}\" already exists`,\n );\n }\n\n state.documentTypes.push({\n id: action.input.id,\n documentType: action.input.documentType,\n });\n },\n removeDocumentTypeOperation(state, action, _dispatch) {\n state.documentTypes = state.documentTypes.filter(\n (documentType) => documentType.id !== action.input.id,\n );\n },\n setProcessorStatusOperation(state, action, _dispatch) {\n state.status = action.input.status;\n },\n addProcessorAppOperation(state, action) {\n const { processorApp } = action.input;\n if (!PROCESSOR_APPS.includes(processorApp as ProcessorApp)) {\n throw new Error(\n `${processorApp} is not a valid processor app. Must be one of ${PROCESSOR_APPS.join(\", \")}.`,\n );\n }\n state.processorApps = [\n ...new Set([...state.processorApps, processorApp]),\n ];\n },\n removeProcessorAppOperation(state, action) {\n const { processorApp } = action.input;\n state.processorApps = state.processorApps.filter(\n (p) => p !== processorApp,\n );\n },\n };\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { ProcessorModulePHState } from \"document-models/processor-module/v1\";\n\nimport { processorModuleBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n AddDocumentTypeInputSchema,\n AddProcessorAppInputSchema,\n RemoveDocumentTypeInputSchema,\n RemoveProcessorAppInputSchema,\n SetProcessorNameInputSchema,\n SetProcessorStatusInputSchema,\n SetProcessorTypeInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<ProcessorModulePHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_PROCESSOR_NAME\": {\n SetProcessorNameInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.setProcessorNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PROCESSOR_TYPE\": {\n SetProcessorTypeInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.setProcessorTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_DOCUMENT_TYPE\": {\n AddDocumentTypeInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.addDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_DOCUMENT_TYPE\": {\n RemoveDocumentTypeInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.removeDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_PROCESSOR_APP\": {\n AddProcessorAppInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.addProcessorAppOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_PROCESSOR_APP\": {\n RemoveProcessorAppInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.removeProcessorAppOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PROCESSOR_STATUS\": {\n SetProcessorStatusInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.setProcessorStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<ProcessorModulePHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const processorModuleDocumentType = \"powerhouse/processor\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { processorModuleDocumentType } from \"./document-type.js\";\nimport { ProcessorModuleStateSchema } from \"./schema/zod.js\";\nimport type {\n ProcessorModuleDocument,\n ProcessorModulePHState,\n} from \"./types.js\";\n\n/** Schema for validating the header object of a ProcessorModule document */\nexport const ProcessorModuleDocumentHeaderSchema =\n BaseDocumentHeaderSchema.extend({\n documentType: z.literal(processorModuleDocumentType),\n });\n\n/** Schema for validating the state object of a ProcessorModule document */\nexport const ProcessorModulePHStateSchema = BaseDocumentStateSchema.extend({\n global: ProcessorModuleStateSchema(),\n});\n\nexport const ProcessorModuleDocumentSchema = z.object({\n header: ProcessorModuleDocumentHeaderSchema,\n state: ProcessorModulePHStateSchema,\n initialState: ProcessorModulePHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a ProcessorModule document state object */\nexport function isProcessorModuleState(\n state: unknown,\n): state is ProcessorModulePHState {\n return ProcessorModulePHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a ProcessorModule document state object */\nexport function assertIsProcessorModuleState(\n state: unknown,\n): asserts state is ProcessorModulePHState {\n ProcessorModulePHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a ProcessorModule document */\nexport function isProcessorModuleDocument(\n document: unknown,\n): document is ProcessorModuleDocument {\n return ProcessorModuleDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a ProcessorModule document */\nexport function assertIsProcessorModuleDocument(\n document: unknown,\n): asserts document is ProcessorModuleDocument {\n ProcessorModuleDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInput,\n baseSaveToFileHandle,\n defaultBaseState,\n} from \"document-model\";\nimport {\n assertIsProcessorModuleDocument,\n assertIsProcessorModuleState,\n isProcessorModuleDocument,\n isProcessorModuleState,\n} from \"./document-schema.js\";\nimport { processorModuleDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n ProcessorModuleGlobalState,\n ProcessorModuleLocalState,\n ProcessorModulePHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: ProcessorModuleGlobalState = {\n name: \"\",\n type: \"\",\n documentTypes: [],\n status: \"DRAFT\",\n processorApps: [],\n};\nexport const initialLocalState: ProcessorModuleLocalState = {};\n\nexport const utils: DocumentModelUtils<ProcessorModulePHState> = {\n fileExtension: \".processor\",\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(\n utils.createState,\n state,\n processorModuleDocumentType,\n );\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInput(input, reducer);\n },\n isStateOfType(state) {\n return isProcessorModuleState(state);\n },\n assertIsStateOfType(state) {\n return assertIsProcessorModuleState(state);\n },\n isDocumentOfType(document) {\n return isProcessorModuleDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsProcessorModuleDocument(document);\n },\n};\n"],"mappings":";;;;;;AAsBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO;EACd,cAAcA,IAAE,QAAQ;EACxB,IAAIA,IAAE,QAAQ;EACf,CAAC;;AAGJ,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO,EACd,cAAcA,IAAE,QAAQ,EACzB,CAAC;;AAGJ,SAAgB,yBAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,mBAAmB,CAAC,UAAU;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AAgB,uBACd,OACiC;AACjC,QAAO,6BAA6B,UAAU,MAAM,CAAC;;;AAIvD,SAAgB,6BACd,OACyC;AACzC,8BAA6B,MAAM,MAAM;;;AAI3C,SAAgB,0BACd,UACqC;AACrC,QAAO,8BAA8B,UAAU,SAAS,CAAC;;;AAI3D,SAAgB,gCACd,UAC6C;AAC7C,+BAA8B,MAAM,SAAS;;;;ACjC/C,MAAa,qBAAiD;CAC5D,MAAM;CACN,MAAM;CACN,eAAe,EAAE;CACjB,QAAQ;CACR,eAAe,EAAE;CAClB;AACD,MAAa,oBAA+C,EAAE;AAE9D,MAAa,QAAoD;CAC/D,eAAe;CACf,YAAY,OAAO;AACjB,SAAO;GACL,GAAG,kBAAkB;GACrB,QAAQ;IAAE,GAAG;IAAoB,GAAG,OAAO;IAAQ;GACnD,OAAO;IAAE,GAAG;IAAmB,GAAG,OAAO;IAAO;GACjD;;CAEH,eAAe,OAAO;AACpB,SAAO,mBACL,MAAM,aACN,OACA,4BACD;;CAEH,iBAAiB,UAAU,OAAO;AAChC,SAAO,qBAAqB,UAAU,MAAM;;CAE9C,cAAc,OAAO;AACnB,SAAO,kBAAkB,OAAO,QAAQ;;CAE1C,cAAc,OAAO;AACnB,SAAO,uBAAuB,MAAM;;CAEtC,oBAAoB,OAAO;AACzB,SAAO,6BAA6B,MAAM;;CAE5C,iBAAiB,UAAU;AACzB,SAAO,0BAA0B,SAAS;;CAE5C,uBAAuB,UAAU;AAC/B,SAAO,gCAAgC,SAAS;;CAEnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils-D0ejTHeY.js","names":["z","documentEditorBaseOperationsActions"],"sources":["../document-models/document-editor/v1/gen/schema/zod.ts","../document-models/document-editor/v1/gen/base-operations/creators.ts","../document-models/document-editor/v1/actions.ts","../document-models/document-editor/v1/src/reducers/base-operations.ts","../document-models/document-editor/v1/gen/reducer.ts","../document-models/document-editor/v1/gen/document-type.ts","../document-models/document-editor/v1/gen/document-schema.ts","../document-models/document-editor/v1/gen/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddDocumentTypeInput,\n DocumentEditorState,\n DocumentTypeItem,\n RemoveDocumentTypeInput,\n SetEditorNameInput,\n SetEditorStatusInput,\n StatusType,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const StatusTypeSchema = z.enum([\"CONFIRMED\", \"DRAFT\"]);\n\nexport function AddDocumentTypeInputSchema(): z.ZodObject<\n Properties<AddDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function DocumentEditorStateSchema(): z.ZodObject<\n Properties<DocumentEditorState>\n> {\n return z.object({\n __typename: z.literal(\"DocumentEditorState\").optional(),\n documentTypes: z.array(z.lazy(() => DocumentTypeItemSchema())),\n name: z.string(),\n status: StatusTypeSchema,\n });\n}\n\nexport function DocumentTypeItemSchema(): z.ZodObject<\n Properties<DocumentTypeItem>\n> {\n return z.object({\n __typename: z.literal(\"DocumentTypeItem\").optional(),\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function RemoveDocumentTypeInputSchema(): z.ZodObject<\n Properties<RemoveDocumentTypeInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function SetEditorNameInputSchema(): z.ZodObject<\n Properties<SetEditorNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetEditorStatusInputSchema(): z.ZodObject<\n Properties<SetEditorStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetEditorNameInputSchema,\n SetEditorStatusInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddDocumentTypeInput,\n RemoveDocumentTypeInput,\n SetEditorNameInput,\n SetEditorStatusInput,\n} from \"../types.js\";\nimport type {\n AddDocumentTypeAction,\n RemoveDocumentTypeAction,\n SetEditorNameAction,\n SetEditorStatusAction,\n} from \"./actions.js\";\n\nexport const setEditorName = (input: SetEditorNameInput) =>\n createAction<SetEditorNameAction>(\n \"SET_EDITOR_NAME\",\n { ...input },\n undefined,\n SetEditorNameInputSchema,\n \"global\",\n );\n\nexport const addDocumentType = (input: AddDocumentTypeInput) =>\n createAction<AddDocumentTypeAction>(\n \"ADD_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n AddDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const removeDocumentType = (input: RemoveDocumentTypeInput) =>\n createAction<RemoveDocumentTypeAction>(\n \"REMOVE_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n RemoveDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const setEditorStatus = (input: SetEditorStatusInput) =>\n createAction<SetEditorStatusAction>(\n \"SET_EDITOR_STATUS\",\n { ...input },\n undefined,\n SetEditorStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport { documentEditorBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the DocumentEditor document model */\n\nexport const actions = {\n ...baseActions,\n ...documentEditorBaseOperationsActions,\n};\n","import type { DocumentEditorBaseOperationsOperations } from \"document-models/document-editor/v1\";\n\nexport const documentEditorBaseOperationsOperations: DocumentEditorBaseOperationsOperations =\n {\n setEditorNameOperation(state, action, _dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"Editor name cannot be empty\");\n }\n state.name = trimmedName;\n },\n addDocumentTypeOperation(state, action, _dispatch) {\n // Check for duplicate ID\n const existingId = state.documentTypes.find(\n (dt) => dt.id === action.input.id,\n );\n if (existingId) {\n throw new Error(\n `Document type with id \"${action.input.id}\" already exists`,\n );\n }\n\n state.documentTypes.push({\n id: action.input.id,\n documentType: action.input.documentType,\n });\n },\n removeDocumentTypeOperation(state, action, _dispatch) {\n state.documentTypes = state.documentTypes.filter(\n (documentType) => documentType.id !== action.input.id,\n );\n },\n setEditorStatusOperation(state, action, _dispatch) {\n state.status = action.input.status;\n },\n };\n","import type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { DocumentEditorPHState } from \"document-models/document-editor/v1\";\n\nimport { documentEditorBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetEditorNameInputSchema,\n SetEditorStatusInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<DocumentEditorPHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_EDITOR_NAME\": {\n SetEditorNameInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.setEditorNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_DOCUMENT_TYPE\": {\n AddDocumentTypeInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.addDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_DOCUMENT_TYPE\": {\n RemoveDocumentTypeInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.removeDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_EDITOR_STATUS\": {\n SetEditorStatusInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.setEditorStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<DocumentEditorPHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const documentEditorDocumentType = \"powerhouse/document-editor\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { documentEditorDocumentType } from \"./document-type.js\";\nimport { DocumentEditorStateSchema } from \"./schema/zod.js\";\nimport type { DocumentEditorDocument, DocumentEditorPHState } from \"./types.js\";\n\n/** Schema for validating the header object of a DocumentEditor document */\nexport const DocumentEditorDocumentHeaderSchema =\n BaseDocumentHeaderSchema.extend({\n documentType: z.literal(documentEditorDocumentType),\n });\n\n/** Schema for validating the state object of a DocumentEditor document */\nexport const DocumentEditorPHStateSchema = BaseDocumentStateSchema.extend({\n global: DocumentEditorStateSchema(),\n});\n\nexport const DocumentEditorDocumentSchema = z.object({\n header: DocumentEditorDocumentHeaderSchema,\n state: DocumentEditorPHStateSchema,\n initialState: DocumentEditorPHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a DocumentEditor document state object */\nexport function isDocumentEditorState(\n state: unknown,\n): state is DocumentEditorPHState {\n return DocumentEditorPHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a DocumentEditor document state object */\nexport function assertIsDocumentEditorState(\n state: unknown,\n): asserts state is DocumentEditorPHState {\n DocumentEditorPHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a DocumentEditor document */\nexport function isDocumentEditorDocument(\n document: unknown,\n): document is DocumentEditorDocument {\n return DocumentEditorDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a DocumentEditor document */\nexport function assertIsDocumentEditorDocument(\n document: unknown,\n): asserts document is DocumentEditorDocument {\n DocumentEditorDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInput,\n baseSaveToFileHandle,\n defaultBaseState,\n} from \"document-model\";\nimport {\n assertIsDocumentEditorDocument,\n assertIsDocumentEditorState,\n isDocumentEditorDocument,\n isDocumentEditorState,\n} from \"./document-schema.js\";\nimport { documentEditorDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n DocumentEditorGlobalState,\n DocumentEditorLocalState,\n DocumentEditorPHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: DocumentEditorGlobalState = {\n name: \"\",\n documentTypes: [],\n status: \"DRAFT\",\n};\nexport const initialLocalState: DocumentEditorLocalState = {};\n\nexport const utils: DocumentModelUtils<DocumentEditorPHState> = {\n fileExtension: \".editor\",\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(\n utils.createState,\n state,\n documentEditorDocumentType,\n );\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInput(input, reducer);\n },\n isStateOfType(state) {\n return isDocumentEditorState(state);\n },\n assertIsStateOfType(state) {\n return assertIsDocumentEditorState(state);\n },\n isDocumentOfType(document) {\n return isDocumentEditorDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsDocumentEditorDocument(document);\n },\n};\n"],"mappings":";;;;;AAmBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO;EACd,cAAcA,IAAE,QAAQ;EACxB,IAAIA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,CAAC;;AAGF,SAAgB,sBACd,OACgC;AAChC,QAAO,4BAA4B,UAAU,MAAM,CAAC;;;AAItD,SAAgB,4BACd,OACwC;AACxC,6BAA4B,MAAM,MAAM;;;AAI1C,SAAgB,yBACd,UACoC;AACpC,QAAO,6BAA6B,UAAU,SAAS,CAAC;;;AAI1D,SAAgB,+BACd,UAC4C;AAC5C,8BAA6B,MAAM,SAAS;;;;AC9B9C,MAAa,qBAAgD;CAC3D,MAAM;CACN,eAAe,EAAE;CACjB,QAAQ;CACT;AACD,MAAa,oBAA8C,EAAE;AAE7D,MAAa,QAAmD;CAC9D,eAAe;CACf,YAAY,OAAO;AACjB,SAAO;GACL,GAAG,kBAAkB;GACrB,QAAQ;IAAE,GAAG;IAAoB,GAAG,OAAO;IAAQ;GACnD,OAAO;IAAE,GAAG;IAAmB,GAAG,OAAO;IAAO;GACjD;;CAEH,eAAe,OAAO;AACpB,SAAO,mBACL,MAAM,aACN,OACA,2BACD;;CAEH,iBAAiB,UAAU,OAAO;AAChC,SAAO,qBAAqB,UAAU,MAAM;;CAE9C,cAAc,OAAO;AACnB,SAAO,kBAAkB,OAAO,QAAQ;;CAE1C,cAAc,OAAO;AACnB,SAAO,sBAAsB,MAAM;;CAErC,oBAAoB,OAAO;AACzB,SAAO,4BAA4B,MAAM;;CAE3C,iBAAiB,UAAU;AACzB,SAAO,yBAAyB,SAAS;;CAE3C,uBAAuB,UAAU;AAC/B,SAAO,+BAA+B,SAAS;;CAElD"}
1
+ {"version":3,"file":"utils-D0ejTHeY.js","names":["z","documentEditorBaseOperationsActions"],"sources":["../document-models/document-editor/v1/gen/schema/zod.ts","../document-models/document-editor/v1/gen/base-operations/creators.ts","../document-models/document-editor/v1/actions.ts","../document-models/document-editor/v1/src/reducers/base-operations.ts","../document-models/document-editor/v1/gen/reducer.ts","../document-models/document-editor/v1/gen/document-type.ts","../document-models/document-editor/v1/gen/document-schema.ts","../document-models/document-editor/v1/gen/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddDocumentTypeInput,\n DocumentEditorState,\n DocumentTypeItem,\n RemoveDocumentTypeInput,\n SetEditorNameInput,\n SetEditorStatusInput,\n StatusType,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const StatusTypeSchema = z.enum([\"CONFIRMED\", \"DRAFT\"]);\n\nexport function AddDocumentTypeInputSchema(): z.ZodObject<\n Properties<AddDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function DocumentEditorStateSchema(): z.ZodObject<\n Properties<DocumentEditorState>\n> {\n return z.object({\n __typename: z.literal(\"DocumentEditorState\").optional(),\n documentTypes: z.array(z.lazy(() => DocumentTypeItemSchema())),\n name: z.string(),\n status: StatusTypeSchema,\n });\n}\n\nexport function DocumentTypeItemSchema(): z.ZodObject<\n Properties<DocumentTypeItem>\n> {\n return z.object({\n __typename: z.literal(\"DocumentTypeItem\").optional(),\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function RemoveDocumentTypeInputSchema(): z.ZodObject<\n Properties<RemoveDocumentTypeInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function SetEditorNameInputSchema(): z.ZodObject<\n Properties<SetEditorNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetEditorStatusInputSchema(): z.ZodObject<\n Properties<SetEditorStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetEditorNameInputSchema,\n SetEditorStatusInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddDocumentTypeInput,\n RemoveDocumentTypeInput,\n SetEditorNameInput,\n SetEditorStatusInput,\n} from \"../types.js\";\nimport type {\n AddDocumentTypeAction,\n RemoveDocumentTypeAction,\n SetEditorNameAction,\n SetEditorStatusAction,\n} from \"./actions.js\";\n\nexport const setEditorName = (input: SetEditorNameInput) =>\n createAction<SetEditorNameAction>(\n \"SET_EDITOR_NAME\",\n { ...input },\n undefined,\n SetEditorNameInputSchema,\n \"global\",\n );\n\nexport const addDocumentType = (input: AddDocumentTypeInput) =>\n createAction<AddDocumentTypeAction>(\n \"ADD_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n AddDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const removeDocumentType = (input: RemoveDocumentTypeInput) =>\n createAction<RemoveDocumentTypeAction>(\n \"REMOVE_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n RemoveDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const setEditorStatus = (input: SetEditorStatusInput) =>\n createAction<SetEditorStatusAction>(\n \"SET_EDITOR_STATUS\",\n { ...input },\n undefined,\n SetEditorStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport { documentEditorBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the DocumentEditor document model */\n\nexport const actions = {\n ...baseActions,\n ...documentEditorBaseOperationsActions,\n};\n","import type { DocumentEditorBaseOperationsOperations } from \"document-models/document-editor/v1\";\n\nexport const documentEditorBaseOperationsOperations: DocumentEditorBaseOperationsOperations =\n {\n setEditorNameOperation(state, action, _dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"Editor name cannot be empty\");\n }\n state.name = trimmedName;\n },\n addDocumentTypeOperation(state, action, _dispatch) {\n // Check for duplicate ID\n const existingId = state.documentTypes.find(\n (dt) => dt.id === action.input.id,\n );\n if (existingId) {\n throw new Error(\n `Document type with id \"${action.input.id}\" already exists`,\n );\n }\n\n state.documentTypes.push({\n id: action.input.id,\n documentType: action.input.documentType,\n });\n },\n removeDocumentTypeOperation(state, action, _dispatch) {\n state.documentTypes = state.documentTypes.filter(\n (documentType) => documentType.id !== action.input.id,\n );\n },\n setEditorStatusOperation(state, action, _dispatch) {\n state.status = action.input.status;\n },\n };\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { DocumentEditorPHState } from \"document-models/document-editor/v1\";\n\nimport { documentEditorBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetEditorNameInputSchema,\n SetEditorStatusInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<DocumentEditorPHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_EDITOR_NAME\": {\n SetEditorNameInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.setEditorNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_DOCUMENT_TYPE\": {\n AddDocumentTypeInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.addDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_DOCUMENT_TYPE\": {\n RemoveDocumentTypeInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.removeDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_EDITOR_STATUS\": {\n SetEditorStatusInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.setEditorStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<DocumentEditorPHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const documentEditorDocumentType = \"powerhouse/document-editor\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { documentEditorDocumentType } from \"./document-type.js\";\nimport { DocumentEditorStateSchema } from \"./schema/zod.js\";\nimport type { DocumentEditorDocument, DocumentEditorPHState } from \"./types.js\";\n\n/** Schema for validating the header object of a DocumentEditor document */\nexport const DocumentEditorDocumentHeaderSchema =\n BaseDocumentHeaderSchema.extend({\n documentType: z.literal(documentEditorDocumentType),\n });\n\n/** Schema for validating the state object of a DocumentEditor document */\nexport const DocumentEditorPHStateSchema = BaseDocumentStateSchema.extend({\n global: DocumentEditorStateSchema(),\n});\n\nexport const DocumentEditorDocumentSchema = z.object({\n header: DocumentEditorDocumentHeaderSchema,\n state: DocumentEditorPHStateSchema,\n initialState: DocumentEditorPHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a DocumentEditor document state object */\nexport function isDocumentEditorState(\n state: unknown,\n): state is DocumentEditorPHState {\n return DocumentEditorPHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a DocumentEditor document state object */\nexport function assertIsDocumentEditorState(\n state: unknown,\n): asserts state is DocumentEditorPHState {\n DocumentEditorPHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a DocumentEditor document */\nexport function isDocumentEditorDocument(\n document: unknown,\n): document is DocumentEditorDocument {\n return DocumentEditorDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a DocumentEditor document */\nexport function assertIsDocumentEditorDocument(\n document: unknown,\n): asserts document is DocumentEditorDocument {\n DocumentEditorDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInput,\n baseSaveToFileHandle,\n defaultBaseState,\n} from \"document-model\";\nimport {\n assertIsDocumentEditorDocument,\n assertIsDocumentEditorState,\n isDocumentEditorDocument,\n isDocumentEditorState,\n} from \"./document-schema.js\";\nimport { documentEditorDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n DocumentEditorGlobalState,\n DocumentEditorLocalState,\n DocumentEditorPHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: DocumentEditorGlobalState = {\n name: \"\",\n documentTypes: [],\n status: \"DRAFT\",\n};\nexport const initialLocalState: DocumentEditorLocalState = {};\n\nexport const utils: DocumentModelUtils<DocumentEditorPHState> = {\n fileExtension: \".editor\",\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(\n utils.createState,\n state,\n documentEditorDocumentType,\n );\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInput(input, reducer);\n },\n isStateOfType(state) {\n return isDocumentEditorState(state);\n },\n assertIsStateOfType(state) {\n return assertIsDocumentEditorState(state);\n },\n isDocumentOfType(document) {\n return isDocumentEditorDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsDocumentEditorDocument(document);\n },\n};\n"],"mappings":";;;;;AAmBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,O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