@phpsandbox/sdk 0.0.56 → 0.0.58
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 +12 -7
- package/dist/browser/phpsandbox-sdk.esm.js +15566 -535
- package/dist/browser/phpsandbox-sdk.esm.min.js +70 -3
- package/dist/browser/phpsandbox-sdk.iife.js +15566 -535
- package/dist/browser/phpsandbox-sdk.iife.min.js +70 -3
- package/dist/deployments.d.ts +167 -107
- package/dist/deployments.js +283 -23
- package/dist/git.d.ts +32 -2
- package/dist/git.js +12 -3
- package/dist/index.d.ts +28 -9
- package/dist/index.js +42 -12
- package/dist/schemas/deployments.d.ts +417 -0
- package/dist/schemas/deployments.js +133 -0
- package/dist/servers.d.ts +42 -0
- package/dist/servers.js +48 -0
- package/docs/api-summary.md +1 -1
- package/examples/README.md +28 -0
- package/examples/deploy-cloudflare-container.ts +49 -0
- package/examples/deploy-laravel-cloud.ts +106 -0
- package/examples/deploy-ssh-agent.ts +211 -0
- package/examples/get.ts +1 -0
- package/package.json +4 -3
package/dist/deployments.d.ts
CHANGED
|
@@ -1,138 +1,175 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export type DeploymentRuntimeProvider = 'docker' | 'compose' | 'cloudflare-container';
|
|
5
|
-
export type DeploymentStatus = 'pending' | 'queued' | 'building' | 'deploying' | 'healthy' | 'failed' | 'stopped' | 'deleting' | 'deleted' | 'delete_failed';
|
|
6
|
-
export type DeploymentSize = 'nano' | 'small' | 'medium' | 'large' | 'lite' | 'basic' | 'standard-1' | 'standard-2';
|
|
1
|
+
import { type Client, type SecretRef } from './index.js';
|
|
2
|
+
import type { DeploymentBuildStatus, DeploymentDomainDnsRecordType, DeploymentEventData, DeploymentJurisdiction, DeploymentLogChunkData, DeploymentProtectionMode, DeploymentRegion, DeploymentReleaseStatus, DeploymentSize, DeploymentStatus, DeploymentTargetProvider, DeployStreamEvent, DeployStreamResult } from './schemas/deployments.js';
|
|
3
|
+
export * from './schemas/deployments.js';
|
|
7
4
|
export interface DeploymentPlacement {
|
|
8
|
-
regions?:
|
|
9
|
-
jurisdiction?:
|
|
10
|
-
}
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
regions?: DeploymentRegion[];
|
|
6
|
+
jurisdiction?: DeploymentJurisdiction;
|
|
7
|
+
}
|
|
8
|
+
export type LaravelCloudRegion = 'us-east-2' | 'us-east-1' | 'ca-central-1' | 'eu-central-1' | 'eu-west-1' | 'eu-west-2' | 'me-central-1' | 'ap-southeast-1' | 'ap-southeast-2' | 'ap-northeast-1';
|
|
9
|
+
export interface DeploymentProtectionData {
|
|
10
|
+
mode: DeploymentProtectionMode;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
token?: string;
|
|
13
|
+
expiresAt?: string;
|
|
14
|
+
url?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DeploymentFeedbackData {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
config: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export type DeploymentProtectionInput = {
|
|
21
|
+
mode: 'none';
|
|
22
|
+
password?: never;
|
|
23
|
+
} | {
|
|
24
|
+
mode: 'password';
|
|
25
|
+
password: string;
|
|
26
|
+
};
|
|
27
|
+
export interface DeploymentFeedbackInput {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
config?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
export interface OkraCloudflareContainerBuildOptions {
|
|
17
32
|
size?: DeploymentSize;
|
|
18
|
-
|
|
33
|
+
sleepAfter?: string;
|
|
19
34
|
placement?: DeploymentPlacement;
|
|
20
35
|
instances?: number;
|
|
21
|
-
source_ref?: string;
|
|
22
|
-
password?: string;
|
|
23
|
-
feedback_enabled?: boolean;
|
|
24
|
-
metadata?: Record<string, unknown>;
|
|
25
36
|
}
|
|
37
|
+
export interface OkraCloudflareContainerDeploymentOptions extends OkraCloudflareContainerBuildOptions {
|
|
38
|
+
protection: DeploymentProtectionData;
|
|
39
|
+
feedback: DeploymentFeedbackData;
|
|
40
|
+
}
|
|
41
|
+
export interface OkraCloudflareContainerPublishOptions extends OkraCloudflareContainerBuildOptions {
|
|
42
|
+
protection?: DeploymentProtectionInput;
|
|
43
|
+
feedback?: DeploymentFeedbackInput;
|
|
44
|
+
}
|
|
45
|
+
export interface OkraSshAgentBuildOptions {
|
|
46
|
+
serverId: string;
|
|
47
|
+
}
|
|
48
|
+
export interface OkraSshAgentDeploymentOptions extends OkraSshAgentBuildOptions {
|
|
49
|
+
protection: DeploymentProtectionData;
|
|
50
|
+
feedback: DeploymentFeedbackData;
|
|
51
|
+
}
|
|
52
|
+
export interface OkraSshAgentPublishOptions extends OkraSshAgentBuildOptions {
|
|
53
|
+
protection?: DeploymentProtectionInput;
|
|
54
|
+
feedback?: DeploymentFeedbackInput;
|
|
55
|
+
}
|
|
56
|
+
export interface OkraLaravelCloudBuildOptions {
|
|
57
|
+
region?: LaravelCloudRegion;
|
|
58
|
+
repository?: string;
|
|
59
|
+
branch?: string;
|
|
60
|
+
sourceControlProviderType?: 'github' | 'gitlab' | 'bitbucket';
|
|
61
|
+
apiKeyConfigured?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface OkraLaravelCloudDeploymentOptions extends OkraLaravelCloudBuildOptions {
|
|
64
|
+
protection: DeploymentProtectionData;
|
|
65
|
+
feedback: DeploymentFeedbackData;
|
|
66
|
+
}
|
|
67
|
+
export interface OkraLaravelCloudPublishOptions {
|
|
68
|
+
apiKey: SecretRef;
|
|
69
|
+
region?: LaravelCloudRegion;
|
|
70
|
+
protection?: DeploymentProtectionInput;
|
|
71
|
+
feedback?: DeploymentFeedbackInput;
|
|
72
|
+
}
|
|
73
|
+
export interface DeploymentProviderOptions {
|
|
74
|
+
okraCloudflareContainer: OkraCloudflareContainerDeploymentOptions;
|
|
75
|
+
okraSshAgent: OkraSshAgentDeploymentOptions;
|
|
76
|
+
okraLaravelCloud: OkraLaravelCloudDeploymentOptions;
|
|
77
|
+
}
|
|
78
|
+
export interface DeploymentProviderBuildOptions {
|
|
79
|
+
okraCloudflareContainer: OkraCloudflareContainerBuildOptions;
|
|
80
|
+
okraSshAgent: OkraSshAgentBuildOptions;
|
|
81
|
+
okraLaravelCloud: OkraLaravelCloudBuildOptions;
|
|
82
|
+
}
|
|
83
|
+
export type DeploymentOptionsForProvider<TProvider extends DeploymentTargetProvider> = DeploymentProviderOptions[TProvider];
|
|
84
|
+
export type DeploymentBuildOptionsForProvider<TProvider extends DeploymentTargetProvider> = DeploymentProviderBuildOptions[TProvider];
|
|
85
|
+
export interface OkraCloudflareContainerPublishInput {
|
|
86
|
+
targetProvider: 'okraCloudflareContainer';
|
|
87
|
+
options?: OkraCloudflareContainerPublishOptions;
|
|
88
|
+
}
|
|
89
|
+
export interface OkraSshAgentPublishInput {
|
|
90
|
+
targetProvider: 'okraSshAgent';
|
|
91
|
+
options: OkraSshAgentPublishOptions;
|
|
92
|
+
}
|
|
93
|
+
export interface OkraLaravelCloudPublishInput {
|
|
94
|
+
targetProvider: 'okraLaravelCloud';
|
|
95
|
+
options: OkraLaravelCloudPublishOptions;
|
|
96
|
+
}
|
|
97
|
+
export type ProviderPublishInput = OkraCloudflareContainerPublishInput | OkraSshAgentPublishInput | OkraLaravelCloudPublishInput;
|
|
98
|
+
export type FirstPublishInput = ProviderPublishInput & {
|
|
99
|
+
slug: string;
|
|
100
|
+
};
|
|
101
|
+
export type PublishInput = FirstPublishInput;
|
|
26
102
|
export interface DeploymentSlugAvailabilityData {
|
|
27
103
|
slug: string;
|
|
28
104
|
available: boolean;
|
|
29
105
|
domain: string;
|
|
30
106
|
}
|
|
31
|
-
export interface DeploymentBuildData {
|
|
107
|
+
export interface DeploymentBuildData<TProvider extends DeploymentTargetProvider = DeploymentTargetProvider> {
|
|
32
108
|
id: string;
|
|
33
|
-
status:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
artifact_checksum: string | null;
|
|
41
|
-
error_message: string | null;
|
|
42
|
-
started_at: string | null;
|
|
43
|
-
finished_at: string | null;
|
|
109
|
+
status: DeploymentBuildStatus;
|
|
110
|
+
strategy: string;
|
|
111
|
+
targetProvider: TProvider;
|
|
112
|
+
options: DeploymentBuildOptionsForProvider<TProvider>;
|
|
113
|
+
errorMessage: string | null;
|
|
114
|
+
startedAt: string | null;
|
|
115
|
+
finishedAt: string | null;
|
|
44
116
|
}
|
|
45
117
|
export interface DeploymentReleaseData {
|
|
46
118
|
id: string;
|
|
47
|
-
status:
|
|
48
|
-
artifact_path: string;
|
|
49
|
-
artifact_checksum: string;
|
|
119
|
+
status: DeploymentReleaseStatus;
|
|
50
120
|
manifest: Record<string, unknown>;
|
|
51
121
|
}
|
|
52
122
|
export interface DeploymentDomainDnsData {
|
|
53
|
-
type:
|
|
123
|
+
type: DeploymentDomainDnsRecordType;
|
|
54
124
|
name: string;
|
|
55
125
|
value: string;
|
|
56
126
|
}
|
|
57
127
|
export interface DeploymentDomainData {
|
|
58
128
|
id: string;
|
|
59
|
-
|
|
129
|
+
deploymentId: string | null;
|
|
60
130
|
hostname: string;
|
|
61
131
|
status: string;
|
|
62
132
|
provider: string;
|
|
63
|
-
|
|
133
|
+
providerHostnameId: string | null;
|
|
64
134
|
dns: DeploymentDomainDnsData;
|
|
65
135
|
ssl: {
|
|
66
136
|
status: string | null;
|
|
67
137
|
};
|
|
68
|
-
|
|
69
|
-
|
|
138
|
+
validationErrors: unknown[];
|
|
139
|
+
validationRecords: unknown[];
|
|
70
140
|
metadata: Record<string, unknown>;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
141
|
+
verifiedAt: string | null;
|
|
142
|
+
createdAt: string | null;
|
|
143
|
+
updatedAt: string | null;
|
|
74
144
|
}
|
|
75
145
|
export interface CreateDeploymentDomainInput {
|
|
76
146
|
hostname: string;
|
|
77
147
|
}
|
|
78
|
-
export interface DeploymentData {
|
|
148
|
+
export interface DeploymentData<TProvider extends DeploymentTargetProvider = DeploymentTargetProvider> {
|
|
79
149
|
id: string;
|
|
80
|
-
notebook_id: string;
|
|
81
|
-
name: string;
|
|
82
150
|
slug: string;
|
|
83
151
|
url: string;
|
|
84
|
-
status: DeploymentStatus
|
|
85
|
-
strategy:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
instances: number;
|
|
92
|
-
origin_url: string | null;
|
|
93
|
-
protection: {
|
|
94
|
-
mode: 'none' | 'password' | string;
|
|
95
|
-
enabled: boolean;
|
|
96
|
-
};
|
|
97
|
-
feedback: {
|
|
98
|
-
enabled: boolean;
|
|
99
|
-
config: Record<string, unknown>;
|
|
100
|
-
};
|
|
101
|
-
current_release?: DeploymentReleaseData | null;
|
|
152
|
+
status: DeploymentStatus;
|
|
153
|
+
strategy: string;
|
|
154
|
+
targetProvider: TProvider;
|
|
155
|
+
options: DeploymentOptionsForProvider<TProvider>;
|
|
156
|
+
okraUrl: string | null;
|
|
157
|
+
originUrl: string | null;
|
|
158
|
+
currentRelease?: DeploymentReleaseData | null;
|
|
102
159
|
domains?: DeploymentDomainData[];
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
export interface DeploymentEventData {
|
|
109
|
-
id?: number | string;
|
|
110
|
-
sequence: number;
|
|
111
|
-
type: string;
|
|
112
|
-
payload: Record<string, unknown>;
|
|
113
|
-
created_at: string | null;
|
|
114
|
-
}
|
|
115
|
-
export interface DeploymentLogChunkData {
|
|
116
|
-
sequence: number;
|
|
117
|
-
stream: 'build' | 'runtime' | string;
|
|
118
|
-
content: string;
|
|
119
|
-
created_at: string | null;
|
|
160
|
+
latestBuild?: DeploymentBuildData<TProvider> | null;
|
|
161
|
+
deployedAt: string | null;
|
|
162
|
+
createdAt: string | null;
|
|
163
|
+
updatedAt: string | null;
|
|
120
164
|
}
|
|
121
165
|
export interface UpdateDeploymentProtectionInput {
|
|
122
|
-
mode:
|
|
166
|
+
mode: DeploymentProtectionMode;
|
|
123
167
|
password?: string;
|
|
124
168
|
}
|
|
125
|
-
export interface DeploymentProtectionData {
|
|
126
|
-
mode: 'none' | 'password' | string;
|
|
127
|
-
enabled: boolean;
|
|
128
|
-
token?: string;
|
|
129
|
-
expires_at?: string;
|
|
130
|
-
url?: string;
|
|
131
|
-
}
|
|
132
169
|
export interface DeploymentProtectionSessionData {
|
|
133
|
-
|
|
170
|
+
previewSessionId: string;
|
|
134
171
|
token: string;
|
|
135
|
-
|
|
172
|
+
expiresAt: string;
|
|
136
173
|
url: string;
|
|
137
174
|
}
|
|
138
175
|
export interface UpdateDeploymentFeedbackInput {
|
|
@@ -142,21 +179,20 @@ export interface UpdateDeploymentFeedbackInput {
|
|
|
142
179
|
export declare class NotebookDeploymentApi {
|
|
143
180
|
private readonly client;
|
|
144
181
|
constructor(client: Client);
|
|
145
|
-
|
|
146
|
-
|
|
182
|
+
current<TProvider extends DeploymentTargetProvider = DeploymentTargetProvider>(notebookId: string): Promise<DeploymentInstance<TProvider> | null>;
|
|
183
|
+
publish<TProvider extends DeploymentTargetProvider = DeploymentTargetProvider>(notebookId: string, input?: PublishInput): Promise<DeploymentRun<TProvider>>;
|
|
147
184
|
slugAvailability(id: string, slug: string): Promise<DeploymentSlugAvailabilityData>;
|
|
148
185
|
}
|
|
149
186
|
export declare class DeploymentApi {
|
|
150
187
|
private readonly client;
|
|
151
188
|
constructor(client: Client);
|
|
152
|
-
get(id: string): Promise<DeploymentInstance
|
|
153
|
-
redeploy(id: string, input?: DeployInput): Promise<DeploymentInstance>;
|
|
189
|
+
get<TProvider extends DeploymentTargetProvider = DeploymentTargetProvider>(id: string): Promise<DeploymentInstance<TProvider>>;
|
|
154
190
|
delete(id: string): Promise<void>;
|
|
155
|
-
setProtection(id: string, input: UpdateDeploymentProtectionInput): Promise<DeploymentInstance
|
|
191
|
+
setProtection<TProvider extends DeploymentTargetProvider = DeploymentTargetProvider>(id: string, input: UpdateDeploymentProtectionInput): Promise<DeploymentInstance<TProvider>>;
|
|
156
192
|
protection(id: string): Promise<DeploymentProtectionData>;
|
|
157
193
|
createProtectionSession(id: string): Promise<DeploymentProtectionSessionData>;
|
|
158
|
-
disableProtection(id: string): Promise<DeploymentInstance
|
|
159
|
-
setFeedback(id: string, input: UpdateDeploymentFeedbackInput): Promise<DeploymentInstance
|
|
194
|
+
disableProtection<TProvider extends DeploymentTargetProvider = DeploymentTargetProvider>(id: string): Promise<DeploymentInstance<TProvider>>;
|
|
195
|
+
setFeedback<TProvider extends DeploymentTargetProvider = DeploymentTargetProvider>(id: string, input: UpdateDeploymentFeedbackInput): Promise<DeploymentInstance<TProvider>>;
|
|
160
196
|
listDomains(id: string): Promise<DeploymentDomainData[]>;
|
|
161
197
|
createDomain(id: string, input: CreateDeploymentDomainInput): Promise<DeploymentDomainData>;
|
|
162
198
|
refreshDomain(id: string, domainId: string): Promise<DeploymentDomainData>;
|
|
@@ -165,25 +201,49 @@ export declare class DeploymentApi {
|
|
|
165
201
|
buildLogs(id: string, buildId: string): Promise<ReadableStream<DeploymentLogChunkData>>;
|
|
166
202
|
logs(id: string): Promise<ReadableStream<DeploymentLogChunkData>>;
|
|
167
203
|
}
|
|
168
|
-
export declare class
|
|
169
|
-
readonly
|
|
204
|
+
export declare class DeploymentRun<TProvider extends DeploymentTargetProvider = DeploymentTargetProvider> {
|
|
205
|
+
readonly initial: DeploymentInstance<TProvider>;
|
|
206
|
+
private readonly client;
|
|
207
|
+
private started;
|
|
208
|
+
private completed;
|
|
209
|
+
private finalError;
|
|
210
|
+
private finalResult;
|
|
211
|
+
private resultPromise;
|
|
212
|
+
private resolveResult;
|
|
213
|
+
private rejectResult;
|
|
214
|
+
private readonly bufferedEvents;
|
|
215
|
+
private readonly subscribers;
|
|
216
|
+
constructor(initial: DeploymentInstance<TProvider>, client: Client);
|
|
217
|
+
events(): AsyncIterable<DeployStreamEvent>;
|
|
218
|
+
result(): Promise<DeployStreamResult>;
|
|
219
|
+
deployment(): Promise<DeploymentInstance<TProvider>>;
|
|
220
|
+
start(): this;
|
|
221
|
+
private subscribe;
|
|
222
|
+
private consumeStream;
|
|
223
|
+
private publish;
|
|
224
|
+
private closeSubscribers;
|
|
225
|
+
private fail;
|
|
226
|
+
}
|
|
227
|
+
export declare class DeploymentInstance<TProvider extends DeploymentTargetProvider = DeploymentTargetProvider> {
|
|
228
|
+
readonly data: DeploymentData<TProvider>;
|
|
170
229
|
private readonly client;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
230
|
+
private readonly notebookId?;
|
|
231
|
+
constructor(data: DeploymentData<TProvider>, client: Client, notebookId?: string);
|
|
232
|
+
refresh(): Promise<DeploymentInstance<TProvider>>;
|
|
233
|
+
publish(): Promise<DeploymentRun<TProvider>>;
|
|
174
234
|
delete(): Promise<void>;
|
|
175
235
|
wait(options?: {
|
|
176
236
|
intervalMs?: number;
|
|
177
237
|
timeoutMs?: number;
|
|
178
|
-
}): Promise<DeploymentInstance
|
|
238
|
+
}): Promise<DeploymentInstance<TProvider>>;
|
|
179
239
|
events(): Promise<ReadableStream<DeploymentEventData>>;
|
|
180
240
|
buildLogs(buildId?: string): Promise<ReadableStream<DeploymentLogChunkData>>;
|
|
181
241
|
logs(): Promise<ReadableStream<DeploymentLogChunkData>>;
|
|
182
|
-
setProtection(input: UpdateDeploymentProtectionInput): Promise<DeploymentInstance
|
|
242
|
+
setProtection(input: UpdateDeploymentProtectionInput): Promise<DeploymentInstance<TProvider>>;
|
|
183
243
|
protection(): Promise<DeploymentProtectionData>;
|
|
184
244
|
createProtectionSession(): Promise<DeploymentProtectionSessionData>;
|
|
185
|
-
disableProtection(): Promise<DeploymentInstance
|
|
186
|
-
setFeedback(input: UpdateDeploymentFeedbackInput): Promise<DeploymentInstance
|
|
245
|
+
disableProtection(): Promise<DeploymentInstance<TProvider>>;
|
|
246
|
+
setFeedback(input: UpdateDeploymentFeedbackInput): Promise<DeploymentInstance<TProvider>>;
|
|
187
247
|
domains(): Promise<DeploymentDomainData[]>;
|
|
188
248
|
addDomain(input: CreateDeploymentDomainInput): Promise<DeploymentDomainData>;
|
|
189
249
|
refreshDomain(domainId: string): Promise<DeploymentDomainData>;
|