@shipstatic/types 0.8.9 → 0.9.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/README.md CHANGED
@@ -21,7 +21,7 @@ npm install @shipstatic/types
21
21
  ```typescript
22
22
  import type {
23
23
  Deployment, DeploymentListResponse,
24
- Domain, DomainListResponse, DnsRecord, DomainDnsResponse, DomainRecordsResponse, DomainValidateResponse,
24
+ Domain, DomainSetResult, DomainListResponse, DnsRecord, DomainDnsResponse, DomainRecordsResponse, DomainValidateResponse,
25
25
  Token, TokenListItem, TokenListResponse, TokenCreateResponse,
26
26
  Account, AccountUsage, AccountOverrides,
27
27
  StaticFile
package/dist/index.d.ts CHANGED
@@ -26,8 +26,10 @@ export interface Deployment {
26
26
  readonly size: number;
27
27
  /** Current deployment status */
28
28
  status: DeploymentStatusType;
29
- /** Whether deployment has configuration */
29
+ /** Whether deployment has a ship.json config */
30
30
  readonly config: boolean;
31
+ /** Whether deployment has a password set */
32
+ readonly password: boolean;
31
33
  /** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
32
34
  labels: string[];
33
35
  /** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli'), null if unknown */
@@ -92,6 +94,20 @@ export interface Domain {
92
94
  /** Total deployment links */
93
95
  links: number;
94
96
  }
97
+ /**
98
+ * Return shape of `domains.set()` — `Domain` plus an SDK-derived flag indicating
99
+ * whether the underlying `PUT /domains/:name` created the record (HTTP 201) or
100
+ * updated an existing one (HTTP 200).
101
+ *
102
+ * `isCreate` is not part of the wire format — the API returns a plain `Domain`
103
+ * body. The SDK derives the flag from the HTTP status code so callers (notably
104
+ * the CLI) can format different output for the create vs repoint paths without
105
+ * a second round-trip.
106
+ */
107
+ export interface DomainSetResult extends Domain {
108
+ /** `true` when this call created a new domain; `false` when it updated an existing one. */
109
+ isCreate: boolean;
110
+ }
95
111
  /**
96
112
  * Response for listing domains
97
113
  */
@@ -534,23 +550,21 @@ export interface StaticFile {
534
550
  size: number;
535
551
  }
536
552
  /**
537
- * Standard platform configuration format used by all clients
538
- */
539
- export interface PlatformConfig {
540
- apiUrl?: string;
541
- deployToken?: string;
542
- apiKey?: string;
543
- }
544
- /**
545
- * Resolved configuration with required apiUrl.
546
- * This is the normalized config after merging options, env, and config files.
553
+ * Resolved client configuration with `apiUrl` defaulted.
554
+ *
555
+ * Produced by the SDK after layering its credential sources (constructor
556
+ * options on top of `SHIP_*` env vars in Node; constructor options only in
557
+ * Browser) and applying the `DEFAULT_API` fallback. File-based sources
558
+ * (`.shiprc`, `package.json` `"ship"` key) are the CLI's responsibility and
559
+ * are merged in *before* construction — by the time a `ResolvedConfig`
560
+ * exists, every source has already collapsed into the constructor argument.
547
561
  */
548
562
  export interface ResolvedConfig {
549
- /** API URL (always present after resolution, defaults to DEFAULT_API) */
563
+ /** API URL always present after resolution, defaults to `DEFAULT_API`. */
550
564
  apiUrl: string;
551
- /** API key for authenticated deployments */
565
+ /** API key for authenticated deployments. */
552
566
  apiKey?: string;
553
- /** Deploy token for single-use deployments */
567
+ /** Deploy token for single-use deployments. */
554
568
  deployToken?: string;
555
569
  }
556
570
  /**
@@ -570,12 +584,26 @@ export interface ProgressInfo {
570
584
  /** Default API URL if not otherwise configured. */
571
585
  export declare const DEFAULT_API = "https://api.shipstatic.com";
572
586
  /**
573
- * Deploy input type - environment-specific
587
+ * Browser-specific deploy input an array of `File` objects (typically from
588
+ * `<input type="file">` or drag-and-drop). The Browser SDK rejects any other
589
+ * shape at runtime.
590
+ */
591
+ export type BrowserDeployInput = File[];
592
+ /**
593
+ * Node-specific deploy input — file or directory path(s) on disk. A single
594
+ * path or an array of paths; directories are walked recursively. The Node
595
+ * SDK rejects any other shape at runtime.
596
+ */
597
+ export type NodeDeployInput = string | string[];
598
+ /**
599
+ * Universal deploy input — the union of every platform's accepted shape.
574
600
  *
575
- * Browser: File[] - array of File objects
576
- * Node.js: string | string[] - file/directory paths
601
+ * Prefer the platform-specific aliases (`BrowserDeployInput` /
602
+ * `NodeDeployInput`) when writing platform-specific code; `DeployInput` is
603
+ * the right type only for code that genuinely needs to accept either. Each
604
+ * platform's SDK validates at runtime and throws on the wrong shape.
577
605
  */
578
- export type DeployInput = File[] | string | string[];
606
+ export type DeployInput = BrowserDeployInput | NodeDeployInput;
579
607
  /**
580
608
  * Options for deployment creation at the API contract level.
581
609
  * SDK implementations may extend with additional options (timeout, signal, callbacks, etc.).
@@ -621,7 +649,7 @@ export interface DomainResource {
621
649
  set: (name: string, options?: {
622
650
  deployment?: string;
623
651
  labels?: string[];
624
- }) => Promise<Domain>;
652
+ }) => Promise<DomainSetResult>;
625
653
  list: () => Promise<DomainListResponse>;
626
654
  get: (name: string) => Promise<Domain>;
627
655
  remove: (name: string) => Promise<void>;
@@ -737,8 +765,10 @@ export interface ActivityMeta {
737
765
  files?: number;
738
766
  /** Total size in bytes */
739
767
  size?: number;
740
- /** Whether deployment has config */
768
+ /** Whether deployment has a ship.json config */
741
769
  hasConfig?: boolean;
770
+ /** Whether deployment has a password set */
771
+ hasPassword?: boolean;
742
772
  /** Whether this was an update (vs create) */
743
773
  isUpdate?: boolean;
744
774
  /** Whether domain was already verified */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipstatic/types",
3
- "version": "0.8.9",
3
+ "version": "0.9.0",
4
4
  "description": "Shared types for ShipStatic platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -33,8 +33,10 @@ export interface Deployment {
33
33
  readonly size: number;
34
34
  /** Current deployment status */
35
35
  status: DeploymentStatusType; // Mutable - can be updated
36
- /** Whether deployment has configuration */
36
+ /** Whether deployment has a ship.json config */
37
37
  readonly config: boolean;
38
+ /** Whether deployment has a password set */
39
+ readonly password: boolean;
38
40
  /** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
39
41
  labels: string[];
40
42
  /** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli'), null if unknown */
@@ -110,6 +112,21 @@ export interface Domain {
110
112
  links: number;
111
113
  }
112
114
 
115
+ /**
116
+ * Return shape of `domains.set()` — `Domain` plus an SDK-derived flag indicating
117
+ * whether the underlying `PUT /domains/:name` created the record (HTTP 201) or
118
+ * updated an existing one (HTTP 200).
119
+ *
120
+ * `isCreate` is not part of the wire format — the API returns a plain `Domain`
121
+ * body. The SDK derives the flag from the HTTP status code so callers (notably
122
+ * the CLI) can format different output for the create vs repoint paths without
123
+ * a second round-trip.
124
+ */
125
+ export interface DomainSetResult extends Domain {
126
+ /** `true` when this call created a new domain; `false` when it updated an existing one. */
127
+ isCreate: boolean;
128
+ }
129
+
113
130
  /**
114
131
  * Response for listing domains
115
132
  */
@@ -820,24 +837,21 @@ export interface StaticFile {
820
837
  // =============================================================================
821
838
 
822
839
  /**
823
- * Standard platform configuration format used by all clients
824
- */
825
- export interface PlatformConfig {
826
- apiUrl?: string;
827
- deployToken?: string;
828
- apiKey?: string;
829
- }
830
-
831
- /**
832
- * Resolved configuration with required apiUrl.
833
- * This is the normalized config after merging options, env, and config files.
840
+ * Resolved client configuration with `apiUrl` defaulted.
841
+ *
842
+ * Produced by the SDK after layering its credential sources (constructor
843
+ * options on top of `SHIP_*` env vars in Node; constructor options only in
844
+ * Browser) and applying the `DEFAULT_API` fallback. File-based sources
845
+ * (`.shiprc`, `package.json` `"ship"` key) are the CLI's responsibility and
846
+ * are merged in *before* construction — by the time a `ResolvedConfig`
847
+ * exists, every source has already collapsed into the constructor argument.
834
848
  */
835
849
  export interface ResolvedConfig {
836
- /** API URL (always present after resolution, defaults to DEFAULT_API) */
850
+ /** API URL always present after resolution, defaults to `DEFAULT_API`. */
837
851
  apiUrl: string;
838
- /** API key for authenticated deployments */
852
+ /** API key for authenticated deployments. */
839
853
  apiKey?: string;
840
- /** Deploy token for single-use deployments */
854
+ /** Deploy token for single-use deployments. */
841
855
  deployToken?: string;
842
856
  }
843
857
 
@@ -872,12 +886,28 @@ export const DEFAULT_API = 'https://api.shipstatic.com';
872
886
  // =============================================================================
873
887
 
874
888
  /**
875
- * Deploy input type - environment-specific
889
+ * Browser-specific deploy input an array of `File` objects (typically from
890
+ * `<input type="file">` or drag-and-drop). The Browser SDK rejects any other
891
+ * shape at runtime.
892
+ */
893
+ export type BrowserDeployInput = File[];
894
+
895
+ /**
896
+ * Node-specific deploy input — file or directory path(s) on disk. A single
897
+ * path or an array of paths; directories are walked recursively. The Node
898
+ * SDK rejects any other shape at runtime.
899
+ */
900
+ export type NodeDeployInput = string | string[];
901
+
902
+ /**
903
+ * Universal deploy input — the union of every platform's accepted shape.
876
904
  *
877
- * Browser: File[] - array of File objects
878
- * Node.js: string | string[] - file/directory paths
905
+ * Prefer the platform-specific aliases (`BrowserDeployInput` /
906
+ * `NodeDeployInput`) when writing platform-specific code; `DeployInput` is
907
+ * the right type only for code that genuinely needs to accept either. Each
908
+ * platform's SDK validates at runtime and throws on the wrong shape.
879
909
  */
880
- export type DeployInput = File[] | string | string[];
910
+ export type DeployInput = BrowserDeployInput | NodeDeployInput;
881
911
 
882
912
  /**
883
913
  * Options for deployment creation at the API contract level.
@@ -921,7 +951,7 @@ export interface DeploymentResource {
921
951
  * Domain resource interface - the contract all implementations must follow
922
952
  */
923
953
  export interface DomainResource {
924
- set: (name: string, options?: { deployment?: string; labels?: string[] }) => Promise<Domain>;
954
+ set: (name: string, options?: { deployment?: string; labels?: string[] }) => Promise<DomainSetResult>;
925
955
  list: () => Promise<DomainListResponse>;
926
956
  get: (name: string) => Promise<Domain>;
927
957
  remove: (name: string) => Promise<void>;
@@ -1112,8 +1142,10 @@ export interface ActivityMeta {
1112
1142
  files?: number;
1113
1143
  /** Total size in bytes */
1114
1144
  size?: number;
1115
- /** Whether deployment has config */
1145
+ /** Whether deployment has a ship.json config */
1116
1146
  hasConfig?: boolean;
1147
+ /** Whether deployment has a password set */
1148
+ hasPassword?: boolean;
1117
1149
 
1118
1150
  // Domain events
1119
1151
  /** Whether this was an update (vs create) */