@pierre/storage 0.3.0 → 0.4.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.cjs CHANGED
@@ -450,7 +450,7 @@ function concatChunks(a, b) {
450
450
 
451
451
  // package.json
452
452
  var package_default = {
453
- version: "0.3.0"};
453
+ version: "0.4.0"};
454
454
 
455
455
  // src/version.ts
456
456
  var PACKAGE_NAME = "code-storage-sdk";
@@ -1903,6 +1903,30 @@ var GitStorage = class _GitStorage {
1903
1903
  }
1904
1904
  return new RepoImpl(options.id, this.options, this.generateJWT.bind(this));
1905
1905
  }
1906
+ /**
1907
+ * Delete a repository by ID
1908
+ * @param options The delete options containing the repo ID
1909
+ * @returns The deletion result
1910
+ */
1911
+ async deleteRepo(options) {
1912
+ const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
1913
+ const jwt = await this.generateJWT(options.id, {
1914
+ permissions: ["repo:write"],
1915
+ ttl
1916
+ });
1917
+ const resp = await this.api.delete("repos/delete", jwt, { allowedStatus: [404, 409] });
1918
+ if (resp.status === 404) {
1919
+ throw new Error("Repository not found");
1920
+ }
1921
+ if (resp.status === 409) {
1922
+ throw new Error("Repository already deleted");
1923
+ }
1924
+ const body = await resp.json();
1925
+ return {
1926
+ repoId: body.repo_id,
1927
+ message: body.message
1928
+ };
1929
+ }
1906
1930
  /**
1907
1931
  * Get the current configuration
1908
1932
  * @returns The client configuration