@shipstatic/ship 0.2.3 → 0.2.5
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 +184 -23
- package/dist/browser.d.ts +107 -88
- package/dist/browser.js +3 -3
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +19 -19
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +10 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +107 -88
- package/dist/index.d.ts +107 -88
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _shipstatic_types from '@shipstatic/types';
|
|
2
|
-
import { PingResponse, ConfigResponse, StaticFile, Deployment, DeploymentListResponse, Alias, AliasListResponse, Account, DeployInput, DeploymentResource, AliasResource, AccountResource,
|
|
2
|
+
import { PingResponse, ConfigResponse, StaticFile, Deployment, DeploymentListResponse, Alias, AliasListResponse, Account, DeployInput, DeploymentResource, AliasResource, AccountResource, PlatformConfig } from '@shipstatic/types';
|
|
3
3
|
export * from '@shipstatic/types';
|
|
4
4
|
export { Account, Alias, DEFAULT_API, DeployInput, Deployment, PingResponse, ShipError, ShipErrorType } from '@shipstatic/types';
|
|
5
5
|
|
|
@@ -91,131 +91,137 @@ interface ShipClientOptions {
|
|
|
91
91
|
*/
|
|
92
92
|
timeout?: number | undefined;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Event map for Ship SDK events
|
|
96
|
+
* Core events for observability: request, response, error
|
|
97
|
+
*/
|
|
98
|
+
interface ShipEvents extends Record<string, any[]> {
|
|
99
|
+
/** Emitted before each API request */
|
|
100
|
+
request: [url: string, init: RequestInit];
|
|
101
|
+
/** Emitted after successful API response */
|
|
102
|
+
response: [response: Response, url: string];
|
|
103
|
+
/** Emitted when API request fails */
|
|
104
|
+
error: [error: Error, url: string];
|
|
105
|
+
}
|
|
94
106
|
|
|
95
107
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @internal
|
|
108
|
+
* Event system for Ship SDK
|
|
109
|
+
* Lightweight, reliable event handling with proper error boundaries
|
|
99
110
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Lightweight event system
|
|
114
|
+
* - Add handler: on()
|
|
115
|
+
* - Remove handler: off()
|
|
116
|
+
* - Emit events: emit() [internal]
|
|
117
|
+
* - Transfer events: transfer() [internal]
|
|
118
|
+
* - Reliable error handling and cleanup
|
|
119
|
+
*/
|
|
120
|
+
declare class SimpleEvents {
|
|
121
|
+
private handlers;
|
|
105
122
|
/**
|
|
106
|
-
*
|
|
107
|
-
* @param options - Client options including API host, authentication credentials, and timeout settings.
|
|
123
|
+
* Add event handler
|
|
108
124
|
*/
|
|
109
|
-
|
|
125
|
+
on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
110
126
|
/**
|
|
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).
|
|
127
|
+
* Remove event handler
|
|
115
128
|
*/
|
|
116
|
-
|
|
129
|
+
off<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
117
130
|
/**
|
|
118
|
-
*
|
|
119
|
-
* @
|
|
131
|
+
* Emit event (internal use only)
|
|
132
|
+
* @internal
|
|
120
133
|
*/
|
|
121
|
-
|
|
134
|
+
emit<K extends keyof ShipEvents>(event: K, ...args: ShipEvents[K]): void;
|
|
122
135
|
/**
|
|
123
|
-
*
|
|
124
|
-
* @
|
|
125
|
-
* @throws {ShipError} If the config request fails.
|
|
136
|
+
* Transfer all handlers to another events instance
|
|
137
|
+
* @internal
|
|
126
138
|
*/
|
|
127
|
-
|
|
139
|
+
transfer(target: SimpleEvents): void;
|
|
128
140
|
/**
|
|
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.
|
|
141
|
+
* Clear all handlers (for cleanup)
|
|
142
|
+
* @internal
|
|
140
143
|
*/
|
|
141
|
-
|
|
144
|
+
clear(): void;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @file HTTP client with integrated event system
|
|
149
|
+
* Clean, direct implementation with reliable error handling
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* HTTP client with integrated event system
|
|
154
|
+
* - Direct event integration
|
|
155
|
+
* - Clean inheritance from SimpleEvents
|
|
156
|
+
* - Reliable error handling
|
|
157
|
+
*/
|
|
158
|
+
declare class ApiHttp extends SimpleEvents {
|
|
159
|
+
private readonly apiUrl;
|
|
160
|
+
private readonly apiKey;
|
|
161
|
+
private readonly deployToken;
|
|
162
|
+
constructor(options: ShipClientOptions);
|
|
142
163
|
/**
|
|
143
|
-
*
|
|
144
|
-
* @returns Promise resolving to deployment list response
|
|
164
|
+
* Transfer events to another client (clean intentional API)
|
|
145
165
|
*/
|
|
146
|
-
|
|
166
|
+
transferEventsTo(target: ApiHttp): void;
|
|
147
167
|
/**
|
|
148
|
-
*
|
|
149
|
-
* @param id - Deployment ID to retrieve
|
|
150
|
-
* @returns Promise resolving to deployment details
|
|
168
|
+
* Make authenticated HTTP request with events
|
|
151
169
|
*/
|
|
152
|
-
|
|
170
|
+
private request;
|
|
153
171
|
/**
|
|
154
|
-
*
|
|
155
|
-
* @param id - Deployment ID to remove
|
|
156
|
-
* @returns Promise resolving when removal is complete
|
|
172
|
+
* Generate auth headers
|
|
157
173
|
*/
|
|
158
|
-
|
|
174
|
+
private getAuthHeaders;
|
|
159
175
|
/**
|
|
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
|
|
176
|
+
* Check if credentials are needed
|
|
164
177
|
*/
|
|
165
|
-
|
|
178
|
+
private needsCredentials;
|
|
166
179
|
/**
|
|
167
|
-
*
|
|
168
|
-
* @param name - Alias name to retrieve
|
|
169
|
-
* @returns Promise resolving to alias details
|
|
180
|
+
* Safely clone response for events
|
|
170
181
|
*/
|
|
171
|
-
|
|
182
|
+
private safeClone;
|
|
172
183
|
/**
|
|
173
|
-
*
|
|
174
|
-
* @returns Promise resolving to alias list response
|
|
184
|
+
* Parse JSON response
|
|
175
185
|
*/
|
|
176
|
-
|
|
186
|
+
private parseResponse;
|
|
177
187
|
/**
|
|
178
|
-
*
|
|
179
|
-
* @param name - Alias name to remove
|
|
180
|
-
* @returns Promise resolving to removal confirmation
|
|
188
|
+
* Handle response errors
|
|
181
189
|
*/
|
|
182
|
-
|
|
190
|
+
private handleResponseError;
|
|
183
191
|
/**
|
|
184
|
-
*
|
|
185
|
-
* @param name - Alias name to check DNS for
|
|
186
|
-
* @returns Promise resolving to confirmation message
|
|
192
|
+
* Handle fetch errors
|
|
187
193
|
*/
|
|
194
|
+
private handleFetchError;
|
|
195
|
+
ping(): Promise<boolean>;
|
|
196
|
+
getPingResponse(): Promise<PingResponse>;
|
|
197
|
+
getConfig(): Promise<ConfigResponse>;
|
|
198
|
+
deploy(files: StaticFile[], options?: ApiDeployOptions): Promise<Deployment>;
|
|
199
|
+
listDeployments(): Promise<DeploymentListResponse>;
|
|
200
|
+
getDeployment(id: string): Promise<Deployment>;
|
|
201
|
+
removeDeployment(id: string): Promise<void>;
|
|
202
|
+
setAlias(name: string, deployment: string): Promise<Alias>;
|
|
203
|
+
getAlias(name: string): Promise<Alias>;
|
|
204
|
+
listAliases(): Promise<AliasListResponse>;
|
|
205
|
+
removeAlias(name: string): Promise<void>;
|
|
188
206
|
checkAlias(name: string): Promise<{
|
|
189
207
|
message: string;
|
|
190
208
|
}>;
|
|
191
|
-
/**
|
|
192
|
-
* Gets account details for the authenticated user
|
|
193
|
-
* @returns Promise resolving to account details
|
|
194
|
-
*/
|
|
195
209
|
getAccount(): Promise<Account>;
|
|
196
|
-
/**
|
|
197
|
-
* Creates a new API key for the authenticated user
|
|
198
|
-
* @returns Promise resolving to the new API key
|
|
199
|
-
*/
|
|
200
|
-
createApiKey(): Promise<{
|
|
201
|
-
apiKey: string;
|
|
202
|
-
}>;
|
|
203
|
-
/**
|
|
204
|
-
* Checks if files represent a SPA structure using AI analysis
|
|
205
|
-
* @param files - Array of StaticFile objects to analyze
|
|
206
|
-
* @returns Promise resolving to boolean indicating if it's a SPA
|
|
207
|
-
*/
|
|
208
210
|
checkSPA(files: StaticFile[]): Promise<boolean>;
|
|
211
|
+
private validateFiles;
|
|
212
|
+
private prepareRequestPayload;
|
|
213
|
+
private createBrowserBody;
|
|
214
|
+
private createNodeBody;
|
|
215
|
+
private getBrowserContentType;
|
|
209
216
|
}
|
|
210
217
|
|
|
211
218
|
/**
|
|
212
|
-
* @file
|
|
219
|
+
* @file Ship SDK resource implementations for deployments, aliases, and accounts.
|
|
213
220
|
*/
|
|
214
221
|
|
|
215
222
|
declare function createDeploymentResource(getApi: () => ApiHttp, clientDefaults?: ShipClientOptions, ensureInit?: () => Promise<void>, processInput?: (input: DeployInput, options: DeploymentOptions) => Promise<StaticFile[]>): DeploymentResource;
|
|
216
223
|
declare function createAliasResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): AliasResource;
|
|
217
224
|
declare function createAccountResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): AccountResource;
|
|
218
|
-
declare function createKeysResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): KeysResource;
|
|
219
225
|
|
|
220
226
|
/**
|
|
221
227
|
* Abstract base class for Ship SDK implementations.
|
|
@@ -230,7 +236,6 @@ declare abstract class Ship$1 {
|
|
|
230
236
|
protected _deployments: DeploymentResource;
|
|
231
237
|
protected _aliases: AliasResource;
|
|
232
238
|
protected _account: AccountResource;
|
|
233
|
-
protected _keys: KeysResource;
|
|
234
239
|
constructor(options?: ShipClientOptions);
|
|
235
240
|
protected abstract resolveInitialConfig(options: ShipClientOptions): any;
|
|
236
241
|
protected abstract loadFullConfig(): Promise<void>;
|
|
@@ -264,9 +269,23 @@ declare abstract class Ship$1 {
|
|
|
264
269
|
*/
|
|
265
270
|
get account(): AccountResource;
|
|
266
271
|
/**
|
|
267
|
-
*
|
|
272
|
+
* Add event listener
|
|
273
|
+
* @param event - Event name
|
|
274
|
+
* @param handler - Event handler function
|
|
275
|
+
*/
|
|
276
|
+
on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
277
|
+
/**
|
|
278
|
+
* Remove event listener
|
|
279
|
+
* @param event - Event name
|
|
280
|
+
* @param handler - Event handler function
|
|
281
|
+
*/
|
|
282
|
+
off<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
283
|
+
/**
|
|
284
|
+
* Replace HTTP client while preserving event listeners
|
|
285
|
+
* Used during initialization to maintain user event subscriptions
|
|
286
|
+
* @protected
|
|
268
287
|
*/
|
|
269
|
-
|
|
288
|
+
protected replaceHttpClient(newClient: ApiHttp): void;
|
|
270
289
|
}
|
|
271
290
|
|
|
272
291
|
/**
|
|
@@ -465,4 +484,4 @@ declare class Ship extends Ship$1 {
|
|
|
465
484
|
protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
|
|
466
485
|
}
|
|
467
486
|
|
|
468
|
-
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,
|
|
487
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _shipstatic_types from '@shipstatic/types';
|
|
2
|
-
import { PingResponse, ConfigResponse, StaticFile, Deployment, DeploymentListResponse, Alias, AliasListResponse, Account, DeployInput, DeploymentResource, AliasResource, AccountResource,
|
|
2
|
+
import { PingResponse, ConfigResponse, StaticFile, Deployment, DeploymentListResponse, Alias, AliasListResponse, Account, DeployInput, DeploymentResource, AliasResource, AccountResource, PlatformConfig } from '@shipstatic/types';
|
|
3
3
|
export * from '@shipstatic/types';
|
|
4
4
|
export { Account, Alias, DEFAULT_API, DeployInput, Deployment, PingResponse, ShipError, ShipErrorType } from '@shipstatic/types';
|
|
5
5
|
|
|
@@ -91,131 +91,137 @@ interface ShipClientOptions {
|
|
|
91
91
|
*/
|
|
92
92
|
timeout?: number | undefined;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Event map for Ship SDK events
|
|
96
|
+
* Core events for observability: request, response, error
|
|
97
|
+
*/
|
|
98
|
+
interface ShipEvents extends Record<string, any[]> {
|
|
99
|
+
/** Emitted before each API request */
|
|
100
|
+
request: [url: string, init: RequestInit];
|
|
101
|
+
/** Emitted after successful API response */
|
|
102
|
+
response: [response: Response, url: string];
|
|
103
|
+
/** Emitted when API request fails */
|
|
104
|
+
error: [error: Error, url: string];
|
|
105
|
+
}
|
|
94
106
|
|
|
95
107
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @internal
|
|
108
|
+
* Event system for Ship SDK
|
|
109
|
+
* Lightweight, reliable event handling with proper error boundaries
|
|
99
110
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Lightweight event system
|
|
114
|
+
* - Add handler: on()
|
|
115
|
+
* - Remove handler: off()
|
|
116
|
+
* - Emit events: emit() [internal]
|
|
117
|
+
* - Transfer events: transfer() [internal]
|
|
118
|
+
* - Reliable error handling and cleanup
|
|
119
|
+
*/
|
|
120
|
+
declare class SimpleEvents {
|
|
121
|
+
private handlers;
|
|
105
122
|
/**
|
|
106
|
-
*
|
|
107
|
-
* @param options - Client options including API host, authentication credentials, and timeout settings.
|
|
123
|
+
* Add event handler
|
|
108
124
|
*/
|
|
109
|
-
|
|
125
|
+
on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
110
126
|
/**
|
|
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).
|
|
127
|
+
* Remove event handler
|
|
115
128
|
*/
|
|
116
|
-
|
|
129
|
+
off<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
117
130
|
/**
|
|
118
|
-
*
|
|
119
|
-
* @
|
|
131
|
+
* Emit event (internal use only)
|
|
132
|
+
* @internal
|
|
120
133
|
*/
|
|
121
|
-
|
|
134
|
+
emit<K extends keyof ShipEvents>(event: K, ...args: ShipEvents[K]): void;
|
|
122
135
|
/**
|
|
123
|
-
*
|
|
124
|
-
* @
|
|
125
|
-
* @throws {ShipError} If the config request fails.
|
|
136
|
+
* Transfer all handlers to another events instance
|
|
137
|
+
* @internal
|
|
126
138
|
*/
|
|
127
|
-
|
|
139
|
+
transfer(target: SimpleEvents): void;
|
|
128
140
|
/**
|
|
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.
|
|
141
|
+
* Clear all handlers (for cleanup)
|
|
142
|
+
* @internal
|
|
140
143
|
*/
|
|
141
|
-
|
|
144
|
+
clear(): void;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @file HTTP client with integrated event system
|
|
149
|
+
* Clean, direct implementation with reliable error handling
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* HTTP client with integrated event system
|
|
154
|
+
* - Direct event integration
|
|
155
|
+
* - Clean inheritance from SimpleEvents
|
|
156
|
+
* - Reliable error handling
|
|
157
|
+
*/
|
|
158
|
+
declare class ApiHttp extends SimpleEvents {
|
|
159
|
+
private readonly apiUrl;
|
|
160
|
+
private readonly apiKey;
|
|
161
|
+
private readonly deployToken;
|
|
162
|
+
constructor(options: ShipClientOptions);
|
|
142
163
|
/**
|
|
143
|
-
*
|
|
144
|
-
* @returns Promise resolving to deployment list response
|
|
164
|
+
* Transfer events to another client (clean intentional API)
|
|
145
165
|
*/
|
|
146
|
-
|
|
166
|
+
transferEventsTo(target: ApiHttp): void;
|
|
147
167
|
/**
|
|
148
|
-
*
|
|
149
|
-
* @param id - Deployment ID to retrieve
|
|
150
|
-
* @returns Promise resolving to deployment details
|
|
168
|
+
* Make authenticated HTTP request with events
|
|
151
169
|
*/
|
|
152
|
-
|
|
170
|
+
private request;
|
|
153
171
|
/**
|
|
154
|
-
*
|
|
155
|
-
* @param id - Deployment ID to remove
|
|
156
|
-
* @returns Promise resolving when removal is complete
|
|
172
|
+
* Generate auth headers
|
|
157
173
|
*/
|
|
158
|
-
|
|
174
|
+
private getAuthHeaders;
|
|
159
175
|
/**
|
|
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
|
|
176
|
+
* Check if credentials are needed
|
|
164
177
|
*/
|
|
165
|
-
|
|
178
|
+
private needsCredentials;
|
|
166
179
|
/**
|
|
167
|
-
*
|
|
168
|
-
* @param name - Alias name to retrieve
|
|
169
|
-
* @returns Promise resolving to alias details
|
|
180
|
+
* Safely clone response for events
|
|
170
181
|
*/
|
|
171
|
-
|
|
182
|
+
private safeClone;
|
|
172
183
|
/**
|
|
173
|
-
*
|
|
174
|
-
* @returns Promise resolving to alias list response
|
|
184
|
+
* Parse JSON response
|
|
175
185
|
*/
|
|
176
|
-
|
|
186
|
+
private parseResponse;
|
|
177
187
|
/**
|
|
178
|
-
*
|
|
179
|
-
* @param name - Alias name to remove
|
|
180
|
-
* @returns Promise resolving to removal confirmation
|
|
188
|
+
* Handle response errors
|
|
181
189
|
*/
|
|
182
|
-
|
|
190
|
+
private handleResponseError;
|
|
183
191
|
/**
|
|
184
|
-
*
|
|
185
|
-
* @param name - Alias name to check DNS for
|
|
186
|
-
* @returns Promise resolving to confirmation message
|
|
192
|
+
* Handle fetch errors
|
|
187
193
|
*/
|
|
194
|
+
private handleFetchError;
|
|
195
|
+
ping(): Promise<boolean>;
|
|
196
|
+
getPingResponse(): Promise<PingResponse>;
|
|
197
|
+
getConfig(): Promise<ConfigResponse>;
|
|
198
|
+
deploy(files: StaticFile[], options?: ApiDeployOptions): Promise<Deployment>;
|
|
199
|
+
listDeployments(): Promise<DeploymentListResponse>;
|
|
200
|
+
getDeployment(id: string): Promise<Deployment>;
|
|
201
|
+
removeDeployment(id: string): Promise<void>;
|
|
202
|
+
setAlias(name: string, deployment: string): Promise<Alias>;
|
|
203
|
+
getAlias(name: string): Promise<Alias>;
|
|
204
|
+
listAliases(): Promise<AliasListResponse>;
|
|
205
|
+
removeAlias(name: string): Promise<void>;
|
|
188
206
|
checkAlias(name: string): Promise<{
|
|
189
207
|
message: string;
|
|
190
208
|
}>;
|
|
191
|
-
/**
|
|
192
|
-
* Gets account details for the authenticated user
|
|
193
|
-
* @returns Promise resolving to account details
|
|
194
|
-
*/
|
|
195
209
|
getAccount(): Promise<Account>;
|
|
196
|
-
/**
|
|
197
|
-
* Creates a new API key for the authenticated user
|
|
198
|
-
* @returns Promise resolving to the new API key
|
|
199
|
-
*/
|
|
200
|
-
createApiKey(): Promise<{
|
|
201
|
-
apiKey: string;
|
|
202
|
-
}>;
|
|
203
|
-
/**
|
|
204
|
-
* Checks if files represent a SPA structure using AI analysis
|
|
205
|
-
* @param files - Array of StaticFile objects to analyze
|
|
206
|
-
* @returns Promise resolving to boolean indicating if it's a SPA
|
|
207
|
-
*/
|
|
208
210
|
checkSPA(files: StaticFile[]): Promise<boolean>;
|
|
211
|
+
private validateFiles;
|
|
212
|
+
private prepareRequestPayload;
|
|
213
|
+
private createBrowserBody;
|
|
214
|
+
private createNodeBody;
|
|
215
|
+
private getBrowserContentType;
|
|
209
216
|
}
|
|
210
217
|
|
|
211
218
|
/**
|
|
212
|
-
* @file
|
|
219
|
+
* @file Ship SDK resource implementations for deployments, aliases, and accounts.
|
|
213
220
|
*/
|
|
214
221
|
|
|
215
222
|
declare function createDeploymentResource(getApi: () => ApiHttp, clientDefaults?: ShipClientOptions, ensureInit?: () => Promise<void>, processInput?: (input: DeployInput, options: DeploymentOptions) => Promise<StaticFile[]>): DeploymentResource;
|
|
216
223
|
declare function createAliasResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): AliasResource;
|
|
217
224
|
declare function createAccountResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): AccountResource;
|
|
218
|
-
declare function createKeysResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): KeysResource;
|
|
219
225
|
|
|
220
226
|
/**
|
|
221
227
|
* Abstract base class for Ship SDK implementations.
|
|
@@ -230,7 +236,6 @@ declare abstract class Ship$1 {
|
|
|
230
236
|
protected _deployments: DeploymentResource;
|
|
231
237
|
protected _aliases: AliasResource;
|
|
232
238
|
protected _account: AccountResource;
|
|
233
|
-
protected _keys: KeysResource;
|
|
234
239
|
constructor(options?: ShipClientOptions);
|
|
235
240
|
protected abstract resolveInitialConfig(options: ShipClientOptions): any;
|
|
236
241
|
protected abstract loadFullConfig(): Promise<void>;
|
|
@@ -264,9 +269,23 @@ declare abstract class Ship$1 {
|
|
|
264
269
|
*/
|
|
265
270
|
get account(): AccountResource;
|
|
266
271
|
/**
|
|
267
|
-
*
|
|
272
|
+
* Add event listener
|
|
273
|
+
* @param event - Event name
|
|
274
|
+
* @param handler - Event handler function
|
|
275
|
+
*/
|
|
276
|
+
on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
277
|
+
/**
|
|
278
|
+
* Remove event listener
|
|
279
|
+
* @param event - Event name
|
|
280
|
+
* @param handler - Event handler function
|
|
281
|
+
*/
|
|
282
|
+
off<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
|
|
283
|
+
/**
|
|
284
|
+
* Replace HTTP client while preserving event listeners
|
|
285
|
+
* Used during initialization to maintain user event subscriptions
|
|
286
|
+
* @protected
|
|
268
287
|
*/
|
|
269
|
-
|
|
288
|
+
protected replaceHttpClient(newClient: ApiHttp): void;
|
|
270
289
|
}
|
|
271
290
|
|
|
272
291
|
/**
|
|
@@ -465,4 +484,4 @@ declare class Ship extends Ship$1 {
|
|
|
465
484
|
protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
|
|
466
485
|
}
|
|
467
486
|
|
|
468
|
-
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,
|
|
487
|
+
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 };
|