@useairfoil/producer-stripe 0.0.2 → 0.0.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.
- package/LICENSE.txt +201 -0
- package/dist/index.d.mts +26 -26
- package/dist/index.mjs +1 -1
- package/dist/main.mjs +6 -4
- package/dist/main.mjs.map +1 -1
- package/dist/{src-DXjXItdQ.mjs → src-DXKdOBgM.mjs} +210 -217
- package/dist/src-DXKdOBgM.mjs.map +1 -0
- package/package.json +18 -18
- package/src/create-table.ts +6 -1
- package/src/main.ts +8 -2
- package/src/schemas/charges.ts +98 -44
- package/src/schemas/customers.ts +47 -21
- package/src/schemas/invoices.ts +86 -44
- package/src/schemas/prices.ts +48 -24
- package/src/schemas/products.ts +37 -17
- package/src/schemas/refunds.ts +30 -16
- package/src/schemas/shared.ts +33 -26
- package/src/schemas/subscriptions.ts +96 -42
- package/src/start.ts +2 -2
- package/dist/src-DXjXItdQ.mjs.map +0 -1
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 GNC Labs Limited
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
193
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
194
|
+
License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
199
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
200
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
201
|
+
specific language governing permissions and limitations under the License.
|
package/dist/index.d.mts
CHANGED
|
@@ -1400,20 +1400,19 @@ export declare const ChargeSchema: Schema.Struct<{
|
|
|
1400
1400
|
type Charge = Schema.Schema.Type<typeof ChargeSchema>;
|
|
1401
1401
|
export declare const ChargeObjectSchema: Schema.Struct<{
|
|
1402
1402
|
readonly id: Schema.String;
|
|
1403
|
-
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1404
|
-
readonly status: Schema.String;
|
|
1405
1403
|
readonly description: Schema.NullOr<Schema.String>;
|
|
1404
|
+
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1406
1405
|
readonly livemode: Schema.Boolean;
|
|
1407
|
-
readonly customer: Schema.NullOr<Schema.String>;
|
|
1408
|
-
readonly currency: Schema.String;
|
|
1409
|
-
readonly metadata: Schema.decodeTo<Schema.$ReadonlyMap<Schema.String, Schema.String>, Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
1410
1406
|
readonly amount: Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>;
|
|
1411
1407
|
readonly amount_captured: Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>;
|
|
1412
1408
|
readonly amount_refunded: Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>;
|
|
1409
|
+
readonly currency: Schema.String;
|
|
1410
|
+
readonly status: Schema.String;
|
|
1413
1411
|
readonly paid: Schema.Boolean;
|
|
1414
1412
|
readonly captured: Schema.Boolean;
|
|
1415
1413
|
readonly refunded: Schema.Boolean;
|
|
1416
1414
|
readonly disputed: Schema.Boolean;
|
|
1415
|
+
readonly customer: Schema.NullOr<Schema.String>;
|
|
1417
1416
|
readonly payment_intent: Schema.NullOr<Schema.String>;
|
|
1418
1417
|
readonly payment_method: Schema.NullOr<Schema.String>;
|
|
1419
1418
|
readonly balance_transaction: Schema.NullOr<Schema.String>;
|
|
@@ -1438,6 +1437,7 @@ export declare const ChargeObjectSchema: Schema.Struct<{
|
|
|
1438
1437
|
readonly risk_level: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
1439
1438
|
readonly seller_message: Schema.NullOr<Schema.String>;
|
|
1440
1439
|
}>>;
|
|
1440
|
+
readonly metadata: Schema.decodeTo<Schema.$ReadonlyMap<Schema.String, Schema.String>, Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
1441
1441
|
readonly billing_details: Schema.Struct<{
|
|
1442
1442
|
readonly name: Schema.NullOr<Schema.String>;
|
|
1443
1443
|
readonly email: Schema.NullOr<Schema.String>;
|
|
@@ -1499,13 +1499,13 @@ export declare const CustomerSchema: Schema.Struct<{
|
|
|
1499
1499
|
type Customer = Schema.Schema.Type<typeof CustomerSchema>;
|
|
1500
1500
|
export declare const CustomerObjectSchema: Schema.Struct<{
|
|
1501
1501
|
readonly id: Schema.String;
|
|
1502
|
-
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1503
1502
|
readonly description: Schema.NullOr<Schema.String>;
|
|
1503
|
+
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1504
1504
|
readonly livemode: Schema.Boolean;
|
|
1505
1505
|
readonly currency: Schema.NullOr<Schema.String>;
|
|
1506
1506
|
readonly metadata: Schema.decodeTo<Schema.$ReadonlyMap<Schema.String, Schema.String>, Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
1507
|
-
readonly test_clock: Schema.NullOr<Schema.String>;
|
|
1508
1507
|
readonly name: Schema.NullOr<Schema.String>;
|
|
1508
|
+
readonly email: Schema.NullOr<Schema.String>;
|
|
1509
1509
|
readonly phone: Schema.NullOr<Schema.String>;
|
|
1510
1510
|
readonly address: Schema.NullOr<Schema.Struct<{
|
|
1511
1511
|
readonly line1: Schema.NullOr<Schema.String>;
|
|
@@ -1515,7 +1515,6 @@ export declare const CustomerObjectSchema: Schema.Struct<{
|
|
|
1515
1515
|
readonly postal_code: Schema.NullOr<Schema.String>;
|
|
1516
1516
|
readonly country: Schema.NullOr<Schema.String>;
|
|
1517
1517
|
}>>;
|
|
1518
|
-
readonly email: Schema.NullOr<Schema.String>;
|
|
1519
1518
|
readonly balance: Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>;
|
|
1520
1519
|
readonly delinquent: Schema.NullOr<Schema.Boolean>;
|
|
1521
1520
|
readonly tax_exempt: Schema.NullOr<Schema.String>;
|
|
@@ -1523,6 +1522,7 @@ export declare const CustomerObjectSchema: Schema.Struct<{
|
|
|
1523
1522
|
readonly invoice_settings: Schema.Struct<{
|
|
1524
1523
|
readonly default_payment_method: Schema.NullOr<Schema.String>;
|
|
1525
1524
|
}>;
|
|
1525
|
+
readonly test_clock: Schema.NullOr<Schema.String>;
|
|
1526
1526
|
readonly shipping: Schema.NullOr<Schema.Struct<{
|
|
1527
1527
|
readonly name: Schema.String;
|
|
1528
1528
|
readonly phone: Schema.NullOr<Schema.String>;
|
|
@@ -1619,17 +1619,20 @@ export declare const InvoiceObjectSchema: Schema.Struct<{
|
|
|
1619
1619
|
readonly number: Schema.NullOr<Schema.String>;
|
|
1620
1620
|
readonly id: Schema.String;
|
|
1621
1621
|
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1622
|
-
readonly status: Schema.NullOr<Schema.String>;
|
|
1623
1622
|
readonly livemode: Schema.Boolean;
|
|
1623
|
+
readonly currency: Schema.String;
|
|
1624
|
+
readonly status: Schema.NullOr<Schema.String>;
|
|
1624
1625
|
readonly customer: Schema.NullOr<Schema.String>;
|
|
1626
|
+
readonly metadata: Schema.decodeTo<Schema.$ReadonlyMap<Schema.String, Schema.String>, Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
1627
|
+
readonly test_clock: Schema.NullOr<Schema.String>;
|
|
1625
1628
|
readonly customer_account: Schema.NullOr<Schema.String>;
|
|
1629
|
+
readonly collection_method: Schema.String;
|
|
1626
1630
|
readonly parent: Schema.NullOr<Schema.Struct<{
|
|
1627
1631
|
readonly type: Schema.String;
|
|
1628
1632
|
readonly subscription_details: Schema.NullOr<Schema.Struct<{
|
|
1629
1633
|
readonly subscription: Schema.String;
|
|
1630
1634
|
}>>;
|
|
1631
1635
|
}>>;
|
|
1632
|
-
readonly currency: Schema.String;
|
|
1633
1636
|
readonly subtotal: Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>;
|
|
1634
1637
|
readonly total: Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>;
|
|
1635
1638
|
readonly total_excluding_tax: Schema.NullOr<Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>>;
|
|
@@ -1639,7 +1642,6 @@ export declare const InvoiceObjectSchema: Schema.Struct<{
|
|
|
1639
1642
|
readonly amount_overpaid: Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>;
|
|
1640
1643
|
readonly attempt_count: Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>;
|
|
1641
1644
|
readonly billing_reason: Schema.NullOr<Schema.String>;
|
|
1642
|
-
readonly collection_method: Schema.String;
|
|
1643
1645
|
readonly due_date: Schema.NullOr<Schema.decodeTo<Schema.Date, Schema.Int, never, never>>;
|
|
1644
1646
|
readonly period_start: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1645
1647
|
readonly period_end: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
@@ -1650,8 +1652,6 @@ export declare const InvoiceObjectSchema: Schema.Struct<{
|
|
|
1650
1652
|
readonly voided_at: Schema.NullOr<Schema.decodeTo<Schema.Date, Schema.Int, never, never>>;
|
|
1651
1653
|
readonly marked_uncollectible_at: Schema.NullOr<Schema.decodeTo<Schema.Date, Schema.Int, never, never>>;
|
|
1652
1654
|
}>;
|
|
1653
|
-
readonly metadata: Schema.decodeTo<Schema.$ReadonlyMap<Schema.String, Schema.String>, Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
1654
|
-
readonly test_clock: Schema.NullOr<Schema.String>;
|
|
1655
1655
|
readonly customer_email: Schema.NullOr<Schema.String>;
|
|
1656
1656
|
readonly customer_name: Schema.NullOr<Schema.String>;
|
|
1657
1657
|
readonly customer_phone: Schema.NullOr<Schema.String>;
|
|
@@ -1707,10 +1707,10 @@ export declare const PriceSchema: Schema.Struct<{
|
|
|
1707
1707
|
type Price = Schema.Schema.Type<typeof PriceSchema>;
|
|
1708
1708
|
export declare const PriceObjectSchema: Schema.Struct<{
|
|
1709
1709
|
readonly id: Schema.String;
|
|
1710
|
-
readonly type: Schema.String;
|
|
1711
1710
|
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1712
1711
|
readonly livemode: Schema.Boolean;
|
|
1713
1712
|
readonly currency: Schema.String;
|
|
1713
|
+
readonly type: Schema.String;
|
|
1714
1714
|
readonly metadata: Schema.decodeTo<Schema.$ReadonlyMap<Schema.String, Schema.String>, Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
1715
1715
|
readonly active: Schema.Boolean;
|
|
1716
1716
|
readonly product: Schema.String;
|
|
@@ -1752,8 +1752,8 @@ export declare const ProductSchema: Schema.Struct<{
|
|
|
1752
1752
|
type Product = Schema.Schema.Type<typeof ProductSchema>;
|
|
1753
1753
|
export declare const ProductObjectSchema: Schema.Struct<{
|
|
1754
1754
|
readonly id: Schema.String;
|
|
1755
|
-
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1756
1755
|
readonly description: Schema.NullOr<Schema.String>;
|
|
1756
|
+
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1757
1757
|
readonly livemode: Schema.Boolean;
|
|
1758
1758
|
readonly metadata: Schema.decodeTo<Schema.$ReadonlyMap<Schema.String, Schema.String>, Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
1759
1759
|
readonly name: Schema.String;
|
|
@@ -1789,15 +1789,15 @@ type Refund = Schema.Schema.Type<typeof RefundSchema>;
|
|
|
1789
1789
|
export declare const RefundObjectSchema: Schema.Struct<{
|
|
1790
1790
|
readonly id: Schema.String;
|
|
1791
1791
|
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1792
|
+
readonly amount: Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>;
|
|
1793
|
+
readonly currency: Schema.String;
|
|
1792
1794
|
readonly status: Schema.NullOr<Schema.String>;
|
|
1793
|
-
readonly reason: Schema.NullOr<Schema.String>;
|
|
1794
1795
|
readonly customer: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
1795
|
-
readonly customer_account: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
1796
|
-
readonly currency: Schema.String;
|
|
1797
|
-
readonly metadata: Schema.decodeTo<Schema.$ReadonlyMap<Schema.String, Schema.String>, Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
1798
|
-
readonly amount: Schema.decodeTo<Schema.BigInt, Schema.Int, never, never>;
|
|
1799
1796
|
readonly payment_intent: Schema.NullOr<Schema.String>;
|
|
1800
1797
|
readonly balance_transaction: Schema.NullOr<Schema.String>;
|
|
1798
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
1799
|
+
readonly metadata: Schema.decodeTo<Schema.$ReadonlyMap<Schema.String, Schema.String>, Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
1800
|
+
readonly customer_account: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
1801
1801
|
readonly pending_reason: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
1802
1802
|
readonly failure_reason: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
1803
1803
|
readonly charge: Schema.NullOr<Schema.String>;
|
|
@@ -1879,17 +1879,17 @@ export declare const SubscriptionObjectSchema: Schema.Struct<{
|
|
|
1879
1879
|
readonly has_more: Schema.Boolean;
|
|
1880
1880
|
}>;
|
|
1881
1881
|
readonly id: Schema.String;
|
|
1882
|
-
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1883
|
-
readonly status: Schema.String;
|
|
1884
1882
|
readonly description: Schema.NullOr<Schema.String>;
|
|
1883
|
+
readonly created: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1885
1884
|
readonly livemode: Schema.Boolean;
|
|
1886
|
-
readonly customer: Schema.NullOr<Schema.String>;
|
|
1887
|
-
readonly customer_account: Schema.NullOr<Schema.String>;
|
|
1888
1885
|
readonly currency: Schema.String;
|
|
1889
|
-
readonly
|
|
1886
|
+
readonly status: Schema.String;
|
|
1887
|
+
readonly customer: Schema.NullOr<Schema.String>;
|
|
1890
1888
|
readonly metadata: Schema.decodeTo<Schema.$ReadonlyMap<Schema.String, Schema.String>, Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
1891
|
-
readonly test_clock: Schema.NullOr<Schema.String>;
|
|
1892
1889
|
readonly default_payment_method: Schema.NullOr<Schema.String>;
|
|
1890
|
+
readonly test_clock: Schema.NullOr<Schema.String>;
|
|
1891
|
+
readonly customer_account: Schema.NullOr<Schema.String>;
|
|
1892
|
+
readonly collection_method: Schema.String;
|
|
1893
1893
|
readonly start_date: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1894
1894
|
readonly billing_cycle_anchor: Schema.decodeTo<Schema.Date, Schema.Int, never, never>;
|
|
1895
1895
|
readonly cancel_at: Schema.NullOr<Schema.decodeTo<Schema.Date, Schema.Int, never, never>>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { manifest } from "./manifest.mjs";
|
|
2
|
-
import { _ as CustomerSchema, a as SubscriptionItemSchema, b as ChargeSchema, c as RefundObjectSchema, d as ProductSchema, f as PriceObjectSchema, g as CustomerObjectSchema, h as InvoiceSchema, i as webhookPath, l as RefundSchema, m as InvoiceObjectSchema, n as connector_exports, o as SubscriptionObjectSchema, p as PriceSchema, s as SubscriptionSchema, u as ProductObjectSchema, v as StripeEventSchema, x as client_exports, y as ChargeObjectSchema } from "./src-
|
|
2
|
+
import { _ as CustomerSchema, a as SubscriptionItemSchema, b as ChargeSchema, c as RefundObjectSchema, d as ProductSchema, f as PriceObjectSchema, g as CustomerObjectSchema, h as InvoiceSchema, i as webhookPath, l as RefundSchema, m as InvoiceObjectSchema, n as connector_exports, o as SubscriptionObjectSchema, p as PriceSchema, s as SubscriptionSchema, u as ProductObjectSchema, v as StripeEventSchema, x as client_exports, y as ChargeObjectSchema } from "./src-DXKdOBgM.mjs";
|
|
3
3
|
export { ChargeObjectSchema, ChargeSchema, CustomerObjectSchema, CustomerSchema, InvoiceObjectSchema, InvoiceSchema, PriceObjectSchema, PriceSchema, ProductObjectSchema, ProductSchema, RefundObjectSchema, RefundSchema, client_exports as StripeClient, connector_exports as StripeConnector, StripeEventSchema, SubscriptionItemSchema, SubscriptionObjectSchema, SubscriptionSchema, manifest, webhookPath };
|
package/dist/main.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { StripeConfigDef } from "./manifest.mjs";
|
|
3
|
-
import { _ as CustomerSchema, b as ChargeSchema, d as ProductSchema, h as InvoiceSchema, l as RefundSchema, p as PriceSchema, r as layerConfig, s as SubscriptionSchema, t as StripeConnector } from "./src-
|
|
3
|
+
import { _ as CustomerSchema, b as ChargeSchema, d as ProductSchema, h as InvoiceSchema, l as RefundSchema, p as PriceSchema, r as layerConfig, s as SubscriptionSchema, t as StripeConnector } from "./src-DXKdOBgM.mjs";
|
|
4
4
|
import { ConnectorApp, Demo, Ingestor, RuntimeConfig, StateStore, Telemetry } from "@useairfoil/connector-kit";
|
|
5
5
|
import { Config, Duration, Effect, Layer, Logger, Schema } from "effect";
|
|
6
6
|
import { FetchHttpClient } from "effect/http";
|
|
@@ -8,7 +8,7 @@ import { NodeRuntime, NodeServices } from "@effect/platform-node";
|
|
|
8
8
|
import { Command } from "effect/cli";
|
|
9
9
|
import { PgClient } from "@effect/sql-pg";
|
|
10
10
|
//#region package.json
|
|
11
|
-
var version = "0.0.
|
|
11
|
+
var version = "0.0.3";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/tables.ts
|
|
14
14
|
const tableSchemas = {
|
|
@@ -23,6 +23,7 @@ const tableSchemas = {
|
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/create-table.ts
|
|
25
25
|
const createTableCommand = ConnectorApp.makeCreateTableCommand(tableSchemas);
|
|
26
|
+
const setupCommand = ConnectorApp.makeSetupCommand(tableSchemas).pipe(Command.provide(RuntimeConfig.layerHosted()));
|
|
26
27
|
//#endregion
|
|
27
28
|
//#region src/demo/shared.ts
|
|
28
29
|
const hour = Duration.toMillis(Duration.hours(1));
|
|
@@ -561,12 +562,13 @@ const StateStoreLayer = StateStore.layerSql().pipe(Layer.provide(PostgresLayer))
|
|
|
561
562
|
const startCommand = Command.make("start", {}, () => Effect.gen(function* () {
|
|
562
563
|
const port = yield* RuntimeConfig.httpPort;
|
|
563
564
|
const entrypoint = yield* StripeConnector;
|
|
564
|
-
return yield* ConnectorApp.start(entrypoint, { port }).pipe(Effect.provide(Ingestor.
|
|
565
|
-
}).pipe(Effect.annotateLogs({ component: "stripe" }), Effect.provide(Layer.mergeAll(StateStoreLayer, ConnectorLayer, Logger.layer([Logger.consolePretty()]), TelemetryLayer)), Effect.provide(RuntimeConfig.layerHosted()))).pipe(Command.withDescription("Run the
|
|
565
|
+
return yield* ConnectorApp.start(entrypoint, { port }).pipe(Effect.provide(Ingestor.layerArrowFlightConfig(entrypoint)));
|
|
566
|
+
}).pipe(Effect.annotateLogs({ component: "stripe" }), Effect.provide(Layer.mergeAll(StateStoreLayer, ConnectorLayer, Logger.layer([Logger.consolePretty()]), TelemetryLayer)), Effect.provide(RuntimeConfig.layerHosted()))).pipe(Command.withDescription("Run the connector"));
|
|
566
567
|
//#endregion
|
|
567
568
|
//#region src/main.ts
|
|
568
569
|
const BootstrapLayer = Layer.mergeAll(FetchHttpClient.layer, NodeServices.layer);
|
|
569
570
|
const program = Command.make("producer-stripe", {}, () => Effect.void).pipe(Command.withSubcommands([
|
|
571
|
+
setupCommand,
|
|
570
572
|
startCommand,
|
|
571
573
|
sandboxCommand,
|
|
572
574
|
createTableCommand,
|
package/dist/main.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.mjs","names":["ConnectorLayer","StripeConnector.layerConfig","TelemetryLayer","StripeConnector.StripeConnector","StripeConnector.layerConfig","StripeConnector.StripeConnector","packageJson.version"],"sources":["../package.json","../src/tables.ts","../src/create-table.ts","../src/demo/shared.ts","../src/demo/customers.ts","../src/demo/setup.ts","../src/demo/index.ts","../src/sandbox.ts","../src/start.ts","../src/main.ts"],"sourcesContent":["","import type { Schema } from \"effect\";\n\nimport { ChargeSchema } from \"./schemas/charges\";\nimport { CustomerSchema } from \"./schemas/customers\";\nimport { InvoiceSchema } from \"./schemas/invoices\";\nimport { PriceSchema } from \"./schemas/prices\";\nimport { ProductSchema } from \"./schemas/products\";\nimport { RefundSchema } from \"./schemas/refunds\";\nimport { SubscriptionSchema } from \"./schemas/subscriptions\";\n\nexport const tableSchemas: Readonly<Record<string, Schema.Top>> = {\n customers: CustomerSchema,\n products: ProductSchema,\n prices: PriceSchema,\n subscriptions: SubscriptionSchema,\n invoices: InvoiceSchema,\n charges: ChargeSchema,\n refunds: RefundSchema,\n};\n","import { ConnectorApp } from \"@useairfoil/connector-kit\";\n\nimport { tableSchemas } from \"./tables\";\n\nexport const createTableCommand = ConnectorApp.makeCreateTableCommand(tableSchemas);\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport { Duration } from \"effect\";\n\nimport type { Charge } from \"../schemas/charges\";\nimport type { Customer } from \"../schemas/customers\";\nimport type { Invoice } from \"../schemas/invoices\";\nimport type { Refund } from \"../schemas/refunds\";\nimport type { Subscription } from \"../schemas/subscriptions\";\n\nexport const hour = Duration.toMillis(Duration.hours(1));\nexport const day = Duration.toMillis(Duration.days(1));\n\n// A small SaaS catalog. Amounts are monthly, in cents. Yearly prices are ten months.\nexport const catalog = [\n { slug: \"starter\", name: \"Starter\", amount: 2900, seats: false, plan: true },\n { slug: \"team\", name: \"Team\", amount: 1500, seats: true, plan: true },\n { slug: \"business\", name: \"Business\", amount: 3900, seats: true, plan: true },\n { slug: \"enterprise\", name: \"Enterprise\", amount: 99900, seats: false, plan: true },\n { slug: \"storage\", name: \"Extra storage\", amount: 1000, seats: false, plan: false },\n { slug: \"support\", name: \"Priority support\", amount: 19900, seats: false, plan: false },\n { slug: \"analytics\", name: \"Analytics\", amount: 4900, seats: false, plan: false },\n { slug: \"sso\", name: \"Single sign-on\", amount: 9900, seats: false, plan: false },\n] as const;\n\ntype CatalogItem = (typeof catalog)[number];\nexport type Currency = \"usd\" | \"eur\";\nexport type Interval = \"month\" | \"year\";\n\n// EUR customers only get monthly prices.\nexport const priceOptions: ReadonlyArray<readonly [Currency, Interval]> = [\n [\"usd\", \"month\"],\n [\"usd\", \"year\"],\n [\"eur\", \"month\"],\n];\n\nexport const productId = (item: CatalogItem) => `prod_demo_${item.slug}`;\n\nexport const priceId = (item: CatalogItem, currency: Currency, interval: Interval) =>\n `price_demo_${item.slug}_${currency}_${interval}`;\n\nexport const unitAmount = (item: CatalogItem, currency: Currency, interval: Interval) => {\n const monthly = currency === \"usd\" ? item.amount : Math.round((item.amount * 0.92) / 100) * 100;\n return BigInt(interval === \"year\" ? monthly * 10 : monthly);\n};\n\n// Stripe stores whole seconds.\nexport const seconds = (time: number) => new Date(Math.floor(time / 1000) * 1000);\n\nexport const addIntervals = (start: Date, interval: Interval, count: number) => {\n const next = new Date(start);\n\n if (interval === \"month\") next.setUTCMonth(next.getUTCMonth() + count);\n else next.setUTCFullYear(next.getUTCFullYear() + count);\n\n return next;\n};\n\n/** Billing period starts from `start`, up to and including the one that holds `until`. */\nexport const periodStarts = (start: Date, interval: Interval, until: Date) => {\n const starts: Array<Date> = [];\n\n for (let next = start; next <= until; next = addIntervals(start, interval, starts.length)) {\n starts.push(next);\n }\n\n return starts;\n};\n\n/** Date helpers for one run. `at` keeps a time from going past now. */\nexport const clock = ({ now }: Demo.DemoContext) => {\n const at = (time: number) => seconds(Math.min(time, now.getTime()));\n return { at };\n};\n\nexport type Rows = {\n readonly customers: Array<Customer>;\n readonly subscriptions: Array<Subscription>;\n readonly invoices: Array<Invoice>;\n readonly charges: Array<Charge>;\n readonly refunds: Array<Refund>;\n};\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport type { SubscriptionItem } from \"../schemas/subscriptions\";\n\nimport {\n addIntervals,\n catalog,\n clock,\n type Currency,\n day,\n hour,\n type Interval,\n periodStarts,\n priceId,\n productId,\n type Rows,\n seconds,\n unitAmount,\n} from \"./shared\";\n\n/** One group is one customer with their subscriptions, invoices, charges, and refunds. */\nexport const customerRows = (index: number, context: Demo.DemoContext): Rows => {\n const { faker, now } = context;\n const { at } = clock(context);\n\n const rows: Rows = { customers: [], subscriptions: [], invoices: [], charges: [], refunds: [] };\n\n const id = `cus_demo_${index}`;\n\n const currency: Currency = faker.helpers.weightedArrayElement([\n { weight: 7, value: \"usd\" },\n { weight: 3, value: \"eur\" },\n ]);\n\n const firstName = faker.person.firstName();\n const lastName = faker.person.lastName();\n const name = `${firstName} ${lastName}`;\n const email = faker.internet.exampleEmail({ firstName, lastName }).toLowerCase();\n const phone = faker.phone.number({ style: \"international\" });\n const invoicePrefix = faker.string.alphanumeric({ length: 8, casing: \"upper\" });\n\n const country =\n currency === \"usd\" ? \"US\" : faker.helpers.arrayElement([\"DE\", \"FR\", \"NL\", \"ES\", \"IE\"]);\n\n const address = {\n line1: faker.location.streetAddress(),\n line2:\n faker.helpers.maybe(() => faker.location.secondaryAddress(), { probability: 0.2 }) ?? null,\n city: faker.location.city(),\n state: country === \"US\" ? faker.location.state({ abbreviated: true }) : null,\n postal_code: faker.location.zipCode(),\n country,\n };\n\n const card = {\n brand: faker.helpers.arrayElement([\"visa\", \"mastercard\", \"amex\"]),\n country,\n funding: faker.helpers.arrayElement([\"credit\", \"debit\"]),\n last4: faker.string.numeric(4),\n exp_month: BigInt(faker.number.int({ min: 1, max: 12 })),\n exp_year: BigInt(now.getUTCFullYear() + faker.number.int({ min: 1, max: 5 })),\n fingerprint: null,\n };\n\n const customerCreated = at(now.getTime() - faker.number.int({ min: 30 * day, max: 730 * day }));\n\n const subscriptionCount = faker.helpers.weightedArrayElement([\n { weight: 15, value: 0 },\n { weight: 70, value: 1 },\n { weight: 15, value: 2 },\n ]);\n\n for (let s = 0; s < subscriptionCount; s++) {\n const subscriptionId = `sub_demo_${index}_${s}`;\n\n const status = faker.helpers.weightedArrayElement([\n { weight: 70, value: \"active\" },\n { weight: 8, value: \"trialing\" },\n { weight: 7, value: \"past_due\" },\n { weight: 15, value: \"canceled\" },\n ]);\n\n const interval: Interval =\n currency === \"usd\" && faker.datatype.boolean({ probability: 0.25 }) ? \"year\" : \"month\";\n\n const plan = faker.helpers.arrayElement(catalog.filter((item) => item.plan));\n\n const addOn = faker.helpers.maybe(\n () => faker.helpers.arrayElement(catalog.filter((item) => !item.plan)),\n { probability: 0.3 },\n );\n\n const lines = [plan, ...(addOn ? [addOn] : [])].map((item) => ({\n item,\n quantity: BigInt(item.seats ? faker.number.int({ min: 3, max: 40 }) : 1),\n }));\n\n const total = lines.reduce(\n (sum, { item, quantity }) => sum + unitAmount(item, currency, interval) * quantity,\n 0n,\n );\n\n const created =\n status === \"trialing\"\n ? at(now.getTime() - faker.number.int({ min: day, max: 13 * day }))\n : at(customerCreated.getTime() + faker.number.int({ min: 0, max: 20 * day }));\n\n const trialEnd = status === \"trialing\" ? seconds(created.getTime() + 14 * day) : null;\n const anchor = trialEnd ?? created;\n\n // Trials bill nothing yet. Canceled ones stop after some periods.\n const starts = status === \"trialing\" ? [] : periodStarts(anchor, interval, now);\n\n const billed =\n status === \"canceled\" && starts.length > 1\n ? starts.slice(0, faker.number.int({ min: 1, max: starts.length - 1 }))\n : starts;\n\n const canceled = status === \"canceled\" && starts.length > 1;\n // During a trial, the current period is the trial itself.\n const currentStart = billed.at(-1) ?? created;\n const currentEnd = trialEnd ?? addIntervals(currentStart, interval, 1);\n const endedAt = canceled ? currentEnd : null;\n\n const items: Array<SubscriptionItem> = lines.map(({ item, quantity }, k) => ({\n id: `si_demo_${index}_${s}_${k}`,\n created,\n price: { id: priceId(item, currency, interval), product: productId(item) },\n quantity,\n current_period_start: currentStart,\n current_period_end: currentEnd,\n }));\n\n billed.forEach((periodStart, n) => {\n const invoiceId = `in_demo_${index}_${s}_${n}`;\n const unpaid = status === \"past_due\" && n === billed.length - 1;\n const finalized = at(periodStart.getTime() + hour);\n\n rows.invoices.push({\n id: invoiceId,\n version: now,\n created: periodStart,\n livemode: false,\n customer: id,\n customer_account: null,\n parent: {\n type: \"subscription_details\",\n subscription_details: { subscription: subscriptionId },\n },\n status: unpaid ? \"open\" : \"paid\",\n number: `${invoicePrefix}-${String(n + 1).padStart(4, \"0\")}`,\n currency,\n subtotal: total,\n total,\n total_excluding_tax: total,\n amount_due: total,\n amount_paid: unpaid ? 0n : total,\n amount_remaining: unpaid ? total : 0n,\n amount_overpaid: 0n,\n attempt_count: unpaid ? 2n : 1n,\n billing_reason: n === 0 ? \"subscription_create\" : \"subscription_cycle\",\n collection_method: \"charge_automatically\",\n due_date: null,\n period_start: n === 0 ? periodStart : (billed[n - 1] ?? periodStart),\n period_end: periodStart,\n effective_at: finalized,\n status_transitions: {\n finalized_at: finalized,\n paid_at: unpaid ? null : finalized,\n voided_at: null,\n marked_uncollectible_at: null,\n },\n metadata: new Map(),\n test_clock: null,\n customer_email: email,\n customer_name: name,\n customer_phone: phone,\n customer_address: address,\n customer_shipping: null,\n });\n\n const chargeId = `ch_demo_${index}_${s}_${n}`;\n const paymentIntent = `pi_demo_${index}_${s}_${n}`;\n\n const refund =\n unpaid || !faker.datatype.boolean({ probability: 0.05 })\n ? null\n : faker.datatype.boolean({ probability: 0.6 })\n ? total\n : total / 2n;\n\n rows.charges.push({\n id: chargeId,\n version: now,\n created: finalized,\n livemode: false,\n amount: total,\n amount_captured: unpaid ? 0n : total,\n amount_refunded: refund ?? 0n,\n currency,\n status: unpaid ? \"failed\" : \"succeeded\",\n paid: !unpaid,\n captured: !unpaid,\n refunded: refund === total,\n disputed: false,\n customer: id,\n payment_intent: paymentIntent,\n payment_method: null,\n balance_transaction: null,\n description: n === 0 ? \"Subscription creation\" : \"Subscription update\",\n failure_code: unpaid ? \"card_declined\" : null,\n failure_message: unpaid ? \"Your card was declined.\" : null,\n payment_method_details: { type: \"card\", card },\n outcome: unpaid\n ? {\n type: \"issuer_declined\",\n network_status: \"declined_by_network\",\n reason: \"generic_decline\",\n risk_level: \"normal\",\n seller_message: \"The bank did not return any further details with this decline.\",\n }\n : {\n type: \"authorized\",\n network_status: \"approved_by_network\",\n reason: null,\n risk_level: \"normal\",\n seller_message: \"Payment complete.\",\n },\n metadata: new Map(),\n billing_details: { name, email, phone, address },\n receipt_email: email,\n });\n\n if (refund !== null) {\n rows.refunds.push({\n id: `re_demo_${index}_${s}_${n}`,\n version: now,\n created: at(finalized.getTime() + faker.number.int({ min: day, max: 10 * day })),\n amount: refund,\n currency,\n status: \"succeeded\",\n pending_reason: null,\n reason: \"requested_by_customer\",\n failure_reason: null,\n charge: chargeId,\n payment_intent: paymentIntent,\n customer: id,\n customer_account: null,\n balance_transaction: null,\n metadata: new Map(),\n });\n }\n });\n\n rows.subscriptions.push({\n id: subscriptionId,\n version: now,\n created,\n livemode: false,\n customer: id,\n customer_account: null,\n // A canceled subscription without a full period is still active.\n status: status === \"canceled\" && !canceled ? \"active\" : status,\n currency,\n collection_method: \"charge_automatically\",\n start_date: created,\n billing_cycle_anchor: anchor,\n cancel_at: null,\n cancel_at_period_end: false,\n canceled_at: endedAt\n ? at(endedAt.getTime() - faker.number.int({ min: day, max: 20 * day }))\n : null,\n ended_at: endedAt,\n trial_start: trialEnd ? created : null,\n trial_end: trialEnd,\n days_until_due: null,\n default_payment_method: null,\n latest_invoice: billed.length > 0 ? `in_demo_${index}_${s}_${billed.length - 1}` : null,\n schedule: null,\n description: null,\n cancellation_details: endedAt\n ? {\n reason: \"cancellation_requested\",\n feedback: faker.helpers.arrayElement([\n \"too_expensive\",\n \"unused\",\n \"switched_service\",\n null,\n ]),\n comment: null,\n }\n : null,\n pause_collection: null,\n items,\n metadata: new Map(),\n test_clock: null,\n });\n }\n\n rows.customers.push({\n id,\n version: now,\n created: customerCreated,\n livemode: false,\n email,\n name,\n phone,\n description: null,\n currency: subscriptionCount > 0 ? currency : null,\n balance: 0n,\n delinquent: rows.subscriptions.some((subscription) => subscription.status === \"past_due\"),\n tax_exempt: \"none\",\n invoice_prefix: invoicePrefix,\n invoice_settings: { default_payment_method: null },\n address,\n metadata: new Map(),\n test_clock: null,\n shipping: null,\n });\n\n return rows;\n};\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport type { Price } from \"../schemas/prices\";\nimport type { Product } from \"../schemas/products\";\n\nimport { catalog, day, priceId, priceOptions, productId, seconds, unitAmount } from \"./shared\";\n\n/** The catalog of products and prices, written once before any customer. */\nexport const setupRows = ({ now }: Demo.DemoContext) => {\n const created = seconds(now.getTime() - 800 * day);\n\n const productRows: Array<Product> = catalog.map((item) => ({\n id: productId(item),\n version: now,\n created,\n updated: created,\n livemode: false,\n active: true,\n name: item.name,\n description: item.plan ? `${item.name} plan` : `${item.name} add-on`,\n default_price: priceId(item, \"usd\", \"month\"),\n tax_code: \"txcd_10103001\",\n unit_label: item.seats ? \"seat\" : null,\n url: null,\n shippable: null,\n statement_descriptor: null,\n metadata: new Map(),\n }));\n\n const priceRows: Array<Price> = catalog.flatMap((item) =>\n priceOptions.map(([currency, interval]) => ({\n id: priceId(item, currency, interval),\n version: now,\n created,\n livemode: false,\n active: true,\n product: productId(item),\n currency,\n type: \"recurring\",\n billing_scheme: \"per_unit\",\n unit_amount: unitAmount(item, currency, interval),\n unit_amount_decimal: String(unitAmount(item, currency, interval)),\n tiers_mode: null,\n lookup_key: `${item.slug}_${interval}ly_${currency}`,\n nickname: `${item.name} ${interval}ly`,\n tax_behavior: \"exclusive\",\n recurring: {\n interval,\n interval_count: 1n,\n usage_type: \"licensed\",\n meter: null,\n trial_period_days: null,\n },\n metadata: new Map(),\n })),\n );\n\n return { products: productRows, prices: priceRows };\n};\n","import { ConnectorApp, Demo, RuntimeConfig } from \"@useairfoil/connector-kit\";\nimport { Command } from \"effect/cli\";\n\nimport { ChargeSchema } from \"../schemas/charges\";\nimport { CustomerSchema } from \"../schemas/customers\";\nimport { InvoiceSchema } from \"../schemas/invoices\";\nimport { PriceSchema } from \"../schemas/prices\";\nimport { ProductSchema } from \"../schemas/products\";\nimport { RefundSchema } from \"../schemas/refunds\";\nimport { SubscriptionSchema } from \"../schemas/subscriptions\";\nimport { customerRows } from \"./customers\";\nimport { setupRows } from \"./setup\";\n\nexport const demo = Demo.define({\n name: \"producer-stripe\",\n setup: {\n tables: [\n Demo.table({ name: \"products\", rowSchema: ProductSchema, version: \"version\" }),\n Demo.table({ name: \"prices\", rowSchema: PriceSchema, version: \"version\" }),\n ],\n rows: setupRows,\n },\n group: {\n tables: [\n Demo.table({ name: \"customers\", rowSchema: CustomerSchema, version: \"version\" }),\n Demo.table({ name: \"subscriptions\", rowSchema: SubscriptionSchema, version: \"version\" }),\n Demo.table({ name: \"invoices\", rowSchema: InvoiceSchema, version: \"version\" }),\n Demo.table({ name: \"charges\", rowSchema: ChargeSchema, version: \"version\" }),\n Demo.table({ name: \"refunds\", rowSchema: RefundSchema, version: \"version\" }),\n ],\n rows: customerRows,\n },\n});\n\nexport const demoCommand = ConnectorApp.makeDemoCommand(demo).pipe(\n Command.provide(RuntimeConfig.layerHosted()),\n);\n","import {\n ConnectorApp,\n Ingestor,\n RuntimeConfig,\n StateStore,\n Telemetry,\n} from \"@useairfoil/connector-kit\";\nimport { Effect, Layer, Logger } from \"effect\";\nimport { Command } from \"effect/cli\";\n\nimport { StripeConnector } from \"./index\";\n\nconst ConnectorLayer = StripeConnector.layerConfig(StripeConnector.StripeConfigDef.config);\n\nconst TelemetryLayer = Layer.mergeAll(Telemetry.layerOtlp(), Telemetry.layerMetricsConsoleDump());\n\nexport const sandboxCommand = Command.make(\"sandbox\", {}, () =>\n Effect.gen(function* () {\n const port = yield* RuntimeConfig.httpPort;\n const entrypoint = yield* StripeConnector.StripeConnector;\n\n return yield* ConnectorApp.start(entrypoint, { port });\n }).pipe(\n Effect.annotateLogs({ component: \"stripe\" }),\n Effect.provide(\n Layer.mergeAll(\n StateStore.layerMemory,\n Ingestor.layerConsole,\n ConnectorLayer,\n Logger.layer([Logger.consolePretty()]),\n TelemetryLayer,\n ),\n ),\n ),\n).pipe(Command.withDescription(\"Run the connector locally and log ingested data\"));\n","import { PgClient } from \"@effect/sql-pg\";\nimport {\n ConnectorApp,\n Ingestor,\n RuntimeConfig,\n StateStore,\n Telemetry,\n} from \"@useairfoil/connector-kit\";\nimport { Config, Effect, Layer, Logger, Schema } from \"effect\";\nimport { Command } from \"effect/cli\";\n\nimport { StripeConnector } from \"./index\";\n\nconst ConnectorLayer = StripeConnector.layerConfig(StripeConnector.StripeConfigDef.config);\nconst TelemetryLayer = Telemetry.layerOtlp();\nconst PostgresLayer = PgClient.layerConfig({\n url: Config.schema(\n Schema.Redacted(Schema.NonEmptyString),\n RuntimeConfig.PlatformRuntimeKey.postgresConnectionString,\n ),\n maxConnections: Config.succeed(2),\n connectTimeout: Config.succeed(\"5 seconds\"),\n applicationName: Config.succeed(\"airfoil-producer-stripe\"),\n});\nconst StateStoreLayer = StateStore.layerSql().pipe(Layer.provide(PostgresLayer));\n\nexport const startCommand = Command.make(\"start\", {}, () =>\n Effect.gen(function* () {\n const port = yield* RuntimeConfig.httpPort;\n const entrypoint = yield* StripeConnector.StripeConnector;\n\n return yield* ConnectorApp.start(entrypoint, { port }).pipe(\n Effect.provide(Ingestor.layerWingsConfig(entrypoint)),\n );\n }).pipe(\n Effect.annotateLogs({ component: \"stripe\" }),\n Effect.provide(\n Layer.mergeAll(\n StateStoreLayer,\n ConnectorLayer,\n Logger.layer([Logger.consolePretty()]),\n TelemetryLayer,\n ),\n ),\n Effect.provide(RuntimeConfig.layerHosted()),\n ),\n).pipe(Command.withDescription(\"Run the production connector against Wings\"));\n","#!/usr/bin/env node\n\nimport { NodeRuntime, NodeServices } from \"@effect/platform-node\";\nimport { Effect, Layer } from \"effect\";\nimport { Command } from \"effect/cli\";\nimport { FetchHttpClient } from \"effect/http\";\n\nimport packageJson from \"../package.json\";\nimport { createTableCommand } from \"./create-table\";\nimport { demoCommand } from \"./demo\";\nimport { sandboxCommand } from \"./sandbox\";\nimport { startCommand } from \"./start\";\n\nconst BootstrapLayer = Layer.mergeAll(FetchHttpClient.layer, NodeServices.layer);\n\nconst program = Command.make(\"producer-stripe\", {}, () => Effect.void).pipe(\n Command.withSubcommands([startCommand, sandboxCommand, createTableCommand, demoCommand]),\n);\n\nconst cli = Command.run(program, { version: packageJson.version });\n\nNodeRuntime.runMain(cli.pipe(Effect.provide(BootstrapLayer), Effect.scoped));\n"],"mappings":";;;;;;;;;;;;;ACUA,MAAa,eAAqD;CAChE,WAAW;CACX,UAAU;CACV,QAAQ;CACR,eAAe;CACf,UAAU;CACV,SAAS;CACT,SAAS;AACX;;;ACdA,MAAa,qBAAqB,aAAa,uBAAuB,YAAY;;;ACMlF,MAAa,OAAO,SAAS,SAAS,SAAS,MAAM,CAAC,CAAC;AACvD,MAAa,MAAM,SAAS,SAAS,SAAS,KAAK,CAAC,CAAC;AAGrD,MAAa,UAAU;CACrB;EAAE,MAAM;EAAW,MAAM;EAAW,QAAQ;EAAM,OAAO;EAAO,MAAM;CAAK;CAC3E;EAAE,MAAM;EAAQ,MAAM;EAAQ,QAAQ;EAAM,OAAO;EAAM,MAAM;CAAK;CACpE;EAAE,MAAM;EAAY,MAAM;EAAY,QAAQ;EAAM,OAAO;EAAM,MAAM;CAAK;CAC5E;EAAE,MAAM;EAAc,MAAM;EAAc,QAAQ;EAAO,OAAO;EAAO,MAAM;CAAK;CAClF;EAAE,MAAM;EAAW,MAAM;EAAiB,QAAQ;EAAM,OAAO;EAAO,MAAM;CAAM;CAClF;EAAE,MAAM;EAAW,MAAM;EAAoB,QAAQ;EAAO,OAAO;EAAO,MAAM;CAAM;CACtF;EAAE,MAAM;EAAa,MAAM;EAAa,QAAQ;EAAM,OAAO;EAAO,MAAM;CAAM;CAChF;EAAE,MAAM;EAAO,MAAM;EAAkB,QAAQ;EAAM,OAAO;EAAO,MAAM;CAAM;AACjF;AAOA,MAAa,eAA6D;CACxE,CAAC,OAAO,OAAO;CACf,CAAC,OAAO,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QAAQ,IAAI,SAAS,EAAWC,QAAoB,CAAC;AAEjE,YAAY,QAAQ,IAAI,KAAK,OAAO,QAAQ,cAAc,GAAG,OAAO,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"main.mjs","names":["ConnectorLayer","StripeConnector.layerConfig","TelemetryLayer","StripeConnector.StripeConnector","StripeConnector.layerConfig","StripeConnector.StripeConnector","packageJson.version"],"sources":["../package.json","../src/tables.ts","../src/create-table.ts","../src/demo/shared.ts","../src/demo/customers.ts","../src/demo/setup.ts","../src/demo/index.ts","../src/sandbox.ts","../src/start.ts","../src/main.ts"],"sourcesContent":["","import type { Schema } from \"effect\";\n\nimport { ChargeSchema } from \"./schemas/charges\";\nimport { CustomerSchema } from \"./schemas/customers\";\nimport { InvoiceSchema } from \"./schemas/invoices\";\nimport { PriceSchema } from \"./schemas/prices\";\nimport { ProductSchema } from \"./schemas/products\";\nimport { RefundSchema } from \"./schemas/refunds\";\nimport { SubscriptionSchema } from \"./schemas/subscriptions\";\n\nexport const tableSchemas: Readonly<Record<string, Schema.Top>> = {\n customers: CustomerSchema,\n products: ProductSchema,\n prices: PriceSchema,\n subscriptions: SubscriptionSchema,\n invoices: InvoiceSchema,\n charges: ChargeSchema,\n refunds: RefundSchema,\n};\n","import { ConnectorApp, RuntimeConfig } from \"@useairfoil/connector-kit\";\nimport { Command } from \"effect/cli\";\n\nimport { tableSchemas } from \"./tables\";\n\nexport const createTableCommand = ConnectorApp.makeCreateTableCommand(tableSchemas);\n\nexport const setupCommand = ConnectorApp.makeSetupCommand(tableSchemas).pipe(\n Command.provide(RuntimeConfig.layerHosted()),\n);\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport { Duration } from \"effect\";\n\nimport type { Charge } from \"../schemas/charges\";\nimport type { Customer } from \"../schemas/customers\";\nimport type { Invoice } from \"../schemas/invoices\";\nimport type { Refund } from \"../schemas/refunds\";\nimport type { Subscription } from \"../schemas/subscriptions\";\n\nexport const hour = Duration.toMillis(Duration.hours(1));\nexport const day = Duration.toMillis(Duration.days(1));\n\n// A small SaaS catalog. Amounts are monthly, in cents. Yearly prices are ten months.\nexport const catalog = [\n { slug: \"starter\", name: \"Starter\", amount: 2900, seats: false, plan: true },\n { slug: \"team\", name: \"Team\", amount: 1500, seats: true, plan: true },\n { slug: \"business\", name: \"Business\", amount: 3900, seats: true, plan: true },\n { slug: \"enterprise\", name: \"Enterprise\", amount: 99900, seats: false, plan: true },\n { slug: \"storage\", name: \"Extra storage\", amount: 1000, seats: false, plan: false },\n { slug: \"support\", name: \"Priority support\", amount: 19900, seats: false, plan: false },\n { slug: \"analytics\", name: \"Analytics\", amount: 4900, seats: false, plan: false },\n { slug: \"sso\", name: \"Single sign-on\", amount: 9900, seats: false, plan: false },\n] as const;\n\ntype CatalogItem = (typeof catalog)[number];\nexport type Currency = \"usd\" | \"eur\";\nexport type Interval = \"month\" | \"year\";\n\n// EUR customers only get monthly prices.\nexport const priceOptions: ReadonlyArray<readonly [Currency, Interval]> = [\n [\"usd\", \"month\"],\n [\"usd\", \"year\"],\n [\"eur\", \"month\"],\n];\n\nexport const productId = (item: CatalogItem) => `prod_demo_${item.slug}`;\n\nexport const priceId = (item: CatalogItem, currency: Currency, interval: Interval) =>\n `price_demo_${item.slug}_${currency}_${interval}`;\n\nexport const unitAmount = (item: CatalogItem, currency: Currency, interval: Interval) => {\n const monthly = currency === \"usd\" ? item.amount : Math.round((item.amount * 0.92) / 100) * 100;\n return BigInt(interval === \"year\" ? monthly * 10 : monthly);\n};\n\n// Stripe stores whole seconds.\nexport const seconds = (time: number) => new Date(Math.floor(time / 1000) * 1000);\n\nexport const addIntervals = (start: Date, interval: Interval, count: number) => {\n const next = new Date(start);\n\n if (interval === \"month\") next.setUTCMonth(next.getUTCMonth() + count);\n else next.setUTCFullYear(next.getUTCFullYear() + count);\n\n return next;\n};\n\n/** Billing period starts from `start`, up to and including the one that holds `until`. */\nexport const periodStarts = (start: Date, interval: Interval, until: Date) => {\n const starts: Array<Date> = [];\n\n for (let next = start; next <= until; next = addIntervals(start, interval, starts.length)) {\n starts.push(next);\n }\n\n return starts;\n};\n\n/** Date helpers for one run. `at` keeps a time from going past now. */\nexport const clock = ({ now }: Demo.DemoContext) => {\n const at = (time: number) => seconds(Math.min(time, now.getTime()));\n return { at };\n};\n\nexport type Rows = {\n readonly customers: Array<Customer>;\n readonly subscriptions: Array<Subscription>;\n readonly invoices: Array<Invoice>;\n readonly charges: Array<Charge>;\n readonly refunds: Array<Refund>;\n};\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport type { SubscriptionItem } from \"../schemas/subscriptions\";\n\nimport {\n addIntervals,\n catalog,\n clock,\n type Currency,\n day,\n hour,\n type Interval,\n periodStarts,\n priceId,\n productId,\n type Rows,\n seconds,\n unitAmount,\n} from \"./shared\";\n\n/** One group is one customer with their subscriptions, invoices, charges, and refunds. */\nexport const customerRows = (index: number, context: Demo.DemoContext): Rows => {\n const { faker, now } = context;\n const { at } = clock(context);\n\n const rows: Rows = { customers: [], subscriptions: [], invoices: [], charges: [], refunds: [] };\n\n const id = `cus_demo_${index}`;\n\n const currency: Currency = faker.helpers.weightedArrayElement([\n { weight: 7, value: \"usd\" },\n { weight: 3, value: \"eur\" },\n ]);\n\n const firstName = faker.person.firstName();\n const lastName = faker.person.lastName();\n const name = `${firstName} ${lastName}`;\n const email = faker.internet.exampleEmail({ firstName, lastName }).toLowerCase();\n const phone = faker.phone.number({ style: \"international\" });\n const invoicePrefix = faker.string.alphanumeric({ length: 8, casing: \"upper\" });\n\n const country =\n currency === \"usd\" ? \"US\" : faker.helpers.arrayElement([\"DE\", \"FR\", \"NL\", \"ES\", \"IE\"]);\n\n const address = {\n line1: faker.location.streetAddress(),\n line2:\n faker.helpers.maybe(() => faker.location.secondaryAddress(), { probability: 0.2 }) ?? null,\n city: faker.location.city(),\n state: country === \"US\" ? faker.location.state({ abbreviated: true }) : null,\n postal_code: faker.location.zipCode(),\n country,\n };\n\n const card = {\n brand: faker.helpers.arrayElement([\"visa\", \"mastercard\", \"amex\"]),\n country,\n funding: faker.helpers.arrayElement([\"credit\", \"debit\"]),\n last4: faker.string.numeric(4),\n exp_month: BigInt(faker.number.int({ min: 1, max: 12 })),\n exp_year: BigInt(now.getUTCFullYear() + faker.number.int({ min: 1, max: 5 })),\n fingerprint: null,\n };\n\n const customerCreated = at(now.getTime() - faker.number.int({ min: 30 * day, max: 730 * day }));\n\n const subscriptionCount = faker.helpers.weightedArrayElement([\n { weight: 15, value: 0 },\n { weight: 70, value: 1 },\n { weight: 15, value: 2 },\n ]);\n\n for (let s = 0; s < subscriptionCount; s++) {\n const subscriptionId = `sub_demo_${index}_${s}`;\n\n const status = faker.helpers.weightedArrayElement([\n { weight: 70, value: \"active\" },\n { weight: 8, value: \"trialing\" },\n { weight: 7, value: \"past_due\" },\n { weight: 15, value: \"canceled\" },\n ]);\n\n const interval: Interval =\n currency === \"usd\" && faker.datatype.boolean({ probability: 0.25 }) ? \"year\" : \"month\";\n\n const plan = faker.helpers.arrayElement(catalog.filter((item) => item.plan));\n\n const addOn = faker.helpers.maybe(\n () => faker.helpers.arrayElement(catalog.filter((item) => !item.plan)),\n { probability: 0.3 },\n );\n\n const lines = [plan, ...(addOn ? [addOn] : [])].map((item) => ({\n item,\n quantity: BigInt(item.seats ? faker.number.int({ min: 3, max: 40 }) : 1),\n }));\n\n const total = lines.reduce(\n (sum, { item, quantity }) => sum + unitAmount(item, currency, interval) * quantity,\n 0n,\n );\n\n const created =\n status === \"trialing\"\n ? at(now.getTime() - faker.number.int({ min: day, max: 13 * day }))\n : at(customerCreated.getTime() + faker.number.int({ min: 0, max: 20 * day }));\n\n const trialEnd = status === \"trialing\" ? seconds(created.getTime() + 14 * day) : null;\n const anchor = trialEnd ?? created;\n\n // Trials bill nothing yet. Canceled ones stop after some periods.\n const starts = status === \"trialing\" ? [] : periodStarts(anchor, interval, now);\n\n const billed =\n status === \"canceled\" && starts.length > 1\n ? starts.slice(0, faker.number.int({ min: 1, max: starts.length - 1 }))\n : starts;\n\n const canceled = status === \"canceled\" && starts.length > 1;\n // During a trial, the current period is the trial itself.\n const currentStart = billed.at(-1) ?? created;\n const currentEnd = trialEnd ?? addIntervals(currentStart, interval, 1);\n const endedAt = canceled ? currentEnd : null;\n\n const items: Array<SubscriptionItem> = lines.map(({ item, quantity }, k) => ({\n id: `si_demo_${index}_${s}_${k}`,\n created,\n price: { id: priceId(item, currency, interval), product: productId(item) },\n quantity,\n current_period_start: currentStart,\n current_period_end: currentEnd,\n }));\n\n billed.forEach((periodStart, n) => {\n const invoiceId = `in_demo_${index}_${s}_${n}`;\n const unpaid = status === \"past_due\" && n === billed.length - 1;\n const finalized = at(periodStart.getTime() + hour);\n\n rows.invoices.push({\n id: invoiceId,\n version: now,\n created: periodStart,\n livemode: false,\n customer: id,\n customer_account: null,\n parent: {\n type: \"subscription_details\",\n subscription_details: { subscription: subscriptionId },\n },\n status: unpaid ? \"open\" : \"paid\",\n number: `${invoicePrefix}-${String(n + 1).padStart(4, \"0\")}`,\n currency,\n subtotal: total,\n total,\n total_excluding_tax: total,\n amount_due: total,\n amount_paid: unpaid ? 0n : total,\n amount_remaining: unpaid ? total : 0n,\n amount_overpaid: 0n,\n attempt_count: unpaid ? 2n : 1n,\n billing_reason: n === 0 ? \"subscription_create\" : \"subscription_cycle\",\n collection_method: \"charge_automatically\",\n due_date: null,\n period_start: n === 0 ? periodStart : (billed[n - 1] ?? periodStart),\n period_end: periodStart,\n effective_at: finalized,\n status_transitions: {\n finalized_at: finalized,\n paid_at: unpaid ? null : finalized,\n voided_at: null,\n marked_uncollectible_at: null,\n },\n metadata: new Map(),\n test_clock: null,\n customer_email: email,\n customer_name: name,\n customer_phone: phone,\n customer_address: address,\n customer_shipping: null,\n });\n\n const chargeId = `ch_demo_${index}_${s}_${n}`;\n const paymentIntent = `pi_demo_${index}_${s}_${n}`;\n\n const refund =\n unpaid || !faker.datatype.boolean({ probability: 0.05 })\n ? null\n : faker.datatype.boolean({ probability: 0.6 })\n ? total\n : total / 2n;\n\n rows.charges.push({\n id: chargeId,\n version: now,\n created: finalized,\n livemode: false,\n amount: total,\n amount_captured: unpaid ? 0n : total,\n amount_refunded: refund ?? 0n,\n currency,\n status: unpaid ? \"failed\" : \"succeeded\",\n paid: !unpaid,\n captured: !unpaid,\n refunded: refund === total,\n disputed: false,\n customer: id,\n payment_intent: paymentIntent,\n payment_method: null,\n balance_transaction: null,\n description: n === 0 ? \"Subscription creation\" : \"Subscription update\",\n failure_code: unpaid ? \"card_declined\" : null,\n failure_message: unpaid ? \"Your card was declined.\" : null,\n payment_method_details: { type: \"card\", card },\n outcome: unpaid\n ? {\n type: \"issuer_declined\",\n network_status: \"declined_by_network\",\n reason: \"generic_decline\",\n risk_level: \"normal\",\n seller_message: \"The bank did not return any further details with this decline.\",\n }\n : {\n type: \"authorized\",\n network_status: \"approved_by_network\",\n reason: null,\n risk_level: \"normal\",\n seller_message: \"Payment complete.\",\n },\n metadata: new Map(),\n billing_details: { name, email, phone, address },\n receipt_email: email,\n });\n\n if (refund !== null) {\n rows.refunds.push({\n id: `re_demo_${index}_${s}_${n}`,\n version: now,\n created: at(finalized.getTime() + faker.number.int({ min: day, max: 10 * day })),\n amount: refund,\n currency,\n status: \"succeeded\",\n pending_reason: null,\n reason: \"requested_by_customer\",\n failure_reason: null,\n charge: chargeId,\n payment_intent: paymentIntent,\n customer: id,\n customer_account: null,\n balance_transaction: null,\n metadata: new Map(),\n });\n }\n });\n\n rows.subscriptions.push({\n id: subscriptionId,\n version: now,\n created,\n livemode: false,\n customer: id,\n customer_account: null,\n // A canceled subscription without a full period is still active.\n status: status === \"canceled\" && !canceled ? \"active\" : status,\n currency,\n collection_method: \"charge_automatically\",\n start_date: created,\n billing_cycle_anchor: anchor,\n cancel_at: null,\n cancel_at_period_end: false,\n canceled_at: endedAt\n ? at(endedAt.getTime() - faker.number.int({ min: day, max: 20 * day }))\n : null,\n ended_at: endedAt,\n trial_start: trialEnd ? created : null,\n trial_end: trialEnd,\n days_until_due: null,\n default_payment_method: null,\n latest_invoice: billed.length > 0 ? `in_demo_${index}_${s}_${billed.length - 1}` : null,\n schedule: null,\n description: null,\n cancellation_details: endedAt\n ? {\n reason: \"cancellation_requested\",\n feedback: faker.helpers.arrayElement([\n \"too_expensive\",\n \"unused\",\n \"switched_service\",\n null,\n ]),\n comment: null,\n }\n : null,\n pause_collection: null,\n items,\n metadata: new Map(),\n test_clock: null,\n });\n }\n\n rows.customers.push({\n id,\n version: now,\n created: customerCreated,\n livemode: false,\n email,\n name,\n phone,\n description: null,\n currency: subscriptionCount > 0 ? currency : null,\n balance: 0n,\n delinquent: rows.subscriptions.some((subscription) => subscription.status === \"past_due\"),\n tax_exempt: \"none\",\n invoice_prefix: invoicePrefix,\n invoice_settings: { default_payment_method: null },\n address,\n metadata: new Map(),\n test_clock: null,\n shipping: null,\n });\n\n return rows;\n};\n","import type { Demo } from \"@useairfoil/connector-kit\";\n\nimport type { Price } from \"../schemas/prices\";\nimport type { Product } from \"../schemas/products\";\n\nimport { catalog, day, priceId, priceOptions, productId, seconds, unitAmount } from \"./shared\";\n\n/** The catalog of products and prices, written once before any customer. */\nexport const setupRows = ({ now }: Demo.DemoContext) => {\n const created = seconds(now.getTime() - 800 * day);\n\n const productRows: Array<Product> = catalog.map((item) => ({\n id: productId(item),\n version: now,\n created,\n updated: created,\n livemode: false,\n active: true,\n name: item.name,\n description: item.plan ? `${item.name} plan` : `${item.name} add-on`,\n default_price: priceId(item, \"usd\", \"month\"),\n tax_code: \"txcd_10103001\",\n unit_label: item.seats ? \"seat\" : null,\n url: null,\n shippable: null,\n statement_descriptor: null,\n metadata: new Map(),\n }));\n\n const priceRows: Array<Price> = catalog.flatMap((item) =>\n priceOptions.map(([currency, interval]) => ({\n id: priceId(item, currency, interval),\n version: now,\n created,\n livemode: false,\n active: true,\n product: productId(item),\n currency,\n type: \"recurring\",\n billing_scheme: \"per_unit\",\n unit_amount: unitAmount(item, currency, interval),\n unit_amount_decimal: String(unitAmount(item, currency, interval)),\n tiers_mode: null,\n lookup_key: `${item.slug}_${interval}ly_${currency}`,\n nickname: `${item.name} ${interval}ly`,\n tax_behavior: \"exclusive\",\n recurring: {\n interval,\n interval_count: 1n,\n usage_type: \"licensed\",\n meter: null,\n trial_period_days: null,\n },\n metadata: new Map(),\n })),\n );\n\n return { products: productRows, prices: priceRows };\n};\n","import { ConnectorApp, Demo, RuntimeConfig } from \"@useairfoil/connector-kit\";\nimport { Command } from \"effect/cli\";\n\nimport { ChargeSchema } from \"../schemas/charges\";\nimport { CustomerSchema } from \"../schemas/customers\";\nimport { InvoiceSchema } from \"../schemas/invoices\";\nimport { PriceSchema } from \"../schemas/prices\";\nimport { ProductSchema } from \"../schemas/products\";\nimport { RefundSchema } from \"../schemas/refunds\";\nimport { SubscriptionSchema } from \"../schemas/subscriptions\";\nimport { customerRows } from \"./customers\";\nimport { setupRows } from \"./setup\";\n\nexport const demo = Demo.define({\n name: \"producer-stripe\",\n setup: {\n tables: [\n Demo.table({ name: \"products\", rowSchema: ProductSchema, version: \"version\" }),\n Demo.table({ name: \"prices\", rowSchema: PriceSchema, version: \"version\" }),\n ],\n rows: setupRows,\n },\n group: {\n tables: [\n Demo.table({ name: \"customers\", rowSchema: CustomerSchema, version: \"version\" }),\n Demo.table({ name: \"subscriptions\", rowSchema: SubscriptionSchema, version: \"version\" }),\n Demo.table({ name: \"invoices\", rowSchema: InvoiceSchema, version: \"version\" }),\n Demo.table({ name: \"charges\", rowSchema: ChargeSchema, version: \"version\" }),\n Demo.table({ name: \"refunds\", rowSchema: RefundSchema, version: \"version\" }),\n ],\n rows: customerRows,\n },\n});\n\nexport const demoCommand = ConnectorApp.makeDemoCommand(demo).pipe(\n Command.provide(RuntimeConfig.layerHosted()),\n);\n","import {\n ConnectorApp,\n Ingestor,\n RuntimeConfig,\n StateStore,\n Telemetry,\n} from \"@useairfoil/connector-kit\";\nimport { Effect, Layer, Logger } from \"effect\";\nimport { Command } from \"effect/cli\";\n\nimport { StripeConnector } from \"./index\";\n\nconst ConnectorLayer = StripeConnector.layerConfig(StripeConnector.StripeConfigDef.config);\n\nconst TelemetryLayer = Layer.mergeAll(Telemetry.layerOtlp(), Telemetry.layerMetricsConsoleDump());\n\nexport const sandboxCommand = Command.make(\"sandbox\", {}, () =>\n Effect.gen(function* () {\n const port = yield* RuntimeConfig.httpPort;\n const entrypoint = yield* StripeConnector.StripeConnector;\n\n return yield* ConnectorApp.start(entrypoint, { port });\n }).pipe(\n Effect.annotateLogs({ component: \"stripe\" }),\n Effect.provide(\n Layer.mergeAll(\n StateStore.layerMemory,\n Ingestor.layerConsole,\n ConnectorLayer,\n Logger.layer([Logger.consolePretty()]),\n TelemetryLayer,\n ),\n ),\n ),\n).pipe(Command.withDescription(\"Run the connector locally and log ingested data\"));\n","import { PgClient } from \"@effect/sql-pg\";\nimport {\n ConnectorApp,\n Ingestor,\n RuntimeConfig,\n StateStore,\n Telemetry,\n} from \"@useairfoil/connector-kit\";\nimport { Config, Effect, Layer, Logger, Schema } from \"effect\";\nimport { Command } from \"effect/cli\";\n\nimport { StripeConnector } from \"./index\";\n\nconst ConnectorLayer = StripeConnector.layerConfig(StripeConnector.StripeConfigDef.config);\nconst TelemetryLayer = Telemetry.layerOtlp();\nconst PostgresLayer = PgClient.layerConfig({\n url: Config.schema(\n Schema.Redacted(Schema.NonEmptyString),\n RuntimeConfig.PlatformRuntimeKey.postgresConnectionString,\n ),\n maxConnections: Config.succeed(2),\n connectTimeout: Config.succeed(\"5 seconds\"),\n applicationName: Config.succeed(\"airfoil-producer-stripe\"),\n});\nconst StateStoreLayer = StateStore.layerSql().pipe(Layer.provide(PostgresLayer));\n\nexport const startCommand = Command.make(\"start\", {}, () =>\n Effect.gen(function* () {\n const port = yield* RuntimeConfig.httpPort;\n const entrypoint = yield* StripeConnector.StripeConnector;\n\n return yield* ConnectorApp.start(entrypoint, { port }).pipe(\n Effect.provide(Ingestor.layerArrowFlightConfig(entrypoint)),\n );\n }).pipe(\n Effect.annotateLogs({ component: \"stripe\" }),\n Effect.provide(\n Layer.mergeAll(\n StateStoreLayer,\n ConnectorLayer,\n Logger.layer([Logger.consolePretty()]),\n TelemetryLayer,\n ),\n ),\n Effect.provide(RuntimeConfig.layerHosted()),\n ),\n).pipe(Command.withDescription(\"Run the connector\"));\n","#!/usr/bin/env node\n\nimport { NodeRuntime, NodeServices } from \"@effect/platform-node\";\nimport { Effect, Layer } from \"effect\";\nimport { Command } from \"effect/cli\";\nimport { FetchHttpClient } from \"effect/http\";\n\nimport packageJson from \"../package.json\";\nimport { createTableCommand, setupCommand } from \"./create-table\";\nimport { demoCommand } from \"./demo\";\nimport { sandboxCommand } from \"./sandbox\";\nimport { startCommand } from \"./start\";\n\nconst BootstrapLayer = Layer.mergeAll(FetchHttpClient.layer, NodeServices.layer);\n\nconst program = Command.make(\"producer-stripe\", {}, () => Effect.void).pipe(\n Command.withSubcommands([\n setupCommand,\n startCommand,\n sandboxCommand,\n createTableCommand,\n demoCommand,\n ]),\n);\n\nconst cli = Command.run(program, { version: packageJson.version });\n\nNodeRuntime.runMain(cli.pipe(Effect.provide(BootstrapLayer), Effect.scoped));\n"],"mappings":";;;;;;;;;;;;;ACUA,MAAa,eAAqD;CAChE,WAAW;CACX,UAAU;CACV,QAAQ;CACR,eAAe;CACf,UAAU;CACV,SAAS;CACT,SAAS;AACX;;;ACbA,MAAa,qBAAqB,aAAa,uBAAuB,YAAY;AAElF,MAAa,eAAe,aAAa,iBAAiB,YAAY,CAAC,CAAC,KACtE,QAAQ,QAAQ,cAAc,YAAY,CAAC,CAC7C;;;ACCA,MAAa,OAAO,SAAS,SAAS,SAAS,MAAM,CAAC,CAAC;AACvD,MAAa,MAAM,SAAS,SAAS,SAAS,KAAK,CAAC,CAAC;AAGrD,MAAa,UAAU;CACrB;EAAE,MAAM;EAAW,MAAM;EAAW,QAAQ;EAAM,OAAO;EAAO,MAAM;CAAK;CAC3E;EAAE,MAAM;EAAQ,MAAM;EAAQ,QAAQ;EAAM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