@bosunski/laravel-cloud-sdk 0.1.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.
@@ -0,0 +1,198 @@
1
+ import { z } from 'zod';
2
+ import { createJsonApiCollectionSchema, createJsonApiResponseSchema, JsonApiResourceSchema, } from '../types/jsonApi.js';
3
+ const databaseAttributesSchema = z
4
+ .object({
5
+ name: z.string(),
6
+ type: z.string(),
7
+ status: z.string(),
8
+ region: z.string(),
9
+ created_at: z.string(),
10
+ config: z.record(z.string(), z.any()),
11
+ connection: z
12
+ .object({
13
+ hostname: z.string(),
14
+ port: z.number(),
15
+ protocol: z.string(),
16
+ driver: z.string(),
17
+ username: z.string(),
18
+ password: z.string(),
19
+ })
20
+ .passthrough(),
21
+ })
22
+ .passthrough();
23
+ const databaseResourceSchema = JsonApiResourceSchema.extend({
24
+ type: z.literal('databases'),
25
+ attributes: databaseAttributesSchema,
26
+ });
27
+ const databaseResponseSchema = createJsonApiResponseSchema(databaseResourceSchema);
28
+ const databaseCollectionSchema = createJsonApiCollectionSchema(databaseResourceSchema);
29
+ const databaseTypeFieldSchema = z
30
+ .object({
31
+ name: z.string(),
32
+ type: z.string(),
33
+ required: z.boolean(),
34
+ nullable: z.boolean().optional(),
35
+ description: z.string().optional(),
36
+ min: z.number().optional(),
37
+ max: z.number().optional(),
38
+ enum: z.array(z.string()).optional(),
39
+ example: z.string().optional(),
40
+ })
41
+ .passthrough();
42
+ const databaseTypeSchema = z
43
+ .object({
44
+ type: z.string(),
45
+ label: z.string(),
46
+ regions: z.array(z.string()),
47
+ config_schema: z.array(databaseTypeFieldSchema),
48
+ })
49
+ .passthrough();
50
+ const databaseTypesResponseSchema = z.object({
51
+ data: z.array(databaseTypeSchema),
52
+ });
53
+ const mapDatabase = (resource) => {
54
+ const parsed = databaseResourceSchema.parse(resource);
55
+ const { attributes } = parsed;
56
+ const { hostname, port, protocol, driver, username, password, ...restConnection } = attributes.connection;
57
+ return {
58
+ id: parsed.id,
59
+ name: attributes.name,
60
+ type: attributes.type,
61
+ status: attributes.status,
62
+ region: attributes.region,
63
+ createdAt: attributes.created_at,
64
+ config: attributes.config,
65
+ connection: {
66
+ hostname,
67
+ port,
68
+ protocol,
69
+ driver,
70
+ username,
71
+ password,
72
+ ...restConnection,
73
+ },
74
+ raw: parsed,
75
+ };
76
+ };
77
+ const serializeDatabaseList = (response) => ({
78
+ data: response.data.map(mapDatabase),
79
+ included: response.included,
80
+ meta: response.meta,
81
+ links: response.links,
82
+ });
83
+ const serializeDatabaseResponse = (response) => ({
84
+ data: mapDatabase(response.data),
85
+ included: response.included,
86
+ meta: response.meta,
87
+ links: response.links,
88
+ });
89
+ const createDatabaseSchema = z
90
+ .object({
91
+ type: z.string(),
92
+ name: z.string().min(3).max(40),
93
+ region: z.string(),
94
+ config: z.record(z.string(), z.any()),
95
+ clusterId: z.number().int().nullable().optional(),
96
+ })
97
+ .strict();
98
+ const mapDatabaseType = (item) => ({
99
+ type: item.type,
100
+ label: item.label,
101
+ regions: item.regions,
102
+ configSchema: item.config_schema.map((field) => ({
103
+ name: field.name,
104
+ type: field.type,
105
+ required: field.required,
106
+ nullable: field.nullable,
107
+ description: field.description,
108
+ min: field.min,
109
+ max: field.max,
110
+ enum: field.enum,
111
+ example: field.example,
112
+ raw: field,
113
+ })),
114
+ raw: item,
115
+ });
116
+ const mapCreatePayload = (payload) => {
117
+ const body = {
118
+ type: payload.type,
119
+ name: payload.name,
120
+ region: payload.region,
121
+ config: payload.config,
122
+ };
123
+ if (payload.clusterId !== undefined) {
124
+ body.cluster_id = payload.clusterId;
125
+ }
126
+ return body;
127
+ };
128
+ export class DatabasesResource {
129
+ client;
130
+ constructor(client) {
131
+ this.client = client;
132
+ }
133
+ async list(options) {
134
+ const query = {};
135
+ if (options?.include?.length) {
136
+ query.include = options.include.join(',');
137
+ }
138
+ if (options?.filter?.type) {
139
+ query['filter[type]'] = options.filter.type;
140
+ }
141
+ if (options?.filter?.region) {
142
+ query['filter[region]'] = options.filter.region;
143
+ }
144
+ if (options?.filter?.status) {
145
+ query['filter[status]'] = options.filter.status;
146
+ }
147
+ if (options?.page?.number !== undefined) {
148
+ query['page[number]'] = options.page.number;
149
+ }
150
+ if (options?.page?.size !== undefined) {
151
+ query['page[size]'] = options.page.size;
152
+ }
153
+ const response = await this.client.request({
154
+ path: '/databases',
155
+ method: 'GET',
156
+ query,
157
+ schema: databaseCollectionSchema,
158
+ });
159
+ return serializeDatabaseList(response);
160
+ }
161
+ async create(payload) {
162
+ const parsedPayload = createDatabaseSchema.parse(payload);
163
+ const response = await this.client.request({
164
+ path: '/databases',
165
+ method: 'POST',
166
+ json: mapCreatePayload(parsedPayload),
167
+ schema: databaseResponseSchema,
168
+ });
169
+ return serializeDatabaseResponse(response);
170
+ }
171
+ async retrieve(databaseId, options) {
172
+ const query = options?.include?.length
173
+ ? { include: options.include.join(',') }
174
+ : undefined;
175
+ const response = await this.client.request({
176
+ path: `/databases/${databaseId}`,
177
+ method: 'GET',
178
+ query,
179
+ schema: databaseResponseSchema,
180
+ });
181
+ return serializeDatabaseResponse(response);
182
+ }
183
+ async delete(databaseId) {
184
+ await this.client.request({
185
+ path: `/databases/${databaseId}`,
186
+ method: 'DELETE',
187
+ });
188
+ }
189
+ async listTypes() {
190
+ const response = await this.client.request({
191
+ path: '/databases/types',
192
+ method: 'GET',
193
+ accept: 'application/json',
194
+ schema: databaseTypesResponseSchema,
195
+ });
196
+ return response.data.map(mapDatabaseType);
197
+ }
198
+ }
@@ -0,0 +1,223 @@
1
+ import { z } from 'zod';
2
+ import { HttpClient } from '../http/client.js';
3
+ import { JsonApiResponse, JsonApiResource } from '../types/jsonApi.js';
4
+ export declare const deploymentResourceSchema: z.ZodObject<{
5
+ id: z.ZodString;
6
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
7
+ data: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
8
+ type: z.ZodString;
9
+ id: z.ZodString;
10
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
11
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
12
+ type: z.ZodString;
13
+ id: z.ZodString;
14
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
15
+ }, z.core.$strip>>]>>;
16
+ links: z.ZodOptional<z.ZodObject<{
17
+ related: z.ZodOptional<z.ZodObject<{
18
+ href: z.ZodOptional<z.ZodString>;
19
+ rel: z.ZodOptional<z.ZodString>;
20
+ describedby: z.ZodOptional<z.ZodString>;
21
+ title: z.ZodOptional<z.ZodString>;
22
+ type: z.ZodOptional<z.ZodString>;
23
+ hreflang: z.ZodOptional<z.ZodString>;
24
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
25
+ }, z.core.$loose>>;
26
+ self: z.ZodOptional<z.ZodObject<{
27
+ href: z.ZodOptional<z.ZodString>;
28
+ rel: z.ZodOptional<z.ZodString>;
29
+ describedby: z.ZodOptional<z.ZodString>;
30
+ title: z.ZodOptional<z.ZodString>;
31
+ type: z.ZodOptional<z.ZodString>;
32
+ hreflang: z.ZodOptional<z.ZodString>;
33
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
34
+ }, z.core.$loose>>;
35
+ }, z.core.$strip>>;
36
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
37
+ }, z.core.$loose>>>;
38
+ links: z.ZodOptional<z.ZodObject<{
39
+ self: z.ZodOptional<z.ZodObject<{
40
+ href: z.ZodOptional<z.ZodString>;
41
+ rel: z.ZodOptional<z.ZodString>;
42
+ describedby: z.ZodOptional<z.ZodString>;
43
+ title: z.ZodOptional<z.ZodString>;
44
+ type: z.ZodOptional<z.ZodString>;
45
+ hreflang: z.ZodOptional<z.ZodString>;
46
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
47
+ }, z.core.$loose>>;
48
+ }, z.core.$strip>>;
49
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
50
+ type: z.ZodLiteral<"deployments">;
51
+ attributes: z.ZodObject<{
52
+ status: z.ZodString;
53
+ branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ commit_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
+ commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
+ failure_reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
58
+ php_major_version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
+ build_command: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
+ node_version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
+ uses_octane: z.ZodOptional<z.ZodBoolean>;
62
+ uses_hibernation: z.ZodOptional<z.ZodBoolean>;
63
+ started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
+ finished_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ }, z.core.$loose>;
66
+ }, z.core.$loose>;
67
+ export declare const deploymentResponseSchema: z.ZodObject<{
68
+ data: z.ZodObject<{
69
+ id: z.ZodString;
70
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
71
+ data: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
72
+ type: z.ZodString;
73
+ id: z.ZodString;
74
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
75
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
76
+ type: z.ZodString;
77
+ id: z.ZodString;
78
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
79
+ }, z.core.$strip>>]>>;
80
+ links: z.ZodOptional<z.ZodObject<{
81
+ related: z.ZodOptional<z.ZodObject<{
82
+ href: z.ZodOptional<z.ZodString>;
83
+ rel: z.ZodOptional<z.ZodString>;
84
+ describedby: z.ZodOptional<z.ZodString>;
85
+ title: z.ZodOptional<z.ZodString>;
86
+ type: z.ZodOptional<z.ZodString>;
87
+ hreflang: z.ZodOptional<z.ZodString>;
88
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
89
+ }, z.core.$loose>>;
90
+ self: z.ZodOptional<z.ZodObject<{
91
+ href: z.ZodOptional<z.ZodString>;
92
+ rel: z.ZodOptional<z.ZodString>;
93
+ describedby: z.ZodOptional<z.ZodString>;
94
+ title: z.ZodOptional<z.ZodString>;
95
+ type: z.ZodOptional<z.ZodString>;
96
+ hreflang: z.ZodOptional<z.ZodString>;
97
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
98
+ }, z.core.$loose>>;
99
+ }, z.core.$strip>>;
100
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
101
+ }, z.core.$loose>>>;
102
+ links: z.ZodOptional<z.ZodObject<{
103
+ self: z.ZodOptional<z.ZodObject<{
104
+ href: z.ZodOptional<z.ZodString>;
105
+ rel: z.ZodOptional<z.ZodString>;
106
+ describedby: z.ZodOptional<z.ZodString>;
107
+ title: z.ZodOptional<z.ZodString>;
108
+ type: z.ZodOptional<z.ZodString>;
109
+ hreflang: z.ZodOptional<z.ZodString>;
110
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
111
+ }, z.core.$loose>>;
112
+ }, z.core.$strip>>;
113
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
114
+ type: z.ZodLiteral<"deployments">;
115
+ attributes: z.ZodObject<{
116
+ status: z.ZodString;
117
+ branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
118
+ commit_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
119
+ commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
120
+ commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
121
+ failure_reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
122
+ php_major_version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
+ build_command: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
+ node_version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
+ uses_octane: z.ZodOptional<z.ZodBoolean>;
126
+ uses_hibernation: z.ZodOptional<z.ZodBoolean>;
127
+ started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
128
+ finished_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
129
+ }, z.core.$loose>;
130
+ }, z.core.$loose>;
131
+ included: z.ZodOptional<z.ZodArray<z.ZodObject<{
132
+ id: z.ZodString;
133
+ type: z.ZodString;
134
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
135
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
136
+ data: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
137
+ type: z.ZodString;
138
+ id: z.ZodString;
139
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
140
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
141
+ type: z.ZodString;
142
+ id: z.ZodString;
143
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
144
+ }, z.core.$strip>>]>>;
145
+ links: z.ZodOptional<z.ZodObject<{
146
+ related: z.ZodOptional<z.ZodObject<{
147
+ href: z.ZodOptional<z.ZodString>;
148
+ rel: z.ZodOptional<z.ZodString>;
149
+ describedby: z.ZodOptional<z.ZodString>;
150
+ title: z.ZodOptional<z.ZodString>;
151
+ type: z.ZodOptional<z.ZodString>;
152
+ hreflang: z.ZodOptional<z.ZodString>;
153
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
154
+ }, z.core.$loose>>;
155
+ self: z.ZodOptional<z.ZodObject<{
156
+ href: z.ZodOptional<z.ZodString>;
157
+ rel: z.ZodOptional<z.ZodString>;
158
+ describedby: z.ZodOptional<z.ZodString>;
159
+ title: z.ZodOptional<z.ZodString>;
160
+ type: z.ZodOptional<z.ZodString>;
161
+ hreflang: z.ZodOptional<z.ZodString>;
162
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
163
+ }, z.core.$loose>>;
164
+ }, z.core.$strip>>;
165
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
166
+ }, z.core.$loose>>>;
167
+ links: z.ZodOptional<z.ZodObject<{
168
+ self: z.ZodOptional<z.ZodObject<{
169
+ href: z.ZodOptional<z.ZodString>;
170
+ rel: z.ZodOptional<z.ZodString>;
171
+ describedby: z.ZodOptional<z.ZodString>;
172
+ title: z.ZodOptional<z.ZodString>;
173
+ type: z.ZodOptional<z.ZodString>;
174
+ hreflang: z.ZodOptional<z.ZodString>;
175
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
176
+ }, z.core.$loose>>;
177
+ }, z.core.$strip>>;
178
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
179
+ }, z.core.$loose>>>;
180
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
181
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
182
+ }, z.core.$strip>;
183
+ export interface Deployment {
184
+ id: string;
185
+ status: string;
186
+ branchName?: string | null;
187
+ commitHash?: string | null;
188
+ commitMessage?: string | null;
189
+ commitAuthor?: string | null;
190
+ failureReason?: string | null;
191
+ phpMajorVersion?: string | null;
192
+ buildCommand?: string | null;
193
+ nodeVersion?: string | null;
194
+ usesOctane?: boolean;
195
+ usesHibernation?: boolean;
196
+ startedAt?: string | null;
197
+ finishedAt?: string | null;
198
+ raw: JsonApiResource;
199
+ }
200
+ export interface ListDeploymentsOptions {
201
+ include?: Array<'environment' | 'initiator'>;
202
+ filter?: {
203
+ status?: string;
204
+ branchName?: string;
205
+ commitHash?: string;
206
+ };
207
+ page?: {
208
+ number?: number;
209
+ size?: number;
210
+ };
211
+ }
212
+ export interface DeploymentListResponse extends JsonApiResponse<Deployment[]> {
213
+ }
214
+ export interface DeploymentResponse extends JsonApiResponse<Deployment> {
215
+ }
216
+ export declare const serializeDeploymentResponse: (response: z.infer<typeof deploymentResponseSchema>) => DeploymentResponse;
217
+ export declare class DeploymentsResource {
218
+ private readonly client;
219
+ constructor(client: HttpClient);
220
+ list(environmentId: string, options?: ListDeploymentsOptions): Promise<DeploymentListResponse>;
221
+ retrieve(deploymentId: string, options?: Pick<ListDeploymentsOptions, 'include'>): Promise<DeploymentResponse>;
222
+ initiate(environmentId: string): Promise<DeploymentResponse>;
223
+ }
@@ -0,0 +1,112 @@
1
+ import { z } from 'zod';
2
+ import { createJsonApiCollectionSchema, createJsonApiResponseSchema, JsonApiResourceSchema, } from '../types/jsonApi.js';
3
+ const deploymentAttributesSchema = z
4
+ .object({
5
+ status: z.string(),
6
+ branch_name: z.string().nullable().optional(),
7
+ commit_hash: z.string().nullable().optional(),
8
+ commit_message: z.string().nullable().optional(),
9
+ commit_author: z.string().nullable().optional(),
10
+ failure_reason: z.string().nullable().optional(),
11
+ php_major_version: z.string().nullable().optional(),
12
+ build_command: z.string().nullable().optional(),
13
+ node_version: z.string().nullable().optional(),
14
+ uses_octane: z.boolean().optional(),
15
+ uses_hibernation: z.boolean().optional(),
16
+ started_at: z.string().nullable().optional(),
17
+ finished_at: z.string().nullable().optional(),
18
+ })
19
+ .passthrough();
20
+ export const deploymentResourceSchema = JsonApiResourceSchema.extend({
21
+ type: z.literal('deployments'),
22
+ attributes: deploymentAttributesSchema,
23
+ });
24
+ export const deploymentResponseSchema = createJsonApiResponseSchema(deploymentResourceSchema);
25
+ const deploymentCollectionSchema = createJsonApiCollectionSchema(deploymentResourceSchema);
26
+ const mapDeployment = (resource) => {
27
+ const parsed = deploymentResourceSchema.parse(resource);
28
+ const { attributes } = parsed;
29
+ return {
30
+ id: parsed.id,
31
+ status: attributes.status,
32
+ branchName: attributes.branch_name ?? null,
33
+ commitHash: attributes.commit_hash ?? null,
34
+ commitMessage: attributes.commit_message ?? null,
35
+ commitAuthor: attributes.commit_author ?? null,
36
+ failureReason: attributes.failure_reason ?? null,
37
+ phpMajorVersion: attributes.php_major_version ?? null,
38
+ buildCommand: attributes.build_command ?? null,
39
+ nodeVersion: attributes.node_version ?? null,
40
+ usesOctane: attributes.uses_octane,
41
+ usesHibernation: attributes.uses_hibernation,
42
+ startedAt: attributes.started_at ?? null,
43
+ finishedAt: attributes.finished_at ?? null,
44
+ raw: parsed,
45
+ };
46
+ };
47
+ const serializeDeploymentList = (response) => ({
48
+ data: response.data.map(mapDeployment),
49
+ included: response.included,
50
+ meta: response.meta,
51
+ links: response.links,
52
+ });
53
+ export const serializeDeploymentResponse = (response) => ({
54
+ data: mapDeployment(response.data),
55
+ included: response.included,
56
+ meta: response.meta,
57
+ links: response.links,
58
+ });
59
+ export class DeploymentsResource {
60
+ client;
61
+ constructor(client) {
62
+ this.client = client;
63
+ }
64
+ async list(environmentId, options) {
65
+ const query = {};
66
+ if (options?.include?.length) {
67
+ query.include = options.include.join(',');
68
+ }
69
+ if (options?.filter?.status) {
70
+ query['filter[status]'] = options.filter.status;
71
+ }
72
+ if (options?.filter?.branchName) {
73
+ query['filter[branch_name]'] = options.filter.branchName;
74
+ }
75
+ if (options?.filter?.commitHash) {
76
+ query['filter[commit_hash]'] = options.filter.commitHash;
77
+ }
78
+ if (options?.page?.number !== undefined) {
79
+ query['page[number]'] = options.page.number;
80
+ }
81
+ if (options?.page?.size !== undefined) {
82
+ query['page[size]'] = options.page.size;
83
+ }
84
+ const response = await this.client.request({
85
+ path: `/environments/${environmentId}/deployments`,
86
+ method: 'GET',
87
+ query,
88
+ schema: deploymentCollectionSchema,
89
+ });
90
+ return serializeDeploymentList(response);
91
+ }
92
+ async retrieve(deploymentId, options) {
93
+ const query = options?.include?.length
94
+ ? { include: options.include.join(',') }
95
+ : undefined;
96
+ const response = await this.client.request({
97
+ path: `/deployments/${deploymentId}`,
98
+ method: 'GET',
99
+ query,
100
+ schema: deploymentResponseSchema,
101
+ });
102
+ return serializeDeploymentResponse(response);
103
+ }
104
+ async initiate(environmentId) {
105
+ const response = await this.client.request({
106
+ path: `/environments/${environmentId}/deployments`,
107
+ method: 'POST',
108
+ schema: deploymentResponseSchema,
109
+ });
110
+ return serializeDeploymentResponse(response);
111
+ }
112
+ }
@@ -0,0 +1,66 @@
1
+ import { z } from 'zod';
2
+ import { HttpClient } from '../http/client.js';
3
+ import { JsonApiResponse, JsonApiResource } from '../types/jsonApi.js';
4
+ declare const domainVerificationMethodSchema: z.ZodEnum<{
5
+ pre_verification: "pre_verification";
6
+ real_time: "real_time";
7
+ }>;
8
+ declare const domainRedirectSchema: z.ZodEnum<{
9
+ root_to_www: "root_to_www";
10
+ www_to_root: "www_to_root";
11
+ }>;
12
+ export interface Domain {
13
+ id: string;
14
+ name: string;
15
+ type: string;
16
+ hostnameStatus: string;
17
+ sslStatus: string;
18
+ originStatus: string;
19
+ redirect?: string | null;
20
+ lastVerifiedAt?: string | null;
21
+ createdAt: string;
22
+ dnsRecords?: Record<string, unknown>;
23
+ wildcard?: Record<string, unknown>;
24
+ www?: Record<string, unknown>;
25
+ raw: JsonApiResource;
26
+ }
27
+ export interface ListDomainsOptions {
28
+ include?: Array<'environment'>;
29
+ filter?: {
30
+ name?: string;
31
+ hostnameStatus?: string;
32
+ sslStatus?: string;
33
+ originStatus?: string;
34
+ };
35
+ page?: {
36
+ number?: number;
37
+ size?: number;
38
+ };
39
+ }
40
+ export interface CreateDomainPayload {
41
+ name: string;
42
+ wwwRedirect?: z.infer<typeof domainRedirectSchema> | null;
43
+ wildcardEnabled?: boolean;
44
+ verificationMethod?: z.infer<typeof domainVerificationMethodSchema>;
45
+ }
46
+ export interface UpdateDomainPayload {
47
+ verificationMethod?: z.infer<typeof domainVerificationMethodSchema>;
48
+ }
49
+ export interface DomainListResponse extends JsonApiResponse<Domain[]> {
50
+ }
51
+ export interface DomainResponse extends JsonApiResponse<Domain> {
52
+ }
53
+ export declare class DomainsResource {
54
+ private readonly client;
55
+ constructor(client: HttpClient);
56
+ list(environmentId: string, options?: ListDomainsOptions): Promise<DomainListResponse>;
57
+ create(environmentId: string, payload: CreateDomainPayload): Promise<DomainResponse>;
58
+ retrieve(domainId: string, options?: {
59
+ include?: Array<'environment'>;
60
+ verify?: boolean;
61
+ }): Promise<DomainResponse>;
62
+ update(domainId: string, payload: UpdateDomainPayload): Promise<DomainResponse>;
63
+ verify(domainId: string): Promise<DomainResponse>;
64
+ delete(domainId: string): Promise<void>;
65
+ }
66
+ export {};