@pubnio/sdk 0.2.13 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +318 -37
- package/dist/index.d.cts +1056 -52
- package/dist/index.d.ts +1056 -52
- package/dist/index.js +319 -38
- package/dist/internal.cjs +318 -37
- package/dist/internal.d.cts +1473 -272
- package/dist/internal.d.ts +1473 -272
- package/dist/internal.js +319 -38
- package/dist/solid.cjs +318 -37
- package/dist/solid.d.cts +1512 -319
- package/dist/solid.d.ts +1512 -319
- package/dist/solid.js +319 -38
- package/package.json +1 -1
package/dist/solid.cjs
CHANGED
|
@@ -334,6 +334,7 @@ __export(exports_sdk_gen, {
|
|
|
334
334
|
postsRetry: () => postsRetry,
|
|
335
335
|
postsUpdate: () => postsUpdate,
|
|
336
336
|
postsValidate: () => postsValidate,
|
|
337
|
+
postsValidateBody: () => postsValidateBody,
|
|
337
338
|
profileDeactivate: () => profileDeactivate,
|
|
338
339
|
profileGet: () => profileGet,
|
|
339
340
|
profileUpdate: () => profileUpdate,
|
|
@@ -546,6 +547,8 @@ var IssueCode = import_effect6.Schema.Literals([
|
|
|
546
547
|
"tiktok_upload_required",
|
|
547
548
|
"tiktok_too_many_mentions",
|
|
548
549
|
"queue_and_time_conflict",
|
|
550
|
+
"queue_not_found",
|
|
551
|
+
"queue_unavailable",
|
|
549
552
|
"invalid_field",
|
|
550
553
|
"account_ambiguous",
|
|
551
554
|
"unsupported_placement",
|
|
@@ -556,8 +559,9 @@ var IssueCode = import_effect6.Schema.Literals([
|
|
|
556
559
|
var PostIssue = import_effect6.Schema.Struct({
|
|
557
560
|
code: IssueCode,
|
|
558
561
|
path: import_effect6.Schema.Array(import_effect6.Schema.Union([import_effect6.Schema.String, import_effect6.Schema.Int])),
|
|
559
|
-
message: import_effect6.Schema.String
|
|
560
|
-
})
|
|
562
|
+
message: import_effect6.Schema.String,
|
|
563
|
+
candidates: import_effect6.Schema.optionalKey(import_effect6.Schema.Array(import_effect6.Schema.Struct({ accountId: AccountId, name: import_effect6.Schema.String })))
|
|
564
|
+
}).annotate({ identifier: "PostIssue" });
|
|
561
565
|
var schemaIssueFormatter = import_effect6.SchemaIssue.makeFormatterStandardSchemaV1();
|
|
562
566
|
|
|
563
567
|
// ../protocol/src/provider.ts
|
|
@@ -659,18 +663,22 @@ var PublishPlacement = import_effect8.Schema.Literals([
|
|
|
659
663
|
var ScheduleOverride = import_effect8.Schema.Union([ScheduledAt, import_effect8.Schema.Null]);
|
|
660
664
|
var DestinationSelection = import_effect8.Schema.Struct({
|
|
661
665
|
accountId: AccountId,
|
|
662
|
-
placement: PublishPlacement
|
|
666
|
+
placement: import_effect8.Schema.optionalKey(PublishPlacement).annotate({
|
|
667
|
+
description: "Omit to select the draft's only destination for this account."
|
|
668
|
+
}),
|
|
663
669
|
scheduledAt: import_effect8.Schema.optionalKey(ScheduleOverride),
|
|
664
670
|
queueId: import_effect8.Schema.optionalKey(uuid2)
|
|
665
671
|
}).annotate({ identifier: "DestinationSelection" });
|
|
666
672
|
var PublishInput = import_effect8.Schema.Struct({
|
|
667
|
-
expectedRevision: PublishRevision
|
|
673
|
+
expectedRevision: import_effect8.Schema.optionalKey(PublishRevision).annotate({
|
|
674
|
+
description: "Publish only if the draft is still at this revision. Omit to publish the saved draft as it is."
|
|
675
|
+
}),
|
|
668
676
|
scheduledAt: import_effect8.Schema.optionalKey(ScheduledAt),
|
|
669
|
-
|
|
677
|
+
accounts: import_effect8.Schema.optionalKey(import_effect8.Schema.Array(AccountId).check(import_effect8.Schema.isMinLength(1), import_effect8.Schema.isMaxLength(50)).annotate({
|
|
670
678
|
description: "Select every draft placement for these accounts. Use targets for exact selection instead."
|
|
671
679
|
})),
|
|
672
680
|
targets: import_effect8.Schema.optionalKey(import_effect8.Schema.Array(DestinationSelection).check(import_effect8.Schema.isMinLength(1), import_effect8.Schema.isMaxLength(50)).annotate({
|
|
673
|
-
description: "Select exact draft destinations and optionally override each schedule. Omit
|
|
681
|
+
description: "Select exact draft destinations and optionally override each schedule. Omit accounts when using targets."
|
|
674
682
|
}))
|
|
675
683
|
});
|
|
676
684
|
var PostRef = import_effect8.Schema.Struct({ postId: PostId });
|
|
@@ -774,7 +782,10 @@ var DeliveryIssue = import_effect8.Schema.Literals([
|
|
|
774
782
|
"tiktok_settings_not_allowed",
|
|
775
783
|
"tiktok_processing_failed",
|
|
776
784
|
"submission_uncertain",
|
|
777
|
-
"confirmation_unavailable"
|
|
785
|
+
"confirmation_unavailable",
|
|
786
|
+
"billing_inactive",
|
|
787
|
+
"spend_cap_reached",
|
|
788
|
+
"insufficient_credit"
|
|
778
789
|
]);
|
|
779
790
|
var FirstCommentStatus = import_effect8.Schema.Literals([
|
|
780
791
|
"pending",
|
|
@@ -873,6 +884,7 @@ var BillingSubscriptionStatus = import_effect9.Schema.Literals([
|
|
|
873
884
|
var UsageMeter = import_effect9.Schema.Literals([
|
|
874
885
|
"confirmed_publish",
|
|
875
886
|
"x_passthrough",
|
|
887
|
+
"x_read",
|
|
876
888
|
"managed_ad",
|
|
877
889
|
"inbox_reply",
|
|
878
890
|
"automation_run"
|
|
@@ -889,10 +901,15 @@ var BillingPlan = import_effect9.Schema.Struct({
|
|
|
889
901
|
monthlyPrice: import_effect9.Schema.NullOr(Money),
|
|
890
902
|
annualPrice: import_effect9.Schema.NullOr(Money),
|
|
891
903
|
meters: import_effect9.Schema.Array(BillingPlanMeter),
|
|
904
|
+
xReads: import_effect9.Schema.Boolean,
|
|
905
|
+
includedXReadMicros: import_effect9.Schema.NullOr(import_effect9.Schema.Int),
|
|
892
906
|
seatsLimit: import_effect9.Schema.NullOr(import_effect9.Schema.Int),
|
|
893
907
|
analyticsRetentionDays: import_effect9.Schema.Int,
|
|
894
908
|
whiteLabelOAuth: import_effect9.Schema.Boolean,
|
|
895
|
-
ssoSaml: import_effect9.Schema.Boolean
|
|
909
|
+
ssoSaml: import_effect9.Schema.Boolean,
|
|
910
|
+
priorityQueue: import_effect9.Schema.Boolean,
|
|
911
|
+
adsInsights: import_effect9.Schema.Boolean,
|
|
912
|
+
adsWrite: import_effect9.Schema.Boolean
|
|
896
913
|
}).annotate({ identifier: "BillingPlan" });
|
|
897
914
|
var BillingPlanList = import_effect9.Schema.Struct({
|
|
898
915
|
data: import_effect9.Schema.Array(BillingPlan)
|
|
@@ -928,6 +945,8 @@ var WorkspaceBilling = import_effect9.Schema.Struct({
|
|
|
928
945
|
creditBalance: Money,
|
|
929
946
|
spendControls: BillingSpendControls,
|
|
930
947
|
currentPeriod: import_effect9.Schema.Struct({
|
|
948
|
+
start: import_effect9.Schema.String,
|
|
949
|
+
end: import_effect9.Schema.String,
|
|
931
950
|
meters: import_effect9.Schema.Array(BillingMeterUsage),
|
|
932
951
|
totalVariableSpendMicros: import_effect9.Schema.Int,
|
|
933
952
|
seatsUsed: import_effect9.Schema.Int,
|
|
@@ -2069,7 +2088,51 @@ var ApiLimits = import_effect15.Schema.Struct({
|
|
|
2069
2088
|
media: MediaLimits,
|
|
2070
2089
|
rateLimits: RateLimits
|
|
2071
2090
|
}).annotate({ identifier: "ApiLimits" });
|
|
2091
|
+
var pollOptionCount = { minOptions: 2, maxOptions: 4 };
|
|
2092
|
+
var xPollLimits = {
|
|
2093
|
+
...pollOptionCount,
|
|
2094
|
+
optionCharacters: 25,
|
|
2095
|
+
minDurationMinutes: 5,
|
|
2096
|
+
maxDurationMinutes: 10080
|
|
2097
|
+
};
|
|
2098
|
+
var linkedinPollLimits = {
|
|
2099
|
+
...pollOptionCount,
|
|
2100
|
+
questionCharacters: 140,
|
|
2101
|
+
optionCharacters: 30,
|
|
2102
|
+
durations: ["ONE_DAY", "THREE_DAYS", "SEVEN_DAYS", "FOURTEEN_DAYS"]
|
|
2103
|
+
};
|
|
2104
|
+
var xReplySettings = [
|
|
2105
|
+
"following",
|
|
2106
|
+
"mentionedUsers",
|
|
2107
|
+
"subscribers",
|
|
2108
|
+
"verified"
|
|
2109
|
+
];
|
|
2110
|
+
var xMediaTagLimit = 10;
|
|
2111
|
+
var pollOptionLimits = {
|
|
2112
|
+
minOptions: import_effect15.Schema.Int,
|
|
2113
|
+
maxOptions: import_effect15.Schema.Int,
|
|
2114
|
+
optionCharacters: import_effect15.Schema.Int
|
|
2115
|
+
};
|
|
2116
|
+
var FeedSettingsCapability = import_effect15.Schema.Struct({
|
|
2117
|
+
poll: import_effect15.Schema.Union([
|
|
2118
|
+
import_effect15.Schema.Struct({
|
|
2119
|
+
...pollOptionLimits,
|
|
2120
|
+
minDurationMinutes: import_effect15.Schema.Int,
|
|
2121
|
+
maxDurationMinutes: import_effect15.Schema.Int
|
|
2122
|
+
}),
|
|
2123
|
+
import_effect15.Schema.Struct({
|
|
2124
|
+
...pollOptionLimits,
|
|
2125
|
+
questionCharacters: import_effect15.Schema.Int,
|
|
2126
|
+
durations: import_effect15.Schema.Array(import_effect15.Schema.Literals(linkedinPollLimits.durations))
|
|
2127
|
+
})
|
|
2128
|
+
]),
|
|
2129
|
+
replySettings: import_effect15.Schema.optionalKey(import_effect15.Schema.Array(import_effect15.Schema.Literals(xReplySettings))),
|
|
2130
|
+
maxMediaTags: import_effect15.Schema.optionalKey(import_effect15.Schema.Int),
|
|
2131
|
+
placeId: import_effect15.Schema.optionalKey(import_effect15.Schema.Boolean),
|
|
2132
|
+
quotePostId: import_effect15.Schema.optionalKey(import_effect15.Schema.Boolean)
|
|
2133
|
+
});
|
|
2072
2134
|
var PlacementCapability = import_effect15.Schema.Struct({
|
|
2135
|
+
settings: import_effect15.Schema.optionalKey(FeedSettingsCapability),
|
|
2073
2136
|
placement: PublishPlacement,
|
|
2074
2137
|
default: import_effect15.Schema.Boolean,
|
|
2075
2138
|
mediaTypes: import_effect15.Schema.Array(MediaType),
|
|
@@ -2443,6 +2506,11 @@ var import_effect28 = require("effect");
|
|
|
2443
2506
|
var import_effect18 = require("effect");
|
|
2444
2507
|
var postTextLimit = 128000;
|
|
2445
2508
|
var threadPostTextLimit = 1250;
|
|
2509
|
+
var blueskyPostMaxBytes = 3000;
|
|
2510
|
+
var graphemeSegmenter = new Intl.Segmenter(undefined, {
|
|
2511
|
+
granularity: "grapheme"
|
|
2512
|
+
});
|
|
2513
|
+
var utf8 = new TextEncoder;
|
|
2446
2514
|
var redditTitleMaxLength = 300;
|
|
2447
2515
|
var threadsTextLimit = 500;
|
|
2448
2516
|
var xArticleTitleMaxLength = 100;
|
|
@@ -2550,12 +2618,34 @@ var InstagramStorySettings = import_effect18.Schema.Struct({
|
|
|
2550
2618
|
muteAudio: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
|
|
2551
2619
|
userTags: instagramTags
|
|
2552
2620
|
}).annotate({ identifier: "InstagramStorySettings" });
|
|
2621
|
+
var blueskyPostText = import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(blueskyPostMaxBytes));
|
|
2553
2622
|
var BlueskyFeedSettings = import_effect18.Schema.Struct({
|
|
2554
|
-
firstComment: import_effect18.Schema.optionalKey(
|
|
2555
|
-
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(
|
|
2623
|
+
firstComment: import_effect18.Schema.optionalKey(blueskyPostText),
|
|
2624
|
+
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(blueskyPostText).check(import_effect18.Schema.isMaxLength(24))),
|
|
2556
2625
|
altText: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(1000)))
|
|
2557
2626
|
}).annotate({ identifier: "BlueskyFeedSettings" });
|
|
2627
|
+
var nonblank = import_effect18.Schema.makeFilter((value) => value.trim().length > 0 || "Supply a nonblank string.", { toJsonSchema: () => ({ pattern: "\\S" }) });
|
|
2628
|
+
function pollText(maximum) {
|
|
2629
|
+
return import_effect18.Schema.String.check(import_effect18.Schema.isBetweenCodePoints(1, maximum, {
|
|
2630
|
+
expected: `between 1 and ${maximum} characters`
|
|
2631
|
+
}), nonblank);
|
|
2632
|
+
}
|
|
2633
|
+
function pollOptions({
|
|
2634
|
+
minOptions,
|
|
2635
|
+
maxOptions,
|
|
2636
|
+
optionCharacters
|
|
2637
|
+
}) {
|
|
2638
|
+
return import_effect18.Schema.Array(pollText(optionCharacters)).check(import_effect18.Schema.isMinLength(minOptions), import_effect18.Schema.isMaxLength(maxOptions));
|
|
2639
|
+
}
|
|
2640
|
+
var LinkedInPoll = import_effect18.Schema.Struct({
|
|
2641
|
+
question: pollText(linkedinPollLimits.questionCharacters),
|
|
2642
|
+
options: pollOptions(linkedinPollLimits),
|
|
2643
|
+
duration: import_effect18.Schema.Literals(linkedinPollLimits.durations)
|
|
2644
|
+
}).annotate({
|
|
2645
|
+
description: "Organic LinkedIn poll. Include post text and omit media, altText, and documentTitle."
|
|
2646
|
+
});
|
|
2558
2647
|
var LinkedInFeedSettings = import_effect18.Schema.Struct({
|
|
2648
|
+
poll: import_effect18.Schema.optionalKey(LinkedInPoll),
|
|
2559
2649
|
firstComment: import_effect18.Schema.optionalKey(text),
|
|
2560
2650
|
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(threadPostTextLimit))).check(import_effect18.Schema.isMaxLength(24))),
|
|
2561
2651
|
visibility: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["PUBLIC", "CONNECTIONS"])),
|
|
@@ -2592,6 +2682,7 @@ var YouTubeVideoSettings = import_effect18.Schema.Struct({
|
|
|
2592
2682
|
title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(100)),
|
|
2593
2683
|
description: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(5000))),
|
|
2594
2684
|
privacyStatus: import_effect18.Schema.Literals(["public", "unlisted", "private"]),
|
|
2685
|
+
firstComment: import_effect18.Schema.optionalKey(text),
|
|
2595
2686
|
tags: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(100))).check(import_effect18.Schema.isMaxLength(30))),
|
|
2596
2687
|
categoryId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^\d{1,3}$/))),
|
|
2597
2688
|
madeForKids: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
|
|
@@ -2606,14 +2697,66 @@ var XArticleDraftSettings = import_effect18.Schema.Struct({
|
|
|
2606
2697
|
title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleTitleMaxLength)),
|
|
2607
2698
|
content: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleContentMaxLength))
|
|
2608
2699
|
}).annotate({ identifier: "XArticleDraftSettings" });
|
|
2700
|
+
var XPoll = import_effect18.Schema.Struct({
|
|
2701
|
+
options: pollOptions(xPollLimits),
|
|
2702
|
+
durationMinutes: import_effect18.Schema.Number.check(import_effect18.Schema.isInt({ expected: "an integer number of minutes" }), import_effect18.Schema.isBetween({
|
|
2703
|
+
minimum: xPollLimits.minDurationMinutes,
|
|
2704
|
+
maximum: xPollLimits.maxDurationMinutes
|
|
2705
|
+
}, {
|
|
2706
|
+
expected: `between ${xPollLimits.minDurationMinutes} and ${xPollLimits.maxDurationMinutes} minutes`
|
|
2707
|
+
}))
|
|
2708
|
+
}).annotate({
|
|
2709
|
+
description: "X poll on the root post. Include post text and omit attachments."
|
|
2710
|
+
});
|
|
2711
|
+
var xPostOptionId = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^[0-9]{1,19}$/, {
|
|
2712
|
+
expected: "an X ID string of 1 to 19 digits"
|
|
2713
|
+
}));
|
|
2609
2714
|
var XFeedSettings = import_effect18.Schema.Struct({
|
|
2715
|
+
poll: import_effect18.Schema.optionalKey(XPoll),
|
|
2716
|
+
replySettings: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(xReplySettings).annotate({
|
|
2717
|
+
description: "Who may reply to the root X post. Omit for the provider default."
|
|
2718
|
+
})),
|
|
2719
|
+
quotePostId: import_effect18.Schema.optionalKey(xPostOptionId.annotate({
|
|
2720
|
+
description: "Native quotes require an X Enterprise app. With PubNio's current app, omit this field and put the X post URL in the text."
|
|
2721
|
+
})),
|
|
2722
|
+
mediaTaggedUserIds: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(xPostOptionId).check(import_effect18.Schema.isMaxLength(xMediaTagLimit)).annotate({
|
|
2723
|
+
description: "X user ID strings to tag on root post photos (JPEG, PNG, or WebP)."
|
|
2724
|
+
})),
|
|
2725
|
+
placeId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isTrimmed({
|
|
2726
|
+
expected: "an X Place ID without surrounding whitespace"
|
|
2727
|
+
}), nonblank).annotate({
|
|
2728
|
+
description: "Opaque X Place ID such as geo.place_id from a post lookup."
|
|
2729
|
+
})),
|
|
2610
2730
|
firstComment: import_effect18.Schema.optionalKey(text),
|
|
2611
|
-
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(
|
|
2731
|
+
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(threadPostTextLimit))).check(import_effect18.Schema.isMaxLength(24))),
|
|
2612
2732
|
article: import_effect18.Schema.optionalKey(XArticleDraftSettings)
|
|
2613
2733
|
}).annotate({ identifier: "XFeedSettings" });
|
|
2614
|
-
var
|
|
2615
|
-
|
|
2616
|
-
|
|
2734
|
+
var googleBusinessLocalTimeFormat = "Use a valid location-local date and time in YYYY-MM-DDTHH:MM format.";
|
|
2735
|
+
var googleBusinessLocalTime = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])T(?:[01][0-9]|2[0-3]):[0-5][0-9]$/, {
|
|
2736
|
+
message: googleBusinessLocalTimeFormat
|
|
2737
|
+
}), import_effect18.Schema.makeFilter((value) => {
|
|
2738
|
+
const year = Number(value.slice(0, 4));
|
|
2739
|
+
const date = new Date(`${value}:00Z`);
|
|
2740
|
+
return year > 0 && date.getUTCMonth() + 1 === Number(value.slice(5, 7)) && date.getUTCDate() === Number(value.slice(8, 10)) || googleBusinessLocalTimeFormat;
|
|
2741
|
+
})).annotate({ description: googleBusinessLocalTimeFormat });
|
|
2742
|
+
var googleBusinessNonblank = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/\S/, {
|
|
2743
|
+
message: "Enter a string with non-whitespace content."
|
|
2744
|
+
}));
|
|
2745
|
+
var googleBusinessLink = MediaUrl.annotate({
|
|
2746
|
+
description: "Use an HTTPS URL of at most 2,048 characters without embedded credentials.",
|
|
2747
|
+
message: "Use an HTTPS URL of at most 2,048 characters without embedded credentials."
|
|
2748
|
+
});
|
|
2749
|
+
var GoogleBusinessFeedSettings = import_effect18.Schema.Struct({
|
|
2750
|
+
topicType: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["standard", "event", "offer"])),
|
|
2751
|
+
title: import_effect18.Schema.optionalKey(googleBusinessNonblank),
|
|
2752
|
+
startsAt: import_effect18.Schema.optionalKey(googleBusinessLocalTime),
|
|
2753
|
+
endsAt: import_effect18.Schema.optionalKey(googleBusinessLocalTime),
|
|
2754
|
+
couponCode: import_effect18.Schema.optionalKey(googleBusinessNonblank),
|
|
2755
|
+
redeemUrl: import_effect18.Schema.optionalKey(googleBusinessLink),
|
|
2756
|
+
terms: import_effect18.Schema.optionalKey(googleBusinessNonblank),
|
|
2757
|
+
callToAction: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["book", "order", "shop", "learn_more", "sign_up", "call"])),
|
|
2758
|
+
callToActionUrl: import_effect18.Schema.optionalKey(googleBusinessLink)
|
|
2759
|
+
}).annotate({ identifier: "GoogleBusinessFeedSettings" });
|
|
2617
2760
|
var ThreadsFeedSettings = import_effect18.Schema.Struct({
|
|
2618
2761
|
firstComment: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(threadsTextLimit))),
|
|
2619
2762
|
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(threadsTextLimit))).check(import_effect18.Schema.isMaxLength(24)))
|
|
@@ -2792,6 +2935,41 @@ var providerSettings = import_effect18.Schema.Union([
|
|
|
2792
2935
|
TikTokFeedSettings,
|
|
2793
2936
|
GoogleBusinessFeedSettings
|
|
2794
2937
|
]);
|
|
2938
|
+
function settingsShapeErrors(issue, depth = 0) {
|
|
2939
|
+
switch (issue._tag) {
|
|
2940
|
+
case "Composite":
|
|
2941
|
+
return issue.issues.reduce((count, child) => count + settingsShapeErrors(child, depth), 0);
|
|
2942
|
+
case "AnyOf":
|
|
2943
|
+
return issue.issues.length === 0 ? 0 : Math.min(...issue.issues.map((child) => settingsShapeErrors(child, depth)));
|
|
2944
|
+
case "Pointer":
|
|
2945
|
+
return settingsShapeErrors(issue.issue, depth + issue.path.length);
|
|
2946
|
+
case "UnexpectedKey":
|
|
2947
|
+
return depth === 1 ? 3 : 2;
|
|
2948
|
+
case "MissingKey":
|
|
2949
|
+
return depth === 1 ? 4 : 1;
|
|
2950
|
+
default:
|
|
2951
|
+
return 0;
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
var createTargetSettings = providerSettings.pipe(import_effect18.Schema.catchDecoding((issue) => {
|
|
2955
|
+
if (issue._tag !== "AnyOf")
|
|
2956
|
+
return import_effect18.Effect.fail(issue);
|
|
2957
|
+
const [first, ...others] = issue.issues;
|
|
2958
|
+
if (!first)
|
|
2959
|
+
return import_effect18.Effect.fail(issue);
|
|
2960
|
+
let closest = first;
|
|
2961
|
+
let fewest = settingsShapeErrors(first);
|
|
2962
|
+
for (const candidate of others) {
|
|
2963
|
+
if (fewest === 0)
|
|
2964
|
+
break;
|
|
2965
|
+
const errors = settingsShapeErrors(candidate);
|
|
2966
|
+
if (errors < fewest) {
|
|
2967
|
+
closest = candidate;
|
|
2968
|
+
fewest = errors;
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
return import_effect18.Effect.fail(closest);
|
|
2972
|
+
}));
|
|
2795
2973
|
var CreatePostTarget = import_effect18.Schema.Struct({
|
|
2796
2974
|
accountId: AccountId,
|
|
2797
2975
|
provider: import_effect18.Schema.optionalKey(Provider),
|
|
@@ -2803,29 +2981,26 @@ var CreatePostTarget = import_effect18.Schema.Struct({
|
|
|
2803
2981
|
queueId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isUUID()).annotate({
|
|
2804
2982
|
description: "Assign this destination to its connected account's schedule queue."
|
|
2805
2983
|
})),
|
|
2806
|
-
settings: import_effect18.Schema.optionalKey(
|
|
2984
|
+
settings: import_effect18.Schema.optionalKey(createTargetSettings)
|
|
2807
2985
|
}).annotate({ identifier: "CreatePostTarget" });
|
|
2808
2986
|
var postText = import_effect18.Schema.Trim.check(import_effect18.Schema.isMaxLength(postTextLimit)).pipe(import_effect18.Schema.annotateEncoded({
|
|
2809
2987
|
description: `At most ${postTextLimit} characters after trimming.`
|
|
2810
2988
|
}));
|
|
2811
2989
|
var postTargets = import_effect18.Schema.Array(PublishTarget).check(import_effect18.Schema.isMaxLength(50));
|
|
2812
|
-
var
|
|
2990
|
+
var PostContent = import_effect18.Schema.Struct({
|
|
2813
2991
|
text: import_effect18.Schema.optionalKey(postText),
|
|
2814
2992
|
targets: import_effect18.Schema.optionalKey(postTargets),
|
|
2815
|
-
media: import_effect18.Schema.optionalKey(MediaInputs)
|
|
2816
|
-
};
|
|
2817
|
-
var PostContent = import_effect18.Schema.Struct(postContent).annotate({
|
|
2818
|
-
identifier: "PostContent"
|
|
2819
|
-
});
|
|
2820
|
-
var PostPreflight = import_effect18.Schema.Struct({
|
|
2821
|
-
...postContent,
|
|
2993
|
+
media: import_effect18.Schema.optionalKey(MediaInputs),
|
|
2822
2994
|
scheduledAt: import_effect18.Schema.optionalKey(ScheduledAt)
|
|
2823
|
-
}).annotate({ identifier: "
|
|
2824
|
-
var
|
|
2825
|
-
text: import_effect18.Schema.optionalKey(postText),
|
|
2995
|
+
}).annotate({ identifier: "PostContent" });
|
|
2996
|
+
var destinationSelectors = {
|
|
2826
2997
|
platforms: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(Provider).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit))),
|
|
2827
2998
|
accounts: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(AccountId).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit))),
|
|
2828
|
-
targets: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(CreatePostTarget).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit)))
|
|
2999
|
+
targets: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(CreatePostTarget).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit)))
|
|
3000
|
+
};
|
|
3001
|
+
var CreatePost = import_effect18.Schema.Struct({
|
|
3002
|
+
text: import_effect18.Schema.optionalKey(postText),
|
|
3003
|
+
...destinationSelectors,
|
|
2829
3004
|
media: import_effect18.Schema.optionalKey(MediaInputs),
|
|
2830
3005
|
scheduledAt: import_effect18.Schema.optionalKey(ScheduledAt),
|
|
2831
3006
|
publishNow: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
|
|
@@ -2833,12 +3008,18 @@ var CreatePost = import_effect18.Schema.Struct({
|
|
|
2833
3008
|
description: "Save the post as a draft without submitting it. Defaults to false."
|
|
2834
3009
|
})
|
|
2835
3010
|
}).annotate({ identifier: "CreatePost" }).annotate({
|
|
2836
|
-
description: "Send
|
|
3011
|
+
description: "Send one selector: platforms, accounts, or targets. scheduledAt is the default time; targets[].scheduledAt overrides it per destination. isDraft saves the same body without submitting."
|
|
2837
3012
|
});
|
|
2838
3013
|
var UpdatePost = import_effect18.Schema.Struct({
|
|
2839
|
-
|
|
3014
|
+
text: import_effect18.Schema.optionalKey(postText),
|
|
3015
|
+
media: import_effect18.Schema.optionalKey(MediaInputs),
|
|
3016
|
+
scheduledAt: import_effect18.Schema.optionalKey(ScheduleOverride),
|
|
3017
|
+
...destinationSelectors,
|
|
3018
|
+
targets: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(CreatePostTarget).check(import_effect18.Schema.isMaxLength(publishTargetLimit))),
|
|
2840
3019
|
expectedRevision: import_effect18.Schema.optionalKey(revision)
|
|
2841
|
-
}).annotate({ identifier: "UpdatePost" })
|
|
3020
|
+
}).annotate({ identifier: "UpdatePost" }).annotate({
|
|
3021
|
+
description: "Edit a draft with the same fields as create. scheduledAt sets the default time; null clears it. One selector (platforms, accounts, or targets) replaces the saved targets; an empty targets array removes them."
|
|
3022
|
+
});
|
|
2842
3023
|
var Post = import_effect18.Schema.Struct({
|
|
2843
3024
|
postId: PostId,
|
|
2844
3025
|
isDraft: import_effect18.Schema.Boolean,
|
|
@@ -2846,6 +3027,9 @@ var Post = import_effect18.Schema.Struct({
|
|
|
2846
3027
|
text: postText,
|
|
2847
3028
|
media: MediaInputs,
|
|
2848
3029
|
targets: postTargets,
|
|
3030
|
+
scheduledAt: import_effect18.Schema.NullOr(ScheduledAt).annotate({
|
|
3031
|
+
description: "The default time for targets without their own scheduledAt. null publishes them when submitted."
|
|
3032
|
+
}),
|
|
2849
3033
|
deliveries: import_effect18.Schema.Array(DeliveryStatus),
|
|
2850
3034
|
status: PostState,
|
|
2851
3035
|
createdAt: import_effect18.Schema.String,
|
|
@@ -3495,6 +3679,31 @@ var InboxReviewList = import_effect21.Schema.Struct({
|
|
|
3495
3679
|
var InboxUnreadCount = import_effect21.Schema.Struct({
|
|
3496
3680
|
unreadCount: import_effect21.Schema.Int
|
|
3497
3681
|
}).annotate({ identifier: "InboxUnreadCount" });
|
|
3682
|
+
var InboxUnavailableReason = import_effect21.Schema.Literals([
|
|
3683
|
+
"provider_subscription_limit",
|
|
3684
|
+
"missing_scopes",
|
|
3685
|
+
"webhook_invalid",
|
|
3686
|
+
"subscription_pending",
|
|
3687
|
+
"plan_required",
|
|
3688
|
+
"insufficient_credit",
|
|
3689
|
+
"spend_cap_reached"
|
|
3690
|
+
]);
|
|
3691
|
+
var InboxUnavailableState = import_effect21.Schema.Struct({
|
|
3692
|
+
reason: InboxUnavailableReason,
|
|
3693
|
+
action: import_effect21.Schema.Literals([
|
|
3694
|
+
"contact_pubnio",
|
|
3695
|
+
"reconnect_account",
|
|
3696
|
+
"wait_for_repair",
|
|
3697
|
+
"upgrade_plan",
|
|
3698
|
+
"add_credit",
|
|
3699
|
+
"raise_spend_cap"
|
|
3700
|
+
])
|
|
3701
|
+
});
|
|
3702
|
+
var InboxDeliveryGap = import_effect21.Schema.Struct({
|
|
3703
|
+
from: import_effect21.Schema.String,
|
|
3704
|
+
to: import_effect21.Schema.String,
|
|
3705
|
+
action: import_effect21.Schema.Literal("review_on_x")
|
|
3706
|
+
});
|
|
3498
3707
|
var InboxChannelCapability = import_effect21.Schema.Struct({
|
|
3499
3708
|
resource: InboxResource,
|
|
3500
3709
|
supported: import_effect21.Schema.Boolean,
|
|
@@ -3507,7 +3716,8 @@ var InboxChannelCapability = import_effect21.Schema.Struct({
|
|
|
3507
3716
|
syncMode: InboxSyncMode,
|
|
3508
3717
|
backfillDays: import_effect21.Schema.Int,
|
|
3509
3718
|
missingScopes: import_effect21.Schema.Array(import_effect21.Schema.String),
|
|
3510
|
-
missingTasks: import_effect21.Schema.Array(import_effect21.Schema.String)
|
|
3719
|
+
missingTasks: import_effect21.Schema.Array(import_effect21.Schema.String),
|
|
3720
|
+
unavailable: import_effect21.Schema.NullOr(InboxUnavailableState)
|
|
3511
3721
|
}).annotate({ identifier: "InboxChannelCapability" });
|
|
3512
3722
|
var InboxAccountCapabilities = import_effect21.Schema.Struct({
|
|
3513
3723
|
accountId: AccountId,
|
|
@@ -3522,6 +3732,7 @@ var InboxAccountCapabilities = import_effect21.Schema.Struct({
|
|
|
3522
3732
|
mentions: InboxChannelCapability,
|
|
3523
3733
|
replyWindow: InboxReplyWindow,
|
|
3524
3734
|
lastSyncError: import_effect21.Schema.NullOr(import_effect21.Schema.String),
|
|
3735
|
+
deliveryGap: import_effect21.Schema.NullOr(InboxDeliveryGap),
|
|
3525
3736
|
checkedAt: import_effect21.Schema.String
|
|
3526
3737
|
}).annotate({ identifier: "InboxAccountCapabilities" });
|
|
3527
3738
|
var InboxCapabilities = import_effect21.Schema.Struct({
|
|
@@ -4434,7 +4645,8 @@ var WorkspaceEventType = import_effect26.Schema.Literals([
|
|
|
4434
4645
|
"billing.credit.topped_up",
|
|
4435
4646
|
"billing.credit.low",
|
|
4436
4647
|
"billing.spend_cap.reached",
|
|
4437
|
-
"billing.invoice.payment_failed"
|
|
4648
|
+
"billing.invoice.payment_failed",
|
|
4649
|
+
"billing.subscription.duplicate_refunded"
|
|
4438
4650
|
]);
|
|
4439
4651
|
var WorkspaceEventEnvelope = import_effect26.Schema.Struct({
|
|
4440
4652
|
id: import_effect26.Schema.String.check(import_effect26.Schema.isUUID()),
|
|
@@ -5015,6 +5227,15 @@ var WebhookEvent = import_effect27.Schema.Union([
|
|
|
5015
5227
|
hostedInvoiceUrl: import_effect27.Schema.NullOr(import_effect27.Schema.String)
|
|
5016
5228
|
})
|
|
5017
5229
|
}),
|
|
5230
|
+
import_effect27.Schema.Struct({
|
|
5231
|
+
...envelope,
|
|
5232
|
+
type: import_effect27.Schema.Literal("billing.subscription.duplicate_refunded"),
|
|
5233
|
+
data: import_effect27.Schema.Struct({
|
|
5234
|
+
subscriptionId: import_effect27.Schema.String,
|
|
5235
|
+
amountRefundedMinor: import_effect27.Schema.Int,
|
|
5236
|
+
currency: import_effect27.Schema.String
|
|
5237
|
+
})
|
|
5238
|
+
}),
|
|
5018
5239
|
import_effect27.Schema.Struct({
|
|
5019
5240
|
...envelope,
|
|
5020
5241
|
type: import_effect27.Schema.Literal("webhook.test"),
|
|
@@ -5198,6 +5419,27 @@ class SeatLimitReached extends import_http_api.HttpApiError.Problem()("SeatLimit
|
|
|
5198
5419
|
}) {
|
|
5199
5420
|
}
|
|
5200
5421
|
|
|
5422
|
+
class PlanRequired extends import_http_api.HttpApiError.Problem()("PlanRequired", {
|
|
5423
|
+
type: "urn:pubnio:problem:plan-required",
|
|
5424
|
+
status: 402,
|
|
5425
|
+
title: "Plan upgrade required"
|
|
5426
|
+
}, {
|
|
5427
|
+
code: import_effect28.Schema.Literal("plan_required"),
|
|
5428
|
+
entitlement: import_effect28.Schema.Literals([
|
|
5429
|
+
"adsInsights",
|
|
5430
|
+
"adsWrite",
|
|
5431
|
+
"analyticsHistory"
|
|
5432
|
+
]),
|
|
5433
|
+
currentPlan: BillingPlanId,
|
|
5434
|
+
minimumPlan: BillingPlanId,
|
|
5435
|
+
fundingUrl: import_effect28.Schema.String,
|
|
5436
|
+
canManageBilling: import_effect28.Schema.Boolean,
|
|
5437
|
+
nextAction: import_effect28.Schema.String,
|
|
5438
|
+
param: import_effect28.Schema.optionalKey(import_effect28.Schema.String),
|
|
5439
|
+
earliestDate: import_effect28.Schema.optionalKey(import_effect28.Schema.String)
|
|
5440
|
+
}) {
|
|
5441
|
+
}
|
|
5442
|
+
|
|
5201
5443
|
class AlreadyMember extends import_http_api.HttpApiError.Problem()("AlreadyMember", {
|
|
5202
5444
|
type: "urn:pubnio:problem:already-member",
|
|
5203
5445
|
status: 409,
|
|
@@ -5387,6 +5629,17 @@ class DestinationAlreadySubmitted extends import_http_api.HttpApiError.Problem()
|
|
|
5387
5629
|
}) {
|
|
5388
5630
|
}
|
|
5389
5631
|
|
|
5632
|
+
class PostSubmitted extends import_http_api.HttpApiError.Problem()("PostSubmitted", {
|
|
5633
|
+
type: "urn:pubnio:problem:post-submitted",
|
|
5634
|
+
status: 409,
|
|
5635
|
+
title: "Post already submitted"
|
|
5636
|
+
}, {
|
|
5637
|
+
code: import_effect28.Schema.Literal("post_submitted"),
|
|
5638
|
+
targetIds: import_effect28.Schema.Array(TargetId),
|
|
5639
|
+
nextAction: import_effect28.Schema.String
|
|
5640
|
+
}) {
|
|
5641
|
+
}
|
|
5642
|
+
|
|
5390
5643
|
class DeliveryNotRetryable extends import_http_api.HttpApiError.Problem()("DeliveryNotRetryable", {
|
|
5391
5644
|
type: "urn:pubnio:problem:delivery-not-retryable",
|
|
5392
5645
|
status: 409,
|
|
@@ -5669,7 +5922,15 @@ class InboxUnsupportedContent extends import_http_api.HttpApiError.Problem()("In
|
|
|
5669
5922
|
capability: ProductCapability
|
|
5670
5923
|
}) {
|
|
5671
5924
|
}
|
|
5925
|
+
|
|
5926
|
+
class InboxUnavailable extends import_http_api.HttpApiError.Problem()("InboxUnavailable", {
|
|
5927
|
+
type: "urn:pubnio:problem:inbox-unavailable",
|
|
5928
|
+
status: 409,
|
|
5929
|
+
title: "Inbox unavailable"
|
|
5930
|
+
}, InboxUnavailableState.fields) {
|
|
5931
|
+
}
|
|
5672
5932
|
var InboxProblems = [
|
|
5933
|
+
InboxUnavailable,
|
|
5673
5934
|
InboxReplyWindowClosed,
|
|
5674
5935
|
InboxTargetChanged,
|
|
5675
5936
|
InboxSyncInProgress,
|
|
@@ -5884,6 +6145,7 @@ var PublishProblems = [
|
|
|
5884
6145
|
AttemptChanged,
|
|
5885
6146
|
IdempotencyConflict,
|
|
5886
6147
|
DestinationAlreadySubmitted,
|
|
6148
|
+
PostSubmitted,
|
|
5887
6149
|
DeliveryNotRetryable,
|
|
5888
6150
|
DeliveryNotReconcilable,
|
|
5889
6151
|
DeliveryScheduleLocked,
|
|
@@ -5910,7 +6172,8 @@ var AdsProblems = [
|
|
|
5910
6172
|
AdKillSwitchActive,
|
|
5911
6173
|
AdOperationNotRetryable,
|
|
5912
6174
|
AdProviderRejected,
|
|
5913
|
-
InvalidAdRequest
|
|
6175
|
+
InvalidAdRequest,
|
|
6176
|
+
PlanRequired
|
|
5914
6177
|
];
|
|
5915
6178
|
var SchedulingProblems = [
|
|
5916
6179
|
QueueNotFound,
|
|
@@ -6341,7 +6604,7 @@ var import_http = require("effect/http");
|
|
|
6341
6604
|
// package.json
|
|
6342
6605
|
var package_default = {
|
|
6343
6606
|
name: "@pubnio/sdk",
|
|
6344
|
-
version: "0.
|
|
6607
|
+
version: "0.4.0",
|
|
6345
6608
|
description: "JavaScript and TypeScript client for the PubNio API",
|
|
6346
6609
|
type: "module",
|
|
6347
6610
|
exports: {
|
|
@@ -8008,6 +8271,15 @@ var postsCreate = (options) => (options.client ?? client).post({
|
|
|
8008
8271
|
...options.headers
|
|
8009
8272
|
}
|
|
8010
8273
|
});
|
|
8274
|
+
var postsValidateBody = (options) => (options.client ?? client).post({
|
|
8275
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
8276
|
+
url: "/api/v1/posts/validate",
|
|
8277
|
+
...options,
|
|
8278
|
+
headers: {
|
|
8279
|
+
"Content-Type": "application/json",
|
|
8280
|
+
...options.headers
|
|
8281
|
+
}
|
|
8282
|
+
});
|
|
8011
8283
|
var postsDelete = (options) => (options.client ?? client).delete({
|
|
8012
8284
|
security: [{ scheme: "bearer", type: "http" }],
|
|
8013
8285
|
url: "/api/v1/posts/{postId}",
|
|
@@ -8860,7 +9132,7 @@ function createPubNioClient({
|
|
|
8860
9132
|
return withIdempotencyKey(idempotencyKey, async () => {
|
|
8861
9133
|
const body = post;
|
|
8862
9134
|
if (post.isDraft) {
|
|
8863
|
-
return decode(
|
|
9135
|
+
return decode(PostCreated, postsCreate({
|
|
8864
9136
|
client,
|
|
8865
9137
|
query: { workspaceId },
|
|
8866
9138
|
headers: { "idempotency-key": idempotencyKey },
|
|
@@ -9545,7 +9817,16 @@ function createPubNioClient({
|
|
|
9545
9817
|
query: { workspaceId },
|
|
9546
9818
|
...transport()
|
|
9547
9819
|
})),
|
|
9548
|
-
|
|
9820
|
+
validateBody: (input) => {
|
|
9821
|
+
const body = input;
|
|
9822
|
+
return decode(PostValidation, postsValidateBody({
|
|
9823
|
+
client,
|
|
9824
|
+
query: { workspaceId },
|
|
9825
|
+
body,
|
|
9826
|
+
...transport()
|
|
9827
|
+
}));
|
|
9828
|
+
},
|
|
9829
|
+
publish: (postId, input = {}) => {
|
|
9549
9830
|
const { idempotencyKey = crypto.randomUUID(), ...publish } = input;
|
|
9550
9831
|
return withIdempotencyKey(idempotencyKey, async () => {
|
|
9551
9832
|
const accepted = await decode(PublishAccepted, postsPublish({
|
|
@@ -9556,7 +9837,7 @@ function createPubNioClient({
|
|
|
9556
9837
|
body: {
|
|
9557
9838
|
expectedRevision: publish.expectedRevision,
|
|
9558
9839
|
scheduledAt: publish.scheduledAt,
|
|
9559
|
-
|
|
9840
|
+
accounts: publish.accounts && [...publish.accounts],
|
|
9560
9841
|
targets: publish.targets && [...publish.targets]
|
|
9561
9842
|
},
|
|
9562
9843
|
...transport()
|