@casual-simulation/aux-records 3.2.3 → 3.2.4-alpha.5940763320
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/AIChatInterface.d.ts +8 -0
- package/AIChatInterface.js.map +1 -1
- package/AIController.d.ts +10 -4
- package/AIController.js +112 -3
- package/AIController.js.map +1 -1
- package/AuthController.d.ts +4 -8
- package/AuthController.js +39 -45
- package/AuthController.js.map +1 -1
- package/AuthStore.d.ts +236 -4
- package/ConfigurationStore.d.ts +12 -0
- package/ConfigurationStore.js +2 -0
- package/ConfigurationStore.js.map +1 -0
- package/DataRecordsController.d.ts +18 -6
- package/DataRecordsController.js +31 -5
- package/DataRecordsController.js.map +1 -1
- package/Errors.d.ts +4 -0
- package/EventRecordsController.d.ts +12 -3
- package/EventRecordsController.js +27 -5
- package/EventRecordsController.js.map +1 -1
- package/FileRecordsController.d.ts +13 -3
- package/FileRecordsController.js +46 -9
- package/FileRecordsController.js.map +1 -1
- package/MemoryFileRecordsLookup.d.ts +11 -0
- package/MemoryFileRecordsLookup.js +128 -0
- package/MemoryFileRecordsLookup.js.map +1 -0
- package/MemoryStore.d.ts +191 -0
- package/MemoryStore.js +1381 -0
- package/MemoryStore.js.map +1 -0
- package/MetricsStore.d.ts +186 -0
- package/MetricsStore.js +2 -0
- package/MetricsStore.js.map +1 -0
- package/OpenAIChatInterface.js +1 -0
- package/OpenAIChatInterface.js.map +1 -1
- package/PolicyController.d.ts +7 -4
- package/PolicyController.js +33 -8
- package/PolicyController.js.map +1 -1
- package/RecordsController.d.ts +185 -7
- package/RecordsController.js +588 -70
- package/RecordsController.js.map +1 -1
- package/RecordsHttpServer.d.ts +8 -0
- package/RecordsHttpServer.js +450 -8
- package/RecordsHttpServer.js.map +1 -1
- package/RecordsStore.d.ts +263 -5
- package/StripeInterface.d.ts +331 -0
- package/StripeInterface.js +37 -1
- package/StripeInterface.js.map +1 -1
- package/SubscriptionConfiguration.d.ts +2523 -33
- package/SubscriptionConfiguration.js +130 -1
- package/SubscriptionConfiguration.js.map +1 -1
- package/SubscriptionController.d.ts +23 -6
- package/SubscriptionController.js +344 -69
- package/SubscriptionController.js.map +1 -1
- package/TestUtils.d.ts +7 -6
- package/TestUtils.js +28 -14
- package/TestUtils.js.map +1 -1
- package/Utils.js +9 -0
- package/Utils.js.map +1 -1
- package/index.d.ts +5 -4
- package/index.js +5 -4
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/MemoryAuthStore.d.ts +0 -33
- package/MemoryAuthStore.js +0 -186
- package/MemoryAuthStore.js.map +0 -1
- package/MemoryDataRecordsStore.d.ts +0 -10
- package/MemoryDataRecordsStore.js +0 -98
- package/MemoryDataRecordsStore.js.map +0 -1
- package/MemoryEventRecordsStore.d.ts +0 -10
- package/MemoryEventRecordsStore.js +0 -89
- package/MemoryEventRecordsStore.js.map +0 -1
- package/MemoryFileRecordsStore.d.ts +0 -25
- package/MemoryFileRecordsStore.js +0 -310
- package/MemoryFileRecordsStore.js.map +0 -1
- package/MemoryPolicyStore.d.ts +0 -43
- package/MemoryPolicyStore.js +0 -255
- package/MemoryPolicyStore.js.map +0 -1
- package/MemoryRecordsStore.d.ts +0 -13
- package/MemoryRecordsStore.js +0 -67
- package/MemoryRecordsStore.js.map +0 -1
package/RecordsStore.d.ts
CHANGED
|
@@ -35,7 +35,97 @@ export interface RecordsStore {
|
|
|
35
35
|
*
|
|
36
36
|
* @param ownerId The ID of the user that owns the records.
|
|
37
37
|
*/
|
|
38
|
-
listRecordsByOwnerId
|
|
38
|
+
listRecordsByOwnerId(ownerId: string): Promise<ListedRecord[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the list of records that the studio with the given ID owns.
|
|
41
|
+
*
|
|
42
|
+
* If null or undefined, then this store does not support this method.
|
|
43
|
+
*
|
|
44
|
+
* @param studioId The ID of the studio that owns the records.
|
|
45
|
+
*/
|
|
46
|
+
listRecordsByStudioId(studioId: string): Promise<ListedRecord[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Gets the list of records that the studio with the given ID owns and that the user with the given ID has access to.
|
|
49
|
+
* @param studioId The ID of the studio.
|
|
50
|
+
* @param userId The ID of the user.
|
|
51
|
+
*/
|
|
52
|
+
listRecordsByStudioIdAndUserId(studioId: string, userId: string): Promise<ListedRecord[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Adds the given studio to the store.
|
|
55
|
+
* @param studio The studio to add.
|
|
56
|
+
*/
|
|
57
|
+
addStudio(studio: Studio): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new studio and adds the given user as an admin.
|
|
60
|
+
* @param studio The studio to create.
|
|
61
|
+
* @param adminId The ID of the admin user.
|
|
62
|
+
*/
|
|
63
|
+
createStudioForUser(studio: Studio, adminId: string): Promise<{
|
|
64
|
+
studio: Studio;
|
|
65
|
+
assignment: StudioAssignment;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Updates the given studio.
|
|
69
|
+
* @param studio The studio record that should be updated.
|
|
70
|
+
*/
|
|
71
|
+
updateStudio(studio: Studio): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Gets the studio with the given ID.
|
|
74
|
+
* @param id The ID of the studio.
|
|
75
|
+
*/
|
|
76
|
+
getStudioById(id: string): Promise<Studio>;
|
|
77
|
+
/**
|
|
78
|
+
* Gets the studio that has the given stripe customer ID.
|
|
79
|
+
* @param customerId The stripe customer ID for the studio.
|
|
80
|
+
*/
|
|
81
|
+
getStudioByStripeCustomerId(customerId: string): Promise<Studio>;
|
|
82
|
+
/**
|
|
83
|
+
* Gets the list of studios that the user with the given ID has access to.
|
|
84
|
+
* @param userId The ID of the user.
|
|
85
|
+
*/
|
|
86
|
+
listStudiosForUser(userId: string): Promise<ListedStudio[]>;
|
|
87
|
+
/**
|
|
88
|
+
* Adds the given studio assignment to the store.
|
|
89
|
+
* @param assignment The assignment to add.
|
|
90
|
+
*/
|
|
91
|
+
addStudioAssignment(assignment: StudioAssignment): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Updates the given studio assignment.
|
|
94
|
+
* @param assignment The assignment that should be updated.
|
|
95
|
+
*/
|
|
96
|
+
updateStudioAssignment(assignment: StudioAssignment): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Removes the given user from the given studio.
|
|
99
|
+
* @param studioId The ID of the studio.
|
|
100
|
+
* @param userId The ID of the user.
|
|
101
|
+
*/
|
|
102
|
+
removeStudioAssignment(studioId: string, userId: string): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Gets the list of users that have been assigned to the given studio.
|
|
105
|
+
* @param studioId The ID of the studio.
|
|
106
|
+
* @param filters The additional filters that should be used.
|
|
107
|
+
*/
|
|
108
|
+
listStudioAssignments(studioId: string, filters?: ListStudioAssignmentFilters): Promise<ListedStudioAssignment[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Gets the list of studio assignments that the user with the given ID has access to.
|
|
111
|
+
* @param userId The ID of the user.
|
|
112
|
+
*/
|
|
113
|
+
listUserAssignments(userId: string): Promise<ListedUserAssignment[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Counts the number of records that match the given filter.
|
|
116
|
+
* @param filter The filter.
|
|
117
|
+
*/
|
|
118
|
+
countRecords(filter: CountRecordsFilter): Promise<number>;
|
|
119
|
+
}
|
|
120
|
+
export interface CountRecordsFilter {
|
|
121
|
+
/**
|
|
122
|
+
* The ID of user that owns the record.
|
|
123
|
+
*/
|
|
124
|
+
ownerId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* The ID of the studio that owns the record.
|
|
127
|
+
*/
|
|
128
|
+
studioId?: string;
|
|
39
129
|
}
|
|
40
130
|
/**
|
|
41
131
|
* Defines an interface for record objects.
|
|
@@ -46,9 +136,15 @@ export interface Record {
|
|
|
46
136
|
*/
|
|
47
137
|
name: string;
|
|
48
138
|
/**
|
|
49
|
-
* The ID of the user that
|
|
139
|
+
* The ID of the user that owns the record.
|
|
140
|
+
* Null if the record is owned by a studio.
|
|
141
|
+
*/
|
|
142
|
+
ownerId: string | null;
|
|
143
|
+
/**
|
|
144
|
+
* The ID of the studio that owns the record.
|
|
145
|
+
* Null if the record is owned by a user.
|
|
50
146
|
*/
|
|
51
|
-
|
|
147
|
+
studioId: string | null;
|
|
52
148
|
/**
|
|
53
149
|
* The scrypt hashes of the secrets that allow access to the record.
|
|
54
150
|
*/
|
|
@@ -67,9 +163,171 @@ export interface ListedRecord {
|
|
|
67
163
|
*/
|
|
68
164
|
name: string;
|
|
69
165
|
/**
|
|
70
|
-
* The ID of the user that
|
|
166
|
+
* The ID of the user that owns the record.
|
|
167
|
+
* Null if owned by a studio.
|
|
168
|
+
*/
|
|
169
|
+
ownerId: string | null;
|
|
170
|
+
/**
|
|
171
|
+
* The ID of the studio that owns the record.
|
|
172
|
+
* Null if owned by a user.
|
|
173
|
+
*/
|
|
174
|
+
studioId: string | null;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Defines an interface for studio objects.
|
|
178
|
+
*/
|
|
179
|
+
export interface Studio {
|
|
180
|
+
/**
|
|
181
|
+
* The ID of the studio.
|
|
182
|
+
*/
|
|
183
|
+
id: string;
|
|
184
|
+
/**
|
|
185
|
+
* The name of the studio.
|
|
186
|
+
*/
|
|
187
|
+
displayName: string;
|
|
188
|
+
/**
|
|
189
|
+
* The ID of the stripe customer for this studio.
|
|
190
|
+
*/
|
|
191
|
+
stripeCustomerId?: string;
|
|
192
|
+
/**
|
|
193
|
+
* The current subscription status for this studio.
|
|
194
|
+
*/
|
|
195
|
+
subscriptionStatus?: string;
|
|
196
|
+
/**
|
|
197
|
+
* The ID of the stripe subscription that this studio currently has.
|
|
198
|
+
*/
|
|
199
|
+
subscriptionId?: string;
|
|
200
|
+
/**
|
|
201
|
+
* The ID of the subscription that this studio record references.
|
|
202
|
+
*/
|
|
203
|
+
subscriptionInfoId?: string;
|
|
204
|
+
/**
|
|
205
|
+
* The unix time in miliseconds that the studio's current subscription period started at.
|
|
206
|
+
*/
|
|
207
|
+
subscriptionPeriodStartMs?: number | null;
|
|
208
|
+
/**
|
|
209
|
+
* The unix time in miliseconds that the studio's current subscription period ends at.
|
|
210
|
+
*/
|
|
211
|
+
subscriptionPeriodEndMs?: number | null;
|
|
212
|
+
}
|
|
213
|
+
export type StudioAssignmentRole = 'admin' | 'member';
|
|
214
|
+
/**
|
|
215
|
+
* Defines an interface for studio assignment objects.
|
|
216
|
+
*/
|
|
217
|
+
export interface StudioAssignment {
|
|
218
|
+
/**
|
|
219
|
+
* The ID of the studio that this assignment applies to.
|
|
220
|
+
*/
|
|
221
|
+
studioId: string;
|
|
222
|
+
/**
|
|
223
|
+
* The ID of the user that this assignment applies to.
|
|
224
|
+
*/
|
|
225
|
+
userId: string;
|
|
226
|
+
/**
|
|
227
|
+
* Whether the user is the primary contact for this studio.
|
|
228
|
+
*/
|
|
229
|
+
isPrimaryContact: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* The role that this user has in the studio.
|
|
232
|
+
*/
|
|
233
|
+
role: StudioAssignmentRole;
|
|
234
|
+
}
|
|
235
|
+
export interface ListedStudioAssignment {
|
|
236
|
+
/**
|
|
237
|
+
* The ID of the studio that this assignment applies to.
|
|
238
|
+
*/
|
|
239
|
+
studioId: string;
|
|
240
|
+
/**
|
|
241
|
+
* The ID of the user that this assignment applies to.
|
|
242
|
+
*/
|
|
243
|
+
userId: string;
|
|
244
|
+
/**
|
|
245
|
+
* Whether the user is the primary contact for this studio.
|
|
246
|
+
*/
|
|
247
|
+
isPrimaryContact: boolean;
|
|
248
|
+
/**
|
|
249
|
+
* The role that this user has in the studio.
|
|
250
|
+
*/
|
|
251
|
+
role: StudioAssignmentRole;
|
|
252
|
+
/**
|
|
253
|
+
* The user that this assignment applies to.
|
|
254
|
+
*/
|
|
255
|
+
user: ListedStudioAssignmentUser;
|
|
256
|
+
}
|
|
257
|
+
export interface ListedUserAssignment {
|
|
258
|
+
/**
|
|
259
|
+
* The name of the studio that this assignment applies to.
|
|
260
|
+
*/
|
|
261
|
+
displayName: string;
|
|
262
|
+
/**
|
|
263
|
+
* The ID of the studio that this assignment applies to.
|
|
264
|
+
*/
|
|
265
|
+
studioId: string;
|
|
266
|
+
/**
|
|
267
|
+
* The ID of the user that this assignment applies to.
|
|
268
|
+
*/
|
|
269
|
+
userId: string;
|
|
270
|
+
/**
|
|
271
|
+
* Whether the user is the primary contact for this studio.
|
|
272
|
+
*/
|
|
273
|
+
isPrimaryContact: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* The role that this user has in the studio.
|
|
276
|
+
*/
|
|
277
|
+
role: StudioAssignmentRole;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The user information for a listed studio assignment.
|
|
281
|
+
*/
|
|
282
|
+
export interface ListedStudioAssignmentUser {
|
|
283
|
+
/**
|
|
284
|
+
* The ID of the user.
|
|
285
|
+
*/
|
|
286
|
+
id: string;
|
|
287
|
+
/**
|
|
288
|
+
* The name of the user.
|
|
289
|
+
*/
|
|
290
|
+
name: string;
|
|
291
|
+
/**
|
|
292
|
+
* The email address of the user.
|
|
293
|
+
*/
|
|
294
|
+
email: string;
|
|
295
|
+
/**
|
|
296
|
+
* The phone number of the user.
|
|
297
|
+
*/
|
|
298
|
+
phoneNumber: string;
|
|
299
|
+
}
|
|
300
|
+
export interface ListedStudio {
|
|
301
|
+
/**
|
|
302
|
+
* The ID of the studio.
|
|
303
|
+
*/
|
|
304
|
+
studioId: string;
|
|
305
|
+
/**
|
|
306
|
+
* The name of the studio.
|
|
307
|
+
*/
|
|
308
|
+
displayName: string;
|
|
309
|
+
/**
|
|
310
|
+
* The role that the user has in the studio.
|
|
311
|
+
*/
|
|
312
|
+
role: StudioAssignmentRole;
|
|
313
|
+
/**
|
|
314
|
+
* Whether the user is the primary contact for this studio.
|
|
315
|
+
*/
|
|
316
|
+
isPrimaryContact: boolean;
|
|
317
|
+
}
|
|
318
|
+
export interface ListStudioAssignmentFilters {
|
|
319
|
+
/**
|
|
320
|
+
* The ID of the user to filter by.
|
|
321
|
+
*/
|
|
322
|
+
userId?: string;
|
|
323
|
+
/**
|
|
324
|
+
* The role to filter by.
|
|
325
|
+
*/
|
|
326
|
+
role?: string;
|
|
327
|
+
/**
|
|
328
|
+
* Whether to filter by primary contact.
|
|
71
329
|
*/
|
|
72
|
-
|
|
330
|
+
isPrimaryContact?: boolean;
|
|
73
331
|
}
|
|
74
332
|
/**
|
|
75
333
|
* Defines a type that represents the different kinds of policies that a record key can have.
|
package/StripeInterface.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
/**
|
|
2
3
|
* Defines an interface that represents the high-level Stripe-like functions that the SubscriptionController uses.
|
|
3
4
|
*/
|
|
@@ -43,6 +44,12 @@ export interface StripeInterface {
|
|
|
43
44
|
* @param secret The secret that should be used to validate the payload against the signature.
|
|
44
45
|
*/
|
|
45
46
|
constructWebhookEvent(payload: string, signature: string, secret: string): StripeEvent;
|
|
47
|
+
/**
|
|
48
|
+
* Gets the subscription with the given ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id The ID of the subscription.
|
|
51
|
+
*/
|
|
52
|
+
getSubscriptionById(id: string): Promise<Omit<StripeSubscription, 'items'>>;
|
|
46
53
|
}
|
|
47
54
|
export interface StripePrice {
|
|
48
55
|
/**
|
|
@@ -366,4 +373,328 @@ export interface StripeProduct {
|
|
|
366
373
|
*/
|
|
367
374
|
default_price: StripePrice;
|
|
368
375
|
}
|
|
376
|
+
export declare const STRIPE_INVOICE_SCHEMA: z.ZodObject<{
|
|
377
|
+
id: z.ZodString;
|
|
378
|
+
currency: z.ZodString;
|
|
379
|
+
customer: z.ZodString;
|
|
380
|
+
description: z.ZodNullable<z.ZodString>;
|
|
381
|
+
subscription: z.ZodString;
|
|
382
|
+
hosted_invoice_url: z.ZodString;
|
|
383
|
+
invoice_pdf: z.ZodString;
|
|
384
|
+
total: z.ZodNumber;
|
|
385
|
+
subtotal: z.ZodNumber;
|
|
386
|
+
tax: z.ZodNullable<z.ZodNumber>;
|
|
387
|
+
status: z.ZodUnion<[z.ZodLiteral<"draft">, z.ZodLiteral<"open">, z.ZodLiteral<"void">, z.ZodLiteral<"paid">, z.ZodLiteral<"uncollectible">]>;
|
|
388
|
+
paid: z.ZodBoolean;
|
|
389
|
+
lines: z.ZodObject<{
|
|
390
|
+
object: z.ZodLiteral<"list">;
|
|
391
|
+
data: z.ZodArray<z.ZodObject<{
|
|
392
|
+
id: z.ZodString;
|
|
393
|
+
price: z.ZodObject<{
|
|
394
|
+
id: z.ZodString;
|
|
395
|
+
product: z.ZodString;
|
|
396
|
+
}, "strip", z.ZodTypeAny, {
|
|
397
|
+
id?: string;
|
|
398
|
+
product?: string;
|
|
399
|
+
}, {
|
|
400
|
+
id?: string;
|
|
401
|
+
product?: string;
|
|
402
|
+
}>;
|
|
403
|
+
}, "strip", z.ZodTypeAny, {
|
|
404
|
+
id?: string;
|
|
405
|
+
price?: {
|
|
406
|
+
id?: string;
|
|
407
|
+
product?: string;
|
|
408
|
+
};
|
|
409
|
+
}, {
|
|
410
|
+
id?: string;
|
|
411
|
+
price?: {
|
|
412
|
+
id?: string;
|
|
413
|
+
product?: string;
|
|
414
|
+
};
|
|
415
|
+
}>, "many">;
|
|
416
|
+
}, "strip", z.ZodTypeAny, {
|
|
417
|
+
object?: "list";
|
|
418
|
+
data?: {
|
|
419
|
+
id?: string;
|
|
420
|
+
price?: {
|
|
421
|
+
id?: string;
|
|
422
|
+
product?: string;
|
|
423
|
+
};
|
|
424
|
+
}[];
|
|
425
|
+
}, {
|
|
426
|
+
object?: "list";
|
|
427
|
+
data?: {
|
|
428
|
+
id?: string;
|
|
429
|
+
price?: {
|
|
430
|
+
id?: string;
|
|
431
|
+
product?: string;
|
|
432
|
+
};
|
|
433
|
+
}[];
|
|
434
|
+
}>;
|
|
435
|
+
}, "strip", z.ZodTypeAny, {
|
|
436
|
+
id?: string;
|
|
437
|
+
currency?: string;
|
|
438
|
+
customer?: string;
|
|
439
|
+
description?: string;
|
|
440
|
+
subscription?: string;
|
|
441
|
+
hosted_invoice_url?: string;
|
|
442
|
+
invoice_pdf?: string;
|
|
443
|
+
total?: number;
|
|
444
|
+
subtotal?: number;
|
|
445
|
+
tax?: number;
|
|
446
|
+
status?: "void" | "paid" | "open" | "draft" | "uncollectible";
|
|
447
|
+
paid?: boolean;
|
|
448
|
+
lines?: {
|
|
449
|
+
object?: "list";
|
|
450
|
+
data?: {
|
|
451
|
+
id?: string;
|
|
452
|
+
price?: {
|
|
453
|
+
id?: string;
|
|
454
|
+
product?: string;
|
|
455
|
+
};
|
|
456
|
+
}[];
|
|
457
|
+
};
|
|
458
|
+
}, {
|
|
459
|
+
id?: string;
|
|
460
|
+
currency?: string;
|
|
461
|
+
customer?: string;
|
|
462
|
+
description?: string;
|
|
463
|
+
subscription?: string;
|
|
464
|
+
hosted_invoice_url?: string;
|
|
465
|
+
invoice_pdf?: string;
|
|
466
|
+
total?: number;
|
|
467
|
+
subtotal?: number;
|
|
468
|
+
tax?: number;
|
|
469
|
+
status?: "void" | "paid" | "open" | "draft" | "uncollectible";
|
|
470
|
+
paid?: boolean;
|
|
471
|
+
lines?: {
|
|
472
|
+
object?: "list";
|
|
473
|
+
data?: {
|
|
474
|
+
id?: string;
|
|
475
|
+
price?: {
|
|
476
|
+
id?: string;
|
|
477
|
+
product?: string;
|
|
478
|
+
};
|
|
479
|
+
}[];
|
|
480
|
+
};
|
|
481
|
+
}>;
|
|
482
|
+
export declare const STRIPE_EVENT_INVOICE_PAID_SCHEMA: z.ZodObject<{
|
|
483
|
+
type: z.ZodLiteral<"invoice.paid">;
|
|
484
|
+
data: z.ZodObject<{
|
|
485
|
+
object: z.ZodObject<{
|
|
486
|
+
id: z.ZodString;
|
|
487
|
+
currency: z.ZodString;
|
|
488
|
+
customer: z.ZodString;
|
|
489
|
+
description: z.ZodNullable<z.ZodString>;
|
|
490
|
+
subscription: z.ZodString;
|
|
491
|
+
hosted_invoice_url: z.ZodString;
|
|
492
|
+
invoice_pdf: z.ZodString;
|
|
493
|
+
total: z.ZodNumber;
|
|
494
|
+
subtotal: z.ZodNumber;
|
|
495
|
+
tax: z.ZodNullable<z.ZodNumber>;
|
|
496
|
+
status: z.ZodUnion<[z.ZodLiteral<"draft">, z.ZodLiteral<"open">, z.ZodLiteral<"void">, z.ZodLiteral<"paid">, z.ZodLiteral<"uncollectible">]>;
|
|
497
|
+
paid: z.ZodBoolean;
|
|
498
|
+
lines: z.ZodObject<{
|
|
499
|
+
object: z.ZodLiteral<"list">;
|
|
500
|
+
data: z.ZodArray<z.ZodObject<{
|
|
501
|
+
id: z.ZodString;
|
|
502
|
+
price: z.ZodObject<{
|
|
503
|
+
id: z.ZodString;
|
|
504
|
+
product: z.ZodString;
|
|
505
|
+
}, "strip", z.ZodTypeAny, {
|
|
506
|
+
id?: string;
|
|
507
|
+
product?: string;
|
|
508
|
+
}, {
|
|
509
|
+
id?: string;
|
|
510
|
+
product?: string;
|
|
511
|
+
}>;
|
|
512
|
+
}, "strip", z.ZodTypeAny, {
|
|
513
|
+
id?: string;
|
|
514
|
+
price?: {
|
|
515
|
+
id?: string;
|
|
516
|
+
product?: string;
|
|
517
|
+
};
|
|
518
|
+
}, {
|
|
519
|
+
id?: string;
|
|
520
|
+
price?: {
|
|
521
|
+
id?: string;
|
|
522
|
+
product?: string;
|
|
523
|
+
};
|
|
524
|
+
}>, "many">;
|
|
525
|
+
}, "strip", z.ZodTypeAny, {
|
|
526
|
+
object?: "list";
|
|
527
|
+
data?: {
|
|
528
|
+
id?: string;
|
|
529
|
+
price?: {
|
|
530
|
+
id?: string;
|
|
531
|
+
product?: string;
|
|
532
|
+
};
|
|
533
|
+
}[];
|
|
534
|
+
}, {
|
|
535
|
+
object?: "list";
|
|
536
|
+
data?: {
|
|
537
|
+
id?: string;
|
|
538
|
+
price?: {
|
|
539
|
+
id?: string;
|
|
540
|
+
product?: string;
|
|
541
|
+
};
|
|
542
|
+
}[];
|
|
543
|
+
}>;
|
|
544
|
+
}, "strip", z.ZodTypeAny, {
|
|
545
|
+
id?: string;
|
|
546
|
+
currency?: string;
|
|
547
|
+
customer?: string;
|
|
548
|
+
description?: string;
|
|
549
|
+
subscription?: string;
|
|
550
|
+
hosted_invoice_url?: string;
|
|
551
|
+
invoice_pdf?: string;
|
|
552
|
+
total?: number;
|
|
553
|
+
subtotal?: number;
|
|
554
|
+
tax?: number;
|
|
555
|
+
status?: "void" | "paid" | "open" | "draft" | "uncollectible";
|
|
556
|
+
paid?: boolean;
|
|
557
|
+
lines?: {
|
|
558
|
+
object?: "list";
|
|
559
|
+
data?: {
|
|
560
|
+
id?: string;
|
|
561
|
+
price?: {
|
|
562
|
+
id?: string;
|
|
563
|
+
product?: string;
|
|
564
|
+
};
|
|
565
|
+
}[];
|
|
566
|
+
};
|
|
567
|
+
}, {
|
|
568
|
+
id?: string;
|
|
569
|
+
currency?: string;
|
|
570
|
+
customer?: string;
|
|
571
|
+
description?: string;
|
|
572
|
+
subscription?: string;
|
|
573
|
+
hosted_invoice_url?: string;
|
|
574
|
+
invoice_pdf?: string;
|
|
575
|
+
total?: number;
|
|
576
|
+
subtotal?: number;
|
|
577
|
+
tax?: number;
|
|
578
|
+
status?: "void" | "paid" | "open" | "draft" | "uncollectible";
|
|
579
|
+
paid?: boolean;
|
|
580
|
+
lines?: {
|
|
581
|
+
object?: "list";
|
|
582
|
+
data?: {
|
|
583
|
+
id?: string;
|
|
584
|
+
price?: {
|
|
585
|
+
id?: string;
|
|
586
|
+
product?: string;
|
|
587
|
+
};
|
|
588
|
+
}[];
|
|
589
|
+
};
|
|
590
|
+
}>;
|
|
591
|
+
}, "strip", z.ZodTypeAny, {
|
|
592
|
+
object?: {
|
|
593
|
+
id?: string;
|
|
594
|
+
currency?: string;
|
|
595
|
+
customer?: string;
|
|
596
|
+
description?: string;
|
|
597
|
+
subscription?: string;
|
|
598
|
+
hosted_invoice_url?: string;
|
|
599
|
+
invoice_pdf?: string;
|
|
600
|
+
total?: number;
|
|
601
|
+
subtotal?: number;
|
|
602
|
+
tax?: number;
|
|
603
|
+
status?: "void" | "paid" | "open" | "draft" | "uncollectible";
|
|
604
|
+
paid?: boolean;
|
|
605
|
+
lines?: {
|
|
606
|
+
object?: "list";
|
|
607
|
+
data?: {
|
|
608
|
+
id?: string;
|
|
609
|
+
price?: {
|
|
610
|
+
id?: string;
|
|
611
|
+
product?: string;
|
|
612
|
+
};
|
|
613
|
+
}[];
|
|
614
|
+
};
|
|
615
|
+
};
|
|
616
|
+
}, {
|
|
617
|
+
object?: {
|
|
618
|
+
id?: string;
|
|
619
|
+
currency?: string;
|
|
620
|
+
customer?: string;
|
|
621
|
+
description?: string;
|
|
622
|
+
subscription?: string;
|
|
623
|
+
hosted_invoice_url?: string;
|
|
624
|
+
invoice_pdf?: string;
|
|
625
|
+
total?: number;
|
|
626
|
+
subtotal?: number;
|
|
627
|
+
tax?: number;
|
|
628
|
+
status?: "void" | "paid" | "open" | "draft" | "uncollectible";
|
|
629
|
+
paid?: boolean;
|
|
630
|
+
lines?: {
|
|
631
|
+
object?: "list";
|
|
632
|
+
data?: {
|
|
633
|
+
id?: string;
|
|
634
|
+
price?: {
|
|
635
|
+
id?: string;
|
|
636
|
+
product?: string;
|
|
637
|
+
};
|
|
638
|
+
}[];
|
|
639
|
+
};
|
|
640
|
+
};
|
|
641
|
+
}>;
|
|
642
|
+
}, "strip", z.ZodTypeAny, {
|
|
643
|
+
type?: "invoice.paid";
|
|
644
|
+
data?: {
|
|
645
|
+
object?: {
|
|
646
|
+
id?: string;
|
|
647
|
+
currency?: string;
|
|
648
|
+
customer?: string;
|
|
649
|
+
description?: string;
|
|
650
|
+
subscription?: string;
|
|
651
|
+
hosted_invoice_url?: string;
|
|
652
|
+
invoice_pdf?: string;
|
|
653
|
+
total?: number;
|
|
654
|
+
subtotal?: number;
|
|
655
|
+
tax?: number;
|
|
656
|
+
status?: "void" | "paid" | "open" | "draft" | "uncollectible";
|
|
657
|
+
paid?: boolean;
|
|
658
|
+
lines?: {
|
|
659
|
+
object?: "list";
|
|
660
|
+
data?: {
|
|
661
|
+
id?: string;
|
|
662
|
+
price?: {
|
|
663
|
+
id?: string;
|
|
664
|
+
product?: string;
|
|
665
|
+
};
|
|
666
|
+
}[];
|
|
667
|
+
};
|
|
668
|
+
};
|
|
669
|
+
};
|
|
670
|
+
}, {
|
|
671
|
+
type?: "invoice.paid";
|
|
672
|
+
data?: {
|
|
673
|
+
object?: {
|
|
674
|
+
id?: string;
|
|
675
|
+
currency?: string;
|
|
676
|
+
customer?: string;
|
|
677
|
+
description?: string;
|
|
678
|
+
subscription?: string;
|
|
679
|
+
hosted_invoice_url?: string;
|
|
680
|
+
invoice_pdf?: string;
|
|
681
|
+
total?: number;
|
|
682
|
+
subtotal?: number;
|
|
683
|
+
tax?: number;
|
|
684
|
+
status?: "void" | "paid" | "open" | "draft" | "uncollectible";
|
|
685
|
+
paid?: boolean;
|
|
686
|
+
lines?: {
|
|
687
|
+
object?: "list";
|
|
688
|
+
data?: {
|
|
689
|
+
id?: string;
|
|
690
|
+
price?: {
|
|
691
|
+
id?: string;
|
|
692
|
+
product?: string;
|
|
693
|
+
};
|
|
694
|
+
}[];
|
|
695
|
+
};
|
|
696
|
+
};
|
|
697
|
+
};
|
|
698
|
+
}>;
|
|
699
|
+
export type StripeInvoice = z.infer<typeof STRIPE_INVOICE_SCHEMA>;
|
|
369
700
|
//# sourceMappingURL=StripeInterface.d.ts.map
|
package/StripeInterface.js
CHANGED
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const STRIPE_INVOICE_SCHEMA = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
currency: z.string(),
|
|
5
|
+
customer: z.string(),
|
|
6
|
+
description: z.string().nullable(),
|
|
7
|
+
subscription: z.string(),
|
|
8
|
+
hosted_invoice_url: z.string(),
|
|
9
|
+
invoice_pdf: z.string(),
|
|
10
|
+
total: z.number(),
|
|
11
|
+
subtotal: z.number(),
|
|
12
|
+
tax: z.number().nullable(),
|
|
13
|
+
status: z.union([
|
|
14
|
+
z.literal('draft'),
|
|
15
|
+
z.literal('open'),
|
|
16
|
+
z.literal('void'),
|
|
17
|
+
z.literal('paid'),
|
|
18
|
+
z.literal('uncollectible'),
|
|
19
|
+
]),
|
|
20
|
+
paid: z.boolean(),
|
|
21
|
+
lines: z.object({
|
|
22
|
+
object: z.literal('list'),
|
|
23
|
+
data: z.array(z.object({
|
|
24
|
+
id: z.string(),
|
|
25
|
+
price: z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
product: z.string(),
|
|
28
|
+
}),
|
|
29
|
+
})),
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
export const STRIPE_EVENT_INVOICE_PAID_SCHEMA = z.object({
|
|
33
|
+
type: z.literal('invoice.paid'),
|
|
34
|
+
data: z.object({
|
|
35
|
+
object: STRIPE_INVOICE_SCHEMA,
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
2
38
|
//# sourceMappingURL=StripeInterface.js.map
|
package/StripeInterface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StripeInterface.js","sourceRoot":"","sources":["StripeInterface.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"StripeInterface.js","sourceRoot":"","sources":["StripeInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkdxB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC9B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC;QACZ,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QAClB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACjB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACjB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACjB,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;KAC7B,CAAC;IACF,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;IAEjB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACZ,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACzB,IAAI,EAAE,CAAC,CAAC,KAAK,CACT,CAAC,CAAC,MAAM,CAAC;YACL,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;YACd,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;gBACZ,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;gBACd,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;aACtB,CAAC;SACL,CAAC,CACL;KACJ,CAAC;CACL,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACX,MAAM,EAAE,qBAAqB;KAChC,CAAC;CACL,CAAC,CAAC"}
|