@shipstatic/types 0.3.21 → 0.4.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/README.md +42 -326
- package/dist/index.d.ts +31 -13
- package/package.json +2 -2
- package/src/index.ts +24 -13
package/README.md
CHANGED
|
@@ -1,371 +1,87 @@
|
|
|
1
1
|
# @shipstatic/types
|
|
2
2
|
|
|
3
|
-
Shared TypeScript types
|
|
3
|
+
Shared TypeScript types for the Shipstatic platform.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Single source of truth for types used across API, SDK, CLI, and web applications.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **Shipstatic API** (`/cloudflare/api`) - Backend API on Cloudflare Workers
|
|
9
|
-
- **Shipstatic SDK** (`/ship`) - Universal SDK for Node.js and Browser
|
|
10
|
-
- **Shipstatic CLI** - Command-line interface
|
|
11
|
-
|
|
12
|
-
## Core Entities
|
|
13
|
-
|
|
14
|
-
### Deployment
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
interface Deployment {
|
|
18
|
-
deployment: string; // Deployment ID (e.g., "happy-cat-abc1234")
|
|
19
|
-
files: number; // Number of files in deployment
|
|
20
|
-
size: number; // Total size in bytes
|
|
21
|
-
status: 'pending' | 'success' | 'failed' | 'deleting';
|
|
22
|
-
config?: boolean; // Whether deployment has ship.json
|
|
23
|
-
url: string; // Deployment URL
|
|
24
|
-
created: number; // Unix timestamp (seconds)
|
|
25
|
-
expires?: number; // Unix timestamp (seconds)
|
|
26
|
-
verified?: number; // Unix timestamp (seconds) when verified
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Alias
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
interface Alias {
|
|
34
|
-
alias: string; // Alias name (subdomain or custom domain)
|
|
35
|
-
deployment: string; // Target deployment ID
|
|
36
|
-
status: 'pending' | 'success' | 'failed';
|
|
37
|
-
url: string; // Alias URL
|
|
38
|
-
created: number; // Unix timestamp (seconds)
|
|
39
|
-
confirmed?: number; // Unix timestamp (seconds) when confirmed
|
|
40
|
-
isCreate?: boolean; // Present in set operations only
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Account
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
interface Account {
|
|
48
|
-
email: string; // User email address
|
|
49
|
-
name: string; // User display name
|
|
50
|
-
picture?: string; // Profile picture URL
|
|
51
|
-
plan: 'free' | 'standard' | 'sponsored' | 'enterprise' | 'suspended' | 'terminating' | 'terminated'; // Account plan status
|
|
52
|
-
created: number; // Unix timestamp (seconds)
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Static File
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
interface StaticFile {
|
|
60
|
-
content: File | Buffer | Blob; // File content
|
|
61
|
-
path: string; // Server path (e.g., "assets/style.css")
|
|
62
|
-
filePath?: string; // Original filesystem path (Node.js)
|
|
63
|
-
md5?: string; // MD5 hash of content
|
|
64
|
-
size: number; // File size in bytes
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## API Response Types
|
|
69
|
-
|
|
70
|
-
### Success Responses
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
interface DeploymentListResponse {
|
|
74
|
-
deployments: Deployment[];
|
|
75
|
-
cursor?: string; // Pagination cursor
|
|
76
|
-
total?: number; // Total count if available
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
interface AliasListResponse {
|
|
80
|
-
aliases: Alias[];
|
|
81
|
-
cursor?: string;
|
|
82
|
-
total?: number;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
interface SuccessResponse<T = any> {
|
|
86
|
-
success: true;
|
|
87
|
-
data: T;
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Configuration
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
interface ConfigResponse {
|
|
95
|
-
maxFileSize: number; // Maximum file size in bytes
|
|
96
|
-
maxFilesCount: number; // Maximum files per deployment
|
|
97
|
-
maxTotalSize: number; // Maximum total deployment size
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
interface PlatformConfig {
|
|
101
|
-
apiUrl?: string;
|
|
102
|
-
deployToken?: string;
|
|
103
|
-
apiKey?: string;
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### SPA Detection
|
|
7
|
+
## Installation
|
|
108
8
|
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
index: string; // Index file path
|
|
113
|
-
}
|
|
9
|
+
```bash
|
|
10
|
+
# Included with Ship SDK
|
|
11
|
+
npm install @shipstatic/ship
|
|
114
12
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
debug: {
|
|
118
|
-
tier: 'exclusions' | 'inclusions' | 'scoring' | 'ai' | 'fallback';
|
|
119
|
-
reason: string;
|
|
120
|
-
};
|
|
121
|
-
}
|
|
13
|
+
# Direct installation
|
|
14
|
+
npm install @shipstatic/types
|
|
122
15
|
```
|
|
123
16
|
|
|
124
|
-
##
|
|
17
|
+
## What's Included
|
|
125
18
|
|
|
126
|
-
|
|
19
|
+
### Core Entities
|
|
127
20
|
|
|
128
21
|
```typescript
|
|
129
|
-
|
|
130
|
-
create: (input: DeployInput, options?: any) => Promise<Deployment>;
|
|
131
|
-
list: () => Promise<DeploymentListResponse>;
|
|
132
|
-
remove: (id: string) => Promise<void>;
|
|
133
|
-
get: (id: string) => Promise<Deployment>;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
interface AliasResource {
|
|
137
|
-
set: (aliasName: string, deployment: string) => Promise<Alias>;
|
|
138
|
-
get: (aliasName: string) => Promise<Alias>;
|
|
139
|
-
list: () => Promise<AliasListResponse>;
|
|
140
|
-
remove: (aliasName: string) => Promise<void>;
|
|
141
|
-
check: (aliasName: string) => Promise<{ message: string }>;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
interface AccountResource {
|
|
145
|
-
get: () => Promise<Account>;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
interface KeysResource {
|
|
149
|
-
create: () => Promise<{ apiKey: string }>;
|
|
150
|
-
}
|
|
22
|
+
import type { Deployment, Domain, Account, Token, StaticFile } from '@shipstatic/types';
|
|
151
23
|
```
|
|
152
24
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
### Unified Error Handling
|
|
25
|
+
### Error System
|
|
156
26
|
|
|
157
27
|
```typescript
|
|
158
|
-
|
|
159
|
-
Validation = "validation_failed",
|
|
160
|
-
NotFound = "not_found",
|
|
161
|
-
RateLimit = "rate_limit_exceeded",
|
|
162
|
-
Authentication = "authentication_failed",
|
|
163
|
-
Business = "business_logic_error",
|
|
164
|
-
Api = "internal_server_error",
|
|
165
|
-
Network = "network_error",
|
|
166
|
-
Cancelled = "operation_cancelled",
|
|
167
|
-
File = "file_error",
|
|
168
|
-
Config = "config_error"
|
|
169
|
-
}
|
|
28
|
+
import { ShipError, ErrorType } from '@shipstatic/types';
|
|
170
29
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
message: string;
|
|
174
|
-
status?: number;
|
|
175
|
-
details?: any;
|
|
176
|
-
}
|
|
30
|
+
throw ShipError.validation('File too large');
|
|
31
|
+
throw ShipError.notFound('Deployment', id);
|
|
177
32
|
|
|
178
|
-
|
|
179
|
-
constructor(
|
|
180
|
-
public readonly type: ErrorType,
|
|
181
|
-
message: string,
|
|
182
|
-
public readonly status?: number,
|
|
183
|
-
public readonly details?: any
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
// Factory methods
|
|
187
|
-
static validation(message: string, details?: any): ShipError;
|
|
188
|
-
static notFound(resource: string, id?: string): ShipError;
|
|
189
|
-
static authentication(message?: string): ShipError;
|
|
190
|
-
static business(message: string, status?: number): ShipError;
|
|
191
|
-
static network(message: string, cause?: Error): ShipError;
|
|
192
|
-
static api(message?: string, status?: number): ShipError;
|
|
193
|
-
|
|
194
|
-
// Helper methods
|
|
195
|
-
isClientError(): boolean;
|
|
196
|
-
isNetworkError(): boolean;
|
|
197
|
-
isAuthError(): boolean;
|
|
198
|
-
toResponse(): ErrorResponse;
|
|
199
|
-
}
|
|
33
|
+
if (error.isClientError()) { /* handle */ }
|
|
200
34
|
```
|
|
201
35
|
|
|
202
|
-
|
|
36
|
+
### API Response Types
|
|
203
37
|
|
|
204
38
|
```typescript
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
maxFilesCount: 1000, // Files per deployment
|
|
212
|
-
maxTotalSize: 100 * 1024 * 1024, // 100MB total
|
|
213
|
-
deploymentExpiryHours: 120, // 5 days
|
|
214
|
-
defaultLimit: 50, // Pagination default
|
|
215
|
-
maxLimit: 100, // Pagination maximum
|
|
216
|
-
} as const;
|
|
217
|
-
|
|
218
|
-
// API key format validation
|
|
219
|
-
const API_KEY_PREFIX = 'ship-';
|
|
220
|
-
const API_KEY_HEX_LENGTH = 64;
|
|
221
|
-
const API_KEY_TOTAL_LENGTH = 69; // 'ship-' + 64 hex chars
|
|
39
|
+
import type {
|
|
40
|
+
DeploymentListResponse,
|
|
41
|
+
DomainListResponse,
|
|
42
|
+
ConfigResponse,
|
|
43
|
+
BillingStatus
|
|
44
|
+
} from '@shipstatic/types';
|
|
222
45
|
```
|
|
223
46
|
|
|
224
|
-
|
|
47
|
+
### Resource Contracts
|
|
225
48
|
|
|
226
|
-
|
|
227
|
-
enum UploadStatus {
|
|
228
|
-
PENDING = 'pending',
|
|
229
|
-
SUCCESS = 'success',
|
|
230
|
-
FAILED = 'failed',
|
|
231
|
-
DELETING = 'deleting'
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
interface UploadedFile {
|
|
235
|
-
key: string; // Storage key
|
|
236
|
-
etag: string; // ETag from storage
|
|
237
|
-
size: number; // File size in bytes
|
|
238
|
-
validated?: boolean; // Whether file was validated
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
interface RateLimitData {
|
|
242
|
-
count: number; // Current request count
|
|
243
|
-
timestamp: number; // Window start timestamp
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
## Validation Utilities
|
|
49
|
+
SDK interface definitions:
|
|
248
50
|
|
|
249
51
|
```typescript
|
|
250
|
-
|
|
251
|
-
function validateApiKey(apiKey: string): void;
|
|
252
|
-
|
|
253
|
-
// Validate deploy token format
|
|
254
|
-
function validateDeployToken(deployToken: string): void;
|
|
255
|
-
|
|
256
|
-
// Validate API URL format
|
|
257
|
-
function validateApiUrl(apiUrl: string): void;
|
|
258
|
-
|
|
259
|
-
// Validate deployment subdomain format
|
|
260
|
-
function validateSubdomain(input: string): boolean;
|
|
52
|
+
import type { DeploymentResource, DomainResource, AccountResource } from '@shipstatic/types';
|
|
261
53
|
```
|
|
262
54
|
|
|
263
|
-
|
|
55
|
+
### Validation Utilities
|
|
264
56
|
|
|
265
57
|
```typescript
|
|
266
|
-
|
|
267
|
-
function generateDeploymentUrl(deployment: string, sitesDomain?: string): string;
|
|
268
|
-
|
|
269
|
-
// Generate alias URL (handles both subdomains and custom domains)
|
|
270
|
-
function generateAliasUrl(alias: string, sitesDomain?: string): string;
|
|
58
|
+
import { validateApiKey, validateDeployToken, validateSubdomain } from '@shipstatic/types';
|
|
271
59
|
```
|
|
272
60
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
### In the API
|
|
61
|
+
### Constants
|
|
276
62
|
|
|
277
63
|
```typescript
|
|
278
|
-
import {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
64
|
+
import {
|
|
65
|
+
DEFAULT_API,
|
|
66
|
+
API_KEY_PREFIX,
|
|
67
|
+
DeploymentStatus,
|
|
68
|
+
DomainStatus,
|
|
69
|
+
AccountPlan
|
|
283
70
|
} from '@shipstatic/types';
|
|
284
|
-
|
|
285
|
-
// Use shared configuration
|
|
286
|
-
const config: ConfigResponse = {
|
|
287
|
-
maxFileSize: serverConfig.maxFileSize,
|
|
288
|
-
maxFilesCount: serverConfig.maxFilesCount,
|
|
289
|
-
maxTotalSize: serverConfig.maxTotalSize,
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
// Use unified error handling
|
|
293
|
-
throw ShipError.validation('File too large', {
|
|
294
|
-
maxSize: serverConfig.maxFileSize
|
|
295
|
-
});
|
|
296
71
|
```
|
|
297
72
|
|
|
298
|
-
|
|
73
|
+
## Usage
|
|
299
74
|
|
|
300
75
|
```typescript
|
|
301
|
-
import {
|
|
302
|
-
ShipError,
|
|
303
|
-
type ConfigResponse,
|
|
304
|
-
type DeploymentListResponse,
|
|
305
|
-
generateDeploymentUrl
|
|
306
|
-
} from '@shipstatic/types';
|
|
307
|
-
|
|
308
|
-
// Handle API responses
|
|
309
|
-
const deployments: DeploymentListResponse = await api.listDeployments();
|
|
76
|
+
import { ShipError, type Deployment, DeploymentStatus } from '@shipstatic/types';
|
|
310
77
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
// Handle errors consistently
|
|
315
|
-
try {
|
|
316
|
-
const result = await deploy(files);
|
|
317
|
-
} catch (error) {
|
|
318
|
-
if (error instanceof ShipError && error.isClientError()) {
|
|
319
|
-
// Handle client errors
|
|
78
|
+
function processDeployment(deployment: Deployment) {
|
|
79
|
+
if (deployment.status === DeploymentStatus.FAILED) {
|
|
80
|
+
throw ShipError.business('Deployment failed');
|
|
320
81
|
}
|
|
321
82
|
}
|
|
322
83
|
```
|
|
323
84
|
|
|
324
|
-
##
|
|
325
|
-
|
|
326
|
-
This package is automatically installed as a dependency:
|
|
327
|
-
|
|
328
|
-
```bash
|
|
329
|
-
# Included with Ship SDK
|
|
330
|
-
npm install @shipstatic/ship
|
|
331
|
-
|
|
332
|
-
# Direct installation (if needed)
|
|
333
|
-
npm install @shipstatic/types
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
## Architecture
|
|
337
|
-
|
|
338
|
-
### Design Principles
|
|
339
|
-
|
|
340
|
-
- **Single source of truth** - All types defined once, used everywhere
|
|
341
|
-
- **Type safety** - Strict TypeScript with comprehensive validation
|
|
342
|
-
- **Wire format compatibility** - Types match actual API contracts
|
|
343
|
-
- **Error consistency** - Unified error handling across all components
|
|
344
|
-
- **Platform contracts** - Resource interfaces define SDK behavior
|
|
345
|
-
|
|
346
|
-
### Type Organization
|
|
347
|
-
|
|
348
|
-
All types are organized in a single `src/index.ts` file by category:
|
|
349
|
-
|
|
350
|
-
1. **Core entities** - Deployment, Alias, Account objects
|
|
351
|
-
2. **API responses** - Response wrappers and pagination
|
|
352
|
-
3. **Resource contracts** - SDK interface definitions
|
|
353
|
-
4. **Error system** - Unified ShipError class and error types
|
|
354
|
-
5. **Platform configuration** - Shared constants and validation
|
|
355
|
-
6. **Upload types** - File handling and status enums
|
|
356
|
-
7. **Utility functions** - URL generation and validation
|
|
357
|
-
|
|
358
|
-
## Philosophy
|
|
359
|
-
|
|
360
|
-
This package follows the **"Impossible Simplicity"** principle:
|
|
361
|
-
|
|
362
|
-
- **Clear contracts** - Types define platform behavior
|
|
363
|
-
- **Zero duplication** - Single source prevents drift
|
|
364
|
-
- **Developer experience** - Predictable, well-documented interfaces
|
|
365
|
-
- **Maintainability** - Easy to update types across entire platform
|
|
366
|
-
|
|
367
|
-
The result is type-safe development across the entire Shipstatic platform with guaranteed consistency between API, SDK, and CLI components.
|
|
368
|
-
|
|
369
|
-
---
|
|
85
|
+
## License
|
|
370
86
|
|
|
371
|
-
|
|
87
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -79,8 +79,6 @@ export interface Domain {
|
|
|
79
79
|
readonly created: number;
|
|
80
80
|
/** Whether this was a create (201) or update (200) operation */
|
|
81
81
|
readonly isCreate?: boolean;
|
|
82
|
-
/** Unix timestamp (seconds) when domain was verified */
|
|
83
|
-
verified?: number;
|
|
84
82
|
/** Unix timestamp (seconds) when deployment binding last changed */
|
|
85
83
|
bound?: number;
|
|
86
84
|
}
|
|
@@ -464,30 +462,47 @@ export declare const DEFAULT_API = "https://api.shipstatic.com";
|
|
|
464
462
|
* Node.js: string | string[] - file/directory paths
|
|
465
463
|
*/
|
|
466
464
|
export type DeployInput = File[] | string | string[];
|
|
465
|
+
/**
|
|
466
|
+
* Options for deployment creation at the API contract level.
|
|
467
|
+
* SDK implementations may extend with additional options (timeout, signal, callbacks, etc.).
|
|
468
|
+
*/
|
|
469
|
+
export interface DeploymentCreateOptions {
|
|
470
|
+
/** Optional tags for categorization and filtering */
|
|
471
|
+
tags?: string[];
|
|
472
|
+
/** Optional subdomain suggestion for the deployment */
|
|
473
|
+
subdomain?: string;
|
|
474
|
+
/** Client identifier (e.g., 'cli', 'sdk', 'web') */
|
|
475
|
+
via?: string;
|
|
476
|
+
}
|
|
467
477
|
/**
|
|
468
478
|
* Deployment resource interface - the contract all implementations must follow
|
|
469
479
|
*/
|
|
470
480
|
export interface DeploymentResource {
|
|
471
|
-
create: (input: DeployInput, options?:
|
|
481
|
+
create: (input: DeployInput, options?: DeploymentCreateOptions) => Promise<Deployment>;
|
|
472
482
|
list: () => Promise<DeploymentListResponse>;
|
|
473
|
-
remove: (id: string) => Promise<void>;
|
|
474
483
|
get: (id: string) => Promise<Deployment>;
|
|
484
|
+
set: (id: string, options: {
|
|
485
|
+
tags: string[];
|
|
486
|
+
}) => Promise<Deployment>;
|
|
487
|
+
remove: (id: string) => Promise<void>;
|
|
475
488
|
}
|
|
476
489
|
/**
|
|
477
490
|
* Domain resource interface - the contract all implementations must follow
|
|
478
491
|
*/
|
|
479
492
|
export interface DomainResource {
|
|
480
|
-
set: (
|
|
481
|
-
|
|
482
|
-
|
|
493
|
+
set: (name: string, options?: {
|
|
494
|
+
deployment?: string;
|
|
495
|
+
tags?: string[];
|
|
496
|
+
}) => Promise<Domain>;
|
|
483
497
|
list: () => Promise<DomainListResponse>;
|
|
484
|
-
|
|
485
|
-
|
|
498
|
+
get: (name: string) => Promise<Domain>;
|
|
499
|
+
remove: (name: string) => Promise<void>;
|
|
500
|
+
verify: (name: string) => Promise<{
|
|
486
501
|
message: string;
|
|
487
502
|
}>;
|
|
488
|
-
dns: (
|
|
489
|
-
records: (
|
|
490
|
-
share: (
|
|
503
|
+
dns: (name: string) => Promise<DomainDnsResponse>;
|
|
504
|
+
records: (name: string) => Promise<DomainRecordsResponse>;
|
|
505
|
+
share: (name: string) => Promise<{
|
|
491
506
|
domain: string;
|
|
492
507
|
hash: string;
|
|
493
508
|
}>;
|
|
@@ -502,7 +517,10 @@ export interface AccountResource {
|
|
|
502
517
|
* Token resource interface - the contract all implementations must follow
|
|
503
518
|
*/
|
|
504
519
|
export interface TokenResource {
|
|
505
|
-
create: (
|
|
520
|
+
create: (options?: {
|
|
521
|
+
ttl?: number;
|
|
522
|
+
tags?: string[];
|
|
523
|
+
}) => Promise<TokenCreateResponse>;
|
|
506
524
|
list: () => Promise<TokenListResponse>;
|
|
507
525
|
remove: (token: string) => Promise<void>;
|
|
508
526
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipstatic/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Shared types for Shipstatic platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"node": ">=20.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^24.10.
|
|
36
|
+
"@types/node": "^24.10.9",
|
|
37
37
|
"typescript": "^5.9.3"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
package/src/index.ts
CHANGED
|
@@ -95,8 +95,6 @@ export interface Domain {
|
|
|
95
95
|
readonly created: number;
|
|
96
96
|
/** Whether this was a create (201) or update (200) operation */
|
|
97
97
|
readonly isCreate?: boolean;
|
|
98
|
-
/** Unix timestamp (seconds) when domain was verified */
|
|
99
|
-
verified?: number; // Mutable - can be updated
|
|
100
98
|
/** Unix timestamp (seconds) when deployment binding last changed */
|
|
101
99
|
bound?: number;
|
|
102
100
|
}
|
|
@@ -716,29 +714,42 @@ export const DEFAULT_API = 'https://api.shipstatic.com';
|
|
|
716
714
|
*/
|
|
717
715
|
export type DeployInput = File[] | string | string[];
|
|
718
716
|
|
|
717
|
+
/**
|
|
718
|
+
* Options for deployment creation at the API contract level.
|
|
719
|
+
* SDK implementations may extend with additional options (timeout, signal, callbacks, etc.).
|
|
720
|
+
*/
|
|
721
|
+
export interface DeploymentCreateOptions {
|
|
722
|
+
/** Optional tags for categorization and filtering */
|
|
723
|
+
tags?: string[];
|
|
724
|
+
/** Optional subdomain suggestion for the deployment */
|
|
725
|
+
subdomain?: string;
|
|
726
|
+
/** Client identifier (e.g., 'cli', 'sdk', 'web') */
|
|
727
|
+
via?: string;
|
|
728
|
+
}
|
|
729
|
+
|
|
719
730
|
/**
|
|
720
731
|
* Deployment resource interface - the contract all implementations must follow
|
|
721
732
|
*/
|
|
722
733
|
export interface DeploymentResource {
|
|
723
|
-
create: (input: DeployInput, options?:
|
|
734
|
+
create: (input: DeployInput, options?: DeploymentCreateOptions) => Promise<Deployment>;
|
|
724
735
|
list: () => Promise<DeploymentListResponse>;
|
|
725
|
-
remove: (id: string) => Promise<void>;
|
|
726
736
|
get: (id: string) => Promise<Deployment>;
|
|
737
|
+
set: (id: string, options: { tags: string[] }) => Promise<Deployment>;
|
|
738
|
+
remove: (id: string) => Promise<void>;
|
|
727
739
|
}
|
|
728
740
|
|
|
729
741
|
/**
|
|
730
742
|
* Domain resource interface - the contract all implementations must follow
|
|
731
743
|
*/
|
|
732
744
|
export interface DomainResource {
|
|
733
|
-
set: (
|
|
734
|
-
update: (domainName: string, tags: string[]) => Promise<Domain>;
|
|
735
|
-
get: (domainName: string) => Promise<Domain>;
|
|
745
|
+
set: (name: string, options?: { deployment?: string; tags?: string[] }) => Promise<Domain>;
|
|
736
746
|
list: () => Promise<DomainListResponse>;
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
747
|
+
get: (name: string) => Promise<Domain>;
|
|
748
|
+
remove: (name: string) => Promise<void>;
|
|
749
|
+
verify: (name: string) => Promise<{ message: string }>;
|
|
750
|
+
dns: (name: string) => Promise<DomainDnsResponse>;
|
|
751
|
+
records: (name: string) => Promise<DomainRecordsResponse>;
|
|
752
|
+
share: (name: string) => Promise<{ domain: string; hash: string }>;
|
|
742
753
|
}
|
|
743
754
|
|
|
744
755
|
/**
|
|
@@ -752,7 +763,7 @@ export interface AccountResource {
|
|
|
752
763
|
* Token resource interface - the contract all implementations must follow
|
|
753
764
|
*/
|
|
754
765
|
export interface TokenResource {
|
|
755
|
-
create: (ttl?: number
|
|
766
|
+
create: (options?: { ttl?: number; tags?: string[] }) => Promise<TokenCreateResponse>;
|
|
756
767
|
list: () => Promise<TokenListResponse>;
|
|
757
768
|
remove: (token: string) => Promise<void>;
|
|
758
769
|
}
|