@powerhousedao/powerhouse-vetra-packages 6.2.2-dev.7 → 6.2.2-dev.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/assets/{entry-Cvoo4_c9.js → entry-BBghrmE1.js} +3 -2
- package/dist/browser/assets/{projection-entry-DVec8YRh.js → projection-entry-BtmaPdIp.js} +4 -4
- package/dist/browser/{linting-Dn6pXRkK.js → button-CuO8Gh3v.js} +20 -6
- package/dist/browser/button-CuO8Gh3v.js.map +1 -0
- package/dist/browser/{connect-KEU-HR3o.js → connect-DmCpI0kg.js} +916 -200
- package/dist/browser/connect-DmCpI0kg.js.map +1 -0
- package/dist/browser/{dist-CXoKspdx.js → dist-B4FWbuEM.js} +10 -2
- package/dist/browser/{dist-CXoKspdx.js.map → dist-B4FWbuEM.js.map} +1 -1
- package/dist/{node/dist-BeZaEP6S.mjs → browser/dist-BAJ5nRDl.js} +21 -2
- package/dist/browser/{dist-D8H48e8N.js.map → dist-BAJ5nRDl.js.map} +1 -1
- package/dist/browser/{dist-D5ra2aRj.js → dist-DfoAQf6g.js} +1617 -1293
- package/dist/browser/dist-DfoAQf6g.js.map +1 -0
- package/dist/browser/{document-drive-IdFV1QXL.js → document-drive-D6XhjHzr.js} +1184 -122
- package/dist/browser/document-drive-D6XhjHzr.js.map +1 -0
- package/dist/browser/document-models/index.js +1 -1
- package/dist/browser/{documents-D4ek7Ubv.js → documents-J_l59mSV.js} +5 -604
- package/dist/browser/documents-J_l59mSV.js.map +1 -0
- package/dist/browser/editor-C069kNOj.js +25 -0
- package/dist/browser/editor-C069kNOj.js.map +1 -0
- package/dist/browser/{editor-DiZF3ao3.js → editor-XlOiVjqp.js} +671 -236
- package/dist/browser/editor-XlOiVjqp.js.map +1 -0
- package/dist/browser/editors/document-model-editor/module.js +1 -1
- package/dist/browser/editors/generic-drive-explorer/index.js +5 -5
- package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
- package/dist/{node/folder-view-Cy-QxsDg.mjs → browser/folder-view-B4b9Ik-G.js} +73 -46
- package/dist/browser/folder-view-B4b9Ik-G.js.map +1 -0
- package/dist/browser/{graphql-editor-ZLRO_8Ce.js → graphql-editor-BDze7_wI.js} +8 -7
- package/dist/browser/{graphql-editor-ZLRO_8Ce.js.map → graphql-editor-BDze7_wI.js.map} +1 -1
- package/dist/browser/{hooks-CORHBNHb.js → hooks-KKcNp2X0.js} +2 -2
- package/dist/browser/{hooks-CORHBNHb.js.map → hooks-KKcNp2X0.js.map} +1 -1
- package/dist/browser/index.js +378 -9
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{json-editor-DBuZ6gN7.js → json-editor-nI61gbA-.js} +4 -4
- package/dist/browser/{json-editor-DBuZ6gN7.js.map → json-editor-nI61gbA-.js.map} +1 -1
- package/dist/browser/{lib-C-f3izXz.js → lib-CE5V8jW5.js} +13 -4
- package/dist/browser/lib-CE5V8jW5.js.map +1 -0
- package/dist/browser/printer-CEYr4JOg.js +604 -0
- package/dist/browser/printer-CEYr4JOg.js.map +1 -0
- package/dist/browser/{schema-context-DY-GEGnY.js → schema-context-ZyeclQwy.js} +2 -2
- package/dist/browser/{schema-context-DY-GEGnY.js.map → schema-context-ZyeclQwy.js.map} +1 -1
- package/dist/browser/{state-schemas-BjQKM498.js → state-schemas-DvpLHgMU.js} +8 -18
- package/dist/browser/state-schemas-DvpLHgMU.js.map +1 -0
- package/dist/node/{linting-Dx50GuLN.mjs → button-Da7CxMn7.mjs} +20 -7
- package/dist/node/button-Da7CxMn7.mjs.map +1 -0
- package/dist/node/{connect-KcYZcy_Z.mjs → connect-BOwTtHRq.mjs} +916 -200
- package/dist/node/connect-BOwTtHRq.mjs.map +1 -0
- package/dist/node/{dist-DJEK2WVi.mjs → dist-CRrgpr8A.mjs} +1621 -1292
- package/dist/node/dist-CRrgpr8A.mjs.map +1 -0
- package/dist/{browser/dist-D8H48e8N.js → node/dist-CzYOpeXN.mjs} +21 -2
- package/dist/node/{dist-BeZaEP6S.mjs.map → dist-CzYOpeXN.mjs.map} +1 -1
- package/dist/node/{dist-fA4EItr0.mjs → dist-DT7jI9ol.mjs} +10 -2
- package/dist/node/{dist-fA4EItr0.mjs.map → dist-DT7jI9ol.mjs.map} +1 -1
- package/dist/node/{document-drive-C8hbqQ3C.mjs → document-drive-B65n0lIk.mjs} +1184 -122
- package/dist/node/document-drive-B65n0lIk.mjs.map +1 -0
- package/dist/node/document-models/index.mjs +1 -1
- package/dist/node/{documents-BFBPmyw1.mjs → documents-DCf53bzO.mjs} +3 -3
- package/dist/node/{documents-BFBPmyw1.mjs.map → documents-DCf53bzO.mjs.map} +1 -1
- package/dist/node/{editor-B1KhoF1f.mjs → editor-BGcLm6LA.mjs} +672 -237
- package/dist/node/editor-BGcLm6LA.mjs.map +1 -0
- package/dist/node/editor-DIiXhhl2.mjs +25 -0
- package/dist/node/editor-DIiXhhl2.mjs.map +1 -0
- package/dist/node/editors/document-model-editor/module.mjs +1 -1
- package/dist/node/editors/generic-drive-explorer/index.mjs +5 -5
- package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
- package/dist/{browser/folder-view-DMFqcJhc.js → node/folder-view-DyijTEeD.mjs} +73 -46
- package/dist/node/folder-view-DyijTEeD.mjs.map +1 -0
- package/dist/node/{graphql-DskHmkMe.mjs → graphql-BfAoPeWM.mjs} +2 -2
- package/dist/node/{graphql-DskHmkMe.mjs.map → graphql-BfAoPeWM.mjs.map} +1 -1
- package/dist/node/{graphql-editor-C5VLRqEf.mjs → graphql-editor-5YU1uHpd.mjs} +7 -7
- package/dist/node/{graphql-editor-C5VLRqEf.mjs.map → graphql-editor-5YU1uHpd.mjs.map} +1 -1
- package/dist/node/{hooks-DJrjfVaS.mjs → hooks-D0DcS3MV.mjs} +2 -2
- package/dist/node/{hooks-DJrjfVaS.mjs.map → hooks-D0DcS3MV.mjs.map} +1 -1
- package/dist/node/index.mjs +378 -9
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{json-editor-iI2s9a_4.mjs → json-editor-iuJkZEgS.mjs} +4 -4
- package/dist/node/{json-editor-iI2s9a_4.mjs.map → json-editor-iuJkZEgS.mjs.map} +1 -1
- package/dist/node/{main-D82dkD7g.mjs → main-B5JSm6Hi.mjs} +15 -6
- package/dist/node/main-B5JSm6Hi.mjs.map +1 -0
- package/dist/node/{schema-context-CX5ml_9t.mjs → schema-context-DL8jhi_d.mjs} +3 -3
- package/dist/node/{schema-context-CX5ml_9t.mjs.map → schema-context-DL8jhi_d.mjs.map} +1 -1
- package/dist/node/{state-schemas-Bl7nA8bB.mjs → state-schemas-DHQAxfto.mjs} +10 -20
- package/dist/{browser/state-schemas-BjQKM498.js.map → node/state-schemas-DHQAxfto.mjs.map} +1 -1
- package/package.json +8 -7
- package/dist/browser/connect-KEU-HR3o.js.map +0 -1
- package/dist/browser/dist-D5ra2aRj.js.map +0 -1
- package/dist/browser/document-drive-IdFV1QXL.js.map +0 -1
- package/dist/browser/documents-D4ek7Ubv.js.map +0 -1
- package/dist/browser/editor-DiZF3ao3.js.map +0 -1
- package/dist/browser/editor-SqNULDP-.js +0 -29
- package/dist/browser/editor-SqNULDP-.js.map +0 -1
- package/dist/browser/folder-view-DMFqcJhc.js.map +0 -1
- package/dist/browser/lib-C-f3izXz.js.map +0 -1
- package/dist/browser/linting-Dn6pXRkK.js.map +0 -1
- package/dist/node/connect-KcYZcy_Z.mjs.map +0 -1
- package/dist/node/dist-DJEK2WVi.mjs.map +0 -1
- package/dist/node/document-drive-C8hbqQ3C.mjs.map +0 -1
- package/dist/node/editor-B1KhoF1f.mjs.map +0 -1
- package/dist/node/editor-yBGEvMGD.mjs +0 -29
- package/dist/node/editor-yBGEvMGD.mjs.map +0 -1
- package/dist/node/folder-view-Cy-QxsDg.mjs.map +0 -1
- package/dist/node/linting-Dx50GuLN.mjs.map +0 -1
- package/dist/node/main-D82dkD7g.mjs.map +0 -1
- package/dist/node/state-schemas-Bl7nA8bB.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["manifestJson"],"sources":["../../powerhouse.manifest.json","../../../reactor-drive/dist/index.js","../../document-models/document-models.ts","../../editors/editors.ts","../../index.ts"],"sourcesContent":["","import { baseCreateDocument, baseLoadFromInput, baseSaveToFileHandle, createPresignedHeader, createReducer, createState, defaultBaseState, generateId, isDocumentAction, replayDocumentVersioned } from \"@powerhousedao/shared/document-model\";\nimport { Migrator, sql } from \"kysely\";\nimport { BaseReadModel, addRelationshipAction, createDocumentAction, removeRelationshipAction, upgradeDocumentAction } from \"@powerhousedao/reactor\";\nimport { gql } from \"graphql-tag\";\n//#region \\0rolldown/runtime.js\nvar __defProp = Object.defineProperty;\nvar __exportAll = (all, no_symbols) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\tif (!no_symbols) __defProp(target, Symbol.toStringTag, { value: \"Module\" });\n\treturn target;\n};\n//#endregion\n//#region src/constants.ts\nconst REACTOR_DRIVE_DOCUMENT_TYPE = \"powerhouse/reactor-drive\";\nconst DRIVE_CHILD_RELATIONSHIP_TYPE = \"drive/child\";\nconst REACTOR_DRIVE_FILE_EXTENSION = \"phrd\";\n//#endregion\n//#region src/actions.ts\nfunction setDriveNameAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"SET_DRIVE_NAME\",\n\t\tscope: \"global\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction setDriveIconAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"SET_DRIVE_ICON\",\n\t\tscope: \"global\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction setSharingTypeAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"SET_SHARING_TYPE\",\n\t\tscope: \"local\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction setAvailableOfflineAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"SET_AVAILABLE_OFFLINE\",\n\t\tscope: \"local\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction addFolderAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"ADD_FOLDER\",\n\t\tscope: \"document\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction updateFolderAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"UPDATE_FOLDER\",\n\t\tscope: \"document\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction removeFolderAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"REMOVE_FOLDER\",\n\t\tscope: \"document\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nconst reactorDriveActions = {\n\tsetDriveName: setDriveNameAction,\n\tsetDriveIcon: setDriveIconAction,\n\tsetSharingType: setSharingTypeAction,\n\tsetAvailableOffline: setAvailableOfflineAction,\n\taddFolder: addFolderAction,\n\tupdateFolder: updateFolderAction,\n\tremoveFolder: removeFolderAction\n};\n//#endregion\n//#region src/reducer/drive.ts\nconst reactorDriveStateReducer = (state, action) => {\n\tif (isDocumentAction(action)) return state;\n\tconst typedAction = action;\n\tswitch (typedAction.type) {\n\t\tcase \"SET_DRIVE_NAME\": {\n\t\t\tconst input = typedAction.input;\n\t\t\tstate.global.name = input.name;\n\t\t\treturn state;\n\t\t}\n\t\tcase \"SET_DRIVE_ICON\": {\n\t\t\tconst input = typedAction.input;\n\t\t\tstate.global.icon = input.icon;\n\t\t\treturn state;\n\t\t}\n\t\tcase \"SET_SHARING_TYPE\": {\n\t\t\tconst input = typedAction.input;\n\t\t\tstate.local.sharingType = input.sharingType;\n\t\t\treturn state;\n\t\t}\n\t\tcase \"SET_AVAILABLE_OFFLINE\": {\n\t\t\tconst input = typedAction.input;\n\t\t\tstate.local.availableOffline = input.availableOffline;\n\t\t\treturn state;\n\t\t}\n\t\tcase \"ADD_FOLDER\":\n\t\tcase \"UPDATE_FOLDER\":\n\t\tcase \"REMOVE_FOLDER\": return state;\n\t\tdefault: return state;\n\t}\n};\n//#endregion\n//#region src/module.ts\nconst initialGlobalState = {\n\tname: \"\",\n\ticon: null\n};\nconst initialLocalState = {\n\tsharingType: \"private\",\n\tavailableOffline: false\n};\nconst reactorDriveCreateState = (state) => {\n\treturn {\n\t\t...defaultBaseState(),\n\t\tglobal: {\n\t\t\t...initialGlobalState,\n\t\t\t...state?.global\n\t\t},\n\t\tlocal: {\n\t\t\t...initialLocalState,\n\t\t\t...state?.local\n\t\t}\n\t};\n};\nconst reactorDriveCreateDocument = (state) => {\n\treturn baseCreateDocument(reactorDriveCreateState, state, REACTOR_DRIVE_DOCUMENT_TYPE);\n};\nconst reactorDriveSaveToFileHandle = (document, input) => {\n\treturn baseSaveToFileHandle(document, input);\n};\nconst reactorDriveLoadFromInput = (input) => {\n\treturn baseLoadFromInput(input, reactorDriveDocumentReducer);\n};\nconst isReactorDriveState = (state) => {\n\treturn typeof state === \"object\" && state !== null && \"global\" in state && \"local\" in state;\n};\nconst assertIsReactorDriveState = (state) => {\n\tif (!isReactorDriveState(state)) throw new Error(\"Not a reactor-drive state\");\n};\nconst isReactorDriveDocument = (document) => {\n\treturn typeof document === \"object\" && document !== null && \"header\" in document && document.header.documentType === \"powerhouse/reactor-drive\";\n};\nconst assertIsReactorDriveDocument = (document) => {\n\tif (!isReactorDriveDocument(document)) throw new Error(\"Not a reactor-drive document\");\n};\nconst reactorDriveDocumentReducer = createReducer(reactorDriveStateReducer);\nconst reactorDriveDocumentGlobalState = {\n\tid: REACTOR_DRIVE_DOCUMENT_TYPE,\n\tname: \"ReactorDrive\",\n\textension: REACTOR_DRIVE_FILE_EXTENSION,\n\tdescription: \"\",\n\tauthor: {\n\t\tname: \"Powerhouse Inc\",\n\t\twebsite: \"https://www.powerhouse.inc/\"\n\t},\n\tspecifications: [{\n\t\tversion: 1,\n\t\tchangeLog: [],\n\t\tstate: {\n\t\t\tglobal: {\n\t\t\t\tschema: \"type ReactorDriveState {\\n name: String!\\n icon: String\\n}\",\n\t\t\t\tinitialValue: JSON.stringify(JSON.stringify(initialGlobalState)),\n\t\t\t\texamples: []\n\t\t\t},\n\t\t\tlocal: {\n\t\t\t\tschema: \"type ReactorDriveLocalState {\\n sharingType: String!\\n availableOffline: Boolean!\\n}\",\n\t\t\t\tinitialValue: JSON.stringify(JSON.stringify(initialLocalState)),\n\t\t\t\texamples: []\n\t\t\t}\n\t\t},\n\t\tmodules: [{\n\t\t\tid: \"reactor-drive/base-operations\",\n\t\t\tname: \"base_operations\",\n\t\t\tdescription: \"\",\n\t\t\toperations: [\n\t\t\t\t{\n\t\t\t\t\tid: \"SET_DRIVE_NAME\",\n\t\t\t\t\tname: \"SET_DRIVE_NAME\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input SetDriveNameInput { name: String! }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"global\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"SET_DRIVE_ICON\",\n\t\t\t\t\tname: \"SET_DRIVE_ICON\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input SetDriveIconInput { icon: String }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"global\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"SET_SHARING_TYPE\",\n\t\t\t\t\tname: \"SET_SHARING_TYPE\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input SetSharingTypeInput { sharingType: String! }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"local\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"SET_AVAILABLE_OFFLINE\",\n\t\t\t\t\tname: \"SET_AVAILABLE_OFFLINE\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input SetAvailableOfflineInput { availableOffline: Boolean! }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"local\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"ADD_FOLDER\",\n\t\t\t\t\tname: \"ADD_FOLDER\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input AddFolderInput { folderId: String! parentFolderId: String name: String! }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"document\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"UPDATE_FOLDER\",\n\t\t\t\t\tname: \"UPDATE_FOLDER\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input UpdateFolderInput { folderId: String! name: String parentFolderId: String }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"document\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"REMOVE_FOLDER\",\n\t\t\t\t\tname: \"REMOVE_FOLDER\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input RemoveFolderInput { folderId: String! }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"document\"\n\t\t\t\t}\n\t\t\t]\n\t\t}]\n\t}]\n};\nconst reactorDriveDocumentModelModule = {\n\tactions: reactorDriveActions,\n\treducer: reactorDriveDocumentReducer,\n\tdocumentModel: createState(defaultBaseState(), reactorDriveDocumentGlobalState),\n\tutils: {\n\t\tfileExtension: REACTOR_DRIVE_FILE_EXTENSION,\n\t\tcreateState: reactorDriveCreateState,\n\t\tcreateDocument: reactorDriveCreateDocument,\n\t\tloadFromInput: reactorDriveLoadFromInput,\n\t\tsaveToFileHandle: reactorDriveSaveToFileHandle,\n\t\tisStateOfType: isReactorDriveState,\n\t\tassertIsStateOfType: assertIsReactorDriveState,\n\t\tisDocumentOfType: isReactorDriveDocument,\n\t\tassertIsDocumentOfType: assertIsReactorDriveDocument\n\t}\n};\n//#endregion\n//#region src/schema/migrations/0001_drive_node.ts\nvar _0001_drive_node_exports = /* @__PURE__ */ __exportAll({\n\tdown: () => down$1,\n\tup: () => up$1\n});\nasync function up$1(db) {\n\tawait db.schema.createTable(\"DriveNode\").ifNotExists().addColumn(\"driveId\", \"text\", (col) => col.notNull()).addColumn(\"id\", \"text\", (col) => col.notNull()).addColumn(\"kind\", \"text\", (col) => col.notNull()).addColumn(\"name\", \"text\", (col) => col.notNull()).addColumn(\"requestedName\", \"text\", (col) => col.notNull()).addColumn(\"parentFolder\", \"text\").addColumn(\"documentType\", \"text\").addColumn(\"createdAt\", \"timestamptz\", (col) => col.notNull().defaultTo(sql`NOW()`)).addColumn(\"updatedAt\", \"timestamptz\", (col) => col.notNull().defaultTo(sql`NOW()`)).addPrimaryKeyConstraint(\"pk_drive_node\", [\"driveId\", \"id\"]).addCheckConstraint(\"chk_drive_node_document_type\", sql`(kind = 'file' AND \"documentType\" IS NOT NULL) OR (kind = 'folder' AND \"documentType\" IS NULL)`).execute();\n\tawait db.schema.createIndex(\"idx_drive_node_parent_name\").ifNotExists().on(\"DriveNode\").columns([\n\t\t\"driveId\",\n\t\t\"parentFolder\",\n\t\t\"name\"\n\t]).execute();\n\tawait db.schema.createIndex(\"idx_drive_node_parent_kind_id\").ifNotExists().on(\"DriveNode\").columns([\n\t\t\"driveId\",\n\t\t\"parentFolder\",\n\t\t\"kind\",\n\t\t\"id\"\n\t]).execute();\n}\nasync function down$1(db) {\n\tawait db.schema.dropTable(\"DriveNode\").execute();\n}\n//#endregion\n//#region src/schema/migrations/0002_document_name.ts\nvar _0002_document_name_exports = /* @__PURE__ */ __exportAll({\n\tdown: () => down,\n\tup: () => up\n});\nasync function up(db) {\n\tawait db.schema.createTable(\"DocumentName\").ifNotExists().addColumn(\"docId\", \"text\", (col) => col.primaryKey()).addColumn(\"name\", \"text\", (col) => col.notNull()).addColumn(\"updatedAt\", \"timestamptz\", (col) => col.notNull().defaultTo(sql`NOW()`)).execute();\n}\nasync function down(db) {\n\tawait db.schema.dropTable(\"DocumentName\").execute();\n}\n//#endregion\n//#region src/schema/migrations/migrator.ts\nconst migrations = {\n\t\"0001_drive_node\": _0001_drive_node_exports,\n\t\"0002_document_name\": _0002_document_name_exports\n};\nconst REACTOR_DRIVE_MIGRATION_TABLE = \"kysely_migration_reactor_drive\";\nconst REACTOR_DRIVE_MIGRATION_LOCK_TABLE = \"kysely_migration_reactor_drive_lock\";\nvar ProgrammaticMigrationProvider = class {\n\tgetMigrations() {\n\t\treturn Promise.resolve(migrations);\n\t}\n};\nasync function runReactorDriveMigrations(db, schema) {\n\ttry {\n\t\tawait sql`CREATE SCHEMA IF NOT EXISTS ${sql.id(schema)}`.execute(db);\n\t} catch (error) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tmigrationsExecuted: [],\n\t\t\terror: error instanceof Error ? error : /* @__PURE__ */ new Error(\"Failed to create schema\")\n\t\t};\n\t}\n\tconst migrator = new Migrator({\n\t\tdb: db.withSchema(schema),\n\t\tprovider: new ProgrammaticMigrationProvider(),\n\t\tmigrationTableSchema: schema,\n\t\tmigrationTableName: REACTOR_DRIVE_MIGRATION_TABLE,\n\t\tmigrationLockTableName: REACTOR_DRIVE_MIGRATION_LOCK_TABLE\n\t});\n\tlet error;\n\tlet results;\n\ttry {\n\t\tconst result = await migrator.migrateToLatest();\n\t\terror = result.error;\n\t\tresults = result.results;\n\t} catch (e) {\n\t\terror = e;\n\t\tresults = [];\n\t}\n\tconst migrationsExecuted = results?.map((result) => result.migrationName) ?? [];\n\tif (error) return {\n\t\tsuccess: false,\n\t\tmigrationsExecuted,\n\t\terror: error instanceof Error ? error : /* @__PURE__ */ new Error(\"Unknown migration error\")\n\t};\n\treturn {\n\t\tsuccess: true,\n\t\tmigrationsExecuted\n\t};\n}\nasync function getReactorDriveMigrationStatus(db, schema) {\n\treturn await new Migrator({\n\t\tdb: db.withSchema(schema),\n\t\tprovider: new ProgrammaticMigrationProvider(),\n\t\tmigrationTableSchema: schema,\n\t\tmigrationTableName: REACTOR_DRIVE_MIGRATION_TABLE,\n\t\tmigrationLockTableName: REACTOR_DRIVE_MIGRATION_LOCK_TABLE\n\t}).getMigrations();\n}\n//#endregion\n//#region src/processors/utils/collisions.ts\n/**\n* Deterministic per-folder name collision rule. Given a desired name and the\n* set of names already taken by siblings, returns the next available name as\n* `requested`, `requested (2)`, `requested (3)`, etc.\n*\n* The rule matches the legacy document-drive module so that migration from\n* the legacy state produces stable suffixes.\n*/\nfunction resolveCollision(requested, takenNames) {\n\tconst taken = /* @__PURE__ */ new Set();\n\tfor (const name of takenNames) taken.add(name);\n\tif (!taken.has(requested)) return requested;\n\tlet suffix = 2;\n\twhile (taken.has(`${requested} (${suffix})`)) suffix += 1;\n\treturn `${requested} (${suffix})`;\n}\n//#endregion\n//#region src/processors/node-processor.ts\nconst NAME_ACTION_TYPES = new Set([\n\t\"CREATE_DOCUMENT\",\n\t\"UPGRADE_DOCUMENT\",\n\t\"SET_NAME\"\n]);\nconst STRUCTURE_ACTION_TYPES = new Set([\n\t\"ADD_RELATIONSHIP\",\n\t\"REMOVE_RELATIONSHIP\",\n\t\"ADD_FOLDER\",\n\t\"UPDATE_FOLDER\",\n\t\"REMOVE_FOLDER\"\n]);\nvar NodeProcessor = class extends BaseReadModel {\n\tdriveDb;\n\tbaseDb;\n\tschema;\n\tconstructor(baseDb, schema, operationIndex, writeCache, consistencyTracker) {\n\t\tconst scopedDb = baseDb.withSchema(schema);\n\t\tsuper(scopedDb, operationIndex, writeCache, consistencyTracker, {\n\t\t\treadModelId: \"reactor-drive-node-processor\",\n\t\t\trebuildStateOnInit: false\n\t\t});\n\t\tthis.driveDb = scopedDb;\n\t\tthis.baseDb = baseDb;\n\t\tthis.schema = schema;\n\t}\n\tasync init() {\n\t\tconst result = await runReactorDriveMigrations(this.baseDb, this.schema);\n\t\tif (!result.success && result.error) throw new Error(`Reactor drive migrations failed: ${result.error.message}`);\n\t\tawait super.init();\n\t}\n\tasync commitOperations(items) {\n\t\tawait this.driveDb.transaction().execute(async (trx) => {\n\t\t\tfor (const item of items) {\n\t\t\t\tconst actionType = item.operation.action.type;\n\t\t\t\tif (NAME_ACTION_TYPES.has(actionType)) {\n\t\t\t\t\tawait this.applyNameOperation(trx, item);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (STRUCTURE_ACTION_TYPES.has(actionType)) {\n\t\t\t\t\tawait this.applyStructureOperation(trx, item);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (actionType === \"DELETE_DOCUMENT\") await this.applyDeleteDocument(trx, item);\n\t\t\t}\n\t\t});\n\t}\n\tasync applyNameOperation(trx, item) {\n\t\tconst action = item.operation.action;\n\t\tconst docId = item.context.documentId;\n\t\tlet name;\n\t\tif (action.type === \"CREATE_DOCUMENT\") name = action.input.name;\n\t\telse if (action.type === \"UPGRADE_DOCUMENT\") name = (action.input.initialState ?? {}).header?.name;\n\t\telse if (action.type === \"SET_NAME\") name = action.input.name;\n\t\tif (name === void 0) return;\n\t\tawait this.upsertDocumentName(trx, docId, name);\n\t\tconst linkedRows = await trx.selectFrom(\"DriveNode\").selectAll().where(\"id\", \"=\", docId).where(\"kind\", \"=\", \"file\").execute();\n\t\tfor (const row of linkedRows) {\n\t\t\tconst resolved = await this.resolveSiblingName(trx, row.driveId, row.parentFolder, name, docId);\n\t\t\tawait trx.updateTable(\"DriveNode\").set({\n\t\t\t\tname: resolved,\n\t\t\t\trequestedName: name,\n\t\t\t\tupdatedAt: /* @__PURE__ */ new Date()\n\t\t\t}).where(\"driveId\", \"=\", row.driveId).where(\"id\", \"=\", docId).execute();\n\t\t}\n\t}\n\tasync applyStructureOperation(trx, item) {\n\t\tif (item.context.documentType !== \"powerhouse/reactor-drive\") return;\n\t\tconst action = item.operation.action;\n\t\tconst driveId = item.context.documentId;\n\t\tif (action.type === \"ADD_RELATIONSHIP\") {\n\t\t\tconst input = action.input;\n\t\t\tif (input.relationshipType !== \"drive/child\") return;\n\t\t\tawait this.handleAddFileRelationship(trx, driveId, input);\n\t\t\treturn;\n\t\t}\n\t\tif (action.type === \"REMOVE_RELATIONSHIP\") {\n\t\t\tconst input = action.input;\n\t\t\tif (input.relationshipType !== \"drive/child\") return;\n\t\t\tawait trx.deleteFrom(\"DriveNode\").where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", input.targetId).execute();\n\t\t\treturn;\n\t\t}\n\t\tif (action.type === \"ADD_FOLDER\") {\n\t\t\tawait this.handleAddFolder(trx, driveId, action.input);\n\t\t\treturn;\n\t\t}\n\t\tif (action.type === \"UPDATE_FOLDER\") {\n\t\t\tawait this.handleUpdateFolder(trx, driveId, action.input);\n\t\t\treturn;\n\t\t}\n\t\tif (action.type === \"REMOVE_FOLDER\") {\n\t\t\tconst input = action.input;\n\t\t\tawait trx.deleteFrom(\"DriveNode\").where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", input.folderId).execute();\n\t\t}\n\t}\n\tasync applyDeleteDocument(trx, item) {\n\t\tconst docId = item.operation.action.input.documentId || item.context.documentId;\n\t\tawait trx.deleteFrom(\"DriveNode\").where(\"id\", \"=\", docId).execute();\n\t\tawait trx.deleteFrom(\"DocumentName\").where(\"docId\", \"=\", docId).execute();\n\t}\n\tasync handleAddFileRelationship(trx, driveId, input) {\n\t\tconst metadata = this.parseFileMetadata(input);\n\t\tconst parentFolder = metadata.parentFolderId ?? null;\n\t\tconst documentType = metadata.documentType;\n\t\tconst requestedName = await this.lookupDocumentName(trx, input.targetId) ?? \"\";\n\t\tconst resolved = await this.resolveSiblingName(trx, driveId, parentFolder, requestedName, input.targetId);\n\t\tawait trx.insertInto(\"DriveNode\").values({\n\t\t\tdriveId,\n\t\t\tid: input.targetId,\n\t\t\tkind: \"file\",\n\t\t\tname: resolved,\n\t\t\trequestedName,\n\t\t\tparentFolder,\n\t\t\tdocumentType\n\t\t}).onConflict((oc) => oc.columns([\"driveId\", \"id\"]).doUpdateSet({\n\t\t\tparentFolder,\n\t\t\tname: resolved,\n\t\t\trequestedName,\n\t\t\tkind: \"file\",\n\t\t\tdocumentType,\n\t\t\tupdatedAt: /* @__PURE__ */ new Date()\n\t\t})).execute();\n\t}\n\tasync handleAddFolder(trx, driveId, input) {\n\t\tconst parentFolder = input.parentFolderId ?? null;\n\t\tconst resolved = await this.resolveSiblingName(trx, driveId, parentFolder, input.name, input.folderId);\n\t\tawait trx.insertInto(\"DriveNode\").values({\n\t\t\tdriveId,\n\t\t\tid: input.folderId,\n\t\t\tkind: \"folder\",\n\t\t\tname: resolved,\n\t\t\trequestedName: input.name,\n\t\t\tparentFolder,\n\t\t\tdocumentType: null\n\t\t}).onConflict((oc) => oc.columns([\"driveId\", \"id\"]).doUpdateSet({\n\t\t\tparentFolder,\n\t\t\tname: resolved,\n\t\t\trequestedName: input.name,\n\t\t\tkind: \"folder\",\n\t\t\tdocumentType: null,\n\t\t\tupdatedAt: /* @__PURE__ */ new Date()\n\t\t})).execute();\n\t}\n\tasync handleUpdateFolder(trx, driveId, input) {\n\t\tconst row = await trx.selectFrom(\"DriveNode\").selectAll().where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", input.folderId).executeTakeFirst();\n\t\tif (!row) return;\n\t\tconst nextParentFolder = input.parentFolderId === void 0 ? row.parentFolder : input.parentFolderId ?? null;\n\t\tconst nextRequestedName = typeof input.name === \"string\" ? input.name : row.requestedName;\n\t\tconst resolved = await this.resolveSiblingName(trx, driveId, nextParentFolder, nextRequestedName, input.folderId);\n\t\tawait trx.updateTable(\"DriveNode\").set({\n\t\t\tparentFolder: nextParentFolder,\n\t\t\tname: resolved,\n\t\t\trequestedName: nextRequestedName,\n\t\t\tupdatedAt: /* @__PURE__ */ new Date()\n\t\t}).where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", input.folderId).execute();\n\t}\n\tasync resolveSiblingName(trx, driveId, parentFolder, requested, excludeId) {\n\t\tlet query = trx.selectFrom(\"DriveNode\").select(\"name\").where(\"driveId\", \"=\", driveId).where(\"id\", \"!=\", excludeId);\n\t\tquery = parentFolder === null ? query.where(\"parentFolder\", \"is\", null) : query.where(\"parentFolder\", \"=\", parentFolder);\n\t\treturn resolveCollision(requested, (await query.execute()).map((r) => r.name));\n\t}\n\tasync lookupDocumentName(trx, docId) {\n\t\treturn (await trx.selectFrom(\"DocumentName\").select(\"name\").where(\"docId\", \"=\", docId).executeTakeFirst())?.name;\n\t}\n\tparseFileMetadata(input) {\n\t\tconst metadata = input.metadata;\n\t\tif (!metadata || typeof metadata !== \"object\" || metadata.kind !== \"file\" || typeof metadata.documentType !== \"string\") throw new Error(`ADD_RELATIONSHIP for target ${input.targetId}: missing or invalid drive/child file metadata (expected { kind: \"file\", parentFolderId, documentType })`);\n\t\tconst typed = metadata;\n\t\treturn {\n\t\t\tkind: \"file\",\n\t\t\tparentFolderId: typed.parentFolderId ?? null,\n\t\t\tdocumentType: typed.documentType\n\t\t};\n\t}\n\tasync upsertDocumentName(trx, docId, name) {\n\t\tawait trx.insertInto(\"DocumentName\").values({\n\t\t\tdocId,\n\t\t\tname\n\t\t}).onConflict((oc) => oc.column(\"docId\").doUpdateSet({\n\t\t\tname,\n\t\t\tupdatedAt: /* @__PURE__ */ new Date()\n\t\t})).execute();\n\t}\n};\n//#endregion\n//#region src/read-model/drive-node-view.ts\nconst DEFAULT_LIMIT$1 = 100;\nfunction parseListChildrenPaging(paging) {\n\tif (paging === void 0) return {\n\t\tlimit: DEFAULT_LIMIT$1,\n\t\tcursor: null\n\t};\n\tif (!Number.isInteger(paging.limit) || paging.limit < 1) throw new Error(`Invalid paging limit: ${String(paging.limit)} (must be an integer >= 1)`);\n\tif (paging.cursor === \"\") return {\n\t\tlimit: paging.limit,\n\t\tcursor: null\n\t};\n\treturn {\n\t\tlimit: paging.limit,\n\t\tcursor: decodeKeysetCursor(paging.cursor)\n\t};\n}\nfunction encodeKeysetCursor(createdAt, id) {\n\treturn globalThis.btoa(JSON.stringify({\n\t\tcreatedAt: createdAt.toISOString(),\n\t\tid\n\t}));\n}\nfunction decodeKeysetCursor(cursor) {\n\tlet decoded;\n\ttry {\n\t\tdecoded = globalThis.atob(cursor);\n\t} catch {\n\t\tthrow new Error(`Invalid paging cursor: ${JSON.stringify(cursor)} (must be a keyset cursor returned by a prior page)`);\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(decoded);\n\t} catch {\n\t\tthrow new Error(`Invalid paging cursor: ${JSON.stringify(cursor)} (must be a keyset cursor returned by a prior page)`);\n\t}\n\tif (parsed === null || typeof parsed !== \"object\" || typeof parsed.createdAt !== \"string\" || typeof parsed.id !== \"string\") throw new Error(`Invalid paging cursor: ${JSON.stringify(cursor)} (must be a keyset cursor returned by a prior page)`);\n\tconst createdAt = new Date(parsed.createdAt);\n\tif (Number.isNaN(createdAt.getTime())) throw new Error(`Invalid paging cursor: ${JSON.stringify(cursor)} (createdAt is not a valid timestamp)`);\n\treturn {\n\t\tcreatedAt,\n\t\tid: parsed.id\n\t};\n}\nvar DriveNodeView = class {\n\tconstructor(db) {\n\t\tthis.db = db;\n\t}\n\tasync getNode(driveId, nodeId) {\n\t\tconst row = await this.db.selectFrom(\"DriveNode\").selectAll().where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", nodeId).executeTakeFirst();\n\t\tif (!row) return void 0;\n\t\treturn rowToNode(row);\n\t}\n\tasync listChildren(driveId, parentFolder, paging) {\n\t\tconst { limit, cursor } = parseListChildrenPaging(paging);\n\t\tlet query = this.db.selectFrom(\"DriveNode\").selectAll().where(\"driveId\", \"=\", driveId);\n\t\tif (parentFolder === null) query = query.where(\"parentFolder\", \"is\", null);\n\t\telse if (parentFolder !== void 0) query = query.where(\"parentFolder\", \"=\", parentFolder);\n\t\tif (cursor !== null) query = query.where((eb) => eb(eb.refTuple(\"createdAt\", \"id\"), \">\", eb.tuple(cursor.createdAt, cursor.id)));\n\t\tconst rows = await query.orderBy(\"createdAt\", \"asc\").orderBy(\"id\", \"asc\").limit(limit + 1).execute();\n\t\tconst hasMore = rows.length > limit;\n\t\tconst sliced = hasMore ? rows.slice(0, limit) : rows;\n\t\tconst last = sliced[sliced.length - 1];\n\t\treturn {\n\t\t\tresults: sliced.map(rowToNode),\n\t\t\toptions: {\n\t\t\t\tcursor: paging?.cursor ?? \"\",\n\t\t\t\tlimit\n\t\t\t},\n\t\t\tnextCursor: hasMore ? encodeKeysetCursor(last.createdAt, last.id) : void 0\n\t\t};\n\t}\n\tasync listAll(driveId) {\n\t\treturn (await this.db.selectFrom(\"DriveNode\").selectAll().where(\"driveId\", \"=\", driveId).orderBy(\"createdAt\", \"asc\").orderBy(\"id\", \"asc\").execute()).map(rowToNode);\n\t}\n\tasync getDescendants(driveId, root) {\n\t\treturn (await this.db.withRecursive(\"descendants\", (qb) => qb.selectFrom(\"DriveNode\").select([\n\t\t\t\"driveId\",\n\t\t\t\"id\",\n\t\t\t\"kind\",\n\t\t\t\"name\",\n\t\t\t\"requestedName\",\n\t\t\t\"parentFolder\",\n\t\t\t\"documentType\",\n\t\t\t\"createdAt\"\n\t\t]).where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", root).unionAll(qb.selectFrom(\"DriveNode\").innerJoin(\"descendants\", \"DriveNode.parentFolder\", \"descendants.id\").where(\"DriveNode.driveId\", \"=\", driveId).select([\n\t\t\t\"DriveNode.driveId\",\n\t\t\t\"DriveNode.id\",\n\t\t\t\"DriveNode.kind\",\n\t\t\t\"DriveNode.name\",\n\t\t\t\"DriveNode.requestedName\",\n\t\t\t\"DriveNode.parentFolder\",\n\t\t\t\"DriveNode.documentType\",\n\t\t\t\"DriveNode.createdAt\"\n\t\t]))).selectFrom(\"descendants\").select([\n\t\t\t\"driveId\",\n\t\t\t\"id\",\n\t\t\t\"kind\",\n\t\t\t\"name\",\n\t\t\t\"requestedName\",\n\t\t\t\"parentFolder\",\n\t\t\t\"documentType\"\n\t\t]).orderBy(\"createdAt\", \"asc\").orderBy(\"id\", \"asc\").execute()).map(rowToNode);\n\t}\n};\nfunction rowToNode(row) {\n\tif (row.kind === \"file\") {\n\t\tif (row.documentType === null) throw new Error(`DriveNode ${row.driveId}/${row.id}: file row has null documentType, which violates the schema CHECK constraint`);\n\t\treturn {\n\t\t\tkind: \"file\",\n\t\t\tid: row.id,\n\t\t\tdriveId: row.driveId,\n\t\t\tparentFolder: row.parentFolder,\n\t\t\tname: row.name,\n\t\t\tdocumentType: row.documentType\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"folder\",\n\t\tid: row.id,\n\t\tdriveId: row.driveId,\n\t\tparentFolder: row.parentFolder,\n\t\tname: row.name\n\t};\n}\n//#endregion\n//#region src/client/reactor-drive-client.ts\n/**\n* Implementation of {@link IDriveClient} backed by the reactor's relationship\n* primitives and the drive-scoped folder actions. Folder structure lives in\n* the operation log (ADD_FOLDER/UPDATE_FOLDER/REMOVE_FOLDER + ADD_RELATIONSHIP\n* for files) and is materialised by `NodeProcessor` into the `DriveNode`\n* table consumed via {@link IDriveReadModel}.\n*/\nvar ReactorDriveClient = class {\n\treactor;\n\treadModel;\n\tconstructor(args) {\n\t\tthis.reactor = args.reactor;\n\t\tthis.readModel = args.readModel;\n\t}\n\tasync create(input, signal) {\n\t\tconst driveDoc = reactorDriveCreateDocument({ global: {\n\t\t\tname: input.global.name,\n\t\t\ticon: input.global.icon ?? null\n\t\t} });\n\t\tif (input.local) {\n\t\t\tif (typeof input.local.sharingType === \"string\") driveDoc.state.local.sharingType = input.local.sharingType;\n\t\t\tif (typeof input.local.availableOffline === \"boolean\") driveDoc.state.local.availableOffline = input.local.availableOffline;\n\t\t}\n\t\tif (input.preferredEditor) driveDoc.header.meta = {\n\t\t\t...driveDoc.header.meta,\n\t\t\tpreferredEditor: input.preferredEditor\n\t\t};\n\t\tconst created = await this.reactor.create(driveDoc, void 0, signal);\n\t\treturn this.toLegacyDriveDocument(created, created.header.id);\n\t}\n\tasync addFile(driveIdentifier, document, parentFolder, signal) {\n\t\tconst documentId = document.header.id;\n\t\tconst createInput = {\n\t\t\tmodel: document.header.documentType,\n\t\t\tversion: 0,\n\t\t\tdocumentId,\n\t\t\tsigning: {\n\t\t\t\tsignature: documentId,\n\t\t\t\tpublicKey: document.header.sig.publicKey,\n\t\t\t\tnonce: document.header.sig.nonce,\n\t\t\t\tcreatedAtUtcIso: document.header.createdAtUtcIso,\n\t\t\t\tdocumentType: document.header.documentType\n\t\t\t},\n\t\t\tslug: document.header.slug,\n\t\t\tname: document.header.name,\n\t\t\tbranch: document.header.branch,\n\t\t\tmeta: document.header.meta,\n\t\t\tprotocolVersions: document.header.protocolVersions ?? { \"base-reducer\": 2 }\n\t\t};\n\t\tconst metadata = {\n\t\t\tkind: \"file\",\n\t\t\tparentFolderId: parentFolder ?? null,\n\t\t\tdocumentType: document.header.documentType\n\t\t};\n\t\tconst request = { jobs: [{\n\t\t\tkey: \"create\",\n\t\t\tdocumentId,\n\t\t\tscope: \"document\",\n\t\t\tbranch: \"main\",\n\t\t\tactions: [createDocumentAction(createInput), upgradeDocumentAction({\n\t\t\t\tdocumentId,\n\t\t\t\tmodel: document.header.documentType,\n\t\t\t\tfromVersion: 0,\n\t\t\t\ttoVersion: document.state.document.version,\n\t\t\t\tinitialState: document.state\n\t\t\t})],\n\t\t\tdependsOn: []\n\t\t}, {\n\t\t\tkey: \"link\",\n\t\t\tdocumentId: driveIdentifier,\n\t\t\tscope: \"document\",\n\t\t\tbranch: \"main\",\n\t\t\tactions: [addRelationshipAction(driveIdentifier, documentId, DRIVE_CHILD_RELATIONSHIP_TYPE, metadata)],\n\t\t\tdependsOn: [\"create\"]\n\t\t}] };\n\t\tawait this.reactor.executeBatch(request, signal);\n\t\treturn this.reactor.get(documentId, void 0, signal);\n\t}\n\tasync addFolder(driveIdentifier, name, parentFolder, signal) {\n\t\tconst folderId = generateId();\n\t\tawait this.reactor.execute(driveIdentifier, \"main\", [addFolderAction({\n\t\t\tfolderId,\n\t\t\tparentFolderId: parentFolder ?? null,\n\t\t\tname\n\t\t})], signal);\n\t\treturn {\n\t\t\tid: folderId,\n\t\t\tkind: \"folder\",\n\t\t\tname,\n\t\t\tparentFolder: parentFolder ?? null\n\t\t};\n\t}\n\tasync removeNode(driveIdentifier, nodeId, signal) {\n\t\tconst node = await this.readModel.getNode(driveIdentifier, nodeId, signal);\n\t\tif (!node) throw new Error(`Node ${nodeId} not found in drive ${driveIdentifier}`);\n\t\tif (node.kind === \"folder\") {\n\t\t\tconst subtree = await this.readModel.getDescendants(driveIdentifier, nodeId, signal);\n\t\t\tconst fileDescendants = subtree.filter((n) => n.kind === \"file\");\n\t\t\tconst subFolders = subtree.filter((n) => n.kind === \"folder\").filter((f) => f.id !== nodeId);\n\t\t\tconst deepestFirstFolders = this.orderDeepestFirst(subFolders, nodeId);\n\t\t\tconst batch = [\n\t\t\t\t...fileDescendants.map((f) => removeRelationshipAction(driveIdentifier, f.id, DRIVE_CHILD_RELATIONSHIP_TYPE)),\n\t\t\t\t...deepestFirstFolders.map((f) => removeFolderAction({ folderId: f.id })),\n\t\t\t\tremoveFolderAction({ folderId: nodeId })\n\t\t\t];\n\t\t\tawait this.reactor.execute(driveIdentifier, \"main\", batch, signal);\n\t\t\tfor (const file of fileDescendants) await this.reactor.deleteDocument(file.id, \"cascade\", signal);\n\t\t\treturn;\n\t\t}\n\t\tawait this.reactor.execute(driveIdentifier, \"main\", [removeRelationshipAction(driveIdentifier, nodeId, DRIVE_CHILD_RELATIONSHIP_TYPE)], signal);\n\t\tawait this.reactor.deleteDocument(nodeId, void 0, signal);\n\t}\n\tasync renameNode(driveIdentifier, nodeId, name, signal) {\n\t\tconst node = await this.readModel.getNode(driveIdentifier, nodeId, signal);\n\t\tif (!node) throw new Error(`Node ${nodeId} not found in drive ${driveIdentifier}`);\n\t\tif (node.kind === \"file\") await this.reactor.rename(nodeId, name, \"main\", signal);\n\t\telse await this.reactor.execute(driveIdentifier, \"main\", [updateFolderAction({\n\t\t\tfolderId: nodeId,\n\t\t\tname\n\t\t})], signal);\n\t\tconst updated = await this.readModel.getNode(driveIdentifier, nodeId, signal);\n\t\tif (!updated) throw new Error(\"Node missing from drive after rename\");\n\t\treturn this.toLegacyNode(updated);\n\t}\n\tasync setPreferredEditorOnNode(nodeId, preferredEditor, signal) {\n\t\treturn this.reactor.setPreferredEditor(nodeId, preferredEditor, \"main\", signal);\n\t}\n\tasync moveNode(driveIdentifier, srcNodeId, targetParentFolderId, signal) {\n\t\tconst node = await this.readModel.getNode(driveIdentifier, srcNodeId, signal);\n\t\tif (!node) throw new Error(`Node ${srcNodeId} not found in drive ${driveIdentifier}`);\n\t\tif (node.kind === \"folder\") await this.reactor.execute(driveIdentifier, \"main\", [updateFolderAction({\n\t\t\tfolderId: srcNodeId,\n\t\t\tparentFolderId: targetParentFolderId ?? null\n\t\t})], signal);\n\t\telse {\n\t\t\tconst metadata = {\n\t\t\t\tkind: \"file\",\n\t\t\t\tparentFolderId: targetParentFolderId ?? null,\n\t\t\t\tdocumentType: node.documentType\n\t\t\t};\n\t\t\tawait this.reactor.execute(driveIdentifier, \"main\", [removeRelationshipAction(driveIdentifier, srcNodeId, DRIVE_CHILD_RELATIONSHIP_TYPE), addRelationshipAction(driveIdentifier, srcNodeId, DRIVE_CHILD_RELATIONSHIP_TYPE, metadata)], signal);\n\t\t}\n\t\tconst drive = await this.reactor.get(driveIdentifier, void 0, signal);\n\t\treturn this.toLegacyDriveDocument(drive, driveIdentifier);\n\t}\n\tasync copyNode(driveIdentifier, srcNodeId, targetParentFolderId, signal) {\n\t\tif (!await this.readModel.getNode(driveIdentifier, srcNodeId, signal)) throw new Error(`Node ${srcNodeId} not found in drive ${driveIdentifier}`);\n\t\tconst subtree = await this.readModel.getDescendants(driveIdentifier, srcNodeId, signal);\n\t\tif (targetParentFolderId !== void 0 && subtree.some((n) => n.id === targetParentFolderId)) throw new Error(`Cannot copy node ${srcNodeId} into itself or one of its descendants (target: ${targetParentFolderId})`);\n\t\tconst idMap = /* @__PURE__ */ new Map();\n\t\tfor (const node of subtree) idMap.set(node.id, generateId());\n\t\tconst jobs = [];\n\t\tconst driveActions = [];\n\t\tconst fileCreateKeys = [];\n\t\tfor (const node of subtree) {\n\t\t\tconst newId = idMap.get(node.id);\n\t\t\tlet newParent;\n\t\t\tif (node.id === srcNodeId) newParent = targetParentFolderId ?? null;\n\t\t\telse {\n\t\t\t\tif (node.parentFolder == null) throw new Error(`copyNode: descendant ${node.id} has no parentFolder`);\n\t\t\t\tconst mapped = idMap.get(node.parentFolder);\n\t\t\t\tif (mapped === void 0) throw new Error(`copyNode: descendant ${node.id} parent ${node.parentFolder} missing from idMap`);\n\t\t\t\tnewParent = mapped;\n\t\t\t}\n\t\t\tif (node.kind === \"folder\") {\n\t\t\t\tdriveActions.push(addFolderAction({\n\t\t\t\t\tfolderId: newId,\n\t\t\t\t\tparentFolderId: newParent,\n\t\t\t\t\tname: node.name\n\t\t\t\t}));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst srcDoc = await this.reactor.get(node.id, void 0, signal);\n\t\t\tconst documentType = srcDoc.header.documentType;\n\t\t\tconst { results: allModules } = await this.reactor.getDocumentModelModules();\n\t\t\tconst modulesForType = allModules.filter((m) => m.documentModel.global.id === documentType);\n\t\t\tif (modulesForType.length === 0) throw new Error(`Document model module not found for type: ${documentType}`);\n\t\t\tconst reducers = {};\n\t\t\tfor (const m of modulesForType) reducers[m.version ?? 1] = m.reducer;\n\t\t\tconst config = { reducers };\n\t\t\tconst duplicated = replayDocumentVersioned(srcDoc.initialState, srcDoc.operations, config, createPresignedHeader(newId, documentType));\n\t\t\tduplicated.header.name = node.name;\n\t\t\tconst createInput = {\n\t\t\t\tmodel: duplicated.header.documentType,\n\t\t\t\tversion: 0,\n\t\t\t\tdocumentId: newId,\n\t\t\t\tsigning: {\n\t\t\t\t\tsignature: newId,\n\t\t\t\t\tpublicKey: duplicated.header.sig.publicKey,\n\t\t\t\t\tnonce: duplicated.header.sig.nonce,\n\t\t\t\t\tcreatedAtUtcIso: duplicated.header.createdAtUtcIso,\n\t\t\t\t\tdocumentType: duplicated.header.documentType\n\t\t\t\t},\n\t\t\t\tslug: duplicated.header.slug,\n\t\t\t\tname: duplicated.header.name,\n\t\t\t\tbranch: duplicated.header.branch,\n\t\t\t\tmeta: duplicated.header.meta,\n\t\t\t\tprotocolVersions: duplicated.header.protocolVersions ?? { \"base-reducer\": 2 }\n\t\t\t};\n\t\t\tconst createKey = `create:${newId}`;\n\t\t\tjobs.push({\n\t\t\t\tkey: createKey,\n\t\t\t\tdocumentId: newId,\n\t\t\t\tscope: \"document\",\n\t\t\t\tbranch: \"main\",\n\t\t\t\tactions: [createDocumentAction(createInput), upgradeDocumentAction({\n\t\t\t\t\tdocumentId: newId,\n\t\t\t\t\tmodel: duplicated.header.documentType,\n\t\t\t\t\tfromVersion: 0,\n\t\t\t\t\ttoVersion: duplicated.state.document.version,\n\t\t\t\t\tinitialState: duplicated.state\n\t\t\t\t})],\n\t\t\t\tdependsOn: []\n\t\t\t});\n\t\t\tfileCreateKeys.push(createKey);\n\t\t\tconst metadata = {\n\t\t\t\tkind: \"file\",\n\t\t\t\tparentFolderId: newParent,\n\t\t\t\tdocumentType: duplicated.header.documentType\n\t\t\t};\n\t\t\tdriveActions.push(addRelationshipAction(driveIdentifier, newId, DRIVE_CHILD_RELATIONSHIP_TYPE, metadata));\n\t\t}\n\t\tif (driveActions.length > 0) jobs.push({\n\t\t\tkey: \"drive\",\n\t\t\tdocumentId: driveIdentifier,\n\t\t\tscope: \"document\",\n\t\t\tbranch: \"main\",\n\t\t\tactions: driveActions,\n\t\t\tdependsOn: fileCreateKeys\n\t\t});\n\t\tif (jobs.length > 0) {\n\t\t\tconst request = { jobs };\n\t\t\tawait this.reactor.executeBatch(request, signal);\n\t\t}\n\t\tconst drive = await this.reactor.get(driveIdentifier, void 0, signal);\n\t\treturn this.toLegacyDriveDocument(drive, driveIdentifier);\n\t}\n\tasync getNode(driveIdentifier, nodeId, signal) {\n\t\tconst node = await this.readModel.getNode(driveIdentifier, nodeId, signal);\n\t\tif (!node) throw new Error(`Node ${nodeId} not found in drive ${driveIdentifier}`);\n\t\treturn this.toLegacyNode(node);\n\t}\n\tasync listNodes(driveIdentifier, parentFolder, paging, signal) {\n\t\tconst page = await this.readModel.listChildren(driveIdentifier, parentFolder, paging, signal);\n\t\treturn {\n\t\t\tresults: page.results.map((node) => this.toLegacyNode(node)),\n\t\t\toptions: page.options,\n\t\t\t...page.nextCursor !== void 0 ? { nextCursor: page.nextCursor } : {},\n\t\t\t...page.totalCount !== void 0 ? { totalCount: page.totalCount } : {}\n\t\t};\n\t}\n\ttoLegacyNode(node) {\n\t\tif (node.kind === \"file\") {\n\t\t\tconst file = node;\n\t\t\treturn {\n\t\t\t\tid: file.id,\n\t\t\t\tkind: \"file\",\n\t\t\t\tname: file.name,\n\t\t\t\tparentFolder: file.parentFolder,\n\t\t\t\tdocumentType: file.documentType\n\t\t\t};\n\t\t}\n\t\tconst folder = node;\n\t\treturn {\n\t\t\tid: folder.id,\n\t\t\tkind: \"folder\",\n\t\t\tname: folder.name,\n\t\t\tparentFolder: folder.parentFolder\n\t\t};\n\t}\n\tasync toLegacyDriveDocument(doc, driveId) {\n\t\tif (doc.header.documentType !== \"powerhouse/reactor-drive\") throw new Error(`Document ${doc.header.id} is not a reactor-drive document`);\n\t\tconst allNodes = await this.readModel.listAll(driveId);\n\t\tconst legacy = structuredClone(doc);\n\t\tconst existingGlobal = legacy.state.global;\n\t\tlegacy.state.global = {\n\t\t\tname: existingGlobal.name ?? \"\",\n\t\t\ticon: existingGlobal.icon ?? null,\n\t\t\tnodes: allNodes.map((n) => this.toLegacyNode(n))\n\t\t};\n\t\treturn legacy;\n\t}\n\torderDeepestFirst(folders, rootId) {\n\t\tconst depthById = /* @__PURE__ */ new Map();\n\t\tconst compute = (id) => {\n\t\t\tif (id === rootId) return 0;\n\t\t\tconst cached = depthById.get(id);\n\t\t\tif (cached !== void 0) return cached;\n\t\t\tconst folder = folders.find((f) => f.id === id);\n\t\t\tif (!folder) return 0;\n\t\t\tconst depth = compute(folder.parentFolder ?? rootId) + 1;\n\t\t\tdepthById.set(id, depth);\n\t\t\treturn depth;\n\t\t};\n\t\treturn folders.slice().sort((a, b) => compute(b.id) - compute(a.id));\n\t}\n};\n//#endregion\n//#region src/subgraph/schema.ts\nconst typeDefs = gql`\n enum ReactorDriveNodeKind {\n FILE\n FOLDER\n }\n\n input ReactorDrivePagingInput {\n cursor: String\n limit: Int\n }\n\n type ReactorDriveFileNode {\n id: ID!\n driveId: ID!\n name: String!\n parentFolder: ID\n documentType: String!\n }\n\n type ReactorDriveFolderNode {\n id: ID!\n driveId: ID!\n name: String!\n parentFolder: ID\n children(\n paging: ReactorDrivePagingInput\n kind: ReactorDriveNodeKind\n ): ReactorDriveNodePage!\n }\n\n union ReactorDriveNode = ReactorDriveFileNode | ReactorDriveFolderNode\n\n type ReactorDriveNodePage {\n results: [ReactorDriveNode!]!\n nextCursor: String\n hasMore: Boolean!\n totalCount: Int\n }\n\n type ReactorDrive {\n id: ID!\n name: String!\n icon: String\n sharingType: String!\n availableOffline: Boolean!\n rootNodes(\n paging: ReactorDrivePagingInput\n kind: ReactorDriveNodeKind\n ): ReactorDriveNodePage!\n }\n\n type Query {\n reactorDrive(id: ID!): ReactorDrive\n reactorDriveNode(driveId: ID!, id: ID!): ReactorDriveNode\n reactorDriveDescendants(driveId: ID!, root: ID!): [ReactorDriveNode!]!\n }\n`;\n//#endregion\n//#region src/subgraph/resolvers.ts\nconst DEFAULT_LIMIT = 100;\nfunction toPaging(input) {\n\tif (!input) return void 0;\n\treturn {\n\t\tcursor: input.cursor ?? \"\",\n\t\tlimit: input.limit ?? DEFAULT_LIMIT\n\t};\n}\nfunction filterByKind(page, kind) {\n\tif (!kind) return page;\n\tconst wanted = kind === \"FILE\" ? \"file\" : \"folder\";\n\treturn {\n\t\t...page,\n\t\tresults: page.results.filter((node) => node.kind === wanted)\n\t};\n}\nfunction shapePage(page) {\n\treturn {\n\t\tresults: page.results,\n\t\tnextCursor: page.nextCursor,\n\t\thasMore: page.nextCursor !== void 0,\n\t\ttotalCount: page.totalCount\n\t};\n}\n/**\n* Builds GraphQL resolvers backed by the drive read model. The resolvers are\n* pure — every external dependency is read off the GraphQL context. Wiring\n* the resolvers into a subgraph (e.g. `reactor-api`'s `ISubgraph`) is the\n* caller's responsibility.\n*/\nfunction createReactorDriveResolvers() {\n\treturn {\n\t\tQuery: {\n\t\t\tasync reactorDrive(_root, args, ctx) {\n\t\t\t\tconst document = await ctx.reactorClient.get(args.id);\n\t\t\t\tif (document.header.documentType !== \"powerhouse/reactor-drive\") return null;\n\t\t\t\treturn {\n\t\t\t\t\tid: document.header.id,\n\t\t\t\t\tname: document.state.global.name,\n\t\t\t\t\ticon: document.state.global.icon,\n\t\t\t\t\tsharingType: document.state.local.sharingType,\n\t\t\t\t\tavailableOffline: document.state.local.availableOffline\n\t\t\t\t};\n\t\t\t},\n\t\t\tasync reactorDriveNode(_root, args, ctx) {\n\t\t\t\treturn ctx.readModel.getNode(args.driveId, args.id);\n\t\t\t},\n\t\t\tasync reactorDriveDescendants(_root, args, ctx) {\n\t\t\t\treturn ctx.readModel.getDescendants(args.driveId, args.root);\n\t\t\t}\n\t\t},\n\t\tReactorDrive: { async rootNodes(parent, args, ctx) {\n\t\t\treturn shapePage(filterByKind(await ctx.readModel.listChildren(parent.id, null, toPaging(args.paging)), args.kind));\n\t\t} },\n\t\tReactorDriveFolderNode: { async children(parent, args, ctx) {\n\t\t\treturn shapePage(filterByKind(await ctx.readModel.listChildren(parent.driveId, parent.id, toPaging(args.paging)), args.kind));\n\t\t} },\n\t\tReactorDriveNode: { __resolveType(node) {\n\t\t\treturn node.kind === \"file\" ? \"ReactorDriveFileNode\" : \"ReactorDriveFolderNode\";\n\t\t} }\n\t};\n}\n//#endregion\n//#region src/migration/migrate-legacy-state.ts\n/**\n* Translates a legacy `document-drive` `state.global.nodes` array into the\n* action vocabulary used by the new reactor-drive module.\n*\n* Folder nodes are emitted as `ADD_FOLDER` actions targeting the drive\n* document. File nodes are emitted as `ADD_RELATIONSHIP` actions on the drive\n* with `drive/child` metadata carrying the parent folder id. File nodes\n* assume the underlying PHDocument still exists under the same id — the\n* migration only re-links it into the new drive, it does not recreate\n* documents.\n*\n* Re-running the migration is safe: existing `DriveNode` rows are skipped\n* so already-migrated nodes are left untouched.\n*/\nasync function migrateLegacyDriveState(args) {\n\tconst { reactor, readModel, driveId, nodes, signal } = args;\n\tconst branch = args.branch ?? \"main\";\n\tconst ordered = orderLegacyNodes(nodes);\n\tconst actions = [];\n\tlet skippedExisting = 0;\n\tfor (const node of ordered) {\n\t\tif (await readModel.getNode(driveId, node.id, signal)) {\n\t\t\tskippedExisting += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tactions.push(toAction(driveId, node));\n\t}\n\tif (actions.length === 0) return {\n\t\temittedActions: 0,\n\t\tskippedExisting\n\t};\n\tawait reactor.execute(driveId, branch, actions, signal);\n\treturn {\n\t\temittedActions: actions.length,\n\t\tskippedExisting\n\t};\n}\nfunction toAction(driveId, node) {\n\tif (node.kind === \"folder\") return addFolderAction({\n\t\tfolderId: node.id,\n\t\tparentFolderId: node.parentFolder ?? null,\n\t\tname: node.name\n\t});\n\tconst fileNode = node;\n\tconst metadata = {\n\t\tkind: \"file\",\n\t\tparentFolderId: fileNode.parentFolder ?? null,\n\t\tdocumentType: fileNode.documentType\n\t};\n\treturn addRelationshipAction(driveId, fileNode.id, DRIVE_CHILD_RELATIONSHIP_TYPE, metadata);\n}\n/**\n* Sorts legacy nodes so that any folder appears before its children. The\n* legacy state stores nodes in insertion order, which usually already\n* satisfies that property, but defensive sorting keeps replay deterministic\n* if the input was constructed out of order.\n*/\nfunction orderLegacyNodes(nodes) {\n\tconst byId = /* @__PURE__ */ new Map();\n\tfor (const node of nodes) byId.set(node.id, node);\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst ordered = [];\n\tfor (const start of nodes) {\n\t\tif (visited.has(start.id)) continue;\n\t\tconst chain = [];\n\t\tconst seenInWalk = /* @__PURE__ */ new Set();\n\t\tlet current = start;\n\t\twhile (current && !visited.has(current.id) && !seenInWalk.has(current.id)) {\n\t\t\tseenInWalk.add(current.id);\n\t\t\tchain.push(current);\n\t\t\tconst parentId = current.parentFolder;\n\t\t\tcurrent = parentId ? byId.get(parentId) : void 0;\n\t\t}\n\t\twhile (chain.length > 0) {\n\t\t\tconst node = chain.pop();\n\t\t\tif (visited.has(node.id)) continue;\n\t\t\tvisited.add(node.id);\n\t\t\tordered.push(node);\n\t\t}\n\t}\n\treturn ordered;\n}\n//#endregion\nexport { DRIVE_CHILD_RELATIONSHIP_TYPE, DriveNodeView, NodeProcessor, REACTOR_DRIVE_DOCUMENT_TYPE, REACTOR_DRIVE_FILE_EXTENSION, ReactorDriveClient, addFolderAction, createReactorDriveResolvers, getReactorDriveMigrationStatus, migrateLegacyDriveState, reactorDriveActions, reactorDriveCreateDocument, reactorDriveCreateState, reactorDriveDocumentModelModule, reactorDriveDocumentReducer, reactorDriveStateReducer, typeDefs as reactorDriveSubgraphTypeDefs, removeFolderAction, resolveCollision, runReactorDriveMigrations, setAvailableOfflineAction, setDriveIconAction, setDriveNameAction, setSharingTypeAction, updateFolderAction };\n\n//# sourceMappingURL=index.js.map","import { reactorDriveDocumentModelModule } from \"@powerhousedao/reactor-drive\";\nimport { driveDocumentModelModule } from \"@powerhousedao/shared/document-drive\";\nimport { type DocumentModelModule } from \"@powerhousedao/shared/document-model\";\nimport { documentModelDocumentModelModule } from \"document-model\";\nexport const documentModels: DocumentModelModule<any>[] = [\n documentModelDocumentModelModule,\n driveDocumentModelModule,\n reactorDriveDocumentModelModule,\n];\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { DocumentModelEditor } from \"./document-model-editor/module.js\";\nimport { GenericDriveExplorer } from \"./generic-drive-explorer/module.js\";\n\nexport const editors: EditorModule[] = [\n DocumentModelEditor,\n GenericDriveExplorer,\n];\n","import type { Manifest } from \"@powerhousedao/shared/document-model\";\nimport manifestJson from \"./powerhouse.manifest.json\" with { type: \"json\" };\nexport { documentModels } from \"./document-models/document-models.js\";\nexport { editors } from \"./editors/editors.js\";\nexport const manifest: Manifest = manifestJson;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACiBA,MAAM,8BAA8B;AAEpC,MAAM,+BAA+B;AAGrC,SAAS,mBAAmB,OAAO;AAClC,QAAO;EACN,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,iCAAiC,IAAI,MAAM,EAAE,aAAa;EAC1D;EACA;;AAEF,SAAS,mBAAmB,OAAO;AAClC,QAAO;EACN,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,iCAAiC,IAAI,MAAM,EAAE,aAAa;EAC1D;EACA;;AAEF,SAAS,qBAAqB,OAAO;AACpC,QAAO;EACN,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,iCAAiC,IAAI,MAAM,EAAE,aAAa;EAC1D;EACA;;AAEF,SAAS,0BAA0B,OAAO;AACzC,QAAO;EACN,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UAA0B,CACrC,qBACA,qBACD;;;ACHD,MAAa,WAAqBA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["initialGlobalState","initialLocalState","z$1.any","z$1.object","z$1.string","z$1.literal","z$1.array","z.literal","z.object","ReactorGroupV1","manifestJson"],"sources":["../../powerhouse.manifest.json","../../../reactor-drive/dist/index.js","../../../reactor-group/dist/chunk-pbuEa-1d.js","../../../reactor-group/dist/module-DuRVS7HX.js","../../document-models/document-models.ts","../../editors/editors.ts","../../index.ts"],"sourcesContent":["","import { assertAuthPreservedOnDuplicate, baseCreateDocument, baseLoadFromInput, baseSaveToFileHandle, createPresignedHeader, createReducer, createState, defaultBaseState, generateId, isDocumentAction, replayDocumentVersioned } from \"@powerhousedao/shared/document-model\";\nimport { Migrator, sql } from \"kysely\";\nimport { BaseReadModel, addRelationshipAction, createDocumentAction, removeRelationshipAction, upgradeDocumentAction } from \"@powerhousedao/reactor\";\nimport { gql } from \"graphql-tag\";\n//#region \\0rolldown/runtime.js\nvar __defProp = Object.defineProperty;\nvar __exportAll = (all, no_symbols) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\tif (!no_symbols) __defProp(target, Symbol.toStringTag, { value: \"Module\" });\n\treturn target;\n};\n//#endregion\n//#region src/constants.ts\nconst REACTOR_DRIVE_DOCUMENT_TYPE = \"powerhouse/reactor-drive\";\nconst DRIVE_CHILD_RELATIONSHIP_TYPE = \"drive/child\";\nconst REACTOR_DRIVE_FILE_EXTENSION = \"phrd\";\n//#endregion\n//#region src/actions.ts\nfunction setDriveNameAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"SET_DRIVE_NAME\",\n\t\tscope: \"global\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction setDriveIconAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"SET_DRIVE_ICON\",\n\t\tscope: \"global\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction setSharingTypeAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"SET_SHARING_TYPE\",\n\t\tscope: \"local\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction setAvailableOfflineAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"SET_AVAILABLE_OFFLINE\",\n\t\tscope: \"local\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction addFolderAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"ADD_FOLDER\",\n\t\tscope: \"document\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction updateFolderAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"UPDATE_FOLDER\",\n\t\tscope: \"document\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nfunction removeFolderAction(input) {\n\treturn {\n\t\tid: generateId(),\n\t\ttype: \"REMOVE_FOLDER\",\n\t\tscope: \"document\",\n\t\ttimestampUtcMs: (/* @__PURE__ */ new Date()).toISOString(),\n\t\tinput\n\t};\n}\nconst reactorDriveActions = {\n\tsetDriveName: setDriveNameAction,\n\tsetDriveIcon: setDriveIconAction,\n\tsetSharingType: setSharingTypeAction,\n\tsetAvailableOffline: setAvailableOfflineAction,\n\taddFolder: addFolderAction,\n\tupdateFolder: updateFolderAction,\n\tremoveFolder: removeFolderAction\n};\n//#endregion\n//#region src/reducer/drive.ts\nconst reactorDriveStateReducer = (state, action) => {\n\tif (isDocumentAction(action)) return state;\n\tconst typedAction = action;\n\tswitch (typedAction.type) {\n\t\tcase \"SET_DRIVE_NAME\": {\n\t\t\tconst input = typedAction.input;\n\t\t\tstate.global.name = input.name;\n\t\t\treturn state;\n\t\t}\n\t\tcase \"SET_DRIVE_ICON\": {\n\t\t\tconst input = typedAction.input;\n\t\t\tstate.global.icon = input.icon;\n\t\t\treturn state;\n\t\t}\n\t\tcase \"SET_SHARING_TYPE\": {\n\t\t\tconst input = typedAction.input;\n\t\t\tstate.local.sharingType = input.sharingType;\n\t\t\treturn state;\n\t\t}\n\t\tcase \"SET_AVAILABLE_OFFLINE\": {\n\t\t\tconst input = typedAction.input;\n\t\t\tstate.local.availableOffline = input.availableOffline;\n\t\t\treturn state;\n\t\t}\n\t\tcase \"ADD_FOLDER\":\n\t\tcase \"UPDATE_FOLDER\":\n\t\tcase \"REMOVE_FOLDER\": return state;\n\t\tdefault: return state;\n\t}\n};\n//#endregion\n//#region src/module.ts\nconst initialGlobalState = {\n\tname: \"\",\n\ticon: null\n};\nconst initialLocalState = {\n\tsharingType: \"private\",\n\tavailableOffline: false\n};\nconst reactorDriveCreateState = (state) => {\n\treturn {\n\t\t...defaultBaseState(),\n\t\tglobal: {\n\t\t\t...initialGlobalState,\n\t\t\t...state?.global\n\t\t},\n\t\tlocal: {\n\t\t\t...initialLocalState,\n\t\t\t...state?.local\n\t\t}\n\t};\n};\nconst reactorDriveCreateDocument = (state) => {\n\treturn baseCreateDocument(reactorDriveCreateState, state, REACTOR_DRIVE_DOCUMENT_TYPE);\n};\nconst reactorDriveSaveToFileHandle = (document, input) => {\n\treturn baseSaveToFileHandle(document, input);\n};\nconst reactorDriveLoadFromInput = (input) => {\n\treturn baseLoadFromInput(input, reactorDriveDocumentReducer);\n};\nconst isReactorDriveState = (state) => {\n\treturn typeof state === \"object\" && state !== null && \"global\" in state && \"local\" in state;\n};\nconst assertIsReactorDriveState = (state) => {\n\tif (!isReactorDriveState(state)) throw new Error(\"Not a reactor-drive state\");\n};\nconst isReactorDriveDocument = (document) => {\n\treturn typeof document === \"object\" && document !== null && \"header\" in document && document.header.documentType === \"powerhouse/reactor-drive\";\n};\nconst assertIsReactorDriveDocument = (document) => {\n\tif (!isReactorDriveDocument(document)) throw new Error(\"Not a reactor-drive document\");\n};\nconst reactorDriveDocumentReducer = createReducer(reactorDriveStateReducer);\nconst reactorDriveDocumentGlobalState = {\n\tid: REACTOR_DRIVE_DOCUMENT_TYPE,\n\tname: \"ReactorDrive\",\n\textension: REACTOR_DRIVE_FILE_EXTENSION,\n\tdescription: \"\",\n\tauthor: {\n\t\tname: \"Powerhouse Inc\",\n\t\twebsite: \"https://www.powerhouse.inc/\"\n\t},\n\tspecifications: [{\n\t\tversion: 1,\n\t\tchangeLog: [],\n\t\tstate: {\n\t\t\tglobal: {\n\t\t\t\tschema: \"type ReactorDriveState {\\n name: String!\\n icon: String\\n}\",\n\t\t\t\tinitialValue: JSON.stringify(JSON.stringify(initialGlobalState)),\n\t\t\t\texamples: []\n\t\t\t},\n\t\t\tlocal: {\n\t\t\t\tschema: \"type ReactorDriveLocalState {\\n sharingType: String!\\n availableOffline: Boolean!\\n}\",\n\t\t\t\tinitialValue: JSON.stringify(JSON.stringify(initialLocalState)),\n\t\t\t\texamples: []\n\t\t\t}\n\t\t},\n\t\tmodules: [{\n\t\t\tid: \"reactor-drive/base-operations\",\n\t\t\tname: \"base_operations\",\n\t\t\tdescription: \"\",\n\t\t\toperations: [\n\t\t\t\t{\n\t\t\t\t\tid: \"SET_DRIVE_NAME\",\n\t\t\t\t\tname: \"SET_DRIVE_NAME\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input SetDriveNameInput { name: String! }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"global\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"SET_DRIVE_ICON\",\n\t\t\t\t\tname: \"SET_DRIVE_ICON\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input SetDriveIconInput { icon: String }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"global\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"SET_SHARING_TYPE\",\n\t\t\t\t\tname: \"SET_SHARING_TYPE\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input SetSharingTypeInput { sharingType: String! }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"local\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"SET_AVAILABLE_OFFLINE\",\n\t\t\t\t\tname: \"SET_AVAILABLE_OFFLINE\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input SetAvailableOfflineInput { availableOffline: Boolean! }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"local\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"ADD_FOLDER\",\n\t\t\t\t\tname: \"ADD_FOLDER\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input AddFolderInput { folderId: String! parentFolderId: String name: String! }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"document\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"UPDATE_FOLDER\",\n\t\t\t\t\tname: \"UPDATE_FOLDER\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input UpdateFolderInput { folderId: String! name: String parentFolderId: String }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"document\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"REMOVE_FOLDER\",\n\t\t\t\t\tname: \"REMOVE_FOLDER\",\n\t\t\t\t\tdescription: \"\",\n\t\t\t\t\tschema: \"input RemoveFolderInput { folderId: String! }\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"document\"\n\t\t\t\t}\n\t\t\t]\n\t\t}]\n\t}]\n};\nconst reactorDriveDocumentModelModule = {\n\tactions: reactorDriveActions,\n\treducer: reactorDriveDocumentReducer,\n\tdocumentModel: createState(defaultBaseState(), reactorDriveDocumentGlobalState),\n\tutils: {\n\t\tfileExtension: REACTOR_DRIVE_FILE_EXTENSION,\n\t\tcreateState: reactorDriveCreateState,\n\t\tcreateDocument: reactorDriveCreateDocument,\n\t\tloadFromInput: reactorDriveLoadFromInput,\n\t\tsaveToFileHandle: reactorDriveSaveToFileHandle,\n\t\tisStateOfType: isReactorDriveState,\n\t\tassertIsStateOfType: assertIsReactorDriveState,\n\t\tisDocumentOfType: isReactorDriveDocument,\n\t\tassertIsDocumentOfType: assertIsReactorDriveDocument\n\t}\n};\n//#endregion\n//#region src/schema/migrations/0001_drive_node.ts\nvar _0001_drive_node_exports = /* @__PURE__ */ __exportAll({\n\tdown: () => down$1,\n\tup: () => up$1\n});\nasync function up$1(db) {\n\tawait db.schema.createTable(\"DriveNode\").ifNotExists().addColumn(\"driveId\", \"text\", (col) => col.notNull()).addColumn(\"id\", \"text\", (col) => col.notNull()).addColumn(\"kind\", \"text\", (col) => col.notNull()).addColumn(\"name\", \"text\", (col) => col.notNull()).addColumn(\"requestedName\", \"text\", (col) => col.notNull()).addColumn(\"parentFolder\", \"text\").addColumn(\"documentType\", \"text\").addColumn(\"createdAt\", \"timestamptz\", (col) => col.notNull().defaultTo(sql`NOW()`)).addColumn(\"updatedAt\", \"timestamptz\", (col) => col.notNull().defaultTo(sql`NOW()`)).addPrimaryKeyConstraint(\"pk_drive_node\", [\"driveId\", \"id\"]).addCheckConstraint(\"chk_drive_node_document_type\", sql`(kind = 'file' AND \"documentType\" IS NOT NULL) OR (kind = 'folder' AND \"documentType\" IS NULL)`).execute();\n\tawait db.schema.createIndex(\"idx_drive_node_parent_name\").ifNotExists().on(\"DriveNode\").columns([\n\t\t\"driveId\",\n\t\t\"parentFolder\",\n\t\t\"name\"\n\t]).execute();\n\tawait db.schema.createIndex(\"idx_drive_node_parent_kind_id\").ifNotExists().on(\"DriveNode\").columns([\n\t\t\"driveId\",\n\t\t\"parentFolder\",\n\t\t\"kind\",\n\t\t\"id\"\n\t]).execute();\n}\nasync function down$1(db) {\n\tawait db.schema.dropTable(\"DriveNode\").execute();\n}\n//#endregion\n//#region src/schema/migrations/0002_document_name.ts\nvar _0002_document_name_exports = /* @__PURE__ */ __exportAll({\n\tdown: () => down,\n\tup: () => up\n});\nasync function up(db) {\n\tawait db.schema.createTable(\"DocumentName\").ifNotExists().addColumn(\"docId\", \"text\", (col) => col.primaryKey()).addColumn(\"name\", \"text\", (col) => col.notNull()).addColumn(\"updatedAt\", \"timestamptz\", (col) => col.notNull().defaultTo(sql`NOW()`)).execute();\n}\nasync function down(db) {\n\tawait db.schema.dropTable(\"DocumentName\").execute();\n}\n//#endregion\n//#region src/schema/migrations/migrator.ts\nconst migrations = {\n\t\"0001_drive_node\": _0001_drive_node_exports,\n\t\"0002_document_name\": _0002_document_name_exports\n};\nconst REACTOR_DRIVE_MIGRATION_TABLE = \"kysely_migration_reactor_drive\";\nconst REACTOR_DRIVE_MIGRATION_LOCK_TABLE = \"kysely_migration_reactor_drive_lock\";\nvar ProgrammaticMigrationProvider = class {\n\tgetMigrations() {\n\t\treturn Promise.resolve(migrations);\n\t}\n};\nasync function runReactorDriveMigrations(db, schema) {\n\ttry {\n\t\tawait sql`CREATE SCHEMA IF NOT EXISTS ${sql.id(schema)}`.execute(db);\n\t} catch (error) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tmigrationsExecuted: [],\n\t\t\terror: error instanceof Error ? error : /* @__PURE__ */ new Error(\"Failed to create schema\")\n\t\t};\n\t}\n\tconst migrator = new Migrator({\n\t\tdb: db.withSchema(schema),\n\t\tprovider: new ProgrammaticMigrationProvider(),\n\t\tmigrationTableSchema: schema,\n\t\tmigrationTableName: REACTOR_DRIVE_MIGRATION_TABLE,\n\t\tmigrationLockTableName: REACTOR_DRIVE_MIGRATION_LOCK_TABLE\n\t});\n\tlet error;\n\tlet results;\n\ttry {\n\t\tconst result = await migrator.migrateToLatest();\n\t\terror = result.error;\n\t\tresults = result.results;\n\t} catch (e) {\n\t\terror = e;\n\t\tresults = [];\n\t}\n\tconst migrationsExecuted = results?.map((result) => result.migrationName) ?? [];\n\tif (error) return {\n\t\tsuccess: false,\n\t\tmigrationsExecuted,\n\t\terror: error instanceof Error ? error : /* @__PURE__ */ new Error(\"Unknown migration error\")\n\t};\n\treturn {\n\t\tsuccess: true,\n\t\tmigrationsExecuted\n\t};\n}\nasync function getReactorDriveMigrationStatus(db, schema) {\n\treturn await new Migrator({\n\t\tdb: db.withSchema(schema),\n\t\tprovider: new ProgrammaticMigrationProvider(),\n\t\tmigrationTableSchema: schema,\n\t\tmigrationTableName: REACTOR_DRIVE_MIGRATION_TABLE,\n\t\tmigrationLockTableName: REACTOR_DRIVE_MIGRATION_LOCK_TABLE\n\t}).getMigrations();\n}\n//#endregion\n//#region src/processors/utils/collisions.ts\n/**\n* Deterministic per-folder name collision rule. Given a desired name and the\n* set of names already taken by siblings, returns the next available name as\n* `requested`, `requested (2)`, `requested (3)`, etc.\n*\n* The rule matches the legacy document-drive module so that migration from\n* the legacy state produces stable suffixes.\n*/\nfunction resolveCollision(requested, takenNames) {\n\tconst taken = /* @__PURE__ */ new Set();\n\tfor (const name of takenNames) taken.add(name);\n\tif (!taken.has(requested)) return requested;\n\tlet suffix = 2;\n\twhile (taken.has(`${requested} (${suffix})`)) suffix += 1;\n\treturn `${requested} (${suffix})`;\n}\n//#endregion\n//#region src/processors/node-processor.ts\nconst NAME_ACTION_TYPES = new Set([\n\t\"CREATE_DOCUMENT\",\n\t\"UPGRADE_DOCUMENT\",\n\t\"SET_NAME\"\n]);\nconst STRUCTURE_ACTION_TYPES = new Set([\n\t\"ADD_RELATIONSHIP\",\n\t\"REMOVE_RELATIONSHIP\",\n\t\"ADD_FOLDER\",\n\t\"UPDATE_FOLDER\",\n\t\"REMOVE_FOLDER\"\n]);\nvar NodeProcessor = class extends BaseReadModel {\n\tdriveDb;\n\tbaseDb;\n\tschema;\n\tconstructor(baseDb, schema, operationIndex, writeCache, consistencyTracker) {\n\t\tconst scopedDb = baseDb.withSchema(schema);\n\t\tsuper(scopedDb, operationIndex, writeCache, consistencyTracker, {\n\t\t\treadModelId: \"reactor-drive-node-processor\",\n\t\t\trebuildStateOnInit: false\n\t\t});\n\t\tthis.driveDb = scopedDb;\n\t\tthis.baseDb = baseDb;\n\t\tthis.schema = schema;\n\t}\n\tasync init() {\n\t\tconst result = await runReactorDriveMigrations(this.baseDb, this.schema);\n\t\tif (!result.success && result.error) throw new Error(`Reactor drive migrations failed: ${result.error.message}`);\n\t\tawait super.init();\n\t}\n\tasync commitOperations(items) {\n\t\tawait this.driveDb.transaction().execute(async (trx) => {\n\t\t\tfor (const item of items) {\n\t\t\t\tconst actionType = item.operation.action.type;\n\t\t\t\tif (NAME_ACTION_TYPES.has(actionType)) {\n\t\t\t\t\tawait this.applyNameOperation(trx, item);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (STRUCTURE_ACTION_TYPES.has(actionType)) {\n\t\t\t\t\tawait this.applyStructureOperation(trx, item);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (actionType === \"DELETE_DOCUMENT\") await this.applyDeleteDocument(trx, item);\n\t\t\t}\n\t\t});\n\t}\n\tasync applyNameOperation(trx, item) {\n\t\tconst action = item.operation.action;\n\t\tconst docId = item.context.documentId;\n\t\tlet name;\n\t\tif (action.type === \"CREATE_DOCUMENT\") name = action.input.name;\n\t\telse if (action.type === \"UPGRADE_DOCUMENT\") name = (action.input.initialState ?? {}).header?.name;\n\t\telse if (action.type === \"SET_NAME\") name = action.input.name;\n\t\tif (name === void 0) return;\n\t\tawait this.upsertDocumentName(trx, docId, name);\n\t\tconst linkedRows = await trx.selectFrom(\"DriveNode\").selectAll().where(\"id\", \"=\", docId).where(\"kind\", \"=\", \"file\").execute();\n\t\tfor (const row of linkedRows) {\n\t\t\tconst resolved = await this.resolveSiblingName(trx, row.driveId, row.parentFolder, name, docId);\n\t\t\tawait trx.updateTable(\"DriveNode\").set({\n\t\t\t\tname: resolved,\n\t\t\t\trequestedName: name,\n\t\t\t\tupdatedAt: /* @__PURE__ */ new Date()\n\t\t\t}).where(\"driveId\", \"=\", row.driveId).where(\"id\", \"=\", docId).execute();\n\t\t}\n\t}\n\tasync applyStructureOperation(trx, item) {\n\t\tif (item.context.documentType !== \"powerhouse/reactor-drive\") return;\n\t\tconst action = item.operation.action;\n\t\tconst driveId = item.context.documentId;\n\t\tif (action.type === \"ADD_RELATIONSHIP\") {\n\t\t\tconst input = action.input;\n\t\t\tif (input.relationshipType !== \"drive/child\") return;\n\t\t\tawait this.handleAddFileRelationship(trx, driveId, input);\n\t\t\treturn;\n\t\t}\n\t\tif (action.type === \"REMOVE_RELATIONSHIP\") {\n\t\t\tconst input = action.input;\n\t\t\tif (input.relationshipType !== \"drive/child\") return;\n\t\t\tawait trx.deleteFrom(\"DriveNode\").where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", input.targetId).execute();\n\t\t\treturn;\n\t\t}\n\t\tif (action.type === \"ADD_FOLDER\") {\n\t\t\tawait this.handleAddFolder(trx, driveId, action.input);\n\t\t\treturn;\n\t\t}\n\t\tif (action.type === \"UPDATE_FOLDER\") {\n\t\t\tawait this.handleUpdateFolder(trx, driveId, action.input);\n\t\t\treturn;\n\t\t}\n\t\tif (action.type === \"REMOVE_FOLDER\") {\n\t\t\tconst input = action.input;\n\t\t\tawait trx.deleteFrom(\"DriveNode\").where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", input.folderId).execute();\n\t\t}\n\t}\n\tasync applyDeleteDocument(trx, item) {\n\t\tconst docId = item.operation.action.input.documentId || item.context.documentId;\n\t\tawait trx.deleteFrom(\"DriveNode\").where(\"id\", \"=\", docId).execute();\n\t\tawait trx.deleteFrom(\"DocumentName\").where(\"docId\", \"=\", docId).execute();\n\t}\n\tasync handleAddFileRelationship(trx, driveId, input) {\n\t\tconst metadata = this.parseFileMetadata(input);\n\t\tconst parentFolder = metadata.parentFolderId ?? null;\n\t\tconst documentType = metadata.documentType;\n\t\tconst requestedName = await this.lookupDocumentName(trx, input.targetId) ?? \"\";\n\t\tconst resolved = await this.resolveSiblingName(trx, driveId, parentFolder, requestedName, input.targetId);\n\t\tawait trx.insertInto(\"DriveNode\").values({\n\t\t\tdriveId,\n\t\t\tid: input.targetId,\n\t\t\tkind: \"file\",\n\t\t\tname: resolved,\n\t\t\trequestedName,\n\t\t\tparentFolder,\n\t\t\tdocumentType\n\t\t}).onConflict((oc) => oc.columns([\"driveId\", \"id\"]).doUpdateSet({\n\t\t\tparentFolder,\n\t\t\tname: resolved,\n\t\t\trequestedName,\n\t\t\tkind: \"file\",\n\t\t\tdocumentType,\n\t\t\tupdatedAt: /* @__PURE__ */ new Date()\n\t\t})).execute();\n\t}\n\tasync handleAddFolder(trx, driveId, input) {\n\t\tconst parentFolder = input.parentFolderId ?? null;\n\t\tconst resolved = await this.resolveSiblingName(trx, driveId, parentFolder, input.name, input.folderId);\n\t\tawait trx.insertInto(\"DriveNode\").values({\n\t\t\tdriveId,\n\t\t\tid: input.folderId,\n\t\t\tkind: \"folder\",\n\t\t\tname: resolved,\n\t\t\trequestedName: input.name,\n\t\t\tparentFolder,\n\t\t\tdocumentType: null\n\t\t}).onConflict((oc) => oc.columns([\"driveId\", \"id\"]).doUpdateSet({\n\t\t\tparentFolder,\n\t\t\tname: resolved,\n\t\t\trequestedName: input.name,\n\t\t\tkind: \"folder\",\n\t\t\tdocumentType: null,\n\t\t\tupdatedAt: /* @__PURE__ */ new Date()\n\t\t})).execute();\n\t}\n\tasync handleUpdateFolder(trx, driveId, input) {\n\t\tconst row = await trx.selectFrom(\"DriveNode\").selectAll().where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", input.folderId).executeTakeFirst();\n\t\tif (!row) return;\n\t\tconst nextParentFolder = input.parentFolderId === void 0 ? row.parentFolder : input.parentFolderId ?? null;\n\t\tconst nextRequestedName = typeof input.name === \"string\" ? input.name : row.requestedName;\n\t\tconst resolved = await this.resolveSiblingName(trx, driveId, nextParentFolder, nextRequestedName, input.folderId);\n\t\tawait trx.updateTable(\"DriveNode\").set({\n\t\t\tparentFolder: nextParentFolder,\n\t\t\tname: resolved,\n\t\t\trequestedName: nextRequestedName,\n\t\t\tupdatedAt: /* @__PURE__ */ new Date()\n\t\t}).where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", input.folderId).execute();\n\t}\n\tasync resolveSiblingName(trx, driveId, parentFolder, requested, excludeId) {\n\t\tlet query = trx.selectFrom(\"DriveNode\").select(\"name\").where(\"driveId\", \"=\", driveId).where(\"id\", \"!=\", excludeId);\n\t\tquery = parentFolder === null ? query.where(\"parentFolder\", \"is\", null) : query.where(\"parentFolder\", \"=\", parentFolder);\n\t\treturn resolveCollision(requested, (await query.execute()).map((r) => r.name));\n\t}\n\tasync lookupDocumentName(trx, docId) {\n\t\treturn (await trx.selectFrom(\"DocumentName\").select(\"name\").where(\"docId\", \"=\", docId).executeTakeFirst())?.name;\n\t}\n\tparseFileMetadata(input) {\n\t\tconst metadata = input.metadata;\n\t\tif (!metadata || typeof metadata !== \"object\" || metadata.kind !== \"file\" || typeof metadata.documentType !== \"string\") throw new Error(`ADD_RELATIONSHIP for target ${input.targetId}: missing or invalid drive/child file metadata (expected { kind: \"file\", parentFolderId, documentType })`);\n\t\tconst typed = metadata;\n\t\treturn {\n\t\t\tkind: \"file\",\n\t\t\tparentFolderId: typed.parentFolderId ?? null,\n\t\t\tdocumentType: typed.documentType\n\t\t};\n\t}\n\tasync upsertDocumentName(trx, docId, name) {\n\t\tawait trx.insertInto(\"DocumentName\").values({\n\t\t\tdocId,\n\t\t\tname\n\t\t}).onConflict((oc) => oc.column(\"docId\").doUpdateSet({\n\t\t\tname,\n\t\t\tupdatedAt: /* @__PURE__ */ new Date()\n\t\t})).execute();\n\t}\n};\n//#endregion\n//#region src/read-model/drive-node-view.ts\nconst DEFAULT_LIMIT$1 = 100;\nfunction parseListChildrenPaging(paging) {\n\tif (paging === void 0) return {\n\t\tlimit: DEFAULT_LIMIT$1,\n\t\tcursor: null\n\t};\n\tif (!Number.isInteger(paging.limit) || paging.limit < 1) throw new Error(`Invalid paging limit: ${String(paging.limit)} (must be an integer >= 1)`);\n\tif (paging.cursor === \"\") return {\n\t\tlimit: paging.limit,\n\t\tcursor: null\n\t};\n\treturn {\n\t\tlimit: paging.limit,\n\t\tcursor: decodeKeysetCursor(paging.cursor)\n\t};\n}\nfunction encodeKeysetCursor(createdAt, id) {\n\treturn globalThis.btoa(JSON.stringify({\n\t\tcreatedAt: createdAt.toISOString(),\n\t\tid\n\t}));\n}\nfunction decodeKeysetCursor(cursor) {\n\tlet decoded;\n\ttry {\n\t\tdecoded = globalThis.atob(cursor);\n\t} catch {\n\t\tthrow new Error(`Invalid paging cursor: ${JSON.stringify(cursor)} (must be a keyset cursor returned by a prior page)`);\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(decoded);\n\t} catch {\n\t\tthrow new Error(`Invalid paging cursor: ${JSON.stringify(cursor)} (must be a keyset cursor returned by a prior page)`);\n\t}\n\tif (parsed === null || typeof parsed !== \"object\" || typeof parsed.createdAt !== \"string\" || typeof parsed.id !== \"string\") throw new Error(`Invalid paging cursor: ${JSON.stringify(cursor)} (must be a keyset cursor returned by a prior page)`);\n\tconst createdAt = new Date(parsed.createdAt);\n\tif (Number.isNaN(createdAt.getTime())) throw new Error(`Invalid paging cursor: ${JSON.stringify(cursor)} (createdAt is not a valid timestamp)`);\n\treturn {\n\t\tcreatedAt,\n\t\tid: parsed.id\n\t};\n}\nvar DriveNodeView = class {\n\tconstructor(db) {\n\t\tthis.db = db;\n\t}\n\tasync getNode(driveId, nodeId) {\n\t\tconst row = await this.db.selectFrom(\"DriveNode\").selectAll().where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", nodeId).executeTakeFirst();\n\t\tif (!row) return void 0;\n\t\treturn rowToNode(row);\n\t}\n\tasync listChildren(driveId, parentFolder, paging) {\n\t\tconst { limit, cursor } = parseListChildrenPaging(paging);\n\t\tlet query = this.db.selectFrom(\"DriveNode\").selectAll().where(\"driveId\", \"=\", driveId);\n\t\tif (parentFolder === null) query = query.where(\"parentFolder\", \"is\", null);\n\t\telse if (parentFolder !== void 0) query = query.where(\"parentFolder\", \"=\", parentFolder);\n\t\tif (cursor !== null) query = query.where((eb) => eb(eb.refTuple(\"createdAt\", \"id\"), \">\", eb.tuple(cursor.createdAt, cursor.id)));\n\t\tconst rows = await query.orderBy(\"createdAt\", \"asc\").orderBy(\"id\", \"asc\").limit(limit + 1).execute();\n\t\tconst hasMore = rows.length > limit;\n\t\tconst sliced = hasMore ? rows.slice(0, limit) : rows;\n\t\tconst last = sliced[sliced.length - 1];\n\t\treturn {\n\t\t\tresults: sliced.map(rowToNode),\n\t\t\toptions: {\n\t\t\t\tcursor: paging?.cursor ?? \"\",\n\t\t\t\tlimit\n\t\t\t},\n\t\t\tnextCursor: hasMore ? encodeKeysetCursor(last.createdAt, last.id) : void 0\n\t\t};\n\t}\n\tasync listAll(driveId) {\n\t\treturn (await this.db.selectFrom(\"DriveNode\").selectAll().where(\"driveId\", \"=\", driveId).orderBy(\"createdAt\", \"asc\").orderBy(\"id\", \"asc\").execute()).map(rowToNode);\n\t}\n\tasync getDescendants(driveId, root) {\n\t\treturn (await this.db.withRecursive(\"descendants\", (qb) => qb.selectFrom(\"DriveNode\").select([\n\t\t\t\"driveId\",\n\t\t\t\"id\",\n\t\t\t\"kind\",\n\t\t\t\"name\",\n\t\t\t\"requestedName\",\n\t\t\t\"parentFolder\",\n\t\t\t\"documentType\",\n\t\t\t\"createdAt\"\n\t\t]).where(\"driveId\", \"=\", driveId).where(\"id\", \"=\", root).unionAll(qb.selectFrom(\"DriveNode\").innerJoin(\"descendants\", \"DriveNode.parentFolder\", \"descendants.id\").where(\"DriveNode.driveId\", \"=\", driveId).select([\n\t\t\t\"DriveNode.driveId\",\n\t\t\t\"DriveNode.id\",\n\t\t\t\"DriveNode.kind\",\n\t\t\t\"DriveNode.name\",\n\t\t\t\"DriveNode.requestedName\",\n\t\t\t\"DriveNode.parentFolder\",\n\t\t\t\"DriveNode.documentType\",\n\t\t\t\"DriveNode.createdAt\"\n\t\t]))).selectFrom(\"descendants\").select([\n\t\t\t\"driveId\",\n\t\t\t\"id\",\n\t\t\t\"kind\",\n\t\t\t\"name\",\n\t\t\t\"requestedName\",\n\t\t\t\"parentFolder\",\n\t\t\t\"documentType\"\n\t\t]).orderBy(\"createdAt\", \"asc\").orderBy(\"id\", \"asc\").execute()).map(rowToNode);\n\t}\n};\nfunction rowToNode(row) {\n\tif (row.kind === \"file\") {\n\t\tif (row.documentType === null) throw new Error(`DriveNode ${row.driveId}/${row.id}: file row has null documentType, which violates the schema CHECK constraint`);\n\t\treturn {\n\t\t\tkind: \"file\",\n\t\t\tid: row.id,\n\t\t\tdriveId: row.driveId,\n\t\t\tparentFolder: row.parentFolder,\n\t\t\tname: row.name,\n\t\t\tdocumentType: row.documentType\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"folder\",\n\t\tid: row.id,\n\t\tdriveId: row.driveId,\n\t\tparentFolder: row.parentFolder,\n\t\tname: row.name\n\t};\n}\n//#endregion\n//#region src/client/reactor-drive-client.ts\n/**\n* Implementation of {@link IDriveClient} backed by the reactor's relationship\n* primitives and the drive-scoped folder actions. Folder structure lives in\n* the operation log (ADD_FOLDER/UPDATE_FOLDER/REMOVE_FOLDER + ADD_RELATIONSHIP\n* for files) and is materialised by `NodeProcessor` into the `DriveNode`\n* table consumed via {@link IDriveReadModel}.\n*/\nvar ReactorDriveClient = class {\n\treactor;\n\treadModel;\n\tconstructor(args) {\n\t\tthis.reactor = args.reactor;\n\t\tthis.readModel = args.readModel;\n\t}\n\tasync create(input, signal) {\n\t\tconst driveDoc = reactorDriveCreateDocument({ global: {\n\t\t\tname: input.global.name,\n\t\t\ticon: input.global.icon ?? null\n\t\t} });\n\t\tif (input.local) {\n\t\t\tif (typeof input.local.sharingType === \"string\") driveDoc.state.local.sharingType = input.local.sharingType;\n\t\t\tif (typeof input.local.availableOffline === \"boolean\") driveDoc.state.local.availableOffline = input.local.availableOffline;\n\t\t}\n\t\tif (input.preferredEditor) driveDoc.header.meta = {\n\t\t\t...driveDoc.header.meta,\n\t\t\tpreferredEditor: input.preferredEditor\n\t\t};\n\t\tconst created = await this.reactor.create(driveDoc, void 0, signal);\n\t\treturn this.toLegacyDriveDocument(created, created.header.id);\n\t}\n\tasync addFile(driveIdentifier, document, parentFolder, signal) {\n\t\tconst documentId = document.header.id;\n\t\tconst createInput = {\n\t\t\tmodel: document.header.documentType,\n\t\t\tversion: 0,\n\t\t\tdocumentId,\n\t\t\tsigning: {\n\t\t\t\tsignature: documentId,\n\t\t\t\tpublicKey: document.header.sig.publicKey,\n\t\t\t\tnonce: document.header.sig.nonce,\n\t\t\t\tcreatedAtUtcIso: document.header.createdAtUtcIso,\n\t\t\t\tdocumentType: document.header.documentType\n\t\t\t},\n\t\t\tslug: document.header.slug,\n\t\t\tname: document.header.name,\n\t\t\tbranch: document.header.branch,\n\t\t\tmeta: document.header.meta,\n\t\t\tprotocolVersions: document.header.protocolVersions ?? { \"base-reducer\": 2 }\n\t\t};\n\t\tconst metadata = {\n\t\t\tkind: \"file\",\n\t\t\tparentFolderId: parentFolder ?? null,\n\t\t\tdocumentType: document.header.documentType\n\t\t};\n\t\tconst request = { jobs: [{\n\t\t\tkey: \"create\",\n\t\t\tdocumentId,\n\t\t\tscope: \"document\",\n\t\t\tbranch: \"main\",\n\t\t\tactions: [createDocumentAction(createInput), upgradeDocumentAction({\n\t\t\t\tdocumentId,\n\t\t\t\tmodel: document.header.documentType,\n\t\t\t\tfromVersion: 0,\n\t\t\t\ttoVersion: document.state.document.version,\n\t\t\t\tinitialState: document.state\n\t\t\t})],\n\t\t\tdependsOn: []\n\t\t}, {\n\t\t\tkey: \"link\",\n\t\t\tdocumentId: driveIdentifier,\n\t\t\tscope: \"document\",\n\t\t\tbranch: \"main\",\n\t\t\tactions: [addRelationshipAction(driveIdentifier, documentId, DRIVE_CHILD_RELATIONSHIP_TYPE, metadata)],\n\t\t\tdependsOn: [\"create\"]\n\t\t}] };\n\t\tawait this.reactor.executeBatch(request, signal);\n\t\treturn this.reactor.get(documentId, void 0, signal);\n\t}\n\tasync addFolder(driveIdentifier, name, parentFolder, signal) {\n\t\tconst folderId = generateId();\n\t\tawait this.reactor.execute(driveIdentifier, \"main\", [addFolderAction({\n\t\t\tfolderId,\n\t\t\tparentFolderId: parentFolder ?? null,\n\t\t\tname\n\t\t})], signal);\n\t\treturn {\n\t\t\tid: folderId,\n\t\t\tkind: \"folder\",\n\t\t\tname,\n\t\t\tparentFolder: parentFolder ?? null\n\t\t};\n\t}\n\tasync removeNode(driveIdentifier, nodeId, signal) {\n\t\tconst node = await this.readModel.getNode(driveIdentifier, nodeId, signal);\n\t\tif (!node) throw new Error(`Node ${nodeId} not found in drive ${driveIdentifier}`);\n\t\tif (node.kind === \"folder\") {\n\t\t\tconst subtree = await this.readModel.getDescendants(driveIdentifier, nodeId, signal);\n\t\t\tconst fileDescendants = subtree.filter((n) => n.kind === \"file\");\n\t\t\tconst subFolders = subtree.filter((n) => n.kind === \"folder\").filter((f) => f.id !== nodeId);\n\t\t\tconst deepestFirstFolders = this.orderDeepestFirst(subFolders, nodeId);\n\t\t\tconst batch = [\n\t\t\t\t...fileDescendants.map((f) => removeRelationshipAction(driveIdentifier, f.id, DRIVE_CHILD_RELATIONSHIP_TYPE)),\n\t\t\t\t...deepestFirstFolders.map((f) => removeFolderAction({ folderId: f.id })),\n\t\t\t\tremoveFolderAction({ folderId: nodeId })\n\t\t\t];\n\t\t\tawait this.reactor.execute(driveIdentifier, \"main\", batch, signal);\n\t\t\tfor (const file of fileDescendants) await this.reactor.deleteDocument(file.id, \"cascade\", signal);\n\t\t\treturn;\n\t\t}\n\t\tawait this.reactor.execute(driveIdentifier, \"main\", [removeRelationshipAction(driveIdentifier, nodeId, DRIVE_CHILD_RELATIONSHIP_TYPE)], signal);\n\t\tawait this.reactor.deleteDocument(nodeId, void 0, signal);\n\t}\n\tasync renameNode(driveIdentifier, nodeId, name, signal) {\n\t\tconst node = await this.readModel.getNode(driveIdentifier, nodeId, signal);\n\t\tif (!node) throw new Error(`Node ${nodeId} not found in drive ${driveIdentifier}`);\n\t\tif (node.kind === \"file\") await this.reactor.rename(nodeId, name, \"main\", signal);\n\t\telse await this.reactor.execute(driveIdentifier, \"main\", [updateFolderAction({\n\t\t\tfolderId: nodeId,\n\t\t\tname\n\t\t})], signal);\n\t\tconst updated = await this.readModel.getNode(driveIdentifier, nodeId, signal);\n\t\tif (!updated) throw new Error(\"Node missing from drive after rename\");\n\t\treturn this.toLegacyNode(updated);\n\t}\n\tasync setPreferredEditorOnNode(nodeId, preferredEditor, signal) {\n\t\treturn this.reactor.setPreferredEditor(nodeId, preferredEditor, \"main\", signal);\n\t}\n\tasync moveNode(driveIdentifier, srcNodeId, targetParentFolderId, signal) {\n\t\tconst node = await this.readModel.getNode(driveIdentifier, srcNodeId, signal);\n\t\tif (!node) throw new Error(`Node ${srcNodeId} not found in drive ${driveIdentifier}`);\n\t\tif (node.kind === \"folder\") await this.reactor.execute(driveIdentifier, \"main\", [updateFolderAction({\n\t\t\tfolderId: srcNodeId,\n\t\t\tparentFolderId: targetParentFolderId ?? null\n\t\t})], signal);\n\t\telse {\n\t\t\tconst metadata = {\n\t\t\t\tkind: \"file\",\n\t\t\t\tparentFolderId: targetParentFolderId ?? null,\n\t\t\t\tdocumentType: node.documentType\n\t\t\t};\n\t\t\tawait this.reactor.execute(driveIdentifier, \"main\", [removeRelationshipAction(driveIdentifier, srcNodeId, DRIVE_CHILD_RELATIONSHIP_TYPE), addRelationshipAction(driveIdentifier, srcNodeId, DRIVE_CHILD_RELATIONSHIP_TYPE, metadata)], signal);\n\t\t}\n\t\tconst drive = await this.reactor.get(driveIdentifier, void 0, signal);\n\t\treturn this.toLegacyDriveDocument(drive, driveIdentifier);\n\t}\n\tasync copyNode(driveIdentifier, srcNodeId, targetParentFolderId, signal) {\n\t\tif (!await this.readModel.getNode(driveIdentifier, srcNodeId, signal)) throw new Error(`Node ${srcNodeId} not found in drive ${driveIdentifier}`);\n\t\tconst subtree = await this.readModel.getDescendants(driveIdentifier, srcNodeId, signal);\n\t\tif (targetParentFolderId !== void 0 && subtree.some((n) => n.id === targetParentFolderId)) throw new Error(`Cannot copy node ${srcNodeId} into itself or one of its descendants (target: ${targetParentFolderId})`);\n\t\tconst idMap = /* @__PURE__ */ new Map();\n\t\tfor (const node of subtree) idMap.set(node.id, generateId());\n\t\tconst jobs = [];\n\t\tconst driveActions = [];\n\t\tconst fileCreateKeys = [];\n\t\tfor (const node of subtree) {\n\t\t\tconst newId = idMap.get(node.id);\n\t\t\tlet newParent;\n\t\t\tif (node.id === srcNodeId) newParent = targetParentFolderId ?? null;\n\t\t\telse {\n\t\t\t\tif (node.parentFolder == null) throw new Error(`copyNode: descendant ${node.id} has no parentFolder`);\n\t\t\t\tconst mapped = idMap.get(node.parentFolder);\n\t\t\t\tif (mapped === void 0) throw new Error(`copyNode: descendant ${node.id} parent ${node.parentFolder} missing from idMap`);\n\t\t\t\tnewParent = mapped;\n\t\t\t}\n\t\t\tif (node.kind === \"folder\") {\n\t\t\t\tdriveActions.push(addFolderAction({\n\t\t\t\t\tfolderId: newId,\n\t\t\t\t\tparentFolderId: newParent,\n\t\t\t\t\tname: node.name\n\t\t\t\t}));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst srcDoc = await this.reactor.get(node.id, void 0, signal);\n\t\t\tconst documentType = srcDoc.header.documentType;\n\t\t\tconst { results: allModules } = await this.reactor.getDocumentModelModules();\n\t\t\tconst modulesForType = allModules.filter((m) => m.documentModel.global.id === documentType);\n\t\t\tif (modulesForType.length === 0) throw new Error(`Document model module not found for type: ${documentType}`);\n\t\t\tconst reducers = {};\n\t\t\tfor (const m of modulesForType) reducers[m.version ?? 1] = m.reducer;\n\t\t\tconst config = { reducers };\n\t\t\tconst duplicated = replayDocumentVersioned(srcDoc.initialState, srcDoc.operations, config, createPresignedHeader(newId, documentType));\n\t\t\tassertAuthPreservedOnDuplicate(node.id, srcDoc.state.auth, duplicated.state.auth);\n\t\t\tduplicated.header.name = node.name;\n\t\t\tconst createInput = {\n\t\t\t\tmodel: duplicated.header.documentType,\n\t\t\t\tversion: 0,\n\t\t\t\tdocumentId: newId,\n\t\t\t\tsigning: {\n\t\t\t\t\tsignature: newId,\n\t\t\t\t\tpublicKey: duplicated.header.sig.publicKey,\n\t\t\t\t\tnonce: duplicated.header.sig.nonce,\n\t\t\t\t\tcreatedAtUtcIso: duplicated.header.createdAtUtcIso,\n\t\t\t\t\tdocumentType: duplicated.header.documentType\n\t\t\t\t},\n\t\t\t\tslug: duplicated.header.slug,\n\t\t\t\tname: duplicated.header.name,\n\t\t\t\tbranch: duplicated.header.branch,\n\t\t\t\tmeta: duplicated.header.meta,\n\t\t\t\tprotocolVersions: duplicated.header.protocolVersions ?? { \"base-reducer\": 2 }\n\t\t\t};\n\t\t\tconst createKey = `create:${newId}`;\n\t\t\tjobs.push({\n\t\t\t\tkey: createKey,\n\t\t\t\tdocumentId: newId,\n\t\t\t\tscope: \"document\",\n\t\t\t\tbranch: \"main\",\n\t\t\t\tactions: [createDocumentAction(createInput), upgradeDocumentAction({\n\t\t\t\t\tdocumentId: newId,\n\t\t\t\t\tmodel: duplicated.header.documentType,\n\t\t\t\t\tfromVersion: 0,\n\t\t\t\t\ttoVersion: duplicated.state.document.version,\n\t\t\t\t\tinitialState: duplicated.state\n\t\t\t\t})],\n\t\t\t\tdependsOn: []\n\t\t\t});\n\t\t\tfileCreateKeys.push(createKey);\n\t\t\tconst metadata = {\n\t\t\t\tkind: \"file\",\n\t\t\t\tparentFolderId: newParent,\n\t\t\t\tdocumentType: duplicated.header.documentType\n\t\t\t};\n\t\t\tdriveActions.push(addRelationshipAction(driveIdentifier, newId, DRIVE_CHILD_RELATIONSHIP_TYPE, metadata));\n\t\t}\n\t\tif (driveActions.length > 0) jobs.push({\n\t\t\tkey: \"drive\",\n\t\t\tdocumentId: driveIdentifier,\n\t\t\tscope: \"document\",\n\t\t\tbranch: \"main\",\n\t\t\tactions: driveActions,\n\t\t\tdependsOn: fileCreateKeys\n\t\t});\n\t\tif (jobs.length > 0) {\n\t\t\tconst request = { jobs };\n\t\t\tawait this.reactor.executeBatch(request, signal);\n\t\t}\n\t\tconst drive = await this.reactor.get(driveIdentifier, void 0, signal);\n\t\treturn this.toLegacyDriveDocument(drive, driveIdentifier);\n\t}\n\tasync getNode(driveIdentifier, nodeId, signal) {\n\t\tconst node = await this.readModel.getNode(driveIdentifier, nodeId, signal);\n\t\tif (!node) throw new Error(`Node ${nodeId} not found in drive ${driveIdentifier}`);\n\t\treturn this.toLegacyNode(node);\n\t}\n\tasync listNodes(driveIdentifier, parentFolder, paging, signal) {\n\t\tconst page = await this.readModel.listChildren(driveIdentifier, parentFolder, paging, signal);\n\t\treturn {\n\t\t\tresults: page.results.map((node) => this.toLegacyNode(node)),\n\t\t\toptions: page.options,\n\t\t\t...page.nextCursor !== void 0 ? { nextCursor: page.nextCursor } : {},\n\t\t\t...page.totalCount !== void 0 ? { totalCount: page.totalCount } : {}\n\t\t};\n\t}\n\ttoLegacyNode(node) {\n\t\tif (node.kind === \"file\") {\n\t\t\tconst file = node;\n\t\t\treturn {\n\t\t\t\tid: file.id,\n\t\t\t\tkind: \"file\",\n\t\t\t\tname: file.name,\n\t\t\t\tparentFolder: file.parentFolder,\n\t\t\t\tdocumentType: file.documentType\n\t\t\t};\n\t\t}\n\t\tconst folder = node;\n\t\treturn {\n\t\t\tid: folder.id,\n\t\t\tkind: \"folder\",\n\t\t\tname: folder.name,\n\t\t\tparentFolder: folder.parentFolder\n\t\t};\n\t}\n\tasync toLegacyDriveDocument(doc, driveId) {\n\t\tif (doc.header.documentType !== \"powerhouse/reactor-drive\") throw new Error(`Document ${doc.header.id} is not a reactor-drive document`);\n\t\tconst allNodes = await this.readModel.listAll(driveId);\n\t\tconst legacy = structuredClone(doc);\n\t\tconst existingGlobal = legacy.state.global;\n\t\tlegacy.state.global = {\n\t\t\tname: existingGlobal.name ?? \"\",\n\t\t\ticon: existingGlobal.icon ?? null,\n\t\t\tnodes: allNodes.map((n) => this.toLegacyNode(n))\n\t\t};\n\t\treturn legacy;\n\t}\n\torderDeepestFirst(folders, rootId) {\n\t\tconst depthById = /* @__PURE__ */ new Map();\n\t\tconst compute = (id) => {\n\t\t\tif (id === rootId) return 0;\n\t\t\tconst cached = depthById.get(id);\n\t\t\tif (cached !== void 0) return cached;\n\t\t\tconst folder = folders.find((f) => f.id === id);\n\t\t\tif (!folder) return 0;\n\t\t\tconst depth = compute(folder.parentFolder ?? rootId) + 1;\n\t\t\tdepthById.set(id, depth);\n\t\t\treturn depth;\n\t\t};\n\t\treturn folders.slice().sort((a, b) => compute(b.id) - compute(a.id));\n\t}\n};\n//#endregion\n//#region src/subgraph/schema.ts\nconst typeDefs = gql`\n enum ReactorDriveNodeKind {\n FILE\n FOLDER\n }\n\n input ReactorDrivePagingInput {\n cursor: String\n limit: Int\n }\n\n type ReactorDriveFileNode {\n id: ID!\n driveId: ID!\n name: String!\n parentFolder: ID\n documentType: String!\n }\n\n type ReactorDriveFolderNode {\n id: ID!\n driveId: ID!\n name: String!\n parentFolder: ID\n children(\n paging: ReactorDrivePagingInput\n kind: ReactorDriveNodeKind\n ): ReactorDriveNodePage!\n }\n\n union ReactorDriveNode = ReactorDriveFileNode | ReactorDriveFolderNode\n\n type ReactorDriveNodePage {\n results: [ReactorDriveNode!]!\n nextCursor: String\n hasMore: Boolean!\n totalCount: Int\n }\n\n type ReactorDrive {\n id: ID!\n name: String!\n icon: String\n sharingType: String!\n availableOffline: Boolean!\n rootNodes(\n paging: ReactorDrivePagingInput\n kind: ReactorDriveNodeKind\n ): ReactorDriveNodePage!\n }\n\n type Query {\n reactorDrive(id: ID!): ReactorDrive\n reactorDriveNode(driveId: ID!, id: ID!): ReactorDriveNode\n reactorDriveDescendants(driveId: ID!, root: ID!): [ReactorDriveNode!]!\n }\n`;\n//#endregion\n//#region src/subgraph/resolvers.ts\nconst DEFAULT_LIMIT = 100;\nfunction toPaging(input) {\n\tif (!input) return void 0;\n\treturn {\n\t\tcursor: input.cursor ?? \"\",\n\t\tlimit: input.limit ?? DEFAULT_LIMIT\n\t};\n}\nfunction filterByKind(page, kind) {\n\tif (!kind) return page;\n\tconst wanted = kind === \"FILE\" ? \"file\" : \"folder\";\n\treturn {\n\t\t...page,\n\t\tresults: page.results.filter((node) => node.kind === wanted)\n\t};\n}\nfunction shapePage(page) {\n\treturn {\n\t\tresults: page.results,\n\t\tnextCursor: page.nextCursor,\n\t\thasMore: page.nextCursor !== void 0,\n\t\ttotalCount: page.totalCount\n\t};\n}\n/**\n* Builds GraphQL resolvers backed by the drive read model. The resolvers are\n* pure — every external dependency is read off the GraphQL context. Wiring\n* the resolvers into a subgraph (e.g. `reactor-api`'s `ISubgraph`) is the\n* caller's responsibility.\n*/\nfunction createReactorDriveResolvers() {\n\treturn {\n\t\tQuery: {\n\t\t\tasync reactorDrive(_root, args, ctx) {\n\t\t\t\tconst document = await ctx.reactorClient.get(args.id);\n\t\t\t\tif (document.header.documentType !== \"powerhouse/reactor-drive\") return null;\n\t\t\t\treturn {\n\t\t\t\t\tid: document.header.id,\n\t\t\t\t\tname: document.state.global.name,\n\t\t\t\t\ticon: document.state.global.icon,\n\t\t\t\t\tsharingType: document.state.local.sharingType,\n\t\t\t\t\tavailableOffline: document.state.local.availableOffline\n\t\t\t\t};\n\t\t\t},\n\t\t\tasync reactorDriveNode(_root, args, ctx) {\n\t\t\t\treturn ctx.readModel.getNode(args.driveId, args.id);\n\t\t\t},\n\t\t\tasync reactorDriveDescendants(_root, args, ctx) {\n\t\t\t\treturn ctx.readModel.getDescendants(args.driveId, args.root);\n\t\t\t}\n\t\t},\n\t\tReactorDrive: { async rootNodes(parent, args, ctx) {\n\t\t\treturn shapePage(filterByKind(await ctx.readModel.listChildren(parent.id, null, toPaging(args.paging)), args.kind));\n\t\t} },\n\t\tReactorDriveFolderNode: { async children(parent, args, ctx) {\n\t\t\treturn shapePage(filterByKind(await ctx.readModel.listChildren(parent.driveId, parent.id, toPaging(args.paging)), args.kind));\n\t\t} },\n\t\tReactorDriveNode: { __resolveType(node) {\n\t\t\treturn node.kind === \"file\" ? \"ReactorDriveFileNode\" : \"ReactorDriveFolderNode\";\n\t\t} }\n\t};\n}\n//#endregion\n//#region src/migration/migrate-legacy-state.ts\n/**\n* Translates a legacy `document-drive` `state.global.nodes` array into the\n* action vocabulary used by the new reactor-drive module.\n*\n* Folder nodes are emitted as `ADD_FOLDER` actions targeting the drive\n* document. File nodes are emitted as `ADD_RELATIONSHIP` actions on the drive\n* with `drive/child` metadata carrying the parent folder id. File nodes\n* assume the underlying PHDocument still exists under the same id — the\n* migration only re-links it into the new drive, it does not recreate\n* documents.\n*\n* Re-running the migration is safe: existing `DriveNode` rows are skipped\n* so already-migrated nodes are left untouched.\n*/\nasync function migrateLegacyDriveState(args) {\n\tconst { reactor, readModel, driveId, nodes, signal } = args;\n\tconst branch = args.branch ?? \"main\";\n\tconst ordered = orderLegacyNodes(nodes);\n\tconst actions = [];\n\tlet skippedExisting = 0;\n\tfor (const node of ordered) {\n\t\tif (await readModel.getNode(driveId, node.id, signal)) {\n\t\t\tskippedExisting += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tactions.push(toAction(driveId, node));\n\t}\n\tif (actions.length === 0) return {\n\t\temittedActions: 0,\n\t\tskippedExisting\n\t};\n\tawait reactor.execute(driveId, branch, actions, signal);\n\treturn {\n\t\temittedActions: actions.length,\n\t\tskippedExisting\n\t};\n}\nfunction toAction(driveId, node) {\n\tif (node.kind === \"folder\") return addFolderAction({\n\t\tfolderId: node.id,\n\t\tparentFolderId: node.parentFolder ?? null,\n\t\tname: node.name\n\t});\n\tconst fileNode = node;\n\tconst metadata = {\n\t\tkind: \"file\",\n\t\tparentFolderId: fileNode.parentFolder ?? null,\n\t\tdocumentType: fileNode.documentType\n\t};\n\treturn addRelationshipAction(driveId, fileNode.id, DRIVE_CHILD_RELATIONSHIP_TYPE, metadata);\n}\n/**\n* Sorts legacy nodes so that any folder appears before its children. The\n* legacy state stores nodes in insertion order, which usually already\n* satisfies that property, but defensive sorting keeps replay deterministic\n* if the input was constructed out of order.\n*/\nfunction orderLegacyNodes(nodes) {\n\tconst byId = /* @__PURE__ */ new Map();\n\tfor (const node of nodes) byId.set(node.id, node);\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst ordered = [];\n\tfor (const start of nodes) {\n\t\tif (visited.has(start.id)) continue;\n\t\tconst chain = [];\n\t\tconst seenInWalk = /* @__PURE__ */ new Set();\n\t\tlet current = start;\n\t\twhile (current && !visited.has(current.id) && !seenInWalk.has(current.id)) {\n\t\t\tseenInWalk.add(current.id);\n\t\t\tchain.push(current);\n\t\t\tconst parentId = current.parentFolder;\n\t\t\tcurrent = parentId ? byId.get(parentId) : void 0;\n\t\t}\n\t\twhile (chain.length > 0) {\n\t\t\tconst node = chain.pop();\n\t\t\tif (visited.has(node.id)) continue;\n\t\t\tvisited.add(node.id);\n\t\t\tordered.push(node);\n\t\t}\n\t}\n\treturn ordered;\n}\n//#endregion\nexport { DRIVE_CHILD_RELATIONSHIP_TYPE, DriveNodeView, NodeProcessor, REACTOR_DRIVE_DOCUMENT_TYPE, REACTOR_DRIVE_FILE_EXTENSION, ReactorDriveClient, addFolderAction, createReactorDriveResolvers, getReactorDriveMigrationStatus, migrateLegacyDriveState, reactorDriveActions, reactorDriveCreateDocument, reactorDriveCreateState, reactorDriveDocumentModelModule, reactorDriveDocumentReducer, reactorDriveStateReducer, typeDefs as reactorDriveSubgraphTypeDefs, removeFolderAction, resolveCollision, runReactorDriveMigrations, setAvailableOfflineAction, setDriveIconAction, setDriveNameAction, setSharingTypeAction, updateFolderAction };\n\n//# sourceMappingURL=index.js.map","//#region \\0rolldown/runtime.js\nvar __defProp = Object.defineProperty;\nvar __exportAll = (all, no_symbols) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\tif (!no_symbols) __defProp(target, Symbol.toStringTag, { value: \"Module\" });\n\treturn target;\n};\n//#endregion\nexport { __exportAll as t };\n","import { t as __exportAll } from \"./chunk-pbuEa-1d.js\";\nimport { BaseDocumentHeaderSchema, BaseDocumentStateSchema, baseActions, baseCreateDocument, baseLoadFromInputVersioned, baseSaveToFileHandle, createAction, createBaseState, createReducer, createState, defaultBaseState, isDocumentAction } from \"document-model\";\nimport * as z$1 from \"zod\";\nimport { z } from \"zod\";\n//#region document-models/reactor-group/v1/gen/schema/zod.ts\nconst isDefinedNonNullAny = (v) => v !== void 0 && v !== null;\nconst definedNonNullAnySchema = z$1.any().refine((v) => isDefinedNonNullAny(v));\nfunction AddMemberInputSchema() {\n\treturn z$1.object({ address: z$1.string() });\n}\nfunction ReactorGroupStateSchema() {\n\treturn z$1.object({\n\t\t__typename: z$1.literal(\"ReactorGroupState\").optional(),\n\t\tdescription: z$1.string(),\n\t\tmembers: z$1.array(z$1.string()),\n\t\tname: z$1.string()\n\t});\n}\nfunction RemoveMemberInputSchema() {\n\treturn z$1.object({ address: z$1.string() });\n}\nfunction SetGroupDescriptionInputSchema() {\n\treturn z$1.object({ description: z$1.string() });\n}\nfunction SetGroupNameInputSchema() {\n\treturn z$1.object({ name: z$1.string() });\n}\n//#endregion\n//#region document-models/reactor-group/v1/gen/group/creators.ts\n/**\n* WARNING: DO NOT EDIT\n* This file is auto-generated and updated by codegen\n*/\nvar creators_exports = /* @__PURE__ */ __exportAll({\n\taddMember: () => addMember,\n\tremoveMember: () => removeMember,\n\tsetGroupDescription: () => setGroupDescription,\n\tsetGroupName: () => setGroupName\n});\nconst setGroupName = (input) => createAction(\"SET_GROUP_NAME\", { ...input }, void 0, SetGroupNameInputSchema, \"global\");\nconst setGroupDescription = (input) => createAction(\"SET_GROUP_DESCRIPTION\", { ...input }, void 0, SetGroupDescriptionInputSchema, \"global\");\nconst addMember = (input) => createAction(\"ADD_MEMBER\", { ...input }, void 0, AddMemberInputSchema, \"global\");\nconst removeMember = (input) => createAction(\"REMOVE_MEMBER\", { ...input }, void 0, RemoveMemberInputSchema, \"global\");\n//#endregion\n//#region document-models/reactor-group/v1/actions.ts\n/**\n* WARNING: DO NOT EDIT\n* This file is auto-generated and updated by codegen\n*/\n/** Actions for the ReactorGroup document model */\nconst actions = {\n\t...baseActions,\n\t...creators_exports\n};\n//#endregion\n//#region document-models/reactor-group/v1/gen/document-model.ts\nconst documentModel = {\n\tid: \"powerhouse/reactor-group\",\n\tname: \"Reactor Group\",\n\tauthor: {\n\t\tname: \"Powerhouse\",\n\t\twebsite: \"https://powerhouse.inc\"\n\t},\n\textension: \".phrg\",\n\tdescription: \"A group of member addresses referenced by { group } principals in the auth scope. Group membership is folded at an operation's position during auth evaluation, so reducers are strict and deterministic: duplicate or unknown members are errors, and membership is capped.\",\n\tspecifications: [{\n\t\tstate: {\n\t\t\tlocal: {\n\t\t\t\tschema: \"\",\n\t\t\t\texamples: [],\n\t\t\t\tinitialValue: \"\"\n\t\t\t},\n\t\t\tglobal: {\n\t\t\t\tschema: \"\\\"\\\"\\\"\\nA member address list gated by the group document's own auth scope. Addresses\\nare stored as given and compared case-insensitively, matching how { address }\\nprincipals are compared during auth evaluation.\\n\\\"\\\"\\\"\\ntype ReactorGroupState {\\n \\\"\\\"\\\"Display name of the group.\\\"\\\"\\\"\\n name: String!\\n \\\"\\\"\\\"Free-text description of the group's purpose.\\\"\\\"\\\"\\n description: String!\\n \\\"\\\"\\\"Member wallet addresses. No duplicates under case-insensitive comparison.\\\"\\\"\\\"\\n members: [String!]!\\n}\",\n\t\t\t\texamples: [],\n\t\t\t\tinitialValue: \"{\\n \\\"name\\\": \\\"\\\",\\n \\\"description\\\": \\\"\\\",\\n \\\"members\\\": []\\n}\"\n\t\t\t}\n\t\t},\n\t\tmodules: [{\n\t\t\tid: \"efd6d9bb-869e-4565-b1ca-d9b74385eaf7\",\n\t\t\tname: \"group\",\n\t\t\tdescription: \"Manage the group's identity and its member address list.\",\n\t\t\toperations: [\n\t\t\t\t{\n\t\t\t\t\tid: \"43da2b3d-bad7-40b8-8a84-4cdf892f1519\",\n\t\t\t\t\tname: \"SET_GROUP_NAME\",\n\t\t\t\t\tdescription: \"Set the display name of the group. The name must be non-empty after trimming and at most 200 characters.\",\n\t\t\t\t\tschema: \"input SetGroupNameInput {\\n name: String!\\n}\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [{\n\t\t\t\t\t\tid: \"8be0d16c-1f21-4d95-9536-c5a5867d2ba1\",\n\t\t\t\t\t\tcode: \"InvalidGroupName\",\n\t\t\t\t\t\tname: \"InvalidGroupName\",\n\t\t\t\t\t\tdescription: \"The group name is empty after trimming or longer than 200 characters.\",\n\t\t\t\t\t\ttemplate: \"\"\n\t\t\t\t\t}],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"global\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"aa493898-ce6b-4b28-baf3-1b6fd8425138\",\n\t\t\t\t\tname: \"SET_GROUP_DESCRIPTION\",\n\t\t\t\t\tdescription: \"Set the free-text description of the group. The description is at most 2000 characters.\",\n\t\t\t\t\tschema: \"input SetGroupDescriptionInput {\\n description: String!\\n}\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [{\n\t\t\t\t\t\tid: \"9f0f77a4-6a86-4f5c-9a3f-13a44be29de3\",\n\t\t\t\t\t\tcode: \"InvalidGroupDescription\",\n\t\t\t\t\t\tname: \"InvalidGroupDescription\",\n\t\t\t\t\t\tdescription: \"The group description is longer than 2000 characters.\",\n\t\t\t\t\t\ttemplate: \"\"\n\t\t\t\t\t}],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"global\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"e7990be2-2e40-4624-9f96-df759703ba6b\",\n\t\t\t\t\tname: \"ADD_MEMBER\",\n\t\t\t\t\tdescription: \"Add a member address to the group. The address must be non-empty after trimming, must not already be a member under case-insensitive comparison, and the group must be below the member cap.\",\n\t\t\t\t\tschema: \"input AddMemberInput {\\n address: String!\\n}\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"3f2504e0-4f89-41d3-9a0c-0305e82c3301\",\n\t\t\t\t\t\t\tcode: \"InvalidMemberAddress\",\n\t\t\t\t\t\t\tname: \"InvalidMemberAddress\",\n\t\t\t\t\t\t\tdescription: \"The member address is empty after trimming.\",\n\t\t\t\t\t\t\ttemplate: \"\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"b2c1a9de-58e6-4f3f-9f2a-7f6b1e2d4c5a\",\n\t\t\t\t\t\t\tcode: \"DuplicateMember\",\n\t\t\t\t\t\t\tname: \"DuplicateMember\",\n\t\t\t\t\t\t\tdescription: \"The address is already a member of the group under case-insensitive comparison.\",\n\t\t\t\t\t\t\ttemplate: \"\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"c4d5e6f7-0a1b-4c2d-8e3f-9a0b1c2d3e4f\",\n\t\t\t\t\t\t\tcode: \"GroupMemberLimitExceeded\",\n\t\t\t\t\t\t\tname: \"GroupMemberLimitExceeded\",\n\t\t\t\t\t\t\tdescription: \"The group already holds the maximum number of members.\",\n\t\t\t\t\t\t\ttemplate: \"\"\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"global\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"b1309319-48b7-42b2-a40e-1fecef9a09a4\",\n\t\t\t\t\tname: \"REMOVE_MEMBER\",\n\t\t\t\t\tdescription: \"Remove a member address from the group, matched case-insensitively. Removing an address that is not a member is an error.\",\n\t\t\t\t\tschema: \"input RemoveMemberInput {\\n address: String!\\n}\",\n\t\t\t\t\ttemplate: \"\",\n\t\t\t\t\treducer: \"\",\n\t\t\t\t\terrors: [{\n\t\t\t\t\t\tid: \"d6e7f8a9-1b2c-4d3e-9f4a-0b1c2d3e4f5a\",\n\t\t\t\t\t\tcode: \"MemberNotFound\",\n\t\t\t\t\t\tname: \"MemberNotFound\",\n\t\t\t\t\t\tdescription: \"The address is not a member of the group under case-insensitive comparison.\",\n\t\t\t\t\t\ttemplate: \"\"\n\t\t\t\t\t}],\n\t\t\t\t\texamples: [],\n\t\t\t\t\tscope: \"global\"\n\t\t\t\t}\n\t\t\t]\n\t\t}],\n\t\tversion: 1,\n\t\tchangeLog: []\n\t}]\n};\n//#endregion\n//#region document-models/reactor-group/v1/gen/group/error.ts\nvar InvalidGroupName = class extends Error {\n\terrorCode = \"InvalidGroupName\";\n\tconstructor(message = \"InvalidGroupName\") {\n\t\tsuper(message);\n\t}\n};\nvar InvalidGroupDescription = class extends Error {\n\terrorCode = \"InvalidGroupDescription\";\n\tconstructor(message = \"InvalidGroupDescription\") {\n\t\tsuper(message);\n\t}\n};\nvar InvalidMemberAddress = class extends Error {\n\terrorCode = \"InvalidMemberAddress\";\n\tconstructor(message = \"InvalidMemberAddress\") {\n\t\tsuper(message);\n\t}\n};\nvar DuplicateMember = class extends Error {\n\terrorCode = \"DuplicateMember\";\n\tconstructor(message = \"DuplicateMember\") {\n\t\tsuper(message);\n\t}\n};\nvar GroupMemberLimitExceeded = class extends Error {\n\terrorCode = \"GroupMemberLimitExceeded\";\n\tconstructor(message = \"GroupMemberLimitExceeded\") {\n\t\tsuper(message);\n\t}\n};\nvar MemberNotFound = class extends Error {\n\terrorCode = \"MemberNotFound\";\n\tconstructor(message = \"MemberNotFound\") {\n\t\tsuper(message);\n\t}\n};\n//#endregion\n//#region document-models/reactor-group/v1/src/reducers/group.ts\n/** Every replica folds group state during auth evaluation, so membership is capped. */\nconst MAX_GROUP_MEMBERS = 1e3;\nconst MAX_GROUP_DESCRIPTION_LENGTH = 2e3;\n/** Addresses are compared case-insensitively, matching { address } principals. */\nfunction sameAddress(a, b) {\n\treturn a.toLowerCase() === b.toLowerCase();\n}\nconst reactorGroupGroupOperations = {\n\tsetGroupNameOperation(state, action) {\n\t\tconst name = action.input.name.trim();\n\t\tif (name === \"\" || name.length > 200) throw new InvalidGroupName(`Group name must be non-empty and at most 200 characters`);\n\t\tstate.name = name;\n\t},\n\tsetGroupDescriptionOperation(state, action) {\n\t\tconst description = action.input.description;\n\t\tif (description.length > 2e3) throw new InvalidGroupDescription(`Group description must be at most ${MAX_GROUP_DESCRIPTION_LENGTH} characters`);\n\t\tstate.description = description;\n\t},\n\taddMemberOperation(state, action) {\n\t\tconst address = action.input.address.trim();\n\t\tif (address === \"\") throw new InvalidMemberAddress(\"Member address must be non-empty\");\n\t\tif (state.members.some((member) => sameAddress(member, address))) throw new DuplicateMember(`Address is already a member: ${address}`);\n\t\tif (state.members.length >= 1e3) throw new GroupMemberLimitExceeded(`A group holds at most ${MAX_GROUP_MEMBERS} members`);\n\t\tstate.members.push(address);\n\t},\n\tremoveMemberOperation(state, action) {\n\t\tconst address = action.input.address.trim();\n\t\tconst index = state.members.findIndex((member) => sameAddress(member, address));\n\t\tif (index === -1) throw new MemberNotFound(`Address is not a member: ${address}`);\n\t\tstate.members.splice(index, 1);\n\t}\n};\n//#endregion\n//#region document-models/reactor-group/v1/gen/reducer.ts\nconst stateReducer = (state, action, dispatch) => {\n\tif (isDocumentAction(action)) return state;\n\tswitch (action.type) {\n\t\tcase \"SET_GROUP_NAME\":\n\t\t\tSetGroupNameInputSchema().parse(action.input);\n\t\t\treactorGroupGroupOperations.setGroupNameOperation(state[action.scope], action, dispatch);\n\t\t\tbreak;\n\t\tcase \"SET_GROUP_DESCRIPTION\":\n\t\t\tSetGroupDescriptionInputSchema().parse(action.input);\n\t\t\treactorGroupGroupOperations.setGroupDescriptionOperation(state[action.scope], action, dispatch);\n\t\t\tbreak;\n\t\tcase \"ADD_MEMBER\":\n\t\t\tAddMemberInputSchema().parse(action.input);\n\t\t\treactorGroupGroupOperations.addMemberOperation(state[action.scope], action, dispatch);\n\t\t\tbreak;\n\t\tcase \"REMOVE_MEMBER\":\n\t\t\tRemoveMemberInputSchema().parse(action.input);\n\t\t\treactorGroupGroupOperations.removeMemberOperation(state[action.scope], action, dispatch);\n\t\t\tbreak;\n\t\tdefault: return state;\n\t}\n};\nconst reducer = createReducer(stateReducer);\n//#endregion\n//#region document-models/reactor-group/upgrades/versions.ts\nconst supportedVersions = [1];\nconst latestVersion = supportedVersions[0];\n//#endregion\n//#region document-models/reactor-group/upgrades/upgrade-manifest.ts\nconst reactorGroupUpgradeManifest = {\n\tdocumentType: \"powerhouse/reactor-group\",\n\tlatestVersion,\n\tsupportedVersions,\n\tupgrades: {}\n};\n//#endregion\n//#region document-models/reactor-group/v1/gen/document-type.ts\n/**\n* WARNING: DO NOT EDIT\n* This file is auto-generated and updated by codegen\n*/\nconst reactorGroupDocumentType = \"powerhouse/reactor-group\";\n//#endregion\n//#region document-models/reactor-group/v1/gen/document-schema.ts\n/**\n* WARNING: DO NOT EDIT\n* This file is auto-generated and updated by codegen\n*/\n/** Schema for validating the header object of a ReactorGroup document */\nconst ReactorGroupDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({ documentType: z.literal(reactorGroupDocumentType) });\n/** Schema for validating the state object of a ReactorGroup document */\nconst ReactorGroupPHStateSchema = BaseDocumentStateSchema.extend({ global: ReactorGroupStateSchema() });\nconst ReactorGroupDocumentSchema = z.object({\n\theader: ReactorGroupDocumentHeaderSchema,\n\tstate: ReactorGroupPHStateSchema,\n\tinitialState: ReactorGroupPHStateSchema\n});\n/** Simple helper function to check if a state object is a ReactorGroup document state object */\nfunction isReactorGroupState(state) {\n\treturn ReactorGroupPHStateSchema.safeParse(state).success;\n}\n/** Simple helper function to assert that a document state object is a ReactorGroup document state object */\nfunction assertIsReactorGroupState(state) {\n\tReactorGroupPHStateSchema.parse(state);\n}\n/** Simple helper function to check if a document is a ReactorGroup document */\nfunction isReactorGroupDocument(document) {\n\treturn ReactorGroupDocumentSchema.safeParse(document).success;\n}\n/** Simple helper function to assert that a document is a ReactorGroup document */\nfunction assertIsReactorGroupDocument(document) {\n\tReactorGroupDocumentSchema.parse(document);\n}\n//#endregion\n//#region document-models/reactor-group/v1/gen/utils.ts\nconst initialGlobalState = {\n\tname: \"\",\n\tdescription: \"\",\n\tmembers: []\n};\nconst initialLocalState = {};\nconst utils$1 = {\n\tfileExtension: \".phrg\",\n\tcreateState(state) {\n\t\treturn {\n\t\t\t...createBaseState(state?.auth, {\n\t\t\t\tversion: 1,\n\t\t\t\t...state?.document\n\t\t\t}),\n\t\t\tglobal: {\n\t\t\t\t...initialGlobalState,\n\t\t\t\t...state?.global\n\t\t\t},\n\t\t\tlocal: {\n\t\t\t\t...initialLocalState,\n\t\t\t\t...state?.local\n\t\t\t}\n\t\t};\n\t},\n\tcreateDocument(state) {\n\t\treturn baseCreateDocument(utils$1.createState, state, reactorGroupDocumentType);\n\t},\n\tsaveToFileHandle(document, input) {\n\t\treturn baseSaveToFileHandle(document, input);\n\t},\n\tloadFromInput(input) {\n\t\treturn baseLoadFromInputVersioned(input, {\n\t\t\treducers: { 1: reducer },\n\t\t\tupgradeManifest: reactorGroupUpgradeManifest\n\t\t});\n\t},\n\tisStateOfType(state) {\n\t\treturn isReactorGroupState(state);\n\t},\n\tassertIsStateOfType(state) {\n\t\treturn assertIsReactorGroupState(state);\n\t},\n\tisDocumentOfType(document) {\n\t\treturn isReactorGroupDocument(document);\n\t},\n\tassertIsDocumentOfType(document) {\n\t\treturn assertIsReactorGroupDocument(document);\n\t}\n};\n//#endregion\n//#region document-models/reactor-group/v1/src/utils.ts\nvar utils_exports = /* @__PURE__ */ __exportAll({});\n//#endregion\n//#region document-models/reactor-group/v1/utils.ts\n/** Utils for the ReactorGroup document model */\nconst utils = {\n\t...utils$1,\n\t...utils_exports\n};\n//#endregion\n//#region document-models/reactor-group/v1/module.ts\n/** Document model module for the ReactorGroup document type */\nconst ReactorGroup = {\n\tversion: 1,\n\treducer,\n\tactions,\n\tutils,\n\tdocumentModel: createState(defaultBaseState(), documentModel)\n};\n//#endregion\nexport { definedNonNullAnySchema as A, setGroupDescription as C, RemoveMemberInputSchema as D, ReactorGroupStateSchema as E, SetGroupDescriptionInputSchema as O, removeMember as S, AddMemberInputSchema as T, reducer as _, utils$1 as a, addMember as b, ReactorGroupPHStateSchema as c, isReactorGroupDocument as d, isReactorGroupState as f, supportedVersions as g, latestVersion as h, initialLocalState as i, isDefinedNonNullAny as j, SetGroupNameInputSchema as k, assertIsReactorGroupDocument as l, reactorGroupUpgradeManifest as m, utils as n, ReactorGroupDocumentHeaderSchema as o, reactorGroupDocumentType as p, initialGlobalState as r, ReactorGroupDocumentSchema as s, ReactorGroup as t, assertIsReactorGroupState as u, documentModel as v, setGroupName as w, creators_exports as x, actions as y };\n\n//# sourceMappingURL=module-DuRVS7HX.js.map","import { reactorDriveDocumentModelModule } from \"@powerhousedao/reactor-drive\";\nimport { ReactorGroupV1 } from \"@powerhousedao/reactor-group\";\nimport { driveDocumentModelModule } from \"@powerhousedao/shared/document-drive\";\nimport { type DocumentModelModule } from \"@powerhousedao/shared/document-model\";\nimport { documentModelDocumentModelModule } from \"document-model\";\nexport const documentModels: DocumentModelModule<any>[] = [\n documentModelDocumentModelModule,\n driveDocumentModelModule,\n reactorDriveDocumentModelModule,\n ReactorGroupV1 as unknown as DocumentModelModule<any>,\n];\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { DocumentModelEditor } from \"./document-model-editor/module.js\";\nimport { GenericDriveExplorer } from \"./generic-drive-explorer/module.js\";\n\nexport const editors: EditorModule[] = [\n DocumentModelEditor,\n GenericDriveExplorer,\n];\n","import type { Manifest } from \"@powerhousedao/shared/document-model\";\nimport manifestJson from \"./powerhouse.manifest.json\" with { type: \"json\" };\nexport { documentModels } from \"./document-models/document-models.js\";\nexport { editors } from \"./editors/editors.js\";\nexport const manifest: Manifest = manifestJson;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACiBA,MAAM,8BAA8B;AAEpC,MAAM,+BAA+B;AAGrC,SAAS,mBAAmB,OAAO;AAClC,QAAO;EACN,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,iCAAiC,IAAI,MAAM,EAAE,aAAa;EAC1D;EACA;;AAEF,SAAS,mBAAmB,OAAO;AAClC,QAAO;EACN,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,iCAAiC,IAAI,MAAM,EAAE,aAAa;EAC1D;EACA;;AAEF,SAAS,qBAAqB,OAAO;AACpC,QAAO;EACN,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,iCAAiC,IAAI,MAAM,EAAE,aAAa;EAC1D;EACA;;AAEF,SAAS,0BAA0B,OAAO;AACzC,QAAO;EACN,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,iCAAiC,IAAI,MAAM,EAAE,aAAa;EAC1D;EACA;;AAEF,SAAS,gBAAgB,OAAO;AAC/B,QAAO;EACN,IAAI,YAAY;EAChB,MAAM;EACN,OAA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C7D;CC5XA;;;ACND,MAAa,UAA0B,CACrC,qBACA,qBACD;;;ACHD,MAAa,WAAqBE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./document-drive-
|
|
2
|
-
import {
|
|
3
|
-
import { C as linter, D as EditorState, E as Compartment, S as forceLinting, T as keymap, _ as foldNodeProp, a as makeFocusHandler, b as tags, c as baseEditorExtensions, d as ayuLight, f as LRLanguage, g as foldInside, i as useHandlerReconfiguration, l as baseKeymap, m as continuedIndent, n as useEditorCleanup, o as makePasteHandler, p as LanguageSupport, r as useEditorRefs, s as makeUpdateHandler, t as useDocumentSync, u as dracula, v as indentNodeProp, w as EditorView, x as LRParser, y as styleTags } from "./hooks-
|
|
1
|
+
import "./document-drive-D6XhjHzr.js";
|
|
2
|
+
import { b as useTheme } from "./dist-DfoAQf6g.js";
|
|
3
|
+
import { C as linter, D as EditorState, E as Compartment, S as forceLinting, T as keymap, _ as foldNodeProp, a as makeFocusHandler, b as tags, c as baseEditorExtensions, d as ayuLight, f as LRLanguage, g as foldInside, i as useHandlerReconfiguration, l as baseKeymap, m as continuedIndent, n as useEditorCleanup, o as makePasteHandler, p as LanguageSupport, r as useEditorRefs, s as makeUpdateHandler, t as useDocumentSync, u as dracula, v as indentNodeProp, w as EditorView, x as LRParser, y as styleTags } from "./hooks-KKcNp2X0.js";
|
|
4
4
|
import { memo, useEffect, useRef } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region ../../node_modules/.pnpm/@lezer+json@1.0.3/node_modules/@lezer/json/dist/index.js
|
|
@@ -151,4 +151,4 @@ const JSONEditor = memo(function JSONEditor(props) {
|
|
|
151
151
|
//#endregion
|
|
152
152
|
export { JSONEditor as default };
|
|
153
153
|
|
|
154
|
-
//# sourceMappingURL=json-editor-
|
|
154
|
+
//# sourceMappingURL=json-editor-nI61gbA-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-editor-
|
|
1
|
+
{"version":3,"file":"json-editor-nI61gbA-.js","names":[],"sources":["../../../../node_modules/.pnpm/@lezer+json@1.0.3/node_modules/@lezer/json/dist/index.js","../../../../node_modules/.pnpm/@codemirror+lang-json@6.0.1/node_modules/@codemirror/lang-json/dist/index.js","../../editors/document-model-editor/components/code-editors/json-editor.tsx"],"sourcesContent":["import { LRParser } from '@lezer/lr';\nimport { styleTags, tags } from '@lezer/highlight';\n\nconst jsonHighlighting = styleTags({\n String: tags.string,\n Number: tags.number,\n \"True False\": tags.bool,\n PropertyName: tags.propertyName,\n Null: tags.null,\n \", :\": tags.separator,\n \"[ ]\": tags.squareBracket,\n \"{ }\": tags.brace\n});\n\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst parser = LRParser.deserialize({\n version: 14,\n states: \"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l\",\n stateData: \"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O\",\n goto: \"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R\",\n nodeNames: \"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array\",\n maxTerm: 25,\n nodeProps: [\n [\"isolate\", -2,6,11,\"\"],\n [\"openedBy\", 7,\"{\",14,\"[\"],\n [\"closedBy\", 8,\"}\",15,\"]\"]\n ],\n propSources: [jsonHighlighting],\n skippedNodes: [0],\n repeatNodeCount: 2,\n tokenData: \"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~\",\n tokenizers: [0],\n topRules: {\"JsonText\":[0,1]},\n tokenPrec: 0\n});\n\nexport { parser };\n","import { parser } from '@lezer/json';\nimport { LRLanguage, indentNodeProp, continuedIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language';\n\n/**\nCalls\n[`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)\non the document and, if that throws an error, reports it as a\nsingle diagnostic.\n*/\nconst jsonParseLinter = () => (view) => {\n try {\n JSON.parse(view.state.doc.toString());\n }\n catch (e) {\n if (!(e instanceof SyntaxError))\n throw e;\n const pos = getErrorPosition(e, view.state.doc);\n return [{\n from: pos,\n message: e.message,\n severity: 'error',\n to: pos\n }];\n }\n return [];\n};\nfunction getErrorPosition(error, doc) {\n let m;\n if (m = error.message.match(/at position (\\d+)/))\n return Math.min(+m[1], doc.length);\n if (m = error.message.match(/at line (\\d+) column (\\d+)/))\n return Math.min(doc.line(+m[1]).from + (+m[2]) - 1, doc.length);\n return 0;\n}\n\n/**\nA language provider that provides JSON parsing.\n*/\nconst jsonLanguage = /*@__PURE__*/LRLanguage.define({\n name: \"json\",\n parser: /*@__PURE__*/parser.configure({\n props: [\n /*@__PURE__*/indentNodeProp.add({\n Object: /*@__PURE__*/continuedIndent({ except: /^\\s*\\}/ }),\n Array: /*@__PURE__*/continuedIndent({ except: /^\\s*\\]/ })\n }),\n /*@__PURE__*/foldNodeProp.add({\n \"Object Array\": foldInside\n })\n ]\n }),\n languageData: {\n closeBrackets: { brackets: [\"[\", \"{\", '\"'] },\n indentOnInput: /^\\s*[\\}\\]]$/\n }\n});\n/**\nJSON language support.\n*/\nfunction json() {\n return new LanguageSupport(jsonLanguage);\n}\n\nexport { json, jsonLanguage, jsonParseLinter };\n","import { json, jsonLanguage, jsonParseLinter } from \"@codemirror/lang-json\";\nimport { forceLinting, linter } from \"@codemirror/lint\";\nimport { Compartment, EditorState } from \"@codemirror/state\";\nimport { EditorView, keymap } from \"@codemirror/view\";\nimport { useTheme } from \"@powerhousedao/reactor-browser\";\nimport { memo, useEffect, useRef } from \"react\";\nimport { ayuLight, dracula } from \"thememirror\";\nimport { baseEditorExtensions, baseKeymap } from \"./constants.js\";\nimport {\n makeFocusHandler,\n makePasteHandler,\n makeUpdateHandler,\n} from \"./factories.js\";\nimport {\n useDocumentSync,\n useEditorCleanup,\n useEditorRefs,\n useHandlerReconfiguration,\n} from \"./hooks.js\";\n\ntype Props = {\n doc: string;\n readonly?: boolean;\n /* Updates the document in the model, should be wrapped in `useCallback` in the parent */\n updateDocumentInModel?: (newDoc: string) => void;\n};\n\nconst JSONEditor = memo(function JSONEditor(props: Props) {\n const { doc, readonly = false, updateDocumentInModel } = props;\n const {\n editorRef,\n viewRef,\n updateListenerCompartment,\n focusHandlerCompartment,\n pasteHandlerCompartment,\n timeoutRef,\n } = useEditorRefs();\n const { theme } = useTheme();\n const themeCompartment = useRef(new Compartment());\n\n useEffect(() => {\n if (!viewRef.current) {\n viewRef.current = new EditorView({\n state: EditorState.create({\n doc,\n extensions: [\n ...baseEditorExtensions,\n keymap.of(baseKeymap),\n themeCompartment.current.of(theme === \"light\" ? ayuLight : dracula),\n jsonLanguage,\n json(),\n linter(jsonParseLinter()),\n updateListenerCompartment.current.of(\n makeUpdateHandler(readonly, timeoutRef, updateDocumentInModel),\n ),\n focusHandlerCompartment.current.of(\n makeFocusHandler(readonly, timeoutRef, updateDocumentInModel),\n ),\n pasteHandlerCompartment.current.of(\n makePasteHandler(readonly, timeoutRef, updateDocumentInModel),\n ),\n EditorState.readOnly.of(readonly),\n ],\n }),\n parent: editorRef.current!,\n });\n forceLinting(viewRef.current);\n }\n }, []);\n\n useEffect(() => {\n if (!viewRef.current) return;\n viewRef.current.dispatch({\n effects: themeCompartment.current.reconfigure(\n theme === \"light\" ? ayuLight : dracula,\n ),\n });\n }, [theme]);\n\n useEditorCleanup(viewRef);\n\n useHandlerReconfiguration(\n viewRef.current,\n readonly,\n timeoutRef,\n updateDocumentInModel,\n {\n updateListener: updateListenerCompartment.current,\n focusHandler: focusHandlerCompartment.current,\n pasteHandler: pasteHandlerCompartment.current,\n },\n );\n\n useDocumentSync(viewRef.current, doc);\n\n return <div ref={editorRef} />;\n});\n\nexport default JSONEditor;\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;AAGA,MAAM,mBAAmB,UAAU;CACjC,QAAQ,KAAK;CACb,QAAQ,KAAK;CACb,cAAc,KAAK;CACnB,cAAc,KAAK;CACnB,MAAM,KAAK;CACX,OAAO,KAAK;CACZ,OAAO,KAAK;CACZ,OAAO,KAAK;CACb,CAAC;AAGF,MAAM,SAAS,SAAS,YAAY;CAClC,SAAS;CACT,QAAQ;CACR,W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AED,iBAAgB,QAAQ,SAAS,IAAI;AAErC,QAAO,oBAAC,OAAD,EAAK,KAAK,WAAa,CAAA;EAC9B"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { t as parse } from "./parser-CkF6Qt8V.js";
|
|
2
|
-
//#region ../reactor/dist/drive-container-types-
|
|
2
|
+
//#region ../reactor/dist/drive-container-types-yzXFiYNp.js
|
|
3
|
+
/** Actions the reactor reduces itself, onto the document scope. */
|
|
4
|
+
const DOCUMENT_SCOPE_ACTIONS = new Set([
|
|
5
|
+
"CREATE_DOCUMENT",
|
|
6
|
+
"DELETE_DOCUMENT",
|
|
7
|
+
"UPGRADE_DOCUMENT",
|
|
8
|
+
"ADD_RELATIONSHIP",
|
|
9
|
+
"REMOVE_RELATIONSHIP",
|
|
10
|
+
"UPDATE_RELATIONSHIP"
|
|
11
|
+
]);
|
|
12
|
+
new Set([...DOCUMENT_SCOPE_ACTIONS].filter((type) => type !== "CREATE_DOCUMENT"));
|
|
3
13
|
/**
|
|
4
14
|
* Error thrown when a document model module is not found in the registry.
|
|
5
15
|
*/
|
|
@@ -59,8 +69,7 @@ var DriveCollectionId = class DriveCollectionId {
|
|
|
59
69
|
return this.driveId === other.driveId && this.branch === other.branch;
|
|
60
70
|
}
|
|
61
71
|
};
|
|
62
|
-
|
|
63
|
-
//#region ../reactor/dist/index.js
|
|
72
|
+
new Set(Object.values({ malformedStoredOperation: "MALFORMED_STORED_OPERATION" }));
|
|
64
73
|
let SyncStatus = /* @__PURE__ */ function(SyncStatus) {
|
|
65
74
|
SyncStatus["Synced"] = "SYNCED";
|
|
66
75
|
SyncStatus["Outgoing"] = "OUTGOING";
|
|
@@ -197,4 +206,4 @@ gql["default"] = gql;
|
|
|
197
206
|
//#endregion
|
|
198
207
|
export { SyncStatus as a, __spreadArray as i, __assign as n, DriveCollectionId as o, __rest as r, ModuleNotFoundError as s, gql as t };
|
|
199
208
|
|
|
200
|
-
//# sourceMappingURL=lib-
|
|
209
|
+
//# sourceMappingURL=lib-CE5V8jW5.js.map
|