@shipstatic/types 0.2.8 → 0.3.0
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 +80 -33
- package/dist/index.js +10 -10
- package/package.json +1 -1
- package/src/index.ts +92 -37
package/dist/index.d.ts
CHANGED
|
@@ -51,45 +51,45 @@ export interface DeploymentListResponse {
|
|
|
51
51
|
total?: number;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Domain status constants
|
|
55
55
|
*/
|
|
56
|
-
export declare const
|
|
56
|
+
export declare const DomainStatus: {
|
|
57
57
|
readonly PENDING: "pending";
|
|
58
58
|
readonly PARTIAL: "partial";
|
|
59
59
|
readonly CONFIRMED: "confirmed";
|
|
60
60
|
readonly FAILED: "failed";
|
|
61
61
|
};
|
|
62
|
-
export type
|
|
62
|
+
export type DomainStatusType = typeof DomainStatus[keyof typeof DomainStatus];
|
|
63
63
|
/**
|
|
64
|
-
* Core
|
|
64
|
+
* Core domain object - used in both API responses and SDK
|
|
65
65
|
*/
|
|
66
|
-
export interface
|
|
67
|
-
/** The
|
|
68
|
-
readonly
|
|
69
|
-
/** The deployment name this
|
|
66
|
+
export interface Domain {
|
|
67
|
+
/** The domain name */
|
|
68
|
+
readonly domain: string;
|
|
69
|
+
/** The deployment name this domain points to */
|
|
70
70
|
deployment: string;
|
|
71
|
-
/** Current
|
|
72
|
-
status:
|
|
71
|
+
/** Current domain status */
|
|
72
|
+
status: DomainStatusType;
|
|
73
73
|
/** Optional array of tags for categorization and filtering (lowercase, alphanumeric with separators) */
|
|
74
74
|
tags?: string[];
|
|
75
|
-
/** The
|
|
75
|
+
/** The domain URL - internal (subdomain) or external (custom domain) */
|
|
76
76
|
readonly url: string;
|
|
77
|
-
/** Unix timestamp (seconds) when
|
|
77
|
+
/** Unix timestamp (seconds) when domain was created */
|
|
78
78
|
readonly created: number;
|
|
79
79
|
/** Whether this was a create (201) or update (200) operation */
|
|
80
80
|
readonly isCreate?: boolean;
|
|
81
|
-
/** Unix timestamp (seconds) when
|
|
81
|
+
/** Unix timestamp (seconds) when domain was confirmed */
|
|
82
82
|
confirmed?: number;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* Response for listing
|
|
85
|
+
* Response for listing domains
|
|
86
86
|
*/
|
|
87
|
-
export interface
|
|
88
|
-
/** Array of
|
|
89
|
-
|
|
87
|
+
export interface DomainListResponse {
|
|
88
|
+
/** Array of domains */
|
|
89
|
+
domains: Domain[];
|
|
90
90
|
/** Optional cursor for pagination */
|
|
91
91
|
cursor?: string;
|
|
92
|
-
/** Total number of
|
|
92
|
+
/** Total number of domains if available */
|
|
93
93
|
total?: number;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
@@ -103,6 +103,45 @@ export interface DeploymentRemoveResponse {
|
|
|
103
103
|
/** Human-readable message */
|
|
104
104
|
message?: string;
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Deployment token for automated deployments
|
|
108
|
+
*/
|
|
109
|
+
export interface Token {
|
|
110
|
+
/** The token hash (not the actual token value) */
|
|
111
|
+
readonly token: string;
|
|
112
|
+
/** The account this token belongs to */
|
|
113
|
+
readonly account: string;
|
|
114
|
+
/** Optional IP address binding for security */
|
|
115
|
+
readonly ip?: string;
|
|
116
|
+
/** Optional array of tags for categorization and filtering (lowercase, alphanumeric with separators) */
|
|
117
|
+
tags?: string[];
|
|
118
|
+
/** Unix timestamp (seconds) when token was created */
|
|
119
|
+
readonly created: number;
|
|
120
|
+
/** Unix timestamp (seconds) when token expires, or null for never */
|
|
121
|
+
readonly expires?: number;
|
|
122
|
+
/** Unix timestamp (seconds) when token was last used */
|
|
123
|
+
readonly used?: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Response for listing tokens
|
|
127
|
+
*/
|
|
128
|
+
export interface TokenListResponse {
|
|
129
|
+
/** Array of tokens */
|
|
130
|
+
tokens: Token[];
|
|
131
|
+
/** Total count of tokens */
|
|
132
|
+
count?: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Response for token creation
|
|
136
|
+
*/
|
|
137
|
+
export interface TokenCreateResponse {
|
|
138
|
+
/** The actual token value (only returned on creation) */
|
|
139
|
+
token: string;
|
|
140
|
+
/** Unix timestamp (seconds) when token expires, or null for never */
|
|
141
|
+
expires?: number;
|
|
142
|
+
/** Success message */
|
|
143
|
+
message?: string;
|
|
144
|
+
}
|
|
106
145
|
/**
|
|
107
146
|
* Account plan constants
|
|
108
147
|
*/
|
|
@@ -343,26 +382,26 @@ export interface DeploymentResource {
|
|
|
343
382
|
get: (id: string) => Promise<Deployment>;
|
|
344
383
|
}
|
|
345
384
|
/**
|
|
346
|
-
*
|
|
385
|
+
* Domain resource interface - the contract all implementations must follow
|
|
347
386
|
*/
|
|
348
|
-
export interface
|
|
349
|
-
set: (
|
|
350
|
-
get: (
|
|
351
|
-
list: () => Promise<
|
|
352
|
-
remove: (
|
|
353
|
-
confirm: (
|
|
387
|
+
export interface DomainResource {
|
|
388
|
+
set: (domainName: string, deployment: string, tags?: string[]) => Promise<Domain>;
|
|
389
|
+
get: (domainName: string) => Promise<Domain>;
|
|
390
|
+
list: () => Promise<DomainListResponse>;
|
|
391
|
+
remove: (domainName: string) => Promise<void>;
|
|
392
|
+
confirm: (domainName: string) => Promise<{
|
|
354
393
|
message: string;
|
|
355
394
|
}>;
|
|
356
|
-
dns: (
|
|
357
|
-
|
|
395
|
+
dns: (domainName: string) => Promise<{
|
|
396
|
+
domain: string;
|
|
358
397
|
dns: any;
|
|
359
398
|
}>;
|
|
360
|
-
records: (
|
|
361
|
-
|
|
399
|
+
records: (domainName: string) => Promise<{
|
|
400
|
+
domain: string;
|
|
362
401
|
records: any[];
|
|
363
402
|
}>;
|
|
364
|
-
share: (
|
|
365
|
-
|
|
403
|
+
share: (domainName: string) => Promise<{
|
|
404
|
+
domain: string;
|
|
366
405
|
hash: string;
|
|
367
406
|
}>;
|
|
368
407
|
}
|
|
@@ -372,6 +411,14 @@ export interface AliasResource {
|
|
|
372
411
|
export interface AccountResource {
|
|
373
412
|
get: () => Promise<Account>;
|
|
374
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Token resource interface - the contract all implementations must follow
|
|
416
|
+
*/
|
|
417
|
+
export interface TokenResource {
|
|
418
|
+
create: (ttl?: number, tags?: string[]) => Promise<TokenCreateResponse>;
|
|
419
|
+
list: () => Promise<TokenListResponse>;
|
|
420
|
+
remove: (token: string) => Promise<void>;
|
|
421
|
+
}
|
|
375
422
|
/**
|
|
376
423
|
* Keys resource interface - the contract all implementations must follow
|
|
377
424
|
*/
|
|
@@ -401,6 +448,6 @@ export interface RateLimitData {
|
|
|
401
448
|
*/
|
|
402
449
|
export declare function generateDeploymentUrl(deployment: string, sitesDomain?: string): string;
|
|
403
450
|
/**
|
|
404
|
-
* Generate
|
|
451
|
+
* Generate domain URL based on whether it's internal (subdomain) or external (custom domain)
|
|
405
452
|
*/
|
|
406
|
-
export declare function
|
|
453
|
+
export declare function generateDomainUrl(domain: string, sitesDomain?: string): string;
|
package/dist/index.js
CHANGED
|
@@ -15,12 +15,12 @@ export const DeploymentStatus = {
|
|
|
15
15
|
DELETING: 'deleting'
|
|
16
16
|
};
|
|
17
17
|
// =============================================================================
|
|
18
|
-
//
|
|
18
|
+
// DOMAIN TYPES
|
|
19
19
|
// =============================================================================
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Domain status constants
|
|
22
22
|
*/
|
|
23
|
-
export const
|
|
23
|
+
export const DomainStatus = {
|
|
24
24
|
PENDING: 'pending',
|
|
25
25
|
PARTIAL: 'partial',
|
|
26
26
|
CONFIRMED: 'confirmed',
|
|
@@ -275,14 +275,14 @@ export function generateDeploymentUrl(deployment, sitesDomain) {
|
|
|
275
275
|
return `https://${deployment}.${domain}`;
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
|
-
* Generate
|
|
278
|
+
* Generate domain URL based on whether it's internal (subdomain) or external (custom domain)
|
|
279
279
|
*/
|
|
280
|
-
export function
|
|
281
|
-
// If
|
|
282
|
-
if (
|
|
283
|
-
return `https://${
|
|
280
|
+
export function generateDomainUrl(domain, sitesDomain) {
|
|
281
|
+
// If domain contains dots, it's an external domain
|
|
282
|
+
if (domain.includes('.')) {
|
|
283
|
+
return `https://${domain}`;
|
|
284
284
|
}
|
|
285
285
|
// Otherwise it's an internal subdomain
|
|
286
|
-
const
|
|
287
|
-
return `https://${
|
|
286
|
+
const siteDomain = sitesDomain || 'statichost.dev';
|
|
287
|
+
return `https://${domain}.${siteDomain}`;
|
|
288
288
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -61,52 +61,52 @@ export interface DeploymentListResponse {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// =============================================================================
|
|
64
|
-
//
|
|
64
|
+
// DOMAIN TYPES
|
|
65
65
|
// =============================================================================
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* Domain status constants
|
|
69
69
|
*/
|
|
70
|
-
export const
|
|
70
|
+
export const DomainStatus = {
|
|
71
71
|
PENDING: 'pending',
|
|
72
72
|
PARTIAL: 'partial',
|
|
73
73
|
CONFIRMED: 'confirmed',
|
|
74
74
|
FAILED: 'failed'
|
|
75
75
|
} as const;
|
|
76
76
|
|
|
77
|
-
export type
|
|
77
|
+
export type DomainStatusType = typeof DomainStatus[keyof typeof DomainStatus];
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* Core
|
|
80
|
+
* Core domain object - used in both API responses and SDK
|
|
81
81
|
*/
|
|
82
|
-
export interface
|
|
83
|
-
/** The
|
|
84
|
-
readonly
|
|
85
|
-
/** The deployment name this
|
|
82
|
+
export interface Domain {
|
|
83
|
+
/** The domain name */
|
|
84
|
+
readonly domain: string;
|
|
85
|
+
/** The deployment name this domain points to */
|
|
86
86
|
deployment: string; // Mutable - can be updated to point to different deployment
|
|
87
|
-
/** Current
|
|
88
|
-
status:
|
|
87
|
+
/** Current domain status */
|
|
88
|
+
status: DomainStatusType; // Mutable - can be updated
|
|
89
89
|
/** Optional array of tags for categorization and filtering (lowercase, alphanumeric with separators) */
|
|
90
90
|
tags?: string[];
|
|
91
|
-
/** The
|
|
91
|
+
/** The domain URL - internal (subdomain) or external (custom domain) */
|
|
92
92
|
readonly url: string;
|
|
93
|
-
/** Unix timestamp (seconds) when
|
|
93
|
+
/** Unix timestamp (seconds) when domain was created */
|
|
94
94
|
readonly created: number;
|
|
95
95
|
/** Whether this was a create (201) or update (200) operation */
|
|
96
96
|
readonly isCreate?: boolean;
|
|
97
|
-
/** Unix timestamp (seconds) when
|
|
97
|
+
/** Unix timestamp (seconds) when domain was confirmed */
|
|
98
98
|
confirmed?: number; // Mutable - can be updated
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
* Response for listing
|
|
102
|
+
* Response for listing domains
|
|
103
103
|
*/
|
|
104
|
-
export interface
|
|
105
|
-
/** Array of
|
|
106
|
-
|
|
104
|
+
export interface DomainListResponse {
|
|
105
|
+
/** Array of domains */
|
|
106
|
+
domains: Domain[];
|
|
107
107
|
/** Optional cursor for pagination */
|
|
108
108
|
cursor?: string;
|
|
109
|
-
/** Total number of
|
|
109
|
+
/** Total number of domains if available */
|
|
110
110
|
total?: number;
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -122,6 +122,52 @@ export interface DeploymentRemoveResponse {
|
|
|
122
122
|
message?: string;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
// =============================================================================
|
|
126
|
+
// TOKEN TYPES
|
|
127
|
+
// =============================================================================
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Deployment token for automated deployments
|
|
131
|
+
*/
|
|
132
|
+
export interface Token {
|
|
133
|
+
/** The token hash (not the actual token value) */
|
|
134
|
+
readonly token: string;
|
|
135
|
+
/** The account this token belongs to */
|
|
136
|
+
readonly account: string;
|
|
137
|
+
/** Optional IP address binding for security */
|
|
138
|
+
readonly ip?: string;
|
|
139
|
+
/** Optional array of tags for categorization and filtering (lowercase, alphanumeric with separators) */
|
|
140
|
+
tags?: string[];
|
|
141
|
+
/** Unix timestamp (seconds) when token was created */
|
|
142
|
+
readonly created: number;
|
|
143
|
+
/** Unix timestamp (seconds) when token expires, or null for never */
|
|
144
|
+
readonly expires?: number;
|
|
145
|
+
/** Unix timestamp (seconds) when token was last used */
|
|
146
|
+
readonly used?: number;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Response for listing tokens
|
|
151
|
+
*/
|
|
152
|
+
export interface TokenListResponse {
|
|
153
|
+
/** Array of tokens */
|
|
154
|
+
tokens: Token[];
|
|
155
|
+
/** Total count of tokens */
|
|
156
|
+
count?: number;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Response for token creation
|
|
161
|
+
*/
|
|
162
|
+
export interface TokenCreateResponse {
|
|
163
|
+
/** The actual token value (only returned on creation) */
|
|
164
|
+
token: string;
|
|
165
|
+
/** Unix timestamp (seconds) when token expires, or null for never */
|
|
166
|
+
expires?: number;
|
|
167
|
+
/** Success message */
|
|
168
|
+
message?: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
125
171
|
// =============================================================================
|
|
126
172
|
// ACCOUNT TYPES
|
|
127
173
|
// =============================================================================
|
|
@@ -589,17 +635,17 @@ export interface DeploymentResource {
|
|
|
589
635
|
}
|
|
590
636
|
|
|
591
637
|
/**
|
|
592
|
-
*
|
|
638
|
+
* Domain resource interface - the contract all implementations must follow
|
|
593
639
|
*/
|
|
594
|
-
export interface
|
|
595
|
-
set: (
|
|
596
|
-
get: (
|
|
597
|
-
list: () => Promise<
|
|
598
|
-
remove: (
|
|
599
|
-
confirm: (
|
|
600
|
-
dns: (
|
|
601
|
-
records: (
|
|
602
|
-
share: (
|
|
640
|
+
export interface DomainResource {
|
|
641
|
+
set: (domainName: string, deployment: string, tags?: string[]) => Promise<Domain>;
|
|
642
|
+
get: (domainName: string) => Promise<Domain>;
|
|
643
|
+
list: () => Promise<DomainListResponse>;
|
|
644
|
+
remove: (domainName: string) => Promise<void>;
|
|
645
|
+
confirm: (domainName: string) => Promise<{ message: string }>;
|
|
646
|
+
dns: (domainName: string) => Promise<{ domain: string; dns: any }>;
|
|
647
|
+
records: (domainName: string) => Promise<{ domain: string; records: any[] }>;
|
|
648
|
+
share: (domainName: string) => Promise<{ domain: string; hash: string }>;
|
|
603
649
|
}
|
|
604
650
|
|
|
605
651
|
/**
|
|
@@ -609,6 +655,15 @@ export interface AccountResource {
|
|
|
609
655
|
get: () => Promise<Account>;
|
|
610
656
|
}
|
|
611
657
|
|
|
658
|
+
/**
|
|
659
|
+
* Token resource interface - the contract all implementations must follow
|
|
660
|
+
*/
|
|
661
|
+
export interface TokenResource {
|
|
662
|
+
create: (ttl?: number, tags?: string[]) => Promise<TokenCreateResponse>;
|
|
663
|
+
list: () => Promise<TokenListResponse>;
|
|
664
|
+
remove: (token: string) => Promise<void>;
|
|
665
|
+
}
|
|
666
|
+
|
|
612
667
|
/**
|
|
613
668
|
* Keys resource interface - the contract all implementations must follow
|
|
614
669
|
*/
|
|
@@ -651,15 +706,15 @@ export function generateDeploymentUrl(deployment: string, sitesDomain?: string):
|
|
|
651
706
|
}
|
|
652
707
|
|
|
653
708
|
/**
|
|
654
|
-
* Generate
|
|
709
|
+
* Generate domain URL based on whether it's internal (subdomain) or external (custom domain)
|
|
655
710
|
*/
|
|
656
|
-
export function
|
|
657
|
-
// If
|
|
658
|
-
if (
|
|
659
|
-
return `https://${
|
|
711
|
+
export function generateDomainUrl(domain: string, sitesDomain?: string): string {
|
|
712
|
+
// If domain contains dots, it's an external domain
|
|
713
|
+
if (domain.includes('.')) {
|
|
714
|
+
return `https://${domain}`;
|
|
660
715
|
}
|
|
661
|
-
|
|
716
|
+
|
|
662
717
|
// Otherwise it's an internal subdomain
|
|
663
|
-
const
|
|
664
|
-
return `https://${
|
|
718
|
+
const siteDomain = sitesDomain || 'statichost.dev';
|
|
719
|
+
return `https://${domain}.${siteDomain}`;
|
|
665
720
|
}
|