@shipstatic/ship 0.2.4 → 0.2.6
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 +228 -28
- package/dist/browser.d.ts +143 -84
- package/dist/browser.js +3 -3
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +21 -21
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +127 -81
- package/dist/index.d.ts +127 -81
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -25,14 +25,16 @@ interface DeploymentOptions {
|
|
|
25
25
|
maxConcurrency?: number;
|
|
26
26
|
/** Timeout in milliseconds for the deploy request. */
|
|
27
27
|
timeout?: number;
|
|
28
|
-
/** API key for this specific deploy. Overrides client's default. */
|
|
28
|
+
/** API key for this specific deploy. Overrides client's default (format: ship-<64-char-hex>, total 69 chars). */
|
|
29
29
|
apiKey?: string;
|
|
30
|
-
/** Deploy token for this specific deploy. Overrides client's default. */
|
|
30
|
+
/** Deploy token for this specific deploy. Overrides client's default (format: token-<64-char-hex>, total 70 chars). */
|
|
31
31
|
deployToken?: string;
|
|
32
32
|
/** Whether to auto-detect and optimize file paths by flattening common directories. Defaults to true. */
|
|
33
33
|
pathDetect?: boolean;
|
|
34
34
|
/** Whether to auto-detect SPAs and generate ship.json configuration. Defaults to true. */
|
|
35
35
|
spaDetect?: boolean;
|
|
36
|
+
/** Optional array of tags for categorization and filtering (lowercase, alphanumeric with separators). */
|
|
37
|
+
tags?: string[];
|
|
36
38
|
/** Callback for overall deploy progress (0-100). */
|
|
37
39
|
onProgress?: (progress: number) => void;
|
|
38
40
|
/** Callback for detailed progress statistics. */
|
|
@@ -63,9 +65,9 @@ interface ProgressStats {
|
|
|
63
65
|
interface ShipClientOptions {
|
|
64
66
|
/** Default API URL for the client instance. */
|
|
65
67
|
apiUrl?: string | undefined;
|
|
66
|
-
/** API key for authenticated deployments. */
|
|
68
|
+
/** API key for authenticated deployments (format: ship-<64-char-hex>, total 69 chars). */
|
|
67
69
|
apiKey?: string | undefined;
|
|
68
|
-
/** Deploy token for single-use deployments. */
|
|
70
|
+
/** Deploy token for single-use deployments (format: token-<64-char-hex>, total 70 chars). */
|
|
69
71
|
deployToken?: string | undefined;
|
|
70
72
|
/** Path to custom config file. */
|
|
71
73
|
configFile?: string | undefined;
|
|
@@ -91,118 +93,144 @@ interface ShipClientOptions {
|
|
|
91
93
|
*/
|
|
92
94
|
timeout?: number | undefined;
|
|
93
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Event map for Ship SDK events
|
|
98
|
+
* Core events for observability: request, response, error
|
|
99
|
+
*/
|
|
100
|
+
interface ShipEvents extends Record<string, any[]> {
|
|
101
|
+
/** Emitted before each API request */
|
|
102
|
+
request: [url: string, init: RequestInit];
|
|
103
|
+
/** Emitted after successful API response */
|
|
104
|
+
response: [response: Response, url: string];
|
|
105
|
+
/** Emitted when API request fails */
|
|
106
|
+
error: [error: Error, url: string];
|
|
107
|
+
}
|
|
94
108
|
|
|
95
109
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @internal
|
|
110
|
+
* Event system for Ship SDK
|
|
111
|
+
* Lightweight, reliable event handling with proper error boundaries
|
|
99
112
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Lightweight event system
|
|
116
|
+
* - Add handler: on()
|
|
117
|
+
* - Remove handler: off()
|
|
118
|
+
* - Emit events: emit() [internal]
|
|
119
|
+
* - Transfer events: transfer() [internal]
|
|
120
|
+
* - Reliable error handling and cleanup
|
|
121
|
+
*/
|
|
122
|
+
declare class SimpleEvents {
|
|
123
|
+
private handlers;
|
|
105
124
|
/**
|
|
106
|
-
*
|
|
107
|
-
* @param options - Client options including API host, authentication credentials, and timeout settings.
|
|
125
|
+
* Add event handler
|
|
108
126
|
*/
|
|
109
|
-
|
|
127
|
+
on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
110
128
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @returns Promise resolving to `true` if the ping is successful, `false` otherwise.
|
|
113
|
-
* @throws {ShipApiError} If the API returns an error response (4xx, 5xx).
|
|
114
|
-
* @throws {ShipNetworkError} If a network error occurs (e.g., DNS failure, connection refused).
|
|
129
|
+
* Remove event handler
|
|
115
130
|
*/
|
|
116
|
-
|
|
131
|
+
off<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
117
132
|
/**
|
|
118
|
-
*
|
|
119
|
-
* @
|
|
133
|
+
* Emit event (internal use only)
|
|
134
|
+
* @internal
|
|
120
135
|
*/
|
|
121
|
-
|
|
136
|
+
emit<K extends keyof ShipEvents>(event: K, ...args: ShipEvents[K]): void;
|
|
122
137
|
/**
|
|
123
|
-
*
|
|
124
|
-
* @
|
|
125
|
-
* @throws {ShipError} If the config request fails.
|
|
138
|
+
* Transfer all handlers to another events instance
|
|
139
|
+
* @internal
|
|
126
140
|
*/
|
|
127
|
-
|
|
141
|
+
transfer(target: SimpleEvents): void;
|
|
128
142
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* Validates files and manages deploy progress and error translation.
|
|
132
|
-
* @param files - Array of StaticFile objects to deploy (must include MD5 checksums).
|
|
133
|
-
* @param options - Optional per-deploy configuration (overrides instance defaults).
|
|
134
|
-
* @returns Promise resolving to a full Deployment object on success.
|
|
135
|
-
* @throws {ShipFileError} If a file is missing an MD5 checksum or content type is unsupported.
|
|
136
|
-
* @throws {ShipClientError} If no files are provided or if environment is unknown.
|
|
137
|
-
* @throws {ShipNetworkError} If a network error occurs during deploy.
|
|
138
|
-
* @throws {ShipApiError} If the API returns an error response.
|
|
139
|
-
* @throws {ShipCancelledError} If the deploy is cancelled via an AbortSignal.
|
|
143
|
+
* Clear all handlers (for cleanup)
|
|
144
|
+
* @internal
|
|
140
145
|
*/
|
|
141
|
-
|
|
146
|
+
clear(): void;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @file HTTP client with integrated event system
|
|
151
|
+
* Clean, direct implementation with reliable error handling
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* HTTP client with integrated event system
|
|
156
|
+
* - Direct event integration
|
|
157
|
+
* - Clean inheritance from SimpleEvents
|
|
158
|
+
* - Reliable error handling
|
|
159
|
+
*/
|
|
160
|
+
declare class ApiHttp extends SimpleEvents {
|
|
161
|
+
private readonly apiUrl;
|
|
162
|
+
private readonly apiKey;
|
|
163
|
+
private readonly deployToken;
|
|
164
|
+
constructor(options: ShipClientOptions);
|
|
142
165
|
/**
|
|
143
|
-
*
|
|
144
|
-
* @returns Promise resolving to deployment list response
|
|
166
|
+
* Transfer events to another client (clean intentional API)
|
|
145
167
|
*/
|
|
146
|
-
|
|
168
|
+
transferEventsTo(target: ApiHttp): void;
|
|
147
169
|
/**
|
|
148
|
-
*
|
|
149
|
-
* @param id - Deployment ID to retrieve
|
|
150
|
-
* @returns Promise resolving to deployment details
|
|
170
|
+
* Make authenticated HTTP request with events
|
|
151
171
|
*/
|
|
152
|
-
|
|
172
|
+
private request;
|
|
153
173
|
/**
|
|
154
|
-
*
|
|
155
|
-
* @param id - Deployment ID to remove
|
|
156
|
-
* @returns Promise resolving when removal is complete
|
|
174
|
+
* Generate auth headers
|
|
157
175
|
*/
|
|
158
|
-
|
|
176
|
+
private getAuthHeaders;
|
|
159
177
|
/**
|
|
160
|
-
*
|
|
161
|
-
* @param name - Alias name
|
|
162
|
-
* @param deployment - Deployment name to point to
|
|
163
|
-
* @returns Promise resolving to the created/updated alias with operation context
|
|
178
|
+
* Check if credentials are needed
|
|
164
179
|
*/
|
|
165
|
-
|
|
180
|
+
private needsCredentials;
|
|
166
181
|
/**
|
|
167
|
-
*
|
|
168
|
-
* @param name - Alias name to retrieve
|
|
169
|
-
* @returns Promise resolving to alias details
|
|
182
|
+
* Safely clone response for events
|
|
170
183
|
*/
|
|
171
|
-
|
|
184
|
+
private safeClone;
|
|
172
185
|
/**
|
|
173
|
-
*
|
|
174
|
-
* @returns Promise resolving to alias list response
|
|
186
|
+
* Parse JSON response
|
|
175
187
|
*/
|
|
176
|
-
|
|
188
|
+
private parseResponse;
|
|
177
189
|
/**
|
|
178
|
-
*
|
|
179
|
-
* @param name - Alias name to remove
|
|
180
|
-
* @returns Promise resolving to removal confirmation
|
|
190
|
+
* Handle response errors
|
|
181
191
|
*/
|
|
182
|
-
|
|
192
|
+
private handleResponseError;
|
|
183
193
|
/**
|
|
184
|
-
*
|
|
185
|
-
* @param name - Alias name to check DNS for
|
|
186
|
-
* @returns Promise resolving to confirmation message
|
|
194
|
+
* Handle fetch errors
|
|
187
195
|
*/
|
|
188
|
-
|
|
196
|
+
private handleFetchError;
|
|
197
|
+
ping(): Promise<boolean>;
|
|
198
|
+
getPingResponse(): Promise<PingResponse>;
|
|
199
|
+
getConfig(): Promise<ConfigResponse>;
|
|
200
|
+
deploy(files: StaticFile[], options?: ApiDeployOptions): Promise<Deployment>;
|
|
201
|
+
listDeployments(): Promise<DeploymentListResponse>;
|
|
202
|
+
getDeployment(id: string): Promise<Deployment>;
|
|
203
|
+
removeDeployment(id: string): Promise<void>;
|
|
204
|
+
setAlias(name: string, deployment: string, tags?: string[]): Promise<Alias>;
|
|
205
|
+
getAlias(name: string): Promise<Alias>;
|
|
206
|
+
listAliases(): Promise<AliasListResponse>;
|
|
207
|
+
removeAlias(name: string): Promise<void>;
|
|
208
|
+
confirmAlias(name: string): Promise<{
|
|
189
209
|
message: string;
|
|
190
210
|
}>;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
211
|
+
getAliasDns(name: string): Promise<{
|
|
212
|
+
alias: string;
|
|
213
|
+
dns: any;
|
|
214
|
+
}>;
|
|
215
|
+
getAliasRecords(name: string): Promise<{
|
|
216
|
+
alias: string;
|
|
217
|
+
records: any[];
|
|
218
|
+
}>;
|
|
219
|
+
getAliasShare(name: string): Promise<{
|
|
220
|
+
alias: string;
|
|
221
|
+
hash: string;
|
|
222
|
+
}>;
|
|
195
223
|
getAccount(): Promise<Account>;
|
|
196
|
-
/**
|
|
197
|
-
* Checks if files represent a SPA structure using AI analysis
|
|
198
|
-
* @param files - Array of StaticFile objects to analyze
|
|
199
|
-
* @returns Promise resolving to boolean indicating if it's a SPA
|
|
200
|
-
*/
|
|
201
224
|
checkSPA(files: StaticFile[]): Promise<boolean>;
|
|
225
|
+
private validateFiles;
|
|
226
|
+
private prepareRequestPayload;
|
|
227
|
+
private createBrowserBody;
|
|
228
|
+
private createNodeBody;
|
|
229
|
+
private getBrowserContentType;
|
|
202
230
|
}
|
|
203
231
|
|
|
204
232
|
/**
|
|
205
|
-
* @file
|
|
233
|
+
* @file Ship SDK resource implementations for deployments, aliases, and accounts.
|
|
206
234
|
*/
|
|
207
235
|
|
|
208
236
|
declare function createDeploymentResource(getApi: () => ApiHttp, clientDefaults?: ShipClientOptions, ensureInit?: () => Promise<void>, processInput?: (input: DeployInput, options: DeploymentOptions) => Promise<StaticFile[]>): DeploymentResource;
|
|
@@ -254,6 +282,24 @@ declare abstract class Ship$1 {
|
|
|
254
282
|
* Get account resource
|
|
255
283
|
*/
|
|
256
284
|
get account(): AccountResource;
|
|
285
|
+
/**
|
|
286
|
+
* Add event listener
|
|
287
|
+
* @param event - Event name
|
|
288
|
+
* @param handler - Event handler function
|
|
289
|
+
*/
|
|
290
|
+
on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
291
|
+
/**
|
|
292
|
+
* Remove event listener
|
|
293
|
+
* @param event - Event name
|
|
294
|
+
* @param handler - Event handler function
|
|
295
|
+
*/
|
|
296
|
+
off<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
297
|
+
/**
|
|
298
|
+
* Replace HTTP client while preserving event listeners
|
|
299
|
+
* Used during initialization to maintain user event subscriptions
|
|
300
|
+
* @protected
|
|
301
|
+
*/
|
|
302
|
+
protected replaceHttpClient(newClient: ApiHttp): void;
|
|
257
303
|
}
|
|
258
304
|
|
|
259
305
|
/**
|
|
@@ -452,4 +498,4 @@ declare class Ship extends Ship$1 {
|
|
|
452
498
|
protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
|
|
453
499
|
}
|
|
454
500
|
|
|
455
|
-
export { type ApiDeployOptions, ApiHttp, type Config, type DeployFile, type DeploymentOptions, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ProgressStats, Ship, type ShipClientOptions, __setTestEnvironment, calculateMD5, createAccountResource, createAliasResource, createDeploymentResource, Ship as default, filterJunk, getCurrentConfig, getENV, loadConfig, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForNode, resolveConfig, setConfig };
|
|
501
|
+
export { type ApiDeployOptions, ApiHttp, type Config, type DeployFile, type DeploymentOptions, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ProgressStats, Ship, type ShipClientOptions, type ShipEvents, __setTestEnvironment, calculateMD5, createAccountResource, createAliasResource, createDeploymentResource, Ship as default, filterJunk, getCurrentConfig, getENV, loadConfig, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForNode, resolveConfig, setConfig, setConfig as setPlatformConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -25,14 +25,16 @@ interface DeploymentOptions {
|
|
|
25
25
|
maxConcurrency?: number;
|
|
26
26
|
/** Timeout in milliseconds for the deploy request. */
|
|
27
27
|
timeout?: number;
|
|
28
|
-
/** API key for this specific deploy. Overrides client's default. */
|
|
28
|
+
/** API key for this specific deploy. Overrides client's default (format: ship-<64-char-hex>, total 69 chars). */
|
|
29
29
|
apiKey?: string;
|
|
30
|
-
/** Deploy token for this specific deploy. Overrides client's default. */
|
|
30
|
+
/** Deploy token for this specific deploy. Overrides client's default (format: token-<64-char-hex>, total 70 chars). */
|
|
31
31
|
deployToken?: string;
|
|
32
32
|
/** Whether to auto-detect and optimize file paths by flattening common directories. Defaults to true. */
|
|
33
33
|
pathDetect?: boolean;
|
|
34
34
|
/** Whether to auto-detect SPAs and generate ship.json configuration. Defaults to true. */
|
|
35
35
|
spaDetect?: boolean;
|
|
36
|
+
/** Optional array of tags for categorization and filtering (lowercase, alphanumeric with separators). */
|
|
37
|
+
tags?: string[];
|
|
36
38
|
/** Callback for overall deploy progress (0-100). */
|
|
37
39
|
onProgress?: (progress: number) => void;
|
|
38
40
|
/** Callback for detailed progress statistics. */
|
|
@@ -63,9 +65,9 @@ interface ProgressStats {
|
|
|
63
65
|
interface ShipClientOptions {
|
|
64
66
|
/** Default API URL for the client instance. */
|
|
65
67
|
apiUrl?: string | undefined;
|
|
66
|
-
/** API key for authenticated deployments. */
|
|
68
|
+
/** API key for authenticated deployments (format: ship-<64-char-hex>, total 69 chars). */
|
|
67
69
|
apiKey?: string | undefined;
|
|
68
|
-
/** Deploy token for single-use deployments. */
|
|
70
|
+
/** Deploy token for single-use deployments (format: token-<64-char-hex>, total 70 chars). */
|
|
69
71
|
deployToken?: string | undefined;
|
|
70
72
|
/** Path to custom config file. */
|
|
71
73
|
configFile?: string | undefined;
|
|
@@ -91,118 +93,144 @@ interface ShipClientOptions {
|
|
|
91
93
|
*/
|
|
92
94
|
timeout?: number | undefined;
|
|
93
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Event map for Ship SDK events
|
|
98
|
+
* Core events for observability: request, response, error
|
|
99
|
+
*/
|
|
100
|
+
interface ShipEvents extends Record<string, any[]> {
|
|
101
|
+
/** Emitted before each API request */
|
|
102
|
+
request: [url: string, init: RequestInit];
|
|
103
|
+
/** Emitted after successful API response */
|
|
104
|
+
response: [response: Response, url: string];
|
|
105
|
+
/** Emitted when API request fails */
|
|
106
|
+
error: [error: Error, url: string];
|
|
107
|
+
}
|
|
94
108
|
|
|
95
109
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @internal
|
|
110
|
+
* Event system for Ship SDK
|
|
111
|
+
* Lightweight, reliable event handling with proper error boundaries
|
|
99
112
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Lightweight event system
|
|
116
|
+
* - Add handler: on()
|
|
117
|
+
* - Remove handler: off()
|
|
118
|
+
* - Emit events: emit() [internal]
|
|
119
|
+
* - Transfer events: transfer() [internal]
|
|
120
|
+
* - Reliable error handling and cleanup
|
|
121
|
+
*/
|
|
122
|
+
declare class SimpleEvents {
|
|
123
|
+
private handlers;
|
|
105
124
|
/**
|
|
106
|
-
*
|
|
107
|
-
* @param options - Client options including API host, authentication credentials, and timeout settings.
|
|
125
|
+
* Add event handler
|
|
108
126
|
*/
|
|
109
|
-
|
|
127
|
+
on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
110
128
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @returns Promise resolving to `true` if the ping is successful, `false` otherwise.
|
|
113
|
-
* @throws {ShipApiError} If the API returns an error response (4xx, 5xx).
|
|
114
|
-
* @throws {ShipNetworkError} If a network error occurs (e.g., DNS failure, connection refused).
|
|
129
|
+
* Remove event handler
|
|
115
130
|
*/
|
|
116
|
-
|
|
131
|
+
off<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
117
132
|
/**
|
|
118
|
-
*
|
|
119
|
-
* @
|
|
133
|
+
* Emit event (internal use only)
|
|
134
|
+
* @internal
|
|
120
135
|
*/
|
|
121
|
-
|
|
136
|
+
emit<K extends keyof ShipEvents>(event: K, ...args: ShipEvents[K]): void;
|
|
122
137
|
/**
|
|
123
|
-
*
|
|
124
|
-
* @
|
|
125
|
-
* @throws {ShipError} If the config request fails.
|
|
138
|
+
* Transfer all handlers to another events instance
|
|
139
|
+
* @internal
|
|
126
140
|
*/
|
|
127
|
-
|
|
141
|
+
transfer(target: SimpleEvents): void;
|
|
128
142
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* Validates files and manages deploy progress and error translation.
|
|
132
|
-
* @param files - Array of StaticFile objects to deploy (must include MD5 checksums).
|
|
133
|
-
* @param options - Optional per-deploy configuration (overrides instance defaults).
|
|
134
|
-
* @returns Promise resolving to a full Deployment object on success.
|
|
135
|
-
* @throws {ShipFileError} If a file is missing an MD5 checksum or content type is unsupported.
|
|
136
|
-
* @throws {ShipClientError} If no files are provided or if environment is unknown.
|
|
137
|
-
* @throws {ShipNetworkError} If a network error occurs during deploy.
|
|
138
|
-
* @throws {ShipApiError} If the API returns an error response.
|
|
139
|
-
* @throws {ShipCancelledError} If the deploy is cancelled via an AbortSignal.
|
|
143
|
+
* Clear all handlers (for cleanup)
|
|
144
|
+
* @internal
|
|
140
145
|
*/
|
|
141
|
-
|
|
146
|
+
clear(): void;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @file HTTP client with integrated event system
|
|
151
|
+
* Clean, direct implementation with reliable error handling
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* HTTP client with integrated event system
|
|
156
|
+
* - Direct event integration
|
|
157
|
+
* - Clean inheritance from SimpleEvents
|
|
158
|
+
* - Reliable error handling
|
|
159
|
+
*/
|
|
160
|
+
declare class ApiHttp extends SimpleEvents {
|
|
161
|
+
private readonly apiUrl;
|
|
162
|
+
private readonly apiKey;
|
|
163
|
+
private readonly deployToken;
|
|
164
|
+
constructor(options: ShipClientOptions);
|
|
142
165
|
/**
|
|
143
|
-
*
|
|
144
|
-
* @returns Promise resolving to deployment list response
|
|
166
|
+
* Transfer events to another client (clean intentional API)
|
|
145
167
|
*/
|
|
146
|
-
|
|
168
|
+
transferEventsTo(target: ApiHttp): void;
|
|
147
169
|
/**
|
|
148
|
-
*
|
|
149
|
-
* @param id - Deployment ID to retrieve
|
|
150
|
-
* @returns Promise resolving to deployment details
|
|
170
|
+
* Make authenticated HTTP request with events
|
|
151
171
|
*/
|
|
152
|
-
|
|
172
|
+
private request;
|
|
153
173
|
/**
|
|
154
|
-
*
|
|
155
|
-
* @param id - Deployment ID to remove
|
|
156
|
-
* @returns Promise resolving when removal is complete
|
|
174
|
+
* Generate auth headers
|
|
157
175
|
*/
|
|
158
|
-
|
|
176
|
+
private getAuthHeaders;
|
|
159
177
|
/**
|
|
160
|
-
*
|
|
161
|
-
* @param name - Alias name
|
|
162
|
-
* @param deployment - Deployment name to point to
|
|
163
|
-
* @returns Promise resolving to the created/updated alias with operation context
|
|
178
|
+
* Check if credentials are needed
|
|
164
179
|
*/
|
|
165
|
-
|
|
180
|
+
private needsCredentials;
|
|
166
181
|
/**
|
|
167
|
-
*
|
|
168
|
-
* @param name - Alias name to retrieve
|
|
169
|
-
* @returns Promise resolving to alias details
|
|
182
|
+
* Safely clone response for events
|
|
170
183
|
*/
|
|
171
|
-
|
|
184
|
+
private safeClone;
|
|
172
185
|
/**
|
|
173
|
-
*
|
|
174
|
-
* @returns Promise resolving to alias list response
|
|
186
|
+
* Parse JSON response
|
|
175
187
|
*/
|
|
176
|
-
|
|
188
|
+
private parseResponse;
|
|
177
189
|
/**
|
|
178
|
-
*
|
|
179
|
-
* @param name - Alias name to remove
|
|
180
|
-
* @returns Promise resolving to removal confirmation
|
|
190
|
+
* Handle response errors
|
|
181
191
|
*/
|
|
182
|
-
|
|
192
|
+
private handleResponseError;
|
|
183
193
|
/**
|
|
184
|
-
*
|
|
185
|
-
* @param name - Alias name to check DNS for
|
|
186
|
-
* @returns Promise resolving to confirmation message
|
|
194
|
+
* Handle fetch errors
|
|
187
195
|
*/
|
|
188
|
-
|
|
196
|
+
private handleFetchError;
|
|
197
|
+
ping(): Promise<boolean>;
|
|
198
|
+
getPingResponse(): Promise<PingResponse>;
|
|
199
|
+
getConfig(): Promise<ConfigResponse>;
|
|
200
|
+
deploy(files: StaticFile[], options?: ApiDeployOptions): Promise<Deployment>;
|
|
201
|
+
listDeployments(): Promise<DeploymentListResponse>;
|
|
202
|
+
getDeployment(id: string): Promise<Deployment>;
|
|
203
|
+
removeDeployment(id: string): Promise<void>;
|
|
204
|
+
setAlias(name: string, deployment: string, tags?: string[]): Promise<Alias>;
|
|
205
|
+
getAlias(name: string): Promise<Alias>;
|
|
206
|
+
listAliases(): Promise<AliasListResponse>;
|
|
207
|
+
removeAlias(name: string): Promise<void>;
|
|
208
|
+
confirmAlias(name: string): Promise<{
|
|
189
209
|
message: string;
|
|
190
210
|
}>;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
211
|
+
getAliasDns(name: string): Promise<{
|
|
212
|
+
alias: string;
|
|
213
|
+
dns: any;
|
|
214
|
+
}>;
|
|
215
|
+
getAliasRecords(name: string): Promise<{
|
|
216
|
+
alias: string;
|
|
217
|
+
records: any[];
|
|
218
|
+
}>;
|
|
219
|
+
getAliasShare(name: string): Promise<{
|
|
220
|
+
alias: string;
|
|
221
|
+
hash: string;
|
|
222
|
+
}>;
|
|
195
223
|
getAccount(): Promise<Account>;
|
|
196
|
-
/**
|
|
197
|
-
* Checks if files represent a SPA structure using AI analysis
|
|
198
|
-
* @param files - Array of StaticFile objects to analyze
|
|
199
|
-
* @returns Promise resolving to boolean indicating if it's a SPA
|
|
200
|
-
*/
|
|
201
224
|
checkSPA(files: StaticFile[]): Promise<boolean>;
|
|
225
|
+
private validateFiles;
|
|
226
|
+
private prepareRequestPayload;
|
|
227
|
+
private createBrowserBody;
|
|
228
|
+
private createNodeBody;
|
|
229
|
+
private getBrowserContentType;
|
|
202
230
|
}
|
|
203
231
|
|
|
204
232
|
/**
|
|
205
|
-
* @file
|
|
233
|
+
* @file Ship SDK resource implementations for deployments, aliases, and accounts.
|
|
206
234
|
*/
|
|
207
235
|
|
|
208
236
|
declare function createDeploymentResource(getApi: () => ApiHttp, clientDefaults?: ShipClientOptions, ensureInit?: () => Promise<void>, processInput?: (input: DeployInput, options: DeploymentOptions) => Promise<StaticFile[]>): DeploymentResource;
|
|
@@ -254,6 +282,24 @@ declare abstract class Ship$1 {
|
|
|
254
282
|
* Get account resource
|
|
255
283
|
*/
|
|
256
284
|
get account(): AccountResource;
|
|
285
|
+
/**
|
|
286
|
+
* Add event listener
|
|
287
|
+
* @param event - Event name
|
|
288
|
+
* @param handler - Event handler function
|
|
289
|
+
*/
|
|
290
|
+
on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
291
|
+
/**
|
|
292
|
+
* Remove event listener
|
|
293
|
+
* @param event - Event name
|
|
294
|
+
* @param handler - Event handler function
|
|
295
|
+
*/
|
|
296
|
+
off<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
297
|
+
/**
|
|
298
|
+
* Replace HTTP client while preserving event listeners
|
|
299
|
+
* Used during initialization to maintain user event subscriptions
|
|
300
|
+
* @protected
|
|
301
|
+
*/
|
|
302
|
+
protected replaceHttpClient(newClient: ApiHttp): void;
|
|
257
303
|
}
|
|
258
304
|
|
|
259
305
|
/**
|
|
@@ -452,4 +498,4 @@ declare class Ship extends Ship$1 {
|
|
|
452
498
|
protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
|
|
453
499
|
}
|
|
454
500
|
|
|
455
|
-
export { type ApiDeployOptions, ApiHttp, type Config, type DeployFile, type DeploymentOptions, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ProgressStats, Ship, type ShipClientOptions, __setTestEnvironment, calculateMD5, createAccountResource, createAliasResource, createDeploymentResource, Ship as default, filterJunk, getCurrentConfig, getENV, loadConfig, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForNode, resolveConfig, setConfig };
|
|
501
|
+
export { type ApiDeployOptions, ApiHttp, type Config, type DeployFile, type DeploymentOptions, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ProgressStats, Ship, type ShipClientOptions, type ShipEvents, __setTestEnvironment, calculateMD5, createAccountResource, createAliasResource, createDeploymentResource, Ship as default, filterJunk, getCurrentConfig, getENV, loadConfig, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForNode, resolveConfig, setConfig, setConfig as setPlatformConfig };
|