@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 CHANGED
@@ -51,45 +51,45 @@ export interface DeploymentListResponse {
51
51
  total?: number;
52
52
  }
53
53
  /**
54
- * Alias status constants
54
+ * Domain status constants
55
55
  */
56
- export declare const AliasStatus: {
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 AliasStatusType = typeof AliasStatus[keyof typeof AliasStatus];
62
+ export type DomainStatusType = typeof DomainStatus[keyof typeof DomainStatus];
63
63
  /**
64
- * Core alias object - used in both API responses and SDK
64
+ * Core domain object - used in both API responses and SDK
65
65
  */
66
- export interface Alias {
67
- /** The alias name */
68
- readonly alias: string;
69
- /** The deployment name this alias points to */
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 alias status */
72
- status: AliasStatusType;
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 alias URL - internal (subdomain) or external (custom domain) */
75
+ /** The domain URL - internal (subdomain) or external (custom domain) */
76
76
  readonly url: string;
77
- /** Unix timestamp (seconds) when alias was created */
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 alias was confirmed */
81
+ /** Unix timestamp (seconds) when domain was confirmed */
82
82
  confirmed?: number;
83
83
  }
84
84
  /**
85
- * Response for listing aliases
85
+ * Response for listing domains
86
86
  */
87
- export interface AliasListResponse {
88
- /** Array of aliases */
89
- aliases: Alias[];
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 aliases if available */
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
- * Alias resource interface - the contract all implementations must follow
385
+ * Domain resource interface - the contract all implementations must follow
347
386
  */
348
- export interface AliasResource {
349
- set: (aliasName: string, deployment: string, tags?: string[]) => Promise<Alias>;
350
- get: (aliasName: string) => Promise<Alias>;
351
- list: () => Promise<AliasListResponse>;
352
- remove: (aliasName: string) => Promise<void>;
353
- confirm: (aliasName: string) => Promise<{
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: (aliasName: string) => Promise<{
357
- alias: string;
395
+ dns: (domainName: string) => Promise<{
396
+ domain: string;
358
397
  dns: any;
359
398
  }>;
360
- records: (aliasName: string) => Promise<{
361
- alias: string;
399
+ records: (domainName: string) => Promise<{
400
+ domain: string;
362
401
  records: any[];
363
402
  }>;
364
- share: (aliasName: string) => Promise<{
365
- alias: string;
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 alias URL based on whether it's internal (subdomain) or external (custom domain)
451
+ * Generate domain URL based on whether it's internal (subdomain) or external (custom domain)
405
452
  */
406
- export declare function generateAliasUrl(alias: string, sitesDomain?: string): string;
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
- // ALIAS TYPES
18
+ // DOMAIN TYPES
19
19
  // =============================================================================
20
20
  /**
21
- * Alias status constants
21
+ * Domain status constants
22
22
  */
23
- export const AliasStatus = {
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 alias URL based on whether it's internal (subdomain) or external (custom domain)
278
+ * Generate domain URL based on whether it's internal (subdomain) or external (custom domain)
279
279
  */
280
- export function generateAliasUrl(alias, sitesDomain) {
281
- // If alias contains dots, it's an external domain
282
- if (alias.includes('.')) {
283
- return `https://${alias}`;
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 domain = sitesDomain || 'statichost.dev';
287
- return `https://${alias}.${domain}`;
286
+ const siteDomain = sitesDomain || 'statichost.dev';
287
+ return `https://${domain}.${siteDomain}`;
288
288
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipstatic/types",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "Shared types for Shipstatic platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -61,52 +61,52 @@ export interface DeploymentListResponse {
61
61
  }
62
62
 
63
63
  // =============================================================================
64
- // ALIAS TYPES
64
+ // DOMAIN TYPES
65
65
  // =============================================================================
66
66
 
67
67
  /**
68
- * Alias status constants
68
+ * Domain status constants
69
69
  */
70
- export const AliasStatus = {
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 AliasStatusType = typeof AliasStatus[keyof typeof AliasStatus];
77
+ export type DomainStatusType = typeof DomainStatus[keyof typeof DomainStatus];
78
78
 
79
79
  /**
80
- * Core alias object - used in both API responses and SDK
80
+ * Core domain object - used in both API responses and SDK
81
81
  */
82
- export interface Alias {
83
- /** The alias name */
84
- readonly alias: string;
85
- /** The deployment name this alias points to */
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 alias status */
88
- status: AliasStatusType; // Mutable - can be updated
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 alias URL - internal (subdomain) or external (custom domain) */
91
+ /** The domain URL - internal (subdomain) or external (custom domain) */
92
92
  readonly url: string;
93
- /** Unix timestamp (seconds) when alias was created */
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 alias was confirmed */
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 aliases
102
+ * Response for listing domains
103
103
  */
104
- export interface AliasListResponse {
105
- /** Array of aliases */
106
- aliases: Alias[];
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 aliases if available */
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
- * Alias resource interface - the contract all implementations must follow
638
+ * Domain resource interface - the contract all implementations must follow
593
639
  */
594
- export interface AliasResource {
595
- set: (aliasName: string, deployment: string, tags?: string[]) => Promise<Alias>;
596
- get: (aliasName: string) => Promise<Alias>;
597
- list: () => Promise<AliasListResponse>;
598
- remove: (aliasName: string) => Promise<void>;
599
- confirm: (aliasName: string) => Promise<{ message: string }>;
600
- dns: (aliasName: string) => Promise<{ alias: string; dns: any }>;
601
- records: (aliasName: string) => Promise<{ alias: string; records: any[] }>;
602
- share: (aliasName: string) => Promise<{ alias: string; hash: string }>;
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 alias URL based on whether it's internal (subdomain) or external (custom domain)
709
+ * Generate domain URL based on whether it's internal (subdomain) or external (custom domain)
655
710
  */
656
- export function generateAliasUrl(alias: string, sitesDomain?: string): string {
657
- // If alias contains dots, it's an external domain
658
- if (alias.includes('.')) {
659
- return `https://${alias}`;
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 domain = sitesDomain || 'statichost.dev';
664
- return `https://${alias}.${domain}`;
718
+ const siteDomain = sitesDomain || 'statichost.dev';
719
+ return `https://${domain}.${siteDomain}`;
665
720
  }