@pierre/storage 1.0.0 → 1.0.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 +2 -0
- package/dist/index.cjs +12 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -8
- package/dist/index.d.ts +37 -8
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +7 -1
- package/src/schemas.ts +2 -0
- package/src/types.ts +3 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -345,6 +345,8 @@ function transformFileDiff(raw: RawFileDiff): FileDiff {
|
|
|
345
345
|
raw: raw.raw,
|
|
346
346
|
bytes: raw.bytes,
|
|
347
347
|
isEof: raw.is_eof,
|
|
348
|
+
additions: raw.additions ?? 0,
|
|
349
|
+
deletions: raw.deletions ?? 0,
|
|
348
350
|
};
|
|
349
351
|
}
|
|
350
352
|
|
|
@@ -558,6 +560,7 @@ class RepoImpl implements Repo {
|
|
|
558
560
|
constructor(
|
|
559
561
|
public readonly id: string,
|
|
560
562
|
public readonly defaultBranch: string,
|
|
563
|
+
public readonly createdAt: string,
|
|
561
564
|
private readonly options: GitStorageOptions,
|
|
562
565
|
private readonly generateJWT: (
|
|
563
566
|
repoId: string,
|
|
@@ -1393,6 +1396,7 @@ export class GitStorage {
|
|
|
1393
1396
|
return new RepoImpl(
|
|
1394
1397
|
repoId,
|
|
1395
1398
|
resolvedDefaultBranch ?? 'main',
|
|
1399
|
+
new Date().toISOString(),
|
|
1396
1400
|
this.options,
|
|
1397
1401
|
this.generateJWT.bind(this)
|
|
1398
1402
|
);
|
|
@@ -1444,11 +1448,13 @@ export class GitStorage {
|
|
|
1444
1448
|
if (resp.status === 404) {
|
|
1445
1449
|
return null;
|
|
1446
1450
|
}
|
|
1447
|
-
const body = (await resp.json()) as { default_branch?: string };
|
|
1451
|
+
const body = (await resp.json()) as { default_branch?: string; created_at?: string };
|
|
1448
1452
|
const defaultBranch = body.default_branch ?? 'main';
|
|
1453
|
+
const createdAt = body.created_at ?? '';
|
|
1449
1454
|
return new RepoImpl(
|
|
1450
1455
|
options.id,
|
|
1451
1456
|
defaultBranch,
|
|
1457
|
+
createdAt,
|
|
1452
1458
|
this.options,
|
|
1453
1459
|
this.generateJWT.bind(this)
|
|
1454
1460
|
);
|
package/src/schemas.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -42,6 +42,7 @@ export interface GetRemoteURLOptions {
|
|
|
42
42
|
export interface Repo {
|
|
43
43
|
id: string;
|
|
44
44
|
defaultBranch: string;
|
|
45
|
+
createdAt: string;
|
|
45
46
|
getRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
|
|
46
47
|
getEphemeralRemoteURL(options?: GetRemoteURLOptions): Promise<string>;
|
|
47
48
|
|
|
@@ -425,6 +426,8 @@ export interface DiffFileBase {
|
|
|
425
426
|
|
|
426
427
|
export interface FileDiff extends DiffFileBase {
|
|
427
428
|
raw: string;
|
|
429
|
+
additions: number;
|
|
430
|
+
deletions: number;
|
|
428
431
|
}
|
|
429
432
|
|
|
430
433
|
export interface FilteredFile extends DiffFileBase {}
|