@webiny/api-file-manager-aco 0.0.0-unstable.606fc9c866 → 0.0.0-unstable.aa00eecd97
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/file/hooks/onFileAfterBatchCreate.hook.js +4 -0
- package/file/hooks/onFileAfterBatchCreate.hook.js.map +1 -1
- package/file/hooks/onFileAfterCreate.hook.js +4 -0
- package/file/hooks/onFileAfterCreate.hook.js.map +1 -1
- package/file/hooks/onFileAfterUpdate.hook.js +1 -1
- package/file/hooks/onFileAfterUpdate.hook.js.map +1 -1
- package/package.json +29 -28
|
@@ -20,6 +20,10 @@ const onFileAfterBatchCreateHook = ({
|
|
|
20
20
|
}) => {
|
|
21
21
|
try {
|
|
22
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
|
+
}
|
|
23
27
|
const payload = (0, _createRecordPayload.createFileRecordPayload)(file, meta);
|
|
24
28
|
await aco.search.create(payload);
|
|
25
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["onFileAfterBatchCreateHook","fileManager","aco","onFileAfterBatchCreate","subscribe","files","meta","file","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 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,
|
|
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"}
|
|
@@ -19,6 +19,10 @@ const onFileAfterCreateHook = ({
|
|
|
19
19
|
meta
|
|
20
20
|
}) => {
|
|
21
21
|
try {
|
|
22
|
+
if (file.meta.private) {
|
|
23
|
+
// Skipping ACO search record creation while file is marked as private
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
22
26
|
const payload = (0, _createRecordPayload.createFileRecordPayload)(file, meta);
|
|
23
27
|
await aco.search.create(payload);
|
|
24
28
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["onFileAfterCreateHook","fileManager","aco","onFileAfterCreate","subscribe","file","meta","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 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,MAAMC,OAAO,GAAG,IAAAC,4CAAuB,
|
|
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"}
|
|
@@ -12,7 +12,7 @@ const onFileAfterUpdateHook = ({
|
|
|
12
12
|
fileManager
|
|
13
13
|
}) => {
|
|
14
14
|
/**
|
|
15
|
-
* Intercept
|
|
15
|
+
* Intercept file update event and update the related search record.
|
|
16
16
|
*/
|
|
17
17
|
fileManager.onFileAfterUpdate.subscribe(async ({
|
|
18
18
|
file
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-file-manager-aco",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.aa00eecd97",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-file-manager-aco:base"
|
|
@@ -22,34 +22,35 @@
|
|
|
22
22
|
"directory": "dist"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/cli": "
|
|
26
|
-
"@babel/core": "
|
|
27
|
-
"@babel/preset-env": "
|
|
28
|
-
"@babel/preset-typescript": "
|
|
29
|
-
"@babel/runtime": "
|
|
30
|
-
"@webiny/api-file-manager-ddb": "
|
|
31
|
-
"@webiny/api-headless-cms": "
|
|
32
|
-
"@webiny/api-headless-cms-ddb": "
|
|
33
|
-
"@webiny/api-i18n": "
|
|
34
|
-
"@webiny/api-i18n-ddb": "
|
|
35
|
-
"@webiny/api-security": "
|
|
36
|
-
"@webiny/api-security-so-ddb": "
|
|
37
|
-
"@webiny/api-tenancy": "
|
|
38
|
-
"@webiny/api-tenancy-so-ddb": "
|
|
39
|
-
"@webiny/cli": "
|
|
40
|
-
"@webiny/handler-aws": "
|
|
41
|
-
"@webiny/handler-graphql": "
|
|
42
|
-
"@webiny/plugins": "
|
|
43
|
-
"@webiny/project-utils": "
|
|
44
|
-
"
|
|
45
|
-
"
|
|
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": "0.0.0-unstable.aa00eecd97",
|
|
31
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.aa00eecd97",
|
|
32
|
+
"@webiny/api-headless-cms-ddb": "0.0.0-unstable.aa00eecd97",
|
|
33
|
+
"@webiny/api-i18n": "0.0.0-unstable.aa00eecd97",
|
|
34
|
+
"@webiny/api-i18n-ddb": "0.0.0-unstable.aa00eecd97",
|
|
35
|
+
"@webiny/api-security": "0.0.0-unstable.aa00eecd97",
|
|
36
|
+
"@webiny/api-security-so-ddb": "0.0.0-unstable.aa00eecd97",
|
|
37
|
+
"@webiny/api-tenancy": "0.0.0-unstable.aa00eecd97",
|
|
38
|
+
"@webiny/api-tenancy-so-ddb": "0.0.0-unstable.aa00eecd97",
|
|
39
|
+
"@webiny/cli": "0.0.0-unstable.aa00eecd97",
|
|
40
|
+
"@webiny/handler-aws": "0.0.0-unstable.aa00eecd97",
|
|
41
|
+
"@webiny/handler-graphql": "0.0.0-unstable.aa00eecd97",
|
|
42
|
+
"@webiny/plugins": "0.0.0-unstable.aa00eecd97",
|
|
43
|
+
"@webiny/project-utils": "0.0.0-unstable.aa00eecd97",
|
|
44
|
+
"mdbid": "1.0.0",
|
|
45
|
+
"ttypescript": "1.5.15",
|
|
46
|
+
"typescript": "4.7.4"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"@webiny/api": "0.0.0-unstable.
|
|
49
|
-
"@webiny/api-aco": "0.0.0-unstable.
|
|
50
|
-
"@webiny/api-file-manager": "0.0.0-unstable.
|
|
51
|
-
"@webiny/error": "0.0.0-unstable.
|
|
52
|
-
"@webiny/handler": "0.0.0-unstable.
|
|
49
|
+
"@webiny/api": "0.0.0-unstable.aa00eecd97",
|
|
50
|
+
"@webiny/api-aco": "0.0.0-unstable.aa00eecd97",
|
|
51
|
+
"@webiny/api-file-manager": "0.0.0-unstable.aa00eecd97",
|
|
52
|
+
"@webiny/error": "0.0.0-unstable.aa00eecd97",
|
|
53
|
+
"@webiny/handler": "0.0.0-unstable.aa00eecd97"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "aa00eecd97d16da9bdb0581f33d491487ce43ce9"
|
|
55
56
|
}
|