@outfitter/contracts 0.1.0 → 0.3.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 +41 -2
- package/dist/actions.d.ts +4 -3
- package/dist/assert/index.d.ts +2 -2
- package/dist/assert/index.js +2 -2
- package/dist/context.d.ts +4 -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 +6 -2
- package/dist/handler.d.ts +3 -2
- package/dist/index.d.ts +14 -13
- package/dist/index.js +42 -32
- package/dist/logging.d.ts +2 -0
- package/dist/logging.js +7 -0
- 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-sf5p84cc.js → contracts-0snpmkdt.js} +1 -1
- package/dist/shared/@outfitter/{contracts-t3j7fba3.d.ts → contracts-18vcxecr.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-wwkk3j4m.d.ts → contracts-25bkj17f.d.ts} +2 -1
- package/dist/shared/@outfitter/contracts-2g8r01zf.d.ts +73 -0
- package/dist/shared/@outfitter/{contracts-dbpj0b4k.js → contracts-5k6q4n48.js} +61 -9
- package/dist/shared/@outfitter/{contracts-g82822x1.d.ts → contracts-6j6z9dsd.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-y8qg2nvz.js → contracts-agmt8915.js} +6 -6
- package/dist/shared/@outfitter/{contracts-109drsem.d.ts → contracts-ar0etwtx.d.ts} +23 -1
- package/dist/shared/@outfitter/{contracts-37891j7e.d.ts → contracts-bdwg55c5.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-chnm7kvm.js → contracts-btg89x4h.js} +3 -3
- package/dist/shared/@outfitter/{contracts-d1thk8cv.js → contracts-cp5c6dws.js} +1 -1
- package/dist/shared/@outfitter/{contracts-47aemgd3.d.ts → contracts-evxky148.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-0taqjz0a.d.ts → contracts-j08e95jw.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-q9tjk2zp.d.ts → contracts-jggbn5tn.d.ts} +1 -1
- package/dist/shared/@outfitter/{contracts-jhsgc85s.js → contracts-phjhz5q3.js} +95 -2
- package/dist/shared/@outfitter/{contracts-aq745b7n.js → contracts-r21yet6j.js} +1 -1
- package/dist/shared/@outfitter/{contracts-ev4a68sg.d.ts → contracts-r35bn9p6.d.ts} +124 -3
- package/dist/shared/@outfitter/{contracts-vtrf6rbx.d.ts → contracts-sf1z80yc.d.ts} +2 -2
- package/dist/shared/@outfitter/contracts-sm6vak1a.js +14 -0
- package/dist/shared/@outfitter/{contracts-yp3derbe.d.ts → contracts-ss9vjjft.d.ts} +3 -37
- package/dist/shared/@outfitter/{contracts-r06bafs8.js → contracts-zx72gyh1.js} +6 -1
- package/dist/validation.d.ts +2 -2
- package/dist/validation.js +2 -2
- package/package.json +50 -44
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Result/Error patterns, error taxonomy, handler contracts, and shared interfaces
|
|
|
4
4
|
|
|
5
5
|
## Status
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Active** - Stable core contracts with active feature development.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
// Define a handler
|
|
37
37
|
const getNote: Handler<{ id: string }, Note, NotFoundError> = async (input, ctx) => {
|
|
38
38
|
const note = await db.notes.find(input.id);
|
|
39
|
-
if (!note) return Result.err(
|
|
39
|
+
if (!note) return Result.err(NotFoundError.create("note", input.id));
|
|
40
40
|
return Result.ok(note);
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -45,6 +45,45 @@ const ctx = createContext({ logger, config });
|
|
|
45
45
|
const result = await getNote({ id: "abc123" }, ctx);
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
## Error Factory Reference
|
|
49
|
+
|
|
50
|
+
All error classes provide a static `create()` factory method that generates a consistent message from structured parameters. Use `create()` for structured errors and the constructor for custom messages.
|
|
51
|
+
|
|
52
|
+
| Error Class | `create()` Signature | Generated Message |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `ValidationError` | `create(field, reason, context?)` | `"email: format invalid"` |
|
|
55
|
+
| `ValidationError` | `fromMessage(message, context?)` | *(your message as-is)* |
|
|
56
|
+
| `AmbiguousError` | `create(what, candidates, context?)` | `"Ambiguous heading: 2 matches found"` |
|
|
57
|
+
| `NotFoundError` | `create(resourceType, resourceId, context?)` | `"note not found: abc123"` |
|
|
58
|
+
| `AlreadyExistsError` | `create(resourceType, resourceId, context?)` | `"file already exists: notes/meeting.md"` |
|
|
59
|
+
| `ConflictError` | `create(message, context?)` | *(your message as-is)* |
|
|
60
|
+
| `PermissionError` | `create(message, context?)` | *(your message as-is)* |
|
|
61
|
+
| `TimeoutError` | `create(operation, timeoutMs)` | `"database query timed out after 5000ms"` |
|
|
62
|
+
| `RateLimitError` | `create(message, retryAfterSeconds?)` | *(your message as-is)* |
|
|
63
|
+
| `NetworkError` | `create(message, context?)` | *(your message as-is)* |
|
|
64
|
+
| `InternalError` | `create(message, context?)` | *(your message as-is)* |
|
|
65
|
+
| `AuthError` | `create(message, reason?)` | *(your message as-is)* |
|
|
66
|
+
| `CancelledError` | `create(message)` | *(your message as-is)* |
|
|
67
|
+
|
|
68
|
+
### Message Casing
|
|
69
|
+
|
|
70
|
+
`create()` factories that auto-generate messages use **lowercase** `resourceType`:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
NotFoundError.create("piece", "abc123");
|
|
74
|
+
// → "piece not found: abc123" (not "Piece not found: abc123")
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
If you need a capitalized message, use the constructor directly:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
new NotFoundError({
|
|
81
|
+
message: "Piece not found: abc123",
|
|
82
|
+
resourceType: "piece",
|
|
83
|
+
resourceId: "abc123",
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
48
87
|
## License
|
|
49
88
|
|
|
50
89
|
MIT
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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-sf1z80yc";
|
|
2
|
+
import "./shared/@outfitter/contracts-ss9vjjft";
|
|
3
|
+
import "./shared/@outfitter/contracts-r35bn9p6";
|
|
4
|
+
import "./shared/@outfitter/contracts-2g8r01zf";
|
|
4
5
|
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-18vcxecr";
|
|
2
|
+
import "../shared/@outfitter/contracts-r35bn9p6";
|
|
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-cp5c6dws.js";
|
|
8
|
+
import"../shared/@outfitter/contracts-phjhz5q3.js";
|
|
9
9
|
export {
|
|
10
10
|
isNonEmptyArray,
|
|
11
11
|
assertNonEmpty,
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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-25bkj17f";
|
|
2
|
+
import "./shared/@outfitter/contracts-ss9vjjft";
|
|
3
|
+
import "./shared/@outfitter/contracts-r35bn9p6";
|
|
4
|
+
import "./shared/@outfitter/contracts-2g8r01zf";
|
|
4
5
|
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-jggbn5tn";
|
|
2
|
+
import "./shared/@outfitter/contracts-r35bn9p6";
|
|
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-btg89x4h.js";
|
|
6
|
+
import"./shared/@outfitter/contracts-5k6q4n48.js";
|
|
7
|
+
import"./shared/@outfitter/contracts-agmt8915.js";
|
|
8
|
+
import"./shared/@outfitter/contracts-phjhz5q3.js";
|
|
7
9
|
import"./shared/@outfitter/contracts-s15x2rs4.js";
|
|
8
|
-
import"./shared/@outfitter/contracts-y8qg2nvz.js";
|
|
9
|
-
import"./shared/@outfitter/contracts-jhsgc85s.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 { AlreadyExistsError, 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-r35bn9p6";
|
|
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, AlreadyExistsError };
|
package/dist/errors.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
+
AlreadyExistsError,
|
|
4
|
+
AmbiguousError,
|
|
3
5
|
AssertionError,
|
|
4
6
|
AuthError,
|
|
5
7
|
CancelledError,
|
|
@@ -16,7 +18,7 @@ import {
|
|
|
16
18
|
getExitCode,
|
|
17
19
|
getStatusCode,
|
|
18
20
|
statusCodeMap
|
|
19
|
-
} from "./shared/@outfitter/contracts-
|
|
21
|
+
} from "./shared/@outfitter/contracts-phjhz5q3.js";
|
|
20
22
|
export {
|
|
21
23
|
statusCodeMap,
|
|
22
24
|
getStatusCode,
|
|
@@ -33,5 +35,7 @@ export {
|
|
|
33
35
|
ConflictError,
|
|
34
36
|
CancelledError,
|
|
35
37
|
AuthError,
|
|
36
|
-
AssertionError
|
|
38
|
+
AssertionError,
|
|
39
|
+
AmbiguousError,
|
|
40
|
+
AlreadyExistsError
|
|
37
41
|
};
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { Handler, HandlerContext,
|
|
2
|
-
import "./shared/@outfitter/contracts-
|
|
1
|
+
import { Handler, HandlerContext, ResolvedConfig, SyncHandler } from "./shared/@outfitter/contracts-ss9vjjft";
|
|
2
|
+
import "./shared/@outfitter/contracts-r35bn9p6";
|
|
3
|
+
import { Logger } from "./shared/@outfitter/contracts-2g8r01zf";
|
|
3
4
|
export { SyncHandler, ResolvedConfig, Logger, HandlerContext, Handler };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
import { ACTION_SURFACES, ActionApiSpec, ActionCliInputContext, ActionCliOption, ActionCliSpec, ActionMcpSpec, ActionRegistry, ActionSpec, ActionSurface, ActionTrpcSpec, AnyActionSpec, DEFAULT_REGISTRY_SURFACES, HttpMethod, createActionRegistry, defineAction } from "./shared/@outfitter/contracts-sf1z80yc";
|
|
1
2
|
import { ACTION_CAPABILITIES, ActionCapability, CAPABILITY_SURFACES, CapabilitySurface, DEFAULT_ACTION_SURFACES, capability, capabilityAll, getActionsForSurface } from "./shared/@outfitter/contracts-bb4hjt8g";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { RetryOptions, TimeoutOptions, retry, withTimeout } from "./shared/@outfitter/contracts-37891j7e";
|
|
3
|
+
import { SerializeErrorOptions, deserializeError, safeParse, safeStringify, serializeError } from "./shared/@outfitter/contracts-j08e95jw";
|
|
4
|
+
import { CreateContextOptions, createContext, generateRequestId } from "./shared/@outfitter/contracts-25bkj17f";
|
|
5
|
+
import { NonEmptyArray, assertDefined, assertMatches, assertNonEmpty, isNonEmptyArray } from "./shared/@outfitter/contracts-18vcxecr";
|
|
6
6
|
import "./shared/@outfitter/contracts-qaccq0gf";
|
|
7
|
-
import { combine2, combine3, orElse, unwrapOrElse } from "./shared/@outfitter/contracts-
|
|
8
|
-
import {
|
|
7
|
+
import { combine2, combine3, expect, orElse, unwrapOrElse } from "./shared/@outfitter/contracts-ar0etwtx";
|
|
8
|
+
import { Envelope, EnvelopeMeta, ErrorEnvelope, HttpResponse, PaginationMeta, SuccessEnvelope, toEnvelope, toHttpResponse } from "./shared/@outfitter/contracts-jggbn5tn";
|
|
9
9
|
import { AdapterAuthError, AuthAdapter, CacheAdapter, CacheError, IndexAdapter, IndexError, IndexStats, SearchOptions, SearchResult, StorageAdapter, StorageError } from "./shared/@outfitter/contracts-93dx53mt";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { Handler, HandlerContext,
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
10
|
+
import { BackoffOptions, getBackoffDelay, isRecoverable, isRetryable, shouldRetry } from "./shared/@outfitter/contracts-evxky148";
|
|
11
|
+
import { RetryOptions, TimeoutOptions, retry, withTimeout } from "./shared/@outfitter/contracts-bdwg55c5";
|
|
12
|
+
import { createValidator, validateInput } from "./shared/@outfitter/contracts-6j6z9dsd";
|
|
13
|
+
import { Handler, HandlerContext, ResolvedConfig, SyncHandler } from "./shared/@outfitter/contracts-ss9vjjft";
|
|
14
|
+
import { AlreadyExistsError, 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-r35bn9p6";
|
|
15
|
+
import { LogLevel, LogMetadata, LogMethod, Logger, LoggerAdapter, LoggerFactory, LoggerFactoryConfig, createLoggerFactory } from "./shared/@outfitter/contracts-2g8r01zf";
|
|
16
|
+
import { DEFAULT_PATTERNS, DEFAULT_SENSITIVE_KEYS, RedactionCallback, RedactionEvent, Redactor, RedactorConfig, createRedactor } from "./shared/@outfitter/contracts-e70qdasg";
|
|
16
17
|
import { TaggedErrorClass } from "better-result";
|
|
17
18
|
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 };
|
|
19
|
+
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, createLoggerFactory, 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, LoggerFactoryConfig, LoggerFactory, LoggerAdapter, Logger, LogMethod, LogMetadata, LogLevel, 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, AlreadyExistsError, AdapterAuthError, ActionTrpcSpec, ActionSurface, ActionSpec, ActionRegistry, ActionMcpSpec, ActionCliSpec, ActionCliOption, ActionCliInputContext, ActionCapability, ActionApiSpec, ACTION_SURFACES, ACTION_CAPABILITIES };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
ACTION_SURFACES,
|
|
4
|
+
DEFAULT_REGISTRY_SURFACES,
|
|
5
|
+
createActionRegistry,
|
|
6
|
+
defineAction
|
|
7
|
+
} from "./shared/@outfitter/contracts-q0v44kef.js";
|
|
2
8
|
import {
|
|
3
9
|
ACTION_CAPABILITIES,
|
|
4
10
|
CAPABILITY_SURFACES,
|
|
@@ -8,58 +14,50 @@ import {
|
|
|
8
14
|
getActionsForSurface
|
|
9
15
|
} from "./shared/@outfitter/contracts-d0tq2adf.js";
|
|
10
16
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "./shared/@outfitter/contracts-
|
|
16
|
-
import {
|
|
17
|
-
ACTION_SURFACES,
|
|
18
|
-
DEFAULT_REGISTRY_SURFACES,
|
|
19
|
-
createActionRegistry,
|
|
20
|
-
defineAction
|
|
21
|
-
} from "./shared/@outfitter/contracts-q0v44kef.js";
|
|
22
|
-
import {
|
|
23
|
-
retry,
|
|
24
|
-
withTimeout
|
|
25
|
-
} from "./shared/@outfitter/contracts-aq745b7n.js";
|
|
17
|
+
assertDefined,
|
|
18
|
+
assertMatches,
|
|
19
|
+
assertNonEmpty,
|
|
20
|
+
isNonEmptyArray
|
|
21
|
+
} from "./shared/@outfitter/contracts-cp5c6dws.js";
|
|
26
22
|
import"./shared/@outfitter/contracts-37gpc56f.js";
|
|
27
23
|
import {
|
|
28
24
|
combine2,
|
|
29
25
|
combine3,
|
|
26
|
+
expect,
|
|
30
27
|
orElse,
|
|
31
28
|
unwrapOrElse
|
|
32
|
-
} from "./shared/@outfitter/contracts-
|
|
33
|
-
import {
|
|
34
|
-
assertDefined,
|
|
35
|
-
assertMatches,
|
|
36
|
-
assertNonEmpty,
|
|
37
|
-
isNonEmptyArray
|
|
38
|
-
} from "./shared/@outfitter/contracts-d1thk8cv.js";
|
|
29
|
+
} from "./shared/@outfitter/contracts-zx72gyh1.js";
|
|
39
30
|
import {
|
|
40
31
|
toEnvelope,
|
|
41
32
|
toHttpResponse
|
|
42
|
-
} from "./shared/@outfitter/contracts-
|
|
33
|
+
} from "./shared/@outfitter/contracts-btg89x4h.js";
|
|
43
34
|
import {
|
|
44
35
|
deserializeError,
|
|
45
36
|
safeParse,
|
|
46
37
|
safeStringify,
|
|
47
38
|
serializeError
|
|
48
|
-
} from "./shared/@outfitter/contracts-
|
|
49
|
-
import {
|
|
50
|
-
DEFAULT_PATTERNS,
|
|
51
|
-
DEFAULT_SENSITIVE_KEYS,
|
|
52
|
-
createRedactor
|
|
53
|
-
} from "./shared/@outfitter/contracts-s15x2rs4.js";
|
|
39
|
+
} from "./shared/@outfitter/contracts-5k6q4n48.js";
|
|
54
40
|
import {
|
|
55
41
|
createContext,
|
|
56
42
|
generateRequestId
|
|
57
|
-
} from "./shared/@outfitter/contracts-
|
|
43
|
+
} from "./shared/@outfitter/contracts-agmt8915.js";
|
|
44
|
+
import {
|
|
45
|
+
getBackoffDelay,
|
|
46
|
+
isRecoverable,
|
|
47
|
+
isRetryable,
|
|
48
|
+
shouldRetry
|
|
49
|
+
} from "./shared/@outfitter/contracts-4zaj7ejb.js";
|
|
50
|
+
import {
|
|
51
|
+
retry,
|
|
52
|
+
withTimeout
|
|
53
|
+
} from "./shared/@outfitter/contracts-r21yet6j.js";
|
|
58
54
|
import {
|
|
59
55
|
createValidator,
|
|
60
56
|
validateInput
|
|
61
|
-
} from "./shared/@outfitter/contracts-
|
|
57
|
+
} from "./shared/@outfitter/contracts-0snpmkdt.js";
|
|
62
58
|
import {
|
|
59
|
+
AlreadyExistsError,
|
|
60
|
+
AmbiguousError,
|
|
63
61
|
AssertionError,
|
|
64
62
|
AuthError,
|
|
65
63
|
CancelledError,
|
|
@@ -76,7 +74,15 @@ import {
|
|
|
76
74
|
getExitCode,
|
|
77
75
|
getStatusCode,
|
|
78
76
|
statusCodeMap
|
|
79
|
-
} from "./shared/@outfitter/contracts-
|
|
77
|
+
} from "./shared/@outfitter/contracts-phjhz5q3.js";
|
|
78
|
+
import {
|
|
79
|
+
createLoggerFactory
|
|
80
|
+
} from "./shared/@outfitter/contracts-sm6vak1a.js";
|
|
81
|
+
import {
|
|
82
|
+
DEFAULT_PATTERNS,
|
|
83
|
+
DEFAULT_SENSITIVE_KEYS,
|
|
84
|
+
createRedactor
|
|
85
|
+
} from "./shared/@outfitter/contracts-s15x2rs4.js";
|
|
80
86
|
|
|
81
87
|
// packages/contracts/src/index.ts
|
|
82
88
|
import { Result, TaggedError } from "better-result";
|
|
@@ -101,11 +107,13 @@ export {
|
|
|
101
107
|
getBackoffDelay,
|
|
102
108
|
getActionsForSurface,
|
|
103
109
|
generateRequestId,
|
|
110
|
+
expect,
|
|
104
111
|
exitCodeMap,
|
|
105
112
|
deserializeError,
|
|
106
113
|
defineAction,
|
|
107
114
|
createValidator,
|
|
108
115
|
createRedactor,
|
|
116
|
+
createLoggerFactory,
|
|
109
117
|
createContext,
|
|
110
118
|
createActionRegistry,
|
|
111
119
|
combine3,
|
|
@@ -134,6 +142,8 @@ export {
|
|
|
134
142
|
CAPABILITY_SURFACES,
|
|
135
143
|
AuthError,
|
|
136
144
|
AssertionError,
|
|
145
|
+
AmbiguousError,
|
|
146
|
+
AlreadyExistsError,
|
|
137
147
|
ACTION_SURFACES,
|
|
138
148
|
ACTION_CAPABILITIES
|
|
139
149
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { LogLevel, LogMetadata, LogMethod, Logger, LoggerAdapter, LoggerFactory, LoggerFactoryConfig, createLoggerFactory } from "./shared/@outfitter/contracts-2g8r01zf";
|
|
2
|
+
export { createLoggerFactory, LoggerFactoryConfig, LoggerFactory, LoggerAdapter, Logger, LogMethod, LogMetadata, LogLevel };
|
package/dist/logging.js
ADDED
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-evxky148";
|
|
2
|
+
import "./shared/@outfitter/contracts-r35bn9p6";
|
|
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-bdwg55c5";
|
|
2
|
+
import "./shared/@outfitter/contracts-r35bn9p6";
|
|
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-r21yet6j.js";
|
|
6
|
+
import"./shared/@outfitter/contracts-phjhz5q3.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-j08e95jw";
|
|
2
|
+
import "./shared/@outfitter/contracts-r35bn9p6";
|
|
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-5k6q4n48.js";
|
|
8
|
+
import"./shared/@outfitter/contracts-phjhz5q3.js";
|
|
8
9
|
import"./shared/@outfitter/contracts-s15x2rs4.js";
|
|
9
|
-
import"./shared/@outfitter/contracts-jhsgc85s.js";
|
|
10
10
|
export {
|
|
11
11
|
serializeError,
|
|
12
12
|
safeStringify,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared logging contracts for backend-agnostic logger integration.
|
|
3
|
+
*
|
|
4
|
+
* The `Logger` interface is the minimal surface required by handler contexts.
|
|
5
|
+
* `LoggerAdapter` and `createLoggerFactory` allow runtime packages to plug in
|
|
6
|
+
* backend-specific implementations while keeping transports backend-agnostic.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Log levels ordered from least to most severe.
|
|
10
|
+
*
|
|
11
|
+
* The special `silent` level disables logging output.
|
|
12
|
+
*/
|
|
13
|
+
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal" | "silent";
|
|
14
|
+
/** Structured metadata attached to log messages. */
|
|
15
|
+
type LogMetadata = Record<string, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Message-first logger method with metadata-first overload for strict misuse
|
|
18
|
+
* detection in TypeScript. Calling with metadata first intentionally resolves to
|
|
19
|
+
* `never` for compile-time feedback.
|
|
20
|
+
*/
|
|
21
|
+
interface LogMethod {
|
|
22
|
+
(message: string, metadata?: LogMetadata): void;
|
|
23
|
+
(metadata: LogMetadata, message: string): never;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Logger interface for handler contexts and cross-package contracts.
|
|
27
|
+
*/
|
|
28
|
+
interface Logger {
|
|
29
|
+
trace: LogMethod;
|
|
30
|
+
debug: LogMethod;
|
|
31
|
+
info: LogMethod;
|
|
32
|
+
warn: LogMethod;
|
|
33
|
+
error: LogMethod;
|
|
34
|
+
fatal: LogMethod;
|
|
35
|
+
child(context: LogMetadata): Logger;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Configuration passed through the logger factory to backend adapters.
|
|
39
|
+
*
|
|
40
|
+
* `backend` carries adapter-specific configuration in a strongly typed way.
|
|
41
|
+
*/
|
|
42
|
+
interface LoggerFactoryConfig<TBackendOptions = unknown> {
|
|
43
|
+
/** Logger category/name identifying the source (e.g., "cli", "mcp") */
|
|
44
|
+
name: string;
|
|
45
|
+
/** Minimum level to emit */
|
|
46
|
+
level?: LogLevel;
|
|
47
|
+
/** Static context attached to every emitted record */
|
|
48
|
+
context?: LogMetadata;
|
|
49
|
+
/** Adapter-specific backend options */
|
|
50
|
+
backend?: TBackendOptions;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Backend adapter contract used by the logger factory.
|
|
54
|
+
*
|
|
55
|
+
* Runtime packages provide concrete adapters (for example logtape or custom
|
|
56
|
+
* implementations) behind this contract.
|
|
57
|
+
*/
|
|
58
|
+
interface LoggerAdapter<TBackendOptions = unknown> {
|
|
59
|
+
createLogger(config: LoggerFactoryConfig<TBackendOptions>): Logger;
|
|
60
|
+
flush?(): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Backend-agnostic logger factory surface consumed by CLI/MCP runtime code.
|
|
64
|
+
*/
|
|
65
|
+
interface LoggerFactory<TBackendOptions = unknown> {
|
|
66
|
+
createLogger(config: LoggerFactoryConfig<TBackendOptions>): Logger;
|
|
67
|
+
flush(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a logger factory from a backend adapter implementation.
|
|
71
|
+
*/
|
|
72
|
+
declare function createLoggerFactory<TBackendOptions = unknown>(adapter: LoggerAdapter<TBackendOptions>): LoggerFactory<TBackendOptions>;
|
|
73
|
+
export { LogLevel, LogMetadata, LogMethod, Logger, LoggerFactoryConfig, LoggerAdapter, LoggerFactory, createLoggerFactory };
|