@webiny/tasks 5.43.0-beta.1 → 5.43.0-beta.2
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/package.json +17 -17
- package/plugins/TaskServicePlugin.d.ts +1 -2
- package/plugins/TaskServicePlugin.js.map +1 -1
- package/service/EventBridgeEventTransportPlugin.d.ts +0 -2
- package/service/EventBridgeEventTransportPlugin.js +0 -1
- package/service/EventBridgeEventTransportPlugin.js.map +1 -1
- package/service/StepFunctionServicePlugin.d.ts +4 -4
- package/service/StepFunctionServicePlugin.js +2 -1
- package/service/StepFunctionServicePlugin.js.map +1 -1
- package/service/createService.js +0 -1
- package/service/createService.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/tasks",
|
|
3
|
-
"version": "5.43.0-beta.
|
|
3
|
+
"version": "5.43.0-beta.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
],
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@webiny/api": "5.43.0-beta.
|
|
16
|
-
"@webiny/api-headless-cms": "5.43.0-beta.
|
|
17
|
-
"@webiny/aws-sdk": "5.43.0-beta.
|
|
18
|
-
"@webiny/error": "5.43.0-beta.
|
|
19
|
-
"@webiny/handler": "5.43.0-beta.
|
|
20
|
-
"@webiny/handler-aws": "5.43.0-beta.
|
|
21
|
-
"@webiny/handler-graphql": "5.43.0-beta.
|
|
22
|
-
"@webiny/plugins": "5.43.0-beta.
|
|
23
|
-
"@webiny/pubsub": "5.43.0-beta.
|
|
24
|
-
"@webiny/utils": "5.43.0-beta.
|
|
15
|
+
"@webiny/api": "5.43.0-beta.2",
|
|
16
|
+
"@webiny/api-headless-cms": "5.43.0-beta.2",
|
|
17
|
+
"@webiny/aws-sdk": "5.43.0-beta.2",
|
|
18
|
+
"@webiny/error": "5.43.0-beta.2",
|
|
19
|
+
"@webiny/handler": "5.43.0-beta.2",
|
|
20
|
+
"@webiny/handler-aws": "5.43.0-beta.2",
|
|
21
|
+
"@webiny/handler-graphql": "5.43.0-beta.2",
|
|
22
|
+
"@webiny/plugins": "5.43.0-beta.2",
|
|
23
|
+
"@webiny/pubsub": "5.43.0-beta.2",
|
|
24
|
+
"@webiny/utils": "5.43.0-beta.2",
|
|
25
25
|
"deep-equal": "2.2.3",
|
|
26
26
|
"lodash": "4.17.21",
|
|
27
27
|
"object-merge-advanced": "12.1.0",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"zod": "3.23.8"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@webiny/api-i18n": "5.43.0-beta.
|
|
33
|
-
"@webiny/api-security": "5.43.0-beta.
|
|
34
|
-
"@webiny/api-tenancy": "5.43.0-beta.
|
|
35
|
-
"@webiny/api-wcp": "5.43.0-beta.
|
|
36
|
-
"@webiny/project-utils": "5.43.0-beta.
|
|
32
|
+
"@webiny/api-i18n": "5.43.0-beta.2",
|
|
33
|
+
"@webiny/api-security": "5.43.0-beta.2",
|
|
34
|
+
"@webiny/api-tenancy": "5.43.0-beta.2",
|
|
35
|
+
"@webiny/api-wcp": "5.43.0-beta.2",
|
|
36
|
+
"@webiny/project-utils": "5.43.0-beta.2",
|
|
37
37
|
"rimraf": "6.0.1",
|
|
38
38
|
"type-fest": "4.14.0",
|
|
39
39
|
"typescript": "5.3.3"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"build": "node ../cli/bin.js run build",
|
|
47
47
|
"watch": "node ../cli/bin.js run watch"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "dbed8c263df662358aca18c3cf452cd280f2dfd9"
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","TaskServicePlugin","Plugin","type","constructor","params","default","exports"],"sources":["TaskServicePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {
|
|
1
|
+
{"version":3,"names":["_plugins","require","TaskServicePlugin","Plugin","type","constructor","params","default","exports"],"sources":["TaskServicePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { ITask } from \"~/types\";\n\nexport interface ITaskServiceCreatePluginParams {\n getTenant(): string;\n getLocale(): string;\n}\n\nexport type ITaskServiceTask = Pick<ITask, \"id\" | \"definitionId\">;\n\nexport interface ITaskService {\n send(task: ITaskServiceTask, delay: number): Promise<unknown | null>;\n fetch(task: ITask): Promise<unknown | null>;\n}\n\nexport interface ITaskServicePluginParams {\n default?: boolean;\n}\n\nexport abstract class TaskServicePlugin extends Plugin {\n public static override readonly type: string = \"tasks.taskService\";\n public readonly default: boolean;\n\n public constructor(params?: ITaskServicePluginParams) {\n super();\n this.default = !!params?.default;\n }\n\n public abstract createService(params: ITaskServiceCreatePluginParams): ITaskService;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAmBO,MAAeC,iBAAiB,SAASC,eAAM,CAAC;EACnD,OAAgCC,IAAI,GAAW,mBAAmB;EAG3DC,WAAWA,CAACC,MAAiC,EAAE;IAClD,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAG,CAAC,CAACD,MAAM,EAAEC,OAAO;EACpC;AAGJ;AAACC,OAAA,CAAAN,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ITaskService, ITaskServiceCreatePluginParams, ITaskServiceTask, TaskServicePlugin } from "../plugins";
|
|
2
|
-
import { Context } from "../types";
|
|
3
2
|
import type { PutEventsCommandOutput } from "@webiny/aws-sdk/client-eventbridge";
|
|
4
3
|
import { GenericRecord } from "@webiny/api/types";
|
|
5
4
|
declare class EventBridgeService implements ITaskService {
|
|
6
|
-
protected readonly context: Context;
|
|
7
5
|
protected readonly getTenant: () => string;
|
|
8
6
|
protected readonly getLocale: () => string;
|
|
9
7
|
private readonly client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","_clientEventbridge","_error","EventBridgeService","constructor","params","client","EventBridgeClient","region","process","env","AWS_REGION","
|
|
1
|
+
{"version":3,"names":["_plugins","require","_clientEventbridge","_error","EventBridgeService","constructor","params","client","EventBridgeClient","region","process","env","AWS_REGION","getTenant","getLocale","send","task","delay","event","webinyTaskId","id","webinyTaskDefinitionId","definitionId","tenant","locale","cmd","PutEventsCommand","Entries","Source","EventBusName","String","EVENT_BUS","DetailType","Detail","JSON","stringify","result","parse","ex","WebinyError","message","code","data","fetch","EventBridgeEventTransportPlugin","TaskServicePlugin","name","createService","exports"],"sources":["EventBridgeEventTransportPlugin.ts"],"sourcesContent":["import {\n ITaskService,\n ITaskServiceCreatePluginParams,\n ITaskServiceTask,\n TaskServicePlugin\n} from \"~/plugins\";\nimport type { ITaskEventInput } from \"~/types\";\nimport type { PutEventsCommandOutput } from \"@webiny/aws-sdk/client-eventbridge\";\nimport { EventBridgeClient, PutEventsCommand } from \"@webiny/aws-sdk/client-eventbridge\";\nimport { WebinyError } from \"@webiny/error\";\nimport { GenericRecord } from \"@webiny/api/types\";\n\nclass EventBridgeService implements ITaskService {\n protected readonly getTenant: () => string;\n protected readonly getLocale: () => string;\n private readonly client: EventBridgeClient;\n\n public constructor(params: ITaskServiceCreatePluginParams) {\n this.client = new EventBridgeClient({\n region: process.env.AWS_REGION\n });\n this.getTenant = params.getTenant;\n this.getLocale = params.getLocale;\n }\n\n public async send(task: ITaskServiceTask, delay: number): Promise<PutEventsCommandOutput> {\n /**\n * The ITaskEvent is what our handler expect to get.\n * Endpoint and stateMachineId are added by the step function.\n */\n const event: ITaskEventInput = {\n webinyTaskId: task.id,\n webinyTaskDefinitionId: task.definitionId,\n tenant: this.getTenant(),\n locale: this.getLocale(),\n delay\n };\n\n const cmd = new PutEventsCommand({\n Entries: [\n {\n Source: \"webiny-api-tasks\",\n EventBusName: String(process.env.EVENT_BUS),\n DetailType: \"WebinyBackgroundTask\",\n Detail: JSON.stringify(event)\n }\n ]\n });\n try {\n const result = await this.client.send(cmd);\n\n return JSON.parse(JSON.stringify(result));\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not trigger task via Event Bridge!\",\n ex.code || \"TRIGGER_TASK_ERROR\",\n {\n event,\n ...(ex.data || {})\n }\n );\n }\n }\n\n public async fetch(): Promise<GenericRecord> {\n throw new WebinyError(\"Not implemented!\", \"NOT_IMPLEMENTED\");\n }\n}\n\nexport class EventBridgeEventTransportPlugin extends TaskServicePlugin {\n public override name = \"task.eventBridgeEventTransport\";\n public createService(params: ITaskServiceCreatePluginParams) {\n return new EventBridgeService(params);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAQA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAGA,MAAMG,kBAAkB,CAAyB;EAKtCC,WAAWA,CAACC,MAAsC,EAAE;IACvD,IAAI,CAACC,MAAM,GAAG,IAAIC,oCAAiB,CAAC;MAChCC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;IACxB,CAAC,CAAC;IACF,IAAI,CAACC,SAAS,GAAGP,MAAM,CAACO,SAAS;IACjC,IAAI,CAACC,SAAS,GAAGR,MAAM,CAACQ,SAAS;EACrC;EAEA,MAAaC,IAAIA,CAACC,IAAsB,EAAEC,KAAa,EAAmC;IACtF;AACR;AACA;AACA;IACQ,MAAMC,KAAsB,GAAG;MAC3BC,YAAY,EAAEH,IAAI,CAACI,EAAE;MACrBC,sBAAsB,EAAEL,IAAI,CAACM,YAAY;MACzCC,MAAM,EAAE,IAAI,CAACV,SAAS,CAAC,CAAC;MACxBW,MAAM,EAAE,IAAI,CAACV,SAAS,CAAC,CAAC;MACxBG;IACJ,CAAC;IAED,MAAMQ,GAAG,GAAG,IAAIC,mCAAgB,CAAC;MAC7BC,OAAO,EAAE,CACL;QACIC,MAAM,EAAE,kBAAkB;QAC1BC,YAAY,EAAEC,MAAM,CAACpB,OAAO,CAACC,GAAG,CAACoB,SAAS,CAAC;QAC3CC,UAAU,EAAE,sBAAsB;QAClCC,MAAM,EAAEC,IAAI,CAACC,SAAS,CAACjB,KAAK;MAChC,CAAC;IAET,CAAC,CAAC;IACF,IAAI;MACA,MAAMkB,MAAM,GAAG,MAAM,IAAI,CAAC7B,MAAM,CAACQ,IAAI,CAACU,GAAG,CAAC;MAE1C,OAAOS,IAAI,CAACG,KAAK,CAACH,IAAI,CAACC,SAAS,CAACC,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,OAAOE,EAAE,EAAE;MACT,MAAM,IAAIC,kBAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0CAA0C,EACxDF,EAAE,CAACG,IAAI,IAAI,oBAAoB,EAC/B;QACIvB,KAAK;QACL,IAAIoB,EAAE,CAACI,IAAI,IAAI,CAAC,CAAC;MACrB,CACJ,CAAC;IACL;EACJ;EAEA,MAAaC,KAAKA,CAAA,EAA2B;IACzC,MAAM,IAAIJ,kBAAW,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;EAChE;AACJ;AAEO,MAAMK,+BAA+B,SAASC,0BAAiB,CAAC;EACnDC,IAAI,GAAG,gCAAgC;EAChDC,aAAaA,CAACzC,MAAsC,EAAE;IACzD,OAAO,IAAIF,kBAAkB,CAACE,MAAM,CAAC;EACzC;AACJ;AAAC0C,OAAA,CAAAJ,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { ITaskService, ITaskServiceCreatePluginParams, ITaskServiceTask
|
|
1
|
+
import type { ITaskService, ITaskServiceCreatePluginParams, ITaskServiceTask } from "../plugins";
|
|
2
|
+
import { TaskServicePlugin } from "../plugins";
|
|
2
3
|
import { DescribeExecutionCommandOutput } from "@webiny/aws-sdk/client-sfn";
|
|
3
|
-
import { ITask } from "../types";
|
|
4
|
+
import type { ITask } from "../types";
|
|
4
5
|
export type IStepFunctionServiceFetchResult = DescribeExecutionCommandOutput;
|
|
5
6
|
export interface IDetailWrapper<T> {
|
|
6
7
|
detail: T;
|
|
7
8
|
}
|
|
8
|
-
declare class StepFunctionService implements ITaskService {
|
|
9
|
+
export declare class StepFunctionService implements ITaskService {
|
|
9
10
|
private readonly getTenant;
|
|
10
11
|
private readonly getLocale;
|
|
11
12
|
private readonly trigger;
|
|
@@ -23,4 +24,3 @@ export declare class StepFunctionServicePlugin extends TaskServicePlugin {
|
|
|
23
24
|
name: string;
|
|
24
25
|
createService(params: ITaskServiceCreatePluginParams): StepFunctionService;
|
|
25
26
|
}
|
|
26
|
-
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StepFunctionServicePlugin = void 0;
|
|
6
|
+
exports.StepFunctionServicePlugin = exports.StepFunctionService = void 0;
|
|
7
7
|
var _plugins = require("../plugins");
|
|
8
8
|
var _clientSfn = require("@webiny/aws-sdk/client-sfn");
|
|
9
9
|
var _utils = require("@webiny/utils");
|
|
@@ -76,6 +76,7 @@ class StepFunctionService {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
exports.StepFunctionService = StepFunctionService;
|
|
79
80
|
class StepFunctionServicePlugin extends _plugins.TaskServicePlugin {
|
|
80
81
|
name = "task.stepFunctionTriggerTransport";
|
|
81
82
|
createService(params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","_clientSfn","_utils","_api","StepFunctionService","constructor","params","getTenant","getLocale","client","createStepFunctionClient","trigger","triggerStepFunctionFactory","get","describeExecutionFactory","send","task","delay","manifest","ServiceDiscovery","load","console","error","bgTaskSfn","api","input","webinyTaskId","id","webinyTaskDefinitionId","definitionId","tenant","locale","name","generateAlphaNumericId","result","detail","stateMachineArn","ex","log","fetch","executionArn","eventResponse","JSON","parse","stringify","StepFunctionServicePlugin","TaskServicePlugin","createService"
|
|
1
|
+
{"version":3,"names":["_plugins","require","_clientSfn","_utils","_api","StepFunctionService","constructor","params","getTenant","getLocale","client","createStepFunctionClient","trigger","triggerStepFunctionFactory","get","describeExecutionFactory","send","task","delay","manifest","ServiceDiscovery","load","console","error","bgTaskSfn","api","input","webinyTaskId","id","webinyTaskDefinitionId","definitionId","tenant","locale","name","generateAlphaNumericId","result","detail","stateMachineArn","ex","log","fetch","executionArn","eventResponse","JSON","parse","stringify","exports","StepFunctionServicePlugin","TaskServicePlugin","createService"],"sources":["StepFunctionServicePlugin.ts"],"sourcesContent":["import type { ITaskService, ITaskServiceCreatePluginParams, ITaskServiceTask } from \"~/plugins\";\nimport { TaskServicePlugin } from \"~/plugins\";\nimport {\n createStepFunctionClient,\n DescribeExecutionCommandOutput,\n describeExecutionFactory,\n triggerStepFunctionFactory\n} from \"@webiny/aws-sdk/client-sfn\";\nimport type { ITaskEventInput } from \"~/handler/types\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\nimport { ServiceDiscovery } from \"@webiny/api\";\nimport type { ITask } from \"~/types\";\n\nexport type IStepFunctionServiceFetchResult = DescribeExecutionCommandOutput;\n\nexport interface IDetailWrapper<T> {\n detail: T;\n}\n\nexport class StepFunctionService implements ITaskService {\n private readonly getTenant: () => string;\n private readonly getLocale: () => string;\n private readonly trigger: ReturnType<typeof triggerStepFunctionFactory>;\n private readonly get: ReturnType<typeof describeExecutionFactory>;\n\n public constructor(params: ITaskServiceCreatePluginParams) {\n this.getTenant = params.getTenant;\n this.getLocale = params.getLocale;\n const client = createStepFunctionClient();\n this.trigger = triggerStepFunctionFactory(client);\n this.get = describeExecutionFactory(client);\n }\n public async send(task: ITaskServiceTask, delay: number) {\n const manifest = await ServiceDiscovery.load();\n if (!manifest) {\n console.error(\"Service manifest not found.\");\n return null;\n }\n const { bgTaskSfn } = manifest.api || {};\n if (!bgTaskSfn) {\n console.error(\"Background task state machine not found.\");\n return null;\n }\n\n const input: ITaskEventInput = {\n webinyTaskId: task.id,\n webinyTaskDefinitionId: task.definitionId,\n tenant: this.getTenant(),\n locale: this.getLocale(),\n delay\n };\n const name = `${task.definitionId}_${task.id}_${generateAlphaNumericId(10)}`;\n try {\n const result = await this.trigger<IDetailWrapper<ITaskEventInput>>({\n input: {\n detail: input\n },\n stateMachineArn: bgTaskSfn,\n name\n });\n return {\n ...result,\n name\n };\n } catch (ex) {\n console.log(\"Could not trigger a step function.\");\n console.error(ex);\n return null;\n }\n }\n\n public async fetch(task: ITask): Promise<IStepFunctionServiceFetchResult | null> {\n const executionArn = task.eventResponse?.executionArn;\n if (!executionArn) {\n console.error(`Execution ARN not found in task \"${task.id}\".`);\n return null;\n }\n try {\n const result = await this.get({\n executionArn\n });\n if (!result) {\n return null;\n }\n return JSON.parse(JSON.stringify(result));\n } catch (ex) {\n console.log(\"Could not get the execution details.\");\n console.error(ex);\n return null;\n }\n }\n}\n\nexport class StepFunctionServicePlugin extends TaskServicePlugin {\n public override name = \"task.stepFunctionTriggerTransport\";\n\n public createService(params: ITaskServiceCreatePluginParams) {\n return new StepFunctionService(params);\n }\n}\n"],"mappings":"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","ignoreList":[]}
|
package/service/createService.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","_error","createService","params","plugins","context","byType","TaskServicePlugin","type","reverse","plugin","find","default","WebinyError","getTenant","tenancy","getCurrentTenant","id","getLocale","cms","code","exports"],"sources":["createService.ts"],"sourcesContent":["import { Context } from \"~/types\";\nimport { ITaskService, TaskServicePlugin } from \"~/plugins\";\nimport { WebinyError } from \"@webiny/error\";\n\nexport interface ICreateTransport {\n context: Context;\n}\n\nexport const createService = (params: ICreateTransport): ITaskService => {\n const plugins = params.context.plugins\n .byType<TaskServicePlugin>(TaskServicePlugin.type)\n .reverse();\n\n const plugin = plugins.find(plugin => plugin.default) || plugins[0];\n if (!plugin) {\n throw new WebinyError(\"Missing TaskServicePlugin.\", \"PLUGIN_ERROR\", {\n type: TaskServicePlugin.type\n });\n }\n\n const getTenant = (): string => {\n return params.context.tenancy.getCurrentTenant().id;\n };\n const getLocale = (): string => {\n return params.context.cms.getLocale().code;\n };\n\n return plugin.createService({\n
|
|
1
|
+
{"version":3,"names":["_plugins","require","_error","createService","params","plugins","context","byType","TaskServicePlugin","type","reverse","plugin","find","default","WebinyError","getTenant","tenancy","getCurrentTenant","id","getLocale","cms","code","exports"],"sources":["createService.ts"],"sourcesContent":["import { Context } from \"~/types\";\nimport { ITaskService, TaskServicePlugin } from \"~/plugins\";\nimport { WebinyError } from \"@webiny/error\";\n\nexport interface ICreateTransport {\n context: Context;\n}\n\nexport const createService = (params: ICreateTransport): ITaskService => {\n const plugins = params.context.plugins\n .byType<TaskServicePlugin>(TaskServicePlugin.type)\n .reverse();\n\n const plugin = plugins.find(plugin => plugin.default) || plugins[0];\n if (!plugin) {\n throw new WebinyError(\"Missing TaskServicePlugin.\", \"PLUGIN_ERROR\", {\n type: TaskServicePlugin.type\n });\n }\n\n const getTenant = (): string => {\n return params.context.tenancy.getCurrentTenant().id;\n };\n const getLocale = (): string => {\n return params.context.cms.getLocale().code;\n };\n\n return plugin.createService({\n getTenant,\n getLocale\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAMO,MAAME,aAAa,GAAIC,MAAwB,IAAmB;EACrE,MAAMC,OAAO,GAAGD,MAAM,CAACE,OAAO,CAACD,OAAO,CACjCE,MAAM,CAAoBC,0BAAiB,CAACC,IAAI,CAAC,CACjDC,OAAO,CAAC,CAAC;EAEd,MAAMC,MAAM,GAAGN,OAAO,CAACO,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACE,OAAO,CAAC,IAAIR,OAAO,CAAC,CAAC,CAAC;EACnE,IAAI,CAACM,MAAM,EAAE;IACT,MAAM,IAAIG,kBAAW,CAAC,4BAA4B,EAAE,cAAc,EAAE;MAChEL,IAAI,EAAED,0BAAiB,CAACC;IAC5B,CAAC,CAAC;EACN;EAEA,MAAMM,SAAS,GAAGA,CAAA,KAAc;IAC5B,OAAOX,MAAM,CAACE,OAAO,CAACU,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAACC,EAAE;EACvD,CAAC;EACD,MAAMC,SAAS,GAAGA,CAAA,KAAc;IAC5B,OAAOf,MAAM,CAACE,OAAO,CAACc,GAAG,CAACD,SAAS,CAAC,CAAC,CAACE,IAAI;EAC9C,CAAC;EAED,OAAOV,MAAM,CAACR,aAAa,CAAC;IACxBY,SAAS;IACTI;EACJ,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAAnB,aAAA,GAAAA,aAAA","ignoreList":[]}
|