@pierre/storage 0.4.1 → 0.5.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.d.cts CHANGED
@@ -466,7 +466,7 @@ type ValidMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
466
466
  type SimplePath = string;
467
467
  type ComplexPath = {
468
468
  path: string;
469
- params?: Record<string, string>;
469
+ params?: Record<string, string | string[]>;
470
470
  body?: Record<string, any>;
471
471
  };
472
472
  type ValidPath = SimplePath | ComplexPath;
@@ -573,6 +573,8 @@ interface GetBranchDiffOptions extends GitStorageInvocationOptions {
573
573
  base?: string;
574
574
  ephemeral?: boolean;
575
575
  ephemeralBase?: boolean;
576
+ /** Optional paths to filter the diff to specific files */
577
+ paths?: string[];
576
578
  }
577
579
  type GetBranchDiffResponse = GetBranchDiffResponseRaw;
578
580
  interface GetBranchDiffResult {
@@ -585,6 +587,8 @@ interface GetBranchDiffResult {
585
587
  interface GetCommitDiffOptions extends GitStorageInvocationOptions {
586
588
  sha: string;
587
589
  baseSha?: string;
590
+ /** Optional paths to filter the diff to specific files */
591
+ paths?: string[];
588
592
  }
589
593
  type GetCommitDiffResponse = GetCommitDiffResponseRaw;
590
594
  interface GetCommitDiffResult {
package/dist/index.d.ts CHANGED
@@ -466,7 +466,7 @@ type ValidMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
466
466
  type SimplePath = string;
467
467
  type ComplexPath = {
468
468
  path: string;
469
- params?: Record<string, string>;
469
+ params?: Record<string, string | string[]>;
470
470
  body?: Record<string, any>;
471
471
  };
472
472
  type ValidPath = SimplePath | ComplexPath;
@@ -573,6 +573,8 @@ interface GetBranchDiffOptions extends GitStorageInvocationOptions {
573
573
  base?: string;
574
574
  ephemeral?: boolean;
575
575
  ephemeralBase?: boolean;
576
+ /** Optional paths to filter the diff to specific files */
577
+ paths?: string[];
576
578
  }
577
579
  type GetBranchDiffResponse = GetBranchDiffResponseRaw;
578
580
  interface GetBranchDiffResult {
@@ -585,6 +587,8 @@ interface GetBranchDiffResult {
585
587
  interface GetCommitDiffOptions extends GitStorageInvocationOptions {
586
588
  sha: string;
587
589
  baseSha?: string;
590
+ /** Optional paths to filter the diff to specific files */
591
+ paths?: string[];
588
592
  }
589
593
  type GetCommitDiffResponse = GetCommitDiffResponseRaw;
590
594
  interface GetCommitDiffResult {
package/dist/index.js CHANGED
@@ -466,7 +466,7 @@ function concatChunks(a, b) {
466
466
 
467
467
  // package.json
468
468
  var package_default = {
469
- version: "0.4.1"};
469
+ version: "0.5.0"};
470
470
 
471
471
  // src/version.ts
472
472
  var PACKAGE_NAME = "code-storage-sdk";
@@ -1004,7 +1004,17 @@ var ApiFetcher = class {
1004
1004
  if (typeof path === "string") {
1005
1005
  return `${this.getBaseUrl()}/${path}`;
1006
1006
  } else if (path.params) {
1007
- const paramStr = new URLSearchParams(path.params).toString();
1007
+ const searchParams = new URLSearchParams();
1008
+ for (const [key, value] of Object.entries(path.params)) {
1009
+ if (Array.isArray(value)) {
1010
+ for (const v of value) {
1011
+ searchParams.append(key, v);
1012
+ }
1013
+ } else {
1014
+ searchParams.append(key, value);
1015
+ }
1016
+ }
1017
+ const paramStr = searchParams.toString();
1008
1018
  return `${this.getBaseUrl()}/${path.path}${paramStr ? `?${paramStr}` : ""}`;
1009
1019
  } else {
1010
1020
  return `${this.getBaseUrl()}/${path.path}`;
@@ -1680,6 +1690,9 @@ var RepoImpl = class {
1680
1690
  if (typeof options.ephemeralBase === "boolean") {
1681
1691
  params.ephemeral_base = String(options.ephemeralBase);
1682
1692
  }
1693
+ if (options.paths && options.paths.length > 0) {
1694
+ params.path = options.paths;
1695
+ }
1683
1696
  const response = await this.api.get({ path: "repos/branches/diff", params }, jwt);
1684
1697
  const raw = branchDiffResponseSchema.parse(await response.json());
1685
1698
  return transformBranchDiffResult(raw);
@@ -1696,6 +1709,9 @@ var RepoImpl = class {
1696
1709
  if (options.baseSha) {
1697
1710
  params.baseSha = options.baseSha;
1698
1711
  }
1712
+ if (options.paths && options.paths.length > 0) {
1713
+ params.path = options.paths;
1714
+ }
1699
1715
  const response = await this.api.get({ path: "repos/diff", params }, jwt);
1700
1716
  const raw = commitDiffResponseSchema.parse(await response.json());
1701
1717
  return transformCommitDiffResult(raw);