@stacksjs/orm 0.72.16 → 0.72.17

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 (101) hide show
  1. package/dist/index.d.ts +97 -97
  2. package/dist/models/Activity.ts +95 -0
  3. package/dist/models/AnalyticsEvent.ts +70 -0
  4. package/dist/models/Automation.ts +23 -0
  5. package/dist/models/AutomationRun.ts +26 -0
  6. package/dist/models/Board.ts +104 -0
  7. package/dist/models/BoardColumn.ts +88 -0
  8. package/dist/models/Campaign.ts +321 -0
  9. package/dist/models/CampaignSend.ts +191 -0
  10. package/dist/models/CampaignVariant.ts +25 -0
  11. package/dist/models/Card.ts +118 -0
  12. package/dist/models/CardComment.ts +68 -0
  13. package/dist/models/Comment.ts +109 -0
  14. package/dist/models/CommunicationSuppression.ts +22 -0
  15. package/dist/models/ConsentEvent.ts +30 -0
  16. package/dist/models/Content/Author.ts +109 -0
  17. package/dist/models/Content/Menu.ts +56 -0
  18. package/dist/models/Content/MenuItem.ts +91 -0
  19. package/dist/models/Content/Page.ts +205 -0
  20. package/dist/models/Content/PageRevision.ts +86 -0
  21. package/dist/models/Content/Post.ts +230 -0
  22. package/dist/models/Content/Redirect.ts +80 -0
  23. package/dist/models/Deployment.ts +117 -0
  24. package/dist/models/EmailIdempotency.ts +64 -0
  25. package/dist/models/EmailList.ts +134 -0
  26. package/dist/models/EmailListSubscriber.ts +91 -0
  27. package/dist/models/EmailSuppression.ts +52 -0
  28. package/dist/models/EmailWebhookEvent.ts +51 -0
  29. package/dist/models/Error.ts +77 -0
  30. package/dist/models/FailedJob.ts +84 -0
  31. package/dist/models/Forms/Form.ts +91 -0
  32. package/dist/models/Forms/FormField.ts +127 -0
  33. package/dist/models/Forms/FormSubmission.ts +114 -0
  34. package/dist/models/Job.ts +69 -0
  35. package/dist/models/Label.ts +67 -0
  36. package/dist/models/Log.ts +134 -0
  37. package/dist/models/MagicLinkToken.ts +97 -0
  38. package/dist/models/MailPreference.ts +213 -0
  39. package/dist/models/Notification.ts +68 -0
  40. package/dist/models/NotificationDelivery.ts +102 -0
  41. package/dist/models/PaymentMethod.ts +98 -0
  42. package/dist/models/PaymentProduct.ts +91 -0
  43. package/dist/models/PaymentTransaction.ts +78 -0
  44. package/dist/models/QueryLog.ts +182 -0
  45. package/dist/models/README.md +31 -0
  46. package/dist/models/Release.ts +90 -0
  47. package/dist/models/Request.ts +133 -0
  48. package/dist/models/SenderDomain.ts +22 -0
  49. package/dist/models/Site.ts +112 -0
  50. package/dist/models/SiteDomain.ts +74 -0
  51. package/dist/models/SmsOptOut.ts +65 -0
  52. package/dist/models/SocialAccount.ts +70 -0
  53. package/dist/models/SocialPost.ts +144 -0
  54. package/dist/models/Subscriber.ts +89 -0
  55. package/dist/models/SubscriberEmail.ts +55 -0
  56. package/dist/models/Subscription.ts +153 -0
  57. package/dist/models/Tag.ts +105 -0
  58. package/dist/models/Team.ts +75 -0
  59. package/dist/models/TeamInvitation.ts +159 -0
  60. package/dist/models/TeamMember.ts +88 -0
  61. package/dist/models/UsageEvent.ts +24 -0
  62. package/dist/models/User.ts +142 -0
  63. package/dist/models/commerce/Auction.ts +173 -0
  64. package/dist/models/commerce/AuctionItem.ts +204 -0
  65. package/dist/models/commerce/Bid.ts +129 -0
  66. package/dist/models/commerce/Cart.ts +140 -0
  67. package/dist/models/commerce/CartItem.ts +138 -0
  68. package/dist/models/commerce/Category.ts +125 -0
  69. package/dist/models/commerce/Coupon.ts +186 -0
  70. package/dist/models/commerce/Customer.ts +132 -0
  71. package/dist/models/commerce/DeliveryRoute.ts +127 -0
  72. package/dist/models/commerce/DeliveryStop.ts +166 -0
  73. package/dist/models/commerce/DigitalDelivery.ts +106 -0
  74. package/dist/models/commerce/Driver.ts +168 -0
  75. package/dist/models/commerce/DriverPing.ts +103 -0
  76. package/dist/models/commerce/GiftCard.ts +195 -0
  77. package/dist/models/commerce/LicenseKey.ts +89 -0
  78. package/dist/models/commerce/LoyaltyPoint.ts +108 -0
  79. package/dist/models/commerce/LoyaltyReward.ts +129 -0
  80. package/dist/models/commerce/Manufacturer.ts +90 -0
  81. package/dist/models/commerce/Order.ts +198 -0
  82. package/dist/models/commerce/OrderIdempotency.ts +34 -0
  83. package/dist/models/commerce/OrderItem.ts +51 -0
  84. package/dist/models/commerce/Payment.ts +182 -0
  85. package/dist/models/commerce/Pledge.ts +112 -0
  86. package/dist/models/commerce/PrintDevice.ts +120 -0
  87. package/dist/models/commerce/Product.ts +153 -0
  88. package/dist/models/commerce/ProductUnit.ts +113 -0
  89. package/dist/models/commerce/ProductVariant.ts +111 -0
  90. package/dist/models/commerce/Receipt.ts +144 -0
  91. package/dist/models/commerce/Review.ts +171 -0
  92. package/dist/models/commerce/ShippingMethod.ts +102 -0
  93. package/dist/models/commerce/ShippingRate.ts +79 -0
  94. package/dist/models/commerce/ShippingZone.ts +116 -0
  95. package/dist/models/commerce/TaxRate.ts +167 -0
  96. package/dist/models/commerce/Transaction.ts +127 -0
  97. package/dist/models/commerce/WaitlistProduct.ts +151 -0
  98. package/dist/models/commerce/WaitlistRestaurant.ts +189 -0
  99. package/dist/models/realtime/Websocket.ts +78 -0
  100. package/dist/password-policy.ts +46 -0
  101. package/package.json +4 -4
@@ -0,0 +1,213 @@
1
+ import { defineModel } from '@stacksjs/orm'
2
+ import { schema } from '@stacksjs/validation'
3
+
4
+ export default defineModel({
5
+ name: 'MailPreference',
6
+ table: 'mail_preferences',
7
+ primaryKey: 'id',
8
+ autoIncrement: true,
9
+
10
+ traits: {
11
+ useTimestamps: true,
12
+ useApi: {
13
+ uri: 'mail-preferences',
14
+ routes: ['index', 'store', 'show', 'update', 'destroy'],
15
+ middleware: ['auth'],
16
+ },
17
+ },
18
+
19
+ attributes: {
20
+ mailbox: {
21
+ fillable: true,
22
+ required: true,
23
+ unique: true,
24
+ validation: {
25
+ rule: schema.string().email().max(320).required(),
26
+ },
27
+ },
28
+
29
+ accountName: {
30
+ fillable: true,
31
+ required: true,
32
+ default: 'Stacks',
33
+ validation: {
34
+ rule: schema.string().max(255).required(),
35
+ },
36
+ },
37
+
38
+ signature: {
39
+ fillable: true,
40
+ required: false,
41
+ validation: {
42
+ rule: schema.string().max(20_000),
43
+ },
44
+ },
45
+
46
+ displayDensity: {
47
+ fillable: true,
48
+ required: true,
49
+ default: 'default',
50
+ validation: {
51
+ rule: schema.enum(['comfortable', 'default', 'compact']),
52
+ },
53
+ },
54
+
55
+ theme: {
56
+ fillable: true,
57
+ required: true,
58
+ default: 'system',
59
+ validation: {
60
+ rule: schema.enum(['light', 'dark', 'system']),
61
+ },
62
+ },
63
+
64
+ language: {
65
+ fillable: true,
66
+ required: true,
67
+ default: 'en',
68
+ validation: {
69
+ rule: schema.enum(['en', 'fr', 'de', 'es', 'ja']),
70
+ },
71
+ },
72
+
73
+ defaultReplyBehavior: {
74
+ fillable: true,
75
+ required: true,
76
+ default: 'replyAll',
77
+ validation: {
78
+ rule: schema.enum(['reply', 'replyAll']),
79
+ },
80
+ },
81
+
82
+ sendAndArchive: {
83
+ fillable: true,
84
+ required: true,
85
+ default: true,
86
+ validation: {
87
+ rule: schema.boolean(),
88
+ },
89
+ },
90
+
91
+ autoAdvance: {
92
+ fillable: true,
93
+ required: true,
94
+ default: 'newer',
95
+ validation: {
96
+ rule: schema.enum(['newer', 'older', 'back']),
97
+ },
98
+ },
99
+
100
+ desktopNotifications: {
101
+ fillable: true,
102
+ required: true,
103
+ default: true,
104
+ validation: {
105
+ rule: schema.boolean(),
106
+ },
107
+ },
108
+
109
+ notificationSound: {
110
+ fillable: true,
111
+ required: true,
112
+ default: 'default',
113
+ validation: {
114
+ rule: schema.enum(['default', 'subtle', 'none']),
115
+ },
116
+ },
117
+
118
+ notificationPreview: {
119
+ fillable: true,
120
+ required: true,
121
+ default: true,
122
+ validation: {
123
+ rule: schema.boolean(),
124
+ },
125
+ },
126
+
127
+ filters: {
128
+ fillable: true,
129
+ required: true,
130
+ default: '[]',
131
+ validation: {
132
+ rule: schema.string(),
133
+ },
134
+ },
135
+
136
+ blockedSenders: {
137
+ fillable: true,
138
+ required: true,
139
+ default: '[]',
140
+ validation: {
141
+ rule: schema.string(),
142
+ },
143
+ },
144
+
145
+ labels: {
146
+ fillable: true,
147
+ required: true,
148
+ default: '[]',
149
+ validation: {
150
+ rule: schema.string(),
151
+ },
152
+ },
153
+
154
+ loadRemoteImages: {
155
+ fillable: true,
156
+ required: true,
157
+ default: false,
158
+ validation: {
159
+ rule: schema.boolean(),
160
+ },
161
+ },
162
+
163
+ showExternalContent: {
164
+ fillable: true,
165
+ required: true,
166
+ default: false,
167
+ validation: {
168
+ rule: schema.boolean(),
169
+ },
170
+ },
171
+
172
+ vacationEnabled: {
173
+ fillable: true,
174
+ required: true,
175
+ default: false,
176
+ validation: {
177
+ rule: schema.boolean(),
178
+ },
179
+ },
180
+
181
+ vacationStartDate: {
182
+ fillable: true,
183
+ required: false,
184
+ validation: {
185
+ rule: schema.string(),
186
+ },
187
+ },
188
+
189
+ vacationEndDate: {
190
+ fillable: true,
191
+ required: false,
192
+ validation: {
193
+ rule: schema.string(),
194
+ },
195
+ },
196
+
197
+ vacationSubject: {
198
+ fillable: true,
199
+ required: false,
200
+ validation: {
201
+ rule: schema.string().max(255),
202
+ },
203
+ },
204
+
205
+ vacationMessage: {
206
+ fillable: true,
207
+ required: false,
208
+ validation: {
209
+ rule: schema.string().max(20_000),
210
+ },
211
+ },
212
+ },
213
+ } as const)
@@ -0,0 +1,68 @@
1
+ import { defineModel } from '@stacksjs/orm'
2
+ import { schema } from '@stacksjs/validation'
3
+
4
+ export default defineModel({
5
+ name: 'Notification',
6
+ table: 'notifications',
7
+ primaryKey: 'id',
8
+ autoIncrement: true,
9
+
10
+ traits: {
11
+ useUuid: true,
12
+ useTimestamps: true,
13
+ useSeeder: {
14
+ count: 30,
15
+ },
16
+ useApi: {
17
+ uri: 'notifications',
18
+ routes: ['index', 'store', 'show', 'update', 'destroy'],
19
+ middleware: ['auth'],
20
+ },
21
+ },
22
+
23
+ belongsTo: ['User'],
24
+
25
+ attributes: {
26
+ type: {
27
+ required: true,
28
+ fillable: true,
29
+ validation: {
30
+ rule: schema.string().max(255),
31
+ },
32
+ factory: faker => faker.helpers.arrayElement([
33
+ 'order.shipped',
34
+ 'payment.received',
35
+ 'security.alert',
36
+ 'subscription.renewed',
37
+ ]),
38
+ },
39
+
40
+ data: {
41
+ type: 'text',
42
+ required: true,
43
+ fillable: true,
44
+ validation: {
45
+ rule: schema.string(),
46
+ },
47
+ factory: faker => JSON.stringify({
48
+ body: faker.lorem.sentence(),
49
+ source: 'system',
50
+ }),
51
+ },
52
+
53
+ readAt: {
54
+ required: false,
55
+ fillable: true,
56
+ validation: {
57
+ rule: schema.timestamp(),
58
+ },
59
+ factory: (faker) => {
60
+ if (faker.datatype.boolean()) {
61
+ return faker.date.recent().toISOString().slice(0, 19).replace('T', ' ')
62
+ }
63
+ return null
64
+ },
65
+ },
66
+
67
+ },
68
+ } as const)
@@ -0,0 +1,102 @@
1
+ import { defineModel } from '@stacksjs/orm'
2
+ import { schema } from '@stacksjs/validation'
3
+
4
+ export default defineModel({
5
+ name: 'NotificationDelivery',
6
+ table: 'notification_deliveries',
7
+ primaryKey: 'id',
8
+ autoIncrement: true,
9
+
10
+ traits: {
11
+ useTimestamps: true,
12
+ useSearch: {
13
+ displayable: ['id', 'channel', 'recipient', 'subject', 'status', 'sentAt'],
14
+ searchable: ['recipient', 'subject', 'body', 'error'],
15
+ sortable: ['channel', 'recipient', 'status', 'sentAt', 'createdAt'],
16
+ filterable: ['channel', 'status'],
17
+ },
18
+ useApi: {
19
+ uri: 'notification-deliveries',
20
+ routes: ['index', 'show', 'destroy'],
21
+ middleware: ['auth'],
22
+ },
23
+ },
24
+
25
+ attributes: {
26
+ userId: {
27
+ required: false,
28
+ fillable: true,
29
+ validation: {
30
+ rule: schema.number(),
31
+ },
32
+ },
33
+
34
+ channel: {
35
+ type: 'string',
36
+ required: true,
37
+ fillable: true,
38
+ validation: {
39
+ rule: schema.enum(['email', 'sms', 'chat', 'database', 'push', 'broadcast']),
40
+ },
41
+ },
42
+
43
+ recipient: {
44
+ required: true,
45
+ fillable: true,
46
+ validation: {
47
+ rule: schema.string().max(1000),
48
+ },
49
+ },
50
+
51
+ subject: {
52
+ required: false,
53
+ fillable: true,
54
+ validation: {
55
+ rule: schema.string().max(255),
56
+ },
57
+ },
58
+
59
+ body: {
60
+ required: true,
61
+ fillable: true,
62
+ validation: {
63
+ rule: schema.string().max(10000),
64
+ },
65
+ },
66
+
67
+ status: {
68
+ type: 'string',
69
+ required: true,
70
+ fillable: true,
71
+ default: 'pending',
72
+ validation: {
73
+ rule: schema.enum(['pending', 'sent', 'delivered', 'failed']),
74
+ },
75
+ },
76
+
77
+ error: {
78
+ required: false,
79
+ fillable: true,
80
+ validation: {
81
+ rule: schema.string().max(5000),
82
+ },
83
+ },
84
+
85
+ metadata: {
86
+ type: 'text',
87
+ required: false,
88
+ fillable: true,
89
+ validation: {
90
+ rule: schema.string(),
91
+ },
92
+ },
93
+
94
+ sentAt: {
95
+ required: false,
96
+ fillable: true,
97
+ validation: {
98
+ rule: schema.timestamp(),
99
+ },
100
+ },
101
+ },
102
+ } as const)
@@ -0,0 +1,98 @@
1
+ import { defineModel } from '@stacksjs/orm'
2
+ import { collect } from '@stacksjs/collections'
3
+
4
+ import { schema } from '@stacksjs/validation'
5
+
6
+ export default defineModel({
7
+ name: 'PaymentMethod', // defaults to the sanitized file name
8
+ table: 'payment_methods', // defaults to the lowercase, plural name of the model name (or the name of the model file)
9
+ primaryKey: 'id', // defaults to `id`
10
+ autoIncrement: true, // defaults to true
11
+ belongsTo: ['User'],
12
+ hasMany: ['PaymentTransaction'],
13
+ traits: {
14
+ useSeeder: {
15
+ count: 5,
16
+ },
17
+ useUuid: true,
18
+ },
19
+ attributes: {
20
+ type: {
21
+ fillable: true,
22
+ validation: {
23
+ rule: schema.string().required().max(512),
24
+ message: {
25
+ string: 'type must be a string',
26
+ required: 'type is required',
27
+ max: 'type must have a maximum of 512 characters',
28
+ },
29
+ },
30
+ factory: () => 'card',
31
+ },
32
+
33
+ lastFour: {
34
+ fillable: true,
35
+ validation: {
36
+ rule: schema.number().required(),
37
+ message: {
38
+ number: 'last_four must be a number',
39
+ required: 'last_four is required',
40
+ },
41
+ },
42
+ factory: faker => faker.string.numeric(4),
43
+ },
44
+
45
+ brand: {
46
+ fillable: true,
47
+ validation: {
48
+ rule: schema.string().required().max(50),
49
+ message: {
50
+ number: 'brand must be a number',
51
+ required: 'brand is required',
52
+ },
53
+ },
54
+ factory: () => collect(['visa', 'mastercard', 'amex', 'jcb']).random().first(),
55
+ },
56
+
57
+ expMonth: {
58
+ fillable: true,
59
+ validation: {
60
+ rule: schema.number().required(),
61
+ message: {
62
+ string: 'exp_month must be a number',
63
+ required: 'exp_month is required',
64
+ },
65
+ },
66
+ factory: faker => faker.number.int({ min: 1, max: 12 }),
67
+ },
68
+
69
+ expYear: {
70
+ fillable: true,
71
+ validation: {
72
+ rule: schema.number().required(),
73
+ message: {
74
+ string: 'exp_year must be a number',
75
+ required: 'exp_year is required',
76
+ },
77
+ },
78
+ factory: faker => faker.number.int({ min: 2024, max: 2050 }),
79
+ },
80
+ isDefault: {
81
+ fillable: true,
82
+ validation: {
83
+ rule: schema.boolean(),
84
+ },
85
+ },
86
+ providerId: {
87
+ fillable: true,
88
+ validation: {
89
+ rule: schema.string().max(255),
90
+ message: {
91
+ string: 'provider_id must be a string',
92
+ required: 'provider_id is required',
93
+ },
94
+ },
95
+ factory: faker => faker.string.alphanumeric(10),
96
+ },
97
+ },
98
+ } as const)
@@ -0,0 +1,91 @@
1
+ import { defineModel } from '@stacksjs/orm'
2
+ import { schema } from '@stacksjs/validation'
3
+
4
+ export default defineModel({
5
+ name: 'PaymentProduct', // defaults to the sanitized file name
6
+ table: 'payment_products', // defaults to the lowercase, plural name of the model name (or the name of the model file)
7
+ primaryKey: 'id', // defaults to `id`
8
+ autoIncrement: true, // defaults to true
9
+ traits: {
10
+ useSeeder: {
11
+ count: 10,
12
+ },
13
+ useUuid: true,
14
+ },
15
+ attributes: {
16
+ name: {
17
+ fillable: true,
18
+ validation: {
19
+ rule: schema.string().required().max(512),
20
+ message: {
21
+ string: 'type must be a string',
22
+ required: 'type is required',
23
+ max: 'type must have a maximum of 512 characters',
24
+ },
25
+ },
26
+ factory: faker => faker.food.dish(),
27
+ },
28
+
29
+ description: {
30
+ fillable: true,
31
+ validation: {
32
+ rule: schema.string(),
33
+ message: {
34
+ string: 'description must be a string',
35
+ required: 'description is required',
36
+ },
37
+ },
38
+ factory: faker => faker.lorem.lines(3),
39
+ },
40
+ key: {
41
+ fillable: true,
42
+ validation: {
43
+ rule: schema.string().required(),
44
+ message: {
45
+ string: 'key must be a string',
46
+ required: 'key is required',
47
+ },
48
+ },
49
+ factory: faker => faker.string.alphanumeric(5),
50
+ },
51
+
52
+ unitPrice: {
53
+ fillable: true,
54
+ validation: {
55
+ rule: schema.number().required(),
56
+ message: {
57
+ string: 'expires must be a string',
58
+ required: 'expires is required',
59
+ },
60
+ },
61
+ factory: faker => faker.number.int({ min: 1000, max: 10000 }),
62
+ },
63
+ status: {
64
+ fillable: true,
65
+ validation: {
66
+ rule: schema.string(),
67
+ },
68
+ factory: faker => faker.lorem.lines(1),
69
+ },
70
+ image: {
71
+ fillable: true,
72
+ validation: {
73
+ rule: schema.string(),
74
+ message: {
75
+ string: 'image must be a string',
76
+ },
77
+ },
78
+ factory: faker => faker.image.url(),
79
+ },
80
+ providerId: {
81
+ fillable: true,
82
+ validation: {
83
+ rule: schema.string().max(255),
84
+ message: {
85
+ string: 'provider_id must be a string',
86
+ },
87
+ },
88
+ factory: faker => faker.string.alphanumeric(10),
89
+ },
90
+ },
91
+ } as const)
@@ -0,0 +1,78 @@
1
+ import { defineModel } from '@stacksjs/orm'
2
+ import { collect } from '@stacksjs/collections'
3
+
4
+ import { schema } from '@stacksjs/validation'
5
+
6
+ export default defineModel({
7
+ name: 'PaymentTransaction', // defaults to the sanitized file name
8
+ table: 'payment_transactions', // defaults to the lowercase, plural name of the model name (or the name of the model file)
9
+ primaryKey: 'id', // defaults to `id`
10
+ autoIncrement: true, // defaults to true
11
+ belongsTo: ['User', 'PaymentMethod'],
12
+ traits: {
13
+ useUuid: true,
14
+ useSeeder: {
15
+ count: 5,
16
+ },
17
+ },
18
+ attributes: {
19
+ name: {
20
+ fillable: true,
21
+ validation: {
22
+ rule: schema.string().required().max(255),
23
+ message: {
24
+ string: 'name must be a string',
25
+ required: 'name is required',
26
+ max: 'name must have a maximum of 255 characters',
27
+ },
28
+ },
29
+ factory: () => 'Dashboard Subscription',
30
+ },
31
+
32
+ description: {
33
+ fillable: true,
34
+ validation: {
35
+ rule: schema.string(),
36
+ message: {
37
+ string: 'description must be a string',
38
+ },
39
+ },
40
+ factory: faker => faker.lorem.lines(2),
41
+ },
42
+
43
+ amount: {
44
+ fillable: true,
45
+ validation: {
46
+ rule: schema.number().required(),
47
+ message: {
48
+ number: 'amount must be a number',
49
+ required: 'amount is required',
50
+ },
51
+ },
52
+ factory: faker => faker.number.int({ min: 1000, max: 10000 }),
53
+ },
54
+
55
+ type: {
56
+ fillable: true,
57
+ validation: {
58
+ rule: schema.string().required().max(50),
59
+ message: {
60
+ string: 'type must be a string',
61
+ max: 'type must have a maximum of 512 characters',
62
+ },
63
+ },
64
+ factory: () => collect(['one-time', 'subscription']).random().first(),
65
+ },
66
+ providerId: {
67
+ fillable: true,
68
+ validation: {
69
+ rule: schema.string().max(255),
70
+ message: {
71
+ string: 'provider_id must be a number',
72
+ required: 'provider_id is required',
73
+ },
74
+ },
75
+ factory: faker => faker.string.alphanumeric(10),
76
+ },
77
+ },
78
+ } as const)