@monkeyplus/payscope 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md +41 -0
  2. package/dist/_chunks/auth.d.mts +707 -0
  3. package/dist/_chunks/database.mjs +831 -0
  4. package/dist/_chunks/db.d.mts +7100 -0
  5. package/dist/_chunks/index.d.mts +178 -0
  6. package/dist/_chunks/lib.mjs +3073 -0
  7. package/dist/_chunks/libs/better-call.d.mts +478 -0
  8. package/dist/_chunks/libs/postgres.d.mts +1 -0
  9. package/dist/_chunks/rolldown-runtime.mjs +11 -0
  10. package/dist/server/db.d.mts +2 -0
  11. package/dist/server/db.mjs +108 -0
  12. package/dist/server/env.d.mts +21 -0
  13. package/dist/server/env.mjs +22 -0
  14. package/dist/server/lib.d.mts +362 -0
  15. package/dist/server/lib.mjs +2 -0
  16. package/dist/server/router.d.mts +1218 -0
  17. package/dist/server/router.mjs +1157 -0
  18. package/dist/server/schemas/auth.d.mts +2 -0
  19. package/dist/server/schemas/auth.mjs +62 -0
  20. package/package.json +58 -0
  21. package/storefront/Readme.md +0 -0
  22. package/storefront/auth.ts +29 -0
  23. package/storefront/cart/ResumeCart.vue +217 -0
  24. package/storefront/cart/ResumeCartSelect.vue +32 -0
  25. package/storefront/cart/ShoppinCart.vue +100 -0
  26. package/storefront/cart/ShoppinCartItem.vue +99 -0
  27. package/storefront/checkout/App.vue +36 -0
  28. package/storefront/checkout/AppCart.vue +72 -0
  29. package/storefront/checkout/AppCartDiscount.vue +74 -0
  30. package/storefront/checkout/AppCartTotals.vue +72 -0
  31. package/storefront/checkout/AppLoading.vue +55 -0
  32. package/storefront/checkout/composables.ts +28 -0
  33. package/storefront/checkout/constants.ts +0 -0
  34. package/storefront/checkout/main.ts +11 -0
  35. package/storefront/checkout/pages/Address/Address.vue +95 -0
  36. package/storefront/checkout/pages/Info/Info.vue +94 -0
  37. package/storefront/checkout/pages/Info/InfoUser.vue +38 -0
  38. package/storefront/checkout/pages/Pay/Pay.vue +115 -0
  39. package/storefront/checkout/pages/Pay/Providers/BancoEconomico/BancoEconomico.vue +9 -0
  40. package/storefront/checkout/pages/Pay/Providers/Cybersource/Cybersource.vue +9 -0
  41. package/storefront/checkout/pages/Pay/Providers/Datafast/Datafast.vue +9 -0
  42. package/storefront/checkout/pages/Pay/Providers/Multipago/Multipago.vue +9 -0
  43. package/storefront/checkout/pages/Pay/Providers/Pagomedios/Pagomedios.vue +93 -0
  44. package/storefront/checkout/pages/Pay/Providers/Pagomedios/composable.ts +23 -0
  45. package/storefront/checkout/pages/Pay/Providers/Paypal/Paypal.vue +168 -0
  46. package/storefront/checkout/pages/Pay/Providers/Paypal/composable.ts +33 -0
  47. package/storefront/checkout/pages/Pay/Providers/Placetopay/Placetopay.vue +9 -0
  48. package/storefront/checkout/pages/Pay/Providers/Wabi/Wabi.vue +9 -0
  49. package/storefront/checkout/pages/Pay/Providers/composable.ts +30 -0
  50. package/storefront/checkout/pages/Payment/Payment.vue +19 -0
  51. package/storefront/checkout/pages/Payment/PaymentStatus.vue +187 -0
  52. package/storefront/checkout/pages/Payment/PaymentStatusDetail.vue +77 -0
  53. package/storefront/checkout/pages/Payment/composable.ts +81 -0
  54. package/storefront/checkout/pages/Shipping/Shipping.vue +67 -0
  55. package/storefront/checkout/pages/StepInfo.vue +37 -0
  56. package/storefront/checkout/router.ts +59 -0
  57. package/storefront/index.ts +3 -0
  58. package/storefront/login/App.vue +9 -0
  59. package/storefront/login/main.ts +10 -0
  60. package/storefront/login/pages/SignIn/Login.vue +82 -0
  61. package/storefront/login/pages/SignUp/SignUp.vue +99 -0
  62. package/storefront/login/router.ts +15 -0
  63. package/storefront/product/AddProduct.vue +303 -0
  64. package/storefront/product/AddProductNumber.vue +62 -0
  65. package/storefront/product/AddProductVariant.vue +66 -0
  66. package/storefront/profile/App.vue +88 -0
  67. package/storefront/profile/main.ts +10 -0
  68. package/storefront/profile/pages/Addresses/Addresses.vue +79 -0
  69. package/storefront/profile/pages/Addresses/AddressesForm.vue +95 -0
  70. package/storefront/profile/pages/Addresses/AddressesModal.vue +24 -0
  71. package/storefront/profile/pages/Buys/Buys.vue +8 -0
  72. package/storefront/profile/pages/Me/Me.vue +15 -0
  73. package/storefront/profile/pages/Me/MeBilling.vue +79 -0
  74. package/storefront/profile/pages/Me/MeBillingForm.vue +66 -0
  75. package/storefront/profile/pages/Me/MeBillingModal.vue +24 -0
  76. package/storefront/profile/pages/Me/MeInfo.vue +75 -0
  77. package/storefront/profile/pages/Me/MePassword.vue +53 -0
  78. package/storefront/profile/pages/Me/MeSubscriptions.vue +15 -0
  79. package/storefront/profile/pages/Returns/Returns.vue +8 -0
  80. package/storefront/profile/pages/Whislist/Whislist.vue +8 -0
  81. package/storefront/profile/router.ts +32 -0
  82. package/storefront/stores.ts +320 -0
@@ -0,0 +1,831 @@
1
+ import { sql } from "drizzle-orm";
2
+ import * as p from "drizzle-orm/pg-core";
3
+ import { bigint, boolean, customType, date, decimal, foreignKey, index, integer, jsonb, serial, snakeCase, text, timestamp, varchar } from "drizzle-orm/pg-core";
4
+ const auth = snakeCase.schema("auth");
5
+ const user = auth.table("user", {
6
+ id: text("id").primaryKey(),
7
+ name: text("name").notNull(),
8
+ email: text("email").notNull().unique(),
9
+ emailVerified: boolean("email_verified").default(false).notNull(),
10
+ image: text("image"),
11
+ createdAt: timestamp("created_at").defaultNow().notNull(),
12
+ updatedAt: timestamp("updated_at").defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull(),
13
+ role: text("role"),
14
+ banned: boolean("banned").default(false),
15
+ banReason: text("ban_reason"),
16
+ banExpires: timestamp("ban_expires"),
17
+ username: text("username").unique(),
18
+ displayUsername: text("display_username")
19
+ });
20
+ const session = auth.table("session", {
21
+ id: text("id").primaryKey(),
22
+ expiresAt: timestamp("expires_at").notNull(),
23
+ token: text("token").notNull().unique(),
24
+ createdAt: timestamp("created_at").defaultNow().notNull(),
25
+ updatedAt: timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull(),
26
+ ipAddress: text("ip_address"),
27
+ userAgent: text("user_agent"),
28
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
29
+ impersonatedBy: text("impersonated_by")
30
+ }, (table) => [index("session_userId_idx").on(table.userId)]);
31
+ const account = auth.table("account", {
32
+ id: text("id").primaryKey(),
33
+ accountId: text("account_id").notNull(),
34
+ providerId: text("provider_id").notNull(),
35
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
36
+ accessToken: text("access_token"),
37
+ refreshToken: text("refresh_token"),
38
+ idToken: text("id_token"),
39
+ accessTokenExpiresAt: timestamp("access_token_expires_at"),
40
+ refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
41
+ scope: text("scope"),
42
+ password: text("password"),
43
+ createdAt: timestamp("created_at").defaultNow().notNull(),
44
+ updatedAt: timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
45
+ }, (table) => [index("account_userId_idx").on(table.userId)]);
46
+ const verification = auth.table("verification", {
47
+ id: text("id").primaryKey(),
48
+ identifier: text("identifier").notNull(),
49
+ value: text("value").notNull(),
50
+ expiresAt: timestamp("expires_at").notNull(),
51
+ createdAt: timestamp("created_at").defaultNow().notNull(),
52
+ updatedAt: timestamp("updated_at").defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
53
+ }, (table) => [index("verification_identifier_idx").on(table.identifier)]);
54
+ const zones = auth.table("zones", {
55
+ id: serial().primaryKey(),
56
+ name: text().notNull()
57
+ });
58
+ const teams = auth.table("teams", {
59
+ id: serial().primaryKey(),
60
+ name: text().notNull(),
61
+ creatorId: text("creator_id")
62
+ });
63
+ const teamUserXRefs = auth.table("team_user_xrefs", {
64
+ id: serial().primaryKey(),
65
+ userId: text("user_id").notNull().references(() => user.id),
66
+ teamId: integer("team_id").notNull().references(() => teams.id)
67
+ });
68
+ const teamZoneXRefs = auth.table("team_zone_xrefs", {
69
+ id: serial().primaryKey(),
70
+ teamId: integer("team_id").notNull().references(() => teams.id),
71
+ zoneId: integer().notNull().references(() => zones.id)
72
+ });
73
+ const buys = snakeCase.schema("buys");
74
+ const customBigSerial = customType({
75
+ dataType() {
76
+ return "bigserial";
77
+ },
78
+ toDriver(value) {
79
+ return value;
80
+ },
81
+ fromDriver(value) {
82
+ return value === null ? value : String(value);
83
+ },
84
+ codec: "bigint:string"
85
+ });
86
+ const checkouts = buys.table("checkouts", {
87
+ id: p.bigserial({ mode: "number" }).primaryKey().notNull(),
88
+ total: p.numeric({ mode: "number" }).default(0).notNull(),
89
+ base: p.numeric({ mode: "number" }),
90
+ items: p.jsonb().notNull().$type(),
91
+ taxes: p.jsonb().notNull().$type(),
92
+ billingInfo: p.jsonb().notNull().$type(),
93
+ shippingInfo: p.jsonb().notNull().$type(),
94
+ createdAt: p.timestamp({
95
+ withTimezone: true,
96
+ mode: "string"
97
+ }).defaultNow(),
98
+ sessionId: p.bigint({ mode: "number" }),
99
+ shippingType: p.jsonb().default({}).$type(),
100
+ discount: p.jsonb().default({}).$type(),
101
+ totalTax: p.numeric(),
102
+ totalShipping: p.numeric()
103
+ }, (table) => [p.foreignKey({
104
+ columns: [table.sessionId],
105
+ foreignColumns: [sessions.id],
106
+ name: "checkouts_session_id_fkey"
107
+ })]);
108
+ const pgmigrations = p.pgTable("pgmigrations", {
109
+ id: p.serial().primaryKey().notNull(),
110
+ name: p.varchar({ length: 255 }).notNull(),
111
+ runOn: p.timestamp("run_on", { mode: "string" }).notNull()
112
+ });
113
+ const countries = p.pgTable("countries", {
114
+ id: p.varchar({ length: 2 }).primaryKey().notNull(),
115
+ name: p.varchar({ length: 120 })
116
+ });
117
+ const drivers = p.pgTable("drivers", { id: p.varchar({ length: 120 }).primaryKey().notNull() });
118
+ const namespaceKeys = p.snakeCase.table("namespace_keys", {
119
+ id: p.serial().primaryKey().notNull(),
120
+ name: p.varchar().notNull(),
121
+ storeId: p.integer().notNull(),
122
+ provider: p.varchar().notNull()
123
+ }, (table) => [p.foreignKey({
124
+ columns: [table.storeId],
125
+ foreignColumns: [stores.id]
126
+ })]);
127
+ const keys = p.snakeCase.table("keys", {
128
+ id: p.serial().primaryKey().notNull(),
129
+ namespaceId: p.integer().notNull(),
130
+ key: p.varchar().notNull(),
131
+ value: p.varchar().notNull()
132
+ }, (table) => [p.foreignKey({
133
+ columns: [table.namespaceId],
134
+ foreignColumns: [namespaceKeys.id]
135
+ }).onDelete("cascade"), p.unique("keys_namespaceId_key_unique").on(table.namespaceId, table.key)]);
136
+ const stores = p.snakeCase.table("stores", {
137
+ id: p.serial().primaryKey().notNull(),
138
+ name: p.varchar({ length: 255 }).notNull(),
139
+ endpoint: p.varchar(),
140
+ resources: p.jsonb().default({}).$type(),
141
+ image: p.varchar(),
142
+ storeExtensions: p.jsonb().default({}).$type(),
143
+ storeSettings: p.jsonb().default({}).$type(),
144
+ driver: p.varchar({ length: 120 }).notNull(),
145
+ storeIntegrations: p.jsonb().default({}),
146
+ countryId: p.varchar({ length: 2 }).default("ec"),
147
+ hook: p.varchar(),
148
+ storeVariants: p.jsonb().default([]).$type(),
149
+ storeMenus: p.jsonb().default([]),
150
+ storeCategories: p.jsonb().default([]).$type().notNull(),
151
+ storeTaxes: p.jsonb().default({}).$type(),
152
+ storeShippings: p.jsonb().default([]),
153
+ storeShippingsOptions: p.jsonb().default({}),
154
+ storeZones: p.jsonb().default([]),
155
+ storeDiscounts: p.jsonb().default([]),
156
+ storeNotifications: p.jsonb().default({}),
157
+ storeTasks: p.jsonb().default({
158
+ success: {},
159
+ successTasks: [],
160
+ failed: {},
161
+ failedTasks: []
162
+ }).$type()
163
+ }, (table) => [p.foreignKey({
164
+ columns: [table.driver],
165
+ foreignColumns: [drivers.id],
166
+ name: "stores_driver_fkey"
167
+ }), p.foreignKey({
168
+ columns: [table.countryId],
169
+ foreignColumns: [countries.id],
170
+ name: "stores_country_id_fkey"
171
+ })]);
172
+ const discounts = buys.table("discounts", {
173
+ id: p.serial().primaryKey().notNull(),
174
+ storeId: p.integer().notNull(),
175
+ customerId: p.varchar().notNull(),
176
+ coupon: p.varchar().notNull()
177
+ }, (table) => [p.foreignKey({
178
+ columns: [table.storeId],
179
+ foreignColumns: [stores.id],
180
+ name: "discounts_store_id_fkey"
181
+ })]);
182
+ const discountCoupons = buys.table("discount_coupons", {
183
+ id: p.serial().primaryKey().notNull(),
184
+ name: p.varchar().notNull(),
185
+ storeId: p.integer().notNull(),
186
+ type: p.text({ enum: ["amount", "percentage"] }).notNull(),
187
+ value: p.numeric().notNull(),
188
+ code: p.varchar().notNull(),
189
+ customerId: p.varchar()
190
+ }, (table) => [p.foreignKey({
191
+ columns: [table.storeId],
192
+ foreignColumns: [stores.id]
193
+ })]);
194
+ const links = buys.table("links", {
195
+ id: p.uuid().default(sql`uuid_generate_v4()`).primaryKey().notNull(),
196
+ description: p.varchar(),
197
+ createdAt: p.timestamp({
198
+ withTimezone: true,
199
+ mode: "string"
200
+ }).defaultNow(),
201
+ expiredAt: p.timestamp({
202
+ withTimezone: true,
203
+ mode: "string"
204
+ }),
205
+ sessionId: p.bigint({ mode: "number" }),
206
+ checkoutId: p.bigint({ mode: "number" }).notNull(),
207
+ storeId: p.integer(),
208
+ statusPay: p.varchar().default("pending")
209
+ }, (table) => [
210
+ p.foreignKey({
211
+ columns: [table.sessionId],
212
+ foreignColumns: [sessions.id],
213
+ name: "links_session_id_fkey"
214
+ }),
215
+ p.foreignKey({
216
+ columns: [table.checkoutId],
217
+ foreignColumns: [checkouts.id],
218
+ name: "links_checkout_id_fkey"
219
+ }),
220
+ p.foreignKey({
221
+ columns: [table.storeId],
222
+ foreignColumns: [stores.id],
223
+ name: "links_store_id_fkey"
224
+ })
225
+ ]);
226
+ const refunds = buys.table("refunds", {
227
+ id: customBigSerial().primaryKey().notNull(),
228
+ details: p.jsonb(),
229
+ createdAt: p.timestamp({
230
+ withTimezone: true,
231
+ mode: "string"
232
+ }).defaultNow(),
233
+ transactionId: p.bigint({ mode: "number" })
234
+ }, (table) => [p.foreignKey({
235
+ columns: [table.transactionId],
236
+ foreignColumns: [transactions.id],
237
+ name: "refunds_transaction_id_fkey"
238
+ })]);
239
+ const sessions = buys.table("sessions", {
240
+ id: customBigSerial().primaryKey().notNull(),
241
+ email: p.varchar({ length: 122 }),
242
+ identification: p.varchar({ length: 20 }),
243
+ hash: p.varchar({ length: 250 }),
244
+ customer: p.jsonb().notNull().$type(),
245
+ storeId: p.integer(),
246
+ sellerEmail: p.varchar({ length: 122 }),
247
+ sellerCode: p.varchar({ length: 50 })
248
+ }, (table) => [p.foreignKey({
249
+ columns: [table.storeId],
250
+ foreignColumns: [stores.id],
251
+ name: "sessions_store_id_fkey"
252
+ })]);
253
+ const transactions = buys.table("transactions", {
254
+ id: customBigSerial().primaryKey().notNull(),
255
+ description: p.varchar().default("Compra "),
256
+ provider: p.varchar().notNull(),
257
+ status: p.varchar({ length: 25 }).default("created").notNull().$type(),
258
+ ref: p.varchar(),
259
+ ip: p.varchar(),
260
+ details: p.jsonb(),
261
+ extras: p.jsonb().default({}),
262
+ tasks: p.jsonb().default({}).$type(),
263
+ responseTasks: p.jsonb().default({}),
264
+ endpoints: p.jsonb().default({}),
265
+ createdAt: p.timestamp({
266
+ withTimezone: true,
267
+ mode: "string"
268
+ }).defaultNow(),
269
+ sessionId: p.bigint({ mode: "number" }).notNull(),
270
+ checkoutId: p.bigint({ mode: "number" }).notNull(),
271
+ linkId: p.uuid(),
272
+ sellerInfo: p.jsonb().default({}),
273
+ seller: p.varchar({ length: 40 }),
274
+ storeId: p.integer()
275
+ }, (table) => [
276
+ p.foreignKey({
277
+ columns: [table.sessionId],
278
+ foreignColumns: [sessions.id],
279
+ name: "transactions_session_id_fkey"
280
+ }),
281
+ p.foreignKey({
282
+ columns: [table.checkoutId],
283
+ foreignColumns: [checkouts.id],
284
+ name: "transactions_checkout_id_fkey"
285
+ }),
286
+ p.foreignKey({
287
+ columns: [table.linkId],
288
+ foreignColumns: [links.id],
289
+ name: "transactions_link_id_fkey"
290
+ }),
291
+ p.foreignKey({
292
+ columns: [table.storeId],
293
+ foreignColumns: [stores.id],
294
+ name: "transactions_store_id_fkey"
295
+ })
296
+ ]);
297
+ const sCustomers = snakeCase.schema("customers");
298
+ const customerAddresses = sCustomers.table("customer_addresses", {
299
+ id: p.serial().primaryKey().notNull(),
300
+ data: p.jsonb().default({}),
301
+ createdAt: p.timestamp({
302
+ withTimezone: true,
303
+ mode: "string"
304
+ }).defaultNow(),
305
+ customerId: p.varchar(),
306
+ storeId: p.integer().notNull()
307
+ }, (table) => [p.foreignKey({
308
+ columns: [table.storeId],
309
+ foreignColumns: [stores.id],
310
+ name: "customer_addresses_store_id_fkey"
311
+ })]);
312
+ const customerBillings = sCustomers.table("customer_billings", {
313
+ id: p.serial().primaryKey().notNull(),
314
+ data: p.jsonb().default({}),
315
+ createdAt: p.timestamp({
316
+ withTimezone: true,
317
+ mode: "string"
318
+ }).defaultNow(),
319
+ customerId: p.varchar(),
320
+ storeId: p.integer().notNull()
321
+ }, (table) => [p.foreignKey({
322
+ columns: [table.storeId],
323
+ foreignColumns: [stores.id],
324
+ name: "customer_billings_store_id_fkey"
325
+ })]);
326
+ const customerBuys = sCustomers.table("customer_buys", {
327
+ id: p.serial().primaryKey().notNull(),
328
+ data: p.jsonb().default({}),
329
+ createdAt: p.timestamp({
330
+ withTimezone: true,
331
+ mode: "string"
332
+ }).defaultNow(),
333
+ customerId: p.varchar(),
334
+ productId: p.bigint({ mode: "string" }),
335
+ transactionId: p.bigint({ mode: "string" }),
336
+ uid: p.varchar(),
337
+ storeId: p.integer().notNull()
338
+ }, (table) => [p.foreignKey({
339
+ columns: [table.storeId],
340
+ foreignColumns: [stores.id]
341
+ }), p.foreignKey({
342
+ columns: [table.transactionId],
343
+ foreignColumns: [transactions.id]
344
+ })]);
345
+ const ecommerce = snakeCase.schema("ecommerce");
346
+ const extensions = ecommerce.table("extensions", {
347
+ id: customBigSerial().primaryKey().notNull(),
348
+ slug: p.varchar().notNull(),
349
+ title: p.varchar(),
350
+ description: p.varchar(),
351
+ images: p.jsonb().default([]).notNull(),
352
+ data: p.jsonb().default({}).notNull(),
353
+ storeId: p.integer(),
354
+ createdAt: p.timestamp({
355
+ withTimezone: true,
356
+ mode: "string"
357
+ }).defaultNow()
358
+ }, (table) => [p.foreignKey({
359
+ columns: [table.storeId],
360
+ foreignColumns: [stores.id],
361
+ name: "extensions_store_id_fkey"
362
+ })]);
363
+ const orders = ecommerce.table("orders", {
364
+ id: customBigSerial().primaryKey().notNull(),
365
+ createdAt: p.timestamp({
366
+ withTimezone: true,
367
+ mode: "string"
368
+ }).defaultNow(),
369
+ transactionId: p.bigint({ mode: "number" }),
370
+ storeId: p.integer(),
371
+ statusPay: p.varchar().default("pending"),
372
+ customerId: p.varchar(),
373
+ statusShipping: p.varchar(),
374
+ extras: p.jsonb(),
375
+ shippingProvider: p.varchar(),
376
+ shipmentDetails: p.jsonb().default([])
377
+ }, (table) => [p.foreignKey({
378
+ columns: [table.transactionId],
379
+ foreignColumns: [transactions.id],
380
+ name: "orders_transaction_id_fkey"
381
+ }), p.foreignKey({
382
+ columns: [table.storeId],
383
+ foreignColumns: [stores.id],
384
+ name: "orders_store_id_fkey"
385
+ })]);
386
+ const products = ecommerce.table("products", {
387
+ id: p.bigserial({ mode: "number" }).primaryKey().notNull(),
388
+ slug: p.varchar(),
389
+ title: p.varchar(),
390
+ subtitle: p.varchar(),
391
+ weight: p.numeric({
392
+ precision: 10,
393
+ scale: 2
394
+ }),
395
+ description: p.varchar(),
396
+ type: p.varchar({ enum: ["secure", "product"] }).default("product").notNull(),
397
+ price: p.numeric({
398
+ precision: 10,
399
+ scale: 2
400
+ }),
401
+ comparedPrice: p.numeric("", {
402
+ precision: 10,
403
+ scale: 2
404
+ }),
405
+ images: p.jsonb().default([]).notNull().$type(),
406
+ extras: p.jsonb().default({}).notNull().$type(),
407
+ createdAt: p.timestamp({
408
+ withTimezone: true,
409
+ mode: "string"
410
+ }).defaultNow(),
411
+ storeId: p.integer().notNull(),
412
+ variants: p.jsonb().default({}).notNull().$type(),
413
+ discount: p.integer(),
414
+ enabled: p.boolean().default(true),
415
+ sku: p.varchar(),
416
+ order: p.integer()
417
+ }, (table) => [p.foreignKey({
418
+ columns: [table.storeId],
419
+ foreignColumns: [stores.id],
420
+ name: "products_store_id_fkey"
421
+ })]);
422
+ const productStocks = ecommerce.table("product_stocks", {
423
+ id: p.serial().primaryKey().notNull(),
424
+ variant: p.varchar({ length: 50 }),
425
+ quantity: p.integer(),
426
+ productId: p.bigint({ mode: "number" })
427
+ }, (table) => [p.foreignKey({
428
+ columns: [table.productId],
429
+ foreignColumns: [products.id],
430
+ name: "product_stocks_product_id_fkey"
431
+ }).onDelete("cascade")]);
432
+ const productTaxXRefs = ecommerce.table("product_tax_x_refs", {
433
+ id: customBigSerial().primaryKey().notNull(),
434
+ included: p.boolean().default(false),
435
+ productId: p.bigint({ mode: "number" }),
436
+ taxId: p.bigint({ mode: "number" })
437
+ }, (table) => [p.foreignKey({
438
+ columns: [table.taxId],
439
+ foreignColumns: [taxes.id],
440
+ name: "product_tax_x_refs_tax_id_fkey"
441
+ }), p.foreignKey({
442
+ columns: [table.productId],
443
+ foreignColumns: [products.id],
444
+ name: "product_tax_x_refs_product_id_fkey"
445
+ }).onDelete("cascade")]);
446
+ const taxes = ecommerce.table("taxes", {
447
+ id: p.bigserial({ mode: "number" }).primaryKey().notNull(),
448
+ title: p.varchar(),
449
+ code: p.varchar(),
450
+ value: p.numeric({
451
+ precision: 5,
452
+ scale: 2,
453
+ mode: "number"
454
+ }).notNull().default(0),
455
+ createdAt: p.timestamp({
456
+ withTimezone: true,
457
+ mode: "string"
458
+ }).defaultNow(),
459
+ storeId: p.integer().notNull(),
460
+ typeId: p.bigint({ mode: "number" }).notNull(),
461
+ countryId: p.varchar({ length: 2 }).default("ec").notNull()
462
+ }, (table) => [
463
+ p.foreignKey({
464
+ columns: [table.storeId],
465
+ foreignColumns: [stores.id],
466
+ name: "taxes_store_id_fkey"
467
+ }),
468
+ p.foreignKey({
469
+ columns: [table.typeId],
470
+ foreignColumns: [typeTaxes.id],
471
+ name: "taxes_type_id_fkey"
472
+ }),
473
+ p.foreignKey({
474
+ columns: [table.countryId],
475
+ foreignColumns: [countries.id]
476
+ })
477
+ ]);
478
+ const typeTaxes = ecommerce.table("type_taxes", {
479
+ id: p.bigserial({ mode: "number" }).primaryKey().notNull(),
480
+ name: p.varchar(),
481
+ code: p.varchar(),
482
+ countryId: p.varchar({ length: 2 }).default("ec"),
483
+ createdAt: p.timestamp({
484
+ withTimezone: true,
485
+ mode: "string"
486
+ }).defaultNow()
487
+ }, (table) => [p.foreignKey({
488
+ columns: [table.countryId],
489
+ foreignColumns: [countries.id]
490
+ })]);
491
+ const users = ecommerce.table("users", {
492
+ id: customBigSerial().primaryKey().notNull(),
493
+ email: p.varchar().notNull(),
494
+ role: p.varchar().notNull(),
495
+ createdAt: p.timestamp({
496
+ withTimezone: true,
497
+ mode: "string"
498
+ }).defaultNow(),
499
+ userId: p.text(),
500
+ storeId: p.integer().notNull()
501
+ }, (table) => [p.foreignKey({
502
+ columns: [table.storeId],
503
+ foreignColumns: [stores.id],
504
+ name: "users_store_id_fkey"
505
+ })]);
506
+ const customerReturns = sCustomers.table("customer_returns", {
507
+ id: p.serial().primaryKey().notNull(),
508
+ data: p.jsonb().default({}),
509
+ createdAt: p.timestamp({
510
+ withTimezone: true,
511
+ mode: "string"
512
+ }).defaultNow(),
513
+ customerId: p.varchar(),
514
+ storeId: p.integer().notNull(),
515
+ orderId: p.bigint({ mode: "number" })
516
+ }, (table) => [p.foreignKey({
517
+ columns: [table.storeId],
518
+ foreignColumns: [stores.id],
519
+ name: "customer_returns_store_id_fkey"
520
+ }), p.foreignKey({
521
+ columns: [table.orderId],
522
+ foreignColumns: [orders.id],
523
+ name: "customer_returns_order_id_fkey"
524
+ }).onDelete("cascade")]);
525
+ const customers = sCustomers.table("customers", {
526
+ id: p.serial().primaryKey().notNull(),
527
+ email: p.varchar().notNull(),
528
+ data: p.jsonb().default({}),
529
+ createdAt: p.timestamp({
530
+ withTimezone: true,
531
+ mode: "string"
532
+ }).defaultNow(),
533
+ storeId: p.integer().notNull(),
534
+ customerId: p.varchar(),
535
+ newsletter: p.boolean(),
536
+ offers: p.boolean(),
537
+ options: p.json().default({})
538
+ }, (table) => [p.foreignKey({
539
+ columns: [table.storeId],
540
+ foreignColumns: [stores.id],
541
+ name: "customers_store_id_fkey"
542
+ })]);
543
+ const customerWhislists = sCustomers.table("customer_whislists", {
544
+ id: p.serial().primaryKey().notNull(),
545
+ data: p.jsonb().default({}),
546
+ createdAt: p.timestamp({
547
+ withTimezone: true,
548
+ mode: "string"
549
+ }).defaultNow(),
550
+ customerId: p.varchar(),
551
+ storeId: p.integer().notNull(),
552
+ productId: p.bigint({ mode: "number" }).notNull()
553
+ }, (table) => [p.foreignKey({
554
+ columns: [table.storeId],
555
+ foreignColumns: [stores.id],
556
+ name: "customer_whislists_store_id_fkey"
557
+ }), p.foreignKey({
558
+ columns: [table.productId],
559
+ foreignColumns: [products.id],
560
+ name: "customer_whislists_product_id_fkey"
561
+ }).onDelete("cascade")]);
562
+ const payments = snakeCase.schema("payments");
563
+ const subscriptions = payments.table("subscriptions", {
564
+ id: serial("id").primaryKey(),
565
+ customerId: varchar("customer_id", { length: 255 }),
566
+ amount: decimal("amount", {
567
+ precision: 10,
568
+ scale: 2
569
+ }).notNull(),
570
+ currency: varchar("currency", { length: 10 }).notNull(),
571
+ startDate: date("start_date").notNull(),
572
+ interval: varchar("interval", {
573
+ length: 20,
574
+ enum: ["monthly", "manual"]
575
+ }).notNull(),
576
+ totalPayments: integer("total_payments").notNull(),
577
+ status: varchar("status", { length: 20 }).notNull(),
578
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
579
+ transactionId: bigint({ mode: "string" }),
580
+ storeId: integer().notNull(),
581
+ index: integer("index").default(0).notNull(),
582
+ ref: varchar("ref", { length: 255 })
583
+ }, (table) => [foreignKey({
584
+ columns: [table.storeId],
585
+ foreignColumns: [stores.id]
586
+ }), foreignKey({
587
+ columns: [table.transactionId],
588
+ foreignColumns: [transactions.id]
589
+ })]);
590
+ const recurringPayments = payments.table("recurring_payments", {
591
+ id: serial("id").primaryKey(),
592
+ subscriptionId: integer("subscription_id").notNull().references(() => subscriptions.id),
593
+ scheduledDate: date("scheduled_date").notNull(),
594
+ amount: decimal("amount", {
595
+ precision: 10,
596
+ scale: 2
597
+ }).notNull(),
598
+ status: varchar("status", { length: 20 }).notNull(),
599
+ attemptCount: integer("attempt_count").default(0).notNull(),
600
+ lastAttemptAt: timestamp("last_attempt_at", { withTimezone: true }),
601
+ maxAttempts: integer("max_attempts").default(3).notNull(),
602
+ paidAt: timestamp("paid_at", { withTimezone: true }),
603
+ failureReason: text("failure_reason"),
604
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull()
605
+ });
606
+ const paymentAttempts = payments.table("payment_attempts", {
607
+ id: serial("id").primaryKey(),
608
+ recurringPaymentId: integer("recurring_payment_id").notNull().references(() => recurringPayments.id),
609
+ attemptNumber: integer("attempt_number").notNull(),
610
+ attemptedAt: timestamp("attempted_at", { withTimezone: true }).defaultNow().notNull(),
611
+ status: varchar("status", { length: 20 }).notNull(),
612
+ failureReason: text("failure_reason"),
613
+ response: jsonb("response").default({})
614
+ });
615
+ const time = {
616
+ createdAt: p.timestamp("created_at").defaultNow().notNull(),
617
+ updatedAt: p.timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
618
+ };
619
+ const quote = p.snakeCase.schema("quote");
620
+ const quoteGroups = quote.table("groups", {
621
+ id: p.serial().primaryKey().notNull(),
622
+ title: p.varchar({ length: 255 }),
623
+ description: p.varchar(),
624
+ storeId: p.integer().notNull().references(() => stores.id),
625
+ ...time
626
+ });
627
+ const quoteQuotes = quote.table("quotes", {
628
+ id: p.serial().primaryKey().notNull(),
629
+ name: p.varchar({ length: 255 }).notNull(),
630
+ variables: p.jsonb().default([]),
631
+ settings: p.jsonb().default({}),
632
+ targetType: p.varchar({ length: 50 }).notNull(),
633
+ targetId: p.integer(),
634
+ storeId: p.integer().notNull().references(() => stores.id),
635
+ description: p.varchar(),
636
+ groupId: p.integer().references(() => quoteGroups.id),
637
+ ...time
638
+ });
639
+ const quoteVersions = quote.table("versions", {
640
+ id: p.serial().primaryKey().notNull(),
641
+ version: p.integer().notNull(),
642
+ title: p.varchar({ length: 255 }),
643
+ documentUrl: p.varchar("document_url"),
644
+ variables: p.jsonb().default([]),
645
+ schema: p.jsonb().default({}),
646
+ quoteId: p.integer("quote_id").references(() => quoteQuotes.id).notNull(),
647
+ images: p.jsonb().default({}),
648
+ publish: p.boolean().default(false),
649
+ ...time
650
+ });
651
+ const secures = snakeCase.schema("secures");
652
+ const reportBuys = secures.table("report_buys", {
653
+ id: p.serial().primaryKey().notNull(),
654
+ customerId: p.varchar(),
655
+ policyNumber: p.varchar(),
656
+ status: p.varchar(),
657
+ productId: p.bigint({ mode: "string" }),
658
+ category: p.varchar(),
659
+ planType: p.varchar(),
660
+ monthPayment: p.boolean().notNull().default(false),
661
+ amount: p.numeric().notNull(),
662
+ buyerFullname: p.varchar().notNull(),
663
+ buyerFirstname: p.varchar().notNull(),
664
+ buyerLastname: p.varchar().notNull(),
665
+ buyerSecondLastname: p.varchar(),
666
+ buyerEmail: p.varchar().notNull(),
667
+ buyerCity: p.varchar(),
668
+ buyerDocumentType: p.varchar(),
669
+ buyerDocumentNumber: p.varchar(),
670
+ buyerPhoneNumber: p.varchar(),
671
+ buyerBirthdate: p.timestamp({
672
+ withTimezone: true,
673
+ mode: "string"
674
+ }),
675
+ buyerGender: p.varchar(),
676
+ buyerCivilStatus: p.varchar(),
677
+ buyerNationality: p.varchar(),
678
+ buyerResidenceCountry: p.varchar(),
679
+ buyerAddress: p.varchar(),
680
+ invoiceDate: p.timestamp({
681
+ withTimezone: true,
682
+ mode: "string"
683
+ }),
684
+ storeId: p.integer().notNull(),
685
+ transactionId: p.bigint({ mode: "string" }),
686
+ createdAt: p.timestamp({
687
+ withTimezone: true,
688
+ mode: "string"
689
+ }).defaultNow(),
690
+ labels: p.jsonb().default({}),
691
+ data: p.jsonb().default({}),
692
+ index: p.integer("index").default(0).notNull()
693
+ }, (table) => [p.foreignKey({
694
+ columns: [table.storeId],
695
+ foreignColumns: [stores.id]
696
+ }), p.foreignKey({
697
+ columns: [table.transactionId],
698
+ foreignColumns: [transactions.id]
699
+ })]);
700
+ const reportDebts = secures.table("report_debts", {
701
+ id: p.serial().primaryKey().notNull(),
702
+ customerId: p.varchar(),
703
+ policyNumber: p.varchar(),
704
+ cuote: p.integer(),
705
+ productId: p.bigint({ mode: "string" }),
706
+ category: p.varchar(),
707
+ amount: p.numeric().notNull(),
708
+ buyerFirstname: p.varchar().notNull(),
709
+ buyerLastname: p.varchar().notNull(),
710
+ buyerSecondLastname: p.varchar(),
711
+ buyerEmail: p.varchar().notNull(),
712
+ buyerCity: p.varchar(),
713
+ buyerDocumentType: p.varchar(),
714
+ buyerDocumentNumber: p.varchar(),
715
+ buyerPhoneNumber: p.varchar(),
716
+ expireDate: p.timestamp({
717
+ withTimezone: true,
718
+ mode: "string"
719
+ }),
720
+ createdAt: p.timestamp({
721
+ withTimezone: true,
722
+ mode: "string"
723
+ }).defaultNow(),
724
+ storeId: p.integer().notNull(),
725
+ transactionId: p.bigint({ mode: "string" }),
726
+ labels: p.jsonb().default({}),
727
+ data: p.jsonb().default({}),
728
+ recurringPaymentId: p.integer()
729
+ }, (table) => [
730
+ p.foreignKey({
731
+ columns: [table.storeId],
732
+ foreignColumns: [stores.id]
733
+ }),
734
+ p.foreignKey({
735
+ columns: [table.transactionId],
736
+ foreignColumns: [transactions.id]
737
+ }),
738
+ p.foreignKey({
739
+ columns: [table.recurringPaymentId],
740
+ foreignColumns: [recurringPayments.id]
741
+ })
742
+ ]);
743
+ const reportLogs = secures.table("report_logs", {
744
+ id: p.serial().primaryKey().notNull(),
745
+ customerId: p.varchar(),
746
+ policyNumber: p.varchar(),
747
+ status: p.varchar(),
748
+ productId: p.bigint({ mode: "string" }),
749
+ category: p.varchar(),
750
+ activity: p.varchar(),
751
+ event: p.varchar(),
752
+ buyerFullname: p.varchar().notNull(),
753
+ buyerFirstname: p.varchar().notNull(),
754
+ buyerLastname: p.varchar().notNull(),
755
+ buyerSecondLastname: p.varchar(),
756
+ buyerEmail: p.varchar().notNull(),
757
+ storeId: p.integer().notNull(),
758
+ transactionId: p.bigint({ mode: "string" }),
759
+ labels: p.jsonb().default({}),
760
+ createdAt: p.timestamp({
761
+ withTimezone: true,
762
+ mode: "string"
763
+ }).defaultNow(),
764
+ data: p.jsonb().default({}),
765
+ isError: p.boolean().default(false)
766
+ }, (table) => [p.foreignKey({
767
+ columns: [table.storeId],
768
+ foreignColumns: [stores.id]
769
+ }), p.foreignKey({
770
+ columns: [table.transactionId],
771
+ foreignColumns: [transactions.id]
772
+ })]);
773
+ const reportMessages = secures.table("report_messages", {
774
+ id: p.serial().primaryKey().notNull(),
775
+ customerId: p.varchar(),
776
+ policyNumber: p.varchar(),
777
+ status: p.varchar(),
778
+ productId: p.bigint({ mode: "string" }),
779
+ category: p.varchar(),
780
+ description: p.varchar(),
781
+ createdAt: p.timestamp({
782
+ withTimezone: true,
783
+ mode: "string"
784
+ }).defaultNow(),
785
+ storeId: p.integer().notNull(),
786
+ transactionId: p.bigint({ mode: "string" }),
787
+ labels: p.jsonb().default({}),
788
+ data: p.jsonb().default({})
789
+ }, (table) => [p.foreignKey({
790
+ columns: [table.storeId],
791
+ foreignColumns: [stores.id]
792
+ }), p.foreignKey({
793
+ columns: [table.transactionId],
794
+ foreignColumns: [transactions.id]
795
+ })]);
796
+ const reportPayments = secures.table("report_payments", {
797
+ id: p.serial().primaryKey().notNull(),
798
+ customerId: p.varchar(),
799
+ policyNumber: p.varchar(),
800
+ documentKey: p.varchar(),
801
+ cuote: p.integer(),
802
+ productId: p.bigint({ mode: "string" }),
803
+ invoiceNumber: p.varchar(),
804
+ status: p.varchar(),
805
+ amount: p.numeric().notNull(),
806
+ storeId: p.integer().notNull(),
807
+ transactionId: p.bigint({ mode: "string" }),
808
+ nit: p.varchar().notNull(),
809
+ fullname: p.varchar().notNull(),
810
+ authorizationNumber: p.varchar().notNull(),
811
+ codeControl: p.varchar(),
812
+ buyerFullname: p.varchar().notNull(),
813
+ buyerFirstname: p.varchar().notNull(),
814
+ buyerLastname: p.varchar().notNull(),
815
+ category: p.varchar(),
816
+ paymentMethod: p.varchar(),
817
+ transactionCode: p.varchar(),
818
+ labels: p.jsonb().default({}),
819
+ createdAt: p.timestamp({
820
+ withTimezone: true,
821
+ mode: "string"
822
+ }).defaultNow(),
823
+ data: p.jsonb().default({})
824
+ }, (table) => [p.foreignKey({
825
+ columns: [table.storeId],
826
+ foreignColumns: [stores.id]
827
+ }), p.foreignKey({
828
+ columns: [table.transactionId],
829
+ foreignColumns: [transactions.id]
830
+ })]);
831
+ export { account, auth, buys, checkouts, countries, customBigSerial, customerAddresses, customerBillings, customerBuys, customerReturns, customerWhislists, customers, discountCoupons, discounts, drivers, ecommerce, extensions, keys, links, namespaceKeys, orders, paymentAttempts, payments, pgmigrations, productStocks, productTaxXRefs, products, quote, quoteGroups, quoteQuotes, quoteVersions, recurringPayments, refunds, reportBuys, reportDebts, reportLogs, reportMessages, reportPayments, sCustomers, secures, session, sessions, stores, subscriptions, taxes, teamUserXRefs, teamZoneXRefs, teams, transactions, typeTaxes, user, users, verification, zones };