@shipstatic/types 0.3.17 → 0.3.19
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/index.d.ts +77 -15
- package/dist/index.js +0 -2
- package/package.json +1 -1
- package/src/index.ts +86 -19
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export interface Deployment {
|
|
|
28
28
|
readonly config?: boolean;
|
|
29
29
|
/** Optional array of tags for categorization and filtering (lowercase, alphanumeric with separators) */
|
|
30
30
|
tags?: string[];
|
|
31
|
+
/** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli') */
|
|
32
|
+
readonly via?: string;
|
|
31
33
|
/** The deployment URL */
|
|
32
34
|
readonly url: string;
|
|
33
35
|
/** Unix timestamp (seconds) when deployment was created */
|
|
@@ -77,8 +79,8 @@ export interface Domain {
|
|
|
77
79
|
readonly created: number;
|
|
78
80
|
/** Whether this was a create (201) or update (200) operation */
|
|
79
81
|
readonly isCreate?: boolean;
|
|
80
|
-
/** Unix timestamp (seconds) when domain was
|
|
81
|
-
|
|
82
|
+
/** Unix timestamp (seconds) when domain was verified */
|
|
83
|
+
verified?: number;
|
|
82
84
|
}
|
|
83
85
|
/**
|
|
84
86
|
* Response for listing domains
|
|
@@ -91,6 +93,48 @@ export interface DomainListResponse {
|
|
|
91
93
|
/** Total number of domains if available */
|
|
92
94
|
total?: number;
|
|
93
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* DNS record types supported for domain configuration
|
|
98
|
+
*/
|
|
99
|
+
export type DnsRecordType = 'A' | 'CNAME';
|
|
100
|
+
/**
|
|
101
|
+
* DNS record required for domain configuration
|
|
102
|
+
*/
|
|
103
|
+
export interface DnsRecord {
|
|
104
|
+
/** Record type (A for apex, CNAME for subdomains) */
|
|
105
|
+
type: DnsRecordType;
|
|
106
|
+
/** The DNS name to configure */
|
|
107
|
+
name: string;
|
|
108
|
+
/** The value to set (IP for A, hostname for CNAME) */
|
|
109
|
+
value: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* DNS provider information for a domain
|
|
113
|
+
*/
|
|
114
|
+
export interface DnsProvider {
|
|
115
|
+
/** Provider name (e.g., "Cloudflare", "GoDaddy") */
|
|
116
|
+
name?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Response for domain DNS provider lookup
|
|
120
|
+
*/
|
|
121
|
+
export interface DomainDnsResponse {
|
|
122
|
+
/** The domain name */
|
|
123
|
+
domain: string;
|
|
124
|
+
/** DNS provider information, null if not yet looked up */
|
|
125
|
+
dns: {
|
|
126
|
+
provider?: DnsProvider;
|
|
127
|
+
} | null;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Response for domain DNS records
|
|
131
|
+
*/
|
|
132
|
+
export interface DomainRecordsResponse {
|
|
133
|
+
/** The domain name */
|
|
134
|
+
domain: string;
|
|
135
|
+
/** Required DNS records for configuration */
|
|
136
|
+
records: DnsRecord[];
|
|
137
|
+
}
|
|
94
138
|
/**
|
|
95
139
|
* Response for deployment removal
|
|
96
140
|
*/
|
|
@@ -214,8 +258,6 @@ export declare enum ErrorType {
|
|
|
214
258
|
/** Configuration error */
|
|
215
259
|
Config = "config_error"
|
|
216
260
|
}
|
|
217
|
-
/** @deprecated Use ErrorType instead. Kept for backward compatibility. */
|
|
218
|
-
export declare const ShipErrorType: typeof ErrorType;
|
|
219
261
|
/**
|
|
220
262
|
* Standard error response format used everywhere
|
|
221
263
|
*/
|
|
@@ -385,6 +427,32 @@ export interface PlatformConfig {
|
|
|
385
427
|
deployToken?: string;
|
|
386
428
|
apiKey?: string;
|
|
387
429
|
}
|
|
430
|
+
/**
|
|
431
|
+
* Resolved configuration with required apiUrl.
|
|
432
|
+
* This is the normalized config after merging options, env, and config files.
|
|
433
|
+
*/
|
|
434
|
+
export interface ResolvedConfig {
|
|
435
|
+
/** API URL (always present after resolution, defaults to DEFAULT_API) */
|
|
436
|
+
apiUrl: string;
|
|
437
|
+
/** API key for authenticated deployments */
|
|
438
|
+
apiKey?: string;
|
|
439
|
+
/** Deploy token for single-use deployments */
|
|
440
|
+
deployToken?: string;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Progress information for deploy/upload operations.
|
|
444
|
+
* Provides consistent percentage-based progress with byte-level details.
|
|
445
|
+
*/
|
|
446
|
+
export interface ProgressInfo {
|
|
447
|
+
/** Progress percentage (0-100) */
|
|
448
|
+
percent: number;
|
|
449
|
+
/** Number of bytes loaded so far */
|
|
450
|
+
loaded: number;
|
|
451
|
+
/** Total number of bytes to load. May be 0 if unknown initially */
|
|
452
|
+
total: number;
|
|
453
|
+
/** Current file being processed (optional) */
|
|
454
|
+
file?: string;
|
|
455
|
+
}
|
|
388
456
|
/** Default API URL if not otherwise configured. */
|
|
389
457
|
export declare const DEFAULT_API = "https://api.shipstatic.com";
|
|
390
458
|
/**
|
|
@@ -411,17 +479,11 @@ export interface DomainResource {
|
|
|
411
479
|
get: (domainName: string) => Promise<Domain>;
|
|
412
480
|
list: () => Promise<DomainListResponse>;
|
|
413
481
|
remove: (domainName: string) => Promise<void>;
|
|
414
|
-
|
|
482
|
+
verify: (domainName: string) => Promise<{
|
|
415
483
|
message: string;
|
|
416
484
|
}>;
|
|
417
|
-
dns: (domainName: string) => Promise<
|
|
418
|
-
|
|
419
|
-
dns: any;
|
|
420
|
-
}>;
|
|
421
|
-
records: (domainName: string) => Promise<{
|
|
422
|
-
domain: string;
|
|
423
|
-
records: any[];
|
|
424
|
-
}>;
|
|
485
|
+
dns: (domainName: string) => Promise<DomainDnsResponse>;
|
|
486
|
+
records: (domainName: string) => Promise<DomainRecordsResponse>;
|
|
425
487
|
share: (domainName: string) => Promise<{
|
|
426
488
|
domain: string;
|
|
427
489
|
hash: string;
|
|
@@ -497,11 +559,11 @@ export interface KeysResource {
|
|
|
497
559
|
/**
|
|
498
560
|
* All activity event types logged in the system
|
|
499
561
|
*/
|
|
500
|
-
export type ActivityEvent = 'account_create' | 'account_update' | 'account_delete' | 'account_key_generate' | 'account_plan_paid' | 'account_plan_transition' | 'account_suspended' | 'deployment_create' | 'deployment_delete' | 'deployment_claim' | 'domain_create' | 'domain_update' | 'domain_delete' | 'domain_set' | '
|
|
562
|
+
export type ActivityEvent = 'account_create' | 'account_update' | 'account_delete' | 'account_key_generate' | 'account_plan_paid' | 'account_plan_transition' | 'account_suspended' | 'deployment_create' | 'deployment_delete' | 'deployment_claim' | 'domain_create' | 'domain_update' | 'domain_delete' | 'domain_set' | 'domain_verify' | 'token_create' | 'token_consume' | 'admin_account_plan_update' | 'admin_account_ref_update' | 'admin_account_billing_update' | 'admin_account_tags_update' | 'admin_deployment_delete' | 'admin_domain_delete' | 'billing_suspended' | 'billing_active' | 'billing_canceled' | 'billing_paused' | 'billing_expired' | 'billing_paid' | 'billing_trialing' | 'billing_scheduled_cancel' | 'billing_unpaid' | 'billing_update' | 'billing_past_due' | 'billing_terminated' | 'billing_manual_sync' | 'refund_created' | 'dispute_created';
|
|
501
563
|
/**
|
|
502
564
|
* Activity events visible to users in the dashboard
|
|
503
565
|
*/
|
|
504
|
-
export type UserVisibleActivityEvent = 'account_create' | 'account_update' | 'account_delete' | 'account_key_generate' | 'account_plan_transition' | 'deployment_create' | 'deployment_delete' | 'deployment_claim' | 'domain_create' | 'domain_update' | 'domain_delete' | 'domain_set' | '
|
|
566
|
+
export type UserVisibleActivityEvent = 'account_create' | 'account_update' | 'account_delete' | 'account_key_generate' | 'account_plan_transition' | 'deployment_create' | 'deployment_delete' | 'deployment_claim' | 'domain_create' | 'domain_update' | 'domain_delete' | 'domain_set' | 'domain_verify' | 'token_create' | 'token_consume';
|
|
505
567
|
/**
|
|
506
568
|
* Activity record returned from the API
|
|
507
569
|
*/
|
package/dist/index.js
CHANGED
|
@@ -70,8 +70,6 @@ export var ErrorType;
|
|
|
70
70
|
/** Configuration error */
|
|
71
71
|
ErrorType["Config"] = "config_error";
|
|
72
72
|
})(ErrorType || (ErrorType = {}));
|
|
73
|
-
/** @deprecated Use ErrorType instead. Kept for backward compatibility. */
|
|
74
|
-
export const ShipErrorType = ErrorType;
|
|
75
73
|
/**
|
|
76
74
|
* Categorizes error types for better type checking
|
|
77
75
|
*/
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -35,6 +35,8 @@ export interface Deployment {
|
|
|
35
35
|
readonly config?: boolean;
|
|
36
36
|
/** Optional array of tags for categorization and filtering (lowercase, alphanumeric with separators) */
|
|
37
37
|
tags?: string[];
|
|
38
|
+
/** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli') */
|
|
39
|
+
readonly via?: string;
|
|
38
40
|
/** The deployment URL */
|
|
39
41
|
readonly url: string;
|
|
40
42
|
/** Unix timestamp (seconds) when deployment was created */
|
|
@@ -93,8 +95,8 @@ export interface Domain {
|
|
|
93
95
|
readonly created: number;
|
|
94
96
|
/** Whether this was a create (201) or update (200) operation */
|
|
95
97
|
readonly isCreate?: boolean;
|
|
96
|
-
/** Unix timestamp (seconds) when domain was
|
|
97
|
-
|
|
98
|
+
/** Unix timestamp (seconds) when domain was verified */
|
|
99
|
+
verified?: number; // Mutable - can be updated
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
@@ -109,6 +111,51 @@ export interface DomainListResponse {
|
|
|
109
111
|
total?: number;
|
|
110
112
|
}
|
|
111
113
|
|
|
114
|
+
/**
|
|
115
|
+
* DNS record types supported for domain configuration
|
|
116
|
+
*/
|
|
117
|
+
export type DnsRecordType = 'A' | 'CNAME';
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* DNS record required for domain configuration
|
|
121
|
+
*/
|
|
122
|
+
export interface DnsRecord {
|
|
123
|
+
/** Record type (A for apex, CNAME for subdomains) */
|
|
124
|
+
type: DnsRecordType;
|
|
125
|
+
/** The DNS name to configure */
|
|
126
|
+
name: string;
|
|
127
|
+
/** The value to set (IP for A, hostname for CNAME) */
|
|
128
|
+
value: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* DNS provider information for a domain
|
|
133
|
+
*/
|
|
134
|
+
export interface DnsProvider {
|
|
135
|
+
/** Provider name (e.g., "Cloudflare", "GoDaddy") */
|
|
136
|
+
name?: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Response for domain DNS provider lookup
|
|
141
|
+
*/
|
|
142
|
+
export interface DomainDnsResponse {
|
|
143
|
+
/** The domain name */
|
|
144
|
+
domain: string;
|
|
145
|
+
/** DNS provider information, null if not yet looked up */
|
|
146
|
+
dns: { provider?: DnsProvider } | null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Response for domain DNS records
|
|
151
|
+
*/
|
|
152
|
+
export interface DomainRecordsResponse {
|
|
153
|
+
/** The domain name */
|
|
154
|
+
domain: string;
|
|
155
|
+
/** Required DNS records for configuration */
|
|
156
|
+
records: DnsRecord[];
|
|
157
|
+
}
|
|
158
|
+
|
|
112
159
|
/**
|
|
113
160
|
* Response for deployment removal
|
|
114
161
|
*/
|
|
@@ -253,9 +300,6 @@ export enum ErrorType {
|
|
|
253
300
|
Config = "config_error"
|
|
254
301
|
}
|
|
255
302
|
|
|
256
|
-
/** @deprecated Use ErrorType instead. Kept for backward compatibility. */
|
|
257
|
-
export const ShipErrorType = ErrorType;
|
|
258
|
-
|
|
259
303
|
/**
|
|
260
304
|
* Categorizes error types for better type checking
|
|
261
305
|
*/
|
|
@@ -331,7 +375,6 @@ export class ShipError extends Error {
|
|
|
331
375
|
return new ShipError(ErrorType.Authentication, message, 401, details);
|
|
332
376
|
}
|
|
333
377
|
|
|
334
|
-
|
|
335
378
|
static business(message: string, status: number = 400): ShipError {
|
|
336
379
|
return new ShipError(ErrorType.Business, message, status);
|
|
337
380
|
}
|
|
@@ -404,13 +447,6 @@ export class ShipError extends Error {
|
|
|
404
447
|
}
|
|
405
448
|
}
|
|
406
449
|
|
|
407
|
-
// =============================================================================
|
|
408
|
-
// CONFIGURATION CONSTANTS
|
|
409
|
-
// =============================================================================
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
450
|
// =============================================================================
|
|
415
451
|
// CONFIG TYPES
|
|
416
452
|
// =============================================================================
|
|
@@ -453,7 +489,6 @@ export interface PingResponse {
|
|
|
453
489
|
timestamp?: number;
|
|
454
490
|
}
|
|
455
491
|
|
|
456
|
-
|
|
457
492
|
// API Key Configuration
|
|
458
493
|
export const API_KEY_PREFIX = 'ship-';
|
|
459
494
|
export const API_KEY_HEX_LENGTH = 64;
|
|
@@ -628,6 +663,38 @@ export interface PlatformConfig {
|
|
|
628
663
|
apiKey?: string;
|
|
629
664
|
}
|
|
630
665
|
|
|
666
|
+
/**
|
|
667
|
+
* Resolved configuration with required apiUrl.
|
|
668
|
+
* This is the normalized config after merging options, env, and config files.
|
|
669
|
+
*/
|
|
670
|
+
export interface ResolvedConfig {
|
|
671
|
+
/** API URL (always present after resolution, defaults to DEFAULT_API) */
|
|
672
|
+
apiUrl: string;
|
|
673
|
+
/** API key for authenticated deployments */
|
|
674
|
+
apiKey?: string;
|
|
675
|
+
/** Deploy token for single-use deployments */
|
|
676
|
+
deployToken?: string;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// =============================================================================
|
|
680
|
+
// PROGRESS TRACKING
|
|
681
|
+
// =============================================================================
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Progress information for deploy/upload operations.
|
|
685
|
+
* Provides consistent percentage-based progress with byte-level details.
|
|
686
|
+
*/
|
|
687
|
+
export interface ProgressInfo {
|
|
688
|
+
/** Progress percentage (0-100) */
|
|
689
|
+
percent: number;
|
|
690
|
+
/** Number of bytes loaded so far */
|
|
691
|
+
loaded: number;
|
|
692
|
+
/** Total number of bytes to load. May be 0 if unknown initially */
|
|
693
|
+
total: number;
|
|
694
|
+
/** Current file being processed (optional) */
|
|
695
|
+
file?: string;
|
|
696
|
+
}
|
|
697
|
+
|
|
631
698
|
// =============================================================================
|
|
632
699
|
// PLATFORM CONSTANTS
|
|
633
700
|
// =============================================================================
|
|
@@ -665,9 +732,9 @@ export interface DomainResource {
|
|
|
665
732
|
get: (domainName: string) => Promise<Domain>;
|
|
666
733
|
list: () => Promise<DomainListResponse>;
|
|
667
734
|
remove: (domainName: string) => Promise<void>;
|
|
668
|
-
|
|
669
|
-
dns: (domainName: string) => Promise<
|
|
670
|
-
records: (domainName: string) => Promise<
|
|
735
|
+
verify: (domainName: string) => Promise<{ message: string }>;
|
|
736
|
+
dns: (domainName: string) => Promise<DomainDnsResponse>;
|
|
737
|
+
records: (domainName: string) => Promise<DomainRecordsResponse>;
|
|
671
738
|
share: (domainName: string) => Promise<{ domain: string; hash: string }>;
|
|
672
739
|
}
|
|
673
740
|
|
|
@@ -774,7 +841,7 @@ export type ActivityEvent =
|
|
|
774
841
|
| 'domain_update'
|
|
775
842
|
| 'domain_delete'
|
|
776
843
|
| 'domain_set'
|
|
777
|
-
| '
|
|
844
|
+
| 'domain_verify'
|
|
778
845
|
// Token events
|
|
779
846
|
| 'token_create'
|
|
780
847
|
| 'token_consume'
|
|
@@ -818,7 +885,7 @@ export type UserVisibleActivityEvent =
|
|
|
818
885
|
| 'domain_update'
|
|
819
886
|
| 'domain_delete'
|
|
820
887
|
| 'domain_set'
|
|
821
|
-
| '
|
|
888
|
+
| 'domain_verify'
|
|
822
889
|
| 'token_create'
|
|
823
890
|
| 'token_consume';
|
|
824
891
|
|