@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/internal.cjs CHANGED
@@ -187,6 +187,7 @@ __export(exports_sdk_gen, {
187
187
  postsRetry: () => postsRetry,
188
188
  postsUpdate: () => postsUpdate,
189
189
  postsValidate: () => postsValidate,
190
+ postsValidateBody: () => postsValidateBody,
190
191
  profileDeactivate: () => profileDeactivate,
191
192
  profileGet: () => profileGet,
192
193
  profileUpdate: () => profileUpdate,
@@ -396,6 +397,8 @@ var IssueCode = import_effect6.Schema.Literals([
396
397
  "tiktok_upload_required",
397
398
  "tiktok_too_many_mentions",
398
399
  "queue_and_time_conflict",
400
+ "queue_not_found",
401
+ "queue_unavailable",
399
402
  "invalid_field",
400
403
  "account_ambiguous",
401
404
  "unsupported_placement",
@@ -406,8 +409,9 @@ var IssueCode = import_effect6.Schema.Literals([
406
409
  var PostIssue = import_effect6.Schema.Struct({
407
410
  code: IssueCode,
408
411
  path: import_effect6.Schema.Array(import_effect6.Schema.Union([import_effect6.Schema.String, import_effect6.Schema.Int])),
409
- message: import_effect6.Schema.String
410
- });
412
+ message: import_effect6.Schema.String,
413
+ candidates: import_effect6.Schema.optionalKey(import_effect6.Schema.Array(import_effect6.Schema.Struct({ accountId: AccountId, name: import_effect6.Schema.String })))
414
+ }).annotate({ identifier: "PostIssue" });
411
415
  var schemaIssueFormatter = import_effect6.SchemaIssue.makeFormatterStandardSchemaV1();
412
416
 
413
417
  // ../protocol/src/provider.ts
@@ -624,7 +628,10 @@ var DeliveryIssue = import_effect8.Schema.Literals([
624
628
  "tiktok_settings_not_allowed",
625
629
  "tiktok_processing_failed",
626
630
  "submission_uncertain",
627
- "confirmation_unavailable"
631
+ "confirmation_unavailable",
632
+ "billing_inactive",
633
+ "spend_cap_reached",
634
+ "insufficient_credit"
628
635
  ]);
629
636
  var FirstCommentStatus = import_effect8.Schema.Literals([
630
637
  "pending",
@@ -723,6 +730,7 @@ var BillingSubscriptionStatus = import_effect9.Schema.Literals([
723
730
  var UsageMeter = import_effect9.Schema.Literals([
724
731
  "confirmed_publish",
725
732
  "x_passthrough",
733
+ "x_read",
726
734
  "managed_ad",
727
735
  "inbox_reply",
728
736
  "automation_run"
@@ -739,10 +747,15 @@ var BillingPlan = import_effect9.Schema.Struct({
739
747
  monthlyPrice: import_effect9.Schema.NullOr(Money),
740
748
  annualPrice: import_effect9.Schema.NullOr(Money),
741
749
  meters: import_effect9.Schema.Array(BillingPlanMeter),
750
+ xReads: import_effect9.Schema.Boolean,
751
+ includedXReadMicros: import_effect9.Schema.NullOr(import_effect9.Schema.Int),
742
752
  seatsLimit: import_effect9.Schema.NullOr(import_effect9.Schema.Int),
743
753
  analyticsRetentionDays: import_effect9.Schema.Int,
744
754
  whiteLabelOAuth: import_effect9.Schema.Boolean,
745
- ssoSaml: import_effect9.Schema.Boolean
755
+ ssoSaml: import_effect9.Schema.Boolean,
756
+ priorityQueue: import_effect9.Schema.Boolean,
757
+ adsInsights: import_effect9.Schema.Boolean,
758
+ adsWrite: import_effect9.Schema.Boolean
746
759
  }).annotate({ identifier: "BillingPlan" });
747
760
  var BillingPlanList = import_effect9.Schema.Struct({
748
761
  data: import_effect9.Schema.Array(BillingPlan)
@@ -778,6 +791,8 @@ var WorkspaceBilling = import_effect9.Schema.Struct({
778
791
  creditBalance: Money,
779
792
  spendControls: BillingSpendControls,
780
793
  currentPeriod: import_effect9.Schema.Struct({
794
+ start: import_effect9.Schema.String,
795
+ end: import_effect9.Schema.String,
781
796
  meters: import_effect9.Schema.Array(BillingMeterUsage),
782
797
  totalVariableSpendMicros: import_effect9.Schema.Int,
783
798
  seatsUsed: import_effect9.Schema.Int,
@@ -1919,7 +1934,51 @@ var ApiLimits = import_effect15.Schema.Struct({
1919
1934
  media: MediaLimits,
1920
1935
  rateLimits: RateLimits
1921
1936
  }).annotate({ identifier: "ApiLimits" });
1937
+ var pollOptionCount = { minOptions: 2, maxOptions: 4 };
1938
+ var xPollLimits = {
1939
+ ...pollOptionCount,
1940
+ optionCharacters: 25,
1941
+ minDurationMinutes: 5,
1942
+ maxDurationMinutes: 10080
1943
+ };
1944
+ var linkedinPollLimits = {
1945
+ ...pollOptionCount,
1946
+ questionCharacters: 140,
1947
+ optionCharacters: 30,
1948
+ durations: ["ONE_DAY", "THREE_DAYS", "SEVEN_DAYS", "FOURTEEN_DAYS"]
1949
+ };
1950
+ var xReplySettings = [
1951
+ "following",
1952
+ "mentionedUsers",
1953
+ "subscribers",
1954
+ "verified"
1955
+ ];
1956
+ var xMediaTagLimit = 10;
1957
+ var pollOptionLimits = {
1958
+ minOptions: import_effect15.Schema.Int,
1959
+ maxOptions: import_effect15.Schema.Int,
1960
+ optionCharacters: import_effect15.Schema.Int
1961
+ };
1962
+ var FeedSettingsCapability = import_effect15.Schema.Struct({
1963
+ poll: import_effect15.Schema.Union([
1964
+ import_effect15.Schema.Struct({
1965
+ ...pollOptionLimits,
1966
+ minDurationMinutes: import_effect15.Schema.Int,
1967
+ maxDurationMinutes: import_effect15.Schema.Int
1968
+ }),
1969
+ import_effect15.Schema.Struct({
1970
+ ...pollOptionLimits,
1971
+ questionCharacters: import_effect15.Schema.Int,
1972
+ durations: import_effect15.Schema.Array(import_effect15.Schema.Literals(linkedinPollLimits.durations))
1973
+ })
1974
+ ]),
1975
+ replySettings: import_effect15.Schema.optionalKey(import_effect15.Schema.Array(import_effect15.Schema.Literals(xReplySettings))),
1976
+ maxMediaTags: import_effect15.Schema.optionalKey(import_effect15.Schema.Int),
1977
+ placeId: import_effect15.Schema.optionalKey(import_effect15.Schema.Boolean),
1978
+ quotePostId: import_effect15.Schema.optionalKey(import_effect15.Schema.Boolean)
1979
+ });
1922
1980
  var PlacementCapability = import_effect15.Schema.Struct({
1981
+ settings: import_effect15.Schema.optionalKey(FeedSettingsCapability),
1923
1982
  placement: PublishPlacement,
1924
1983
  default: import_effect15.Schema.Boolean,
1925
1984
  mediaTypes: import_effect15.Schema.Array(MediaType),
@@ -2293,6 +2352,11 @@ var import_effect28 = require("effect");
2293
2352
  var import_effect18 = require("effect");
2294
2353
  var postTextLimit = 128000;
2295
2354
  var threadPostTextLimit = 1250;
2355
+ var blueskyPostMaxBytes = 3000;
2356
+ var graphemeSegmenter = new Intl.Segmenter(undefined, {
2357
+ granularity: "grapheme"
2358
+ });
2359
+ var utf8 = new TextEncoder;
2296
2360
  var redditTitleMaxLength = 300;
2297
2361
  var threadsTextLimit = 500;
2298
2362
  var xArticleTitleMaxLength = 100;
@@ -2400,12 +2464,34 @@ var InstagramStorySettings = import_effect18.Schema.Struct({
2400
2464
  muteAudio: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
2401
2465
  userTags: instagramTags
2402
2466
  }).annotate({ identifier: "InstagramStorySettings" });
2467
+ var blueskyPostText = import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(blueskyPostMaxBytes));
2403
2468
  var BlueskyFeedSettings = import_effect18.Schema.Struct({
2404
- firstComment: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(300))),
2405
- 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))),
2469
+ firstComment: import_effect18.Schema.optionalKey(blueskyPostText),
2470
+ thread: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(blueskyPostText).check(import_effect18.Schema.isMaxLength(24))),
2406
2471
  altText: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(1000)))
2407
2472
  }).annotate({ identifier: "BlueskyFeedSettings" });
2473
+ var nonblank = import_effect18.Schema.makeFilter((value) => value.trim().length > 0 || "Supply a nonblank string.", { toJsonSchema: () => ({ pattern: "\\S" }) });
2474
+ function pollText(maximum) {
2475
+ return import_effect18.Schema.String.check(import_effect18.Schema.isBetweenCodePoints(1, maximum, {
2476
+ expected: `between 1 and ${maximum} characters`
2477
+ }), nonblank);
2478
+ }
2479
+ function pollOptions({
2480
+ minOptions,
2481
+ maxOptions,
2482
+ optionCharacters
2483
+ }) {
2484
+ return import_effect18.Schema.Array(pollText(optionCharacters)).check(import_effect18.Schema.isMinLength(minOptions), import_effect18.Schema.isMaxLength(maxOptions));
2485
+ }
2486
+ var LinkedInPoll = import_effect18.Schema.Struct({
2487
+ question: pollText(linkedinPollLimits.questionCharacters),
2488
+ options: pollOptions(linkedinPollLimits),
2489
+ duration: import_effect18.Schema.Literals(linkedinPollLimits.durations)
2490
+ }).annotate({
2491
+ description: "Organic LinkedIn poll. Include post text and omit media, altText, and documentTitle."
2492
+ });
2408
2493
  var LinkedInFeedSettings = import_effect18.Schema.Struct({
2494
+ poll: import_effect18.Schema.optionalKey(LinkedInPoll),
2409
2495
  firstComment: import_effect18.Schema.optionalKey(text),
2410
2496
  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))),
2411
2497
  visibility: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["PUBLIC", "CONNECTIONS"])),
@@ -2442,6 +2528,7 @@ var YouTubeVideoSettings = import_effect18.Schema.Struct({
2442
2528
  title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(100)),
2443
2529
  description: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMaxLength(5000))),
2444
2530
  privacyStatus: import_effect18.Schema.Literals(["public", "unlisted", "private"]),
2531
+ firstComment: import_effect18.Schema.optionalKey(text),
2445
2532
  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))),
2446
2533
  categoryId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^\d{1,3}$/))),
2447
2534
  madeForKids: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
@@ -2456,14 +2543,66 @@ var XArticleDraftSettings = import_effect18.Schema.Struct({
2456
2543
  title: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleTitleMaxLength)),
2457
2544
  content: import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(xArticleContentMaxLength))
2458
2545
  }).annotate({ identifier: "XArticleDraftSettings" });
2546
+ var XPoll = import_effect18.Schema.Struct({
2547
+ options: pollOptions(xPollLimits),
2548
+ durationMinutes: import_effect18.Schema.Number.check(import_effect18.Schema.isInt({ expected: "an integer number of minutes" }), import_effect18.Schema.isBetween({
2549
+ minimum: xPollLimits.minDurationMinutes,
2550
+ maximum: xPollLimits.maxDurationMinutes
2551
+ }, {
2552
+ expected: `between ${xPollLimits.minDurationMinutes} and ${xPollLimits.maxDurationMinutes} minutes`
2553
+ }))
2554
+ }).annotate({
2555
+ description: "X poll on the root post. Include post text and omit attachments."
2556
+ });
2557
+ var xPostOptionId = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/^[0-9]{1,19}$/, {
2558
+ expected: "an X ID string of 1 to 19 digits"
2559
+ }));
2459
2560
  var XFeedSettings = import_effect18.Schema.Struct({
2561
+ poll: import_effect18.Schema.optionalKey(XPoll),
2562
+ replySettings: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(xReplySettings).annotate({
2563
+ description: "Who may reply to the root X post. Omit for the provider default."
2564
+ })),
2565
+ quotePostId: import_effect18.Schema.optionalKey(xPostOptionId.annotate({
2566
+ 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."
2567
+ })),
2568
+ mediaTaggedUserIds: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(xPostOptionId).check(import_effect18.Schema.isMaxLength(xMediaTagLimit)).annotate({
2569
+ description: "X user ID strings to tag on root post photos (JPEG, PNG, or WebP)."
2570
+ })),
2571
+ placeId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isTrimmed({
2572
+ expected: "an X Place ID without surrounding whitespace"
2573
+ }), nonblank).annotate({
2574
+ description: "Opaque X Place ID such as geo.place_id from a post lookup."
2575
+ })),
2460
2576
  firstComment: import_effect18.Schema.optionalKey(text),
2461
- 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))),
2577
+ 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))),
2462
2578
  article: import_effect18.Schema.optionalKey(XArticleDraftSettings)
2463
2579
  }).annotate({ identifier: "XFeedSettings" });
2464
- var GoogleBusinessFeedSettings = import_effect18.Schema.Struct({}).annotate({
2465
- identifier: "GoogleBusinessFeedSettings"
2466
- });
2580
+ var googleBusinessLocalTimeFormat = "Use a valid location-local date and time in YYYY-MM-DDTHH:MM format.";
2581
+ 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]$/, {
2582
+ message: googleBusinessLocalTimeFormat
2583
+ }), import_effect18.Schema.makeFilter((value) => {
2584
+ const year = Number(value.slice(0, 4));
2585
+ const date = new Date(`${value}:00Z`);
2586
+ return year > 0 && date.getUTCMonth() + 1 === Number(value.slice(5, 7)) && date.getUTCDate() === Number(value.slice(8, 10)) || googleBusinessLocalTimeFormat;
2587
+ })).annotate({ description: googleBusinessLocalTimeFormat });
2588
+ var googleBusinessNonblank = import_effect18.Schema.String.check(import_effect18.Schema.isPattern(/\S/, {
2589
+ message: "Enter a string with non-whitespace content."
2590
+ }));
2591
+ var googleBusinessLink = MediaUrl.annotate({
2592
+ description: "Use an HTTPS URL of at most 2,048 characters without embedded credentials.",
2593
+ message: "Use an HTTPS URL of at most 2,048 characters without embedded credentials."
2594
+ });
2595
+ var GoogleBusinessFeedSettings = import_effect18.Schema.Struct({
2596
+ topicType: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["standard", "event", "offer"])),
2597
+ title: import_effect18.Schema.optionalKey(googleBusinessNonblank),
2598
+ startsAt: import_effect18.Schema.optionalKey(googleBusinessLocalTime),
2599
+ endsAt: import_effect18.Schema.optionalKey(googleBusinessLocalTime),
2600
+ couponCode: import_effect18.Schema.optionalKey(googleBusinessNonblank),
2601
+ redeemUrl: import_effect18.Schema.optionalKey(googleBusinessLink),
2602
+ terms: import_effect18.Schema.optionalKey(googleBusinessNonblank),
2603
+ callToAction: import_effect18.Schema.optionalKey(import_effect18.Schema.Literals(["book", "order", "shop", "learn_more", "sign_up", "call"])),
2604
+ callToActionUrl: import_effect18.Schema.optionalKey(googleBusinessLink)
2605
+ }).annotate({ identifier: "GoogleBusinessFeedSettings" });
2467
2606
  var ThreadsFeedSettings = import_effect18.Schema.Struct({
2468
2607
  firstComment: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(threadsTextLimit))),
2469
2608
  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)))
@@ -2642,6 +2781,41 @@ var providerSettings = import_effect18.Schema.Union([
2642
2781
  TikTokFeedSettings,
2643
2782
  GoogleBusinessFeedSettings
2644
2783
  ]);
2784
+ function settingsShapeErrors(issue, depth = 0) {
2785
+ switch (issue._tag) {
2786
+ case "Composite":
2787
+ return issue.issues.reduce((count, child) => count + settingsShapeErrors(child, depth), 0);
2788
+ case "AnyOf":
2789
+ return issue.issues.length === 0 ? 0 : Math.min(...issue.issues.map((child) => settingsShapeErrors(child, depth)));
2790
+ case "Pointer":
2791
+ return settingsShapeErrors(issue.issue, depth + issue.path.length);
2792
+ case "UnexpectedKey":
2793
+ return depth === 1 ? 3 : 2;
2794
+ case "MissingKey":
2795
+ return depth === 1 ? 4 : 1;
2796
+ default:
2797
+ return 0;
2798
+ }
2799
+ }
2800
+ var createTargetSettings = providerSettings.pipe(import_effect18.Schema.catchDecoding((issue) => {
2801
+ if (issue._tag !== "AnyOf")
2802
+ return import_effect18.Effect.fail(issue);
2803
+ const [first, ...others] = issue.issues;
2804
+ if (!first)
2805
+ return import_effect18.Effect.fail(issue);
2806
+ let closest = first;
2807
+ let fewest = settingsShapeErrors(first);
2808
+ for (const candidate of others) {
2809
+ if (fewest === 0)
2810
+ break;
2811
+ const errors = settingsShapeErrors(candidate);
2812
+ if (errors < fewest) {
2813
+ closest = candidate;
2814
+ fewest = errors;
2815
+ }
2816
+ }
2817
+ return import_effect18.Effect.fail(closest);
2818
+ }));
2645
2819
  var CreatePostTarget = import_effect18.Schema.Struct({
2646
2820
  accountId: AccountId,
2647
2821
  provider: import_effect18.Schema.optionalKey(Provider),
@@ -2653,7 +2827,7 @@ var CreatePostTarget = import_effect18.Schema.Struct({
2653
2827
  queueId: import_effect18.Schema.optionalKey(import_effect18.Schema.String.check(import_effect18.Schema.isUUID()).annotate({
2654
2828
  description: "Assign this destination to its connected account's schedule queue."
2655
2829
  })),
2656
- settings: import_effect18.Schema.optionalKey(providerSettings)
2830
+ settings: import_effect18.Schema.optionalKey(createTargetSettings)
2657
2831
  }).annotate({ identifier: "CreatePostTarget" });
2658
2832
  var postText = import_effect18.Schema.Trim.check(import_effect18.Schema.isMaxLength(postTextLimit)).pipe(import_effect18.Schema.annotateEncoded({
2659
2833
  description: `At most ${postTextLimit} characters after trimming.`
@@ -3345,6 +3519,31 @@ var InboxReviewList = import_effect21.Schema.Struct({
3345
3519
  var InboxUnreadCount = import_effect21.Schema.Struct({
3346
3520
  unreadCount: import_effect21.Schema.Int
3347
3521
  }).annotate({ identifier: "InboxUnreadCount" });
3522
+ var InboxUnavailableReason = import_effect21.Schema.Literals([
3523
+ "provider_subscription_limit",
3524
+ "missing_scopes",
3525
+ "webhook_invalid",
3526
+ "subscription_pending",
3527
+ "plan_required",
3528
+ "insufficient_credit",
3529
+ "spend_cap_reached"
3530
+ ]);
3531
+ var InboxUnavailableState = import_effect21.Schema.Struct({
3532
+ reason: InboxUnavailableReason,
3533
+ action: import_effect21.Schema.Literals([
3534
+ "contact_pubnio",
3535
+ "reconnect_account",
3536
+ "wait_for_repair",
3537
+ "upgrade_plan",
3538
+ "add_credit",
3539
+ "raise_spend_cap"
3540
+ ])
3541
+ });
3542
+ var InboxDeliveryGap = import_effect21.Schema.Struct({
3543
+ from: import_effect21.Schema.String,
3544
+ to: import_effect21.Schema.String,
3545
+ action: import_effect21.Schema.Literal("review_on_x")
3546
+ });
3348
3547
  var InboxChannelCapability = import_effect21.Schema.Struct({
3349
3548
  resource: InboxResource,
3350
3549
  supported: import_effect21.Schema.Boolean,
@@ -3357,7 +3556,8 @@ var InboxChannelCapability = import_effect21.Schema.Struct({
3357
3556
  syncMode: InboxSyncMode,
3358
3557
  backfillDays: import_effect21.Schema.Int,
3359
3558
  missingScopes: import_effect21.Schema.Array(import_effect21.Schema.String),
3360
- missingTasks: import_effect21.Schema.Array(import_effect21.Schema.String)
3559
+ missingTasks: import_effect21.Schema.Array(import_effect21.Schema.String),
3560
+ unavailable: import_effect21.Schema.NullOr(InboxUnavailableState)
3361
3561
  }).annotate({ identifier: "InboxChannelCapability" });
3362
3562
  var InboxAccountCapabilities = import_effect21.Schema.Struct({
3363
3563
  accountId: AccountId,
@@ -3372,6 +3572,7 @@ var InboxAccountCapabilities = import_effect21.Schema.Struct({
3372
3572
  mentions: InboxChannelCapability,
3373
3573
  replyWindow: InboxReplyWindow,
3374
3574
  lastSyncError: import_effect21.Schema.NullOr(import_effect21.Schema.String),
3575
+ deliveryGap: import_effect21.Schema.NullOr(InboxDeliveryGap),
3375
3576
  checkedAt: import_effect21.Schema.String
3376
3577
  }).annotate({ identifier: "InboxAccountCapabilities" });
3377
3578
  var InboxCapabilities = import_effect21.Schema.Struct({
@@ -4284,7 +4485,8 @@ var WorkspaceEventType = import_effect26.Schema.Literals([
4284
4485
  "billing.credit.topped_up",
4285
4486
  "billing.credit.low",
4286
4487
  "billing.spend_cap.reached",
4287
- "billing.invoice.payment_failed"
4488
+ "billing.invoice.payment_failed",
4489
+ "billing.subscription.duplicate_refunded"
4288
4490
  ]);
4289
4491
  var WorkspaceEventEnvelope = import_effect26.Schema.Struct({
4290
4492
  id: import_effect26.Schema.String.check(import_effect26.Schema.isUUID()),
@@ -4865,6 +5067,15 @@ var WebhookEvent = import_effect27.Schema.Union([
4865
5067
  hostedInvoiceUrl: import_effect27.Schema.NullOr(import_effect27.Schema.String)
4866
5068
  })
4867
5069
  }),
5070
+ import_effect27.Schema.Struct({
5071
+ ...envelope,
5072
+ type: import_effect27.Schema.Literal("billing.subscription.duplicate_refunded"),
5073
+ data: import_effect27.Schema.Struct({
5074
+ subscriptionId: import_effect27.Schema.String,
5075
+ amountRefundedMinor: import_effect27.Schema.Int,
5076
+ currency: import_effect27.Schema.String
5077
+ })
5078
+ }),
4868
5079
  import_effect27.Schema.Struct({
4869
5080
  ...envelope,
4870
5081
  type: import_effect27.Schema.Literal("webhook.test"),
@@ -5048,6 +5259,27 @@ class SeatLimitReached extends import_http_api.HttpApiError.Problem()("SeatLimit
5048
5259
  }) {
5049
5260
  }
5050
5261
 
5262
+ class PlanRequired extends import_http_api.HttpApiError.Problem()("PlanRequired", {
5263
+ type: "urn:pubnio:problem:plan-required",
5264
+ status: 402,
5265
+ title: "Plan upgrade required"
5266
+ }, {
5267
+ code: import_effect28.Schema.Literal("plan_required"),
5268
+ entitlement: import_effect28.Schema.Literals([
5269
+ "adsInsights",
5270
+ "adsWrite",
5271
+ "analyticsHistory"
5272
+ ]),
5273
+ currentPlan: BillingPlanId,
5274
+ minimumPlan: BillingPlanId,
5275
+ fundingUrl: import_effect28.Schema.String,
5276
+ canManageBilling: import_effect28.Schema.Boolean,
5277
+ nextAction: import_effect28.Schema.String,
5278
+ param: import_effect28.Schema.optionalKey(import_effect28.Schema.String),
5279
+ earliestDate: import_effect28.Schema.optionalKey(import_effect28.Schema.String)
5280
+ }) {
5281
+ }
5282
+
5051
5283
  class AlreadyMember extends import_http_api.HttpApiError.Problem()("AlreadyMember", {
5052
5284
  type: "urn:pubnio:problem:already-member",
5053
5285
  status: 409,
@@ -5519,7 +5751,15 @@ class InboxUnsupportedContent extends import_http_api.HttpApiError.Problem()("In
5519
5751
  capability: ProductCapability
5520
5752
  }) {
5521
5753
  }
5754
+
5755
+ class InboxUnavailable extends import_http_api.HttpApiError.Problem()("InboxUnavailable", {
5756
+ type: "urn:pubnio:problem:inbox-unavailable",
5757
+ status: 409,
5758
+ title: "Inbox unavailable"
5759
+ }, InboxUnavailableState.fields) {
5760
+ }
5522
5761
  var InboxProblems = [
5762
+ InboxUnavailable,
5523
5763
  InboxReplyWindowClosed,
5524
5764
  InboxTargetChanged,
5525
5765
  InboxSyncInProgress,
@@ -5760,7 +6000,8 @@ var AdsProblems = [
5760
6000
  AdKillSwitchActive,
5761
6001
  AdOperationNotRetryable,
5762
6002
  AdProviderRejected,
5763
- InvalidAdRequest
6003
+ InvalidAdRequest,
6004
+ PlanRequired
5764
6005
  ];
5765
6006
  var SchedulingProblems = [
5766
6007
  QueueNotFound,
@@ -6191,7 +6432,7 @@ var import_http = require("effect/http");
6191
6432
  // package.json
6192
6433
  var package_default = {
6193
6434
  name: "@pubnio/sdk",
6194
- version: "0.2.13",
6435
+ version: "0.3.0",
6195
6436
  description: "JavaScript and TypeScript client for the PubNio API",
6196
6437
  type: "module",
6197
6438
  exports: {
@@ -7858,6 +8099,15 @@ var postsCreate = (options) => (options.client ?? client).post({
7858
8099
  ...options.headers
7859
8100
  }
7860
8101
  });
8102
+ var postsValidateBody = (options) => (options.client ?? client).post({
8103
+ security: [{ scheme: "bearer", type: "http" }],
8104
+ url: "/api/v1/posts/validate",
8105
+ ...options,
8106
+ headers: {
8107
+ "Content-Type": "application/json",
8108
+ ...options.headers
8109
+ }
8110
+ });
7861
8111
  var postsDelete = (options) => (options.client ?? client).delete({
7862
8112
  security: [{ scheme: "bearer", type: "http" }],
7863
8113
  url: "/api/v1/posts/{postId}",
@@ -9395,6 +9645,15 @@ function createPubNioClient({
9395
9645
  query: { workspaceId },
9396
9646
  ...transport()
9397
9647
  })),
9648
+ validateBody: (input) => {
9649
+ const body = input;
9650
+ return decode(PostValidation, postsValidateBody({
9651
+ client,
9652
+ query: { workspaceId },
9653
+ body,
9654
+ ...transport()
9655
+ }));
9656
+ },
9398
9657
  publish: (postId, input) => {
9399
9658
  const { idempotencyKey = crypto.randomUUID(), ...publish } = input;
9400
9659
  return withIdempotencyKey(idempotencyKey, async () => {