hide-a-bed 7.0.0 → 7.1.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.
@@ -1,89 +1,92 @@
1
- import { RetryableError } from './errors.mts'
2
- import type { RequestOptions } from '../../schema/request.mts'
3
- import { composeAbortSignal } from './request.mts'
1
+ import { RetryableError } from "./errors.mts";
2
+ import type { RequestOptions } from "../../schema/request.mts";
3
+ import { composeAbortSignal } from "./request.mts";
4
4
 
5
- export type HttpMethod = 'DELETE' | 'GET' | 'POST' | 'PUT'
5
+ export type HttpMethod = "DELETE" | "GET" | "HEAD" | "POST" | "PUT";
6
6
 
7
- type NativeFetchBody = RequestInit['body']
7
+ type NativeFetchBody = RequestInit["body"];
8
8
 
9
9
  export type FetchBody =
10
10
  | NativeFetchBody
11
11
  | Record<string, unknown>
12
12
  | Array<unknown>
13
13
  | null
14
- | undefined
14
+ | undefined;
15
15
 
16
16
  export type FetchAuth = {
17
- password: string
18
- username: string
19
- }
17
+ password: string;
18
+ username: string;
19
+ };
20
20
 
21
21
  export type FetchResult<TBody> = {
22
- body: TBody
23
- headers: Headers
24
- statusCode: number
25
- }
22
+ body: TBody;
23
+ headers: Headers;
24
+ statusCode: number;
25
+ };
26
26
 
27
27
  export type FetchRequestOptions = {
28
- auth?: FetchAuth
29
- body?: FetchBody
30
- headers?: Record<string, string>
31
- method: HttpMethod
28
+ auth?: FetchAuth;
29
+ body?: FetchBody;
30
+ headers?: Record<string, string>;
31
+ method: HttpMethod;
32
32
  operation?:
33
- | 'get'
34
- | 'getAtRev'
35
- | 'getDBInfo'
36
- | 'patch'
37
- | 'patchDangerously'
38
- | 'put'
39
- | 'query'
40
- | 'queryStream'
41
- | 'remove'
42
- | 'request'
43
- | 'watchDocs'
44
- request?: RequestOptions
45
- signal?: AbortSignal
46
- url: string | URL
47
- }
33
+ | "get"
34
+ | "getAtRev"
35
+ | "getDBInfo"
36
+ | "headDB"
37
+ | "patch"
38
+ | "patchDangerously"
39
+ | "put"
40
+ | "query"
41
+ | "queryStream"
42
+ | "remove"
43
+ | "request"
44
+ | "watchDocs";
45
+ request?: RequestOptions;
46
+ signal?: AbortSignal;
47
+ url: string | URL;
48
+ };
48
49
 
49
50
  const JSON_HEADERS = {
50
- 'Content-Type': 'application/json'
51
- } as const
51
+ "Content-Type": "application/json",
52
+ } as const;
52
53
 
53
54
  const hasHeader = (headers: Record<string, string>, name: string) => {
54
- const expected = name.toLowerCase()
55
- return Object.keys(headers).some(header => header.toLowerCase() === expected)
56
- }
55
+ const expected = name.toLowerCase();
56
+ return Object.keys(headers).some(
57
+ (header) => header.toLowerCase() === expected,
58
+ );
59
+ };
57
60
 
58
61
  const toBasicAuthHeader = ({ username, password }: FetchAuth) => {
59
- const token = Buffer.from(`${username}:${password}`).toString('base64')
60
- return `Basic ${token}`
61
- }
62
+ const token = Buffer.from(`${username}:${password}`).toString("base64");
63
+ return `Basic ${token}`;
64
+ };
62
65
 
63
66
  const prepareRequest = (options: FetchRequestOptions) => {
64
- const auth = options.auth
65
- const headers = { ...(options.headers ?? {}) }
67
+ const auth = options.auth;
68
+ const headers = { ...(options.headers ?? {}) };
66
69
 
67
- if (auth && !hasHeader(headers, 'Authorization')) {
68
- headers.Authorization = toBasicAuthHeader(auth)
70
+ if (auth && !hasHeader(headers, "Authorization")) {
71
+ headers.Authorization = toBasicAuthHeader(auth);
69
72
  }
70
73
 
71
- return { headers }
72
- }
74
+ return { headers };
75
+ };
73
76
 
74
77
  const isAbortError = (err: unknown): err is DOMException => {
75
- return err instanceof DOMException && err.name === 'AbortError'
76
- }
78
+ return err instanceof DOMException && err.name === "AbortError";
79
+ };
77
80
 
78
81
  const isTimeoutError = (err: unknown): err is DOMException => {
79
- return err instanceof DOMException && err.name === 'TimeoutError'
80
- }
82
+ return err instanceof DOMException && err.name === "TimeoutError";
83
+ };
81
84
 
82
85
  const encodeBody = (body: FetchBody): NativeFetchBody | undefined => {
83
- if (body == null) return undefined
86
+ if (body == null) return undefined;
84
87
 
85
88
  if (
86
- typeof body === 'string' ||
89
+ typeof body === "string" ||
87
90
  body instanceof ArrayBuffer ||
88
91
  ArrayBuffer.isView(body) ||
89
92
  body instanceof Blob ||
@@ -91,83 +94,89 @@ const encodeBody = (body: FetchBody): NativeFetchBody | undefined => {
91
94
  body instanceof URLSearchParams ||
92
95
  body instanceof ReadableStream
93
96
  ) {
94
- return body as NativeFetchBody
97
+ return body as NativeFetchBody;
95
98
  }
96
99
 
97
- return JSON.stringify(body)
98
- }
100
+ return JSON.stringify(body);
101
+ };
99
102
 
100
103
  const parseJsonResponse = async (response: Response): Promise<unknown> => {
101
104
  if (response.status === 204 || response.status === 205) {
102
- return null
105
+ return null;
103
106
  }
104
107
 
105
- const text = await response.text()
108
+ const text = await response.text();
106
109
 
107
- if (text.trim() === '') {
108
- return null
110
+ if (text.trim() === "") {
111
+ return null;
109
112
  }
110
113
 
111
114
  try {
112
- return JSON.parse(text)
115
+ return JSON.parse(text);
113
116
  } catch (err) {
114
117
  if (response.ok) {
115
- throw err
118
+ throw err;
116
119
  }
117
120
 
118
- return text
121
+ return text;
119
122
  }
120
- }
123
+ };
121
124
 
122
125
  export async function fetchCouchJson<TBody = unknown>(
123
- options: FetchRequestOptions
126
+ options: FetchRequestOptions,
124
127
  ): Promise<FetchResult<TBody>> {
125
- let response: Response
126
- const { headers } = prepareRequest(options)
127
- const { signal, timedOut } = composeAbortSignal(options.signal, options.request)
128
+ let response: Response;
129
+ const { headers } = prepareRequest(options);
130
+ const { signal, timedOut } = composeAbortSignal(
131
+ options.signal,
132
+ options.request,
133
+ );
128
134
 
129
135
  try {
130
136
  response = await fetch(options.url, {
131
137
  method: options.method,
132
138
  headers: {
133
139
  ...JSON_HEADERS,
134
- ...headers
140
+ ...headers,
135
141
  },
136
142
  body: encodeBody(options.body),
137
143
  signal,
138
- dispatcher: options.request?.dispatcher
139
- })
144
+ dispatcher: options.request?.dispatcher,
145
+ });
140
146
  } catch (err) {
141
147
  if (timedOut() || isTimeoutError(err)) {
142
- throw new RetryableError('Request timed out', 503, {
143
- category: 'network',
148
+ throw new RetryableError("Request timed out", 503, {
149
+ category: "network",
144
150
  cause: err,
145
- operation: options.operation
146
- })
151
+ operation: options.operation,
152
+ });
147
153
  }
148
154
 
149
155
  if (isAbortError(err)) {
150
- throw err
156
+ throw err;
151
157
  }
152
158
 
153
- RetryableError.handleNetworkError(err, options.operation)
159
+ RetryableError.handleNetworkError(err, options.operation);
154
160
  }
155
161
 
156
- const body = (await parseJsonResponse(response)) as TBody
162
+ const body = (await parseJsonResponse(response)) as TBody;
157
163
 
158
164
  return {
159
165
  body,
160
166
  headers: response.headers,
161
- statusCode: response.status
162
- }
167
+ statusCode: response.status,
168
+ };
163
169
  }
164
170
 
165
171
  export async function fetchCouchStream(
166
- options: FetchRequestOptions
172
+ options: FetchRequestOptions,
167
173
  ): Promise<FetchResult<ReadableStream<Uint8Array> | null>> {
168
- let response: Response
169
- const { headers } = prepareRequest(options)
170
- const { signal, timedOut } = composeAbortSignal(options.signal, options.request)
174
+ let response: Response;
175
+ const { headers } = prepareRequest(options);
176
+ const { signal, timedOut } = composeAbortSignal(
177
+ options.signal,
178
+ options.request,
179
+ );
171
180
 
172
181
  try {
173
182
  response = await fetch(options.url, {
@@ -175,27 +184,27 @@ export async function fetchCouchStream(
175
184
  headers,
176
185
  body: encodeBody(options.body),
177
186
  signal,
178
- dispatcher: options.request?.dispatcher
179
- })
187
+ dispatcher: options.request?.dispatcher,
188
+ });
180
189
  } catch (err) {
181
190
  if (timedOut() || isTimeoutError(err)) {
182
- throw new RetryableError('Request timed out', 503, {
183
- category: 'network',
191
+ throw new RetryableError("Request timed out", 503, {
192
+ category: "network",
184
193
  cause: err,
185
- operation: options.operation
186
- })
194
+ operation: options.operation,
195
+ });
187
196
  }
188
197
 
189
198
  if (isAbortError(err)) {
190
- throw err
199
+ throw err;
191
200
  }
192
201
 
193
- RetryableError.handleNetworkError(err, options.operation)
202
+ RetryableError.handleNetworkError(err, options.operation);
194
203
  }
195
204
 
196
205
  return {
197
206
  body: response.body,
198
207
  headers: response.headers,
199
- statusCode: response.status
200
- }
208
+ statusCode: response.status,
209
+ };
201
210
  }
@@ -6,8 +6,7 @@ const KEYS_TO_QUOTE: (keyof ViewOptions)[] = [
6
6
  'key',
7
7
  'keys',
8
8
  'startkey',
9
- 'startkey_docid',
10
- 'update'
9
+ 'startkey_docid'
11
10
  ]
12
11
 
13
12
  /**
package/index.mts CHANGED
@@ -1,19 +1,20 @@
1
- import { createQuery } from './impl/utils/queryBuilder.mts'
2
- import { QueryBuilder } from './impl/utils/queryBuilder.mts'
3
- import { bindConfig } from './impl/bindConfig.mts'
4
- import { withRetry } from './impl/retry.mts'
5
- import { bulkGet, bulkGetDictionary } from './impl/bulkGet.mts'
6
- import { getAtRev, get } from './impl/get.mts'
7
- import { queryStream } from './impl/stream.mts'
8
- import { patch, patchDangerously } from './impl/patch.mts'
9
- import { put } from './impl/put.mts'
10
- import { remove } from './impl/remove.mts'
11
- import { bulkSave, bulkSaveTransaction } from './impl/bulkSave.mts'
12
- import { query } from './impl/query.mts'
13
- import { getDBInfo } from './impl/getDBInfo.mts'
14
- import { bulkRemove, bulkRemoveMap } from './impl/bulkRemove.mts'
15
- import { createLock, removeLock } from './impl/sugar/lock.mts'
16
- import { watchDocs } from './impl/sugar/watch.mts'
1
+ import { createQuery } from "./impl/utils/queryBuilder.mts";
2
+ import { QueryBuilder } from "./impl/utils/queryBuilder.mts";
3
+ import { bindConfig } from "./impl/bindConfig.mts";
4
+ import { withRetry } from "./impl/retry.mts";
5
+ import { bulkGet, bulkGetDictionary } from "./impl/bulkGet.mts";
6
+ import { getAtRev, get } from "./impl/get.mts";
7
+ import { queryStream } from "./impl/stream.mts";
8
+ import { patch, patchDangerously } from "./impl/patch.mts";
9
+ import { put } from "./impl/put.mts";
10
+ import { remove } from "./impl/remove.mts";
11
+ import { bulkSave, bulkSaveTransaction } from "./impl/bulkSave.mts";
12
+ import { query } from "./impl/query.mts";
13
+ import { getDBInfo } from "./impl/getDBInfo.mts";
14
+ import { headDB } from "./impl/headDB.mts";
15
+ import { bulkRemove, bulkRemoveMap } from "./impl/bulkRemove.mts";
16
+ import { createLock, removeLock } from "./impl/sugar/lock.mts";
17
+ import { watchDocs } from "./impl/sugar/watch.mts";
17
18
 
18
19
  export {
19
20
  get,
@@ -25,6 +26,7 @@ export {
25
26
  query,
26
27
  queryStream,
27
28
  getDBInfo,
29
+ headDB,
28
30
 
29
31
  // sugar methods
30
32
  patch,
@@ -43,8 +45,8 @@ export {
43
45
  QueryBuilder,
44
46
  createQuery,
45
47
  createLock,
46
- removeLock
47
- }
48
+ removeLock,
49
+ };
48
50
 
49
51
  export {
50
52
  ConflictError,
@@ -52,8 +54,8 @@ export {
52
54
  NotFoundError,
53
55
  OperationError,
54
56
  RetryableError,
55
- ValidationError
56
- } from './impl/utils/errors.mts'
57
+ ValidationError,
58
+ } from "./impl/utils/errors.mts";
57
59
 
58
60
  export type {
59
61
  BulkGetBound,
@@ -61,39 +63,52 @@ export type {
61
63
  BulkGetDictionaryOptions,
62
64
  BulkGetDictionaryResult,
63
65
  BulkGetOptions,
64
- BulkGetResponse
65
- } from './impl/bulkGet.mts'
66
- export type { OnInvalidDocAction } from './impl/utils/parseRows.mts'
67
- export type { GetOptions, GetBound, GetAtRevBound } from './impl/get.mts'
68
- export type { QueryBound } from './impl/query.mts'
66
+ BulkGetResponse,
67
+ } from "./impl/bulkGet.mts";
68
+ export type { OnInvalidDocAction } from "./impl/utils/parseRows.mts";
69
+ export type { GetOptions, GetBound, GetAtRevBound } from "./impl/get.mts";
70
+ export type { QueryBound } from "./impl/query.mts";
69
71
  export type {
70
72
  ViewString,
71
- ViewOptions as SimpleViewOptions
72
- } from './schema/couch/couch.input.schema.ts'
73
+ ViewOptions as SimpleViewOptions,
74
+ } from "./schema/couch/couch.input.schema.ts";
73
75
  export type {
74
76
  ViewRow,
75
77
  CouchDoc,
76
78
  CouchDocInput,
77
79
  ViewQueryResponse,
78
80
  ViewQueryResponseValidated,
79
- ViewRowValidated
80
- } from './schema/couch/couch.output.schema.ts'
81
- export type { RetryOptions } from './impl/retry.mts'
81
+ ViewRowValidated,
82
+ } from "./schema/couch/couch.output.schema.ts";
83
+ export type { RetryOptions } from "./impl/retry.mts";
82
84
  export type {
83
85
  ErrorCategory,
84
86
  ErrorOperation,
85
87
  HideABedErrorOptions,
86
88
  NetworkError,
87
- ValidationErrorOptions
88
- } from './impl/utils/errors.mts'
89
- export type { OnRow } from './impl/stream.mts'
90
- export type { CouchAuth, CouchAuthInput, CouchConfig, CouchConfigInput } from './schema/config.mts'
91
- export type { Dispatcher, RequestOptions, RequestOptionsInput } from './schema/request.mts'
92
- export type { LockOptions, LockOptionsInput, LockDoc } from './schema/sugar/lock.mts'
93
- export type { WatchHandle, WatchListener } from './impl/sugar/watch.mts'
89
+ ValidationErrorOptions,
90
+ } from "./impl/utils/errors.mts";
91
+ export type { OnRow } from "./impl/stream.mts";
92
+ export type {
93
+ CouchAuth,
94
+ CouchAuthInput,
95
+ CouchConfig,
96
+ CouchConfigInput,
97
+ } from "./schema/config.mts";
98
+ export type {
99
+ Dispatcher,
100
+ RequestOptions,
101
+ RequestOptionsInput,
102
+ } from "./schema/request.mts";
103
+ export type {
104
+ LockOptions,
105
+ LockOptionsInput,
106
+ LockDoc,
107
+ } from "./schema/sugar/lock.mts";
108
+ export type { WatchHandle, WatchListener } from "./impl/sugar/watch.mts";
94
109
  export type {
95
110
  WatchOptions as WatchOptionsSchema,
96
- WatchOptionsInput
97
- } from './schema/sugar/watch.mts'
98
- export type { BoundInstance } from './impl/bindConfig.mts'
99
- export type { StandardSchemaV1 } from './types/standard-schema.ts'
111
+ WatchOptionsInput,
112
+ } from "./schema/sugar/watch.mts";
113
+ export type { BoundInstance } from "./impl/bindConfig.mts";
114
+ export type { StandardSchemaV1 } from "./types/standard-schema.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hide-a-bed",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "An abstraction over couchdb calls that includes easy mock/stubs with pouchdb",
5
5
  "keywords": [
6
6
  "couchdb",
@@ -1,17 +1,18 @@
1
- import type z from 'zod';
2
- import { CouchConfig, type CouchConfigInput } from '../schema/config.mts';
3
- import { type BulkGetBound, type BulkGetDictionaryBound } from './bulkGet.mts';
4
- import { type GetBound, type GetAtRevBound } from './get.mts';
5
- import { queryStream } from './stream.mts';
6
- import { patch, patchDangerously } from './patch.mts';
7
- import { put } from './put.mts';
8
- import type { QueryBound } from './query.mts';
9
- import { bulkRemove, bulkRemoveMap } from './bulkRemove.mts';
10
- import { bulkSave, bulkSaveTransaction } from './bulkSave.mts';
11
- import { getDBInfo } from './getDBInfo.mts';
12
- import { remove } from './remove.mts';
13
- import { createLock, removeLock } from './sugar/lock.mts';
14
- import { watchDocs } from './sugar/watch.mts';
1
+ import type z from "zod";
2
+ import { CouchConfig, type CouchConfigInput } from "../schema/config.mts";
3
+ import { type BulkGetBound, type BulkGetDictionaryBound } from "./bulkGet.mts";
4
+ import { type GetBound, type GetAtRevBound } from "./get.mts";
5
+ import { queryStream } from "./stream.mts";
6
+ import { patch, patchDangerously } from "./patch.mts";
7
+ import { put } from "./put.mts";
8
+ import type { QueryBound } from "./query.mts";
9
+ import { bulkRemove, bulkRemoveMap } from "./bulkRemove.mts";
10
+ import { bulkSave, bulkSaveTransaction } from "./bulkSave.mts";
11
+ import { getDBInfo } from "./getDBInfo.mts";
12
+ import { headDB } from "./headDB.mts";
13
+ import { remove } from "./remove.mts";
14
+ import { createLock, removeLock } from "./sugar/lock.mts";
15
+ import { watchDocs } from "./sugar/watch.mts";
15
16
  type BoundConfigMethod<T> = T extends (...args: infer Args) => infer Result ? Args extends [unknown, ...infer Rest] ? (...args: Rest) => Result : never : never;
16
17
  type BoundMethods = {
17
18
  bulkGet: BulkGetBound;
@@ -24,6 +25,7 @@ type BoundMethods = {
24
25
  bulkSave: BoundConfigMethod<typeof bulkSave>;
25
26
  bulkSaveTransaction: BoundConfigMethod<typeof bulkSaveTransaction>;
26
27
  getDBInfo: BoundConfigMethod<typeof getDBInfo>;
28
+ headDB: BoundConfigMethod<typeof headDB>;
27
29
  patch: BoundConfigMethod<typeof patch>;
28
30
  patchDangerously: BoundConfigMethod<typeof patchDangerously>;
29
31
  put: BoundConfigMethod<typeof put>;
@@ -1 +1 @@
1
- {"version":3,"file":"bindConfig.d.mts","sourceRoot":"","sources":["../../../impl/bindConfig.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEzE,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,sBAAsB,EAE5B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAiB,MAAM,WAAW,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE7C,KAAK,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,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IACjD,UAAU,EAAE,iBAAiB,CAAC,OAAO,UAAU,CAAC,CAAC;IACjD,SAAS,EAAE,iBAAiB,CAAC,OAAO,SAAS,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IACzC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC,GAAG,aAAa,CAAC;CACzE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,gBAAgB,KAAG,aAgBrD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EAE/C,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EAC3D,MAAM,EAAE,WAAW,UAYpB"}
@@ -0,0 +1,13 @@
1
+ import { type CouchConfigInput } from "../schema/config.mts";
2
+ /**
3
+ * Performs a health check against the target CouchDB database using `HEAD /{db}`.
4
+ *
5
+ * @see {@link https://docs.couchdb.org/en/stable/api/database/common.html#head--db | CouchDB API Documentation}
6
+ *
7
+ * @param configInput - The CouchDB configuration input.
8
+ * @returns A promise that resolves to `true` when the database responds successfully.
9
+ * @throws {RetryableError} `RetryableError` If a retryable error occurs during the request.
10
+ * @throws {OperationError} For other non-retryable response failures.
11
+ */
12
+ export declare const headDB: (configInput: CouchConfigInput) => Promise<true>;
13
+ //# sourceMappingURL=headDB.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headDB.d.mts","sourceRoot":"","sources":["../../../impl/headDB.mts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK1E;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,GAAU,aAAa,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAqCxE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=headDB.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headDB.test.d.mts","sourceRoot":"","sources":["../../../impl/headDB.test.mts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import type { StandardSchemaV1 } from '../../types/standard-schema.ts';
1
+ import type { StandardSchemaV1 } from "../../types/standard-schema.ts";
2
2
  /**
3
3
  * Represents a network-level error emitted by Node.js or HTTP client libraries.
4
4
  *
@@ -14,8 +14,8 @@ export interface NetworkError {
14
14
  */
15
15
  message?: string;
16
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';
17
+ export type ErrorCategory = "conflict" | "network" | "not_found" | "operation" | "retryable" | "validation" | "transaction";
18
+ export type ErrorOperation = "get" | "getAtRev" | "getDBInfo" | "headDB" | "patch" | "patchDangerously" | "put" | "query" | "queryStream" | "remove" | "request" | "watchDocs";
19
19
  export declare const hasStatusCode: (error: unknown) => error is {
20
20
  statusCode: number;
21
21
  };
@@ -50,7 +50,7 @@ export declare class HideABedError extends Error {
50
50
  readonly statusCode?: number;
51
51
  constructor(message: string, options: HideABedErrorOptions);
52
52
  }
53
- export type ValidationErrorOptions = Omit<Partial<HideABedErrorOptions>, 'category' | 'retryable'> & {
53
+ export type ValidationErrorOptions = Omit<Partial<HideABedErrorOptions>, "category" | "retryable"> & {
54
54
  issues: ReadonlyArray<StandardSchemaV1.Issue>;
55
55
  message?: string;
56
56
  };
@@ -64,7 +64,7 @@ export type ValidationErrorOptions = Omit<Partial<HideABedErrorOptions>, 'catego
64
64
  * @public
65
65
  */
66
66
  export declare class NotFoundError extends HideABedError {
67
- constructor(docId: string, options?: Omit<Partial<HideABedErrorOptions>, 'category' | 'docId' | 'retryable'> & {
67
+ constructor(docId: string, options?: Omit<Partial<HideABedErrorOptions>, "category" | "docId" | "retryable"> & {
68
68
  message?: string;
69
69
  });
70
70
  }
@@ -74,7 +74,7 @@ export declare class NotFoundError extends HideABedError {
74
74
  * @public
75
75
  */
76
76
  export declare class ConflictError extends HideABedError {
77
- constructor(docId: string, options?: Omit<Partial<HideABedErrorOptions>, 'category' | 'docId' | 'retryable'> & {
77
+ constructor(docId: string, options?: Omit<Partial<HideABedErrorOptions>, "category" | "docId" | "retryable"> & {
78
78
  message?: string;
79
79
  });
80
80
  }
@@ -84,8 +84,8 @@ export declare class ConflictError extends HideABedError {
84
84
  * @public
85
85
  */
86
86
  export declare class OperationError extends HideABedError {
87
- constructor(message: string, options?: Omit<Partial<HideABedErrorOptions>, 'category' | 'retryable'> & {
88
- category?: Extract<ErrorCategory, 'operation' | 'transaction'>;
87
+ constructor(message: string, options?: Omit<Partial<HideABedErrorOptions>, "category" | "retryable"> & {
88
+ category?: Extract<ErrorCategory, "operation" | "transaction">;
89
89
  });
90
90
  }
91
91
  /**
@@ -94,7 +94,7 @@ export declare class OperationError extends HideABedError {
94
94
  * @public
95
95
  */
96
96
  export declare class ValidationError extends HideABedError {
97
- readonly issues: ValidationErrorOptions['issues'];
97
+ readonly issues: ValidationErrorOptions["issues"];
98
98
  constructor(options: ValidationErrorOptions);
99
99
  }
100
100
  /**
@@ -107,8 +107,8 @@ export declare class ValidationError extends HideABedError {
107
107
  * @public
108
108
  */
109
109
  export declare class RetryableError extends HideABedError {
110
- constructor(message: string, statusCode?: number, options?: Omit<Partial<HideABedErrorOptions>, 'category' | 'retryable' | 'statusCode'> & {
111
- category?: Extract<ErrorCategory, 'network' | 'retryable'>;
110
+ constructor(message: string, statusCode?: number, options?: Omit<Partial<HideABedErrorOptions>, "category" | "retryable" | "statusCode"> & {
111
+ category?: Extract<ErrorCategory, "network" | "retryable">;
112
112
  });
113
113
  /**
114
114
  * Determines whether the provided status code should be treated as retryable.
@@ -136,7 +136,7 @@ type ResponseErrorOptions = {
136
136
  operation: ErrorOperation;
137
137
  statusCode?: number;
138
138
  };
139
- export declare function createResponseError({ body, defaultMessage, docId, notFoundMessage, operation, statusCode }: ResponseErrorOptions): HideABedError;
139
+ export declare function createResponseError({ body, defaultMessage, docId, notFoundMessage, operation, statusCode, }: ResponseErrorOptions): HideABedError;
140
140
  export declare function isConflictError(err: unknown): boolean;
141
141
  export {};
142
142
  //# sourceMappingURL=errors.d.mts.map