@getpilfer/cli 0.1.2 → 0.1.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.
@@ -7,7 +7,7 @@ import {
7
7
  mergeBody,
8
8
  printList,
9
9
  printOutput
10
- } from "./chunk-AQXEFAD4.js";
10
+ } from "./chunk-CXNVJZ4C.js";
11
11
  import "./chunk-GZ4DXDQM.js";
12
12
 
13
13
  // src/lib/idempotent-create.ts
@@ -176,7 +176,7 @@ function register(program, helpers) {
176
176
  printOutput(getOutputFormat(), data ?? {}, false);
177
177
  });
178
178
  const projectsCmd = program.command("projects").description("projects resource");
179
- projectsCmd.command("list").description("List projects").option("--limit <n>", "Max results").option("--offset <n>", "Skip n results").option("--all", "Fetch all pages").option("--fields <fields>", "Comma-separated fields to print").option("--where <field=value>", "Client-side exact filters, comma-separated").option("--jsonl", "Print one compact JSON object per row").option("--organization-id <value>", "Filter by organizationId").hook("preAction", (thisCommand) => {
179
+ projectsCmd.command("list").description("List projects").option("--limit <n>", "Max results").option("--offset <n>", "Skip n results").option("--all", "Fetch all pages").option("--fields <fields>", "Comma-separated fields to print").option("--where <field=value>", "Client-side exact filters, comma-separated").option("--jsonl", "Print one compact JSON object per row").option("--organization-id <value>", "Filter by organizationId").option("--include <value>", "Filter by include").hook("preAction", (thisCommand) => {
180
180
  syncRootOptsFromCommand(thisCommand);
181
181
  }).action(async (opts) => {
182
182
  const token = requireToken();
@@ -187,17 +187,23 @@ function register(program, helpers) {
187
187
  if (opts.organizationId != null) {
188
188
  query.organizationId = coerceQueryFlag(opts.organizationId, { field: "organizationId", flag: "--organization-id", kind: "string" }, exitWithError);
189
189
  }
190
+ if (opts.include != null) {
191
+ query.include = coerceQueryFlag(opts.include, { field: "include", flag: "--include", kind: "string" }, exitWithError);
192
+ }
190
193
  const res = await fetchList({ path: "projects", token, baseUrl: getBaseUrl(), query, all: Boolean(opts.all), request: apiRequest });
191
194
  if (!res.ok) exitWithError(res.status || 500, res.error ?? "Request failed");
192
195
  const data = res.data?.data ?? [];
193
196
  printList({ format: getOutputFormat(), data, fields: opts.fields, where: opts.where, jsonl: Boolean(opts.jsonl) });
194
197
  });
195
- projectsCmd.command("get <id>").description("Get one projects by id").hook("preAction", (thisCommand) => {
198
+ projectsCmd.command("get <id>").description("Get one projects by id").option("--include <value>", "Include/filter by include").hook("preAction", (thisCommand) => {
196
199
  syncRootOptsFromCommand(thisCommand);
197
200
  }).action(async (id, opts) => {
198
201
  const token = requireToken();
199
202
  if (!token) exitWithError(401, "Missing or invalid token");
200
203
  const query = {};
204
+ if (opts.include != null) {
205
+ query.include = coerceQueryFlag(opts.include, { field: "include", flag: "--include", kind: "string" }, exitWithError);
206
+ }
201
207
  const res = await apiRequest({ method: "GET", path: "projects/" + encodeURIComponent(id), token, baseUrl: getBaseUrl(), query });
202
208
  if (!res.ok) exitWithError(res.status || 500, res.error ?? "Request failed");
203
209
  const data = res.data?.data ?? res.data;
@@ -225,7 +231,7 @@ function register(program, helpers) {
225
231
  baseUrl: getBaseUrl(),
226
232
  body,
227
233
  identityFields: ["name", "organizationId"],
228
- queryFields: ["organizationId"],
234
+ queryFields: ["organizationId", "include"],
229
235
  request: apiRequest
230
236
  });
231
237
  if (existing) {
@@ -348,7 +354,7 @@ function register(program, helpers) {
348
354
  if (getOutputFormat() === "json") console.log(JSON.stringify({ data: null, deleted: true }));
349
355
  });
350
356
  const spacesCmd = program.command("spaces").description("spaces resource");
351
- spacesCmd.command("list").description("List spaces").option("--limit <n>", "Max results").option("--offset <n>", "Skip n results").option("--all", "Fetch all pages").option("--fields <fields>", "Comma-separated fields to print").option("--where <field=value>", "Client-side exact filters, comma-separated").option("--jsonl", "Print one compact JSON object per row").option("--organization-id <value>", "Filter by organizationId").option("--project-id <value>", "Filter by projectId").hook("preAction", (thisCommand) => {
357
+ spacesCmd.command("list").description("List spaces").option("--limit <n>", "Max results").option("--offset <n>", "Skip n results").option("--all", "Fetch all pages").option("--fields <fields>", "Comma-separated fields to print").option("--where <field=value>", "Client-side exact filters, comma-separated").option("--jsonl", "Print one compact JSON object per row").option("--organization-id <value>", "Filter by organizationId").option("--project-id <value>", "Filter by projectId").option("--include <value>", "Filter by include").hook("preAction", (thisCommand) => {
352
358
  syncRootOptsFromCommand(thisCommand);
353
359
  }).action(async (opts) => {
354
360
  const token = requireToken();
@@ -362,17 +368,23 @@ function register(program, helpers) {
362
368
  if (opts.projectId != null) {
363
369
  query.projectId = coerceQueryFlag(opts.projectId, { field: "projectId", flag: "--project-id", kind: "string" }, exitWithError);
364
370
  }
371
+ if (opts.include != null) {
372
+ query.include = coerceQueryFlag(opts.include, { field: "include", flag: "--include", kind: "string" }, exitWithError);
373
+ }
365
374
  const res = await fetchList({ path: "spaces", token, baseUrl: getBaseUrl(), query, all: Boolean(opts.all), request: apiRequest });
366
375
  if (!res.ok) exitWithError(res.status || 500, res.error ?? "Request failed");
367
376
  const data = res.data?.data ?? [];
368
377
  printList({ format: getOutputFormat(), data, fields: opts.fields, where: opts.where, jsonl: Boolean(opts.jsonl) });
369
378
  });
370
- spacesCmd.command("get <id>").description("Get one spaces by id").hook("preAction", (thisCommand) => {
379
+ spacesCmd.command("get <id>").description("Get one spaces by id").option("--include <value>", "Include/filter by include").hook("preAction", (thisCommand) => {
371
380
  syncRootOptsFromCommand(thisCommand);
372
381
  }).action(async (id, opts) => {
373
382
  const token = requireToken();
374
383
  if (!token) exitWithError(401, "Missing or invalid token");
375
384
  const query = {};
385
+ if (opts.include != null) {
386
+ query.include = coerceQueryFlag(opts.include, { field: "include", flag: "--include", kind: "string" }, exitWithError);
387
+ }
376
388
  const res = await apiRequest({ method: "GET", path: "spaces/" + encodeURIComponent(id), token, baseUrl: getBaseUrl(), query });
377
389
  if (!res.ok) exitWithError(res.status || 500, res.error ?? "Request failed");
378
390
  const data = res.data?.data ?? res.data;
@@ -406,7 +418,7 @@ function register(program, helpers) {
406
418
  baseUrl: getBaseUrl(),
407
419
  body,
408
420
  identityFields: ["name", "organizationId", "projectId"],
409
- queryFields: ["organizationId", "projectId"],
421
+ queryFields: ["organizationId", "projectId", "include"],
410
422
  request: apiRequest
411
423
  });
412
424
  if (existing) {
@@ -547,7 +559,7 @@ function register(program, helpers) {
547
559
  if (getOutputFormat() === "json") console.log(JSON.stringify({ data: null, deleted: true }));
548
560
  });
549
561
  const scoutsCmd = program.command("scouts").description("scouts resource");
550
- scoutsCmd.command("list").description("List scouts").option("--limit <n>", "Max results").option("--offset <n>", "Skip n results").option("--all", "Fetch all pages").option("--fields <fields>", "Comma-separated fields to print").option("--where <field=value>", "Client-side exact filters, comma-separated").option("--jsonl", "Print one compact JSON object per row").option("--organization-id <value>", "Filter by organizationId").option("--category-id <value>", "Filter by categoryId").hook("preAction", (thisCommand) => {
562
+ scoutsCmd.command("list").description("List scouts").option("--limit <n>", "Max results").option("--offset <n>", "Skip n results").option("--all", "Fetch all pages").option("--fields <fields>", "Comma-separated fields to print").option("--where <field=value>", "Client-side exact filters, comma-separated").option("--jsonl", "Print one compact JSON object per row").option("--organization-id <value>", "Filter by organizationId").option("--category-id <value>", "Filter by categoryId").option("--include <value>", "Filter by include").hook("preAction", (thisCommand) => {
551
563
  syncRootOptsFromCommand(thisCommand);
552
564
  }).action(async (opts) => {
553
565
  const token = requireToken();
@@ -561,17 +573,23 @@ function register(program, helpers) {
561
573
  if (opts.categoryId != null) {
562
574
  query.categoryId = coerceQueryFlag(opts.categoryId, { field: "categoryId", flag: "--category-id", kind: "string" }, exitWithError);
563
575
  }
576
+ if (opts.include != null) {
577
+ query.include = coerceQueryFlag(opts.include, { field: "include", flag: "--include", kind: "string" }, exitWithError);
578
+ }
564
579
  const res = await fetchList({ path: "scouts", token, baseUrl: getBaseUrl(), query, all: Boolean(opts.all), request: apiRequest });
565
580
  if (!res.ok) exitWithError(res.status || 500, res.error ?? "Request failed");
566
581
  const data = res.data?.data ?? [];
567
582
  printList({ format: getOutputFormat(), data, fields: opts.fields, where: opts.where, jsonl: Boolean(opts.jsonl) });
568
583
  });
569
- scoutsCmd.command("get <id>").description("Get one scouts by id").hook("preAction", (thisCommand) => {
584
+ scoutsCmd.command("get <id>").description("Get one scouts by id").option("--include <value>", "Include/filter by include").hook("preAction", (thisCommand) => {
570
585
  syncRootOptsFromCommand(thisCommand);
571
586
  }).action(async (id, opts) => {
572
587
  const token = requireToken();
573
588
  if (!token) exitWithError(401, "Missing or invalid token");
574
589
  const query = {};
590
+ if (opts.include != null) {
591
+ query.include = coerceQueryFlag(opts.include, { field: "include", flag: "--include", kind: "string" }, exitWithError);
592
+ }
575
593
  const res = await apiRequest({ method: "GET", path: "scouts/" + encodeURIComponent(id), token, baseUrl: getBaseUrl(), query });
576
594
  if (!res.ok) exitWithError(res.status || 500, res.error ?? "Request failed");
577
595
  const data = res.data?.data ?? res.data;
@@ -631,7 +649,7 @@ function register(program, helpers) {
631
649
  baseUrl: getBaseUrl(),
632
650
  body,
633
651
  identityFields: ["name", "organizationId"],
634
- queryFields: ["organizationId", "categoryId"],
652
+ queryFields: ["organizationId", "categoryId", "include"],
635
653
  request: apiRequest
636
654
  });
637
655
  if (existing) {
@@ -844,7 +862,7 @@ function register(program, helpers) {
844
862
  if (getOutputFormat() === "json") console.log(JSON.stringify({ data: null, deleted: true }));
845
863
  });
846
864
  const assetsCmd = program.command("assets").description("assets resource");
847
- assetsCmd.command("list").description("List assets").option("--limit <n>", "Max results").option("--offset <n>", "Skip n results").option("--all", "Fetch all pages").option("--fields <fields>", "Comma-separated fields to print").option("--where <field=value>", "Client-side exact filters, comma-separated").option("--jsonl", "Print one compact JSON object per row").option("--organization-id <value>", "Filter by organizationId").option("--scout-id <value>", "Filter by scoutId").hook("preAction", (thisCommand) => {
865
+ assetsCmd.command("list").description("List assets").option("--limit <n>", "Max results").option("--offset <n>", "Skip n results").option("--all", "Fetch all pages").option("--fields <fields>", "Comma-separated fields to print").option("--where <field=value>", "Client-side exact filters, comma-separated").option("--jsonl", "Print one compact JSON object per row").option("--organization-id <value>", "Filter by organizationId").option("--scout-id <value>", "Filter by scoutId").option("--include <value>", "Filter by include").hook("preAction", (thisCommand) => {
848
866
  syncRootOptsFromCommand(thisCommand);
849
867
  }).action(async (opts) => {
850
868
  const token = requireToken();
@@ -858,17 +876,23 @@ function register(program, helpers) {
858
876
  if (opts.scoutId != null) {
859
877
  query.scoutId = coerceQueryFlag(opts.scoutId, { field: "scoutId", flag: "--scout-id", kind: "string" }, exitWithError);
860
878
  }
879
+ if (opts.include != null) {
880
+ query.include = coerceQueryFlag(opts.include, { field: "include", flag: "--include", kind: "string" }, exitWithError);
881
+ }
861
882
  const res = await fetchList({ path: "assets", token, baseUrl: getBaseUrl(), query, all: Boolean(opts.all), request: apiRequest });
862
883
  if (!res.ok) exitWithError(res.status || 500, res.error ?? "Request failed");
863
884
  const data = res.data?.data ?? [];
864
885
  printList({ format: getOutputFormat(), data, fields: opts.fields, where: opts.where, jsonl: Boolean(opts.jsonl) });
865
886
  });
866
- assetsCmd.command("get <id>").description("Get one assets by id").hook("preAction", (thisCommand) => {
887
+ assetsCmd.command("get <id>").description("Get one assets by id").option("--include <value>", "Include/filter by include").hook("preAction", (thisCommand) => {
867
888
  syncRootOptsFromCommand(thisCommand);
868
889
  }).action(async (id, opts) => {
869
890
  const token = requireToken();
870
891
  if (!token) exitWithError(401, "Missing or invalid token");
871
892
  const query = {};
893
+ if (opts.include != null) {
894
+ query.include = coerceQueryFlag(opts.include, { field: "include", flag: "--include", kind: "string" }, exitWithError);
895
+ }
872
896
  const res = await apiRequest({ method: "GET", path: "assets/" + encodeURIComponent(id), token, baseUrl: getBaseUrl(), query });
873
897
  if (!res.ok) exitWithError(res.status || 500, res.error ?? "Request failed");
874
898
  const data = res.data?.data ?? res.data;
@@ -914,7 +938,7 @@ function register(program, helpers) {
914
938
  baseUrl: getBaseUrl(),
915
939
  body,
916
940
  identityFields: ["name", "organizationId"],
917
- queryFields: ["organizationId", "scoutId"],
941
+ queryFields: ["organizationId", "scoutId", "include"],
918
942
  request: apiRequest
919
943
  });
920
944
  if (existing) {
@@ -1665,4 +1689,4 @@ function register(program, helpers) {
1665
1689
  export {
1666
1690
  register
1667
1691
  };
1668
- //# sourceMappingURL=generated-UG3O6FVC.js.map
1692
+ //# sourceMappingURL=generated-7QDIZ5V5.js.map