@outfitter/contracts 0.1.0 → 0.2.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/dist/actions.d.ts +3 -3
- package/dist/assert/index.d.ts +2 -2
- package/dist/assert/index.js +2 -2
- package/dist/context.d.ts +3 -3
- package/dist/context.js +1 -1
- package/dist/envelope.d.ts +2 -2
- package/dist/envelope.js +4 -4
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +4 -2
- package/dist/handler.d.ts +2 -2
- package/dist/index.d.ts +12 -12
- package/dist/index.js +12 -8
- package/dist/recovery.d.ts +2 -2
- package/dist/resilience.d.ts +2 -2
- package/dist/resilience.js +2 -2
- package/dist/result/index.d.ts +2 -2
- package/dist/result/index.js +3 -1
- package/dist/result/utilities.d.ts +2 -2
- package/dist/result/utilities.js +3 -1
- package/dist/serialization.d.ts +2 -2
- package/dist/serialization.js +2 -2
- package/dist/shared/@outfitter/{contracts-jhsgc85s.js → contracts-0cj49e1a.js} +70 -2
- package/dist/shared/@outfitter/{contracts-d1thk8cv.js → contracts-2f3khqcc.js} +1 -1
- package/dist/shared/@outfitter/{contracts-ev4a68sg.d.ts → contracts-5hr9pdcq.d.ts} +64 -2
- package/dist/shared/@outfitter/{contracts-0taqjz0a.d.ts → contracts-6atxbfag.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-y8qg2nvz.js → contracts-agmt8915.js} +6 -6
- package/dist/shared/@outfitter/{contracts-dbpj0b4k.js → contracts-agvdgx9j.js} +21 -1
- package/dist/shared/@outfitter/{contracts-yp3derbe.d.ts → contracts-amd2ykn8.d.ts} +7 -1
- package/dist/shared/@outfitter/{contracts-109drsem.d.ts → contracts-ar0etwtx.d.ts} +23 -1
- package/dist/shared/@outfitter/{contracts-t3j7fba3.d.ts → contracts-jbhbyhtt.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-q9tjk2zp.d.ts → contracts-k0rhaye3.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-sf5p84cc.js → contracts-k2jdpbb6.js} +1 -1
- package/dist/shared/@outfitter/{contracts-47aemgd3.d.ts → contracts-md2mvvyt.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-g82822x1.d.ts → contracts-n9hb6hqt.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-aq745b7n.js → contracts-pdk7s4t8.js} +1 -1
- package/dist/shared/@outfitter/{contracts-37891j7e.d.ts → contracts-r64j5rsm.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-chnm7kvm.js → contracts-rtsa2s0f.js} +3 -3
- package/dist/shared/@outfitter/{contracts-wwkk3j4m.d.ts → contracts-t68dwjbk.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-r06bafs8.js → contracts-zx72gyh1.js} +6 -1
- package/dist/shared/@outfitter/{contracts-vtrf6rbx.d.ts → contracts-zyanj0gf.d.ts} +2 -2
- package/dist/validation.d.ts +2 -2
- package/dist/validation.js +2 -2
- package/package.json +1 -1
package/dist/actions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ACTION_SURFACES, ActionApiSpec, ActionCliInputContext, ActionCliOption, ActionCliSpec, ActionMcpSpec, ActionRegistry, ActionSpec, ActionSurface, ActionTrpcSpec, AnyActionSpec, DEFAULT_REGISTRY_SURFACES, HttpMethod, createActionRegistry, defineAction } from "./shared/@outfitter/contracts-
|
|
2
|
-
import "./shared/@outfitter/contracts-
|
|
3
|
-
import "./shared/@outfitter/contracts-
|
|
1
|
+
import { ACTION_SURFACES, ActionApiSpec, ActionCliInputContext, ActionCliOption, ActionCliSpec, ActionMcpSpec, ActionRegistry, ActionSpec, ActionSurface, ActionTrpcSpec, AnyActionSpec, DEFAULT_REGISTRY_SURFACES, HttpMethod, createActionRegistry, defineAction } from "./shared/@outfitter/contracts-zyanj0gf";
|
|
2
|
+
import "./shared/@outfitter/contracts-amd2ykn8";
|
|
3
|
+
import "./shared/@outfitter/contracts-5hr9pdcq";
|
|
4
4
|
export { defineAction, createActionRegistry, HttpMethod, DEFAULT_REGISTRY_SURFACES, AnyActionSpec, ActionTrpcSpec, ActionSurface, ActionSpec, ActionRegistry, ActionMcpSpec, ActionCliSpec, ActionCliOption, ActionCliInputContext, ActionApiSpec, ACTION_SURFACES };
|
package/dist/assert/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { NonEmptyArray, assertDefined, assertMatches, assertNonEmpty, isNonEmptyArray } from "../shared/@outfitter/contracts-
|
|
2
|
-
import "../shared/@outfitter/contracts-
|
|
1
|
+
import { NonEmptyArray, assertDefined, assertMatches, assertNonEmpty, isNonEmptyArray } from "../shared/@outfitter/contracts-jbhbyhtt";
|
|
2
|
+
import "../shared/@outfitter/contracts-5hr9pdcq";
|
|
3
3
|
export { isNonEmptyArray, assertNonEmpty, assertMatches, assertDefined, NonEmptyArray };
|
package/dist/assert/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
assertMatches,
|
|
5
5
|
assertNonEmpty,
|
|
6
6
|
isNonEmptyArray
|
|
7
|
-
} from "../shared/@outfitter/contracts-
|
|
8
|
-
import"../shared/@outfitter/contracts-
|
|
7
|
+
} from "../shared/@outfitter/contracts-2f3khqcc.js";
|
|
8
|
+
import"../shared/@outfitter/contracts-0cj49e1a.js";
|
|
9
9
|
export {
|
|
10
10
|
isNonEmptyArray,
|
|
11
11
|
assertNonEmpty,
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateContextOptions, createContext, generateRequestId } from "./shared/@outfitter/contracts-
|
|
2
|
-
import "./shared/@outfitter/contracts-
|
|
3
|
-
import "./shared/@outfitter/contracts-
|
|
1
|
+
import { CreateContextOptions, createContext, generateRequestId } from "./shared/@outfitter/contracts-t68dwjbk";
|
|
2
|
+
import "./shared/@outfitter/contracts-amd2ykn8";
|
|
3
|
+
import "./shared/@outfitter/contracts-5hr9pdcq";
|
|
4
4
|
export { generateRequestId, createContext, CreateContextOptions };
|
package/dist/context.js
CHANGED
package/dist/envelope.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Envelope, EnvelopeMeta, ErrorEnvelope, HttpResponse, PaginationMeta, SuccessEnvelope, toEnvelope, toHttpResponse } from "./shared/@outfitter/contracts-
|
|
2
|
-
import "./shared/@outfitter/contracts-
|
|
1
|
+
import { Envelope, EnvelopeMeta, ErrorEnvelope, HttpResponse, PaginationMeta, SuccessEnvelope, toEnvelope, toHttpResponse } from "./shared/@outfitter/contracts-k0rhaye3";
|
|
2
|
+
import "./shared/@outfitter/contracts-5hr9pdcq";
|
|
3
3
|
export { toHttpResponse, toEnvelope, SuccessEnvelope, PaginationMeta, HttpResponse, ErrorEnvelope, EnvelopeMeta, Envelope };
|
package/dist/envelope.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
toEnvelope,
|
|
4
4
|
toHttpResponse
|
|
5
|
-
} from "./shared/@outfitter/contracts-
|
|
6
|
-
import"./shared/@outfitter/contracts-
|
|
5
|
+
} from "./shared/@outfitter/contracts-rtsa2s0f.js";
|
|
6
|
+
import"./shared/@outfitter/contracts-agvdgx9j.js";
|
|
7
7
|
import"./shared/@outfitter/contracts-s15x2rs4.js";
|
|
8
|
-
import"./shared/@outfitter/contracts-
|
|
9
|
-
import"./shared/@outfitter/contracts-
|
|
8
|
+
import"./shared/@outfitter/contracts-agmt8915.js";
|
|
9
|
+
import"./shared/@outfitter/contracts-0cj49e1a.js";
|
|
10
10
|
export {
|
|
11
11
|
toHttpResponse,
|
|
12
12
|
toEnvelope
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AnyKitError, AssertionError, AuthError, CancelledError, ConflictError, ERROR_CODES, ErrorCategory, ErrorCode, InternalError, KitErrorProps, NetworkError, NotFoundError, OutfitterError, PermissionError, RateLimitError, SerializedError, TimeoutError, ValidationError, exitCodeMap, getExitCode, getStatusCode, statusCodeMap } from "./shared/@outfitter/contracts-
|
|
2
|
-
export { statusCodeMap, getStatusCode, getExitCode, exitCodeMap, ValidationError, TimeoutError, SerializedError, RateLimitError, PermissionError, OutfitterError, NotFoundError, NetworkError, KitErrorProps, InternalError, ErrorCode, ErrorCategory, ERROR_CODES, ConflictError, CancelledError, AuthError, AssertionError, AnyKitError };
|
|
1
|
+
import { AmbiguousError, AnyKitError, AssertionError, AuthError, CancelledError, ConflictError, ERROR_CODES, ErrorCategory, ErrorCode, InternalError, KitErrorProps, NetworkError, NotFoundError, OutfitterError, PermissionError, RateLimitError, SerializedError, TimeoutError, ValidationError, exitCodeMap, getExitCode, getStatusCode, statusCodeMap } from "./shared/@outfitter/contracts-5hr9pdcq";
|
|
2
|
+
export { statusCodeMap, getStatusCode, getExitCode, exitCodeMap, ValidationError, TimeoutError, SerializedError, RateLimitError, PermissionError, OutfitterError, NotFoundError, NetworkError, KitErrorProps, InternalError, ErrorCode, ErrorCategory, ERROR_CODES, ConflictError, CancelledError, AuthError, AssertionError, AnyKitError, AmbiguousError };
|
package/dist/errors.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
+
AmbiguousError,
|
|
3
4
|
AssertionError,
|
|
4
5
|
AuthError,
|
|
5
6
|
CancelledError,
|
|
@@ -16,7 +17,7 @@ import {
|
|
|
16
17
|
getExitCode,
|
|
17
18
|
getStatusCode,
|
|
18
19
|
statusCodeMap
|
|
19
|
-
} from "./shared/@outfitter/contracts-
|
|
20
|
+
} from "./shared/@outfitter/contracts-0cj49e1a.js";
|
|
20
21
|
export {
|
|
21
22
|
statusCodeMap,
|
|
22
23
|
getStatusCode,
|
|
@@ -33,5 +34,6 @@ export {
|
|
|
33
34
|
ConflictError,
|
|
34
35
|
CancelledError,
|
|
35
36
|
AuthError,
|
|
36
|
-
AssertionError
|
|
37
|
+
AssertionError,
|
|
38
|
+
AmbiguousError
|
|
37
39
|
};
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Handler, HandlerContext, Logger, ResolvedConfig, SyncHandler } from "./shared/@outfitter/contracts-
|
|
2
|
-
import "./shared/@outfitter/contracts-
|
|
1
|
+
import { Handler, HandlerContext, Logger, ResolvedConfig, SyncHandler } from "./shared/@outfitter/contracts-amd2ykn8";
|
|
2
|
+
import "./shared/@outfitter/contracts-5hr9pdcq";
|
|
3
3
|
export { SyncHandler, ResolvedConfig, Logger, HandlerContext, Handler };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ACTION_CAPABILITIES, ActionCapability, CAPABILITY_SURFACES, CapabilitySurface, DEFAULT_ACTION_SURFACES, capability, capabilityAll, getActionsForSurface } from "./shared/@outfitter/contracts-bb4hjt8g";
|
|
2
2
|
import { DEFAULT_PATTERNS, DEFAULT_SENSITIVE_KEYS, RedactionCallback, RedactionEvent, Redactor, RedactorConfig, createRedactor } from "./shared/@outfitter/contracts-e70qdasg";
|
|
3
|
-
import { BackoffOptions, getBackoffDelay, isRecoverable, isRetryable, shouldRetry } from "./shared/@outfitter/contracts-
|
|
4
|
-
import { ACTION_SURFACES, ActionApiSpec, ActionCliInputContext, ActionCliOption, ActionCliSpec, ActionMcpSpec, ActionRegistry, ActionSpec, ActionSurface, ActionTrpcSpec, AnyActionSpec, DEFAULT_REGISTRY_SURFACES, HttpMethod, createActionRegistry, defineAction } from "./shared/@outfitter/contracts-
|
|
5
|
-
import { RetryOptions, TimeoutOptions, retry, withTimeout } from "./shared/@outfitter/contracts-
|
|
3
|
+
import { BackoffOptions, getBackoffDelay, isRecoverable, isRetryable, shouldRetry } from "./shared/@outfitter/contracts-md2mvvyt";
|
|
4
|
+
import { ACTION_SURFACES, ActionApiSpec, ActionCliInputContext, ActionCliOption, ActionCliSpec, ActionMcpSpec, ActionRegistry, ActionSpec, ActionSurface, ActionTrpcSpec, AnyActionSpec, DEFAULT_REGISTRY_SURFACES, HttpMethod, createActionRegistry, defineAction } from "./shared/@outfitter/contracts-zyanj0gf";
|
|
5
|
+
import { RetryOptions, TimeoutOptions, retry, withTimeout } from "./shared/@outfitter/contracts-r64j5rsm";
|
|
6
6
|
import "./shared/@outfitter/contracts-qaccq0gf";
|
|
7
|
-
import { combine2, combine3, orElse, unwrapOrElse } from "./shared/@outfitter/contracts-
|
|
8
|
-
import { NonEmptyArray, assertDefined, assertMatches, assertNonEmpty, isNonEmptyArray } from "./shared/@outfitter/contracts-
|
|
7
|
+
import { combine2, combine3, expect, orElse, unwrapOrElse } from "./shared/@outfitter/contracts-ar0etwtx";
|
|
8
|
+
import { NonEmptyArray, assertDefined, assertMatches, assertNonEmpty, isNonEmptyArray } from "./shared/@outfitter/contracts-jbhbyhtt";
|
|
9
9
|
import { AdapterAuthError, AuthAdapter, CacheAdapter, CacheError, IndexAdapter, IndexError, IndexStats, SearchOptions, SearchResult, StorageAdapter, StorageError } from "./shared/@outfitter/contracts-93dx53mt";
|
|
10
|
-
import { Envelope, EnvelopeMeta, ErrorEnvelope, HttpResponse, PaginationMeta, SuccessEnvelope, toEnvelope, toHttpResponse } from "./shared/@outfitter/contracts-
|
|
11
|
-
import { SerializeErrorOptions, deserializeError, safeParse, safeStringify, serializeError } from "./shared/@outfitter/contracts-
|
|
12
|
-
import { CreateContextOptions, createContext, generateRequestId } from "./shared/@outfitter/contracts-
|
|
13
|
-
import { Handler, HandlerContext, Logger, ResolvedConfig, SyncHandler } from "./shared/@outfitter/contracts-
|
|
14
|
-
import { createValidator, validateInput } from "./shared/@outfitter/contracts-
|
|
15
|
-
import { AnyKitError, AssertionError, AuthError, CancelledError, ConflictError, ERROR_CODES, ErrorCategory, ErrorCode, InternalError, KitErrorProps, NetworkError, NotFoundError, OutfitterError, PermissionError, RateLimitError, SerializedError, TimeoutError, ValidationError, exitCodeMap, getExitCode, getStatusCode, statusCodeMap } from "./shared/@outfitter/contracts-
|
|
10
|
+
import { Envelope, EnvelopeMeta, ErrorEnvelope, HttpResponse, PaginationMeta, SuccessEnvelope, toEnvelope, toHttpResponse } from "./shared/@outfitter/contracts-k0rhaye3";
|
|
11
|
+
import { SerializeErrorOptions, deserializeError, safeParse, safeStringify, serializeError } from "./shared/@outfitter/contracts-6atxbfag";
|
|
12
|
+
import { CreateContextOptions, createContext, generateRequestId } from "./shared/@outfitter/contracts-t68dwjbk";
|
|
13
|
+
import { Handler, HandlerContext, Logger, ResolvedConfig, SyncHandler } from "./shared/@outfitter/contracts-amd2ykn8";
|
|
14
|
+
import { createValidator, validateInput } from "./shared/@outfitter/contracts-n9hb6hqt";
|
|
15
|
+
import { AmbiguousError, AnyKitError, AssertionError, AuthError, CancelledError, ConflictError, ERROR_CODES, ErrorCategory, ErrorCode, InternalError, KitErrorProps, NetworkError, NotFoundError, OutfitterError, PermissionError, RateLimitError, SerializedError, TimeoutError, ValidationError, exitCodeMap, getExitCode, getStatusCode, statusCodeMap } from "./shared/@outfitter/contracts-5hr9pdcq";
|
|
16
16
|
import { TaggedErrorClass } from "better-result";
|
|
17
17
|
import { Result, TaggedError } from "better-result";
|
|
18
|
-
export { withTimeout, validateInput, unwrapOrElse, toHttpResponse, toEnvelope, statusCodeMap, shouldRetry, serializeError, safeStringify, safeParse, retry, orElse, isRetryable, isRecoverable, isNonEmptyArray, getStatusCode, getExitCode, getBackoffDelay, getActionsForSurface, generateRequestId, exitCodeMap, deserializeError, defineAction, createValidator, createRedactor, createContext, createActionRegistry, combine3, combine2, capabilityAll, capability, assertNonEmpty, assertMatches, assertDefined, ValidationError, TimeoutOptions, TimeoutError, TaggedErrorClass, TaggedError, SyncHandler, SuccessEnvelope, StorageError, StorageAdapter, SerializedError, SerializeErrorOptions, SearchResult, SearchOptions, RetryOptions, Result, ResolvedConfig, RedactorConfig, Redactor, RedactionEvent, RedactionCallback, RateLimitError, PermissionError, PaginationMeta, OutfitterError, NotFoundError, NonEmptyArray, NetworkError, Logger, KitErrorProps, InternalError, IndexStats, IndexError, IndexAdapter, HttpResponse, HttpMethod, HandlerContext, Handler, ErrorEnvelope, ErrorCode, ErrorCategory, EnvelopeMeta, Envelope, ERROR_CODES, DEFAULT_SENSITIVE_KEYS, DEFAULT_REGISTRY_SURFACES, DEFAULT_PATTERNS, DEFAULT_ACTION_SURFACES, CreateContextOptions, ConflictError, CapabilitySurface, CancelledError, CacheError, CacheAdapter, CAPABILITY_SURFACES, BackoffOptions, AuthError, AuthAdapter, AssertionError, AnyKitError, AnyActionSpec, AdapterAuthError, ActionTrpcSpec, ActionSurface, ActionSpec, ActionRegistry, ActionMcpSpec, ActionCliSpec, ActionCliOption, ActionCliInputContext, ActionCapability, ActionApiSpec, ACTION_SURFACES, ACTION_CAPABILITIES };
|
|
18
|
+
export { withTimeout, validateInput, unwrapOrElse, toHttpResponse, toEnvelope, statusCodeMap, shouldRetry, serializeError, safeStringify, safeParse, retry, orElse, isRetryable, isRecoverable, isNonEmptyArray, getStatusCode, getExitCode, getBackoffDelay, getActionsForSurface, generateRequestId, expect, exitCodeMap, deserializeError, defineAction, createValidator, createRedactor, createContext, createActionRegistry, combine3, combine2, capabilityAll, capability, assertNonEmpty, assertMatches, assertDefined, ValidationError, TimeoutOptions, TimeoutError, TaggedErrorClass, TaggedError, SyncHandler, SuccessEnvelope, StorageError, StorageAdapter, SerializedError, SerializeErrorOptions, SearchResult, SearchOptions, RetryOptions, Result, ResolvedConfig, RedactorConfig, Redactor, RedactionEvent, RedactionCallback, RateLimitError, PermissionError, PaginationMeta, OutfitterError, NotFoundError, NonEmptyArray, NetworkError, Logger, KitErrorProps, InternalError, IndexStats, IndexError, IndexAdapter, HttpResponse, HttpMethod, HandlerContext, Handler, ErrorEnvelope, ErrorCode, ErrorCategory, EnvelopeMeta, Envelope, ERROR_CODES, DEFAULT_SENSITIVE_KEYS, DEFAULT_REGISTRY_SURFACES, DEFAULT_PATTERNS, DEFAULT_ACTION_SURFACES, CreateContextOptions, ConflictError, CapabilitySurface, CancelledError, CacheError, CacheAdapter, CAPABILITY_SURFACES, BackoffOptions, AuthError, AuthAdapter, AssertionError, AnyKitError, AnyActionSpec, AmbiguousError, AdapterAuthError, ActionTrpcSpec, ActionSurface, ActionSpec, ActionRegistry, ActionMcpSpec, ActionCliSpec, ActionCliOption, ActionCliInputContext, ActionCapability, ActionApiSpec, ACTION_SURFACES, ACTION_CAPABILITIES };
|
package/dist/index.js
CHANGED
|
@@ -22,30 +22,31 @@ import {
|
|
|
22
22
|
import {
|
|
23
23
|
retry,
|
|
24
24
|
withTimeout
|
|
25
|
-
} from "./shared/@outfitter/contracts-
|
|
25
|
+
} from "./shared/@outfitter/contracts-pdk7s4t8.js";
|
|
26
26
|
import"./shared/@outfitter/contracts-37gpc56f.js";
|
|
27
27
|
import {
|
|
28
28
|
combine2,
|
|
29
29
|
combine3,
|
|
30
|
+
expect,
|
|
30
31
|
orElse,
|
|
31
32
|
unwrapOrElse
|
|
32
|
-
} from "./shared/@outfitter/contracts-
|
|
33
|
+
} from "./shared/@outfitter/contracts-zx72gyh1.js";
|
|
33
34
|
import {
|
|
34
35
|
assertDefined,
|
|
35
36
|
assertMatches,
|
|
36
37
|
assertNonEmpty,
|
|
37
38
|
isNonEmptyArray
|
|
38
|
-
} from "./shared/@outfitter/contracts-
|
|
39
|
+
} from "./shared/@outfitter/contracts-2f3khqcc.js";
|
|
39
40
|
import {
|
|
40
41
|
toEnvelope,
|
|
41
42
|
toHttpResponse
|
|
42
|
-
} from "./shared/@outfitter/contracts-
|
|
43
|
+
} from "./shared/@outfitter/contracts-rtsa2s0f.js";
|
|
43
44
|
import {
|
|
44
45
|
deserializeError,
|
|
45
46
|
safeParse,
|
|
46
47
|
safeStringify,
|
|
47
48
|
serializeError
|
|
48
|
-
} from "./shared/@outfitter/contracts-
|
|
49
|
+
} from "./shared/@outfitter/contracts-agvdgx9j.js";
|
|
49
50
|
import {
|
|
50
51
|
DEFAULT_PATTERNS,
|
|
51
52
|
DEFAULT_SENSITIVE_KEYS,
|
|
@@ -54,12 +55,13 @@ import {
|
|
|
54
55
|
import {
|
|
55
56
|
createContext,
|
|
56
57
|
generateRequestId
|
|
57
|
-
} from "./shared/@outfitter/contracts-
|
|
58
|
+
} from "./shared/@outfitter/contracts-agmt8915.js";
|
|
58
59
|
import {
|
|
59
60
|
createValidator,
|
|
60
61
|
validateInput
|
|
61
|
-
} from "./shared/@outfitter/contracts-
|
|
62
|
+
} from "./shared/@outfitter/contracts-k2jdpbb6.js";
|
|
62
63
|
import {
|
|
64
|
+
AmbiguousError,
|
|
63
65
|
AssertionError,
|
|
64
66
|
AuthError,
|
|
65
67
|
CancelledError,
|
|
@@ -76,7 +78,7 @@ import {
|
|
|
76
78
|
getExitCode,
|
|
77
79
|
getStatusCode,
|
|
78
80
|
statusCodeMap
|
|
79
|
-
} from "./shared/@outfitter/contracts-
|
|
81
|
+
} from "./shared/@outfitter/contracts-0cj49e1a.js";
|
|
80
82
|
|
|
81
83
|
// packages/contracts/src/index.ts
|
|
82
84
|
import { Result, TaggedError } from "better-result";
|
|
@@ -101,6 +103,7 @@ export {
|
|
|
101
103
|
getBackoffDelay,
|
|
102
104
|
getActionsForSurface,
|
|
103
105
|
generateRequestId,
|
|
106
|
+
expect,
|
|
104
107
|
exitCodeMap,
|
|
105
108
|
deserializeError,
|
|
106
109
|
defineAction,
|
|
@@ -134,6 +137,7 @@ export {
|
|
|
134
137
|
CAPABILITY_SURFACES,
|
|
135
138
|
AuthError,
|
|
136
139
|
AssertionError,
|
|
140
|
+
AmbiguousError,
|
|
137
141
|
ACTION_SURFACES,
|
|
138
142
|
ACTION_CAPABILITIES
|
|
139
143
|
};
|
package/dist/recovery.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { BackoffOptions, getBackoffDelay, isRecoverable, isRetryable, shouldRetry } from "./shared/@outfitter/contracts-
|
|
2
|
-
import "./shared/@outfitter/contracts-
|
|
1
|
+
import { BackoffOptions, getBackoffDelay, isRecoverable, isRetryable, shouldRetry } from "./shared/@outfitter/contracts-md2mvvyt";
|
|
2
|
+
import "./shared/@outfitter/contracts-5hr9pdcq";
|
|
3
3
|
export { shouldRetry, isRetryable, isRecoverable, getBackoffDelay, BackoffOptions };
|
package/dist/resilience.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RetryOptions, TimeoutOptions, retry, withTimeout } from "./shared/@outfitter/contracts-
|
|
2
|
-
import "./shared/@outfitter/contracts-
|
|
1
|
+
import { RetryOptions, TimeoutOptions, retry, withTimeout } from "./shared/@outfitter/contracts-r64j5rsm";
|
|
2
|
+
import "./shared/@outfitter/contracts-5hr9pdcq";
|
|
3
3
|
export { withTimeout, retry, TimeoutOptions, RetryOptions };
|
package/dist/resilience.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
retry,
|
|
4
4
|
withTimeout
|
|
5
|
-
} from "./shared/@outfitter/contracts-
|
|
6
|
-
import"./shared/@outfitter/contracts-
|
|
5
|
+
} from "./shared/@outfitter/contracts-pdk7s4t8.js";
|
|
6
|
+
import"./shared/@outfitter/contracts-0cj49e1a.js";
|
|
7
7
|
export {
|
|
8
8
|
withTimeout,
|
|
9
9
|
retry
|
package/dist/result/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "../shared/@outfitter/contracts-qaccq0gf";
|
|
2
|
-
import { combine2, combine3, orElse, unwrapOrElse } from "../shared/@outfitter/contracts-
|
|
3
|
-
export { unwrapOrElse, orElse, combine3, combine2 };
|
|
2
|
+
import { combine2, combine3, expect, orElse, unwrapOrElse } from "../shared/@outfitter/contracts-ar0etwtx";
|
|
3
|
+
export { unwrapOrElse, orElse, expect, combine3, combine2 };
|
package/dist/result/index.js
CHANGED
|
@@ -3,12 +3,14 @@ import"../shared/@outfitter/contracts-37gpc56f.js";
|
|
|
3
3
|
import {
|
|
4
4
|
combine2,
|
|
5
5
|
combine3,
|
|
6
|
+
expect,
|
|
6
7
|
orElse,
|
|
7
8
|
unwrapOrElse
|
|
8
|
-
} from "../shared/@outfitter/contracts-
|
|
9
|
+
} from "../shared/@outfitter/contracts-zx72gyh1.js";
|
|
9
10
|
export {
|
|
10
11
|
unwrapOrElse,
|
|
11
12
|
orElse,
|
|
13
|
+
expect,
|
|
12
14
|
combine3,
|
|
13
15
|
combine2
|
|
14
16
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { combine2, combine3, orElse, unwrapOrElse } from "../shared/@outfitter/contracts-
|
|
2
|
-
export { unwrapOrElse, orElse, combine3, combine2 };
|
|
1
|
+
import { combine2, combine3, expect, orElse, unwrapOrElse } from "../shared/@outfitter/contracts-ar0etwtx";
|
|
2
|
+
export { unwrapOrElse, orElse, expect, combine3, combine2 };
|
package/dist/result/utilities.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
combine2,
|
|
4
4
|
combine3,
|
|
5
|
+
expect,
|
|
5
6
|
orElse,
|
|
6
7
|
unwrapOrElse
|
|
7
|
-
} from "../shared/@outfitter/contracts-
|
|
8
|
+
} from "../shared/@outfitter/contracts-zx72gyh1.js";
|
|
8
9
|
export {
|
|
9
10
|
unwrapOrElse,
|
|
10
11
|
orElse,
|
|
12
|
+
expect,
|
|
11
13
|
combine3,
|
|
12
14
|
combine2
|
|
13
15
|
};
|
package/dist/serialization.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SerializeErrorOptions, deserializeError, safeParse, safeStringify, serializeError } from "./shared/@outfitter/contracts-
|
|
2
|
-
import "./shared/@outfitter/contracts-
|
|
1
|
+
import { SerializeErrorOptions, deserializeError, safeParse, safeStringify, serializeError } from "./shared/@outfitter/contracts-6atxbfag";
|
|
2
|
+
import "./shared/@outfitter/contracts-5hr9pdcq";
|
|
3
3
|
export { serializeError, safeStringify, safeParse, deserializeError, SerializeErrorOptions };
|
package/dist/serialization.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
safeParse,
|
|
5
5
|
safeStringify,
|
|
6
6
|
serializeError
|
|
7
|
-
} from "./shared/@outfitter/contracts-
|
|
7
|
+
} from "./shared/@outfitter/contracts-agvdgx9j.js";
|
|
8
8
|
import"./shared/@outfitter/contracts-s15x2rs4.js";
|
|
9
|
-
import"./shared/@outfitter/contracts-
|
|
9
|
+
import"./shared/@outfitter/contracts-0cj49e1a.js";
|
|
10
10
|
export {
|
|
11
11
|
serializeError,
|
|
12
12
|
safeStringify,
|
|
@@ -30,7 +30,8 @@ var ERROR_CODES = {
|
|
|
30
30
|
FIELD_REQUIRED: 1001,
|
|
31
31
|
INVALID_FORMAT: 1002,
|
|
32
32
|
OUT_OF_RANGE: 1003,
|
|
33
|
-
TYPE_MISMATCH: 1004
|
|
33
|
+
TYPE_MISMATCH: 1004,
|
|
34
|
+
AMBIGUOUS_MATCH: 1005
|
|
34
35
|
},
|
|
35
36
|
not_found: {
|
|
36
37
|
RESOURCE_NOT_FOUND: 2001,
|
|
@@ -76,6 +77,7 @@ function getStatusCode(category) {
|
|
|
76
77
|
return statusCodeMap[category];
|
|
77
78
|
}
|
|
78
79
|
var ValidationErrorBase = TaggedError("ValidationError")();
|
|
80
|
+
var AmbiguousErrorBase = TaggedError("AmbiguousError")();
|
|
79
81
|
var AssertionErrorBase = TaggedError("AssertionError")();
|
|
80
82
|
var NotFoundErrorBase = TaggedError("NotFoundError")();
|
|
81
83
|
var ConflictErrorBase = TaggedError("ConflictError")();
|
|
@@ -89,6 +91,30 @@ var CancelledErrorBase = TaggedError("CancelledError")();
|
|
|
89
91
|
|
|
90
92
|
class ValidationError extends ValidationErrorBase {
|
|
91
93
|
category = "validation";
|
|
94
|
+
static create(field, reason, context) {
|
|
95
|
+
return new ValidationError({
|
|
96
|
+
message: `${field}: ${reason}`,
|
|
97
|
+
field,
|
|
98
|
+
...context != null && { context }
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
exitCode() {
|
|
102
|
+
return getExitCode(this.category);
|
|
103
|
+
}
|
|
104
|
+
statusCode() {
|
|
105
|
+
return getStatusCode(this.category);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
class AmbiguousError extends AmbiguousErrorBase {
|
|
110
|
+
category = "validation";
|
|
111
|
+
static create(what, candidates, context) {
|
|
112
|
+
return new AmbiguousError({
|
|
113
|
+
message: `Ambiguous ${what}: ${candidates.length} matches found`,
|
|
114
|
+
candidates,
|
|
115
|
+
...context != null && { context }
|
|
116
|
+
});
|
|
117
|
+
}
|
|
92
118
|
exitCode() {
|
|
93
119
|
return getExitCode(this.category);
|
|
94
120
|
}
|
|
@@ -109,6 +135,14 @@ class AssertionError extends AssertionErrorBase {
|
|
|
109
135
|
|
|
110
136
|
class NotFoundError extends NotFoundErrorBase {
|
|
111
137
|
category = "not_found";
|
|
138
|
+
static create(resourceType, resourceId, context) {
|
|
139
|
+
return new NotFoundError({
|
|
140
|
+
message: `${resourceType} not found: ${resourceId}`,
|
|
141
|
+
resourceType,
|
|
142
|
+
resourceId,
|
|
143
|
+
...context != null && { context }
|
|
144
|
+
});
|
|
145
|
+
}
|
|
112
146
|
exitCode() {
|
|
113
147
|
return getExitCode(this.category);
|
|
114
148
|
}
|
|
@@ -119,6 +153,9 @@ class NotFoundError extends NotFoundErrorBase {
|
|
|
119
153
|
|
|
120
154
|
class ConflictError extends ConflictErrorBase {
|
|
121
155
|
category = "conflict";
|
|
156
|
+
static create(message, context) {
|
|
157
|
+
return new ConflictError({ message, ...context != null && { context } });
|
|
158
|
+
}
|
|
122
159
|
exitCode() {
|
|
123
160
|
return getExitCode(this.category);
|
|
124
161
|
}
|
|
@@ -129,6 +166,12 @@ class ConflictError extends ConflictErrorBase {
|
|
|
129
166
|
|
|
130
167
|
class PermissionError extends PermissionErrorBase {
|
|
131
168
|
category = "permission";
|
|
169
|
+
static create(message, context) {
|
|
170
|
+
return new PermissionError({
|
|
171
|
+
message,
|
|
172
|
+
...context != null && { context }
|
|
173
|
+
});
|
|
174
|
+
}
|
|
132
175
|
exitCode() {
|
|
133
176
|
return getExitCode(this.category);
|
|
134
177
|
}
|
|
@@ -139,6 +182,13 @@ class PermissionError extends PermissionErrorBase {
|
|
|
139
182
|
|
|
140
183
|
class TimeoutError extends TimeoutErrorBase {
|
|
141
184
|
category = "timeout";
|
|
185
|
+
static create(operation, timeoutMs) {
|
|
186
|
+
return new TimeoutError({
|
|
187
|
+
message: `${operation} timed out after ${timeoutMs}ms`,
|
|
188
|
+
operation,
|
|
189
|
+
timeoutMs
|
|
190
|
+
});
|
|
191
|
+
}
|
|
142
192
|
exitCode() {
|
|
143
193
|
return getExitCode(this.category);
|
|
144
194
|
}
|
|
@@ -149,6 +199,12 @@ class TimeoutError extends TimeoutErrorBase {
|
|
|
149
199
|
|
|
150
200
|
class RateLimitError extends RateLimitErrorBase {
|
|
151
201
|
category = "rate_limit";
|
|
202
|
+
static create(message, retryAfterSeconds) {
|
|
203
|
+
return new RateLimitError({
|
|
204
|
+
message,
|
|
205
|
+
...retryAfterSeconds != null && { retryAfterSeconds }
|
|
206
|
+
});
|
|
207
|
+
}
|
|
152
208
|
exitCode() {
|
|
153
209
|
return getExitCode(this.category);
|
|
154
210
|
}
|
|
@@ -159,6 +215,9 @@ class RateLimitError extends RateLimitErrorBase {
|
|
|
159
215
|
|
|
160
216
|
class NetworkError extends NetworkErrorBase {
|
|
161
217
|
category = "network";
|
|
218
|
+
static create(message, context) {
|
|
219
|
+
return new NetworkError({ message, ...context != null && { context } });
|
|
220
|
+
}
|
|
162
221
|
exitCode() {
|
|
163
222
|
return getExitCode(this.category);
|
|
164
223
|
}
|
|
@@ -169,6 +228,9 @@ class NetworkError extends NetworkErrorBase {
|
|
|
169
228
|
|
|
170
229
|
class InternalError extends InternalErrorBase {
|
|
171
230
|
category = "internal";
|
|
231
|
+
static create(message, context) {
|
|
232
|
+
return new InternalError({ message, ...context != null && { context } });
|
|
233
|
+
}
|
|
172
234
|
exitCode() {
|
|
173
235
|
return getExitCode(this.category);
|
|
174
236
|
}
|
|
@@ -179,6 +241,9 @@ class InternalError extends InternalErrorBase {
|
|
|
179
241
|
|
|
180
242
|
class AuthError extends AuthErrorBase {
|
|
181
243
|
category = "auth";
|
|
244
|
+
static create(message, reason) {
|
|
245
|
+
return new AuthError({ message, ...reason != null && { reason } });
|
|
246
|
+
}
|
|
182
247
|
exitCode() {
|
|
183
248
|
return getExitCode(this.category);
|
|
184
249
|
}
|
|
@@ -189,6 +254,9 @@ class AuthError extends AuthErrorBase {
|
|
|
189
254
|
|
|
190
255
|
class CancelledError extends CancelledErrorBase {
|
|
191
256
|
category = "cancelled";
|
|
257
|
+
static create(message) {
|
|
258
|
+
return new CancelledError({ message });
|
|
259
|
+
}
|
|
192
260
|
exitCode() {
|
|
193
261
|
return getExitCode(this.category);
|
|
194
262
|
}
|
|
@@ -197,4 +265,4 @@ class CancelledError extends CancelledErrorBase {
|
|
|
197
265
|
}
|
|
198
266
|
}
|
|
199
267
|
|
|
200
|
-
export { exitCodeMap, statusCodeMap, ERROR_CODES, getExitCode, getStatusCode, ValidationError, AssertionError, NotFoundError, ConflictError, PermissionError, TimeoutError, RateLimitError, NetworkError, InternalError, AuthError, CancelledError };
|
|
268
|
+
export { exitCodeMap, statusCodeMap, ERROR_CODES, getExitCode, getStatusCode, ValidationError, AmbiguousError, AssertionError, NotFoundError, ConflictError, PermissionError, TimeoutError, RateLimitError, NetworkError, InternalError, AuthError, CancelledError };
|
|
@@ -40,6 +40,7 @@ declare const ERROR_CODES: {
|
|
|
40
40
|
readonly INVALID_FORMAT: 1002;
|
|
41
41
|
readonly OUT_OF_RANGE: 1003;
|
|
42
42
|
readonly TYPE_MISMATCH: 1004;
|
|
43
|
+
readonly AMBIGUOUS_MATCH: 1005;
|
|
43
44
|
};
|
|
44
45
|
readonly not_found: {
|
|
45
46
|
readonly RESOURCE_NOT_FOUND: 2001;
|
|
@@ -112,6 +113,12 @@ declare function getStatusCode(category: ErrorCategory): number;
|
|
|
112
113
|
declare const ValidationErrorBase: TaggedErrorClass<"ValidationError", {
|
|
113
114
|
message: string;
|
|
114
115
|
field?: string;
|
|
116
|
+
context?: Record<string, unknown>;
|
|
117
|
+
}>;
|
|
118
|
+
declare const AmbiguousErrorBase: TaggedErrorClass<"AmbiguousError", {
|
|
119
|
+
message: string;
|
|
120
|
+
candidates: string[];
|
|
121
|
+
context?: Record<string, unknown>;
|
|
115
122
|
}>;
|
|
116
123
|
declare const AssertionErrorBase: TaggedErrorClass<"AssertionError", {
|
|
117
124
|
message: string;
|
|
@@ -120,6 +127,7 @@ declare const NotFoundErrorBase: TaggedErrorClass<"NotFoundError", {
|
|
|
120
127
|
message: string;
|
|
121
128
|
resourceType: string;
|
|
122
129
|
resourceId: string;
|
|
130
|
+
context?: Record<string, unknown>;
|
|
123
131
|
}>;
|
|
124
132
|
declare const ConflictErrorBase: TaggedErrorClass<"ConflictError", {
|
|
125
133
|
message: string;
|
|
@@ -159,10 +167,40 @@ declare const CancelledErrorBase: TaggedErrorClass<"CancelledError", {
|
|
|
159
167
|
* @example
|
|
160
168
|
* ```typescript
|
|
161
169
|
* new ValidationError({ message: "Email format invalid", field: "email" });
|
|
170
|
+
* new ValidationError({
|
|
171
|
+
* message: "Value out of range",
|
|
172
|
+
* field: "age",
|
|
173
|
+
* context: { min: 0, max: 150, received: -1 },
|
|
174
|
+
* });
|
|
162
175
|
* ```
|
|
163
176
|
*/
|
|
164
177
|
declare class ValidationError extends ValidationErrorBase {
|
|
165
178
|
readonly category: "validation";
|
|
179
|
+
/** Create a ValidationError with auto-generated message from field name. */
|
|
180
|
+
static create(field: string, reason: string, context?: Record<string, unknown>): ValidationError;
|
|
181
|
+
exitCode(): number;
|
|
182
|
+
statusCode(): number;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Multiple matches found — user must disambiguate.
|
|
186
|
+
*
|
|
187
|
+
* Used in search/resolution systems where partial input matches
|
|
188
|
+
* multiple candidates. Carries the candidate list so transport
|
|
189
|
+
* layers can prompt disambiguation.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```typescript
|
|
193
|
+
* new AmbiguousError({
|
|
194
|
+
* message: "Multiple headings match 'Intro'",
|
|
195
|
+
* candidates: ["Introduction", "Intro to APIs"],
|
|
196
|
+
* });
|
|
197
|
+
* AmbiguousError.create("heading", ["Introduction", "Intro to APIs"]);
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
declare class AmbiguousError extends AmbiguousErrorBase {
|
|
201
|
+
readonly category: "validation";
|
|
202
|
+
/** Create an AmbiguousError with auto-generated message. */
|
|
203
|
+
static create(what: string, candidates: string[], context?: Record<string, unknown>): AmbiguousError;
|
|
166
204
|
exitCode(): number;
|
|
167
205
|
statusCode(): number;
|
|
168
206
|
}
|
|
@@ -202,10 +240,18 @@ declare class AssertionError extends AssertionErrorBase {
|
|
|
202
240
|
* @example
|
|
203
241
|
* ```typescript
|
|
204
242
|
* new NotFoundError({ message: "note not found: abc123", resourceType: "note", resourceId: "abc123" });
|
|
243
|
+
* new NotFoundError({
|
|
244
|
+
* message: "Heading not found",
|
|
245
|
+
* resourceType: "heading",
|
|
246
|
+
* resourceId: "h:Intro",
|
|
247
|
+
* context: { availableHeadings: ["Introduction", "Getting Started"] },
|
|
248
|
+
* });
|
|
205
249
|
* ```
|
|
206
250
|
*/
|
|
207
251
|
declare class NotFoundError extends NotFoundErrorBase {
|
|
208
252
|
readonly category: "not_found";
|
|
253
|
+
/** Create a NotFoundError with auto-generated message. */
|
|
254
|
+
static create(resourceType: string, resourceId: string, context?: Record<string, unknown>): NotFoundError;
|
|
209
255
|
exitCode(): number;
|
|
210
256
|
statusCode(): number;
|
|
211
257
|
}
|
|
@@ -219,6 +265,8 @@ declare class NotFoundError extends NotFoundErrorBase {
|
|
|
219
265
|
*/
|
|
220
266
|
declare class ConflictError extends ConflictErrorBase {
|
|
221
267
|
readonly category: "conflict";
|
|
268
|
+
/** Create a ConflictError with optional context. */
|
|
269
|
+
static create(message: string, context?: Record<string, unknown>): ConflictError;
|
|
222
270
|
exitCode(): number;
|
|
223
271
|
statusCode(): number;
|
|
224
272
|
}
|
|
@@ -232,6 +280,8 @@ declare class ConflictError extends ConflictErrorBase {
|
|
|
232
280
|
*/
|
|
233
281
|
declare class PermissionError extends PermissionErrorBase {
|
|
234
282
|
readonly category: "permission";
|
|
283
|
+
/** Create a PermissionError with optional context. */
|
|
284
|
+
static create(message: string, context?: Record<string, unknown>): PermissionError;
|
|
235
285
|
exitCode(): number;
|
|
236
286
|
statusCode(): number;
|
|
237
287
|
}
|
|
@@ -245,6 +295,8 @@ declare class PermissionError extends PermissionErrorBase {
|
|
|
245
295
|
*/
|
|
246
296
|
declare class TimeoutError extends TimeoutErrorBase {
|
|
247
297
|
readonly category: "timeout";
|
|
298
|
+
/** Create a TimeoutError with auto-generated message. */
|
|
299
|
+
static create(operation: string, timeoutMs: number): TimeoutError;
|
|
248
300
|
exitCode(): number;
|
|
249
301
|
statusCode(): number;
|
|
250
302
|
}
|
|
@@ -258,6 +310,8 @@ declare class TimeoutError extends TimeoutErrorBase {
|
|
|
258
310
|
*/
|
|
259
311
|
declare class RateLimitError extends RateLimitErrorBase {
|
|
260
312
|
readonly category: "rate_limit";
|
|
313
|
+
/** Create a RateLimitError with optional retry hint. */
|
|
314
|
+
static create(message: string, retryAfterSeconds?: number): RateLimitError;
|
|
261
315
|
exitCode(): number;
|
|
262
316
|
statusCode(): number;
|
|
263
317
|
}
|
|
@@ -271,6 +325,8 @@ declare class RateLimitError extends RateLimitErrorBase {
|
|
|
271
325
|
*/
|
|
272
326
|
declare class NetworkError extends NetworkErrorBase {
|
|
273
327
|
readonly category: "network";
|
|
328
|
+
/** Create a NetworkError with optional context. */
|
|
329
|
+
static create(message: string, context?: Record<string, unknown>): NetworkError;
|
|
274
330
|
exitCode(): number;
|
|
275
331
|
statusCode(): number;
|
|
276
332
|
}
|
|
@@ -284,6 +340,8 @@ declare class NetworkError extends NetworkErrorBase {
|
|
|
284
340
|
*/
|
|
285
341
|
declare class InternalError extends InternalErrorBase {
|
|
286
342
|
readonly category: "internal";
|
|
343
|
+
/** Create an InternalError with optional context. */
|
|
344
|
+
static create(message: string, context?: Record<string, unknown>): InternalError;
|
|
287
345
|
exitCode(): number;
|
|
288
346
|
statusCode(): number;
|
|
289
347
|
}
|
|
@@ -297,6 +355,8 @@ declare class InternalError extends InternalErrorBase {
|
|
|
297
355
|
*/
|
|
298
356
|
declare class AuthError extends AuthErrorBase {
|
|
299
357
|
readonly category: "auth";
|
|
358
|
+
/** Create an AuthError with optional reason. */
|
|
359
|
+
static create(message: string, reason?: "missing" | "invalid" | "expired"): AuthError;
|
|
300
360
|
exitCode(): number;
|
|
301
361
|
statusCode(): number;
|
|
302
362
|
}
|
|
@@ -310,16 +370,18 @@ declare class AuthError extends AuthErrorBase {
|
|
|
310
370
|
*/
|
|
311
371
|
declare class CancelledError extends CancelledErrorBase {
|
|
312
372
|
readonly category: "cancelled";
|
|
373
|
+
/** Create a CancelledError. */
|
|
374
|
+
static create(message: string): CancelledError;
|
|
313
375
|
exitCode(): number;
|
|
314
376
|
statusCode(): number;
|
|
315
377
|
}
|
|
316
378
|
/**
|
|
317
379
|
* Union type of all concrete error class instances.
|
|
318
380
|
*/
|
|
319
|
-
type AnyKitError = InstanceType<typeof ValidationError> | InstanceType<typeof AssertionError> | InstanceType<typeof NotFoundError> | InstanceType<typeof ConflictError> | InstanceType<typeof PermissionError> | InstanceType<typeof TimeoutError> | InstanceType<typeof RateLimitError> | InstanceType<typeof NetworkError> | InstanceType<typeof InternalError> | InstanceType<typeof AuthError> | InstanceType<typeof CancelledError>;
|
|
381
|
+
type AnyKitError = InstanceType<typeof ValidationError> | InstanceType<typeof AmbiguousError> | InstanceType<typeof AssertionError> | InstanceType<typeof NotFoundError> | InstanceType<typeof ConflictError> | InstanceType<typeof PermissionError> | InstanceType<typeof TimeoutError> | InstanceType<typeof RateLimitError> | InstanceType<typeof NetworkError> | InstanceType<typeof InternalError> | InstanceType<typeof AuthError> | InstanceType<typeof CancelledError>;
|
|
320
382
|
/**
|
|
321
383
|
* Type alias for backwards compatibility with handler signatures.
|
|
322
384
|
* Use AnyKitError for the union type.
|
|
323
385
|
*/
|
|
324
386
|
type OutfitterError = AnyKitError;
|
|
325
|
-
export { ErrorCategory, exitCodeMap, statusCodeMap, ERROR_CODES, ErrorCode, SerializedError, KitErrorProps, getExitCode, getStatusCode, ValidationError, AssertionError, NotFoundError, ConflictError, PermissionError, TimeoutError, RateLimitError, NetworkError, InternalError, AuthError, CancelledError, AnyKitError, OutfitterError };
|
|
387
|
+
export { ErrorCategory, exitCodeMap, statusCodeMap, ERROR_CODES, ErrorCode, SerializedError, KitErrorProps, getExitCode, getStatusCode, ValidationError, AmbiguousError, AssertionError, NotFoundError, ConflictError, PermissionError, TimeoutError, RateLimitError, NetworkError, InternalError, AuthError, CancelledError, AnyKitError, OutfitterError };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/contracts/src/context.ts
|
|
3
3
|
var noopLogger = {
|
|
4
|
-
trace: () => {},
|
|
5
|
-
debug: () => {},
|
|
6
|
-
info: () => {},
|
|
7
|
-
warn: () => {},
|
|
8
|
-
error: () => {},
|
|
9
|
-
fatal: () => {},
|
|
4
|
+
trace: (..._args) => {},
|
|
5
|
+
debug: (..._args) => {},
|
|
6
|
+
info: (..._args) => {},
|
|
7
|
+
warn: (..._args) => {},
|
|
8
|
+
error: (..._args) => {},
|
|
9
|
+
fatal: (..._args) => {},
|
|
10
10
|
child: () => noopLogger
|
|
11
11
|
};
|
|
12
12
|
function createContext(options) {
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
createRedactor
|
|
6
6
|
} from "./contracts-s15x2rs4.js";
|
|
7
7
|
import {
|
|
8
|
+
AmbiguousError,
|
|
9
|
+
AssertionError,
|
|
8
10
|
AuthError,
|
|
9
11
|
CancelledError,
|
|
10
12
|
ConflictError,
|
|
@@ -15,12 +17,14 @@ import {
|
|
|
15
17
|
RateLimitError,
|
|
16
18
|
TimeoutError,
|
|
17
19
|
ValidationError
|
|
18
|
-
} from "./contracts-
|
|
20
|
+
} from "./contracts-0cj49e1a.js";
|
|
19
21
|
|
|
20
22
|
// packages/contracts/src/serialization.ts
|
|
21
23
|
import { Result } from "better-result";
|
|
22
24
|
var errorRegistry = {
|
|
23
25
|
ValidationError,
|
|
26
|
+
AmbiguousError,
|
|
27
|
+
AssertionError,
|
|
24
28
|
NotFoundError,
|
|
25
29
|
ConflictError,
|
|
26
30
|
PermissionError,
|
|
@@ -70,6 +74,13 @@ function extractContext(error) {
|
|
|
70
74
|
}
|
|
71
75
|
break;
|
|
72
76
|
}
|
|
77
|
+
case "AmbiguousError": {
|
|
78
|
+
const amb = error;
|
|
79
|
+
context["candidates"] = amb.candidates;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case "AssertionError":
|
|
83
|
+
break;
|
|
73
84
|
case "ConflictError":
|
|
74
85
|
case "PermissionError":
|
|
75
86
|
case "NetworkError":
|
|
@@ -196,6 +207,15 @@ function deserializeError(data) {
|
|
|
196
207
|
}
|
|
197
208
|
return new AuthError(props);
|
|
198
209
|
}
|
|
210
|
+
case "AmbiguousError":
|
|
211
|
+
return new AmbiguousError({
|
|
212
|
+
message: data.message,
|
|
213
|
+
candidates: context["candidates"] ?? []
|
|
214
|
+
});
|
|
215
|
+
case "AssertionError":
|
|
216
|
+
return new AssertionError({
|
|
217
|
+
message: data.message
|
|
218
|
+
});
|
|
199
219
|
case "CancelledError":
|
|
200
220
|
return new CancelledError({
|
|
201
221
|
message: data.message
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OutfitterError } from "./contracts-
|
|
1
|
+
import { OutfitterError } from "./contracts-5hr9pdcq";
|
|
2
2
|
import { Result } from "better-result";
|
|
3
3
|
/**
|
|
4
4
|
* Logger interface for handler context.
|
|
@@ -9,11 +9,17 @@ import { Result } from "better-result";
|
|
|
9
9
|
*/
|
|
10
10
|
interface Logger {
|
|
11
11
|
trace(message: string, metadata?: Record<string, unknown>): void;
|
|
12
|
+
trace(metadata: Record<string, unknown>, message: string): never;
|
|
12
13
|
debug(message: string, metadata?: Record<string, unknown>): void;
|
|
14
|
+
debug(metadata: Record<string, unknown>, message: string): never;
|
|
13
15
|
info(message: string, metadata?: Record<string, unknown>): void;
|
|
16
|
+
info(metadata: Record<string, unknown>, message: string): never;
|
|
14
17
|
warn(message: string, metadata?: Record<string, unknown>): void;
|
|
18
|
+
warn(metadata: Record<string, unknown>, message: string): never;
|
|
15
19
|
error(message: string, metadata?: Record<string, unknown>): void;
|
|
20
|
+
error(metadata: Record<string, unknown>, message: string): never;
|
|
16
21
|
fatal(message: string, metadata?: Record<string, unknown>): void;
|
|
22
|
+
fatal(metadata: Record<string, unknown>, message: string): never;
|
|
17
23
|
/**
|
|
18
24
|
* Creates a child logger with additional context.
|
|
19
25
|
*
|
|
@@ -100,4 +100,26 @@ declare const combine3: <
|
|
|
100
100
|
T3,
|
|
101
101
|
E
|
|
102
102
|
>(r1: Result<T1, E>, r2: Result<T2, E>, r3: Result<T3, E>) => Result<[T1, T2, T3], E>;
|
|
103
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Extract value from Ok, or throw with a contextual error message.
|
|
105
|
+
*
|
|
106
|
+
* Like `unwrap()` but with a caller-provided message for better
|
|
107
|
+
* debugging context. Use at system boundaries (CLI adapters, MCP
|
|
108
|
+
* handlers) where you need the value and want a clear error.
|
|
109
|
+
*
|
|
110
|
+
* @param result - The Result to unwrap
|
|
111
|
+
* @param message - Context message prepended to the error
|
|
112
|
+
* @returns The success value
|
|
113
|
+
* @throws Error with contextual message if Result is Err
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* const config = expect(loadConfig(), "Failed to load config");
|
|
118
|
+
* // On Err, throws: "Failed to load config: <error details>"
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
declare const expect: <
|
|
122
|
+
T,
|
|
123
|
+
E
|
|
124
|
+
>(result: Result<T, E>, message: string) => T;
|
|
125
|
+
export { unwrapOrElse, orElse, combine2, combine3, expect };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
serializeError
|
|
4
|
-
} from "./contracts-
|
|
4
|
+
} from "./contracts-agvdgx9j.js";
|
|
5
5
|
import {
|
|
6
6
|
generateRequestId
|
|
7
|
-
} from "./contracts-
|
|
7
|
+
} from "./contracts-agmt8915.js";
|
|
8
8
|
import {
|
|
9
9
|
statusCodeMap
|
|
10
|
-
} from "./contracts-
|
|
10
|
+
} from "./contracts-0cj49e1a.js";
|
|
11
11
|
|
|
12
12
|
// packages/contracts/src/envelope.ts
|
|
13
13
|
function buildMeta(overrides) {
|
|
@@ -23,5 +23,10 @@ var combine3 = (r1, r2, r3) => {
|
|
|
23
23
|
return r3;
|
|
24
24
|
return Result.ok([r1.value, r2.value, r3.value]);
|
|
25
25
|
};
|
|
26
|
+
var expect = (result, message) => {
|
|
27
|
+
if (result.isOk())
|
|
28
|
+
return result.value;
|
|
29
|
+
throw new Error(`${message}: ${String(result.error)}`);
|
|
30
|
+
};
|
|
26
31
|
|
|
27
|
-
export { unwrapOrElse, orElse, combine2, combine3 };
|
|
32
|
+
export { unwrapOrElse, orElse, combine2, combine3, expect };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Handler, SyncHandler } from "./contracts-
|
|
2
|
-
import { OutfitterError } from "./contracts-
|
|
1
|
+
import { Handler, SyncHandler } from "./contracts-amd2ykn8";
|
|
2
|
+
import { OutfitterError } from "./contracts-5hr9pdcq";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
declare const ACTION_SURFACES: readonly ["cli", "mcp", "api", "server"];
|
|
5
5
|
type ActionSurface = (typeof ACTION_SURFACES)[number];
|
package/dist/validation.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { createValidator, validateInput } from "./shared/@outfitter/contracts-
|
|
2
|
-
import "./shared/@outfitter/contracts-
|
|
1
|
+
import { createValidator, validateInput } from "./shared/@outfitter/contracts-n9hb6hqt";
|
|
2
|
+
import "./shared/@outfitter/contracts-5hr9pdcq";
|
|
3
3
|
export { validateInput, createValidator };
|
package/dist/validation.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createValidator,
|
|
4
4
|
validateInput
|
|
5
|
-
} from "./shared/@outfitter/contracts-
|
|
6
|
-
import"./shared/@outfitter/contracts-
|
|
5
|
+
} from "./shared/@outfitter/contracts-k2jdpbb6.js";
|
|
6
|
+
import"./shared/@outfitter/contracts-0cj49e1a.js";
|
|
7
7
|
export {
|
|
8
8
|
validateInput,
|
|
9
9
|
createValidator
|