@posterly/cli 0.2.0 → 0.2.2

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/bin/posterly.mjs CHANGED
@@ -409,6 +409,8 @@ async function main() {
409
409
  }
410
410
 
411
411
  function parseArgs(args) {
412
+ // Flags that are plain on/off switches and never take the next argument.
413
+ const BOOLEAN_FLAGS = new Set(['pinContentType']);
412
414
  const [command, ...rest] = args;
413
415
  const flags = {};
414
416
  const positional = [];
@@ -426,6 +428,12 @@ function parseArgs(args) {
426
428
  flags[key] = arg.slice(eq + 1);
427
429
  continue;
428
430
  }
431
+ // Pure boolean flags never take the next argument as their value, so
432
+ // `a.jpg --pin-content-type b.jpg` keeps both files.
433
+ if (BOOLEAN_FLAGS.has(key)) {
434
+ flags[key] = true;
435
+ continue;
436
+ }
429
437
  const next = rest[i + 1];
430
438
  if (!next || next.startsWith('--')) {
431
439
  flags[key] = true;
@@ -900,9 +908,17 @@ async function mediaUploadPayload(flags, positional) {
900
908
  // (unchanged). Several files, up to 20 in one call: pass local paths with no
901
909
  // --content-type, `media:signed-upload a.jpg b.jpg c.mp4`, and the CLI reads
902
910
  // each name, type and size from disk. `--files '[{"filename","content_type",
903
- // "size"}]'` sends a batch you describe yourself.
911
+ // "size"}]'` sends a batch you describe yourself. `--pin-content-type` locks
912
+ // each slot to the declared content type: the PUT must then send exactly the
913
+ // returned Content-Type header or storage answers 403.
914
+ function takePinContentType(flags) {
915
+ // --pin-content-type (true) or --pin-content-type=true|false
916
+ return flagEnabled(flags.pinContentType) ? { pin_content_type: true } : {};
917
+ }
918
+
904
919
  async function mediaSignedUploadPayload(flags, positional) {
905
- const workspace = flags.workspaceId ? { workspace_id: flags.workspaceId } : {};
920
+ const pin = takePinContentType(flags);
921
+ const workspace = { ...(flags.workspaceId ? { workspace_id: flags.workspaceId } : {}), ...pin };
906
922
  if (flags.files !== undefined) {
907
923
  const files = jsonFlag(flags.files);
908
924
  if (!Array.isArray(files)) throw new Error('--files must be a JSON array of { filename, content_type, size }');
@@ -134,10 +134,12 @@ export const PLATFORM_MANIFEST = Object.freeze({
134
134
  "youtube": "youtube"
135
135
  },
136
136
  "helperNames": [
137
+ "linkedin.company_lookup",
137
138
  "linkedin.recent_mentions",
138
139
  "pinterest.boards",
139
140
  "tiktok.creator_info",
140
- "x.quota"
141
+ "x.quota",
142
+ "youtube.playlists"
141
143
  ],
142
144
  "analyticsPlatformIds": [
143
145
  "instagram",
@@ -335,7 +337,8 @@ export const PLATFORM_MANIFEST = Object.freeze({
335
337
  ],
336
338
  "analyticsSupported": true,
337
339
  "helpers": [
338
- "linkedin.recent_mentions"
340
+ "linkedin.recent_mentions",
341
+ "linkedin.company_lookup"
339
342
  ]
340
343
  },
341
344
  {
@@ -347,7 +350,9 @@ export const PLATFORM_MANIFEST = Object.freeze({
347
350
  "video"
348
351
  ],
349
352
  "analyticsSupported": true,
350
- "helpers": []
353
+ "helpers": [
354
+ "youtube.playlists"
355
+ ]
351
356
  },
352
357
  {
353
358
  "id": "pinterest",
@@ -747,7 +752,7 @@ export const PLANNED_PLATFORM_IDS = Object.freeze(["reddit","medium","skool","wh
747
752
  export const ALL_PLATFORM_IDS = Object.freeze(["instagram","facebook","tiktok","twitter","linkedin","youtube","pinterest","threads","google_business","telegram","bluesky","discord","slack","mastodon","devto","hashnode","wordpress","lemmy","reddit","medium","skool","whop"]);
748
753
  export const SUPPORTED_PLATFORM_INPUTS = Object.freeze(["bluesky","devto","discord","facebook","gmb","google-business","google_business","google_business_profile","hashnode","instagram","instagram-standalone","lemmy","linkedin","mastodon","pinterest","slack","telegram","threads","tiktok","twitter","wordpress","x","youtube"]);
749
754
  export const ALL_PLATFORM_INPUTS = Object.freeze(["bluesky","devto","discord","facebook","gmb","google-business","google_business","google_business_profile","hashnode","instagram","instagram-standalone","lemmy","linkedin","mastodon","medium","pinterest","reddit","skool","slack","telegram","threads","tiktok","twitter","whop","wordpress","x","youtube"]);
750
- export const PLATFORM_HELPER_NAMES = Object.freeze(["linkedin.recent_mentions","pinterest.boards","tiktok.creator_info","x.quota"]);
755
+ export const PLATFORM_HELPER_NAMES = Object.freeze(["linkedin.company_lookup","linkedin.recent_mentions","pinterest.boards","tiktok.creator_info","x.quota","youtube.playlists"]);
751
756
  export const CONNECT_TARGET_IDS = Object.freeze(["instagram","meta","facebook","youtube","tiktok","linkedin","linkedin_page","threads","google_business","pinterest","twitter","telegram","bluesky","discord","slack","mastodon","devto","hashnode","wordpress","lemmy","reddit","medium","skool","whop"]);
752
757
  export const CONNECT_INPUTS = Object.freeze(["bluesky","devto","discord","facebook","facebook_instagram","facebook_pages","gmb","google-business","google_business","google_business_profile","hashnode","instagram","instagram-standalone","instagram_direct","lemmy","linkedin","linkedin-company","linkedin-page","linkedin_company","linkedin_page","linkedin_personal","mastodon","medium","meta","meta_business","pinterest","reddit","skool","slack","telegram","threads","tiktok","twitter","whop","wordpress","x","x_twitter","youtube"]);
753
758
  export const ANALYTICS_PLATFORM_IDS = Object.freeze(["instagram","facebook","twitter","linkedin","youtube","pinterest","threads","google_business"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posterly/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Command line interface for the posterly API",
5
5
  "license": "MIT",
6
6
  "type": "module",