@pierre/storage 0.1.4 → 0.2.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 +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commit.ts +22 -3
- package/src/index.ts +14 -4
- package/src/types.ts +4 -0
package/dist/index.cjs
CHANGED
|
@@ -197,6 +197,9 @@ var CommitBuilderImpl = class {
|
|
|
197
197
|
this.options.baseBranch = trimmedBase;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
+
if (this.options.ephemeralBase && !this.options.baseBranch) {
|
|
201
|
+
throw new Error("createCommit ephemeralBase requires baseBranch");
|
|
202
|
+
}
|
|
200
203
|
}
|
|
201
204
|
addFile(path, source, options) {
|
|
202
205
|
this.ensureNotSent();
|
|
@@ -290,6 +293,12 @@ var CommitBuilderImpl = class {
|
|
|
290
293
|
email: this.options.committer.email
|
|
291
294
|
};
|
|
292
295
|
}
|
|
296
|
+
if (this.options.ephemeral) {
|
|
297
|
+
metadata.ephemeral = true;
|
|
298
|
+
}
|
|
299
|
+
if (this.options.ephemeralBase) {
|
|
300
|
+
metadata.ephemeral_base = true;
|
|
301
|
+
}
|
|
293
302
|
return metadata;
|
|
294
303
|
}
|
|
295
304
|
ensureNotSent() {
|
|
@@ -587,6 +596,8 @@ function normalizeCommitOptions(options) {
|
|
|
587
596
|
commitMessage: options.commitMessage,
|
|
588
597
|
expectedHeadSha: options.expectedHeadSha,
|
|
589
598
|
baseBranch: options.baseBranch,
|
|
599
|
+
ephemeral: options.ephemeral === true,
|
|
600
|
+
ephemeralBase: options.ephemeralBase === true,
|
|
590
601
|
author: options.author,
|
|
591
602
|
committer: options.committer,
|
|
592
603
|
signal: options.signal,
|
|
@@ -1299,6 +1310,9 @@ var RepoImpl = class {
|
|
|
1299
1310
|
if (options.ref) {
|
|
1300
1311
|
params.ref = options.ref;
|
|
1301
1312
|
}
|
|
1313
|
+
if (typeof options.ephemeral === "boolean") {
|
|
1314
|
+
params.ephemeral = String(options.ephemeral);
|
|
1315
|
+
}
|
|
1302
1316
|
return this.api.get({ path: "repos/file", params }, jwt);
|
|
1303
1317
|
}
|
|
1304
1318
|
async listFiles(options) {
|
|
@@ -1307,8 +1321,17 @@ var RepoImpl = class {
|
|
|
1307
1321
|
permissions: ["git:read"],
|
|
1308
1322
|
ttl
|
|
1309
1323
|
});
|
|
1310
|
-
const params =
|
|
1311
|
-
|
|
1324
|
+
const params = {};
|
|
1325
|
+
if (options?.ref) {
|
|
1326
|
+
params.ref = options.ref;
|
|
1327
|
+
}
|
|
1328
|
+
if (typeof options?.ephemeral === "boolean") {
|
|
1329
|
+
params.ephemeral = String(options.ephemeral);
|
|
1330
|
+
}
|
|
1331
|
+
const response = await this.api.get(
|
|
1332
|
+
{ path: "repos/files", params: Object.keys(params).length ? params : void 0 },
|
|
1333
|
+
jwt
|
|
1334
|
+
);
|
|
1312
1335
|
const raw = listFilesResponseSchema.parse(await response.json());
|
|
1313
1336
|
return { paths: raw.paths, ref: raw.ref };
|
|
1314
1337
|
}
|