@xwiki/cristal-electron-storage 0.21.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +13 -10
  2. package/dist/default/components/fileSystemStorage.d.ts +1 -1
  3. package/dist/default/componentsInit.d.ts +3 -0
  4. package/dist/default/electron/preload/apiTypes.d.ts +3 -1
  5. package/dist/default/index.es.js +10 -7
  6. package/dist/default/index.es.js.map +1 -1
  7. package/dist/default/index.umd.js +1 -1
  8. package/dist/default/index.umd.js.map +1 -1
  9. package/dist/main/index.d.cts +20 -2
  10. package/dist/main/index.d.ts +20 -2
  11. package/dist/main/index.es.js +239 -99
  12. package/dist/main/index.es.js.map +1 -1
  13. package/dist/main/index.umd.js +9 -1
  14. package/dist/main/index.umd.js.map +1 -1
  15. package/dist/{main/electron/preload → preload}/apiTypes.d.ts +3 -1
  16. package/dist/preload/index.d.cts +20 -2
  17. package/dist/preload/index.d.ts +20 -2
  18. package/dist/preload/index.es.js +47 -104
  19. package/dist/preload/index.es.js.map +1 -1
  20. package/dist/preload/index.umd.js +1 -1
  21. package/dist/preload/index.umd.js.map +1 -1
  22. package/package.json +19 -19
  23. package/src/components/FileSystemConfig.ts +1 -1
  24. package/src/components/fileSystemStorage.ts +6 -6
  25. package/src/componentsInit.ts +3 -0
  26. package/src/electron/main/index.ts +9 -9
  27. package/src/electron/preload/apiTypes.ts +3 -1
  28. package/src/electron/preload/index.ts +2 -2
  29. package/vite.main.config.ts +5 -1
  30. package/vite.preload.config.ts +1 -1
  31. package/vitest.config.ts +1 -1
  32. package/dist/main/components/FileSystemConfig.d.ts +0 -8
  33. package/dist/main/components/fileSystemStorage.d.ts +0 -25
  34. package/dist/main/componentsInit.d.ts +0 -6
  35. package/dist/main/electron/main/index.d.ts +0 -20
  36. package/dist/main/electron/preload/index.d.ts +0 -20
  37. package/dist/preload/components/FileSystemConfig.d.ts +0 -8
  38. package/dist/preload/components/fileSystemStorage.d.ts +0 -25
  39. package/dist/preload/componentsInit.d.ts +0 -6
  40. package/dist/preload/electron/main/index.d.ts +0 -20
  41. package/dist/preload/electron/preload/apiTypes.d.ts +0 -40
  42. package/dist/preload/electron/preload/index.d.ts +0 -20
package/CHANGELOG.md CHANGED
@@ -1,19 +1,22 @@
1
1
  # @xwiki/cristal-electron-storage
2
2
 
3
- ## 0.21.1
3
+ ## 0.22.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Cristal 0.22 Release
4
8
 
5
9
  ### Patch Changes
6
10
 
7
- - Cristal 0.21.1 Release
8
11
  - Updated dependencies
9
- - @xwiki/cristal-api@0.21.1
10
- - @xwiki/cristal-backend-api@0.21.1
11
- - @xwiki/cristal-link-suggest-api@0.21.1
12
- - @xwiki/cristal-model-api@0.21.1
13
- - @xwiki/cristal-model-remote-url-filesystem-api@0.21.1
14
- - @xwiki/cristal-page-default@0.21.1
15
- - @xwiki/cristal-electron-state@0.21.1
16
- - @xwiki/cristal-utils-inversify@0.21.1
12
+ - @xwiki/cristal-api@0.22.0
13
+ - @xwiki/cristal-backend-api@0.22.0
14
+ - @xwiki/cristal-link-suggest-api@0.22.0
15
+ - @xwiki/cristal-model-api@0.22.0
16
+ - @xwiki/cristal-model-remote-url-filesystem-api@0.22.0
17
+ - @xwiki/cristal-page-default@0.22.0
18
+ - @xwiki/cristal-electron-state@0.22.0
19
+ - @xwiki/cristal-utils-inversify@0.22.0
17
20
 
18
21
  ## 0.21.0
19
22
 
@@ -1,5 +1,5 @@
1
- import { AttachmentsData, PageAttachment, PageData, Logger } from '@xwiki/cristal-api';
2
1
  import { AbstractStorage } from '@xwiki/cristal-backend-api';
2
+ import { AttachmentsData, Logger, PageAttachment, PageData } from '@xwiki/cristal-api';
3
3
  export default class FileSystemStorage extends AbstractStorage {
4
4
  constructor(logger: Logger);
5
5
  getEditField(): Promise<string>;
@@ -1,5 +1,8 @@
1
1
  import { Logger } from '@xwiki/cristal-api';
2
2
  import { Container } from 'inversify';
3
+ /**
4
+ * @beta
5
+ */
3
6
  export default class ComponentInit {
4
7
  logger: Logger;
5
8
  constructor(container: Container);
@@ -1,6 +1,6 @@
1
- import { PageAttachment, PageData } from '@xwiki/cristal-api';
2
1
  import { LinkType } from '@xwiki/cristal-link-suggest-api';
3
2
  import { EntityType } from '@xwiki/cristal-model-api';
3
+ import { PageAttachment, PageData } from '@xwiki/cristal-api';
4
4
  export interface APITypes {
5
5
  initRootDirectory(): void;
6
6
  resolvePath(page: string): Promise<string>;
@@ -19,6 +19,7 @@ export interface APITypes {
19
19
  * @param type - the type of attach
20
20
  * @param mimetype - the expected mimetype, only applied for attachments
21
21
  * @since 0.13
22
+ * @beta
22
23
  */
23
24
  search(query: string, type?: LinkType, mimetype?: string): Promise<({
24
25
  type: EntityType.ATTACHMENT;
@@ -35,6 +36,7 @@ export interface APITypes {
35
36
  * @param preserveChildren - whether to move children
36
37
  *
37
38
  * @since 0.20
39
+ * @beta
38
40
  */
39
41
  movePage(reference: string, newReference: string, preserveChildren: boolean): Promise<void>;
40
42
  }
@@ -7,7 +7,9 @@ var f = Object.getOwnPropertyDescriptor, p = (t, e, a, r) => {
7
7
  (n = t[o]) && (s = n(s) || s);
8
8
  return s;
9
9
  }, i = (t, e) => (a, r) => e(a, r, t);
10
- let m = class extends h {
10
+ let l = class extends h {
11
+ storage;
12
+ cristal;
11
13
  constructor(t, e, a) {
12
14
  super(t), this.storage = e, this.cristal = a, this.storage.setWikiConfig(this), this.homePage === "" && (this.homePage = "index.md");
13
15
  }
@@ -18,19 +20,19 @@ let m = class extends h {
18
20
  super.initialize(), fileSystemStorage.initRootDirectory();
19
21
  }
20
22
  };
21
- m = p([
23
+ l = p([
22
24
  c(),
23
25
  i(0, g("Logger")),
24
26
  i(1, g("Storage")),
25
27
  i(1, S("FileSystem")),
26
28
  i(2, g("CristalApp"))
27
- ], m);
29
+ ], l);
28
30
  var v = Object.getOwnPropertyDescriptor, P = (t, e, a, r) => {
29
31
  for (var s = r > 1 ? void 0 : r ? v(e, a) : e, o = t.length - 1, n; o >= 0; o--)
30
32
  (n = t[o]) && (s = n(s) || s);
31
33
  return s;
32
34
  }, w = (t, e) => (a, r) => e(a, r, t);
33
- let l = class extends y {
35
+ let m = class extends y {
34
36
  constructor(t) {
35
37
  super(t, "storage.components.fileSystemStorage");
36
38
  }
@@ -92,13 +94,14 @@ let l = class extends y {
92
94
  await fileSystemStorage.saveAttachment(a, e);
93
95
  }
94
96
  };
95
- l = P([
97
+ m = P([
96
98
  c(),
97
99
  w(0, g("Logger"))
98
- ], l);
100
+ ], m);
99
101
  class b {
102
+ logger;
100
103
  constructor(e) {
101
- this.logger = e.get("Logger"), this.logger.setModule("electron.storage.components.componentsInit"), this.logger?.debug("Init Sample Module components begin"), e.bind("WikiConfig").to(m).when(d("FileSystem")), e.bind("Storage").to(l).whenNamed("FileSystem"), this.logger?.debug("Init Sample Module components end");
104
+ this.logger = e.get("Logger"), this.logger.setModule("electron.storage.components.componentsInit"), this.logger?.debug("Init Sample Module components begin"), e.bind("WikiConfig").to(l).when(d("FileSystem")), e.bind("Storage").to(m).whenNamed("FileSystem"), this.logger?.debug("Init Sample Module components end");
102
105
  }
103
106
  }
104
107
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../src/components/FileSystemConfig.ts","../../src/components/fileSystemStorage.ts","../../src/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { APITypes } from \"../electron/preload/apiTypes\";\nimport { DefaultWikiConfig } from \"@xwiki/cristal-api\";\nimport { inject, injectable, named } from \"inversify\";\nimport type { CristalApp, Logger, Storage } from \"@xwiki/cristal-api\";\n\ndeclare const fileSystemStorage: APITypes;\n\n@injectable()\nexport class FileSystemConfig extends DefaultWikiConfig {\n override storage: Storage;\n override cristal: CristalApp;\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"Storage\") @named(\"FileSystem\") storage: Storage,\n @inject(\"CristalApp\") cristal: CristalApp,\n ) {\n super(logger);\n this.storage = storage;\n this.cristal = cristal;\n this.storage.setWikiConfig(this);\n if (this.homePage === \"\") {\n this.homePage = \"index.md\";\n }\n }\n\n override getType(): string {\n return \"FileSystem\";\n }\n\n override initialize(): void {\n super.initialize();\n // The initialization for the root directory needs to be done after a\n // configuration change, but before any storage operation.\n fileSystemStorage.initRootDirectory();\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { APITypes } from \"../electron/preload/apiTypes\";\nimport {\n AttachmentsData,\n DefaultPageData,\n PageAttachment,\n PageData,\n} from \"@xwiki/cristal-api\";\nimport { AbstractStorage } from \"@xwiki/cristal-backend-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { Logger } from \"@xwiki/cristal-api\";\n\ndeclare const fileSystemStorage: APITypes;\n\n@injectable()\nexport default class FileSystemStorage extends AbstractStorage {\n constructor(@inject(\"Logger\") logger: Logger) {\n super(logger, \"storage.components.fileSystemStorage\");\n }\n\n getEditField(): Promise<string> {\n return Promise.resolve(\"\");\n }\n\n getImageURL(): string {\n return \"\";\n }\n\n async getPageContent(page: string): Promise<PageData> {\n const decodedPage = decodeURI(page);\n const path = await fileSystemStorage.resolvePath(decodedPage);\n const pageData = await fileSystemStorage.readPage(path || \"\");\n if (pageData) {\n pageData.id = decodedPage;\n pageData.headline = pageData.name;\n pageData.headlineRaw = pageData.name;\n }\n return pageData;\n }\n\n async getAttachments(page: string): Promise<AttachmentsData | undefined> {\n const path = await fileSystemStorage.resolveAttachmentsPath(page);\n return {\n attachments: await fileSystemStorage.readAttachments(path),\n };\n }\n\n async getAttachment(\n page: string,\n name: string,\n ): Promise<PageAttachment | undefined> {\n const path = await fileSystemStorage.resolveAttachmentPath(page, name);\n return fileSystemStorage.readAttachment(path);\n }\n\n getPageFromViewURL(): string | null {\n return null;\n }\n\n getPageRestURL(): string {\n return \"\";\n }\n\n getPanelContent(): Promise<PageData> {\n return Promise.resolve(new DefaultPageData());\n }\n\n isStorageReady(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n async save(page: string, title: string, content: string): Promise<void> {\n const path = await fileSystemStorage.resolvePath(page);\n await fileSystemStorage.savePage(path, content, title);\n }\n\n async saveAttachments(\n page: string,\n files: File[],\n ): Promise<undefined | (undefined | string)[]> {\n await Promise.all(files.map((file) => this.saveAttachment(page, file)));\n return undefined;\n }\n\n async delete(page: string): Promise<{ success: boolean; error?: string }> {\n try {\n await fileSystemStorage.deletePage(page);\n return { success: true };\n } catch (error) {\n return { success: false, error: (error as Error).message };\n }\n }\n\n async move(\n page: string,\n newPage: string,\n preserveChildren: boolean,\n ): Promise<{ success: boolean; error?: string }> {\n try {\n await fileSystemStorage.movePage(page, newPage, preserveChildren);\n return { success: true };\n } catch (error) {\n return { success: false, error: (error as Error).message };\n }\n }\n\n private async saveAttachment(page: string, file: File): Promise<unknown> {\n const path = await fileSystemStorage.resolveAttachmentPath(page, file.name);\n await fileSystemStorage.saveAttachment(path, file);\n return;\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { FileSystemConfig } from \"./components/FileSystemConfig\";\nimport FileSystemStorage from \"./components/fileSystemStorage\";\nimport { whenNamedOrDefault } from \"@xwiki/cristal-utils-inversify\";\nimport type { Logger, Storage, WikiConfig } from \"@xwiki/cristal-api\";\nimport type { Container } from \"inversify\";\n\nexport default class ComponentInit {\n logger: Logger;\n\n constructor(container: Container) {\n this.logger = container.get<Logger>(\"Logger\");\n this.logger.setModule(\"electron.storage.components.componentsInit\");\n\n this.logger?.debug(\"Init Sample Module components begin\");\n container\n .bind<WikiConfig>(\"WikiConfig\")\n .to(FileSystemConfig)\n .when(whenNamedOrDefault(\"FileSystem\"));\n container\n .bind<Storage>(\"Storage\")\n .to(FileSystemStorage)\n .whenNamed(\"FileSystem\");\n this.logger?.debug(\"Init Sample Module components end\");\n }\n}\n"],"names":["FileSystemConfig","DefaultWikiConfig","logger","storage","cristal","__decorateClass","injectable","__decorateParam","FileSystemStorage","AbstractStorage","page","decodedPage","path","pageData","name","DefaultPageData","title","content","files","file","error","newPage","preserveChildren","ComponentInit","container","whenNamedOrDefault"],"mappings":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EAEcC,OAAO,QAAQ,CAAA;AAAA,GADTC,CAAA;ACRrB,MAAqBe,EAAc;AAAA,EAGjC,YAAYC,GAAsB;AAChC,SAAK,SAASA,EAAU,IAAY,QAAQ,GAC5C,KAAK,OAAO,UAAU,4CAA4C,GAElE,KAAK,QAAQ,MAAM,qCAAqC,GACxDA,EACG,KAAiB,YAAY,EAC7B,GAAGxB,CAAgB,EACnB,KAAKyB,EAAmB,YAAY,CAAC,GACxCD,EACG,KAAc,SAAS,EACvB,GAAGhB,CAAiB,EACpB,UAAU,YAAY,GACzB,KAAK,QAAQ,MAAM,mCAAmC;AAAA,EACxD;AACF;"}
1
+ {"version":3,"file":"index.es.js","sources":["../../src/components/FileSystemConfig.ts","../../src/components/fileSystemStorage.ts","../../src/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { DefaultWikiConfig } from \"@xwiki/cristal-api\";\nimport { inject, injectable, named } from \"inversify\";\nimport type { APITypes } from \"../electron/preload/apiTypes\";\nimport type { CristalApp, Logger, Storage } from \"@xwiki/cristal-api\";\n\ndeclare const fileSystemStorage: APITypes;\n\n@injectable()\nexport class FileSystemConfig extends DefaultWikiConfig {\n override storage: Storage;\n override cristal: CristalApp;\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"Storage\") @named(\"FileSystem\") storage: Storage,\n @inject(\"CristalApp\") cristal: CristalApp,\n ) {\n super(logger);\n this.storage = storage;\n this.cristal = cristal;\n this.storage.setWikiConfig(this);\n if (this.homePage === \"\") {\n this.homePage = \"index.md\";\n }\n }\n\n override getType(): string {\n return \"FileSystem\";\n }\n\n override initialize(): void {\n super.initialize();\n // The initialization for the root directory needs to be done after a\n // configuration change, but before any storage operation.\n fileSystemStorage.initRootDirectory();\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { DefaultPageData } from \"@xwiki/cristal-api\";\nimport { AbstractStorage } from \"@xwiki/cristal-backend-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { APITypes } from \"../electron/preload/apiTypes\";\nimport type {\n AttachmentsData,\n Logger,\n PageAttachment,\n PageData,\n} from \"@xwiki/cristal-api\";\n\ndeclare const fileSystemStorage: APITypes;\n\n@injectable()\nexport default class FileSystemStorage extends AbstractStorage {\n constructor(@inject(\"Logger\") logger: Logger) {\n super(logger, \"storage.components.fileSystemStorage\");\n }\n\n getEditField(): Promise<string> {\n return Promise.resolve(\"\");\n }\n\n getImageURL(): string {\n return \"\";\n }\n\n async getPageContent(page: string): Promise<PageData> {\n const decodedPage = decodeURI(page);\n const path = await fileSystemStorage.resolvePath(decodedPage);\n const pageData = await fileSystemStorage.readPage(path || \"\");\n if (pageData) {\n pageData.id = decodedPage;\n pageData.headline = pageData.name;\n pageData.headlineRaw = pageData.name;\n }\n return pageData;\n }\n\n async getAttachments(page: string): Promise<AttachmentsData | undefined> {\n const path = await fileSystemStorage.resolveAttachmentsPath(page);\n return {\n attachments: await fileSystemStorage.readAttachments(path),\n };\n }\n\n async getAttachment(\n page: string,\n name: string,\n ): Promise<PageAttachment | undefined> {\n const path = await fileSystemStorage.resolveAttachmentPath(page, name);\n return fileSystemStorage.readAttachment(path);\n }\n\n getPageFromViewURL(): string | null {\n return null;\n }\n\n getPageRestURL(): string {\n return \"\";\n }\n\n getPanelContent(): Promise<PageData> {\n return Promise.resolve(new DefaultPageData());\n }\n\n isStorageReady(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n async save(page: string, title: string, content: string): Promise<void> {\n const path = await fileSystemStorage.resolvePath(page);\n await fileSystemStorage.savePage(path, content, title);\n }\n\n async saveAttachments(\n page: string,\n files: File[],\n ): Promise<undefined | (undefined | string)[]> {\n await Promise.all(files.map((file) => this.saveAttachment(page, file)));\n return undefined;\n }\n\n async delete(page: string): Promise<{ success: boolean; error?: string }> {\n try {\n await fileSystemStorage.deletePage(page);\n return { success: true };\n } catch (error) {\n return { success: false, error: (error as Error).message };\n }\n }\n\n async move(\n page: string,\n newPage: string,\n preserveChildren: boolean,\n ): Promise<{ success: boolean; error?: string }> {\n try {\n await fileSystemStorage.movePage(page, newPage, preserveChildren);\n return { success: true };\n } catch (error) {\n return { success: false, error: (error as Error).message };\n }\n }\n\n private async saveAttachment(page: string, file: File): Promise<unknown> {\n const path = await fileSystemStorage.resolveAttachmentPath(page, file.name);\n await fileSystemStorage.saveAttachment(path, file);\n return;\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { FileSystemConfig } from \"./components/FileSystemConfig\";\nimport FileSystemStorage from \"./components/fileSystemStorage\";\nimport { whenNamedOrDefault } from \"@xwiki/cristal-utils-inversify\";\nimport type { Logger, Storage, WikiConfig } from \"@xwiki/cristal-api\";\nimport type { Container } from \"inversify\";\n\n/**\n * @beta\n */\nexport default class ComponentInit {\n logger: Logger;\n\n constructor(container: Container) {\n this.logger = container.get<Logger>(\"Logger\");\n this.logger.setModule(\"electron.storage.components.componentsInit\");\n\n this.logger?.debug(\"Init Sample Module components begin\");\n container\n .bind<WikiConfig>(\"WikiConfig\")\n .to(FileSystemConfig)\n .when(whenNamedOrDefault(\"FileSystem\"));\n container\n .bind<Storage>(\"Storage\")\n .to(FileSystemStorage)\n .whenNamed(\"FileSystem\");\n this.logger?.debug(\"Init Sample Module components end\");\n }\n}\n"],"names":["FileSystemConfig","DefaultWikiConfig","logger","storage","cristal","__decorateClass","injectable","__decorateParam","FileSystemStorage","AbstractStorage","page","decodedPage","path","pageData","name","DefaultPageData","title","content","files","file","error","newPage","preserveChildren","ComponentInit","container","whenNamedOrDefault"],"mappings":";;;;;;;;;AA4BO,IAAMA,IAAN,cAA+BC,EAAkB;AAAA,EAC7C;AAAA,EACA;AAAA,EACT,YACoBC,GACsBC,GAClBC,GACtB;AACA,UAAMF,CAAM,GACZ,KAAK,UAAUC,GACf,KAAK,UAAUC,GACf,KAAK,QAAQ,cAAc,IAAI,GAC3B,KAAK,aAAa,OACpB,KAAK,WAAW;AAAA,EAEpB;AAAA,EAES,UAAkB;AACzB,WAAO;AAAA,EACT;AAAA,EAES,aAAmB;AAC1B,UAAM,WAAA,GAGN,kBAAkB,kBAAA;AAAA,EAC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AiB,EACpB,UAAU,YAAY,GACzB,KAAK,QAAQ,MAAM,mCAAmC;AAAA,EACxD;AACF;"}
@@ -1,2 +1,2 @@
1
- (function(s,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@xwiki/cristal-api"),require("inversify"),require("@xwiki/cristal-backend-api"),require("@xwiki/cristal-utils-inversify")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-api","inversify","@xwiki/cristal-backend-api","@xwiki/cristal-utils-inversify"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.cristal_storage={},s.cristalApi,s.inversify,s.cristalBackendApi,s.cristalUtilsInversify))})(this,function(s,c,n,h,d){"use strict";var S=Object.getOwnPropertyDescriptor,f=(t,e,a,r)=>{for(var i=r>1?void 0:r?S(e,a):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=l(i)||i);return i},g=(t,e)=>(a,r)=>e(a,r,t);let m=class extends c.DefaultWikiConfig{constructor(t,e,a){super(t),this.storage=e,this.cristal=a,this.storage.setWikiConfig(this),this.homePage===""&&(this.homePage="index.md")}getType(){return"FileSystem"}initialize(){super.initialize(),fileSystemStorage.initRootDirectory()}};m=f([n.injectable(),g(0,n.inject("Logger")),g(1,n.inject("Storage")),g(1,n.named("FileSystem")),g(2,n.inject("CristalApp"))],m);var p=Object.getOwnPropertyDescriptor,y=(t,e,a,r)=>{for(var i=r>1?void 0:r?p(e,a):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=l(i)||i);return i},v=(t,e)=>(a,r)=>e(a,r,t);let u=class extends h.AbstractStorage{constructor(t){super(t,"storage.components.fileSystemStorage")}getEditField(){return Promise.resolve("")}getImageURL(){return""}async getPageContent(t){const e=decodeURI(t),a=await fileSystemStorage.resolvePath(e),r=await fileSystemStorage.readPage(a||"");return r&&(r.id=e,r.headline=r.name,r.headlineRaw=r.name),r}async getAttachments(t){const e=await fileSystemStorage.resolveAttachmentsPath(t);return{attachments:await fileSystemStorage.readAttachments(e)}}async getAttachment(t,e){const a=await fileSystemStorage.resolveAttachmentPath(t,e);return fileSystemStorage.readAttachment(a)}getPageFromViewURL(){return null}getPageRestURL(){return""}getPanelContent(){return Promise.resolve(new c.DefaultPageData)}isStorageReady(){return Promise.resolve(!0)}async save(t,e,a){const r=await fileSystemStorage.resolvePath(t);await fileSystemStorage.savePage(r,a,e)}async saveAttachments(t,e){await Promise.all(e.map(a=>this.saveAttachment(t,a)))}async delete(t){try{return await fileSystemStorage.deletePage(t),{success:!0}}catch(e){return{success:!1,error:e.message}}}async move(t,e,a){try{return await fileSystemStorage.movePage(t,e,a),{success:!0}}catch(r){return{success:!1,error:r.message}}}async saveAttachment(t,e){const a=await fileSystemStorage.resolveAttachmentPath(t,e.name);await fileSystemStorage.saveAttachment(a,e)}};u=y([n.injectable(),v(0,n.inject("Logger"))],u);class w{constructor(e){this.logger=e.get("Logger"),this.logger.setModule("electron.storage.components.componentsInit"),this.logger?.debug("Init Sample Module components begin"),e.bind("WikiConfig").to(m).when(d.whenNamedOrDefault("FileSystem")),e.bind("Storage").to(u).whenNamed("FileSystem"),this.logger?.debug("Init Sample Module components end")}}s.ComponentInit=w,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
1
+ (function(s,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@xwiki/cristal-api"),require("inversify"),require("@xwiki/cristal-backend-api"),require("@xwiki/cristal-utils-inversify")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-api","inversify","@xwiki/cristal-backend-api","@xwiki/cristal-utils-inversify"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.cristal_storage={},s.cristalApi,s.inversify,s.cristalBackendApi,s.cristalUtilsInversify))})(this,(function(s,c,n,h,d){"use strict";var S=Object.getOwnPropertyDescriptor,f=(t,e,a,r)=>{for(var i=r>1?void 0:r?S(e,a):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=l(i)||i);return i},g=(t,e)=>(a,r)=>e(a,r,t);let m=class extends c.DefaultWikiConfig{storage;cristal;constructor(t,e,a){super(t),this.storage=e,this.cristal=a,this.storage.setWikiConfig(this),this.homePage===""&&(this.homePage="index.md")}getType(){return"FileSystem"}initialize(){super.initialize(),fileSystemStorage.initRootDirectory()}};m=f([n.injectable(),g(0,n.inject("Logger")),g(1,n.inject("Storage")),g(1,n.named("FileSystem")),g(2,n.inject("CristalApp"))],m);var p=Object.getOwnPropertyDescriptor,y=(t,e,a,r)=>{for(var i=r>1?void 0:r?p(e,a):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=l(i)||i);return i},v=(t,e)=>(a,r)=>e(a,r,t);let u=class extends h.AbstractStorage{constructor(t){super(t,"storage.components.fileSystemStorage")}getEditField(){return Promise.resolve("")}getImageURL(){return""}async getPageContent(t){const e=decodeURI(t),a=await fileSystemStorage.resolvePath(e),r=await fileSystemStorage.readPage(a||"");return r&&(r.id=e,r.headline=r.name,r.headlineRaw=r.name),r}async getAttachments(t){const e=await fileSystemStorage.resolveAttachmentsPath(t);return{attachments:await fileSystemStorage.readAttachments(e)}}async getAttachment(t,e){const a=await fileSystemStorage.resolveAttachmentPath(t,e);return fileSystemStorage.readAttachment(a)}getPageFromViewURL(){return null}getPageRestURL(){return""}getPanelContent(){return Promise.resolve(new c.DefaultPageData)}isStorageReady(){return Promise.resolve(!0)}async save(t,e,a){const r=await fileSystemStorage.resolvePath(t);await fileSystemStorage.savePage(r,a,e)}async saveAttachments(t,e){await Promise.all(e.map(a=>this.saveAttachment(t,a)))}async delete(t){try{return await fileSystemStorage.deletePage(t),{success:!0}}catch(e){return{success:!1,error:e.message}}}async move(t,e,a){try{return await fileSystemStorage.movePage(t,e,a),{success:!0}}catch(r){return{success:!1,error:r.message}}}async saveAttachment(t,e){const a=await fileSystemStorage.resolveAttachmentPath(t,e.name);await fileSystemStorage.saveAttachment(a,e)}};u=y([n.injectable(),v(0,n.inject("Logger"))],u);class w{logger;constructor(e){this.logger=e.get("Logger"),this.logger.setModule("electron.storage.components.componentsInit"),this.logger?.debug("Init Sample Module components begin"),e.bind("WikiConfig").to(m).when(d.whenNamedOrDefault("FileSystem")),e.bind("Storage").to(u).whenNamed("FileSystem"),this.logger?.debug("Init Sample Module components end")}}s.ComponentInit=w,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
2
2
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../../src/components/FileSystemConfig.ts","../../src/components/fileSystemStorage.ts","../../src/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { APITypes } from \"../electron/preload/apiTypes\";\nimport { DefaultWikiConfig } from \"@xwiki/cristal-api\";\nimport { inject, injectable, named } from \"inversify\";\nimport type { CristalApp, Logger, Storage } from \"@xwiki/cristal-api\";\n\ndeclare const fileSystemStorage: APITypes;\n\n@injectable()\nexport class FileSystemConfig extends DefaultWikiConfig {\n override storage: Storage;\n override cristal: CristalApp;\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"Storage\") @named(\"FileSystem\") storage: Storage,\n @inject(\"CristalApp\") cristal: CristalApp,\n ) {\n super(logger);\n this.storage = storage;\n this.cristal = cristal;\n this.storage.setWikiConfig(this);\n if (this.homePage === \"\") {\n this.homePage = \"index.md\";\n }\n }\n\n override getType(): string {\n return \"FileSystem\";\n }\n\n override initialize(): void {\n super.initialize();\n // The initialization for the root directory needs to be done after a\n // configuration change, but before any storage operation.\n fileSystemStorage.initRootDirectory();\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { APITypes } from \"../electron/preload/apiTypes\";\nimport {\n AttachmentsData,\n DefaultPageData,\n PageAttachment,\n PageData,\n} from \"@xwiki/cristal-api\";\nimport { AbstractStorage } from \"@xwiki/cristal-backend-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { Logger } from \"@xwiki/cristal-api\";\n\ndeclare const fileSystemStorage: APITypes;\n\n@injectable()\nexport default class FileSystemStorage extends AbstractStorage {\n constructor(@inject(\"Logger\") logger: Logger) {\n super(logger, \"storage.components.fileSystemStorage\");\n }\n\n getEditField(): Promise<string> {\n return Promise.resolve(\"\");\n }\n\n getImageURL(): string {\n return \"\";\n }\n\n async getPageContent(page: string): Promise<PageData> {\n const decodedPage = decodeURI(page);\n const path = await fileSystemStorage.resolvePath(decodedPage);\n const pageData = await fileSystemStorage.readPage(path || \"\");\n if (pageData) {\n pageData.id = decodedPage;\n pageData.headline = pageData.name;\n pageData.headlineRaw = pageData.name;\n }\n return pageData;\n }\n\n async getAttachments(page: string): Promise<AttachmentsData | undefined> {\n const path = await fileSystemStorage.resolveAttachmentsPath(page);\n return {\n attachments: await fileSystemStorage.readAttachments(path),\n };\n }\n\n async getAttachment(\n page: string,\n name: string,\n ): Promise<PageAttachment | undefined> {\n const path = await fileSystemStorage.resolveAttachmentPath(page, name);\n return fileSystemStorage.readAttachment(path);\n }\n\n getPageFromViewURL(): string | null {\n return null;\n }\n\n getPageRestURL(): string {\n return \"\";\n }\n\n getPanelContent(): Promise<PageData> {\n return Promise.resolve(new DefaultPageData());\n }\n\n isStorageReady(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n async save(page: string, title: string, content: string): Promise<void> {\n const path = await fileSystemStorage.resolvePath(page);\n await fileSystemStorage.savePage(path, content, title);\n }\n\n async saveAttachments(\n page: string,\n files: File[],\n ): Promise<undefined | (undefined | string)[]> {\n await Promise.all(files.map((file) => this.saveAttachment(page, file)));\n return undefined;\n }\n\n async delete(page: string): Promise<{ success: boolean; error?: string }> {\n try {\n await fileSystemStorage.deletePage(page);\n return { success: true };\n } catch (error) {\n return { success: false, error: (error as Error).message };\n }\n }\n\n async move(\n page: string,\n newPage: string,\n preserveChildren: boolean,\n ): Promise<{ success: boolean; error?: string }> {\n try {\n await fileSystemStorage.movePage(page, newPage, preserveChildren);\n return { success: true };\n } catch (error) {\n return { success: false, error: (error as Error).message };\n }\n }\n\n private async saveAttachment(page: string, file: File): Promise<unknown> {\n const path = await fileSystemStorage.resolveAttachmentPath(page, file.name);\n await fileSystemStorage.saveAttachment(path, file);\n return;\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { FileSystemConfig } from \"./components/FileSystemConfig\";\nimport FileSystemStorage from \"./components/fileSystemStorage\";\nimport { whenNamedOrDefault } from \"@xwiki/cristal-utils-inversify\";\nimport type { Logger, Storage, WikiConfig } from \"@xwiki/cristal-api\";\nimport type { Container } from \"inversify\";\n\nexport default class ComponentInit {\n logger: Logger;\n\n constructor(container: Container) {\n this.logger = container.get<Logger>(\"Logger\");\n this.logger.setModule(\"electron.storage.components.componentsInit\");\n\n this.logger?.debug(\"Init Sample Module components begin\");\n container\n .bind<WikiConfig>(\"WikiConfig\")\n .to(FileSystemConfig)\n .when(whenNamedOrDefault(\"FileSystem\"));\n container\n .bind<Storage>(\"Storage\")\n .to(FileSystemStorage)\n .whenNamed(\"FileSystem\");\n this.logger?.debug(\"Init Sample Module components end\");\n }\n}\n"],"names":["FileSystemConfig","DefaultWikiConfig","logger","storage","cristal","__decorateClass","injectable","__decorateParam","FileSystemStorage","AbstractStorage","page","decodedPage","path","pageData","name","DefaultPageData","title","content","files","file","error","newPage","preserveChildren","ComponentInit","container","whenNamedOrDefault"],"mappings":"2rBA4BO,IAAMA,EAAN,cAA+BC,EAAAA,iBAAkB,CAGtD,YACoBC,EACsBC,EAClBC,EACtB,CACA,MAAMF,CAAM,EACZ,KAAK,QAAUC,EACf,KAAK,QAAUC,EACf,KAAK,QAAQ,cAAc,IAAI,EAC3B,KAAK,WAAa,KACpB,KAAK,SAAW,WAEpB,CAES,SAAkB,CACzB,MAAO,YACT,CAES,YAAmB,CAC1B,MAAM,WAAA,EAGN,kBAAkB,kBAAA,CACpB,CACF,EA3BaJ,EAANK,EAAA,CADNC,aAAA,EAKIC,aAAO,QAAQ,CAAA,EACfA,aAAO,SAAS,CAAA,EAAGA,YAAM,YAAY,CAAA,EACrCA,aAAO,YAAY,CAAA,CAAA,EANXP,CAAA,uKCMb,IAAqBQ,EAArB,cAA+CC,EAAAA,eAAgB,CAC7D,YAA8BP,EAAgB,CAC5C,MAAMA,EAAQ,sCAAsC,CACt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,MAAM,KACJV,EACAW,EACAC,EAC+C,CAC/C,GAAI,CACF,aAAM,kBAAkB,SAASZ,EAAMW,EAASC,CAAgB,EACzD,CAAE,QAAS,EAAA,CACpB,OAASF,EAAO,CACd,MAAO,CAAE,QAAS,GAAO,MAAQA,EAAgB,OAAA,CACnD,CACF,CAEA,MAAc,eAAeV,EAAcS,EAA8B,CACvE,MAAMP,EAAO,MAAM,kBAAkB,sBAAsBF,EAAMS,EAAK,IAAI,EAC1E,MAAM,kBAAkB,eAAeP,EAAMO,CAAI,CAEnD,CACF,EAhGqBX,EAArBH,EAAA,CADCC,aAAA,EAEcC,aAAO,QAAQ,CAAA,CAAA,EADTC,CAAA,ECRrB,MAAqBe,CAAc,CAGjC,YAAYC,EAAsB,CAChC,KAAK,OAASA,EAAU,IAAY,QAAQ,EAC5C,KAAK,OAAO,UAAU,4CAA4C,EAElE,KAAK,QAAQ,MAAM,qCAAqC,EACxDA,EACG,KAAiB,YAAY,EAC7B,GAAGxB,CAAgB,EACnB,KAAKyB,qBAAmB,YAAY,CAAC,EACxCD,EACG,KAAc,SAAS,EACvB,GAAGhB,CAAiB,EACpB,UAAU,YAAY,EACzB,KAAK,QAAQ,MAAM,mCAAmC,CACxD,CACF"}
1
+ {"version":3,"file":"index.umd.js","sources":["../../src/components/FileSystemConfig.ts","../../src/components/fileSystemStorage.ts","../../src/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { DefaultWikiConfig } from \"@xwiki/cristal-api\";\nimport { inject, injectable, named } from \"inversify\";\nimport type { APITypes } from \"../electron/preload/apiTypes\";\nimport type { CristalApp, Logger, Storage } from \"@xwiki/cristal-api\";\n\ndeclare const fileSystemStorage: APITypes;\n\n@injectable()\nexport class FileSystemConfig extends DefaultWikiConfig {\n override storage: Storage;\n override cristal: CristalApp;\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"Storage\") @named(\"FileSystem\") storage: Storage,\n @inject(\"CristalApp\") cristal: CristalApp,\n ) {\n super(logger);\n this.storage = storage;\n this.cristal = cristal;\n this.storage.setWikiConfig(this);\n if (this.homePage === \"\") {\n this.homePage = \"index.md\";\n }\n }\n\n override getType(): string {\n return \"FileSystem\";\n }\n\n override initialize(): void {\n super.initialize();\n // The initialization for the root directory needs to be done after a\n // configuration change, but before any storage operation.\n fileSystemStorage.initRootDirectory();\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { DefaultPageData } from \"@xwiki/cristal-api\";\nimport { AbstractStorage } from \"@xwiki/cristal-backend-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { APITypes } from \"../electron/preload/apiTypes\";\nimport type {\n AttachmentsData,\n Logger,\n PageAttachment,\n PageData,\n} from \"@xwiki/cristal-api\";\n\ndeclare const fileSystemStorage: APITypes;\n\n@injectable()\nexport default class FileSystemStorage extends AbstractStorage {\n constructor(@inject(\"Logger\") logger: Logger) {\n super(logger, \"storage.components.fileSystemStorage\");\n }\n\n getEditField(): Promise<string> {\n return Promise.resolve(\"\");\n }\n\n getImageURL(): string {\n return \"\";\n }\n\n async getPageContent(page: string): Promise<PageData> {\n const decodedPage = decodeURI(page);\n const path = await fileSystemStorage.resolvePath(decodedPage);\n const pageData = await fileSystemStorage.readPage(path || \"\");\n if (pageData) {\n pageData.id = decodedPage;\n pageData.headline = pageData.name;\n pageData.headlineRaw = pageData.name;\n }\n return pageData;\n }\n\n async getAttachments(page: string): Promise<AttachmentsData | undefined> {\n const path = await fileSystemStorage.resolveAttachmentsPath(page);\n return {\n attachments: await fileSystemStorage.readAttachments(path),\n };\n }\n\n async getAttachment(\n page: string,\n name: string,\n ): Promise<PageAttachment | undefined> {\n const path = await fileSystemStorage.resolveAttachmentPath(page, name);\n return fileSystemStorage.readAttachment(path);\n }\n\n getPageFromViewURL(): string | null {\n return null;\n }\n\n getPageRestURL(): string {\n return \"\";\n }\n\n getPanelContent(): Promise<PageData> {\n return Promise.resolve(new DefaultPageData());\n }\n\n isStorageReady(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n async save(page: string, title: string, content: string): Promise<void> {\n const path = await fileSystemStorage.resolvePath(page);\n await fileSystemStorage.savePage(path, content, title);\n }\n\n async saveAttachments(\n page: string,\n files: File[],\n ): Promise<undefined | (undefined | string)[]> {\n await Promise.all(files.map((file) => this.saveAttachment(page, file)));\n return undefined;\n }\n\n async delete(page: string): Promise<{ success: boolean; error?: string }> {\n try {\n await fileSystemStorage.deletePage(page);\n return { success: true };\n } catch (error) {\n return { success: false, error: (error as Error).message };\n }\n }\n\n async move(\n page: string,\n newPage: string,\n preserveChildren: boolean,\n ): Promise<{ success: boolean; error?: string }> {\n try {\n await fileSystemStorage.movePage(page, newPage, preserveChildren);\n return { success: true };\n } catch (error) {\n return { success: false, error: (error as Error).message };\n }\n }\n\n private async saveAttachment(page: string, file: File): Promise<unknown> {\n const path = await fileSystemStorage.resolveAttachmentPath(page, file.name);\n await fileSystemStorage.saveAttachment(path, file);\n return;\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { FileSystemConfig } from \"./components/FileSystemConfig\";\nimport FileSystemStorage from \"./components/fileSystemStorage\";\nimport { whenNamedOrDefault } from \"@xwiki/cristal-utils-inversify\";\nimport type { Logger, Storage, WikiConfig } from \"@xwiki/cristal-api\";\nimport type { Container } from \"inversify\";\n\n/**\n * @beta\n */\nexport default class ComponentInit {\n logger: Logger;\n\n constructor(container: Container) {\n this.logger = container.get<Logger>(\"Logger\");\n this.logger.setModule(\"electron.storage.components.componentsInit\");\n\n this.logger?.debug(\"Init Sample Module components begin\");\n container\n .bind<WikiConfig>(\"WikiConfig\")\n .to(FileSystemConfig)\n .when(whenNamedOrDefault(\"FileSystem\"));\n container\n .bind<Storage>(\"Storage\")\n .to(FileSystemStorage)\n .whenNamed(\"FileSystem\");\n this.logger?.debug(\"Init Sample Module components end\");\n }\n}\n"],"names":["FileSystemConfig","DefaultWikiConfig","logger","storage","cristal","__decorateClass","injectable","__decorateParam","FileSystemStorage","AbstractStorage","page","decodedPage","path","pageData","name","DefaultPageData","title","content","files","file","error","newPage","preserveChildren","ComponentInit","container","whenNam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B,YAAY,CAAC,EACxCD,EACG,KAAc,SAAS,EACvB,GAAGhB,CAAiB,EACpB,UAAU,YAAY,EACzB,KAAK,QAAQ,MAAM,mCAAmC,CACxD,CACF"}
@@ -1,2 +1,20 @@
1
- import { default as ComponentInit } from './componentsInit';
2
- export { ComponentInit };
1
+ /**
2
+ * See the LICENSE file distributed with this work for additional
3
+ * information regarding copyright ownership.
4
+ *
5
+ * This is free software; you can redistribute it and/or modify it
6
+ * under the terms of the GNU Lesser General Public License as
7
+ * published by the Free Software Foundation; either version 2.1 of
8
+ * the License, or (at your option) any later version.
9
+ *
10
+ * This software is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this software; if not, write to the Free
17
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
+ */
20
+ export default function load(): Promise<void>;
@@ -1,2 +1,20 @@
1
- import { default as ComponentInit } from './componentsInit';
2
- export { ComponentInit };
1
+ /**
2
+ * See the LICENSE file distributed with this work for additional
3
+ * information regarding copyright ownership.
4
+ *
5
+ * This is free software; you can redistribute it and/or modify it
6
+ * under the terms of the GNU Lesser General Public License as
7
+ * published by the Free Software Foundation; either version 2.1 of
8
+ * the License, or (at your option) any later version.
9
+ *
10
+ * This software is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this software; if not, write to the Free
17
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
+ */
20
+ export default function load(): Promise<void>;