@pierre/storage 0.5.0 → 0.7.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 +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +7 -6
- package/src/types.ts +1 -0
package/dist/index.d.cts
CHANGED
|
@@ -447,6 +447,7 @@ interface GetRemoteURLOptions {
|
|
|
447
447
|
}
|
|
448
448
|
interface Repo {
|
|
449
449
|
id: string;
|
|
450
|
+
defaultBranch: string;
|
|
450
451
|
getRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
|
|
451
452
|
getEphemeralRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
|
|
452
453
|
getFileStream(options: GetFileOptions): Promise<Response>;
|
package/dist/index.d.ts
CHANGED
|
@@ -447,6 +447,7 @@ interface GetRemoteURLOptions {
|
|
|
447
447
|
}
|
|
448
448
|
interface Repo {
|
|
449
449
|
id: string;
|
|
450
|
+
defaultBranch: string;
|
|
450
451
|
getRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
|
|
451
452
|
getEphemeralRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
|
|
452
453
|
getFileStream(options: GetFileOptions): Promise<Response>;
|
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.
|
|
469
|
+
version: "0.7.0"};
|
|
470
470
|
|
|
471
471
|
// src/version.ts
|
|
472
472
|
var PACKAGE_NAME = "code-storage-sdk";
|
|
@@ -1559,8 +1559,9 @@ function transformGrepFileMatch(raw) {
|
|
|
1559
1559
|
};
|
|
1560
1560
|
}
|
|
1561
1561
|
var RepoImpl = class {
|
|
1562
|
-
constructor(id, options, generateJWT) {
|
|
1562
|
+
constructor(id, defaultBranch, options, generateJWT) {
|
|
1563
1563
|
this.id = id;
|
|
1564
|
+
this.defaultBranch = defaultBranch;
|
|
1564
1565
|
this.options = options;
|
|
1565
1566
|
this.generateJWT = generateJWT;
|
|
1566
1567
|
this.api = getApiInstance(
|
|
@@ -1981,7 +1982,7 @@ var GitStorage = class _GitStorage {
|
|
|
1981
1982
|
provider: "github",
|
|
1982
1983
|
...snakecaseKeys(options.baseRepo)
|
|
1983
1984
|
} : null;
|
|
1984
|
-
const defaultBranch = options?.defaultBranch ?? "main";
|
|
1985
|
+
const defaultBranch = options?.baseRepo?.defaultBranch ?? options?.defaultBranch ?? "main";
|
|
1985
1986
|
const createRepoPath = baseRepoOptions || defaultBranch ? {
|
|
1986
1987
|
path: "repos",
|
|
1987
1988
|
body: {
|
|
@@ -1993,7 +1994,7 @@ var GitStorage = class _GitStorage {
|
|
|
1993
1994
|
if (resp.status === 409) {
|
|
1994
1995
|
throw new Error("Repository already exists");
|
|
1995
1996
|
}
|
|
1996
|
-
return new RepoImpl(repoId, this.options, this.generateJWT.bind(this));
|
|
1997
|
+
return new RepoImpl(repoId, defaultBranch, this.options, this.generateJWT.bind(this));
|
|
1997
1998
|
}
|
|
1998
1999
|
/**
|
|
1999
2000
|
* Find a repository by ID
|
|
@@ -2009,7 +2010,9 @@ var GitStorage = class _GitStorage {
|
|
|
2009
2010
|
if (resp.status === 404) {
|
|
2010
2011
|
return null;
|
|
2011
2012
|
}
|
|
2012
|
-
|
|
2013
|
+
const body = await resp.json();
|
|
2014
|
+
const defaultBranch = body.default_branch ?? "main";
|
|
2015
|
+
return new RepoImpl(options.id, defaultBranch, this.options, this.generateJWT.bind(this));
|
|
2013
2016
|
}
|
|
2014
2017
|
/**
|
|
2015
2018
|
* Delete a repository by ID
|