@picked/cli 0.0.1-dev.1786601464574
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 +22 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/cjs/cli.js +10 -0
- package/dist/cjs/index.js +1 -0
- package/dist/esm/cli.js +78 -0
- package/dist/esm/index.js +2 -0
- package/dist/types/auth/oauth.d.ts +26 -0
- package/dist/types/auth/oauth.d.ts.map +1 -0
- package/dist/types/auth/pkce.d.ts +26 -0
- package/dist/types/auth/pkce.d.ts.map +1 -0
- package/dist/types/auth/session.d.ts +12 -0
- package/dist/types/auth/session.d.ts.map +1 -0
- package/dist/types/auth/token-store.d.ts +63 -0
- package/dist/types/auth/token-store.d.ts.map +1 -0
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/commands/generate-types.d.ts +15 -0
- package/dist/types/commands/generate-types.d.ts.map +1 -0
- package/dist/types/commands/login.d.ts +14 -0
- package/dist/types/commands/login.d.ts.map +1 -0
- package/dist/types/commands/logout.d.ts +14 -0
- package/dist/types/commands/logout.d.ts.map +1 -0
- package/dist/types/commands/status.d.ts +14 -0
- package/dist/types/commands/status.d.ts.map +1 -0
- package/dist/types/commands/whoami.d.ts +13 -0
- package/dist/types/commands/whoami.d.ts.map +1 -0
- package/dist/types/commands/workspace-list.d.ts +16 -0
- package/dist/types/commands/workspace-list.d.ts.map +1 -0
- package/dist/types/commands/workspace-use.d.ts +20 -0
- package/dist/types/commands/workspace-use.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/api-url.d.ts +13 -0
- package/dist/types/lib/api-url.d.ts.map +1 -0
- package/dist/types/lib/browser.d.ts +12 -0
- package/dist/types/lib/browser.d.ts.map +1 -0
- package/dist/types/lib/paths.d.ts +13 -0
- package/dist/types/lib/paths.d.ts.map +1 -0
- package/dist/types/lib/prompt.d.ts +17 -0
- package/dist/types/lib/prompt.d.ts.map +1 -0
- package/dist/types/lib/workspaces.d.ts +54 -0
- package/dist/types/lib/workspaces.d.ts.map +1 -0
- package/dist/workspace-use-CEY180nO.js +524 -0
- package/dist/workspace-use-DK1LIQd3.cjs +48 -0
- package/package.json +82 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Identity claims decoded from the stored access token, for display purposes only. */
|
|
2
|
+
export interface StoredSessionUser {
|
|
3
|
+
id?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
}
|
|
6
|
+
/** Cached dynamic OAuth client registration for one API origin. */
|
|
7
|
+
export interface StoredClient {
|
|
8
|
+
clientId: string;
|
|
9
|
+
redirectUri: string;
|
|
10
|
+
}
|
|
11
|
+
/** OAuth session for one API origin. */
|
|
12
|
+
export interface StoredSession {
|
|
13
|
+
accessToken: string;
|
|
14
|
+
refreshToken: string;
|
|
15
|
+
/** Access-token expiry as epoch milliseconds. */
|
|
16
|
+
expiresAt: number;
|
|
17
|
+
user?: StoredSessionUser;
|
|
18
|
+
}
|
|
19
|
+
/** Per-origin auth config persisted at `~/.picked/auth/<slug>.json`. */
|
|
20
|
+
export interface AuthConfig {
|
|
21
|
+
apiUrl: string;
|
|
22
|
+
client?: StoredClient;
|
|
23
|
+
session?: StoredSession;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reads the stored auth config for an API origin, or `null` when absent or malformed.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} apiUrl - The API origin whose config to read.
|
|
29
|
+
* @returns {Promise<AuthConfig | null>} The stored config, or `null`.
|
|
30
|
+
* @example
|
|
31
|
+
* const config = await readAuthConfig('https://api.picked.app')
|
|
32
|
+
*/
|
|
33
|
+
export declare function readAuthConfig(apiUrl: string): Promise<AuthConfig | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Persists the OAuth client registration for an API origin, preserving any stored session.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} apiUrl - The API origin the client is registered against.
|
|
38
|
+
* @param {StoredClient} client - The client registration to store.
|
|
39
|
+
* @returns {Promise<void>} Resolves once the config is persisted.
|
|
40
|
+
* @example
|
|
41
|
+
* await saveClient('https://api.picked.app', { clientId, redirectUri })
|
|
42
|
+
*/
|
|
43
|
+
export declare function saveClient(apiUrl: string, client: StoredClient): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Persists the OAuth session for an API origin, preserving any stored client registration.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} apiUrl - The API origin the session belongs to.
|
|
48
|
+
* @param {StoredSession} session - The session to store.
|
|
49
|
+
* @returns {Promise<void>} Resolves once the config is persisted.
|
|
50
|
+
* @example
|
|
51
|
+
* await saveSession('https://api.picked.app', session)
|
|
52
|
+
*/
|
|
53
|
+
export declare function saveSession(apiUrl: string, session: StoredSession): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Removes the stored auth config for an API origin, if present. Other origins are untouched.
|
|
56
|
+
*
|
|
57
|
+
* @param {string} apiUrl - The API origin whose config to remove.
|
|
58
|
+
* @returns {Promise<void>} Resolves once that origin's config no longer exists.
|
|
59
|
+
* @example
|
|
60
|
+
* await clearAuthConfig('https://api.picked.app')
|
|
61
|
+
*/
|
|
62
|
+
export declare function clearAuthConfig(apiUrl: string): Promise<void>;
|
|
63
|
+
//# sourceMappingURL=token-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../../src/auth/token-store.ts"],"names":[],"mappings":"AASA,uFAAuF;AACvF,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,wCAAwC;AACxC,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,iBAAiB,CAAA;CACzB;AAED,wEAAwE;AACxE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB;AA4DD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAU/E;AAkDD;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpF;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvF;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `picked generate types`.
|
|
3
|
+
*
|
|
4
|
+
* @param {object} options - Command options.
|
|
5
|
+
* @param {boolean} [options.check] - Compare-only mode; do not write output.
|
|
6
|
+
* @param {string} [options.cwd] - Working directory containing `picked.config`.
|
|
7
|
+
* @returns {Promise<number>} Process exit code.
|
|
8
|
+
* @example
|
|
9
|
+
* await runGenerateTypes({ check: false })
|
|
10
|
+
*/
|
|
11
|
+
export declare function runGenerateTypes(options?: {
|
|
12
|
+
check?: boolean;
|
|
13
|
+
cwd?: string;
|
|
14
|
+
}): Promise<number>;
|
|
15
|
+
//# sourceMappingURL=generate-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-types.d.ts","sourceRoot":"","sources":["../../../src/commands/generate-types.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CAyClB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `picked login`: runs the browser + loopback PKCE OAuth flow and persists the
|
|
3
|
+
* resulting session to the current directory's API origin auth config.
|
|
4
|
+
*
|
|
5
|
+
* @param {object} [options] - Command options.
|
|
6
|
+
* @param {string} [options.cwd] - Working directory used to resolve the API origin.
|
|
7
|
+
* @returns {Promise<number>} Process exit code.
|
|
8
|
+
* @example
|
|
9
|
+
* await runLogin({})
|
|
10
|
+
*/
|
|
11
|
+
export declare function runLogin(options?: {
|
|
12
|
+
cwd?: string;
|
|
13
|
+
}): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/login.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB1E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `picked logout`: removes the stored OAuth session for the current directory's API
|
|
3
|
+
* origin. Sessions for other origins are left untouched.
|
|
4
|
+
*
|
|
5
|
+
* @param {object} [options] - Command options.
|
|
6
|
+
* @param {string} [options.cwd] - Working directory used to resolve the API origin.
|
|
7
|
+
* @returns {Promise<number>} Process exit code.
|
|
8
|
+
* @example
|
|
9
|
+
* await runLogout()
|
|
10
|
+
*/
|
|
11
|
+
export declare function runLogout(options?: {
|
|
12
|
+
cwd?: string;
|
|
13
|
+
}): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/commands/logout.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAM3E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `picked status`: prints the effective active workspace selection for the current
|
|
3
|
+
* API origin alongside the committed `picked.config` default.
|
|
4
|
+
*
|
|
5
|
+
* @param {object} [options] - Command options.
|
|
6
|
+
* @param {string} [options.cwd] - Working directory to inspect; defaults to `process.cwd()`.
|
|
7
|
+
* @returns {Promise<number>} Process exit code.
|
|
8
|
+
* @example
|
|
9
|
+
* await runStatus({})
|
|
10
|
+
*/
|
|
11
|
+
export declare function runStatus(options?: {
|
|
12
|
+
cwd?: string;
|
|
13
|
+
}): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAsC3E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `picked whoami`: prints the identity signed in to the current directory's API origin.
|
|
3
|
+
*
|
|
4
|
+
* @param {object} [options] - Command options.
|
|
5
|
+
* @param {string} [options.cwd] - Working directory used to resolve the API origin.
|
|
6
|
+
* @returns {Promise<number>} Process exit code.
|
|
7
|
+
* @example
|
|
8
|
+
* await runWhoami()
|
|
9
|
+
*/
|
|
10
|
+
export declare function runWhoami(options?: {
|
|
11
|
+
cwd?: string;
|
|
12
|
+
}): Promise<number>;
|
|
13
|
+
//# sourceMappingURL=whoami.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../src/commands/whoami.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAoB3E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `picked workspace list`: prints every organization, project, and workspace
|
|
3
|
+
* visible to the authenticated user.
|
|
4
|
+
*
|
|
5
|
+
* @param {object} [options] - Command options.
|
|
6
|
+
* @param {string} [options.cwd] - Working directory used to resolve the API URL.
|
|
7
|
+
* @param {boolean} [options.json] - Print machine-readable JSON to stdout instead of a table.
|
|
8
|
+
* @returns {Promise<number>} Process exit code.
|
|
9
|
+
* @example
|
|
10
|
+
* await runWorkspaceList({ json: false })
|
|
11
|
+
*/
|
|
12
|
+
export declare function runWorkspaceList(options?: {
|
|
13
|
+
cwd?: string;
|
|
14
|
+
json?: boolean;
|
|
15
|
+
}): Promise<number>;
|
|
16
|
+
//# sourceMappingURL=workspace-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-list.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-list.ts"],"names":[],"mappings":"AAiCA;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBlB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Options for {@link runWorkspaceUse}. */
|
|
2
|
+
interface RunWorkspaceUseOptions {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
project?: string;
|
|
5
|
+
workspace?: string;
|
|
6
|
+
/** Skip the immediate `picked generate types` refresh. Defaults to true (runs). */
|
|
7
|
+
generate?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Runs `picked workspace use`: selects a project (and optionally a specific workspace)
|
|
11
|
+
* and persists it to `.picked/settings.json`, refreshing generated types by default.
|
|
12
|
+
*
|
|
13
|
+
* @param {RunWorkspaceUseOptions} [options] - Command options.
|
|
14
|
+
* @returns {Promise<number>} Process exit code.
|
|
15
|
+
* @example
|
|
16
|
+
* await runWorkspaceUse({ project: 'proj-1' })
|
|
17
|
+
*/
|
|
18
|
+
export declare function runWorkspaceUse(options?: RunWorkspaceUseOptions): Promise<number>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=workspace-use.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-use.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-use.ts"],"names":[],"mappings":"AAcA,2CAA2C;AAC3C,UAAU,sBAAsB;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAqID;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBvF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @file Public exports for `\@picked/cli`. */
|
|
2
|
+
export { runGenerateTypes } from './commands/generate-types';
|
|
3
|
+
export { runLogin } from './commands/login';
|
|
4
|
+
export { runLogout } from './commands/logout';
|
|
5
|
+
export { runStatus } from './commands/status';
|
|
6
|
+
export { runWhoami } from './commands/whoami';
|
|
7
|
+
export { runWorkspaceList } from './commands/workspace-list';
|
|
8
|
+
export { runWorkspaceUse } from './commands/workspace-use';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the canonical Picked API origin: the `PICKED_API_URL` env var, else `apiUrl`
|
|
3
|
+
* from `picked.config`, else the production default. The result is normalised to its
|
|
4
|
+
* origin so it is identical whether it feeds a request or keys per-origin auth storage.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} [cwd] - Directory to search for `picked.config`; defaults to `process.cwd()`.
|
|
7
|
+
* @returns {Promise<string>} The resolved canonical API origin (HTTPS or loopback).
|
|
8
|
+
* @throws {Error} When the resolved URL is not HTTPS and not a loopback host.
|
|
9
|
+
* @example
|
|
10
|
+
* const apiUrl = await resolveApiUrl()
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveApiUrl(cwd?: string): Promise<string>;
|
|
13
|
+
//# sourceMappingURL=api-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-url.d.ts","sourceRoot":"","sources":["../../../src/lib/api-url.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAC,GAAG,SAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAMxE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opens a URL in the platform's default browser. Spawn failures are swallowed: callers
|
|
3
|
+
* always print the URL as a fallback for the user to open manually, so a missing opener
|
|
4
|
+
* binary should not fail the surrounding flow.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} url - URL to open.
|
|
7
|
+
* @returns {Promise<void>} Resolves once the opener process has been spawned.
|
|
8
|
+
* @example
|
|
9
|
+
* await openUrl('https://api.picked.app/oauth/consent')
|
|
10
|
+
*/
|
|
11
|
+
export declare function openUrl(url: string): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/lib/browser.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYlD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the auth config file path for a given API origin,
|
|
3
|
+
* `~/.picked/auth/<slug>.json`. The origin is normalised first, so cosmetically
|
|
4
|
+
* different spellings of one origin resolve to the same file.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} apiUrl - The API base URL whose session is stored.
|
|
7
|
+
* @returns {string} Absolute path to that origin's auth config file.
|
|
8
|
+
* @throws {Error} When the URL is malformed, or not HTTPS and not a loopback host.
|
|
9
|
+
* @example
|
|
10
|
+
* authConfigPath('https://api.picked.app') // '/Users/dev/.picked/auth/api.picked.app-3f2a9c1b.json'
|
|
11
|
+
*/
|
|
12
|
+
export declare function authConfigPath(apiUrl: string): string;
|
|
13
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/lib/paths.ts"],"names":[],"mappings":"AAuCA;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompts the user to pick one item from a list by number. Prompts are written to
|
|
3
|
+
* stderr so a command's `--json` stdout output stays machine-readable.
|
|
4
|
+
*
|
|
5
|
+
* @template T
|
|
6
|
+
* @param {string} title - Prompt heading.
|
|
7
|
+
* @param {ReadonlyArray<{ label: string; value: T }>} choices - Options to choose from.
|
|
8
|
+
* @returns {Promise<T>} The chosen value.
|
|
9
|
+
* @throws {Error} When `choices` is empty.
|
|
10
|
+
* @example
|
|
11
|
+
* const project = await selectOne('Pick a project', [{ label: 'Website', value: 'proj-1' }])
|
|
12
|
+
*/
|
|
13
|
+
export declare function selectOne<T>(title: string, choices: ReadonlyArray<{
|
|
14
|
+
label: string;
|
|
15
|
+
value: T;
|
|
16
|
+
}>): Promise<T>;
|
|
17
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/lib/prompt.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;GAWG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,GAClD,OAAO,CAAC,CAAC,CAAC,CA0BZ"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { WorkspaceStatus } from '@picked/config';
|
|
2
|
+
/** A workspace within a project, as returned by the workspace-tree query. */
|
|
3
|
+
export interface WorkspaceNode {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
status: WorkspaceStatus;
|
|
7
|
+
}
|
|
8
|
+
/** A project within an organization, as returned by the workspace-tree query. */
|
|
9
|
+
export interface ProjectNode {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
liveWorkspaceId: string | null;
|
|
13
|
+
/** The project's live published version id, or `null` when nothing is served to delivery. */
|
|
14
|
+
liveVersionId: string | null;
|
|
15
|
+
workspaces: WorkspaceNode[];
|
|
16
|
+
}
|
|
17
|
+
/** An organization, as returned by the workspace-tree query. */
|
|
18
|
+
export interface OrgNode {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
slug: string;
|
|
22
|
+
projects: ProjectNode[];
|
|
23
|
+
}
|
|
24
|
+
/** Workspace lookup result carrying its stateless preview delivery token. */
|
|
25
|
+
export interface WorkspacePreviewInfo {
|
|
26
|
+
status: WorkspaceStatus;
|
|
27
|
+
name: string;
|
|
28
|
+
previewToken: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Fetches every organization, project, and workspace visible to the authenticated user.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} apiUrl - Base Picked API URL.
|
|
34
|
+
* @param {string} token - Bearer access token.
|
|
35
|
+
* @returns {Promise<OrgNode[]>} The organization/project/workspace tree.
|
|
36
|
+
* @throws {Error} When the request fails or the caller is not authenticated.
|
|
37
|
+
* @example
|
|
38
|
+
* const orgs = await fetchWorkspaceTree(apiUrl, token)
|
|
39
|
+
*/
|
|
40
|
+
export declare function fetchWorkspaceTree(apiUrl: string, token: string): Promise<OrgNode[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Fetches a single workspace's status, name, and stateless preview delivery token.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} apiUrl - Base Picked API URL.
|
|
45
|
+
* @param {string} token - Bearer access token.
|
|
46
|
+
* @param {string} projectId - Project the workspace belongs to.
|
|
47
|
+
* @param {string} workspaceId - Workspace to fetch.
|
|
48
|
+
* @returns {Promise<WorkspacePreviewInfo>} The workspace's status, name, and preview token.
|
|
49
|
+
* @throws {Error} When the request fails or the workspace cannot be found.
|
|
50
|
+
* @example
|
|
51
|
+
* const info = await fetchPreviewToken(apiUrl, token, projectId, workspaceId)
|
|
52
|
+
*/
|
|
53
|
+
export declare function fetchPreviewToken(apiUrl: string, token: string, projectId: string, workspaceId: string): Promise<WorkspacePreviewInfo>;
|
|
54
|
+
//# sourceMappingURL=workspaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../../src/lib/workspaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,eAAe,CAAA;CACxB;AAED,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,6FAA6F;IAC7F,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,UAAU,EAAE,aAAa,EAAE,CAAA;CAC5B;AAED,gEAAgE;AAChE,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,EAAE,CAAA;CACxB;AAED,6EAA6E;AAC7E,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;CACrB;AAoDD;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CA8B1F;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,oBAAoB,CAAC,CAU/B"}
|