@happyvertical/garrula 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Garrula.d.ts +14 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +701 -38
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +184 -10
- package/dist/outbound/models.d.ts +19 -1
- package/dist/outbound/service.d.ts +39 -4
- package/dist/outbound/types.d.ts +49 -1
- package/dist/smrt-knowledge.json +75 -3
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "1.0.0",
|
|
3
3
|
"timestamp": 0,
|
|
4
4
|
"packageName": "@happyvertical/garrula",
|
|
5
|
-
"packageVersion": "0.1.
|
|
5
|
+
"packageVersion": "0.1.8",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/garrula:Garrula": {
|
|
8
8
|
"name": "garrula",
|
|
@@ -390,6 +390,33 @@
|
|
|
390
390
|
"isStatic": false,
|
|
391
391
|
"isPublic": true
|
|
392
392
|
},
|
|
393
|
+
"attachMedia": {
|
|
394
|
+
"name": "attachMedia",
|
|
395
|
+
"async": true,
|
|
396
|
+
"parameters": [
|
|
397
|
+
{
|
|
398
|
+
"name": "id",
|
|
399
|
+
"type": "string",
|
|
400
|
+
"optional": false
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
"name": "media",
|
|
404
|
+
"type": "AttachMediaInput",
|
|
405
|
+
"optional": false
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
"name": "options",
|
|
409
|
+
"type": "object",
|
|
410
|
+
"optional": true,
|
|
411
|
+
"memberTypes": [
|
|
412
|
+
"string"
|
|
413
|
+
]
|
|
414
|
+
}
|
|
415
|
+
],
|
|
416
|
+
"returnType": "Promise<OutboundDraft>",
|
|
417
|
+
"isStatic": false,
|
|
418
|
+
"isPublic": true
|
|
419
|
+
},
|
|
393
420
|
"approve": {
|
|
394
421
|
"name": "approve",
|
|
395
422
|
"async": true,
|
|
@@ -1467,6 +1494,60 @@
|
|
|
1467
1494
|
"required": false,
|
|
1468
1495
|
"default": []
|
|
1469
1496
|
},
|
|
1497
|
+
"media": {
|
|
1498
|
+
"type": "json",
|
|
1499
|
+
"_meta": {
|
|
1500
|
+
"__typeUnresolved": true,
|
|
1501
|
+
"__statedOptions": []
|
|
1502
|
+
},
|
|
1503
|
+
"required": false
|
|
1504
|
+
},
|
|
1505
|
+
"youtubeMetadata": {
|
|
1506
|
+
"type": "json",
|
|
1507
|
+
"_meta": {
|
|
1508
|
+
"__typeUnresolved": true,
|
|
1509
|
+
"__statedOptions": []
|
|
1510
|
+
},
|
|
1511
|
+
"required": false
|
|
1512
|
+
},
|
|
1513
|
+
"parentOutboundId": {
|
|
1514
|
+
"type": "text",
|
|
1515
|
+
"_meta": {
|
|
1516
|
+
"__statedOptions": []
|
|
1517
|
+
},
|
|
1518
|
+
"required": false
|
|
1519
|
+
},
|
|
1520
|
+
"xRepostMode": {
|
|
1521
|
+
"type": "text",
|
|
1522
|
+
"_meta": {
|
|
1523
|
+
"__statedOptions": []
|
|
1524
|
+
},
|
|
1525
|
+
"required": false
|
|
1526
|
+
},
|
|
1527
|
+
"requestedTargetAccountIds": {
|
|
1528
|
+
"type": "json",
|
|
1529
|
+
"_meta": {
|
|
1530
|
+
"__statedOptions": [
|
|
1531
|
+
"default"
|
|
1532
|
+
]
|
|
1533
|
+
},
|
|
1534
|
+
"required": false,
|
|
1535
|
+
"default": []
|
|
1536
|
+
},
|
|
1537
|
+
"requestedXRepostMode": {
|
|
1538
|
+
"type": "text",
|
|
1539
|
+
"_meta": {
|
|
1540
|
+
"__statedOptions": []
|
|
1541
|
+
},
|
|
1542
|
+
"required": false
|
|
1543
|
+
},
|
|
1544
|
+
"utmCampaign": {
|
|
1545
|
+
"type": "text",
|
|
1546
|
+
"_meta": {
|
|
1547
|
+
"__statedOptions": []
|
|
1548
|
+
},
|
|
1549
|
+
"required": false
|
|
1550
|
+
},
|
|
1470
1551
|
"createdBy": {
|
|
1471
1552
|
"type": "text",
|
|
1472
1553
|
"_meta": {
|
|
@@ -1511,7 +1592,7 @@
|
|
|
1511
1592
|
"validationRules": [],
|
|
1512
1593
|
"schema": {
|
|
1513
1594
|
"tableName": "garrula_outbound_posts",
|
|
1514
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"garrula_outbound_posts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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\" TEXT,\n \"state\" TEXT,\n \"kind\" TEXT,\n \"source_event_id\" TEXT,\n \"source_kind\" TEXT,\n \"source_url\" TEXT,\n \"claims\" JSON DEFAULT '[]',\n \"created_by\" TEXT,\n \"approved_by\" TEXT,\n \"rejected_reason\" TEXT\n);",
|
|
1595
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"garrula_outbound_posts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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\" TEXT,\n \"state\" TEXT,\n \"kind\" TEXT,\n \"source_event_id\" TEXT,\n \"source_kind\" TEXT,\n \"source_url\" TEXT,\n \"claims\" JSON DEFAULT '[]',\n \"media\" JSON,\n \"youtube_metadata\" JSON,\n \"parent_outbound_id\" TEXT,\n \"x_repost_mode\" TEXT,\n \"requested_target_account_ids\" JSON DEFAULT '[]',\n \"requested_x_repost_mode\" TEXT,\n \"utm_campaign\" TEXT,\n \"created_by\" TEXT,\n \"approved_by\" TEXT,\n \"rejected_reason\" TEXT\n);",
|
|
1515
1596
|
"columns": {
|
|
1516
1597
|
"_sync_origin_device_id": {
|
|
1517
1598
|
"type": "TEXT"
|
|
@@ -1586,6 +1667,35 @@
|
|
|
1586
1667
|
"notNull": false,
|
|
1587
1668
|
"default": []
|
|
1588
1669
|
},
|
|
1670
|
+
"media": {
|
|
1671
|
+
"type": "JSON",
|
|
1672
|
+
"notNull": false
|
|
1673
|
+
},
|
|
1674
|
+
"youtube_metadata": {
|
|
1675
|
+
"type": "JSON",
|
|
1676
|
+
"notNull": false
|
|
1677
|
+
},
|
|
1678
|
+
"parent_outbound_id": {
|
|
1679
|
+
"type": "TEXT",
|
|
1680
|
+
"notNull": false
|
|
1681
|
+
},
|
|
1682
|
+
"x_repost_mode": {
|
|
1683
|
+
"type": "TEXT",
|
|
1684
|
+
"notNull": false
|
|
1685
|
+
},
|
|
1686
|
+
"requested_target_account_ids": {
|
|
1687
|
+
"type": "JSON",
|
|
1688
|
+
"notNull": false,
|
|
1689
|
+
"default": []
|
|
1690
|
+
},
|
|
1691
|
+
"requested_x_repost_mode": {
|
|
1692
|
+
"type": "TEXT",
|
|
1693
|
+
"notNull": false
|
|
1694
|
+
},
|
|
1695
|
+
"utm_campaign": {
|
|
1696
|
+
"type": "TEXT",
|
|
1697
|
+
"notNull": false
|
|
1698
|
+
},
|
|
1589
1699
|
"created_by": {
|
|
1590
1700
|
"type": "TEXT",
|
|
1591
1701
|
"notNull": false
|
|
@@ -1625,7 +1735,7 @@
|
|
|
1625
1735
|
]
|
|
1626
1736
|
}
|
|
1627
1737
|
],
|
|
1628
|
-
"version": "
|
|
1738
|
+
"version": "3d4232b7"
|
|
1629
1739
|
},
|
|
1630
1740
|
"importPath": "@happyvertical/garrula"
|
|
1631
1741
|
},
|
|
@@ -1655,7 +1765,7 @@
|
|
|
1655
1765
|
],
|
|
1656
1766
|
"schema": {
|
|
1657
1767
|
"tableName": "garrula_outbound_posts",
|
|
1658
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"garrula_outbound_posts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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\" TEXT,\n \"state\" TEXT,\n \"kind\" TEXT,\n \"source_event_id\" TEXT,\n \"source_kind\" TEXT,\n \"source_url\" TEXT,\n \"claims\" JSON DEFAULT '[]',\n \"created_by\" TEXT,\n \"approved_by\" TEXT,\n \"rejected_reason\" TEXT\n);",
|
|
1768
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"garrula_outbound_posts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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\" TEXT,\n \"state\" TEXT,\n \"kind\" TEXT,\n \"source_event_id\" TEXT,\n \"source_kind\" TEXT,\n \"source_url\" TEXT,\n \"claims\" JSON DEFAULT '[]',\n \"media\" JSON,\n \"youtube_metadata\" JSON,\n \"parent_outbound_id\" TEXT,\n \"x_repost_mode\" TEXT,\n \"requested_target_account_ids\" JSON DEFAULT '[]',\n \"requested_x_repost_mode\" TEXT,\n \"utm_campaign\" TEXT,\n \"created_by\" TEXT,\n \"approved_by\" TEXT,\n \"rejected_reason\" TEXT\n);",
|
|
1659
1769
|
"columns": {
|
|
1660
1770
|
"_sync_origin_device_id": {
|
|
1661
1771
|
"type": "TEXT"
|
|
@@ -1730,6 +1840,35 @@
|
|
|
1730
1840
|
"notNull": false,
|
|
1731
1841
|
"default": []
|
|
1732
1842
|
},
|
|
1843
|
+
"media": {
|
|
1844
|
+
"type": "JSON",
|
|
1845
|
+
"notNull": false
|
|
1846
|
+
},
|
|
1847
|
+
"youtube_metadata": {
|
|
1848
|
+
"type": "JSON",
|
|
1849
|
+
"notNull": false
|
|
1850
|
+
},
|
|
1851
|
+
"parent_outbound_id": {
|
|
1852
|
+
"type": "TEXT",
|
|
1853
|
+
"notNull": false
|
|
1854
|
+
},
|
|
1855
|
+
"x_repost_mode": {
|
|
1856
|
+
"type": "TEXT",
|
|
1857
|
+
"notNull": false
|
|
1858
|
+
},
|
|
1859
|
+
"requested_target_account_ids": {
|
|
1860
|
+
"type": "JSON",
|
|
1861
|
+
"notNull": false,
|
|
1862
|
+
"default": []
|
|
1863
|
+
},
|
|
1864
|
+
"requested_x_repost_mode": {
|
|
1865
|
+
"type": "TEXT",
|
|
1866
|
+
"notNull": false
|
|
1867
|
+
},
|
|
1868
|
+
"utm_campaign": {
|
|
1869
|
+
"type": "TEXT",
|
|
1870
|
+
"notNull": false
|
|
1871
|
+
},
|
|
1733
1872
|
"created_by": {
|
|
1734
1873
|
"type": "TEXT",
|
|
1735
1874
|
"notNull": false
|
|
@@ -1769,7 +1908,7 @@
|
|
|
1769
1908
|
]
|
|
1770
1909
|
}
|
|
1771
1910
|
],
|
|
1772
|
-
"version": "
|
|
1911
|
+
"version": "3d4232b7"
|
|
1773
1912
|
},
|
|
1774
1913
|
"importPath": "@happyvertical/garrula"
|
|
1775
1914
|
},
|
|
@@ -2181,6 +2320,23 @@
|
|
|
2181
2320
|
},
|
|
2182
2321
|
"required": false,
|
|
2183
2322
|
"default": []
|
|
2323
|
+
},
|
|
2324
|
+
"requestedTargetAccountIds": {
|
|
2325
|
+
"type": "json",
|
|
2326
|
+
"_meta": {
|
|
2327
|
+
"__statedOptions": [
|
|
2328
|
+
"default"
|
|
2329
|
+
]
|
|
2330
|
+
},
|
|
2331
|
+
"required": false,
|
|
2332
|
+
"default": []
|
|
2333
|
+
},
|
|
2334
|
+
"requestedXRepostMode": {
|
|
2335
|
+
"type": "text",
|
|
2336
|
+
"_meta": {
|
|
2337
|
+
"__statedOptions": []
|
|
2338
|
+
},
|
|
2339
|
+
"required": false
|
|
2184
2340
|
}
|
|
2185
2341
|
},
|
|
2186
2342
|
"methods": {},
|
|
@@ -2205,7 +2361,7 @@
|
|
|
2205
2361
|
"validationRules": [],
|
|
2206
2362
|
"schema": {
|
|
2207
2363
|
"tableName": "garrula_source_events",
|
|
2208
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"garrula_source_events\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"event_key\" TEXT,\n \"outcome\" TEXT,\n \"outbound_post_ids\" JSON DEFAULT '[]'\n);",
|
|
2364
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"garrula_source_events\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"event_key\" TEXT,\n \"outcome\" TEXT,\n \"outbound_post_ids\" JSON DEFAULT '[]',\n \"requested_target_account_ids\" JSON DEFAULT '[]',\n \"requested_x_repost_mode\" TEXT\n);",
|
|
2209
2365
|
"columns": {
|
|
2210
2366
|
"_sync_origin_device_id": {
|
|
2211
2367
|
"type": "TEXT"
|
|
@@ -2263,6 +2419,15 @@
|
|
|
2263
2419
|
"type": "JSON",
|
|
2264
2420
|
"notNull": false,
|
|
2265
2421
|
"default": []
|
|
2422
|
+
},
|
|
2423
|
+
"requested_target_account_ids": {
|
|
2424
|
+
"type": "JSON",
|
|
2425
|
+
"notNull": false,
|
|
2426
|
+
"default": []
|
|
2427
|
+
},
|
|
2428
|
+
"requested_x_repost_mode": {
|
|
2429
|
+
"type": "TEXT",
|
|
2430
|
+
"notNull": false
|
|
2266
2431
|
}
|
|
2267
2432
|
},
|
|
2268
2433
|
"indexes": [
|
|
@@ -2291,7 +2456,7 @@
|
|
|
2291
2456
|
]
|
|
2292
2457
|
}
|
|
2293
2458
|
],
|
|
2294
|
-
"version": "
|
|
2459
|
+
"version": "8ee32adb"
|
|
2295
2460
|
},
|
|
2296
2461
|
"importPath": "@happyvertical/garrula"
|
|
2297
2462
|
},
|
|
@@ -2321,7 +2486,7 @@
|
|
|
2321
2486
|
],
|
|
2322
2487
|
"schema": {
|
|
2323
2488
|
"tableName": "garrula_source_events",
|
|
2324
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"garrula_source_events\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"event_key\" TEXT,\n \"outcome\" TEXT,\n \"outbound_post_ids\" JSON DEFAULT '[]'\n);",
|
|
2489
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"garrula_source_events\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"event_key\" TEXT,\n \"outcome\" TEXT,\n \"outbound_post_ids\" JSON DEFAULT '[]',\n \"requested_target_account_ids\" JSON DEFAULT '[]',\n \"requested_x_repost_mode\" TEXT\n);",
|
|
2325
2490
|
"columns": {
|
|
2326
2491
|
"_sync_origin_device_id": {
|
|
2327
2492
|
"type": "TEXT"
|
|
@@ -2379,6 +2544,15 @@
|
|
|
2379
2544
|
"type": "JSON",
|
|
2380
2545
|
"notNull": false,
|
|
2381
2546
|
"default": []
|
|
2547
|
+
},
|
|
2548
|
+
"requested_target_account_ids": {
|
|
2549
|
+
"type": "JSON",
|
|
2550
|
+
"notNull": false,
|
|
2551
|
+
"default": []
|
|
2552
|
+
},
|
|
2553
|
+
"requested_x_repost_mode": {
|
|
2554
|
+
"type": "TEXT",
|
|
2555
|
+
"notNull": false
|
|
2382
2556
|
}
|
|
2383
2557
|
},
|
|
2384
2558
|
"indexes": [
|
|
@@ -2407,7 +2581,7 @@
|
|
|
2407
2581
|
]
|
|
2408
2582
|
}
|
|
2409
2583
|
],
|
|
2410
|
-
"version": "
|
|
2584
|
+
"version": "8ee32adb"
|
|
2411
2585
|
},
|
|
2412
2586
|
"importPath": "@happyvertical/garrula"
|
|
2413
2587
|
}
|
|
@@ -2419,6 +2593,6 @@
|
|
|
2419
2593
|
"@happyvertical/smrt-social",
|
|
2420
2594
|
"@happyvertical/smrt-tenancy"
|
|
2421
2595
|
],
|
|
2422
|
-
"schemaFingerprint": "
|
|
2596
|
+
"schemaFingerprint": "70fcc7179338a00028f6d551af87fa6614234a430e4faf6484230db0ee9b7351",
|
|
2423
2597
|
"stampsConstructors": true
|
|
2424
2598
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SmrtObjectOptions, SmrtCollection, SmrtObject } from '@happyvertical/smrt-core';
|
|
2
|
-
import { AutonomyMode, DraftClaim, LinkPolicy, OutboundPostKind, OutboundState, SourceEventKind, SourceRule } from './types.js';
|
|
2
|
+
import { AutonomyMode, DraftClaim, LinkPolicy, OutboundMedia, OutboundPostKind, OutboundState, SourceEventKind, SourceRule, XRepostMode, YouTubeVideoMetadata } from './types.js';
|
|
3
3
|
export interface GarrulaOutboundSettingsOptions extends SmrtObjectOptions {
|
|
4
4
|
tenantId?: string | null;
|
|
5
5
|
paused?: boolean;
|
|
@@ -38,6 +38,13 @@ export interface GarrulaOutboundPostOptions extends SmrtObjectOptions {
|
|
|
38
38
|
sourceKind?: SourceEventKind;
|
|
39
39
|
sourceUrl?: string | null;
|
|
40
40
|
claims?: DraftClaim[];
|
|
41
|
+
media?: OutboundMedia | null;
|
|
42
|
+
youtubeMetadata?: YouTubeVideoMetadata | null;
|
|
43
|
+
parentOutboundId?: string | null;
|
|
44
|
+
xRepostMode?: XRepostMode | null;
|
|
45
|
+
requestedTargetAccountIds?: string[] | null;
|
|
46
|
+
requestedXRepostMode?: XRepostMode | null;
|
|
47
|
+
utmCampaign?: string | null;
|
|
41
48
|
createdBy?: string | null;
|
|
42
49
|
approvedBy?: string | null;
|
|
43
50
|
rejectedReason?: string | null;
|
|
@@ -58,6 +65,13 @@ export declare class GarrulaOutboundPost extends SmrtObject {
|
|
|
58
65
|
sourceKind: string;
|
|
59
66
|
sourceUrl: string | null;
|
|
60
67
|
claims: DraftClaim[];
|
|
68
|
+
media: OutboundMedia | null;
|
|
69
|
+
youtubeMetadata: YouTubeVideoMetadata | null;
|
|
70
|
+
parentOutboundId: string | null;
|
|
71
|
+
xRepostMode: string | null;
|
|
72
|
+
requestedTargetAccountIds: string[] | null;
|
|
73
|
+
requestedXRepostMode: string | null;
|
|
74
|
+
utmCampaign: string | null;
|
|
61
75
|
/** Who supplied a manual draft (`createDraft`); null for ingested drafts. */
|
|
62
76
|
createdBy: string | null;
|
|
63
77
|
approvedBy: string | null;
|
|
@@ -95,6 +109,8 @@ export interface GarrulaSourceEventOptions extends SmrtObjectOptions {
|
|
|
95
109
|
eventKey?: string;
|
|
96
110
|
outcome?: string;
|
|
97
111
|
outboundPostIds?: string[];
|
|
112
|
+
requestedTargetAccountIds?: string[] | null;
|
|
113
|
+
requestedXRepostMode?: string | null;
|
|
98
114
|
}
|
|
99
115
|
/** Dedupe ledger: an event id seen once never yields a second candidate. */
|
|
100
116
|
export declare class GarrulaSourceEvent extends SmrtObject {
|
|
@@ -104,6 +120,8 @@ export declare class GarrulaSourceEvent extends SmrtObject {
|
|
|
104
120
|
/** `drafted` | `ignored` */
|
|
105
121
|
outcome: string;
|
|
106
122
|
outboundPostIds: string[];
|
|
123
|
+
requestedTargetAccountIds: string[] | null;
|
|
124
|
+
requestedXRepostMode: string | null;
|
|
107
125
|
constructor(options?: GarrulaSourceEventOptions);
|
|
108
126
|
}
|
|
109
127
|
export declare class GarrulaSourceEventCollection extends SmrtCollection<GarrulaSourceEvent> {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GarrulaConfig } from '../config.js';
|
|
2
|
-
import { GarrulaCollections, GarrulaSocialPost } from '../types.js';
|
|
2
|
+
import { GarrulaCollections, GarrulaPostType, GarrulaSocialAccount, GarrulaSocialPost } from '../types.js';
|
|
3
3
|
import { GarrulaOutboundPostCollection, GarrulaOutboundSettingsCollection, GarrulaSourceEventCollection, GarrulaSpendEntryCollection } from './models.js';
|
|
4
4
|
import { CostSource } from './rates.js';
|
|
5
|
-
import { CreateDraftInput, CreateDraftResult, DraftClaim, DraftingAI, IngestResult, OutboundDraft, OutboundPostKind, OutboundRefusal, OutboundSettings, OutboundSettingsPatch, OutboundState, SourceEvent, SpendSummary } from './types.js';
|
|
5
|
+
import { AttachMediaInput, CreateDraftInput, CreateDraftResult, DraftClaim, DraftingAI, IngestResult, OutboundDraft, OutboundPostKind, OutboundRefusal, OutboundSettings, OutboundSettingsPatch, OutboundState, SourceEvent, SpendSummary, YouTubeVideoMetadata } from './types.js';
|
|
6
6
|
export interface OutboundStores {
|
|
7
7
|
settings: GarrulaOutboundSettingsCollection;
|
|
8
8
|
posts: GarrulaOutboundPostCollection;
|
|
@@ -21,6 +21,11 @@ export interface OutboundServiceOptions {
|
|
|
21
21
|
/** The model client used to draft; resolved lazily so tests inject a fake. */
|
|
22
22
|
ai: () => DraftingAI;
|
|
23
23
|
now?: () => Date;
|
|
24
|
+
/**
|
|
25
|
+
* Renew a lapsed but refreshable access token and save it on the account
|
|
26
|
+
* (clearing the lapsed expiry). Throws when the account cannot be renewed.
|
|
27
|
+
*/
|
|
28
|
+
refreshAccount?: (account: GarrulaSocialAccount) => Promise<void>;
|
|
24
29
|
}
|
|
25
30
|
/** A reservation held between the gate and the publish outcome. */
|
|
26
31
|
export interface SpendReservation {
|
|
@@ -31,10 +36,22 @@ export interface SpendReservation {
|
|
|
31
36
|
estimateSource: CostSource;
|
|
32
37
|
outboundId: string | null;
|
|
33
38
|
}
|
|
39
|
+
export interface ResolvedSendPayload {
|
|
40
|
+
linkUrl: string | null;
|
|
41
|
+
postType?: GarrulaPostType;
|
|
42
|
+
videoContentId?: string | null;
|
|
43
|
+
mediaUrl?: string | null;
|
|
44
|
+
title?: string | null;
|
|
45
|
+
description?: string;
|
|
46
|
+
hashtags?: string[];
|
|
47
|
+
isShort?: boolean;
|
|
48
|
+
linkBehavior?: "inline" | "reply";
|
|
49
|
+
}
|
|
34
50
|
export type GateDecision = {
|
|
35
51
|
ok: true;
|
|
36
52
|
reservation: SpendReservation;
|
|
37
53
|
linkUrl: string | null;
|
|
54
|
+
resolved?: ResolvedSendPayload;
|
|
38
55
|
} | {
|
|
39
56
|
ok: false;
|
|
40
57
|
refusal: OutboundRefusal;
|
|
@@ -47,17 +64,21 @@ export interface SentOutcome {
|
|
|
47
64
|
} | null;
|
|
48
65
|
success: boolean;
|
|
49
66
|
error?: string;
|
|
67
|
+
/** True when the publish was refused/skipped before calling the platform. */
|
|
68
|
+
skipped?: boolean;
|
|
50
69
|
}
|
|
51
70
|
/** Title prefix on social posts created by outbound drafting. */
|
|
52
71
|
export declare const OUTBOUND_POST_MARKER = "garrula-outbound:";
|
|
53
72
|
/** True for a social post that outbound drafting created. */
|
|
54
73
|
export declare function isOutboundMarked(post: GarrulaSocialPost): boolean;
|
|
74
|
+
export declare function validateYouTubeMetadata(input: unknown): YouTubeVideoMetadata;
|
|
55
75
|
export declare class OutboundService {
|
|
56
76
|
private readonly stores;
|
|
57
77
|
private readonly social;
|
|
58
78
|
private readonly configFn;
|
|
59
79
|
private readonly aiFn;
|
|
60
80
|
private readonly nowFn;
|
|
81
|
+
private readonly refreshAccount?;
|
|
61
82
|
constructor(options: OutboundServiceOptions);
|
|
62
83
|
/** The default cap; a non-finite or negative configured value falls back to the shipped default. */
|
|
63
84
|
private defaultCapMicros;
|
|
@@ -75,6 +96,8 @@ export declare class OutboundService {
|
|
|
75
96
|
* ignores the autonomy settings; a person must still approve it.
|
|
76
97
|
*/
|
|
77
98
|
createDraft(tenantId: string, input: CreateDraftInput): Promise<CreateDraftResult>;
|
|
99
|
+
private isAccountValidAndReady;
|
|
100
|
+
private resolveSelectedAccounts;
|
|
78
101
|
private targetAccounts;
|
|
79
102
|
private requireRow;
|
|
80
103
|
private loadPost;
|
|
@@ -90,13 +113,25 @@ export declare class OutboundService {
|
|
|
90
113
|
claims?: DraftClaim[];
|
|
91
114
|
linkUrl?: string | null;
|
|
92
115
|
}): Promise<OutboundDraft>;
|
|
116
|
+
/**
|
|
117
|
+
* Attach a video or image reference (with optional aspect-ratio variants and
|
|
118
|
+
* YouTube metadata) to an outbound draft. Like `editDraft`, attaching media
|
|
119
|
+
* withdraws any existing approval back to `draft` (and on any paired
|
|
120
|
+
* dependent X draft) while keeping the outbound marker on `SocialPost.title`
|
|
121
|
+
* intact.
|
|
122
|
+
*/
|
|
123
|
+
attachMedia(tenantId: string, id: string, input: AttachMediaInput): Promise<OutboundDraft>;
|
|
124
|
+
private findDependents;
|
|
125
|
+
private assertDependentsMutable;
|
|
93
126
|
approve(tenantId: string, id: string, approvedBy?: string): Promise<OutboundDraft>;
|
|
94
127
|
reject(tenantId: string, id: string, reason?: string): Promise<OutboundDraft>;
|
|
95
128
|
/** A failed post goes back to approved so the next run publishes it again. */
|
|
96
129
|
retry(tenantId: string, id: string): Promise<OutboundDraft>;
|
|
97
130
|
schedule(tenantId: string, id: string, at: Date): Promise<OutboundDraft>;
|
|
98
|
-
/** Approved or scheduled posts of the tenant whose time has come. */
|
|
131
|
+
/** Approved or scheduled posts of the tenant whose time has come (parents before dependents). */
|
|
99
132
|
dueForPublish(tenantId: string, now: Date): Promise<GarrulaSocialPost[]>;
|
|
133
|
+
/** Order social posts so parent YouTube posts run ahead of dependent X posts. */
|
|
134
|
+
orderSocialPostsForPublish(posts: GarrulaSocialPost[]): Promise<GarrulaSocialPost[]>;
|
|
100
135
|
/** The tenant's post to publish now: it must be approved or scheduled. */
|
|
101
136
|
postForPublish(tenantId: string, id: string): Promise<GarrulaSocialPost>;
|
|
102
137
|
outboundIdForPost(tenantId: string, socialPostId: string): Promise<string | null>;
|
|
@@ -123,7 +158,7 @@ export declare class OutboundService {
|
|
|
123
158
|
* the monthly cap. On success a spend reservation is held (atomically with
|
|
124
159
|
* the cap check) until {@link finish}.
|
|
125
160
|
*/
|
|
126
|
-
beforeSend(post: GarrulaSocialPost, platform: string): Promise<GateDecision>;
|
|
161
|
+
beforeSend(post: GarrulaSocialPost, platform: string, linkBehavior?: string | null): Promise<GateDecision>;
|
|
127
162
|
/**
|
|
128
163
|
* Settle a reservation after the publish. Spend is recorded whenever the
|
|
129
164
|
* platform was reached (adapter cost, else the rate table; a dry run costs
|
package/dist/outbound/types.d.ts
CHANGED
|
@@ -86,6 +86,38 @@ export type OutboundSettingsPatch = Partial<Omit<OutboundSettings, "tenantId" |
|
|
|
86
86
|
autonomy?: Partial<Record<OutboundPostKind, AutonomyMode>>;
|
|
87
87
|
linkPolicy?: Record<string, LinkPolicy>;
|
|
88
88
|
};
|
|
89
|
+
export declare const YOUTUBE_MAX_TITLE_LENGTH = 100;
|
|
90
|
+
export declare const YOUTUBE_MAX_DESCRIPTION_LENGTH = 5000;
|
|
91
|
+
export type VideoAspectRatio = "16:9" | "9:16" | "1:1";
|
|
92
|
+
export type XRepostMode = "teaser_plus_link" | "full_video" | "link_only";
|
|
93
|
+
export declare const X_REPOST_MODES: readonly XRepostMode[];
|
|
94
|
+
export interface MediaVariant {
|
|
95
|
+
outputId?: string;
|
|
96
|
+
aspectRatio?: VideoAspectRatio;
|
|
97
|
+
videoContentId: string;
|
|
98
|
+
/** Optional explicit flag marking a YouTube Short variant. */
|
|
99
|
+
isShort?: boolean;
|
|
100
|
+
/** Optional role hint (`primary` or `teaser`) for multi-variant selection. */
|
|
101
|
+
role?: "primary" | "teaser";
|
|
102
|
+
}
|
|
103
|
+
export interface YouTubeVideoMetadata {
|
|
104
|
+
title: string;
|
|
105
|
+
description?: string;
|
|
106
|
+
tags?: string[];
|
|
107
|
+
}
|
|
108
|
+
export interface OutboundMedia {
|
|
109
|
+
postType: "video" | "image";
|
|
110
|
+
videoContentId: string;
|
|
111
|
+
variants?: MediaVariant[];
|
|
112
|
+
youtube?: YouTubeVideoMetadata;
|
|
113
|
+
}
|
|
114
|
+
export interface AttachMediaInput {
|
|
115
|
+
postType: "video" | "image";
|
|
116
|
+
videoContentId: string;
|
|
117
|
+
mediaUrl?: string | null;
|
|
118
|
+
variants?: MediaVariant[];
|
|
119
|
+
youtube?: YouTubeVideoMetadata;
|
|
120
|
+
}
|
|
89
121
|
/** What the host and the UI see of one outbound post. */
|
|
90
122
|
export interface OutboundDraft {
|
|
91
123
|
id: string;
|
|
@@ -99,6 +131,12 @@ export interface OutboundDraft {
|
|
|
99
131
|
claims: DraftClaim[];
|
|
100
132
|
/** The URL that may be published, depending on the account's link policy. */
|
|
101
133
|
linkUrl: string | null;
|
|
134
|
+
/** Attached video/image reference, variants, and YouTube metadata. */
|
|
135
|
+
media: OutboundMedia | null;
|
|
136
|
+
/** Parent outbound draft ID when this draft depends on another (e.g. X repost after YouTube). */
|
|
137
|
+
parentOutboundId: string | null;
|
|
138
|
+
/** X repost mode when paired with a parent YouTube draft. */
|
|
139
|
+
xRepostMode: XRepostMode | null;
|
|
102
140
|
sourceEventId: string;
|
|
103
141
|
sourceKind: OutboundSourceKind;
|
|
104
142
|
/** Who supplied the draft through `createDraft`; null for ingested drafts. */
|
|
@@ -129,6 +167,16 @@ export interface CreateDraftInput {
|
|
|
129
167
|
kind?: OutboundPostKind;
|
|
130
168
|
/** URL to publish with the post; only used when the account's link policy is `include`. */
|
|
131
169
|
linkUrl?: string | null;
|
|
170
|
+
/** Optional list of active ready account IDs within the tenant to draft for. */
|
|
171
|
+
targetAccountIds?: string[];
|
|
172
|
+
/** Paired YouTube-first -> X-repost mode (`teaser_plus_link`, `full_video`, `link_only`). */
|
|
173
|
+
xRepostMode?: XRepostMode;
|
|
174
|
+
/** Optional campaign query param (`?utm_campaign=`) preserved on paired YouTube -> X links. */
|
|
175
|
+
utmCampaign?: string | null;
|
|
176
|
+
/** Optional media & YouTube metadata to attach at draft creation time. */
|
|
177
|
+
media?: AttachMediaInput;
|
|
178
|
+
/** Optional YouTube upload metadata (validated against YouTube 100/5000 limits). */
|
|
179
|
+
youtube?: YouTubeVideoMetadata;
|
|
132
180
|
}
|
|
133
181
|
export type CreateDraftResult = {
|
|
134
182
|
outcome: "drafted";
|
|
@@ -152,7 +200,7 @@ export type IngestResult = {
|
|
|
152
200
|
error: string;
|
|
153
201
|
};
|
|
154
202
|
/** Typed reasons the pipeline refuses to publish or change a post. */
|
|
155
|
-
export type OutboundRefusalCode = "paused" | "cap-reached" | "uncited" | "not-approved" | "illegal-transition" | "not-found" | "in-flight" | "invalid";
|
|
203
|
+
export type OutboundRefusalCode = "paused" | "cap-reached" | "uncited" | "not-approved" | "illegal-transition" | "not-found" | "in-flight" | "media-unavailable" | "dependency-not-ready" | "invalid";
|
|
156
204
|
export interface OutboundRefusal {
|
|
157
205
|
code: OutboundRefusalCode;
|
|
158
206
|
message: string;
|
package/dist/smrt-knowledge.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"sensitiveFieldsExcluded": true,
|
|
4
4
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
5
5
|
"packageName": "@happyvertical/garrula",
|
|
6
|
-
"packageVersion": "0.1.
|
|
6
|
+
"packageVersion": "0.1.8",
|
|
7
7
|
"sourceManifestPath": "dist/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
10
|
+
"manifest": "2f365863b60bb5b3d1fd2a43965efb94c3b7b45305a11e716bb2306227fe6852",
|
|
11
|
+
"packageJson": "eb694466d1a70f4d23b325c85f280fc6a082128682e13135fa2763ee4cd604ea",
|
|
12
12
|
"agents": "37df674b62c16b50b91bda6e6057f1da0c0e2169b9d13f31ac0cdabb88f0f3f5"
|
|
13
13
|
},
|
|
14
14
|
"exports": [
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"relationships": [],
|
|
107
107
|
"methods": [
|
|
108
108
|
"approve",
|
|
109
|
+
"attachMedia",
|
|
109
110
|
"createArticleVideoPosts",
|
|
110
111
|
"createDraft",
|
|
111
112
|
"createStoryLinkPosts",
|
|
@@ -153,6 +154,16 @@
|
|
|
153
154
|
],
|
|
154
155
|
"returns": "Promise<OutboundDraft>"
|
|
155
156
|
},
|
|
157
|
+
{
|
|
158
|
+
"name": "attachMedia",
|
|
159
|
+
"async": true,
|
|
160
|
+
"params": [
|
|
161
|
+
"id: string",
|
|
162
|
+
"media: AttachMediaInput",
|
|
163
|
+
"options?: object"
|
|
164
|
+
],
|
|
165
|
+
"returns": "Promise<OutboundDraft>"
|
|
166
|
+
},
|
|
156
167
|
{
|
|
157
168
|
"name": "createArticleVideoPosts",
|
|
158
169
|
"async": true,
|
|
@@ -449,6 +460,13 @@
|
|
|
449
460
|
"reason": "api is disabled",
|
|
450
461
|
"objectName": "@happyvertical/garrula:Garrula"
|
|
451
462
|
},
|
|
463
|
+
{
|
|
464
|
+
"kind": "api",
|
|
465
|
+
"operation": "attachMedia",
|
|
466
|
+
"code": "api-disabled",
|
|
467
|
+
"reason": "api is disabled",
|
|
468
|
+
"objectName": "@happyvertical/garrula:Garrula"
|
|
469
|
+
},
|
|
452
470
|
{
|
|
453
471
|
"kind": "api",
|
|
454
472
|
"operation": "createArticleVideoPosts",
|
|
@@ -905,6 +923,48 @@
|
|
|
905
923
|
"columnType": "JSON",
|
|
906
924
|
"default": []
|
|
907
925
|
},
|
|
926
|
+
{
|
|
927
|
+
"name": "media",
|
|
928
|
+
"type": "json",
|
|
929
|
+
"required": false,
|
|
930
|
+
"columnType": "JSON"
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
"name": "youtubeMetadata",
|
|
934
|
+
"type": "json",
|
|
935
|
+
"required": false,
|
|
936
|
+
"columnType": "JSON"
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
"name": "parentOutboundId",
|
|
940
|
+
"type": "text",
|
|
941
|
+
"required": false,
|
|
942
|
+
"columnType": "TEXT"
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
"name": "xRepostMode",
|
|
946
|
+
"type": "text",
|
|
947
|
+
"required": false,
|
|
948
|
+
"columnType": "TEXT"
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
"name": "requestedTargetAccountIds",
|
|
952
|
+
"type": "json",
|
|
953
|
+
"required": false,
|
|
954
|
+
"columnType": "JSON",
|
|
955
|
+
"default": []
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
"name": "requestedXRepostMode",
|
|
959
|
+
"type": "text",
|
|
960
|
+
"required": false
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
"name": "utmCampaign",
|
|
964
|
+
"type": "text",
|
|
965
|
+
"required": false,
|
|
966
|
+
"columnType": "TEXT"
|
|
967
|
+
},
|
|
908
968
|
{
|
|
909
969
|
"name": "createdBy",
|
|
910
970
|
"type": "text",
|
|
@@ -1104,6 +1164,18 @@
|
|
|
1104
1164
|
"required": false,
|
|
1105
1165
|
"columnType": "JSON",
|
|
1106
1166
|
"default": []
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
"name": "requestedTargetAccountIds",
|
|
1170
|
+
"type": "json",
|
|
1171
|
+
"required": false,
|
|
1172
|
+
"columnType": "JSON",
|
|
1173
|
+
"default": []
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
"name": "requestedXRepostMode",
|
|
1177
|
+
"type": "text",
|
|
1178
|
+
"required": false
|
|
1107
1179
|
}
|
|
1108
1180
|
],
|
|
1109
1181
|
"relationships": [],
|