hide-a-bed 6.0.0 → 7.0.0-beta.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.
Files changed (100) hide show
  1. package/README.md +89 -28
  2. package/dist/cjs/index.cjs +888 -443
  3. package/dist/esm/index.mjs +883 -443
  4. package/eslint.config.js +6 -1
  5. package/impl/bindConfig.mts +30 -3
  6. package/impl/bulkGet.mts +50 -27
  7. package/impl/bulkRemove.mts +4 -2
  8. package/impl/bulkSave.mts +50 -28
  9. package/impl/get.mts +49 -40
  10. package/impl/getDBInfo.mts +26 -24
  11. package/impl/patch.mts +46 -42
  12. package/impl/put.mts +39 -21
  13. package/impl/query.mts +101 -81
  14. package/impl/remove.mts +33 -33
  15. package/impl/stream.mts +163 -102
  16. package/impl/sugar/watch.mts +165 -97
  17. package/impl/utils/errors.mts +261 -35
  18. package/impl/utils/fetch.mts +201 -0
  19. package/impl/utils/parseRows.mts +47 -6
  20. package/impl/utils/request.mts +22 -0
  21. package/impl/utils/response.mts +50 -0
  22. package/impl/utils/transactionErrors.mts +14 -8
  23. package/impl/utils/url.mts +21 -0
  24. package/index.mts +19 -2
  25. package/migration_guides/v7.md +353 -0
  26. package/package.json +4 -4
  27. package/schema/config.mts +17 -34
  28. package/schema/request.mts +36 -0
  29. package/schema/sugar/watch.mts +1 -1
  30. package/tsconfig.json +9 -1
  31. package/types/output/impl/bindConfig.d.mts +31 -149
  32. package/types/output/impl/bindConfig.d.mts.map +1 -1
  33. package/types/output/impl/bindConfig.test.d.mts +2 -0
  34. package/types/output/impl/bindConfig.test.d.mts.map +1 -0
  35. package/types/output/impl/bulkGet.d.mts +5 -5
  36. package/types/output/impl/bulkGet.d.mts.map +1 -1
  37. package/types/output/impl/bulkRemove.d.mts +4 -2
  38. package/types/output/impl/bulkRemove.d.mts.map +1 -1
  39. package/types/output/impl/bulkSave.d.mts +2 -2
  40. package/types/output/impl/bulkSave.d.mts.map +1 -1
  41. package/types/output/impl/get.d.mts +2 -2
  42. package/types/output/impl/get.d.mts.map +1 -1
  43. package/types/output/impl/getDBInfo.d.mts +1 -1
  44. package/types/output/impl/getDBInfo.d.mts.map +1 -1
  45. package/types/output/impl/patch.d.mts +8 -3
  46. package/types/output/impl/patch.d.mts.map +1 -1
  47. package/types/output/impl/put.d.mts.map +1 -1
  48. package/types/output/impl/query.d.mts +8 -23
  49. package/types/output/impl/query.d.mts.map +1 -1
  50. package/types/output/impl/remove.d.mts.map +1 -1
  51. package/types/output/impl/request-controls.test.d.mts +2 -0
  52. package/types/output/impl/request-controls.test.d.mts.map +1 -0
  53. package/types/output/impl/stream.d.mts +1 -1
  54. package/types/output/impl/stream.d.mts.map +1 -1
  55. package/types/output/impl/sugar/watch.d.mts +7 -5
  56. package/types/output/impl/sugar/watch.d.mts.map +1 -1
  57. package/types/output/impl/utils/errors.d.mts +84 -26
  58. package/types/output/impl/utils/errors.d.mts.map +1 -1
  59. package/types/output/impl/utils/fetch.d.mts +27 -0
  60. package/types/output/impl/utils/fetch.d.mts.map +1 -0
  61. package/types/output/impl/utils/fetch.test.d.mts +2 -0
  62. package/types/output/impl/utils/fetch.test.d.mts.map +1 -0
  63. package/types/output/impl/utils/parseRows.d.mts +3 -0
  64. package/types/output/impl/utils/parseRows.d.mts.map +1 -1
  65. package/types/output/impl/utils/request.d.mts +6 -0
  66. package/types/output/impl/utils/request.d.mts.map +1 -0
  67. package/types/output/impl/utils/response.d.mts +7 -0
  68. package/types/output/impl/utils/response.d.mts.map +1 -0
  69. package/types/output/impl/utils/response.test.d.mts +2 -0
  70. package/types/output/impl/utils/response.test.d.mts.map +1 -0
  71. package/types/output/impl/utils/trackedEmitter.test.d.mts +2 -0
  72. package/types/output/impl/utils/trackedEmitter.test.d.mts.map +1 -0
  73. package/types/output/impl/utils/transactionErrors.d.mts +5 -4
  74. package/types/output/impl/utils/transactionErrors.d.mts.map +1 -1
  75. package/types/output/impl/utils/transactionErrors.test.d.mts +2 -0
  76. package/types/output/impl/utils/transactionErrors.test.d.mts.map +1 -0
  77. package/types/output/impl/utils/url.d.mts +4 -0
  78. package/types/output/impl/utils/url.d.mts.map +1 -0
  79. package/types/output/impl/utils/url.test.d.mts +2 -0
  80. package/types/output/impl/utils/url.test.d.mts.map +1 -0
  81. package/types/output/index.d.mts +5 -2
  82. package/types/output/index.d.mts.map +1 -1
  83. package/types/output/schema/config.d.mts +13 -69
  84. package/types/output/schema/config.d.mts.map +1 -1
  85. package/types/output/schema/config.test.d.mts +2 -0
  86. package/types/output/schema/config.test.d.mts.map +1 -0
  87. package/types/output/schema/request.d.mts +10 -0
  88. package/types/output/schema/request.d.mts.map +1 -0
  89. package/types/output/schema/sugar/lock.test.d.mts +2 -0
  90. package/types/output/schema/sugar/lock.test.d.mts.map +1 -0
  91. package/types/output/schema/sugar/watch.d.mts +1 -1
  92. package/types/output/schema/sugar/watch.d.mts.map +1 -1
  93. package/types/output/schema/sugar/watch.test.d.mts +2 -0
  94. package/types/output/schema/sugar/watch.test.d.mts.map +1 -0
  95. package/impl/utils/mergeNeedleOpts.mts +0 -16
  96. package/schema/util.mts +0 -8
  97. package/types/output/impl/utils/mergeNeedleOpts.d.mts +0 -53
  98. package/types/output/impl/utils/mergeNeedleOpts.d.mts.map +0 -1
  99. package/types/output/schema/util.d.mts +0 -85
  100. package/types/output/schema/util.d.mts.map +0 -1
@@ -1,5 +1,6 @@
1
+ import type { StandardSchemaV1 } from '../../types/standard-schema.ts';
1
2
  /**
2
- * Represents a network-level error emitted by Node.js or libraries such as `needle`.
3
+ * Represents a network-level error emitted by Node.js or HTTP client libraries.
3
4
  *
4
5
  * @public
5
6
  */
@@ -13,6 +14,40 @@ export interface NetworkError {
13
14
  */
14
15
  message?: string;
15
16
  }
17
+ export type ErrorCategory = 'conflict' | 'network' | 'not_found' | 'operation' | 'retryable' | 'validation' | 'transaction';
18
+ export type ErrorOperation = 'get' | 'getAtRev' | 'getDBInfo' | 'patch' | 'patchDangerously' | 'put' | 'query' | 'queryStream' | 'remove' | 'request' | 'watchDocs';
19
+ /**
20
+ * Shared structured fields available on hide-a-bed operational errors.
21
+ *
22
+ * @public
23
+ */
24
+ export type HideABedErrorOptions = {
25
+ category: ErrorCategory;
26
+ cause?: unknown;
27
+ couchError?: string;
28
+ docId?: string;
29
+ operation?: ErrorOperation;
30
+ retryable: boolean;
31
+ statusCode?: number;
32
+ };
33
+ /**
34
+ * Shared base class for operational errors thrown by hide-a-bed.
35
+ *
36
+ * @public
37
+ */
38
+ export declare class HideABedError extends Error {
39
+ readonly category: ErrorCategory;
40
+ readonly couchError?: string;
41
+ readonly docId?: string;
42
+ readonly operation?: ErrorOperation;
43
+ readonly retryable: boolean;
44
+ readonly statusCode?: number;
45
+ constructor(message: string, options: HideABedErrorOptions);
46
+ }
47
+ export type ValidationErrorOptions = Omit<Partial<HideABedErrorOptions>, 'category' | 'retryable'> & {
48
+ issues: ReadonlyArray<StandardSchemaV1.Issue>;
49
+ message?: string;
50
+ };
16
51
  /**
17
52
  * Error thrown when a requested CouchDB document cannot be found.
18
53
  *
@@ -22,18 +57,39 @@ export interface NetworkError {
22
57
  *
23
58
  * @public
24
59
  */
25
- export declare class NotFoundError extends Error {
26
- /**
27
- * Identifier of the missing document.
28
- */
29
- readonly docId: string;
30
- /**
31
- * Creates a new {@link NotFoundError} instance.
32
- *
33
- * @param docId - The identifier of the document that was not found.
34
- * @param message - Optional custom error message.
35
- */
36
- constructor(docId: string, message?: string);
60
+ export declare class NotFoundError extends HideABedError {
61
+ constructor(docId: string, options?: Omit<Partial<HideABedErrorOptions>, 'category' | 'docId' | 'retryable'> & {
62
+ message?: string;
63
+ });
64
+ }
65
+ /**
66
+ * Error thrown when a single-document mutation conflicts with the current revision.
67
+ *
68
+ * @public
69
+ */
70
+ export declare class ConflictError extends HideABedError {
71
+ constructor(docId: string, options?: Omit<Partial<HideABedErrorOptions>, 'category' | 'docId' | 'retryable'> & {
72
+ message?: string;
73
+ });
74
+ }
75
+ /**
76
+ * Error thrown when an operation fails in a non-retryable way.
77
+ *
78
+ * @public
79
+ */
80
+ export declare class OperationError extends HideABedError {
81
+ constructor(message: string, options?: Omit<Partial<HideABedErrorOptions>, 'category' | 'retryable'> & {
82
+ category?: Extract<ErrorCategory, 'operation' | 'transaction'>;
83
+ });
84
+ }
85
+ /**
86
+ * Error thrown when schema validation fails for a document, row, key, or value.
87
+ *
88
+ * @public
89
+ */
90
+ export declare class ValidationError extends HideABedError {
91
+ readonly issues: ValidationErrorOptions['issues'];
92
+ constructor(options: ValidationErrorOptions);
37
93
  }
38
94
  /**
39
95
  * Error signalling that an operation can be retried due to transient conditions.
@@ -44,18 +100,10 @@ export declare class NotFoundError extends Error {
44
100
  *
45
101
  * @public
46
102
  */
47
- export declare class RetryableError extends Error {
48
- /**
49
- * HTTP status code associated with the retryable failure, when available.
50
- */
51
- readonly statusCode?: number;
52
- /**
53
- * Creates a new {@link RetryableError} instance.
54
- *
55
- * @param message - Detailed description of the failure.
56
- * @param statusCode - Optional HTTP status code corresponding to the failure.
57
- */
58
- constructor(message: string, statusCode?: number);
103
+ export declare class RetryableError extends HideABedError {
104
+ constructor(message: string, statusCode?: number, options?: Omit<Partial<HideABedErrorOptions>, 'category' | 'retryable' | 'statusCode'> & {
105
+ category?: Extract<ErrorCategory, 'network' | 'retryable'>;
106
+ });
59
107
  /**
60
108
  * Determines whether the provided status code should be treated as retryable.
61
109
  *
@@ -72,7 +120,17 @@ export declare class RetryableError extends Error {
72
120
  * @throws {@link RetryableError} When the error maps to a retryable network condition.
73
121
  * @throws {*} Re-throws the original error when it cannot be mapped.
74
122
  */
75
- static handleNetworkError(err: unknown): never;
123
+ static handleNetworkError(err: unknown, operation?: ErrorOperation): never;
76
124
  }
125
+ type ResponseErrorOptions = {
126
+ body?: unknown;
127
+ defaultMessage: string;
128
+ docId?: string;
129
+ notFoundMessage?: string;
130
+ operation: ErrorOperation;
131
+ statusCode?: number;
132
+ };
133
+ export declare function createResponseError({ body, defaultMessage, docId, notFoundMessage, operation, statusCode }: ResponseErrorOptions): HideABedError;
77
134
  export declare function isConflictError(err: unknown): boolean;
135
+ export {};
78
136
  //# sourceMappingURL=errors.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../../../../impl/utils/errors.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAuBD;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IAEtB;;;;;OAKG;gBACS,KAAK,EAAE,MAAM,EAAE,OAAO,SAAuB;CAK1D;AAED;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAE5B;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAMhD;;;;;;OAMG;IACH,MAAM,CAAC,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,IAAI,MAAM;IAKlF;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK;CAU/C;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIrD"}
1
+ {"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../../../../impl/utils/errors.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAEtE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAMD,MAAM,M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CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,GAAE,cAA0B,GAAG,KAAK;CAgBtF;AAED,KAAK,oBAAoB,GAAG;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,cAAc,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,cAAc,EACd,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACX,EAAE,oBAAoB,GAAG,aAAa,CAiCtC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAKrD"}
@@ -0,0 +1,27 @@
1
+ import type { RequestOptions } from '../../schema/request.mts';
2
+ export type HttpMethod = 'DELETE' | 'GET' | 'POST' | 'PUT';
3
+ type NativeFetchBody = RequestInit['body'];
4
+ export type FetchBody = NativeFetchBody | Record<string, unknown> | Array<unknown> | null | undefined;
5
+ export type FetchAuth = {
6
+ password: string;
7
+ username: string;
8
+ };
9
+ export type FetchResult<TBody> = {
10
+ body: TBody;
11
+ headers: Headers;
12
+ statusCode: number;
13
+ };
14
+ export type FetchRequestOptions = {
15
+ auth?: FetchAuth;
16
+ body?: FetchBody;
17
+ headers?: Record<string, string>;
18
+ method: HttpMethod;
19
+ operation?: 'get' | 'getAtRev' | 'getDBInfo' | 'patch' | 'patchDangerously' | 'put' | 'query' | 'queryStream' | 'remove' | 'request' | 'watchDocs';
20
+ request?: RequestOptions;
21
+ signal?: AbortSignal;
22
+ url: string | URL;
23
+ };
24
+ export declare function fetchCouchJson<TBody = unknown>(options: FetchRequestOptions): Promise<FetchResult<TBody>>;
25
+ export declare function fetchCouchStream(options: FetchRequestOptions): Promise<FetchResult<ReadableStream<Uint8Array> | null>>;
26
+ export {};
27
+ //# sourceMapping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,GAC3B,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAuC7B;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC,CAkCzD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fetch.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.test.d.mts","sourceRoot":"","sources":["../../../../impl/utils/fetch.test.mts"],"names":[],"mappings":""}
@@ -1,9 +1,12 @@
1
1
  import type { StandardSchemaV1 } from '../../types/standard-schema.ts';
2
+ import { type ErrorOperation } from './errors.mts';
2
3
  export type OnInvalidDocAction = 'throw' | 'skip';
3
4
  export declare function parseRows<DocSchema extends StandardSchemaV1 = StandardSchemaV1<any>, KeySchema extends StandardSchemaV1 = StandardSchemaV1<any>, ValueSchema extends StandardSchemaV1 = StandardSchemaV1<any>>(rows: unknown, options: {
5
+ defaultMessage?: string;
4
6
  onInvalidDoc?: OnInvalidDocAction;
5
7
  docSchema?: DocSchema;
6
8
  keySchema?: KeySchema;
9
+ operation?: ErrorOperation;
7
10
  valueSchema?: ValueSchema;
8
11
  }): Promise<{
9
12
  id?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"parseRows.d.mts","sourceRoot":"","sources":["../../../../impl/utils/parseRows.mts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAGtE,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,CAAA;AAEjD,wBAAsB,SAAS,CAC7B,SAAS,SAAS,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAC1D,SAAS,SAAS,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAC1D,WAAW,SAAS,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAE5D,IAAI,EAAE,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B"}
@@ -0,0 +1,6 @@
1
+ import type { RequestOptions } from '../../schema/request.mts';
2
+ export declare const composeAbortSignal: (internalSignal?: AbortSignal, request?: RequestOptions) => {
3
+ signal: AbortSignal | undefined;
4
+ timedOut: () => boolean;
5
+ };
6
+ //# sourceMappingURL=request.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.mts","sourceRoot":"","sources":["../../../../impl/utils/request.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAM9D,eAAO,MAAM,kBAAkB,GAC7B,iBAAiB,WAAW,EAC5B,UAAU,cAAc,KACvB;IACD,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAC/B,QAAQ,EAAE,MAAM,OAAO,CAAA;CAUxB,CAAA"}
@@ -0,0 +1,7 @@
1
+ export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
2
+ export type CouchSuccessProfile = 'bulkGet' | 'bulkSave' | 'changesFeed' | 'database' | 'documentDelete' | 'documentRead' | 'documentWrite' | 'viewQuery' | 'viewStream';
3
+ export declare const getReason: (value: unknown, fallback: string) => string;
4
+ export declare const getCouchError: (value: unknown) => string | undefined;
5
+ export declare const getSuccessStatusCodes: (profile: CouchSuccessProfile) => readonly number[];
6
+ export declare const isSuccessStatusCode: (profile: CouchSuccessProfile, statusCode: number) => boolean;
7
+ //# sourceMappingURL=response.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.mts","sourceRoot":"","sources":["../../../../impl/utils/response.mts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAExE,CAAA;AAED,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,UAAU,GACV,aAAa,GACb,UAAU,GACV,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,WAAW,GACX,YAAY,CAAA;AAchB,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,EAAE,UAAU,MAAM,WAMzD,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,uBAM3C,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,SAAS,mBAAmB,sBAEjE,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,SAAS,mBAAmB,EAAE,YAAY,MAAM,YAEnF,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=response.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.test.d.mts","sourceRoot":"","sources":["../../../../impl/utils/response.test.mts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=trackedEmitter.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trackedEmitter.test.d.mts","sourceRoot":"","sources":["../../../../impl/utils/trackedEmitter.test.mts"],"names":[],"mappings":""}
@@ -1,12 +1,13 @@
1
- export declare class TransactionSetupError extends Error {
1
+ import { OperationError } from './errors.mts';
2
+ export declare class TransactionSetupError extends OperationError {
2
3
  details: Record<string, unknown>;
3
4
  constructor(message: string, details?: Record<string, unknown>);
4
5
  }
5
- export declare class TransactionVersionConflictError extends Error {
6
+ export declare class TransactionVersionConflictError extends OperationError {
6
7
  conflictingIds: string[];
7
8
  constructor(conflictingIds: string[]);
8
9
  }
9
- export declare class TransactionBulkOperationError extends Error {
10
+ export declare class TransactionBulkOperationError extends OperationError {
10
11
  failedDocs: {
11
12
  ok?: boolean | null;
12
13
  id?: string | null;
@@ -22,7 +23,7 @@ export declare class TransactionBulkOperationError extends Error {
22
23
  reason?: string | null;
23
24
  }>);
24
25
  }
25
- export declare class TransactionRollbackError extends Error {
26
+ export declare class TransactionRollbackError extends OperationError {
26
27
  originalError: Error;
27
28
  rollbackResults: {
28
29
  ok?: boolean | null;
@@ -1 +1 @@
1
- {"version":3,"file":"transactionErrors.d.mts","sourceRoot":"","sources":["../../../../impl/utils/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ClB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KACvB,CAAC;CAQL;AAED,qBAAa,wBAAyB,SAAQ,cAAc;IAC1D,aAAa,EAAE,KAAK,CAAA;IACpB,eAAe,EAAE;QACf,EAAE,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QACnB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAClB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KACvB,EAAE,CAAA;gBAGD,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,KAAK,EACpB,eAAe,EAAE,KAAK,CAAC;QACrB,EAAE,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QACnB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAClB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KACvB,CAAC;CAOL"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transactionErrors.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionErrors.test.d.mts","sourceRoot":"","sources":["../../../../impl/utils/transactionErrors.test.mts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export declare const createCouchDbUrl: (value: string | URL) => import("url").URL;
2
+ export declare const createCouchPathUrl: (path: string, base: string | URL) => import("url").URL;
3
+ export declare const createCouchDocUrl: (docId: string, base: string | URL) => import("url").URL;
4
+ //# sourceMappingURL=url.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.mts","sourceRoot":"","sources":["../../../../impl/utils/url.mts"],"names":[],"mappings":"AAUA,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,GAAG,GAAG,sBAEnD,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,GAAG,GAAG,sBAElE,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,EAAE,MAAM,MAAM,GAAG,GAAG,sBAElE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=url.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.test.d.mts","sourceRoot":"","sources":["../../../../impl/utils/url.test.mts"],"names":[],"mappings":""}
@@ -15,6 +15,7 @@ import { bulkRemove, bulkRemoveMap } from './impl/bulkRemove.mts';
15
15
  import { createLock, removeLock } from './impl/sugar/lock.mts';
16
16
  import { watchDocs } from './impl/sugar/watch.mts';
17
17
  export { get, getAtRev, put, remove, bulkGet, bulkSave, query, queryStream, getDBInfo, patch, patchDangerously, bulkRemove, bulkRemoveMap, bulkGetDictionary, bulkSaveTransaction, watchDocs, bindConfig, withRetry, QueryBuilder, createQuery, createLock, removeLock };
18
+ export { ConflictError, HideABedError, NotFoundError, OperationError, RetryableError, ValidationError } from './impl/utils/errors.mts';
18
19
  export type { BulkGetBound, BulkGetDictionaryBound, BulkGetDictionaryOptions, BulkGetDictionaryResult, BulkGetOptions, BulkGetResponse } from './impl/bulkGet.mts';
19
20
  export type { OnInvalidDocAction } from './impl/utils/parseRows.mts';
20
21
  export type { GetOptions, GetBound, GetAtRevBound } from './impl/get.mts';
@@ -22,10 +23,12 @@ export type { QueryBound } from './impl/query.mts';
22
23
  export type { ViewString, ViewOptions as SimpleViewOptions } from './schema/couch/couch.input.schema.ts';
23
24
  export type { ViewRow, CouchDoc, CouchDocInput, ViewQueryResponse, ViewQueryResponseValidated, ViewRowValidated } from './schema/couch/couch.output.schema.ts';
24
25
  export type { RetryOptions } from './impl/retry.mts';
25
- export type { NetworkError, RetryableError, NotFoundError } from './impl/utils/errors.mts';
26
+ export type { ErrorCategory, ErrorOperation, HideABedErrorOptions, NetworkError, ValidationErrorOptions } from './impl/utils/errors.mts';
26
27
  export type { OnRow } from './impl/stream.mts';
27
- export type { CouchConfig, CouchConfigInput } from './schema/config.mts';
28
+ export type { CouchAuth, CouchAuthInput, CouchConfig, CouchConfigInput } from './schema/config.mts';
29
+ export type { Dispatcher, RequestOptions, RequestOptionsInput } from './schema/request.mts';
28
30
  export type { LockOptions, LockOptionsInput, LockDoc } from './schema/sugar/lock.mts';
31
+ export type { WatchHandle, WatchListener } from './impl/sugar/watch.mts';
29
32
  export type { WatchOptions as WatchOptionsSchema, WatchOptionsInput } from './schema/sugar/watch.mts';
30
33
  export type { BoundInstance } from './impl/bindConfig.mts';
31
34
  export type { StandardSchemaV1 } from './types/standard-schema.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../index.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EA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AAM,qBAAqB,CAAA;AACnG,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC3F,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACrF,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACxE,YAAY,EACV,YAAY,IAAI,kBAAkB,EAClC,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;AACjC,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA"}
@@ -1,46 +1,18 @@
1
1
  import { z } from 'zod';
2
2
  import type { StandardSchemaV1 } from '../types/standard-schema.ts';
3
- export declare const NeedleBaseOptions: z.ZodObject<{
4
- json: z.ZodBoolean;
5
- headers: z.ZodRecord<z.ZodString, z.ZodString>;
6
- parse_response: z.ZodOptional<z.ZodBoolean>;
7
- }, z.core.$strip>;
8
- export type NeedleBaseOptionsSchema = z.infer<typeof NeedleBaseOptions>;
9
- export declare const NeedleOptions: z.ZodObject<{
10
- json: z.ZodOptional<z.ZodBoolean>;
11
- compressed: z.ZodOptional<z.ZodBoolean>;
12
- follow_max: z.ZodOptional<z.ZodNumber>;
13
- follow_set_cookie: z.ZodOptional<z.ZodBoolean>;
14
- follow_set_referer: z.ZodOptional<z.ZodBoolean>;
15
- follow: z.ZodOptional<z.ZodNumber>;
16
- timeout: z.ZodOptional<z.ZodNumber>;
17
- read_timeout: z.ZodOptional<z.ZodNumber>;
18
- parse_response: z.ZodOptional<z.ZodBoolean>;
19
- decode: z.ZodOptional<z.ZodBoolean>;
20
- parse_cookies: z.ZodOptional<z.ZodBoolean>;
21
- cookies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
22
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
23
- auth: z.ZodOptional<z.ZodEnum<{
24
- auto: "auto";
25
- digest: "digest";
26
- basic: "basic";
27
- }>>;
28
- username: z.ZodOptional<z.ZodString>;
29
- password: z.ZodOptional<z.ZodString>;
30
- proxy: z.ZodOptional<z.ZodString>;
31
- agent: z.ZodOptional<z.ZodAny>;
32
- rejectUnauthorized: z.ZodOptional<z.ZodBoolean>;
33
- output: z.ZodOptional<z.ZodString>;
34
- parse: z.ZodOptional<z.ZodBoolean>;
35
- multipart: z.ZodOptional<z.ZodBoolean>;
36
- open_timeout: z.ZodOptional<z.ZodNumber>;
37
- response_timeout: z.ZodOptional<z.ZodNumber>;
38
- keepAlive: z.ZodOptional<z.ZodBoolean>;
39
- }, z.core.$strip>;
3
+ import { RequestOptions } from './request.mts';
4
+ export declare const CouchAuth: z.ZodObject<{
5
+ username: z.ZodString;
6
+ password: z.ZodString;
7
+ }, z.core.$strict>;
40
8
  export declare const CouchConfig: z.ZodObject<{
9
+ auth: z.ZodOptional<z.ZodObject<{
10
+ username: z.ZodString;
11
+ password: z.ZodString;
12
+ }, z.core.$strict>>;
41
13
  backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
42
14
  bindWithRetry: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
43
- couch: z.ZodString;
15
+ couch: z.ZodCustom<string | URL, string | URL>;
44
16
  initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
45
17
  logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
46
18
  error: z.ZodOptional<z.ZodFunction<z.ZodArray<z.ZodAny>, z.ZodVoid>>;
@@ -49,42 +21,14 @@ export declare const CouchConfig: z.ZodObject<{
49
21
  debug: z.ZodOptional<z.ZodFunction<z.ZodArray<z.ZodAny>, z.ZodVoid>>;
50
22
  }, z.core.$strip>, z.ZodFunction<z.ZodArray<z.ZodAny>, z.ZodVoid>]>>;
51
23
  maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
52
- needleOpts: z.ZodOptional<z.ZodObject<{
53
- json: z.ZodOptional<z.ZodBoolean>;
54
- compressed: z.ZodOptional<z.ZodBoolean>;
55
- follow_max: z.ZodOptional<z.ZodNumber>;
56
- follow_set_cookie: z.ZodOptional<z.ZodBoolean>;
57
- follow_set_referer: z.ZodOptional<z.ZodBoolean>;
58
- follow: z.ZodOptional<z.ZodNumber>;
59
- timeout: z.ZodOptional<z.ZodNumber>;
60
- read_timeout: z.ZodOptional<z.ZodNumber>;
61
- parse_response: z.ZodOptional<z.ZodBoolean>;
62
- decode: z.ZodOptional<z.ZodBoolean>;
63
- parse_cookies: z.ZodOptional<z.ZodBoolean>;
64
- cookies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
65
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
66
- auth: z.ZodOptional<z.ZodEnum<{
67
- auto: "auto";
68
- digest: "digest";
69
- basic: "basic";
70
- }>>;
71
- username: z.ZodOptional<z.ZodString>;
72
- password: z.ZodOptional<z.ZodString>;
73
- proxy: z.ZodOptional<z.ZodString>;
74
- agent: z.ZodOptional<z.ZodAny>;
75
- rejectUnauthorized: z.ZodOptional<z.ZodBoolean>;
76
- output: z.ZodOptional<z.ZodString>;
77
- parse: z.ZodOptional<z.ZodBoolean>;
78
- multipart: z.ZodOptional<z.ZodBoolean>;
79
- open_timeout: z.ZodOptional<z.ZodNumber>;
80
- response_timeout: z.ZodOptional<z.ZodNumber>;
81
- keepAlive: z.ZodOptional<z.ZodBoolean>;
82
- }, z.core.$strip>>;
24
+ request: z.ZodOptional<z.ZodType<RequestOptions, RequestOptions, z.core.$ZodTypeInternals<RequestOptions, RequestOptions>>>;
83
25
  throwOnGetNotFound: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
84
26
  useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
85
27
  '~emitter': z.ZodOptional<z.ZodAny>;
86
28
  '~normalizedLogger': z.ZodOptional<z.ZodAny>;
87
29
  }, z.core.$strict>;
30
+ export type CouchAuth = StandardSchemaV1.InferOutput<typeof CouchAuth>;
31
+ export type CouchAuthInput = StandardSchemaV1.InferInput<typeof CouchAuth>;
88
32
  export type CouchConfig = StandardSchemaV1.InferOutput<typeof CouchConfig>;
89
33
  export type CouchConfigInput = StandardSchemaV1.InferInput<typeof CouchConfig>;
90
34
  //# sourceMappingURL=config.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.mts","sourceRoot":"","sources":["../../../schema/config.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAanE,eAAO,MAAM,iBAAiB;;;;iBAI5B,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEvE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BxB,CAAA;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4BY,CAAA;AAEpC,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAC,WAAW,CAAC,OAAO,WAAW,CAAC,CAAA;AAC1E,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA"}
1
+ {"version":3,"file":"config.d.mts","sourceRoot":"","sources":["../../../schema/config.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAa9C,eAAO,MAAM,SAAS;;;kBAGpB,CAAA;AAWF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;kBA6BY,CAAA;AAEpC,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,WAAW,CAAC,OAAO,SAAS,CAAC,CAAA;AACtE,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAA;AAC1E,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAC,WAAW,CAAC,OAAO,WAAW,CAAC,CAAA;AAC1E,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.test.d.mts","sourceRoot":"","sources":["../../../schema/config.test.mts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ export type Dispatcher = RequestInit['dispatcher'];
3
+ export type RequestOptions = {
4
+ dispatcher?: Dispatcher;
5
+ signal?: AbortSignal;
6
+ timeout?: number;
7
+ };
8
+ export type RequestOptionsInput = RequestOptions;
9
+ export declare const RequestOptions: z.ZodType<RequestOptions, RequestOptionsInput>;
10
+ //# sourceMappingURL=request.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.mts","sourceRoot":"","sources":["../../../schema/request.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,YAAY,CAAC,CAAA;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAA;AAOhD,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,mBAAmB,CAcxE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=lock.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.test.d.mts","sourceRoot":"","sources":["../../../../schema/sugar/lock.test.mts"],"names":[],"mappings":""}
@@ -5,7 +5,7 @@ export declare const WatchOptions: z.ZodObject<{
5
5
  maxRetries: z.ZodOptional<z.ZodNumber>;
6
6
  initialDelay: z.ZodOptional<z.ZodNumber>;
7
7
  maxDelay: z.ZodOptional<z.ZodNumber>;
8
- }, z.core.$strip>;
8
+ }, z.core.$strict>;
9
9
  export type WatchOptions = StandardSchemaV1.InferOutput<typeof WatchOptions>;
10
10
  export type WatchOptionsInput = StandardSchemaV1.InferInput<typeof WatchOptions>;
11
11
  //# sourceMappingURL=watch.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.mts","sourceRoot":"","sources":["../../../../schema/sugar/watch.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAEtE,eAAO,MAAM,YAAY;;;;;iBAOb,CAAA;AAEZ,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC,OAAO,YAAY,CAAC,CAAA;AAC5E,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA"}
1
+ {"version":3,"file":"watch.d.mts","sourceRoot":"","sources":["../../../../schema/sugar/watch.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAEtE,eAAO,MAAM,YAAY;;;;;kBAOb,CAAA;AAEZ,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC,OAAO,YAAY,CAAC,CAAA;AAC5E,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=watch.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.test.d.mts","sourceRoot":"","sources":["../../../../schema/sugar/watch.test.mts"],"names":[],"mappings":""}
@@ -1,16 +0,0 @@
1
- import { MergeNeedleOpts } from '../../schema/util.mts'
2
-
3
- export const mergeNeedleOpts = MergeNeedleOpts.implement((config, opts) => {
4
- if (config.needleOpts) {
5
- return {
6
- ...opts,
7
- ...config.needleOpts,
8
- headers: {
9
- ...opts.headers,
10
- ...(config.needleOpts.headers ?? {})
11
- }
12
- }
13
- }
14
-
15
- return opts
16
- })
package/schema/util.mts DELETED
@@ -1,8 +0,0 @@
1
- import { z } from 'zod'
2
- import { CouchConfig, NeedleBaseOptions, NeedleOptions } from './config.mts'
3
-
4
- export const MergeNeedleOpts = z.function({
5
- input: [CouchConfig, NeedleBaseOptions],
6
- output: NeedleOptions
7
- })
8
- export type MergeNeedleOptsSchema = z.infer<typeof MergeNeedleOpts>
@@ -1,53 +0,0 @@
1
- export declare const mergeNeedleOpts: (args_0: {
2
- couch: string;
3
- backoffFactor?: number | undefined;
4
- bindWithRetry?: boolean | undefined;
5
- initialDelay?: number | undefined;
6
- logger?: import("zod/v4/core").$InferInnerFunctionType<import("zod").ZodArray<import("zod").ZodAny>, import("zod").ZodVoid> | {
7
- error?: import("zod/v4/core").$InferInnerFunctionType<import("zod").ZodArray<import("zod").ZodAny>, import("zod").ZodVoid> | undefined;
8
- warn?: import("zod/v4/core").$InferInnerFunctionType<import("zod").ZodArray<import("zod").ZodAny>, import("zod").ZodVoid> | undefined;
9
- info?: import("zod/v4/core").$InferInnerFunctionType<import("zod").ZodArray<import("zod").ZodAny>, import("zod").ZodVoid> | undefined;
10
- debug?: import("zod/v4/core").$InferInnerFunctionType<import("zod").ZodArray<import("zod").ZodAny>, import("zod").ZodVoid> | undefined;
11
- } | undefined;
12
- maxRetries?: number | undefined;
13
- needleOpts?: {
14
- json?: boolean | undefined;
15
- compressed?: boolean | undefined;
16
- follow_max?: number | undefined;
17
- follow_set_cookie?: boolean | undefined;
18
- follow_set_referer?: boolean | undefined;
19
- follow?: number | undefined;
20
- timeout?: number | undefined;
21
- read_timeout?: number | undefined;
22
- parse_response?: boolean | undefined;
23
- decode?: boolean | undefined;
24
- parse_cookies?: boolean | undefined;
25
- cookies?: Record<string, string> | undefined;
26
- headers?: Record<string, string> | undefined;
27
- auth?: "auto" | "digest" | "basic" | undefined;
28
- username?: string | undefined;
29
- password?: string | undefined;
30
- proxy?: string | undefined;
31
- agent?: any;
32
- rejectUnauthorized?: boolean | undefined;
33
- output?: string | undefined;
34
- parse?: boolean | undefined;
35
- multipart?: boolean | undefined;
36
- open_timeout?: number | undefined;
37
- response_timeout?: number | undefined;
38
- keepAlive?: boolean | undefined;
39
- } | undefined;
40
- throwOnGetNotFound?: boolean | undefined;
41
- useConsoleLogger?: boolean | undefined;
42
- '~emitter'?: any;
43
- '~normalizedLogger'?: any;
44
- }, args_1: {
45
- json: boolean;
46
- headers: Record<string, string>;
47
- parse_response?: boolean | undefined;
48
- }) => {
49
- json: boolean;
50
- headers: Record<string, string>;
51
- parse_response?: boolean | undefined;
52
- };
53
- //# sourceMappingURL=mergeNeedleOpts.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeNeedleOpts.d.mts","sourceRoot":"","sources":["../../../../impl/utils/mergeNeedleOpts.mts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa1B,CAAA"}