@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/index.cjs
CHANGED
|
@@ -179,6 +179,7 @@ __export(exports_sdk_gen, {
|
|
|
179
179
|
postsRetry: () => postsRetry,
|
|
180
180
|
postsUpdate: () => postsUpdate,
|
|
181
181
|
postsValidate: () => postsValidate,
|
|
182
|
+
postsValidateBody: () => postsValidateBody,
|
|
182
183
|
profileDeactivate: () => profileDeactivate,
|
|
183
184
|
profileGet: () => profileGet,
|
|
184
185
|
profileUpdate: () => profileUpdate,
|
|
@@ -388,6 +389,8 @@ var IssueCode = import_effect6.Schema.Literals([
|
|
|
388
389
|
"tiktok_upload_required",
|
|
389
390
|
"tiktok_too_many_mentions",
|
|
390
391
|
"queue_and_time_conflict",
|
|
392
|
+
"queue_not_found",
|
|
393
|
+
"queue_unavailable",
|
|
391
394
|
"invalid_field",
|
|
392
395
|
"account_ambiguous",
|
|
393
396
|
"unsupported_placement",
|
|
@@ -398,8 +401,9 @@ var IssueCode = import_effect6.Schema.Literals([
|
|
|
398
401
|
var PostIssue = import_effect6.Schema.Struct({
|
|
399
402
|
code: IssueCode,
|
|
400
403
|
path: import_effect6.Schema.Array(import_effect6.Schema.Union([import_effect6.Schema.String, import_effect6.Schema.Int])),
|
|
401
|
-
message: import_effect6.Schema.String
|
|
402
|
-
})
|
|
404
|
+
message: import_effect6.Schema.String,
|
|
405
|
+
candidates: import_effect6.Schema.optionalKey(import_effect6.Schema.Array(import_effect6.Schema.Struct({ accountId: AccountId, name: import_effect6.Schema.String })))
|
|
406
|
+
}).annotate({ identifier: "PostIssue" });
|
|
403
407
|
var schemaIssueFormatter = import_effect6.SchemaIssue.makeFormatterStandardSchemaV1();
|
|
404
408
|
|
|
405
409
|
// ../protocol/src/provider.ts
|
|
@@ -501,18 +505,22 @@ var PublishPlacement = import_effect8.Schema.Literals([
|
|
|
501
505
|
var ScheduleOverride = import_effect8.Schema.Union([ScheduledAt, import_effect8.Schema.Null]);
|
|
502
506
|
var DestinationSelection = import_effect8.Schema.Struct({
|
|
503
507
|
accountId: AccountId,
|
|
504
|
-
placement: PublishPlacement
|
|
508
|
+
placement: import_effect8.Schema.optionalKey(PublishPlacement).annotate({
|
|
509
|
+
description: "Omit to select the draft's only destination for this account."
|
|
510
|
+
}),
|
|
505
511
|
scheduledAt: import_effect8.Schema.optionalKey(ScheduleOverride),
|
|
506
512
|
queueId: import_effect8.Schema.optionalKey(uuid2)
|
|
507
513
|
}).annotate({ identifier: "DestinationSelection" });
|
|
508
514
|
var PublishInput = import_effect8.Schema.Struct({
|
|
509
|
-
expectedRevision: PublishRevision
|
|
515
|
+
expectedRevision: import_effect8.Schema.optionalKey(PublishRevision).annotate({
|
|
516
|
+
description: "Publish only if the draft is still at this revision. Omit to publish the saved draft as it is."
|
|
517
|
+
}),
|
|
510
518
|
scheduledAt: import_effect8.Schema.optionalKey(ScheduledAt),
|
|
511
|
-
|
|
519
|
+
accounts: import_effect8.Schema.optionalKey(import_effect8.Schema.Array(AccountId).check(import_effect8.Schema.isMinLength(1), import_effect8.Schema.isMaxLength(50)).annotate({
|
|
512
520
|
description: "Select every draft placement for these accounts. Use targets for exact selection instead."
|
|
513
521
|
})),
|
|
514
522
|
targets: import_effect8.Schema.optionalKey(import_effect8.Schema.Array(DestinationSelection).check(import_effect8.Schema.isMinLength(1), import_effect8.Schema.isMaxLength(50)).annotate({
|
|
515
|
-
description: "Select exact draft destinations and optionally override each schedule. Omit
|
|
523
|
+
description: "Select exact draft destinations and optionally override each schedule. Omit accounts when using targets."
|
|
516
524
|
}))
|
|
517
525
|
});
|
|
518
526
|
var PostRef = import_effect8.Schema.Struct({ postId: PostId });
|
|
@@ -616,7 +624,10 @@ var DeliveryIssue = import_effect8.Schema.Literals([
|
|
|
616
624
|
"tiktok_settings_not_allowed",
|
|
617
625
|
"tiktok_processing_failed",
|
|
618
626
|
"submission_uncertain",
|
|
619
|
-
"confirmation_unavailable"
|
|
627
|
+
"confirmation_unavailable",
|
|
628
|
+
"billing_inactive",
|
|
629
|
+
"spend_cap_reached",
|
|
630
|
+
"insufficient_credit"
|
|
620
631
|
]);
|
|
621
632
|
var FirstCommentStatus = import_effect8.Schema.Literals([
|
|
622
633
|
"pending",
|
|
@@ -715,6 +726,7 @@ var BillingSubscriptionStatus = import_effect9.Schema.Literals([
|
|
|
715
726
|
var UsageMeter = import_effect9.Schema.Literals([
|
|
716
727
|
"confirmed_publish",
|
|
717
728
|
"x_passthrough",
|
|
729
|
+
"x_read",
|
|
718
730
|
"managed_ad",
|
|
719
731
|
"inbox_reply",
|
|
720
732
|
"automation_run"
|
|
@@ -731,10 +743,15 @@ var BillingPlan = import_effect9.Schema.Struct({
|
|
|
731
743
|
monthlyPrice: import_effect9.Schema.NullOr(Money),
|
|
732
744
|
annualPrice: import_effect9.Schema.NullOr(Money),
|
|
733
745
|
meters: import_effect9.Schema.Array(BillingPlanMeter),
|
|
746
|
+
xReads: import_effect9.Schema.Boolean,
|
|
747
|
+
includedXReadMicros: import_effect9.Schema.NullOr(import_effect9.Schema.Int),
|
|
734
748
|
seatsLimit: import_effect9.Schema.NullOr(import_effect9.Schema.Int),
|
|
735
749
|
analyticsRetentionDays: import_effect9.Schema.Int,
|
|
736
750
|
whiteLabelOAuth: import_effect9.Schema.Boolean,
|
|
737
|
-
ssoSaml: import_effect9.Schema.Boolean
|
|
751
|
+
ssoSaml: import_effect9.Schema.Boolean,
|
|
752
|
+
priorityQueue: import_effect9.Schema.Boolean,
|
|
753
|
+
adsInsights: import_effect9.Schema.Boolean,
|
|
754
|
+
adsWrite: import_effect9.Schema.Boolean
|
|
738
755
|
}).annotate({ identifier: "BillingPlan" });
|
|
739
756
|
var BillingPlanList = import_effect9.Schema.Struct({
|
|
740
757
|
data: import_effect9.Schema.Array(BillingPlan)
|
|
@@ -770,6 +787,8 @@ var WorkspaceBilling = import_effect9.Schema.Struct({
|
|
|
770
787
|
creditBalance: Money,
|
|
771
788
|
spendControls: BillingSpendControls,
|
|
772
789
|
currentPeriod: import_effect9.Schema.Struct({
|
|
790
|
+
start: import_effect9.Schema.String,
|
|
791
|
+
end: import_effect9.Schema.String,
|
|
773
792
|
meters: import_effect9.Schema.Array(BillingMeterUsage),
|
|
774
793
|
totalVariableSpendMicros: import_effect9.Schema.Int,
|
|
775
794
|
seatsUsed: import_effect9.Schema.Int,
|
|
@@ -1911,7 +1930,51 @@ var ApiLimits = import_effect15.Schema.Struct({
|
|
|
1911
1930
|
media: MediaLimits,
|
|
1912
1931
|
rateLimits: RateLimits
|
|
1913
1932
|
}).annotate({ identifier: "ApiLimits" });
|
|
1933
|
+
var pollOptionCount = { minOptions: 2, maxOptions: 4 };
|
|
1934
|
+
var xPollLimits = {
|
|
1935
|
+
...pollOptionCount,
|
|
1936
|
+
optionCharacters: 25,
|
|
1937
|
+
minDurationMinutes: 5,
|
|
1938
|
+
maxDurationMinutes: 10080
|
|
1939
|
+
};
|
|
1940
|
+
var linkedinPollLimits = {
|
|
1941
|
+
...pollOptionCount,
|
|
1942
|
+
questionCharacters: 140,
|
|
1943
|
+
optionCharacters: 30,
|
|
1944
|
+
durations: ["ONE_DAY", "THREE_DAYS", "SEVEN_DAYS", "FOURTEEN_DAYS"]
|
|
1945
|
+
};
|
|
1946
|
+
var xReplySettings = [
|
|
1947
|
+
"following",
|
|
1948
|
+
"mentionedUsers",
|
|
1949
|
+
"subscribers",
|
|
1950
|
+
"verified"
|
|
1951
|
+
];
|
|
1952
|
+
var xMediaTagLimit = 10;
|
|
1953
|
+
var pollOptionLimits = {
|
|
1954
|
+
minOptions: import_effect15.Schema.Int,
|
|
1955
|
+
maxOptions: import_effect15.Schema.Int,
|
|
1956
|
+
optionCharacters: import_effect15.Schema.Int
|
|
1957
|
+
};
|
|
1958
|
+
var FeedSettingsCapability = import_effect15.Schema.Struct({
|
|
1959
|
+
poll: import_effect15.Schema.Union([
|
|
1960
|
+
import_effect15.Schema.Struct({
|
|
1961
|
+
...pollOptionLimits,
|
|
1962
|
+
minDurationMinutes: import_effect15.Schema.Int,
|
|
1963
|
+
maxDurationMinutes: import_effect15.Schema.Int
|
|
1964
|
+
}),
|
|
1965
|
+
import_effect15.Schema.Struct({
|
|
1966
|
+
...pollOptionLimits,
|
|
1967
|
+
questionCharacters: import_effect15.Schema.Int,
|
|
1968
|
+
durations: import_effect15.Schema.Array(import_effect15.Schema.Literals(linkedinPollLimits.durations))
|
|
1969
|
+
})
|
|
1970
|
+
]),
|
|
1971
|
+
replySettings: import_effect15.Schema.optionalKey(import_effect15.Schema.Array(import_effect15.Schema.Literals(xReplySettings))),
|
|
1972
|
+
maxMediaTags: import_effect15.Schema.optionalKey(import_effect15.Schema.Int),
|
|
1973
|
+
placeId: import_effect15.Schema.optionalKey(import_effect15.Schema.Boolean),
|
|
1974
|
+
quotePostId: import_effect15.Schema.optionalKey(import_effect15.Schema.Boolean)
|
|
1975
|
+
});
|
|
1914
1976
|
var PlacementCapability = import_effect15.Schema.Struct({
|
|
1977
|
+
settings: import_effect15.Schema.optionalKey(FeedSettingsCapability),
|
|
1915
1978
|
placement: PublishPlacement,
|
|
1916
1979
|
default: import_effect15.Schema.Boolean,
|
|
1917
1980
|
mediaTypes: import_effect15.Schema.Array(MediaType),
|
|
@@ -2285,6 +2348,11 @@ var import_effect28 = require("effect");
|
|
|
2285
2348
|
var import_effect18 = require("effect");
|
|
2286
2349
|
var postTextLimit = 128000;
|
|
2287
2350
|
var threadPostTextLimit = 1250;
|
|
2351
|
+
var blueskyPostMaxBytes = 3000;
|
|
2352
|
+
var graphemeSegmenter = new Intl.Segmenter(undefined, {
|
|
2353
|
+
granularity: "grapheme"
|
|
2354
|
+
});
|
|
2355
|
+
var utf8 = new TextEncoder;
|
|
2288
2356
|
var redditTitleMaxLength = 300;
|
|
2289
2357
|
var threadsTextLimit = 500;
|
|
2290
2358
|
var xArticleTitleMaxLength = 100;
|
|
@@ -2392,12 +2460,34 @@ var InstagramStorySettings = import_effect18.Schema.Struct({
|
|
|
2392
2460
|
muteAudio: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
|
|
2393
2461
|
userTags: instagramTags
|
|
2394
2462
|
}).annotate({ identifier: "InstagramStorySettings" });
|
|
2463
|
+
var blueskyPostText = import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(blueskyPostMaxBytes));
|
|
2395
2464
|
var BlueskyFeedSettings = import_effect18.Schema.Struct({
|
|
2396
|
-
firstComment: import_effect18.Schema.optionalKey(
|
|
2397
|
-
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(
|
|
2465
|
+
firstComment: import_effect18.Schema.optionalKey(blueskyPostText),
|
|
2466
|
+
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(blueskyPostText).check(import_effect18.Schema.isMaxLength(24))),
|
|
2398
2467
|
altText: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(1000)))
|
|
2399
2468
|
}).annotate({ identifier: "BlueskyFeedSettings" });
|
|
2469
|
+
var nonblank = import_effect18.Schema.makeFilter((value) => value.trim().length > 0 || "Supply a nonblank string.", { toJsonSchema: () => ({ pattern: "\\S" }) });
|
|
2470
|
+
function pollText(maximum) {
|
|
2471
|
+
return import_effect18.Schema.String.check(import_effect18.Schema.isBetweenCodePoints(1, maximum, {
|
|
2472
|
+
expected: `between 1 and ${maximum} characters`
|
|
2473
|
+
}), nonblank);
|
|
2474
|
+
}
|
|
2475
|
+
function pollOptions({
|
|
2476
|
+
minOptions,
|
|
2477
|
+
maxOptions,
|
|
2478
|
+
optionCharacters
|
|
2479
|
+
}) {
|
|
2480
|
+
return import_effect18.Schema.Array(pollText(optionCharacters)).check(import_effect18.Schema.isMinLength(minOptions), import_effect18.Schema.isMaxLength(maxOptions));
|
|
2481
|
+
}
|
|
2482
|
+
var LinkedInPoll = import_effect18.Schema.Struct({
|
|
2483
|
+
question: pollText(linkedinPollLimits.questionCharacters),
|
|
2484
|
+
options: pollOptions(linkedinPollLimits),
|
|
2485
|
+
duration: import_effect18.Schema.Literals(linkedinPollLimits.durations)
|
|
2486
|
+
}).annotate({
|
|
2487
|
+
description: "Organic LinkedIn poll. Include post text and omit media, altText, and documentTitle."
|
|
2488
|
+
});
|
|
2400
2489
|
var LinkedInFeedSettings = import_effect18.Schema.Struct({
|
|
2490
|
+
poll: import_effect18.Schema.optionalKey(LinkedInPoll),
|
|
2401
2491
|
firstComment: import_effect18.Schema.optionalKey(text),
|
|
2402
2492
|
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))),
|
|
2403
2493
|
visibility: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["PUBLIC", "CONNECTIONS"])),
|
|
@@ -2434,6 +2524,7 @@ var YouTubeVideoSettings = import_effect18.Schema.Struct({
|
|
|
2434
2524
|
title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(100)),
|
|
2435
2525
|
description: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(5000))),
|
|
2436
2526
|
privacyStatus: import_effect18.Schema.Literals(["public", "unlisted", "private"]),
|
|
2527
|
+
firstComment: import_effect18.Schema.optionalKey(text),
|
|
2437
2528
|
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))),
|
|
2438
2529
|
categoryId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^\d{1,3}$/))),
|
|
2439
2530
|
madeForKids: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
|
|
@@ -2448,14 +2539,66 @@ var XArticleDraftSettings = import_effect18.Schema.Struct({
|
|
|
2448
2539
|
title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleTitleMaxLength)),
|
|
2449
2540
|
content: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleContentMaxLength))
|
|
2450
2541
|
}).annotate({ identifier: "XArticleDraftSettings" });
|
|
2542
|
+
var XPoll = import_effect18.Schema.Struct({
|
|
2543
|
+
options: pollOptions(xPollLimits),
|
|
2544
|
+
durationMinutes: import_effect18.Schema.Number.check(import_effect18.Schema.isInt({ expected: "an integer number of minutes" }), import_effect18.Schema.isBetween({
|
|
2545
|
+
minimum: xPollLimits.minDurationMinutes,
|
|
2546
|
+
maximum: xPollLimits.maxDurationMinutes
|
|
2547
|
+
}, {
|
|
2548
|
+
expected: `between ${xPollLimits.minDurationMinutes} and ${xPollLimits.maxDurationMinutes} minutes`
|
|
2549
|
+
}))
|
|
2550
|
+
}).annotate({
|
|
2551
|
+
description: "X poll on the root post. Include post text and omit attachments."
|
|
2552
|
+
});
|
|
2553
|
+
var xPostOptionId = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^[0-9]{1,19}$/, {
|
|
2554
|
+
expected: "an X ID string of 1 to 19 digits"
|
|
2555
|
+
}));
|
|
2451
2556
|
var XFeedSettings = import_effect18.Schema.Struct({
|
|
2557
|
+
poll: import_effect18.Schema.optionalKey(XPoll),
|
|
2558
|
+
replySettings: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(xReplySettings).annotate({
|
|
2559
|
+
description: "Who may reply to the root X post. Omit for the provider default."
|
|
2560
|
+
})),
|
|
2561
|
+
quotePostId: import_effect18.Schema.optionalKey(xPostOptionId.annotate({
|
|
2562
|
+
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."
|
|
2563
|
+
})),
|
|
2564
|
+
mediaTaggedUserIds: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(xPostOptionId).check(import_effect18.Schema.isMaxLength(xMediaTagLimit)).annotate({
|
|
2565
|
+
description: "X user ID strings to tag on root post photos (JPEG, PNG, or WebP)."
|
|
2566
|
+
})),
|
|
2567
|
+
placeId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isTrimmed({
|
|
2568
|
+
expected: "an X Place ID without surrounding whitespace"
|
|
2569
|
+
}), nonblank).annotate({
|
|
2570
|
+
description: "Opaque X Place ID such as geo.place_id from a post lookup."
|
|
2571
|
+
})),
|
|
2452
2572
|
firstComment: import_effect18.Schema.optionalKey(text),
|
|
2453
|
-
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(
|
|
2573
|
+
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))),
|
|
2454
2574
|
article: import_effect18.Schema.optionalKey(XArticleDraftSettings)
|
|
2455
2575
|
}).annotate({ identifier: "XFeedSettings" });
|
|
2456
|
-
var
|
|
2457
|
-
|
|
2458
|
-
|
|
2576
|
+
var googleBusinessLocalTimeFormat = "Use a valid location-local date and time in YYYY-MM-DDTHH:MM format.";
|
|
2577
|
+
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]$/, {
|
|
2578
|
+
message: googleBusinessLocalTimeFormat
|
|
2579
|
+
}), import_effect18.Schema.makeFilter((value) => {
|
|
2580
|
+
const year = Number(value.slice(0, 4));
|
|
2581
|
+
const date = new Date(`${value}:00Z`);
|
|
2582
|
+
return year > 0 && date.getUTCMonth() + 1 === Number(value.slice(5, 7)) && date.getUTCDate() === Number(value.slice(8, 10)) || googleBusinessLocalTimeFormat;
|
|
2583
|
+
})).annotate({ description: googleBusinessLocalTimeFormat });
|
|
2584
|
+
var googleBusinessNonblank = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/\S/, {
|
|
2585
|
+
message: "Enter a string with non-whitespace content."
|
|
2586
|
+
}));
|
|
2587
|
+
var googleBusinessLink = MediaUrl.annotate({
|
|
2588
|
+
description: "Use an HTTPS URL of at most 2,048 characters without embedded credentials.",
|
|
2589
|
+
message: "Use an HTTPS URL of at most 2,048 characters without embedded credentials."
|
|
2590
|
+
});
|
|
2591
|
+
var GoogleBusinessFeedSettings = import_effect18.Schema.Struct({
|
|
2592
|
+
topicType: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["standard", "event", "offer"])),
|
|
2593
|
+
title: import_effect18.Schema.optionalKey(googleBusinessNonblank),
|
|
2594
|
+
startsAt: import_effect18.Schema.optionalKey(googleBusinessLocalTime),
|
|
2595
|
+
endsAt: import_effect18.Schema.optionalKey(googleBusinessLocalTime),
|
|
2596
|
+
couponCode: import_effect18.Schema.optionalKey(googleBusinessNonblank),
|
|
2597
|
+
redeemUrl: import_effect18.Schema.optionalKey(googleBusinessLink),
|
|
2598
|
+
terms: import_effect18.Schema.optionalKey(googleBusinessNonblank),
|
|
2599
|
+
callToAction: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["book", "order", "shop", "learn_more", "sign_up", "call"])),
|
|
2600
|
+
callToActionUrl: import_effect18.Schema.optionalKey(googleBusinessLink)
|
|
2601
|
+
}).annotate({ identifier: "GoogleBusinessFeedSettings" });
|
|
2459
2602
|
var ThreadsFeedSettings = import_effect18.Schema.Struct({
|
|
2460
2603
|
firstComment: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(threadsTextLimit))),
|
|
2461
2604
|
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)))
|
|
@@ -2634,6 +2777,41 @@ var providerSettings = import_effect18.Schema.Union([
|
|
|
2634
2777
|
TikTokFeedSettings,
|
|
2635
2778
|
GoogleBusinessFeedSettings
|
|
2636
2779
|
]);
|
|
2780
|
+
function settingsShapeErrors(issue, depth = 0) {
|
|
2781
|
+
switch (issue._tag) {
|
|
2782
|
+
case "Composite":
|
|
2783
|
+
return issue.issues.reduce((count, child) => count + settingsShapeErrors(child, depth), 0);
|
|
2784
|
+
case "AnyOf":
|
|
2785
|
+
return issue.issues.length === 0 ? 0 : Math.min(...issue.issues.map((child) => settingsShapeErrors(child, depth)));
|
|
2786
|
+
case "Pointer":
|
|
2787
|
+
return settingsShapeErrors(issue.issue, depth + issue.path.length);
|
|
2788
|
+
case "UnexpectedKey":
|
|
2789
|
+
return depth === 1 ? 3 : 2;
|
|
2790
|
+
case "MissingKey":
|
|
2791
|
+
return depth === 1 ? 4 : 1;
|
|
2792
|
+
default:
|
|
2793
|
+
return 0;
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
var createTargetSettings = providerSettings.pipe(import_effect18.Schema.catchDecoding((issue) => {
|
|
2797
|
+
if (issue._tag !== "AnyOf")
|
|
2798
|
+
return import_effect18.Effect.fail(issue);
|
|
2799
|
+
const [first, ...others] = issue.issues;
|
|
2800
|
+
if (!first)
|
|
2801
|
+
return import_effect18.Effect.fail(issue);
|
|
2802
|
+
let closest = first;
|
|
2803
|
+
let fewest = settingsShapeErrors(first);
|
|
2804
|
+
for (const candidate of others) {
|
|
2805
|
+
if (fewest === 0)
|
|
2806
|
+
break;
|
|
2807
|
+
const errors = settingsShapeErrors(candidate);
|
|
2808
|
+
if (errors < fewest) {
|
|
2809
|
+
closest = candidate;
|
|
2810
|
+
fewest = errors;
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
return import_effect18.Effect.fail(closest);
|
|
2814
|
+
}));
|
|
2637
2815
|
var CreatePostTarget = import_effect18.Schema.Struct({
|
|
2638
2816
|
accountId: AccountId,
|
|
2639
2817
|
provider: import_effect18.Schema.optionalKey(Provider),
|
|
@@ -2645,29 +2823,26 @@ var CreatePostTarget = import_effect18.Schema.Struct({
|
|
|
2645
2823
|
queueId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isUUID()).annotate({
|
|
2646
2824
|
description: "Assign this destination to its connected account's schedule queue."
|
|
2647
2825
|
})),
|
|
2648
|
-
settings: import_effect18.Schema.optionalKey(
|
|
2826
|
+
settings: import_effect18.Schema.optionalKey(createTargetSettings)
|
|
2649
2827
|
}).annotate({ identifier: "CreatePostTarget" });
|
|
2650
2828
|
var postText = import_effect18.Schema.Trim.check(import_effect18.Schema.isMaxLength(postTextLimit)).pipe(import_effect18.Schema.annotateEncoded({
|
|
2651
2829
|
description: `At most ${postTextLimit} characters after trimming.`
|
|
2652
2830
|
}));
|
|
2653
2831
|
var postTargets = import_effect18.Schema.Array(PublishTarget).check(import_effect18.Schema.isMaxLength(50));
|
|
2654
|
-
var
|
|
2832
|
+
var PostContent = import_effect18.Schema.Struct({
|
|
2655
2833
|
text: import_effect18.Schema.optionalKey(postText),
|
|
2656
2834
|
targets: import_effect18.Schema.optionalKey(postTargets),
|
|
2657
|
-
media: import_effect18.Schema.optionalKey(MediaInputs)
|
|
2658
|
-
};
|
|
2659
|
-
var PostContent = import_effect18.Schema.Struct(postContent).annotate({
|
|
2660
|
-
identifier: "PostContent"
|
|
2661
|
-
});
|
|
2662
|
-
var PostPreflight = import_effect18.Schema.Struct({
|
|
2663
|
-
...postContent,
|
|
2835
|
+
media: import_effect18.Schema.optionalKey(MediaInputs),
|
|
2664
2836
|
scheduledAt: import_effect18.Schema.optionalKey(ScheduledAt)
|
|
2665
|
-
}).annotate({ identifier: "
|
|
2666
|
-
var
|
|
2667
|
-
text: import_effect18.Schema.optionalKey(postText),
|
|
2837
|
+
}).annotate({ identifier: "PostContent" });
|
|
2838
|
+
var destinationSelectors = {
|
|
2668
2839
|
platforms: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(Provider).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit))),
|
|
2669
2840
|
accounts: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(AccountId).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit))),
|
|
2670
|
-
targets: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(CreatePostTarget).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit)))
|
|
2841
|
+
targets: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(CreatePostTarget).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit)))
|
|
2842
|
+
};
|
|
2843
|
+
var CreatePost = import_effect18.Schema.Struct({
|
|
2844
|
+
text: import_effect18.Schema.optionalKey(postText),
|
|
2845
|
+
...destinationSelectors,
|
|
2671
2846
|
media: import_effect18.Schema.optionalKey(MediaInputs),
|
|
2672
2847
|
scheduledAt: import_effect18.Schema.optionalKey(ScheduledAt),
|
|
2673
2848
|
publishNow: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
|
|
@@ -2675,12 +2850,18 @@ var CreatePost = import_effect18.Schema.Struct({
|
|
|
2675
2850
|
description: "Save the post as a draft without submitting it. Defaults to false."
|
|
2676
2851
|
})
|
|
2677
2852
|
}).annotate({ identifier: "CreatePost" }).annotate({
|
|
2678
|
-
description: "Send
|
|
2853
|
+
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."
|
|
2679
2854
|
});
|
|
2680
2855
|
var UpdatePost = import_effect18.Schema.Struct({
|
|
2681
|
-
|
|
2856
|
+
text: import_effect18.Schema.optionalKey(postText),
|
|
2857
|
+
media: import_effect18.Schema.optionalKey(MediaInputs),
|
|
2858
|
+
scheduledAt: import_effect18.Schema.optionalKey(ScheduleOverride),
|
|
2859
|
+
...destinationSelectors,
|
|
2860
|
+
targets: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(CreatePostTarget).check(import_effect18.Schema.isMaxLength(publishTargetLimit))),
|
|
2682
2861
|
expectedRevision: import_effect18.Schema.optionalKey(revision)
|
|
2683
|
-
}).annotate({ identifier: "UpdatePost" })
|
|
2862
|
+
}).annotate({ identifier: "UpdatePost" }).annotate({
|
|
2863
|
+
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."
|
|
2864
|
+
});
|
|
2684
2865
|
var Post = import_effect18.Schema.Struct({
|
|
2685
2866
|
postId: PostId,
|
|
2686
2867
|
isDraft: import_effect18.Schema.Boolean,
|
|
@@ -2688,6 +2869,9 @@ var Post = import_effect18.Schema.Struct({
|
|
|
2688
2869
|
text: postText,
|
|
2689
2870
|
media: MediaInputs,
|
|
2690
2871
|
targets: postTargets,
|
|
2872
|
+
scheduledAt: import_effect18.Schema.NullOr(ScheduledAt).annotate({
|
|
2873
|
+
description: "The default time for targets without their own scheduledAt. null publishes them when submitted."
|
|
2874
|
+
}),
|
|
2691
2875
|
deliveries: import_effect18.Schema.Array(DeliveryStatus),
|
|
2692
2876
|
status: PostState,
|
|
2693
2877
|
createdAt: import_effect18.Schema.String,
|
|
@@ -3337,6 +3521,31 @@ var InboxReviewList = import_effect21.Schema.Struct({
|
|
|
3337
3521
|
var InboxUnreadCount = import_effect21.Schema.Struct({
|
|
3338
3522
|
unreadCount: import_effect21.Schema.Int
|
|
3339
3523
|
}).annotate({ identifier: "InboxUnreadCount" });
|
|
3524
|
+
var InboxUnavailableReason = import_effect21.Schema.Literals([
|
|
3525
|
+
"provider_subscription_limit",
|
|
3526
|
+
"missing_scopes",
|
|
3527
|
+
"webhook_invalid",
|
|
3528
|
+
"subscription_pending",
|
|
3529
|
+
"plan_required",
|
|
3530
|
+
"insufficient_credit",
|
|
3531
|
+
"spend_cap_reached"
|
|
3532
|
+
]);
|
|
3533
|
+
var InboxUnavailableState = import_effect21.Schema.Struct({
|
|
3534
|
+
reason: InboxUnavailableReason,
|
|
3535
|
+
action: import_effect21.Schema.Literals([
|
|
3536
|
+
"contact_pubnio",
|
|
3537
|
+
"reconnect_account",
|
|
3538
|
+
"wait_for_repair",
|
|
3539
|
+
"upgrade_plan",
|
|
3540
|
+
"add_credit",
|
|
3541
|
+
"raise_spend_cap"
|
|
3542
|
+
])
|
|
3543
|
+
});
|
|
3544
|
+
var InboxDeliveryGap = import_effect21.Schema.Struct({
|
|
3545
|
+
from: import_effect21.Schema.String,
|
|
3546
|
+
to: import_effect21.Schema.String,
|
|
3547
|
+
action: import_effect21.Schema.Literal("review_on_x")
|
|
3548
|
+
});
|
|
3340
3549
|
var InboxChannelCapability = import_effect21.Schema.Struct({
|
|
3341
3550
|
resource: InboxResource,
|
|
3342
3551
|
supported: import_effect21.Schema.Boolean,
|
|
@@ -3349,7 +3558,8 @@ var InboxChannelCapability = import_effect21.Schema.Struct({
|
|
|
3349
3558
|
syncMode: InboxSyncMode,
|
|
3350
3559
|
backfillDays: import_effect21.Schema.Int,
|
|
3351
3560
|
missingScopes: import_effect21.Schema.Array(import_effect21.Schema.String),
|
|
3352
|
-
missingTasks: import_effect21.Schema.Array(import_effect21.Schema.String)
|
|
3561
|
+
missingTasks: import_effect21.Schema.Array(import_effect21.Schema.String),
|
|
3562
|
+
unavailable: import_effect21.Schema.NullOr(InboxUnavailableState)
|
|
3353
3563
|
}).annotate({ identifier: "InboxChannelCapability" });
|
|
3354
3564
|
var InboxAccountCapabilities = import_effect21.Schema.Struct({
|
|
3355
3565
|
accountId: AccountId,
|
|
@@ -3364,6 +3574,7 @@ var InboxAccountCapabilities = import_effect21.Schema.Struct({
|
|
|
3364
3574
|
mentions: InboxChannelCapability,
|
|
3365
3575
|
replyWindow: InboxReplyWindow,
|
|
3366
3576
|
lastSyncError: import_effect21.Schema.NullOr(import_effect21.Schema.String),
|
|
3577
|
+
deliveryGap: import_effect21.Schema.NullOr(InboxDeliveryGap),
|
|
3367
3578
|
checkedAt: import_effect21.Schema.String
|
|
3368
3579
|
}).annotate({ identifier: "InboxAccountCapabilities" });
|
|
3369
3580
|
var InboxCapabilities = import_effect21.Schema.Struct({
|
|
@@ -4276,7 +4487,8 @@ var WorkspaceEventType = import_effect26.Schema.Literals([
|
|
|
4276
4487
|
"billing.credit.topped_up",
|
|
4277
4488
|
"billing.credit.low",
|
|
4278
4489
|
"billing.spend_cap.reached",
|
|
4279
|
-
"billing.invoice.payment_failed"
|
|
4490
|
+
"billing.invoice.payment_failed",
|
|
4491
|
+
"billing.subscription.duplicate_refunded"
|
|
4280
4492
|
]);
|
|
4281
4493
|
var WorkspaceEventEnvelope = import_effect26.Schema.Struct({
|
|
4282
4494
|
id: import_effect26.Schema.String.check(import_effect26.Schema.isUUID()),
|
|
@@ -4857,6 +5069,15 @@ var WebhookEvent = import_effect27.Schema.Union([
|
|
|
4857
5069
|
hostedInvoiceUrl: import_effect27.Schema.NullOr(import_effect27.Schema.String)
|
|
4858
5070
|
})
|
|
4859
5071
|
}),
|
|
5072
|
+
import_effect27.Schema.Struct({
|
|
5073
|
+
...envelope,
|
|
5074
|
+
type: import_effect27.Schema.Literal("billing.subscription.duplicate_refunded"),
|
|
5075
|
+
data: import_effect27.Schema.Struct({
|
|
5076
|
+
subscriptionId: import_effect27.Schema.String,
|
|
5077
|
+
amountRefundedMinor: import_effect27.Schema.Int,
|
|
5078
|
+
currency: import_effect27.Schema.String
|
|
5079
|
+
})
|
|
5080
|
+
}),
|
|
4860
5081
|
import_effect27.Schema.Struct({
|
|
4861
5082
|
...envelope,
|
|
4862
5083
|
type: import_effect27.Schema.Literal("webhook.test"),
|
|
@@ -5040,6 +5261,27 @@ class SeatLimitReached extends import_http_api.HttpApiError.Problem()("SeatLimit
|
|
|
5040
5261
|
}) {
|
|
5041
5262
|
}
|
|
5042
5263
|
|
|
5264
|
+
class PlanRequired extends import_http_api.HttpApiError.Problem()("PlanRequired", {
|
|
5265
|
+
type: "urn:pubnio:problem:plan-required",
|
|
5266
|
+
status: 402,
|
|
5267
|
+
title: "Plan upgrade required"
|
|
5268
|
+
}, {
|
|
5269
|
+
code: import_effect28.Schema.Literal("plan_required"),
|
|
5270
|
+
entitlement: import_effect28.Schema.Literals([
|
|
5271
|
+
"adsInsights",
|
|
5272
|
+
"adsWrite",
|
|
5273
|
+
"analyticsHistory"
|
|
5274
|
+
]),
|
|
5275
|
+
currentPlan: BillingPlanId,
|
|
5276
|
+
minimumPlan: BillingPlanId,
|
|
5277
|
+
fundingUrl: import_effect28.Schema.String,
|
|
5278
|
+
canManageBilling: import_effect28.Schema.Boolean,
|
|
5279
|
+
nextAction: import_effect28.Schema.String,
|
|
5280
|
+
param: import_effect28.Schema.optionalKey(import_effect28.Schema.String),
|
|
5281
|
+
earliestDate: import_effect28.Schema.optionalKey(import_effect28.Schema.String)
|
|
5282
|
+
}) {
|
|
5283
|
+
}
|
|
5284
|
+
|
|
5043
5285
|
class AlreadyMember extends import_http_api.HttpApiError.Problem()("AlreadyMember", {
|
|
5044
5286
|
type: "urn:pubnio:problem:already-member",
|
|
5045
5287
|
status: 409,
|
|
@@ -5229,6 +5471,17 @@ class DestinationAlreadySubmitted extends import_http_api.HttpApiError.Problem()
|
|
|
5229
5471
|
}) {
|
|
5230
5472
|
}
|
|
5231
5473
|
|
|
5474
|
+
class PostSubmitted extends import_http_api.HttpApiError.Problem()("PostSubmitted", {
|
|
5475
|
+
type: "urn:pubnio:problem:post-submitted",
|
|
5476
|
+
status: 409,
|
|
5477
|
+
title: "Post already submitted"
|
|
5478
|
+
}, {
|
|
5479
|
+
code: import_effect28.Schema.Literal("post_submitted"),
|
|
5480
|
+
targetIds: import_effect28.Schema.Array(TargetId),
|
|
5481
|
+
nextAction: import_effect28.Schema.String
|
|
5482
|
+
}) {
|
|
5483
|
+
}
|
|
5484
|
+
|
|
5232
5485
|
class DeliveryNotRetryable extends import_http_api.HttpApiError.Problem()("DeliveryNotRetryable", {
|
|
5233
5486
|
type: "urn:pubnio:problem:delivery-not-retryable",
|
|
5234
5487
|
status: 409,
|
|
@@ -5511,7 +5764,15 @@ class InboxUnsupportedContent extends import_http_api.HttpApiError.Problem()("In
|
|
|
5511
5764
|
capability: ProductCapability
|
|
5512
5765
|
}) {
|
|
5513
5766
|
}
|
|
5767
|
+
|
|
5768
|
+
class InboxUnavailable extends import_http_api.HttpApiError.Problem()("InboxUnavailable", {
|
|
5769
|
+
type: "urn:pubnio:problem:inbox-unavailable",
|
|
5770
|
+
status: 409,
|
|
5771
|
+
title: "Inbox unavailable"
|
|
5772
|
+
}, InboxUnavailableState.fields) {
|
|
5773
|
+
}
|
|
5514
5774
|
var InboxProblems = [
|
|
5775
|
+
InboxUnavailable,
|
|
5515
5776
|
InboxReplyWindowClosed,
|
|
5516
5777
|
InboxTargetChanged,
|
|
5517
5778
|
InboxSyncInProgress,
|
|
@@ -5726,6 +5987,7 @@ var PublishProblems = [
|
|
|
5726
5987
|
AttemptChanged,
|
|
5727
5988
|
IdempotencyConflict,
|
|
5728
5989
|
DestinationAlreadySubmitted,
|
|
5990
|
+
PostSubmitted,
|
|
5729
5991
|
DeliveryNotRetryable,
|
|
5730
5992
|
DeliveryNotReconcilable,
|
|
5731
5993
|
DeliveryScheduleLocked,
|
|
@@ -5752,7 +6014,8 @@ var AdsProblems = [
|
|
|
5752
6014
|
AdKillSwitchActive,
|
|
5753
6015
|
AdOperationNotRetryable,
|
|
5754
6016
|
AdProviderRejected,
|
|
5755
|
-
InvalidAdRequest
|
|
6017
|
+
InvalidAdRequest,
|
|
6018
|
+
PlanRequired
|
|
5756
6019
|
];
|
|
5757
6020
|
var SchedulingProblems = [
|
|
5758
6021
|
QueueNotFound,
|
|
@@ -6183,7 +6446,7 @@ var import_http = require("effect/http");
|
|
|
6183
6446
|
// package.json
|
|
6184
6447
|
var package_default = {
|
|
6185
6448
|
name: "@pubnio/sdk",
|
|
6186
|
-
version: "0.
|
|
6449
|
+
version: "0.4.0",
|
|
6187
6450
|
description: "JavaScript and TypeScript client for the PubNio API",
|
|
6188
6451
|
type: "module",
|
|
6189
6452
|
exports: {
|
|
@@ -7850,6 +8113,15 @@ var postsCreate = (options) => (options.client ?? client).post({
|
|
|
7850
8113
|
...options.headers
|
|
7851
8114
|
}
|
|
7852
8115
|
});
|
|
8116
|
+
var postsValidateBody = (options) => (options.client ?? client).post({
|
|
8117
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
8118
|
+
url: "/api/v1/posts/validate",
|
|
8119
|
+
...options,
|
|
8120
|
+
headers: {
|
|
8121
|
+
"Content-Type": "application/json",
|
|
8122
|
+
...options.headers
|
|
8123
|
+
}
|
|
8124
|
+
});
|
|
7853
8125
|
var postsDelete = (options) => (options.client ?? client).delete({
|
|
7854
8126
|
security: [{ scheme: "bearer", type: "http" }],
|
|
7855
8127
|
url: "/api/v1/posts/{postId}",
|
|
@@ -8702,7 +8974,7 @@ function createPubNioClient({
|
|
|
8702
8974
|
return withIdempotencyKey(idempotencyKey, async () => {
|
|
8703
8975
|
const body = post;
|
|
8704
8976
|
if (post.isDraft) {
|
|
8705
|
-
return decode(
|
|
8977
|
+
return decode(PostCreated, postsCreate({
|
|
8706
8978
|
client,
|
|
8707
8979
|
query: { workspaceId },
|
|
8708
8980
|
headers: { "idempotency-key": idempotencyKey },
|
|
@@ -9387,7 +9659,16 @@ function createPubNioClient({
|
|
|
9387
9659
|
query: { workspaceId },
|
|
9388
9660
|
...transport()
|
|
9389
9661
|
})),
|
|
9390
|
-
|
|
9662
|
+
validateBody: (input) => {
|
|
9663
|
+
const body = input;
|
|
9664
|
+
return decode(PostValidation, postsValidateBody({
|
|
9665
|
+
client,
|
|
9666
|
+
query: { workspaceId },
|
|
9667
|
+
body,
|
|
9668
|
+
...transport()
|
|
9669
|
+
}));
|
|
9670
|
+
},
|
|
9671
|
+
publish: (postId, input = {}) => {
|
|
9391
9672
|
const { idempotencyKey = crypto.randomUUID(), ...publish } = input;
|
|
9392
9673
|
return withIdempotencyKey(idempotencyKey, async () => {
|
|
9393
9674
|
const accepted = await decode(PublishAccepted, postsPublish({
|
|
@@ -9398,7 +9679,7 @@ function createPubNioClient({
|
|
|
9398
9679
|
body: {
|
|
9399
9680
|
expectedRevision: publish.expectedRevision,
|
|
9400
9681
|
scheduledAt: publish.scheduledAt,
|
|
9401
|
-
|
|
9682
|
+
accounts: publish.accounts && [...publish.accounts],
|
|
9402
9683
|
targets: publish.targets && [...publish.targets]
|
|
9403
9684
|
},
|
|
9404
9685
|
...transport()
|