@shipstatic/ship 0.3.6 → 0.3.8

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/dist/browser.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _shipstatic_types from '@shipstatic/types';
2
- import { PingResponse, ConfigResponse, StaticFile, Deployment, DeploymentListResponse, Domain, DomainListResponse, Account, TokenCreateResponse, TokenListResponse, DeployInput, DeploymentResource, DomainResource, AccountResource, TokenResource, PlatformConfig } from '@shipstatic/types';
2
+ import { PingResponse, ConfigResponse, StaticFile, Deployment, DeploymentListResponse, Domain, DomainListResponse, Account, TokenCreateResponse, TokenListResponse, CheckoutSession, SubscriptionStatus, SubscriptionSyncResponse, DeployInput, DeploymentResource, DomainResource, AccountResource, TokenResource, SubscriptionResource, PlatformConfig, ValidatableFile, FileValidationResult } from '@shipstatic/types';
3
3
  export * from '@shipstatic/types';
4
- export { Account, DEFAULT_API, DeployInput, Deployment, Domain, PingResponse, ShipError, ShipErrorType } from '@shipstatic/types';
4
+ export { Account, DEFAULT_API, DeployInput, Deployment, Domain, FileValidationStatus as FILE_VALIDATION_STATUS, PingResponse, ShipError, ShipErrorType } from '@shipstatic/types';
5
5
 
6
6
  /**
7
7
  * @file SDK-specific type definitions
@@ -224,6 +224,23 @@ declare class ApiHttp extends SimpleEvents {
224
224
  createToken(ttl?: number, tags?: string[]): Promise<TokenCreateResponse>;
225
225
  listTokens(): Promise<TokenListResponse>;
226
226
  removeToken(token: string): Promise<void>;
227
+ /**
228
+ * Create a Creem checkout session for subscription
229
+ * POST /subscriptions/checkout
230
+ */
231
+ createCheckout(): Promise<CheckoutSession>;
232
+ /**
233
+ * Get current subscription status and usage
234
+ * GET /subscriptions/status
235
+ */
236
+ getSubscriptionStatus(): Promise<SubscriptionStatus>;
237
+ /**
238
+ * Sync subscription ID after checkout redirect
239
+ * POST /subscriptions/sync
240
+ *
241
+ * @param subscriptionId - Subscription ID from Creem redirect URL
242
+ */
243
+ syncSubscription(subscriptionId: string): Promise<SubscriptionSyncResponse>;
227
244
  checkSPA(files: StaticFile[]): Promise<boolean>;
228
245
  private validateFiles;
229
246
  private prepareRequestPayload;
@@ -240,6 +257,7 @@ declare function createDeploymentResource(getApi: () => ApiHttp, clientDefaults?
240
257
  declare function createDomainResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): DomainResource;
241
258
  declare function createAccountResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): AccountResource;
242
259
  declare function createTokenResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): TokenResource;
260
+ declare function createSubscriptionResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): SubscriptionResource;
243
261
 
244
262
  /**
245
263
  * Abstract base class for Ship SDK implementations.
@@ -258,6 +276,7 @@ declare abstract class Ship$1 {
258
276
  protected _domains: DomainResource;
259
277
  protected _account: AccountResource;
260
278
  protected _tokens: TokenResource;
279
+ protected _subscriptions: SubscriptionResource;
261
280
  constructor(options?: ShipClientOptions);
262
281
  protected abstract resolveInitialConfig(options: ShipClientOptions): any;
263
282
  protected abstract loadFullConfig(): Promise<void>;
@@ -294,6 +313,10 @@ declare abstract class Ship$1 {
294
313
  * Get tokens resource
295
314
  */
296
315
  get tokens(): TokenResource;
316
+ /**
317
+ * Get subscriptions resource
318
+ */
319
+ get subscriptions(): SubscriptionResource;
297
320
  /**
298
321
  * Get API configuration (file upload limits, etc.)
299
322
  * Reuses platform config fetched during initialization, then caches the result
@@ -499,50 +522,6 @@ declare function getENV(): ExecutionEnvironment;
499
522
  * Provides client-side validation for file uploads before deployment
500
523
  */
501
524
 
502
- /**
503
- * File status constants for validation state tracking
504
- */
505
- declare const FILE_VALIDATION_STATUS: {
506
- readonly PENDING: "pending";
507
- readonly PROCESSING_ERROR: "processing_error";
508
- readonly EMPTY_FILE: "empty_file";
509
- readonly VALIDATION_FAILED: "validation_failed";
510
- readonly READY: "ready";
511
- };
512
- type FileValidationStatus = (typeof FILE_VALIDATION_STATUS)[keyof typeof FILE_VALIDATION_STATUS];
513
- /**
514
- * Client-side validation error structure
515
- */
516
- interface ValidationError {
517
- error: string;
518
- details: string;
519
- errors: string[];
520
- isClientError: true;
521
- }
522
- /**
523
- * Minimal file interface required for validation
524
- */
525
- interface ValidatableFile {
526
- name: string;
527
- size: number;
528
- type: string;
529
- status?: string;
530
- statusMessage?: string;
531
- }
532
- /**
533
- * File validation result
534
- *
535
- * NOTE: Validation is ATOMIC - if any file fails validation, ALL files are rejected.
536
- * This ensures deployments are all-or-nothing for data integrity.
537
- */
538
- interface FileValidationResult<T extends ValidatableFile> {
539
- /** All files with updated status */
540
- files: T[];
541
- /** Files that passed validation (empty if ANY file failed - atomic validation) */
542
- validFiles: T[];
543
- /** Validation error if any files failed */
544
- error: ValidationError | null;
545
- }
546
525
  /**
547
526
  * Format file size to human-readable string
548
527
  */
@@ -657,4 +636,4 @@ declare class Ship extends Ship$1 {
657
636
  protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
658
637
  }
659
638
 
660
- export { type ApiDeployOptions, ApiHttp, type Config, type DeployFile, type DeploymentOptions, type ExecutionEnvironment, FILE_VALIDATION_STATUS, type FileValidationResult, type FileValidationStatus, JUNK_DIRECTORIES, type MD5Result, type ProgressInfo, Ship, type ShipClientOptions, type ShipEvents, type ValidatableFile, type ValidationError, __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 };
639
+ export { type ApiDeployOptions, ApiHttp, type Config, type DeployFile, type DeploymentOptions, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ProgressInfo, Ship, type ShipClientOptions, type ShipEvents, __setTestEnvironment, allValidFilesReady, calculateMD5, createAccountResource, createDeploymentResource, createDomainResource, createSubscriptionResource, createTokenResource, Ship as default, filterJunk, formatFileSize, getCurrentConfig, getENV, getValidFiles, loadConfig, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForBrowser, resolveConfig, setConfig as setPlatformConfig, validateFiles };