@graffy/pg 0.15.5 → 0.15.8-alpha.1
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/cjs/Db.js +392 -0
- package/cjs/filter/filterObject.js +3 -18
- package/cjs/filter/getAst.js +3 -1
- package/cjs/filter/getSql.js +33 -22
- package/cjs/index.js +65 -174
- package/cjs/link/index.js +0 -47
- package/cjs/sql/clauses.js +92 -0
- package/cjs/sql/getArgSql.js +98 -84
- package/cjs/sql/{getIdMeta.js → getMeta.js} +24 -6
- package/cjs/sql/select.js +9 -24
- package/cjs/sql/upsert.js +19 -156
- package/cjs/{sql → test}/expectSql.js +1 -0
- package/cjs/test/setup.js +189 -147
- package/package.json +5 -6
- package/types/Db.d.ts +9 -0
- package/types/index.d.ts +7 -2
- package/types/link/index.d.ts +0 -3
- package/types/sql/clauses.d.ts +8 -0
- package/types/sql/getArgSql.d.ts +17 -18
- package/types/sql/getMeta.d.ts +4 -0
- package/types/sql/select.d.ts +2 -7
- package/cjs/dbRead.js +0 -228
- package/cjs/dbWrite.js +0 -158
- package/cjs/options.js +0 -160
- package/cjs/pool.js +0 -42
- package/cjs/sql/getSelectCols.js +0 -47
- package/types/dbRead.d.ts +0 -1
- package/types/dbWrite.d.ts +0 -1
- package/types/options.d.ts +0 -23
- package/types/pool.d.ts +0 -2
- package/types/sql/getIdMeta.d.ts +0 -4
- package/types/sql/getSelectCols.d.ts +0 -1
package/cjs/test/setup.js
CHANGED
|
@@ -3,181 +3,223 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.
|
|
6
|
+
exports.setupPgServer = setupPgServer;
|
|
7
|
+
exports.teardownPgServer = teardownPgServer;
|
|
8
|
+
exports.resetTables = resetTables;
|
|
9
|
+
exports.getPool = getPool;
|
|
10
|
+
|
|
11
|
+
var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/taggedTemplateLiteralLoose"));
|
|
7
12
|
|
|
8
13
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
9
14
|
|
|
10
|
-
var
|
|
15
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
11
16
|
|
|
12
|
-
var
|
|
17
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
13
18
|
|
|
14
|
-
var
|
|
19
|
+
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
|
|
20
|
+
|
|
21
|
+
var _child_process = require("child_process");
|
|
15
22
|
|
|
16
|
-
var
|
|
23
|
+
var _util = require("util");
|
|
17
24
|
|
|
18
25
|
var _sqlTemplateTag = _interopRequireDefault(require("sql-template-tag"));
|
|
19
26
|
|
|
20
|
-
var
|
|
27
|
+
var _pg = require("pg");
|
|
28
|
+
|
|
29
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
30
|
+
|
|
31
|
+
var connOptions = {
|
|
32
|
+
host: 'localhost',
|
|
33
|
+
port: 15432,
|
|
34
|
+
user: 'postgres',
|
|
35
|
+
password: 'graffy',
|
|
36
|
+
database: 'postgres'
|
|
37
|
+
};
|
|
38
|
+
var pool = null;
|
|
39
|
+
var execFile = (0, _util.promisify)(_child_process.execFile);
|
|
40
|
+
|
|
41
|
+
var sleep = function sleep(ms) {
|
|
42
|
+
return new _promise.default(function (res) {
|
|
43
|
+
return (0, _setTimeout2.default)(res, ms);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var isPgReady = /*#__PURE__*/function () {
|
|
48
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
49
|
+
var client;
|
|
50
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
51
|
+
while (1) {
|
|
52
|
+
switch (_context.prev = _context.next) {
|
|
53
|
+
case 0:
|
|
54
|
+
_context.prev = 0;
|
|
55
|
+
client = new _pg.Client(connOptions);
|
|
56
|
+
_context.next = 4;
|
|
57
|
+
return client.connect();
|
|
58
|
+
|
|
59
|
+
case 4:
|
|
60
|
+
_context.next = 6;
|
|
61
|
+
return client.end();
|
|
21
62
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} // populate();
|
|
63
|
+
case 6:
|
|
64
|
+
return _context.abrupt("return", true);
|
|
25
65
|
|
|
66
|
+
case 9:
|
|
67
|
+
_context.prev = 9;
|
|
68
|
+
_context.t0 = _context["catch"](0);
|
|
69
|
+
return _context.abrupt("return", false);
|
|
26
70
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
71
|
+
case 12:
|
|
72
|
+
case "end":
|
|
73
|
+
return _context.stop();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, _callee, null, [[0, 9]]);
|
|
77
|
+
}));
|
|
30
78
|
|
|
79
|
+
return function isPgReady() {
|
|
80
|
+
return _ref.apply(this, arguments);
|
|
81
|
+
};
|
|
82
|
+
}();
|
|
83
|
+
|
|
84
|
+
function setupPgServer() {
|
|
85
|
+
return _setupPgServer.apply(this, arguments);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function _setupPgServer() {
|
|
89
|
+
_setupPgServer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
31
90
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
32
91
|
while (1) {
|
|
33
92
|
switch (_context2.prev = _context2.next) {
|
|
34
93
|
case 0:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
40
|
-
while (1) {
|
|
41
|
-
switch (_context.prev = _context.next) {
|
|
42
|
-
case 0:
|
|
43
|
-
if (builder === void 0) {
|
|
44
|
-
builder = function builder() {};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
i = 0;
|
|
48
|
-
|
|
49
|
-
case 2:
|
|
50
|
-
if (!(i < number)) {
|
|
51
|
-
_context.next = 10;
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
_ref = builder(i) || {}, _ref$tags = _ref.tags, tags = _ref$tags === void 0 ? {} : _ref$tags, _ref$data = _ref.data, data = _ref$data === void 0 ? {} : _ref$data;
|
|
56
|
-
now = (0, _now.default)(); // console.log('Inserting ', type, i);
|
|
57
|
-
|
|
58
|
-
_context.next = 7;
|
|
59
|
-
return pool.query((0, _sqlTemplateTag.default)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2.default)(["INSERT INTO \"users\" (\n \"id\", \"tags\", \"data\", \"version\"\n ) VALUES (\n ", ",\n ", ",\n ", ",\n ", "\n );"])), type + i, tags, data, now));
|
|
60
|
-
|
|
61
|
-
case 7:
|
|
62
|
-
i++;
|
|
63
|
-
_context.next = 2;
|
|
64
|
-
break;
|
|
65
|
-
|
|
66
|
-
case 10:
|
|
67
|
-
case "end":
|
|
68
|
-
return _context.stop();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}, _callee);
|
|
72
|
-
}));
|
|
73
|
-
return _insert.apply(this, arguments);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
insert = function _insert2(_x, _x2, _x3) {
|
|
77
|
-
return _insert.apply(this, arguments);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// console.log('Creating tables');
|
|
81
|
-
pool = new _pg.default.Pool();
|
|
82
|
-
_context2.next = 5;
|
|
83
|
-
return pool.query((0, _sqlTemplateTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)(["\n DROP TABLE IF EXISTS \"users\";\n "]))));
|
|
84
|
-
|
|
85
|
-
case 5:
|
|
86
|
-
_context2.next = 7;
|
|
87
|
-
return pool.query((0, _sqlTemplateTag.default)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)(["\n CREATE TABLE \"users\" (\n \"id\" text PRIMARY KEY,\n \"tags\" jsonb NOT NULL DEFAULT '{}',\n \"data\" jsonb NOT NULL DEFAULT '{}',\n \"version\" int8 NOT NULL DEFAULT NOW()\n );\n "]))));
|
|
94
|
+
_context2.prev = 0;
|
|
95
|
+
_context2.next = 3;
|
|
96
|
+
return execFile('docker', ['run', '-d', '--name', 'graffypg', '-p', connOptions.port + ":5432", '-e', "POSTGRES_PASSWORD=" + connOptions.password, 'postgres:alpine']);
|
|
88
97
|
|
|
89
|
-
case
|
|
98
|
+
case 3:
|
|
90
99
|
_context2.next = 9;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
id: {
|
|
100
|
-
role: 'primary'
|
|
101
|
-
},
|
|
102
|
-
tags: {
|
|
103
|
-
role: 'gin'
|
|
104
|
-
},
|
|
105
|
-
data: {
|
|
106
|
-
role: 'default'
|
|
107
|
-
},
|
|
108
|
-
version: {
|
|
109
|
-
role: 'version'
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
links: {
|
|
113
|
-
posts: {
|
|
114
|
-
target: ['post'],
|
|
115
|
-
back: ['author']
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
post: {
|
|
120
|
-
type: 'db',
|
|
121
|
-
table: 'posts',
|
|
122
|
-
columns: {
|
|
123
|
-
id: {
|
|
124
|
-
role: 'primary'
|
|
125
|
-
},
|
|
126
|
-
tags: {
|
|
127
|
-
role: 'gin'
|
|
128
|
-
},
|
|
129
|
-
data: {
|
|
130
|
-
role: 'default'
|
|
131
|
-
},
|
|
132
|
-
version: {
|
|
133
|
-
role: 'version'
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
links: {
|
|
137
|
-
author: {
|
|
138
|
-
target: ['user']
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
});
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case 5:
|
|
103
|
+
_context2.prev = 5;
|
|
104
|
+
_context2.t0 = _context2["catch"](0);
|
|
105
|
+
// eslint-disable-next-line no-console
|
|
106
|
+
console.error('Could not start a test Postgres server using Docker.\n' + 'Possible reasons:\n' + '1. You might not have Docker installed.\n' + '2. The last test run might not have exited properly.\n' + ' Run yarn pg:clean to fix this.\n' + 'Docker might have printed a detailed error message above.');
|
|
107
|
+
throw _context2.t0;
|
|
146
108
|
|
|
147
109
|
case 9:
|
|
148
110
|
_context2.next = 11;
|
|
149
|
-
return
|
|
150
|
-
return {
|
|
151
|
-
data: {
|
|
152
|
-
i: i
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
});
|
|
111
|
+
return isPgReady(connOptions.port);
|
|
156
112
|
|
|
157
113
|
case 11:
|
|
158
|
-
_context2.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
i: i,
|
|
163
|
-
author: 'user' + (4 - i)
|
|
164
|
-
},
|
|
165
|
-
tags: {
|
|
166
|
-
author: 'user' + (4 - i)
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
case 13:
|
|
172
|
-
_context2.next = 15;
|
|
173
|
-
return pool.end();
|
|
114
|
+
if (_context2.sent) {
|
|
115
|
+
_context2.next = 16;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
174
118
|
|
|
175
|
-
|
|
119
|
+
_context2.next = 14;
|
|
120
|
+
return sleep(200);
|
|
121
|
+
|
|
122
|
+
case 14:
|
|
123
|
+
_context2.next = 9;
|
|
124
|
+
break;
|
|
125
|
+
|
|
126
|
+
case 16:
|
|
127
|
+
// console.log('Postgres is up in', Date.now() - start, 'ms');
|
|
128
|
+
pool = new _pg.Pool(connOptions);
|
|
129
|
+
|
|
130
|
+
case 17:
|
|
176
131
|
case "end":
|
|
177
132
|
return _context2.stop();
|
|
178
133
|
}
|
|
179
134
|
}
|
|
180
|
-
}, _callee2);
|
|
135
|
+
}, _callee2, null, [[0, 5]]);
|
|
136
|
+
}));
|
|
137
|
+
return _setupPgServer.apply(this, arguments);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function teardownPgServer() {
|
|
141
|
+
return _teardownPgServer.apply(this, arguments);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function _teardownPgServer() {
|
|
145
|
+
_teardownPgServer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
146
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
147
|
+
while (1) {
|
|
148
|
+
switch (_context3.prev = _context3.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
if (!pool) {
|
|
151
|
+
_context3.next = 4;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
_context3.next = 3;
|
|
156
|
+
return pool.end();
|
|
157
|
+
|
|
158
|
+
case 3:
|
|
159
|
+
pool = null;
|
|
160
|
+
|
|
161
|
+
case 4:
|
|
162
|
+
_context3.next = 6;
|
|
163
|
+
return execFile('docker', ['rm', '-f', 'graffypg']);
|
|
164
|
+
|
|
165
|
+
case 6:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context3.stop();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, _callee3);
|
|
181
171
|
}));
|
|
182
|
-
return
|
|
172
|
+
return _teardownPgServer.apply(this, arguments);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function resetTables() {
|
|
176
|
+
return _resetTables.apply(this, arguments);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function _resetTables() {
|
|
180
|
+
_resetTables = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
181
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
182
|
+
while (1) {
|
|
183
|
+
switch (_context4.prev = _context4.next) {
|
|
184
|
+
case 0:
|
|
185
|
+
if (pool) {
|
|
186
|
+
_context4.next = 2;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
throw Error('No pool; Did not setup PG or already torn down.');
|
|
191
|
+
|
|
192
|
+
case 2:
|
|
193
|
+
_context4.next = 4;
|
|
194
|
+
return pool.query((0, _sqlTemplateTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)(["\n CREATE EXTENSION IF NOT EXISTS \"pgcrypto\"\n "]))));
|
|
195
|
+
|
|
196
|
+
case 4:
|
|
197
|
+
_context4.next = 6;
|
|
198
|
+
return pool.query((0, _sqlTemplateTag.default)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)(["\n DROP TABLE IF EXISTS \"users\";\n "]))));
|
|
199
|
+
|
|
200
|
+
case 6:
|
|
201
|
+
_context4.next = 8;
|
|
202
|
+
return pool.query((0, _sqlTemplateTag.default)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2.default)(["\n CREATE UNLOGGED TABLE \"users\" (\n \"id\" uuid DEFAULT gen_random_uuid() PRIMARY KEY,\n \"name\" text,\n \"settings\" jsonb,\n \"email\" text UNIQUE,\n \"version\" int8 NOT NULL\n );\n "]))));
|
|
203
|
+
|
|
204
|
+
case 8:
|
|
205
|
+
_context4.next = 10;
|
|
206
|
+
return pool.query((0, _sqlTemplateTag.default)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2.default)(["\n DROP TABLE IF EXISTS \"posts\";\n "]))));
|
|
207
|
+
|
|
208
|
+
case 10:
|
|
209
|
+
_context4.next = 12;
|
|
210
|
+
return pool.query((0, _sqlTemplateTag.default)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)(["\n CREATE UNLOGGED TABLE \"posts\" (\n \"id\" uuid DEFAULT gen_random_uuid() PRIMARY KEY,\n \"title\" text,\n \"authorId\" text,\n \"version\" int8 NOT NULL\n );\n "]))));
|
|
211
|
+
|
|
212
|
+
case 12:
|
|
213
|
+
case "end":
|
|
214
|
+
return _context4.stop();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}, _callee4);
|
|
218
|
+
}));
|
|
219
|
+
return _resetTables.apply(this, arguments);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function getPool() {
|
|
223
|
+
if (!pool) throw Error('No pool; Did not setup PG or already torn down.');
|
|
224
|
+
return pool;
|
|
183
225
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graffy/pg",
|
|
3
3
|
"description": "The standard Postgres module for Graffy. Each instance this module mounts a Postgres table as a Graffy subtree.",
|
|
4
4
|
"author": "aravind (https://github.com/aravindet)",
|
|
5
|
-
"version": "0.15.
|
|
5
|
+
"version": "0.15.8-alpha.1",
|
|
6
6
|
"main": "./cjs/index.js",
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
8
8
|
"repository": {
|
|
@@ -12,11 +12,10 @@
|
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@babel/runtime-corejs3": "^7.15.3",
|
|
15
|
-
"@graffy/common": "0.15.5",
|
|
16
|
-
"debug": "^4.3.2",
|
|
17
|
-
"@graffy/testing": "0.15.5",
|
|
18
|
-
"@graffy/stream": "0.15.5",
|
|
19
15
|
"pg": "^8.7.1",
|
|
20
|
-
"
|
|
16
|
+
"@graffy/common": "0.15.8-alpha.1",
|
|
17
|
+
"debug": "^4.3.2",
|
|
18
|
+
"sql-template-tag": "^4.0.0",
|
|
19
|
+
"@graffy/testing": "0.15.8-alpha.1"
|
|
21
20
|
}
|
|
22
21
|
}
|
package/types/Db.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default class Db {
|
|
2
|
+
constructor(connection: any);
|
|
3
|
+
client: any;
|
|
4
|
+
query(sql: any): Promise<any>;
|
|
5
|
+
readSql(sql: any): Promise<any>;
|
|
6
|
+
writeSql(sql: any): Promise<any>;
|
|
7
|
+
read(rootQuery: any, tableOptions: any): Promise<any>;
|
|
8
|
+
write(rootChange: any, tableOptions: any): Promise<any[]>;
|
|
9
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export function pg({ table, idCol, verCol, links, connection }: {
|
|
2
|
+
table?: string;
|
|
3
|
+
idCol?: string;
|
|
4
|
+
verCol?: string;
|
|
5
|
+
links?: object;
|
|
6
|
+
connection?: any;
|
|
7
|
+
}): (store: any) => void;
|
package/types/link/index.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const nowTimestamp: import("sql-template-tag").Sql;
|
|
2
|
+
export function getJsonBuildObject(variadic: any): import("sql-template-tag").Sql;
|
|
3
|
+
export function getSelectCols(table: any): import("sql-template-tag").Sql;
|
|
4
|
+
export function getInsert(row: any, options: any): {
|
|
5
|
+
cols: import("sql-template-tag").Sql;
|
|
6
|
+
vals: import("sql-template-tag").Sql;
|
|
7
|
+
};
|
|
8
|
+
export function getUpdates(row: any, options: any): import("sql-template-tag").Sql;
|
package/types/sql/getArgSql.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}, options:
|
|
11
|
-
|
|
12
|
-
where:
|
|
1
|
+
/**
|
|
2
|
+
Uses the args object (typically passed in the $key attribute)
|
|
3
|
+
|
|
4
|
+
@param {object} args
|
|
5
|
+
@param {object} options
|
|
6
|
+
|
|
7
|
+
@typedef { import('sql-template-tag').Sql } Sql
|
|
8
|
+
@return {{ meta: Sql, where: Sql[], order?: Sql, limit: number }}
|
|
9
|
+
*/
|
|
10
|
+
export default function getArgSql({ $first, $last, $after, $before, $since, $until, $all, $cursor: _, ...rest }: object, options: object): {
|
|
11
|
+
meta: Sql;
|
|
12
|
+
where: Sql[];
|
|
13
|
+
order?: Sql;
|
|
13
14
|
limit: number;
|
|
14
|
-
order?: undefined;
|
|
15
|
-
} | {
|
|
16
|
-
attrs: import("sql-template-tag").Sql;
|
|
17
|
-
where: any[];
|
|
18
|
-
order: import("sql-template-tag").Sql;
|
|
19
|
-
limit: any;
|
|
20
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Uses the args object (typically passed in the $key attribute)
|
|
18
|
+
*/
|
|
19
|
+
export type Sql = import('sql-template-tag').Sql;
|
package/types/sql/select.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
export function selectByArgs(args: any, options: any
|
|
2
|
-
|
|
3
|
-
}): import("sql-template-tag").Sql;
|
|
4
|
-
export function selectByIds(ids: any, options: any, { forUpdate }?: {
|
|
5
|
-
forUpdate: any;
|
|
6
|
-
}): import("sql-template-tag").Sql;
|
|
7
|
-
export function selectUpdatedSince(version: any, options: any): import("sql-template-tag").Sql;
|
|
1
|
+
export function selectByArgs(args: any, options: any): import("sql-template-tag").Sql;
|
|
2
|
+
export function selectByIds(ids: any, options: any): import("sql-template-tag").Sql;
|