@snowtop/ent 0.1.0-alpha54 → 0.1.0-alpha59
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/action/orchestrator.js +21 -0
- package/core/base.d.ts +1 -1
- package/core/clause.d.ts +36 -7
- package/core/clause.js +133 -32
- package/core/config.d.ts +5 -2
- package/core/ent.d.ts +16 -3
- package/core/ent.js +147 -35
- package/core/loaders/assoc_count_loader.js +6 -1
- package/core/query/shared_assoc_test.d.ts +1 -1
- package/core/query/shared_assoc_test.js +17 -5
- package/core/query/shared_test.d.ts +3 -0
- package/core/query/shared_test.js +95 -17
- package/index.d.ts +5 -5
- package/index.js +7 -6
- package/package.json +1 -1
- package/parse_schema/parse.d.ts +8 -2
- package/parse_schema/parse.js +35 -2
- package/schema/index.d.ts +1 -1
- package/schema/schema.d.ts +20 -1
- package/scripts/custom_graphql.js +2 -0
- package/scripts/read_schema.js +10 -1
- package/testutils/db/{test_db.d.ts → temp_db.d.ts} +15 -3
- package/testutils/db/{test_db.js → temp_db.js} +62 -15
- package/testutils/fake_data/fake_contact.d.ts +1 -1
- package/testutils/fake_data/fake_contact.js +2 -2
- package/testutils/fake_data/fake_event.d.ts +1 -1
- package/testutils/fake_data/fake_event.js +3 -3
- package/testutils/fake_data/fake_user.d.ts +1 -1
- package/testutils/fake_data/fake_user.js +2 -2
- package/testutils/fake_data/test_helpers.d.ts +2 -2
- package/testutils/fake_data/test_helpers.js +5 -5
- package/testutils/parse_sql.js +4 -0
- package/testutils/test_edge_global_schema.d.ts +15 -0
- package/testutils/test_edge_global_schema.js +58 -0
- package/testutils/write.d.ts +2 -2
- package/testutils/write.js +3 -3
- package/tsc/ast.d.ts +1 -0
- package/tsc/ast.js +3 -0
package/action/orchestrator.js
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
2
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
23
|
};
|
|
@@ -11,6 +30,7 @@ const privacy_1 = require("../core/privacy");
|
|
|
11
30
|
const executor_1 = require("./executor");
|
|
12
31
|
const logger_1 = require("../core/logger");
|
|
13
32
|
const memoizee_1 = __importDefault(require("memoizee"));
|
|
33
|
+
const clause = __importStar(require("../core/clause"));
|
|
14
34
|
var edgeDirection;
|
|
15
35
|
(function (edgeDirection) {
|
|
16
36
|
edgeDirection[edgeDirection["inboundEdge"] = 0] = "inboundEdge";
|
|
@@ -159,6 +179,7 @@ class Orchestrator {
|
|
|
159
179
|
key: this.options.key,
|
|
160
180
|
loadEntOptions: this.options.loaderOptions,
|
|
161
181
|
placeholderID: this.options.builder.placeholderID,
|
|
182
|
+
whereClause: clause.Eq(this.options.key, this.existingEnt?.id),
|
|
162
183
|
};
|
|
163
184
|
if (this.logValues) {
|
|
164
185
|
opts.fieldsToLog = this.logValues;
|
package/core/base.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ export interface CreateRowOptions extends DataOptions {
|
|
|
82
82
|
fieldsToLog?: Data;
|
|
83
83
|
}
|
|
84
84
|
export interface EditRowOptions extends CreateRowOptions {
|
|
85
|
-
|
|
85
|
+
whereClause: clause.Clause;
|
|
86
86
|
}
|
|
87
87
|
interface LoadableEntOptions<TEnt extends Ent, TViewer extends Viewer = Viewer> {
|
|
88
88
|
loaderFactory: LoaderFactory<any, Data | null>;
|
package/core/clause.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export interface Clause {
|
|
2
2
|
clause(idx: number): string;
|
|
3
|
+
columns(): string[];
|
|
3
4
|
values(): any[];
|
|
4
5
|
instanceKey(): string;
|
|
5
6
|
logValues(): any[];
|
|
@@ -12,10 +13,11 @@ declare class simpleClause implements Clause {
|
|
|
12
13
|
protected col: string;
|
|
13
14
|
private value;
|
|
14
15
|
private op;
|
|
15
|
-
private
|
|
16
|
-
constructor(col: string, value: any, op: string,
|
|
16
|
+
private handleNull?;
|
|
17
|
+
constructor(col: string, value: any, op: string, handleNull?: Clause | undefined);
|
|
17
18
|
clause(idx: number): string;
|
|
18
|
-
private
|
|
19
|
+
private nullClause;
|
|
20
|
+
columns(): string[];
|
|
19
21
|
values(): any[];
|
|
20
22
|
logValues(): any[];
|
|
21
23
|
instanceKey(): string;
|
|
@@ -25,16 +27,43 @@ declare class compositeClause implements Clause {
|
|
|
25
27
|
private sep;
|
|
26
28
|
constructor(clauses: Clause[], sep: string);
|
|
27
29
|
clause(idx: number): string;
|
|
30
|
+
columns(): string[];
|
|
28
31
|
values(): any[];
|
|
29
32
|
logValues(): any[];
|
|
30
33
|
instanceKey(): string;
|
|
31
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* creates a clause to determine if the given value is contained in the array stored in the column in the db
|
|
37
|
+
* only works with postgres gin indexes
|
|
38
|
+
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
39
|
+
*/
|
|
40
|
+
export declare function PostgresArrayContainsValue(col: string, value: any): Clause;
|
|
41
|
+
/**
|
|
42
|
+
* creates a clause to determine if every item in the list is stored in the array stored in the column in the db
|
|
43
|
+
* only works with postgres gin indexes
|
|
44
|
+
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
45
|
+
*/
|
|
46
|
+
export declare function PostgresArrayContains(col: string, value: any[]): Clause;
|
|
47
|
+
/**
|
|
48
|
+
* creates a clause to determine if the given value is NOT contained in the array stored in the column in the db
|
|
49
|
+
* only works with postgres gin indexes
|
|
50
|
+
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
51
|
+
*/
|
|
52
|
+
export declare function PostgresArrayNotContainsValue(col: string, value: any): Clause;
|
|
53
|
+
/**
|
|
54
|
+
* creates a clause to determine if every item in the list is NOT stored in the array stored in the column in the db
|
|
55
|
+
* only works with postgres gin indexes
|
|
56
|
+
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
57
|
+
*/
|
|
58
|
+
export declare function PostgresArrayNotContains(col: string, value: any[]): Clause;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated use PostgresArrayContainsValue
|
|
61
|
+
*/
|
|
32
62
|
export declare function ArrayEq(col: string, value: any): Clause;
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated use PostgresNotArrayContains
|
|
65
|
+
*/
|
|
33
66
|
export declare function ArrayNotEq(col: string, value: any): Clause;
|
|
34
|
-
export declare function ArrayGreater(col: string, value: any): Clause;
|
|
35
|
-
export declare function ArrayLess(col: string, value: any): Clause;
|
|
36
|
-
export declare function ArrayGreaterEq(col: string, value: any): Clause;
|
|
37
|
-
export declare function ArrayLessEq(col: string, value: any): Clause;
|
|
38
67
|
export declare function Eq(col: string, value: any): Clause;
|
|
39
68
|
export declare function NotEq(col: string, value: any): Clause;
|
|
40
69
|
export declare function Greater(col: string, value: any): simpleClause;
|
package/core/clause.js
CHANGED
|
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.sensitiveValue = exports.TsVectorWebsearchToTsQuery = exports.TsVectorPhraseToTsQuery = exports.TsVectorPlainToTsQuery = exports.TsVectorColTsQuery = exports.WebsearchToTsQuery = exports.PhraseToTsQuery = exports.PlainToTsQuery = exports.TsQuery = exports.In = exports.Or = exports.AndOptional = exports.And = exports.LessEq = exports.GreaterEq = exports.Less = exports.Greater = exports.NotEq = exports.Eq = exports.
|
|
22
|
+
exports.sensitiveValue = exports.TsVectorWebsearchToTsQuery = exports.TsVectorPhraseToTsQuery = exports.TsVectorPlainToTsQuery = exports.TsVectorColTsQuery = exports.WebsearchToTsQuery = exports.PhraseToTsQuery = exports.PlainToTsQuery = exports.TsQuery = exports.In = exports.Or = exports.AndOptional = exports.And = exports.LessEq = exports.GreaterEq = exports.Less = exports.Greater = exports.NotEq = exports.Eq = exports.ArrayNotEq = exports.ArrayEq = exports.PostgresArrayNotContains = exports.PostgresArrayNotContainsValue = exports.PostgresArrayContains = exports.PostgresArrayContainsValue = void 0;
|
|
23
23
|
const db_1 = __importStar(require("./db"));
|
|
24
24
|
function isSensitive(val) {
|
|
25
25
|
return (val !== null &&
|
|
@@ -33,33 +33,33 @@ function rawValue(val) {
|
|
|
33
33
|
return val;
|
|
34
34
|
}
|
|
35
35
|
class simpleClause {
|
|
36
|
-
constructor(col, value, op,
|
|
36
|
+
constructor(col, value, op, handleNull) {
|
|
37
37
|
this.col = col;
|
|
38
38
|
this.value = value;
|
|
39
39
|
this.op = op;
|
|
40
|
-
this.
|
|
40
|
+
this.handleNull = handleNull;
|
|
41
41
|
}
|
|
42
42
|
clause(idx) {
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
43
|
+
const nullClause = this.nullClause();
|
|
44
|
+
if (nullClause) {
|
|
45
|
+
return nullClause.clause(idx);
|
|
46
46
|
}
|
|
47
47
|
if (db_1.default.getDialect() === db_1.Dialect.Postgres) {
|
|
48
48
|
return `${this.col} ${this.op} $${idx}`;
|
|
49
49
|
}
|
|
50
50
|
return `${this.col} ${this.op} ?`;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
if (!this.
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (db_1.default.getDialect() !== db_1.Dialect.SQLite) {
|
|
52
|
+
nullClause() {
|
|
53
|
+
if (!this.handleNull || this.value !== null) {
|
|
57
54
|
return;
|
|
58
55
|
}
|
|
59
|
-
return this.
|
|
56
|
+
return this.handleNull;
|
|
57
|
+
}
|
|
58
|
+
columns() {
|
|
59
|
+
return [this.col];
|
|
60
60
|
}
|
|
61
61
|
values() {
|
|
62
|
-
const sqliteClause = this.
|
|
62
|
+
const sqliteClause = this.nullClause();
|
|
63
63
|
if (sqliteClause) {
|
|
64
64
|
return sqliteClause.values();
|
|
65
65
|
}
|
|
@@ -69,7 +69,7 @@ class simpleClause {
|
|
|
69
69
|
return [this.value];
|
|
70
70
|
}
|
|
71
71
|
logValues() {
|
|
72
|
-
const sqliteClause = this.
|
|
72
|
+
const sqliteClause = this.nullClause();
|
|
73
73
|
if (sqliteClause) {
|
|
74
74
|
return sqliteClause.logValues();
|
|
75
75
|
}
|
|
@@ -79,7 +79,7 @@ class simpleClause {
|
|
|
79
79
|
return [this.value];
|
|
80
80
|
}
|
|
81
81
|
instanceKey() {
|
|
82
|
-
const sqliteClause = this.
|
|
82
|
+
const sqliteClause = this.nullClause();
|
|
83
83
|
if (sqliteClause) {
|
|
84
84
|
return sqliteClause.instanceKey();
|
|
85
85
|
}
|
|
@@ -93,6 +93,9 @@ class isNullClause {
|
|
|
93
93
|
clause(idx) {
|
|
94
94
|
return `${this.col} IS NULL`;
|
|
95
95
|
}
|
|
96
|
+
columns() {
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
96
99
|
values() {
|
|
97
100
|
return [];
|
|
98
101
|
}
|
|
@@ -110,6 +113,9 @@ class isNotNullClause {
|
|
|
110
113
|
clause(idx) {
|
|
111
114
|
return `${this.col} IS NOT NULL`;
|
|
112
115
|
}
|
|
116
|
+
columns() {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
113
119
|
values() {
|
|
114
120
|
return [];
|
|
115
121
|
}
|
|
@@ -132,6 +138,9 @@ class arraySimpleClause {
|
|
|
132
138
|
}
|
|
133
139
|
return `${this.col} ${this.op} ?`;
|
|
134
140
|
}
|
|
141
|
+
columns() {
|
|
142
|
+
return [this.col];
|
|
143
|
+
}
|
|
135
144
|
values() {
|
|
136
145
|
if (isSensitive(this.value)) {
|
|
137
146
|
return [this.value.value()];
|
|
@@ -148,6 +157,60 @@ class arraySimpleClause {
|
|
|
148
157
|
return `${this.col}${this.op}${rawValue(this.value)}`;
|
|
149
158
|
}
|
|
150
159
|
}
|
|
160
|
+
class postgresArrayContains {
|
|
161
|
+
constructor(col, value, not) {
|
|
162
|
+
this.col = col;
|
|
163
|
+
this.value = value;
|
|
164
|
+
this.not = not;
|
|
165
|
+
}
|
|
166
|
+
clause(idx) {
|
|
167
|
+
if (db_1.default.getDialect() === db_1.Dialect.Postgres) {
|
|
168
|
+
if (this.not) {
|
|
169
|
+
return `NOT ${this.col} @> $${idx}`;
|
|
170
|
+
}
|
|
171
|
+
return `${this.col} @> $${idx}`;
|
|
172
|
+
}
|
|
173
|
+
throw new Error(`not supported`);
|
|
174
|
+
}
|
|
175
|
+
columns() {
|
|
176
|
+
return [this.col];
|
|
177
|
+
}
|
|
178
|
+
values() {
|
|
179
|
+
if (isSensitive(this.value)) {
|
|
180
|
+
return [`{${this.value.value()}}`];
|
|
181
|
+
}
|
|
182
|
+
return [`{${this.value}}`];
|
|
183
|
+
}
|
|
184
|
+
logValues() {
|
|
185
|
+
if (isSensitive(this.value)) {
|
|
186
|
+
return [this.value.logValue()];
|
|
187
|
+
}
|
|
188
|
+
return [this.value];
|
|
189
|
+
}
|
|
190
|
+
instanceKey() {
|
|
191
|
+
if (this.not) {
|
|
192
|
+
return `NOT:${this.col}@>${rawValue(this.value)}`;
|
|
193
|
+
}
|
|
194
|
+
return `${this.col}@>${rawValue(this.value)}`;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
class postgresArrayContainsList extends postgresArrayContains {
|
|
198
|
+
constructor(col, value, not) {
|
|
199
|
+
super(col, value, not);
|
|
200
|
+
}
|
|
201
|
+
values() {
|
|
202
|
+
return [
|
|
203
|
+
`{${this.value
|
|
204
|
+
.map((v) => {
|
|
205
|
+
if (isSensitive(v)) {
|
|
206
|
+
return v.value();
|
|
207
|
+
}
|
|
208
|
+
return v;
|
|
209
|
+
})
|
|
210
|
+
.join(", ")}}`,
|
|
211
|
+
];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
151
214
|
class inClause {
|
|
152
215
|
constructor(col, value) {
|
|
153
216
|
this.col = col;
|
|
@@ -174,6 +237,9 @@ class inClause {
|
|
|
174
237
|
// or change to a sqlx.Rebind format
|
|
175
238
|
// here's what sqlx does: https://play.golang.org/p/vPzvYqeAcP0
|
|
176
239
|
}
|
|
240
|
+
columns() {
|
|
241
|
+
return [this.col];
|
|
242
|
+
}
|
|
177
243
|
values() {
|
|
178
244
|
const result = [];
|
|
179
245
|
for (const value of this.value) {
|
|
@@ -215,6 +281,13 @@ class compositeClause {
|
|
|
215
281
|
}
|
|
216
282
|
return clauses.join(this.sep);
|
|
217
283
|
}
|
|
284
|
+
columns() {
|
|
285
|
+
const ret = [];
|
|
286
|
+
for (const cls of this.clauses) {
|
|
287
|
+
ret.push(...cls.columns());
|
|
288
|
+
}
|
|
289
|
+
return ret;
|
|
290
|
+
}
|
|
218
291
|
values() {
|
|
219
292
|
let result = [];
|
|
220
293
|
for (const clause of this.clauses) {
|
|
@@ -264,6 +337,9 @@ class tsQueryClause {
|
|
|
264
337
|
// FYI this doesn't actually work for sqlite since different
|
|
265
338
|
return `${this.col} @@ ${this.getFunction()}('${language}', ?)`;
|
|
266
339
|
}
|
|
340
|
+
columns() {
|
|
341
|
+
return [this.col];
|
|
342
|
+
}
|
|
267
343
|
values() {
|
|
268
344
|
const { value } = this.getInfo();
|
|
269
345
|
return [value];
|
|
@@ -298,31 +374,56 @@ class websearchTosQueryClause extends tsQueryClause {
|
|
|
298
374
|
return "websearch_to_tsquery";
|
|
299
375
|
}
|
|
300
376
|
}
|
|
301
|
-
|
|
377
|
+
/**
|
|
378
|
+
* creates a clause to determine if the given value is contained in the array stored in the column in the db
|
|
379
|
+
* only works with postgres gin indexes
|
|
380
|
+
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
381
|
+
*/
|
|
382
|
+
function PostgresArrayContainsValue(col, value) {
|
|
383
|
+
return new postgresArrayContains(col, value);
|
|
384
|
+
}
|
|
385
|
+
exports.PostgresArrayContainsValue = PostgresArrayContainsValue;
|
|
386
|
+
/**
|
|
387
|
+
* creates a clause to determine if every item in the list is stored in the array stored in the column in the db
|
|
388
|
+
* only works with postgres gin indexes
|
|
389
|
+
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
390
|
+
*/
|
|
391
|
+
function PostgresArrayContains(col, value) {
|
|
392
|
+
return new postgresArrayContainsList(col, value);
|
|
393
|
+
}
|
|
394
|
+
exports.PostgresArrayContains = PostgresArrayContains;
|
|
395
|
+
/**
|
|
396
|
+
* creates a clause to determine if the given value is NOT contained in the array stored in the column in the db
|
|
397
|
+
* only works with postgres gin indexes
|
|
398
|
+
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
399
|
+
*/
|
|
400
|
+
function PostgresArrayNotContainsValue(col, value) {
|
|
401
|
+
return new postgresArrayContains(col, value, true);
|
|
402
|
+
}
|
|
403
|
+
exports.PostgresArrayNotContainsValue = PostgresArrayNotContainsValue;
|
|
404
|
+
/**
|
|
405
|
+
* creates a clause to determine if every item in the list is NOT stored in the array stored in the column in the db
|
|
406
|
+
* only works with postgres gin indexes
|
|
407
|
+
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
408
|
+
*/
|
|
409
|
+
function PostgresArrayNotContains(col, value) {
|
|
410
|
+
return new postgresArrayContainsList(col, value, true);
|
|
411
|
+
}
|
|
412
|
+
exports.PostgresArrayNotContains = PostgresArrayNotContains;
|
|
413
|
+
/**
|
|
414
|
+
* @deprecated use PostgresArrayContainsValue
|
|
415
|
+
*/
|
|
302
416
|
function ArrayEq(col, value) {
|
|
303
417
|
return new arraySimpleClause(col, value, "=");
|
|
304
418
|
}
|
|
305
419
|
exports.ArrayEq = ArrayEq;
|
|
420
|
+
/**
|
|
421
|
+
* @deprecated use PostgresNotArrayContains
|
|
422
|
+
*/
|
|
306
423
|
function ArrayNotEq(col, value) {
|
|
307
424
|
return new arraySimpleClause(col, value, "!=");
|
|
308
425
|
}
|
|
309
426
|
exports.ArrayNotEq = ArrayNotEq;
|
|
310
|
-
function ArrayGreater(col, value) {
|
|
311
|
-
return new arraySimpleClause(col, value, ">");
|
|
312
|
-
}
|
|
313
|
-
exports.ArrayGreater = ArrayGreater;
|
|
314
|
-
function ArrayLess(col, value) {
|
|
315
|
-
return new arraySimpleClause(col, value, "<");
|
|
316
|
-
}
|
|
317
|
-
exports.ArrayLess = ArrayLess;
|
|
318
|
-
function ArrayGreaterEq(col, value) {
|
|
319
|
-
return new arraySimpleClause(col, value, ">=");
|
|
320
|
-
}
|
|
321
|
-
exports.ArrayGreaterEq = ArrayGreaterEq;
|
|
322
|
-
function ArrayLessEq(col, value) {
|
|
323
|
-
return new arraySimpleClause(col, value, "<=");
|
|
324
|
-
}
|
|
325
|
-
exports.ArrayLessEq = ArrayLessEq;
|
|
326
427
|
function Eq(col, value) {
|
|
327
428
|
return new simpleClause(col, value, "=", new isNullClause(col));
|
|
328
429
|
}
|
package/core/config.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface Config {
|
|
|
20
20
|
log?: logType | logType[];
|
|
21
21
|
codegen?: CodegenConfig;
|
|
22
22
|
customGraphQLJSONPath?: string;
|
|
23
|
+
globalSchemaPath?: string;
|
|
23
24
|
}
|
|
24
25
|
interface CodegenConfig {
|
|
25
26
|
defaultEntPolicy?: PrivacyConfig;
|
|
@@ -35,7 +36,8 @@ interface CodegenConfig {
|
|
|
35
36
|
schemaSQLFilePath?: boolean;
|
|
36
37
|
databaseToCompareTo?: string;
|
|
37
38
|
fieldPrivacyEvaluated?: fieldPrivacyEvaluated;
|
|
38
|
-
templatizedViewer?:
|
|
39
|
+
templatizedViewer?: importedObject;
|
|
40
|
+
customAssocEdgePath?: importedObject;
|
|
39
41
|
}
|
|
40
42
|
interface PrettierConfig {
|
|
41
43
|
custom?: boolean;
|
|
@@ -46,9 +48,10 @@ interface PrivacyConfig {
|
|
|
46
48
|
policyName: string;
|
|
47
49
|
class?: boolean;
|
|
48
50
|
}
|
|
49
|
-
interface
|
|
51
|
+
interface importedObject {
|
|
50
52
|
path: string;
|
|
51
53
|
name: string;
|
|
54
|
+
alias?: string;
|
|
52
55
|
}
|
|
53
56
|
export declare function loadConfig(file?: string | Buffer | Config): void;
|
|
54
57
|
export {};
|
package/core/ent.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Executor } from "../action/action";
|
|
|
4
4
|
import * as clause from "./clause";
|
|
5
5
|
import { Builder } from "../action";
|
|
6
6
|
import DataLoader from "dataloader";
|
|
7
|
+
import { GlobalSchema } from "../schema/";
|
|
7
8
|
export declare function loadEnt<TEnt extends Ent<TViewer>, TViewer extends Viewer>(viewer: TViewer, id: ID, options: LoadEntOptions<TEnt, TViewer>): Promise<TEnt | null>;
|
|
8
9
|
export declare function loadEntViaKey<TEnt extends Ent<TViewer>, TViewer extends Viewer>(viewer: TViewer, key: any, options: LoadEntOptions<TEnt, TViewer>): Promise<TEnt | null>;
|
|
9
10
|
export declare function loadEntX<TEnt extends Ent<TViewer>, TViewer extends Viewer>(viewer: TViewer, id: ID, options: LoadEntOptions<TEnt, TViewer>): Promise<TEnt>;
|
|
@@ -52,6 +53,7 @@ export interface EditNodeOptions<T extends Ent> extends EditRowOptions {
|
|
|
52
53
|
fieldsToResolve: string[];
|
|
53
54
|
loadEntOptions: LoadEntOptions<T>;
|
|
54
55
|
placeholderID?: ID;
|
|
56
|
+
key: string;
|
|
55
57
|
}
|
|
56
58
|
export declare class EditNodeOperation<T extends Ent> implements DataOperation {
|
|
57
59
|
options: EditNodeOptions<T>;
|
|
@@ -67,7 +69,11 @@ export declare class EditNodeOperation<T extends Ent> implements DataOperation {
|
|
|
67
69
|
returnedRow(): Data | null;
|
|
68
70
|
createdEnt(viewer: Viewer): T | null;
|
|
69
71
|
}
|
|
72
|
+
export declare function setGlobalSchema(val: GlobalSchema): void;
|
|
73
|
+
export declare function clearGlobalSchema(): void;
|
|
74
|
+
export declare function __hasGlobalSchema(): boolean;
|
|
70
75
|
export declare class EdgeOperation implements DataOperation {
|
|
76
|
+
private builder;
|
|
71
77
|
edgeInput: AssocEdgeInput;
|
|
72
78
|
private options;
|
|
73
79
|
private edgeData;
|
|
@@ -96,9 +102,9 @@ export declare class EdgeOperation implements DataOperation {
|
|
|
96
102
|
export declare function buildInsertQuery(options: CreateRowOptions, suffix?: string): [string, string[], string[]];
|
|
97
103
|
export declare function createRow(queryer: Queryer, options: CreateRowOptions, suffix: string): Promise<Data | null>;
|
|
98
104
|
export declare function createRowSync(queryer: SyncQueryer, options: CreateRowOptions, suffix: string): Data | null;
|
|
99
|
-
export declare function buildUpdateQuery(options: EditRowOptions,
|
|
100
|
-
export declare function editRow(queryer: Queryer, options: EditRowOptions,
|
|
101
|
-
export declare function editRowSync(queryer: SyncQueryer, options: EditRowOptions,
|
|
105
|
+
export declare function buildUpdateQuery(options: EditRowOptions, suffix?: string): [string, any[], any[]];
|
|
106
|
+
export declare function editRow(queryer: Queryer, options: EditRowOptions, suffix?: string): Promise<Data | null>;
|
|
107
|
+
export declare function editRowSync(queryer: SyncQueryer, options: EditRowOptions, suffix?: string): Data | null;
|
|
102
108
|
export declare function deleteRows(queryer: Queryer, options: DataOptions, cls: clause.Clause): Promise<void>;
|
|
103
109
|
export declare function deleteRowsSync(queryer: SyncQueryer, options: DataOptions, cls: clause.Clause): void;
|
|
104
110
|
export declare class DeleteNodeOperation implements DataOperation {
|
|
@@ -116,7 +122,9 @@ export declare class AssocEdge {
|
|
|
116
122
|
id2Type: string;
|
|
117
123
|
time: Date;
|
|
118
124
|
data?: string | null;
|
|
125
|
+
private rawData;
|
|
119
126
|
constructor(data: Data);
|
|
127
|
+
__getRawData(): Data;
|
|
120
128
|
getCursor(): string;
|
|
121
129
|
}
|
|
122
130
|
interface cursorOptions {
|
|
@@ -156,6 +164,7 @@ interface loadEdgesOptions {
|
|
|
156
164
|
edgeType: string;
|
|
157
165
|
context?: Context;
|
|
158
166
|
queryOptions?: EdgeQueryableDataOptions;
|
|
167
|
+
disableTransformations?: boolean;
|
|
159
168
|
}
|
|
160
169
|
interface loadCustomEdgesOptions<T extends AssocEdge> extends loadEdgesOptions {
|
|
161
170
|
ctr: AssocEdgeConstructor<T>;
|
|
@@ -163,6 +172,10 @@ interface loadCustomEdgesOptions<T extends AssocEdge> extends loadEdgesOptions {
|
|
|
163
172
|
export declare const DefaultLimit = 1000;
|
|
164
173
|
export declare function defaultEdgeQueryOptions(id1: ID, edgeType: string): EdgeQueryableDataOptions;
|
|
165
174
|
export declare function loadEdges(options: loadEdgesOptions): Promise<AssocEdge[]>;
|
|
175
|
+
export declare function getEdgeClauseAndFields(cls: clause.Clause, options: loadEdgesOptions): {
|
|
176
|
+
cls: clause.Clause;
|
|
177
|
+
fields: string[];
|
|
178
|
+
};
|
|
166
179
|
export declare function loadCustomEdges<T extends AssocEdge>(options: loadCustomEdgesOptions<T>): Promise<T[]>;
|
|
167
180
|
export declare function loadUniqueEdge(options: loadEdgesOptions): Promise<AssocEdge | null>;
|
|
168
181
|
export declare function loadUniqueNode<TEnt extends Ent<TViewer>, TViewer extends Viewer>(viewer: TViewer, id1: ID, edgeType: string, options: LoadEntOptions<TEnt, TViewer>): Promise<TEnt | null>;
|