@shipstatic/ship 0.3.6 → 0.3.9

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, 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,21 @@ 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
+ * IMPOSSIBLE SIMPLICITY: No sync endpoint needed!
239
+ * Webhooks are the single source of truth.
240
+ * Frontend just polls getSubscriptionStatus() after checkout redirect.
241
+ */
227
242
  checkSPA(files: StaticFile[]): Promise<boolean>;
228
243
  private validateFiles;
229
244
  private prepareRequestPayload;
@@ -240,6 +255,11 @@ declare function createDeploymentResource(getApi: () => ApiHttp, clientDefaults?
240
255
  declare function createDomainResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): DomainResource;
241
256
  declare function createAccountResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): AccountResource;
242
257
  declare function createTokenResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): TokenResource;
258
+ /**
259
+ * IMPOSSIBLE SIMPLICITY: No sync() method needed!
260
+ * Webhooks are the single source of truth. Frontend just polls status().
261
+ */
262
+ declare function createSubscriptionResource(getApi: () => ApiHttp, ensureInit?: () => Promise<void>): SubscriptionResource;
243
263
 
244
264
  /**
245
265
  * Abstract base class for Ship SDK implementations.
@@ -258,6 +278,7 @@ declare abstract class Ship$1 {
258
278
  protected _domains: DomainResource;
259
279
  protected _account: AccountResource;
260
280
  protected _tokens: TokenResource;
281
+ protected _subscriptions: SubscriptionResource;
261
282
  constructor(options?: ShipClientOptions);
262
283
  protected abstract resolveInitialConfig(options: ShipClientOptions): any;
263
284
  protected abstract loadFullConfig(): Promise<void>;
@@ -294,6 +315,10 @@ declare abstract class Ship$1 {
294
315
  * Get tokens resource
295
316
  */
296
317
  get tokens(): TokenResource;
318
+ /**
319
+ * Get subscriptions resource
320
+ */
321
+ get subscriptions(): SubscriptionResource;
297
322
  /**
298
323
  * Get API configuration (file upload limits, etc.)
299
324
  * Reuses platform config fetched during initialization, then caches the result
@@ -499,50 +524,6 @@ declare function getENV(): ExecutionEnvironment;
499
524
  * Provides client-side validation for file uploads before deployment
500
525
  */
501
526
 
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
527
  /**
547
528
  * Format file size to human-readable string
548
529
  */
@@ -657,4 +638,4 @@ declare class Ship extends Ship$1 {
657
638
  protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
658
639
  }
659
640
 
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 };
641
+ 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 };