@rdlabo/workers-hono-kit 0.3.7 → 0.4.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.
Files changed (57) hide show
  1. package/README.md +34 -1
  2. package/dist/business-time/index.d.ts +49 -0
  3. package/dist/business-time/index.js +149 -0
  4. package/dist/business-time/types.d.ts +9 -0
  5. package/dist/business-time/types.js +5 -0
  6. package/dist/db/columns.d.ts +46 -0
  7. package/dist/db/columns.js +36 -0
  8. package/dist/db/connection.js +2 -1
  9. package/dist/db/decimal.d.ts +27 -0
  10. package/dist/db/decimal.js +50 -0
  11. package/dist/db/index.d.ts +4 -1
  12. package/dist/db/index.js +3 -1
  13. package/dist/db/jst.d.ts +10 -72
  14. package/dist/db/jst.js +10 -82
  15. package/dist/testing/index.d.ts +2 -0
  16. package/dist/testing/index.js +2 -0
  17. package/dist/testing/workers-bindings.d.ts +49 -0
  18. package/dist/testing/workers-bindings.js +62 -0
  19. package/package.json +7 -3
  20. package/scripts/db-baseline.mjs +0 -0
  21. package/src/ai/gateway.ts +0 -120
  22. package/src/aws/cloudfront.ts +0 -105
  23. package/src/aws/secrets-manager.ts +0 -112
  24. package/src/cache/kv-cache.ts +0 -316
  25. package/src/db/connection.ts +0 -107
  26. package/src/db/database.ts +0 -269
  27. package/src/db/index.ts +0 -39
  28. package/src/db/jst.ts +0 -122
  29. package/src/db/migrate.ts +0 -155
  30. package/src/db/orm-config.ts +0 -171
  31. package/src/db/retry.ts +0 -43
  32. package/src/db/write-result.ts +0 -46
  33. package/src/firebase/firebase-verifier.ts +0 -76
  34. package/src/firebase/identity-toolkit.ts +0 -179
  35. package/src/firebase/jose-firebase-verifier.ts +0 -159
  36. package/src/firebase/remote-verifier.ts +0 -98
  37. package/src/http/app-env.ts +0 -53
  38. package/src/http/app-info.ts +0 -38
  39. package/src/http/execution-context.ts +0 -11
  40. package/src/http/http-status.ts +0 -71
  41. package/src/http/nest-error.ts +0 -207
  42. package/src/http/trailing-slash.ts +0 -28
  43. package/src/http/user-protocol.ts +0 -36
  44. package/src/index.ts +0 -77
  45. package/src/middleware/auth.ts +0 -129
  46. package/src/middleware/finalize-response.ts +0 -90
  47. package/src/middleware/validation.ts +0 -158
  48. package/src/middleware/zod-coerce.ts +0 -124
  49. package/src/queue/consumer.ts +0 -146
  50. package/src/queue/send.ts +0 -129
  51. package/src/stripe/client.ts +0 -85
  52. package/src/testing/auth.ts +0 -110
  53. package/src/testing/configurable-fake.ts +0 -45
  54. package/src/testing/db.ts +0 -194
  55. package/src/testing/fakes.ts +0 -153
  56. package/src/testing/index.ts +0 -31
  57. package/src/testing/stripe-fixtures.ts +0 -175
@@ -1,175 +0,0 @@
1
- import type Stripe from 'stripe';
2
-
3
- /**
4
- * Test fixture factories for Stripe objects.
5
- *
6
- * The real SDK types are enormous, so each factory builds only the fields tests typically read,
7
- * fills them with reasonable defaults, lets you override via `over`, and casts to the Stripe type
8
- * once at the end. This consolidates the duplicated hand-built dummy `PaymentIntent`/`Event`/... that
9
- * billing tests tend to reconstruct in every project.
10
- */
11
-
12
- /**
13
- * Build a fake Stripe `ApiList` wrapping the given data.
14
- *
15
- * @remarks Defaults: `object: 'list'`, `has_more: false`, `url: '/v1/_test'`.
16
- * @typeParam T - Element type of the list.
17
- * @param data - Items to place in `data`.
18
- * @param over - Field overrides merged last.
19
- * @returns A `Stripe.ApiList<T>` fixture.
20
- * @example
21
- * ```ts
22
- * const list = fakeApiList([fakePaymentIntent()]);
23
- * ```
24
- */
25
- export function fakeApiList<T>(data: T[], over: Partial<Stripe.ApiList<T>> = {}): Stripe.ApiList<T> {
26
- return {
27
- object: 'list',
28
- data,
29
- has_more: false,
30
- url: '/v1/_test',
31
- ...over,
32
- };
33
- }
34
-
35
- /**
36
- * Build a fake Stripe `PaymentIntent`.
37
- *
38
- * @remarks Defaults: `id: 'pi_test_1'`, `object: 'payment_intent'`, `amount: 1000`, `currency: 'jpy'`,
39
- * `status: 'succeeded'`, `created: 1_700_000_000`.
40
- * @param over - Field overrides merged last.
41
- * @returns A `Stripe.PaymentIntent` fixture.
42
- * @example
43
- * ```ts
44
- * const pi = fakePaymentIntent({ status: 'requires_payment_method' });
45
- * ```
46
- */
47
- export function fakePaymentIntent(over: Partial<Stripe.PaymentIntent> = {}): Stripe.PaymentIntent {
48
- return {
49
- id: 'pi_test_1',
50
- object: 'payment_intent',
51
- amount: 1000,
52
- currency: 'jpy',
53
- status: 'succeeded',
54
- created: 1_700_000_000,
55
- ...over,
56
- } as Stripe.PaymentIntent;
57
- }
58
-
59
- /**
60
- * Build a fake Stripe webhook `Event` wrapping the given payload.
61
- *
62
- * @remarks Defaults: `id: 'evt_test_1'`, `object: 'event'`, `api_version: '2024-06-20'`,
63
- * `created: 1_700_000_000`, `livemode: false`. The payload is placed at `data.object`.
64
- * @param type - Event type (e.g. `'payment_intent.succeeded'`), assigned to `type`.
65
- * @param dataObject - The object placed at `data.object`.
66
- * @param over - Field overrides merged last.
67
- * @returns A `Stripe.Event` fixture.
68
- * @example
69
- * ```ts
70
- * const event = fakeStripeEvent('payment_intent.succeeded', fakePaymentIntent());
71
- * ```
72
- */
73
- export function fakeStripeEvent(type: string, dataObject: unknown, over: Partial<Stripe.Event> = {}): Stripe.Event {
74
- return {
75
- id: 'evt_test_1',
76
- object: 'event',
77
- api_version: '2024-06-20',
78
- created: 1_700_000_000,
79
- livemode: false,
80
- type,
81
- data: { object: dataObject },
82
- ...over,
83
- } as Stripe.Event;
84
- }
85
-
86
- /**
87
- * Build a fake Stripe `Checkout.Session`.
88
- *
89
- * @remarks Defaults: `id: 'cs_test_1'`, `object: 'checkout.session'`,
90
- * `url: 'https://checkout.stripe.test/cs_test_1'`, `mode: 'subscription'`, `status: 'open'`.
91
- * @param over - Field overrides merged last.
92
- * @returns A `Stripe.Checkout.Session` fixture.
93
- * @example
94
- * ```ts
95
- * const session = fakeCheckoutSession({ status: 'complete' });
96
- * ```
97
- */
98
- export function fakeCheckoutSession(over: Partial<Stripe.Checkout.Session> = {}): Stripe.Checkout.Session {
99
- return {
100
- id: 'cs_test_1',
101
- object: 'checkout.session',
102
- url: 'https://checkout.stripe.test/cs_test_1',
103
- mode: 'subscription',
104
- status: 'open',
105
- ...over,
106
- } as Stripe.Checkout.Session;
107
- }
108
-
109
- /**
110
- * Build a fake Stripe `Customer`.
111
- *
112
- * @remarks Defaults: `id: 'cus_test_1'`, `object: 'customer'`, `created: 1_700_000_000`,
113
- * `livemode: false`.
114
- * @param over - Field overrides merged last.
115
- * @returns A `Stripe.Customer` fixture.
116
- * @example
117
- * ```ts
118
- * const customer = fakeCustomer({ email: 'a@example.com' });
119
- * ```
120
- */
121
- export function fakeCustomer(over: Partial<Stripe.Customer> = {}): Stripe.Customer {
122
- return {
123
- id: 'cus_test_1',
124
- object: 'customer',
125
- created: 1_700_000_000,
126
- livemode: false,
127
- ...over,
128
- } as Stripe.Customer;
129
- }
130
-
131
- /**
132
- * Build a fake Stripe `Price`.
133
- *
134
- * @remarks Defaults: `id: 'price_test_1'`, `object: 'price'`, `active: true`, `currency: 'jpy'`,
135
- * `unit_amount: 1000`.
136
- * @param over - Field overrides merged last.
137
- * @returns A `Stripe.Price` fixture.
138
- * @example
139
- * ```ts
140
- * const price = fakePrice({ unit_amount: 2000 });
141
- * ```
142
- */
143
- export function fakePrice(over: Partial<Stripe.Price> = {}): Stripe.Price {
144
- return {
145
- id: 'price_test_1',
146
- object: 'price',
147
- active: true,
148
- currency: 'jpy',
149
- unit_amount: 1000,
150
- ...over,
151
- } as Stripe.Price;
152
- }
153
-
154
- /**
155
- * Build a fake Stripe `Subscription`.
156
- *
157
- * @remarks Defaults: `id: 'sub_test_1'`, `object: 'subscription'`, `status: 'active'`,
158
- * `customer: 'cus_test_1'`, `created: 1_700_000_000`.
159
- * @param over - Field overrides merged last.
160
- * @returns A `Stripe.Subscription` fixture.
161
- * @example
162
- * ```ts
163
- * const sub = fakeSubscription({ status: 'canceled' });
164
- * ```
165
- */
166
- export function fakeSubscription(over: Partial<Stripe.Subscription> = {}): Stripe.Subscription {
167
- return {
168
- id: 'sub_test_1',
169
- object: 'subscription',
170
- status: 'active',
171
- customer: 'cus_test_1',
172
- created: 1_700_000_000,
173
- ...over,
174
- } as Stripe.Subscription;
175
- }