@webiny/webhooks 6.6.0-alpha.1 → 6.6.0-alpha.3

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.
@@ -1,5 +1,5 @@
1
1
  import "@webiny/background-tasks/api/types.js";
2
- import { TaskDefinition } from "@webiny/api-core/exports/api/tasks.js";
2
+ import { TaskDefinition, TaskHandler } from "@webiny/api-core/exports/api/tasks.js";
3
3
  import { TenantContext } from "@webiny/api-core/exports/api/tenancy.js";
4
4
  import { WebhookSignPayload } from "@webiny/api-core/features/webhooks/index.js";
5
5
  import { GetWebhookRepository } from "../../../api/features/GetWebhook/abstractions.js";
@@ -8,8 +8,8 @@ import { UpdateWebhookDeliveryRepository } from "../../../api/features/UpdateWeb
8
8
  import { GetWebhookSettingsRepository } from "../../../api/features/GetWebhookSettings/abstractions.js";
9
9
  import { WebhookDeliver } from "../../../api/features/WebhookDeliver/abstractions.js";
10
10
  import type { ISendWebhookTaskInput, ISendWebhookTaskOutput } from "./types.js";
11
- type IRunParams = TaskDefinition.RunParams<ISendWebhookTaskInput, ISendWebhookTaskOutput>;
12
- declare class SendWebhookTaskDefinition implements TaskDefinition.Interface<ISendWebhookTaskInput, ISendWebhookTaskOutput> {
11
+ type IRunParams = TaskHandler.RunParams<ISendWebhookTaskInput, ISendWebhookTaskOutput>;
12
+ declare class SendWebhookTaskHandlerImpl implements TaskHandler.Interface<ISendWebhookTaskInput, ISendWebhookTaskOutput> {
13
13
  private readonly getWebhookRepository;
14
14
  private readonly getWebhookDeliveryRepository;
15
15
  private readonly updateDeliveryRepository;
@@ -17,6 +17,10 @@ declare class SendWebhookTaskDefinition implements TaskDefinition.Interface<ISen
17
17
  private readonly tenantContext;
18
18
  private readonly getWebhookSettingsRepository;
19
19
  private readonly deliver;
20
+ constructor(getWebhookRepository: GetWebhookRepository.Interface, getWebhookDeliveryRepository: GetWebhookDeliveryRepository.Interface, updateDeliveryRepository: UpdateWebhookDeliveryRepository.Interface, signPayload: WebhookSignPayload.Interface, tenantContext: TenantContext.Interface, getWebhookSettingsRepository: GetWebhookSettingsRepository.Interface, deliver: WebhookDeliver.Interface);
21
+ run(params: IRunParams): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskResultError | TaskDefinition.ResultDone<ISendWebhookTaskOutput>>;
22
+ }
23
+ declare class SendWebhookTaskDefinition implements TaskDefinition.Interface {
20
24
  readonly id = "sendWebhook";
21
25
  readonly title = "Send Webhook";
22
26
  readonly maxIterations = 1;
@@ -24,8 +28,9 @@ declare class SendWebhookTaskDefinition implements TaskDefinition.Interface<ISen
24
28
  readonly databaseLogs = false;
25
29
  readonly description = "POST a signed event payload to a webhook endpoint and log the delivery.";
26
30
  readonly selfCleanup = "always";
27
- constructor(getWebhookRepository: GetWebhookRepository.Interface, getWebhookDeliveryRepository: GetWebhookDeliveryRepository.Interface, updateDeliveryRepository: UpdateWebhookDeliveryRepository.Interface, signPayload: WebhookSignPayload.Interface, tenantContext: TenantContext.Interface, getWebhookSettingsRepository: GetWebhookSettingsRepository.Interface, deliver: WebhookDeliver.Interface);
28
- run(params: IRunParams): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskResultError | TaskDefinition.ResultDone<ISendWebhookTaskOutput>>;
31
+ handler: typeof SendWebhookTaskHandlerImpl & {
32
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskOutput>>;
33
+ };
29
34
  }
30
35
  export declare const SendWebhookTask: typeof SendWebhookTaskDefinition & {
31
36
  __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskOutput>>;
@@ -1,5 +1,5 @@
1
1
  import "@webiny/background-tasks/api/types.js";
2
- import { TaskDefinition } from "@webiny/api-core/exports/api/tasks.js";
2
+ import { TaskDefinition, TaskHandler } from "@webiny/api-core/exports/api/tasks.js";
3
3
  import { TenantContext } from "@webiny/api-core/exports/api/tenancy.js";
4
4
  import { WebhookSignPayload } from "@webiny/api-core/features/webhooks/index.js";
5
5
  import { GetWebhookRepository } from "../GetWebhook/abstractions.js";
@@ -8,7 +8,7 @@ import { UpdateWebhookDeliveryRepository } from "../UpdateWebhookDelivery/abstra
8
8
  import { GetWebhookSettingsRepository } from "../GetWebhookSettings/abstractions.js";
9
9
  import { WebhookDeliver } from "../WebhookDeliver/abstractions.js";
10
10
  import { SEND_WEBHOOK_TASK } from "../../domain/constants.js";
11
- class SendWebhookTaskDefinition {
11
+ class SendWebhookTaskHandlerImpl {
12
12
  constructor(getWebhookRepository, getWebhookDeliveryRepository, updateDeliveryRepository, signPayload, tenantContext, getWebhookSettingsRepository, deliver){
13
13
  this.getWebhookRepository = getWebhookRepository;
14
14
  this.getWebhookDeliveryRepository = getWebhookDeliveryRepository;
@@ -17,13 +17,6 @@ class SendWebhookTaskDefinition {
17
17
  this.tenantContext = tenantContext;
18
18
  this.getWebhookSettingsRepository = getWebhookSettingsRepository;
19
19
  this.deliver = deliver;
20
- this.id = SEND_WEBHOOK_TASK;
21
- this.title = "Send Webhook";
22
- this.maxIterations = 1;
23
- this.isPrivate = true;
24
- this.databaseLogs = false;
25
- this.description = "POST a signed event payload to a webhook endpoint and log the delivery.";
26
- this.selfCleanup = "always";
27
20
  }
28
21
  async run(params) {
29
22
  const { input, controller } = params;
@@ -94,8 +87,8 @@ class SendWebhookTaskDefinition {
94
87
  return controller.response.done();
95
88
  }
96
89
  }
97
- const SendWebhookTask = TaskDefinition.createImplementation({
98
- implementation: SendWebhookTaskDefinition,
90
+ const SendWebhookTaskHandler = TaskHandler.createImplementation({
91
+ implementation: SendWebhookTaskHandlerImpl,
99
92
  dependencies: [
100
93
  GetWebhookRepository,
101
94
  GetWebhookDeliveryRepository,
@@ -106,6 +99,22 @@ const SendWebhookTask = TaskDefinition.createImplementation({
106
99
  WebhookDeliver
107
100
  ]
108
101
  });
102
+ class SendWebhookTaskDefinition {
103
+ constructor(){
104
+ this.id = SEND_WEBHOOK_TASK;
105
+ this.title = "Send Webhook";
106
+ this.maxIterations = 1;
107
+ this.isPrivate = true;
108
+ this.databaseLogs = false;
109
+ this.description = "POST a signed event payload to a webhook endpoint and log the delivery.";
110
+ this.selfCleanup = "always";
111
+ this.handler = SendWebhookTaskHandler;
112
+ }
113
+ }
114
+ const SendWebhookTask = TaskDefinition.createImplementation({
115
+ implementation: SendWebhookTaskDefinition,
116
+ dependencies: []
117
+ });
109
118
  export { SendWebhookTask };
110
119
 
111
120
  //# sourceMappingURL=SendWebhookTask.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api/features/SendWebhookTask/SendWebhookTask.js","sources":["../../../../src/api/features/SendWebhookTask/SendWebhookTask.ts"],"sourcesContent":["import \"@webiny/background-tasks/api/types.js\";\nimport { TaskDefinition } from \"@webiny/api-core/exports/api/tasks.js\";\nimport { TenantContext } from \"@webiny/api-core/exports/api/tenancy.js\";\nimport { WebhookSignPayload } from \"@webiny/api-core/features/webhooks/index.js\";\nimport { GetWebhookRepository } from \"~/api/features/GetWebhook/abstractions.js\";\nimport { GetWebhookDeliveryRepository } from \"~/api/features/GetWebhookDelivery/abstractions.js\";\nimport { UpdateWebhookDeliveryRepository } from \"~/api/features/UpdateWebhookDelivery/abstractions.js\";\nimport { GetWebhookSettingsRepository } from \"~/api/features/GetWebhookSettings/abstractions.js\";\nimport { WebhookDeliver } from \"~/api/features/WebhookDeliver/abstractions.js\";\nimport { SEND_WEBHOOK_TASK } from \"~/api/domain/constants.js\";\nimport type { ISendWebhookTaskInput, ISendWebhookTaskOutput, IWebhookPayload } from \"./types.js\";\nimport type { IWebhookSignPayloadHeaders } from \"@webiny/api-core/features/webhooks/WebhookSignPayload/abstractions.js\";\n\ntype IRunParams = TaskDefinition.RunParams<ISendWebhookTaskInput, ISendWebhookTaskOutput>;\n\nclass SendWebhookTaskDefinition implements TaskDefinition.Interface<\n ISendWebhookTaskInput,\n ISendWebhookTaskOutput\n> {\n public readonly id = SEND_WEBHOOK_TASK;\n public readonly title = \"Send Webhook\";\n public readonly maxIterations = 1;\n public readonly isPrivate = true;\n public readonly databaseLogs = false;\n public readonly description =\n \"POST a signed event payload to a webhook endpoint and log the delivery.\";\n public readonly selfCleanup = \"always\";\n\n public constructor(\n private readonly getWebhookRepository: GetWebhookRepository.Interface,\n private readonly getWebhookDeliveryRepository: GetWebhookDeliveryRepository.Interface,\n private readonly updateDeliveryRepository: UpdateWebhookDeliveryRepository.Interface,\n private readonly signPayload: WebhookSignPayload.Interface,\n private readonly tenantContext: TenantContext.Interface,\n private readonly getWebhookSettingsRepository: GetWebhookSettingsRepository.Interface,\n private readonly deliver: WebhookDeliver.Interface\n ) {}\n\n public async run(params: IRunParams) {\n const { input, controller } = params;\n const taskId = controller.state.getTask().id;\n\n const delivery = await this.getWebhookDeliveryRepository.execute(input.deliveryId);\n if (delivery.isFail()) {\n return controller.response.error(delivery.error);\n }\n\n await this.updateDeliveryRepository.execute(input.deliveryId, {\n backgroundTaskId: taskId,\n status: \"delivering\"\n });\n\n const webhookResult = await this.getWebhookRepository.execute(input.webhookId);\n if (webhookResult.isFail()) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(webhookResult.error);\n }\n const webhook = webhookResult.value;\n\n const now = new Date();\n const payload: IWebhookPayload = {\n id: taskId,\n event: input.eventName,\n timestamp: now.toISOString(),\n webhookId: input.webhookId,\n deliveryId: input.deliveryId,\n tenant: this.tenantContext.getTenant().id,\n data: delivery.value.payload\n };\n const rawBody = JSON.stringify(payload);\n let signHeaders: IWebhookSignPayloadHeaders;\n\n const settingsResult = await this.getWebhookSettingsRepository.execute();\n if (settingsResult.isFail()) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(settingsResult.error);\n }\n const signingSecret = webhook.signingSecret || settingsResult.value.signingSecret || \"\";\n\n try {\n signHeaders = await this.signPayload.sign(taskId, now, rawBody, signingSecret);\n } catch (ex) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(ex);\n }\n\n const requestHeaders: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n ...signHeaders\n };\n\n const result = await this.deliver.execute({\n url: webhook.endpointUrl,\n headers: requestHeaders,\n body: rawBody,\n timeout: 600_000,\n maxRetries: 3,\n initialDelay: 1000,\n maxDelay: 30_000\n });\n\n await this.updateDeliveryRepository.execute(input.deliveryId, {\n payload,\n requestHeaders,\n responseTime: result.responseTime,\n responseStatus: result.status,\n responseBody: result.body,\n status: result.status > 0 ? \"delivered\" : \"failed\"\n });\n\n return controller.response.done();\n }\n}\n\nexport const SendWebhookTask = TaskDefinition.createImplementation({\n implementation: SendWebhookTaskDefinition,\n dependencies: [\n GetWebhookRepository,\n GetWebhookDeliveryRepository,\n UpdateWebhookDeliveryRepository,\n WebhookSignPayload,\n TenantContext,\n GetWebhookSettingsRepository,\n WebhookDeliver\n ]\n});\n"],"names":["SendWebhookTaskDefinition","getWebhookRepository","getWebhookDeliveryRepository","updateDeliveryRepository","signPayload","tenantContext","getWebhookSettingsRepository","deliver","SEND_WEBHOOK_TASK","params","input","controller","taskId","delivery","webhookResult","webhook","now","Date","payload","rawBody","JSON","signHeaders","settingsResult","signingSecret","ex","requestHeaders","result","SendWebhookTask","TaskDefinition","GetWebhookRepository","GetWebhookDeliveryRepository","UpdateWebhookDeliveryRepository","WebhookSignPayload","TenantContext","GetWebhookSettingsRepository","WebhookDeliver"],"mappings":";;;;;;;;;;AAeA,MAAMA;IAaF,YACqBC,oBAAoD,EACpDC,4BAAoE,EACpEC,wBAAmE,EACnEC,WAAyC,EACzCC,aAAsC,EACtCC,4BAAoE,EACpEC,OAAiC,CACpD;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ACAC;KACH;AACL"}
1
+ {"version":3,"file":"api/features/SendWebhookTask/SendWebhookTask.js","sources":["../../../../src/api/features/SendWebhookTask/SendWebhookTask.ts"],"sourcesContent":["import \"@webiny/background-tasks/api/types.js\";\nimport { TaskDefinition, TaskHandler } from \"@webiny/api-core/exports/api/tasks.js\";\nimport { TenantContext } from \"@webiny/api-core/exports/api/tenancy.js\";\nimport { WebhookSignPayload } from \"@webiny/api-core/features/webhooks/index.js\";\nimport { GetWebhookRepository } from \"~/api/features/GetWebhook/abstractions.js\";\nimport { GetWebhookDeliveryRepository } from \"~/api/features/GetWebhookDelivery/abstractions.js\";\nimport { UpdateWebhookDeliveryRepository } from \"~/api/features/UpdateWebhookDelivery/abstractions.js\";\nimport { GetWebhookSettingsRepository } from \"~/api/features/GetWebhookSettings/abstractions.js\";\nimport { WebhookDeliver } from \"~/api/features/WebhookDeliver/abstractions.js\";\nimport { SEND_WEBHOOK_TASK } from \"~/api/domain/constants.js\";\nimport type { ISendWebhookTaskInput, ISendWebhookTaskOutput, IWebhookPayload } from \"./types.js\";\nimport type { IWebhookSignPayloadHeaders } from \"@webiny/api-core/features/webhooks/WebhookSignPayload/abstractions.js\";\n\ntype IRunParams = TaskHandler.RunParams<ISendWebhookTaskInput, ISendWebhookTaskOutput>;\n\nclass SendWebhookTaskHandlerImpl implements TaskHandler.Interface<\n ISendWebhookTaskInput,\n ISendWebhookTaskOutput\n> {\n public constructor(\n private readonly getWebhookRepository: GetWebhookRepository.Interface,\n private readonly getWebhookDeliveryRepository: GetWebhookDeliveryRepository.Interface,\n private readonly updateDeliveryRepository: UpdateWebhookDeliveryRepository.Interface,\n private readonly signPayload: WebhookSignPayload.Interface,\n private readonly tenantContext: TenantContext.Interface,\n private readonly getWebhookSettingsRepository: GetWebhookSettingsRepository.Interface,\n private readonly deliver: WebhookDeliver.Interface\n ) {}\n\n public async run(params: IRunParams) {\n const { input, controller } = params;\n const taskId = controller.state.getTask().id;\n\n const delivery = await this.getWebhookDeliveryRepository.execute(input.deliveryId);\n if (delivery.isFail()) {\n return controller.response.error(delivery.error);\n }\n\n await this.updateDeliveryRepository.execute(input.deliveryId, {\n backgroundTaskId: taskId,\n status: \"delivering\"\n });\n\n const webhookResult = await this.getWebhookRepository.execute(input.webhookId);\n if (webhookResult.isFail()) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(webhookResult.error);\n }\n const webhook = webhookResult.value;\n\n const now = new Date();\n const payload: IWebhookPayload = {\n id: taskId,\n event: input.eventName,\n timestamp: now.toISOString(),\n webhookId: input.webhookId,\n deliveryId: input.deliveryId,\n tenant: this.tenantContext.getTenant().id,\n data: delivery.value.payload\n };\n const rawBody = JSON.stringify(payload);\n let signHeaders: IWebhookSignPayloadHeaders;\n\n const settingsResult = await this.getWebhookSettingsRepository.execute();\n if (settingsResult.isFail()) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(settingsResult.error);\n }\n const signingSecret = webhook.signingSecret || settingsResult.value.signingSecret || \"\";\n\n try {\n signHeaders = await this.signPayload.sign(taskId, now, rawBody, signingSecret);\n } catch (ex) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(ex);\n }\n\n const requestHeaders: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n ...signHeaders\n };\n\n const result = await this.deliver.execute({\n url: webhook.endpointUrl,\n headers: requestHeaders,\n body: rawBody,\n timeout: 600_000,\n maxRetries: 3,\n initialDelay: 1000,\n maxDelay: 30_000\n });\n\n await this.updateDeliveryRepository.execute(input.deliveryId, {\n payload,\n requestHeaders,\n responseTime: result.responseTime,\n responseStatus: result.status,\n responseBody: result.body,\n status: result.status > 0 ? \"delivered\" : \"failed\"\n });\n\n return controller.response.done();\n }\n}\n\nconst SendWebhookTaskHandler = TaskHandler.createImplementation({\n implementation: SendWebhookTaskHandlerImpl,\n dependencies: [\n GetWebhookRepository,\n GetWebhookDeliveryRepository,\n UpdateWebhookDeliveryRepository,\n WebhookSignPayload,\n TenantContext,\n GetWebhookSettingsRepository,\n WebhookDeliver\n ]\n});\n\nclass SendWebhookTaskDefinition implements TaskDefinition.Interface {\n public readonly id = SEND_WEBHOOK_TASK;\n public readonly title = \"Send Webhook\";\n public readonly maxIterations = 1;\n public readonly isPrivate = true;\n public readonly databaseLogs = false;\n public readonly description =\n \"POST a signed event payload to a webhook endpoint and log the delivery.\";\n public readonly selfCleanup = \"always\";\n\n handler = SendWebhookTaskHandler;\n}\n\nexport const SendWebhookTask = TaskDefinition.createImplementation({\n implementation: SendWebhookTaskDefinition,\n dependencies: []\n});\n"],"names":["SendWebhookTaskHandlerImpl","getWebhookRepository","getWebhookDeliveryRepository","updateDeliveryRepository","signPayload","tenantContext","getWebhookSettingsRepository","deliver","params","input","controller","taskId","delivery","webhookResult","webhook","now","Date","payload","rawBody","JSON","signHeaders","settingsResult","signingSecret","ex","requestHeaders","result","SendWebhookTaskHandler","TaskHandler","GetWebhookRepository","GetWebhookDeliveryRepository","UpdateWebhookDeliveryRepository","WebhookSignPayload","TenantContext","GetWebhookSettingsRepository","WebhookDeliver","SendWebhookTaskDefinition","SEND_WEBHOOK_TASK","SendWebhookTask","TaskDefinition"],"mappings":";;;;;;;;;;AAeA,MAAMA;IAIF,YACqBC,oBAAoD,EACpDC,4BAAoE,EACpEC,wBAAmE,EACnEC,WAAyC,EACzCC,aAAsC,EACtCC,4BAAoE,EACpEC,OAAiC,CACpD;aAPmBN,oBAAoB,GAApBA;aACAC,4BAA4B,GAA5BA;aACAC,wBAAwB,GAAxBA;aACAC,WAAW,GAAXA;aACAC,aAAa,GAAbA;aACAC,4BAA4B,GAA5BA;aACAC,OAAO,GAAPA;IAClB;IAEH,MAAa,IAAIC,MAAkB,EAAE;QACjC,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;QAC9B,MAAMG,SAASD,WAAW,KAAK,CAAC,OAAO,GAAG,EAAE;QAE5C,MAAME,WAAW,MAA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,QAAQI,KAAKG,SAASI;QACpE,EAAE,OAAOC,IAAI;YACT,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAACd,MAAM,UAAU,EAAE;gBAAE,QAAQ;YAAS;YACjF,OAAOC,WAAW,QAAQ,CAAC,KAAK,CAACa;QACrC;QAEA,MAAMC,iBAAyC;YAC3C,gBAAgB;YAChB,GAAGJ,WAAW;QAClB;QAEA,MAAMK,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YACtC,KAAKX,QAAQ,WAAW;YACxB,SAASU;YACT,MAAMN;YACN,SAAS;YACT,YAAY;YACZ,cAAc;YACd,UAAU;QACd;QAEA,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAACT,MAAM,UAAU,EAAE;YAC1DQ;YACAO;YACA,cAAcC,OAAO,YAAY;YACjC,gBAAgBA,OAAO,MAAM;YAC7B,cAAcA,OAAO,IAAI;YACzB,QAAQA,OAAO,MAAM,GAAG,IAAI,cAAc;QAC9C;QAEA,OAAOf,WAAW,QAAQ,CAAC,IAAI;IACnC;AACJ;AAEA,MAAMgB,yBAAyBC,YAAY,oBAAoB,CAAC;IAC5D,gBAAgB3B;IAChB,cAAc;QACV4B;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL;AAEA,MAAMC;;aACc,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,aAAa,GAAG;aAChB,SAAS,GAAG;aACZ,YAAY,GAAG;aACf,WAAW,GACvB;aACY,WAAW,GAAG;aAE9B,OAAO,GAAGV;;AACd;AAEO,MAAMW,kBAAkBC,eAAe,oBAAoB,CAAC;IAC/D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/webhooks",
3
- "version": "6.6.0-alpha.1",
3
+ "version": "6.6.0-alpha.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -19,17 +19,17 @@
19
19
  },
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@webiny/admin-ui": "6.6.0-alpha.1",
23
- "@webiny/api-core": "6.6.0-alpha.1",
24
- "@webiny/api-graphql": "6.6.0-alpha.1",
25
- "@webiny/api-headless-cms": "6.6.0-alpha.1",
26
- "@webiny/app": "6.6.0-alpha.1",
27
- "@webiny/app-admin": "6.6.0-alpha.1",
28
- "@webiny/background-tasks": "6.6.0-alpha.1",
29
- "@webiny/feature": "6.6.0-alpha.1",
30
- "@webiny/icons": "6.6.0-alpha.1",
31
- "@webiny/sdk": "6.6.0-alpha.1",
32
- "@webiny/utils": "6.6.0-alpha.1",
22
+ "@webiny/admin-ui": "6.6.0-alpha.3",
23
+ "@webiny/api-core": "6.6.0-alpha.3",
24
+ "@webiny/api-graphql": "6.6.0-alpha.3",
25
+ "@webiny/api-headless-cms": "6.6.0-alpha.3",
26
+ "@webiny/app": "6.6.0-alpha.3",
27
+ "@webiny/app-admin": "6.6.0-alpha.3",
28
+ "@webiny/background-tasks": "6.6.0-alpha.3",
29
+ "@webiny/feature": "6.6.0-alpha.3",
30
+ "@webiny/icons": "6.6.0-alpha.3",
31
+ "@webiny/sdk": "6.6.0-alpha.3",
32
+ "@webiny/utils": "6.6.0-alpha.3",
33
33
  "graphql": "16.14.2",
34
34
  "lodash": "4.18.1",
35
35
  "mobx": "7.0.3",
@@ -40,13 +40,13 @@
40
40
  "zod": "4.4.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@webiny/api": "6.6.0-alpha.1",
44
- "@webiny/api-core-testing": "6.6.0-alpha.1",
45
- "@webiny/build-tools": "6.6.0-alpha.1",
43
+ "@webiny/api": "6.6.0-alpha.3",
44
+ "@webiny/api-core-testing": "6.6.0-alpha.3",
45
+ "@webiny/build-tools": "6.6.0-alpha.3",
46
46
  "@webiny/di": "1.1.0",
47
- "@webiny/event-handler-core": "6.6.0-alpha.1",
48
- "@webiny/handler": "6.6.0-alpha.1",
49
- "@webiny/wcp": "6.6.0-alpha.1",
47
+ "@webiny/event-handler-core": "6.6.0-alpha.3",
48
+ "@webiny/handler": "6.6.0-alpha.3",
49
+ "@webiny/wcp": "6.6.0-alpha.3",
50
50
  "typescript": "7.0.2",
51
51
  "vitest": "4.1.11"
52
52
  },