@shipstatic/types 0.7.7 → 0.8.1
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 +7 -14
- package/dist/index.js +7 -9
- package/package.json +1 -1
- package/src/index.ts +9 -17
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type DeploymentStatusType = typeof DeploymentStatus[keyof typeof Deployme
|
|
|
16
16
|
* Core deployment object - used in both API responses and SDK
|
|
17
17
|
*/
|
|
18
18
|
export interface Deployment {
|
|
19
|
-
/** The deployment
|
|
19
|
+
/** The deployment hostname (e.g., 'happy-cat-abc1234.shipstatic.com') */
|
|
20
20
|
readonly deployment: string;
|
|
21
21
|
/** Number of files in this deployment */
|
|
22
22
|
readonly files: number;
|
|
@@ -30,8 +30,6 @@ export interface Deployment {
|
|
|
30
30
|
labels: string[];
|
|
31
31
|
/** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli'), null if unknown */
|
|
32
32
|
readonly via: string | null;
|
|
33
|
-
/** The deployment URL */
|
|
34
|
-
readonly url: string;
|
|
35
33
|
/** Unix timestamp (seconds) when deployment was created */
|
|
36
34
|
readonly created: number;
|
|
37
35
|
/** Unix timestamp (seconds) when deployment expires, null if never */
|
|
@@ -69,14 +67,12 @@ export type DomainStatusType = typeof DomainStatus[keyof typeof DomainStatus];
|
|
|
69
67
|
export interface Domain {
|
|
70
68
|
/** The domain name */
|
|
71
69
|
readonly domain: string;
|
|
72
|
-
/** The deployment
|
|
70
|
+
/** The deployment hostname this domain points to (null = domain added but not yet linked) */
|
|
73
71
|
deployment: string | null;
|
|
74
72
|
/** Current domain status */
|
|
75
73
|
status: DomainStatusType;
|
|
76
74
|
/** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
|
|
77
75
|
labels: string[];
|
|
78
|
-
/** The domain URL - internal (subdomain) or external (custom domain) */
|
|
79
|
-
readonly url: string;
|
|
80
76
|
/** Unix timestamp (seconds) when domain was created */
|
|
81
77
|
readonly created: number;
|
|
82
78
|
/** When deployment was last linked (Unix timestamp), null if never linked */
|
|
@@ -462,8 +458,8 @@ export declare function validateDeployToken(deployToken: string): void;
|
|
|
462
458
|
*/
|
|
463
459
|
export declare function validateApiUrl(apiUrl: string): void;
|
|
464
460
|
/**
|
|
465
|
-
* Check if a string matches the deployment
|
|
466
|
-
* Example: "happy-cat-abc1234"
|
|
461
|
+
* Check if a string matches the deployment identifier pattern (word-word-alphanumeric7).
|
|
462
|
+
* Example: "happy-cat-abc1234.shipstatic.com"
|
|
467
463
|
*/
|
|
468
464
|
export declare function isDeployment(input: string): boolean;
|
|
469
465
|
/**
|
|
@@ -568,8 +564,6 @@ export type DeployInput = File[] | string | string[];
|
|
|
568
564
|
export interface DeploymentUploadOptions {
|
|
569
565
|
/** Optional labels for categorization and filtering */
|
|
570
566
|
labels?: string[];
|
|
571
|
-
/** Optional subdomain suggestion for the deployment */
|
|
572
|
-
subdomain?: string;
|
|
573
567
|
/** Client identifier (e.g., 'cli', 'sdk', 'web') */
|
|
574
568
|
via?: string;
|
|
575
569
|
/** @internal Trigger server-side build. Only available via /upload endpoint. */
|
|
@@ -849,12 +843,11 @@ export declare function isCustomDomain(domain: string, platformDomain: string):
|
|
|
849
843
|
*/
|
|
850
844
|
export declare function extractSubdomain(domain: string, platformDomain: string): string | null;
|
|
851
845
|
/**
|
|
852
|
-
* Generate
|
|
846
|
+
* Generate HTTPS URL for a deployment hostname.
|
|
853
847
|
*/
|
|
854
|
-
export declare function generateDeploymentUrl(deployment: string
|
|
848
|
+
export declare function generateDeploymentUrl(deployment: string): string;
|
|
855
849
|
/**
|
|
856
|
-
* Generate URL for a domain.
|
|
857
|
-
* Domains are stored as FQDNs, so this just prepends https://
|
|
850
|
+
* Generate HTTPS URL for a domain.
|
|
858
851
|
*/
|
|
859
852
|
export declare function generateDomainUrl(domain: string): string;
|
|
860
853
|
/**
|
package/dist/index.js
CHANGED
|
@@ -375,11 +375,11 @@ export function validateApiUrl(apiUrl) {
|
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
/**
|
|
378
|
-
* Check if a string matches the deployment
|
|
379
|
-
* Example: "happy-cat-abc1234"
|
|
378
|
+
* Check if a string matches the deployment identifier pattern (word-word-alphanumeric7).
|
|
379
|
+
* Example: "happy-cat-abc1234.shipstatic.com"
|
|
380
380
|
*/
|
|
381
381
|
export function isDeployment(input) {
|
|
382
|
-
return /^[a-z]+-[a-z]+-[a-z0-9]{7}
|
|
382
|
+
return /^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(input);
|
|
383
383
|
}
|
|
384
384
|
// =============================================================================
|
|
385
385
|
// PLATFORM CONSTANTS
|
|
@@ -441,15 +441,13 @@ export function extractSubdomain(domain, platformDomain) {
|
|
|
441
441
|
return domain.slice(0, -(platformDomain.length + 1)); // +1 for the dot
|
|
442
442
|
}
|
|
443
443
|
/**
|
|
444
|
-
* Generate
|
|
444
|
+
* Generate HTTPS URL for a deployment hostname.
|
|
445
445
|
*/
|
|
446
|
-
export function generateDeploymentUrl(deployment
|
|
447
|
-
|
|
448
|
-
return `https://${deployment}.${domain}`;
|
|
446
|
+
export function generateDeploymentUrl(deployment) {
|
|
447
|
+
return `https://${deployment}`;
|
|
449
448
|
}
|
|
450
449
|
/**
|
|
451
|
-
* Generate URL for a domain.
|
|
452
|
-
* Domains are stored as FQDNs, so this just prepends https://
|
|
450
|
+
* Generate HTTPS URL for a domain.
|
|
453
451
|
*/
|
|
454
452
|
export function generateDomainUrl(domain) {
|
|
455
453
|
return `https://${domain}`;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type DeploymentStatusType = typeof DeploymentStatus[keyof typeof Deployme
|
|
|
23
23
|
* Core deployment object - used in both API responses and SDK
|
|
24
24
|
*/
|
|
25
25
|
export interface Deployment {
|
|
26
|
-
/** The deployment
|
|
26
|
+
/** The deployment hostname (e.g., 'happy-cat-abc1234.shipstatic.com') */
|
|
27
27
|
readonly deployment: string;
|
|
28
28
|
/** Number of files in this deployment */
|
|
29
29
|
readonly files: number;
|
|
@@ -37,8 +37,6 @@ export interface Deployment {
|
|
|
37
37
|
labels: string[];
|
|
38
38
|
/** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli'), null if unknown */
|
|
39
39
|
readonly via: string | null;
|
|
40
|
-
/** The deployment URL */
|
|
41
|
-
readonly url: string;
|
|
42
40
|
/** Unix timestamp (seconds) when deployment was created */
|
|
43
41
|
readonly created: number;
|
|
44
42
|
/** Unix timestamp (seconds) when deployment expires, null if never */
|
|
@@ -85,14 +83,12 @@ export type DomainStatusType = typeof DomainStatus[keyof typeof DomainStatus];
|
|
|
85
83
|
export interface Domain {
|
|
86
84
|
/** The domain name */
|
|
87
85
|
readonly domain: string;
|
|
88
|
-
/** The deployment
|
|
86
|
+
/** The deployment hostname this domain points to (null = domain added but not yet linked) */
|
|
89
87
|
deployment: string | null; // Mutable - can be updated to point to different deployment
|
|
90
88
|
/** Current domain status */
|
|
91
89
|
status: DomainStatusType; // Mutable - can be updated
|
|
92
90
|
/** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
|
|
93
91
|
labels: string[];
|
|
94
|
-
/** The domain URL - internal (subdomain) or external (custom domain) */
|
|
95
|
-
readonly url: string;
|
|
96
92
|
/** Unix timestamp (seconds) when domain was created */
|
|
97
93
|
readonly created: number;
|
|
98
94
|
/** When deployment was last linked (Unix timestamp), null if never linked */
|
|
@@ -733,11 +729,11 @@ export function validateApiUrl(apiUrl: string): void {
|
|
|
733
729
|
}
|
|
734
730
|
|
|
735
731
|
/**
|
|
736
|
-
* Check if a string matches the deployment
|
|
737
|
-
* Example: "happy-cat-abc1234"
|
|
732
|
+
* Check if a string matches the deployment identifier pattern (word-word-alphanumeric7).
|
|
733
|
+
* Example: "happy-cat-abc1234.shipstatic.com"
|
|
738
734
|
*/
|
|
739
735
|
export function isDeployment(input: string): boolean {
|
|
740
|
-
return /^[a-z]+-[a-z]+-[a-z0-9]{7}
|
|
736
|
+
return /^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(input);
|
|
741
737
|
}
|
|
742
738
|
|
|
743
739
|
// =============================================================================
|
|
@@ -874,8 +870,6 @@ export type DeployInput = File[] | string | string[];
|
|
|
874
870
|
export interface DeploymentUploadOptions {
|
|
875
871
|
/** Optional labels for categorization and filtering */
|
|
876
872
|
labels?: string[];
|
|
877
|
-
/** Optional subdomain suggestion for the deployment */
|
|
878
|
-
subdomain?: string;
|
|
879
873
|
/** Client identifier (e.g., 'cli', 'sdk', 'web') */
|
|
880
874
|
via?: string;
|
|
881
875
|
/** @internal Trigger server-side build. Only available via /upload endpoint. */
|
|
@@ -1268,16 +1262,14 @@ export function extractSubdomain(domain: string, platformDomain: string): string
|
|
|
1268
1262
|
}
|
|
1269
1263
|
|
|
1270
1264
|
/**
|
|
1271
|
-
* Generate
|
|
1265
|
+
* Generate HTTPS URL for a deployment hostname.
|
|
1272
1266
|
*/
|
|
1273
|
-
export function generateDeploymentUrl(deployment: string
|
|
1274
|
-
|
|
1275
|
-
return `https://${deployment}.${domain}`;
|
|
1267
|
+
export function generateDeploymentUrl(deployment: string): string {
|
|
1268
|
+
return `https://${deployment}`;
|
|
1276
1269
|
}
|
|
1277
1270
|
|
|
1278
1271
|
/**
|
|
1279
|
-
* Generate URL for a domain.
|
|
1280
|
-
* Domains are stored as FQDNs, so this just prepends https://
|
|
1272
|
+
* Generate HTTPS URL for a domain.
|
|
1281
1273
|
*/
|
|
1282
1274
|
export function generateDomainUrl(domain: string): string {
|
|
1283
1275
|
return `https://${domain}`;
|