@phpsandbox/sdk 0.0.67 → 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.
- package/README.md +10 -13
- package/dist/auth.d.ts +0 -1
- package/dist/auth.js +0 -3
- package/dist/beacon/index.d.ts +2 -0
- package/dist/beacon/index.js +5 -0
- package/dist/browser/phpsandbox-sdk.esm.js +311 -1016
- package/dist/browser/phpsandbox-sdk.esm.min.js +24 -24
- package/dist/browser/phpsandbox-sdk.iife.js +311 -1016
- package/dist/browser/phpsandbox-sdk.iife.min.js +24 -24
- package/dist/filesystem.d.ts +2 -1
- package/dist/filesystem.js +35 -2
- package/dist/index.d.ts +15 -24
- package/dist/index.js +19 -28
- package/dist/publications.d.ts +222 -0
- package/dist/{deployments.js → publications.js} +65 -70
- package/dist/repl.d.ts +0 -2
- package/dist/repl.js +0 -3
- package/dist/runtime/rest.js +1 -1
- package/dist/schemas/{deployments.d.ts → publications.d.ts} +68 -68
- package/dist/schemas/publications.js +133 -0
- package/dist/shell.d.ts +43 -22
- package/dist/shell.js +103 -75
- package/dist/terminal.d.ts +1 -3
- package/dist/terminal.js +2 -5
- package/docs/api-summary.md +13 -10
- package/docs/cdn-usage.md +4 -4
- package/docs/getting-started.md +6 -6
- package/examples/README.md +8 -9
- package/examples/basic.ts +1 -1
- package/examples/git-merge-smoke.ts +2 -2
- package/examples/laravel-load-test.ts +14 -19
- package/examples/notebook-readonly-smoke.ts +11 -11
- package/examples/publication-provider-label.ts +11 -0
- package/examples/{deploy-cloudflare-container.ts → publish-cloudflare-container.ts} +11 -11
- package/examples/{deploy-laravel-cloud.ts → publish-laravel-cloud.ts} +11 -11
- package/examples/{deploy-ssh-agent.ts → publish-ssh-agent.ts} +15 -16
- package/package.json +7 -2
- package/dist/deployments.d.ts +0 -253
- package/dist/laravel.d.ts +0 -22
- package/dist/laravel.js +0 -11
- package/dist/schemas/deployments.js +0 -133
- package/examples/deployment-provider-label.ts +0 -11
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const DeploymentTargetProviderSchema = z.enum([
|
|
3
|
-
'okraCloudflareContainer',
|
|
4
|
-
'okraSshAgent',
|
|
5
|
-
'okraLaravelCloud',
|
|
6
|
-
]);
|
|
7
|
-
export const DeploymentStatusSchema = z.enum([
|
|
8
|
-
'pending',
|
|
9
|
-
'queued',
|
|
10
|
-
'building',
|
|
11
|
-
'deploying',
|
|
12
|
-
'healthy',
|
|
13
|
-
'failed',
|
|
14
|
-
'stopped',
|
|
15
|
-
'deleting',
|
|
16
|
-
'deleted',
|
|
17
|
-
'delete_failed',
|
|
18
|
-
]);
|
|
19
|
-
export const DeploymentBuildStatusSchema = z.enum([
|
|
20
|
-
'pending',
|
|
21
|
-
'queued',
|
|
22
|
-
'running',
|
|
23
|
-
'succeeded',
|
|
24
|
-
'failed',
|
|
25
|
-
'cancelled',
|
|
26
|
-
]);
|
|
27
|
-
export const DeploymentReleaseStatusSchema = z.enum(['created', 'ready', 'deleted']);
|
|
28
|
-
export const DeploymentSizeSchema = z.enum([
|
|
29
|
-
'nano',
|
|
30
|
-
'small',
|
|
31
|
-
'medium',
|
|
32
|
-
'large',
|
|
33
|
-
'lite',
|
|
34
|
-
'basic',
|
|
35
|
-
'standard-1',
|
|
36
|
-
'standard-2',
|
|
37
|
-
]);
|
|
38
|
-
export const DeploymentRegionSchema = z.enum([
|
|
39
|
-
'ENAM',
|
|
40
|
-
'WNAM',
|
|
41
|
-
'EEUR',
|
|
42
|
-
'WEUR',
|
|
43
|
-
'APAC',
|
|
44
|
-
'SAM',
|
|
45
|
-
'ME',
|
|
46
|
-
'OC',
|
|
47
|
-
'AFR',
|
|
48
|
-
]);
|
|
49
|
-
export const DeploymentJurisdictionSchema = z.enum(['eu', 'fedramp']);
|
|
50
|
-
export const DeploymentDomainDnsRecordTypeSchema = z.enum(['CNAME', 'ALIAS', 'ANAME']);
|
|
51
|
-
export const DeploymentProtectionModeSchema = z.enum(['none', 'password']);
|
|
52
|
-
export const DeploymentLogStreamSchema = z.enum(['build', 'runtime']);
|
|
53
|
-
export const DeployStreamLogStreamSchema = z.enum(['build', 'deploy', 'runtime']);
|
|
54
|
-
export const DeploymentEventDataSchema = z.object({
|
|
55
|
-
id: z.union([z.number(), z.string()]).optional(),
|
|
56
|
-
sequence: z.number(),
|
|
57
|
-
type: z.string(),
|
|
58
|
-
payload: z.record(z.string(), z.unknown()),
|
|
59
|
-
createdAt: z.string().nullable(),
|
|
60
|
-
}).passthrough();
|
|
61
|
-
export const DeploymentLogChunkDataSchema = z.object({
|
|
62
|
-
sequence: z.number(),
|
|
63
|
-
stream: DeploymentLogStreamSchema,
|
|
64
|
-
content: z.string(),
|
|
65
|
-
createdAt: z.string().nullable(),
|
|
66
|
-
}).passthrough();
|
|
67
|
-
export const DeployStreamPhaseSchema = z.object({
|
|
68
|
-
name: z.string(),
|
|
69
|
-
status: z.enum(['running', 'completed', 'failed']).optional(),
|
|
70
|
-
data: z.record(z.string(), z.unknown()).optional(),
|
|
71
|
-
}).strict();
|
|
72
|
-
export const DeployStreamLogSchema = z.object({
|
|
73
|
-
stream: DeployStreamLogStreamSchema,
|
|
74
|
-
content: z.string(),
|
|
75
|
-
}).strict();
|
|
76
|
-
export const DeployStreamResultSchema = z.object({
|
|
77
|
-
success: z.boolean(),
|
|
78
|
-
deploymentId: z.string(),
|
|
79
|
-
buildId: z.string(),
|
|
80
|
-
releaseId: z.string(),
|
|
81
|
-
status: DeploymentStatusSchema,
|
|
82
|
-
}).strict();
|
|
83
|
-
export const DeployStreamPhaseEventSchema = DeployStreamPhaseSchema.extend({
|
|
84
|
-
type: z.literal('phase'),
|
|
85
|
-
}).strict();
|
|
86
|
-
export const DeployStreamLogEventSchema = DeployStreamLogSchema.extend({
|
|
87
|
-
type: z.literal('log'),
|
|
88
|
-
}).strict();
|
|
89
|
-
export const DeployStreamResultEventSchema = DeployStreamResultSchema.extend({
|
|
90
|
-
type: z.literal('result'),
|
|
91
|
-
}).strict();
|
|
92
|
-
export const DeployStreamEventSchema = z.discriminatedUnion('type', [
|
|
93
|
-
DeployStreamPhaseEventSchema,
|
|
94
|
-
DeployStreamLogEventSchema,
|
|
95
|
-
DeployStreamResultEventSchema,
|
|
96
|
-
]);
|
|
97
|
-
export const DeployStreamErrorSchema = z.object({
|
|
98
|
-
message: z.string().optional(),
|
|
99
|
-
}).passthrough();
|
|
100
|
-
export const DeployStreamSseEventNameSchema = z.enum(['phase', 'log', 'done', 'result', 'error']);
|
|
101
|
-
export const DeployStreamSsePhaseEventSchema = z.object({
|
|
102
|
-
event: z.literal('phase'),
|
|
103
|
-
data: DeployStreamPhaseSchema,
|
|
104
|
-
}).strict();
|
|
105
|
-
export const DeployStreamSseLogEventSchema = z.object({
|
|
106
|
-
event: z.literal('log'),
|
|
107
|
-
data: DeployStreamLogSchema,
|
|
108
|
-
}).strict();
|
|
109
|
-
export const DeployStreamSseDoneEventSchema = z.object({
|
|
110
|
-
event: z.literal('done'),
|
|
111
|
-
data: DeployStreamResultSchema,
|
|
112
|
-
}).strict();
|
|
113
|
-
export const DeployStreamSseResultEventSchema = z.object({
|
|
114
|
-
event: z.literal('result'),
|
|
115
|
-
data: DeployStreamResultSchema,
|
|
116
|
-
}).strict();
|
|
117
|
-
export const DeployStreamSseErrorEventSchema = z.object({
|
|
118
|
-
event: z.literal('error'),
|
|
119
|
-
data: DeployStreamErrorSchema,
|
|
120
|
-
}).strict();
|
|
121
|
-
export const DeployStreamSseEventSchema = z.discriminatedUnion('event', [
|
|
122
|
-
DeployStreamSsePhaseEventSchema,
|
|
123
|
-
DeployStreamSseLogEventSchema,
|
|
124
|
-
DeployStreamSseDoneEventSchema,
|
|
125
|
-
DeployStreamSseResultEventSchema,
|
|
126
|
-
DeployStreamSseErrorEventSchema,
|
|
127
|
-
]).transform((event) => {
|
|
128
|
-
if (event.event === 'error') {
|
|
129
|
-
throw new Error(event.data.message ?? 'Deploy failed');
|
|
130
|
-
}
|
|
131
|
-
const type = event.event === 'done' ? 'result' : event.event;
|
|
132
|
-
return DeployStreamEventSchema.parse({ type, ...event.data });
|
|
133
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DeploymentTargetProvider } from '../src/index.js';
|
|
2
|
-
|
|
3
|
-
const deploymentTargetProviderLabels: Record<DeploymentTargetProvider, string> = {
|
|
4
|
-
okraCloudflareContainer: 'Cloudflare Containers',
|
|
5
|
-
okraSshAgent: 'SSH Agent',
|
|
6
|
-
okraLaravelCloud: 'Laravel Cloud',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export function deploymentTargetProviderLabel(provider: DeploymentTargetProvider): string {
|
|
10
|
-
return deploymentTargetProviderLabels[provider] ?? provider;
|
|
11
|
-
}
|