@pubnio/sdk 0.2.13 → 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),
@@ -2443,6 +2502,11 @@ var import_effect28 = require("effect");
2443
2502
  var import_effect18 = require("effect");
2444
2503
  var postTextLimit = 128000;
2445
2504
  var threadPostTextLimit = 1250;
2505
+ var blueskyPostMaxBytes = 3000;
2506
+ var graphemeSegmenter = new Intl.Segmenter(undefined, {
2507
+ granularity: "grapheme"
2508
+ });
2509
+ var utf8 = new TextEncoder;
2446
2510
  var redditTitleMaxLength = 300;
2447
2511
  var threadsTextLimit = 500;
2448
2512
  var xArticleTitleMaxLength = 100;
@@ -2550,12 +2614,34 @@ var InstagramStorySettings = import_effect18.Schema.Struct({
2550
2614
  muteAudio: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
2551
2615
  userTags: instagramTags
2552
2616
  }).annotate({ identifier: "InstagramStorySettings" });
2617
+ var blueskyPostText = import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(blueskyPostMaxBytes));
2553
2618
  var BlueskyFeedSettings = import_effect18.Schema.Struct({
2554
- firstComment: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(300))),
2555
- 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))),
2556
2621
  altText: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(1000)))
2557
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
+ });
2558
2643
  var LinkedInFeedSettings = import_effect18.Schema.Struct({
2644
+ poll: import_effect18.Schema.optionalKey(LinkedInPoll),
2559
2645
  firstComment: import_effect18.Schema.optionalKey(text),
2560
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))),
2561
2647
  visibility: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["PUBLIC", "CONNECTIONS"])),
@@ -2592,6 +2678,7 @@ var YouTubeVideoSettings = import_effect18.Schema.Struct({
2592
2678
  title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(100)),
2593
2679
  description: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(5000))),
2594
2680
  privacyStatus: import_effect18.Schema.Literals(["public", "unlisted", "private"]),
2681
+ firstComment: import_effect18.Schema.optionalKey(text),
2595
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))),
2596
2683
  categoryId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^\d{1,3}$/))),
2597
2684
  madeForKids: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
@@ -2606,14 +2693,66 @@ var XArticleDraftSettings = import_effect18.Schema.Struct({
2606
2693
  title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleTitleMaxLength)),
2607
2694
  content: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleContentMaxLength))
2608
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
+ }));
2609
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
+ })),
2610
2726
  firstComment: import_effect18.Schema.optionalKey(text),
2611
- thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(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))),
2612
2728
  article: import_effect18.Schema.optionalKey(XArticleDraftSettings)
2613
2729
  }).annotate({ identifier: "XFeedSettings" });
2614
- var GoogleBusinessFeedSettings = import_effect18.Schema.Struct({}).annotate({
2615
- identifier: "GoogleBusinessFeedSettings"
2616
- });
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" });
2617
2756
  var ThreadsFeedSettings = import_effect18.Schema.Struct({
2618
2757
  firstComment: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(threadsTextLimit))),
2619
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)))
@@ -2792,6 +2931,41 @@ var providerSettings = import_effect18.Schema.Union([
2792
2931
  TikTokFeedSettings,
2793
2932
  GoogleBusinessFeedSettings
2794
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
+ }));
2795
2969
  var CreatePostTarget = import_effect18.Schema.Struct({
2796
2970
  accountId: AccountId,
2797
2971
  provider: import_effect18.Schema.optionalKey(Provider),
@@ -2803,7 +2977,7 @@ var CreatePostTarget = import_effect18.Schema.Struct({
2803
2977
  queueId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isUUID()).annotate({
2804
2978
  description: "Assign this destination to its connected account's schedule queue."
2805
2979
  })),
2806
- settings: import_effect18.Schema.optionalKey(providerSettings)
2980
+ settings: import_effect18.Schema.optionalKey(createTargetSettings)
2807
2981
  }).annotate({ identifier: "CreatePostTarget" });
2808
2982
  var postText = import_effect18.Schema.Trim.check(import_effect18.Schema.isMaxLength(postTextLimit)).pipe(import_effect18.Schema.annotateEncoded({
2809
2983
  description: `At most ${postTextLimit} characters after trimming.`
@@ -3495,6 +3669,31 @@ var InboxReviewList = import_effect21.Schema.Struct({
3495
3669
  var InboxUnreadCount = import_effect21.Schema.Struct({
3496
3670
  unreadCount: import_effect21.Schema.Int
3497
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
+ });
3498
3697
  var InboxChannelCapability = import_effect21.Schema.Struct({
3499
3698
  resource: InboxResource,
3500
3699
  supported: import_effect21.Schema.Boolean,
@@ -3507,7 +3706,8 @@ var InboxChannelCapability = import_effect21.Schema.Struct({
3507
3706
  syncMode: InboxSyncMode,
3508
3707
  backfillDays: import_effect21.Schema.Int,
3509
3708
  missingScopes: import_effect21.Schema.Array(import_effect21.Schema.String),
3510
- 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)
3511
3711
  }).annotate({ identifier: "InboxChannelCapability" });
3512
3712
  var InboxAccountCapabilities = import_effect21.Schema.Struct({
3513
3713
  accountId: AccountId,
@@ -3522,6 +3722,7 @@ var InboxAccountCapabilities = import_effect21.Schema.Struct({
3522
3722
  mentions: InboxChannelCapability,
3523
3723
  replyWindow: InboxReplyWindow,
3524
3724
  lastSyncError: import_effect21.Schema.NullOr(import_effect21.Schema.String),
3725
+ deliveryGap: import_effect21.Schema.NullOr(InboxDeliveryGap),
3525
3726
  checkedAt: import_effect21.Schema.String
3526
3727
  }).annotate({ identifier: "InboxAccountCapabilities" });
3527
3728
  var InboxCapabilities = import_effect21.Schema.Struct({
@@ -4434,7 +4635,8 @@ var WorkspaceEventType = import_effect26.Schema.Literals([
4434
4635
  "billing.credit.topped_up",
4435
4636
  "billing.credit.low",
4436
4637
  "billing.spend_cap.reached",
4437
- "billing.invoice.payment_failed"
4638
+ "billing.invoice.payment_failed",
4639
+ "billing.subscription.duplicate_refunded"
4438
4640
  ]);
4439
4641
  var WorkspaceEventEnvelope = import_effect26.Schema.Struct({
4440
4642
  id: import_effect26.Schema.String.check(import_effect26.Schema.isUUID()),
@@ -5015,6 +5217,15 @@ var WebhookEvent = import_effect27.Schema.Union([
5015
5217
  hostedInvoiceUrl: import_effect27.Schema.NullOr(import_effect27.Schema.String)
5016
5218
  })
5017
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
+ }),
5018
5229
  import_effect27.Schema.Struct({
5019
5230
  ...envelope,
5020
5231
  type: import_effect27.Schema.Literal("webhook.test"),
@@ -5198,6 +5409,27 @@ class SeatLimitReached extends import_http_api.HttpApiError.Problem()("SeatLimit
5198
5409
  }) {
5199
5410
  }
5200
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
+
5201
5433
  class AlreadyMember extends import_http_api.HttpApiError.Problem()("AlreadyMember", {
5202
5434
  type: "urn:pubnio:problem:already-member",
5203
5435
  status: 409,
@@ -5669,7 +5901,15 @@ class InboxUnsupportedContent extends import_http_api.HttpApiError.Problem()("In
5669
5901
  capability: ProductCapability
5670
5902
  }) {
5671
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
+ }
5672
5911
  var InboxProblems = [
5912
+ InboxUnavailable,
5673
5913
  InboxReplyWindowClosed,
5674
5914
  InboxTargetChanged,
5675
5915
  InboxSyncInProgress,
@@ -5910,7 +6150,8 @@ var AdsProblems = [
5910
6150
  AdKillSwitchActive,
5911
6151
  AdOperationNotRetryable,
5912
6152
  AdProviderRejected,
5913
- InvalidAdRequest
6153
+ InvalidAdRequest,
6154
+ PlanRequired
5914
6155
  ];
5915
6156
  var SchedulingProblems = [
5916
6157
  QueueNotFound,
@@ -6341,7 +6582,7 @@ var import_http = require("effect/http");
6341
6582
  // package.json
6342
6583
  var package_default = {
6343
6584
  name: "@pubnio/sdk",
6344
- version: "0.2.13",
6585
+ version: "0.3.0",
6345
6586
  description: "JavaScript and TypeScript client for the PubNio API",
6346
6587
  type: "module",
6347
6588
  exports: {
@@ -8008,6 +8249,15 @@ var postsCreate = (options) => (options.client ?? client).post({
8008
8249
  ...options.headers
8009
8250
  }
8010
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
+ });
8011
8261
  var postsDelete = (options) => (options.client ?? client).delete({
8012
8262
  security: [{ scheme: "bearer", type: "http" }],
8013
8263
  url: "/api/v1/posts/{postId}",
@@ -9545,6 +9795,15 @@ function createPubNioClient({
9545
9795
  query: { workspaceId },
9546
9796
  ...transport()
9547
9797
  })),
9798
+ validateBody: (input) => {
9799
+ const body = input;
9800
+ return decode(PostValidation, postsValidateBody({
9801
+ client,
9802
+ query: { workspaceId },
9803
+ body,
9804
+ ...transport()
9805
+ }));
9806
+ },
9548
9807
  publish: (postId, input) => {
9549
9808
  const { idempotencyKey = crypto.randomUUID(), ...publish } = input;
9550
9809
  return withIdempotencyKey(idempotencyKey, async () => {