-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadapter.js
120 lines (107 loc) · 2.53 KB
/
adapter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// deno-lint-ignore-file no-unused-vars
/**
* @typedef {Object} CreateDocumentArgs
* @property {string} db
* @property {string} id
* @property {object} doc
*
* @typedef {Object} RetrieveDocumentArgs
* @property {string} db
* @property {string} id
*
* @typedef {Object} QueryDocumentsArgs
* @property {string} db
* @property {QueryArgs} query
*
* @typedef {Object} QueryArgs
* @property {object} selector
* @property {string[]} fields
* @property {number} limit
* @property {object[]} sort
* @property {string} use_index
*
* @typedef {Object} IndexDocumentArgs
* @property {string} db
* @property {string} name
* @property {string[]} fields
*
* @typedef {Object} ListDocumentArgs
* @property {string} db
* @property {number} limit
* @property {string} startkey
* @property {string} endkey
* @property {string[]} keys
*
* @typedef {Object} BulkDocumentsArgs
* @property {string} db
* @property {object[]} docs
*
* @typedef {Object} Response
* @property {boolean} ok
*/
export default function (_env) {
/**
* @param {string} name
* @returns {Promise<Response>}
*/
async function createDatabase(name) {}
/**
* @param {string} name
* @returns {Promise<Response>}
*/
async function removeDatabase(name) {}
/**
* @param {CreateDocumentArgs}
* @returns {Promise<Response>}
*/
async function createDocument({ db, id, doc }) {}
/**
* @param {RetrieveDocumentArgs}
* @returns {Promise<Response>}
*/
async function retrieveDocument({ db, id }) {}
/**
* @param {CreateDocumentArgs}
* @returns {Promise<Response>}
*/
async function updateDocument({ db, id, doc }) {}
/**
* @param {RetrieveDocumentArgs}
* @returns {Promise<Response>}
*/
async function removeDocument({ db, id }) {}
/**
* @param {QueryDocumentsArgs}
* @returns {Promise<Response>}
*/
async function queryDocuments({ db, query }) {}
/**
* @param {IndexDocumentArgs}
* @returns {Promise<Response>}
*/
async function indexDocuments({ db, name, fields }) {}
/**
* @param {ListDocumentArgs}
* @returns {Promise<Response>}
*/
async function listDocuments(
{ db, limit, startkey, endkey, keys, descending },
) {}
/**
* @param {BulkDocumentsArgs}
* @returns {Promise<Response>}
*/
async function bulkDocuments({ db, docs }) {}
return Object.freeze({
createDatabase,
removeDatabase,
createDocument,
retrieveDocument,
updateDocument,
removeDocument,
queryDocuments,
indexDocuments,
listDocuments,
bulkDocuments,
});
}