@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pierre/storage",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Pierre Git Storage SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
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
@@ -88,6 +88,8 @@ export const diffFileRawSchema = z.object({
88
88
  raw: z.string(),
89
89
  bytes: z.number(),
90
90
  is_eof: z.boolean(),
91
+ additions: z.number().optional(),
92
+ deletions: z.number().optional(),
91
93
  });
92
94
 
93
95
  export const filteredFileRawSchema = z.object({
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 {}