pockethost 1.0.0-rc.1

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 (44) hide show
  1. package/LICENSE.md +16 -0
  2. package/dist/index.mjs +3156 -0
  3. package/dist/instance-app/migrations/1699198734_pockethost_defaults.js +39 -0
  4. package/dist/instance-app/pb_hooks/_ph_admin_sync.pb.js +71 -0
  5. package/dist/instance-app/pb_hooks/_ph_lib.js +19 -0
  6. package/dist/instance-app/tsconfig.json +8 -0
  7. package/dist/instance-app/types/goja.d.ts +58 -0
  8. package/dist/instance-app/types/lib.d.ts +5 -0
  9. package/dist/instance-app/types/types.d.ts +19573 -0
  10. package/dist/mothership-app/migrations/1705062576_collections_snapshot.js +1863 -0
  11. package/dist/mothership-app/migrations/1705083826_updated_stats.js +721 -0
  12. package/dist/mothership-app/migrations/1706060446_updated_instances.js +44 -0
  13. package/dist/mothership-app/pb_hooks/src/instances-create.pb.js +65 -0
  14. package/dist/mothership-app/pb_hooks/src/instances-delete.pb.js +69 -0
  15. package/dist/mothership-app/pb_hooks/src/instances-migrate-versions.pb.js +33 -0
  16. package/dist/mothership-app/pb_hooks/src/instances-notify-discord-after-create.pb.js +31 -0
  17. package/dist/mothership-app/pb_hooks/src/instances-notify-on-maintenance-mode.pb.js +52 -0
  18. package/dist/mothership-app/pb_hooks/src/instances-reset-idle.pb.js +7 -0
  19. package/dist/mothership-app/pb_hooks/src/instances-update.pb.js +121 -0
  20. package/dist/mothership-app/pb_hooks/src/instances-validate-before-create.pb.js +16 -0
  21. package/dist/mothership-app/pb_hooks/src/instances-validate-before-update.pb.js +43 -0
  22. package/dist/mothership-app/pb_hooks/src/lib.js +171 -0
  23. package/dist/mothership-app/pb_hooks/src/ls.pb.js +159 -0
  24. package/dist/mothership-app/pb_hooks/src/mail.pb.js +49 -0
  25. package/dist/mothership-app/pb_hooks/src/notifications.pb.js +62 -0
  26. package/dist/mothership-app/pb_hooks/src/random-words.js +2085 -0
  27. package/dist/mothership-app/pb_hooks/src/signup.pb.js +214 -0
  28. package/dist/mothership-app/pb_hooks/src/sns.pb.js +133 -0
  29. package/dist/mothership-app/pb_hooks/src/unsubscribe.pb.js +33 -0
  30. package/dist/mothership-app/pb_hooks/src/user-token.pb.js +33 -0
  31. package/dist/mothership-app/pb_hooks/src/user-welcome-msg.pb.js +32 -0
  32. package/dist/mothership-app/pb_hooks/src/versions-route.pb.js +12 -0
  33. package/dist/mothership-app/pb_hooks/src/versions.js +0 -0
  34. package/dist/mothership-app/pb_hooks/tsconfig.json +8 -0
  35. package/dist/mothership-app/pb_hooks/types/global.d.ts +1 -0
  36. package/dist/mothership-app/pb_hooks/types/goja.d.ts +58 -0
  37. package/dist/mothership-app/pb_hooks/types/lemon.d.ts +12 -0
  38. package/dist/mothership-app/pb_hooks/types/lib.d.ts +55 -0
  39. package/dist/mothership-app/pb_hooks/types/types.d.ts +19573 -0
  40. package/dist/mothership-app/ph_app/index.js +11 -0
  41. package/dist/mothership-app/ph_app/package-lock.json +657 -0
  42. package/dist/mothership-app/ph_app/package.json +14 -0
  43. package/package.json +144 -0
  44. package/readme.md +168 -0
@@ -0,0 +1,1863 @@
1
+ /// <reference path="../pb_data/types.d.ts" />
2
+ migrate((db) => {
3
+ const snapshot = [
4
+ {
5
+ "id": "etae8tuiaxl6xfv",
6
+ "created": "2022-09-17 16:25:20.140Z",
7
+ "updated": "2024-01-06 09:43:36.008Z",
8
+ "name": "instances",
9
+ "type": "base",
10
+ "system": false,
11
+ "schema": [
12
+ {
13
+ "system": false,
14
+ "id": "qdtuuld1",
15
+ "name": "subdomain",
16
+ "type": "text",
17
+ "required": true,
18
+ "presentable": true,
19
+ "unique": false,
20
+ "options": {
21
+ "min": null,
22
+ "max": 50,
23
+ "pattern": "^[a-z][a-z0-9-]{2,39}$"
24
+ }
25
+ },
26
+ {
27
+ "system": false,
28
+ "id": "rbj14krn",
29
+ "name": "uid",
30
+ "type": "relation",
31
+ "required": true,
32
+ "presentable": false,
33
+ "unique": false,
34
+ "options": {
35
+ "collectionId": "systemprofiles0",
36
+ "cascadeDelete": false,
37
+ "minSelect": null,
38
+ "maxSelect": 1,
39
+ "displayFields": null
40
+ }
41
+ },
42
+ {
43
+ "system": false,
44
+ "id": "c2y74d7h",
45
+ "name": "status",
46
+ "type": "text",
47
+ "required": true,
48
+ "presentable": false,
49
+ "unique": false,
50
+ "options": {
51
+ "min": null,
52
+ "max": null,
53
+ "pattern": ""
54
+ }
55
+ },
56
+ {
57
+ "system": false,
58
+ "id": "4ydffkv3",
59
+ "name": "version",
60
+ "type": "text",
61
+ "required": true,
62
+ "presentable": false,
63
+ "unique": false,
64
+ "options": {
65
+ "min": null,
66
+ "max": null,
67
+ "pattern": ""
68
+ }
69
+ },
70
+ {
71
+ "system": false,
72
+ "id": "3yu1db4p",
73
+ "name": "secrets",
74
+ "type": "json",
75
+ "required": false,
76
+ "presentable": false,
77
+ "unique": false,
78
+ "options": {
79
+ "maxSize": 2000000
80
+ }
81
+ },
82
+ {
83
+ "system": false,
84
+ "id": "mexrkb5z",
85
+ "name": "maintenance",
86
+ "type": "bool",
87
+ "required": false,
88
+ "presentable": false,
89
+ "unique": false,
90
+ "options": {}
91
+ },
92
+ {
93
+ "system": false,
94
+ "id": "hkt4q8yk",
95
+ "name": "syncAdmin",
96
+ "type": "bool",
97
+ "required": false,
98
+ "presentable": false,
99
+ "unique": false,
100
+ "options": {}
101
+ },
102
+ {
103
+ "system": false,
104
+ "id": "5oz9huwg",
105
+ "name": "cname",
106
+ "type": "text",
107
+ "required": false,
108
+ "presentable": false,
109
+ "unique": false,
110
+ "options": {
111
+ "min": null,
112
+ "max": null,
113
+ "pattern": "^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}$"
114
+ }
115
+ },
116
+ {
117
+ "system": false,
118
+ "id": "a5qqq8fs",
119
+ "name": "dev",
120
+ "type": "bool",
121
+ "required": false,
122
+ "presentable": false,
123
+ "unique": false,
124
+ "options": {}
125
+ },
126
+ {
127
+ "system": false,
128
+ "id": "hsoandop",
129
+ "name": "cname_active",
130
+ "type": "bool",
131
+ "required": false,
132
+ "presentable": false,
133
+ "unique": false,
134
+ "options": {}
135
+ },
136
+ {
137
+ "system": false,
138
+ "id": "k7nxxzdr",
139
+ "name": "s3",
140
+ "type": "relation",
141
+ "required": false,
142
+ "presentable": false,
143
+ "unique": false,
144
+ "options": {
145
+ "collectionId": "7n6rny9w7n52mvi",
146
+ "cascadeDelete": false,
147
+ "minSelect": null,
148
+ "maxSelect": 1,
149
+ "displayFields": null
150
+ }
151
+ },
152
+ {
153
+ "system": false,
154
+ "id": "rofy4mta",
155
+ "name": "notifyMaintenanceMode",
156
+ "type": "bool",
157
+ "required": false,
158
+ "presentable": false,
159
+ "unique": false,
160
+ "options": {}
161
+ }
162
+ ],
163
+ "indexes": [
164
+ "CREATE UNIQUE INDEX `idx_unique_qdtuuld1` ON `instances` (`subdomain`)",
165
+ "CREATE INDEX `idx_DKUSkMx` ON `instances` (`status`)",
166
+ "CREATE INDEX `idx_fhfKrpl` ON `instances` (`uid`)",
167
+ "CREATE INDEX `idx_TfdgNnO` ON `instances` (`maintenance`)",
168
+ "CREATE INDEX `idx_FrmHehp` ON `instances` (`created`)",
169
+ "CREATE INDEX `idx_tNMeylJ` ON `instances` (`updated`)",
170
+ "CREATE UNIQUE INDEX `idx_rBYwAXi` ON `instances` (`cname`) WHERE cname != ''"
171
+ ],
172
+ "listRule": "uid=@request.auth.id",
173
+ "viewRule": "uid = @request.auth.id",
174
+ "createRule": null,
175
+ "updateRule": null,
176
+ "deleteRule": null,
177
+ "options": {}
178
+ },
179
+ {
180
+ "id": "systemprofiles0",
181
+ "created": "2022-11-02 17:53:52.539Z",
182
+ "updated": "2024-01-10 11:47:04.774Z",
183
+ "name": "users",
184
+ "type": "auth",
185
+ "system": false,
186
+ "schema": [
187
+ {
188
+ "system": false,
189
+ "id": "pbfieldname",
190
+ "name": "name",
191
+ "type": "text",
192
+ "required": false,
193
+ "presentable": false,
194
+ "unique": false,
195
+ "options": {
196
+ "min": null,
197
+ "max": null,
198
+ "pattern": ""
199
+ }
200
+ },
201
+ {
202
+ "system": false,
203
+ "id": "pbfieldavatar",
204
+ "name": "avatar",
205
+ "type": "file",
206
+ "required": false,
207
+ "presentable": false,
208
+ "unique": false,
209
+ "options": {
210
+ "mimeTypes": [
211
+ "image/jpg",
212
+ "image/jpeg",
213
+ "image/png",
214
+ "image/svg+xml",
215
+ "image/gif"
216
+ ],
217
+ "thumbs": null,
218
+ "maxSelect": 1,
219
+ "maxSize": 5242880,
220
+ "protected": false
221
+ }
222
+ },
223
+ {
224
+ "system": false,
225
+ "id": "7jf2i4be",
226
+ "name": "subscription",
227
+ "type": "select",
228
+ "required": true,
229
+ "presentable": false,
230
+ "unique": false,
231
+ "options": {
232
+ "maxSelect": 1,
233
+ "values": [
234
+ "free",
235
+ "premium",
236
+ "lifetime",
237
+ "legacy"
238
+ ]
239
+ }
240
+ },
241
+ {
242
+ "system": false,
243
+ "id": "c1lrvx9q",
244
+ "name": "isLegacy",
245
+ "type": "bool",
246
+ "required": false,
247
+ "presentable": false,
248
+ "unique": false,
249
+ "options": {}
250
+ },
251
+ {
252
+ "system": false,
253
+ "id": "wp3zam39",
254
+ "name": "isFounder",
255
+ "type": "bool",
256
+ "required": false,
257
+ "presentable": false,
258
+ "unique": false,
259
+ "options": {}
260
+ },
261
+ {
262
+ "system": false,
263
+ "id": "yrezqbhc",
264
+ "name": "discord_id",
265
+ "type": "text",
266
+ "required": false,
267
+ "presentable": false,
268
+ "unique": false,
269
+ "options": {
270
+ "min": null,
271
+ "max": null,
272
+ "pattern": ""
273
+ }
274
+ },
275
+ {
276
+ "system": false,
277
+ "id": "stcfuecz",
278
+ "name": "unsubscribe",
279
+ "type": "bool",
280
+ "required": false,
281
+ "presentable": false,
282
+ "unique": false,
283
+ "options": {}
284
+ },
285
+ {
286
+ "system": false,
287
+ "id": "bbspvxke",
288
+ "name": "notifyMaintenanceMode",
289
+ "type": "bool",
290
+ "required": false,
291
+ "presentable": false,
292
+ "unique": false,
293
+ "options": {}
294
+ },
295
+ {
296
+ "system": false,
297
+ "id": "umykxmck",
298
+ "name": "welcome",
299
+ "type": "date",
300
+ "required": false,
301
+ "presentable": false,
302
+ "unique": false,
303
+ "options": {
304
+ "min": "",
305
+ "max": ""
306
+ }
307
+ }
308
+ ],
309
+ "indexes": [],
310
+ "listRule": "id = @request.auth.id",
311
+ "viewRule": "id = @request.auth.id",
312
+ "createRule": "",
313
+ "updateRule": "id = @request.auth.id",
314
+ "deleteRule": null,
315
+ "options": {
316
+ "allowEmailAuth": true,
317
+ "allowOAuth2Auth": true,
318
+ "allowUsernameAuth": false,
319
+ "exceptEmailDomains": null,
320
+ "manageRule": null,
321
+ "minPasswordLength": 8,
322
+ "onlyEmailDomains": null,
323
+ "onlyVerified": false,
324
+ "requireEmail": true
325
+ }
326
+ },
327
+ {
328
+ "id": "buq519uv711078p",
329
+ "created": "2023-12-13 12:27:18.834Z",
330
+ "updated": "2023-12-14 15:59:34.478Z",
331
+ "name": "stats",
332
+ "type": "view",
333
+ "system": false,
334
+ "schema": [
335
+ {
336
+ "system": false,
337
+ "id": "ocbcyask",
338
+ "name": "total_users",
339
+ "type": "number",
340
+ "required": false,
341
+ "presentable": false,
342
+ "unique": false,
343
+ "options": {
344
+ "min": null,
345
+ "max": null,
346
+ "noDecimal": false
347
+ }
348
+ },
349
+ {
350
+ "system": false,
351
+ "id": "q5okyyvj",
352
+ "name": "total_legacy_subscribers",
353
+ "type": "number",
354
+ "required": false,
355
+ "presentable": false,
356
+ "unique": false,
357
+ "options": {
358
+ "min": null,
359
+ "max": null,
360
+ "noDecimal": false
361
+ }
362
+ },
363
+ {
364
+ "system": false,
365
+ "id": "a8mv3hbg",
366
+ "name": "total_free_subscribers",
367
+ "type": "number",
368
+ "required": false,
369
+ "presentable": false,
370
+ "unique": false,
371
+ "options": {
372
+ "min": null,
373
+ "max": null,
374
+ "noDecimal": false
375
+ }
376
+ },
377
+ {
378
+ "system": false,
379
+ "id": "bkn9fxd9",
380
+ "name": "total_pro_subscribers",
381
+ "type": "number",
382
+ "required": false,
383
+ "presentable": false,
384
+ "unique": false,
385
+ "options": {
386
+ "min": null,
387
+ "max": null,
388
+ "noDecimal": false
389
+ }
390
+ },
391
+ {
392
+ "system": false,
393
+ "id": "qkyv0nvm",
394
+ "name": "total_lifetime_subscribers",
395
+ "type": "number",
396
+ "required": false,
397
+ "presentable": false,
398
+ "unique": false,
399
+ "options": {
400
+ "min": null,
401
+ "max": null,
402
+ "noDecimal": false
403
+ }
404
+ },
405
+ {
406
+ "system": false,
407
+ "id": "g6hgzcbi",
408
+ "name": "new_users_last_hour",
409
+ "type": "number",
410
+ "required": false,
411
+ "presentable": false,
412
+ "unique": false,
413
+ "options": {
414
+ "min": null,
415
+ "max": null,
416
+ "noDecimal": false
417
+ }
418
+ },
419
+ {
420
+ "system": false,
421
+ "id": "6e2gep5p",
422
+ "name": "new_users_last_24_hours",
423
+ "type": "number",
424
+ "required": false,
425
+ "presentable": false,
426
+ "unique": false,
427
+ "options": {
428
+ "min": null,
429
+ "max": null,
430
+ "noDecimal": false
431
+ }
432
+ },
433
+ {
434
+ "system": false,
435
+ "id": "qdd2lgrg",
436
+ "name": "new_users_last_7_days",
437
+ "type": "number",
438
+ "required": false,
439
+ "presentable": false,
440
+ "unique": false,
441
+ "options": {
442
+ "min": null,
443
+ "max": null,
444
+ "noDecimal": false
445
+ }
446
+ },
447
+ {
448
+ "system": false,
449
+ "id": "mdsqys16",
450
+ "name": "new_users_last_30_days",
451
+ "type": "number",
452
+ "required": false,
453
+ "presentable": false,
454
+ "unique": false,
455
+ "options": {
456
+ "min": null,
457
+ "max": null,
458
+ "noDecimal": false
459
+ }
460
+ },
461
+ {
462
+ "system": false,
463
+ "id": "lz1oyvrc",
464
+ "name": "total_instances",
465
+ "type": "number",
466
+ "required": false,
467
+ "presentable": false,
468
+ "unique": false,
469
+ "options": {
470
+ "min": null,
471
+ "max": null,
472
+ "noDecimal": false
473
+ }
474
+ },
475
+ {
476
+ "system": false,
477
+ "id": "ntg2cv49",
478
+ "name": "total_instances_last_hour",
479
+ "type": "number",
480
+ "required": false,
481
+ "presentable": false,
482
+ "unique": false,
483
+ "options": {
484
+ "min": null,
485
+ "max": null,
486
+ "noDecimal": false
487
+ }
488
+ },
489
+ {
490
+ "system": false,
491
+ "id": "o5o8e0a3",
492
+ "name": "total_instances_last_24_hours",
493
+ "type": "number",
494
+ "required": false,
495
+ "presentable": false,
496
+ "unique": false,
497
+ "options": {
498
+ "min": null,
499
+ "max": null,
500
+ "noDecimal": false
501
+ }
502
+ },
503
+ {
504
+ "system": false,
505
+ "id": "bi4hgf4i",
506
+ "name": "total_instances_last_7_days",
507
+ "type": "number",
508
+ "required": false,
509
+ "presentable": false,
510
+ "unique": false,
511
+ "options": {
512
+ "min": null,
513
+ "max": null,
514
+ "noDecimal": false
515
+ }
516
+ },
517
+ {
518
+ "system": false,
519
+ "id": "e65bogl0",
520
+ "name": "total_instances_last_30_days",
521
+ "type": "number",
522
+ "required": false,
523
+ "presentable": false,
524
+ "unique": false,
525
+ "options": {
526
+ "min": null,
527
+ "max": null,
528
+ "noDecimal": false
529
+ }
530
+ },
531
+ {
532
+ "system": false,
533
+ "id": "uxq8augl",
534
+ "name": "new_instances_last_hour",
535
+ "type": "number",
536
+ "required": false,
537
+ "presentable": false,
538
+ "unique": false,
539
+ "options": {
540
+ "min": null,
541
+ "max": null,
542
+ "noDecimal": false
543
+ }
544
+ },
545
+ {
546
+ "system": false,
547
+ "id": "w4k4qocm",
548
+ "name": "new_instances_last_24_hours",
549
+ "type": "number",
550
+ "required": false,
551
+ "presentable": false,
552
+ "unique": false,
553
+ "options": {
554
+ "min": null,
555
+ "max": null,
556
+ "noDecimal": false
557
+ }
558
+ },
559
+ {
560
+ "system": false,
561
+ "id": "vpbfbm1f",
562
+ "name": "new_instances_last_7_days",
563
+ "type": "number",
564
+ "required": false,
565
+ "presentable": false,
566
+ "unique": false,
567
+ "options": {
568
+ "min": null,
569
+ "max": null,
570
+ "noDecimal": false
571
+ }
572
+ },
573
+ {
574
+ "system": false,
575
+ "id": "xactzvom",
576
+ "name": "new_instances_last_30_days",
577
+ "type": "number",
578
+ "required": false,
579
+ "presentable": false,
580
+ "unique": false,
581
+ "options": {
582
+ "min": null,
583
+ "max": null,
584
+ "noDecimal": false
585
+ }
586
+ }
587
+ ],
588
+ "indexes": [],
589
+ "listRule": null,
590
+ "viewRule": null,
591
+ "createRule": null,
592
+ "updateRule": null,
593
+ "deleteRule": null,
594
+ "options": {
595
+ "query": "SELECT\n (ROW_NUMBER() OVER()) as id,\n \n COUNT(DISTINCT users.id) AS total_users,\n COUNT(DISTINCT CASE WHEN users.subscription ='legacy' THEN users.id END) AS total_legacy_subscribers,\n COUNT(DISTINCT CASE WHEN users.subscription ='free' THEN users.id END) AS total_free_subscribers,\n COUNT(DISTINCT CASE WHEN users.subscription= 'premium' THEN users.id END) AS total_pro_subscribers,\n COUNT(DISTINCT CASE WHEN users.subscription= 'lifetime' THEN users.id END) AS total_lifetime_subscribers,\n \n COUNT(DISTINCT CASE WHEN users.created > DATETIME('now', '-1 hour') THEN users.id END) AS new_users_last_hour,\n COUNT(DISTINCT CASE WHEN users.created > DATETIME('now', '-24 hours') THEN users.id END) AS new_users_last_24_hours,\n COUNT(DISTINCT CASE WHEN users.created > DATETIME('now', '-7 days') THEN users.id END) AS new_users_last_7_days,\n COUNT(DISTINCT CASE WHEN users.created > DATETIME('now', '-30 days') THEN users.id END) AS new_users_last_30_days,\n \n COUNT(DISTINCT instances.id ) AS total_instances,\n COUNT(DISTINCT CASE WHEN instances.updated > DATETIME('now', '-1 hour') THEN instances.id END) AS total_instances_last_hour,\n COUNT(DISTINCT CASE WHEN instances.updated > DATETIME('now', '-24 hours') THEN instances.id END) AS total_instances_last_24_hours,\n COUNT(DISTINCT CASE WHEN instances.updated > DATETIME('now', '-7 days') THEN instances.id END) AS total_instances_last_7_days,\n COUNT(DISTINCT CASE WHEN instances.updated > DATETIME('now', '-30 days') THEN instances.id END) AS total_instances_last_30_days,\n \n COUNT(DISTINCT CASE WHEN instances.created > DATETIME('now', '-1 hour') THEN instances.id END) AS new_instances_last_hour,\n COUNT(DISTINCT CASE WHEN instances.created > DATETIME('now', '-24 hours') THEN instances.id END) AS new_instances_last_24_hours,\n COUNT(DISTINCT CASE WHEN instances.created > DATETIME('now', '-7 days') THEN instances.id END) AS new_instances_last_7_days,\n COUNT(DISTINCT CASE WHEN instances.created > DATETIME('now', '-30 days') THEN instances.id END) AS new_instances_last_30_days\n \nFROM\n verified_users users\nLEFT JOIN\n instances ON users.id = instances.uid;\n"
596
+ }
597
+ },
598
+ {
599
+ "id": "aif4h1j462iqopo",
600
+ "created": "2023-12-14 09:01:33.345Z",
601
+ "updated": "2023-12-14 09:08:41.595Z",
602
+ "name": "settings",
603
+ "type": "base",
604
+ "system": false,
605
+ "schema": [
606
+ {
607
+ "system": false,
608
+ "id": "a0gyirdi",
609
+ "name": "name",
610
+ "type": "text",
611
+ "required": true,
612
+ "presentable": true,
613
+ "unique": false,
614
+ "options": {
615
+ "min": null,
616
+ "max": null,
617
+ "pattern": ""
618
+ }
619
+ },
620
+ {
621
+ "system": false,
622
+ "id": "xso1u0og",
623
+ "name": "value",
624
+ "type": "json",
625
+ "required": false,
626
+ "presentable": false,
627
+ "unique": false,
628
+ "options": {
629
+ "maxSize": 2000000
630
+ }
631
+ }
632
+ ],
633
+ "indexes": [
634
+ "CREATE INDEX `idx_qMbeGsg` ON `settings` (`name`)"
635
+ ],
636
+ "listRule": "",
637
+ "viewRule": "",
638
+ "createRule": null,
639
+ "updateRule": null,
640
+ "deleteRule": null,
641
+ "options": {}
642
+ },
643
+ {
644
+ "id": "4kshuv7r3jdrst4",
645
+ "created": "2023-12-14 15:47:15.041Z",
646
+ "updated": "2023-12-24 17:33:36.849Z",
647
+ "name": "verified_users",
648
+ "type": "view",
649
+ "system": false,
650
+ "schema": [
651
+ {
652
+ "system": false,
653
+ "id": "5cg5wgrf",
654
+ "name": "username",
655
+ "type": "text",
656
+ "required": false,
657
+ "presentable": false,
658
+ "unique": false,
659
+ "options": {
660
+ "min": null,
661
+ "max": null,
662
+ "pattern": ""
663
+ }
664
+ },
665
+ {
666
+ "system": false,
667
+ "id": "o2j25t4a",
668
+ "name": "email",
669
+ "type": "email",
670
+ "required": false,
671
+ "presentable": false,
672
+ "unique": false,
673
+ "options": {
674
+ "exceptDomains": null,
675
+ "onlyDomains": null
676
+ }
677
+ },
678
+ {
679
+ "system": false,
680
+ "id": "emdb7k7j",
681
+ "name": "subscription",
682
+ "type": "select",
683
+ "required": true,
684
+ "presentable": false,
685
+ "unique": false,
686
+ "options": {
687
+ "maxSelect": 1,
688
+ "values": [
689
+ "free",
690
+ "premium",
691
+ "lifetime",
692
+ "legacy"
693
+ ]
694
+ }
695
+ },
696
+ {
697
+ "system": false,
698
+ "id": "kygqqzeb",
699
+ "name": "isLegacy",
700
+ "type": "bool",
701
+ "required": false,
702
+ "presentable": false,
703
+ "unique": false,
704
+ "options": {}
705
+ },
706
+ {
707
+ "system": false,
708
+ "id": "qy6jora9",
709
+ "name": "isFounder",
710
+ "type": "bool",
711
+ "required": false,
712
+ "presentable": false,
713
+ "unique": false,
714
+ "options": {}
715
+ }
716
+ ],
717
+ "indexes": [],
718
+ "listRule": null,
719
+ "viewRule": null,
720
+ "createRule": null,
721
+ "updateRule": null,
722
+ "deleteRule": null,
723
+ "options": {
724
+ "query": "select id, username, email, subscription, isLegacy, isFounder,created,updated from users where verified = 1"
725
+ }
726
+ },
727
+ {
728
+ "id": "7vzz1jr2us7mwmx",
729
+ "created": "2023-12-14 16:30:33.330Z",
730
+ "updated": "2023-12-15 13:31:07.128Z",
731
+ "name": "user_growth_by_month",
732
+ "type": "view",
733
+ "system": false,
734
+ "schema": [
735
+ {
736
+ "system": false,
737
+ "id": "pk5at00z",
738
+ "name": "t",
739
+ "type": "json",
740
+ "required": false,
741
+ "presentable": false,
742
+ "unique": false,
743
+ "options": {
744
+ "maxSize": 1
745
+ }
746
+ },
747
+ {
748
+ "system": false,
749
+ "id": "3ybi74j4",
750
+ "name": "c",
751
+ "type": "number",
752
+ "required": false,
753
+ "presentable": false,
754
+ "unique": false,
755
+ "options": {
756
+ "min": null,
757
+ "max": null,
758
+ "noDecimal": false
759
+ }
760
+ }
761
+ ],
762
+ "indexes": [],
763
+ "listRule": null,
764
+ "viewRule": null,
765
+ "createRule": null,
766
+ "updateRule": null,
767
+ "deleteRule": null,
768
+ "options": {
769
+ "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n strftime('%Y-%m', created) AS t, \n COUNT(*) AS c \nFROM \n verified_users as users\nGROUP BY \n t\n\torder by t desc\n"
770
+ }
771
+ },
772
+ {
773
+ "id": "thjxyrzo35idz7s",
774
+ "created": "2023-12-14 16:38:00.529Z",
775
+ "updated": "2023-12-15 13:28:54.353Z",
776
+ "name": "growth_by_day",
777
+ "type": "view",
778
+ "system": false,
779
+ "schema": [
780
+ {
781
+ "system": false,
782
+ "id": "ghgoehkw",
783
+ "name": "created_day",
784
+ "type": "json",
785
+ "required": false,
786
+ "presentable": false,
787
+ "unique": false,
788
+ "options": {
789
+ "maxSize": 1
790
+ }
791
+ },
792
+ {
793
+ "system": false,
794
+ "id": "uhyqirzc",
795
+ "name": "users_count",
796
+ "type": "json",
797
+ "required": false,
798
+ "presentable": false,
799
+ "unique": false,
800
+ "options": {
801
+ "maxSize": 1
802
+ }
803
+ },
804
+ {
805
+ "system": false,
806
+ "id": "nv9hcwkf",
807
+ "name": "instances_count",
808
+ "type": "json",
809
+ "required": false,
810
+ "presentable": false,
811
+ "unique": false,
812
+ "options": {
813
+ "maxSize": 1
814
+ }
815
+ }
816
+ ],
817
+ "indexes": [],
818
+ "listRule": null,
819
+ "viewRule": null,
820
+ "createRule": null,
821
+ "updateRule": null,
822
+ "deleteRule": null,
823
+ "options": {
824
+ "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n created_day,\n SUM(users_count) AS users_count,\n SUM(instances_count) AS instances_count\nFROM (\n SELECT \n strftime('%Y-%m-%d', users.created) AS created_day, \n COUNT(*) AS users_count, \n 0 AS instances_count\n FROM \n users \n GROUP BY \n created_day\n UNION ALL\n SELECT \n strftime('%Y-%m-%d', instances.created) AS created_day, \n 0 AS users_count, \n COUNT(*) AS instances_count\n FROM \n instances \n GROUP BY \n created_day\n) \nGROUP BY \n created_day\norder by created_day desc\n"
825
+ }
826
+ },
827
+ {
828
+ "id": "ledwhu6imoityio",
829
+ "created": "2023-12-15 13:31:50.847Z",
830
+ "updated": "2023-12-24 17:33:36.855Z",
831
+ "name": "unverified_users",
832
+ "type": "view",
833
+ "system": false,
834
+ "schema": [
835
+ {
836
+ "system": false,
837
+ "id": "grpncfep",
838
+ "name": "username",
839
+ "type": "text",
840
+ "required": false,
841
+ "presentable": false,
842
+ "unique": false,
843
+ "options": {
844
+ "min": null,
845
+ "max": null,
846
+ "pattern": ""
847
+ }
848
+ },
849
+ {
850
+ "system": false,
851
+ "id": "ijsrdmwp",
852
+ "name": "email",
853
+ "type": "email",
854
+ "required": false,
855
+ "presentable": false,
856
+ "unique": false,
857
+ "options": {
858
+ "exceptDomains": null,
859
+ "onlyDomains": null
860
+ }
861
+ },
862
+ {
863
+ "system": false,
864
+ "id": "e31p6ova",
865
+ "name": "subscription",
866
+ "type": "select",
867
+ "required": true,
868
+ "presentable": false,
869
+ "unique": false,
870
+ "options": {
871
+ "maxSelect": 1,
872
+ "values": [
873
+ "free",
874
+ "premium",
875
+ "lifetime",
876
+ "legacy"
877
+ ]
878
+ }
879
+ },
880
+ {
881
+ "system": false,
882
+ "id": "lxitczix",
883
+ "name": "isLegacy",
884
+ "type": "bool",
885
+ "required": false,
886
+ "presentable": false,
887
+ "unique": false,
888
+ "options": {}
889
+ },
890
+ {
891
+ "system": false,
892
+ "id": "umh2fccl",
893
+ "name": "isFounder",
894
+ "type": "bool",
895
+ "required": false,
896
+ "presentable": false,
897
+ "unique": false,
898
+ "options": {}
899
+ }
900
+ ],
901
+ "indexes": [],
902
+ "listRule": null,
903
+ "viewRule": null,
904
+ "createRule": null,
905
+ "updateRule": null,
906
+ "deleteRule": null,
907
+ "options": {
908
+ "query": "select id, username, email, subscription, isLegacy, isFounder,created,updated from users where verified = 0"
909
+ }
910
+ },
911
+ {
912
+ "id": "18rfmj8aklx6bjq",
913
+ "created": "2023-12-22 17:15:47.557Z",
914
+ "updated": "2024-01-06 10:50:16.459Z",
915
+ "name": "sent_messages",
916
+ "type": "base",
917
+ "system": false,
918
+ "schema": [
919
+ {
920
+ "system": false,
921
+ "id": "wuitrzp6",
922
+ "name": "user",
923
+ "type": "relation",
924
+ "required": true,
925
+ "presentable": false,
926
+ "unique": false,
927
+ "options": {
928
+ "collectionId": "systemprofiles0",
929
+ "cascadeDelete": false,
930
+ "minSelect": null,
931
+ "maxSelect": 1,
932
+ "displayFields": null
933
+ }
934
+ },
935
+ {
936
+ "system": false,
937
+ "id": "yzvlcy7m",
938
+ "name": "message",
939
+ "type": "text",
940
+ "required": true,
941
+ "presentable": false,
942
+ "unique": false,
943
+ "options": {
944
+ "min": null,
945
+ "max": null,
946
+ "pattern": ""
947
+ }
948
+ },
949
+ {
950
+ "system": false,
951
+ "id": "kigwtdjb",
952
+ "name": "campaign_message",
953
+ "type": "relation",
954
+ "required": true,
955
+ "presentable": false,
956
+ "unique": false,
957
+ "options": {
958
+ "collectionId": "w1vjr1edr5tsam3",
959
+ "cascadeDelete": false,
960
+ "minSelect": null,
961
+ "maxSelect": 1,
962
+ "displayFields": null
963
+ }
964
+ }
965
+ ],
966
+ "indexes": [],
967
+ "listRule": null,
968
+ "viewRule": null,
969
+ "createRule": null,
970
+ "updateRule": null,
971
+ "deleteRule": null,
972
+ "options": {}
973
+ },
974
+ {
975
+ "id": "4jyrkxcora6bl8r",
976
+ "created": "2023-12-24 03:51:53.315Z",
977
+ "updated": "2023-12-24 17:33:36.858Z",
978
+ "name": "legacy_users",
979
+ "type": "view",
980
+ "system": false,
981
+ "schema": [
982
+ {
983
+ "system": false,
984
+ "id": "t0mmenni",
985
+ "name": "email",
986
+ "type": "email",
987
+ "required": false,
988
+ "presentable": false,
989
+ "unique": false,
990
+ "options": {
991
+ "exceptDomains": null,
992
+ "onlyDomains": null
993
+ }
994
+ },
995
+ {
996
+ "system": false,
997
+ "id": "wwsyffsl",
998
+ "name": "isFounder",
999
+ "type": "bool",
1000
+ "required": false,
1001
+ "presentable": false,
1002
+ "unique": false,
1003
+ "options": {}
1004
+ },
1005
+ {
1006
+ "system": false,
1007
+ "id": "tdna703r",
1008
+ "name": "subscription",
1009
+ "type": "select",
1010
+ "required": true,
1011
+ "presentable": false,
1012
+ "unique": false,
1013
+ "options": {
1014
+ "maxSelect": 1,
1015
+ "values": [
1016
+ "free",
1017
+ "premium",
1018
+ "lifetime",
1019
+ "legacy"
1020
+ ]
1021
+ }
1022
+ }
1023
+ ],
1024
+ "indexes": [],
1025
+ "listRule": null,
1026
+ "viewRule": null,
1027
+ "createRule": null,
1028
+ "updateRule": null,
1029
+ "deleteRule": null,
1030
+ "options": {
1031
+ "query": "select u.id, u.email,u.isFounder,u.subscription,u.created,u.updated from verified_users u where u.isLegacy=1"
1032
+ }
1033
+ },
1034
+ {
1035
+ "id": "iff2jfzb89dwiov",
1036
+ "created": "2023-12-24 17:21:14.169Z",
1037
+ "updated": "2024-01-04 09:57:09.867Z",
1038
+ "name": "payments",
1039
+ "type": "base",
1040
+ "system": false,
1041
+ "schema": [
1042
+ {
1043
+ "system": false,
1044
+ "id": "uhurtdtl",
1045
+ "name": "user",
1046
+ "type": "relation",
1047
+ "required": true,
1048
+ "presentable": false,
1049
+ "unique": false,
1050
+ "options": {
1051
+ "collectionId": "systemprofiles0",
1052
+ "cascadeDelete": false,
1053
+ "minSelect": null,
1054
+ "maxSelect": 1,
1055
+ "displayFields": null
1056
+ }
1057
+ },
1058
+ {
1059
+ "system": false,
1060
+ "id": "tgaer8rx",
1061
+ "name": "payment_id",
1062
+ "type": "text",
1063
+ "required": true,
1064
+ "presentable": false,
1065
+ "unique": false,
1066
+ "options": {
1067
+ "min": null,
1068
+ "max": null,
1069
+ "pattern": ""
1070
+ }
1071
+ }
1072
+ ],
1073
+ "indexes": [
1074
+ "CREATE INDEX `idx_DezkBvw` ON `payments` (`user`)",
1075
+ "CREATE INDEX `idx_A5j325f` ON `payments` (`payment_id`)",
1076
+ "CREATE INDEX `idx_qBPC3VW` ON `payments` (`created`)",
1077
+ "CREATE UNIQUE INDEX `idx_NPkwSnu` ON `payments` (`payment_id`)"
1078
+ ],
1079
+ "listRule": null,
1080
+ "viewRule": null,
1081
+ "createRule": null,
1082
+ "updateRule": null,
1083
+ "deleteRule": null,
1084
+ "options": {}
1085
+ },
1086
+ {
1087
+ "id": "w1vjr1edr5tsam3",
1088
+ "created": "2023-12-29 14:50:43.496Z",
1089
+ "updated": "2024-01-05 17:05:50.218Z",
1090
+ "name": "campaign_messages",
1091
+ "type": "base",
1092
+ "system": false,
1093
+ "schema": [
1094
+ {
1095
+ "system": false,
1096
+ "id": "wsfnencj",
1097
+ "name": "campaign",
1098
+ "type": "relation",
1099
+ "required": false,
1100
+ "presentable": false,
1101
+ "unique": false,
1102
+ "options": {
1103
+ "collectionId": "yfhnigik0uvyt4m",
1104
+ "cascadeDelete": false,
1105
+ "minSelect": null,
1106
+ "maxSelect": 1,
1107
+ "displayFields": null
1108
+ }
1109
+ },
1110
+ {
1111
+ "system": false,
1112
+ "id": "lxy9jyyk",
1113
+ "name": "subject",
1114
+ "type": "text",
1115
+ "required": true,
1116
+ "presentable": false,
1117
+ "unique": false,
1118
+ "options": {
1119
+ "min": null,
1120
+ "max": null,
1121
+ "pattern": ""
1122
+ }
1123
+ },
1124
+ {
1125
+ "system": false,
1126
+ "id": "4h2cqwha",
1127
+ "name": "body",
1128
+ "type": "editor",
1129
+ "required": true,
1130
+ "presentable": false,
1131
+ "unique": false,
1132
+ "options": {
1133
+ "convertUrls": false
1134
+ }
1135
+ }
1136
+ ],
1137
+ "indexes": [],
1138
+ "listRule": null,
1139
+ "viewRule": null,
1140
+ "createRule": null,
1141
+ "updateRule": null,
1142
+ "deleteRule": null,
1143
+ "options": {}
1144
+ },
1145
+ {
1146
+ "id": "7n6rny9w7n52mvi",
1147
+ "created": "2023-12-30 15:27:51.880Z",
1148
+ "updated": "2023-12-30 15:30:46.145Z",
1149
+ "name": "s3",
1150
+ "type": "base",
1151
+ "system": false,
1152
+ "schema": [
1153
+ {
1154
+ "system": false,
1155
+ "id": "yvy0exvk",
1156
+ "name": "instance",
1157
+ "type": "relation",
1158
+ "required": false,
1159
+ "presentable": true,
1160
+ "unique": false,
1161
+ "options": {
1162
+ "collectionId": "etae8tuiaxl6xfv",
1163
+ "cascadeDelete": false,
1164
+ "minSelect": null,
1165
+ "maxSelect": 1,
1166
+ "displayFields": null
1167
+ }
1168
+ },
1169
+ {
1170
+ "system": false,
1171
+ "id": "kz6u1z1p",
1172
+ "name": "endpoint",
1173
+ "type": "text",
1174
+ "required": false,
1175
+ "presentable": false,
1176
+ "unique": false,
1177
+ "options": {
1178
+ "min": null,
1179
+ "max": null,
1180
+ "pattern": ""
1181
+ }
1182
+ },
1183
+ {
1184
+ "system": false,
1185
+ "id": "etcgfvgc",
1186
+ "name": "access_key",
1187
+ "type": "text",
1188
+ "required": false,
1189
+ "presentable": false,
1190
+ "unique": false,
1191
+ "options": {
1192
+ "min": null,
1193
+ "max": null,
1194
+ "pattern": ""
1195
+ }
1196
+ },
1197
+ {
1198
+ "system": false,
1199
+ "id": "fn8ulajr",
1200
+ "name": "secret",
1201
+ "type": "text",
1202
+ "required": false,
1203
+ "presentable": false,
1204
+ "unique": false,
1205
+ "options": {
1206
+ "min": null,
1207
+ "max": null,
1208
+ "pattern": ""
1209
+ }
1210
+ },
1211
+ {
1212
+ "system": false,
1213
+ "id": "kktzqpxi",
1214
+ "name": "bucket",
1215
+ "type": "text",
1216
+ "required": false,
1217
+ "presentable": false,
1218
+ "unique": false,
1219
+ "options": {
1220
+ "min": null,
1221
+ "max": null,
1222
+ "pattern": ""
1223
+ }
1224
+ },
1225
+ {
1226
+ "system": false,
1227
+ "id": "fysmrb1v",
1228
+ "name": "region",
1229
+ "type": "text",
1230
+ "required": false,
1231
+ "presentable": false,
1232
+ "unique": false,
1233
+ "options": {
1234
+ "min": null,
1235
+ "max": null,
1236
+ "pattern": ""
1237
+ }
1238
+ }
1239
+ ],
1240
+ "indexes": [],
1241
+ "listRule": null,
1242
+ "viewRule": null,
1243
+ "createRule": null,
1244
+ "updateRule": null,
1245
+ "deleteRule": null,
1246
+ "options": {}
1247
+ },
1248
+ {
1249
+ "id": "yfhnigik0uvyt4m",
1250
+ "created": "2024-01-05 08:50:50.016Z",
1251
+ "updated": "2024-01-05 17:03:19.348Z",
1252
+ "name": "campaigns",
1253
+ "type": "base",
1254
+ "system": false,
1255
+ "schema": [
1256
+ {
1257
+ "system": false,
1258
+ "id": "1laswhyx",
1259
+ "name": "name",
1260
+ "type": "text",
1261
+ "required": true,
1262
+ "presentable": true,
1263
+ "unique": false,
1264
+ "options": {
1265
+ "min": null,
1266
+ "max": null,
1267
+ "pattern": ""
1268
+ }
1269
+ },
1270
+ {
1271
+ "system": false,
1272
+ "id": "4fxgwtui",
1273
+ "name": "vars",
1274
+ "type": "json",
1275
+ "required": true,
1276
+ "presentable": false,
1277
+ "unique": false,
1278
+ "options": {
1279
+ "maxSize": 20000
1280
+ }
1281
+ },
1282
+ {
1283
+ "system": false,
1284
+ "id": "tni65iyd",
1285
+ "name": "usersQuery",
1286
+ "type": "text",
1287
+ "required": true,
1288
+ "presentable": false,
1289
+ "unique": false,
1290
+ "options": {
1291
+ "min": null,
1292
+ "max": null,
1293
+ "pattern": ""
1294
+ }
1295
+ }
1296
+ ],
1297
+ "indexes": [],
1298
+ "listRule": null,
1299
+ "viewRule": null,
1300
+ "createRule": null,
1301
+ "updateRule": null,
1302
+ "deleteRule": null,
1303
+ "options": {}
1304
+ },
1305
+ {
1306
+ "id": "s00x84jumfjcuvc",
1307
+ "created": "2024-01-05 08:59:19.802Z",
1308
+ "updated": "2024-01-05 17:00:07.941Z",
1309
+ "name": "subscribed_users",
1310
+ "type": "view",
1311
+ "system": false,
1312
+ "schema": [
1313
+ {
1314
+ "system": false,
1315
+ "id": "s2197q2z",
1316
+ "name": "username",
1317
+ "type": "text",
1318
+ "required": false,
1319
+ "presentable": false,
1320
+ "unique": false,
1321
+ "options": {
1322
+ "min": null,
1323
+ "max": null,
1324
+ "pattern": ""
1325
+ }
1326
+ },
1327
+ {
1328
+ "system": false,
1329
+ "id": "cuhc31f3",
1330
+ "name": "email",
1331
+ "type": "email",
1332
+ "required": false,
1333
+ "presentable": false,
1334
+ "unique": false,
1335
+ "options": {
1336
+ "exceptDomains": null,
1337
+ "onlyDomains": null
1338
+ }
1339
+ },
1340
+ {
1341
+ "system": false,
1342
+ "id": "ciq66ylh",
1343
+ "name": "subscription",
1344
+ "type": "select",
1345
+ "required": true,
1346
+ "presentable": false,
1347
+ "unique": false,
1348
+ "options": {
1349
+ "maxSelect": 1,
1350
+ "values": [
1351
+ "free",
1352
+ "premium",
1353
+ "lifetime",
1354
+ "legacy"
1355
+ ]
1356
+ }
1357
+ },
1358
+ {
1359
+ "system": false,
1360
+ "id": "ko9likeb",
1361
+ "name": "isLegacy",
1362
+ "type": "bool",
1363
+ "required": false,
1364
+ "presentable": false,
1365
+ "unique": false,
1366
+ "options": {}
1367
+ },
1368
+ {
1369
+ "system": false,
1370
+ "id": "98xd2uwo",
1371
+ "name": "isFounder",
1372
+ "type": "bool",
1373
+ "required": false,
1374
+ "presentable": false,
1375
+ "unique": false,
1376
+ "options": {}
1377
+ }
1378
+ ],
1379
+ "indexes": [],
1380
+ "listRule": null,
1381
+ "viewRule": null,
1382
+ "createRule": null,
1383
+ "updateRule": null,
1384
+ "deleteRule": null,
1385
+ "options": {
1386
+ "query": "select id, username, email, subscription, isLegacy, isFounder,created,updated from users where verified=1 and unsubscribe=0"
1387
+ }
1388
+ },
1389
+ {
1390
+ "id": "hsuwe2h3csch1yr",
1391
+ "created": "2024-01-07 07:16:49.459Z",
1392
+ "updated": "2024-01-08 14:46:00.858Z",
1393
+ "name": "audit",
1394
+ "type": "base",
1395
+ "system": false,
1396
+ "schema": [
1397
+ {
1398
+ "system": false,
1399
+ "id": "cgkurilx",
1400
+ "name": "event",
1401
+ "type": "text",
1402
+ "required": false,
1403
+ "presentable": false,
1404
+ "unique": false,
1405
+ "options": {
1406
+ "min": null,
1407
+ "max": null,
1408
+ "pattern": ""
1409
+ }
1410
+ },
1411
+ {
1412
+ "system": false,
1413
+ "id": "orqvyzje",
1414
+ "name": "email",
1415
+ "type": "text",
1416
+ "required": false,
1417
+ "presentable": false,
1418
+ "unique": false,
1419
+ "options": {
1420
+ "min": null,
1421
+ "max": null,
1422
+ "pattern": ""
1423
+ }
1424
+ },
1425
+ {
1426
+ "system": false,
1427
+ "id": "3frdgrxe",
1428
+ "name": "user",
1429
+ "type": "relation",
1430
+ "required": false,
1431
+ "presentable": false,
1432
+ "unique": false,
1433
+ "options": {
1434
+ "collectionId": "systemprofiles0",
1435
+ "cascadeDelete": false,
1436
+ "minSelect": null,
1437
+ "maxSelect": 1,
1438
+ "displayFields": null
1439
+ }
1440
+ },
1441
+ {
1442
+ "system": false,
1443
+ "id": "kcj9mpcm",
1444
+ "name": "notification",
1445
+ "type": "relation",
1446
+ "required": false,
1447
+ "presentable": false,
1448
+ "unique": false,
1449
+ "options": {
1450
+ "collectionId": "y5lqraz7c4jvisu",
1451
+ "cascadeDelete": false,
1452
+ "minSelect": null,
1453
+ "maxSelect": 1,
1454
+ "displayFields": null
1455
+ }
1456
+ },
1457
+ {
1458
+ "system": false,
1459
+ "id": "sterc0x6",
1460
+ "name": "instance",
1461
+ "type": "relation",
1462
+ "required": false,
1463
+ "presentable": false,
1464
+ "unique": false,
1465
+ "options": {
1466
+ "collectionId": "etae8tuiaxl6xfv",
1467
+ "cascadeDelete": false,
1468
+ "minSelect": null,
1469
+ "maxSelect": 1,
1470
+ "displayFields": null
1471
+ }
1472
+ },
1473
+ {
1474
+ "system": false,
1475
+ "id": "rtfafgv0",
1476
+ "name": "campaign",
1477
+ "type": "relation",
1478
+ "required": false,
1479
+ "presentable": false,
1480
+ "unique": false,
1481
+ "options": {
1482
+ "collectionId": "yfhnigik0uvyt4m",
1483
+ "cascadeDelete": false,
1484
+ "minSelect": null,
1485
+ "maxSelect": 1,
1486
+ "displayFields": null
1487
+ }
1488
+ },
1489
+ {
1490
+ "system": false,
1491
+ "id": "vsobm1jq",
1492
+ "name": "campaign_message",
1493
+ "type": "relation",
1494
+ "required": false,
1495
+ "presentable": false,
1496
+ "unique": false,
1497
+ "options": {
1498
+ "collectionId": "w1vjr1edr5tsam3",
1499
+ "cascadeDelete": false,
1500
+ "minSelect": null,
1501
+ "maxSelect": 1,
1502
+ "displayFields": null
1503
+ }
1504
+ },
1505
+ {
1506
+ "system": false,
1507
+ "id": "nztvxk7i",
1508
+ "name": "sent_message",
1509
+ "type": "relation",
1510
+ "required": false,
1511
+ "presentable": false,
1512
+ "unique": false,
1513
+ "options": {
1514
+ "collectionId": "18rfmj8aklx6bjq",
1515
+ "cascadeDelete": false,
1516
+ "minSelect": null,
1517
+ "maxSelect": 1,
1518
+ "displayFields": null
1519
+ }
1520
+ },
1521
+ {
1522
+ "system": false,
1523
+ "id": "chqbmew7",
1524
+ "name": "note",
1525
+ "type": "text",
1526
+ "required": false,
1527
+ "presentable": false,
1528
+ "unique": false,
1529
+ "options": {
1530
+ "min": null,
1531
+ "max": null,
1532
+ "pattern": ""
1533
+ }
1534
+ },
1535
+ {
1536
+ "system": false,
1537
+ "id": "9vjfnw4e",
1538
+ "name": "raw_payload",
1539
+ "type": "text",
1540
+ "required": false,
1541
+ "presentable": false,
1542
+ "unique": false,
1543
+ "options": {
1544
+ "min": null,
1545
+ "max": null,
1546
+ "pattern": ""
1547
+ }
1548
+ }
1549
+ ],
1550
+ "indexes": [],
1551
+ "listRule": null,
1552
+ "viewRule": null,
1553
+ "createRule": null,
1554
+ "updateRule": null,
1555
+ "deleteRule": null,
1556
+ "options": {}
1557
+ },
1558
+ {
1559
+ "id": "y5lqraz7c4jvisu",
1560
+ "created": "2024-01-08 13:55:45.485Z",
1561
+ "updated": "2024-01-08 18:24:16.818Z",
1562
+ "name": "notifications",
1563
+ "type": "base",
1564
+ "system": false,
1565
+ "schema": [
1566
+ {
1567
+ "system": false,
1568
+ "id": "dwn9j8oo",
1569
+ "name": "channel",
1570
+ "type": "select",
1571
+ "required": false,
1572
+ "presentable": false,
1573
+ "unique": false,
1574
+ "options": {
1575
+ "maxSelect": 1,
1576
+ "values": [
1577
+ "email",
1578
+ "lemonbot"
1579
+ ]
1580
+ }
1581
+ },
1582
+ {
1583
+ "system": false,
1584
+ "id": "ry5pnrld",
1585
+ "name": "user",
1586
+ "type": "relation",
1587
+ "required": false,
1588
+ "presentable": false,
1589
+ "unique": false,
1590
+ "options": {
1591
+ "collectionId": "systemprofiles0",
1592
+ "cascadeDelete": false,
1593
+ "minSelect": null,
1594
+ "maxSelect": 1,
1595
+ "displayFields": null
1596
+ }
1597
+ },
1598
+ {
1599
+ "system": false,
1600
+ "id": "fksunfv1",
1601
+ "name": "instance",
1602
+ "type": "relation",
1603
+ "required": false,
1604
+ "presentable": false,
1605
+ "unique": false,
1606
+ "options": {
1607
+ "collectionId": "etae8tuiaxl6xfv",
1608
+ "cascadeDelete": false,
1609
+ "minSelect": null,
1610
+ "maxSelect": 1,
1611
+ "displayFields": null
1612
+ }
1613
+ },
1614
+ {
1615
+ "system": false,
1616
+ "id": "gmqwgamf",
1617
+ "name": "campaign",
1618
+ "type": "relation",
1619
+ "required": false,
1620
+ "presentable": false,
1621
+ "unique": false,
1622
+ "options": {
1623
+ "collectionId": "yfhnigik0uvyt4m",
1624
+ "cascadeDelete": false,
1625
+ "minSelect": null,
1626
+ "maxSelect": 1,
1627
+ "displayFields": null
1628
+ }
1629
+ },
1630
+ {
1631
+ "system": false,
1632
+ "id": "crksfxsv",
1633
+ "name": "campaign_message",
1634
+ "type": "relation",
1635
+ "required": false,
1636
+ "presentable": false,
1637
+ "unique": false,
1638
+ "options": {
1639
+ "collectionId": "w1vjr1edr5tsam3",
1640
+ "cascadeDelete": false,
1641
+ "minSelect": null,
1642
+ "maxSelect": 1,
1643
+ "displayFields": null
1644
+ }
1645
+ },
1646
+ {
1647
+ "system": false,
1648
+ "id": "qoshryii",
1649
+ "name": "sent_message",
1650
+ "type": "relation",
1651
+ "required": false,
1652
+ "presentable": false,
1653
+ "unique": false,
1654
+ "options": {
1655
+ "collectionId": "18rfmj8aklx6bjq",
1656
+ "cascadeDelete": false,
1657
+ "minSelect": null,
1658
+ "maxSelect": 1,
1659
+ "displayFields": null
1660
+ }
1661
+ },
1662
+ {
1663
+ "system": false,
1664
+ "id": "cmkxbt9j",
1665
+ "name": "payment",
1666
+ "type": "relation",
1667
+ "required": false,
1668
+ "presentable": false,
1669
+ "unique": false,
1670
+ "options": {
1671
+ "collectionId": "iff2jfzb89dwiov",
1672
+ "cascadeDelete": false,
1673
+ "minSelect": null,
1674
+ "maxSelect": 1,
1675
+ "displayFields": null
1676
+ }
1677
+ },
1678
+ {
1679
+ "system": false,
1680
+ "id": "ezyqswtg",
1681
+ "name": "payload",
1682
+ "type": "json",
1683
+ "required": true,
1684
+ "presentable": false,
1685
+ "unique": false,
1686
+ "options": {
1687
+ "maxSize": 2000000
1688
+ }
1689
+ },
1690
+ {
1691
+ "system": false,
1692
+ "id": "sgeq9rbv",
1693
+ "name": "delivered",
1694
+ "type": "date",
1695
+ "required": false,
1696
+ "presentable": false,
1697
+ "unique": false,
1698
+ "options": {
1699
+ "min": "",
1700
+ "max": ""
1701
+ }
1702
+ },
1703
+ {
1704
+ "system": false,
1705
+ "id": "v8zn89fa",
1706
+ "name": "message_template",
1707
+ "type": "relation",
1708
+ "required": true,
1709
+ "presentable": false,
1710
+ "unique": false,
1711
+ "options": {
1712
+ "collectionId": "6m8h2sy0nutig46",
1713
+ "cascadeDelete": false,
1714
+ "minSelect": null,
1715
+ "maxSelect": 1,
1716
+ "displayFields": null
1717
+ }
1718
+ },
1719
+ {
1720
+ "system": false,
1721
+ "id": "zoqchc2l",
1722
+ "name": "message_template_vars",
1723
+ "type": "json",
1724
+ "required": true,
1725
+ "presentable": false,
1726
+ "unique": false,
1727
+ "options": {
1728
+ "maxSize": 2000000
1729
+ }
1730
+ }
1731
+ ],
1732
+ "indexes": [],
1733
+ "listRule": null,
1734
+ "viewRule": null,
1735
+ "createRule": null,
1736
+ "updateRule": null,
1737
+ "deleteRule": null,
1738
+ "options": {}
1739
+ },
1740
+ {
1741
+ "id": "6m8h2sy0nutig46",
1742
+ "created": "2024-01-08 18:12:45.214Z",
1743
+ "updated": "2024-01-08 18:12:45.214Z",
1744
+ "name": "message_templates",
1745
+ "type": "base",
1746
+ "system": false,
1747
+ "schema": [
1748
+ {
1749
+ "system": false,
1750
+ "id": "si53ohkr",
1751
+ "name": "slug",
1752
+ "type": "text",
1753
+ "required": true,
1754
+ "presentable": true,
1755
+ "unique": false,
1756
+ "options": {
1757
+ "min": null,
1758
+ "max": null,
1759
+ "pattern": ""
1760
+ }
1761
+ },
1762
+ {
1763
+ "system": false,
1764
+ "id": "zarqosgs",
1765
+ "name": "subject",
1766
+ "type": "text",
1767
+ "required": true,
1768
+ "presentable": false,
1769
+ "unique": false,
1770
+ "options": {
1771
+ "min": null,
1772
+ "max": null,
1773
+ "pattern": ""
1774
+ }
1775
+ },
1776
+ {
1777
+ "system": false,
1778
+ "id": "woodsq1c",
1779
+ "name": "body_html",
1780
+ "type": "editor",
1781
+ "required": false,
1782
+ "presentable": false,
1783
+ "unique": false,
1784
+ "options": {
1785
+ "convertUrls": false
1786
+ }
1787
+ }
1788
+ ],
1789
+ "indexes": [
1790
+ "CREATE UNIQUE INDEX `idx_7e53x5A` ON `message_templates` (`slug`)"
1791
+ ],
1792
+ "listRule": null,
1793
+ "viewRule": null,
1794
+ "createRule": null,
1795
+ "updateRule": null,
1796
+ "deleteRule": null,
1797
+ "options": {}
1798
+ },
1799
+ {
1800
+ "id": "h055gvw3oqi2fs0",
1801
+ "created": "2024-01-12 11:12:59.598Z",
1802
+ "updated": "2024-01-12 11:20:00.505Z",
1803
+ "name": "duplicate_emails",
1804
+ "type": "view",
1805
+ "system": false,
1806
+ "schema": [
1807
+ {
1808
+ "system": false,
1809
+ "id": "y2akvv89",
1810
+ "name": "email_prefix",
1811
+ "type": "json",
1812
+ "required": false,
1813
+ "presentable": false,
1814
+ "unique": false,
1815
+ "options": {
1816
+ "maxSize": 1
1817
+ }
1818
+ },
1819
+ {
1820
+ "system": false,
1821
+ "id": "za7mr8gw",
1822
+ "name": "email_domain",
1823
+ "type": "json",
1824
+ "required": false,
1825
+ "presentable": false,
1826
+ "unique": false,
1827
+ "options": {
1828
+ "maxSize": 1
1829
+ }
1830
+ },
1831
+ {
1832
+ "system": false,
1833
+ "id": "zjwougcm",
1834
+ "name": "count",
1835
+ "type": "number",
1836
+ "required": false,
1837
+ "presentable": false,
1838
+ "unique": false,
1839
+ "options": {
1840
+ "min": null,
1841
+ "max": null,
1842
+ "noDecimal": false
1843
+ }
1844
+ }
1845
+ ],
1846
+ "indexes": [],
1847
+ "listRule": null,
1848
+ "viewRule": null,
1849
+ "createRule": null,
1850
+ "updateRule": null,
1851
+ "deleteRule": null,
1852
+ "options": {
1853
+ "query": "SELECT \n (ROW_NUMBER() OVER()) as id,\n SUBSTR(email, 1, INSTR(email, '@') - 1) AS email_prefix,\n SUBSTR(email, INSTR(email, '@')) AS email_domain,\n COUNT(*) AS count\nFROM \n (SELECT \n CASE \n WHEN INSTR(SUBSTR(email, 1, INSTR(email, '@') - 1), '+') > 0 \n THEN SUBSTR(email, 1, INSTR(SUBSTR(email, 1, INSTR(email, '@') - 1), '+') - 1) || SUBSTR(email, INSTR(email, '@')) \n ELSE email \n END AS email \n FROM users)\nGROUP BY \n email_prefix, email_domain;\n"
1854
+ }
1855
+ }
1856
+ ];
1857
+
1858
+ const collections = snapshot.map((item) => new Collection(item));
1859
+
1860
+ return Dao(db).importCollections(collections, true, null);
1861
+ }, (db) => {
1862
+ return null;
1863
+ })