@cosmoner/sdk 1.21.0 → 1.22.1
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 +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +47 -1
- package/dist/index.mjs +46 -1
- package/dist/services/invoices.d.ts +78 -0
- package/dist/version.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -256,6 +256,7 @@ A method taking an id rejects an empty one before sending anything.
|
|
|
256
256
|
| `registries` | `list()`, `get(registryId)` | `delete(registryId)` |
|
|
257
257
|
| `iam` | `list()`, `get(iamUserName)` — the list holds `credentials` plus partial-failure `errors` | `delete(iamUserName)` |
|
|
258
258
|
| `members` | `list()` — members and pending invitations | |
|
|
259
|
+
| `invoices` | `list({ status, createdGte, createdLte, limit, startingAfter })` — one page, newest first; `export({ status, createdGte, createdLte })` — every match, up to 1,000; `get(invoiceId)` — each with `invoicePdfUrl`. Needs `billing:read` | |
|
|
259
260
|
| `email` | `listDomains()`, `getDomain(emailDomainId)`, `limits()`, alongside `send()` | `createDomain({ domainId })`, `createExternalDomain({ domainName })`, `verifyDomain(emailDomainId)`, `deleteDomain(emailDomainId)` |
|
|
260
261
|
|
|
261
262
|
Two of these return a credential, and each needs only the namespace's read
|
package/dist/client.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { DomainsService } from "./services/domains";
|
|
|
8
8
|
import { EmailService } from "./services/email";
|
|
9
9
|
import { HostingService } from "./services/hosting";
|
|
10
10
|
import { IamService } from "./services/iam";
|
|
11
|
+
import { InvoicesService } from "./services/invoices";
|
|
11
12
|
import { MembersService } from "./services/members";
|
|
12
13
|
import { ProjectsService } from "./services/projects";
|
|
13
14
|
import { RedisService } from "./services/redis";
|
|
@@ -44,6 +45,7 @@ export declare class Cosmoner {
|
|
|
44
45
|
readonly email: EmailService;
|
|
45
46
|
readonly hosting: HostingService;
|
|
46
47
|
readonly iam: IamService;
|
|
48
|
+
readonly invoices: InvoicesService;
|
|
47
49
|
readonly members: MembersService;
|
|
48
50
|
/** Account-level: never uses the client's default project. */
|
|
49
51
|
readonly projects: ProjectsService;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { DomainsService, type CreateDomainResponse, type DeleteDomainResponse, t
|
|
|
13
13
|
export { EmailService, type CreateEmailDomainParams, type CreateEmailDomainResponse, type CreateExternalEmailDomainParams, type CreateSmtpCredentialParams, type CreateSmtpCredentialResponse, type EmailDomain, type EmailDomainDetail, type EmailDomainVerification, type EmailLimits, type EmailTemplateRef, type GetEmailDomainResponse, type GetEmailLimitsResponse, type ListEmailDomainsResponse, type NewSmtpCredential, type SendEmailParams, type SendEmailResponse, type SendRawEmailParams, type SendTemplateEmailParams, type SentEmailTemplate, type VerifyEmailDomainResponse, } from "./services/email";
|
|
14
14
|
export { HostingService, type CreateHostingSiteParams, type CreateHostingSiteResponse, type DeleteHostingSiteResponse, type AttachHostingDomainParams, type AttachHostingDomainResponse, type DetachHostingDomainResponse, type EnableHostingMailParams, type GetHostingAccessResponse, type GetHostingSiteParams, type GetHostingSiteResponse, type GetHostingSiteWithCredentialsResponse, type HostingAccess, type HostingDomain, type HostingDomainAttached, type HostingDomainBehaviour, type HostingDomainDnsInstructions, type HostingDomainKind, type HostingImageBuild, type HostingImageStatus, type HostingImageStatusResponse, type HostingImageUpdate, type HostingMailStatus, type HostingMailStatusResponse, type HostingPrice, type HostingSite, type HostingSiteStatus, type HostingSiteWithCredentials, type HostingTier, type ListHostingDomainsResponse, type ListHostingPricesResponse, type ListHostingSitesResponse, type PreviewHostingSiteParams, type PreviewHostingSiteResponse, type SetHostingPhpVersionParams, type UpdateHostingDomainParams, type UpdateHostingDomainResponse, } from "./services/hosting";
|
|
15
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
|
+
export { InvoicesService, type ExportInvoicesResponse, type GetInvoiceResponse, type Invoice, type InvoiceFilterParams, type InvoicePage, type InvoiceStatus, type ListInvoicesParams, type ListInvoicesResponse, } from "./services/invoices";
|
|
16
17
|
export { MembersService, type ListMembersResponse, type ProjectMember, type ProjectMembers } from "./services/members";
|
|
17
18
|
export type { CheckoutPreview, PlanChangePreview } from "./services/preview";
|
|
18
19
|
export { ProjectsService, type DeleteProjectResponse, type GetProjectResponse, type ListProjectsResponse, type Project, type UpdateProjectParams, type UpdateProjectResponse, } from "./services/projects";
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ __export(index_exports, {
|
|
|
46
46
|
HostingService: () => HostingService,
|
|
47
47
|
IamService: () => IamService,
|
|
48
48
|
InsufficientScopeError: () => InsufficientScopeError,
|
|
49
|
+
InvoicesService: () => InvoicesService,
|
|
49
50
|
MAX_DEPLOYMENT_BYTES: () => MAX_DEPLOYMENT_BYTES,
|
|
50
51
|
MembersService: () => MembersService,
|
|
51
52
|
NotFoundError: () => NotFoundError,
|
|
@@ -950,6 +951,49 @@ var IamService = class {
|
|
|
950
951
|
}
|
|
951
952
|
};
|
|
952
953
|
|
|
954
|
+
// src/services/invoices.ts
|
|
955
|
+
var InvoicesService = class {
|
|
956
|
+
constructor(transport, config) {
|
|
957
|
+
this.transport = transport;
|
|
958
|
+
this.config = config;
|
|
959
|
+
}
|
|
960
|
+
/** Lists one page of the project's invoices, newest first, at every stage. */
|
|
961
|
+
async list(params = {}) {
|
|
962
|
+
return this.transport.request("GET", this.basePath(params.projectId), {
|
|
963
|
+
query: { ...filterQuery(params), limit: params.limit, starting_after: params.startingAfter || void 0 }
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* Every invoice matching the filters in one response, newest first, for
|
|
968
|
+
* bookkeeping. At most 1,000: narrow the date range to reach further back.
|
|
969
|
+
* Rate-limited, unlike `list()`.
|
|
970
|
+
*/
|
|
971
|
+
async export(params = {}) {
|
|
972
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/export`, {
|
|
973
|
+
query: filterQuery(params)
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
/** Reads one invoice by the id `list()` returns. */
|
|
977
|
+
async get(invoiceId, params = {}) {
|
|
978
|
+
if (!invoiceId) throw new Error("invoiceId is required");
|
|
979
|
+
return this.transport.request(
|
|
980
|
+
"GET",
|
|
981
|
+
`${this.basePath(params.projectId)}/${encodeURIComponent(invoiceId)}`
|
|
982
|
+
);
|
|
983
|
+
}
|
|
984
|
+
/** Builds the collection route for the resolved project. */
|
|
985
|
+
basePath(projectId) {
|
|
986
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/billing/invoices`;
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
function filterQuery(params) {
|
|
990
|
+
return {
|
|
991
|
+
status: params.status,
|
|
992
|
+
created_gte: params.createdGte || void 0,
|
|
993
|
+
created_lte: params.createdLte || void 0
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
|
|
953
997
|
// src/services/members.ts
|
|
954
998
|
var MembersService = class {
|
|
955
999
|
constructor(transport, config) {
|
|
@@ -1784,7 +1828,7 @@ function sleep(ms) {
|
|
|
1784
1828
|
}
|
|
1785
1829
|
|
|
1786
1830
|
// src/version.ts
|
|
1787
|
-
var VERSION = "1.
|
|
1831
|
+
var VERSION = "1.22.1";
|
|
1788
1832
|
var USER_AGENT = `cosmoner-node/${VERSION}`;
|
|
1789
1833
|
|
|
1790
1834
|
// src/transport.ts
|
|
@@ -1914,6 +1958,7 @@ var Cosmoner = class {
|
|
|
1914
1958
|
this.email = new EmailService(this.transport, this.config);
|
|
1915
1959
|
this.hosting = new HostingService(this.transport, this.config);
|
|
1916
1960
|
this.iam = new IamService(this.transport, this.config);
|
|
1961
|
+
this.invoices = new InvoicesService(this.transport, this.config);
|
|
1917
1962
|
this.members = new MembersService(this.transport, this.config);
|
|
1918
1963
|
this.projects = new ProjectsService(this.transport);
|
|
1919
1964
|
this.catalog = new CatalogService(this.transport);
|
|
@@ -2303,6 +2348,7 @@ var index_default = Cosmoner;
|
|
|
2303
2348
|
HostingService,
|
|
2304
2349
|
IamService,
|
|
2305
2350
|
InsufficientScopeError,
|
|
2351
|
+
InvoicesService,
|
|
2306
2352
|
MAX_DEPLOYMENT_BYTES,
|
|
2307
2353
|
MembersService,
|
|
2308
2354
|
NotFoundError,
|
package/dist/index.mjs
CHANGED
|
@@ -875,6 +875,49 @@ var IamService = class {
|
|
|
875
875
|
}
|
|
876
876
|
};
|
|
877
877
|
|
|
878
|
+
// src/services/invoices.ts
|
|
879
|
+
var InvoicesService = class {
|
|
880
|
+
constructor(transport, config) {
|
|
881
|
+
this.transport = transport;
|
|
882
|
+
this.config = config;
|
|
883
|
+
}
|
|
884
|
+
/** Lists one page of the project's invoices, newest first, at every stage. */
|
|
885
|
+
async list(params = {}) {
|
|
886
|
+
return this.transport.request("GET", this.basePath(params.projectId), {
|
|
887
|
+
query: { ...filterQuery(params), limit: params.limit, starting_after: params.startingAfter || void 0 }
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Every invoice matching the filters in one response, newest first, for
|
|
892
|
+
* bookkeeping. At most 1,000: narrow the date range to reach further back.
|
|
893
|
+
* Rate-limited, unlike `list()`.
|
|
894
|
+
*/
|
|
895
|
+
async export(params = {}) {
|
|
896
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/export`, {
|
|
897
|
+
query: filterQuery(params)
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
/** Reads one invoice by the id `list()` returns. */
|
|
901
|
+
async get(invoiceId, params = {}) {
|
|
902
|
+
if (!invoiceId) throw new Error("invoiceId is required");
|
|
903
|
+
return this.transport.request(
|
|
904
|
+
"GET",
|
|
905
|
+
`${this.basePath(params.projectId)}/${encodeURIComponent(invoiceId)}`
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
/** Builds the collection route for the resolved project. */
|
|
909
|
+
basePath(projectId) {
|
|
910
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/billing/invoices`;
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
function filterQuery(params) {
|
|
914
|
+
return {
|
|
915
|
+
status: params.status,
|
|
916
|
+
created_gte: params.createdGte || void 0,
|
|
917
|
+
created_lte: params.createdLte || void 0
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
|
|
878
921
|
// src/services/members.ts
|
|
879
922
|
var MembersService = class {
|
|
880
923
|
constructor(transport, config) {
|
|
@@ -1709,7 +1752,7 @@ function sleep(ms) {
|
|
|
1709
1752
|
}
|
|
1710
1753
|
|
|
1711
1754
|
// src/version.ts
|
|
1712
|
-
var VERSION = "1.
|
|
1755
|
+
var VERSION = "1.22.1";
|
|
1713
1756
|
var USER_AGENT = `cosmoner-node/${VERSION}`;
|
|
1714
1757
|
|
|
1715
1758
|
// src/transport.ts
|
|
@@ -1839,6 +1882,7 @@ var Cosmoner = class {
|
|
|
1839
1882
|
this.email = new EmailService(this.transport, this.config);
|
|
1840
1883
|
this.hosting = new HostingService(this.transport, this.config);
|
|
1841
1884
|
this.iam = new IamService(this.transport, this.config);
|
|
1885
|
+
this.invoices = new InvoicesService(this.transport, this.config);
|
|
1842
1886
|
this.members = new MembersService(this.transport, this.config);
|
|
1843
1887
|
this.projects = new ProjectsService(this.transport);
|
|
1844
1888
|
this.catalog = new CatalogService(this.transport);
|
|
@@ -2227,6 +2271,7 @@ export {
|
|
|
2227
2271
|
HostingService,
|
|
2228
2272
|
IamService,
|
|
2229
2273
|
InsufficientScopeError,
|
|
2274
|
+
InvoicesService,
|
|
2230
2275
|
MAX_DEPLOYMENT_BYTES,
|
|
2231
2276
|
MembersService,
|
|
2232
2277
|
NotFoundError,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** Invoices service namespace — the invoices issued to a project. Read-only. */
|
|
2
|
+
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { Transport } from "../transport";
|
|
4
|
+
/** Where an invoice is in its lifecycle. */
|
|
5
|
+
export type InvoiceStatus = "draft" | "open" | "paid" | "uncollectible" | "void";
|
|
6
|
+
/** An invoice issued to the project. */
|
|
7
|
+
export interface Invoice {
|
|
8
|
+
/** Opaque id. Also the cursor for the next page of `list()`. */
|
|
9
|
+
id: string;
|
|
10
|
+
/** The number printed on the invoice. Null while it is a draft. */
|
|
11
|
+
number: string | null;
|
|
12
|
+
/** ISO 8601 date-time. */
|
|
13
|
+
created: string;
|
|
14
|
+
/** Amount due, in minor units of `currency`: `4900` is USD 49.00. */
|
|
15
|
+
amountDue: number;
|
|
16
|
+
/** Upper-case ISO 4217 code, e.g. `USD`. */
|
|
17
|
+
currency: string;
|
|
18
|
+
status: InvoiceStatus | null;
|
|
19
|
+
/** A page showing the invoice, where an open one can be paid. Null while it is a draft. */
|
|
20
|
+
hostedInvoiceUrl: string | null;
|
|
21
|
+
/** A direct download of the invoice as a PDF. Null while it is a draft. */
|
|
22
|
+
invoicePdfUrl: string | null;
|
|
23
|
+
/** Always null: the project is the one the request named. */
|
|
24
|
+
project: null;
|
|
25
|
+
}
|
|
26
|
+
/** One page of invoices, newest first. */
|
|
27
|
+
export interface InvoicePage {
|
|
28
|
+
data: Invoice[];
|
|
29
|
+
hasMore: boolean;
|
|
30
|
+
/** Pass as `startingAfter` for the next page. Null on the last page. */
|
|
31
|
+
nextCursor: string | null;
|
|
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
|
+
/** Filters shared by `list()` and `export()`. */
|
|
43
|
+
export interface InvoiceFilterParams extends ProjectScopedParams {
|
|
44
|
+
status?: InvoiceStatus;
|
|
45
|
+
/** Inclusive lower bound on the invoice date: an ISO date (`2026-01-01`) or date-time. */
|
|
46
|
+
createdGte?: string;
|
|
47
|
+
/** Inclusive upper bound on the invoice date: an ISO date or date-time. */
|
|
48
|
+
createdLte?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Arguments accepted by `client.invoices.list()`. */
|
|
51
|
+
export interface ListInvoicesParams extends InvoiceFilterParams {
|
|
52
|
+
/** Page size, 1 to 100. The API defaults to 10. */
|
|
53
|
+
limit?: number;
|
|
54
|
+
/** The previous page's `nextCursor`. */
|
|
55
|
+
startingAfter?: string;
|
|
56
|
+
}
|
|
57
|
+
export type ListInvoicesResponse = Envelope<InvoicePage>;
|
|
58
|
+
export type ExportInvoicesResponse = Envelope<Invoice[]>;
|
|
59
|
+
export type GetInvoiceResponse = Envelope<Invoice>;
|
|
60
|
+
/** A project's invoices. Needs a key with `billing:read`. */
|
|
61
|
+
export declare class InvoicesService {
|
|
62
|
+
private readonly transport;
|
|
63
|
+
private readonly config;
|
|
64
|
+
constructor(transport: Transport, config: ResolvedConfig);
|
|
65
|
+
/** Lists one page of the project's invoices, newest first, at every stage. */
|
|
66
|
+
list(params?: ListInvoicesParams): Promise<ListInvoicesResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Every invoice matching the filters in one response, newest first, for
|
|
69
|
+
* bookkeeping. At most 1,000: narrow the date range to reach further back.
|
|
70
|
+
* Rate-limited, unlike `list()`.
|
|
71
|
+
*/
|
|
72
|
+
export(params?: InvoiceFilterParams): Promise<ExportInvoicesResponse>;
|
|
73
|
+
/** Reads one invoice by the id `list()` returns. */
|
|
74
|
+
get(invoiceId: string, params?: ProjectScopedParams): Promise<GetInvoiceResponse>;
|
|
75
|
+
/** Builds the collection route for the resolved project. */
|
|
76
|
+
private basePath;
|
|
77
|
+
}
|
|
78
|
+
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.22.1";
|
|
12
|
+
export declare const USER_AGENT = "cosmoner-node/1.22.1";
|