postiz 2.0.1 → 2.0.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/dist/index.js CHANGED
@@ -12364,9 +12364,44 @@ var _PostizAPI = class _PostizAPI {
12364
12364
  });
12365
12365
  }
12366
12366
  async upload(file, filename) {
12367
+ var _a7;
12367
12368
  const formData = new FormData();
12368
- const extension = filename.split(".").pop() || "jpg";
12369
- const type = extension === "png" ? "image/png" : extension === "jpg" || extension === "jpeg" ? "image/jpeg" : extension === "gif" ? "image/gif" : "image/jpeg";
12369
+ const extension = ((_a7 = filename.split(".").pop()) == null ? void 0 : _a7.toLowerCase()) || "";
12370
+ const mimeTypes = {
12371
+ // Images
12372
+ "png": "image/png",
12373
+ "jpg": "image/jpeg",
12374
+ "jpeg": "image/jpeg",
12375
+ "gif": "image/gif",
12376
+ "webp": "image/webp",
12377
+ "svg": "image/svg+xml",
12378
+ "bmp": "image/bmp",
12379
+ "ico": "image/x-icon",
12380
+ // Videos
12381
+ "mp4": "video/mp4",
12382
+ "mov": "video/quicktime",
12383
+ "avi": "video/x-msvideo",
12384
+ "mkv": "video/x-matroska",
12385
+ "webm": "video/webm",
12386
+ "flv": "video/x-flv",
12387
+ "wmv": "video/x-ms-wmv",
12388
+ "m4v": "video/x-m4v",
12389
+ "mpeg": "video/mpeg",
12390
+ "mpg": "video/mpeg",
12391
+ "3gp": "video/3gpp",
12392
+ // Audio
12393
+ "mp3": "audio/mpeg",
12394
+ "wav": "audio/wav",
12395
+ "ogg": "audio/ogg",
12396
+ "aac": "audio/aac",
12397
+ "flac": "audio/flac",
12398
+ "m4a": "audio/mp4",
12399
+ // Documents
12400
+ "pdf": "application/pdf",
12401
+ "doc": "application/msword",
12402
+ "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
12403
+ };
12404
+ const type = mimeTypes[extension] || "application/octet-stream";
12370
12405
  const blob = new Blob([
12371
12406
  file
12372
12407
  ], {
@@ -12393,6 +12428,11 @@ var _PostizAPI = class _PostizAPI {
12393
12428
  method: "GET"
12394
12429
  });
12395
12430
  }
12431
+ async getIntegrationSettings(integrationId) {
12432
+ return this.request(`/public/v1/integration-settings/${integrationId}`, {
12433
+ method: "GET"
12434
+ });
12435
+ }
12396
12436
  };
12397
12437
  __name(_PostizAPI, "PostizAPI");
12398
12438
  var PostizAPI = _PostizAPI;
@@ -12521,9 +12561,9 @@ async function listPosts(args) {
12521
12561
  startDate: args.startDate || defaultStartDate.toISOString(),
12522
12562
  endDate: args.endDate || defaultEndDate.toISOString()
12523
12563
  };
12524
- if (args.page) filters.page = args.page;
12525
- if (args.limit) filters.limit = args.limit;
12526
- if (args.search) filters.search = args.search;
12564
+ if (args.customer) {
12565
+ filters.customer = args.customer;
12566
+ }
12527
12567
  try {
12528
12568
  const result = await api.listPosts(filters);
12529
12569
  console.log("\u{1F4CB} Posts:");
@@ -12567,6 +12607,24 @@ async function listIntegrations() {
12567
12607
  }
12568
12608
  }
12569
12609
  __name(listIntegrations, "listIntegrations");
12610
+ async function getIntegrationSettings(args) {
12611
+ const config = getConfig();
12612
+ const api = new PostizAPI(config);
12613
+ if (!args.id) {
12614
+ console.error("\u274C Integration ID is required");
12615
+ process.exit(1);
12616
+ }
12617
+ try {
12618
+ const result = await api.getIntegrationSettings(args.id);
12619
+ console.log(`\u2699\uFE0F Settings for integration: ${args.id}`);
12620
+ console.log(JSON.stringify(result, null, 2));
12621
+ return result;
12622
+ } catch (error) {
12623
+ console.error("\u274C Failed to get integration settings:", error.message);
12624
+ process.exit(1);
12625
+ }
12626
+ }
12627
+ __name(getIntegrationSettings, "getIntegrationSettings");
12570
12628
 
12571
12629
  // src/commands/upload.ts
12572
12630
  var import_fs6 = require("fs");
@@ -12645,27 +12703,21 @@ yargs_default(hideBin(process.argv)).scriptName("postiz").usage("$0 <command> [o
12645
12703
  }).option("endDate", {
12646
12704
  describe: "End date (ISO 8601 format). Default: 30 days from now",
12647
12705
  type: "string"
12648
- }).option("page", {
12649
- alias: "p",
12650
- describe: "Page number",
12651
- type: "number",
12652
- default: 1
12653
- }).option("limit", {
12654
- alias: "l",
12655
- describe: "Number of posts per page",
12656
- type: "number",
12657
- default: 10
12658
- }).option("search", {
12659
- alias: "s",
12660
- describe: "Search query",
12706
+ }).option("customer", {
12707
+ describe: "Customer ID (optional)",
12661
12708
  type: "string"
12662
- }).example("$0 posts:list", "List all posts (last 30 days to next 30 days)").example("$0 posts:list -p 2 -l 20", "List posts with pagination").example('$0 posts:list -s "hello"', "Search posts").example('$0 posts:list --startDate "2024-01-01T00:00:00Z" --endDate "2024-12-31T23:59:59Z"', "List posts for a specific date range");
12709
+ }).example("$0 posts:list", "List all posts (last 30 days to next 30 days)").example('$0 posts:list --startDate "2024-01-01T00:00:00Z" --endDate "2024-12-31T23:59:59Z"', "List posts for a specific date range").example('$0 posts:list --customer "customer-id"', "List posts for a specific customer");
12663
12710
  }, listPosts).command("posts:delete <id>", "Delete a post", (yargs) => {
12664
12711
  return yargs.positional("id", {
12665
12712
  describe: "Post ID to delete",
12666
12713
  type: "string"
12667
12714
  }).example("$0 posts:delete abc123", "Delete post with ID abc123");
12668
- }, deletePost).command("integrations:list", "List all connected integrations", {}, listIntegrations).command("upload <file>", "Upload a file", (yargs) => {
12715
+ }, deletePost).command("integrations:list", "List all connected integrations", {}, listIntegrations).command("integrations:settings <id>", "Get settings schema for a specific integration", (yargs) => {
12716
+ return yargs.positional("id", {
12717
+ describe: "Integration ID",
12718
+ type: "string"
12719
+ }).example("$0 integrations:settings reddit-123", "Get settings schema for Reddit integration").example("$0 integrations:settings youtube-456", "Get settings schema for YouTube integration");
12720
+ }, getIntegrationSettings).command("upload <file>", "Upload a file", (yargs) => {
12669
12721
  return yargs.positional("file", {
12670
12722
  describe: "File path to upload",
12671
12723
  type: "string"