@launchpad-kit/client-core 0.0.0-bootstrap.0
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/LICENSE +202 -0
- package/README.md +70 -0
- package/app-client.d.ts +311 -0
- package/errors.d.ts +5 -0
- package/fields.d.ts +15 -0
- package/index.d.ts +20 -0
- package/index.mjs +685 -0
- package/operations.d.ts +85 -0
- package/output.d.ts +1 -0
- package/pack.d.ts +24 -0
- package/package.json +43 -0
- package/project.d.ts +6 -0
- package/redact.d.ts +2 -0
- package/secure-file.d.ts +22 -0
- package/session-store.d.ts +32 -0
- package/store.d.ts +26 -0
- package/workspace.d.ts +44 -0
package/operations.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { LaunchpadClient } from '@launchpad-kit/sdk';
|
|
2
|
+
import { SessionStore } from './session-store.js';
|
|
3
|
+
import { CredentialStore } from './store.js';
|
|
4
|
+
export interface Context {
|
|
5
|
+
store: CredentialStore;
|
|
6
|
+
sessions: SessionStore;
|
|
7
|
+
env: Record<string, string | undefined>;
|
|
8
|
+
fetch?: typeof fetch;
|
|
9
|
+
secrets?: Set<string>;
|
|
10
|
+
}
|
|
11
|
+
export declare function createContext(env?: Record<string, string | undefined>, options?: {
|
|
12
|
+
fetch?: typeof fetch;
|
|
13
|
+
}): Context;
|
|
14
|
+
export interface Resolved {
|
|
15
|
+
profile: string | null;
|
|
16
|
+
controller: string;
|
|
17
|
+
apiKey: string;
|
|
18
|
+
organizationId: string | null;
|
|
19
|
+
fromEnvironment: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function resolve(ctx: Context, profileName?: string): Promise<Resolved>;
|
|
22
|
+
export declare function clientFor(ctx: Context, resolved: Resolved): LaunchpadClient;
|
|
23
|
+
export declare function login(ctx: Context, input: {
|
|
24
|
+
controller: string;
|
|
25
|
+
apiKey: string;
|
|
26
|
+
profile?: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
profile: string;
|
|
29
|
+
controller: string;
|
|
30
|
+
key: {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
organizationId: string;
|
|
34
|
+
scopes: ("organization:read" | "member:read" | "project:read" | "project:create" | "project:delete" | "app:read" | "app:deploy" | "app:delete" | "app:promote" | "app:alias:manage")[];
|
|
35
|
+
projectIds: string[] | null;
|
|
36
|
+
expiresAt: string;
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
39
|
+
export declare function logout(ctx: Context, profileName?: string): Promise<{
|
|
40
|
+
profile: string;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function listProfiles(ctx: Context): Promise<{
|
|
43
|
+
current: string | null;
|
|
44
|
+
profiles: {
|
|
45
|
+
name: string;
|
|
46
|
+
controller: string;
|
|
47
|
+
organizationId: string | null;
|
|
48
|
+
savedAt: string;
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|
|
51
|
+
export declare function useProfile(ctx: Context, name: string): Promise<{
|
|
52
|
+
profile: string;
|
|
53
|
+
}>;
|
|
54
|
+
export declare function whoami(ctx: Context, profileName?: string): Promise<{
|
|
55
|
+
profile: string | null;
|
|
56
|
+
controller: string;
|
|
57
|
+
key: {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
organizationId: string;
|
|
61
|
+
scopes: ("organization:read" | "member:read" | "project:read" | "project:create" | "project:delete" | "app:read" | "app:deploy" | "app:delete" | "app:promote" | "app:alias:manage")[];
|
|
62
|
+
projectIds: string[] | null;
|
|
63
|
+
expiresAt: string;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
export declare function useOrganization(ctx: Context, organization: string, profileName?: string): Promise<{
|
|
67
|
+
organization: {
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
slug: string;
|
|
71
|
+
role: "owner" | "admin" | "deployer" | "viewer";
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
export declare function listOrganizations(ctx: Context, profileName?: string): Promise<{
|
|
75
|
+
id: string;
|
|
76
|
+
name: string;
|
|
77
|
+
slug: string;
|
|
78
|
+
role: "owner" | "admin" | "deployer" | "viewer";
|
|
79
|
+
}[]>;
|
|
80
|
+
export declare function listProjects(ctx: Context, profileName?: string): Promise<{
|
|
81
|
+
id: string;
|
|
82
|
+
slug: string;
|
|
83
|
+
name: string;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
}[]>;
|
package/output.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function safeOutput(text: string, secrets?: Iterable<string>): string;
|
package/pack.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface PackLimits {
|
|
2
|
+
maxArchiveBytes: number;
|
|
3
|
+
maxEntries: number;
|
|
4
|
+
maxDepth: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const DEFAULT_PACK_LIMITS: PackLimits;
|
|
7
|
+
export interface FileSelection {
|
|
8
|
+
include: string[];
|
|
9
|
+
exclude: string[];
|
|
10
|
+
prefix: string;
|
|
11
|
+
protectedPaths?: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function compileSelection(include: string[], exclude: string[]): {
|
|
14
|
+
selects: (relative: string) => boolean;
|
|
15
|
+
mayContain: (directory: string) => boolean;
|
|
16
|
+
};
|
|
17
|
+
export interface Packed {
|
|
18
|
+
archive: Uint8Array;
|
|
19
|
+
files: number;
|
|
20
|
+
bytes: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function packDirectory(directory: string, limits?: PackLimits, selection?: FileSelection, signal?: AbortSignal): Promise<Packed>;
|
|
23
|
+
export declare function checkLocation(directory: string, protectedDirectories?: string[]): void;
|
|
24
|
+
export declare function readArchive(file: string, limits?: PackLimits): Promise<Packed>;
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@launchpad-kit/client-core",
|
|
3
|
+
"version": "0.0.0-bootstrap.0",
|
|
4
|
+
"description": "Profiles, credentials and workflows shared by the CLI and MCP server",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/launchpad-kit/launchpad.git",
|
|
9
|
+
"directory": "packages/client-core"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/launchpad-kit/launchpad#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/launchpad-kit/launchpad/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=22.12"
|
|
18
|
+
},
|
|
19
|
+
"main": "./index.mjs",
|
|
20
|
+
"types": "./index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./index.d.ts",
|
|
24
|
+
"import": "./index.mjs",
|
|
25
|
+
"default": "./index.mjs"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"files": [
|
|
30
|
+
"*.mjs",
|
|
31
|
+
"*.d.ts",
|
|
32
|
+
"**/*.d.ts",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@launchpad-kit/contracts": "^0.0.0-bootstrap.0",
|
|
38
|
+
"@launchpad-kit/sdk": "^0.0.0-bootstrap.0",
|
|
39
|
+
"picomatch": "4.0.7",
|
|
40
|
+
"tar": "7.5.23",
|
|
41
|
+
"zod": "4.6.7"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/project.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { clientFor, Context } from './operations.js';
|
|
2
|
+
export declare function resolveProjectId(client: ReturnType<typeof clientFor>, organizationId: string, project: string): Promise<string>;
|
|
3
|
+
export declare function resolveProject(ctx: Context, project: string, profile?: string): Promise<{
|
|
4
|
+
organizationId: string;
|
|
5
|
+
projectId: string;
|
|
6
|
+
}>;
|
package/redact.d.ts
ADDED
package/secure-file.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare class SecureJsonFile<T> {
|
|
3
|
+
readonly directory: string;
|
|
4
|
+
readonly file: string;
|
|
5
|
+
private readonly name;
|
|
6
|
+
private readonly label;
|
|
7
|
+
private readonly schema;
|
|
8
|
+
private readonly empty;
|
|
9
|
+
constructor(directory: string, spec: {
|
|
10
|
+
name: string;
|
|
11
|
+
label: string;
|
|
12
|
+
schema: z.ZodType<T>;
|
|
13
|
+
empty: () => T;
|
|
14
|
+
});
|
|
15
|
+
private checkDirectory;
|
|
16
|
+
private guard;
|
|
17
|
+
load(): Promise<T>;
|
|
18
|
+
private read;
|
|
19
|
+
update<R>(change: (config: T) => R): Promise<R>;
|
|
20
|
+
private write;
|
|
21
|
+
private lock;
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SecureJsonFile } from './secure-file.js';
|
|
3
|
+
export declare const normalizeEmail: (email: string) => string;
|
|
4
|
+
declare const entrySchema: z.ZodObject<{
|
|
5
|
+
controller: z.ZodString;
|
|
6
|
+
email: z.ZodString;
|
|
7
|
+
cookie: z.ZodString;
|
|
8
|
+
savedAt: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
declare const sessionsSchema: z.ZodObject<{
|
|
11
|
+
version: z.ZodLiteral<1>;
|
|
12
|
+
sessions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
13
|
+
controller: z.ZodString;
|
|
14
|
+
email: z.ZodString;
|
|
15
|
+
cookie: z.ZodString;
|
|
16
|
+
savedAt: z.ZodString;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type SessionEntry = z.infer<typeof entrySchema>;
|
|
20
|
+
export type SessionFile = z.infer<typeof sessionsSchema>;
|
|
21
|
+
export declare class SessionStore extends SecureJsonFile<SessionFile> {
|
|
22
|
+
constructor(directory: string);
|
|
23
|
+
get(controller: string): Promise<SessionEntry | null>;
|
|
24
|
+
put(input: {
|
|
25
|
+
controller: string;
|
|
26
|
+
email: string;
|
|
27
|
+
cookie: string;
|
|
28
|
+
savedAt?: string;
|
|
29
|
+
}): Promise<SessionEntry | null>;
|
|
30
|
+
remove(controller: string, cookie?: string): Promise<SessionEntry | null>;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
package/store.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SecureJsonFile } from './secure-file.js';
|
|
3
|
+
declare const profileSchema: z.ZodObject<{
|
|
4
|
+
controller: z.ZodString;
|
|
5
|
+
apiKey: z.ZodString;
|
|
6
|
+
organizationId: z.ZodNullable<z.ZodString>;
|
|
7
|
+
savedAt: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
declare const configSchema: z.ZodObject<{
|
|
10
|
+
version: z.ZodLiteral<1>;
|
|
11
|
+
currentProfile: z.ZodNullable<z.ZodString>;
|
|
12
|
+
profiles: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
13
|
+
controller: z.ZodString;
|
|
14
|
+
apiKey: z.ZodString;
|
|
15
|
+
organizationId: z.ZodNullable<z.ZodString>;
|
|
16
|
+
savedAt: z.ZodString;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type Profile = z.infer<typeof profileSchema>;
|
|
20
|
+
export type Config = z.infer<typeof configSchema>;
|
|
21
|
+
export declare const emptyConfig: () => Config;
|
|
22
|
+
export declare function configDirectory(env: Record<string, string | undefined>): string;
|
|
23
|
+
export declare class CredentialStore extends SecureJsonFile<Config> {
|
|
24
|
+
constructor(directory: string);
|
|
25
|
+
}
|
|
26
|
+
export {};
|
package/workspace.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from './operations.js';
|
|
3
|
+
declare const workspaceSchema: z.ZodObject<{
|
|
4
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
5
|
+
organization: z.ZodString;
|
|
6
|
+
project: z.ZodString;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export type WorkspaceConfig = z.infer<typeof workspaceSchema>;
|
|
9
|
+
export declare const MAX_WORKSPACE_CONFIG_BYTES: number;
|
|
10
|
+
/** A file is trusted only if the current user owns it. Where there are no user ids, it is. */
|
|
11
|
+
export declare function ownedByCurrentUser(owner: number, current: number | undefined): boolean;
|
|
12
|
+
/** Resolve an absolute directory and find the nearest launchpad.json, up to the filesystem root.
|
|
13
|
+
* Missing config is allowed; invalid config is refused rather than skipped.
|
|
14
|
+
* No process working directory or credential-store state is changed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readWorkspace(workingDir: string): Promise<{
|
|
17
|
+
directory: string;
|
|
18
|
+
config: {
|
|
19
|
+
organization: string;
|
|
20
|
+
project: string;
|
|
21
|
+
profile?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
directory: string;
|
|
25
|
+
config: null;
|
|
26
|
+
}>;
|
|
27
|
+
/** Build a per-call client context. Explicit arguments override project config;
|
|
28
|
+
* an organization override is checked against the key's visible organizations.
|
|
29
|
+
* Never persists profile/organization selections to the credential store.
|
|
30
|
+
*/
|
|
31
|
+
export declare function workspaceContext(ctx: Context, input: {
|
|
32
|
+
workingDir: string;
|
|
33
|
+
profile?: string;
|
|
34
|
+
organization?: string;
|
|
35
|
+
project?: string;
|
|
36
|
+
defaultProfile?: string;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
context: Context;
|
|
39
|
+
profile: string | undefined;
|
|
40
|
+
project: string | undefined;
|
|
41
|
+
directory: string;
|
|
42
|
+
organization: string | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
export {};
|