@decaf-ts/for-nest 0.10.2 → 0.11.0

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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/dist/for-nest.cjs +1 -1
  3. package/dist/for-nest.cjs.map +1 -1
  4. package/dist/for-nest.js +1 -1
  5. package/dist/for-nest.js.map +1 -1
  6. package/lib/cjs/index.cjs +4 -3
  7. package/lib/cjs/index.cjs.map +1 -1
  8. package/lib/cjs/webhooks/DecafWebhookModule.cjs +141 -0
  9. package/lib/cjs/webhooks/DecafWebhookModule.cjs.map +1 -0
  10. package/lib/cjs/webhooks/controllers.cjs +151 -0
  11. package/lib/cjs/webhooks/controllers.cjs.map +1 -0
  12. package/lib/cjs/webhooks/index.cjs +34 -0
  13. package/lib/cjs/webhooks/index.cjs.map +1 -0
  14. package/lib/cjs/webhooks/types.cjs +4 -0
  15. package/lib/cjs/webhooks/types.cjs.map +1 -0
  16. package/lib/esm/index.js +4 -3
  17. package/lib/esm/index.js.map +1 -1
  18. package/lib/esm/webhooks/DecafWebhookModule.js +132 -0
  19. package/lib/esm/webhooks/DecafWebhookModule.js.map +1 -0
  20. package/lib/esm/webhooks/controllers.js +142 -0
  21. package/lib/esm/webhooks/controllers.js.map +1 -0
  22. package/lib/esm/webhooks/index.js +5 -0
  23. package/lib/esm/webhooks/index.js.map +1 -0
  24. package/lib/esm/webhooks/types.js +2 -0
  25. package/lib/esm/webhooks/types.js.map +1 -0
  26. package/lib/types/index.d.cts +4 -3
  27. package/lib/types/index.d.mts +4 -3
  28. package/lib/types/webhooks/DecafWebhookModule.d.cts +13 -0
  29. package/lib/types/webhooks/DecafWebhookModule.d.mts +13 -0
  30. package/lib/types/webhooks/controllers.d.cts +13 -0
  31. package/lib/types/webhooks/controllers.d.mts +13 -0
  32. package/lib/types/webhooks/index.d.cts +4 -0
  33. package/lib/types/webhooks/index.d.mts +4 -0
  34. package/lib/types/webhooks/types.d.cts +21 -0
  35. package/lib/types/webhooks/types.d.mts +21 -0
  36. package/package.json +13 -1
@@ -0,0 +1,142 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ var WebhookSubscriptionActionsController_1, WebhookEventActionsController_1;
14
+ import { Controller, Param, Post } from "@nestjs/common";
15
+ import { Repository, OrderDirection } from "@decaf-ts/core";
16
+ import { DecafController } from "./../controllers.js";
17
+ import { DecafRequestContext } from "./../request/index.js";
18
+ import { WebhookDelivery, WebhookEventRecord, WebhookStatus, WebhookSubscription, collectPagedResults, } from "@decaf-ts/for-http/server";
19
+ let WebhookSubscriptionActionsController = WebhookSubscriptionActionsController_1 = class WebhookSubscriptionActionsController extends DecafController {
20
+ constructor(clientContext) {
21
+ super(clientContext, WebhookSubscriptionActionsController_1.name);
22
+ }
23
+ async deactivate(id) {
24
+ const { ctx } = (await this.logCtx([], "deactivate", true)).for(this.deactivate);
25
+ const repo = Repository.forModel(WebhookSubscription);
26
+ const current = await repo.read(id, ctx);
27
+ current.active = false;
28
+ return repo.update(current, ctx);
29
+ }
30
+ async reactivate(id) {
31
+ const { ctx } = (await this.logCtx([], "reactivate", true)).for(this.reactivate);
32
+ const repo = Repository.forModel(WebhookSubscription);
33
+ const current = await repo.read(id, ctx);
34
+ current.active = true;
35
+ return repo.update(current, ctx);
36
+ }
37
+ };
38
+ __decorate([
39
+ Post(":id/deactivate"),
40
+ __param(0, Param("id")),
41
+ __metadata("design:type", Function),
42
+ __metadata("design:paramtypes", [String]),
43
+ __metadata("design:returntype", Promise)
44
+ ], WebhookSubscriptionActionsController.prototype, "deactivate", null);
45
+ __decorate([
46
+ Post(":id/reactivate"),
47
+ __param(0, Param("id")),
48
+ __metadata("design:type", Function),
49
+ __metadata("design:paramtypes", [String]),
50
+ __metadata("design:returntype", Promise)
51
+ ], WebhookSubscriptionActionsController.prototype, "reactivate", null);
52
+ WebhookSubscriptionActionsController = WebhookSubscriptionActionsController_1 = __decorate([
53
+ Controller("webhook-subscriptions"),
54
+ __metadata("design:paramtypes", [DecafRequestContext])
55
+ ], WebhookSubscriptionActionsController);
56
+ export { WebhookSubscriptionActionsController };
57
+ let WebhookEventActionsController = WebhookEventActionsController_1 = class WebhookEventActionsController extends DecafController {
58
+ constructor(clientContext) {
59
+ super(clientContext, WebhookEventActionsController_1.name);
60
+ }
61
+ async replay(id) {
62
+ const { ctx } = (await this.logCtx([], "replay", true)).for(this.replay);
63
+ const eventRepo = Repository.forModel(WebhookEventRecord);
64
+ const deliveryRepo = Repository.forModel(WebhookDelivery);
65
+ try {
66
+ let event;
67
+ try {
68
+ event = await eventRepo.read(id, ctx);
69
+ }
70
+ catch (error) {
71
+ const events = await eventRepo
72
+ .select()
73
+ .where(eventRepo.attr("id").eq(id))
74
+ .limit(1)
75
+ .execute(ctx);
76
+ if (!events.length)
77
+ throw error;
78
+ event = events[0];
79
+ }
80
+ let deliveries = [];
81
+ try {
82
+ deliveries = await collectPagedResults(() => deliveryRepo
83
+ .select()
84
+ .where(deliveryRepo.attr("eventId").eq(event.id))
85
+ .orderBy("createdAt", OrderDirection.ASC)
86
+ .thenBy("id", OrderDirection.ASC)
87
+ .paginate(250, ctx), 250, ctx);
88
+ }
89
+ catch {
90
+ try {
91
+ deliveries = await deliveryRepo
92
+ .select()
93
+ .where(deliveryRepo.attr("eventId").eq(event.id))
94
+ .execute(ctx);
95
+ }
96
+ catch {
97
+ deliveries = [];
98
+ }
99
+ }
100
+ const now = new Date();
101
+ for (const delivery of deliveries) {
102
+ delivery.status = WebhookStatus.PENDING;
103
+ delivery.attempts = 0;
104
+ delivery.nextAttemptAt = now;
105
+ delivery.lastAttemptAt = null;
106
+ delivery.errorMessage = undefined;
107
+ delivery.responseStatus = undefined;
108
+ delivery.responseBody = undefined;
109
+ }
110
+ event.status = WebhookStatus.PENDING;
111
+ event.deliveriesSucceeded = 0;
112
+ event.deliveriesFailed = 0;
113
+ event.nextAttemptAt = now;
114
+ event.updatedAt = now;
115
+ if (deliveries.length) {
116
+ try {
117
+ await deliveryRepo.updateAll(deliveries, ctx.override({ applyUpdateValidation: false }));
118
+ }
119
+ catch {
120
+ // Replay still resets the event state even if bulk delivery updates are not queryable here.
121
+ }
122
+ }
123
+ return eventRepo.update(event, ctx);
124
+ }
125
+ catch (error) {
126
+ throw error;
127
+ }
128
+ }
129
+ };
130
+ __decorate([
131
+ Post(":id/replay"),
132
+ __param(0, Param("id")),
133
+ __metadata("design:type", Function),
134
+ __metadata("design:paramtypes", [String]),
135
+ __metadata("design:returntype", Promise)
136
+ ], WebhookEventActionsController.prototype, "replay", null);
137
+ WebhookEventActionsController = WebhookEventActionsController_1 = __decorate([
138
+ Controller("webhook-events"),
139
+ __metadata("design:paramtypes", [DecafRequestContext])
140
+ ], WebhookEventActionsController);
141
+ export { WebhookEventActionsController };
142
+ //# sourceMappingURL=controllers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controllers.js","sourceRoot":"","sources":["../../../src/webhooks/controllers.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,gBAAgB,CAAC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,cAAc,GAAG,SAAS,CAAC;gBACpC,QAAQ,CAAC,YAAY,GAAG,SAAS,CAAC;YACpC,CAAC;YAED,KAAK,CAAC,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC;YACrC,KAAK,CAAC,mBAAmB,GAAG,CAAC,CAAC;YAC9B,KAAK,CAAC,gBAAgB,GAAG,CAAC,CAAC;YAC3B,KAAK,CAAC,aAAa,GAAG,GAAG,CAAC;YAC1B,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC;YAEtB,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;gBACtB,IAAI,CAAC;oBACH,MAAM,YAAY,CAAC,SAAS,CAC1B,UAAU,EACV,GAAG,CAAC,QAAQ,CAAC,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAC/C,CAAC;gBACJ,CAAC;gBAAC,MAAM,CAAC;oBACP,4FAA4F;gBAC9F,CAAC;YACH,CAAC;YACD,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAA;AA/EO;IADL,IAAI,CAAC,YAAY,CAAC;IACL,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;;;;2DA8ExB;AApFU,6BAA6B;IADzC,UAAU,CAAC,gBAAgB,CAAC;qCAEA,mBAAmB;GADnC,6BAA6B,CAqFzC"}
@@ -0,0 +1,5 @@
1
+ export * from "./DecafWebhookModule.js";
2
+ export * from "./controllers.js";
3
+ export * from "./types.js";
4
+ export { WebhookDelivery, WebhookDeliveryService, WebhookEventRecord, WebhookPublisherService, WebhookSignatureMiddleware, WebhookStatus, WebhookSubscription, WebhookSubscriptionService, computeNextAttempt, signWebhookPayload, verifyWebhookSignature, } from "@decaf-ts/for-http/server";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/webhooks/index.ts"],"names":[],"mappings":"AAAA,wCAAqC;AACrC,iCAA8B;AAC9B,2BAAwB;AAExB,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/webhooks/types.ts"],"names":[],"mappings":""}
@@ -34,25 +34,26 @@ export * from "./migrations/index.d.cts";
34
34
  export * from "./types.d.cts";
35
35
  export * from "./utils.d.cts";
36
36
  export * from "./events-module/index.d.cts";
37
+ export * from "./webhooks/index.d.cts";
37
38
  /**
38
39
  * Represents the current version of the ts-workspace module.
39
40
  * The actual version number is replaced during the build process.
40
41
  * @constant
41
42
  * @type {string}
42
43
  */
43
- export declare const VERSION = "0.10.1";
44
+ export declare const VERSION = "0.10.2";
44
45
  /**
45
46
  * @description Represents the current commit hash of the module build.
46
47
  * @summary Stores the current git commit hash for the package. The build replaces
47
48
  * the placeholder with the actual commit hash at publish time.
48
49
  * @const COMMIT
49
50
  */
50
- export declare const COMMIT = "2609028";
51
+ export declare const COMMIT = "cee7a8b";
51
52
  /**
52
53
  * @description Represents the full version string of the module.
53
54
  * @summary Stores the semver version and commit hash for the package.
54
55
  * The build replaces the placeholder with the actual `<version>-<commit>` value at publish time.
55
56
  * @const FULL_VERSION
56
57
  */
57
- export declare const FULL_VERSION = "0.10.1-2609028";
58
+ export declare const FULL_VERSION = "0.10.2-cee7a8b";
58
59
  export declare const PACKAGE_NAME = "@decaf-ts/for-nest";
@@ -34,25 +34,26 @@ export * from "./migrations/index.d.mts";
34
34
  export * from "./types.d.mts";
35
35
  export * from "./utils.d.mts";
36
36
  export * from "./events-module/index.d.mts";
37
+ export * from "./webhooks/index.d.mts";
37
38
  /**
38
39
  * Represents the current version of the ts-workspace module.
39
40
  * The actual version number is replaced during the build process.
40
41
  * @constant
41
42
  * @type {string}
42
43
  */
43
- export declare const VERSION = "0.10.1";
44
+ export declare const VERSION = "0.10.2";
44
45
  /**
45
46
  * @description Represents the current commit hash of the module build.
46
47
  * @summary Stores the current git commit hash for the package. The build replaces
47
48
  * the placeholder with the actual commit hash at publish time.
48
49
  * @const COMMIT
49
50
  */
50
- export declare const COMMIT = "2609028";
51
+ export declare const COMMIT = "cee7a8b";
51
52
  /**
52
53
  * @description Represents the full version string of the module.
53
54
  * @summary Stores the semver version and commit hash for the package.
54
55
  * The build replaces the placeholder with the actual `<version>-<commit>` value at publish time.
55
56
  * @const FULL_VERSION
56
57
  */
57
- export declare const FULL_VERSION = "0.10.1-2609028";
58
+ export declare const FULL_VERSION = "0.10.2-cee7a8b";
58
59
  export declare const PACKAGE_NAME = "@decaf-ts/for-nest";
@@ -0,0 +1,13 @@
1
+ import { DynamicModule } from "@nestjs/common";
2
+ import { Adapter } from "@decaf-ts/core";
3
+ import { DecafWebhookModuleOptions } from "./types.d.cts";
4
+ export declare class DecafWebhookModule {
5
+ private static _logger;
6
+ private static _persistence?;
7
+ private static get log();
8
+ static bootPersistence(options: DecafWebhookModuleOptions): Promise<Adapter<any, any, any, any>[]>;
9
+ static forRoot(options: DecafWebhookModuleOptions): Promise<DynamicModule>;
10
+ static forRootAsync(options: DecafWebhookModuleOptions): Promise<DynamicModule>;
11
+ }
12
+ export declare const DecafWebhooksModule: typeof DecafWebhookModule;
13
+ export declare function runWebhooksMigrations(): Promise<void>;
@@ -0,0 +1,13 @@
1
+ import { DynamicModule } from "@nestjs/common";
2
+ import { Adapter } from "@decaf-ts/core";
3
+ import { DecafWebhookModuleOptions } from "./types.d.mts";
4
+ export declare class DecafWebhookModule {
5
+ private static _logger;
6
+ private static _persistence?;
7
+ private static get log();
8
+ static bootPersistence(options: DecafWebhookModuleOptions): Promise<Adapter<any, any, any, any>[]>;
9
+ static forRoot(options: DecafWebhookModuleOptions): Promise<DynamicModule>;
10
+ static forRootAsync(options: DecafWebhookModuleOptions): Promise<DynamicModule>;
11
+ }
12
+ export declare const DecafWebhooksModule: typeof DecafWebhookModule;
13
+ export declare function runWebhooksMigrations(): Promise<void>;
@@ -0,0 +1,13 @@
1
+ import { DecafController } from "../controllers.d.cts";
2
+ import { DecafRequestContext } from "../request/index.d.cts";
3
+ import { DecafServerCtx } from "../constants.d.cts";
4
+ import { WebhookEventRecord, WebhookSubscription } from "@decaf-ts/for-http/server";
5
+ export declare class WebhookSubscriptionActionsController extends DecafController<DecafServerCtx> {
6
+ constructor(clientContext: DecafRequestContext);
7
+ deactivate(id: string): Promise<WebhookSubscription>;
8
+ reactivate(id: string): Promise<WebhookSubscription>;
9
+ }
10
+ export declare class WebhookEventActionsController extends DecafController<DecafServerCtx> {
11
+ constructor(clientContext: DecafRequestContext);
12
+ replay(id: string): Promise<WebhookEventRecord>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { DecafController } from "../controllers.d.mts";
2
+ import { DecafRequestContext } from "../request/index.d.mts";
3
+ import { DecafServerCtx } from "../constants.d.mts";
4
+ import { WebhookEventRecord, WebhookSubscription } from "@decaf-ts/for-http/server";
5
+ export declare class WebhookSubscriptionActionsController extends DecafController<DecafServerCtx> {
6
+ constructor(clientContext: DecafRequestContext);
7
+ deactivate(id: string): Promise<WebhookSubscription>;
8
+ reactivate(id: string): Promise<WebhookSubscription>;
9
+ }
10
+ export declare class WebhookEventActionsController extends DecafController<DecafServerCtx> {
11
+ constructor(clientContext: DecafRequestContext);
12
+ replay(id: string): Promise<WebhookEventRecord>;
13
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./DecafWebhookModule.d.cts";
2
+ export * from "./controllers.d.cts";
3
+ export * from "./types.d.cts";
4
+ export { WebhookDelivery, WebhookDeliveryService, WebhookEventRecord, WebhookPublisherService, WebhookSignatureMiddleware, WebhookStatus, WebhookSubscription, WebhookSubscriptionService, computeNextAttempt, signWebhookPayload, verifyWebhookSignature, } from "@decaf-ts/for-http/server";
@@ -0,0 +1,4 @@
1
+ export * from "./DecafWebhookModule.d.mts";
2
+ export * from "./controllers.d.mts";
3
+ export * from "./types.d.mts";
4
+ export { WebhookDelivery, WebhookDeliveryService, WebhookEventRecord, WebhookPublisherService, WebhookSignatureMiddleware, WebhookStatus, WebhookSubscription, WebhookSubscriptionService, computeNextAttempt, signWebhookPayload, verifyWebhookSignature, } from "@decaf-ts/for-http/server";
@@ -0,0 +1,21 @@
1
+ import { Adapter, ConfigOf } from "@decaf-ts/core";
2
+ import { Constructor } from "@decaf-ts/decoration";
3
+ import { Type } from "@nestjs/common";
4
+ import { DecafRequestHandler } from "../types.d.cts";
5
+ export interface DecafWebhookModuleOptions<CONF = any, A extends Adapter<CONF, any, any, any> = Adapter<CONF, any, any, any>> {
6
+ conf: [
7
+ Constructor<A>,
8
+ ConfigOf<A>,
9
+ ...args: any[] | [
10
+ ...any[],
11
+ any
12
+ ]
13
+ ][];
14
+ handlers?: Type<DecafRequestHandler>[];
15
+ initialization?: () => Promise<void>;
16
+ /**
17
+ * Router prefix for the webhook controllers.
18
+ * @default "/webhooks"
19
+ */
20
+ webhookApiPath?: string;
21
+ }
@@ -0,0 +1,21 @@
1
+ import { Adapter, ConfigOf } from "@decaf-ts/core";
2
+ import { Constructor } from "@decaf-ts/decoration";
3
+ import { Type } from "@nestjs/common";
4
+ import { DecafRequestHandler } from "../types.d.mts";
5
+ export interface DecafWebhookModuleOptions<CONF = any, A extends Adapter<CONF, any, any, any> = Adapter<CONF, any, any, any>> {
6
+ conf: [
7
+ Constructor<A>,
8
+ ConfigOf<A>,
9
+ ...args: any[] | [
10
+ ...any[],
11
+ any
12
+ ]
13
+ ][];
14
+ handlers?: Type<DecafRequestHandler>[];
15
+ initialization?: () => Promise<void>;
16
+ /**
17
+ * Router prefix for the webhook controllers.
18
+ * @default "/webhooks"
19
+ */
20
+ webhookApiPath?: string;
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decaf-ts/for-nest",
3
- "version": "0.10.2",
3
+ "version": "0.11.0",
4
4
  "description": "NestJS decaf integration",
5
5
  "type": "module",
6
6
  "exports": {
@@ -36,6 +36,17 @@
36
36
  "default": "./lib/cjs/cli-module.cjs"
37
37
  },
38
38
  "default": "./lib/esm/cli-module.js"
39
+ },
40
+ "./webhooks": {
41
+ "import": {
42
+ "types": "./lib/types/webhooks/index.d.mts",
43
+ "default": "./lib/esm/webhooks/index.js"
44
+ },
45
+ "require": {
46
+ "types": "./lib/types/webhooks/index.d.cts",
47
+ "default": "./lib/cjs/webhooks/index.cjs"
48
+ },
49
+ "default": "./lib/esm/webhooks/index.js"
39
50
  }
40
51
  },
41
52
  "bin": {
@@ -148,6 +159,7 @@
148
159
  "@decaf-ts/db-decorators": "latest",
149
160
  "@decaf-ts/decoration": "latest",
150
161
  "@decaf-ts/decorator-validation": "latest",
162
+ "@decaf-ts/for-http": "latest",
151
163
  "@decaf-ts/injectable-decorators": "latest",
152
164
  "@decaf-ts/logging": "latest",
153
165
  "@decaf-ts/transactional-decorators": "latest",