@shipstatic/types 0.8.10 → 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
@@ -94,6 +94,20 @@ export interface Domain {
94
94
  /** Total deployment links */
95
95
  links: number;
96
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
+ }
97
111
  /**
98
112
  * Response for listing domains
99
113
  */
@@ -536,23 +550,21 @@ export interface StaticFile {
536
550
  size: number;
537
551
  }
538
552
  /**
539
- * Standard platform configuration format used by all clients
540
- */
541
- export interface PlatformConfig {
542
- apiUrl?: string;
543
- deployToken?: string;
544
- apiKey?: string;
545
- }
546
- /**
547
- * Resolved configuration with required apiUrl.
548
- * 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.
549
561
  */
550
562
  export interface ResolvedConfig {
551
- /** API URL (always present after resolution, defaults to DEFAULT_API) */
563
+ /** API URL always present after resolution, defaults to `DEFAULT_API`. */
552
564
  apiUrl: string;
553
- /** API key for authenticated deployments */
565
+ /** API key for authenticated deployments. */
554
566
  apiKey?: string;
555
- /** Deploy token for single-use deployments */
567
+ /** Deploy token for single-use deployments. */
556
568
  deployToken?: string;
557
569
  }
558
570
  /**
@@ -572,12 +584,26 @@ export interface ProgressInfo {
572
584
  /** Default API URL if not otherwise configured. */
573
585
  export declare const DEFAULT_API = "https://api.shipstatic.com";
574
586
  /**
575
- * 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.
576
600
  *
577
- * Browser: File[] - array of File objects
578
- * 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.
579
605
  */
580
- export type DeployInput = File[] | string | string[];
606
+ export type DeployInput = BrowserDeployInput | NodeDeployInput;
581
607
  /**
582
608
  * Options for deployment creation at the API contract level.
583
609
  * SDK implementations may extend with additional options (timeout, signal, callbacks, etc.).
@@ -623,7 +649,7 @@ export interface DomainResource {
623
649
  set: (name: string, options?: {
624
650
  deployment?: string;
625
651
  labels?: string[];
626
- }) => Promise<Domain>;
652
+ }) => Promise<DomainSetResult>;
627
653
  list: () => Promise<DomainListResponse>;
628
654
  get: (name: string) => Promise<Domain>;
629
655
  remove: (name: string) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipstatic/types",
3
- "version": "0.8.10",
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
@@ -112,6 +112,21 @@ export interface Domain {
112
112
  links: number;
113
113
  }
114
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
+
115
130
  /**
116
131
  * Response for listing domains
117
132
  */
@@ -822,24 +837,21 @@ export interface StaticFile {
822
837
  // =============================================================================
823
838
 
824
839
  /**
825
- * Standard platform configuration format used by all clients
826
- */
827
- export interface PlatformConfig {
828
- apiUrl?: string;
829
- deployToken?: string;
830
- apiKey?: string;
831
- }
832
-
833
- /**
834
- * Resolved configuration with required apiUrl.
835
- * 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.
836
848
  */
837
849
  export interface ResolvedConfig {
838
- /** API URL (always present after resolution, defaults to DEFAULT_API) */
850
+ /** API URL always present after resolution, defaults to `DEFAULT_API`. */
839
851
  apiUrl: string;
840
- /** API key for authenticated deployments */
852
+ /** API key for authenticated deployments. */
841
853
  apiKey?: string;
842
- /** Deploy token for single-use deployments */
854
+ /** Deploy token for single-use deployments. */
843
855
  deployToken?: string;
844
856
  }
845
857
 
@@ -874,12 +886,28 @@ export const DEFAULT_API = 'https://api.shipstatic.com';
874
886
  // =============================================================================
875
887
 
876
888
  /**
877
- * 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.
878
904
  *
879
- * Browser: File[] - array of File objects
880
- * 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.
881
909
  */
882
- export type DeployInput = File[] | string | string[];
910
+ export type DeployInput = BrowserDeployInput | NodeDeployInput;
883
911
 
884
912
  /**
885
913
  * Options for deployment creation at the API contract level.
@@ -923,7 +951,7 @@ export interface DeploymentResource {
923
951
  * Domain resource interface - the contract all implementations must follow
924
952
  */
925
953
  export interface DomainResource {
926
- set: (name: string, options?: { deployment?: string; labels?: string[] }) => Promise<Domain>;
954
+ set: (name: string, options?: { deployment?: string; labels?: string[] }) => Promise<DomainSetResult>;
927
955
  list: () => Promise<DomainListResponse>;
928
956
  get: (name: string) => Promise<Domain>;
929
957
  remove: (name: string) => Promise<void>;