@webiny/api-file-manager-aco 5.36.2 → 5.37.0-beta.1

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/LICENSE CHANGED
@@ -1,6 +1,11 @@
1
- MIT License
1
+ Copyright (c) Webiny Inc.
2
2
 
3
- Copyright (c) Webiny
3
+ Portions of this software are licensed as follows:
4
+
5
+ * All content that resides under the "enterprise/" directories of this repository, is licensed under the license defined in their respective "enterprise/LICENSE" file.
6
+ * All content that resides under the "packages/" sub-directories of this repository, is licensed under the license defined in their respective "packages/*/LICENSE" file.
7
+ * All third party components incorporated into the Webiny Software are licensed under the original license provided by the owner of the applicable component.
8
+ * Content outside of the above mentioned directories or restrictions above is available under the "MIT" license as defined below.
4
9
 
5
10
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
11
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,56 +1,17 @@
1
1
  {
2
2
  "name": "@webiny/api-file-manager-aco",
3
- "version": "5.36.2",
4
- "main": "index.js",
5
- "keywords": [
6
- "api-file-manager-aco:base"
7
- ],
3
+ "version": "5.37.0-beta.1",
8
4
  "repository": {
9
5
  "type": "git",
10
6
  "url": "https://github.com/webiny/webiny-js.git",
11
7
  "directory": "packages/api-file-manager-aco"
12
8
  },
13
- "description": "Connect File Manager to ACO",
9
+ "description": "This package is scheduled for deletion in the next version.",
14
10
  "author": "Webiny Ltd.",
15
11
  "license": "MIT",
16
- "scripts": {
17
- "build": "yarn webiny run build",
18
- "watch": "yarn webiny run watch"
19
- },
20
12
  "publishConfig": {
21
13
  "access": "public",
22
- "directory": "dist"
23
- },
24
- "devDependencies": {
25
- "@babel/cli": "7.20.7",
26
- "@babel/core": "7.20.12",
27
- "@babel/preset-env": "7.20.2",
28
- "@babel/preset-typescript": "7.18.6",
29
- "@babel/runtime": "7.20.13",
30
- "@webiny/api-file-manager-ddb": "5.36.2",
31
- "@webiny/api-headless-cms": "5.36.2",
32
- "@webiny/api-headless-cms-ddb": "5.36.2",
33
- "@webiny/api-i18n": "5.36.2",
34
- "@webiny/api-i18n-ddb": "5.36.2",
35
- "@webiny/api-security": "5.36.2",
36
- "@webiny/api-security-so-ddb": "5.36.2",
37
- "@webiny/api-tenancy": "5.36.2",
38
- "@webiny/api-tenancy-so-ddb": "5.36.2",
39
- "@webiny/cli": "5.36.2",
40
- "@webiny/handler-aws": "5.36.2",
41
- "@webiny/handler-graphql": "5.36.2",
42
- "@webiny/plugins": "5.36.2",
43
- "@webiny/project-utils": "5.36.2",
44
- "mdbid": "1.0.0",
45
- "ttypescript": "1.5.15",
46
- "typescript": "4.7.4"
47
- },
48
- "dependencies": {
49
- "@webiny/api": "5.36.2",
50
- "@webiny/api-aco": "5.36.2",
51
- "@webiny/api-file-manager": "5.36.2",
52
- "@webiny/error": "5.36.2",
53
- "@webiny/handler": "5.36.2"
14
+ "directory": "."
54
15
  },
55
- "gitHead": "908c591cd08d81da267ed6152e880b52e1157c8b"
16
+ "gitHead": "176c29425477d1daaca1b7da79bacc79a1d35f6e"
56
17
  }
package/README.md DELETED
@@ -1,33 +0,0 @@
1
- # @webiny/api-file-manager-aco
2
-
3
- [![](https://img.shields.io/npm/dw/@webiny/api-file-manager-aco.svg)](https://www.npmjs.com/package/@webiny/api-file-manager-aco)
4
- [![](https://img.shields.io/npm/v/@webiny/api-file-manager-aco.svg)](https://www.npmjs.com/package/@webiny/api-file-manager-aco)
5
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
6
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
7
-
8
- ## Install
9
-
10
- ```
11
- npm install --save @webiny/api-file-manager-aco
12
- ```
13
-
14
- Or if you prefer yarn:
15
-
16
- ```
17
- yarn add @webiny/api-file-manager-aco
18
- ```
19
- ## Testing
20
-
21
- To run tests api-file-manager-aco tests with targeted storage operations loaded use:
22
-
23
- ### DynamoDB
24
-
25
- ```
26
- yarn test packages/api-file-manager-aco/* --keyword=cms:ddb --keyword=aco:base --keyword=fm:ddb --keyword=fm:base --keyword=api-file-manager-aco:base
27
- ```
28
-
29
- ### DynamoDB + ElasticSearch
30
-
31
- ```
32
- yarn test packages/api-file-manager-aco/* --keyword=cms:ddb-es --keyword=aco:base --keyword=fm:ddb-es --keyword=fm:base --keyword=api-file-manager-aco:base
33
- ```
package/contants.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const ROOT_FOLDER = "ROOT";
2
- export declare const FM_FILE_TYPE = "FmFile";
package/contants.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ROOT_FOLDER = exports.FM_FILE_TYPE = void 0;
7
- const ROOT_FOLDER = "ROOT";
8
- exports.ROOT_FOLDER = ROOT_FOLDER;
9
- const FM_FILE_TYPE = "FmFile";
10
- exports.FM_FILE_TYPE = FM_FILE_TYPE;
package/contants.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":["ROOT_FOLDER","FM_FILE_TYPE"],"sources":["contants.ts"],"sourcesContent":["export const ROOT_FOLDER = \"ROOT\";\nexport const FM_FILE_TYPE = \"FmFile\";\n"],"mappings":";;;;;;AAAO,MAAMA,WAAW,GAAG,MAAM;AAAC;AAC3B,MAAMC,YAAY,GAAG,QAAQ;AAAC"}
@@ -1,3 +0,0 @@
1
- import { FmAcoContext } from "../../types";
2
- export declare const createFileHooks: (context: FmAcoContext) => void;
3
- export declare const createImportExportFileHooks: (context: FmAcoContext) => void;
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createImportExportFileHooks = exports.createFileHooks = void 0;
7
- var _onFileAfterCreate = require("./onFileAfterCreate.hook");
8
- var _onFileAfterBatchCreate = require("./onFileAfterBatchCreate.hook");
9
- var _onFileAfterDelete = require("./onFileAfterDelete.hook");
10
- var _onFileAfterUpdate = require("./onFileAfterUpdate.hook");
11
- const createFileHooks = context => {
12
- (0, _onFileAfterCreate.onFileAfterCreateHook)(context);
13
- (0, _onFileAfterBatchCreate.onFileAfterBatchCreateHook)(context);
14
- (0, _onFileAfterDelete.onFileAfterDeleteHook)(context);
15
- (0, _onFileAfterUpdate.onFileAfterUpdateHook)(context);
16
- };
17
- exports.createFileHooks = createFileHooks;
18
- const createImportExportFileHooks = context => {
19
- (0, _onFileAfterCreate.onFileAfterCreateHook)(context);
20
- (0, _onFileAfterBatchCreate.onFileAfterBatchCreateHook)(context);
21
- };
22
- exports.createImportExportFileHooks = createImportExportFileHooks;
@@ -1 +0,0 @@
1
- {"version":3,"names":["createFileHooks","context","onFileAfterCreateHook","onFileAfterBatchCreateHook","onFileAfterDeleteHook","onFileAfterUpdateHook","createImportExportFileHooks"],"sources":["index.ts"],"sourcesContent":["import { onFileAfterCreateHook } from \"~/file/hooks/onFileAfterCreate.hook\";\nimport { onFileAfterBatchCreateHook } from \"~/file/hooks/onFileAfterBatchCreate.hook\";\nimport { onFileAfterDeleteHook } from \"~/file/hooks/onFileAfterDelete.hook\";\nimport { onFileAfterUpdateHook } from \"~/file/hooks/onFileAfterUpdate.hook\";\n\nimport { FmAcoContext } from \"~/types\";\n\nexport const createFileHooks = (context: FmAcoContext) => {\n onFileAfterCreateHook(context);\n onFileAfterBatchCreateHook(context);\n onFileAfterDeleteHook(context);\n onFileAfterUpdateHook(context);\n};\n\nexport const createImportExportFileHooks = (context: FmAcoContext) => {\n onFileAfterCreateHook(context);\n onFileAfterBatchCreateHook(context);\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAIO,MAAMA,eAAe,GAAIC,OAAqB,IAAK;EACtD,IAAAC,wCAAqB,EAACD,OAAO,CAAC;EAC9B,IAAAE,kDAA0B,EAACF,OAAO,CAAC;EACnC,IAAAG,wCAAqB,EAACH,OAAO,CAAC;EAC9B,IAAAI,wCAAqB,EAACJ,OAAO,CAAC;AAClC,CAAC;AAAC;AAEK,MAAMK,2BAA2B,GAAIL,OAAqB,IAAK;EAClE,IAAAC,wCAAqB,EAACD,OAAO,CAAC;EAC9B,IAAAE,kDAA0B,EAACF,OAAO,CAAC;AACvC,CAAC;AAAC"}
@@ -1,2 +0,0 @@
1
- import { FmAcoContext } from "../../types";
2
- export declare const onFileAfterBatchCreateHook: ({ fileManager, aco }: FmAcoContext) => void;
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.onFileAfterBatchCreateHook = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _createRecordPayload = require("../../utils/createRecordPayload");
10
- const onFileAfterBatchCreateHook = ({
11
- fileManager,
12
- aco
13
- }) => {
14
- /**
15
- * Intercept file batch creation and create a new search records.
16
- */
17
- fileManager.onFileAfterBatchCreate.subscribe(async ({
18
- files,
19
- meta
20
- }) => {
21
- try {
22
- for (const file of files) {
23
- if (file.meta.private) {
24
- // Skipping ACO search record creation while file is marked as private
25
- continue;
26
- }
27
- const payload = (0, _createRecordPayload.createFileRecordPayload)(file, meta);
28
- await aco.search.create(payload);
29
- }
30
- } catch (error) {
31
- throw _error.default.from(error, {
32
- message: "Error while executing onFileAfterBatchCreateHook hook",
33
- code: "ACO_AFTER_FILE_BATCH_CREATE_HOOK"
34
- });
35
- }
36
- });
37
- };
38
- exports.onFileAfterBatchCreateHook = onFileAfterBatchCreateHook;
@@ -1 +0,0 @@
1
- {"version":3,"names":["onFileAfterBatchCreateHook","fileManager","aco","onFileAfterBatchCreate","subscribe","files","meta","file","private","payload","createFileRecordPayload","search","create","error","WebinyError","from","message","code"],"sources":["onFileAfterBatchCreate.hook.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nimport { createFileRecordPayload } from \"../../utils/createRecordPayload\";\n\nimport { FmAcoContext, FmFileRecordData } from \"~/types\";\n\nexport const onFileAfterBatchCreateHook = ({ fileManager, aco }: FmAcoContext) => {\n /**\n * Intercept file batch creation and create a new search records.\n */\n fileManager.onFileAfterBatchCreate.subscribe(async ({ files, meta }) => {\n try {\n for (const file of files) {\n if (file.meta.private) {\n // Skipping ACO search record creation while file is marked as private\n continue;\n }\n const payload = createFileRecordPayload(file, meta);\n await aco.search.create<FmFileRecordData>(payload);\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onFileAfterBatchCreateHook hook\",\n code: \"ACO_AFTER_FILE_BATCH_CREATE_HOOK\"\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AAIO,MAAMA,0BAA0B,GAAG,CAAC;EAAEC,WAAW;EAAEC;AAAkB,CAAC,KAAK;EAC9E;AACJ;AACA;EACID,WAAW,CAACE,sBAAsB,CAACC,SAAS,CAAC,OAAO;IAAEC,KAAK;IAAEC;EAAK,CAAC,KAAK;IACpE,IAAI;MACA,KAAK,MAAMC,IAAI,IAAIF,KAAK,EAAE;QACtB,IAAIE,IAAI,CAACD,IAAI,CAACE,OAAO,EAAE;UACnB;UACA;QACJ;QACA,MAAMC,OAAO,GAAG,IAAAC,4CAAuB,EAACH,IAAI,EAAED,IAAI,CAAC;QACnD,MAAMJ,GAAG,CAACS,MAAM,CAACC,MAAM,CAAmBH,OAAO,CAAC;MACtD;IACJ,CAAC,CAAC,OAAOI,KAAK,EAAE;MACZ,MAAMC,cAAW,CAACC,IAAI,CAACF,KAAK,EAAE;QAC1BG,OAAO,EAAE,uDAAuD;QAChEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,2 +0,0 @@
1
- import { FmAcoContext } from "../../types";
2
- export declare const onFileAfterCreateHook: ({ fileManager, aco }: FmAcoContext) => void;
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.onFileAfterCreateHook = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _createRecordPayload = require("../../utils/createRecordPayload");
10
- const onFileAfterCreateHook = ({
11
- fileManager,
12
- aco
13
- }) => {
14
- /**
15
- * Intercept file creation and create a new search record.
16
- */
17
- fileManager.onFileAfterCreate.subscribe(async ({
18
- file,
19
- meta
20
- }) => {
21
- try {
22
- if (file.meta.private) {
23
- // Skipping ACO search record creation while file is marked as private
24
- return;
25
- }
26
- const payload = (0, _createRecordPayload.createFileRecordPayload)(file, meta);
27
- await aco.search.create(payload);
28
- } catch (error) {
29
- throw _error.default.from(error, {
30
- message: "Error while executing onFileAfterCreateHook hook",
31
- code: "ACO_AFTER_FILE_CREATE_HOOK"
32
- });
33
- }
34
- });
35
- };
36
- exports.onFileAfterCreateHook = onFileAfterCreateHook;
@@ -1 +0,0 @@
1
- {"version":3,"names":["onFileAfterCreateHook","fileManager","aco","onFileAfterCreate","subscribe","file","meta","private","payload","createFileRecordPayload","search","create","error","WebinyError","from","message","code"],"sources":["onFileAfterCreate.hook.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nimport { createFileRecordPayload } from \"../../utils/createRecordPayload\";\n\nimport { FmAcoContext, FmFileRecordData } from \"~/types\";\n\nexport const onFileAfterCreateHook = ({ fileManager, aco }: FmAcoContext) => {\n /**\n * Intercept file creation and create a new search record.\n */\n fileManager.onFileAfterCreate.subscribe(async ({ file, meta }) => {\n try {\n if (file.meta.private) {\n // Skipping ACO search record creation while file is marked as private\n return;\n }\n const payload = createFileRecordPayload(file, meta);\n await aco.search.create<FmFileRecordData>(payload);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onFileAfterCreateHook hook\",\n code: \"ACO_AFTER_FILE_CREATE_HOOK\"\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AAIO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC,WAAW;EAAEC;AAAkB,CAAC,KAAK;EACzE;AACJ;AACA;EACID,WAAW,CAACE,iBAAiB,CAACC,SAAS,CAAC,OAAO;IAAEC,IAAI;IAAEC;EAAK,CAAC,KAAK;IAC9D,IAAI;MACA,IAAID,IAAI,CAACC,IAAI,CAACC,OAAO,EAAE;QACnB;QACA;MACJ;MACA,MAAMC,OAAO,GAAG,IAAAC,4CAAuB,EAACJ,IAAI,EAAEC,IAAI,CAAC;MACnD,MAAMJ,GAAG,CAACQ,MAAM,CAACC,MAAM,CAAmBH,OAAO,CAAC;IACtD,CAAC,CAAC,OAAOI,KAAK,EAAE;MACZ,MAAMC,cAAW,CAACC,IAAI,CAACF,KAAK,EAAE;QAC1BG,OAAO,EAAE,kDAAkD;QAC3DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,2 +0,0 @@
1
- import { FmAcoContext } from "../../types";
2
- export declare const onFileAfterDeleteHook: ({ fileManager, aco }: FmAcoContext) => void;
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.onFileAfterDeleteHook = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- const onFileAfterDeleteHook = ({
10
- fileManager,
11
- aco
12
- }) => {
13
- /**
14
- * Intercept file deletion and delete the related search record.
15
- */
16
- fileManager.onFileAfterDelete.subscribe(async ({
17
- file
18
- }) => {
19
- try {
20
- await aco.search.delete(file.id);
21
- } catch (error) {
22
- if (error.code === "NOT_FOUND") {
23
- return;
24
- }
25
- throw _error.default.from(error, {
26
- message: "Error while executing onFileAfterDeleteHook hook",
27
- code: "ACO_AFTER_FILE_DELETE_HOOK"
28
- });
29
- }
30
- });
31
- };
32
- exports.onFileAfterDeleteHook = onFileAfterDeleteHook;
@@ -1 +0,0 @@
1
- {"version":3,"names":["onFileAfterDeleteHook","fileManager","aco","onFileAfterDelete","subscribe","file","search","delete","id","error","code","WebinyError","from","message"],"sources":["onFileAfterDelete.hook.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nimport { FmAcoContext } from \"~/types\";\n\nexport const onFileAfterDeleteHook = ({ fileManager, aco }: FmAcoContext) => {\n /**\n * Intercept file deletion and delete the related search record.\n */\n fileManager.onFileAfterDelete.subscribe(async ({ file }) => {\n try {\n await aco.search.delete(file.id);\n } catch (error) {\n if (error.code === \"NOT_FOUND\") {\n return;\n }\n\n throw WebinyError.from(error, {\n message: \"Error while executing onFileAfterDeleteHook hook\",\n code: \"ACO_AFTER_FILE_DELETE_HOOK\"\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;AAIO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC,WAAW;EAAEC;AAAkB,CAAC,KAAK;EACzE;AACJ;AACA;EACID,WAAW,CAACE,iBAAiB,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAK,CAAC,KAAK;IACxD,IAAI;MACA,MAAMH,GAAG,CAACI,MAAM,CAACC,MAAM,CAACF,IAAI,CAACG,EAAE,CAAC;IACpC,CAAC,CAAC,OAAOC,KAAK,EAAE;MACZ,IAAIA,KAAK,CAACC,IAAI,KAAK,WAAW,EAAE;QAC5B;MACJ;MAEA,MAAMC,cAAW,CAACC,IAAI,CAACH,KAAK,EAAE;QAC1BI,OAAO,EAAE,kDAAkD;QAC3DH,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,2 +0,0 @@
1
- import { FmAcoContext } from "../../types";
2
- export declare const onFileAfterUpdateHook: ({ aco, fileManager }: FmAcoContext) => void;
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.onFileAfterUpdateHook = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _createRecordPayload = require("../../utils/createRecordPayload");
10
- const onFileAfterUpdateHook = ({
11
- aco,
12
- fileManager
13
- }) => {
14
- /**
15
- * Intercept file update event and update the related search record.
16
- */
17
- fileManager.onFileAfterUpdate.subscribe(async ({
18
- file
19
- }) => {
20
- try {
21
- const payload = await (0, _createRecordPayload.updatePageRecordPayload)(file);
22
- await aco.search.update(file.id, payload);
23
- } catch (error) {
24
- throw _error.default.from(error, {
25
- message: "Error while executing onFileAfterUpdateHook hook",
26
- code: "ACO_AFTER_FILE_UPDATE_HOOK"
27
- });
28
- }
29
- });
30
- };
31
- exports.onFileAfterUpdateHook = onFileAfterUpdateHook;
@@ -1 +0,0 @@
1
- {"version":3,"names":["onFileAfterUpdateHook","aco","fileManager","onFileAfterUpdate","subscribe","file","payload","updatePageRecordPayload","search","update","id","error","WebinyError","from","message","code"],"sources":["onFileAfterUpdate.hook.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nimport { updatePageRecordPayload } from \"../../utils/createRecordPayload\";\n\nimport { FmAcoContext, FmFileRecordData } from \"~/types\";\n\nexport const onFileAfterUpdateHook = ({ aco, fileManager }: FmAcoContext) => {\n /**\n * Intercept file update event and update the related search record.\n */\n fileManager.onFileAfterUpdate.subscribe(async ({ file }) => {\n try {\n const payload = await updatePageRecordPayload(file);\n await aco.search.update<FmFileRecordData>(file.id, payload);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onFileAfterUpdateHook hook\",\n code: \"ACO_AFTER_FILE_UPDATE_HOOK\"\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AAIO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC,GAAG;EAAEC;AAA0B,CAAC,KAAK;EACzE;AACJ;AACA;EACIA,WAAW,CAACC,iBAAiB,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAK,CAAC,KAAK;IACxD,IAAI;MACA,MAAMC,OAAO,GAAG,MAAM,IAAAC,4CAAuB,EAACF,IAAI,CAAC;MACnD,MAAMJ,GAAG,CAACO,MAAM,CAACC,MAAM,CAAmBJ,IAAI,CAACK,EAAE,EAAEJ,OAAO,CAAC;IAC/D,CAAC,CAAC,OAAOK,KAAK,EAAE;MACZ,MAAMC,cAAW,CAACC,IAAI,CAACF,KAAK,EAAE;QAC1BG,OAAO,EAAE,kDAAkD;QAC3DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
package/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { ContextPlugin } from "@webiny/api";
2
- import { FmAcoContext } from "./types";
3
- export declare const createAcoFileManagerContext: () => ContextPlugin<FmAcoContext>;
4
- export declare const createAcoFileManagerImportExportContext: () => ContextPlugin<FmAcoContext>;
package/index.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createAcoFileManagerImportExportContext = exports.createAcoFileManagerContext = void 0;
7
- var _api = require("@webiny/api");
8
- var _hooks = require("./file/hooks");
9
- const createAcoFileManagerContext = () => {
10
- return new _api.ContextPlugin(context => {
11
- (0, _hooks.createFileHooks)(context);
12
- });
13
- };
14
- exports.createAcoFileManagerContext = createAcoFileManagerContext;
15
- const createAcoFileManagerImportExportContext = () => {
16
- return new _api.ContextPlugin(context => {
17
- (0, _hooks.createImportExportFileHooks)(context);
18
- });
19
- };
20
- exports.createAcoFileManagerImportExportContext = createAcoFileManagerImportExportContext;
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":["createAcoFileManagerContext","ContextPlugin","context","createFileHooks","createAcoFileManagerImportExportContext","createImportExportFileHooks"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\n\nimport { createImportExportFileHooks, createFileHooks } from \"~/file/hooks\";\n\nimport { FmAcoContext } from \"~/types\";\n\nexport const createAcoFileManagerContext = () => {\n return new ContextPlugin<FmAcoContext>(context => {\n createFileHooks(context);\n });\n};\n\nexport const createAcoFileManagerImportExportContext = () => {\n return new ContextPlugin<FmAcoContext>(context => {\n createImportExportFileHooks(context);\n });\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAIO,MAAMA,2BAA2B,GAAG,MAAM;EAC7C,OAAO,IAAIC,kBAAa,CAAeC,OAAO,IAAI;IAC9C,IAAAC,sBAAe,EAACD,OAAO,CAAC;EAC5B,CAAC,CAAC;AACN,CAAC;AAAC;AAEK,MAAME,uCAAuC,GAAG,MAAM;EACzD,OAAO,IAAIH,kBAAa,CAAeC,OAAO,IAAI;IAC9C,IAAAG,kCAA2B,EAACH,OAAO,CAAC;EACxC,CAAC,CAAC;AACN,CAAC;AAAC"}
package/types.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { AcoContext } from "@webiny/api-aco/types";
2
- import { FileManagerContext, File } from "@webiny/api-file-manager/types";
3
- import { Context as BaseContext } from "@webiny/handler/types";
4
- export declare type FmFileRecordData = Pick<File, "id" | "key" | "size" | "type" | "name" | "meta" | "createdOn" | "createdBy" | "aliases">;
5
- export interface FmAcoContext extends BaseContext, AcoContext, FileManagerContext {
6
- }
package/types.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
package/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { AcoContext } from \"@webiny/api-aco/types\";\nimport { FileManagerContext, File } from \"@webiny/api-file-manager/types\";\nimport { Context as BaseContext } from \"@webiny/handler/types\";\n\nexport type FmFileRecordData = Pick<\n File,\n \"id\" | \"key\" | \"size\" | \"type\" | \"name\" | \"meta\" | \"createdOn\" | \"createdBy\" | \"aliases\"\n>;\n\nexport interface FmAcoContext extends BaseContext, AcoContext, FileManagerContext {}\n"],"mappings":""}
@@ -1,6 +0,0 @@
1
- import { CreateSearchRecordParams, UpdateSearchRecordParams } from "@webiny/api-aco/record/record.types";
2
- import { File } from "@webiny/api-file-manager/types";
3
- import { FmFileRecordData } from "../types";
4
- export declare const addMimeTag: (tags: string[], mime: string) => string[];
5
- export declare const createFileRecordPayload: (file: File, requestMeta?: Record<string, any>) => CreateSearchRecordParams<FmFileRecordData>;
6
- export declare const updatePageRecordPayload: (file: File) => Promise<UpdateSearchRecordParams<FmFileRecordData>>;
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.updatePageRecordPayload = exports.createFileRecordPayload = exports.addMimeTag = void 0;
7
- var _contants = require("../contants");
8
- const addMimeTag = (tags, mime) => [...tags, `mime:${mime}`];
9
- exports.addMimeTag = addMimeTag;
10
- const createFileRecordPayload = (file, requestMeta) => {
11
- var _requestMeta$location;
12
- const {
13
- id,
14
- key,
15
- size,
16
- type,
17
- name,
18
- meta,
19
- createdOn,
20
- createdBy,
21
- tags,
22
- aliases
23
- } = file;
24
- const location = {
25
- folderId: (requestMeta === null || requestMeta === void 0 ? void 0 : (_requestMeta$location = requestMeta.location) === null || _requestMeta$location === void 0 ? void 0 : _requestMeta$location.folderId) || _contants.ROOT_FOLDER
26
- };
27
- return {
28
- id,
29
- type: _contants.FM_FILE_TYPE,
30
- title: name,
31
- location,
32
- tags: addMimeTag(tags, type),
33
- data: {
34
- id,
35
- key,
36
- size,
37
- type,
38
- name,
39
- createdOn,
40
- createdBy,
41
- aliases,
42
- meta
43
- }
44
- };
45
- };
46
- exports.createFileRecordPayload = createFileRecordPayload;
47
- const updatePageRecordPayload = async file => {
48
- const {
49
- id,
50
- key,
51
- size,
52
- type,
53
- name,
54
- meta,
55
- createdOn,
56
- createdBy,
57
- tags,
58
- aliases
59
- } = file;
60
- return {
61
- title: name,
62
- tags: addMimeTag(tags, type),
63
- data: {
64
- id,
65
- key,
66
- size,
67
- type,
68
- name,
69
- createdOn,
70
- createdBy,
71
- aliases,
72
- meta
73
- }
74
- };
75
- };
76
- exports.updatePageRecordPayload = updatePageRecordPayload;
@@ -1 +0,0 @@
1
- {"version":3,"names":["addMimeTag","tags","mime","createFileRecordPayload","file","requestMeta","id","key","size","type","name","meta","createdOn","createdBy","aliases","location","folderId","ROOT_FOLDER","FM_FILE_TYPE","title","data","updatePageRecordPayload"],"sources":["createRecordPayload.ts"],"sourcesContent":["import { FM_FILE_TYPE, ROOT_FOLDER } from \"~/contants\";\n\nimport {\n CreateSearchRecordParams,\n UpdateSearchRecordParams\n} from \"@webiny/api-aco/record/record.types\";\nimport { File } from \"@webiny/api-file-manager/types\";\nimport { FmFileRecordData } from \"~/types\";\n\nexport const addMimeTag = (tags: string[], mime: string): string[] => [...tags, `mime:${mime}`];\n\nexport const createFileRecordPayload = (\n file: File,\n requestMeta?: Record<string, any>\n): CreateSearchRecordParams<FmFileRecordData> => {\n const { id, key, size, type, name, meta, createdOn, createdBy, tags, aliases } = file;\n const location = {\n folderId: requestMeta?.location?.folderId || ROOT_FOLDER\n };\n\n return {\n id,\n type: FM_FILE_TYPE,\n title: name,\n location,\n tags: addMimeTag(tags, type),\n data: {\n id,\n key,\n size,\n type,\n name,\n createdOn,\n createdBy,\n aliases,\n meta\n }\n };\n};\n\nexport const updatePageRecordPayload = async (\n file: File\n): Promise<UpdateSearchRecordParams<FmFileRecordData>> => {\n const { id, key, size, type, name, meta, createdOn, createdBy, tags, aliases } = file;\n\n return {\n title: name,\n tags: addMimeTag(tags, type),\n data: {\n id,\n key,\n size,\n type,\n name,\n createdOn,\n createdBy,\n aliases,\n meta\n }\n };\n};\n"],"mappings":";;;;;;AAAA;AASO,MAAMA,UAAU,GAAG,CAACC,IAAc,EAAEC,IAAY,KAAe,CAAC,GAAGD,IAAI,EAAG,QAAOC,IAAK,EAAC,CAAC;AAAC;AAEzF,MAAMC,uBAAuB,GAAG,CACnCC,IAAU,EACVC,WAAiC,KACY;EAAA;EAC7C,MAAM;IAAEC,EAAE;IAAEC,GAAG;IAAEC,IAAI;IAAEC,IAAI;IAAEC,IAAI;IAAEC,IAAI;IAAEC,SAAS;IAAEC,SAAS;IAAEZ,IAAI;IAAEa;EAAQ,CAAC,GAAGV,IAAI;EACrF,MAAMW,QAAQ,GAAG;IACbC,QAAQ,EAAE,CAAAX,WAAW,aAAXA,WAAW,gDAAXA,WAAW,CAAEU,QAAQ,0DAArB,sBAAuBC,QAAQ,KAAIC;EACjD,CAAC;EAED,OAAO;IACHX,EAAE;IACFG,IAAI,EAAES,sBAAY;IAClBC,KAAK,EAAET,IAAI;IACXK,QAAQ;IACRd,IAAI,EAAED,UAAU,CAACC,IAAI,EAAEQ,IAAI,CAAC;IAC5BW,IAAI,EAAE;MACFd,EAAE;MACFC,GAAG;MACHC,IAAI;MACJC,IAAI;MACJC,IAAI;MACJE,SAAS;MACTC,SAAS;MACTC,OAAO;MACPH;IACJ;EACJ,CAAC;AACL,CAAC;AAAC;AAEK,MAAMU,uBAAuB,GAAG,MACnCjB,IAAU,IAC4C;EACtD,MAAM;IAAEE,EAAE;IAAEC,GAAG;IAAEC,IAAI;IAAEC,IAAI;IAAEC,IAAI;IAAEC,IAAI;IAAEC,SAAS;IAAEC,SAAS;IAAEZ,IAAI;IAAEa;EAAQ,CAAC,GAAGV,IAAI;EAErF,OAAO;IACHe,KAAK,EAAET,IAAI;IACXT,IAAI,EAAED,UAAU,CAACC,IAAI,EAAEQ,IAAI,CAAC;IAC5BW,IAAI,EAAE;MACFd,EAAE;MACFC,GAAG;MACHC,IAAI;MACJC,IAAI;MACJC,IAAI;MACJE,SAAS;MACTC,SAAS;MACTC,OAAO;MACPH;IACJ;EACJ,CAAC;AACL,CAAC;AAAC"}