@pubnio/sdk 0.2.12 → 0.3.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 +280 -15
- package/dist/index.d.cts +582 -25
- package/dist/index.d.ts +582 -25
- package/dist/index.js +281 -16
- package/dist/internal.cjs +280 -15
- package/dist/internal.d.cts +814 -103
- package/dist/internal.d.ts +814 -103
- package/dist/internal.js +281 -16
- package/dist/solid.cjs +280 -15
- package/dist/solid.d.cts +1024 -273
- package/dist/solid.d.ts +1024 -273
- package/dist/solid.js +281 -16
- 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
|
|
@@ -616,7 +620,10 @@ var DeliveryIssue = import_effect8.Schema.Literals([
|
|
|
616
620
|
"tiktok_settings_not_allowed",
|
|
617
621
|
"tiktok_processing_failed",
|
|
618
622
|
"submission_uncertain",
|
|
619
|
-
"confirmation_unavailable"
|
|
623
|
+
"confirmation_unavailable",
|
|
624
|
+
"billing_inactive",
|
|
625
|
+
"spend_cap_reached",
|
|
626
|
+
"insufficient_credit"
|
|
620
627
|
]);
|
|
621
628
|
var FirstCommentStatus = import_effect8.Schema.Literals([
|
|
622
629
|
"pending",
|
|
@@ -715,6 +722,7 @@ var BillingSubscriptionStatus = import_effect9.Schema.Literals([
|
|
|
715
722
|
var UsageMeter = import_effect9.Schema.Literals([
|
|
716
723
|
"confirmed_publish",
|
|
717
724
|
"x_passthrough",
|
|
725
|
+
"x_read",
|
|
718
726
|
"managed_ad",
|
|
719
727
|
"inbox_reply",
|
|
720
728
|
"automation_run"
|
|
@@ -731,10 +739,15 @@ var BillingPlan = import_effect9.Schema.Struct({
|
|
|
731
739
|
monthlyPrice: import_effect9.Schema.NullOr(Money),
|
|
732
740
|
annualPrice: import_effect9.Schema.NullOr(Money),
|
|
733
741
|
meters: import_effect9.Schema.Array(BillingPlanMeter),
|
|
742
|
+
xReads: import_effect9.Schema.Boolean,
|
|
743
|
+
includedXReadMicros: import_effect9.Schema.NullOr(import_effect9.Schema.Int),
|
|
734
744
|
seatsLimit: import_effect9.Schema.NullOr(import_effect9.Schema.Int),
|
|
735
745
|
analyticsRetentionDays: import_effect9.Schema.Int,
|
|
736
746
|
whiteLabelOAuth: import_effect9.Schema.Boolean,
|
|
737
|
-
ssoSaml: import_effect9.Schema.Boolean
|
|
747
|
+
ssoSaml: import_effect9.Schema.Boolean,
|
|
748
|
+
priorityQueue: import_effect9.Schema.Boolean,
|
|
749
|
+
adsInsights: import_effect9.Schema.Boolean,
|
|
750
|
+
adsWrite: import_effect9.Schema.Boolean
|
|
738
751
|
}).annotate({ identifier: "BillingPlan" });
|
|
739
752
|
var BillingPlanList = import_effect9.Schema.Struct({
|
|
740
753
|
data: import_effect9.Schema.Array(BillingPlan)
|
|
@@ -770,6 +783,8 @@ var WorkspaceBilling = import_effect9.Schema.Struct({
|
|
|
770
783
|
creditBalance: Money,
|
|
771
784
|
spendControls: BillingSpendControls,
|
|
772
785
|
currentPeriod: import_effect9.Schema.Struct({
|
|
786
|
+
start: import_effect9.Schema.String,
|
|
787
|
+
end: import_effect9.Schema.String,
|
|
773
788
|
meters: import_effect9.Schema.Array(BillingMeterUsage),
|
|
774
789
|
totalVariableSpendMicros: import_effect9.Schema.Int,
|
|
775
790
|
seatsUsed: import_effect9.Schema.Int,
|
|
@@ -1911,7 +1926,51 @@ var ApiLimits = import_effect15.Schema.Struct({
|
|
|
1911
1926
|
media: MediaLimits,
|
|
1912
1927
|
rateLimits: RateLimits
|
|
1913
1928
|
}).annotate({ identifier: "ApiLimits" });
|
|
1929
|
+
var pollOptionCount = { minOptions: 2, maxOptions: 4 };
|
|
1930
|
+
var xPollLimits = {
|
|
1931
|
+
...pollOptionCount,
|
|
1932
|
+
optionCharacters: 25,
|
|
1933
|
+
minDurationMinutes: 5,
|
|
1934
|
+
maxDurationMinutes: 10080
|
|
1935
|
+
};
|
|
1936
|
+
var linkedinPollLimits = {
|
|
1937
|
+
...pollOptionCount,
|
|
1938
|
+
questionCharacters: 140,
|
|
1939
|
+
optionCharacters: 30,
|
|
1940
|
+
durations: ["ONE_DAY", "THREE_DAYS", "SEVEN_DAYS", "FOURTEEN_DAYS"]
|
|
1941
|
+
};
|
|
1942
|
+
var xReplySettings = [
|
|
1943
|
+
"following",
|
|
1944
|
+
"mentionedUsers",
|
|
1945
|
+
"subscribers",
|
|
1946
|
+
"verified"
|
|
1947
|
+
];
|
|
1948
|
+
var xMediaTagLimit = 10;
|
|
1949
|
+
var pollOptionLimits = {
|
|
1950
|
+
minOptions: import_effect15.Schema.Int,
|
|
1951
|
+
maxOptions: import_effect15.Schema.Int,
|
|
1952
|
+
optionCharacters: import_effect15.Schema.Int
|
|
1953
|
+
};
|
|
1954
|
+
var FeedSettingsCapability = import_effect15.Schema.Struct({
|
|
1955
|
+
poll: import_effect15.Schema.Union([
|
|
1956
|
+
import_effect15.Schema.Struct({
|
|
1957
|
+
...pollOptionLimits,
|
|
1958
|
+
minDurationMinutes: import_effect15.Schema.Int,
|
|
1959
|
+
maxDurationMinutes: import_effect15.Schema.Int
|
|
1960
|
+
}),
|
|
1961
|
+
import_effect15.Schema.Struct({
|
|
1962
|
+
...pollOptionLimits,
|
|
1963
|
+
questionCharacters: import_effect15.Schema.Int,
|
|
1964
|
+
durations: import_effect15.Schema.Array(import_effect15.Schema.Literals(linkedinPollLimits.durations))
|
|
1965
|
+
})
|
|
1966
|
+
]),
|
|
1967
|
+
replySettings: import_effect15.Schema.optionalKey(import_effect15.Schema.Array(import_effect15.Schema.Literals(xReplySettings))),
|
|
1968
|
+
maxMediaTags: import_effect15.Schema.optionalKey(import_effect15.Schema.Int),
|
|
1969
|
+
placeId: import_effect15.Schema.optionalKey(import_effect15.Schema.Boolean),
|
|
1970
|
+
quotePostId: import_effect15.Schema.optionalKey(import_effect15.Schema.Boolean)
|
|
1971
|
+
});
|
|
1914
1972
|
var PlacementCapability = import_effect15.Schema.Struct({
|
|
1973
|
+
settings: import_effect15.Schema.optionalKey(FeedSettingsCapability),
|
|
1915
1974
|
placement: PublishPlacement,
|
|
1916
1975
|
default: import_effect15.Schema.Boolean,
|
|
1917
1976
|
mediaTypes: import_effect15.Schema.Array(MediaType),
|
|
@@ -2209,6 +2268,12 @@ var OAuthFailureReason = import_effect17.Schema.Literals([
|
|
|
2209
2268
|
"connection_changed",
|
|
2210
2269
|
"connection_failed"
|
|
2211
2270
|
]);
|
|
2271
|
+
var ConnectionEmptyReason = import_effect17.Schema.Literals([
|
|
2272
|
+
"pages_permission_declined",
|
|
2273
|
+
"no_pages",
|
|
2274
|
+
"granted_pages_not_listed",
|
|
2275
|
+
"business_assets_unavailable"
|
|
2276
|
+
]);
|
|
2212
2277
|
var attempt2 = { attemptId: uuid3, provider: AccountProvider };
|
|
2213
2278
|
var ConnectionStatus = import_effect17.Schema.Union([
|
|
2214
2279
|
import_effect17.Schema.Struct({
|
|
@@ -2279,6 +2344,11 @@ var import_effect28 = require("effect");
|
|
|
2279
2344
|
var import_effect18 = require("effect");
|
|
2280
2345
|
var postTextLimit = 128000;
|
|
2281
2346
|
var threadPostTextLimit = 1250;
|
|
2347
|
+
var blueskyPostMaxBytes = 3000;
|
|
2348
|
+
var graphemeSegmenter = new Intl.Segmenter(undefined, {
|
|
2349
|
+
granularity: "grapheme"
|
|
2350
|
+
});
|
|
2351
|
+
var utf8 = new TextEncoder;
|
|
2282
2352
|
var redditTitleMaxLength = 300;
|
|
2283
2353
|
var threadsTextLimit = 500;
|
|
2284
2354
|
var xArticleTitleMaxLength = 100;
|
|
@@ -2386,12 +2456,34 @@ var InstagramStorySettings = import_effect18.Schema.Struct({
|
|
|
2386
2456
|
muteAudio: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
|
|
2387
2457
|
userTags: instagramTags
|
|
2388
2458
|
}).annotate({ identifier: "InstagramStorySettings" });
|
|
2459
|
+
var blueskyPostText = import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(blueskyPostMaxBytes));
|
|
2389
2460
|
var BlueskyFeedSettings = import_effect18.Schema.Struct({
|
|
2390
|
-
firstComment: import_effect18.Schema.optionalKey(
|
|
2391
|
-
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(
|
|
2461
|
+
firstComment: import_effect18.Schema.optionalKey(blueskyPostText),
|
|
2462
|
+
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(blueskyPostText).check(import_effect18.Schema.isMaxLength(24))),
|
|
2392
2463
|
altText: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(1000)))
|
|
2393
2464
|
}).annotate({ identifier: "BlueskyFeedSettings" });
|
|
2465
|
+
var nonblank = import_effect18.Schema.makeFilter((value) => value.trim().length > 0 || "Supply a nonblank string.", { toJsonSchema: () => ({ pattern: "\\S" }) });
|
|
2466
|
+
function pollText(maximum) {
|
|
2467
|
+
return import_effect18.Schema.String.check(import_effect18.Schema.isBetweenCodePoints(1, maximum, {
|
|
2468
|
+
expected: `between 1 and ${maximum} characters`
|
|
2469
|
+
}), nonblank);
|
|
2470
|
+
}
|
|
2471
|
+
function pollOptions({
|
|
2472
|
+
minOptions,
|
|
2473
|
+
maxOptions,
|
|
2474
|
+
optionCharacters
|
|
2475
|
+
}) {
|
|
2476
|
+
return import_effect18.Schema.Array(pollText(optionCharacters)).check(import_effect18.Schema.isMinLength(minOptions), import_effect18.Schema.isMaxLength(maxOptions));
|
|
2477
|
+
}
|
|
2478
|
+
var LinkedInPoll = import_effect18.Schema.Struct({
|
|
2479
|
+
question: pollText(linkedinPollLimits.questionCharacters),
|
|
2480
|
+
options: pollOptions(linkedinPollLimits),
|
|
2481
|
+
duration: import_effect18.Schema.Literals(linkedinPollLimits.durations)
|
|
2482
|
+
}).annotate({
|
|
2483
|
+
description: "Organic LinkedIn poll. Include post text and omit media, altText, and documentTitle."
|
|
2484
|
+
});
|
|
2394
2485
|
var LinkedInFeedSettings = import_effect18.Schema.Struct({
|
|
2486
|
+
poll: import_effect18.Schema.optionalKey(LinkedInPoll),
|
|
2395
2487
|
firstComment: import_effect18.Schema.optionalKey(text),
|
|
2396
2488
|
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))),
|
|
2397
2489
|
visibility: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["PUBLIC", "CONNECTIONS"])),
|
|
@@ -2428,6 +2520,7 @@ var YouTubeVideoSettings = import_effect18.Schema.Struct({
|
|
|
2428
2520
|
title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(100)),
|
|
2429
2521
|
description: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(5000))),
|
|
2430
2522
|
privacyStatus: import_effect18.Schema.Literals(["public", "unlisted", "private"]),
|
|
2523
|
+
firstComment: import_effect18.Schema.optionalKey(text),
|
|
2431
2524
|
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))),
|
|
2432
2525
|
categoryId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^\d{1,3}$/))),
|
|
2433
2526
|
madeForKids: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
|
|
@@ -2442,14 +2535,66 @@ var XArticleDraftSettings = import_effect18.Schema.Struct({
|
|
|
2442
2535
|
title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleTitleMaxLength)),
|
|
2443
2536
|
content: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleContentMaxLength))
|
|
2444
2537
|
}).annotate({ identifier: "XArticleDraftSettings" });
|
|
2538
|
+
var XPoll = import_effect18.Schema.Struct({
|
|
2539
|
+
options: pollOptions(xPollLimits),
|
|
2540
|
+
durationMinutes: import_effect18.Schema.Number.check(import_effect18.Schema.isInt({ expected: "an integer number of minutes" }), import_effect18.Schema.isBetween({
|
|
2541
|
+
minimum: xPollLimits.minDurationMinutes,
|
|
2542
|
+
maximum: xPollLimits.maxDurationMinutes
|
|
2543
|
+
}, {
|
|
2544
|
+
expected: `between ${xPollLimits.minDurationMinutes} and ${xPollLimits.maxDurationMinutes} minutes`
|
|
2545
|
+
}))
|
|
2546
|
+
}).annotate({
|
|
2547
|
+
description: "X poll on the root post. Include post text and omit attachments."
|
|
2548
|
+
});
|
|
2549
|
+
var xPostOptionId = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^[0-9]{1,19}$/, {
|
|
2550
|
+
expected: "an X ID string of 1 to 19 digits"
|
|
2551
|
+
}));
|
|
2445
2552
|
var XFeedSettings = import_effect18.Schema.Struct({
|
|
2553
|
+
poll: import_effect18.Schema.optionalKey(XPoll),
|
|
2554
|
+
replySettings: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(xReplySettings).annotate({
|
|
2555
|
+
description: "Who may reply to the root X post. Omit for the provider default."
|
|
2556
|
+
})),
|
|
2557
|
+
quotePostId: import_effect18.Schema.optionalKey(xPostOptionId.annotate({
|
|
2558
|
+
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."
|
|
2559
|
+
})),
|
|
2560
|
+
mediaTaggedUserIds: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(xPostOptionId).check(import_effect18.Schema.isMaxLength(xMediaTagLimit)).annotate({
|
|
2561
|
+
description: "X user ID strings to tag on root post photos (JPEG, PNG, or WebP)."
|
|
2562
|
+
})),
|
|
2563
|
+
placeId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isTrimmed({
|
|
2564
|
+
expected: "an X Place ID without surrounding whitespace"
|
|
2565
|
+
}), nonblank).annotate({
|
|
2566
|
+
description: "Opaque X Place ID such as geo.place_id from a post lookup."
|
|
2567
|
+
})),
|
|
2446
2568
|
firstComment: import_effect18.Schema.optionalKey(text),
|
|
2447
|
-
thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(
|
|
2569
|
+
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))),
|
|
2448
2570
|
article: import_effect18.Schema.optionalKey(XArticleDraftSettings)
|
|
2449
2571
|
}).annotate({ identifier: "XFeedSettings" });
|
|
2450
|
-
var
|
|
2451
|
-
|
|
2452
|
-
|
|
2572
|
+
var googleBusinessLocalTimeFormat = "Use a valid location-local date and time in YYYY-MM-DDTHH:MM format.";
|
|
2573
|
+
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]$/, {
|
|
2574
|
+
message: googleBusinessLocalTimeFormat
|
|
2575
|
+
}), import_effect18.Schema.makeFilter((value) => {
|
|
2576
|
+
const year = Number(value.slice(0, 4));
|
|
2577
|
+
const date = new Date(`${value}:00Z`);
|
|
2578
|
+
return year > 0 && date.getUTCMonth() + 1 === Number(value.slice(5, 7)) && date.getUTCDate() === Number(value.slice(8, 10)) || googleBusinessLocalTimeFormat;
|
|
2579
|
+
})).annotate({ description: googleBusinessLocalTimeFormat });
|
|
2580
|
+
var googleBusinessNonblank = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/\S/, {
|
|
2581
|
+
message: "Enter a string with non-whitespace content."
|
|
2582
|
+
}));
|
|
2583
|
+
var googleBusinessLink = MediaUrl.annotate({
|
|
2584
|
+
description: "Use an HTTPS URL of at most 2,048 characters without embedded credentials.",
|
|
2585
|
+
message: "Use an HTTPS URL of at most 2,048 characters without embedded credentials."
|
|
2586
|
+
});
|
|
2587
|
+
var GoogleBusinessFeedSettings = import_effect18.Schema.Struct({
|
|
2588
|
+
topicType: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["standard", "event", "offer"])),
|
|
2589
|
+
title: import_effect18.Schema.optionalKey(googleBusinessNonblank),
|
|
2590
|
+
startsAt: import_effect18.Schema.optionalKey(googleBusinessLocalTime),
|
|
2591
|
+
endsAt: import_effect18.Schema.optionalKey(googleBusinessLocalTime),
|
|
2592
|
+
couponCode: import_effect18.Schema.optionalKey(googleBusinessNonblank),
|
|
2593
|
+
redeemUrl: import_effect18.Schema.optionalKey(googleBusinessLink),
|
|
2594
|
+
terms: import_effect18.Schema.optionalKey(googleBusinessNonblank),
|
|
2595
|
+
callToAction: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["book", "order", "shop", "learn_more", "sign_up", "call"])),
|
|
2596
|
+
callToActionUrl: import_effect18.Schema.optionalKey(googleBusinessLink)
|
|
2597
|
+
}).annotate({ identifier: "GoogleBusinessFeedSettings" });
|
|
2453
2598
|
var ThreadsFeedSettings = import_effect18.Schema.Struct({
|
|
2454
2599
|
firstComment: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(threadsTextLimit))),
|
|
2455
2600
|
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)))
|
|
@@ -2628,6 +2773,41 @@ var providerSettings = import_effect18.Schema.Union([
|
|
|
2628
2773
|
TikTokFeedSettings,
|
|
2629
2774
|
GoogleBusinessFeedSettings
|
|
2630
2775
|
]);
|
|
2776
|
+
function settingsShapeErrors(issue, depth = 0) {
|
|
2777
|
+
switch (issue._tag) {
|
|
2778
|
+
case "Composite":
|
|
2779
|
+
return issue.issues.reduce((count, child) => count + settingsShapeErrors(child, depth), 0);
|
|
2780
|
+
case "AnyOf":
|
|
2781
|
+
return issue.issues.length === 0 ? 0 : Math.min(...issue.issues.map((child) => settingsShapeErrors(child, depth)));
|
|
2782
|
+
case "Pointer":
|
|
2783
|
+
return settingsShapeErrors(issue.issue, depth + issue.path.length);
|
|
2784
|
+
case "UnexpectedKey":
|
|
2785
|
+
return depth === 1 ? 3 : 2;
|
|
2786
|
+
case "MissingKey":
|
|
2787
|
+
return depth === 1 ? 4 : 1;
|
|
2788
|
+
default:
|
|
2789
|
+
return 0;
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
var createTargetSettings = providerSettings.pipe(import_effect18.Schema.catchDecoding((issue) => {
|
|
2793
|
+
if (issue._tag !== "AnyOf")
|
|
2794
|
+
return import_effect18.Effect.fail(issue);
|
|
2795
|
+
const [first, ...others] = issue.issues;
|
|
2796
|
+
if (!first)
|
|
2797
|
+
return import_effect18.Effect.fail(issue);
|
|
2798
|
+
let closest = first;
|
|
2799
|
+
let fewest = settingsShapeErrors(first);
|
|
2800
|
+
for (const candidate of others) {
|
|
2801
|
+
if (fewest === 0)
|
|
2802
|
+
break;
|
|
2803
|
+
const errors = settingsShapeErrors(candidate);
|
|
2804
|
+
if (errors < fewest) {
|
|
2805
|
+
closest = candidate;
|
|
2806
|
+
fewest = errors;
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
return import_effect18.Effect.fail(closest);
|
|
2810
|
+
}));
|
|
2631
2811
|
var CreatePostTarget = import_effect18.Schema.Struct({
|
|
2632
2812
|
accountId: AccountId,
|
|
2633
2813
|
provider: import_effect18.Schema.optionalKey(Provider),
|
|
@@ -2639,7 +2819,7 @@ var CreatePostTarget = import_effect18.Schema.Struct({
|
|
|
2639
2819
|
queueId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isUUID()).annotate({
|
|
2640
2820
|
description: "Assign this destination to its connected account's schedule queue."
|
|
2641
2821
|
})),
|
|
2642
|
-
settings: import_effect18.Schema.optionalKey(
|
|
2822
|
+
settings: import_effect18.Schema.optionalKey(createTargetSettings)
|
|
2643
2823
|
}).annotate({ identifier: "CreatePostTarget" });
|
|
2644
2824
|
var postText = import_effect18.Schema.Trim.check(import_effect18.Schema.isMaxLength(postTextLimit)).pipe(import_effect18.Schema.annotateEncoded({
|
|
2645
2825
|
description: `At most ${postTextLimit} characters after trimming.`
|
|
@@ -3331,6 +3511,31 @@ var InboxReviewList = import_effect21.Schema.Struct({
|
|
|
3331
3511
|
var InboxUnreadCount = import_effect21.Schema.Struct({
|
|
3332
3512
|
unreadCount: import_effect21.Schema.Int
|
|
3333
3513
|
}).annotate({ identifier: "InboxUnreadCount" });
|
|
3514
|
+
var InboxUnavailableReason = import_effect21.Schema.Literals([
|
|
3515
|
+
"provider_subscription_limit",
|
|
3516
|
+
"missing_scopes",
|
|
3517
|
+
"webhook_invalid",
|
|
3518
|
+
"subscription_pending",
|
|
3519
|
+
"plan_required",
|
|
3520
|
+
"insufficient_credit",
|
|
3521
|
+
"spend_cap_reached"
|
|
3522
|
+
]);
|
|
3523
|
+
var InboxUnavailableState = import_effect21.Schema.Struct({
|
|
3524
|
+
reason: InboxUnavailableReason,
|
|
3525
|
+
action: import_effect21.Schema.Literals([
|
|
3526
|
+
"contact_pubnio",
|
|
3527
|
+
"reconnect_account",
|
|
3528
|
+
"wait_for_repair",
|
|
3529
|
+
"upgrade_plan",
|
|
3530
|
+
"add_credit",
|
|
3531
|
+
"raise_spend_cap"
|
|
3532
|
+
])
|
|
3533
|
+
});
|
|
3534
|
+
var InboxDeliveryGap = import_effect21.Schema.Struct({
|
|
3535
|
+
from: import_effect21.Schema.String,
|
|
3536
|
+
to: import_effect21.Schema.String,
|
|
3537
|
+
action: import_effect21.Schema.Literal("review_on_x")
|
|
3538
|
+
});
|
|
3334
3539
|
var InboxChannelCapability = import_effect21.Schema.Struct({
|
|
3335
3540
|
resource: InboxResource,
|
|
3336
3541
|
supported: import_effect21.Schema.Boolean,
|
|
@@ -3343,7 +3548,8 @@ var InboxChannelCapability = import_effect21.Schema.Struct({
|
|
|
3343
3548
|
syncMode: InboxSyncMode,
|
|
3344
3549
|
backfillDays: import_effect21.Schema.Int,
|
|
3345
3550
|
missingScopes: import_effect21.Schema.Array(import_effect21.Schema.String),
|
|
3346
|
-
missingTasks: import_effect21.Schema.Array(import_effect21.Schema.String)
|
|
3551
|
+
missingTasks: import_effect21.Schema.Array(import_effect21.Schema.String),
|
|
3552
|
+
unavailable: import_effect21.Schema.NullOr(InboxUnavailableState)
|
|
3347
3553
|
}).annotate({ identifier: "InboxChannelCapability" });
|
|
3348
3554
|
var InboxAccountCapabilities = import_effect21.Schema.Struct({
|
|
3349
3555
|
accountId: AccountId,
|
|
@@ -3358,6 +3564,7 @@ var InboxAccountCapabilities = import_effect21.Schema.Struct({
|
|
|
3358
3564
|
mentions: InboxChannelCapability,
|
|
3359
3565
|
replyWindow: InboxReplyWindow,
|
|
3360
3566
|
lastSyncError: import_effect21.Schema.NullOr(import_effect21.Schema.String),
|
|
3567
|
+
deliveryGap: import_effect21.Schema.NullOr(InboxDeliveryGap),
|
|
3361
3568
|
checkedAt: import_effect21.Schema.String
|
|
3362
3569
|
}).annotate({ identifier: "InboxAccountCapabilities" });
|
|
3363
3570
|
var InboxCapabilities = import_effect21.Schema.Struct({
|
|
@@ -4270,7 +4477,8 @@ var WorkspaceEventType = import_effect26.Schema.Literals([
|
|
|
4270
4477
|
"billing.credit.topped_up",
|
|
4271
4478
|
"billing.credit.low",
|
|
4272
4479
|
"billing.spend_cap.reached",
|
|
4273
|
-
"billing.invoice.payment_failed"
|
|
4480
|
+
"billing.invoice.payment_failed",
|
|
4481
|
+
"billing.subscription.duplicate_refunded"
|
|
4274
4482
|
]);
|
|
4275
4483
|
var WorkspaceEventEnvelope = import_effect26.Schema.Struct({
|
|
4276
4484
|
id: import_effect26.Schema.String.check(import_effect26.Schema.isUUID()),
|
|
@@ -4851,6 +5059,15 @@ var WebhookEvent = import_effect27.Schema.Union([
|
|
|
4851
5059
|
hostedInvoiceUrl: import_effect27.Schema.NullOr(import_effect27.Schema.String)
|
|
4852
5060
|
})
|
|
4853
5061
|
}),
|
|
5062
|
+
import_effect27.Schema.Struct({
|
|
5063
|
+
...envelope,
|
|
5064
|
+
type: import_effect27.Schema.Literal("billing.subscription.duplicate_refunded"),
|
|
5065
|
+
data: import_effect27.Schema.Struct({
|
|
5066
|
+
subscriptionId: import_effect27.Schema.String,
|
|
5067
|
+
amountRefundedMinor: import_effect27.Schema.Int,
|
|
5068
|
+
currency: import_effect27.Schema.String
|
|
5069
|
+
})
|
|
5070
|
+
}),
|
|
4854
5071
|
import_effect27.Schema.Struct({
|
|
4855
5072
|
...envelope,
|
|
4856
5073
|
type: import_effect27.Schema.Literal("webhook.test"),
|
|
@@ -5034,6 +5251,27 @@ class SeatLimitReached extends import_http_api.HttpApiError.Problem()("SeatLimit
|
|
|
5034
5251
|
}) {
|
|
5035
5252
|
}
|
|
5036
5253
|
|
|
5254
|
+
class PlanRequired extends import_http_api.HttpApiError.Problem()("PlanRequired", {
|
|
5255
|
+
type: "urn:pubnio:problem:plan-required",
|
|
5256
|
+
status: 402,
|
|
5257
|
+
title: "Plan upgrade required"
|
|
5258
|
+
}, {
|
|
5259
|
+
code: import_effect28.Schema.Literal("plan_required"),
|
|
5260
|
+
entitlement: import_effect28.Schema.Literals([
|
|
5261
|
+
"adsInsights",
|
|
5262
|
+
"adsWrite",
|
|
5263
|
+
"analyticsHistory"
|
|
5264
|
+
]),
|
|
5265
|
+
currentPlan: BillingPlanId,
|
|
5266
|
+
minimumPlan: BillingPlanId,
|
|
5267
|
+
fundingUrl: import_effect28.Schema.String,
|
|
5268
|
+
canManageBilling: import_effect28.Schema.Boolean,
|
|
5269
|
+
nextAction: import_effect28.Schema.String,
|
|
5270
|
+
param: import_effect28.Schema.optionalKey(import_effect28.Schema.String),
|
|
5271
|
+
earliestDate: import_effect28.Schema.optionalKey(import_effect28.Schema.String)
|
|
5272
|
+
}) {
|
|
5273
|
+
}
|
|
5274
|
+
|
|
5037
5275
|
class AlreadyMember extends import_http_api.HttpApiError.Problem()("AlreadyMember", {
|
|
5038
5276
|
type: "urn:pubnio:problem:already-member",
|
|
5039
5277
|
status: 409,
|
|
@@ -5505,7 +5743,15 @@ class InboxUnsupportedContent extends import_http_api.HttpApiError.Problem()("In
|
|
|
5505
5743
|
capability: ProductCapability
|
|
5506
5744
|
}) {
|
|
5507
5745
|
}
|
|
5746
|
+
|
|
5747
|
+
class InboxUnavailable extends import_http_api.HttpApiError.Problem()("InboxUnavailable", {
|
|
5748
|
+
type: "urn:pubnio:problem:inbox-unavailable",
|
|
5749
|
+
status: 409,
|
|
5750
|
+
title: "Inbox unavailable"
|
|
5751
|
+
}, InboxUnavailableState.fields) {
|
|
5752
|
+
}
|
|
5508
5753
|
var InboxProblems = [
|
|
5754
|
+
InboxUnavailable,
|
|
5509
5755
|
InboxReplyWindowClosed,
|
|
5510
5756
|
InboxTargetChanged,
|
|
5511
5757
|
InboxSyncInProgress,
|
|
@@ -5746,7 +5992,8 @@ var AdsProblems = [
|
|
|
5746
5992
|
AdKillSwitchActive,
|
|
5747
5993
|
AdOperationNotRetryable,
|
|
5748
5994
|
AdProviderRejected,
|
|
5749
|
-
InvalidAdRequest
|
|
5995
|
+
InvalidAdRequest,
|
|
5996
|
+
PlanRequired
|
|
5750
5997
|
];
|
|
5751
5998
|
var SchedulingProblems = [
|
|
5752
5999
|
QueueNotFound,
|
|
@@ -6177,7 +6424,7 @@ var import_http = require("effect/http");
|
|
|
6177
6424
|
// package.json
|
|
6178
6425
|
var package_default = {
|
|
6179
6426
|
name: "@pubnio/sdk",
|
|
6180
|
-
version: "0.
|
|
6427
|
+
version: "0.3.0",
|
|
6181
6428
|
description: "JavaScript and TypeScript client for the PubNio API",
|
|
6182
6429
|
type: "module",
|
|
6183
6430
|
exports: {
|
|
@@ -7844,6 +8091,15 @@ var postsCreate = (options) => (options.client ?? client).post({
|
|
|
7844
8091
|
...options.headers
|
|
7845
8092
|
}
|
|
7846
8093
|
});
|
|
8094
|
+
var postsValidateBody = (options) => (options.client ?? client).post({
|
|
8095
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
8096
|
+
url: "/api/v1/posts/validate",
|
|
8097
|
+
...options,
|
|
8098
|
+
headers: {
|
|
8099
|
+
"Content-Type": "application/json",
|
|
8100
|
+
...options.headers
|
|
8101
|
+
}
|
|
8102
|
+
});
|
|
7847
8103
|
var postsDelete = (options) => (options.client ?? client).delete({
|
|
7848
8104
|
security: [{ scheme: "bearer", type: "http" }],
|
|
7849
8105
|
url: "/api/v1/posts/{postId}",
|
|
@@ -9381,6 +9637,15 @@ function createPubNioClient({
|
|
|
9381
9637
|
query: { workspaceId },
|
|
9382
9638
|
...transport()
|
|
9383
9639
|
})),
|
|
9640
|
+
validateBody: (input) => {
|
|
9641
|
+
const body = input;
|
|
9642
|
+
return decode(PostValidation, postsValidateBody({
|
|
9643
|
+
client,
|
|
9644
|
+
query: { workspaceId },
|
|
9645
|
+
body,
|
|
9646
|
+
...transport()
|
|
9647
|
+
}));
|
|
9648
|
+
},
|
|
9384
9649
|
publish: (postId, input) => {
|
|
9385
9650
|
const { idempotencyKey = crypto.randomUUID(), ...publish } = input;
|
|
9386
9651
|
return withIdempotencyKey(idempotencyKey, async () => {
|