@shipstatic/ship 0.4.8 → 0.4.10

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 CHANGED
@@ -179,12 +179,12 @@ ship.on('error', (error, url) => console.error(error));
179
179
  ### Error Handling
180
180
 
181
181
  ```javascript
182
- import { ShipError } from '@shipstatic/ship';
182
+ import { isShipError } from '@shipstatic/types';
183
183
 
184
184
  try {
185
185
  await ship.deployments.create('./dist');
186
186
  } catch (error) {
187
- if (error instanceof ShipError) {
187
+ if (isShipError(error)) {
188
188
  if (error.isAuthError()) { /* ... */ }
189
189
  if (error.isValidationError()) { /* ... */ }
190
190
  if (error.isNetworkError()) { /* ... */ }
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _shipstatic_types from '@shipstatic/types';
2
- import { ProgressInfo, StaticFile, Deployment, DeploymentListResponse, Domain, DomainListResponse, DomainDnsResponse, DomainRecordsResponse, TokenCreateResponse, TokenListResponse, Account, ConfigResponse, PingResponse, PlatformConfig, ResolvedConfig, DeployInput, AccountResource, DeploymentResource, DomainResource, TokenResource, ValidatableFile, FileValidationResult, ShipError } from '@shipstatic/types';
2
+ import { ProgressInfo, StaticFile, Deployment, DeploymentListResponse, Domain, DomainListResponse, DomainDnsResponse, DomainRecordsResponse, TokenCreateResponse, TokenListResponse, Account, ConfigResponse, PingResponse, PlatformConfig, ResolvedConfig, DeployInput, AccountResource, DeploymentResource, DomainResource, TokenResource, ValidatableFile, FileValidationResult } from '@shipstatic/types';
3
3
  export * from '@shipstatic/types';
4
4
  export { Account, AccountResource, DEFAULT_API, DeployInput, Deployment, DeploymentResource, Domain, DomainResource, ErrorType, FileValidationStatus as FILE_VALIDATION_STATUS, PingResponse, ResolvedConfig, ShipError, StaticFile, TokenResource } from '@shipstatic/types';
5
5
 
@@ -208,6 +208,11 @@ declare class ApiHttp extends SimpleEvents {
208
208
  domain: string;
209
209
  hash: string;
210
210
  }>;
211
+ validateDomain(name: string): Promise<{
212
+ valid: boolean;
213
+ normalized?: string;
214
+ error?: string;
215
+ }>;
211
216
  createToken(ttl?: number, tags?: string[]): Promise<TokenCreateResponse>;
212
217
  listTokens(): Promise<TokenListResponse>;
213
218
  removeToken(token: string): Promise<void>;
@@ -565,26 +570,6 @@ declare function getValidFiles<T extends ValidatableFile>(files: T[]): T[];
565
570
  */
566
571
  declare function allValidFilesReady<T extends ValidatableFile>(files: T[]): boolean;
567
572
 
568
- /**
569
- * @file Error utilities for consistent error handling across SDK consumers.
570
- */
571
-
572
- /**
573
- * Ensure any error is wrapped as a ShipError.
574
- * Useful for catch blocks where the error type is unknown.
575
- *
576
- * @example
577
- * ```ts
578
- * try {
579
- * await someOperation();
580
- * } catch (err) {
581
- * const shipError = ensureShipError(err);
582
- * // Now you can safely use shipError.message, shipError.type, etc.
583
- * }
584
- * ```
585
- */
586
- declare function ensureShipError(err: unknown): ShipError;
587
-
588
573
  /**
589
574
  * @file Platform configuration management for the Ship SDK.
590
575
  * Implements fail-fast dynamic configuration with mandatory API fetch.
@@ -649,4 +634,4 @@ declare class Ship extends Ship$1 {
649
634
  protected getDeployBodyCreator(): DeployBodyCreator;
650
635
  }
651
636
 
652
- export { type ApiDeployOptions, ApiHttp, type ApiHttpOptions, type DeployBody, type DeployBodyCreator, type DeployFile, type DeploymentOptions, type DeploymentResourceContext, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ResourceContext, Ship, type ShipClientOptions, type ShipEvents, __setTestEnvironment, allValidFilesReady, calculateMD5, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, ensureShipError, filterJunk, formatFileSize, getCurrentConfig, getENV, getValidFiles, loadConfig, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForBrowser, resolveConfig, setConfig as setPlatformConfig, validateFiles };
637
+ export { type ApiDeployOptions, ApiHttp, type ApiHttpOptions, type DeployBody, type DeployBodyCreator, type DeployFile, type DeploymentOptions, type DeploymentResourceContext, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ResourceContext, Ship, type ShipClientOptions, type ShipEvents, __setTestEnvironment, allValidFilesReady, calculateMD5, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, filterJunk, formatFileSize, getCurrentConfig, getENV, getValidFiles, loadConfig, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForBrowser, resolveConfig, setConfig as setPlatformConfig, validateFiles };