@nuelink/nuelink-cli 1.3.1 → 1.3.3
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/package.json +1 -1
- package/src/postPayload.js +5 -5
- package/src/validation.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuelink/nuelink-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "The official Nuelink CLI for automating social media workflows from your terminal. Schedule posts, upload media, manage brands, and integrate Nuelink into scripts, CI/CD pipelines, and AI agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Nuelink",
|
package/src/postPayload.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
splitCsv,
|
|
6
6
|
validateHttpUrl,
|
|
7
7
|
validatePollOptions,
|
|
8
|
-
|
|
8
|
+
validateScheduledAt,
|
|
9
9
|
} from "./validation.js";
|
|
10
10
|
|
|
11
11
|
const VALID_PUBLISH_MODES = ["DRAFT", "QUEUE", "SCHEDULE", "IMMEDIATE"];
|
|
@@ -60,10 +60,10 @@ function normalizePublishMode(value) {
|
|
|
60
60
|
function buildPostPayload(options) {
|
|
61
61
|
const media = mergeMedia(options.mediaIds, options.mediaUrls);
|
|
62
62
|
const publishMode = normalizePublishMode(options.publishMode);
|
|
63
|
-
const
|
|
63
|
+
const scheduledAt = validateScheduledAt(options.scheduledAt);
|
|
64
64
|
|
|
65
|
-
if (publishMode === "SCHEDULE" && !
|
|
66
|
-
throw new Error("
|
|
65
|
+
if (publishMode === "SCHEDULE" && !scheduledAt) {
|
|
66
|
+
throw new Error("scheduledAt is required when publishMode is SCHEDULE.");
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
const pollOptions = options.pollOptions ? parseCsv(options.pollOptions) : [];
|
|
@@ -135,7 +135,7 @@ function buildPostPayload(options) {
|
|
|
135
135
|
...(options.link ? { link: validateHttpUrl(options.link, "link") } : {}),
|
|
136
136
|
...(options.postType ? { postType: options.postType } : {}),
|
|
137
137
|
publishMode,
|
|
138
|
-
|
|
138
|
+
scheduledAt,
|
|
139
139
|
...(parseBooleanStrict(options.postAsStory, "post-as-story") !== undefined
|
|
140
140
|
? { postAsStory: parseBooleanStrict(options.postAsStory, "post-as-story") }
|
|
141
141
|
: {}),
|
package/src/validation.js
CHANGED
|
@@ -106,7 +106,7 @@ function validateQueueSlots(queueSlots) {
|
|
|
106
106
|
return queueSlots;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
function
|
|
109
|
+
function validateScheduledAt(value) {
|
|
110
110
|
if (value === undefined || value === null || value === "" || value === "null") {
|
|
111
111
|
return null;
|
|
112
112
|
}
|
|
@@ -180,7 +180,7 @@ export {
|
|
|
180
180
|
validateHttpUrl,
|
|
181
181
|
validateMediaFile,
|
|
182
182
|
validatePollOptions,
|
|
183
|
-
|
|
183
|
+
validateScheduledAt,
|
|
184
184
|
validateQueueSlots,
|
|
185
185
|
normalizeEnum,
|
|
186
186
|
};
|