@pubnio/sdk 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +45 -23
- package/dist/index.d.cts +475 -28
- package/dist/index.d.ts +475 -28
- package/dist/index.js +45 -23
- package/dist/internal.cjs +45 -23
- package/dist/internal.d.cts +557 -67
- package/dist/internal.d.ts +557 -67
- package/dist/internal.js +45 -23
- package/dist/solid.cjs +45 -23
- package/dist/solid.d.cts +489 -47
- package/dist/solid.d.ts +489 -47
- package/dist/solid.js +45 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -465,18 +465,22 @@ var PublishPlacement = Schema8.Literals([
|
|
|
465
465
|
var ScheduleOverride = Schema8.Union([ScheduledAt, Schema8.Null]);
|
|
466
466
|
var DestinationSelection = Schema8.Struct({
|
|
467
467
|
accountId: AccountId,
|
|
468
|
-
placement: PublishPlacement
|
|
468
|
+
placement: Schema8.optionalKey(PublishPlacement).annotate({
|
|
469
|
+
description: "Omit to select the draft's only destination for this account."
|
|
470
|
+
}),
|
|
469
471
|
scheduledAt: Schema8.optionalKey(ScheduleOverride),
|
|
470
472
|
queueId: Schema8.optionalKey(uuid2)
|
|
471
473
|
}).annotate({ identifier: "DestinationSelection" });
|
|
472
474
|
var PublishInput = Schema8.Struct({
|
|
473
|
-
expectedRevision: PublishRevision
|
|
475
|
+
expectedRevision: Schema8.optionalKey(PublishRevision).annotate({
|
|
476
|
+
description: "Publish only if the draft is still at this revision. Omit to publish the saved draft as it is."
|
|
477
|
+
}),
|
|
474
478
|
scheduledAt: Schema8.optionalKey(ScheduledAt),
|
|
475
|
-
|
|
479
|
+
accounts: Schema8.optionalKey(Schema8.Array(AccountId).check(Schema8.isMinLength(1), Schema8.isMaxLength(50)).annotate({
|
|
476
480
|
description: "Select every draft placement for these accounts. Use targets for exact selection instead."
|
|
477
481
|
})),
|
|
478
482
|
targets: Schema8.optionalKey(Schema8.Array(DestinationSelection).check(Schema8.isMinLength(1), Schema8.isMaxLength(50)).annotate({
|
|
479
|
-
description: "Select exact draft destinations and optionally override each schedule. Omit
|
|
483
|
+
description: "Select exact draft destinations and optionally override each schedule. Omit accounts when using targets."
|
|
480
484
|
}))
|
|
481
485
|
});
|
|
482
486
|
var PostRef = Schema8.Struct({ postId: PostId });
|
|
@@ -2785,23 +2789,20 @@ var postText = Schema18.Trim.check(Schema18.isMaxLength(postTextLimit)).pipe(Sch
|
|
|
2785
2789
|
description: `At most ${postTextLimit} characters after trimming.`
|
|
2786
2790
|
}));
|
|
2787
2791
|
var postTargets = Schema18.Array(PublishTarget).check(Schema18.isMaxLength(50));
|
|
2788
|
-
var
|
|
2792
|
+
var PostContent = Schema18.Struct({
|
|
2789
2793
|
text: Schema18.optionalKey(postText),
|
|
2790
2794
|
targets: Schema18.optionalKey(postTargets),
|
|
2791
|
-
media: Schema18.optionalKey(MediaInputs)
|
|
2792
|
-
};
|
|
2793
|
-
var PostContent = Schema18.Struct(postContent).annotate({
|
|
2794
|
-
identifier: "PostContent"
|
|
2795
|
-
});
|
|
2796
|
-
var PostPreflight = Schema18.Struct({
|
|
2797
|
-
...postContent,
|
|
2795
|
+
media: Schema18.optionalKey(MediaInputs),
|
|
2798
2796
|
scheduledAt: Schema18.optionalKey(ScheduledAt)
|
|
2799
|
-
}).annotate({ identifier: "
|
|
2800
|
-
var
|
|
2801
|
-
text: Schema18.optionalKey(postText),
|
|
2797
|
+
}).annotate({ identifier: "PostContent" });
|
|
2798
|
+
var destinationSelectors = {
|
|
2802
2799
|
platforms: Schema18.optionalKey(Schema18.Array(Provider).check(Schema18.isMinLength(1), Schema18.isMaxLength(publishTargetLimit))),
|
|
2803
2800
|
accounts: Schema18.optionalKey(Schema18.Array(AccountId).check(Schema18.isMinLength(1), Schema18.isMaxLength(publishTargetLimit))),
|
|
2804
|
-
targets: Schema18.optionalKey(Schema18.Array(CreatePostTarget).check(Schema18.isMinLength(1), Schema18.isMaxLength(publishTargetLimit)))
|
|
2801
|
+
targets: Schema18.optionalKey(Schema18.Array(CreatePostTarget).check(Schema18.isMinLength(1), Schema18.isMaxLength(publishTargetLimit)))
|
|
2802
|
+
};
|
|
2803
|
+
var CreatePost = Schema18.Struct({
|
|
2804
|
+
text: Schema18.optionalKey(postText),
|
|
2805
|
+
...destinationSelectors,
|
|
2805
2806
|
media: Schema18.optionalKey(MediaInputs),
|
|
2806
2807
|
scheduledAt: Schema18.optionalKey(ScheduledAt),
|
|
2807
2808
|
publishNow: Schema18.optionalKey(Schema18.Boolean),
|
|
@@ -2809,12 +2810,18 @@ var CreatePost = Schema18.Struct({
|
|
|
2809
2810
|
description: "Save the post as a draft without submitting it. Defaults to false."
|
|
2810
2811
|
})
|
|
2811
2812
|
}).annotate({ identifier: "CreatePost" }).annotate({
|
|
2812
|
-
description: "Send
|
|
2813
|
+
description: "Send one selector: platforms, accounts, or targets. scheduledAt is the default time; targets[].scheduledAt overrides it per destination. isDraft saves the same body without submitting."
|
|
2813
2814
|
});
|
|
2814
2815
|
var UpdatePost = Schema18.Struct({
|
|
2815
|
-
|
|
2816
|
+
text: Schema18.optionalKey(postText),
|
|
2817
|
+
media: Schema18.optionalKey(MediaInputs),
|
|
2818
|
+
scheduledAt: Schema18.optionalKey(ScheduleOverride),
|
|
2819
|
+
...destinationSelectors,
|
|
2820
|
+
targets: Schema18.optionalKey(Schema18.Array(CreatePostTarget).check(Schema18.isMaxLength(publishTargetLimit))),
|
|
2816
2821
|
expectedRevision: Schema18.optionalKey(revision)
|
|
2817
|
-
}).annotate({ identifier: "UpdatePost" })
|
|
2822
|
+
}).annotate({ identifier: "UpdatePost" }).annotate({
|
|
2823
|
+
description: "Edit a draft with the same fields as create. scheduledAt sets the default time; null clears it. One selector (platforms, accounts, or targets) replaces the saved targets; an empty targets array removes them."
|
|
2824
|
+
});
|
|
2818
2825
|
var Post = Schema18.Struct({
|
|
2819
2826
|
postId: PostId,
|
|
2820
2827
|
isDraft: Schema18.Boolean,
|
|
@@ -2822,6 +2829,9 @@ var Post = Schema18.Struct({
|
|
|
2822
2829
|
text: postText,
|
|
2823
2830
|
media: MediaInputs,
|
|
2824
2831
|
targets: postTargets,
|
|
2832
|
+
scheduledAt: Schema18.NullOr(ScheduledAt).annotate({
|
|
2833
|
+
description: "The default time for targets without their own scheduledAt. null publishes them when submitted."
|
|
2834
|
+
}),
|
|
2825
2835
|
deliveries: Schema18.Array(DeliveryStatus),
|
|
2826
2836
|
status: PostState,
|
|
2827
2837
|
createdAt: Schema18.String,
|
|
@@ -5421,6 +5431,17 @@ class DestinationAlreadySubmitted extends HttpApiError.Problem()("DestinationAlr
|
|
|
5421
5431
|
}) {
|
|
5422
5432
|
}
|
|
5423
5433
|
|
|
5434
|
+
class PostSubmitted extends HttpApiError.Problem()("PostSubmitted", {
|
|
5435
|
+
type: "urn:pubnio:problem:post-submitted",
|
|
5436
|
+
status: 409,
|
|
5437
|
+
title: "Post already submitted"
|
|
5438
|
+
}, {
|
|
5439
|
+
code: Schema28.Literal("post_submitted"),
|
|
5440
|
+
targetIds: Schema28.Array(TargetId),
|
|
5441
|
+
nextAction: Schema28.String
|
|
5442
|
+
}) {
|
|
5443
|
+
}
|
|
5444
|
+
|
|
5424
5445
|
class DeliveryNotRetryable extends HttpApiError.Problem()("DeliveryNotRetryable", {
|
|
5425
5446
|
type: "urn:pubnio:problem:delivery-not-retryable",
|
|
5426
5447
|
status: 409,
|
|
@@ -5926,6 +5947,7 @@ var PublishProblems = [
|
|
|
5926
5947
|
AttemptChanged,
|
|
5927
5948
|
IdempotencyConflict,
|
|
5928
5949
|
DestinationAlreadySubmitted,
|
|
5950
|
+
PostSubmitted,
|
|
5929
5951
|
DeliveryNotRetryable,
|
|
5930
5952
|
DeliveryNotReconcilable,
|
|
5931
5953
|
DeliveryScheduleLocked,
|
|
@@ -6384,7 +6406,7 @@ import { ProblemDetails } from "effect/http";
|
|
|
6384
6406
|
// package.json
|
|
6385
6407
|
var package_default = {
|
|
6386
6408
|
name: "@pubnio/sdk",
|
|
6387
|
-
version: "0.
|
|
6409
|
+
version: "0.4.0",
|
|
6388
6410
|
description: "JavaScript and TypeScript client for the PubNio API",
|
|
6389
6411
|
type: "module",
|
|
6390
6412
|
exports: {
|
|
@@ -8912,7 +8934,7 @@ function createPubNioClient({
|
|
|
8912
8934
|
return withIdempotencyKey(idempotencyKey, async () => {
|
|
8913
8935
|
const body = post;
|
|
8914
8936
|
if (post.isDraft) {
|
|
8915
|
-
return decode(
|
|
8937
|
+
return decode(PostCreated, postsCreate({
|
|
8916
8938
|
client,
|
|
8917
8939
|
query: { workspaceId },
|
|
8918
8940
|
headers: { "idempotency-key": idempotencyKey },
|
|
@@ -9606,7 +9628,7 @@ function createPubNioClient({
|
|
|
9606
9628
|
...transport()
|
|
9607
9629
|
}));
|
|
9608
9630
|
},
|
|
9609
|
-
publish: (postId, input) => {
|
|
9631
|
+
publish: (postId, input = {}) => {
|
|
9610
9632
|
const { idempotencyKey = crypto.randomUUID(), ...publish } = input;
|
|
9611
9633
|
return withIdempotencyKey(idempotencyKey, async () => {
|
|
9612
9634
|
const accepted = await decode(PublishAccepted, postsPublish({
|
|
@@ -9617,7 +9639,7 @@ function createPubNioClient({
|
|
|
9617
9639
|
body: {
|
|
9618
9640
|
expectedRevision: publish.expectedRevision,
|
|
9619
9641
|
scheduledAt: publish.scheduledAt,
|
|
9620
|
-
|
|
9642
|
+
accounts: publish.accounts && [...publish.accounts],
|
|
9621
9643
|
targets: publish.targets && [...publish.targets]
|
|
9622
9644
|
},
|
|
9623
9645
|
...transport()
|
package/dist/internal.cjs
CHANGED
|
@@ -513,18 +513,22 @@ var PublishPlacement = import_effect8.Schema.Literals([
|
|
|
513
513
|
var ScheduleOverride = import_effect8.Schema.Union([ScheduledAt, import_effect8.Schema.Null]);
|
|
514
514
|
var DestinationSelection = import_effect8.Schema.Struct({
|
|
515
515
|
accountId: AccountId,
|
|
516
|
-
placement: PublishPlacement
|
|
516
|
+
placement: import_effect8.Schema.optionalKey(PublishPlacement).annotate({
|
|
517
|
+
description: "Omit to select the draft's only destination for this account."
|
|
518
|
+
}),
|
|
517
519
|
scheduledAt: import_effect8.Schema.optionalKey(ScheduleOverride),
|
|
518
520
|
queueId: import_effect8.Schema.optionalKey(uuid2)
|
|
519
521
|
}).annotate({ identifier: "DestinationSelection" });
|
|
520
522
|
var PublishInput = import_effect8.Schema.Struct({
|
|
521
|
-
expectedRevision: PublishRevision
|
|
523
|
+
expectedRevision: import_effect8.Schema.optionalKey(PublishRevision).annotate({
|
|
524
|
+
description: "Publish only if the draft is still at this revision. Omit to publish the saved draft as it is."
|
|
525
|
+
}),
|
|
522
526
|
scheduledAt: import_effect8.Schema.optionalKey(ScheduledAt),
|
|
523
|
-
|
|
527
|
+
accounts: import_effect8.Schema.optionalKey(import_effect8.Schema.Array(AccountId).check(import_effect8.Schema.isMinLength(1), import_effect8.Schema.isMaxLength(50)).annotate({
|
|
524
528
|
description: "Select every draft placement for these accounts. Use targets for exact selection instead."
|
|
525
529
|
})),
|
|
526
530
|
targets: import_effect8.Schema.optionalKey(import_effect8.Schema.Array(DestinationSelection).check(import_effect8.Schema.isMinLength(1), import_effect8.Schema.isMaxLength(50)).annotate({
|
|
527
|
-
description: "Select exact draft destinations and optionally override each schedule. Omit
|
|
531
|
+
description: "Select exact draft destinations and optionally override each schedule. Omit accounts when using targets."
|
|
528
532
|
}))
|
|
529
533
|
});
|
|
530
534
|
var PostRef = import_effect8.Schema.Struct({ postId: PostId });
|
|
@@ -2833,23 +2837,20 @@ var postText = import_effect18.Schema.Trim.check(import_effect18.Schema.isMaxLen
|
|
|
2833
2837
|
description: `At most ${postTextLimit} characters after trimming.`
|
|
2834
2838
|
}));
|
|
2835
2839
|
var postTargets = import_effect18.Schema.Array(PublishTarget).check(import_effect18.Schema.isMaxLength(50));
|
|
2836
|
-
var
|
|
2840
|
+
var PostContent = import_effect18.Schema.Struct({
|
|
2837
2841
|
text: import_effect18.Schema.optionalKey(postText),
|
|
2838
2842
|
targets: import_effect18.Schema.optionalKey(postTargets),
|
|
2839
|
-
media: import_effect18.Schema.optionalKey(MediaInputs)
|
|
2840
|
-
};
|
|
2841
|
-
var PostContent = import_effect18.Schema.Struct(postContent).annotate({
|
|
2842
|
-
identifier: "PostContent"
|
|
2843
|
-
});
|
|
2844
|
-
var PostPreflight = import_effect18.Schema.Struct({
|
|
2845
|
-
...postContent,
|
|
2843
|
+
media: import_effect18.Schema.optionalKey(MediaInputs),
|
|
2846
2844
|
scheduledAt: import_effect18.Schema.optionalKey(ScheduledAt)
|
|
2847
|
-
}).annotate({ identifier: "
|
|
2848
|
-
var
|
|
2849
|
-
text: import_effect18.Schema.optionalKey(postText),
|
|
2845
|
+
}).annotate({ identifier: "PostContent" });
|
|
2846
|
+
var destinationSelectors = {
|
|
2850
2847
|
platforms: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(Provider).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit))),
|
|
2851
2848
|
accounts: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(AccountId).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit))),
|
|
2852
|
-
targets: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(CreatePostTarget).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit)))
|
|
2849
|
+
targets: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(CreatePostTarget).check(import_effect18.Schema.isMinLength(1), import_effect18.Schema.isMaxLength(publishTargetLimit)))
|
|
2850
|
+
};
|
|
2851
|
+
var CreatePost = import_effect18.Schema.Struct({
|
|
2852
|
+
text: import_effect18.Schema.optionalKey(postText),
|
|
2853
|
+
...destinationSelectors,
|
|
2853
2854
|
media: import_effect18.Schema.optionalKey(MediaInputs),
|
|
2854
2855
|
scheduledAt: import_effect18.Schema.optionalKey(ScheduledAt),
|
|
2855
2856
|
publishNow: import_effect18.Schema.optionalKey(import_effect18.Schema.Boolean),
|
|
@@ -2857,12 +2858,18 @@ var CreatePost = import_effect18.Schema.Struct({
|
|
|
2857
2858
|
description: "Save the post as a draft without submitting it. Defaults to false."
|
|
2858
2859
|
})
|
|
2859
2860
|
}).annotate({ identifier: "CreatePost" }).annotate({
|
|
2860
|
-
description: "Send
|
|
2861
|
+
description: "Send one selector: platforms, accounts, or targets. scheduledAt is the default time; targets[].scheduledAt overrides it per destination. isDraft saves the same body without submitting."
|
|
2861
2862
|
});
|
|
2862
2863
|
var UpdatePost = import_effect18.Schema.Struct({
|
|
2863
|
-
|
|
2864
|
+
text: import_effect18.Schema.optionalKey(postText),
|
|
2865
|
+
media: import_effect18.Schema.optionalKey(MediaInputs),
|
|
2866
|
+
scheduledAt: import_effect18.Schema.optionalKey(ScheduleOverride),
|
|
2867
|
+
...destinationSelectors,
|
|
2868
|
+
targets: import_effect18.Schema.optionalKey(import_effect18.Schema.Array(CreatePostTarget).check(import_effect18.Schema.isMaxLength(publishTargetLimit))),
|
|
2864
2869
|
expectedRevision: import_effect18.Schema.optionalKey(revision)
|
|
2865
|
-
}).annotate({ identifier: "UpdatePost" })
|
|
2870
|
+
}).annotate({ identifier: "UpdatePost" }).annotate({
|
|
2871
|
+
description: "Edit a draft with the same fields as create. scheduledAt sets the default time; null clears it. One selector (platforms, accounts, or targets) replaces the saved targets; an empty targets array removes them."
|
|
2872
|
+
});
|
|
2866
2873
|
var Post = import_effect18.Schema.Struct({
|
|
2867
2874
|
postId: PostId,
|
|
2868
2875
|
isDraft: import_effect18.Schema.Boolean,
|
|
@@ -2870,6 +2877,9 @@ var Post = import_effect18.Schema.Struct({
|
|
|
2870
2877
|
text: postText,
|
|
2871
2878
|
media: MediaInputs,
|
|
2872
2879
|
targets: postTargets,
|
|
2880
|
+
scheduledAt: import_effect18.Schema.NullOr(ScheduledAt).annotate({
|
|
2881
|
+
description: "The default time for targets without their own scheduledAt. null publishes them when submitted."
|
|
2882
|
+
}),
|
|
2873
2883
|
deliveries: import_effect18.Schema.Array(DeliveryStatus),
|
|
2874
2884
|
status: PostState,
|
|
2875
2885
|
createdAt: import_effect18.Schema.String,
|
|
@@ -5469,6 +5479,17 @@ class DestinationAlreadySubmitted extends import_http_api.HttpApiError.Problem()
|
|
|
5469
5479
|
}) {
|
|
5470
5480
|
}
|
|
5471
5481
|
|
|
5482
|
+
class PostSubmitted extends import_http_api.HttpApiError.Problem()("PostSubmitted", {
|
|
5483
|
+
type: "urn:pubnio:problem:post-submitted",
|
|
5484
|
+
status: 409,
|
|
5485
|
+
title: "Post already submitted"
|
|
5486
|
+
}, {
|
|
5487
|
+
code: import_effect28.Schema.Literal("post_submitted"),
|
|
5488
|
+
targetIds: import_effect28.Schema.Array(TargetId),
|
|
5489
|
+
nextAction: import_effect28.Schema.String
|
|
5490
|
+
}) {
|
|
5491
|
+
}
|
|
5492
|
+
|
|
5472
5493
|
class DeliveryNotRetryable extends import_http_api.HttpApiError.Problem()("DeliveryNotRetryable", {
|
|
5473
5494
|
type: "urn:pubnio:problem:delivery-not-retryable",
|
|
5474
5495
|
status: 409,
|
|
@@ -5974,6 +5995,7 @@ var PublishProblems = [
|
|
|
5974
5995
|
AttemptChanged,
|
|
5975
5996
|
IdempotencyConflict,
|
|
5976
5997
|
DestinationAlreadySubmitted,
|
|
5998
|
+
PostSubmitted,
|
|
5977
5999
|
DeliveryNotRetryable,
|
|
5978
6000
|
DeliveryNotReconcilable,
|
|
5979
6001
|
DeliveryScheduleLocked,
|
|
@@ -6432,7 +6454,7 @@ var import_http = require("effect/http");
|
|
|
6432
6454
|
// package.json
|
|
6433
6455
|
var package_default = {
|
|
6434
6456
|
name: "@pubnio/sdk",
|
|
6435
|
-
version: "0.
|
|
6457
|
+
version: "0.4.0",
|
|
6436
6458
|
description: "JavaScript and TypeScript client for the PubNio API",
|
|
6437
6459
|
type: "module",
|
|
6438
6460
|
exports: {
|
|
@@ -8960,7 +8982,7 @@ function createPubNioClient({
|
|
|
8960
8982
|
return withIdempotencyKey(idempotencyKey, async () => {
|
|
8961
8983
|
const body = post;
|
|
8962
8984
|
if (post.isDraft) {
|
|
8963
|
-
return decode(
|
|
8985
|
+
return decode(PostCreated, postsCreate({
|
|
8964
8986
|
client,
|
|
8965
8987
|
query: { workspaceId },
|
|
8966
8988
|
headers: { "idempotency-key": idempotencyKey },
|
|
@@ -9654,7 +9676,7 @@ function createPubNioClient({
|
|
|
9654
9676
|
...transport()
|
|
9655
9677
|
}));
|
|
9656
9678
|
},
|
|
9657
|
-
publish: (postId, input) => {
|
|
9679
|
+
publish: (postId, input = {}) => {
|
|
9658
9680
|
const { idempotencyKey = crypto.randomUUID(), ...publish } = input;
|
|
9659
9681
|
return withIdempotencyKey(idempotencyKey, async () => {
|
|
9660
9682
|
const accepted = await decode(PublishAccepted, postsPublish({
|
|
@@ -9665,7 +9687,7 @@ function createPubNioClient({
|
|
|
9665
9687
|
body: {
|
|
9666
9688
|
expectedRevision: publish.expectedRevision,
|
|
9667
9689
|
scheduledAt: publish.scheduledAt,
|
|
9668
|
-
|
|
9690
|
+
accounts: publish.accounts && [...publish.accounts],
|
|
9669
9691
|
targets: publish.targets && [...publish.targets]
|
|
9670
9692
|
},
|
|
9671
9693
|
...transport()
|