@shipstatic/types 0.5.1 → 0.5.2

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
@@ -25,19 +25,17 @@ export interface Deployment {
25
25
  /** Current deployment status */
26
26
  status: DeploymentStatusType;
27
27
  /** Whether deployment has configuration */
28
- readonly config?: boolean;
29
- /** Optional array of labels for categorization and filtering (lowercase, alphanumeric with separators) */
30
- labels?: string[];
31
- /** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli') */
32
- readonly via?: string;
28
+ readonly config: boolean;
29
+ /** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
30
+ labels: string[];
31
+ /** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli'), null if unknown */
32
+ readonly via: string | null;
33
33
  /** The deployment URL */
34
34
  readonly url: string;
35
35
  /** Unix timestamp (seconds) when deployment was created */
36
36
  readonly created: number;
37
- /** Unix timestamp (seconds) when deployment expires */
38
- expires?: number;
39
- /** Short-lived JWT token for claiming this deployment (only present for public deployments) */
40
- claimToken?: string;
37
+ /** Unix timestamp (seconds) when deployment expires, null if never */
38
+ expires: number | null;
41
39
  }
42
40
  /**
43
41
  * Response for listing deployments
@@ -45,10 +43,10 @@ export interface Deployment {
45
43
  export interface DeploymentListResponse {
46
44
  /** Array of deployments */
47
45
  deployments: Deployment[];
48
- /** Optional cursor for pagination */
49
- cursor?: string;
50
- /** Total number of deployments if available */
51
- total?: number;
46
+ /** Cursor for pagination, null if no more pages */
47
+ cursor: string | null;
48
+ /** Total number of deployments */
49
+ total: number;
52
50
  }
53
51
  /**
54
52
  * Domain status constants
@@ -75,18 +73,16 @@ export interface Domain {
75
73
  deployment: string | null;
76
74
  /** Current domain status */
77
75
  status: DomainStatusType;
78
- /** Optional array of labels for categorization and filtering (lowercase, alphanumeric with separators) */
79
- labels?: string[];
76
+ /** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
77
+ labels: string[];
80
78
  /** The domain URL - internal (subdomain) or external (custom domain) */
81
79
  readonly url: string;
82
80
  /** Unix timestamp (seconds) when domain was created */
83
81
  readonly created: number;
84
- /** Whether this was a create (201) or update (200) operation */
85
- readonly isCreate?: boolean;
86
- /** When deployment was last linked (Unix timestamp, null if never) */
87
- linked?: number;
82
+ /** When deployment was last linked (Unix timestamp), null if never linked */
83
+ linked: number | null;
88
84
  /** Total deployment links */
89
- links?: number;
85
+ links: number;
90
86
  }
91
87
  /**
92
88
  * Response for listing domains
@@ -94,10 +90,10 @@ export interface Domain {
94
90
  export interface DomainListResponse {
95
91
  /** Array of domains */
96
92
  domains: Domain[];
97
- /** Optional cursor for pagination */
98
- cursor?: string;
99
- /** Total number of domains if available */
100
- total?: number;
93
+ /** Cursor for pagination, null if no more pages */
94
+ cursor: string | null;
95
+ /** Total number of domains */
96
+ total: number;
101
97
  }
102
98
  /**
103
99
  * DNS record types supported for domain configuration
@@ -118,8 +114,8 @@ export interface DnsRecord {
118
114
  * DNS provider information for a domain
119
115
  */
120
116
  export interface DnsProvider {
121
- /** Provider name (e.g., "Cloudflare", "GoDaddy") */
122
- name?: string;
117
+ /** Provider name (e.g., "Cloudflare", "GoDaddy"), null if unknown */
118
+ name: string | null;
123
119
  }
124
120
  /**
125
121
  * Response for domain DNS provider lookup
@@ -149,12 +145,12 @@ export interface DomainRecordsResponse {
149
145
  export interface DomainValidateResponse {
150
146
  /** Whether the domain is valid */
151
147
  valid: boolean;
152
- /** Normalized domain name (only present when valid) */
153
- normalized?: string;
154
- /** Whether the domain is available (only present when valid) */
155
- available?: boolean;
156
- /** Error message (only present when invalid) */
157
- error?: string;
148
+ /** Normalized domain name, null when invalid */
149
+ normalized: string | null;
150
+ /** Whether the domain is available, null when invalid */
151
+ available: boolean | null;
152
+ /** Error message, null when valid */
153
+ error: string | null;
158
154
  }
159
155
  /**
160
156
  * Response for deployment removal
@@ -165,7 +161,7 @@ export interface DeploymentRemoveResponse {
165
161
  /** The deployment ID */
166
162
  deployment: string;
167
163
  /** Human-readable message */
168
- message?: string;
164
+ message: string;
169
165
  }
170
166
  /**
171
167
  * Deployment token for automated deployments
@@ -175,16 +171,16 @@ export interface Token {
175
171
  readonly token: string;
176
172
  /** The account this token belongs to */
177
173
  readonly account: string;
178
- /** Optional IP address locking for security */
179
- readonly ip?: string;
180
- /** Optional array of labels for categorization and filtering (lowercase, alphanumeric with separators) */
181
- labels?: string[];
174
+ /** IP address locking for security, null if not locked */
175
+ readonly ip: string | null;
176
+ /** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
177
+ labels: string[];
182
178
  /** Unix timestamp (seconds) when token was created */
183
179
  readonly created: number;
184
- /** Unix timestamp (seconds) when token expires, or null for never */
185
- readonly expires?: number;
186
- /** Unix timestamp (seconds) when token was last used */
187
- readonly used?: number;
180
+ /** Unix timestamp (seconds) when token expires, null for never */
181
+ readonly expires: number | null;
182
+ /** Unix timestamp (seconds) when token was last used, null if never used */
183
+ readonly used: number | null;
188
184
  }
189
185
  /**
190
186
  * Response for listing tokens
@@ -193,7 +189,7 @@ export interface TokenListResponse {
193
189
  /** Array of tokens */
194
190
  tokens: Token[];
195
191
  /** Total count of tokens */
196
- count?: number;
192
+ count: number;
197
193
  }
198
194
  /**
199
195
  * Response for token creation
@@ -201,10 +197,10 @@ export interface TokenListResponse {
201
197
  export interface TokenCreateResponse {
202
198
  /** The actual token value (only returned on creation) */
203
199
  token: string;
204
- /** Unix timestamp (seconds) when token expires, or null for never */
205
- expires?: number;
206
- /** Success message */
207
- message?: string;
200
+ /** Labels for categorization and filtering. Always present, empty array when none. */
201
+ labels: string[];
202
+ /** Unix timestamp (seconds) when token expires, null for never */
203
+ expires: number | null;
208
204
  }
209
205
  /**
210
206
  * Account plan constants
@@ -226,18 +222,18 @@ export type AccountPlanType = typeof AccountPlan[keyof typeof AccountPlan];
226
222
  export interface Account {
227
223
  /** User email address */
228
224
  readonly email: string;
229
- /** User display name */
230
- readonly name: string;
231
- /** User profile picture URL */
232
- readonly picture?: string;
225
+ /** User display name, null if not set */
226
+ readonly name: string | null;
227
+ /** User profile picture URL, null if not set */
228
+ readonly picture: string | null;
233
229
  /** Account plan status */
234
230
  readonly plan: AccountPlanType;
235
231
  /** Unix timestamp (seconds) when account was created */
236
232
  readonly created: number;
237
- /** Unix timestamp (seconds) when account was activated (first deployment) */
238
- readonly activated?: number;
239
- /** Last 4 characters of the API key for identification (null when no key generated) */
240
- readonly hint?: string;
233
+ /** Unix timestamp (seconds) when account was activated (first deployment), null if not yet activated */
234
+ readonly activated: number | null;
235
+ /** Last 4 characters of the API key for identification, null when no key generated */
236
+ readonly hint: string | null;
241
237
  }
242
238
  /**
243
239
  * Account-specific configuration overrides
@@ -653,14 +649,14 @@ export interface TokenResource {
653
649
  export interface BillingStatus {
654
650
  /** Creem billing ID, or null if no active billing */
655
651
  billing: string | null;
656
- /** Number of billing units (1 unit = 1 custom domain) */
657
- units?: number;
658
- /** Number of custom domains currently in use */
659
- usage?: number;
660
- /** Billing status from Creem (active, trialing, canceled, etc.) */
661
- status?: string;
662
- /** Link to Creem customer portal for billing management */
663
- portal?: string | null;
652
+ /** Number of billing units (1 unit = 1 custom domain), null if no billing */
653
+ units: number | null;
654
+ /** Number of custom domains currently in use, null if no billing */
655
+ usage: number | null;
656
+ /** Billing status from Creem (active, trialing, canceled, etc.), null if no billing */
657
+ status: string | null;
658
+ /** Link to Creem customer portal for billing management, null if unavailable */
659
+ portal: string | null;
664
660
  }
665
661
  /**
666
662
  * Checkout session response from POST /billing/checkout
@@ -919,10 +915,10 @@ export declare const LABEL_PATTERN: RegExp;
919
915
  export declare function serializeLabels(labels: string[] | undefined): string | null;
920
916
  /**
921
917
  * Deserialize labels from JSON string to array.
922
- * Returns undefined for null/empty strings.
918
+ * Always returns an array — empty array for null/empty/invalid input.
923
919
  *
924
920
  * @example deserializeLabels('["web","production"]') → ['web', 'production']
925
- * @example deserializeLabels(null) → undefined
926
- * @example deserializeLabels('') → undefined
921
+ * @example deserializeLabels(null) → []
922
+ * @example deserializeLabels('') → []
927
923
  */
928
- export declare function deserializeLabels(labelsJson: string | null): string[] | undefined;
924
+ export declare function deserializeLabels(labelsJson: string | null): string[];
package/dist/index.js CHANGED
@@ -605,20 +605,20 @@ export function serializeLabels(labels) {
605
605
  }
606
606
  /**
607
607
  * Deserialize labels from JSON string to array.
608
- * Returns undefined for null/empty strings.
608
+ * Always returns an array — empty array for null/empty/invalid input.
609
609
  *
610
610
  * @example deserializeLabels('["web","production"]') → ['web', 'production']
611
- * @example deserializeLabels(null) → undefined
612
- * @example deserializeLabels('') → undefined
611
+ * @example deserializeLabels(null) → []
612
+ * @example deserializeLabels('') → []
613
613
  */
614
614
  export function deserializeLabels(labelsJson) {
615
615
  if (!labelsJson)
616
- return undefined;
616
+ return [];
617
617
  try {
618
618
  const parsed = JSON.parse(labelsJson);
619
- return Array.isArray(parsed) && parsed.length > 0 ? parsed : undefined;
619
+ return Array.isArray(parsed) ? parsed : [];
620
620
  }
621
621
  catch {
622
- return undefined;
622
+ return [];
623
623
  }
624
624
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipstatic/types",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Shared types for Shipstatic platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -32,19 +32,17 @@ export interface Deployment {
32
32
  /** Current deployment status */
33
33
  status: DeploymentStatusType; // Mutable - can be updated
34
34
  /** Whether deployment has configuration */
35
- readonly config?: boolean;
36
- /** Optional array of labels for categorization and filtering (lowercase, alphanumeric with separators) */
37
- labels?: string[];
38
- /** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli') */
39
- readonly via?: string;
35
+ readonly config: boolean;
36
+ /** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
37
+ labels: string[];
38
+ /** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli'), null if unknown */
39
+ readonly via: string | null;
40
40
  /** The deployment URL */
41
41
  readonly url: string;
42
42
  /** Unix timestamp (seconds) when deployment was created */
43
43
  readonly created: number;
44
- /** Unix timestamp (seconds) when deployment expires */
45
- expires?: number; // Mutable - can be updated
46
- /** Short-lived JWT token for claiming this deployment (only present for public deployments) */
47
- claimToken?: string; // Mutable - can be updated
44
+ /** Unix timestamp (seconds) when deployment expires, null if never */
45
+ expires: number | null; // Mutable - can be updated
48
46
  }
49
47
 
50
48
 
@@ -54,10 +52,10 @@ export interface Deployment {
54
52
  export interface DeploymentListResponse {
55
53
  /** Array of deployments */
56
54
  deployments: Deployment[];
57
- /** Optional cursor for pagination */
58
- cursor?: string;
59
- /** Total number of deployments if available */
60
- total?: number;
55
+ /** Cursor for pagination, null if no more pages */
56
+ cursor: string | null;
57
+ /** Total number of deployments */
58
+ total: number;
61
59
  }
62
60
 
63
61
  // =============================================================================
@@ -91,18 +89,16 @@ export interface Domain {
91
89
  deployment: string | null; // Mutable - can be updated to point to different deployment
92
90
  /** Current domain status */
93
91
  status: DomainStatusType; // Mutable - can be updated
94
- /** Optional array of labels for categorization and filtering (lowercase, alphanumeric with separators) */
95
- labels?: string[];
92
+ /** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
93
+ labels: string[];
96
94
  /** The domain URL - internal (subdomain) or external (custom domain) */
97
95
  readonly url: string;
98
96
  /** Unix timestamp (seconds) when domain was created */
99
97
  readonly created: number;
100
- /** Whether this was a create (201) or update (200) operation */
101
- readonly isCreate?: boolean;
102
- /** When deployment was last linked (Unix timestamp, null if never) */
103
- linked?: number;
98
+ /** When deployment was last linked (Unix timestamp), null if never linked */
99
+ linked: number | null;
104
100
  /** Total deployment links */
105
- links?: number;
101
+ links: number;
106
102
  }
107
103
 
108
104
  /**
@@ -111,10 +107,10 @@ export interface Domain {
111
107
  export interface DomainListResponse {
112
108
  /** Array of domains */
113
109
  domains: Domain[];
114
- /** Optional cursor for pagination */
115
- cursor?: string;
116
- /** Total number of domains if available */
117
- total?: number;
110
+ /** Cursor for pagination, null if no more pages */
111
+ cursor: string | null;
112
+ /** Total number of domains */
113
+ total: number;
118
114
  }
119
115
 
120
116
  /**
@@ -138,8 +134,8 @@ export interface DnsRecord {
138
134
  * DNS provider information for a domain
139
135
  */
140
136
  export interface DnsProvider {
141
- /** Provider name (e.g., "Cloudflare", "GoDaddy") */
142
- name?: string;
137
+ /** Provider name (e.g., "Cloudflare", "GoDaddy"), null if unknown */
138
+ name: string | null;
143
139
  }
144
140
 
145
141
  /**
@@ -170,12 +166,12 @@ export interface DomainRecordsResponse {
170
166
  export interface DomainValidateResponse {
171
167
  /** Whether the domain is valid */
172
168
  valid: boolean;
173
- /** Normalized domain name (only present when valid) */
174
- normalized?: string;
175
- /** Whether the domain is available (only present when valid) */
176
- available?: boolean;
177
- /** Error message (only present when invalid) */
178
- error?: string;
169
+ /** Normalized domain name, null when invalid */
170
+ normalized: string | null;
171
+ /** Whether the domain is available, null when invalid */
172
+ available: boolean | null;
173
+ /** Error message, null when valid */
174
+ error: string | null;
179
175
  }
180
176
 
181
177
  /**
@@ -187,7 +183,7 @@ export interface DeploymentRemoveResponse {
187
183
  /** The deployment ID */
188
184
  deployment: string;
189
185
  /** Human-readable message */
190
- message?: string;
186
+ message: string;
191
187
  }
192
188
 
193
189
  // =============================================================================
@@ -202,16 +198,16 @@ export interface Token {
202
198
  readonly token: string;
203
199
  /** The account this token belongs to */
204
200
  readonly account: string;
205
- /** Optional IP address locking for security */
206
- readonly ip?: string;
207
- /** Optional array of labels for categorization and filtering (lowercase, alphanumeric with separators) */
208
- labels?: string[];
201
+ /** IP address locking for security, null if not locked */
202
+ readonly ip: string | null;
203
+ /** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
204
+ labels: string[];
209
205
  /** Unix timestamp (seconds) when token was created */
210
206
  readonly created: number;
211
- /** Unix timestamp (seconds) when token expires, or null for never */
212
- readonly expires?: number;
213
- /** Unix timestamp (seconds) when token was last used */
214
- readonly used?: number;
207
+ /** Unix timestamp (seconds) when token expires, null for never */
208
+ readonly expires: number | null;
209
+ /** Unix timestamp (seconds) when token was last used, null if never used */
210
+ readonly used: number | null;
215
211
  }
216
212
 
217
213
  /**
@@ -221,7 +217,7 @@ export interface TokenListResponse {
221
217
  /** Array of tokens */
222
218
  tokens: Token[];
223
219
  /** Total count of tokens */
224
- count?: number;
220
+ count: number;
225
221
  }
226
222
 
227
223
  /**
@@ -230,10 +226,10 @@ export interface TokenListResponse {
230
226
  export interface TokenCreateResponse {
231
227
  /** The actual token value (only returned on creation) */
232
228
  token: string;
233
- /** Unix timestamp (seconds) when token expires, or null for never */
234
- expires?: number;
235
- /** Success message */
236
- message?: string;
229
+ /** Labels for categorization and filtering. Always present, empty array when none. */
230
+ labels: string[];
231
+ /** Unix timestamp (seconds) when token expires, null for never */
232
+ expires: number | null;
237
233
  }
238
234
 
239
235
  // =============================================================================
@@ -262,18 +258,18 @@ export type AccountPlanType = typeof AccountPlan[keyof typeof AccountPlan];
262
258
  export interface Account {
263
259
  /** User email address */
264
260
  readonly email: string;
265
- /** User display name */
266
- readonly name: string;
267
- /** User profile picture URL */
268
- readonly picture?: string;
261
+ /** User display name, null if not set */
262
+ readonly name: string | null;
263
+ /** User profile picture URL, null if not set */
264
+ readonly picture: string | null;
269
265
  /** Account plan status */
270
266
  readonly plan: AccountPlanType;
271
267
  /** Unix timestamp (seconds) when account was created */
272
268
  readonly created: number;
273
- /** Unix timestamp (seconds) when account was activated (first deployment) */
274
- readonly activated?: number;
275
- /** Last 4 characters of the API key for identification (null when no key generated) */
276
- readonly hint?: string;
269
+ /** Unix timestamp (seconds) when account was activated (first deployment), null if not yet activated */
270
+ readonly activated: number | null;
271
+ /** Last 4 characters of the API key for identification, null when no key generated */
272
+ readonly hint: string | null;
277
273
  }
278
274
 
279
275
  /**
@@ -1071,14 +1067,14 @@ export interface TokenResource {
1071
1067
  export interface BillingStatus {
1072
1068
  /** Creem billing ID, or null if no active billing */
1073
1069
  billing: string | null;
1074
- /** Number of billing units (1 unit = 1 custom domain) */
1075
- units?: number;
1076
- /** Number of custom domains currently in use */
1077
- usage?: number;
1078
- /** Billing status from Creem (active, trialing, canceled, etc.) */
1079
- status?: string;
1080
- /** Link to Creem customer portal for billing management */
1081
- portal?: string | null;
1070
+ /** Number of billing units (1 unit = 1 custom domain), null if no billing */
1071
+ units: number | null;
1072
+ /** Number of custom domains currently in use, null if no billing */
1073
+ usage: number | null;
1074
+ /** Billing status from Creem (active, trialing, canceled, etc.), null if no billing */
1075
+ status: string | null;
1076
+ /** Link to Creem customer portal for billing management, null if unavailable */
1077
+ portal: string | null;
1082
1078
  }
1083
1079
 
1084
1080
 
@@ -1467,18 +1463,18 @@ export function serializeLabels(labels: string[] | undefined): string | null {
1467
1463
 
1468
1464
  /**
1469
1465
  * Deserialize labels from JSON string to array.
1470
- * Returns undefined for null/empty strings.
1466
+ * Always returns an array — empty array for null/empty/invalid input.
1471
1467
  *
1472
1468
  * @example deserializeLabels('["web","production"]') → ['web', 'production']
1473
- * @example deserializeLabels(null) → undefined
1474
- * @example deserializeLabels('') → undefined
1469
+ * @example deserializeLabels(null) → []
1470
+ * @example deserializeLabels('') → []
1475
1471
  */
1476
- export function deserializeLabels(labelsJson: string | null): string[] | undefined {
1477
- if (!labelsJson) return undefined;
1472
+ export function deserializeLabels(labelsJson: string | null): string[] {
1473
+ if (!labelsJson) return [];
1478
1474
  try {
1479
1475
  const parsed = JSON.parse(labelsJson);
1480
- return Array.isArray(parsed) && parsed.length > 0 ? parsed : undefined;
1476
+ return Array.isArray(parsed) ? parsed : [];
1481
1477
  } catch {
1482
- return undefined;
1478
+ return [];
1483
1479
  }
1484
1480
  }