@pierre/storage 0.2.2 → 0.2.3
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/README.md +21 -0
- package/dist/index.cjs +7 -0
- 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 +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +8 -0
- package/src/types.ts +1 -0
package/README.md
CHANGED
|
@@ -76,6 +76,26 @@ const readOnlyUrl = await repo.getRemoteURL({
|
|
|
76
76
|
// - 'repo:write' - Create a repository
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
#### Ephemeral Branches
|
|
80
|
+
|
|
81
|
+
For working with ephemeral branches (temporary branches isolated from the main repository), use
|
|
82
|
+
`getEphemeralRemote()`:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
// Get ephemeral namespace remote URL
|
|
86
|
+
const ephemeralUrl = await repo.getEphemeralRemoteURL();
|
|
87
|
+
// Returns: https://t:JWT@your-name.code.storage/repo-id+ephemeral.git
|
|
88
|
+
|
|
89
|
+
// Configure separate remotes for default and ephemeral branches
|
|
90
|
+
console.log(`Run: git remote add origin ${await repo.getRemoteURL()}`);
|
|
91
|
+
console.log(`Run: git remote add ephemeral ${await repo.getEphemeralRemoteURL()}`);
|
|
92
|
+
|
|
93
|
+
// Push ephemeral branch
|
|
94
|
+
// git push ephemeral feature-branch
|
|
95
|
+
|
|
96
|
+
// The ephemeral remote supports all the same options and permission as regular remotes
|
|
97
|
+
```
|
|
98
|
+
|
|
79
99
|
### Working with Repository Content
|
|
80
100
|
|
|
81
101
|
Once you have a repository instance, you can perform various Git operations:
|
|
@@ -290,6 +310,7 @@ interface FindOneOptions {
|
|
|
290
310
|
interface Repo {
|
|
291
311
|
id: string;
|
|
292
312
|
getRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
|
|
313
|
+
getEphemeralRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
|
|
293
314
|
|
|
294
315
|
getFileStream(options: GetFileOptions): Promise<Response>;
|
|
295
316
|
listFiles(options?: ListFilesOptions): Promise<ListFilesResult>;
|
package/dist/index.cjs
CHANGED
|
@@ -1523,6 +1523,13 @@ var RepoImpl = class {
|
|
|
1523
1523
|
url.password = await this.generateJWT(this.id, urlOptions);
|
|
1524
1524
|
return url.toString();
|
|
1525
1525
|
}
|
|
1526
|
+
async getEphemeralRemoteURL(urlOptions) {
|
|
1527
|
+
const storageBaseUrl = this.options.storageBaseUrl ?? STORAGE_BASE_URL;
|
|
1528
|
+
const url = new URL(`https://${this.options.name}.${storageBaseUrl}/${this.id}+ephemeral.git`);
|
|
1529
|
+
url.username = `t`;
|
|
1530
|
+
url.password = await this.generateJWT(this.id, urlOptions);
|
|
1531
|
+
return url.toString();
|
|
1532
|
+
}
|
|
1526
1533
|
async getFileStream(options) {
|
|
1527
1534
|
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
1528
1535
|
const jwt = await this.generateJWT(this.id, {
|