@shipstatic/types 0.2.9 → 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 +33 -33
- package/dist/index.js +10 -10
- package/package.json +1 -1
- package/src/index.ts +37 -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
|
/**
|
|
@@ -382,26 +382,26 @@ export interface DeploymentResource {
|
|
|
382
382
|
get: (id: string) => Promise<Deployment>;
|
|
383
383
|
}
|
|
384
384
|
/**
|
|
385
|
-
*
|
|
385
|
+
* Domain resource interface - the contract all implementations must follow
|
|
386
386
|
*/
|
|
387
|
-
export interface
|
|
388
|
-
set: (
|
|
389
|
-
get: (
|
|
390
|
-
list: () => Promise<
|
|
391
|
-
remove: (
|
|
392
|
-
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<{
|
|
393
393
|
message: string;
|
|
394
394
|
}>;
|
|
395
|
-
dns: (
|
|
396
|
-
|
|
395
|
+
dns: (domainName: string) => Promise<{
|
|
396
|
+
domain: string;
|
|
397
397
|
dns: any;
|
|
398
398
|
}>;
|
|
399
|
-
records: (
|
|
400
|
-
|
|
399
|
+
records: (domainName: string) => Promise<{
|
|
400
|
+
domain: string;
|
|
401
401
|
records: any[];
|
|
402
402
|
}>;
|
|
403
|
-
share: (
|
|
404
|
-
|
|
403
|
+
share: (domainName: string) => Promise<{
|
|
404
|
+
domain: string;
|
|
405
405
|
hash: string;
|
|
406
406
|
}>;
|
|
407
407
|
}
|
|
@@ -448,6 +448,6 @@ export interface RateLimitData {
|
|
|
448
448
|
*/
|
|
449
449
|
export declare function generateDeploymentUrl(deployment: string, sitesDomain?: string): string;
|
|
450
450
|
/**
|
|
451
|
-
* Generate
|
|
451
|
+
* Generate domain URL based on whether it's internal (subdomain) or external (custom domain)
|
|
452
452
|
*/
|
|
453
|
-
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
|
|
|
@@ -635,17 +635,17 @@ export interface DeploymentResource {
|
|
|
635
635
|
}
|
|
636
636
|
|
|
637
637
|
/**
|
|
638
|
-
*
|
|
638
|
+
* Domain resource interface - the contract all implementations must follow
|
|
639
639
|
*/
|
|
640
|
-
export interface
|
|
641
|
-
set: (
|
|
642
|
-
get: (
|
|
643
|
-
list: () => Promise<
|
|
644
|
-
remove: (
|
|
645
|
-
confirm: (
|
|
646
|
-
dns: (
|
|
647
|
-
records: (
|
|
648
|
-
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 }>;
|
|
649
649
|
}
|
|
650
650
|
|
|
651
651
|
/**
|
|
@@ -706,15 +706,15 @@ export function generateDeploymentUrl(deployment: string, sitesDomain?: string):
|
|
|
706
706
|
}
|
|
707
707
|
|
|
708
708
|
/**
|
|
709
|
-
* Generate
|
|
709
|
+
* Generate domain URL based on whether it's internal (subdomain) or external (custom domain)
|
|
710
710
|
*/
|
|
711
|
-
export function
|
|
712
|
-
// If
|
|
713
|
-
if (
|
|
714
|
-
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}`;
|
|
715
715
|
}
|
|
716
|
-
|
|
716
|
+
|
|
717
717
|
// Otherwise it's an internal subdomain
|
|
718
|
-
const
|
|
719
|
-
return `https://${
|
|
718
|
+
const siteDomain = sitesDomain || 'statichost.dev';
|
|
719
|
+
return `https://${domain}.${siteDomain}`;
|
|
720
720
|
}
|