@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.js
CHANGED
|
@@ -191,6 +191,9 @@ var CommitBuilderImpl = class {
|
|
|
191
191
|
this.options.baseBranch = trimmedBase;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
+
if (this.options.ephemeralBase && !this.options.baseBranch) {
|
|
195
|
+
throw new Error("createCommit ephemeralBase requires baseBranch");
|
|
196
|
+
}
|
|
194
197
|
}
|
|
195
198
|
addFile(path, source, options) {
|
|
196
199
|
this.ensureNotSent();
|
|
@@ -284,6 +287,12 @@ var CommitBuilderImpl = class {
|
|
|
284
287
|
email: this.options.committer.email
|
|
285
288
|
};
|
|
286
289
|
}
|
|
290
|
+
if (this.options.ephemeral) {
|
|
291
|
+
metadata.ephemeral = true;
|
|
292
|
+
}
|
|
293
|
+
if (this.options.ephemeralBase) {
|
|
294
|
+
metadata.ephemeral_base = true;
|
|
295
|
+
}
|
|
287
296
|
return metadata;
|
|
288
297
|
}
|
|
289
298
|
ensureNotSent() {
|
|
@@ -581,6 +590,8 @@ function normalizeCommitOptions(options) {
|
|
|
581
590
|
commitMessage: options.commitMessage,
|
|
582
591
|
expectedHeadSha: options.expectedHeadSha,
|
|
583
592
|
baseBranch: options.baseBranch,
|
|
593
|
+
ephemeral: options.ephemeral === true,
|
|
594
|
+
ephemeralBase: options.ephemeralBase === true,
|
|
584
595
|
author: options.author,
|
|
585
596
|
committer: options.committer,
|
|
586
597
|
signal: options.signal,
|
|
@@ -1293,6 +1304,9 @@ var RepoImpl = class {
|
|
|
1293
1304
|
if (options.ref) {
|
|
1294
1305
|
params.ref = options.ref;
|
|
1295
1306
|
}
|
|
1307
|
+
if (typeof options.ephemeral === "boolean") {
|
|
1308
|
+
params.ephemeral = String(options.ephemeral);
|
|
1309
|
+
}
|
|
1296
1310
|
return this.api.get({ path: "repos/file", params }, jwt);
|
|
1297
1311
|
}
|
|
1298
1312
|
async listFiles(options) {
|
|
@@ -1301,8 +1315,17 @@ var RepoImpl = class {
|
|
|
1301
1315
|
permissions: ["git:read"],
|
|
1302
1316
|
ttl
|
|
1303
1317
|
});
|
|
1304
|
-
const params =
|
|
1305
|
-
|
|
1318
|
+
const params = {};
|
|
1319
|
+
if (options?.ref) {
|
|
1320
|
+
params.ref = options.ref;
|
|
1321
|
+
}
|
|
1322
|
+
if (typeof options?.ephemeral === "boolean") {
|
|
1323
|
+
params.ephemeral = String(options.ephemeral);
|
|
1324
|
+
}
|
|
1325
|
+
const response = await this.api.get(
|
|
1326
|
+
{ path: "repos/files", params: Object.keys(params).length ? params : void 0 },
|
|
1327
|
+
jwt
|
|
1328
|
+
);
|
|
1306
1329
|
const raw = listFilesResponseSchema.parse(await response.json());
|
|
1307
1330
|
return { paths: raw.paths, ref: raw.ref };
|
|
1308
1331
|
}
|