@offworld/sdk 0.1.2 → 0.1.4
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 +29 -25
- package/dist/index.d.mts +1 -64
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +36 -7
package/README.md
CHANGED
|
@@ -12,24 +12,24 @@ bun add @offworld/sdk
|
|
|
12
12
|
|
|
13
13
|
## Modules
|
|
14
14
|
|
|
15
|
-
| Module
|
|
16
|
-
|
|
|
17
|
-
| `config.ts`
|
|
18
|
-
| `paths.ts`
|
|
19
|
-
| `clone.ts`
|
|
20
|
-
| `index-manager.ts`
|
|
21
|
-
| `generate.ts`
|
|
22
|
-
| `sync.ts`
|
|
23
|
-
| `auth.ts`
|
|
24
|
-
| `agents.ts`
|
|
25
|
-
| `agents-md.ts`
|
|
26
|
-
| `repo-source.ts`
|
|
27
|
-
| `manifest.ts`
|
|
28
|
-
| `dep-mappings.ts`
|
|
29
|
-
| `reference-matcher.ts` | Match deps to installed references
|
|
30
|
-
| `repo-manager.ts`
|
|
31
|
-
| `models.ts`
|
|
32
|
-
| `installation.ts`
|
|
15
|
+
| Module | Description |
|
|
16
|
+
| ---------------------- | ----------------------------------------- |
|
|
17
|
+
| `config.ts` | Config load/save, path utilities |
|
|
18
|
+
| `paths.ts` | XDG-compliant path resolution |
|
|
19
|
+
| `clone.ts` | Git clone/update/remove |
|
|
20
|
+
| `index-manager.ts` | Global + project map management |
|
|
21
|
+
| `generate.ts` | AI reference generation |
|
|
22
|
+
| `sync.ts` | Convex client for push/pull |
|
|
23
|
+
| `auth.ts` | WorkOS token management |
|
|
24
|
+
| `agents.ts` | Agent registry |
|
|
25
|
+
| `agents-md.ts` | AGENTS.md reference table generation |
|
|
26
|
+
| `repo-source.ts` | Parse repo input (URL, owner/repo, local) |
|
|
27
|
+
| `manifest.ts` | Dependency parsing (package.json, etc.) |
|
|
28
|
+
| `dep-mappings.ts` | npm package to GitHub repo resolution |
|
|
29
|
+
| `reference-matcher.ts` | Match deps to installed references |
|
|
30
|
+
| `repo-manager.ts` | Bulk repo operations (update, prune, gc) |
|
|
31
|
+
| `models.ts` | AI provider/model registry |
|
|
32
|
+
| `installation.ts` | Upgrade/uninstall utilities |
|
|
33
33
|
|
|
34
34
|
## Usage
|
|
35
35
|
|
|
@@ -84,7 +84,11 @@ await pushReference("owner/repo", referenceData);
|
|
|
84
84
|
### Dependency Resolution
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
|
-
import {
|
|
87
|
+
import {
|
|
88
|
+
parseDependencies,
|
|
89
|
+
resolveDependencyRepo,
|
|
90
|
+
matchDependenciesToReferences,
|
|
91
|
+
} from "@offworld/sdk";
|
|
88
92
|
|
|
89
93
|
const deps = parseDependencies("package.json");
|
|
90
94
|
const repo = await resolveDependencyRepo("zod");
|
|
@@ -93,12 +97,12 @@ const matches = matchDependenciesToReferences(deps);
|
|
|
93
97
|
|
|
94
98
|
## Data Paths
|
|
95
99
|
|
|
96
|
-
| Purpose
|
|
97
|
-
|
|
|
98
|
-
| Config
|
|
99
|
-
| Data root
|
|
100
|
-
| Skill dir
|
|
101
|
-
| Global map | `Paths.globalMap`
|
|
100
|
+
| Purpose | Getter |
|
|
101
|
+
| ---------- | --------------------- |
|
|
102
|
+
| Config | `Paths.config` |
|
|
103
|
+
| Data root | `Paths.data` |
|
|
104
|
+
| Skill dir | `Paths.offworldDir` |
|
|
105
|
+
| Global map | `Paths.globalMap` |
|
|
102
106
|
| References | `Paths.referencesDir` |
|
|
103
107
|
|
|
104
108
|
## Commands
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { Agent, Config, Config as Config$1, FileIndex, FileIndexEntry, FileRole,
|
|
|
5
5
|
* SDK Constants
|
|
6
6
|
*/
|
|
7
7
|
/** SDK version - must match package.json */
|
|
8
|
-
declare const VERSION = "0.1.
|
|
8
|
+
declare const VERSION = "0.1.4";
|
|
9
9
|
/**
|
|
10
10
|
* Default patterns to ignore when scanning repositories.
|
|
11
11
|
* Includes directories, binary files, IDE configs, and build outputs.
|
|
@@ -269,19 +269,7 @@ interface CloneOptions {
|
|
|
269
269
|
/** Use sparse checkout for large repos (only src/, lib/, packages/, docs/) */
|
|
270
270
|
sparse?: boolean;
|
|
271
271
|
}
|
|
272
|
-
/**
|
|
273
|
-
* Get the current commit SHA for a repository
|
|
274
|
-
*/
|
|
275
272
|
declare function getCommitSha(repoPath: string): string;
|
|
276
|
-
/**
|
|
277
|
-
* Get the number of commits between two SHAs.
|
|
278
|
-
* Returns the number of commits from `olderSha` to `newerSha`.
|
|
279
|
-
* Returns null if the distance cannot be determined (e.g., shallow clone without the commit).
|
|
280
|
-
*
|
|
281
|
-
* @param repoPath - Path to the git repository
|
|
282
|
-
* @param olderSha - The older commit SHA (e.g., remote skill's commit)
|
|
283
|
-
* @param newerSha - The newer commit SHA (e.g., current HEAD), defaults to HEAD
|
|
284
|
-
*/
|
|
285
273
|
declare function getCommitDistance(repoPath: string, olderSha: string, newerSha?: string): number | null;
|
|
286
274
|
/**
|
|
287
275
|
* Clone a remote repository to the local repo root.
|
|
@@ -293,15 +281,7 @@ declare function getCommitDistance(repoPath: string, olderSha: string, newerSha?
|
|
|
293
281
|
* @throws GitError if clone fails
|
|
294
282
|
*/
|
|
295
283
|
declare function cloneRepo(source: RemoteRepoSource, options?: CloneOptions): Promise<string>;
|
|
296
|
-
/**
|
|
297
|
-
* Check if a repository is a shallow clone.
|
|
298
|
-
*/
|
|
299
284
|
declare function isShallowClone(repoPath: string): boolean;
|
|
300
|
-
/**
|
|
301
|
-
* Convert a shallow clone to a full clone by fetching all history.
|
|
302
|
-
* Returns true if the repo was shallow and is now unshallowed.
|
|
303
|
-
* Returns false if the repo was already a full clone.
|
|
304
|
-
*/
|
|
305
285
|
declare function unshallowRepo(repoPath: string): Promise<boolean>;
|
|
306
286
|
interface UpdateResult {
|
|
307
287
|
/** Whether any updates were fetched */
|
|
@@ -328,31 +308,11 @@ interface UpdateOptions {
|
|
|
328
308
|
*/
|
|
329
309
|
declare function updateRepo(qualifiedName: string, options?: UpdateOptions): Promise<UpdateResult>;
|
|
330
310
|
interface RemoveOptions {
|
|
331
|
-
/** Only remove reference files (keep cloned repo) */
|
|
332
311
|
referenceOnly?: boolean;
|
|
333
|
-
/** Only remove cloned repo (keep reference files) */
|
|
334
312
|
repoOnly?: boolean;
|
|
335
313
|
}
|
|
336
|
-
/**
|
|
337
|
-
* Remove a cloned repository and its reference data.
|
|
338
|
-
*
|
|
339
|
-
* @param qualifiedName - The qualified name of the repo
|
|
340
|
-
* @param options - Remove options
|
|
341
|
-
* @returns true if removed, false if not found
|
|
342
|
-
*/
|
|
343
314
|
declare function removeRepo(qualifiedName: string, options?: RemoveOptions): Promise<boolean>;
|
|
344
|
-
/**
|
|
345
|
-
* List all cloned repositories from the global map.
|
|
346
|
-
*
|
|
347
|
-
* @returns Array of qualified names
|
|
348
|
-
*/
|
|
349
315
|
declare function listRepos(): string[];
|
|
350
|
-
/**
|
|
351
|
-
* Check if a repository is cloned and in the map.
|
|
352
|
-
*
|
|
353
|
-
* @param qualifiedName - The qualified name of the repo
|
|
354
|
-
* @returns true if repo exists in map and on disk
|
|
355
|
-
*/
|
|
356
316
|
declare function isRepoCloned(qualifiedName: string): boolean;
|
|
357
317
|
/**
|
|
358
318
|
* Get the local path for a cloned repository.
|
|
@@ -567,7 +527,6 @@ declare function validatePushAllowed(source: RepoSource$1): void;
|
|
|
567
527
|
/**
|
|
568
528
|
* Authentication utilities for offworld CLI
|
|
569
529
|
*/
|
|
570
|
-
/** Stored authentication data */
|
|
571
530
|
interface AuthData {
|
|
572
531
|
token: string;
|
|
573
532
|
expiresAt?: string;
|
|
@@ -591,15 +550,7 @@ declare class NotLoggedInError extends AuthError {
|
|
|
591
550
|
declare class TokenExpiredError extends AuthError {
|
|
592
551
|
constructor(message?: string);
|
|
593
552
|
}
|
|
594
|
-
/**
|
|
595
|
-
* Returns the auth file path using XDG Base Directory spec
|
|
596
|
-
* Location: ~/.local/share/offworld/auth.json
|
|
597
|
-
*/
|
|
598
553
|
declare function getAuthPath(): string;
|
|
599
|
-
/**
|
|
600
|
-
* Saves authentication data to ~/.local/share/offworld/auth.json
|
|
601
|
-
* Creates directory if it doesn't exist
|
|
602
|
-
*/
|
|
603
554
|
declare function saveAuthData(data: AuthData): void;
|
|
604
555
|
/**
|
|
605
556
|
* Loads authentication data from ~/.local/share/offworld/auth.json
|
|
@@ -611,28 +562,14 @@ declare function loadAuthData(): AuthData | null;
|
|
|
611
562
|
* @returns true if auth file was deleted, false if it didn't exist
|
|
612
563
|
*/
|
|
613
564
|
declare function clearAuthData(): boolean;
|
|
614
|
-
/**
|
|
615
|
-
* Gets the current authentication token
|
|
616
|
-
* Auto-refreshes if token expires within 1 minute
|
|
617
|
-
* @throws NotLoggedInError if not logged in
|
|
618
|
-
* @throws TokenExpiredError if token is expired and refresh fails
|
|
619
|
-
*/
|
|
620
565
|
declare function getToken(): Promise<string>;
|
|
621
566
|
/**
|
|
622
567
|
* Gets the current authentication token, or null if not logged in
|
|
623
568
|
* Does not throw errors
|
|
624
569
|
*/
|
|
625
570
|
declare function getTokenOrNull(): Promise<string | null>;
|
|
626
|
-
/**
|
|
627
|
-
* Checks if user is logged in with valid token
|
|
628
|
-
*/
|
|
629
571
|
declare function isLoggedIn(): Promise<boolean>;
|
|
630
572
|
declare function getAuthStatus(): Promise<AuthStatus>;
|
|
631
|
-
/**
|
|
632
|
-
* Refreshes the access token using the stored refresh token
|
|
633
|
-
* @returns New auth data with refreshed token
|
|
634
|
-
* @throws AuthError if refresh fails
|
|
635
|
-
*/
|
|
636
573
|
declare function refreshAccessToken(): Promise<AuthData>;
|
|
637
574
|
//#endregion
|
|
638
575
|
//#region src/generate.d.ts
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/constants.ts","../src/config.ts","../src/paths.ts","../src/repo-source.ts","../src/index-manager.ts","../src/map.ts","../src/clone.ts","../src/ai/opencode.ts","../src/ai/errors.ts","../src/sync.ts","../src/auth.ts","../src/generate.ts","../src/agents.ts","../src/manifest.ts","../src/dep-mappings.ts","../src/reference-matcher.ts","../src/agents-md.ts","../src/repo-manager.ts","../src/models.ts","../src/installation.ts"],"mappings":";;;;;;AAKA;AAAA,cAAa,OAAA;;;;AAMb;cAAa,uBAAA;;;;;;;iBCGG,WAAA,CAAA;AAAA,iBAIA,WAAA,CAAY,MAAA,GAAS,QAAA;;;;;;;AAJrC;;iBAiBgB,WAAA,CACf,QAAA,UACA,QAAA,sCACA,MAAA,GAAS,QAAA;;;AAhBV;;iBA8BgB,aAAA,CAAc,QAAA;;;AAjB9B;;;;;iBAwCgB,mBAAA,CAAoB,QAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/constants.ts","../src/config.ts","../src/paths.ts","../src/repo-source.ts","../src/index-manager.ts","../src/map.ts","../src/clone.ts","../src/ai/opencode.ts","../src/ai/errors.ts","../src/sync.ts","../src/auth.ts","../src/generate.ts","../src/agents.ts","../src/manifest.ts","../src/dep-mappings.ts","../src/reference-matcher.ts","../src/agents-md.ts","../src/repo-manager.ts","../src/models.ts","../src/installation.ts"],"mappings":";;;;;;AAKA;AAAA,cAAa,OAAA;;;;AAMb;cAAa,uBAAA;;;;;;;iBCGG,WAAA,CAAA;AAAA,iBAIA,WAAA,CAAY,MAAA,GAAS,QAAA;;;;;;;AAJrC;;iBAiBgB,WAAA,CACf,QAAA,UACA,QAAA,sCACA,MAAA,GAAS,QAAA;;;AAhBV;;iBA8BgB,aAAA,CAAc,QAAA;;;AAjB9B;;;;;iBAwCgB,mBAAA,CAAoB,QAAA;AAAA,iBAuBpB,eAAA,CAAgB,QAAA;AAAA,iBAIhB,gBAAA,CAAiB,QAAA;AAAA,iBAIjB,WAAA,CAAY,QAAA;;AAtD5B;;;iBA8Dg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AY,KAAA;IAAQ,QAAA;IAAkB,aAAA;IAAuB,SAAA;EAAA;EAC7D,cAAA;AAAA;AAAA,iBAGqB,aAAA,CAAc,OAAA,GAAS,eAAA,GAAuB,OAAA,CAAQ,cAAA;;;;;;UCzV3D,YAAA;EAChB,EAAA;EACA,IAAA;EACA,GAAA;AAAA;AlBCD;;;AAAA,UkBKiB,SAAA;EAChB,EAAA;EACA,IAAA;EACA,SAAA;EACA,YAAA;EACA,MAAA;AAAA;;;;UAMgB,kBAAA,SAA2B,YAAA;EAC3C,MAAA,EAAQ,SAAA;AAAA;;;AjBGT;iBiBkCsB,aAAA,CAAA,GAAiB,OAAA,CAAQ,YAAA;;;;iBAezB,WAAA,CAAY,UAAA,WAAqB,OAAA,CAAQ,kBAAA;;;;iBA4BzC,uBAAA,CAAA,GAA2B,OAAA,CAAQ,kBAAA;AjB5DzD;;;AAAA,iBiBqFsB,qBAAA,CACrB,UAAA,UACA,OAAA,WACE,OAAA;EAAU,KAAA;EAAgB,KAAA;AAAA;;;;;;KC1HjB,aAAA;;;;iBAKI,mBAAA,CAAA,GAAuB,aAAA;AnBRvC;;;AAAA,iBmB+FgB,iBAAA,CAAA;;;;iBAOM,kBAAA,CAAmB,MAAA,GAAS,aAAA,GAAgB,OAAA;AlBnGlE;;;AAAA,iBkBqIgB,cAAA,CAAe,MAAA,EAAQ,aAAA,EAAe,OAAA,WAAkB,OAAA;;AlBjIxE;;iBkB4KgB,gBAAA,CAAiB,MAAA,EAAQ,aAAA,GAAgB,OAAA;;;AlB/JzD;iBkBiNgB,mBAAA,CAAA;;;;iBA0BA,gBAAA,CAAiB,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { api } from "@offworld/backend-api/api";
|
|
|
15
15
|
* SDK Constants
|
|
16
16
|
*/
|
|
17
17
|
/** SDK version - must match package.json */
|
|
18
|
-
const VERSION = "0.1.
|
|
18
|
+
const VERSION = "0.1.4";
|
|
19
19
|
/**
|
|
20
20
|
* Default patterns to ignore when scanning repositories.
|
|
21
21
|
* Includes directories, binary files, IDE configs, and build outputs.
|
|
@@ -764,21 +764,9 @@ function execGitAsync(args, cwd) {
|
|
|
764
764
|
});
|
|
765
765
|
});
|
|
766
766
|
}
|
|
767
|
-
/**
|
|
768
|
-
* Get the current commit SHA for a repository
|
|
769
|
-
*/
|
|
770
767
|
function getCommitSha(repoPath) {
|
|
771
768
|
return execGit(["rev-parse", "HEAD"], repoPath);
|
|
772
769
|
}
|
|
773
|
-
/**
|
|
774
|
-
* Get the number of commits between two SHAs.
|
|
775
|
-
* Returns the number of commits from `olderSha` to `newerSha`.
|
|
776
|
-
* Returns null if the distance cannot be determined (e.g., shallow clone without the commit).
|
|
777
|
-
*
|
|
778
|
-
* @param repoPath - Path to the git repository
|
|
779
|
-
* @param olderSha - The older commit SHA (e.g., remote skill's commit)
|
|
780
|
-
* @param newerSha - The newer commit SHA (e.g., current HEAD), defaults to HEAD
|
|
781
|
-
*/
|
|
782
770
|
function getCommitDistance(repoPath, olderSha, newerSha = "HEAD") {
|
|
783
771
|
try {
|
|
784
772
|
try {
|
|
@@ -875,9 +863,6 @@ async function cloneSparse(cloneUrl, repoPath, options) {
|
|
|
875
863
|
], repoPath);
|
|
876
864
|
await execGitAsync(["checkout"], repoPath);
|
|
877
865
|
}
|
|
878
|
-
/**
|
|
879
|
-
* Check if a repository is a shallow clone.
|
|
880
|
-
*/
|
|
881
866
|
function isShallowClone(repoPath) {
|
|
882
867
|
try {
|
|
883
868
|
return execGit(["rev-parse", "--is-shallow-repository"], repoPath) === "true";
|
|
@@ -885,11 +870,6 @@ function isShallowClone(repoPath) {
|
|
|
885
870
|
return false;
|
|
886
871
|
}
|
|
887
872
|
}
|
|
888
|
-
/**
|
|
889
|
-
* Convert a shallow clone to a full clone by fetching all history.
|
|
890
|
-
* Returns true if the repo was shallow and is now unshallowed.
|
|
891
|
-
* Returns false if the repo was already a full clone.
|
|
892
|
-
*/
|
|
893
873
|
async function unshallowRepo(repoPath) {
|
|
894
874
|
if (!isShallowClone(repoPath)) return false;
|
|
895
875
|
await execGitAsync(["fetch", "--unshallow"], repoPath);
|
|
@@ -926,13 +906,6 @@ async function updateRepo(qualifiedName, options = {}) {
|
|
|
926
906
|
unshallowed
|
|
927
907
|
};
|
|
928
908
|
}
|
|
929
|
-
/**
|
|
930
|
-
* Remove a cloned repository and its reference data.
|
|
931
|
-
*
|
|
932
|
-
* @param qualifiedName - The qualified name of the repo
|
|
933
|
-
* @param options - Remove options
|
|
934
|
-
* @returns true if removed, false if not found
|
|
935
|
-
*/
|
|
936
909
|
async function removeRepo(qualifiedName, options = {}) {
|
|
937
910
|
const entry = readGlobalMap().repos[qualifiedName];
|
|
938
911
|
if (!entry) return false;
|
|
@@ -968,21 +941,10 @@ async function removeRepo(qualifiedName, options = {}) {
|
|
|
968
941
|
});
|
|
969
942
|
return true;
|
|
970
943
|
}
|
|
971
|
-
/**
|
|
972
|
-
* List all cloned repositories from the global map.
|
|
973
|
-
*
|
|
974
|
-
* @returns Array of qualified names
|
|
975
|
-
*/
|
|
976
944
|
function listRepos() {
|
|
977
945
|
const map = readGlobalMap();
|
|
978
946
|
return Object.keys(map.repos);
|
|
979
947
|
}
|
|
980
|
-
/**
|
|
981
|
-
* Check if a repository is cloned and in the map.
|
|
982
|
-
*
|
|
983
|
-
* @param qualifiedName - The qualified name of the repo
|
|
984
|
-
* @returns true if repo exists in map and on disk
|
|
985
|
-
*/
|
|
986
948
|
function isRepoCloned(qualifiedName) {
|
|
987
949
|
const entry = readGlobalMap().repos[qualifiedName];
|
|
988
950
|
if (!entry) return false;
|
|
@@ -1976,11 +1938,6 @@ var TokenExpiredError = class extends AuthError {
|
|
|
1976
1938
|
this.name = "TokenExpiredError";
|
|
1977
1939
|
}
|
|
1978
1940
|
};
|
|
1979
|
-
/**
|
|
1980
|
-
* Extracts expiration timestamp from JWT access token
|
|
1981
|
-
* @param token - JWT access token
|
|
1982
|
-
* @returns ISO string of expiration date, or undefined if extraction fails
|
|
1983
|
-
*/
|
|
1984
1941
|
function extractJwtExpiration(token) {
|
|
1985
1942
|
try {
|
|
1986
1943
|
const parts = token.split(".");
|
|
@@ -1994,17 +1951,9 @@ function extractJwtExpiration(token) {
|
|
|
1994
1951
|
return;
|
|
1995
1952
|
}
|
|
1996
1953
|
}
|
|
1997
|
-
/**
|
|
1998
|
-
* Returns the auth file path using XDG Base Directory spec
|
|
1999
|
-
* Location: ~/.local/share/offworld/auth.json
|
|
2000
|
-
*/
|
|
2001
1954
|
function getAuthPath() {
|
|
2002
1955
|
return Paths.authFile;
|
|
2003
1956
|
}
|
|
2004
|
-
/**
|
|
2005
|
-
* Saves authentication data to ~/.local/share/offworld/auth.json
|
|
2006
|
-
* Creates directory if it doesn't exist
|
|
2007
|
-
*/
|
|
2008
1957
|
function saveAuthData(data) {
|
|
2009
1958
|
const authPath = getAuthPath();
|
|
2010
1959
|
const authDir = dirname(authPath);
|
|
@@ -2043,12 +1992,6 @@ function clearAuthData() {
|
|
|
2043
1992
|
return false;
|
|
2044
1993
|
}
|
|
2045
1994
|
}
|
|
2046
|
-
/**
|
|
2047
|
-
* Gets the current authentication token
|
|
2048
|
-
* Auto-refreshes if token expires within 1 minute
|
|
2049
|
-
* @throws NotLoggedInError if not logged in
|
|
2050
|
-
* @throws TokenExpiredError if token is expired and refresh fails
|
|
2051
|
-
*/
|
|
2052
1995
|
async function getToken() {
|
|
2053
1996
|
const data = loadAuthData();
|
|
2054
1997
|
if (!data) throw new NotLoggedInError();
|
|
@@ -2093,9 +2036,6 @@ async function getTokenOrNull() {
|
|
|
2093
2036
|
return null;
|
|
2094
2037
|
}
|
|
2095
2038
|
}
|
|
2096
|
-
/**
|
|
2097
|
-
* Checks if user is logged in with valid token
|
|
2098
|
-
*/
|
|
2099
2039
|
async function isLoggedIn() {
|
|
2100
2040
|
return await getTokenOrNull() !== null;
|
|
2101
2041
|
}
|
|
@@ -2129,11 +2069,6 @@ const WORKOS_API = "https://api.workos.com";
|
|
|
2129
2069
|
function getWorkosClientId() {
|
|
2130
2070
|
return process.env.WORKOS_CLIENT_ID || "";
|
|
2131
2071
|
}
|
|
2132
|
-
/**
|
|
2133
|
-
* Refreshes the access token using the stored refresh token
|
|
2134
|
-
* @returns New auth data with refreshed token
|
|
2135
|
-
* @throws AuthError if refresh fails
|
|
2136
|
-
*/
|
|
2137
2072
|
async function refreshAccessToken() {
|
|
2138
2073
|
const data = loadAuthData();
|
|
2139
2074
|
if (!data?.refreshToken) throw new AuthError("No refresh token available. Please log in again.");
|