@cosmoner/sdk 1.10.0 → 1.11.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/dist/index.d.ts CHANGED
@@ -10,16 +10,16 @@ export { BucketsService, type Bucket, type BucketTier, type CreateBucketParams,
10
10
  export { CatalogService, type AppSize, type CatalogRegion, type DatabaseCatalog, type DatabaseSize, type GetDatabaseCatalogResponse, type ListAppRegionsResponse, type ListAppSizesResponse, type ListRedisPlansResponse, type ListRegionsResponse, type ListServerImagesResponse, type ListServerSizesResponse, type RedisPlan, type ServerSize, } from "./services/catalog";
11
11
  export { DatabasesService, type CreateDedicatedDatabaseParams, type CreateDedicatedDatabaseResponse, type DatabaseSummary, type DedicatedDatabase, type DedicatedDatabaseDetail, type DeleteDatabaseResponse, type GetDedicatedDatabaseResponse, type GetSharedDatabaseResponse, type ListDatabasesResponse, type ListDedicatedDatabasesResponse, type ListSharedDatabasesResponse, type PreviewDedicatedDatabaseParams, type PreviewDedicatedDatabaseResponse, type SharedDatabase, } from "./services/databases";
12
12
  export { DomainsService, type CreateDomainResponse, type DeleteDomainResponse, type DnsRecord, type Domain, type GetDomainResponse, type ListDomainsResponse, type VerificationRecord, type VerifyDomainResponse, } from "./services/domains";
13
- export { EmailService, type EmailDomain, type EmailDomainDetail, type GetEmailDomainResponse, type ListEmailDomainsResponse, type SendEmailParams, type SendEmailResponse, } from "./services/email";
13
+ export { EmailService, type CreateSmtpCredentialParams, type CreateSmtpCredentialResponse, type EmailDomain, type EmailDomainDetail, type GetEmailDomainResponse, type ListEmailDomainsResponse, type NewSmtpCredential, type SendEmailParams, type SendEmailResponse, } from "./services/email";
14
14
  export { HostingService, type CreateHostingSiteParams, type CreateHostingSiteResponse, type DeleteHostingSiteResponse, type GetHostingAccessResponse, type GetHostingSiteParams, type GetHostingSiteResponse, type GetHostingSiteWithCredentialsResponse, type HostingAccess, type HostingPrice, type HostingSite, type HostingSiteStatus, type HostingSiteWithCredentials, type HostingTier, type ListHostingPricesResponse, type ListHostingSitesResponse, type PreviewHostingSiteParams, type PreviewHostingSiteResponse, } from "./services/hosting";
15
- export { IamService, type GetIamCredentialResponse, type IamCredential, type IamCredentialList, type ListIamCredentialsResponse, } from "./services/iam";
15
+ export { IamService, type CreateIamCredentialParams, type CreateIamCredentialResponse, type GetIamCredentialResponse, type IamCredential, type IamCredentialList, type IamRegistryGrant, type IamStorageGrant, type ListIamCredentialsResponse, type NewIamCredential, } from "./services/iam";
16
16
  export { MembersService, type ListMembersResponse, type ProjectMember, type ProjectMembers } from "./services/members";
17
17
  export type { CheckoutPreview, PlanChangePreview } from "./services/preview";
18
18
  export { ProjectsService, type GetProjectResponse, type ListProjectsResponse, type Project } from "./services/projects";
19
19
  export { RedisService, type CreateRedisParams, type CreateRedisResponse, type DeleteRedisDatabaseResponse, type GetRedisDatabaseResponse, type ListRedisDatabasesResponse, type PreviewRedisParams, type PreviewRedisResponse, type RedisDatabase, type RedisDatabaseDetail, type RedisPersistence, } from "./services/redis";
20
20
  export { RegistriesService, type CreateRegistryParams, type CreateRegistryResponse, type DeleteRegistryResponse, type GetRegistryResponse, type ListRegistriesResponse, type ListRegistryProvidersResponse, type PreviewRegistryResponse, type Registry, type RegistryProvider, type RegistryRepository, } from "./services/registries";
21
21
  export { ServersService, type CreateServerParams, type CreateServerResponse, type DeleteServerResponse, type GetServerResponse, type ListServersResponse, type PreviewServerParams, type PreviewServerResponse, type Server, type ServerDetail, type ServerStatus, } from "./services/servers";
22
- export { SshKeysService, type CreateSshKeyParams, type CreateSshKeyResponse, type DeleteSshKeyResponse, type ListSshKeysResponse, type SshKey, } from "./services/ssh-keys";
22
+ export { SshKeysService, type CreateSshKeyParams, type CreateSshKeyResponse, type DeleteSshKeyResponse, type GenerateSshKeyResponse, type GeneratedSshKey, type ListSshKeysResponse, type SshKey, } from "./services/ssh-keys";
23
23
  export { PROJECT_ENVIRONMENTS, type Actor, type ProjectEnvironment, } from "./services/project-config";
24
24
  export { SecretsService, type CreateSecretParams, type GetSecretAuditResponse, type GetSecretResponse, type GetSecretsUsageResponse, type ListSecretsParams, type ListSecretsResponse, type ProjectSecret, type RevealedProjectSecret, type SecretAuditEntry, type SecretsUsage, type SetSecretResponse, type UpdateSecretParams, } from "./services/secrets";
25
25
  export { VariablesService, type CreateVariableParams, type GetVariableResponse, type ListVariablesParams, type ListVariablesResponse, type ProjectVariable, type SetVariableResponse, type UpdateVariableParams, } from "./services/variables";
package/dist/index.js CHANGED
@@ -588,6 +588,33 @@ var EmailService = class {
588
588
  `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}`
589
589
  );
590
590
  }
591
+ /**
592
+ * Creates an SMTP credential for a sending domain. The response holds
593
+ * `smtpPassword` this once: the API keeps only a hash.
594
+ */
595
+ // eslint-disable-next-line require-await -- `async` makes the validation below reject rather than throw synchronously.
596
+ async createCredential(emailDomainId, params) {
597
+ if (!emailDomainId) throw new Error("emailDomainId is required");
598
+ if (!params?.label) throw new Error("label is required");
599
+ if (!params.fromAddress) throw new Error("fromAddress is required");
600
+ return this.transport.request(
601
+ "POST",
602
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}/credentials`,
603
+ { body: { label: params.label, fromAddress: params.fromAddress } }
604
+ );
605
+ }
606
+ /**
607
+ * Deletes an SMTP credential; anything sending with it stops working. The
608
+ * API answers 204, so there is nothing to return.
609
+ */
610
+ async deleteCredential(emailDomainId, credentialId, params = {}) {
611
+ if (!emailDomainId) throw new Error("emailDomainId is required");
612
+ if (!credentialId) throw new Error("credentialId is required");
613
+ await this.transport.request(
614
+ "DELETE",
615
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}/credentials/${credentialId}`
616
+ );
617
+ }
591
618
  };
592
619
 
593
620
  // src/services/hosting.ts
@@ -687,6 +714,18 @@ var IamService = class {
687
714
  if (!iamUserName) throw new Error("iamUserName is required");
688
715
  await this.transport.request("DELETE", `${this.basePath(params.projectId)}/${encodeURIComponent(iamUserName)}`);
689
716
  }
717
+ /**
718
+ * Creates an access key for object storage, the container registry, or both.
719
+ * The response holds `secretAccessKey` this once: the API keeps no copy, and
720
+ * no later read returns it.
721
+ */
722
+ async create(params) {
723
+ if (!params?.label) throw new Error("label is required");
724
+ if (!params.storage && !params.registry) throw new Error("storage or registry is required");
725
+ return this.transport.request("POST", this.basePath(params.projectId), {
726
+ body: { label: params.label, storage: params.storage, registry: params.registry }
727
+ });
728
+ }
690
729
  };
691
730
 
692
731
  // src/services/members.ts
@@ -1013,6 +1052,16 @@ var SshKeysService = class {
1013
1052
  basePath(projectId) {
1014
1053
  return `/v1/projects/${resolveProjectId(this.config, projectId)}/ssh-keys`;
1015
1054
  }
1055
+ /**
1056
+ * Generates a key pair and adds its public half to the project. The response
1057
+ * holds `privateKey` this once: the API never stores it.
1058
+ */
1059
+ async generate(params) {
1060
+ if (!params?.name) throw new Error("name is required");
1061
+ return this.transport.request("POST", `${this.basePath(params.projectId)}/generate`, {
1062
+ body: { name: params.name }
1063
+ });
1064
+ }
1016
1065
  };
1017
1066
 
1018
1067
  // src/services/variables.ts
@@ -1461,7 +1510,7 @@ function sleep(ms) {
1461
1510
  }
1462
1511
 
1463
1512
  // src/version.ts
1464
- var VERSION = "1.10.0";
1513
+ var VERSION = "1.11.0";
1465
1514
  var USER_AGENT = `cosmoner-node/${VERSION}`;
1466
1515
 
1467
1516
  // src/transport.ts
package/dist/index.mjs CHANGED
@@ -513,6 +513,33 @@ var EmailService = class {
513
513
  `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}`
514
514
  );
515
515
  }
516
+ /**
517
+ * Creates an SMTP credential for a sending domain. The response holds
518
+ * `smtpPassword` this once: the API keeps only a hash.
519
+ */
520
+ // eslint-disable-next-line require-await -- `async` makes the validation below reject rather than throw synchronously.
521
+ async createCredential(emailDomainId, params) {
522
+ if (!emailDomainId) throw new Error("emailDomainId is required");
523
+ if (!params?.label) throw new Error("label is required");
524
+ if (!params.fromAddress) throw new Error("fromAddress is required");
525
+ return this.transport.request(
526
+ "POST",
527
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}/credentials`,
528
+ { body: { label: params.label, fromAddress: params.fromAddress } }
529
+ );
530
+ }
531
+ /**
532
+ * Deletes an SMTP credential; anything sending with it stops working. The
533
+ * API answers 204, so there is nothing to return.
534
+ */
535
+ async deleteCredential(emailDomainId, credentialId, params = {}) {
536
+ if (!emailDomainId) throw new Error("emailDomainId is required");
537
+ if (!credentialId) throw new Error("credentialId is required");
538
+ await this.transport.request(
539
+ "DELETE",
540
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}/credentials/${credentialId}`
541
+ );
542
+ }
516
543
  };
517
544
 
518
545
  // src/services/hosting.ts
@@ -612,6 +639,18 @@ var IamService = class {
612
639
  if (!iamUserName) throw new Error("iamUserName is required");
613
640
  await this.transport.request("DELETE", `${this.basePath(params.projectId)}/${encodeURIComponent(iamUserName)}`);
614
641
  }
642
+ /**
643
+ * Creates an access key for object storage, the container registry, or both.
644
+ * The response holds `secretAccessKey` this once: the API keeps no copy, and
645
+ * no later read returns it.
646
+ */
647
+ async create(params) {
648
+ if (!params?.label) throw new Error("label is required");
649
+ if (!params.storage && !params.registry) throw new Error("storage or registry is required");
650
+ return this.transport.request("POST", this.basePath(params.projectId), {
651
+ body: { label: params.label, storage: params.storage, registry: params.registry }
652
+ });
653
+ }
615
654
  };
616
655
 
617
656
  // src/services/members.ts
@@ -938,6 +977,16 @@ var SshKeysService = class {
938
977
  basePath(projectId) {
939
978
  return `/v1/projects/${resolveProjectId(this.config, projectId)}/ssh-keys`;
940
979
  }
980
+ /**
981
+ * Generates a key pair and adds its public half to the project. The response
982
+ * holds `privateKey` this once: the API never stores it.
983
+ */
984
+ async generate(params) {
985
+ if (!params?.name) throw new Error("name is required");
986
+ return this.transport.request("POST", `${this.basePath(params.projectId)}/generate`, {
987
+ body: { name: params.name }
988
+ });
989
+ }
941
990
  };
942
991
 
943
992
  // src/services/variables.ts
@@ -1386,7 +1435,7 @@ function sleep(ms) {
1386
1435
  }
1387
1436
 
1388
1437
  // src/version.ts
1389
- var VERSION = "1.10.0";
1438
+ var VERSION = "1.11.0";
1390
1439
  var USER_AGENT = `cosmoner-node/${VERSION}`;
1391
1440
 
1392
1441
  // src/transport.ts
@@ -71,6 +71,27 @@ export interface GetEmailDomainResponse {
71
71
  success: true;
72
72
  data: EmailDomainDetail;
73
73
  }
74
+ /** Arguments accepted by `client.email.createCredential()`. */
75
+ export interface CreateSmtpCredentialParams extends ProjectScopedParams {
76
+ label: string;
77
+ /** The address it sends as; it must be on the sending domain. */
78
+ fromAddress: string;
79
+ }
80
+ /** A new SMTP credential, with its password — returned this once. */
81
+ export interface NewSmtpCredential {
82
+ id: string;
83
+ label: string;
84
+ fromAddress: string;
85
+ smtpUsername: string;
86
+ /** Store it now: the API keeps only a hash, and no later read returns it. */
87
+ smtpPassword: string;
88
+ sentCount: number;
89
+ createdAt: string;
90
+ }
91
+ export interface CreateSmtpCredentialResponse {
92
+ success: true;
93
+ data: NewSmtpCredential;
94
+ }
74
95
  /** Email operations for a project. */
75
96
  export declare class EmailService {
76
97
  private readonly transport;
@@ -91,4 +112,14 @@ export declare class EmailService {
91
112
  * stays in the project. The API answers 204, so there is nothing to return.
92
113
  */
93
114
  deleteDomain(emailDomainId: string, params?: ProjectScopedParams): Promise<void>;
115
+ /**
116
+ * Creates an SMTP credential for a sending domain. The response holds
117
+ * `smtpPassword` this once: the API keeps only a hash.
118
+ */
119
+ createCredential(emailDomainId: string, params: CreateSmtpCredentialParams): Promise<CreateSmtpCredentialResponse>;
120
+ /**
121
+ * Deletes an SMTP credential; anything sending with it stops working. The
122
+ * API answers 204, so there is nothing to return.
123
+ */
124
+ deleteCredential(emailDomainId: string, credentialId: string, params?: ProjectScopedParams): Promise<void>;
94
125
  }
@@ -46,6 +46,53 @@ interface Envelope<T> {
46
46
  }
47
47
  export type ListIamCredentialsResponse = Envelope<IamCredentialList>;
48
48
  export type GetIamCredentialResponse = Envelope<IamCredential>;
49
+ /** What a new credential may do in object storage. */
50
+ export interface IamStorageGrant {
51
+ access: "read" | "write";
52
+ /** Buckets it reaches, by id. Omitted or empty: every bucket, including ones created later. */
53
+ bucketIds?: string[];
54
+ }
55
+ /** What a new credential may do in the container registry. */
56
+ export interface IamRegistryGrant {
57
+ access: "pull" | "push";
58
+ /** Repositories it reaches, by id. Omitted or empty: every repository, including ones created later. */
59
+ repositoryIds?: string[];
60
+ }
61
+ /** Arguments accepted by `client.iam.create()`. At least one of `storage` and `registry` is required. */
62
+ export interface CreateIamCredentialParams extends ProjectScopedParams {
63
+ /** 1–20 characters; it becomes part of the IAM user name. */
64
+ label: string;
65
+ storage?: IamStorageGrant;
66
+ registry?: IamRegistryGrant;
67
+ }
68
+ /** A new credential, with its secret key — returned this once. */
69
+ export interface NewIamCredential {
70
+ iamUserName: string;
71
+ label: string;
72
+ accessKeyId: string;
73
+ /** Store it now: the API keeps no copy, and no later read returns it. */
74
+ secretAccessKey: string;
75
+ createdAt: string;
76
+ origin: "project";
77
+ storage: {
78
+ access: "read" | "write";
79
+ allBuckets: boolean;
80
+ buckets: Array<{
81
+ bucketId: string;
82
+ bucketName: string;
83
+ }>;
84
+ } | null;
85
+ registry: {
86
+ access: "pull" | "push";
87
+ allRepositories: boolean;
88
+ repositories: Array<{
89
+ repositoryId: string;
90
+ repositoryName: string;
91
+ registryId: string;
92
+ }>;
93
+ } | null;
94
+ }
95
+ export type CreateIamCredentialResponse = Envelope<NewIamCredential>;
49
96
  /** Read operations on a project's access credentials. */
50
97
  export declare class IamService {
51
98
  private readonly transport;
@@ -62,5 +109,11 @@ export declare class IamService {
62
109
  * keys stops working. The API answers 204, so there is nothing to return.
63
110
  */
64
111
  delete(iamUserName: string, params?: ProjectScopedParams): Promise<void>;
112
+ /**
113
+ * Creates an access key for object storage, the container registry, or both.
114
+ * The response holds `secretAccessKey` this once: the API keeps no copy, and
115
+ * no later read returns it.
116
+ */
117
+ create(params: CreateIamCredentialParams): Promise<CreateIamCredentialResponse>;
65
118
  }
66
119
  export {};
@@ -31,6 +31,12 @@ export type DeleteSshKeyResponse = Envelope<{
31
31
  /** Servers the key was already installed on, where it still works: deleting does not revoke it there. */
32
32
  stillAuthorisedOn: number;
33
33
  }>;
34
+ /** A key pair generated by the API, with its private half — returned this once. */
35
+ export interface GeneratedSshKey extends SshKey {
36
+ /** RSA 4096, PEM (PKCS#1). Store it now: it is never stored, and no later read returns it. */
37
+ privateKey: string;
38
+ }
39
+ export type GenerateSshKeyResponse = Envelope<GeneratedSshKey>;
34
40
  /** A project's SSH keys. */
35
41
  export declare class SshKeysService {
36
42
  private readonly transport;
@@ -47,5 +53,12 @@ export declare class SshKeysService {
47
53
  delete(sshKeyId: string, params?: ProjectScopedParams): Promise<DeleteSshKeyResponse>;
48
54
  /** Builds the collection route for the resolved project. */
49
55
  private basePath;
56
+ /**
57
+ * Generates a key pair and adds its public half to the project. The response
58
+ * holds `privateKey` this once: the API never stores it.
59
+ */
60
+ generate(params: {
61
+ name: string;
62
+ } & ProjectScopedParams): Promise<GenerateSshKeyResponse>;
50
63
  }
51
64
  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.10.0";
12
- export declare const USER_AGENT = "cosmoner-node/1.10.0";
11
+ export declare const VERSION = "1.11.0";
12
+ export declare const USER_AGENT = "cosmoner-node/1.11.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmoner/sdk",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Cosmoner SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",