@shipstatic/types 0.7.7 → 0.8.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 +7 -12
- package/dist/index.js +7 -9
- package/package.json +1 -1
- package/src/index.ts +9 -15
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
|
/**
|
|
@@ -849,12 +845,11 @@ export declare function isCustomDomain(domain: string, platformDomain: string):
|
|
|
849
845
|
*/
|
|
850
846
|
export declare function extractSubdomain(domain: string, platformDomain: string): string | null;
|
|
851
847
|
/**
|
|
852
|
-
* Generate
|
|
848
|
+
* Generate HTTPS URL for a deployment hostname.
|
|
853
849
|
*/
|
|
854
|
-
export declare function generateDeploymentUrl(deployment: string
|
|
850
|
+
export declare function generateDeploymentUrl(deployment: string): string;
|
|
855
851
|
/**
|
|
856
|
-
* Generate URL for a domain.
|
|
857
|
-
* Domains are stored as FQDNs, so this just prepends https://
|
|
852
|
+
* Generate HTTPS URL for a domain.
|
|
858
853
|
*/
|
|
859
854
|
export declare function generateDomainUrl(domain: string): string;
|
|
860
855
|
/**
|
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
|
// =============================================================================
|
|
@@ -1268,16 +1264,14 @@ export function extractSubdomain(domain: string, platformDomain: string): string
|
|
|
1268
1264
|
}
|
|
1269
1265
|
|
|
1270
1266
|
/**
|
|
1271
|
-
* Generate
|
|
1267
|
+
* Generate HTTPS URL for a deployment hostname.
|
|
1272
1268
|
*/
|
|
1273
|
-
export function generateDeploymentUrl(deployment: string
|
|
1274
|
-
|
|
1275
|
-
return `https://${deployment}.${domain}`;
|
|
1269
|
+
export function generateDeploymentUrl(deployment: string): string {
|
|
1270
|
+
return `https://${deployment}`;
|
|
1276
1271
|
}
|
|
1277
1272
|
|
|
1278
1273
|
/**
|
|
1279
|
-
* Generate URL for a domain.
|
|
1280
|
-
* Domains are stored as FQDNs, so this just prepends https://
|
|
1274
|
+
* Generate HTTPS URL for a domain.
|
|
1281
1275
|
*/
|
|
1282
1276
|
export function generateDomainUrl(domain: string): string {
|
|
1283
1277
|
return `https://${domain}`;
|