@launchpad-kit/client-core 0.0.0-stage → 0.1.0-rc.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/LICENSE +202 -0
- package/README.md +69 -2
- 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 +41 -4
- 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/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,70 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @launchpad-kit/client-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Profiles, credentials and operations shared by the CLI and the local MCP server. Node (`>=22.12`) and Bun, ESM only, **POSIX only** (the permission and owner checks are skipped on Windows, which is unsupported and untested).
|
|
4
|
+
|
|
5
|
+
This is a public package so the CLI and the MCP server can import it instead of bundling it, but
|
|
6
|
+
it is not a general client: other users should use `@launchpad-kit/sdk`. Every name in the
|
|
7
|
+
[Public API](#public-api) is part of the package's interface under the `0.x` rule in
|
|
8
|
+
[docs/releasing.md](../../docs/releasing.md), and the files it writes (`credentials.json`,
|
|
9
|
+
`session.json`, format `version: 1`) are never rewritten in another format.
|
|
10
|
+
|
|
11
|
+
- `CredentialStore` keeps profiles in `credentials.json` under `$LAUNCHPAD_CONFIG_DIR`, `$XDG_CONFIG_HOME/launchpad` or `~/.config/launchpad`: a mode-700 directory, a mode-600 file replaced atomically under a lock. It refuses a symlink, a file others can read or a file of another owner, and never rewrites a corrupt or newer-format file, so credentials are not lost silently.
|
|
12
|
+
- Operations (`login`, `logout`, `whoami`, `useProfile`, `useOrganization`, `listProjects`, ...) take a `Context` and return plain data. `login` verifies the key with the controller before saving it; a key belongs to one organization, which login selects.
|
|
13
|
+
- Credential resolution: explicit profile, then `LAUNCHPAD_PROFILE`, then the current profile. Without an explicit profile, `LAUNCHPAD_CONTROLLER` plus `LAUNCHPAD_API_KEY` (and optional `LAUNCHPAD_ORG`, an org ID, not a slug) bypass the file for CI. A partial pair is an error, never a fallback to saved credentials. Project listing discovers the key's org if none is selected.
|
|
14
|
+
- `redact` hides anything shaped like a key, for text that reaches a terminal, a log or an MCP response.
|
|
15
|
+
|
|
16
|
+
Depends on `@launchpad-kit/contracts`, `@launchpad-kit/sdk`, `picomatch`, `tar` and `zod`.
|
|
17
|
+
|
|
18
|
+
## Public API
|
|
19
|
+
|
|
20
|
+
The interface is exactly the names exported by `src/index.ts`; `src/index.spec.ts` fails if the
|
|
21
|
+
list changes by accident.
|
|
22
|
+
|
|
23
|
+
- Errors and redaction: `ClientCoreError`, `ClientCoreErrorCode`, `redact`, `redactSecrets`, `safeOutput`.
|
|
24
|
+
- Stores: `CredentialStore`, `SessionStore`, `configDirectory`, `normalizeEmail`, types `Config`, `Profile`, `SessionEntry`.
|
|
25
|
+
- Operations: `createContext`, `login`, `logout`, `listProfiles`, `useProfile`, `whoami`, `useOrganization`, `listOrganizations`, `listProjects`, `resolveProject`, type `Context`.
|
|
26
|
+
- Packing: `packDirectory`, `readArchive`, `checkLocation`, `compileSelection`, `DEFAULT_PACK_LIMITS`, types `FileSelection`, `PackLimits`, `Packed`.
|
|
27
|
+
- Workspace and apps: `readWorkspace`, `workspaceContext`, `appClient`, `checkedApp`, `requireConfirmation`, type `AppClient`.
|
|
28
|
+
- Fields: `parseFields`, `fieldsToQuery`, types `FieldInput`, `FieldSources`.
|
|
29
|
+
|
|
30
|
+
**Internal, unstable:** `resolve`, `clientFor` and type `Resolved` are exported only because the
|
|
31
|
+
CLI needs them. They are marked `@internal`, may change in any release, and their results hold
|
|
32
|
+
the raw API key: never log, print or serialize them. Other helpers (for example
|
|
33
|
+
`MAX_WORKSPACE_CONFIG_BYTES`, `ownedByCurrentUser`) are not exported.
|
|
34
|
+
|
|
35
|
+
## Security model
|
|
36
|
+
|
|
37
|
+
Assets: API keys in `credentials.json`, kept-session cookies in `session.json`, and the same
|
|
38
|
+
secrets in memory and in the environment. The adversary is another local user, a malicious or
|
|
39
|
+
buggy controller response, and untrusted text (server names, error bodies) that reaches a
|
|
40
|
+
terminal, a log or an agent.
|
|
41
|
+
|
|
42
|
+
- **Stores.** `CredentialStore` and `SessionStore` take an arbitrary directory. On read they refuse
|
|
43
|
+
a directory or file that the current user does not own or whose mode is not `0700`/`0600`
|
|
44
|
+
(and any symlink); on write they repair the mode, replacing the file atomically under a lock.
|
|
45
|
+
- **Environment.** `LAUNCHPAD_API_KEY` and the other `LAUNCHPAD_*` overrides are visible in
|
|
46
|
+
`/proc/<pid>/environ` to the same user (and root) and are inherited by child processes. Prefer a
|
|
47
|
+
saved profile on a shared machine.
|
|
48
|
+
- **No secret logging.** Operations return data and never print. Errors carry no key or file
|
|
49
|
+
contents. `resolve` and `clientFor` (internal) hold the raw key: do not log their results.
|
|
50
|
+
- **Redaction.** `redact` hides key-shaped text, `Bearer` tokens and `__Secure-`/`__Host-` cookies;
|
|
51
|
+
`safeOutput` also strips control characters and hides the secrets you pass. The context's
|
|
52
|
+
`secrets` set collects the keys resolved in this run. An embedder must redact its own secrets
|
|
53
|
+
(a password, a cookie) with `redactSecrets` or `safeOutput(text, secrets)`; the CLI and the
|
|
54
|
+
MCP server do. The pattern part of `redact` is best effort and does not catch a `Bearer` token
|
|
55
|
+
shorter than 8 characters without a digit or `. _ -`, a URL-encoded `Bearer%20<token>`, a token
|
|
56
|
+
containing an escaped character, or a plain (not `__Secure-`/`__Host-`) session cookie over
|
|
57
|
+
loopback HTTP. Pass every known secret value (API keys, cookie values) to `redactSecrets`.
|
|
58
|
+
- **Transport.** The SDK accepts HTTPS, or HTTP to a loopback address only.
|
|
59
|
+
- **POSIX only.** Owner and mode checks are skipped on Windows, which is unsupported.
|
|
60
|
+
- **Packer.** `packDirectory` skips secret-looking names (`.env*`, keys, credentials files). The
|
|
61
|
+
list is best effort, not a guarantee: review what you upload.
|
|
62
|
+
|
|
63
|
+
## Lock recovery
|
|
64
|
+
|
|
65
|
+
Updates wait briefly for the current writer, then fail with `store-busy` rather
|
|
66
|
+
than assuming an old lock means the owner is dead. Only the matching ownership
|
|
67
|
+
token is released, and failed writes clean up their temporary credential file.
|
|
68
|
+
After a crashed writer, remove `credentials.json.lock` manually **only after
|
|
69
|
+
confirming that no Launchpad client is writing**. Never remove a live writer's lock.
|
|
70
|
+
This deliberately trades automatic crash recovery for preserving profile changes.
|
package/app-client.d.ts
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { Context } from './operations.js';
|
|
2
|
+
export declare function appClient(context: Context, profile?: string): Promise<{
|
|
3
|
+
client: {
|
|
4
|
+
raw: (method: string, rawPath: string, options?: import('@launchpad-kit/sdk').RawOptions) => Promise<import('@launchpad-kit/sdk').RawResponse>;
|
|
5
|
+
key: {
|
|
6
|
+
get: () => Promise<{
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
organizationId: string;
|
|
10
|
+
scopes: ("organization:read" | "member:read" | "project:read" | "project:create" | "project:delete" | "app:read" | "app:deploy" | "app:delete" | "app:promote" | "app:alias:manage")[];
|
|
11
|
+
projectIds: string[] | null;
|
|
12
|
+
expiresAt: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
organizations: {
|
|
16
|
+
list: () => Promise<{
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
slug: string;
|
|
20
|
+
role: "owner" | "admin" | "deployer" | "viewer";
|
|
21
|
+
}[]>;
|
|
22
|
+
listPage: (page: import('@launchpad-kit/sdk').PageOptions) => Promise<import('@launchpad-kit/sdk').Page<{
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
slug: string;
|
|
26
|
+
role: "owner" | "admin" | "deployer" | "viewer";
|
|
27
|
+
}>>;
|
|
28
|
+
get: (organizationId: string) => Promise<{
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
slug: string;
|
|
32
|
+
role: "owner" | "admin" | "deployer" | "viewer";
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
members: {
|
|
36
|
+
list: (organizationId: string) => Promise<{
|
|
37
|
+
userId: string;
|
|
38
|
+
email: string;
|
|
39
|
+
name: string;
|
|
40
|
+
role: "owner" | "admin" | "deployer" | "viewer";
|
|
41
|
+
}[]>;
|
|
42
|
+
listPage: (o: string, page: import('@launchpad-kit/sdk').PageOptions) => Promise<import('@launchpad-kit/sdk').Page<{
|
|
43
|
+
userId: string;
|
|
44
|
+
email: string;
|
|
45
|
+
name: string;
|
|
46
|
+
role: "owner" | "admin" | "deployer" | "viewer";
|
|
47
|
+
}>>;
|
|
48
|
+
};
|
|
49
|
+
projects: {
|
|
50
|
+
list: (organizationId: string) => Promise<{
|
|
51
|
+
id: string;
|
|
52
|
+
slug: string;
|
|
53
|
+
name: string;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
}[]>;
|
|
56
|
+
listPage: (o: string, page: import('@launchpad-kit/sdk').PageOptions) => Promise<import('@launchpad-kit/sdk').Page<{
|
|
57
|
+
id: string;
|
|
58
|
+
slug: string;
|
|
59
|
+
name: string;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
}>>;
|
|
62
|
+
create: (organizationId: string, input: import('@launchpad-kit/sdk').CreateProjectInput) => Promise<{
|
|
63
|
+
id: string;
|
|
64
|
+
slug: string;
|
|
65
|
+
name: string;
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
68
|
+
artifacts: {
|
|
69
|
+
upload: (o: string, projectId: string, archive: Blob, options?: Pick<import('@launchpad-kit/sdk').RequestOptions, "signal">) => Promise<{
|
|
70
|
+
id: string;
|
|
71
|
+
digest: string;
|
|
72
|
+
sizeBytes: number;
|
|
73
|
+
expandedBytes: number;
|
|
74
|
+
entryCount: number;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
reused: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
apps: {
|
|
80
|
+
list: (o: string) => Promise<{
|
|
81
|
+
id: string;
|
|
82
|
+
projectId: string;
|
|
83
|
+
slug: string;
|
|
84
|
+
state: "active" | "shutting-down" | "deleted";
|
|
85
|
+
createdAt: string;
|
|
86
|
+
}[]>;
|
|
87
|
+
listPage: (o: string, page: import('@launchpad-kit/sdk').PageOptions) => Promise<import('@launchpad-kit/sdk').Page<{
|
|
88
|
+
id: string;
|
|
89
|
+
projectId: string;
|
|
90
|
+
slug: string;
|
|
91
|
+
state: "active" | "shutting-down" | "deleted";
|
|
92
|
+
createdAt: string;
|
|
93
|
+
}>>;
|
|
94
|
+
get: (o: string, id: string) => Promise<{
|
|
95
|
+
id: string;
|
|
96
|
+
projectId: string;
|
|
97
|
+
slug: string;
|
|
98
|
+
state: "active" | "shutting-down" | "deleted";
|
|
99
|
+
createdAt: string;
|
|
100
|
+
}>;
|
|
101
|
+
create: (o: string, projectId: string, input: import('zod').input<typeof import('@launchpad-kit/contracts').createAppSchema>) => Promise<{
|
|
102
|
+
id: string;
|
|
103
|
+
projectId: string;
|
|
104
|
+
slug: string;
|
|
105
|
+
state: "active" | "shutting-down" | "deleted";
|
|
106
|
+
createdAt: string;
|
|
107
|
+
}>;
|
|
108
|
+
shutdown: (o: string, id: string) => Promise<{
|
|
109
|
+
appId: string;
|
|
110
|
+
state: "active" | "shutting-down" | "deleted";
|
|
111
|
+
withdrawalsQueued: number;
|
|
112
|
+
deletionsQueued: number;
|
|
113
|
+
blockedBy: ("aliases-disabled" | "alias-in-progress" | "alias-needs-reconciliation" | "deployment-unfinished" | "deployment-needs-reconciliation" | "deployment-deleting" | "deletion-needs-reconciliation")[];
|
|
114
|
+
}>;
|
|
115
|
+
};
|
|
116
|
+
deployments: {
|
|
117
|
+
list: (o: string, appId: string) => Promise<{
|
|
118
|
+
id: string;
|
|
119
|
+
appId: string;
|
|
120
|
+
status: "queued" | "verifying" | "succeeded" | "failed" | "reconciliation-needed" | "preparing" | "building" | "deploying" | "cancelled";
|
|
121
|
+
desiredState: "active" | "deleted" | "deleting";
|
|
122
|
+
hostname: string;
|
|
123
|
+
spa: boolean;
|
|
124
|
+
createdAt: string;
|
|
125
|
+
finishedAt: string | null;
|
|
126
|
+
expiresAt: string;
|
|
127
|
+
failureCode: string | null;
|
|
128
|
+
failureMessage: string | null;
|
|
129
|
+
}[]>;
|
|
130
|
+
listPage: (o: string, appId: string, page: import('@launchpad-kit/sdk').PageOptions) => Promise<import('@launchpad-kit/sdk').Page<{
|
|
131
|
+
id: string;
|
|
132
|
+
appId: string;
|
|
133
|
+
status: "queued" | "verifying" | "succeeded" | "failed" | "reconciliation-needed" | "preparing" | "building" | "deploying" | "cancelled";
|
|
134
|
+
desiredState: "active" | "deleted" | "deleting";
|
|
135
|
+
hostname: string;
|
|
136
|
+
spa: boolean;
|
|
137
|
+
createdAt: string;
|
|
138
|
+
finishedAt: string | null;
|
|
139
|
+
expiresAt: string;
|
|
140
|
+
failureCode: string | null;
|
|
141
|
+
failureMessage: string | null;
|
|
142
|
+
}>>;
|
|
143
|
+
create: (o: string, appId: string, input: import('zod').input<typeof import('@launchpad-kit/contracts').createDeploymentSchema>, options?: Pick<import('@launchpad-kit/sdk').RequestOptions, "signal">) => Promise<{
|
|
144
|
+
id: string;
|
|
145
|
+
appId: string;
|
|
146
|
+
status: "queued" | "verifying" | "succeeded" | "failed" | "reconciliation-needed" | "preparing" | "building" | "deploying" | "cancelled";
|
|
147
|
+
desiredState: "active" | "deleted" | "deleting";
|
|
148
|
+
hostname: string;
|
|
149
|
+
spa: boolean;
|
|
150
|
+
createdAt: string;
|
|
151
|
+
finishedAt: string | null;
|
|
152
|
+
expiresAt: string;
|
|
153
|
+
failureCode: string | null;
|
|
154
|
+
failureMessage: string | null;
|
|
155
|
+
}>;
|
|
156
|
+
get: (o: string, id: string) => Promise<{
|
|
157
|
+
id: string;
|
|
158
|
+
appId: string;
|
|
159
|
+
status: "queued" | "verifying" | "succeeded" | "failed" | "reconciliation-needed" | "preparing" | "building" | "deploying" | "cancelled";
|
|
160
|
+
desiredState: "active" | "deleted" | "deleting";
|
|
161
|
+
hostname: string;
|
|
162
|
+
spa: boolean;
|
|
163
|
+
createdAt: string;
|
|
164
|
+
finishedAt: string | null;
|
|
165
|
+
expiresAt: string;
|
|
166
|
+
failureCode: string | null;
|
|
167
|
+
failureMessage: string | null;
|
|
168
|
+
}>;
|
|
169
|
+
events: (o: string, id: string, cursor?: {
|
|
170
|
+
after?: string;
|
|
171
|
+
limit?: number;
|
|
172
|
+
}) => Promise<{
|
|
173
|
+
seq: string;
|
|
174
|
+
phase: string;
|
|
175
|
+
level: "error" | "info" | "warn";
|
|
176
|
+
message: string;
|
|
177
|
+
createdAt: string;
|
|
178
|
+
}[]>;
|
|
179
|
+
eventsPage: (o: string, id: string, options: {
|
|
180
|
+
after?: string;
|
|
181
|
+
limit: number;
|
|
182
|
+
signal?: AbortSignal;
|
|
183
|
+
}) => Promise<import('@launchpad-kit/sdk').EventsPage<import('zod').infer<typeof import('@launchpad-kit/contracts').deploymentEventSchema>>>;
|
|
184
|
+
delete: (o: string, id: string) => Promise<{
|
|
185
|
+
operationId: string;
|
|
186
|
+
deploymentId: string;
|
|
187
|
+
status: "queued";
|
|
188
|
+
}>;
|
|
189
|
+
};
|
|
190
|
+
aliases: {
|
|
191
|
+
list: (o: string, appId: string) => Promise<{
|
|
192
|
+
id: string;
|
|
193
|
+
appId: string;
|
|
194
|
+
slug: string;
|
|
195
|
+
hostname: string;
|
|
196
|
+
state: "unbound" | "bound" | "binding" | "binding-uncertain" | "withdrawing" | "withdrawal-uncertain" | "withdrawn";
|
|
197
|
+
targetDeploymentId: string | null;
|
|
198
|
+
reservedGeneration: string;
|
|
199
|
+
committedGeneration: string;
|
|
200
|
+
createdAt: string;
|
|
201
|
+
}[]>;
|
|
202
|
+
listPage: (o: string, appId: string, page: import('@launchpad-kit/sdk').PageOptions) => Promise<import('@launchpad-kit/sdk').Page<{
|
|
203
|
+
id: string;
|
|
204
|
+
appId: string;
|
|
205
|
+
slug: string;
|
|
206
|
+
hostname: string;
|
|
207
|
+
state: "unbound" | "bound" | "binding" | "binding-uncertain" | "withdrawing" | "withdrawal-uncertain" | "withdrawn";
|
|
208
|
+
targetDeploymentId: string | null;
|
|
209
|
+
reservedGeneration: string;
|
|
210
|
+
committedGeneration: string;
|
|
211
|
+
createdAt: string;
|
|
212
|
+
}>>;
|
|
213
|
+
get: (o: string, id: string) => Promise<{
|
|
214
|
+
id: string;
|
|
215
|
+
appId: string;
|
|
216
|
+
slug: string;
|
|
217
|
+
hostname: string;
|
|
218
|
+
state: "unbound" | "bound" | "binding" | "binding-uncertain" | "withdrawing" | "withdrawal-uncertain" | "withdrawn";
|
|
219
|
+
targetDeploymentId: string | null;
|
|
220
|
+
reservedGeneration: string;
|
|
221
|
+
committedGeneration: string;
|
|
222
|
+
createdAt: string;
|
|
223
|
+
}>;
|
|
224
|
+
create: (o: string, appId: string, input: import('zod').input<typeof import('@launchpad-kit/contracts').createAliasSchema>) => Promise<{
|
|
225
|
+
id: string;
|
|
226
|
+
appId: string;
|
|
227
|
+
slug: string;
|
|
228
|
+
hostname: string;
|
|
229
|
+
state: "unbound" | "bound" | "binding" | "binding-uncertain" | "withdrawing" | "withdrawal-uncertain" | "withdrawn";
|
|
230
|
+
targetDeploymentId: string | null;
|
|
231
|
+
reservedGeneration: string;
|
|
232
|
+
committedGeneration: string;
|
|
233
|
+
createdAt: string;
|
|
234
|
+
}>;
|
|
235
|
+
promote: (o: string, id: string, input: import('zod').input<typeof import('@launchpad-kit/contracts').promoteAliasSchema>, options: import('@launchpad-kit/sdk').RequestOptions & {
|
|
236
|
+
idempotencyKey: string;
|
|
237
|
+
}) => Promise<{
|
|
238
|
+
id: string;
|
|
239
|
+
aliasId: string;
|
|
240
|
+
action: "bind" | "withdraw";
|
|
241
|
+
status: "queued" | "applying" | "verifying" | "succeeded" | "failed" | "reconciliation-needed" | "superseded";
|
|
242
|
+
generation: string;
|
|
243
|
+
expectedGeneration: string;
|
|
244
|
+
previousTargetDeploymentId: string | null;
|
|
245
|
+
desiredTargetDeploymentId: string | null;
|
|
246
|
+
supersedesOperationId: string | null;
|
|
247
|
+
supersededByOperationId: string | null;
|
|
248
|
+
failureCode: string | null;
|
|
249
|
+
createdAt: string;
|
|
250
|
+
finishedAt: string | null;
|
|
251
|
+
}>;
|
|
252
|
+
withdraw: (o: string, id: string, input: import('zod').input<typeof import('@launchpad-kit/contracts').withdrawAliasSchema>, options: import('@launchpad-kit/sdk').RequestOptions & {
|
|
253
|
+
idempotencyKey: string;
|
|
254
|
+
}) => Promise<{
|
|
255
|
+
id: string;
|
|
256
|
+
aliasId: string;
|
|
257
|
+
action: "bind" | "withdraw";
|
|
258
|
+
status: "queued" | "applying" | "verifying" | "succeeded" | "failed" | "reconciliation-needed" | "superseded";
|
|
259
|
+
generation: string;
|
|
260
|
+
expectedGeneration: string;
|
|
261
|
+
previousTargetDeploymentId: string | null;
|
|
262
|
+
desiredTargetDeploymentId: string | null;
|
|
263
|
+
supersedesOperationId: string | null;
|
|
264
|
+
supersededByOperationId: string | null;
|
|
265
|
+
failureCode: string | null;
|
|
266
|
+
createdAt: string;
|
|
267
|
+
finishedAt: string | null;
|
|
268
|
+
}>;
|
|
269
|
+
operations: (o: string, id: string) => Promise<{
|
|
270
|
+
id: string;
|
|
271
|
+
aliasId: string;
|
|
272
|
+
action: "bind" | "withdraw";
|
|
273
|
+
status: "queued" | "applying" | "verifying" | "succeeded" | "failed" | "reconciliation-needed" | "superseded";
|
|
274
|
+
generation: string;
|
|
275
|
+
expectedGeneration: string;
|
|
276
|
+
previousTargetDeploymentId: string | null;
|
|
277
|
+
desiredTargetDeploymentId: string | null;
|
|
278
|
+
supersedesOperationId: string | null;
|
|
279
|
+
supersededByOperationId: string | null;
|
|
280
|
+
failureCode: string | null;
|
|
281
|
+
createdAt: string;
|
|
282
|
+
finishedAt: string | null;
|
|
283
|
+
}[]>;
|
|
284
|
+
operationsPage: (o: string, id: string, page: import('@launchpad-kit/sdk').PageOptions) => Promise<import('@launchpad-kit/sdk').Page<{
|
|
285
|
+
id: string;
|
|
286
|
+
aliasId: string;
|
|
287
|
+
action: "bind" | "withdraw";
|
|
288
|
+
status: "queued" | "applying" | "verifying" | "succeeded" | "failed" | "reconciliation-needed" | "superseded";
|
|
289
|
+
generation: string;
|
|
290
|
+
expectedGeneration: string;
|
|
291
|
+
previousTargetDeploymentId: string | null;
|
|
292
|
+
desiredTargetDeploymentId: string | null;
|
|
293
|
+
supersedesOperationId: string | null;
|
|
294
|
+
supersededByOperationId: string | null;
|
|
295
|
+
failureCode: string | null;
|
|
296
|
+
createdAt: string;
|
|
297
|
+
finishedAt: string | null;
|
|
298
|
+
}>>;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
organizationId: string;
|
|
302
|
+
}>;
|
|
303
|
+
export type AppClient = Awaited<ReturnType<typeof appClient>>;
|
|
304
|
+
export declare function requireConfirmation(confirmed: boolean | undefined): void;
|
|
305
|
+
export declare function checkedApp({ client, organizationId }: AppClient, appId: string, allowedProjects: readonly string[]): Promise<{
|
|
306
|
+
id: string;
|
|
307
|
+
projectId: string;
|
|
308
|
+
slug: string;
|
|
309
|
+
state: "active" | "shutting-down" | "deleted";
|
|
310
|
+
createdAt: string;
|
|
311
|
+
}>;
|
package/errors.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type ClientCoreErrorCode = "not-logged-in" | "insecure-store" | "corrupt-store" | "unsupported-store" | "store-unavailable" | "store-busy" | "bad-input" | "no-organization";
|
|
2
|
+
export declare class ClientCoreError extends Error {
|
|
3
|
+
readonly code: ClientCoreErrorCode;
|
|
4
|
+
constructor(code: ClientCoreErrorCode, message: string);
|
|
5
|
+
}
|
package/fields.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface FieldInput {
|
|
2
|
+
typed: boolean;
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
export interface FieldSources {
|
|
6
|
+
fill?(text: string): string;
|
|
7
|
+
readFile(path: string): Promise<string>;
|
|
8
|
+
readStdin(): Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
type Node = {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
export declare function parseFields(inputs: readonly FieldInput[], sources: FieldSources): Promise<Node>;
|
|
14
|
+
export declare function fieldsToQuery(fields: Node, prefix?: string): Array<[string, string]>;
|
|
15
|
+
export {};
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { ClientCoreError } from './errors.js';
|
|
2
|
+
export type { ClientCoreErrorCode } from './errors.js';
|
|
3
|
+
export { redact, redactSecrets } from './redact.js';
|
|
4
|
+
export { safeOutput } from './output.js';
|
|
5
|
+
export { configDirectory, CredentialStore } from './store.js';
|
|
6
|
+
export type { Config, Profile } from './store.js';
|
|
7
|
+
export { normalizeEmail, SessionStore } from './session-store.js';
|
|
8
|
+
export type { SessionEntry } from './session-store.js';
|
|
9
|
+
export { createContext, listOrganizations, listProfiles, listProjects, login, logout, useOrganization, useProfile, whoami, } from './operations.js';
|
|
10
|
+
export type { Context } from './operations.js';
|
|
11
|
+
export { resolveProject } from './project.js';
|
|
12
|
+
export { checkLocation, compileSelection, DEFAULT_PACK_LIMITS, packDirectory, readArchive, } from './pack.js';
|
|
13
|
+
export type { FileSelection, PackLimits, Packed } from './pack.js';
|
|
14
|
+
export { readWorkspace, workspaceContext } from './workspace.js';
|
|
15
|
+
export { appClient, checkedApp, requireConfirmation } from './app-client.js';
|
|
16
|
+
export type { AppClient } from './app-client.js';
|
|
17
|
+
export { fieldsToQuery, parseFields } from './fields.js';
|
|
18
|
+
export type { FieldInput, FieldSources } from './fields.js';
|
|
19
|
+
export { clientFor, resolve } from './operations.js';
|
|
20
|
+
export type { Resolved } from './operations.js';
|