@dereekb/nestjs 13.43.0 → 14.0.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.
@@ -1,7 +1,7 @@
1
1
  import { handlerFactory, handlerConfigurerFactory, handlerMappedSetFunctionFactory } from '@dereekb/util';
2
2
  import { RawBody } from '@dereekb/nestjs';
3
3
  import { Injectable, Inject, BadRequestException, Logger, Post, Req, Controller, Module } from '@nestjs/common';
4
- import Stripe from 'stripe';
4
+ import { Stripe } from 'stripe';
5
5
  import { ConfigService, ConfigModule } from '@nestjs/config';
6
6
 
7
7
  function _define_property$4(obj, key, value) {
@@ -12,9 +12,7 @@ function _define_property$4(obj, key, value) {
12
12
  configurable: true,
13
13
  writable: true
14
14
  });
15
- } else {
16
- obj[key] = value;
17
- }
15
+ } else obj[key] = value;
18
16
  return obj;
19
17
  }
20
18
  function _object_spread(target) {
@@ -42,9 +40,8 @@ function ownKeys(object, enumerableOnly) {
42
40
  }
43
41
  function _object_spread_props(target, source) {
44
42
  source = source != null ? source : {};
45
- if (Object.getOwnPropertyDescriptors) {
46
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
47
- } else {
43
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
44
+ else {
48
45
  ownKeys(Object(source)).forEach(function(key) {
49
46
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
50
47
  });
@@ -140,9 +137,7 @@ typeof SuppressedError === "function" ? SuppressedError : function(error, suppre
140
137
  };
141
138
 
142
139
  function _class_call_check$5(instance, Constructor) {
143
- if (!(instance instanceof Constructor)) {
144
- throw new TypeError("Cannot call a class as a function");
145
- }
140
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
146
141
  }
147
142
  function _defineProperties$3(target, props) {
148
143
  for(var i = 0; i < props.length; i++){
@@ -165,9 +160,7 @@ function _define_property$3(obj, key, value) {
165
160
  configurable: true,
166
161
  writable: true
167
162
  });
168
- } else {
169
- obj[key] = value;
170
- }
163
+ } else obj[key] = value;
171
164
  return obj;
172
165
  }
173
166
  /**
@@ -194,9 +187,7 @@ function _define_property$3(obj, key, value) {
194
187
  ();
195
188
 
196
189
  function _class_call_check$4(instance, Constructor) {
197
- if (!(instance instanceof Constructor)) {
198
- throw new TypeError("Cannot call a class as a function");
199
- }
190
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
200
191
  }
201
192
  function _defineProperties$2(target, props) {
202
193
  for(var i = 0; i < props.length; i++){
@@ -219,9 +210,7 @@ function _define_property$2(obj, key, value) {
219
210
  configurable: true,
220
211
  writable: true
221
212
  });
222
- } else {
223
- obj[key] = value;
224
- }
213
+ } else obj[key] = value;
225
214
  return obj;
226
215
  }
227
216
  /**
@@ -277,11 +266,8 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
277
266
  reject(error);
278
267
  return;
279
268
  }
280
- if (info.done) {
281
- resolve(value);
282
- } else {
283
- Promise.resolve(value).then(_next, _throw);
284
- }
269
+ if (info.done) resolve(value);
270
+ else Promise.resolve(value).then(_next, _throw);
285
271
  }
286
272
  function _async_to_generator$1(fn) {
287
273
  return function() {
@@ -299,9 +285,7 @@ function _async_to_generator$1(fn) {
299
285
  };
300
286
  }
301
287
  function _class_call_check$3(instance, Constructor) {
302
- if (!(instance instanceof Constructor)) {
303
- throw new TypeError("Cannot call a class as a function");
304
- }
288
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
305
289
  }
306
290
  function _defineProperties$1(target, props) {
307
291
  for(var i = 0; i < props.length; i++){
@@ -324,9 +308,7 @@ function _define_property$1(obj, key, value) {
324
308
  configurable: true,
325
309
  writable: true
326
310
  });
327
- } else {
328
- obj[key] = value;
329
- }
311
+ } else obj[key] = value;
330
312
  return obj;
331
313
  }
332
314
  function _ts_generator$1(thisArg, body) {
@@ -497,11 +479,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
497
479
  reject(error);
498
480
  return;
499
481
  }
500
- if (info.done) {
501
- resolve(value);
502
- } else {
503
- Promise.resolve(value).then(_next, _throw);
504
- }
482
+ if (info.done) resolve(value);
483
+ else Promise.resolve(value).then(_next, _throw);
505
484
  }
506
485
  function _async_to_generator(fn) {
507
486
  return function() {
@@ -519,9 +498,7 @@ function _async_to_generator(fn) {
519
498
  };
520
499
  }
521
500
  function _class_call_check$2(instance, Constructor) {
522
- if (!(instance instanceof Constructor)) {
523
- throw new TypeError("Cannot call a class as a function");
524
- }
501
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
525
502
  }
526
503
  function _defineProperties(target, props) {
527
504
  for(var i = 0; i < props.length; i++){
@@ -544,9 +521,7 @@ function _define_property(obj, key, value) {
544
521
  configurable: true,
545
522
  writable: true
546
523
  });
547
- } else {
548
- obj[key] = value;
549
- }
524
+ } else obj[key] = value;
550
525
  return obj;
551
526
  }
552
527
  function _ts_generator(thisArg, body) {
@@ -690,11 +665,9 @@ StripeWebhookController = __decorate([
690
665
  ], StripeWebhookController);
691
666
 
692
667
  function _class_call_check$1(instance, Constructor) {
693
- if (!(instance instanceof Constructor)) {
694
- throw new TypeError("Cannot call a class as a function");
695
- }
668
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
696
669
  }
697
- var DEFAULT_STRIPE_API_VERSION = '2026-02-25.clover';
670
+ var DEFAULT_STRIPE_API_VERSION = '2026-08-26.dahlia';
698
671
  /**
699
672
  * Factory that creates a StripeServiceConfig from environment variables.
700
673
  *
@@ -744,9 +717,7 @@ StripeModule = __decorate([
744
717
  ], StripeModule);
745
718
 
746
719
  function _class_call_check(instance, Constructor) {
747
- if (!(instance instanceof Constructor)) {
748
- throw new TypeError("Cannot call a class as a function");
749
- }
720
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
750
721
  }
751
722
  var StripeWebhookModule = function StripeWebhookModule() {
752
723
  _class_call_check(this, StripeWebhookModule);
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@dereekb/nestjs/stripe",
3
- "version": "13.43.0",
3
+ "version": "14.0.0",
4
4
  "type": "module",
5
5
  "peerDependencies": {
6
- "@dereekb/date": "13.43.0",
7
- "@dereekb/model": "13.43.0",
8
- "@dereekb/nestjs": "13.43.0",
9
- "@dereekb/rxjs": "13.43.0",
10
- "@dereekb/util": "13.43.0",
11
- "@nestjs/common": "^11.1.19",
12
- "@nestjs/config": "^4.0.4",
6
+ "@dereekb/date": "14.0.0",
7
+ "@dereekb/model": "14.0.0",
8
+ "@dereekb/nestjs": "14.0.0",
9
+ "@dereekb/rxjs": "14.0.0",
10
+ "@dereekb/util": "14.0.0",
11
+ "@nestjs/common": "^12.0.1",
12
+ "@nestjs/config": "^12.0.0",
13
13
  "express": "^5.2.1",
14
- "stripe": "^20.4.1"
14
+ "stripe": "^22.6.1"
15
15
  },
16
16
  "exports": {
17
17
  "./package.json": "./package.json",
@@ -2,3 +2,4 @@ export * from './webhook';
2
2
  export * from './stripe.module';
3
3
  export * from './stripe.api';
4
4
  export * from './stripe.config';
5
+ export * from './stripe.type';
@@ -1,4 +1,4 @@
1
- import Stripe from 'stripe';
1
+ import { Stripe } from 'stripe';
2
2
  import { type Request } from 'express';
3
3
  import { StripeServiceConfig } from './stripe.config';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type Stripe from 'stripe';
1
+ import { type Stripe } from 'stripe';
2
2
  export interface StripeServiceApiConfig {
3
3
  readonly secret: string;
4
4
  readonly webhookSecret: string;
@@ -1,13 +1,21 @@
1
- declare module 'stripe' {
2
- namespace Stripe {
3
- type TypedEventDataObject<T> = T;
4
- interface TypedEventData<T extends object> extends Stripe.Event.Data {
5
- object: T;
6
- previous_attributes?: Partial<T>;
7
- }
8
- interface TypedEvent<T extends object = object> extends Stripe.EventBase {
9
- data: TypedEventData<T>;
10
- type: Exclude<Stripe.WebhookEndpointCreateParams.EnabledEvent, '*'>;
11
- }
12
- }
1
+ import { type Stripe } from 'stripe';
2
+ /**
3
+ * The data object carried by a StripeTypedEvent.
4
+ *
5
+ * Marks the point where an untyped Stripe.Event.Data.Object has been narrowed to a known type.
6
+ */
7
+ export type StripeTypedEventDataObject<T> = T;
8
+ /**
9
+ * Stripe.Event.Data narrowed to a known data object type.
10
+ */
11
+ export interface StripeTypedEventData<T extends object> extends Stripe.Event.Data {
12
+ object: T;
13
+ previous_attributes?: Partial<T>;
14
+ }
15
+ /**
16
+ * A Stripe.Event narrowed to a known data object type.
17
+ */
18
+ export interface StripeTypedEvent<T extends object = object> extends Stripe.EventBase {
19
+ data: StripeTypedEventData<T>;
20
+ type: Exclude<Stripe.WebhookEndpointCreateParams.EnabledEvent, '*'>;
13
21
  }
@@ -1,6 +1,6 @@
1
1
  import { type HandlerBindAccessor, type HandlerMappedSetFunction, type Handler } from '@dereekb/util';
2
- import type Stripe from 'stripe';
3
- import '../stripe.type';
2
+ import { type Stripe } from 'stripe';
3
+ import { type StripeTypedEventDataObject } from '../stripe.type';
4
4
  export declare enum StripeWebhookEventType {
5
5
  CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = "customer.subscription.trial_will_end",
6
6
  CUSTOMER_SUBSCRIPTION_DELETED = "customer.subscription.deleted",
@@ -28,7 +28,7 @@ export interface StripeWebhookEvent<T> {
28
28
  /**
29
29
  * The relevant data associated with this type of event.
30
30
  */
31
- readonly data: Stripe.TypedEventDataObject<T>;
31
+ readonly data: StripeTypedEventDataObject<T>;
32
32
  }
33
33
  /**
34
34
  * Creates a StripeWebhookEvent and treats the data as the input type.
@@ -46,9 +46,9 @@ export declare function stripeWebhookEvent<T>(event: Stripe.Event): StripeWebhoo
46
46
  * @returns Mapper that converts a raw Stripe.Event into a StripeWebhookEvent using `mapFn`.
47
47
  */
48
48
  export declare function stripeWebhookEventMapper<T>(mapFn: (object: Stripe.Event.Data.Object, event: Stripe.Event) => T): (event: Stripe.Event) => StripeWebhookEvent<T>;
49
- export type StripeCheckoutSessionEventDataObject = Stripe.TypedEventDataObject<Stripe.Checkout.Session>;
50
- export type StripeCustomerSubscriptionEventDataObject = Stripe.TypedEventDataObject<Stripe.Subscription>;
51
- export type StripeSubscriptionScheduleEventDataObject = Stripe.TypedEventDataObject<Stripe.SubscriptionSchedule>;
49
+ export type StripeCheckoutSessionEventDataObject = StripeTypedEventDataObject<Stripe.Checkout.Session>;
50
+ export type StripeCustomerSubscriptionEventDataObject = StripeTypedEventDataObject<Stripe.Subscription>;
51
+ export type StripeSubscriptionScheduleEventDataObject = StripeTypedEventDataObject<Stripe.SubscriptionSchedule>;
52
52
  export type StripeEventHandler = Handler<Stripe.Event, string>;
53
53
  export declare const stripeEventHandlerFactory: import("@dereekb/util").HandlerFactory<Stripe.Event, string, boolean>;
54
54
  export type StripeHandlerMappedSetFunction<T> = HandlerMappedSetFunction<StripeWebhookEvent<T>>;
@@ -1,4 +1,4 @@
1
- import type Stripe from 'stripe';
1
+ import { type Stripe } from 'stripe';
2
2
  import { type Request } from 'express';
3
3
  import { StripeApi } from '../stripe.api';
4
4
  import { type Handler } from '@dereekb/util';