@happyvertical/smrt-social 0.57.45 → 0.57.47

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.
@@ -2,136 +2,75 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-social",
5
- "packageVersion": "0.57.45",
5
+ "packageVersion": "0.57.47",
6
6
  "objects": {
7
- "@happyvertical/smrt-social:OAuthState": {
8
- "name": "oauthstate",
9
- "className": "OAuthState",
10
- "qualifiedName": "@happyvertical/smrt-social:OAuthState",
7
+ "@happyvertical/smrt-social:OAuthStateCollection": {
8
+ "name": "oauthstatecollection",
9
+ "className": "OAuthStateCollection",
10
+ "qualifiedName": "@happyvertical/smrt-social:OAuthStateCollection",
11
11
  "collection": "oauthstates",
12
- "description": "Temporary OAuth state for social account connection",
13
- "filePath": "/home/runner/work/smrt/smrt/packages/social/src/oauth-state.ts",
12
+ "filePath": "/home/runner/work/smrt/smrt/packages/social/src/collections/oauth-state-collection.ts",
14
13
  "packageName": "@happyvertical/smrt-social",
15
- "fields": {
16
- "created_at": {
17
- "type": "datetime",
18
- "required": false
19
- },
20
- "updated_at": {
21
- "type": "datetime",
22
- "required": false
23
- },
24
- "tenantId": {
25
- "type": "text",
26
- "required": false,
27
- "_meta": {
28
- "sqlType": "UUID",
29
- "nullable": true,
30
- "__tenancy": {
31
- "isTenantIdField": true,
32
- "autoFilter": true,
33
- "required": false,
34
- "autoPopulate": true,
35
- "nullable": true,
36
- "mode": "optional",
37
- "field": "tenantId",
38
- "allowSuperAdminBypass": false
39
- }
40
- }
41
- },
42
- "platform": {
43
- "type": "text",
44
- "required": false,
45
- "default": "youtube",
46
- "enum": [
47
- "youtube",
48
- "threads",
49
- "x",
50
- "bluesky",
51
- "facebook"
52
- ]
53
- },
54
- "state": {
55
- "type": "text",
56
- "required": false,
57
- "default": ""
58
- },
59
- "codeVerifier": {
60
- "type": "text",
61
- "required": false
62
- },
63
- "redirectUri": {
64
- "type": "text",
65
- "required": false,
66
- "default": ""
67
- },
68
- "scopes": {
69
- "type": "json",
70
- "required": false,
71
- "default": []
72
- },
73
- "expiresAt": {
74
- "type": "datetime",
75
- "required": false
76
- },
77
- "createdByUserId": {
78
- "type": "crossPackageRef",
79
- "required": false,
80
- "related": "@happyvertical/smrt-users:User"
81
- },
82
- "returnTo": {
83
- "type": "text",
84
- "required": false
85
- }
86
- },
14
+ "fields": {},
87
15
  "methods": {
88
- "verifyState": {
89
- "name": "verifyState",
90
- "async": false,
16
+ "findByState": {
17
+ "name": "findByState",
18
+ "async": true,
91
19
  "parameters": [
92
20
  {
93
- "name": "callbackState",
21
+ "name": "state",
94
22
  "type": "string",
95
23
  "optional": false
96
24
  }
97
25
  ],
98
- "returnType": "boolean",
26
+ "returnType": "Promise<OAuthState | null>",
99
27
  "isStatic": false,
100
28
  "isPublic": true
101
29
  },
102
- "generateState": {
103
- "name": "generateState",
104
- "async": false,
105
- "parameters": [],
106
- "returnType": "string",
107
- "isStatic": true,
30
+ "consume": {
31
+ "name": "consume",
32
+ "async": true,
33
+ "parameters": [
34
+ {
35
+ "name": "state",
36
+ "type": "OAuthState",
37
+ "optional": false
38
+ }
39
+ ],
40
+ "returnType": "Promise<boolean>",
41
+ "isStatic": false,
108
42
  "isPublic": true
109
43
  },
110
- "generateCodeVerifier": {
111
- "name": "generateCodeVerifier",
112
- "async": false,
113
- "parameters": [],
114
- "returnType": "string",
115
- "isStatic": true,
44
+ "findExpired": {
45
+ "name": "findExpired",
46
+ "async": true,
47
+ "parameters": [
48
+ {
49
+ "name": "now",
50
+ "type": "Date",
51
+ "optional": true
52
+ }
53
+ ],
54
+ "returnType": "Promise<OAuthState[]>",
55
+ "isStatic": false,
116
56
  "isPublic": true
117
57
  },
118
- "generateCodeChallenge": {
119
- "name": "generateCodeChallenge",
58
+ "deleteExpired": {
59
+ "name": "deleteExpired",
120
60
  "async": true,
121
61
  "parameters": [
122
62
  {
123
- "name": "verifier",
124
- "type": "string",
125
- "optional": false
63
+ "name": "now",
64
+ "type": "Date",
65
+ "optional": true
126
66
  }
127
67
  ],
128
- "returnType": "Promise<string>",
129
- "isStatic": true,
68
+ "returnType": "Promise<number>",
69
+ "isStatic": false,
130
70
  "isPublic": true
131
71
  }
132
72
  },
133
73
  "decoratorConfig": {
134
- "tableStrategy": "sti",
135
74
  "api": {
136
75
  "include": [
137
76
  "list",
@@ -140,23 +79,17 @@
140
79
  "delete"
141
80
  ]
142
81
  },
143
- "mcp": false,
144
- "cli": {
145
- "skipApiCheck": true
146
- },
147
- "tenantScoped": {
148
- "mode": "optional"
149
- },
150
- "conflictColumns": [
151
- "tenant_id",
152
- "slug",
153
- "context",
154
- "_meta_type"
155
- ]
82
+ "mcp": false
156
83
  },
157
- "extends": "SmrtObject",
158
- "exportName": "OAuthState",
159
- "collectionExportName": "OAuthStateCollection",
84
+ "extends": "SmrtCollection",
85
+ "extendsTypeArg": "OAuthState",
86
+ "exportName": "OAuthStateCollection",
87
+ "collectionExportName": "OAuthStateCollectionCollection",
88
+ "collectionOf": "@happyvertical/smrt-social:OAuthState",
89
+ "inheritedExposure": [
90
+ "api",
91
+ "mcp"
92
+ ],
160
93
  "schema": {
161
94
  "tableName": "oauth_states",
162
95
  "ddl": "CREATE TABLE IF NOT EXISTS \"oauth_states\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"platform\" TEXT DEFAULT 'youtube',\n \"state\" TEXT DEFAULT '',\n \"code_verifier\" TEXT,\n \"redirect_uri\" TEXT DEFAULT '',\n \"scopes\" JSON DEFAULT '[]',\n \"expires_at\" TIMESTAMP,\n \"created_by_user_id\" UUID,\n \"return_to\" TEXT\n);",
@@ -273,265 +206,78 @@
273
206
  },
274
207
  "importPath": "@happyvertical/smrt-social"
275
208
  },
276
- "@happyvertical/smrt-social:SocialAccount": {
277
- "name": "socialaccount",
278
- "className": "SocialAccount",
279
- "qualifiedName": "@happyvertical/smrt-social:SocialAccount",
209
+ "@happyvertical/smrt-social:SocialAccountCollection": {
210
+ "name": "socialaccountcollection",
211
+ "className": "SocialAccountCollection",
212
+ "qualifiedName": "@happyvertical/smrt-social:SocialAccountCollection",
280
213
  "collection": "socialaccounts",
281
- "description": "Connected social media account for publishing",
282
- "filePath": "/home/runner/work/smrt/smrt/packages/social/src/social-account.ts",
214
+ "filePath": "/home/runner/work/smrt/smrt/packages/social/src/collections/social-account-collection.ts",
283
215
  "packageName": "@happyvertical/smrt-social",
284
- "fields": {
285
- "created_at": {
286
- "type": "datetime",
287
- "required": false
288
- },
289
- "updated_at": {
290
- "type": "datetime",
291
- "required": false
216
+ "fields": {},
217
+ "methods": {
218
+ "findActive": {
219
+ "name": "findActive",
220
+ "async": true,
221
+ "parameters": [
222
+ {
223
+ "name": "platform",
224
+ "type": "SocialPlatformType",
225
+ "optional": true
226
+ }
227
+ ],
228
+ "returnType": "Promise<SocialAccount[]>",
229
+ "isStatic": false,
230
+ "isPublic": true
292
231
  },
293
- "tenantId": {
294
- "type": "text",
295
- "required": false,
296
- "_meta": {
297
- "sqlType": "UUID",
298
- "nullable": true,
299
- "__tenancy": {
300
- "isTenantIdField": true,
301
- "autoFilter": true,
302
- "required": false,
303
- "autoPopulate": true,
304
- "nullable": true,
305
- "mode": "optional",
306
- "field": "tenantId",
307
- "allowSuperAdminBypass": false
232
+ "findReady": {
233
+ "name": "findReady",
234
+ "async": true,
235
+ "parameters": [
236
+ {
237
+ "name": "platform",
238
+ "type": "SocialPlatformType",
239
+ "optional": true
308
240
  }
309
- }
241
+ ],
242
+ "returnType": "Promise<SocialAccount[]>",
243
+ "isStatic": false,
244
+ "isPublic": true
310
245
  },
311
- "name": {
312
- "type": "text",
313
- "required": false,
314
- "default": "",
315
- "description": "A name you will recognise this account by.",
316
- "_meta": {
317
- "description": "A name you will recognise this account by."
318
- }
319
- },
320
- "platform": {
321
- "type": "text",
322
- "required": false,
323
- "default": "youtube",
324
- "description": "Which platform it is on: YouTube, X, Threads or Bluesky.",
325
- "_meta": {
326
- "description": "Which platform it is on: YouTube, X, Threads or Bluesky."
327
- },
328
- "enum": [
329
- "youtube",
330
- "threads",
331
- "x",
332
- "bluesky",
333
- "facebook"
334
- ]
335
- },
336
- "platformUserId": {
337
- "type": "text",
338
- "required": false
339
- },
340
- "platformUsername": {
341
- "type": "text",
342
- "required": false,
343
- "description": "The username or handle you post under.",
344
- "_meta": {
345
- "description": "The username or handle you post under."
346
- }
347
- },
348
- "platformUrl": {
349
- "type": "text",
350
- "required": false,
351
- "description": "The web address of your profile on the platform.",
352
- "_meta": {
353
- "description": "The web address of your profile on the platform."
354
- }
355
- },
356
- "accessToken": {
357
- "type": "text",
358
- "required": false
359
- },
360
- "refreshToken": {
361
- "type": "text",
362
- "required": false
363
- },
364
- "credentialSecretId": {
365
- "type": "text",
366
- "required": false
367
- },
368
- "accessTokenSecretName": {
369
- "type": "text",
370
- "required": false
371
- },
372
- "refreshTokenSecretName": {
373
- "type": "text",
374
- "required": false
375
- },
376
- "tokenExpiresAt": {
377
- "type": "datetime",
378
- "required": false
379
- },
380
- "isActive": {
381
- "type": "boolean",
382
- "required": false,
383
- "default": true,
384
- "description": "Whether posts can still go out from this account.",
385
- "_meta": {
386
- "description": "Whether posts can still go out from this account."
387
- }
388
- },
389
- "defaultHashtags": {
390
- "type": "json",
391
- "required": false,
392
- "default": [],
393
- "description": "Hashtags added to every post from this account.",
394
- "_meta": {
395
- "description": "Hashtags added to every post from this account."
396
- }
397
- },
398
- "scopes": {
399
- "type": "json",
400
- "required": false,
401
- "default": []
402
- },
403
- "missingPermissions": {
404
- "type": "json",
405
- "required": false,
406
- "default": []
407
- },
408
- "linkBehavior": {
409
- "type": "text",
410
- "required": false,
411
- "default": "description",
412
- "description": "Where a shared link goes: in the text, as a reply, or left out.",
413
- "_meta": {
414
- "description": "Where a shared link goes: in the text, as a reply, or left out."
415
- },
416
- "enum": [
417
- "description",
418
- "inline",
419
- "attachment",
420
- "reply",
421
- "none"
422
- ]
423
- },
424
- "publishMode": {
425
- "type": "text",
426
- "required": false,
427
- "default": "dry_run",
428
- "enum": [
429
- "dry_run",
430
- "stage_remote",
431
- "private_or_scheduled",
432
- "public"
433
- ]
434
- },
435
- "publicPublishingAllowed": {
436
- "type": "boolean",
437
- "required": false,
438
- "default": false
439
- },
440
- "status": {
441
- "type": "text",
442
- "required": false,
443
- "default": "connected",
444
- "description": "Whether the account is connected, or needs signing in again.",
445
- "_meta": {
446
- "description": "Whether the account is connected, or needs signing in again."
447
- },
448
- "enum": [
449
- "connected",
450
- "disconnected",
451
- "expired",
452
- "missing_permissions",
453
- "error"
454
- ]
455
- },
456
- "errorMessage": {
457
- "type": "text",
458
- "required": false
459
- }
460
- },
461
- "methods": {
462
- "getSlug": {
463
- "name": "getSlug",
464
- "async": true,
465
- "parameters": [],
466
- "returnType": "Promise<string | null | undefined>",
467
- "isStatic": false,
468
- "isPublic": true
469
- },
470
- "setCredentials": {
471
- "name": "setCredentials",
472
- "async": true,
473
- "parameters": [
474
- {
475
- "name": "credentials",
476
- "type": "Record<string, unknown>",
477
- "optional": false
478
- },
479
- {
480
- "name": "options",
481
- "type": "object",
482
- "optional": true,
483
- "memberTypes": [
484
- "string"
485
- ]
486
- }
487
- ],
488
- "returnType": "Promise<void>",
489
- "isStatic": false,
490
- "isPublic": true
491
- },
492
- "getCredentials": {
493
- "name": "getCredentials",
494
- "async": true,
495
- "parameters": [],
496
- "returnType": "Promise<Record<string, unknown> | null>",
497
- "isStatic": false,
498
- "isPublic": true
499
- }
500
- },
501
- "decoratorConfig": {
502
- "tableStrategy": "sti",
503
- "api": {
504
- "include": [
505
- "list",
506
- "get",
507
- "create",
508
- "update",
509
- "delete"
510
- ]
246
+ "findNeedsAttention": {
247
+ "name": "findNeedsAttention",
248
+ "async": true,
249
+ "parameters": [],
250
+ "returnType": "Promise<SocialAccount[]>",
251
+ "isStatic": false,
252
+ "isPublic": true
253
+ }
254
+ },
255
+ "decoratorConfig": {
256
+ "api": {
257
+ "include": [
258
+ "list",
259
+ "get",
260
+ "create",
261
+ "update",
262
+ "delete"
263
+ ]
511
264
  },
512
265
  "mcp": {
513
266
  "include": [
514
267
  "list",
515
268
  "get"
516
269
  ]
517
- },
518
- "cli": {
519
- "skipApiCheck": true
520
- },
521
- "tenantScoped": {
522
- "mode": "optional"
523
- },
524
- "conflictColumns": [
525
- "tenant_id",
526
- "slug",
527
- "context",
528
- "_meta_type"
529
- ]
270
+ }
530
271
  },
531
- "extends": "SmrtObject",
532
- "exportName": "SocialAccount",
533
- "collectionExportName": "SocialAccountCollection",
534
- "displayLabelField": "name",
272
+ "extends": "SmrtCollection",
273
+ "extendsTypeArg": "SocialAccount",
274
+ "exportName": "SocialAccountCollection",
275
+ "collectionExportName": "SocialAccountCollectionCollection",
276
+ "collectionOf": "@happyvertical/smrt-social:SocialAccount",
277
+ "inheritedExposure": [
278
+ "api",
279
+ "mcp"
280
+ ],
535
281
  "schema": {
536
282
  "tableName": "social_accounts",
537
283
  "ddl": "CREATE TABLE IF NOT EXISTS \"social_accounts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"platform\" TEXT DEFAULT 'youtube',\n \"platform_user_id\" TEXT,\n \"platform_username\" TEXT,\n \"platform_url\" TEXT,\n \"access_token\" TEXT,\n \"refresh_token\" TEXT,\n \"credential_secret_id\" TEXT,\n \"access_token_secret_name\" TEXT,\n \"refresh_token_secret_name\" TEXT,\n \"token_expires_at\" TIMESTAMP,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"default_hashtags\" JSON DEFAULT '[]',\n \"scopes\" JSON DEFAULT '[]',\n \"missing_permissions\" JSON DEFAULT '[]',\n \"link_behavior\" TEXT DEFAULT 'description',\n \"publish_mode\" TEXT DEFAULT 'dry_run',\n \"public_publishing_allowed\" BOOLEAN DEFAULT FALSE,\n \"status\" TEXT DEFAULT 'connected',\n \"error_message\" TEXT\n);",
@@ -695,92 +441,67 @@
695
441
  },
696
442
  "importPath": "@happyvertical/smrt-social"
697
443
  },
698
- "@happyvertical/smrt-social:SocialPostAnalyticsSnapshot": {
699
- "name": "socialpostanalyticssnapshot",
700
- "className": "SocialPostAnalyticsSnapshot",
701
- "qualifiedName": "@happyvertical/smrt-social:SocialPostAnalyticsSnapshot",
444
+ "@happyvertical/smrt-social:SocialPostAnalyticsSnapshotCollection": {
445
+ "name": "socialpostanalyticssnapshotcollection",
446
+ "className": "SocialPostAnalyticsSnapshotCollection",
447
+ "qualifiedName": "@happyvertical/smrt-social:SocialPostAnalyticsSnapshotCollection",
702
448
  "collection": "socialpostanalyticssnapshots",
703
- "filePath": "/home/runner/work/smrt/smrt/packages/social/src/social-post-analytics-snapshot.ts",
449
+ "filePath": "/home/runner/work/smrt/smrt/packages/social/src/collections/social-post-analytics-snapshot-collection.ts",
704
450
  "packageName": "@happyvertical/smrt-social",
705
- "fields": {
706
- "created_at": {
707
- "type": "datetime",
708
- "required": false
709
- },
710
- "updated_at": {
711
- "type": "datetime",
712
- "required": false
451
+ "fields": {},
452
+ "methods": {
453
+ "recordSnapshot": {
454
+ "name": "recordSnapshot",
455
+ "async": true,
456
+ "parameters": [
457
+ {
458
+ "name": "options",
459
+ "type": "object",
460
+ "optional": false,
461
+ "memberTypes": [
462
+ "string",
463
+ "SocialPlatformType",
464
+ "PostAnalytics",
465
+ "RawAnalyticsPayload",
466
+ "Date",
467
+ "string | null"
468
+ ]
469
+ }
470
+ ],
471
+ "returnType": "Promise<SocialPostAnalyticsSnapshot>",
472
+ "isStatic": false,
473
+ "isPublic": true
713
474
  },
714
- "tenantId": {
715
- "type": "text",
716
- "required": false,
717
- "_meta": {
718
- "sqlType": "UUID",
719
- "nullable": true,
720
- "__tenancy": {
721
- "isTenantIdField": true,
722
- "autoFilter": true,
723
- "required": false,
724
- "autoPopulate": true,
725
- "nullable": true,
726
- "mode": "optional",
727
- "field": "tenantId",
728
- "allowSuperAdminBypass": false
475
+ "findForPost": {
476
+ "name": "findForPost",
477
+ "async": true,
478
+ "parameters": [
479
+ {
480
+ "name": "socialPostId",
481
+ "type": "string",
482
+ "optional": false
729
483
  }
730
- }
731
- },
732
- "socialPostId": {
733
- "type": "foreignKey",
734
- "required": false,
735
- "related": "SocialPost",
736
- "description": "The post these numbers are for.",
737
- "_meta": {
738
- "description": "The post these numbers are for."
739
- }
740
- },
741
- "platform": {
742
- "type": "text",
743
- "required": true,
744
- "description": "The platform that reported the numbers.",
745
- "_meta": {
746
- "required": true,
747
- "description": "The platform that reported the numbers."
748
- },
749
- "enum": [
750
- "youtube",
751
- "threads",
752
- "x",
753
- "bluesky",
754
- "facebook"
755
- ]
756
- },
757
- "analytics": {
758
- "type": "json",
759
- "required": false,
760
- "description": "The views, likes, comments, shares and clicks the platform reported.",
761
- "_meta": {
762
- "description": "The views, likes, comments, shares and clicks the platform reported."
763
- }
764
- },
765
- "raw": {
766
- "type": "json",
767
- "required": false,
768
- "_meta": {
769
- "nullable": true
770
- }
484
+ ],
485
+ "returnType": "Promise<SocialPostAnalyticsSnapshot[]>",
486
+ "isStatic": false,
487
+ "isPublic": true
771
488
  },
772
- "capturedAt": {
773
- "type": "datetime",
774
- "required": false,
775
- "description": "When these numbers were taken from the platform.",
776
- "_meta": {
777
- "description": "When these numbers were taken from the platform."
778
- }
489
+ "findLatestForPost": {
490
+ "name": "findLatestForPost",
491
+ "async": true,
492
+ "parameters": [
493
+ {
494
+ "name": "socialPostId",
495
+ "type": "string",
496
+ "optional": false
497
+ }
498
+ ],
499
+ "returnType": "Promise<SocialPostAnalyticsSnapshot | null>",
500
+ "isStatic": false,
501
+ "isPublic": true
779
502
  }
780
503
  },
781
- "methods": {},
782
504
  "decoratorConfig": {
783
- "tableStrategy": "sti",
784
505
  "api": {
785
506
  "include": [
786
507
  "list",
@@ -794,27 +515,16 @@
794
515
  "list",
795
516
  "get"
796
517
  ]
797
- },
798
- "cli": true,
799
- "tenantScoped": {
800
- "mode": "optional"
801
- },
802
- "conflictColumns": [
803
- "tenant_id",
804
- "slug",
805
- "context",
806
- "_meta_type"
807
- ]
808
- },
809
- "extends": "SmrtObject",
810
- "exportName": "SocialPostAnalyticsSnapshot",
811
- "collectionExportName": "SocialPostAnalyticsSnapshotCollection",
812
- "validationRules": [
813
- {
814
- "field": "platform",
815
- "rule": "required",
816
- "fieldType": "text"
817
518
  }
519
+ },
520
+ "extends": "SmrtCollection",
521
+ "extendsTypeArg": "SocialPostAnalyticsSnapshot",
522
+ "exportName": "SocialPostAnalyticsSnapshotCollection",
523
+ "collectionExportName": "SocialPostAnalyticsSnapshotCollectionCollection",
524
+ "collectionOf": "@happyvertical/smrt-social:SocialPostAnalyticsSnapshot",
525
+ "inheritedExposure": [
526
+ "api",
527
+ "mcp"
818
528
  ],
819
529
  "schema": {
820
530
  "tableName": "social_post_analytics_snapshots",
@@ -922,183 +632,143 @@
922
632
  },
923
633
  "importPath": "@happyvertical/smrt-social"
924
634
  },
925
- "@happyvertical/smrt-social:SocialPost": {
926
- "name": "socialpost",
927
- "className": "SocialPost",
928
- "qualifiedName": "@happyvertical/smrt-social:SocialPost",
635
+ "@happyvertical/smrt-social:SocialPostCollection": {
636
+ "name": "socialpostcollection",
637
+ "className": "SocialPostCollection",
638
+ "qualifiedName": "@happyvertical/smrt-social:SocialPostCollection",
929
639
  "collection": "socialposts",
930
- "description": "Social media post for multi-platform publishing",
931
- "filePath": "/home/runner/work/smrt/smrt/packages/social/src/social-post.ts",
640
+ "filePath": "/home/runner/work/smrt/smrt/packages/social/src/collections/social-post-collection.ts",
932
641
  "packageName": "@happyvertical/smrt-social",
933
- "fields": {
934
- "created_at": {
935
- "type": "datetime",
936
- "required": false
937
- },
938
- "updated_at": {
939
- "type": "datetime",
940
- "required": false
941
- },
942
- "tenantId": {
943
- "type": "text",
944
- "required": false,
945
- "_meta": {
946
- "sqlType": "UUID",
947
- "nullable": true,
948
- "__tenancy": {
949
- "isTenantIdField": true,
950
- "autoFilter": true,
951
- "required": false,
952
- "autoPopulate": true,
953
- "nullable": true,
954
- "mode": "optional",
955
- "field": "tenantId",
956
- "allowSuperAdminBypass": false
642
+ "fields": {},
643
+ "methods": {
644
+ "createDraft": {
645
+ "name": "createDraft",
646
+ "async": true,
647
+ "parameters": [
648
+ {
649
+ "name": "options",
650
+ "type": "CreateSocialPostDraftOptions",
651
+ "optional": false
957
652
  }
958
- }
959
- },
960
- "socialAccountId": {
961
- "type": "foreignKey",
962
- "required": false,
963
- "related": "SocialAccount",
964
- "description": "The connected account this post goes out from.",
965
- "_meta": {
966
- "description": "The connected account this post goes out from."
967
- }
653
+ ],
654
+ "returnType": "Promise<SocialPost>",
655
+ "isStatic": false,
656
+ "isPublic": true
968
657
  },
969
- "createdByUserId": {
970
- "type": "crossPackageRef",
971
- "required": false,
972
- "related": "@happyvertical/smrt-users:User"
658
+ "findByStatus": {
659
+ "name": "findByStatus",
660
+ "async": true,
661
+ "parameters": [
662
+ {
663
+ "name": "status",
664
+ "type": "PostStatus",
665
+ "optional": false
666
+ }
667
+ ],
668
+ "returnType": "Promise<SocialPost[]>",
669
+ "isStatic": false,
670
+ "isPublic": true
973
671
  },
974
- "videoContentId": {
975
- "type": "crossPackageRef",
976
- "required": false,
977
- "related": "@happyvertical/smrt-video:VideoContent"
672
+ "findForAccount": {
673
+ "name": "findForAccount",
674
+ "async": true,
675
+ "parameters": [
676
+ {
677
+ "name": "socialAccountId",
678
+ "type": "string",
679
+ "optional": false
680
+ }
681
+ ],
682
+ "returnType": "Promise<SocialPost[]>",
683
+ "isStatic": false,
684
+ "isPublic": true
978
685
  },
979
- "contentId": {
980
- "type": "crossPackageRef",
981
- "required": false,
982
- "related": "@happyvertical/smrt-content:Content"
686
+ "findDueForPublish": {
687
+ "name": "findDueForPublish",
688
+ "async": true,
689
+ "parameters": [
690
+ {
691
+ "name": "now",
692
+ "type": "Date",
693
+ "optional": true
694
+ }
695
+ ],
696
+ "returnType": "Promise<SocialPost[]>",
697
+ "isStatic": false,
698
+ "isPublic": true
983
699
  },
984
- "postType": {
985
- "type": "text",
986
- "required": false,
987
- "default": "text",
988
- "description": "What kind of post it is: text, link, image or video.",
989
- "_meta": {
990
- "description": "What kind of post it is: text, link, image or video."
991
- },
992
- "enum": [
993
- "text",
994
- "link",
995
- "image",
996
- "video"
997
- ]
700
+ "recordPublishSuccess": {
701
+ "name": "recordPublishSuccess",
702
+ "async": true,
703
+ "parameters": [
704
+ {
705
+ "name": "post",
706
+ "type": "SocialPost",
707
+ "optional": false
708
+ },
709
+ {
710
+ "name": "data",
711
+ "type": "PublishSuccessData",
712
+ "optional": false
713
+ }
714
+ ],
715
+ "returnType": "Promise<SocialPost>",
716
+ "isStatic": false,
717
+ "isPublic": true
998
718
  },
999
- "mediaUrl": {
1000
- "type": "text",
1001
- "required": false
1002
- },
1003
- "title": {
1004
- "type": "text",
1005
- "required": false,
1006
- "description": "A title, for platforms that show one.",
1007
- "_meta": {
1008
- "description": "A title, for platforms that show one."
1009
- }
1010
- },
1011
- "description": {
1012
- "type": "text",
1013
- "required": false,
1014
- "default": "",
1015
- "description": "The words of the post.",
1016
- "_meta": {
1017
- "description": "The words of the post."
1018
- }
1019
- },
1020
- "hashtags": {
1021
- "type": "json",
1022
- "required": false,
1023
- "default": [],
1024
- "description": "Hashtags added to the end of the post.",
1025
- "_meta": {
1026
- "description": "Hashtags added to the end of the post."
1027
- }
1028
- },
1029
- "linkUrl": {
1030
- "type": "text",
1031
- "required": false,
1032
- "description": "A web address to share with the post.",
1033
- "_meta": {
1034
- "description": "A web address to share with the post."
1035
- }
1036
- },
1037
- "platformPostId": {
1038
- "type": "text",
1039
- "required": false
1040
- },
1041
- "platformUrl": {
1042
- "type": "text",
1043
- "required": false,
1044
- "description": "Where the post can be seen on the platform, once it is out.",
1045
- "_meta": {
1046
- "description": "Where the post can be seen on the platform, once it is out."
1047
- }
1048
- },
1049
- "scheduledAt": {
1050
- "type": "datetime",
1051
- "required": false,
1052
- "description": "The date and time you have in mind for putting the post out. Only a note of the plan: publishing is a separate step your application has to run.",
1053
- "_meta": {
1054
- "description": "The date and time you have in mind for putting the post out. Only a note of the plan: publishing is a separate step your application has to run."
1055
- }
1056
- },
1057
- "publishedAt": {
1058
- "type": "datetime",
1059
- "required": false,
1060
- "description": "When the post actually went out.",
1061
- "_meta": {
1062
- "description": "When the post actually went out."
1063
- }
1064
- },
1065
- "status": {
1066
- "type": "text",
1067
- "required": false,
1068
- "default": "draft",
1069
- "description": "Where the post stands: draft, waiting to go out, published or failed.",
1070
- "_meta": {
1071
- "description": "Where the post stands: draft, waiting to go out, published or failed."
1072
- },
1073
- "enum": [
1074
- "draft",
1075
- "pending_approval",
1076
- "approved",
1077
- "scheduled",
1078
- "publishing",
1079
- "dry_run",
1080
- "staged",
1081
- "published",
1082
- "failed",
1083
- "cancelled"
1084
- ]
1085
- },
1086
- "errorMessage": {
1087
- "type": "text",
1088
- "required": false
1089
- },
1090
- "analytics": {
1091
- "type": "json",
1092
- "required": false
719
+ "recordPublishFailure": {
720
+ "name": "recordPublishFailure",
721
+ "async": true,
722
+ "parameters": [
723
+ {
724
+ "name": "post",
725
+ "type": "SocialPost",
726
+ "optional": false
727
+ },
728
+ {
729
+ "name": "error",
730
+ "type": "Error | string",
731
+ "optional": false,
732
+ "unionBranches": [
733
+ {
734
+ "type": "Error"
735
+ },
736
+ {
737
+ "type": "string"
738
+ }
739
+ ]
740
+ }
741
+ ],
742
+ "returnType": "Promise<SocialPost>",
743
+ "isStatic": false,
744
+ "isPublic": true
1093
745
  },
1094
- "analyticsLastSyncedAt": {
1095
- "type": "datetime",
1096
- "required": false
746
+ "updateLatestAnalytics": {
747
+ "name": "updateLatestAnalytics",
748
+ "async": true,
749
+ "parameters": [
750
+ {
751
+ "name": "post",
752
+ "type": "SocialPost",
753
+ "optional": false
754
+ },
755
+ {
756
+ "name": "analytics",
757
+ "type": "PostAnalytics",
758
+ "optional": false
759
+ },
760
+ {
761
+ "name": "syncedAt",
762
+ "type": "Date",
763
+ "optional": true
764
+ }
765
+ ],
766
+ "returnType": "Promise<SocialPost>",
767
+ "isStatic": false,
768
+ "isPublic": true
1097
769
  }
1098
770
  },
1099
- "methods": {},
1100
771
  "decoratorConfig": {
1101
- "tableStrategy": "sti",
1102
772
  "api": {
1103
773
  "include": [
1104
774
  "list",
@@ -1113,22 +783,17 @@
1113
783
  "list",
1114
784
  "get"
1115
785
  ]
1116
- },
1117
- "cli": true,
1118
- "tenantScoped": {
1119
- "mode": "optional"
1120
- },
1121
- "conflictColumns": [
1122
- "tenant_id",
1123
- "slug",
1124
- "context",
1125
- "_meta_type"
1126
- ]
786
+ }
1127
787
  },
1128
- "extends": "SmrtObject",
1129
- "exportName": "SocialPost",
1130
- "collectionExportName": "SocialPostCollection",
1131
- "displayLabelField": "title",
788
+ "extends": "SmrtCollection",
789
+ "extendsTypeArg": "SocialPost",
790
+ "exportName": "SocialPostCollection",
791
+ "collectionExportName": "SocialPostCollectionCollection",
792
+ "collectionOf": "@happyvertical/smrt-social:SocialPost",
793
+ "inheritedExposure": [
794
+ "api",
795
+ "mcp"
796
+ ],
1132
797
  "schema": {
1133
798
  "tableName": "social_posts",
1134
799
  "ddl": "CREATE TABLE IF NOT EXISTS \"social_posts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"social_account_id\" UUID,\n \"created_by_user_id\" UUID,\n \"video_content_id\" UUID,\n \"content_id\" UUID,\n \"post_type\" TEXT DEFAULT 'text',\n \"media_url\" TEXT,\n \"title\" TEXT,\n \"description\" TEXT DEFAULT '',\n \"hashtags\" JSON DEFAULT '[]',\n \"link_url\" TEXT,\n \"platform_post_id\" TEXT,\n \"platform_url\" TEXT,\n \"scheduled_at\" TIMESTAMP,\n \"published_at\" TIMESTAMP,\n \"status\" TEXT DEFAULT 'draft',\n \"error_message\" TEXT,\n \"analytics\" JSON,\n \"analytics_last_synced_at\" TIMESTAMP\n);",
@@ -1312,73 +977,134 @@
1312
977
  },
1313
978
  "importPath": "@happyvertical/smrt-social"
1314
979
  },
1315
- "@happyvertical/smrt-social:OAuthStateCollection": {
1316
- "name": "oauthstatecollection",
1317
- "className": "OAuthStateCollection",
1318
- "qualifiedName": "@happyvertical/smrt-social:OAuthStateCollection",
980
+ "@happyvertical/smrt-social:OAuthState": {
981
+ "name": "oauthstate",
982
+ "className": "OAuthState",
983
+ "qualifiedName": "@happyvertical/smrt-social:OAuthState",
1319
984
  "collection": "oauthstates",
1320
- "filePath": "/home/runner/work/smrt/smrt/packages/social/src/collections/oauth-state-collection.ts",
985
+ "description": "Temporary OAuth state for social account connection",
986
+ "filePath": "/home/runner/work/smrt/smrt/packages/social/src/oauth-state.ts",
1321
987
  "packageName": "@happyvertical/smrt-social",
1322
- "fields": {},
1323
- "methods": {
1324
- "findByState": {
1325
- "name": "findByState",
1326
- "async": true,
1327
- "parameters": [
1328
- {
1329
- "name": "state",
1330
- "type": "string",
1331
- "optional": false
1332
- }
1333
- ],
1334
- "returnType": "Promise<OAuthState | null>",
1335
- "isStatic": false,
1336
- "isPublic": true
988
+ "fields": {
989
+ "created_at": {
990
+ "type": "datetime",
991
+ "required": false
1337
992
  },
1338
- "consume": {
1339
- "name": "consume",
1340
- "async": true,
1341
- "parameters": [
1342
- {
1343
- "name": "state",
1344
- "type": "OAuthState",
1345
- "optional": false
1346
- }
1347
- ],
1348
- "returnType": "Promise<boolean>",
1349
- "isStatic": false,
1350
- "isPublic": true
993
+ "updated_at": {
994
+ "type": "datetime",
995
+ "required": false
1351
996
  },
1352
- "findExpired": {
1353
- "name": "findExpired",
1354
- "async": true,
1355
- "parameters": [
1356
- {
1357
- "name": "now",
1358
- "type": "Date",
1359
- "optional": true
997
+ "tenantId": {
998
+ "type": "text",
999
+ "required": false,
1000
+ "_meta": {
1001
+ "sqlType": "UUID",
1002
+ "nullable": true,
1003
+ "__tenancy": {
1004
+ "isTenantIdField": true,
1005
+ "autoFilter": true,
1006
+ "required": false,
1007
+ "autoPopulate": true,
1008
+ "nullable": true,
1009
+ "mode": "optional",
1010
+ "field": "tenantId",
1011
+ "allowSuperAdminBypass": false
1360
1012
  }
1361
- ],
1362
- "returnType": "Promise<OAuthState[]>",
1363
- "isStatic": false,
1364
- "isPublic": true
1013
+ }
1365
1014
  },
1366
- "deleteExpired": {
1367
- "name": "deleteExpired",
1368
- "async": true,
1369
- "parameters": [
1370
- {
1371
- "name": "now",
1372
- "type": "Date",
1373
- "optional": true
1374
- }
1375
- ],
1376
- "returnType": "Promise<number>",
1377
- "isStatic": false,
1378
- "isPublic": true
1015
+ "platform": {
1016
+ "type": "text",
1017
+ "required": false,
1018
+ "default": "youtube",
1019
+ "enum": [
1020
+ "youtube",
1021
+ "threads",
1022
+ "x",
1023
+ "bluesky",
1024
+ "facebook"
1025
+ ]
1026
+ },
1027
+ "state": {
1028
+ "type": "text",
1029
+ "required": false,
1030
+ "default": ""
1031
+ },
1032
+ "codeVerifier": {
1033
+ "type": "text",
1034
+ "required": false
1035
+ },
1036
+ "redirectUri": {
1037
+ "type": "text",
1038
+ "required": false,
1039
+ "default": ""
1040
+ },
1041
+ "scopes": {
1042
+ "type": "json",
1043
+ "required": false,
1044
+ "default": []
1045
+ },
1046
+ "expiresAt": {
1047
+ "type": "datetime",
1048
+ "required": false
1049
+ },
1050
+ "createdByUserId": {
1051
+ "type": "crossPackageRef",
1052
+ "required": false,
1053
+ "related": "@happyvertical/smrt-users:User"
1054
+ },
1055
+ "returnTo": {
1056
+ "type": "text",
1057
+ "required": false
1058
+ }
1059
+ },
1060
+ "methods": {
1061
+ "verifyState": {
1062
+ "name": "verifyState",
1063
+ "async": false,
1064
+ "parameters": [
1065
+ {
1066
+ "name": "callbackState",
1067
+ "type": "string",
1068
+ "optional": false
1069
+ }
1070
+ ],
1071
+ "returnType": "boolean",
1072
+ "isStatic": false,
1073
+ "isPublic": true
1074
+ },
1075
+ "generateState": {
1076
+ "name": "generateState",
1077
+ "async": false,
1078
+ "parameters": [],
1079
+ "returnType": "string",
1080
+ "isStatic": true,
1081
+ "isPublic": true
1082
+ },
1083
+ "generateCodeVerifier": {
1084
+ "name": "generateCodeVerifier",
1085
+ "async": false,
1086
+ "parameters": [],
1087
+ "returnType": "string",
1088
+ "isStatic": true,
1089
+ "isPublic": true
1090
+ },
1091
+ "generateCodeChallenge": {
1092
+ "name": "generateCodeChallenge",
1093
+ "async": true,
1094
+ "parameters": [
1095
+ {
1096
+ "name": "verifier",
1097
+ "type": "string",
1098
+ "optional": false
1099
+ }
1100
+ ],
1101
+ "returnType": "Promise<string>",
1102
+ "isStatic": true,
1103
+ "isPublic": true
1379
1104
  }
1380
1105
  },
1381
1106
  "decoratorConfig": {
1107
+ "tableStrategy": "sti",
1382
1108
  "api": {
1383
1109
  "include": [
1384
1110
  "list",
@@ -1387,12 +1113,23 @@
1387
1113
  "delete"
1388
1114
  ]
1389
1115
  },
1390
- "mcp": false
1116
+ "mcp": false,
1117
+ "cli": {
1118
+ "skipApiCheck": true
1119
+ },
1120
+ "tenantScoped": {
1121
+ "mode": "optional"
1122
+ },
1123
+ "conflictColumns": [
1124
+ "tenant_id",
1125
+ "slug",
1126
+ "context",
1127
+ "_meta_type"
1128
+ ]
1391
1129
  },
1392
- "extends": "SmrtCollection",
1393
- "extendsTypeArg": "OAuthState",
1394
- "exportName": "OAuthStateCollection",
1395
- "collectionExportName": "OAuthStateCollectionCollection",
1130
+ "extends": "SmrtObject",
1131
+ "exportName": "OAuthState",
1132
+ "collectionExportName": "OAuthStateCollection",
1396
1133
  "schema": {
1397
1134
  "tableName": "oauth_states",
1398
1135
  "ddl": "CREATE TABLE IF NOT EXISTS \"oauth_states\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"platform\" TEXT DEFAULT 'youtube',\n \"state\" TEXT DEFAULT '',\n \"code_verifier\" TEXT,\n \"redirect_uri\" TEXT DEFAULT '',\n \"scopes\" JSON DEFAULT '[]',\n \"expires_at\" TIMESTAMP,\n \"created_by_user_id\" UUID,\n \"return_to\" TEXT\n);",
@@ -1509,113 +1246,305 @@
1509
1246
  },
1510
1247
  "importPath": "@happyvertical/smrt-social"
1511
1248
  },
1512
- "@happyvertical/smrt-social:SocialAccountCollection": {
1513
- "name": "socialaccountcollection",
1514
- "className": "SocialAccountCollection",
1515
- "qualifiedName": "@happyvertical/smrt-social:SocialAccountCollection",
1249
+ "@happyvertical/smrt-social:SocialAccount": {
1250
+ "name": "socialaccount",
1251
+ "className": "SocialAccount",
1252
+ "qualifiedName": "@happyvertical/smrt-social:SocialAccount",
1516
1253
  "collection": "socialaccounts",
1517
- "filePath": "/home/runner/work/smrt/smrt/packages/social/src/collections/social-account-collection.ts",
1254
+ "description": "Connected social media account for publishing",
1255
+ "filePath": "/home/runner/work/smrt/smrt/packages/social/src/social-account.ts",
1518
1256
  "packageName": "@happyvertical/smrt-social",
1519
- "fields": {},
1520
- "methods": {
1521
- "findActive": {
1522
- "name": "findActive",
1523
- "async": true,
1524
- "parameters": [
1525
- {
1526
- "name": "platform",
1527
- "type": "SocialPlatformType",
1528
- "optional": true
1529
- }
1530
- ],
1531
- "returnType": "Promise<SocialAccount[]>",
1532
- "isStatic": false,
1533
- "isPublic": true
1257
+ "fields": {
1258
+ "created_at": {
1259
+ "type": "datetime",
1260
+ "required": false
1534
1261
  },
1535
- "findReady": {
1536
- "name": "findReady",
1537
- "async": true,
1538
- "parameters": [
1539
- {
1540
- "name": "platform",
1541
- "type": "SocialPlatformType",
1542
- "optional": true
1262
+ "updated_at": {
1263
+ "type": "datetime",
1264
+ "required": false
1265
+ },
1266
+ "tenantId": {
1267
+ "type": "text",
1268
+ "required": false,
1269
+ "_meta": {
1270
+ "sqlType": "UUID",
1271
+ "nullable": true,
1272
+ "__tenancy": {
1273
+ "isTenantIdField": true,
1274
+ "autoFilter": true,
1275
+ "required": false,
1276
+ "autoPopulate": true,
1277
+ "nullable": true,
1278
+ "mode": "optional",
1279
+ "field": "tenantId",
1280
+ "allowSuperAdminBypass": false
1543
1281
  }
1544
- ],
1545
- "returnType": "Promise<SocialAccount[]>",
1546
- "isStatic": false,
1547
- "isPublic": true
1282
+ }
1548
1283
  },
1549
- "findNeedsAttention": {
1550
- "name": "findNeedsAttention",
1551
- "async": true,
1552
- "parameters": [],
1553
- "returnType": "Promise<SocialAccount[]>",
1554
- "isStatic": false,
1555
- "isPublic": true
1556
- }
1557
- },
1558
- "decoratorConfig": {
1559
- "api": {
1560
- "include": [
1561
- "list",
1562
- "get",
1563
- "create",
1564
- "update",
1565
- "delete"
1566
- ]
1284
+ "name": {
1285
+ "type": "text",
1286
+ "required": false,
1287
+ "default": "",
1288
+ "description": "A name you will recognise this account by.",
1289
+ "_meta": {
1290
+ "description": "A name you will recognise this account by."
1291
+ }
1567
1292
  },
1568
- "mcp": {
1569
- "include": [
1570
- "list",
1571
- "get"
1572
- ]
1573
- }
1574
- },
1575
- "extends": "SmrtCollection",
1576
- "extendsTypeArg": "SocialAccount",
1577
- "exportName": "SocialAccountCollection",
1578
- "collectionExportName": "SocialAccountCollectionCollection",
1579
- "schema": {
1580
- "tableName": "social_accounts",
1581
- "ddl": "CREATE TABLE IF NOT EXISTS \"social_accounts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"platform\" TEXT DEFAULT 'youtube',\n \"platform_user_id\" TEXT,\n \"platform_username\" TEXT,\n \"platform_url\" TEXT,\n \"access_token\" TEXT,\n \"refresh_token\" TEXT,\n \"credential_secret_id\" TEXT,\n \"access_token_secret_name\" TEXT,\n \"refresh_token_secret_name\" TEXT,\n \"token_expires_at\" TIMESTAMP,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"default_hashtags\" JSON DEFAULT '[]',\n \"scopes\" JSON DEFAULT '[]',\n \"missing_permissions\" JSON DEFAULT '[]',\n \"link_behavior\" TEXT DEFAULT 'description',\n \"publish_mode\" TEXT DEFAULT 'dry_run',\n \"public_publishing_allowed\" BOOLEAN DEFAULT FALSE,\n \"status\" TEXT DEFAULT 'connected',\n \"error_message\" TEXT\n);",
1582
- "columns": {
1583
- "id": {
1584
- "type": "UUID",
1585
- "primaryKey": true,
1586
- "referenceKind": "id",
1587
- "notNull": true
1588
- },
1589
- "slug": {
1590
- "type": "TEXT",
1591
- "notNull": true
1592
- },
1593
- "context": {
1594
- "type": "TEXT",
1595
- "notNull": true,
1596
- "default": ""
1597
- },
1598
- "_meta_type": {
1599
- "type": "TEXT",
1600
- "notNull": true
1601
- },
1602
- "_meta_data": {
1603
- "type": "JSON",
1604
- "notNull": false
1605
- },
1606
- "created_at": {
1607
- "type": "TIMESTAMP",
1608
- "notNull": true,
1609
- "default": "current_timestamp"
1610
- },
1611
- "updated_at": {
1612
- "type": "TIMESTAMP",
1613
- "notNull": true,
1614
- "default": "current_timestamp"
1293
+ "platform": {
1294
+ "type": "text",
1295
+ "required": false,
1296
+ "default": "youtube",
1297
+ "description": "Which platform it is on: YouTube, X, Threads or Bluesky.",
1298
+ "_meta": {
1299
+ "description": "Which platform it is on: YouTube, X, Threads or Bluesky."
1615
1300
  },
1616
- "tenant_id": {
1617
- "type": "UUID",
1618
- "referenceKind": "tenantId",
1301
+ "enum": [
1302
+ "youtube",
1303
+ "threads",
1304
+ "x",
1305
+ "bluesky",
1306
+ "facebook"
1307
+ ]
1308
+ },
1309
+ "platformUserId": {
1310
+ "type": "text",
1311
+ "required": false
1312
+ },
1313
+ "platformUsername": {
1314
+ "type": "text",
1315
+ "required": false,
1316
+ "description": "The username or handle you post under.",
1317
+ "_meta": {
1318
+ "description": "The username or handle you post under."
1319
+ }
1320
+ },
1321
+ "platformUrl": {
1322
+ "type": "text",
1323
+ "required": false,
1324
+ "description": "The web address of your profile on the platform.",
1325
+ "_meta": {
1326
+ "description": "The web address of your profile on the platform."
1327
+ }
1328
+ },
1329
+ "accessToken": {
1330
+ "type": "text",
1331
+ "required": false
1332
+ },
1333
+ "refreshToken": {
1334
+ "type": "text",
1335
+ "required": false
1336
+ },
1337
+ "credentialSecretId": {
1338
+ "type": "text",
1339
+ "required": false
1340
+ },
1341
+ "accessTokenSecretName": {
1342
+ "type": "text",
1343
+ "required": false
1344
+ },
1345
+ "refreshTokenSecretName": {
1346
+ "type": "text",
1347
+ "required": false
1348
+ },
1349
+ "tokenExpiresAt": {
1350
+ "type": "datetime",
1351
+ "required": false
1352
+ },
1353
+ "isActive": {
1354
+ "type": "boolean",
1355
+ "required": false,
1356
+ "default": true,
1357
+ "description": "Whether posts can still go out from this account.",
1358
+ "_meta": {
1359
+ "description": "Whether posts can still go out from this account."
1360
+ }
1361
+ },
1362
+ "defaultHashtags": {
1363
+ "type": "json",
1364
+ "required": false,
1365
+ "default": [],
1366
+ "description": "Hashtags added to every post from this account.",
1367
+ "_meta": {
1368
+ "description": "Hashtags added to every post from this account."
1369
+ }
1370
+ },
1371
+ "scopes": {
1372
+ "type": "json",
1373
+ "required": false,
1374
+ "default": []
1375
+ },
1376
+ "missingPermissions": {
1377
+ "type": "json",
1378
+ "required": false,
1379
+ "default": []
1380
+ },
1381
+ "linkBehavior": {
1382
+ "type": "text",
1383
+ "required": false,
1384
+ "default": "description",
1385
+ "description": "Where a shared link goes: in the text, as a reply, or left out.",
1386
+ "_meta": {
1387
+ "description": "Where a shared link goes: in the text, as a reply, or left out."
1388
+ },
1389
+ "enum": [
1390
+ "description",
1391
+ "inline",
1392
+ "attachment",
1393
+ "reply",
1394
+ "none"
1395
+ ]
1396
+ },
1397
+ "publishMode": {
1398
+ "type": "text",
1399
+ "required": false,
1400
+ "default": "dry_run",
1401
+ "enum": [
1402
+ "dry_run",
1403
+ "stage_remote",
1404
+ "private_or_scheduled",
1405
+ "public"
1406
+ ]
1407
+ },
1408
+ "publicPublishingAllowed": {
1409
+ "type": "boolean",
1410
+ "required": false,
1411
+ "default": false
1412
+ },
1413
+ "status": {
1414
+ "type": "text",
1415
+ "required": false,
1416
+ "default": "connected",
1417
+ "description": "Whether the account is connected, or needs signing in again.",
1418
+ "_meta": {
1419
+ "description": "Whether the account is connected, or needs signing in again."
1420
+ },
1421
+ "enum": [
1422
+ "connected",
1423
+ "disconnected",
1424
+ "expired",
1425
+ "missing_permissions",
1426
+ "error"
1427
+ ]
1428
+ },
1429
+ "errorMessage": {
1430
+ "type": "text",
1431
+ "required": false
1432
+ }
1433
+ },
1434
+ "methods": {
1435
+ "getSlug": {
1436
+ "name": "getSlug",
1437
+ "async": true,
1438
+ "parameters": [],
1439
+ "returnType": "Promise<string | null | undefined>",
1440
+ "isStatic": false,
1441
+ "isPublic": true
1442
+ },
1443
+ "setCredentials": {
1444
+ "name": "setCredentials",
1445
+ "async": true,
1446
+ "parameters": [
1447
+ {
1448
+ "name": "credentials",
1449
+ "type": "Record<string, unknown>",
1450
+ "optional": false
1451
+ },
1452
+ {
1453
+ "name": "options",
1454
+ "type": "object",
1455
+ "optional": true,
1456
+ "memberTypes": [
1457
+ "string"
1458
+ ]
1459
+ }
1460
+ ],
1461
+ "returnType": "Promise<void>",
1462
+ "isStatic": false,
1463
+ "isPublic": true
1464
+ },
1465
+ "getCredentials": {
1466
+ "name": "getCredentials",
1467
+ "async": true,
1468
+ "parameters": [],
1469
+ "returnType": "Promise<Record<string, unknown> | null>",
1470
+ "isStatic": false,
1471
+ "isPublic": true
1472
+ }
1473
+ },
1474
+ "decoratorConfig": {
1475
+ "tableStrategy": "sti",
1476
+ "api": {
1477
+ "include": [
1478
+ "list",
1479
+ "get",
1480
+ "create",
1481
+ "update",
1482
+ "delete"
1483
+ ]
1484
+ },
1485
+ "mcp": {
1486
+ "include": [
1487
+ "list",
1488
+ "get"
1489
+ ]
1490
+ },
1491
+ "cli": {
1492
+ "skipApiCheck": true
1493
+ },
1494
+ "tenantScoped": {
1495
+ "mode": "optional"
1496
+ },
1497
+ "conflictColumns": [
1498
+ "tenant_id",
1499
+ "slug",
1500
+ "context",
1501
+ "_meta_type"
1502
+ ]
1503
+ },
1504
+ "extends": "SmrtObject",
1505
+ "exportName": "SocialAccount",
1506
+ "collectionExportName": "SocialAccountCollection",
1507
+ "displayLabelField": "name",
1508
+ "schema": {
1509
+ "tableName": "social_accounts",
1510
+ "ddl": "CREATE TABLE IF NOT EXISTS \"social_accounts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"platform\" TEXT DEFAULT 'youtube',\n \"platform_user_id\" TEXT,\n \"platform_username\" TEXT,\n \"platform_url\" TEXT,\n \"access_token\" TEXT,\n \"refresh_token\" TEXT,\n \"credential_secret_id\" TEXT,\n \"access_token_secret_name\" TEXT,\n \"refresh_token_secret_name\" TEXT,\n \"token_expires_at\" TIMESTAMP,\n \"is_active\" BOOLEAN DEFAULT TRUE,\n \"default_hashtags\" JSON DEFAULT '[]',\n \"scopes\" JSON DEFAULT '[]',\n \"missing_permissions\" JSON DEFAULT '[]',\n \"link_behavior\" TEXT DEFAULT 'description',\n \"publish_mode\" TEXT DEFAULT 'dry_run',\n \"public_publishing_allowed\" BOOLEAN DEFAULT FALSE,\n \"status\" TEXT DEFAULT 'connected',\n \"error_message\" TEXT\n);",
1511
+ "columns": {
1512
+ "id": {
1513
+ "type": "UUID",
1514
+ "primaryKey": true,
1515
+ "referenceKind": "id",
1516
+ "notNull": true
1517
+ },
1518
+ "slug": {
1519
+ "type": "TEXT",
1520
+ "notNull": true
1521
+ },
1522
+ "context": {
1523
+ "type": "TEXT",
1524
+ "notNull": true,
1525
+ "default": ""
1526
+ },
1527
+ "_meta_type": {
1528
+ "type": "TEXT",
1529
+ "notNull": true
1530
+ },
1531
+ "_meta_data": {
1532
+ "type": "JSON",
1533
+ "notNull": false
1534
+ },
1535
+ "created_at": {
1536
+ "type": "TIMESTAMP",
1537
+ "notNull": true,
1538
+ "default": "current_timestamp"
1539
+ },
1540
+ "updated_at": {
1541
+ "type": "TIMESTAMP",
1542
+ "notNull": true,
1543
+ "default": "current_timestamp"
1544
+ },
1545
+ "tenant_id": {
1546
+ "type": "UUID",
1547
+ "referenceKind": "tenantId",
1619
1548
  "notNull": false
1620
1549
  },
1621
1550
  "name": {
@@ -1739,67 +1668,92 @@
1739
1668
  },
1740
1669
  "importPath": "@happyvertical/smrt-social"
1741
1670
  },
1742
- "@happyvertical/smrt-social:SocialPostAnalyticsSnapshotCollection": {
1743
- "name": "socialpostanalyticssnapshotcollection",
1744
- "className": "SocialPostAnalyticsSnapshotCollection",
1745
- "qualifiedName": "@happyvertical/smrt-social:SocialPostAnalyticsSnapshotCollection",
1671
+ "@happyvertical/smrt-social:SocialPostAnalyticsSnapshot": {
1672
+ "name": "socialpostanalyticssnapshot",
1673
+ "className": "SocialPostAnalyticsSnapshot",
1674
+ "qualifiedName": "@happyvertical/smrt-social:SocialPostAnalyticsSnapshot",
1746
1675
  "collection": "socialpostanalyticssnapshots",
1747
- "filePath": "/home/runner/work/smrt/smrt/packages/social/src/collections/social-post-analytics-snapshot-collection.ts",
1676
+ "filePath": "/home/runner/work/smrt/smrt/packages/social/src/social-post-analytics-snapshot.ts",
1748
1677
  "packageName": "@happyvertical/smrt-social",
1749
- "fields": {},
1750
- "methods": {
1751
- "recordSnapshot": {
1752
- "name": "recordSnapshot",
1753
- "async": true,
1754
- "parameters": [
1755
- {
1756
- "name": "options",
1757
- "type": "object",
1758
- "optional": false,
1759
- "memberTypes": [
1760
- "string",
1761
- "SocialPlatformType",
1762
- "PostAnalytics",
1763
- "RawAnalyticsPayload",
1764
- "Date",
1765
- "string | null"
1766
- ]
1767
- }
1768
- ],
1769
- "returnType": "Promise<SocialPostAnalyticsSnapshot>",
1770
- "isStatic": false,
1771
- "isPublic": true
1678
+ "fields": {
1679
+ "created_at": {
1680
+ "type": "datetime",
1681
+ "required": false
1772
1682
  },
1773
- "findForPost": {
1774
- "name": "findForPost",
1775
- "async": true,
1776
- "parameters": [
1777
- {
1778
- "name": "socialPostId",
1779
- "type": "string",
1780
- "optional": false
1781
- }
1782
- ],
1783
- "returnType": "Promise<SocialPostAnalyticsSnapshot[]>",
1784
- "isStatic": false,
1785
- "isPublic": true
1683
+ "updated_at": {
1684
+ "type": "datetime",
1685
+ "required": false
1786
1686
  },
1787
- "findLatestForPost": {
1788
- "name": "findLatestForPost",
1789
- "async": true,
1790
- "parameters": [
1791
- {
1792
- "name": "socialPostId",
1793
- "type": "string",
1794
- "optional": false
1687
+ "tenantId": {
1688
+ "type": "text",
1689
+ "required": false,
1690
+ "_meta": {
1691
+ "sqlType": "UUID",
1692
+ "nullable": true,
1693
+ "__tenancy": {
1694
+ "isTenantIdField": true,
1695
+ "autoFilter": true,
1696
+ "required": false,
1697
+ "autoPopulate": true,
1698
+ "nullable": true,
1699
+ "mode": "optional",
1700
+ "field": "tenantId",
1701
+ "allowSuperAdminBypass": false
1795
1702
  }
1796
- ],
1797
- "returnType": "Promise<SocialPostAnalyticsSnapshot | null>",
1798
- "isStatic": false,
1799
- "isPublic": true
1703
+ }
1704
+ },
1705
+ "socialPostId": {
1706
+ "type": "foreignKey",
1707
+ "required": false,
1708
+ "related": "SocialPost",
1709
+ "description": "The post these numbers are for.",
1710
+ "_meta": {
1711
+ "description": "The post these numbers are for."
1712
+ }
1713
+ },
1714
+ "platform": {
1715
+ "type": "text",
1716
+ "required": true,
1717
+ "description": "The platform that reported the numbers.",
1718
+ "_meta": {
1719
+ "required": true,
1720
+ "description": "The platform that reported the numbers."
1721
+ },
1722
+ "enum": [
1723
+ "youtube",
1724
+ "threads",
1725
+ "x",
1726
+ "bluesky",
1727
+ "facebook"
1728
+ ]
1729
+ },
1730
+ "analytics": {
1731
+ "type": "json",
1732
+ "required": false,
1733
+ "description": "The views, likes, comments, shares and clicks the platform reported.",
1734
+ "_meta": {
1735
+ "description": "The views, likes, comments, shares and clicks the platform reported."
1736
+ }
1737
+ },
1738
+ "raw": {
1739
+ "type": "json",
1740
+ "required": false,
1741
+ "_meta": {
1742
+ "nullable": true
1743
+ }
1744
+ },
1745
+ "capturedAt": {
1746
+ "type": "datetime",
1747
+ "required": false,
1748
+ "description": "When these numbers were taken from the platform.",
1749
+ "_meta": {
1750
+ "description": "When these numbers were taken from the platform."
1751
+ }
1800
1752
  }
1801
1753
  },
1754
+ "methods": {},
1802
1755
  "decoratorConfig": {
1756
+ "tableStrategy": "sti",
1803
1757
  "api": {
1804
1758
  "include": [
1805
1759
  "list",
@@ -1813,12 +1767,28 @@
1813
1767
  "list",
1814
1768
  "get"
1815
1769
  ]
1816
- }
1770
+ },
1771
+ "cli": true,
1772
+ "tenantScoped": {
1773
+ "mode": "optional"
1774
+ },
1775
+ "conflictColumns": [
1776
+ "tenant_id",
1777
+ "slug",
1778
+ "context",
1779
+ "_meta_type"
1780
+ ]
1817
1781
  },
1818
- "extends": "SmrtCollection",
1819
- "extendsTypeArg": "SocialPostAnalyticsSnapshot",
1820
- "exportName": "SocialPostAnalyticsSnapshotCollection",
1821
- "collectionExportName": "SocialPostAnalyticsSnapshotCollectionCollection",
1782
+ "extends": "SmrtObject",
1783
+ "exportName": "SocialPostAnalyticsSnapshot",
1784
+ "collectionExportName": "SocialPostAnalyticsSnapshotCollection",
1785
+ "validationRules": [
1786
+ {
1787
+ "field": "platform",
1788
+ "rule": "required",
1789
+ "fieldType": "text"
1790
+ }
1791
+ ],
1822
1792
  "schema": {
1823
1793
  "tableName": "social_post_analytics_snapshots",
1824
1794
  "ddl": "CREATE TABLE IF NOT EXISTS \"social_post_analytics_snapshots\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"social_post_id\" UUID,\n \"platform\" TEXT,\n \"analytics\" JSON,\n \"raw\" JSON,\n \"captured_at\" TIMESTAMP\n);",
@@ -1925,143 +1895,183 @@
1925
1895
  },
1926
1896
  "importPath": "@happyvertical/smrt-social"
1927
1897
  },
1928
- "@happyvertical/smrt-social:SocialPostCollection": {
1929
- "name": "socialpostcollection",
1930
- "className": "SocialPostCollection",
1931
- "qualifiedName": "@happyvertical/smrt-social:SocialPostCollection",
1898
+ "@happyvertical/smrt-social:SocialPost": {
1899
+ "name": "socialpost",
1900
+ "className": "SocialPost",
1901
+ "qualifiedName": "@happyvertical/smrt-social:SocialPost",
1932
1902
  "collection": "socialposts",
1933
- "filePath": "/home/runner/work/smrt/smrt/packages/social/src/collections/social-post-collection.ts",
1903
+ "description": "Social media post for multi-platform publishing",
1904
+ "filePath": "/home/runner/work/smrt/smrt/packages/social/src/social-post.ts",
1934
1905
  "packageName": "@happyvertical/smrt-social",
1935
- "fields": {},
1936
- "methods": {
1937
- "createDraft": {
1938
- "name": "createDraft",
1939
- "async": true,
1940
- "parameters": [
1941
- {
1942
- "name": "options",
1943
- "type": "CreateSocialPostDraftOptions",
1944
- "optional": false
1945
- }
1946
- ],
1947
- "returnType": "Promise<SocialPost>",
1948
- "isStatic": false,
1949
- "isPublic": true
1906
+ "fields": {
1907
+ "created_at": {
1908
+ "type": "datetime",
1909
+ "required": false
1950
1910
  },
1951
- "findByStatus": {
1952
- "name": "findByStatus",
1953
- "async": true,
1954
- "parameters": [
1955
- {
1956
- "name": "status",
1957
- "type": "PostStatus",
1958
- "optional": false
1959
- }
1960
- ],
1961
- "returnType": "Promise<SocialPost[]>",
1962
- "isStatic": false,
1963
- "isPublic": true
1911
+ "updated_at": {
1912
+ "type": "datetime",
1913
+ "required": false
1964
1914
  },
1965
- "findForAccount": {
1966
- "name": "findForAccount",
1967
- "async": true,
1968
- "parameters": [
1969
- {
1970
- "name": "socialAccountId",
1971
- "type": "string",
1972
- "optional": false
1915
+ "tenantId": {
1916
+ "type": "text",
1917
+ "required": false,
1918
+ "_meta": {
1919
+ "sqlType": "UUID",
1920
+ "nullable": true,
1921
+ "__tenancy": {
1922
+ "isTenantIdField": true,
1923
+ "autoFilter": true,
1924
+ "required": false,
1925
+ "autoPopulate": true,
1926
+ "nullable": true,
1927
+ "mode": "optional",
1928
+ "field": "tenantId",
1929
+ "allowSuperAdminBypass": false
1973
1930
  }
1974
- ],
1975
- "returnType": "Promise<SocialPost[]>",
1976
- "isStatic": false,
1977
- "isPublic": true
1931
+ }
1978
1932
  },
1979
- "findDueForPublish": {
1980
- "name": "findDueForPublish",
1981
- "async": true,
1982
- "parameters": [
1983
- {
1984
- "name": "now",
1985
- "type": "Date",
1986
- "optional": true
1987
- }
1988
- ],
1989
- "returnType": "Promise<SocialPost[]>",
1990
- "isStatic": false,
1991
- "isPublic": true
1933
+ "socialAccountId": {
1934
+ "type": "foreignKey",
1935
+ "required": false,
1936
+ "related": "SocialAccount",
1937
+ "description": "The connected account this post goes out from.",
1938
+ "_meta": {
1939
+ "description": "The connected account this post goes out from."
1940
+ }
1992
1941
  },
1993
- "recordPublishSuccess": {
1994
- "name": "recordPublishSuccess",
1995
- "async": true,
1996
- "parameters": [
1997
- {
1998
- "name": "post",
1999
- "type": "SocialPost",
2000
- "optional": false
2001
- },
2002
- {
2003
- "name": "data",
2004
- "type": "PublishSuccessData",
2005
- "optional": false
2006
- }
2007
- ],
2008
- "returnType": "Promise<SocialPost>",
2009
- "isStatic": false,
2010
- "isPublic": true
1942
+ "createdByUserId": {
1943
+ "type": "crossPackageRef",
1944
+ "required": false,
1945
+ "related": "@happyvertical/smrt-users:User"
2011
1946
  },
2012
- "recordPublishFailure": {
2013
- "name": "recordPublishFailure",
2014
- "async": true,
2015
- "parameters": [
2016
- {
2017
- "name": "post",
2018
- "type": "SocialPost",
2019
- "optional": false
2020
- },
2021
- {
2022
- "name": "error",
2023
- "type": "Error | string",
2024
- "optional": false,
2025
- "unionBranches": [
2026
- {
2027
- "type": "Error"
2028
- },
2029
- {
2030
- "type": "string"
2031
- }
2032
- ]
2033
- }
2034
- ],
2035
- "returnType": "Promise<SocialPost>",
2036
- "isStatic": false,
2037
- "isPublic": true
1947
+ "videoContentId": {
1948
+ "type": "crossPackageRef",
1949
+ "required": false,
1950
+ "related": "@happyvertical/smrt-video:VideoContent"
2038
1951
  },
2039
- "updateLatestAnalytics": {
2040
- "name": "updateLatestAnalytics",
2041
- "async": true,
2042
- "parameters": [
2043
- {
2044
- "name": "post",
2045
- "type": "SocialPost",
2046
- "optional": false
2047
- },
2048
- {
2049
- "name": "analytics",
2050
- "type": "PostAnalytics",
2051
- "optional": false
2052
- },
2053
- {
2054
- "name": "syncedAt",
2055
- "type": "Date",
2056
- "optional": true
2057
- }
2058
- ],
2059
- "returnType": "Promise<SocialPost>",
2060
- "isStatic": false,
2061
- "isPublic": true
1952
+ "contentId": {
1953
+ "type": "crossPackageRef",
1954
+ "required": false,
1955
+ "related": "@happyvertical/smrt-content:Content"
1956
+ },
1957
+ "postType": {
1958
+ "type": "text",
1959
+ "required": false,
1960
+ "default": "text",
1961
+ "description": "What kind of post it is: text, link, image or video.",
1962
+ "_meta": {
1963
+ "description": "What kind of post it is: text, link, image or video."
1964
+ },
1965
+ "enum": [
1966
+ "text",
1967
+ "link",
1968
+ "image",
1969
+ "video"
1970
+ ]
1971
+ },
1972
+ "mediaUrl": {
1973
+ "type": "text",
1974
+ "required": false
1975
+ },
1976
+ "title": {
1977
+ "type": "text",
1978
+ "required": false,
1979
+ "description": "A title, for platforms that show one.",
1980
+ "_meta": {
1981
+ "description": "A title, for platforms that show one."
1982
+ }
1983
+ },
1984
+ "description": {
1985
+ "type": "text",
1986
+ "required": false,
1987
+ "default": "",
1988
+ "description": "The words of the post.",
1989
+ "_meta": {
1990
+ "description": "The words of the post."
1991
+ }
1992
+ },
1993
+ "hashtags": {
1994
+ "type": "json",
1995
+ "required": false,
1996
+ "default": [],
1997
+ "description": "Hashtags added to the end of the post.",
1998
+ "_meta": {
1999
+ "description": "Hashtags added to the end of the post."
2000
+ }
2001
+ },
2002
+ "linkUrl": {
2003
+ "type": "text",
2004
+ "required": false,
2005
+ "description": "A web address to share with the post.",
2006
+ "_meta": {
2007
+ "description": "A web address to share with the post."
2008
+ }
2009
+ },
2010
+ "platformPostId": {
2011
+ "type": "text",
2012
+ "required": false
2013
+ },
2014
+ "platformUrl": {
2015
+ "type": "text",
2016
+ "required": false,
2017
+ "description": "Where the post can be seen on the platform, once it is out.",
2018
+ "_meta": {
2019
+ "description": "Where the post can be seen on the platform, once it is out."
2020
+ }
2021
+ },
2022
+ "scheduledAt": {
2023
+ "type": "datetime",
2024
+ "required": false,
2025
+ "description": "The date and time you have in mind for putting the post out. Only a note of the plan: publishing is a separate step your application has to run.",
2026
+ "_meta": {
2027
+ "description": "The date and time you have in mind for putting the post out. Only a note of the plan: publishing is a separate step your application has to run."
2028
+ }
2029
+ },
2030
+ "publishedAt": {
2031
+ "type": "datetime",
2032
+ "required": false,
2033
+ "description": "When the post actually went out.",
2034
+ "_meta": {
2035
+ "description": "When the post actually went out."
2036
+ }
2037
+ },
2038
+ "status": {
2039
+ "type": "text",
2040
+ "required": false,
2041
+ "default": "draft",
2042
+ "description": "Where the post stands: draft, waiting to go out, published or failed.",
2043
+ "_meta": {
2044
+ "description": "Where the post stands: draft, waiting to go out, published or failed."
2045
+ },
2046
+ "enum": [
2047
+ "draft",
2048
+ "pending_approval",
2049
+ "approved",
2050
+ "scheduled",
2051
+ "publishing",
2052
+ "dry_run",
2053
+ "staged",
2054
+ "published",
2055
+ "failed",
2056
+ "cancelled"
2057
+ ]
2058
+ },
2059
+ "errorMessage": {
2060
+ "type": "text",
2061
+ "required": false
2062
+ },
2063
+ "analytics": {
2064
+ "type": "json",
2065
+ "required": false
2066
+ },
2067
+ "analyticsLastSyncedAt": {
2068
+ "type": "datetime",
2069
+ "required": false
2062
2070
  }
2063
2071
  },
2072
+ "methods": {},
2064
2073
  "decoratorConfig": {
2074
+ "tableStrategy": "sti",
2065
2075
  "api": {
2066
2076
  "include": [
2067
2077
  "list",
@@ -2076,12 +2086,22 @@
2076
2086
  "list",
2077
2087
  "get"
2078
2088
  ]
2079
- }
2089
+ },
2090
+ "cli": true,
2091
+ "tenantScoped": {
2092
+ "mode": "optional"
2093
+ },
2094
+ "conflictColumns": [
2095
+ "tenant_id",
2096
+ "slug",
2097
+ "context",
2098
+ "_meta_type"
2099
+ ]
2080
2100
  },
2081
- "extends": "SmrtCollection",
2082
- "extendsTypeArg": "SocialPost",
2083
- "exportName": "SocialPostCollection",
2084
- "collectionExportName": "SocialPostCollectionCollection",
2101
+ "extends": "SmrtObject",
2102
+ "exportName": "SocialPost",
2103
+ "collectionExportName": "SocialPostCollection",
2104
+ "displayLabelField": "title",
2085
2105
  "schema": {
2086
2106
  "tableName": "social_posts",
2087
2107
  "ddl": "CREATE TABLE IF NOT EXISTS \"social_posts\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"social_account_id\" UUID,\n \"created_by_user_id\" UUID,\n \"video_content_id\" UUID,\n \"content_id\" UUID,\n \"post_type\" TEXT DEFAULT 'text',\n \"media_url\" TEXT,\n \"title\" TEXT,\n \"description\" TEXT DEFAULT '',\n \"hashtags\" JSON DEFAULT '[]',\n \"link_url\" TEXT,\n \"platform_post_id\" TEXT,\n \"platform_url\" TEXT,\n \"scheduled_at\" TIMESTAMP,\n \"published_at\" TIMESTAMP,\n \"status\" TEXT DEFAULT 'draft',\n \"error_message\" TEXT,\n \"analytics\" JSON,\n \"analytics_last_synced_at\" TIMESTAMP\n);",