@oh-my-ghaad/core 0.0.7 → 0.0.8

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.
@@ -0,0 +1,19 @@
1
+
2
+ 
3
+ > @oh-my-ghaad/core@0.0.7 build /Volumes/T7/repos/oh-my-ghaad/packages/core
4
+ > tsup src/index.ts --dts --format esm,cjs
5
+
6
+ CLI Building entry: src/index.ts
7
+ CLI Using tsconfig: tsconfig.json
8
+ CLI tsup v8.5.0
9
+ CLI Target: esnext
10
+ ESM Build start
11
+ CJS Build start
12
+ CJS dist/index.cjs 12.34 KB
13
+ CJS ⚡️ Build success in 12ms
14
+ ESM dist/index.js 11.11 KB
15
+ ESM ⚡️ Build success in 12ms
16
+ DTS Build start
17
+ DTS ⚡️ Build success in 362ms
18
+ DTS dist/index.d.ts 7.40 KB
19
+ DTS dist/index.d.cts 7.40 KB
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [0.0.8](https://github.com/cmgriffing/oh-my-ghaad/compare/v0.0.7...v0.0.8) (2025-10-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * instead of storing owner and repo separate, store the whole RepositoryResponse object ([db60e6b](https://github.com/cmgriffing/oh-my-ghaad/commit/db60e6b65f2232613a2de3ba6c0a45a51cbb0b27))
7
+
8
+
9
+
1
10
  ## [0.0.7](https://github.com/cmgriffing/oh-my-ghaad/compare/v0.0.6...v0.0.7) (2025-10-04)
2
11
 
3
12
 
package/dist/index.cjs CHANGED
@@ -85,14 +85,8 @@ var Engine = class {
85
85
  const persistedRepo = storage?.getItem(
86
86
  this.appConfig.persistedRepoKey || "repo"
87
87
  );
88
- if (persistedRepo) {
89
- this.getAdapter()?.setRepo(persistedRepo);
90
- }
91
- const persistedOwner = storage?.getItem(
92
- this.appConfig.persistedOwnerKey || "owner"
93
- );
94
- if (persistedOwner) {
95
- this.getAdapter()?.setOwner(persistedOwner);
88
+ if (persistedRepo && typeof persistedRepo === "string") {
89
+ this.getAdapter()?.setRepo(JSON.parse(persistedRepo));
96
90
  }
97
91
  }
98
92
  }
@@ -112,24 +106,15 @@ var Engine = class {
112
106
  (subscription) => subscription(this.collections)
113
107
  );
114
108
  }
115
- setRepoOwner(owner) {
109
+ setRepo(repo) {
116
110
  if (this.appConfig.persisted) {
117
111
  storage?.setItem(
118
- this.appConfig.persistedOwnerKey || "owner",
119
- owner || ""
112
+ this.appConfig.persistedRepoKey || "repo",
113
+ JSON.stringify(repo || {})
120
114
  );
121
115
  }
122
116
  this.adapters.forEach((adapter) => {
123
- adapter.setOwner(owner);
124
- });
125
- this.notifySubscribers();
126
- }
127
- setRepoName(name) {
128
- if (this.appConfig.persisted) {
129
- storage?.setItem(this.appConfig.persistedRepoKey || "repo", name || "");
130
- }
131
- this.adapters.forEach((adapter) => {
132
- adapter.setRepo(name);
117
+ adapter.setRepo(repo);
133
118
  });
134
119
  this.notifySubscribers();
135
120
  }
@@ -428,7 +413,6 @@ var Adapter = class {
428
413
  clientId;
429
414
  redirectUri;
430
415
  token;
431
- owner;
432
416
  repo;
433
417
  accessManagementUrl;
434
418
  scopes;
@@ -439,9 +423,6 @@ var Adapter = class {
439
423
  this.accessManagementUrl = props.accessManagementUrl;
440
424
  this.scopes = props.scopes;
441
425
  }
442
- setOwner(owner) {
443
- this.owner = owner;
444
- }
445
426
  setRepo(repo) {
446
427
  this.repo = repo;
447
428
  }
package/dist/index.d.cts CHANGED
@@ -31,7 +31,7 @@ interface AdapterProps {
31
31
  scopes: string[];
32
32
  }
33
33
  type Subscription = (collections: Collection[]) => void | Promise<void>;
34
- interface RepositoryResponse {
34
+ interface RepositoryResponse$1 {
35
35
  id: string | number;
36
36
  org: string;
37
37
  name: string;
@@ -60,7 +60,7 @@ interface IAdapter extends AdapterProps {
60
60
  readonly secondaryColor: string;
61
61
  readonly oauthUrl: string;
62
62
  readonly baseUrl: string;
63
- fetchRepositories(): Promise<RepositoryResponse[]>;
63
+ fetchRepositories(): Promise<RepositoryResponse$1[]>;
64
64
  fetchFile(filePath: string): Promise<string>;
65
65
  fetchFileHistory(filePath: string): Promise<CommitResponse[]>;
66
66
  fetchDirectory(directoryPath: string): Promise<string[]>;
@@ -83,14 +83,12 @@ declare class Adapter implements AdapterProps {
83
83
  clientId: string;
84
84
  redirectUri: string;
85
85
  token: string | null;
86
- owner: string | null;
87
- repo: string | null;
86
+ repo: RepositoryResponse$1 | null;
88
87
  accessManagementUrl: string;
89
88
  scopes: string[];
90
89
  protected unauthorizedHandler: (() => void | Promise<void>) | null;
91
90
  constructor(props: AdapterProps);
92
- setOwner(owner: string | null): void;
93
- setRepo(repo: string | null): void;
91
+ setRepo(repo: RepositoryResponse$1 | null): void;
94
92
  setToken(token: string | null): void;
95
93
  setUnauthorizedHandler(handler: () => void | Promise<void>): void;
96
94
  }
@@ -132,6 +130,13 @@ type RepoConfig = z.infer<typeof repoConfigSchema> & {
132
130
  status: RepoStatus;
133
131
  };
134
132
 
133
+ interface RepositoryResponse {
134
+ id: string | number;
135
+ org: string;
136
+ name: string;
137
+ url: string;
138
+ }
139
+
135
140
  declare class Engine {
136
141
  private status;
137
142
  private subscriptions;
@@ -150,8 +155,7 @@ declare class Engine {
150
155
  subscribe(subscription: Subscription): void;
151
156
  unsubscribe(subscription: Subscription): void;
152
157
  private notifySubscribers;
153
- setRepoOwner(owner: string | null): void;
154
- setRepoName(name: string | null): void;
158
+ setRepo(repo: RepositoryResponse | null): void;
155
159
  getRepoStatus(): RepoStatus;
156
160
  getAppConfig(): {
157
161
  appName?: string;
@@ -186,4 +190,4 @@ declare class Engine {
186
190
  fetchPullRequests(force?: boolean): Promise<PrResponse[]>;
187
191
  }
188
192
 
189
- export { Adapter, type AdapterProps, type AppConfig, type BaseCollectionItem, Collection, type CollectionItemStatus, type CollectionStatus, type CommitRequest, type CommitResponse, Engine, type IAdapter, type InvalidRepoStatus, type PendingCollectionItemType, type PrRequest, type PrResponse, type RepoConfig, type RepoStatus, type RepositoryResponse, type Subscription, type ValidRepoStatus, appConfigSchema, repoConfigSchema };
193
+ export { Adapter, type AdapterProps, type AppConfig, type BaseCollectionItem, Collection, type CollectionItemStatus, type CollectionStatus, type CommitRequest, type CommitResponse, Engine, type IAdapter, type InvalidRepoStatus, type PendingCollectionItemType, type PrRequest, type PrResponse, type RepoConfig, type RepoStatus, type RepositoryResponse$1 as RepositoryResponse, type Subscription, type ValidRepoStatus, appConfigSchema, repoConfigSchema };
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ interface AdapterProps {
31
31
  scopes: string[];
32
32
  }
33
33
  type Subscription = (collections: Collection[]) => void | Promise<void>;
34
- interface RepositoryResponse {
34
+ interface RepositoryResponse$1 {
35
35
  id: string | number;
36
36
  org: string;
37
37
  name: string;
@@ -60,7 +60,7 @@ interface IAdapter extends AdapterProps {
60
60
  readonly secondaryColor: string;
61
61
  readonly oauthUrl: string;
62
62
  readonly baseUrl: string;
63
- fetchRepositories(): Promise<RepositoryResponse[]>;
63
+ fetchRepositories(): Promise<RepositoryResponse$1[]>;
64
64
  fetchFile(filePath: string): Promise<string>;
65
65
  fetchFileHistory(filePath: string): Promise<CommitResponse[]>;
66
66
  fetchDirectory(directoryPath: string): Promise<string[]>;
@@ -83,14 +83,12 @@ declare class Adapter implements AdapterProps {
83
83
  clientId: string;
84
84
  redirectUri: string;
85
85
  token: string | null;
86
- owner: string | null;
87
- repo: string | null;
86
+ repo: RepositoryResponse$1 | null;
88
87
  accessManagementUrl: string;
89
88
  scopes: string[];
90
89
  protected unauthorizedHandler: (() => void | Promise<void>) | null;
91
90
  constructor(props: AdapterProps);
92
- setOwner(owner: string | null): void;
93
- setRepo(repo: string | null): void;
91
+ setRepo(repo: RepositoryResponse$1 | null): void;
94
92
  setToken(token: string | null): void;
95
93
  setUnauthorizedHandler(handler: () => void | Promise<void>): void;
96
94
  }
@@ -132,6 +130,13 @@ type RepoConfig = z.infer<typeof repoConfigSchema> & {
132
130
  status: RepoStatus;
133
131
  };
134
132
 
133
+ interface RepositoryResponse {
134
+ id: string | number;
135
+ org: string;
136
+ name: string;
137
+ url: string;
138
+ }
139
+
135
140
  declare class Engine {
136
141
  private status;
137
142
  private subscriptions;
@@ -150,8 +155,7 @@ declare class Engine {
150
155
  subscribe(subscription: Subscription): void;
151
156
  unsubscribe(subscription: Subscription): void;
152
157
  private notifySubscribers;
153
- setRepoOwner(owner: string | null): void;
154
- setRepoName(name: string | null): void;
158
+ setRepo(repo: RepositoryResponse | null): void;
155
159
  getRepoStatus(): RepoStatus;
156
160
  getAppConfig(): {
157
161
  appName?: string;
@@ -186,4 +190,4 @@ declare class Engine {
186
190
  fetchPullRequests(force?: boolean): Promise<PrResponse[]>;
187
191
  }
188
192
 
189
- export { Adapter, type AdapterProps, type AppConfig, type BaseCollectionItem, Collection, type CollectionItemStatus, type CollectionStatus, type CommitRequest, type CommitResponse, Engine, type IAdapter, type InvalidRepoStatus, type PendingCollectionItemType, type PrRequest, type PrResponse, type RepoConfig, type RepoStatus, type RepositoryResponse, type Subscription, type ValidRepoStatus, appConfigSchema, repoConfigSchema };
193
+ export { Adapter, type AdapterProps, type AppConfig, type BaseCollectionItem, Collection, type CollectionItemStatus, type CollectionStatus, type CommitRequest, type CommitResponse, Engine, type IAdapter, type InvalidRepoStatus, type PendingCollectionItemType, type PrRequest, type PrResponse, type RepoConfig, type RepoStatus, type RepositoryResponse$1 as RepositoryResponse, type Subscription, type ValidRepoStatus, appConfigSchema, repoConfigSchema };
package/dist/index.js CHANGED
@@ -56,14 +56,8 @@ var Engine = class {
56
56
  const persistedRepo = storage?.getItem(
57
57
  this.appConfig.persistedRepoKey || "repo"
58
58
  );
59
- if (persistedRepo) {
60
- this.getAdapter()?.setRepo(persistedRepo);
61
- }
62
- const persistedOwner = storage?.getItem(
63
- this.appConfig.persistedOwnerKey || "owner"
64
- );
65
- if (persistedOwner) {
66
- this.getAdapter()?.setOwner(persistedOwner);
59
+ if (persistedRepo && typeof persistedRepo === "string") {
60
+ this.getAdapter()?.setRepo(JSON.parse(persistedRepo));
67
61
  }
68
62
  }
69
63
  }
@@ -83,24 +77,15 @@ var Engine = class {
83
77
  (subscription) => subscription(this.collections)
84
78
  );
85
79
  }
86
- setRepoOwner(owner) {
80
+ setRepo(repo) {
87
81
  if (this.appConfig.persisted) {
88
82
  storage?.setItem(
89
- this.appConfig.persistedOwnerKey || "owner",
90
- owner || ""
83
+ this.appConfig.persistedRepoKey || "repo",
84
+ JSON.stringify(repo || {})
91
85
  );
92
86
  }
93
87
  this.adapters.forEach((adapter) => {
94
- adapter.setOwner(owner);
95
- });
96
- this.notifySubscribers();
97
- }
98
- setRepoName(name) {
99
- if (this.appConfig.persisted) {
100
- storage?.setItem(this.appConfig.persistedRepoKey || "repo", name || "");
101
- }
102
- this.adapters.forEach((adapter) => {
103
- adapter.setRepo(name);
88
+ adapter.setRepo(repo);
104
89
  });
105
90
  this.notifySubscribers();
106
91
  }
@@ -399,7 +384,6 @@ var Adapter = class {
399
384
  clientId;
400
385
  redirectUri;
401
386
  token;
402
- owner;
403
387
  repo;
404
388
  accessManagementUrl;
405
389
  scopes;
@@ -410,9 +394,6 @@ var Adapter = class {
410
394
  this.accessManagementUrl = props.accessManagementUrl;
411
395
  this.scopes = props.scopes;
412
396
  }
413
- setOwner(owner) {
414
- this.owner = owner;
415
- }
416
397
  setRepo(repo) {
417
398
  this.repo = repo;
418
399
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-ghaad/core",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/adapter.ts CHANGED
@@ -1,11 +1,10 @@
1
- import { AdapterProps } from "./types";
1
+ import { AdapterProps, RepositoryResponse } from "./types";
2
2
 
3
3
  export class Adapter implements AdapterProps {
4
4
  clientId: string;
5
5
  redirectUri: string;
6
6
  token: string | null;
7
- owner: string | null;
8
- repo: string | null;
7
+ repo: RepositoryResponse | null;
9
8
  accessManagementUrl: string;
10
9
  scopes: string[];
11
10
  protected unauthorizedHandler: (() => void | Promise<void>) | null = null;
@@ -17,11 +16,7 @@ export class Adapter implements AdapterProps {
17
16
  this.scopes = props.scopes;
18
17
  }
19
18
 
20
- setOwner(owner: string | null) {
21
- this.owner = owner;
22
- }
23
-
24
- setRepo(repo: string | null) {
19
+ setRepo(repo: RepositoryResponse | null) {
25
20
  this.repo = repo;
26
21
  }
27
22
 
package/src/engine.ts CHANGED
@@ -5,6 +5,7 @@ import type { IAdapter, PrResponse, RepoStatus, Subscription } from "./types";
5
5
  import { Adapter } from "./adapter";
6
6
  import type { AppConfig, RepoConfig } from "./validators";
7
7
  import { repoConfigSchema } from "./validators";
8
+ import { RepositoryResponse } from "../dist";
8
9
 
9
10
  const storage = typeof window !== "undefined" ? window.localStorage : null;
10
11
 
@@ -63,15 +64,8 @@ export class Engine {
63
64
  const persistedRepo = storage?.getItem(
64
65
  this.appConfig.persistedRepoKey || "repo"
65
66
  );
66
- if (persistedRepo) {
67
- this.getAdapter()?.setRepo(persistedRepo);
68
- }
69
-
70
- const persistedOwner = storage?.getItem(
71
- this.appConfig.persistedOwnerKey || "owner"
72
- );
73
- if (persistedOwner) {
74
- this.getAdapter()?.setOwner(persistedOwner);
67
+ if (persistedRepo && typeof persistedRepo === "string") {
68
+ this.getAdapter()?.setRepo(JSON.parse(persistedRepo));
75
69
  }
76
70
  }
77
71
  }
@@ -96,27 +90,16 @@ export class Engine {
96
90
  );
97
91
  }
98
92
 
99
- setRepoOwner(owner: string | null) {
93
+ setRepo(repo: RepositoryResponse | null) {
100
94
  if (this.appConfig.persisted) {
101
95
  storage?.setItem(
102
- this.appConfig.persistedOwnerKey || "owner",
103
- owner || ""
96
+ this.appConfig.persistedRepoKey || "repo",
97
+ JSON.stringify(repo || {})
104
98
  );
105
99
  }
106
100
 
107
101
  this.adapters.forEach((adapter) => {
108
- adapter.setOwner(owner);
109
- });
110
- this.notifySubscribers();
111
- }
112
-
113
- setRepoName(name: string | null) {
114
- if (this.appConfig.persisted) {
115
- storage?.setItem(this.appConfig.persistedRepoKey || "repo", name || "");
116
- }
117
-
118
- this.adapters.forEach((adapter) => {
119
- adapter.setRepo(name);
102
+ adapter.setRepo(repo);
120
103
  });
121
104
  this.notifySubscribers();
122
105
  }