hide-a-bed 5.2.7 → 6.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.
- package/.prettierrc +7 -0
- package/README.md +270 -218
- package/dist/cjs/index.cjs +1952 -0
- package/dist/esm/index.mjs +1898 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +113 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/QueryBuilder.html +42 -0
- package/docs/functions/bindConfig.html +4 -0
- package/docs/functions/bulkGet.html +14 -0
- package/docs/functions/bulkGetDictionary.html +10 -0
- package/docs/functions/bulkRemove.html +12 -0
- package/docs/functions/bulkRemoveMap.html +11 -0
- package/docs/functions/bulkSave.html +10 -0
- package/docs/functions/bulkSaveTransaction.html +23 -0
- package/docs/functions/createLock.html +7 -0
- package/docs/functions/createQuery.html +1 -0
- package/docs/functions/get.html +1 -0
- package/docs/functions/getAtRev.html +1 -0
- package/docs/functions/getDBInfo.html +10 -0
- package/docs/functions/patch.html +8 -0
- package/docs/functions/patchDangerously.html +9 -0
- package/docs/functions/put.html +1 -0
- package/docs/functions/query.html +15 -0
- package/docs/functions/queryStream.html +6 -0
- package/docs/functions/remove.html +1 -0
- package/docs/functions/removeLock.html +6 -0
- package/docs/functions/watchDocs.html +9 -0
- package/docs/functions/withRetry.html +6 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +483 -0
- package/docs/interfaces/NetworkError.html +6 -0
- package/docs/interfaces/NotFoundError.html +10 -0
- package/docs/interfaces/RetryOptions.html +10 -0
- package/docs/interfaces/RetryableError.html +10 -0
- package/docs/interfaces/StandardSchemaV1.FailureResult.html +4 -0
- package/docs/interfaces/StandardSchemaV1.Issue.html +6 -0
- package/docs/interfaces/StandardSchemaV1.Options.html +3 -0
- package/docs/interfaces/StandardSchemaV1.PathSegment.html +4 -0
- package/docs/interfaces/StandardSchemaV1.Props.html +10 -0
- package/docs/interfaces/StandardSchemaV1.SuccessResult.html +6 -0
- package/docs/interfaces/StandardSchemaV1.Types.html +6 -0
- package/docs/interfaces/StandardSchemaV1.html +4 -0
- package/docs/modules/StandardSchemaV1.html +1 -0
- package/docs/modules.html +1 -0
- package/docs/types/BoundInstance.html +1 -0
- package/docs/types/BulkGetBound.html +2 -0
- package/docs/types/BulkGetDictionaryBound.html +1 -0
- package/docs/types/BulkGetDictionaryOptions.html +2 -0
- package/docs/types/BulkGetDictionaryResult.html +3 -0
- package/docs/types/BulkGetOptions.html +3 -0
- package/docs/types/BulkGetResponse.html +1 -0
- package/docs/types/CouchConfig-1.html +1 -0
- package/docs/types/CouchConfig.html +1 -0
- package/docs/types/CouchConfigInput.html +1 -0
- package/docs/types/CouchDoc-1.html +1 -0
- package/docs/types/CouchDoc.html +2 -0
- package/docs/types/CouchDocInput.html +2 -0
- package/docs/types/GetAtRevBound.html +1 -0
- package/docs/types/GetBound.html +1 -0
- package/docs/types/GetOptions.html +2 -0
- package/docs/types/LockDoc-1.html +1 -0
- package/docs/types/LockDoc.html +1 -0
- package/docs/types/LockOptions-1.html +1 -0
- package/docs/types/LockOptions.html +1 -0
- package/docs/types/LockOptionsInput.html +1 -0
- package/docs/types/OnInvalidDocAction.html +1 -0
- package/docs/types/OnRow.html +1 -0
- package/docs/types/QueryBound.html +1 -0
- package/docs/types/SimpleViewOptions-1.html +1 -0
- package/docs/types/SimpleViewOptions.html +1 -0
- package/docs/types/StandardSchemaV1.InferInput.html +2 -0
- package/docs/types/StandardSchemaV1.InferOutput.html +2 -0
- package/docs/types/StandardSchemaV1.Result.html +2 -0
- package/docs/types/ViewQueryResponse-1.html +1 -0
- package/docs/types/ViewQueryResponse.html +2 -0
- package/docs/types/ViewQueryResponseValidated.html +2 -0
- package/docs/types/ViewRow-1.html +1 -0
- package/docs/types/ViewRow.html +2 -0
- package/docs/types/ViewRowValidated.html +7 -0
- package/docs/types/ViewString.html +1 -0
- package/docs/types/WatchOptionsInput.html +1 -0
- package/docs/types/WatchOptionsSchema-1.html +1 -0
- package/docs/types/WatchOptionsSchema.html +1 -0
- package/eslint.config.js +15 -0
- package/impl/bindConfig.mts +140 -0
- package/impl/bulkGet.mts +256 -0
- package/impl/bulkGet.test.mts +159 -0
- package/impl/bulkRemove.mts +98 -0
- package/impl/bulkRemove.test.mts +102 -0
- package/impl/bulkSave.mts +286 -0
- package/impl/bulkSave.test.mts +319 -0
- package/impl/get.mts +137 -0
- package/impl/get.test.mts +114 -0
- package/impl/getDBInfo.mts +67 -0
- package/impl/getDBInfo.test.mts +62 -0
- package/impl/patch.mts +134 -0
- package/impl/patch.test.mts +142 -0
- package/impl/put.mts +56 -0
- package/impl/put.test.mts +114 -0
- package/impl/query.mts +224 -0
- package/impl/query.test.mts +280 -0
- package/impl/remove.mts +65 -0
- package/impl/remove.test.mts +82 -0
- package/impl/retry.mts +66 -0
- package/impl/retry.test.mts +77 -0
- package/impl/stream.mts +143 -0
- package/impl/stream.test.mts +205 -0
- package/impl/sugar/lock.mts +103 -0
- package/impl/sugar/lock.test.mts +113 -0
- package/impl/sugar/{watch.mjs → watch.mts} +56 -22
- package/impl/sugar/watch.test.mts +155 -0
- package/impl/utils/errors.mts +130 -0
- package/impl/utils/errors.test.mts +58 -0
- package/impl/utils/logger.mts +62 -0
- package/impl/utils/logger.test.mts +129 -0
- package/impl/utils/mergeNeedleOpts.mts +16 -0
- package/impl/utils/parseRows.mts +117 -0
- package/impl/utils/parseRows.test.mts +183 -0
- package/impl/utils/queryBuilder.mts +173 -0
- package/impl/utils/queryBuilder.test.mts +83 -0
- package/impl/utils/queryString.mts +44 -0
- package/impl/utils/queryString.test.mts +53 -0
- package/impl/{trackedEmitter.mjs → utils/trackedEmitter.mts} +9 -7
- package/impl/utils/transactionErrors.mts +71 -0
- package/index.mts +82 -0
- package/index.test.mts +415 -0
- package/package.json +45 -31
- package/schema/config.mts +81 -0
- package/schema/couch/couch.input.schema.ts +43 -0
- package/schema/couch/couch.output.schema.ts +169 -0
- package/schema/sugar/lock.mts +18 -0
- package/schema/sugar/watch.mts +14 -0
- package/schema/util.mts +8 -0
- package/tsconfig.json +10 -4
- package/tsdown.config.ts +16 -0
- package/typedoc.json +4 -0
- package/types/output/eslint.config.d.ts +3 -0
- package/types/output/eslint.config.d.ts.map +1 -0
- package/types/output/impl/bindConfig.d.mts +174 -0
- package/types/output/impl/bindConfig.d.mts.map +1 -0
- package/types/output/impl/bulkGet.d.mts +75 -0
- package/types/output/impl/bulkGet.d.mts.map +1 -0
- package/types/output/impl/bulkGet.test.d.mts +2 -0
- package/types/output/impl/bulkGet.test.d.mts.map +1 -0
- package/types/output/impl/bulkRemove.d.mts +63 -0
- package/types/output/impl/bulkRemove.d.mts.map +1 -0
- package/types/output/impl/bulkRemove.test.d.mts +2 -0
- package/types/output/impl/bulkRemove.test.d.mts.map +1 -0
- package/types/output/impl/bulkSave.d.mts +64 -0
- package/types/output/impl/bulkSave.d.mts.map +1 -0
- package/types/output/impl/bulkSave.test.d.mts +2 -0
- package/types/output/impl/bulkSave.test.d.mts.map +1 -0
- package/types/output/impl/get.d.mts +20 -0
- package/types/output/impl/get.d.mts.map +1 -0
- package/types/output/impl/get.test.d.mts +2 -0
- package/types/output/impl/get.test.d.mts.map +1 -0
- package/types/output/impl/getDBInfo.d.mts +52 -0
- package/types/output/impl/getDBInfo.d.mts.map +1 -0
- package/types/output/impl/getDBInfo.test.d.mts +2 -0
- package/types/output/impl/getDBInfo.test.d.mts.map +1 -0
- package/types/output/impl/patch.d.mts +45 -0
- package/types/output/impl/patch.d.mts.map +1 -0
- package/types/output/impl/patch.test.d.mts +2 -0
- package/types/output/impl/patch.test.d.mts.map +1 -0
- package/types/output/impl/put.d.mts +5 -0
- package/types/output/impl/put.d.mts.map +1 -0
- package/types/output/impl/put.test.d.mts +2 -0
- package/types/output/impl/put.test.d.mts.map +1 -0
- package/types/output/impl/query.d.mts +47 -0
- package/types/output/impl/query.d.mts.map +1 -0
- package/types/output/impl/query.test.d.mts +2 -0
- package/types/output/impl/query.test.d.mts.map +1 -0
- package/types/output/impl/remove.d.mts +9 -0
- package/types/output/impl/remove.d.mts.map +1 -0
- package/types/output/impl/remove.test.d.mts +2 -0
- package/types/output/impl/remove.test.d.mts.map +1 -0
- package/types/output/impl/retry.d.mts +32 -0
- package/types/output/impl/retry.d.mts.map +1 -0
- package/types/output/impl/retry.test.d.mts +2 -0
- package/types/output/impl/retry.test.d.mts.map +1 -0
- package/types/output/impl/stream.d.mts +13 -0
- package/types/output/impl/stream.d.mts.map +1 -0
- package/types/output/impl/stream.test.d.mts +2 -0
- package/types/output/impl/stream.test.d.mts.map +1 -0
- package/types/output/impl/sugar/lock.d.mts +24 -0
- package/types/output/impl/sugar/lock.d.mts.map +1 -0
- package/types/output/impl/sugar/lock.test.d.mts +2 -0
- package/types/output/impl/sugar/lock.test.d.mts.map +1 -0
- package/types/output/impl/sugar/watch.d.mts +21 -0
- package/types/output/impl/sugar/watch.d.mts.map +1 -0
- package/types/output/impl/sugar/watch.test.d.mts +2 -0
- package/types/output/impl/sugar/watch.test.d.mts.map +1 -0
- package/types/output/impl/utils/errors.d.mts +78 -0
- package/types/output/impl/utils/errors.d.mts.map +1 -0
- package/types/output/impl/utils/errors.test.d.mts +2 -0
- package/types/output/impl/utils/errors.test.d.mts.map +1 -0
- package/types/output/impl/utils/logger.d.mts +11 -0
- package/types/output/impl/utils/logger.d.mts.map +1 -0
- package/types/output/impl/utils/logger.test.d.mts +2 -0
- package/types/output/impl/utils/logger.test.d.mts.map +1 -0
- package/types/output/impl/utils/mergeNeedleOpts.d.mts +53 -0
- package/types/output/impl/utils/mergeNeedleOpts.d.mts.map +1 -0
- package/types/output/impl/utils/parseRows.d.mts +15 -0
- package/types/output/impl/utils/parseRows.d.mts.map +1 -0
- package/types/output/impl/utils/parseRows.test.d.mts +2 -0
- package/types/output/impl/utils/parseRows.test.d.mts.map +1 -0
- package/types/output/impl/utils/queryBuilder.d.mts +68 -0
- package/types/output/impl/utils/queryBuilder.d.mts.map +1 -0
- package/types/output/impl/utils/queryBuilder.test.d.mts +2 -0
- package/types/output/impl/utils/queryBuilder.test.d.mts.map +1 -0
- package/types/output/impl/utils/queryString.d.mts +9 -0
- package/types/output/impl/utils/queryString.d.mts.map +1 -0
- package/types/output/impl/utils/queryString.test.d.mts +2 -0
- package/types/output/impl/utils/queryString.test.d.mts.map +1 -0
- package/types/output/impl/utils/trackedEmitter.d.mts +7 -0
- package/types/output/impl/utils/trackedEmitter.d.mts.map +1 -0
- package/{impl → types/output/impl/utils}/transactionErrors.d.mts +16 -31
- package/types/output/impl/utils/transactionErrors.d.mts.map +1 -0
- package/types/output/index.d.mts +32 -0
- package/types/output/index.d.mts.map +1 -0
- package/types/output/index.test.d.mts +2 -0
- package/types/output/index.test.d.mts.map +1 -0
- package/types/output/schema/config.d.mts +90 -0
- package/types/output/schema/config.d.mts.map +1 -0
- package/types/output/schema/couch/couch.input.schema.d.ts +29 -0
- package/types/output/schema/couch/couch.input.schema.d.ts.map +1 -0
- package/types/output/schema/couch/couch.output.schema.d.ts +113 -0
- package/types/output/schema/couch/couch.output.schema.d.ts.map +1 -0
- package/types/output/schema/sugar/lock.d.mts +19 -0
- package/types/output/schema/sugar/lock.d.mts.map +1 -0
- package/types/output/schema/sugar/watch.d.mts +11 -0
- package/types/output/schema/sugar/watch.d.mts.map +1 -0
- package/types/output/schema/util.d.mts +85 -0
- package/types/output/schema/util.d.mts.map +1 -0
- package/types/output/tsdown.config.d.ts +3 -0
- package/types/output/tsdown.config.d.ts.map +1 -0
- package/types/output/types/standard-schema.d.ts +60 -0
- package/types/output/types/standard-schema.d.ts.map +1 -0
- package/types/standard-schema.ts +76 -0
- package/types/utils.d.ts +1 -0
- package/cjs/impl/bulk.cjs +0 -275
- package/cjs/impl/changes.cjs +0 -67
- package/cjs/impl/crud.cjs +0 -127
- package/cjs/impl/errors.cjs +0 -75
- package/cjs/impl/logger.cjs +0 -70
- package/cjs/impl/patch.cjs +0 -95
- package/cjs/impl/query.cjs +0 -116
- package/cjs/impl/queryBuilder.cjs +0 -163
- package/cjs/impl/retry.cjs +0 -55
- package/cjs/impl/stream.cjs +0 -121
- package/cjs/impl/sugar/lock.cjs +0 -81
- package/cjs/impl/sugar/watch.cjs +0 -159
- package/cjs/impl/trackedEmitter.cjs +0 -54
- package/cjs/impl/transactionErrors.cjs +0 -70
- package/cjs/impl/util.cjs +0 -64
- package/cjs/index.cjs +0 -132
- package/cjs/integration/changes.cjs +0 -76
- package/cjs/integration/disconnect-watch.cjs +0 -52
- package/cjs/integration/watch.cjs +0 -59
- package/cjs/schema/bind.cjs +0 -59
- package/cjs/schema/bulk.cjs +0 -92
- package/cjs/schema/changes.cjs +0 -68
- package/cjs/schema/config.cjs +0 -48
- package/cjs/schema/crud.cjs +0 -77
- package/cjs/schema/patch.cjs +0 -53
- package/cjs/schema/query.cjs +0 -62
- package/cjs/schema/stream.cjs +0 -42
- package/cjs/schema/sugar/lock.cjs +0 -59
- package/cjs/schema/sugar/watch.cjs +0 -42
- package/cjs/schema/util.cjs +0 -39
- package/config.json +0 -5
- package/docs/compiler.png +0 -0
- package/dualmode.config.json +0 -11
- package/impl/bulk.d.mts +0 -11
- package/impl/bulk.d.mts.map +0 -1
- package/impl/bulk.mjs +0 -291
- package/impl/changes.d.mts +0 -12
- package/impl/changes.d.mts.map +0 -1
- package/impl/changes.mjs +0 -53
- package/impl/crud.d.mts +0 -7
- package/impl/crud.d.mts.map +0 -1
- package/impl/crud.mjs +0 -108
- package/impl/errors.d.mts +0 -43
- package/impl/errors.d.mts.map +0 -1
- package/impl/errors.mjs +0 -65
- package/impl/logger.d.mts +0 -32
- package/impl/logger.d.mts.map +0 -1
- package/impl/logger.mjs +0 -59
- package/impl/patch.d.mts +0 -6
- package/impl/patch.d.mts.map +0 -1
- package/impl/patch.mjs +0 -88
- package/impl/query.d.mts +0 -195
- package/impl/query.d.mts.map +0 -1
- package/impl/query.mjs +0 -122
- package/impl/queryBuilder.d.mts +0 -154
- package/impl/queryBuilder.d.mts.map +0 -1
- package/impl/queryBuilder.mjs +0 -175
- package/impl/retry.d.mts +0 -2
- package/impl/retry.d.mts.map +0 -1
- package/impl/retry.mjs +0 -39
- package/impl/stream.d.mts +0 -3
- package/impl/stream.d.mts.map +0 -1
- package/impl/stream.mjs +0 -98
- package/impl/sugar/lock.d.mts +0 -5
- package/impl/sugar/lock.d.mts.map +0 -1
- package/impl/sugar/lock.mjs +0 -70
- package/impl/sugar/watch.d.mts +0 -34
- package/impl/sugar/watch.d.mts.map +0 -1
- package/impl/trackedEmitter.d.mts +0 -8
- package/impl/trackedEmitter.d.mts.map +0 -1
- package/impl/transactionErrors.d.mts.map +0 -1
- package/impl/transactionErrors.mjs +0 -47
- package/impl/util.d.mts +0 -3
- package/impl/util.d.mts.map +0 -1
- package/impl/util.mjs +0 -35
- package/index.d.mts +0 -80
- package/index.d.mts.map +0 -1
- package/index.mjs +0 -141
- package/integration/changes.mjs +0 -60
- package/integration/disconnect-watch.mjs +0 -36
- package/integration/watch.mjs +0 -40
- package/log.txt +0 -580
- package/schema/bind.d.mts +0 -5461
- package/schema/bind.d.mts.map +0 -1
- package/schema/bind.mjs +0 -43
- package/schema/bulk.d.mts +0 -923
- package/schema/bulk.d.mts.map +0 -1
- package/schema/bulk.mjs +0 -83
- package/schema/changes.d.mts +0 -191
- package/schema/changes.d.mts.map +0 -1
- package/schema/changes.mjs +0 -59
- package/schema/config.d.mts +0 -79
- package/schema/config.d.mts.map +0 -1
- package/schema/config.mjs +0 -26
- package/schema/crud.d.mts +0 -491
- package/schema/crud.d.mts.map +0 -1
- package/schema/crud.mjs +0 -64
- package/schema/patch.d.mts +0 -255
- package/schema/patch.d.mts.map +0 -1
- package/schema/patch.mjs +0 -42
- package/schema/query.d.mts +0 -406
- package/schema/query.d.mts.map +0 -1
- package/schema/query.mjs +0 -45
- package/schema/stream.d.mts +0 -211
- package/schema/stream.d.mts.map +0 -1
- package/schema/stream.mjs +0 -23
- package/schema/sugar/lock.d.mts +0 -238
- package/schema/sugar/lock.d.mts.map +0 -1
- package/schema/sugar/lock.mjs +0 -50
- package/schema/sugar/watch.d.mts +0 -127
- package/schema/sugar/watch.d.mts.map +0 -1
- package/schema/sugar/watch.mjs +0 -29
- package/schema/util.d.mts +0 -160
- package/schema/util.d.mts.map +0 -1
- package/schema/util.mjs +0 -35
- package/types/changes-stream.d.ts +0 -11
package/impl/sugar/watch.d.mts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const watchDocs: (args_0: import("zod").objectInputType<{
|
|
2
|
-
throwOnGetNotFound: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
|
|
3
|
-
couch: import("zod").ZodString;
|
|
4
|
-
bindWithRetry: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
|
|
5
|
-
maxRetries: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
|
|
6
|
-
initialDelay: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
|
|
7
|
-
backoffFactor: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
|
|
8
|
-
useConsoleLogger: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
|
|
9
|
-
logger: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
10
|
-
error: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<[import("zod").ZodAny], import("zod").ZodUnknown>, import("zod").ZodVoid>>;
|
|
11
|
-
warn: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<[import("zod").ZodAny], import("zod").ZodUnknown>, import("zod").ZodVoid>>;
|
|
12
|
-
info: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<[import("zod").ZodAny], import("zod").ZodUnknown>, import("zod").ZodVoid>>;
|
|
13
|
-
debug: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<[import("zod").ZodAny], import("zod").ZodUnknown>, import("zod").ZodVoid>>;
|
|
14
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
15
|
-
error?: ((args_0: any, ...args: unknown[]) => void) | undefined;
|
|
16
|
-
warn?: ((args_0: any, ...args: unknown[]) => void) | undefined;
|
|
17
|
-
info?: ((args_0: any, ...args: unknown[]) => void) | undefined;
|
|
18
|
-
debug?: ((args_0: any, ...args: unknown[]) => void) | undefined;
|
|
19
|
-
}, {
|
|
20
|
-
error?: ((args_0: any, ...args: unknown[]) => void) | undefined;
|
|
21
|
-
warn?: ((args_0: any, ...args: unknown[]) => void) | undefined;
|
|
22
|
-
info?: ((args_0: any, ...args: unknown[]) => void) | undefined;
|
|
23
|
-
debug?: ((args_0: any, ...args: unknown[]) => void) | undefined;
|
|
24
|
-
}>, import("zod").ZodFunction<import("zod").ZodTuple<[import("zod").ZodString, import("zod").ZodAny], import("zod").ZodUnknown>, import("zod").ZodVoid>]>>;
|
|
25
|
-
_normalizedLogger: import("zod").ZodOptional<import("zod").ZodAny>;
|
|
26
|
-
}, import("zod").ZodTypeAny, "passthrough">, args_1: string | string[], args_2: (args_0: any, ...args: unknown[]) => void, args_3: {
|
|
27
|
-
include_docs?: boolean | undefined;
|
|
28
|
-
}, ...args: unknown[]) => {
|
|
29
|
-
on: (event: string, listener: (args_0: any, ...args: unknown[]) => void) => EventEmitter<[never]>;
|
|
30
|
-
removeListener: (event: string, listener: (args_0: any, ...args: unknown[]) => void) => EventEmitter<[never]>;
|
|
31
|
-
stop: () => void;
|
|
32
|
-
};
|
|
33
|
-
import { EventEmitter } from 'events';
|
|
34
|
-
//# sourceMappingURL=watch.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.mts","sourceRoot":"","sources":["watch.mjs"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiJE;6BAxJ2B,QAAQ"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export class TrackedEmitter extends EventEmitter<[never]> {
|
|
2
|
-
constructor(options: any);
|
|
3
|
-
delay: any;
|
|
4
|
-
emit(event: any, ...args: any[]): Promise<any>;
|
|
5
|
-
}
|
|
6
|
-
export function setupEmitter(config: any): any;
|
|
7
|
-
import { EventEmitter } from 'events';
|
|
8
|
-
//# sourceMappingURL=trackedEmitter.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trackedEmitter.d.mts","sourceRoot":"","sources":["trackedEmitter.mjs"],"names":[],"mappings":"AAEA;IAEE,0BAGC;IADoB,WAA0B;IAG/C,+CAiBC;CACF;AAEM,+CAGN;6BAhC4B,QAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transactionErrors.d.mts","sourceRoot":"","sources":["transactionErrors.mjs"],"names":[],"mappings":"AAAA;IACE;;;OAGG;IACH,qBAHW,MAAM,YACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAM7B;IADC,6BAAsB;CAEzB;AAED;IACE;;OAEG;IACH,4BAFW,MAAM,EAAE,EAMlB;IADC,yBAAoC;CAEvC;AAED;IACE;;OAEG;IACH,wBAFW,KAAK,CAAC;QAAC,EAAE,CAAC,EAAE,OAAO,GAAC,IAAI,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAC,IAAI,CAAA;KAAC,CAAC,EAMpH;IADC;aALqB,OAAO,GAAC,IAAI;aAAO,MAAM,GAAC,IAAI;cAAQ,MAAM,GAAC,IAAI;gBAAU,MAAM,GAAC,IAAI;iBAAW,MAAM,GAAC,IAAI;QAKrF;CAE/B;AAED;IACE;;;;OAIG;IACH,qBAJW,MAAM,iBACN,KAAK,mBACL,KAAK,CAAC;QAAC,EAAE,CAAC,EAAE,OAAO,GAAC,IAAI,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAC,IAAI,CAAA;KAAC,CAAC,EAOpH;IAFC,qBAAkC;IAClC;aANqB,OAAO,GAAC,IAAI;aAAO,MAAM,GAAC,IAAI;cAAQ,MAAM,GAAC,IAAI;gBAAU,MAAM,GAAC,IAAI;iBAAW,MAAM,GAAC,IAAI;QAM3E;CAEzC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export class TransactionSetupError extends Error {
|
|
2
|
-
/**
|
|
3
|
-
* @param {string} message
|
|
4
|
-
* @param {Record<string, any>} details
|
|
5
|
-
*/
|
|
6
|
-
constructor (message, details = {}) {
|
|
7
|
-
super(message)
|
|
8
|
-
this.name = 'TransactionSetupError'
|
|
9
|
-
this.details = details
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class TransactionVersionConflictError extends Error {
|
|
14
|
-
/**
|
|
15
|
-
* @param {string[]} conflictingIds
|
|
16
|
-
*/
|
|
17
|
-
constructor (conflictingIds) {
|
|
18
|
-
super(`Revision mismatch for documents: ${conflictingIds.join(', ')}`)
|
|
19
|
-
this.name = 'TransactionVersionConflictError'
|
|
20
|
-
this.conflictingIds = conflictingIds
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export class TransactionBulkOperationError extends Error {
|
|
25
|
-
/**
|
|
26
|
-
* @param {Array<{ok?: boolean|null, id?: string|null, rev?: string|null, error?: string|null, reason?: string|null}>} failedDocs
|
|
27
|
-
*/
|
|
28
|
-
constructor (failedDocs) {
|
|
29
|
-
super(`Failed to save documents: ${failedDocs.map(d => d.id).join(', ')}`)
|
|
30
|
-
this.name = 'TransactionBulkOperationError'
|
|
31
|
-
this.failedDocs = failedDocs
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class TransactionRollbackError extends Error {
|
|
36
|
-
/**
|
|
37
|
-
* @param {string} message
|
|
38
|
-
* @param {Error} originalError
|
|
39
|
-
* @param {Array<{ok?: boolean|null, id?: string|null, rev?: string|null, error?: string|null, reason?: string|null}>} rollbackResults
|
|
40
|
-
*/
|
|
41
|
-
constructor (message, originalError, rollbackResults) {
|
|
42
|
-
super(message)
|
|
43
|
-
this.name = 'TransactionRollbackError'
|
|
44
|
-
this.originalError = originalError
|
|
45
|
-
this.rollbackResults = rollbackResults
|
|
46
|
-
}
|
|
47
|
-
}
|
package/impl/util.d.mts
DELETED
package/impl/util.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.mts","sourceRoot":"","sources":["util.mjs"],"names":[],"mappings":"AAMA,4DAA4D;AAC5D,wBADY,OAAO,oBAAoB,EAAE,eAAe,CA4BtD"}
|
package/impl/util.mjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import needle from 'needle'
|
|
3
|
-
import { RetryableError, NotFoundError } from './errors.mjs'
|
|
4
|
-
import { createLogger } from './logger.mjs'
|
|
5
|
-
import { GetDBInfo } from '../schema/util.mjs'
|
|
6
|
-
|
|
7
|
-
/** @type { import('../schema/util.mjs').GetDBInfoSchema} */
|
|
8
|
-
export const getDBInfo = GetDBInfo.implement(async (config) => {
|
|
9
|
-
const logger = createLogger(config)
|
|
10
|
-
const url = `${config.couch}`
|
|
11
|
-
const opts = {
|
|
12
|
-
json: true,
|
|
13
|
-
headers: {
|
|
14
|
-
'Content-Type': 'application/json'
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
let resp
|
|
18
|
-
try {
|
|
19
|
-
resp = await needle('get', url, opts)
|
|
20
|
-
} catch (err) {
|
|
21
|
-
logger.error('Error during put operation:', err)
|
|
22
|
-
RetryableError.handleNetworkError(err)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!resp) {
|
|
26
|
-
logger.error('No response received from put request')
|
|
27
|
-
throw new RetryableError('no response', 503)
|
|
28
|
-
}
|
|
29
|
-
const result = resp.body
|
|
30
|
-
if (RetryableError.isRetryableStatusCode(resp.statusCode)) {
|
|
31
|
-
logger.warn(`Retryable status code received: ${resp.statusCode}`)
|
|
32
|
-
throw new RetryableError(result.reason || 'retryable error', resp.statusCode)
|
|
33
|
-
}
|
|
34
|
-
return result
|
|
35
|
-
})
|
package/index.d.mts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
export type DB = z.infer<typeof BindReturns>;
|
|
2
|
-
import { get } from './impl/crud.mjs';
|
|
3
|
-
import { getAtRev } from './impl/crud.mjs';
|
|
4
|
-
import { put } from './impl/crud.mjs';
|
|
5
|
-
import { bulkGet } from './impl/bulk.mjs';
|
|
6
|
-
import { bulkSave } from './impl/bulk.mjs';
|
|
7
|
-
import { query } from './impl/query.mjs';
|
|
8
|
-
import { queryStream } from './impl/stream.mjs';
|
|
9
|
-
export namespace schema {
|
|
10
|
-
export { CouchConfig };
|
|
11
|
-
export { SimpleViewQuery };
|
|
12
|
-
export { SimpleViewQueryResponse };
|
|
13
|
-
export { SimpleViewQueryStream };
|
|
14
|
-
export { OnRow };
|
|
15
|
-
export { BulkSave };
|
|
16
|
-
export { BulkGet };
|
|
17
|
-
export { BulkRemove };
|
|
18
|
-
export { BulkGetDictionary };
|
|
19
|
-
export { BulkSaveTransaction };
|
|
20
|
-
export { CouchGet };
|
|
21
|
-
export { CouchPut };
|
|
22
|
-
export { CouchDoc };
|
|
23
|
-
export { CouchDocResponse };
|
|
24
|
-
export { Patch };
|
|
25
|
-
export { PatchDangerously };
|
|
26
|
-
export { CouchGetAtRev };
|
|
27
|
-
export { Bind };
|
|
28
|
-
export { Lock };
|
|
29
|
-
export { WatchDocs };
|
|
30
|
-
export { LockOptions };
|
|
31
|
-
export { CreateLock };
|
|
32
|
-
export { RemoveLock };
|
|
33
|
-
export { Changes };
|
|
34
|
-
export { ChangesOptions };
|
|
35
|
-
export { ChangesResponse };
|
|
36
|
-
export { GetDBInfo };
|
|
37
|
-
}
|
|
38
|
-
import { getDBInfo } from './impl/util.mjs';
|
|
39
|
-
import { patch } from './impl/patch.mjs';
|
|
40
|
-
import { patchDangerously } from './impl/patch.mjs';
|
|
41
|
-
import { bulkRemove } from './impl/bulk.mjs';
|
|
42
|
-
import { bulkGetDictionary } from './impl/bulk.mjs';
|
|
43
|
-
import { bulkSaveTransaction } from './impl/bulk.mjs';
|
|
44
|
-
/** @type { import('./schema/bind.mjs').BindSchema } */
|
|
45
|
-
export const bindConfig: import("./schema/bind.mjs").BindSchema;
|
|
46
|
-
import { withRetry } from './impl/retry.mjs';
|
|
47
|
-
import { createQuery } from './impl/queryBuilder.mjs';
|
|
48
|
-
import { createLock } from './impl/sugar/lock.mjs';
|
|
49
|
-
import { removeLock } from './impl/sugar/lock.mjs';
|
|
50
|
-
import { z } from 'zod';
|
|
51
|
-
import { BindReturns } from './schema/bind.mjs';
|
|
52
|
-
import { CouchConfig } from './schema/config.mjs';
|
|
53
|
-
import { SimpleViewQuery } from './schema/query.mjs';
|
|
54
|
-
import { SimpleViewQueryResponse } from './schema/query.mjs';
|
|
55
|
-
import { SimpleViewQueryStream } from './schema/stream.mjs';
|
|
56
|
-
import { OnRow } from './schema/stream.mjs';
|
|
57
|
-
import { BulkSave } from './schema/bulk.mjs';
|
|
58
|
-
import { BulkGet } from './schema/bulk.mjs';
|
|
59
|
-
import { BulkRemove } from './schema/bulk.mjs';
|
|
60
|
-
import { BulkGetDictionary } from './schema/bulk.mjs';
|
|
61
|
-
import { BulkSaveTransaction } from './schema/bulk.mjs';
|
|
62
|
-
import { CouchGet } from './schema/crud.mjs';
|
|
63
|
-
import { CouchPut } from './schema/crud.mjs';
|
|
64
|
-
import { CouchDoc } from './schema/crud.mjs';
|
|
65
|
-
import { CouchDocResponse } from './schema/crud.mjs';
|
|
66
|
-
import { Patch } from './schema/patch.mjs';
|
|
67
|
-
import { PatchDangerously } from './schema/patch.mjs';
|
|
68
|
-
import { CouchGetAtRev } from './schema/crud.mjs';
|
|
69
|
-
import { Bind } from './schema/bind.mjs';
|
|
70
|
-
import { Lock } from './schema/sugar/lock.mjs';
|
|
71
|
-
import { WatchDocs } from './schema/sugar/watch.mjs';
|
|
72
|
-
import { LockOptions } from './schema/sugar/lock.mjs';
|
|
73
|
-
import { CreateLock } from './schema/sugar/lock.mjs';
|
|
74
|
-
import { RemoveLock } from './schema/sugar/lock.mjs';
|
|
75
|
-
import { Changes } from './schema/changes.mjs';
|
|
76
|
-
import { ChangesOptions } from './schema/changes.mjs';
|
|
77
|
-
import { ChangesResponse } from './schema/changes.mjs';
|
|
78
|
-
import { GetDBInfo } from './schema/util.mjs';
|
|
79
|
-
export { get, getAtRev, put, bulkGet, bulkSave, query, queryStream, getDBInfo, patch, patchDangerously, bulkRemove, bulkGetDictionary, bulkSaveTransaction, withRetry, createQuery, createLock, removeLock };
|
|
80
|
-
//# sourceMappingURL=index.d.mts.map
|
package/index.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mjs"],"names":[],"mappings":"iBAmHe,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;oBAhHP,iBAAiB;yBAAjB,iBAAiB;oBAAjB,iBAAiB;wBADkC,iBAAiB;yBAAjB,iBAAiB;sBAMjF,kBAAkB;4BACZ,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAErB,iBAAiB;sBANH,kBAAkB;iCAAlB,kBAAkB;2BAH4B,iBAAiB;kCAAjB,iBAAiB;oCAAjB,iBAAiB;AAwFvG,uDAAuD;AACvD,yBADY,OAAO,mBAAmB,EAAE,UAAU,CAuBhD;0BArGwB,kBAAkB;4BAFhB,yBAAyB;2BAJd,uBAAuB;2BAAvB,uBAAuB;kBAL5C,KAAK;4BAqBW,mBAAmB;4BARzB,qBAAqB;gCACQ,oBAAoB;wCAApB,oBAAoB;sCAEhC,qBAAqB;sBAArB,qBAAqB;yBAJoB,mBAAmB;wBAAnB,mBAAmB;2BAAnB,mBAAmB;kCAAnB,mBAAmB;oCAAnB,mBAAmB;yBAQ3B,mBAAmB;yBAAnB,mBAAmB;yBAAnB,mBAAmB;iCAAnB,mBAAmB;sBAHzD,oBAAoB;iCAApB,oBAAoB;8BAGkB,mBAAmB;qBAC/D,mBAAmB;qBAHK,yBAAyB;0BACzD,0BAA0B;4BADM,yBAAyB;2BAAzB,yBAAyB;2BAAzB,yBAAyB;wBAH1B,sBAAsB;+BAAtB,sBAAsB;gCAAtB,sBAAsB;0BAOrD,mBAAmB"}
|
package/index.mjs
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
// @ts-check */
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
import { bulkGet, bulkSave, bulkRemove, bulkGetDictionary, bulkSaveTransaction } from './impl/bulk.mjs'
|
|
4
|
-
import { get, put, getAtRev } from './impl/crud.mjs'
|
|
5
|
-
import { changes } from './impl/changes.mjs'
|
|
6
|
-
import { patch, patchDangerously } from './impl/patch.mjs'
|
|
7
|
-
import { createLock, removeLock } from './impl/sugar/lock.mjs'
|
|
8
|
-
import { watchDocs } from './impl/sugar/watch.mjs'
|
|
9
|
-
import { query } from './impl/query.mjs'
|
|
10
|
-
import { queryStream } from './impl/stream.mjs'
|
|
11
|
-
import { createQuery } from './impl/queryBuilder.mjs'
|
|
12
|
-
import { getDBInfo } from './impl/util.mjs'
|
|
13
|
-
import { withRetry } from './impl/retry.mjs'
|
|
14
|
-
import { BulkSave, BulkGet, BulkRemove, BulkGetDictionary, BulkSaveTransaction } from './schema/bulk.mjs'
|
|
15
|
-
import { CouchConfig } from './schema/config.mjs'
|
|
16
|
-
import { SimpleViewQuery, SimpleViewQueryResponse } from './schema/query.mjs'
|
|
17
|
-
import { Changes, ChangesOptions, ChangesResponse } from './schema/changes.mjs'
|
|
18
|
-
import { SimpleViewQueryStream, OnRow } from './schema/stream.mjs'
|
|
19
|
-
import { Patch, PatchDangerously } from './schema/patch.mjs'
|
|
20
|
-
import { Lock, LockOptions, CreateLock, RemoveLock } from './schema/sugar/lock.mjs'
|
|
21
|
-
import { WatchDocs } from './schema/sugar/watch.mjs'
|
|
22
|
-
import { CouchDoc, CouchDocResponse, CouchPut, CouchGet, CouchGetAtRev } from './schema/crud.mjs'
|
|
23
|
-
import { Bind, BindReturns } from './schema/bind.mjs'
|
|
24
|
-
import { GetDBInfo } from './schema/util.mjs'
|
|
25
|
-
|
|
26
|
-
const schema = {
|
|
27
|
-
CouchConfig,
|
|
28
|
-
SimpleViewQuery,
|
|
29
|
-
SimpleViewQueryResponse,
|
|
30
|
-
SimpleViewQueryStream,
|
|
31
|
-
OnRow,
|
|
32
|
-
BulkSave,
|
|
33
|
-
BulkGet,
|
|
34
|
-
BulkRemove,
|
|
35
|
-
BulkGetDictionary,
|
|
36
|
-
BulkSaveTransaction,
|
|
37
|
-
CouchGet,
|
|
38
|
-
CouchPut,
|
|
39
|
-
CouchDoc,
|
|
40
|
-
CouchDocResponse,
|
|
41
|
-
Patch,
|
|
42
|
-
PatchDangerously,
|
|
43
|
-
CouchGetAtRev,
|
|
44
|
-
Bind,
|
|
45
|
-
Lock,
|
|
46
|
-
WatchDocs,
|
|
47
|
-
LockOptions,
|
|
48
|
-
CreateLock,
|
|
49
|
-
RemoveLock,
|
|
50
|
-
Changes,
|
|
51
|
-
ChangesOptions,
|
|
52
|
-
ChangesResponse,
|
|
53
|
-
GetDBInfo
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* @param {import('./schema/config.mjs').CouchConfigSchema } config
|
|
57
|
-
*/
|
|
58
|
-
function doBind (config) {
|
|
59
|
-
// Default retry options
|
|
60
|
-
const retryOptions = {
|
|
61
|
-
maxRetries: config.maxRetries ?? 10,
|
|
62
|
-
initialDelay: config.initialDelay ?? 1000,
|
|
63
|
-
backoffFactor: config.backoffFactor ?? 2
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Create the object without the config property first
|
|
67
|
-
const result = {
|
|
68
|
-
get: config.bindWithRetry ? withRetry(get.bind(null, config), retryOptions) : get.bind(null, config),
|
|
69
|
-
getAtRev: config.bindWithRetry ? withRetry(getAtRev.bind(null, config), retryOptions) : getAtRev.bind(null, config),
|
|
70
|
-
put: config.bindWithRetry ? withRetry(put.bind(null, config), retryOptions) : put.bind(null, config),
|
|
71
|
-
bulkGet: config.bindWithRetry ? withRetry(bulkGet.bind(null, config), retryOptions) : bulkGet.bind(null, config),
|
|
72
|
-
bulkSave: config.bindWithRetry ? withRetry(bulkSave.bind(null, config), retryOptions) : bulkSave.bind(null, config),
|
|
73
|
-
query: config.bindWithRetry ? withRetry(query.bind(null, config), retryOptions) : query.bind(null, config),
|
|
74
|
-
queryStream: config.bindWithRetry ? withRetry(queryStream.bind(null, config), retryOptions) : queryStream.bind(null, config),
|
|
75
|
-
// Sugar Methods
|
|
76
|
-
patch: config.bindWithRetry ? withRetry(patch.bind(null, config), retryOptions) : patch.bind(null, config),
|
|
77
|
-
patchDangerously: patchDangerously.bind(null, config), // patchDangerously not included in retry
|
|
78
|
-
bulkRemove: config.bindWithRetry ? withRetry(bulkRemove.bind(null, config), retryOptions) : bulkRemove.bind(null, config),
|
|
79
|
-
bulkGetDictionary: config.bindWithRetry ? withRetry(bulkGetDictionary.bind(null, config), retryOptions) : bulkGetDictionary.bind(null, config),
|
|
80
|
-
bulkSaveTransaction: bulkSaveTransaction.bind(null, config),
|
|
81
|
-
createLock: createLock.bind(null, config),
|
|
82
|
-
removeLock: removeLock.bind(null, config),
|
|
83
|
-
watchDocs: watchDocs.bind(null, config),
|
|
84
|
-
changes: changes.bind(null, config),
|
|
85
|
-
getDBInfo: config.bindWithRetry ? withRetry(getDBInfo.bind(null, config), retryOptions) : getDBInfo.bind(null, config)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return result
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** @type { import('./schema/bind.mjs').BindSchema } */
|
|
92
|
-
const bindConfig = Bind.implement((
|
|
93
|
-
/** @type { import('./schema/config.mjs').CouchConfigSchema } */
|
|
94
|
-
config
|
|
95
|
-
) => {
|
|
96
|
-
const parsedConfig = CouchConfig.parse(config)
|
|
97
|
-
|
|
98
|
-
/** @type { import('./schema/bind.mjs').BindBaseSchema } funcs */
|
|
99
|
-
const funcs = doBind(parsedConfig)
|
|
100
|
-
|
|
101
|
-
// Add the options function that returns a new bound instance
|
|
102
|
-
// this allows the user to override some options
|
|
103
|
-
const reconfig = (
|
|
104
|
-
/** @type any */
|
|
105
|
-
_overrides
|
|
106
|
-
) => {
|
|
107
|
-
// override the config and return doBind again
|
|
108
|
-
const newConfig = { ...config, ..._overrides }
|
|
109
|
-
return bindConfig(newConfig)
|
|
110
|
-
}
|
|
111
|
-
/** @type { import('./schema/bind.mjs').BindReturnsSchema } */
|
|
112
|
-
const all = { ...funcs, options: reconfig }
|
|
113
|
-
return all
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
/** @typedef { z.infer<typeof BindReturns> } DB */
|
|
117
|
-
|
|
118
|
-
export {
|
|
119
|
-
get,
|
|
120
|
-
getAtRev,
|
|
121
|
-
put,
|
|
122
|
-
bulkGet,
|
|
123
|
-
bulkSave,
|
|
124
|
-
query,
|
|
125
|
-
queryStream,
|
|
126
|
-
schema,
|
|
127
|
-
getDBInfo,
|
|
128
|
-
|
|
129
|
-
// sugar methods
|
|
130
|
-
patch,
|
|
131
|
-
patchDangerously,
|
|
132
|
-
bulkRemove,
|
|
133
|
-
bulkGetDictionary,
|
|
134
|
-
bulkSaveTransaction,
|
|
135
|
-
|
|
136
|
-
bindConfig,
|
|
137
|
-
withRetry,
|
|
138
|
-
createQuery,
|
|
139
|
-
createLock,
|
|
140
|
-
removeLock
|
|
141
|
-
}
|
package/integration/changes.mjs
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { TrackedEmitter } from '../impl/trackedEmitter.mjs'
|
|
2
|
-
import test from 'tap'
|
|
3
|
-
import { spawn } from 'child_process'
|
|
4
|
-
import { bindConfig } from '../index.mjs'
|
|
5
|
-
import needle from 'needle'
|
|
6
|
-
|
|
7
|
-
let DB_URL = `https://admin:iEZCEQhVR9PVCmYuZ5Bv@redman-couchdb.staging.brivity.io/testdb`
|
|
8
|
-
|
|
9
|
-
const config = {
|
|
10
|
-
couch: DB_URL,
|
|
11
|
-
bindWithRetry: true,
|
|
12
|
-
logger: (level, ...args) => {
|
|
13
|
-
console.log(`[${level.toUpperCase()}]`, ...args)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
test.test('changes tests', async t => {
|
|
17
|
-
await needle('put', DB_URL)
|
|
18
|
-
t.teardown(async () => {
|
|
19
|
-
await needle('delete', DB_URL)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const db = bindConfig(config)
|
|
23
|
-
|
|
24
|
-
t.test('basic changes feed', t => new Promise(async (resolve) => {
|
|
25
|
-
const onChange = (change) => {
|
|
26
|
-
t.equal(change.id, 'test-changes-doc', 'change notification received')
|
|
27
|
-
changesEmitter.stop()
|
|
28
|
-
t.end()
|
|
29
|
-
resolve()
|
|
30
|
-
}
|
|
31
|
-
const changesEmitter = await db.changes(onChange, { since: 'now', feed: 'continuous' })
|
|
32
|
-
t.ok(changesEmitter.on, 'changes emitter has on method')
|
|
33
|
-
t.ok(changesEmitter.removeListener, 'changes emitter has removeListener method')
|
|
34
|
-
t.ok(changesEmitter.stop, 'changes emitter has stop method')
|
|
35
|
-
await new Promise((resolve) => setTimeout(resolve, 1000)) // Give it time to start
|
|
36
|
-
// Create a document to trigger a change
|
|
37
|
-
await db.put({ _id: 'test-changes-doc', data: 'test' })
|
|
38
|
-
}))
|
|
39
|
-
|
|
40
|
-
t.test('document id', t => new Promise(async (resolve) => {
|
|
41
|
-
const opts = {
|
|
42
|
-
since: 'now',
|
|
43
|
-
include_docs: true,
|
|
44
|
-
feed: 'continuous'
|
|
45
|
-
}
|
|
46
|
-
const onChange = (change) => {
|
|
47
|
-
console.log('got a change', change)
|
|
48
|
-
if (change.id === 'test-a') {
|
|
49
|
-
setTimeout(() => {
|
|
50
|
-
resolve()
|
|
51
|
-
}, 1000)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const changesEmitter = await db.changes(onChange, opts)
|
|
55
|
-
await new Promise((resolve) => setTimeout(resolve, 4000)) // Give it time to start
|
|
56
|
-
// Create a document to trigger a change
|
|
57
|
-
await db.put({ _id: 'test-changes-doc-2', data: 'test' })
|
|
58
|
-
await db.put({ _id: 'test-a', data: 'test' })
|
|
59
|
-
}))
|
|
60
|
-
})
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { watchDocs } from "../impl/sugar/watch.mjs";
|
|
2
|
-
import { bindConfig } from '../index.mjs'
|
|
3
|
-
import needle from 'needle'
|
|
4
|
-
|
|
5
|
-
let DB_URL = `https://admin:iEZCEQhVR9PVCmYuZ5Bv@redman-couchdb.staging.brivity.io/testdb`
|
|
6
|
-
|
|
7
|
-
const config = {
|
|
8
|
-
couch: DB_URL,
|
|
9
|
-
bindWithRetry: true,
|
|
10
|
-
logger: (level, ...args) => {
|
|
11
|
-
console.log(`[${level.toUpperCase()}]`, ...args)
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const run = async () => {
|
|
16
|
-
await needle('put', DB_URL)
|
|
17
|
-
const db = bindConfig(config)
|
|
18
|
-
const onChange = (change) => {
|
|
19
|
-
console.log(change)
|
|
20
|
-
}
|
|
21
|
-
const feed = watchDocs(config, 'doc-a-1', onChange, {include_docs: true})
|
|
22
|
-
feed.on('end', ({lastSeq}) => {
|
|
23
|
-
console.log('ending')
|
|
24
|
-
console.log('lastSeq', lastSeq)
|
|
25
|
-
})
|
|
26
|
-
// wait a while, and then end the watcher
|
|
27
|
-
setTimeout(() => {
|
|
28
|
-
console.log('stopping...')
|
|
29
|
-
feed.stop()
|
|
30
|
-
console.log('stopped')
|
|
31
|
-
}, 190000)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
run()
|
package/integration/watch.mjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { watchDocs } from "../impl/sugar/watch.mjs";
|
|
2
|
-
import test from 'tap'
|
|
3
|
-
import { bindConfig } from '../index.mjs'
|
|
4
|
-
import needle from 'needle'
|
|
5
|
-
|
|
6
|
-
let DB_URL = `https://admin:iEZCEQhVR9PVCmYuZ5Bv@redman-couchdb.staging.brivity.io/testdb`
|
|
7
|
-
|
|
8
|
-
const config = {
|
|
9
|
-
couch: DB_URL,
|
|
10
|
-
bindWithRetry: true,
|
|
11
|
-
logger: (level, ...args) => {
|
|
12
|
-
console.log(`[${level.toUpperCase()}]`, ...args)
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
test.test('changes tests', async t => {
|
|
16
|
-
await needle('put', DB_URL)
|
|
17
|
-
t.teardown(async () => {
|
|
18
|
-
await needle('delete', DB_URL)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
const db = bindConfig(config)
|
|
22
|
-
|
|
23
|
-
t.test('watch a doc', t => new Promise(async (resolve) => {
|
|
24
|
-
let feed = null
|
|
25
|
-
const onChange = (change) => {
|
|
26
|
-
t.equal(change.id, 'doc-a-1')
|
|
27
|
-
t.equal(change.doc._id, 'doc-a-1')
|
|
28
|
-
t.equal(change.doc.data, 'test')
|
|
29
|
-
feed.stop()
|
|
30
|
-
resolve()
|
|
31
|
-
}
|
|
32
|
-
feed = db.watchDocs('doc-a-1', onChange, {include_docs: true})
|
|
33
|
-
feed.on('end', ({lastSeq}) => {
|
|
34
|
-
console.log('ending')
|
|
35
|
-
console.log('lastSeq', lastSeq)
|
|
36
|
-
})
|
|
37
|
-
await db.put({ _id: 'doc-a-fake-out', data: 'test' }) // we should not see this, because we did not watch it
|
|
38
|
-
await db.put({ _id: 'doc-a-1', data: 'test' })
|
|
39
|
-
}))
|
|
40
|
-
})
|