@decaf-ts/for-couchdb 0.1.27 → 0.1.29
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/LICENSE.md +0 -0
- package/README.md +38 -242
- package/{lib → dist/types}/adapter.d.ts +0 -0
- package/{lib → dist/types}/constants.d.ts +0 -0
- package/{lib → dist/types}/errors.d.ts +0 -0
- package/{lib/esm → dist/types}/index.d.ts +1 -1
- package/{lib/esm → dist/types}/indexes/generator.d.ts +0 -0
- package/{lib/esm → dist/types}/indexes/index.d.ts +0 -0
- package/{lib/esm → dist/types}/interfaces/CouchDBRepository.d.ts +0 -0
- package/{lib/esm → dist/types}/interfaces/index.d.ts +0 -0
- package/{lib/esm → dist/types}/model/CouchDBSequence.d.ts +2 -2
- package/{lib/esm → dist/types}/model/index.d.ts +0 -0
- package/{lib/esm → dist/types}/query/FromClause.d.ts +0 -0
- package/{lib/esm → dist/types}/query/InsertClause.d.ts +0 -0
- package/{lib/esm → dist/types}/query/Paginator.d.ts +0 -0
- package/{lib/esm → dist/types}/query/SelectClause.d.ts +0 -0
- package/{lib/esm → dist/types}/query/Statement.d.ts +0 -0
- package/{lib/esm → dist/types}/query/ValuesClause.d.ts +0 -0
- package/{lib/esm → dist/types}/query/WhereClause.d.ts +0 -0
- package/{lib/esm → dist/types}/query/constants.d.ts +0 -0
- package/{lib/esm → dist/types}/query/factory.d.ts +0 -0
- package/{lib/esm → dist/types}/query/index.d.ts +0 -0
- package/{lib/esm → dist/types}/query/translate.d.ts +0 -0
- package/{lib/esm → dist/types}/sequences/Sequence.d.ts +0 -0
- package/{lib/esm → dist/types}/sequences/index.d.ts +0 -0
- package/{lib/esm → dist/types}/sequences/utils.d.ts +0 -0
- package/{lib/esm → dist/types}/types.d.ts +0 -0
- package/{lib/esm → dist/types}/utils.d.ts +0 -0
- package/docker/.dockerignore +0 -0
- package/docker/.env +0 -0
- package/docker/Dockerfile-booter +0 -0
- package/docker/Dockerfile-couchdb +0 -0
- package/docker/couchdb.ini +0 -0
- package/docker/docker-compose.yml +0 -2
- package/lib/adapter.cjs +2 -0
- package/lib/constants.cjs +2 -0
- package/lib/errors.cjs +2 -0
- package/lib/esm/adapter.js +0 -0
- package/lib/esm/constants.js +0 -0
- package/lib/esm/errors.js +0 -0
- package/lib/esm/index.js +2 -2
- package/lib/esm/indexes/generator.js +0 -0
- package/lib/esm/indexes/index.js +0 -0
- package/lib/esm/interfaces/CouchDBRepository.js +0 -0
- package/lib/esm/interfaces/index.js +0 -0
- package/lib/esm/model/CouchDBSequence.js +1 -16
- package/lib/esm/model/index.js +0 -0
- package/lib/esm/query/FromClause.js +0 -0
- package/lib/esm/query/InsertClause.js +0 -0
- package/lib/esm/query/Paginator.js +0 -0
- package/lib/esm/query/SelectClause.js +0 -0
- package/lib/esm/query/Statement.js +0 -0
- package/lib/esm/query/ValuesClause.js +0 -0
- package/lib/esm/query/WhereClause.js +0 -0
- package/lib/esm/query/constants.js +0 -0
- package/lib/esm/query/factory.js +0 -0
- package/lib/esm/query/index.js +0 -0
- package/lib/esm/query/translate.js +0 -0
- package/lib/esm/sequences/Sequence.js +0 -0
- package/lib/esm/sequences/index.js +0 -0
- package/lib/esm/sequences/utils.js +0 -0
- package/lib/esm/types.js +0 -0
- package/lib/esm/utils.js +0 -0
- package/lib/index.cjs +3 -1
- package/lib/indexes/generator.cjs +2 -0
- package/lib/indexes/index.cjs +2 -0
- package/lib/interfaces/CouchDBRepository.cjs +2 -0
- package/lib/interfaces/index.cjs +2 -0
- package/lib/model/CouchDBSequence.cjs +2 -15
- package/lib/model/index.cjs +2 -0
- package/lib/query/FromClause.cjs +2 -0
- package/lib/query/InsertClause.cjs +2 -0
- package/lib/query/Paginator.cjs +2 -0
- package/lib/query/SelectClause.cjs +2 -0
- package/lib/query/Statement.cjs +2 -0
- package/lib/query/ValuesClause.cjs +2 -0
- package/lib/query/WhereClause.cjs +2 -0
- package/lib/query/constants.cjs +2 -0
- package/lib/query/factory.cjs +2 -0
- package/lib/query/index.cjs +2 -0
- package/lib/query/translate.cjs +2 -0
- package/lib/sequences/Sequence.cjs +2 -0
- package/lib/sequences/index.cjs +2 -0
- package/lib/sequences/utils.cjs +2 -0
- package/lib/types.cjs +2 -0
- package/lib/utils.cjs +2 -0
- package/package.json +26 -17
- package/dist/esm/for-couchdb.bundle.min.esm.js +0 -2
- package/dist/esm/for-couchdb.bundle.min.esm.js.LICENSE.txt +0 -14
- package/dist/for-couchdb.bundle.min.js +0 -2
- package/dist/for-couchdb.bundle.min.js.LICENSE.txt +0 -14
- package/lib/esm/adapter.d.ts +0 -37
- package/lib/esm/constants.d.ts +0 -12
- package/lib/esm/errors.d.ts +0 -4
- package/lib/index.d.ts +0 -27
- package/lib/indexes/generator.d.ts +0 -3
- package/lib/indexes/index.d.ts +0 -1
- package/lib/interfaces/CouchDBRepository.d.ts +0 -5
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/model/CouchDBSequence.d.ts +0 -20
- package/lib/model/index.d.ts +0 -1
- package/lib/query/FromClause.d.ts +0 -7
- package/lib/query/InsertClause.d.ts +0 -7
- package/lib/query/Paginator.d.ts +0 -10
- package/lib/query/SelectClause.d.ts +0 -7
- package/lib/query/Statement.d.ts +0 -13
- package/lib/query/ValuesClause.d.ts +0 -7
- package/lib/query/WhereClause.d.ts +0 -7
- package/lib/query/constants.d.ts +0 -4
- package/lib/query/factory.d.ts +0 -24
- package/lib/query/index.d.ts +0 -1
- package/lib/query/translate.d.ts +0 -3
- package/lib/sequences/Sequence.d.ts +0 -49
- package/lib/sequences/index.d.ts +0 -1
- package/lib/types.d.ts +0 -112
- package/lib/utils.d.ts +0 -7
package/lib/query/Statement.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Adapter, Statement } from "@decaf-ts/core";
|
|
2
|
-
import { Paginator } from "@decaf-ts/core";
|
|
3
|
-
import { MangoQuery } from "../types";
|
|
4
|
-
export declare class CouchDBStatement<Y> extends Statement<MangoQuery> {
|
|
5
|
-
constructor(adapter: Adapter<Y, MangoQuery>);
|
|
6
|
-
/**
|
|
7
|
-
* @inheritDoc
|
|
8
|
-
*/
|
|
9
|
-
execute<Y>(): Promise<Y>;
|
|
10
|
-
paginate<R>(size: number): Promise<Paginator<R, MangoQuery>>;
|
|
11
|
-
private processRecord;
|
|
12
|
-
raw<R>(rawInput: MangoQuery, ...args: any[]): Promise<R>;
|
|
13
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ValuesClause } from "@decaf-ts/core";
|
|
2
|
-
import { ModelArg, Model } from "@decaf-ts/decorator-validation";
|
|
3
|
-
import { MangoQuery } from "../types";
|
|
4
|
-
export declare class CouchDBValuesClause<M extends Model> extends ValuesClause<MangoQuery, M> {
|
|
5
|
-
constructor(clause: ModelArg<ValuesClause<MangoQuery, M>>);
|
|
6
|
-
build(previous: MangoQuery): MangoQuery;
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { WhereClause } from "@decaf-ts/core";
|
|
2
|
-
import { ModelArg } from "@decaf-ts/decorator-validation";
|
|
3
|
-
import { MangoQuery } from "../types";
|
|
4
|
-
export declare class CouchDBWhereClause extends WhereClause<MangoQuery> {
|
|
5
|
-
constructor(clause: ModelArg<WhereClause<MangoQuery>>);
|
|
6
|
-
build(query: MangoQuery): MangoQuery;
|
|
7
|
-
}
|
package/lib/query/constants.d.ts
DELETED
package/lib/query/factory.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ClauseFactory, Condition, FromClause, FromSelector, GroupBySelector, LimitSelector, OffsetSelector, OrderBySelector, SelectSelector, Statement } from "@decaf-ts/core";
|
|
2
|
-
import { LimitClause } from "@decaf-ts/core";
|
|
3
|
-
import { SelectClause } from "@decaf-ts/core";
|
|
4
|
-
import { WhereClause } from "@decaf-ts/core";
|
|
5
|
-
import { OffsetClause } from "@decaf-ts/core";
|
|
6
|
-
import { OrderByClause } from "@decaf-ts/core";
|
|
7
|
-
import { GroupByClause } from "@decaf-ts/core";
|
|
8
|
-
import { ValuesClause } from "@decaf-ts/core";
|
|
9
|
-
import { InsertClause } from "@decaf-ts/core";
|
|
10
|
-
import { Model } from "@decaf-ts/decorator-validation";
|
|
11
|
-
import { CouchDBAdapter } from "../adapter";
|
|
12
|
-
import { MangoQuery } from "../types";
|
|
13
|
-
export declare class Factory<S> extends ClauseFactory<S, MangoQuery> {
|
|
14
|
-
constructor(adapter: CouchDBAdapter<S>);
|
|
15
|
-
from<M extends Model>(statement: Statement<MangoQuery>, selector: FromSelector<M>): FromClause<MangoQuery, M>;
|
|
16
|
-
groupBy(statement: Statement<MangoQuery>, selector: GroupBySelector): GroupByClause<MangoQuery>;
|
|
17
|
-
insert<M extends Model>(): InsertClause<MangoQuery, M>;
|
|
18
|
-
limit(statement: Statement<MangoQuery>, selector: LimitSelector): LimitClause<MangoQuery>;
|
|
19
|
-
offset(statement: Statement<MangoQuery>, selector: OffsetSelector): OffsetClause<MangoQuery>;
|
|
20
|
-
orderBy(statement: Statement<MangoQuery>, selector: OrderBySelector[]): OrderByClause<MangoQuery>;
|
|
21
|
-
select<M extends Model>(selector: SelectSelector | undefined): SelectClause<MangoQuery, M>;
|
|
22
|
-
values<M extends Model>(statement: Statement<MangoQuery>, values: M[]): ValuesClause<MangoQuery, M>;
|
|
23
|
-
where(statement: Statement<MangoQuery>, condition: Condition): WhereClause<MangoQuery>;
|
|
24
|
-
}
|
package/lib/query/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./factory";
|
package/lib/query/translate.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Sequence as Seq } from "../model/CouchDBSequence";
|
|
2
|
-
import { Adapter, SequenceOptions } from "@decaf-ts/core";
|
|
3
|
-
import { Sequence } from "@decaf-ts/core";
|
|
4
|
-
import { MangoQuery } from "../types";
|
|
5
|
-
import { CouchDBRepository } from "../interfaces";
|
|
6
|
-
/**
|
|
7
|
-
* @summary Abstract implementation of a Sequence
|
|
8
|
-
* @description provides the basic functionality for {@link Sequence}s
|
|
9
|
-
*
|
|
10
|
-
* @param {SequenceOptions} options
|
|
11
|
-
*
|
|
12
|
-
* @class CouchDBSequence
|
|
13
|
-
* @implements Sequence
|
|
14
|
-
*
|
|
15
|
-
* @category Sequences
|
|
16
|
-
*/
|
|
17
|
-
export declare class CouchDBSequence extends Sequence {
|
|
18
|
-
protected repo: CouchDBRepository<Seq, any>;
|
|
19
|
-
constructor(options: SequenceOptions, adapter: Adapter<any, MangoQuery>);
|
|
20
|
-
/**
|
|
21
|
-
* @summary Retrieves the current value for the sequence
|
|
22
|
-
* @protected
|
|
23
|
-
*/
|
|
24
|
-
current(): Promise<string | number | bigint>;
|
|
25
|
-
/**
|
|
26
|
-
* @summary Parses the {@link Sequence} value
|
|
27
|
-
*
|
|
28
|
-
* @protected
|
|
29
|
-
* @param value
|
|
30
|
-
*/
|
|
31
|
-
private parse;
|
|
32
|
-
/**
|
|
33
|
-
* @summary increments the sequence
|
|
34
|
-
* @description Sequence specific implementation
|
|
35
|
-
*
|
|
36
|
-
* @param {string | number | bigint} current
|
|
37
|
-
* @param count
|
|
38
|
-
* @protected
|
|
39
|
-
*/
|
|
40
|
-
private increment;
|
|
41
|
-
/**
|
|
42
|
-
* @summary Generates the next value in th sequence
|
|
43
|
-
* @description calls {@link Sequence#parse} on the current value
|
|
44
|
-
* followed by {@link Sequence#increment}
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
next(): Promise<number | string | bigint>;
|
|
48
|
-
range(count: number): Promise<(number | string | bigint)[]>;
|
|
49
|
-
}
|
package/lib/sequences/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Sequence";
|
package/lib/types.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/** Mango response.
|
|
2
|
-
* @see Docs: {@link https://docs.couchdb.org/en/latest/api/database/find.html#db-find} */
|
|
3
|
-
export interface MangoResponse<D> {
|
|
4
|
-
/** Array of documents matching the search.
|
|
5
|
-
*
|
|
6
|
-
* In each matching document, the fields specified in the fields part of the request body are listed, along with
|
|
7
|
-
* their values. */
|
|
8
|
-
docs: (D & {
|
|
9
|
-
_id: string;
|
|
10
|
-
_rev: string;
|
|
11
|
-
})[];
|
|
12
|
-
/** A string that enables you to specify which page of results you require.
|
|
13
|
-
*
|
|
14
|
-
* Used for paging through result sets. */
|
|
15
|
-
bookmark?: string;
|
|
16
|
-
/** Execution warnings */
|
|
17
|
-
warning?: string;
|
|
18
|
-
/** Basic execution statistics for a specific request. */
|
|
19
|
-
execution_stats?: MangoExecutionStats;
|
|
20
|
-
}
|
|
21
|
-
/** Mango execution stats.
|
|
22
|
-
* @see Docs: {@link http://docs.couchdb.org/en/latest/api/database/find.html#execution-statistics} */
|
|
23
|
-
export interface MangoExecutionStats {
|
|
24
|
-
/** Number of index keys examined. Currently always 0. */
|
|
25
|
-
total_keys_examined: number;
|
|
26
|
-
/** Number of documents fetched from the database / index.
|
|
27
|
-
*
|
|
28
|
-
* Equivalent to using include_docs = true in a view. */
|
|
29
|
-
total_docs_examined: number;
|
|
30
|
-
/** Number of documents fetched from the database using an out-of-band document fetch.
|
|
31
|
-
*
|
|
32
|
-
* This is only non-zero when read quorum > 1 is specified in the query parameters. */
|
|
33
|
-
total_quorum_docs_examined: number;
|
|
34
|
-
/** Number of results returned from the query. */
|
|
35
|
-
results_returned: number;
|
|
36
|
-
/** Total execution time in milliseconds as measured by the database. */
|
|
37
|
-
execution_time_ms: number;
|
|
38
|
-
}
|
|
39
|
-
/** Mango create index parameters.
|
|
40
|
-
* @see Docs: {@link http://docs.couchdb.org/en/latest/api/database/find.html#db-index} */
|
|
41
|
-
export interface CreateIndexRequest {
|
|
42
|
-
/** JSON object describing the index to create */
|
|
43
|
-
index: {
|
|
44
|
-
/** Array of field names following the sort syntax. */
|
|
45
|
-
fields: SortOrder[];
|
|
46
|
-
/** A selector to apply to documents at indexing time, creating a partial index. */
|
|
47
|
-
partial_filter_selector?: MangoSelector;
|
|
48
|
-
};
|
|
49
|
-
/** Name of the design document in which the index will be created. */
|
|
50
|
-
ddoc?: string;
|
|
51
|
-
/** Name of the index. If no name is provided, a name will be generated automatically. */
|
|
52
|
-
name?: string;
|
|
53
|
-
/** Can be "json" or "text".
|
|
54
|
-
*
|
|
55
|
-
* @default "json" */
|
|
56
|
-
type?: "json" | "text";
|
|
57
|
-
/** This field sets whether the created index will be a partitioned or global index. */
|
|
58
|
-
partitioned?: boolean;
|
|
59
|
-
}
|
|
60
|
-
export type MangoValue = number | string | Date | boolean | object | null;
|
|
61
|
-
export type MangoOperator = "$lt" | "$lte" | "$eq" | "$ne" | "$gte" | "$gt" | "$exists" | "$type" | "$in" | "$nin" | "$size" | "$mod" | "$regex" | "$or" | "$and" | "$nor" | "$not" | "$all" | "$allMatch" | "$elemMatch";
|
|
62
|
-
/** Mango selector syntax.
|
|
63
|
-
* @see Docs: {@link http://docs.couchdb.org/en/latest/api/database/find.html#selector-syntax} */
|
|
64
|
-
export type MangoSelector = {
|
|
65
|
-
[K in MangoOperator | string]: MangoSelector | MangoSelector[] | MangoValue | MangoValue[];
|
|
66
|
-
};
|
|
67
|
-
/** Mango sort syntax
|
|
68
|
-
* @see Docs: {@link http://docs.couchdb.org/en/latest/api/database/find.html#sort-syntax} */
|
|
69
|
-
export type SortOrder = string | string[] | {
|
|
70
|
-
[key: string]: "asc" | "desc";
|
|
71
|
-
};
|
|
72
|
-
/** Mango query syntax.
|
|
73
|
-
* @see Docs: {@link https://docs.couchdb.org/en/latest/api/database/find.html#db-find} */
|
|
74
|
-
export interface MangoQuery {
|
|
75
|
-
/** JSON object describing criteria used to select documents. */
|
|
76
|
-
selector: MangoSelector;
|
|
77
|
-
/** Maximum number of results returned. @default 25 */
|
|
78
|
-
limit?: number;
|
|
79
|
-
/** Skip the first 'n' results, where 'n' is the value specified. */
|
|
80
|
-
skip?: number;
|
|
81
|
-
/** JSON array following sort syntax. */
|
|
82
|
-
sort?: SortOrder[];
|
|
83
|
-
/** JSON array specifying which fields of each object should be returned.
|
|
84
|
-
*
|
|
85
|
-
* If it is omitted, the entire object is returned.
|
|
86
|
-
*
|
|
87
|
-
* @see Docs: {@link http://docs.couchdb.org/en/latest/api/database/find.html#filtering-fields} */
|
|
88
|
-
fields?: string[];
|
|
89
|
-
use_index?: string | [string, string];
|
|
90
|
-
/** Read quorum needed for the result.
|
|
91
|
-
*
|
|
92
|
-
* @default 1 */
|
|
93
|
-
r?: number;
|
|
94
|
-
/** A string that enables you to specify which page of results you require.
|
|
95
|
-
*
|
|
96
|
-
* Used for paging through result sets. */
|
|
97
|
-
bookmark?: string;
|
|
98
|
-
/** Whether to update the index prior to returning the result.
|
|
99
|
-
*
|
|
100
|
-
* @default true */
|
|
101
|
-
update?: boolean;
|
|
102
|
-
/** Whether or not the view results should be returned from a “stable” set of shards. */
|
|
103
|
-
stable?: boolean;
|
|
104
|
-
/** Combination of update = false and stable = true options.
|
|
105
|
-
*
|
|
106
|
-
* Possible options: "ok", false (default). */
|
|
107
|
-
stale?: "ok" | false;
|
|
108
|
-
/** Include execution statistics in the query response.
|
|
109
|
-
*
|
|
110
|
-
* Optional, default: false. */
|
|
111
|
-
execution_stats?: boolean;
|
|
112
|
-
}
|
package/lib/utils.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { OrderDirection } from "@decaf-ts/core";
|
|
2
|
-
import { CreateIndexRequest } from "./types";
|
|
3
|
-
export declare function reAuth(con: any, user: string, pass: string): Promise<any>;
|
|
4
|
-
export declare function wrapDocumentScope(con: any, dbName: string, user: string, pass: string): any;
|
|
5
|
-
export declare function testReservedAttributes(attr: string): RegExpMatchArray | null;
|
|
6
|
-
export declare function generateIndexName(attribute: string, tableName: string, compositions?: string[], order?: OrderDirection, separator?: string): string;
|
|
7
|
-
export declare function generateIndexDoc(attribute: string, tableName: string, compositions?: string[], order?: OrderDirection, separator?: string): CreateIndexRequest;
|