@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/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
@@ -774,7 +778,10 @@ var DeliveryIssue = import_effect8.Schema.Literals([
774
778
  "tiktok_settings_not_allowed",
775
779
  "tiktok_processing_failed",
776
780
  "submission_uncertain",
777
- "confirmation_unavailable"
781
+ "confirmation_unavailable",
782
+ "billing_inactive",
783
+ "spend_cap_reached",
784
+ "insufficient_credit"
778
785
  ]);
779
786
  var FirstCommentStatus = import_effect8.Schema.Literals([
780
787
  "pending",
@@ -873,6 +880,7 @@ var BillingSubscriptionStatus = import_effect9.Schema.Literals([
873
880
  var UsageMeter = import_effect9.Schema.Literals([
874
881
  "confirmed_publish",
875
882
  "x_passthrough",
883
+ "x_read",
876
884
  "managed_ad",
877
885
  "inbox_reply",
878
886
  "automation_run"
@@ -889,10 +897,15 @@ var BillingPlan = import_effect9.Schema.Struct({
889
897
  monthlyPrice: import_effect9.Schema.NullOr(Money),
890
898
  annualPrice: import_effect9.Schema.NullOr(Money),
891
899
  meters: import_effect9.Schema.Array(BillingPlanMeter),
900
+ xReads: import_effect9.Schema.Boolean,
901
+ includedXReadMicros: import_effect9.Schema.NullOr(import_effect9.Schema.Int),
892
902
  seatsLimit: import_effect9.Schema.NullOr(import_effect9.Schema.Int),
893
903
  analyticsRetentionDays: import_effect9.Schema.Int,
894
904
  whiteLabelOAuth: import_effect9.Schema.Boolean,
895
- ssoSaml: import_effect9.Schema.Boolean
905
+ ssoSaml: import_effect9.Schema.Boolean,
906
+ priorityQueue: import_effect9.Schema.Boolean,
907
+ adsInsights: import_effect9.Schema.Boolean,
908
+ adsWrite: import_effect9.Schema.Boolean
896
909
  }).annotate({ identifier: "BillingPlan" });
897
910
  var BillingPlanList = import_effect9.Schema.Struct({
898
911
  data: import_effect9.Schema.Array(BillingPlan)
@@ -928,6 +941,8 @@ var WorkspaceBilling = import_effect9.Schema.Struct({
928
941
  creditBalance: Money,
929
942
  spendControls: BillingSpendControls,
930
943
  currentPeriod: import_effect9.Schema.Struct({
944
+ start: import_effect9.Schema.String,
945
+ end: import_effect9.Schema.String,
931
946
  meters: import_effect9.Schema.Array(BillingMeterUsage),
932
947
  totalVariableSpendMicros: import_effect9.Schema.Int,
933
948
  seatsUsed: import_effect9.Schema.Int,
@@ -2069,7 +2084,51 @@ var ApiLimits = import_effect15.Schema.Struct({
2069
2084
  media: MediaLimits,
2070
2085
  rateLimits: RateLimits
2071
2086
  }).annotate({ identifier: "ApiLimits" });
2087
+ var pollOptionCount = { minOptions: 2, maxOptions: 4 };
2088
+ var xPollLimits = {
2089
+ ...pollOptionCount,
2090
+ optionCharacters: 25,
2091
+ minDurationMinutes: 5,
2092
+ maxDurationMinutes: 10080
2093
+ };
2094
+ var linkedinPollLimits = {
2095
+ ...pollOptionCount,
2096
+ questionCharacters: 140,
2097
+ optionCharacters: 30,
2098
+ durations: ["ONE_DAY", "THREE_DAYS", "SEVEN_DAYS", "FOURTEEN_DAYS"]
2099
+ };
2100
+ var xReplySettings = [
2101
+ "following",
2102
+ "mentionedUsers",
2103
+ "subscribers",
2104
+ "verified"
2105
+ ];
2106
+ var xMediaTagLimit = 10;
2107
+ var pollOptionLimits = {
2108
+ minOptions: import_effect15.Schema.Int,
2109
+ maxOptions: import_effect15.Schema.Int,
2110
+ optionCharacters: import_effect15.Schema.Int
2111
+ };
2112
+ var FeedSettingsCapability = import_effect15.Schema.Struct({
2113
+ poll: import_effect15.Schema.Union([
2114
+ import_effect15.Schema.Struct({
2115
+ ...pollOptionLimits,
2116
+ minDurationMinutes: import_effect15.Schema.Int,
2117
+ maxDurationMinutes: import_effect15.Schema.Int
2118
+ }),
2119
+ import_effect15.Schema.Struct({
2120
+ ...pollOptionLimits,
2121
+ questionCharacters: import_effect15.Schema.Int,
2122
+ durations: import_effect15.Schema.Array(import_effect15.Schema.Literals(linkedinPollLimits.durations))
2123
+ })
2124
+ ]),
2125
+ replySettings: import_effect15.Schema.optionalKey(import_effect15.Schema.Array(import_effect15.Schema.Literals(xReplySettings))),
2126
+ maxMediaTags: import_effect15.Schema.optionalKey(import_effect15.Schema.Int),
2127
+ placeId: import_effect15.Schema.optionalKey(import_effect15.Schema.Boolean),
2128
+ quotePostId: import_effect15.Schema.optionalKey(import_effect15.Schema.Boolean)
2129
+ });
2072
2130
  var PlacementCapability = import_effect15.Schema.Struct({
2131
+ settings: import_effect15.Schema.optionalKey(FeedSettingsCapability),
2073
2132
  placement: PublishPlacement,
2074
2133
  default: import_effect15.Schema.Boolean,
2075
2134
  mediaTypes: import_effect15.Schema.Array(MediaType),
@@ -2367,6 +2426,12 @@ var OAuthFailureReason = import_effect17.Schema.Literals([
2367
2426
  "connection_changed",
2368
2427
  "connection_failed"
2369
2428
  ]);
2429
+ var ConnectionEmptyReason = import_effect17.Schema.Literals([
2430
+ "pages_permission_declined",
2431
+ "no_pages",
2432
+ "granted_pages_not_listed",
2433
+ "business_assets_unavailable"
2434
+ ]);
2370
2435
  var attempt2 = { attemptId: uuid3, provider: AccountProvider };
2371
2436
  var ConnectionStatus = import_effect17.Schema.Union([
2372
2437
  import_effect17.Schema.Struct({
@@ -2437,6 +2502,11 @@ var import_effect28 = require("effect");
2437
2502
  var import_effect18 = require("effect");
2438
2503
  var postTextLimit = 128000;
2439
2504
  var threadPostTextLimit = 1250;
2505
+ var blueskyPostMaxBytes = 3000;
2506
+ var graphemeSegmenter = new Intl.Segmenter(undefined, {
2507
+ granularity: "grapheme"
2508
+ });
2509
+ var utf8 = new TextEncoder;
2440
2510
  var redditTitleMaxLength = 300;
2441
2511
  var threadsTextLimit = 500;
2442
2512
  var xArticleTitleMaxLength = 100;
@@ -2544,12 +2614,34 @@ var InstagramStorySettings = import_effect18.Schema.Struct({
2544
2614
  muteAudio: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
2545
2615
  userTags: instagramTags
2546
2616
  }).annotate({ identifier: "InstagramStorySettings" });
2617
+ var blueskyPostText = import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(blueskyPostMaxBytes));
2547
2618
  var BlueskyFeedSettings = import_effect18.Schema.Struct({
2548
- firstComment: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(300))),
2549
- thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(300))).check(import_effect18.Schema.isMaxLength(24))),
2619
+ firstComment: import_effect18.Schema.optionalKey(blueskyPostText),
2620
+ thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(blueskyPostText).check(import_effect18.Schema.isMaxLength(24))),
2550
2621
  altText: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(1000)))
2551
2622
  }).annotate({ identifier: "BlueskyFeedSettings" });
2623
+ var nonblank = import_effect18.Schema.makeFilter((value) => value.trim().length > 0 || "Supply a nonblank string.", { toJsonSchema: () => ({ pattern: "\\S" }) });
2624
+ function pollText(maximum) {
2625
+ return import_effect18.Schema.String.check(import_effect18.Schema.isBetweenCodePoints(1, maximum, {
2626
+ expected: `between 1 and ${maximum} characters`
2627
+ }), nonblank);
2628
+ }
2629
+ function pollOptions({
2630
+ minOptions,
2631
+ maxOptions,
2632
+ optionCharacters
2633
+ }) {
2634
+ return import_effect18.Schema.Array(pollText(optionCharacters)).check(import_effect18.Schema.isMinLength(minOptions), import_effect18.Schema.isMaxLength(maxOptions));
2635
+ }
2636
+ var LinkedInPoll = import_effect18.Schema.Struct({
2637
+ question: pollText(linkedinPollLimits.questionCharacters),
2638
+ options: pollOptions(linkedinPollLimits),
2639
+ duration: import_effect18.Schema.Literals(linkedinPollLimits.durations)
2640
+ }).annotate({
2641
+ description: "Organic LinkedIn poll. Include post text and omit media, altText, and documentTitle."
2642
+ });
2552
2643
  var LinkedInFeedSettings = import_effect18.Schema.Struct({
2644
+ poll: import_effect18.Schema.optionalKey(LinkedInPoll),
2553
2645
  firstComment: import_effect18.Schema.optionalKey(text),
2554
2646
  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))),
2555
2647
  visibility: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["PUBLIC", "CONNECTIONS"])),
@@ -2586,6 +2678,7 @@ var YouTubeVideoSettings = import_effect18.Schema.Struct({
2586
2678
  title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(100)),
2587
2679
  description: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(5000))),
2588
2680
  privacyStatus: import_effect18.Schema.Literals(["public", "unlisted", "private"]),
2681
+ firstComment: import_effect18.Schema.optionalKey(text),
2589
2682
  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))),
2590
2683
  categoryId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^\d{1,3}$/))),
2591
2684
  madeForKids: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
@@ -2600,14 +2693,66 @@ var XArticleDraftSettings = import_effect18.Schema.Struct({
2600
2693
  title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleTitleMaxLength)),
2601
2694
  content: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleContentMaxLength))
2602
2695
  }).annotate({ identifier: "XArticleDraftSettings" });
2696
+ var XPoll = import_effect18.Schema.Struct({
2697
+ options: pollOptions(xPollLimits),
2698
+ durationMinutes: import_effect18.Schema.Number.check(import_effect18.Schema.isInt({ expected: "an integer number of minutes" }), import_effect18.Schema.isBetween({
2699
+ minimum: xPollLimits.minDurationMinutes,
2700
+ maximum: xPollLimits.maxDurationMinutes
2701
+ }, {
2702
+ expected: `between ${xPollLimits.minDurationMinutes} and ${xPollLimits.maxDurationMinutes} minutes`
2703
+ }))
2704
+ }).annotate({
2705
+ description: "X poll on the root post. Include post text and omit attachments."
2706
+ });
2707
+ var xPostOptionId = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^[0-9]{1,19}$/, {
2708
+ expected: "an X ID string of 1 to 19 digits"
2709
+ }));
2603
2710
  var XFeedSettings = import_effect18.Schema.Struct({
2711
+ poll: import_effect18.Schema.optionalKey(XPoll),
2712
+ replySettings: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(xReplySettings).annotate({
2713
+ description: "Who may reply to the root X post. Omit for the provider default."
2714
+ })),
2715
+ quotePostId: import_effect18.Schema.optionalKey(xPostOptionId.annotate({
2716
+ 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."
2717
+ })),
2718
+ mediaTaggedUserIds: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(xPostOptionId).check(import_effect18.Schema.isMaxLength(xMediaTagLimit)).annotate({
2719
+ description: "X user ID strings to tag on root post photos (JPEG, PNG, or WebP)."
2720
+ })),
2721
+ placeId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isTrimmed({
2722
+ expected: "an X Place ID without surrounding whitespace"
2723
+ }), nonblank).annotate({
2724
+ description: "Opaque X Place ID such as geo.place_id from a post lookup."
2725
+ })),
2604
2726
  firstComment: import_effect18.Schema.optionalKey(text),
2605
- thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(280))).check(import_effect18.Schema.isMaxLength(24))),
2727
+ 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))),
2606
2728
  article: import_effect18.Schema.optionalKey(XArticleDraftSettings)
2607
2729
  }).annotate({ identifier: "XFeedSettings" });
2608
- var GoogleBusinessFeedSettings = import_effect18.Schema.Struct({}).annotate({
2609
- identifier: "GoogleBusinessFeedSettings"
2610
- });
2730
+ var googleBusinessLocalTimeFormat = "Use a valid location-local date and time in YYYY-MM-DDTHH:MM format.";
2731
+ 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]$/, {
2732
+ message: googleBusinessLocalTimeFormat
2733
+ }), import_effect18.Schema.makeFilter((value) => {
2734
+ const year = Number(value.slice(0, 4));
2735
+ const date = new Date(`${value}:00Z`);
2736
+ return year > 0 && date.getUTCMonth() + 1 === Number(value.slice(5, 7)) && date.getUTCDate() === Number(value.slice(8, 10)) || googleBusinessLocalTimeFormat;
2737
+ })).annotate({ description: googleBusinessLocalTimeFormat });
2738
+ var googleBusinessNonblank = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/\S/, {
2739
+ message: "Enter a string with non-whitespace content."
2740
+ }));
2741
+ var googleBusinessLink = MediaUrl.annotate({
2742
+ description: "Use an HTTPS URL of at most 2,048 characters without embedded credentials.",
2743
+ message: "Use an HTTPS URL of at most 2,048 characters without embedded credentials."
2744
+ });
2745
+ var GoogleBusinessFeedSettings = import_effect18.Schema.Struct({
2746
+ topicType: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["standard", "event", "offer"])),
2747
+ title: import_effect18.Schema.optionalKey(googleBusinessNonblank),
2748
+ startsAt: import_effect18.Schema.optionalKey(googleBusinessLocalTime),
2749
+ endsAt: import_effect18.Schema.optionalKey(googleBusinessLocalTime),
2750
+ couponCode: import_effect18.Schema.optionalKey(googleBusinessNonblank),
2751
+ redeemUrl: import_effect18.Schema.optionalKey(googleBusinessLink),
2752
+ terms: import_effect18.Schema.optionalKey(googleBusinessNonblank),
2753
+ callToAction: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["book", "order", "shop", "learn_more", "sign_up", "call"])),
2754
+ callToActionUrl: import_effect18.Schema.optionalKey(googleBusinessLink)
2755
+ }).annotate({ identifier: "GoogleBusinessFeedSettings" });
2611
2756
  var ThreadsFeedSettings = import_effect18.Schema.Struct({
2612
2757
  firstComment: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(threadsTextLimit))),
2613
2758
  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)))
@@ -2786,6 +2931,41 @@ var providerSettings = import_effect18.Schema.Union([
2786
2931
  TikTokFeedSettings,
2787
2932
  GoogleBusinessFeedSettings
2788
2933
  ]);
2934
+ function settingsShapeErrors(issue, depth = 0) {
2935
+ switch (issue._tag) {
2936
+ case "Composite":
2937
+ return issue.issues.reduce((count, child) => count + settingsShapeErrors(child, depth), 0);
2938
+ case "AnyOf":
2939
+ return issue.issues.length === 0 ? 0 : Math.min(...issue.issues.map((child) => settingsShapeErrors(child, depth)));
2940
+ case "Pointer":
2941
+ return settingsShapeErrors(issue.issue, depth + issue.path.length);
2942
+ case "UnexpectedKey":
2943
+ return depth === 1 ? 3 : 2;
2944
+ case "MissingKey":
2945
+ return depth === 1 ? 4 : 1;
2946
+ default:
2947
+ return 0;
2948
+ }
2949
+ }
2950
+ var createTargetSettings = providerSettings.pipe(import_effect18.Schema.catchDecoding((issue) => {
2951
+ if (issue._tag !== "AnyOf")
2952
+ return import_effect18.Effect.fail(issue);
2953
+ const [first, ...others] = issue.issues;
2954
+ if (!first)
2955
+ return import_effect18.Effect.fail(issue);
2956
+ let closest = first;
2957
+ let fewest = settingsShapeErrors(first);
2958
+ for (const candidate of others) {
2959
+ if (fewest === 0)
2960
+ break;
2961
+ const errors = settingsShapeErrors(candidate);
2962
+ if (errors < fewest) {
2963
+ closest = candidate;
2964
+ fewest = errors;
2965
+ }
2966
+ }
2967
+ return import_effect18.Effect.fail(closest);
2968
+ }));
2789
2969
  var CreatePostTarget = import_effect18.Schema.Struct({
2790
2970
  accountId: AccountId,
2791
2971
  provider: import_effect18.Schema.optionalKey(Provider),
@@ -2797,7 +2977,7 @@ var CreatePostTarget = import_effect18.Schema.Struct({
2797
2977
  queueId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isUUID()).annotate({
2798
2978
  description: "Assign this destination to its connected account's schedule queue."
2799
2979
  })),
2800
- settings: import_effect18.Schema.optionalKey(providerSettings)
2980
+ settings: import_effect18.Schema.optionalKey(createTargetSettings)
2801
2981
  }).annotate({ identifier: "CreatePostTarget" });
2802
2982
  var postText = import_effect18.Schema.Trim.check(import_effect18.Schema.isMaxLength(postTextLimit)).pipe(import_effect18.Schema.annotateEncoded({
2803
2983
  description: `At most ${postTextLimit} characters after trimming.`
@@ -3489,6 +3669,31 @@ var InboxReviewList = import_effect21.Schema.Struct({
3489
3669
  var InboxUnreadCount = import_effect21.Schema.Struct({
3490
3670
  unreadCount: import_effect21.Schema.Int
3491
3671
  }).annotate({ identifier: "InboxUnreadCount" });
3672
+ var InboxUnavailableReason = import_effect21.Schema.Literals([
3673
+ "provider_subscription_limit",
3674
+ "missing_scopes",
3675
+ "webhook_invalid",
3676
+ "subscription_pending",
3677
+ "plan_required",
3678
+ "insufficient_credit",
3679
+ "spend_cap_reached"
3680
+ ]);
3681
+ var InboxUnavailableState = import_effect21.Schema.Struct({
3682
+ reason: InboxUnavailableReason,
3683
+ action: import_effect21.Schema.Literals([
3684
+ "contact_pubnio",
3685
+ "reconnect_account",
3686
+ "wait_for_repair",
3687
+ "upgrade_plan",
3688
+ "add_credit",
3689
+ "raise_spend_cap"
3690
+ ])
3691
+ });
3692
+ var InboxDeliveryGap = import_effect21.Schema.Struct({
3693
+ from: import_effect21.Schema.String,
3694
+ to: import_effect21.Schema.String,
3695
+ action: import_effect21.Schema.Literal("review_on_x")
3696
+ });
3492
3697
  var InboxChannelCapability = import_effect21.Schema.Struct({
3493
3698
  resource: InboxResource,
3494
3699
  supported: import_effect21.Schema.Boolean,
@@ -3501,7 +3706,8 @@ var InboxChannelCapability = import_effect21.Schema.Struct({
3501
3706
  syncMode: InboxSyncMode,
3502
3707
  backfillDays: import_effect21.Schema.Int,
3503
3708
  missingScopes: import_effect21.Schema.Array(import_effect21.Schema.String),
3504
- missingTasks: import_effect21.Schema.Array(import_effect21.Schema.String)
3709
+ missingTasks: import_effect21.Schema.Array(import_effect21.Schema.String),
3710
+ unavailable: import_effect21.Schema.NullOr(InboxUnavailableState)
3505
3711
  }).annotate({ identifier: "InboxChannelCapability" });
3506
3712
  var InboxAccountCapabilities = import_effect21.Schema.Struct({
3507
3713
  accountId: AccountId,
@@ -3516,6 +3722,7 @@ var InboxAccountCapabilities = import_effect21.Schema.Struct({
3516
3722
  mentions: InboxChannelCapability,
3517
3723
  replyWindow: InboxReplyWindow,
3518
3724
  lastSyncError: import_effect21.Schema.NullOr(import_effect21.Schema.String),
3725
+ deliveryGap: import_effect21.Schema.NullOr(InboxDeliveryGap),
3519
3726
  checkedAt: import_effect21.Schema.String
3520
3727
  }).annotate({ identifier: "InboxAccountCapabilities" });
3521
3728
  var InboxCapabilities = import_effect21.Schema.Struct({
@@ -4428,7 +4635,8 @@ var WorkspaceEventType = import_effect26.Schema.Literals([
4428
4635
  "billing.credit.topped_up",
4429
4636
  "billing.credit.low",
4430
4637
  "billing.spend_cap.reached",
4431
- "billing.invoice.payment_failed"
4638
+ "billing.invoice.payment_failed",
4639
+ "billing.subscription.duplicate_refunded"
4432
4640
  ]);
4433
4641
  var WorkspaceEventEnvelope = import_effect26.Schema.Struct({
4434
4642
  id: import_effect26.Schema.String.check(import_effect26.Schema.isUUID()),
@@ -5009,6 +5217,15 @@ var WebhookEvent = import_effect27.Schema.Union([
5009
5217
  hostedInvoiceUrl: import_effect27.Schema.NullOr(import_effect27.Schema.String)
5010
5218
  })
5011
5219
  }),
5220
+ import_effect27.Schema.Struct({
5221
+ ...envelope,
5222
+ type: import_effect27.Schema.Literal("billing.subscription.duplicate_refunded"),
5223
+ data: import_effect27.Schema.Struct({
5224
+ subscriptionId: import_effect27.Schema.String,
5225
+ amountRefundedMinor: import_effect27.Schema.Int,
5226
+ currency: import_effect27.Schema.String
5227
+ })
5228
+ }),
5012
5229
  import_effect27.Schema.Struct({
5013
5230
  ...envelope,
5014
5231
  type: import_effect27.Schema.Literal("webhook.test"),
@@ -5192,6 +5409,27 @@ class SeatLimitReached extends import_http_api.HttpApiError.Problem()("SeatLimit
5192
5409
  }) {
5193
5410
  }
5194
5411
 
5412
+ class PlanRequired extends import_http_api.HttpApiError.Problem()("PlanRequired", {
5413
+ type: "urn:pubnio:problem:plan-required",
5414
+ status: 402,
5415
+ title: "Plan upgrade required"
5416
+ }, {
5417
+ code: import_effect28.Schema.Literal("plan_required"),
5418
+ entitlement: import_effect28.Schema.Literals([
5419
+ "adsInsights",
5420
+ "adsWrite",
5421
+ "analyticsHistory"
5422
+ ]),
5423
+ currentPlan: BillingPlanId,
5424
+ minimumPlan: BillingPlanId,
5425
+ fundingUrl: import_effect28.Schema.String,
5426
+ canManageBilling: import_effect28.Schema.Boolean,
5427
+ nextAction: import_effect28.Schema.String,
5428
+ param: import_effect28.Schema.optionalKey(import_effect28.Schema.String),
5429
+ earliestDate: import_effect28.Schema.optionalKey(import_effect28.Schema.String)
5430
+ }) {
5431
+ }
5432
+
5195
5433
  class AlreadyMember extends import_http_api.HttpApiError.Problem()("AlreadyMember", {
5196
5434
  type: "urn:pubnio:problem:already-member",
5197
5435
  status: 409,
@@ -5663,7 +5901,15 @@ class InboxUnsupportedContent extends import_http_api.HttpApiError.Problem()("In
5663
5901
  capability: ProductCapability
5664
5902
  }) {
5665
5903
  }
5904
+
5905
+ class InboxUnavailable extends import_http_api.HttpApiError.Problem()("InboxUnavailable", {
5906
+ type: "urn:pubnio:problem:inbox-unavailable",
5907
+ status: 409,
5908
+ title: "Inbox unavailable"
5909
+ }, InboxUnavailableState.fields) {
5910
+ }
5666
5911
  var InboxProblems = [
5912
+ InboxUnavailable,
5667
5913
  InboxReplyWindowClosed,
5668
5914
  InboxTargetChanged,
5669
5915
  InboxSyncInProgress,
@@ -5904,7 +6150,8 @@ var AdsProblems = [
5904
6150
  AdKillSwitchActive,
5905
6151
  AdOperationNotRetryable,
5906
6152
  AdProviderRejected,
5907
- InvalidAdRequest
6153
+ InvalidAdRequest,
6154
+ PlanRequired
5908
6155
  ];
5909
6156
  var SchedulingProblems = [
5910
6157
  QueueNotFound,
@@ -6335,7 +6582,7 @@ var import_http = require("effect/http");
6335
6582
  // package.json
6336
6583
  var package_default = {
6337
6584
  name: "@pubnio/sdk",
6338
- version: "0.2.12",
6585
+ version: "0.3.0",
6339
6586
  description: "JavaScript and TypeScript client for the PubNio API",
6340
6587
  type: "module",
6341
6588
  exports: {
@@ -8002,6 +8249,15 @@ var postsCreate = (options) => (options.client ?? client).post({
8002
8249
  ...options.headers
8003
8250
  }
8004
8251
  });
8252
+ var postsValidateBody = (options) => (options.client ?? client).post({
8253
+ security: [{ scheme: "bearer", type: "http" }],
8254
+ url: "/api/v1/posts/validate",
8255
+ ...options,
8256
+ headers: {
8257
+ "Content-Type": "application/json",
8258
+ ...options.headers
8259
+ }
8260
+ });
8005
8261
  var postsDelete = (options) => (options.client ?? client).delete({
8006
8262
  security: [{ scheme: "bearer", type: "http" }],
8007
8263
  url: "/api/v1/posts/{postId}",
@@ -9539,6 +9795,15 @@ function createPubNioClient({
9539
9795
  query: { workspaceId },
9540
9796
  ...transport()
9541
9797
  })),
9798
+ validateBody: (input) => {
9799
+ const body = input;
9800
+ return decode(PostValidation, postsValidateBody({
9801
+ client,
9802
+ query: { workspaceId },
9803
+ body,
9804
+ ...transport()
9805
+ }));
9806
+ },
9542
9807
  publish: (postId, input) => {
9543
9808
  const { idempotencyKey = crypto.randomUUID(), ...publish } = input;
9544
9809
  return withIdempotencyKey(idempotencyKey, async () => {