@pierre/storage 1.2.0 → 1.2.2
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 +20 -1
- package/dist/index.cjs +12 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
- package/src/index.ts +12 -0
- package/src/types.ts +2 -0
package/README.md
CHANGED
|
@@ -126,7 +126,7 @@ const readOnlyUrl = await repo.getRemoteURL({
|
|
|
126
126
|
#### Ephemeral Branches
|
|
127
127
|
|
|
128
128
|
For working with ephemeral branches (temporary branches isolated from the main
|
|
129
|
-
repository), use `
|
|
129
|
+
repository), use `getEphemeralRemoteURL()`:
|
|
130
130
|
|
|
131
131
|
```typescript
|
|
132
132
|
// Get ephemeral namespace remote URL
|
|
@@ -145,6 +145,23 @@ console.log(
|
|
|
145
145
|
// The ephemeral remote supports all the same options and permission as regular remotes
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
+
#### Import Remote
|
|
149
|
+
|
|
150
|
+
For write-only history imports, use `getImportRemoteURL()`:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// Get import remote URL
|
|
154
|
+
const importUrl = await repo.getImportRemoteURL();
|
|
155
|
+
// Returns: https://t:JWT@your-name.code.storage/repo-id+import.git
|
|
156
|
+
|
|
157
|
+
console.log(`Run: git remote add import ${importUrl}`);
|
|
158
|
+
|
|
159
|
+
// Push imported history through the import remote
|
|
160
|
+
// git push import main
|
|
161
|
+
|
|
162
|
+
// Reads are disabled on +import remotes; use the repository remote for clone/fetch
|
|
163
|
+
```
|
|
164
|
+
|
|
148
165
|
### Working with Repository Content
|
|
149
166
|
|
|
150
167
|
Once you have a repository instance, you can perform various Git operations:
|
|
@@ -171,6 +188,7 @@ const archiveResp = await repo.getArchiveStream({
|
|
|
171
188
|
ref: 'main',
|
|
172
189
|
includeGlobs: ['README.md'],
|
|
173
190
|
excludeGlobs: ['vendor/**'],
|
|
191
|
+
maxBlobSize: 1024 * 1024, // optional max file size in bytes
|
|
174
192
|
archivePrefix: 'repo/',
|
|
175
193
|
});
|
|
176
194
|
const archiveBytes = new Uint8Array(await archiveResp.arrayBuffer());
|
|
@@ -469,6 +487,7 @@ interface ArchiveOptions {
|
|
|
469
487
|
ref?: string; // Branch, tag, or commit SHA (defaults to default branch)
|
|
470
488
|
includeGlobs?: string[];
|
|
471
489
|
excludeGlobs?: string[];
|
|
490
|
+
maxBlobSize?: number; // Optional max file size in bytes
|
|
472
491
|
archivePrefix?: string;
|
|
473
492
|
ttl?: number;
|
|
474
493
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -530,7 +530,7 @@ function concatChunks(a, b) {
|
|
|
530
530
|
|
|
531
531
|
// package.json
|
|
532
532
|
var package_default = {
|
|
533
|
-
version: "1.2.
|
|
533
|
+
version: "1.2.2"};
|
|
534
534
|
|
|
535
535
|
// src/version.ts
|
|
536
536
|
var PACKAGE_NAME = "code-storage-sdk";
|
|
@@ -1825,6 +1825,14 @@ var RepoImpl = class {
|
|
|
1825
1825
|
url.password = await this.generateJWT(this.id, urlOptions);
|
|
1826
1826
|
return url.toString();
|
|
1827
1827
|
}
|
|
1828
|
+
async getImportRemoteURL(urlOptions) {
|
|
1829
|
+
const url = new URL(
|
|
1830
|
+
`https://${this.options.storageBaseUrl}/${this.id}+import.git`
|
|
1831
|
+
);
|
|
1832
|
+
url.username = `t`;
|
|
1833
|
+
url.password = await this.generateJWT(this.id, urlOptions);
|
|
1834
|
+
return url.toString();
|
|
1835
|
+
}
|
|
1828
1836
|
async getFileStream(options) {
|
|
1829
1837
|
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
1830
1838
|
const jwt = await this.generateJWT(this.id, {
|
|
@@ -1862,6 +1870,9 @@ var RepoImpl = class {
|
|
|
1862
1870
|
if (Array.isArray(options.excludeGlobs) && options.excludeGlobs.length > 0) {
|
|
1863
1871
|
body.exclude_globs = options.excludeGlobs;
|
|
1864
1872
|
}
|
|
1873
|
+
if (typeof options.maxBlobSize === "number" && Number.isFinite(options.maxBlobSize)) {
|
|
1874
|
+
body.max_blob_size = options.maxBlobSize;
|
|
1875
|
+
}
|
|
1865
1876
|
if (typeof options.archivePrefix === "string") {
|
|
1866
1877
|
const prefix = options.archivePrefix.trim();
|
|
1867
1878
|
if (prefix) {
|