@webiny/api-file-manager-s3 6.6.0-alpha.10 → 6.6.0-alpha.11
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/features/DeleteFileFromBucket/DeleteFileFromBucketHandler.d.ts +3 -1
- package/features/DeleteFileFromBucket/DeleteFileFromBucketHandler.js +13 -4
- package/features/DeleteFileFromBucket/DeleteFileFromBucketHandler.js.map +1 -1
- package/features/ExtractMetadata/ExtractMetadataHandler.d.ts +3 -1
- package/features/ExtractMetadata/ExtractMetadataHandler.js +10 -3
- package/features/ExtractMetadata/ExtractMetadataHandler.js.map +1 -1
- package/features/FlushCache/FlushCacheOnFileDeleteHandler.d.ts +3 -3
- package/features/FlushCache/FlushCacheOnFileDeleteHandler.js +8 -10
- package/features/FlushCache/FlushCacheOnFileDeleteHandler.js.map +1 -1
- package/features/FlushCache/FlushCacheOnFileUpdateHandler.d.ts +3 -3
- package/features/FlushCache/FlushCacheOnFileUpdateHandler.js +8 -10
- package/features/FlushCache/FlushCacheOnFileUpdateHandler.js.map +1 -1
- package/features/FlushCache/feature.js +0 -2
- package/features/FlushCache/feature.js.map +1 -1
- package/package.json +16 -16
- package/features/FlushCache/InvalidateCacheTask.d.ts +0 -31
- package/features/FlushCache/InvalidateCacheTask.js +0 -84
- package/features/FlushCache/InvalidateCacheTask.js.map +0 -1
|
@@ -2,11 +2,13 @@ import { FileAfterDeleteEventHandler } from "@webiny/api-file-manager/features/f
|
|
|
2
2
|
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
3
3
|
import { GlobalKeyValueStore } from "@webiny/api-core/features/keyValueStore/index.js";
|
|
4
4
|
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
5
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
5
6
|
declare class DeleteFileFromBucketHandlerImpl implements FileAfterDeleteEventHandler.Interface {
|
|
6
7
|
private tenantContext;
|
|
7
8
|
private taskService;
|
|
8
9
|
private keyValueStore;
|
|
9
|
-
|
|
10
|
+
private logger;
|
|
11
|
+
constructor(tenantContext: TenantContext.Interface, taskService: TaskService.Interface, keyValueStore: GlobalKeyValueStore.Interface, logger: Logger.Interface);
|
|
10
12
|
handle(event: FileAfterDeleteEventHandler.Event): Promise<void>;
|
|
11
13
|
}
|
|
12
14
|
export declare const DeleteFileFromBucketHandler: typeof DeleteFileFromBucketHandlerImpl & {
|
|
@@ -2,23 +2,31 @@ import { FileAfterDeleteEventHandler } from "@webiny/api-file-manager/features/f
|
|
|
2
2
|
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
3
3
|
import { GlobalKeyValueStore } from "@webiny/api-core/features/keyValueStore/index.js";
|
|
4
4
|
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
5
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
5
6
|
class DeleteFileFromBucketHandlerImpl {
|
|
6
|
-
constructor(tenantContext, taskService, keyValueStore){
|
|
7
|
+
constructor(tenantContext, taskService, keyValueStore, logger){
|
|
7
8
|
this.tenantContext = tenantContext;
|
|
8
9
|
this.taskService = taskService;
|
|
9
10
|
this.keyValueStore = keyValueStore;
|
|
11
|
+
this.logger = logger;
|
|
10
12
|
}
|
|
11
13
|
async handle(event) {
|
|
12
14
|
const { file } = event.payload;
|
|
13
15
|
const tenant = this.tenantContext.getTenant();
|
|
14
|
-
|
|
16
|
+
const folderKey = `tenants/${tenant.id}/files/${file.id}`;
|
|
17
|
+
const result = await this.taskService.trigger({
|
|
15
18
|
definition: "fileManagerFolderDelete",
|
|
16
19
|
input: {
|
|
17
20
|
caller: "fm-after-delete",
|
|
18
21
|
bucket: String(process.env.S3_BUCKET),
|
|
19
|
-
folderKey
|
|
22
|
+
folderKey
|
|
20
23
|
}
|
|
21
24
|
});
|
|
25
|
+
if (result.isFail()) this.logger.error({
|
|
26
|
+
error: result.error,
|
|
27
|
+
fileId: file.id,
|
|
28
|
+
folderKey
|
|
29
|
+
}, "Could not start deleting the file's folder from the bucket.");
|
|
22
30
|
await this.keyValueStore.delete(`FileManager/File/${file.id}/Metadata`);
|
|
23
31
|
}
|
|
24
32
|
}
|
|
@@ -27,7 +35,8 @@ const DeleteFileFromBucketHandler = FileAfterDeleteEventHandler.createImplementa
|
|
|
27
35
|
dependencies: [
|
|
28
36
|
TenantContext,
|
|
29
37
|
TaskService,
|
|
30
|
-
GlobalKeyValueStore
|
|
38
|
+
GlobalKeyValueStore,
|
|
39
|
+
Logger
|
|
31
40
|
]
|
|
32
41
|
});
|
|
33
42
|
export { DeleteFileFromBucketHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/DeleteFileFromBucket/DeleteFileFromBucketHandler.js","sources":["../../../src/features/DeleteFileFromBucket/DeleteFileFromBucketHandler.ts"],"sourcesContent":["import { FileAfterDeleteEventHandler } from \"@webiny/api-file-manager/features/file/DeleteFile/events.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { GlobalKeyValueStore } from \"@webiny/api-core/features/keyValueStore/index.js\";\nimport type { DeleteS3FolderInput } from \"~/features/DeleteFileFromBucket/DeleteS3FolderTask.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\n\nclass DeleteFileFromBucketHandlerImpl implements FileAfterDeleteEventHandler.Interface {\n constructor(\n private tenantContext: TenantContext.Interface,\n private taskService: TaskService.Interface,\n private keyValueStore: GlobalKeyValueStore.Interface\n ) {}\n\n async handle(event: FileAfterDeleteEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n const tenant = this.tenantContext.getTenant();\n\n // Delete S3 folder recursively\n await this.taskService.trigger<DeleteS3FolderInput>({\n definition: \"fileManagerFolderDelete\",\n input: {\n caller: \"fm-after-delete\",\n bucket: String(process.env.S3_BUCKET),\n folderKey
|
|
1
|
+
{"version":3,"file":"features/DeleteFileFromBucket/DeleteFileFromBucketHandler.js","sources":["../../../src/features/DeleteFileFromBucket/DeleteFileFromBucketHandler.ts"],"sourcesContent":["import { FileAfterDeleteEventHandler } from \"@webiny/api-file-manager/features/file/DeleteFile/events.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { GlobalKeyValueStore } from \"@webiny/api-core/features/keyValueStore/index.js\";\nimport type { DeleteS3FolderInput } from \"~/features/DeleteFileFromBucket/DeleteS3FolderTask.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\n\nclass DeleteFileFromBucketHandlerImpl implements FileAfterDeleteEventHandler.Interface {\n constructor(\n private tenantContext: TenantContext.Interface,\n private taskService: TaskService.Interface,\n private keyValueStore: GlobalKeyValueStore.Interface,\n private logger: Logger.Interface\n ) {}\n\n async handle(event: FileAfterDeleteEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n const tenant = this.tenantContext.getTenant();\n\n // Delete S3 folder recursively. The file record is already gone, so a task that can't start\n // is logged and doesn't fail the delete.\n const folderKey = `tenants/${tenant.id}/files/${file.id}`;\n const result = await this.taskService.trigger<DeleteS3FolderInput>({\n definition: \"fileManagerFolderDelete\",\n input: {\n caller: \"fm-after-delete\",\n bucket: String(process.env.S3_BUCKET),\n folderKey\n }\n });\n if (result.isFail()) {\n this.logger.error(\n { error: result.error, fileId: file.id, folderKey },\n \"Could not start deleting the file's folder from the bucket.\"\n );\n }\n\n // Delete file metadata\n await this.keyValueStore.delete(`FileManager/File/${file.id}/Metadata`);\n }\n}\n\nexport const DeleteFileFromBucketHandler = FileAfterDeleteEventHandler.createImplementation({\n implementation: DeleteFileFromBucketHandlerImpl,\n dependencies: [TenantContext, TaskService, GlobalKeyValueStore, Logger]\n});\n"],"names":["DeleteFileFromBucketHandlerImpl","tenantContext","taskService","keyValueStore","logger","event","file","tenant","folderKey","result","String","process","DeleteFileFromBucketHandler","FileAfterDeleteEventHandler","TenantContext","TaskService","GlobalKeyValueStore","Logger"],"mappings":";;;;;AAOA,MAAMA;IACF,YACYC,aAAsC,EACtCC,WAAkC,EAClCC,aAA4C,EAC5CC,MAAwB,CAClC;aAJUH,aAAa,GAAbA;aACAC,WAAW,GAAXA;aACAC,aAAa,GAAbA;aACAC,MAAM,GAANA;IACT;IAEH,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;QAC9B,MAAME,SAAS,IAAI,CAAC,aAAa,CAAC,SAAS;QAI3C,MAAMC,YAAY,CAAC,QAAQ,EAAED,OAAO,EAAE,CAAC,OAAO,EAAED,KAAK,EAAE,EAAE;QACzD,MAAMG,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAsB;YAC/D,YAAY;YACZ,OAAO;gBACH,QAAQ;gBACR,QAAQC,OAAOC,QAAQ,GAAG,CAAC,SAAS;gBACpCH;YACJ;QACJ;QACA,IAAIC,OAAO,MAAM,IACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACb;YAAE,OAAOA,OAAO,KAAK;YAAE,QAAQH,KAAK,EAAE;YAAEE;QAAU,GAClD;QAKR,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAEF,KAAK,EAAE,CAAC,SAAS,CAAC;IAC1E;AACJ;AAEO,MAAMM,8BAA8BC,4BAA4B,oBAAoB,CAAC;IACxF,gBAAgBb;IAChB,cAAc;QAACc;QAAeC;QAAaC;QAAqBC;KAAO;AAC3E"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { FileAfterCreateEventHandler } from "@webiny/api-file-manager/features/file/CreateFile/events.js";
|
|
2
2
|
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
3
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
3
4
|
declare class ExtractMetadataHandlerImpl implements FileAfterCreateEventHandler.Interface {
|
|
4
5
|
private taskService;
|
|
5
|
-
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(taskService: TaskService.Interface, logger: Logger.Interface);
|
|
6
8
|
handle(event: FileAfterCreateEventHandler.Event): Promise<void>;
|
|
7
9
|
}
|
|
8
10
|
export declare const ExtractMetadataHandler: typeof ExtractMetadataHandlerImpl & {
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import { FileAfterCreateEventHandler } from "@webiny/api-file-manager/features/file/CreateFile/events.js";
|
|
2
2
|
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
3
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
3
4
|
class ExtractMetadataHandlerImpl {
|
|
4
|
-
constructor(taskService){
|
|
5
|
+
constructor(taskService, logger){
|
|
5
6
|
this.taskService = taskService;
|
|
7
|
+
this.logger = logger;
|
|
6
8
|
}
|
|
7
9
|
async handle(event) {
|
|
8
10
|
const { file } = event.payload;
|
|
9
|
-
await this.taskService.trigger({
|
|
11
|
+
const result = await this.taskService.trigger({
|
|
10
12
|
definition: "fileManagerExtractMetadata",
|
|
11
13
|
input: {
|
|
12
14
|
fileId: file.id
|
|
13
15
|
}
|
|
14
16
|
});
|
|
17
|
+
if (result.isFail()) this.logger.error({
|
|
18
|
+
error: result.error,
|
|
19
|
+
fileId: file.id
|
|
20
|
+
}, "Could not start the metadata extraction.");
|
|
15
21
|
}
|
|
16
22
|
}
|
|
17
23
|
const ExtractMetadataHandler = FileAfterCreateEventHandler.createImplementation({
|
|
18
24
|
implementation: ExtractMetadataHandlerImpl,
|
|
19
25
|
dependencies: [
|
|
20
|
-
TaskService
|
|
26
|
+
TaskService,
|
|
27
|
+
Logger
|
|
21
28
|
]
|
|
22
29
|
});
|
|
23
30
|
export { ExtractMetadataHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/ExtractMetadata/ExtractMetadataHandler.js","sources":["../../../src/features/ExtractMetadata/ExtractMetadataHandler.ts"],"sourcesContent":["import { FileAfterCreateEventHandler } from \"@webiny/api-file-manager/features/file/CreateFile/events.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport type { ExtractMetadataInput } from \"./ExtractMetadataTask.js\";\n\nclass ExtractMetadataHandlerImpl implements FileAfterCreateEventHandler.Interface {\n constructor(private taskService: TaskService.Interface) {}\n\n async handle(event: FileAfterCreateEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n\n //
|
|
1
|
+
{"version":3,"file":"features/ExtractMetadata/ExtractMetadataHandler.js","sources":["../../../src/features/ExtractMetadata/ExtractMetadataHandler.ts"],"sourcesContent":["import { FileAfterCreateEventHandler } from \"@webiny/api-file-manager/features/file/CreateFile/events.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport type { ExtractMetadataInput } from \"./ExtractMetadataTask.js\";\n\nclass ExtractMetadataHandlerImpl implements FileAfterCreateEventHandler.Interface {\n constructor(\n private taskService: TaskService.Interface,\n private logger: Logger.Interface\n ) {}\n\n async handle(event: FileAfterCreateEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n\n // The file is already stored, so a task that can't start is logged and doesn't fail the upload.\n const result = await this.taskService.trigger<ExtractMetadataInput>({\n definition: \"fileManagerExtractMetadata\",\n input: {\n fileId: file.id\n }\n });\n if (result.isFail()) {\n this.logger.error(\n { error: result.error, fileId: file.id },\n \"Could not start the metadata extraction.\"\n );\n }\n }\n}\n\nexport const ExtractMetadataHandler = FileAfterCreateEventHandler.createImplementation({\n implementation: ExtractMetadataHandlerImpl,\n dependencies: [TaskService, Logger]\n});\n"],"names":["ExtractMetadataHandlerImpl","taskService","logger","event","file","result","ExtractMetadataHandler","FileAfterCreateEventHandler","TaskService","Logger"],"mappings":";;;AAKA,MAAMA;IACF,YACYC,WAAkC,EAClCC,MAAwB,CAClC;aAFUD,WAAW,GAAXA;aACAC,MAAM,GAANA;IACT;IAEH,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;QAG9B,MAAME,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAuB;YAChE,YAAY;YACZ,OAAO;gBACH,QAAQD,KAAK,EAAE;YACnB;QACJ;QACA,IAAIC,OAAO,MAAM,IACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACb;YAAE,OAAOA,OAAO,KAAK;YAAE,QAAQD,KAAK,EAAE;QAAC,GACvC;IAGZ;AACJ;AAEO,MAAME,yBAAyBC,4BAA4B,oBAAoB,CAAC;IACnF,gBAAgBP;IAChB,cAAc;QAACQ;QAAaC;KAAO;AACvC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FileAfterDeleteEventHandler } from "@webiny/api-file-manager/features/file/DeleteFile/events.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CdnCache } from "@webiny/api-core/features/cdnCache/index.js";
|
|
3
3
|
declare class FlushCacheOnFileDeleteHandlerImpl implements FileAfterDeleteEventHandler.Interface {
|
|
4
|
-
private
|
|
4
|
+
private cdnCache;
|
|
5
5
|
private readonly pathsGenerator;
|
|
6
|
-
constructor(
|
|
6
|
+
constructor(cdnCache: CdnCache.Interface);
|
|
7
7
|
handle(event: FileAfterDeleteEventHandler.Event): Promise<void>;
|
|
8
8
|
}
|
|
9
9
|
export declare const FlushCacheOnFileDeleteHandler: typeof FlushCacheOnFileDeleteHandlerImpl & {
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { FileAfterDeleteEventHandler } from "@webiny/api-file-manager/features/file/DeleteFile/events.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CdnCache } from "@webiny/api-core/features/cdnCache/index.js";
|
|
3
3
|
import { CdnPathsGenerator } from "../../utils/CdnPathsGenerator.js";
|
|
4
4
|
class FlushCacheOnFileDeleteHandlerImpl {
|
|
5
|
-
constructor(
|
|
6
|
-
this.
|
|
5
|
+
constructor(cdnCache){
|
|
6
|
+
this.cdnCache = cdnCache;
|
|
7
7
|
this.pathsGenerator = new CdnPathsGenerator();
|
|
8
8
|
}
|
|
9
9
|
async handle(event) {
|
|
10
10
|
const { file } = event.payload;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
paths: this.pathsGenerator.generate(file.id)
|
|
16
|
-
}
|
|
11
|
+
const paths = this.pathsGenerator.generate(file.id);
|
|
12
|
+
await this.cdnCache.invalidate({
|
|
13
|
+
caller: "fm-before-delete",
|
|
14
|
+
paths
|
|
17
15
|
});
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
18
|
const FlushCacheOnFileDeleteHandler = FileAfterDeleteEventHandler.createImplementation({
|
|
21
19
|
implementation: FlushCacheOnFileDeleteHandlerImpl,
|
|
22
20
|
dependencies: [
|
|
23
|
-
|
|
21
|
+
CdnCache
|
|
24
22
|
]
|
|
25
23
|
});
|
|
26
24
|
export { FlushCacheOnFileDeleteHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/FlushCache/FlushCacheOnFileDeleteHandler.js","sources":["../../../src/features/FlushCache/FlushCacheOnFileDeleteHandler.ts"],"sourcesContent":["import { FileAfterDeleteEventHandler } from \"@webiny/api-file-manager/features/file/DeleteFile/events.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"features/FlushCache/FlushCacheOnFileDeleteHandler.js","sources":["../../../src/features/FlushCache/FlushCacheOnFileDeleteHandler.ts"],"sourcesContent":["import { FileAfterDeleteEventHandler } from \"@webiny/api-file-manager/features/file/DeleteFile/events.js\";\nimport { CdnCache } from \"@webiny/api-core/features/cdnCache/index.js\";\nimport { CdnPathsGenerator } from \"~/utils/CdnPathsGenerator.js\";\n\nclass FlushCacheOnFileDeleteHandlerImpl implements FileAfterDeleteEventHandler.Interface {\n private readonly pathsGenerator: CdnPathsGenerator;\n\n constructor(private cdnCache: CdnCache.Interface) {\n this.pathsGenerator = new CdnPathsGenerator();\n }\n\n async handle(event: FileAfterDeleteEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n const paths = this.pathsGenerator.generate(file.id);\n\n await this.cdnCache.invalidate({ caller: \"fm-before-delete\", paths });\n }\n}\n\nexport const FlushCacheOnFileDeleteHandler = FileAfterDeleteEventHandler.createImplementation({\n implementation: FlushCacheOnFileDeleteHandlerImpl,\n dependencies: [CdnCache]\n});\n"],"names":["FlushCacheOnFileDeleteHandlerImpl","cdnCache","CdnPathsGenerator","event","file","paths","FlushCacheOnFileDeleteHandler","FileAfterDeleteEventHandler","CdnCache"],"mappings":";;;AAIA,MAAMA;IAGF,YAAoBC,QAA4B,CAAE;aAA9BA,QAAQ,GAARA;QAChB,IAAI,CAAC,cAAc,GAAG,IAAIC;IAC9B;IAEA,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;QAC9B,MAAME,QAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAACD,KAAK,EAAE;QAElD,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;YAAE,QAAQ;YAAoBC;QAAM;IACvE;AACJ;AAEO,MAAMC,gCAAgCC,4BAA4B,oBAAoB,CAAC;IAC1F,gBAAgBP;IAChB,cAAc;QAACQ;KAAS;AAC5B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FileBeforeUpdateEventHandler } from "@webiny/api-file-manager/features/file/UpdateFile/events.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CdnCache } from "@webiny/api-core/features/cdnCache/index.js";
|
|
3
3
|
declare class FlushCacheOnFileUpdateHandlerImpl implements FileBeforeUpdateEventHandler.Interface {
|
|
4
|
-
private
|
|
4
|
+
private cdnCache;
|
|
5
5
|
private readonly pathsGenerator;
|
|
6
|
-
constructor(
|
|
6
|
+
constructor(cdnCache: CdnCache.Interface);
|
|
7
7
|
handle(event: FileBeforeUpdateEventHandler.Event): Promise<void>;
|
|
8
8
|
}
|
|
9
9
|
export declare const FlushCacheOnFileUpdateHandler: typeof FlushCacheOnFileUpdateHandlerImpl & {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FileBeforeUpdateEventHandler } from "@webiny/api-file-manager/features/file/UpdateFile/events.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CdnCache } from "@webiny/api-core/features/cdnCache/index.js";
|
|
3
3
|
import { CdnPathsGenerator } from "../../utils/CdnPathsGenerator.js";
|
|
4
4
|
class FlushCacheOnFileUpdateHandlerImpl {
|
|
5
|
-
constructor(
|
|
6
|
-
this.
|
|
5
|
+
constructor(cdnCache){
|
|
6
|
+
this.cdnCache = cdnCache;
|
|
7
7
|
this.pathsGenerator = new CdnPathsGenerator();
|
|
8
8
|
}
|
|
9
9
|
async handle(event) {
|
|
@@ -11,19 +11,17 @@ class FlushCacheOnFileUpdateHandlerImpl {
|
|
|
11
11
|
const prevAccessControl = original.accessControl;
|
|
12
12
|
const newAccessControl = file.accessControl;
|
|
13
13
|
if (prevAccessControl?.type === newAccessControl?.type) return;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
paths: this.pathsGenerator.generate(file.id)
|
|
19
|
-
}
|
|
14
|
+
const paths = this.pathsGenerator.generate(file.id);
|
|
15
|
+
await this.cdnCache.invalidate({
|
|
16
|
+
caller: "fm-before-update",
|
|
17
|
+
paths
|
|
20
18
|
});
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
const FlushCacheOnFileUpdateHandler = FileBeforeUpdateEventHandler.createImplementation({
|
|
24
22
|
implementation: FlushCacheOnFileUpdateHandlerImpl,
|
|
25
23
|
dependencies: [
|
|
26
|
-
|
|
24
|
+
CdnCache
|
|
27
25
|
]
|
|
28
26
|
});
|
|
29
27
|
export { FlushCacheOnFileUpdateHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/FlushCache/FlushCacheOnFileUpdateHandler.js","sources":["../../../src/features/FlushCache/FlushCacheOnFileUpdateHandler.ts"],"sourcesContent":["import { FileBeforeUpdateEventHandler } from \"@webiny/api-file-manager/features/file/UpdateFile/events.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"features/FlushCache/FlushCacheOnFileUpdateHandler.js","sources":["../../../src/features/FlushCache/FlushCacheOnFileUpdateHandler.ts"],"sourcesContent":["import { FileBeforeUpdateEventHandler } from \"@webiny/api-file-manager/features/file/UpdateFile/events.js\";\nimport { CdnCache } from \"@webiny/api-core/features/cdnCache/index.js\";\nimport { CdnPathsGenerator } from \"~/utils/CdnPathsGenerator.js\";\n\nclass FlushCacheOnFileUpdateHandlerImpl implements FileBeforeUpdateEventHandler.Interface {\n private readonly pathsGenerator: CdnPathsGenerator;\n\n constructor(private cdnCache: CdnCache.Interface) {\n this.pathsGenerator = new CdnPathsGenerator();\n }\n\n async handle(event: FileBeforeUpdateEventHandler.Event): Promise<void> {\n const { file, original } = event.payload;\n\n const prevAccessControl = original.accessControl;\n const newAccessControl = file.accessControl;\n\n // Only trigger cache flush if access control type has changed\n if (prevAccessControl?.type === newAccessControl?.type) {\n return;\n }\n\n const paths = this.pathsGenerator.generate(file.id);\n\n await this.cdnCache.invalidate({ caller: \"fm-before-update\", paths });\n }\n}\n\nexport const FlushCacheOnFileUpdateHandler = FileBeforeUpdateEventHandler.createImplementation({\n implementation: FlushCacheOnFileUpdateHandlerImpl,\n dependencies: [CdnCache]\n});\n"],"names":["FlushCacheOnFileUpdateHandlerImpl","cdnCache","CdnPathsGenerator","event","file","original","prevAccessControl","newAccessControl","paths","FlushCacheOnFileUpdateHandler","FileBeforeUpdateEventHandler","CdnCache"],"mappings":";;;AAIA,MAAMA;IAGF,YAAoBC,QAA4B,CAAE;aAA9BA,QAAQ,GAARA;QAChB,IAAI,CAAC,cAAc,GAAG,IAAIC;IAC9B;IAEA,MAAM,OAAOC,KAAyC,EAAiB;QACnE,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGF,MAAM,OAAO;QAExC,MAAMG,oBAAoBD,SAAS,aAAa;QAChD,MAAME,mBAAmBH,KAAK,aAAa;QAG3C,IAAIE,mBAAmB,SAASC,kBAAkB,MAC9C;QAGJ,MAAMC,QAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAACJ,KAAK,EAAE;QAElD,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;YAAE,QAAQ;YAAoBI;QAAM;IACvE;AACJ;AAEO,MAAMC,gCAAgCC,6BAA6B,oBAAoB,CAAC;IAC3F,gBAAgBV;IAChB,cAAc;QAACW;KAAS;AAC5B"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
2
|
import { FlushCacheOnFileDeleteHandler } from "./FlushCacheOnFileDeleteHandler.js";
|
|
3
3
|
import { FlushCacheOnFileUpdateHandler } from "./FlushCacheOnFileUpdateHandler.js";
|
|
4
|
-
import { InvalidateCloudfrontCacheTaskDefinition } from "./InvalidateCacheTask.js";
|
|
5
4
|
const FlushCacheFeature = createFeature({
|
|
6
5
|
name: "FileManagerS3/FlushCache",
|
|
7
6
|
register (container) {
|
|
8
7
|
container.register(FlushCacheOnFileDeleteHandler);
|
|
9
8
|
container.register(FlushCacheOnFileUpdateHandler);
|
|
10
|
-
container.register(InvalidateCloudfrontCacheTaskDefinition);
|
|
11
9
|
}
|
|
12
10
|
});
|
|
13
11
|
export { FlushCacheFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/FlushCache/feature.js","sources":["../../../src/features/FlushCache/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { FlushCacheOnFileDeleteHandler } from \"./FlushCacheOnFileDeleteHandler.js\";\nimport { FlushCacheOnFileUpdateHandler } from \"./FlushCacheOnFileUpdateHandler.js\";\
|
|
1
|
+
{"version":3,"file":"features/FlushCache/feature.js","sources":["../../../src/features/FlushCache/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { FlushCacheOnFileDeleteHandler } from \"./FlushCacheOnFileDeleteHandler.js\";\nimport { FlushCacheOnFileUpdateHandler } from \"./FlushCacheOnFileUpdateHandler.js\";\n\nexport const FlushCacheFeature = createFeature({\n name: \"FileManagerS3/FlushCache\",\n register(container) {\n container.register(FlushCacheOnFileDeleteHandler);\n container.register(FlushCacheOnFileUpdateHandler);\n }\n});\n"],"names":["FlushCacheFeature","createFeature","container","FlushCacheOnFileDeleteHandler","FlushCacheOnFileUpdateHandler"],"mappings":";;;AAIO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;IACvB;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-file-manager-s3",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
"author": "Webiny Ltd",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@webiny/api": "6.6.0-alpha.
|
|
18
|
-
"@webiny/api-core": "6.6.0-alpha.
|
|
19
|
-
"@webiny/api-file-manager": "6.6.0-alpha.
|
|
20
|
-
"@webiny/api-graphql": "6.6.0-alpha.
|
|
21
|
-
"@webiny/api-websockets": "6.6.0-alpha.
|
|
22
|
-
"@webiny/aws-sdk": "6.6.0-alpha.
|
|
23
|
-
"@webiny/background-tasks": "6.6.0-alpha.
|
|
17
|
+
"@webiny/api": "6.6.0-alpha.11",
|
|
18
|
+
"@webiny/api-core": "6.6.0-alpha.11",
|
|
19
|
+
"@webiny/api-file-manager": "6.6.0-alpha.11",
|
|
20
|
+
"@webiny/api-graphql": "6.6.0-alpha.11",
|
|
21
|
+
"@webiny/api-websockets": "6.6.0-alpha.11",
|
|
22
|
+
"@webiny/aws-sdk": "6.6.0-alpha.11",
|
|
23
|
+
"@webiny/background-tasks": "6.6.0-alpha.11",
|
|
24
24
|
"@webiny/di": "2.0.0",
|
|
25
|
-
"@webiny/event-handler-aws": "6.6.0-alpha.
|
|
26
|
-
"@webiny/event-handler-core": "6.6.0-alpha.
|
|
27
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
28
|
-
"@webiny/handler": "6.6.0-alpha.
|
|
29
|
-
"@webiny/plugins": "6.6.0-alpha.
|
|
30
|
-
"@webiny/utils": "6.6.0-alpha.
|
|
31
|
-
"@webiny/validation": "6.6.0-alpha.
|
|
25
|
+
"@webiny/event-handler-aws": "6.6.0-alpha.11",
|
|
26
|
+
"@webiny/event-handler-core": "6.6.0-alpha.11",
|
|
27
|
+
"@webiny/feature": "6.6.0-alpha.11",
|
|
28
|
+
"@webiny/handler": "6.6.0-alpha.11",
|
|
29
|
+
"@webiny/plugins": "6.6.0-alpha.11",
|
|
30
|
+
"@webiny/utils": "6.6.0-alpha.11",
|
|
31
|
+
"@webiny/validation": "6.6.0-alpha.11",
|
|
32
32
|
"exifreader": "4.52.0",
|
|
33
33
|
"mime": "4.1.2",
|
|
34
34
|
"object-hash": "3.0.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"sharp": "0.35.5"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
41
|
+
"@webiny/build-tools": "6.6.0-alpha.11",
|
|
42
42
|
"rimraf": "6.1.3",
|
|
43
43
|
"typescript": "7.0.2",
|
|
44
44
|
"vitest": "5.0.5"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
-
export interface InvalidateCacheInput {
|
|
3
|
-
/**
|
|
4
|
-
* Caller of the task (e.g., `fm-before-update`, `fm-after-delete`).
|
|
5
|
-
*/
|
|
6
|
-
caller: string;
|
|
7
|
-
/**
|
|
8
|
-
* Cache paths to invalidate.
|
|
9
|
-
*/
|
|
10
|
-
paths: string[];
|
|
11
|
-
}
|
|
12
|
-
declare class InvalidateCloudfrontCacheTaskHandlerImpl implements TaskHandler.Interface<InvalidateCacheInput> {
|
|
13
|
-
private continueIfCode;
|
|
14
|
-
run({ input, controller }: TaskHandler.RunParams<InvalidateCacheInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultContinue<InvalidateCacheInput> | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
15
|
-
private invalidateCache;
|
|
16
|
-
}
|
|
17
|
-
declare class InvalidateCloudfrontCacheTask implements TaskDefinition.Interface {
|
|
18
|
-
id: string;
|
|
19
|
-
title: string;
|
|
20
|
-
description: string;
|
|
21
|
-
maxIterations: number;
|
|
22
|
-
isPrivate: boolean;
|
|
23
|
-
selfCleanup: ("onAbort" | "onSuccess")[];
|
|
24
|
-
handler: typeof InvalidateCloudfrontCacheTaskHandlerImpl & {
|
|
25
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export declare const InvalidateCloudfrontCacheTaskDefinition: typeof InvalidateCloudfrontCacheTask & {
|
|
29
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
30
|
-
};
|
|
31
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { ServiceDiscovery } from "@webiny/api-core/features/serviceDiscovery/index.js";
|
|
2
|
-
import { CloudFront } from "@webiny/aws-sdk/client-cloudfront/index.js";
|
|
3
|
-
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
4
|
-
import { executeWithRetry } from "@webiny/utils";
|
|
5
|
-
class ReturnContinue extends Error {
|
|
6
|
-
}
|
|
7
|
-
class InvalidateCloudfrontCacheTaskHandlerImpl {
|
|
8
|
-
async run({ input, controller }) {
|
|
9
|
-
if (controller.runtime.isAborted()) return controller.response.aborted();
|
|
10
|
-
const manifest = await ServiceDiscovery.load();
|
|
11
|
-
if (!manifest) return controller.response.error({
|
|
12
|
-
message: "Unable to invalidate cache due to a missing service manifest.",
|
|
13
|
-
code: "MISSING_SERVICE_MANIFEST",
|
|
14
|
-
data: {
|
|
15
|
-
manifest: "api"
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
const { distributionId } = manifest.api.cloudfront;
|
|
19
|
-
const invalidateCache = ()=>this.invalidateCache(input.caller, distributionId, input.paths);
|
|
20
|
-
try {
|
|
21
|
-
await executeWithRetry(invalidateCache, {
|
|
22
|
-
minTimeout: 2000,
|
|
23
|
-
retries: 10000,
|
|
24
|
-
onFailedAttempt: ({ error })=>{
|
|
25
|
-
if (this.continueIfCode.includes(error.name)) throw new ReturnContinue();
|
|
26
|
-
if (error.message.includes("not authorized to perform")) throw error;
|
|
27
|
-
if (controller.runtime.isCloseToTimeout()) throw new ReturnContinue();
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
} catch (error) {
|
|
31
|
-
if (error instanceof ReturnContinue) return controller.response.continue(input);
|
|
32
|
-
return controller.response.error({
|
|
33
|
-
message: error.message,
|
|
34
|
-
code: "EXECUTE_WITH_RETRY_FAILED",
|
|
35
|
-
data: input.paths
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return controller.response.done();
|
|
39
|
-
}
|
|
40
|
-
async invalidateCache(caller, distributionId, paths) {
|
|
41
|
-
const cloudfront = new CloudFront();
|
|
42
|
-
await cloudfront.createInvalidation({
|
|
43
|
-
DistributionId: distributionId,
|
|
44
|
-
InvalidationBatch: {
|
|
45
|
-
CallerReference: `${new Date().getTime()}-${caller}`,
|
|
46
|
-
Paths: {
|
|
47
|
-
Quantity: paths.length,
|
|
48
|
-
Items: paths
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
constructor(){
|
|
54
|
-
this.continueIfCode = [
|
|
55
|
-
"TooManyInvalidationsInProgress",
|
|
56
|
-
"Throttling"
|
|
57
|
-
];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const InvalidateCloudfrontCacheTaskHandler = TaskHandler.createImplementation({
|
|
61
|
-
implementation: InvalidateCloudfrontCacheTaskHandlerImpl,
|
|
62
|
-
dependencies: []
|
|
63
|
-
});
|
|
64
|
-
class InvalidateCloudfrontCacheTask {
|
|
65
|
-
constructor(){
|
|
66
|
-
this.id = "invalidateAssetCache";
|
|
67
|
-
this.title = "Invalidate CloudFront Cache";
|
|
68
|
-
this.description = "A task to invalidate Cloudfront cache by given paths.";
|
|
69
|
-
this.maxIterations = 100;
|
|
70
|
-
this.isPrivate = true;
|
|
71
|
-
this.selfCleanup = [
|
|
72
|
-
"onSuccess",
|
|
73
|
-
"onAbort"
|
|
74
|
-
];
|
|
75
|
-
this.handler = InvalidateCloudfrontCacheTaskHandler;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const InvalidateCloudfrontCacheTaskDefinition = TaskDefinition.createImplementation({
|
|
79
|
-
implementation: InvalidateCloudfrontCacheTask,
|
|
80
|
-
dependencies: []
|
|
81
|
-
});
|
|
82
|
-
export { InvalidateCloudfrontCacheTaskDefinition };
|
|
83
|
-
|
|
84
|
-
//# sourceMappingURL=InvalidateCacheTask.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/FlushCache/InvalidateCacheTask.js","sources":["../../../src/features/FlushCache/InvalidateCacheTask.ts"],"sourcesContent":["import { ServiceDiscovery } from \"@webiny/api-core/features/serviceDiscovery/index.js\";\nimport { CloudFront } from \"@webiny/aws-sdk/client-cloudfront/index.js\";\nimport {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { executeWithRetry } from \"@webiny/utils\";\n\nclass ReturnContinue extends Error {}\n\nexport interface InvalidateCacheInput {\n /**\n * Caller of the task (e.g., `fm-before-update`, `fm-after-delete`).\n */\n caller: string;\n /**\n * Cache paths to invalidate.\n */\n paths: string[];\n}\n\nclass InvalidateCloudfrontCacheTaskHandlerImpl implements TaskHandler.Interface<InvalidateCacheInput> {\n private continueIfCode = [\"TooManyInvalidationsInProgress\", \"Throttling\"];\n\n public async run({ input, controller }: TaskHandler.RunParams<InvalidateCacheInput>) {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n const manifest = await ServiceDiscovery.load();\n\n if (!manifest) {\n return controller.response.error({\n message: `Unable to invalidate cache due to a missing service manifest.`,\n code: \"MISSING_SERVICE_MANIFEST\",\n data: {\n manifest: \"api\"\n }\n });\n }\n\n const { distributionId } = manifest.api.cloudfront;\n\n const invalidateCache = () => {\n return this.invalidateCache(input.caller, distributionId as string, input.paths);\n };\n\n try {\n await executeWithRetry(invalidateCache, {\n minTimeout: 2000,\n // instead of forever: true\n retries: 10000,\n onFailedAttempt: ({ error }) => {\n if (this.continueIfCode.includes(error.name)) {\n throw new ReturnContinue();\n }\n\n if (error.message.includes(\"not authorized to perform\")) {\n throw error;\n }\n\n if (controller.runtime.isCloseToTimeout()) {\n throw new ReturnContinue();\n }\n }\n });\n } catch (error) {\n if (error instanceof ReturnContinue) {\n return controller.response.continue(input);\n }\n\n return controller.response.error({\n message: error.message,\n code: \"EXECUTE_WITH_RETRY_FAILED\",\n data: input.paths\n });\n }\n\n return controller.response.done();\n }\n\n private async invalidateCache(\n caller: string,\n distributionId: string,\n paths: string[]\n ): Promise<void> {\n const cloudfront = new CloudFront();\n await cloudfront.createInvalidation({\n DistributionId: distributionId,\n InvalidationBatch: {\n CallerReference: `${new Date().getTime()}-${caller}`,\n Paths: {\n Quantity: paths.length,\n Items: paths\n }\n }\n });\n }\n}\n\nconst InvalidateCloudfrontCacheTaskHandler = TaskHandler.createImplementation({\n implementation: InvalidateCloudfrontCacheTaskHandlerImpl,\n dependencies: []\n});\n\nclass InvalidateCloudfrontCacheTask implements TaskDefinition.Interface {\n id = \"invalidateAssetCache\";\n title = \"Invalidate CloudFront Cache\";\n description = \"A task to invalidate Cloudfront cache by given paths.\";\n maxIterations = 100;\n isPrivate = true;\n selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n handler = InvalidateCloudfrontCacheTaskHandler;\n}\n\nexport const InvalidateCloudfrontCacheTaskDefinition = TaskDefinition.createImplementation({\n implementation: InvalidateCloudfrontCacheTask,\n dependencies: []\n});\n"],"names":["ReturnContinue","Error","InvalidateCloudfrontCacheTaskHandlerImpl","input","controller","manifest","ServiceDiscovery","distributionId","invalidateCache","executeWithRetry","error","caller","paths","cloudfront","CloudFront","Date","InvalidateCloudfrontCacheTaskHandler","TaskHandler","InvalidateCloudfrontCacheTask","InvalidateCloudfrontCacheTaskDefinition","TaskDefinition"],"mappings":";;;;AAQA,MAAMA,uBAAuBC;AAAO;AAapC,MAAMC;IAGF,MAAa,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAA+C,EAAE;QACjF,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;QAGtC,MAAMC,WAAW,MAAMC,iBAAiB,IAAI;QAE5C,IAAI,CAACD,UACD,OAAOD,WAAW,QAAQ,CAAC,KAAK,CAAC;YAC7B,SAAS;YACT,MAAM;YACN,MAAM;gBACF,UAAU;YACd;QACJ;QAGJ,MAAM,EAAEG,cAAc,EAAE,GAAGF,SAAS,GAAG,CAAC,UAAU;QAElD,MAAMG,kBAAkB,IACb,IAAI,CAAC,eAAe,CAACL,MAAM,MAAM,EAAEI,gBAA0BJ,MAAM,KAAK;QAGnF,IAAI;YACA,MAAMM,iBAAiBD,iBAAiB;gBACpC,YAAY;gBAEZ,SAAS;gBACT,iBAAiB,CAAC,EAAEE,KAAK,EAAE;oBACvB,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,CAACA,MAAM,IAAI,GACvC,MAAM,IAAIV;oBAGd,IAAIU,MAAM,OAAO,CAAC,QAAQ,CAAC,8BACvB,MAAMA;oBAGV,IAAIN,WAAW,OAAO,CAAC,gBAAgB,IACnC,MAAM,IAAIJ;gBAElB;YACJ;QACJ,EAAE,OAAOU,OAAO;YACZ,IAAIA,iBAAiBV,gBACjB,OAAOI,WAAW,QAAQ,CAAC,QAAQ,CAACD;YAGxC,OAAOC,WAAW,QAAQ,CAAC,KAAK,CAAC;gBAC7B,SAASM,MAAM,OAAO;gBACtB,MAAM;gBACN,MAAMP,MAAM,KAAK;YACrB;QACJ;QAEA,OAAOC,WAAW,QAAQ,CAAC,IAAI;IACnC;IAEA,MAAc,gBACVO,MAAc,EACdJ,cAAsB,EACtBK,KAAe,EACF;QACb,MAAMC,aAAa,IAAIC;QACvB,MAAMD,WAAW,kBAAkB,CAAC;YAChC,gBAAgBN;YAChB,mBAAmB;gBACf,iBAAiB,GAAG,IAAIQ,OAAO,OAAO,GAAG,CAAC,EAAEJ,QAAQ;gBACpD,OAAO;oBACH,UAAUC,MAAM,MAAM;oBACtB,OAAOA;gBACX;YACJ;QACJ;IACJ;;aA3EQ,cAAc,GAAG;YAAC;YAAkC;SAAa;;AA4E7E;AAEA,MAAMI,uCAAuCC,YAAY,oBAAoB,CAAC;IAC1E,gBAAgBf;IAChB,cAAc,EAAE;AACpB;AAEA,MAAMgB;;aACF,EAAE,GAAG;aACL,KAAK,GAAG;aACR,WAAW,GAAG;aACd,aAAa,GAAG;aAChB,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;aAExD,OAAO,GAAGF;;AACd;AAEO,MAAMG,0CAA0CC,eAAe,oBAAoB,CAAC;IACvF,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|