@shipstatic/types 2.5.0-beta.22 → 2.5.0-beta.23
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 +21 -0
- package/dist/index.js +23 -0
- package/package.json +1 -1
- package/src/index.ts +24 -0
package/dist/index.d.ts
CHANGED
|
@@ -712,6 +712,17 @@ export declare const ErrorType: {
|
|
|
712
712
|
readonly Business: "business_logic_error";
|
|
713
713
|
/** API server error (500). Generic server-side fault. */
|
|
714
714
|
readonly Api: "internal_server_error";
|
|
715
|
+
/**
|
|
716
|
+
* The platform is closed for maintenance (503). A deliberate operator
|
|
717
|
+
* state, not a fault — nothing errored; the API is refusing work on
|
|
718
|
+
* purpose, and deployed sites keep serving throughout.
|
|
719
|
+
*
|
|
720
|
+
* Distinct from `Api` at 503, which the platform already uses for a
|
|
721
|
+
* dependency that failed (moderation unavailable). A consumer has to tell
|
|
722
|
+
* "we closed the door" from "something broke": the two get opposite words
|
|
723
|
+
* and opposite retry behaviour.
|
|
724
|
+
*/
|
|
725
|
+
readonly Maintenance: "maintenance";
|
|
715
726
|
/** Network/connection error. Client-side only — set by HTTP clients on fetch failure; never produced server-side. */
|
|
716
727
|
readonly Network: "network_error";
|
|
717
728
|
/** Operation was cancelled. Client-side only — set on `AbortSignal` abort; never produced server-side. */
|
|
@@ -812,6 +823,16 @@ export declare class ShipError extends Error {
|
|
|
812
823
|
static file(message: string, details?: unknown): ShipError;
|
|
813
824
|
static config(message: string, details?: unknown): ShipError;
|
|
814
825
|
static api(message: string, status?: number, details?: unknown): ShipError;
|
|
826
|
+
/**
|
|
827
|
+
* The platform is closed for maintenance (503).
|
|
828
|
+
*
|
|
829
|
+
* `message` is REQUIRED and has no default here. The API is the only
|
|
830
|
+
* producer of that sentence, and a default in this file would be a second
|
|
831
|
+
* owner of one fact — see CLAUDE.md, "The Constellation Law" (stopping
|
|
832
|
+
* rule). It is also the one factory whose status is fixed rather than
|
|
833
|
+
* defaulted: a maintenance refusal is 503 or it is not this error.
|
|
834
|
+
*/
|
|
835
|
+
static maintenance(message: string, details?: unknown): ShipError;
|
|
815
836
|
/**
|
|
816
837
|
* The caller is at fault — by HTTP's own definition of a 4xx, or by a type
|
|
817
838
|
* that is client-attributable without ever having a status (`Config`,
|
package/dist/index.js
CHANGED
|
@@ -258,6 +258,17 @@ export const ErrorType = {
|
|
|
258
258
|
Business: 'business_logic_error',
|
|
259
259
|
/** API server error (500). Generic server-side fault. */
|
|
260
260
|
Api: 'internal_server_error',
|
|
261
|
+
/**
|
|
262
|
+
* The platform is closed for maintenance (503). A deliberate operator
|
|
263
|
+
* state, not a fault — nothing errored; the API is refusing work on
|
|
264
|
+
* purpose, and deployed sites keep serving throughout.
|
|
265
|
+
*
|
|
266
|
+
* Distinct from `Api` at 503, which the platform already uses for a
|
|
267
|
+
* dependency that failed (moderation unavailable). A consumer has to tell
|
|
268
|
+
* "we closed the door" from "something broke": the two get opposite words
|
|
269
|
+
* and opposite retry behaviour.
|
|
270
|
+
*/
|
|
271
|
+
Maintenance: 'maintenance',
|
|
261
272
|
/** Network/connection error. Client-side only — set by HTTP clients on fetch failure; never produced server-side. */
|
|
262
273
|
Network: 'network_error',
|
|
263
274
|
/** Operation was cancelled. Client-side only — set on `AbortSignal` abort; never produced server-side. */
|
|
@@ -562,6 +573,18 @@ export class ShipError extends Error {
|
|
|
562
573
|
static api(message, status = 500, details) {
|
|
563
574
|
return new ShipError(ErrorType.Api, message, status, details);
|
|
564
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* The platform is closed for maintenance (503).
|
|
578
|
+
*
|
|
579
|
+
* `message` is REQUIRED and has no default here. The API is the only
|
|
580
|
+
* producer of that sentence, and a default in this file would be a second
|
|
581
|
+
* owner of one fact — see CLAUDE.md, "The Constellation Law" (stopping
|
|
582
|
+
* rule). It is also the one factory whose status is fixed rather than
|
|
583
|
+
* defaulted: a maintenance refusal is 503 or it is not this error.
|
|
584
|
+
*/
|
|
585
|
+
static maintenance(message, details) {
|
|
586
|
+
return new ShipError(ErrorType.Maintenance, message, 503, details);
|
|
587
|
+
}
|
|
565
588
|
// Semantic-category guards. For specific-type checks, use
|
|
566
589
|
// `error.type === ErrorType.X` directly or the generic `isType(t)`.
|
|
567
590
|
/**
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -802,6 +802,17 @@ export const ErrorType = {
|
|
|
802
802
|
Business: 'business_logic_error',
|
|
803
803
|
/** API server error (500). Generic server-side fault. */
|
|
804
804
|
Api: 'internal_server_error',
|
|
805
|
+
/**
|
|
806
|
+
* The platform is closed for maintenance (503). A deliberate operator
|
|
807
|
+
* state, not a fault — nothing errored; the API is refusing work on
|
|
808
|
+
* purpose, and deployed sites keep serving throughout.
|
|
809
|
+
*
|
|
810
|
+
* Distinct from `Api` at 503, which the platform already uses for a
|
|
811
|
+
* dependency that failed (moderation unavailable). A consumer has to tell
|
|
812
|
+
* "we closed the door" from "something broke": the two get opposite words
|
|
813
|
+
* and opposite retry behaviour.
|
|
814
|
+
*/
|
|
815
|
+
Maintenance: 'maintenance',
|
|
805
816
|
/** Network/connection error. Client-side only — set by HTTP clients on fetch failure; never produced server-side. */
|
|
806
817
|
Network: 'network_error',
|
|
807
818
|
/** Operation was cancelled. Client-side only — set on `AbortSignal` abort; never produced server-side. */
|
|
@@ -1151,6 +1162,19 @@ export class ShipError extends Error {
|
|
|
1151
1162
|
return new ShipError(ErrorType.Api, message, status, details);
|
|
1152
1163
|
}
|
|
1153
1164
|
|
|
1165
|
+
/**
|
|
1166
|
+
* The platform is closed for maintenance (503).
|
|
1167
|
+
*
|
|
1168
|
+
* `message` is REQUIRED and has no default here. The API is the only
|
|
1169
|
+
* producer of that sentence, and a default in this file would be a second
|
|
1170
|
+
* owner of one fact — see CLAUDE.md, "The Constellation Law" (stopping
|
|
1171
|
+
* rule). It is also the one factory whose status is fixed rather than
|
|
1172
|
+
* defaulted: a maintenance refusal is 503 or it is not this error.
|
|
1173
|
+
*/
|
|
1174
|
+
static maintenance(message: string, details?: unknown): ShipError {
|
|
1175
|
+
return new ShipError(ErrorType.Maintenance, message, 503, details);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1154
1178
|
// Semantic-category guards. For specific-type checks, use
|
|
1155
1179
|
// `error.type === ErrorType.X` directly or the generic `isType(t)`.
|
|
1156
1180
|
|