@cosmoner/sdk 1.7.0 → 1.8.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/README.md +30 -2
- package/dist/client.d.ts +21 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +281 -4
- package/dist/index.mjs +271 -4
- package/dist/services/apps.d.ts +24 -0
- package/dist/services/buckets.d.ts +37 -0
- package/dist/services/databases.d.ts +106 -0
- package/dist/services/domains.d.ts +54 -0
- package/dist/services/email.d.ts +56 -0
- package/dist/services/iam.d.ts +61 -0
- package/dist/services/members.d.ts +50 -0
- package/dist/services/projects.d.ts +45 -0
- package/dist/services/redis.d.ts +55 -0
- package/dist/services/registries.d.ts +47 -0
- package/dist/services/secrets.d.ts +3 -3
- package/dist/services/servers.d.ts +56 -0
- package/dist/services/ssh-keys.d.ts +31 -0
- package/dist/version.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** IAM service namespace — a project's storage and registry access keys. */
|
|
2
|
+
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { Transport } from "../transport";
|
|
4
|
+
/**
|
|
5
|
+
* One access credential. Only the key id is ever returned; the secret half is
|
|
6
|
+
* shown once, when the credential is created.
|
|
7
|
+
*/
|
|
8
|
+
export interface IamCredential {
|
|
9
|
+
iamUserName: string;
|
|
10
|
+
label: string | null;
|
|
11
|
+
accessKeyId: string;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
origin: "project" | "registry" | "bucket";
|
|
14
|
+
registry: {
|
|
15
|
+
access: "pull" | "push";
|
|
16
|
+
allRepositories: boolean;
|
|
17
|
+
repositories: Array<{
|
|
18
|
+
repositoryId: string;
|
|
19
|
+
repositoryName: string;
|
|
20
|
+
registryId: string | null;
|
|
21
|
+
}>;
|
|
22
|
+
} | null;
|
|
23
|
+
storage: {
|
|
24
|
+
access: "read" | "write";
|
|
25
|
+
allBuckets: boolean;
|
|
26
|
+
buckets: Array<{
|
|
27
|
+
bucketId: string;
|
|
28
|
+
bucketName: string;
|
|
29
|
+
}>;
|
|
30
|
+
} | null;
|
|
31
|
+
}
|
|
32
|
+
/** The project's credentials, and any it could not read. */
|
|
33
|
+
export interface IamCredentialList {
|
|
34
|
+
credentials: IamCredential[];
|
|
35
|
+
/** Problems reading some credentials; the rest are still listed. */
|
|
36
|
+
errors: string[];
|
|
37
|
+
}
|
|
38
|
+
/** Options accepted by every method, for working across projects. */
|
|
39
|
+
export interface ProjectScopedParams {
|
|
40
|
+
/** Overrides the client-level default project for this call. */
|
|
41
|
+
projectId?: string;
|
|
42
|
+
}
|
|
43
|
+
interface Envelope<T> {
|
|
44
|
+
success: true;
|
|
45
|
+
data: T;
|
|
46
|
+
}
|
|
47
|
+
export type ListIamCredentialsResponse = Envelope<IamCredentialList>;
|
|
48
|
+
export type GetIamCredentialResponse = Envelope<IamCredential>;
|
|
49
|
+
/** Read operations on a project's access credentials. */
|
|
50
|
+
export declare class IamService {
|
|
51
|
+
private readonly transport;
|
|
52
|
+
private readonly config;
|
|
53
|
+
constructor(transport: Transport, config: ResolvedConfig);
|
|
54
|
+
/** Builds the collection route for the resolved project. */
|
|
55
|
+
private basePath;
|
|
56
|
+
/** Lists every access credential in the project, newest first. */
|
|
57
|
+
list(params?: ProjectScopedParams): Promise<ListIamCredentialsResponse>;
|
|
58
|
+
/** Fetches one credential by its IAM user name. */
|
|
59
|
+
get(iamUserName: string, params?: ProjectScopedParams): Promise<GetIamCredentialResponse>;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Members service namespace — who belongs to a project. */
|
|
2
|
+
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { Transport } from "../transport";
|
|
4
|
+
/** One member of a project. */
|
|
5
|
+
export interface ProjectMember {
|
|
6
|
+
id: string;
|
|
7
|
+
userId: string;
|
|
8
|
+
role: string;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
user: {
|
|
11
|
+
name: string;
|
|
12
|
+
email: string;
|
|
13
|
+
image: string | null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** A project's members and the invitations not yet accepted. */
|
|
17
|
+
export interface ProjectMembers {
|
|
18
|
+
orgId: string;
|
|
19
|
+
/** The user the credential belongs to. */
|
|
20
|
+
currentUserId: string;
|
|
21
|
+
/** Who pays the project's invoices. */
|
|
22
|
+
billerUserId: string | null;
|
|
23
|
+
pendingBillerUserId: string | null;
|
|
24
|
+
members: ProjectMember[];
|
|
25
|
+
pendingInvitations: Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
email: string;
|
|
28
|
+
role: string;
|
|
29
|
+
expiresAt: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
/** Options accepted by every method, for working across projects. */
|
|
33
|
+
export interface ProjectScopedParams {
|
|
34
|
+
/** Overrides the client-level default project for this call. */
|
|
35
|
+
projectId?: string;
|
|
36
|
+
}
|
|
37
|
+
interface Envelope<T> {
|
|
38
|
+
success: true;
|
|
39
|
+
data: T;
|
|
40
|
+
}
|
|
41
|
+
export type ListMembersResponse = Envelope<ProjectMembers>;
|
|
42
|
+
/** Read operations on a project's members. */
|
|
43
|
+
export declare class MembersService {
|
|
44
|
+
private readonly transport;
|
|
45
|
+
private readonly config;
|
|
46
|
+
constructor(transport: Transport, config: ResolvedConfig);
|
|
47
|
+
/** Lists the project's members and pending invitations. */
|
|
48
|
+
list(params?: ProjectScopedParams): Promise<ListMembersResponse>;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Projects service namespace — the projects the credential can reach. */
|
|
2
|
+
import type { Transport } from "../transport";
|
|
3
|
+
/** A project as the API lists it. The API returns more; the rest are present at runtime. */
|
|
4
|
+
export interface Project {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
/** Falls back to the id for a project created without a slug. */
|
|
8
|
+
slug: string;
|
|
9
|
+
billingEmail: string | null;
|
|
10
|
+
/** Set while the project is blocked for an unpaid invoice. */
|
|
11
|
+
blockedAt: string | null;
|
|
12
|
+
blockedReason: string | null;
|
|
13
|
+
/** How many of each resource the project holds. */
|
|
14
|
+
_count: {
|
|
15
|
+
servers: number;
|
|
16
|
+
domains: number;
|
|
17
|
+
members: number;
|
|
18
|
+
apps: number;
|
|
19
|
+
objectStorages: number;
|
|
20
|
+
containerRegistries: number;
|
|
21
|
+
databaseClusters: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface Envelope<T> {
|
|
25
|
+
success: true;
|
|
26
|
+
data: T;
|
|
27
|
+
}
|
|
28
|
+
export type ListProjectsResponse = Envelope<Project[]>;
|
|
29
|
+
export type GetProjectResponse = Envelope<Project>;
|
|
30
|
+
/**
|
|
31
|
+
* Reads the projects the credential can reach.
|
|
32
|
+
*
|
|
33
|
+
* Account-level: it never uses the client's default project. An API key sees
|
|
34
|
+
* the one project it was issued for; a `cosmoner login` session sees every
|
|
35
|
+
* project its user is a member of.
|
|
36
|
+
*/
|
|
37
|
+
export declare class ProjectsService {
|
|
38
|
+
private readonly transport;
|
|
39
|
+
constructor(transport: Transport);
|
|
40
|
+
/** Lists every project the credential can reach, newest first. */
|
|
41
|
+
list(): Promise<ListProjectsResponse>;
|
|
42
|
+
/** Fetches one project by id or slug. */
|
|
43
|
+
get(project: string): Promise<GetProjectResponse>;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Redis service namespace — a project's managed Redis and Valkey databases. */
|
|
2
|
+
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { Transport } from "../transport";
|
|
4
|
+
/** A Redis database as the API lists it. The API returns more; the rest are present at runtime. */
|
|
5
|
+
export interface RedisDatabase {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
provider: string;
|
|
9
|
+
engine: "REDIS" | "VALKEY";
|
|
10
|
+
engineVersion: string | null;
|
|
11
|
+
planSlug: string;
|
|
12
|
+
planType: "RAM" | "FLEX";
|
|
13
|
+
memoryMb: number;
|
|
14
|
+
throughputOps: number | null;
|
|
15
|
+
cloudProvider: string | null;
|
|
16
|
+
region: string;
|
|
17
|
+
replication: boolean;
|
|
18
|
+
dataPersistence: string;
|
|
19
|
+
status: "CREATING" | "ACTIVE" | "ERROR" | "TERMINATED";
|
|
20
|
+
host: string | null;
|
|
21
|
+
port: number | null;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
}
|
|
24
|
+
/** A Redis database read on its own. */
|
|
25
|
+
export interface RedisDatabaseDetail extends RedisDatabase {
|
|
26
|
+
/**
|
|
27
|
+
* The plaintext password. Always present once provisioned, and readable
|
|
28
|
+
* with only `redis:read`, so guard the key accordingly.
|
|
29
|
+
*/
|
|
30
|
+
password: string | null;
|
|
31
|
+
}
|
|
32
|
+
/** Options accepted by every method, for working across projects. */
|
|
33
|
+
export interface ProjectScopedParams {
|
|
34
|
+
/** Overrides the client-level default project for this call. */
|
|
35
|
+
projectId?: string;
|
|
36
|
+
}
|
|
37
|
+
interface Envelope<T> {
|
|
38
|
+
success: true;
|
|
39
|
+
data: T;
|
|
40
|
+
}
|
|
41
|
+
export type ListRedisDatabasesResponse = Envelope<RedisDatabase[]>;
|
|
42
|
+
export type GetRedisDatabaseResponse = Envelope<RedisDatabaseDetail>;
|
|
43
|
+
/** Read operations on a project's Redis databases. */
|
|
44
|
+
export declare class RedisService {
|
|
45
|
+
private readonly transport;
|
|
46
|
+
private readonly config;
|
|
47
|
+
constructor(transport: Transport, config: ResolvedConfig);
|
|
48
|
+
/** Builds the collection route for the resolved project. */
|
|
49
|
+
private basePath;
|
|
50
|
+
/** Lists every Redis database in the project that has not been terminated. */
|
|
51
|
+
list(params?: ProjectScopedParams): Promise<ListRedisDatabasesResponse>;
|
|
52
|
+
/** Fetches one Redis database, with its password; see {@link RedisDatabaseDetail}. */
|
|
53
|
+
get(redisId: string, params?: ProjectScopedParams): Promise<GetRedisDatabaseResponse>;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Registries service namespace — a project's container registries. */
|
|
2
|
+
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { Transport } from "../transport";
|
|
4
|
+
/** One repository in a registry. */
|
|
5
|
+
export interface RegistryRepository {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
/** The path to pull and push, e.g. `registry.cosmoner.com/acme/web`. */
|
|
9
|
+
fullPath: string;
|
|
10
|
+
visibility: "PRIVATE" | "PUBLIC";
|
|
11
|
+
}
|
|
12
|
+
/** A container registry. The API returns more; the rest are present at runtime. */
|
|
13
|
+
export interface Registry {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
provider: string;
|
|
17
|
+
region: string;
|
|
18
|
+
endpoint: string | null;
|
|
19
|
+
status: "CREATING" | "ACTIVE" | "SUSPENDED" | "DELETING";
|
|
20
|
+
namespaceName: string | null;
|
|
21
|
+
repositories: RegistryRepository[];
|
|
22
|
+
createdAt: string;
|
|
23
|
+
}
|
|
24
|
+
/** Options accepted by every method, for working across projects. */
|
|
25
|
+
export interface ProjectScopedParams {
|
|
26
|
+
/** Overrides the client-level default project for this call. */
|
|
27
|
+
projectId?: string;
|
|
28
|
+
}
|
|
29
|
+
interface Envelope<T> {
|
|
30
|
+
success: true;
|
|
31
|
+
data: T;
|
|
32
|
+
}
|
|
33
|
+
export type ListRegistriesResponse = Envelope<Registry[]>;
|
|
34
|
+
export type GetRegistryResponse = Envelope<Registry>;
|
|
35
|
+
/** Read operations on a project's container registries. */
|
|
36
|
+
export declare class RegistriesService {
|
|
37
|
+
private readonly transport;
|
|
38
|
+
private readonly config;
|
|
39
|
+
constructor(transport: Transport, config: ResolvedConfig);
|
|
40
|
+
/** Builds the collection route for the resolved project. */
|
|
41
|
+
private basePath;
|
|
42
|
+
/** Lists every registry in the project, with its repositories. */
|
|
43
|
+
list(params?: ProjectScopedParams): Promise<ListRegistriesResponse>;
|
|
44
|
+
/** Fetches one registry, with its repositories. */
|
|
45
|
+
get(registryId: string, params?: ProjectScopedParams): Promise<GetRegistryResponse>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -130,9 +130,9 @@ export declare class SecretsService {
|
|
|
130
130
|
/**
|
|
131
131
|
* Stores a new secret, and returns its plaintext value once.
|
|
132
132
|
*
|
|
133
|
-
* Creation is rate-limited to
|
|
134
|
-
*
|
|
135
|
-
* answers 402 — see `usage()`.
|
|
133
|
+
* Creation is rate-limited to 100 per project every 10 minutes, shared by
|
|
134
|
+
* every key and machine working on the project; past it, a `RateLimitError`.
|
|
135
|
+
* A project at its secret limit answers 402 — see `usage()`.
|
|
136
136
|
*/
|
|
137
137
|
create(params: CreateSecretParams): Promise<SetSecretResponse>;
|
|
138
138
|
/** Replaces a secret's value, bumps its version, and returns the new value once. */
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Servers service namespace — a project's virtual servers. */
|
|
2
|
+
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { Transport } from "../transport";
|
|
4
|
+
export type ServerStatus = "PROVISIONING" | "RUNNING" | "STOPPED" | "ERROR" | "TERMINATED";
|
|
5
|
+
/** A server as the API lists it. The API returns more; the rest are present at runtime. */
|
|
6
|
+
export interface Server {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
type: "LAMP" | "POSTGRES";
|
|
10
|
+
provider: string;
|
|
11
|
+
region: string;
|
|
12
|
+
instanceType: string;
|
|
13
|
+
image: string;
|
|
14
|
+
status: ServerStatus;
|
|
15
|
+
ipAddress: string | null;
|
|
16
|
+
hostname: string | null;
|
|
17
|
+
phpVersion: string | null;
|
|
18
|
+
pgVersion: string | null;
|
|
19
|
+
pgDatabase: string | null;
|
|
20
|
+
pgUsername: string | null;
|
|
21
|
+
sshUser: string | null;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
}
|
|
25
|
+
/** A server read on its own, with the SSH keys installed on it. */
|
|
26
|
+
export interface ServerDetail extends Server {
|
|
27
|
+
sshKeys: Array<{
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
fingerprint: string;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
/** Options accepted by every method, for working across projects. */
|
|
34
|
+
export interface ProjectScopedParams {
|
|
35
|
+
/** Overrides the client-level default project for this call. */
|
|
36
|
+
projectId?: string;
|
|
37
|
+
}
|
|
38
|
+
interface Envelope<T> {
|
|
39
|
+
success: true;
|
|
40
|
+
data: T;
|
|
41
|
+
}
|
|
42
|
+
export type ListServersResponse = Envelope<Server[]>;
|
|
43
|
+
export type GetServerResponse = Envelope<ServerDetail>;
|
|
44
|
+
/** Read operations on a project's servers. */
|
|
45
|
+
export declare class ServersService {
|
|
46
|
+
private readonly transport;
|
|
47
|
+
private readonly config;
|
|
48
|
+
constructor(transport: Transport, config: ResolvedConfig);
|
|
49
|
+
/** Builds the collection route for the resolved project. */
|
|
50
|
+
private basePath;
|
|
51
|
+
/** Lists every server in the project that has not been terminated. */
|
|
52
|
+
list(params?: ProjectScopedParams): Promise<ListServersResponse>;
|
|
53
|
+
/** Fetches one server, with the SSH keys installed on it. */
|
|
54
|
+
get(serverId: string, params?: ProjectScopedParams): Promise<GetServerResponse>;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** SSH keys service namespace — the public keys a project installs on its servers. */
|
|
2
|
+
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { Transport } from "../transport";
|
|
4
|
+
/** A public SSH key. The private half is never stored or returned. */
|
|
5
|
+
export interface SshKey {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
publicKey: string;
|
|
9
|
+
fingerprint: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
}
|
|
13
|
+
/** Options accepted by every method, for working across projects. */
|
|
14
|
+
export interface ProjectScopedParams {
|
|
15
|
+
/** Overrides the client-level default project for this call. */
|
|
16
|
+
projectId?: string;
|
|
17
|
+
}
|
|
18
|
+
interface Envelope<T> {
|
|
19
|
+
success: true;
|
|
20
|
+
data: T;
|
|
21
|
+
}
|
|
22
|
+
export type ListSshKeysResponse = Envelope<SshKey[]>;
|
|
23
|
+
/** Read operations on a project's SSH keys. */
|
|
24
|
+
export declare class SshKeysService {
|
|
25
|
+
private readonly transport;
|
|
26
|
+
private readonly config;
|
|
27
|
+
constructor(transport: Transport, config: ResolvedConfig);
|
|
28
|
+
/** Lists every SSH key in the project. */
|
|
29
|
+
list(params?: ProjectScopedParams): Promise<ListSshKeysResponse>;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
package/dist/version.d.ts
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* the release workflow runs that straight after `npm version`, and
|
|
9
9
|
* `version.test.ts` fails the build if the two ever disagree.
|
|
10
10
|
*/
|
|
11
|
-
export declare const VERSION = "1.
|
|
12
|
-
export declare const USER_AGENT = "cosmoner-node/1.
|
|
11
|
+
export declare const VERSION = "1.8.0";
|
|
12
|
+
export declare const USER_AGENT = "cosmoner-node/1.8.0";
|