@snowtop/ent 0.1.0-alpha13 → 0.1.0-alpha131
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/action.d.ts +33 -29
- package/action/action.js +22 -7
- package/action/executor.d.ts +3 -3
- package/action/executor.js +8 -3
- package/action/experimental_action.d.ts +32 -22
- package/action/experimental_action.js +35 -9
- package/action/index.d.ts +2 -0
- package/action/index.js +7 -1
- package/action/orchestrator.d.ts +32 -15
- package/action/orchestrator.js +249 -53
- package/action/privacy.d.ts +2 -2
- package/action/relative_value.d.ts +47 -0
- package/action/relative_value.js +125 -0
- package/action/transaction.d.ts +10 -0
- package/action/transaction.js +23 -0
- package/auth/auth.d.ts +1 -1
- package/core/base.d.ts +61 -37
- package/core/base.js +7 -1
- package/core/clause.d.ts +85 -40
- package/core/clause.js +375 -64
- package/core/config.d.ts +12 -1
- package/core/config.js +7 -1
- package/core/const.d.ts +3 -0
- package/core/const.js +6 -0
- package/core/context.d.ts +6 -4
- package/core/context.js +20 -2
- package/core/convert.d.ts +1 -1
- package/core/date.js +1 -5
- package/core/db.d.ts +11 -8
- package/core/db.js +20 -8
- package/core/ent.d.ts +86 -30
- package/core/ent.js +626 -197
- package/core/global_schema.d.ts +7 -0
- package/core/global_schema.js +51 -0
- package/core/loaders/assoc_count_loader.d.ts +3 -2
- package/core/loaders/assoc_count_loader.js +10 -2
- package/core/loaders/assoc_edge_loader.d.ts +2 -2
- package/core/loaders/assoc_edge_loader.js +8 -11
- package/core/loaders/index.d.ts +1 -1
- package/core/loaders/index.js +1 -3
- package/core/loaders/index_loader.d.ts +3 -3
- package/core/loaders/loader.d.ts +2 -2
- package/core/loaders/loader.js +5 -5
- package/core/loaders/object_loader.d.ts +32 -11
- package/core/loaders/object_loader.js +225 -78
- package/core/loaders/query_loader.d.ts +7 -13
- package/core/loaders/query_loader.js +52 -11
- package/core/loaders/raw_count_loader.d.ts +2 -2
- package/core/loaders/raw_count_loader.js +5 -1
- package/core/logger.d.ts +1 -1
- package/core/logger.js +1 -0
- package/core/privacy.d.ts +25 -24
- package/core/privacy.js +21 -25
- package/core/query/assoc_query.d.ts +7 -6
- package/core/query/assoc_query.js +9 -1
- package/core/query/custom_clause_query.d.ts +27 -0
- package/core/query/custom_clause_query.js +84 -0
- package/core/query/custom_query.d.ts +20 -5
- package/core/query/custom_query.js +87 -12
- package/core/query/index.d.ts +1 -0
- package/core/query/index.js +3 -1
- package/core/query/query.d.ts +8 -4
- package/core/query/query.js +101 -53
- package/core/query/shared_assoc_test.d.ts +2 -1
- package/core/query/shared_assoc_test.js +35 -45
- package/core/query/shared_test.d.ts +8 -1
- package/core/query/shared_test.js +470 -236
- package/core/viewer.d.ts +3 -3
- package/core/viewer.js +1 -1
- package/graphql/graphql.d.ts +51 -19
- package/graphql/graphql.js +160 -136
- package/graphql/graphql_field_helpers.d.ts +7 -1
- package/graphql/graphql_field_helpers.js +21 -1
- package/graphql/index.d.ts +2 -2
- package/graphql/index.js +3 -5
- package/graphql/query/connection_type.d.ts +9 -9
- package/graphql/query/edge_connection.d.ts +9 -9
- package/graphql/query/page_info.d.ts +1 -1
- package/graphql/query/shared_assoc_test.js +1 -1
- package/graphql/query/shared_edge_connection.js +1 -19
- package/graphql/scalars/orderby_direction.d.ts +2 -0
- package/graphql/scalars/orderby_direction.js +15 -0
- package/imports/dataz/example1/_auth.js +128 -47
- package/imports/dataz/example1/_viewer.js +87 -39
- package/imports/index.d.ts +6 -1
- package/imports/index.js +19 -4
- package/index.d.ts +13 -5
- package/index.js +21 -7
- package/package.json +17 -17
- package/parse_schema/parse.d.ts +31 -9
- package/parse_schema/parse.js +155 -13
- package/schema/base_schema.d.ts +7 -3
- package/schema/base_schema.js +10 -0
- package/schema/field.d.ts +78 -21
- package/schema/field.js +231 -71
- package/schema/index.d.ts +2 -2
- package/schema/index.js +5 -1
- package/schema/json_field.d.ts +16 -4
- package/schema/json_field.js +32 -2
- package/schema/schema.d.ts +89 -19
- package/schema/schema.js +11 -13
- package/schema/struct_field.d.ts +15 -3
- package/schema/struct_field.js +117 -22
- package/schema/union_field.d.ts +1 -1
- package/scripts/custom_compiler.js +10 -6
- package/scripts/custom_graphql.js +128 -31
- package/scripts/migrate_v0.1.js +36 -0
- package/scripts/move_types.js +120 -0
- package/scripts/read_schema.js +20 -5
- package/testutils/action/complex_schemas.d.ts +69 -0
- package/testutils/action/complex_schemas.js +398 -0
- package/testutils/builder.d.ts +41 -47
- package/testutils/builder.js +76 -49
- package/testutils/db/fixture.d.ts +10 -0
- package/testutils/db/fixture.js +26 -0
- package/testutils/db/{test_db.d.ts → temp_db.d.ts} +24 -8
- package/testutils/db/{test_db.js → temp_db.js} +182 -45
- package/testutils/db/value.d.ts +7 -0
- package/testutils/db/value.js +251 -0
- package/testutils/db_mock.d.ts +16 -4
- package/testutils/db_mock.js +52 -7
- package/testutils/db_time_zone.d.ts +4 -0
- package/testutils/db_time_zone.js +41 -0
- package/testutils/ent-graphql-tests/index.d.ts +7 -1
- package/testutils/ent-graphql-tests/index.js +52 -23
- package/testutils/fake_comms.js +1 -1
- package/testutils/fake_data/const.d.ts +2 -1
- package/testutils/fake_data/const.js +3 -0
- package/testutils/fake_data/fake_contact.d.ts +7 -3
- package/testutils/fake_data/fake_contact.js +13 -7
- package/testutils/fake_data/fake_event.d.ts +4 -1
- package/testutils/fake_data/fake_event.js +7 -6
- package/testutils/fake_data/fake_tag.d.ts +36 -0
- package/testutils/fake_data/fake_tag.js +89 -0
- package/testutils/fake_data/fake_user.d.ts +8 -5
- package/testutils/fake_data/fake_user.js +16 -15
- package/testutils/fake_data/index.js +5 -1
- package/testutils/fake_data/internal.d.ts +2 -0
- package/testutils/fake_data/internal.js +7 -1
- package/testutils/fake_data/tag_query.d.ts +13 -0
- package/testutils/fake_data/tag_query.js +43 -0
- package/testutils/fake_data/test_helpers.d.ts +11 -4
- package/testutils/fake_data/test_helpers.js +28 -12
- package/testutils/fake_data/user_query.d.ts +13 -6
- package/testutils/fake_data/user_query.js +54 -22
- package/testutils/fake_log.d.ts +3 -3
- package/testutils/fake_log.js +1 -1
- package/testutils/parse_sql.d.ts +6 -0
- package/testutils/parse_sql.js +16 -2
- package/testutils/test_edge_global_schema.d.ts +15 -0
- package/testutils/test_edge_global_schema.js +62 -0
- package/testutils/write.d.ts +2 -2
- package/testutils/write.js +33 -7
- package/tsc/ast.d.ts +25 -2
- package/tsc/ast.js +141 -17
- package/tsc/compilerOptions.js +5 -1
- package/tsc/move_generated.d.ts +1 -0
- package/tsc/move_generated.js +164 -0
- package/tsc/transform.d.ts +22 -0
- package/tsc/transform.js +181 -0
- package/tsc/transform_action.d.ts +22 -0
- package/tsc/transform_action.js +183 -0
- package/tsc/transform_ent.d.ts +17 -0
- package/tsc/transform_ent.js +60 -0
- package/tsc/transform_schema.d.ts +27 -0
- package/{scripts → tsc}/transform_schema.js +146 -117
- package/graphql/enums.d.ts +0 -3
- package/graphql/enums.js +0 -25
- package/scripts/move_generated.js +0 -142
- package/scripts/transform_code.js +0 -113
- package/scripts/transform_schema.d.ts +0 -1
- /package/scripts/{move_generated.d.ts → migrate_v0.1.d.ts} +0 -0
- /package/scripts/{transform_code.d.ts → move_types.d.ts} +0 -0
package/imports/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -34,7 +38,11 @@ function getFiles(filePath, opts) {
|
|
|
34
38
|
}
|
|
35
39
|
// graphql path should be passed to this
|
|
36
40
|
// this is more agnostic about what it expect here
|
|
37
|
-
let
|
|
41
|
+
let pattern = `${filePath}/**/*.ts`;
|
|
42
|
+
if (opts?.justCurrentDir) {
|
|
43
|
+
pattern = `${filePath}/**.ts`;
|
|
44
|
+
}
|
|
45
|
+
let files = glob_1.default.sync(pattern, {
|
|
38
46
|
ignore: opts?.ignore,
|
|
39
47
|
});
|
|
40
48
|
if (opts?.filter) {
|
|
@@ -42,8 +50,15 @@ function getFiles(filePath, opts) {
|
|
|
42
50
|
}
|
|
43
51
|
return files;
|
|
44
52
|
}
|
|
45
|
-
function parseCustomImports(filePath,
|
|
46
|
-
const files =
|
|
53
|
+
function parseCustomImports(filePath, inputs) {
|
|
54
|
+
const files = [];
|
|
55
|
+
// simplifies tests and other simple callsites
|
|
56
|
+
if (inputs.length === 0) {
|
|
57
|
+
inputs.push({ root: filePath });
|
|
58
|
+
}
|
|
59
|
+
for (const input of inputs) {
|
|
60
|
+
files.push(...getFiles(input.root, input.opts));
|
|
61
|
+
}
|
|
47
62
|
const options = (0, compilerOptions_1.readCompilerOptions)(filePath);
|
|
48
63
|
let classMap = new Map();
|
|
49
64
|
files.forEach((file) => {
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./core/base";
|
|
2
|
-
export { loadEnt, loadCustomData, loadCustomEnts, loadEntX, loadEnts, CustomQuery, loadDerivedEnt, loadDerivedEntX, loadEntViaKey, loadEntXViaKey, performRawQuery, loadRowX, loadRow, loadRows, DataOperation, EditNodeOptions, EditNodeOperation, EdgeOperation, DeleteNodeOperation, AssocEdge, AssocEdgeInputOptions, AssocEdgeInput, AssocEdgeData, loadEdgeData, loadEdgeDatas, loadEdges, loadUniqueEdge, loadUniqueNode, loadRawEdgeCountX, loadEdgeForID2, loadNodesByEdge, getEdgeTypeInGroup, } from "./core/ent";
|
|
2
|
+
export { loadEnt, loadCustomData, loadCustomEnts, loadCustomCount, loadEntX, loadEnts, CustomQuery, loadDerivedEnt, loadDerivedEntX, loadEntViaKey, loadEntXViaKey, performRawQuery, loadRowX, loadRow, loadRows, DataOperation, EditNodeOptions, EditNodeOperation, RawQueryOperation, EdgeOperation, DeleteNodeOperation, AssocEdge, AssocEdgeInputOptions, AssocEdgeInput, AssocEdgeData, loadEdgeData, loadEdgeDatas, loadEdges, loadUniqueEdge, loadUniqueNode, loadRawEdgeCountX, loadEdgeForID2, loadNodesByEdge, getEdgeTypeInGroup, } from "./core/ent";
|
|
3
|
+
export { setGlobalSchema } from "./core/global_schema";
|
|
3
4
|
import DB from "./core/db";
|
|
4
5
|
export * from "./core/loaders";
|
|
5
6
|
export { DB };
|
|
@@ -7,12 +8,14 @@ export { EntPrivacyError, AlwaysAllowRule, AlwaysDenyRule, DenyIfLoggedInRule, D
|
|
|
7
8
|
export * from "./core/query";
|
|
8
9
|
export * from "./schema/";
|
|
9
10
|
import * as q from "./core/clause";
|
|
11
|
+
export { Clause } from "./core/clause";
|
|
10
12
|
declare const query: {
|
|
11
13
|
Eq: typeof q.Eq;
|
|
12
14
|
NotEq: typeof q.NotEq;
|
|
13
15
|
And: typeof q.And;
|
|
14
16
|
AndOptional: typeof q.AndOptional;
|
|
15
17
|
Or: typeof q.Or;
|
|
18
|
+
OrOptional: typeof q.OrOptional;
|
|
16
19
|
In: typeof q.In;
|
|
17
20
|
Greater: typeof q.Greater;
|
|
18
21
|
Less: typeof q.Less;
|
|
@@ -20,10 +23,15 @@ declare const query: {
|
|
|
20
23
|
LessEq: typeof q.LessEq;
|
|
21
24
|
ArrayEq: typeof q.ArrayEq;
|
|
22
25
|
ArrayNotEq: typeof q.ArrayNotEq;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
PostgresArrayContainsValue: typeof q.PostgresArrayContainsValue;
|
|
27
|
+
PostgresArrayContains: typeof q.PostgresArrayContains;
|
|
28
|
+
PostgresArrayNotContainsValue: typeof q.PostgresArrayNotContainsValue;
|
|
29
|
+
PostgresArrayNotContains: typeof q.PostgresArrayNotContains;
|
|
30
|
+
PostgresArrayOverlaps: typeof q.PostgresArrayOverlaps;
|
|
31
|
+
PostgresArrayNotOverlaps: typeof q.PostgresArrayNotOverlaps;
|
|
32
|
+
JSONPathValuePredicate: typeof q.JSONPathValuePredicate;
|
|
33
|
+
JSONObjectFieldKeyASJSON: typeof q.JSONObjectFieldKeyASJSON;
|
|
34
|
+
JSONObjectFieldKeyAsText: typeof q.JSONObjectFieldKeyAsText;
|
|
27
35
|
TsQuery: typeof q.TsQuery;
|
|
28
36
|
PlainToTsQuery: typeof q.PlainToTsQuery;
|
|
29
37
|
PhraseToTsQuery: typeof q.PhraseToTsQuery;
|
package/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -25,13 +29,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
30
|
};
|
|
27
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.
|
|
29
|
-
exports.setLogLevels = exports.loadConfig = exports.LoggedOutViewer = exports.IDViewer = exports.ContextCache = exports.query = exports.AllowIfViewerHasIdentityPrivacyPolicy = exports.AllowIfViewerPrivacyPolicy = exports.AllowIfSubPolicyAllowsRule = exports.AllowIfConditionAppliesRule = exports.AlwaysDenyPrivacyPolicy = exports.AlwaysAllowPrivacyPolicy = exports.applyPrivacyPolicyX = exports.applyPrivacyPolicy = exports.DelayedResultRule = exports.DenyIfEntIsVisiblePolicy = exports.AllowIfEntIsVisiblePolicy = exports.DenyIfEntIsNotVisibleRule = exports.DenyIfEntIsVisibleRule = exports.AllowIfEntIsNotVisibleRule = exports.AllowIfEntIsVisibleRule = exports.DenyIfViewerOutboundEdgeDoesNotExistRule = void 0;
|
|
32
|
+
exports.DenyIfViewerInboundEdgeExistsRule = exports.DenyIfEdgeExistsRule = exports.AllowIfViewerOutboundEdgeExistsRule = exports.AllowIfViewerInboundEdgeExistsRule = exports.AllowIfEdgeExistsRule = exports.DenyIfViewerEqualsRule = exports.AllowIfViewerEqualsRule = exports.DenyIfEntPropertyIsRule = exports.AllowIfEntPropertyIsRule = exports.AllowIfViewerIsEntPropertyRule = exports.AllowIfViewerIsRule = exports.AllowIfFuncRule = exports.AllowIfViewerRule = exports.AllowIfHasIdentity = exports.DenyIfLoggedOutRule = exports.DenyIfLoggedInRule = exports.AlwaysDenyRule = exports.AlwaysAllowRule = exports.EntPrivacyError = exports.DB = exports.setGlobalSchema = exports.getEdgeTypeInGroup = exports.loadNodesByEdge = exports.loadEdgeForID2 = exports.loadRawEdgeCountX = exports.loadUniqueNode = exports.loadUniqueEdge = exports.loadEdges = exports.loadEdgeDatas = exports.loadEdgeData = exports.AssocEdgeData = exports.AssocEdge = exports.DeleteNodeOperation = exports.EdgeOperation = exports.RawQueryOperation = exports.EditNodeOperation = exports.loadRows = exports.loadRow = exports.loadRowX = exports.performRawQuery = exports.loadEntXViaKey = exports.loadEntViaKey = exports.loadDerivedEntX = exports.loadDerivedEnt = exports.loadEnts = exports.loadEntX = exports.loadCustomCount = exports.loadCustomEnts = exports.loadCustomData = exports.loadEnt = void 0;
|
|
33
|
+
exports.setLogLevels = exports.loadConfig = exports.LoggedOutViewer = exports.IDViewer = exports.ContextCache = exports.query = exports.AllowIfViewerHasIdentityPrivacyPolicy = exports.AllowIfViewerPrivacyPolicy = exports.AllowIfSubPolicyAllowsRule = exports.AllowIfConditionAppliesRule = exports.AlwaysDenyPrivacyPolicy = exports.AlwaysAllowPrivacyPolicy = exports.applyPrivacyPolicyX = exports.applyPrivacyPolicy = exports.DelayedResultRule = exports.DenyIfEntIsVisiblePolicy = exports.AllowIfEntIsVisiblePolicy = exports.DenyIfEntIsNotVisibleRule = exports.DenyIfEntIsVisibleRule = exports.AllowIfEntIsNotVisibleRule = exports.AllowIfEntIsVisibleRule = exports.DenyIfViewerOutboundEdgeDoesNotExistRule = exports.DenyIfViewerInboundEdgeDoesNotExistRule = exports.DenyIfEdgeDoesNotExistRule = exports.DenyIfViewerOutboundEdgeExistsRule = void 0;
|
|
30
34
|
__exportStar(require("./core/base"), exports);
|
|
31
35
|
var ent_1 = require("./core/ent");
|
|
32
36
|
Object.defineProperty(exports, "loadEnt", { enumerable: true, get: function () { return ent_1.loadEnt; } });
|
|
33
37
|
Object.defineProperty(exports, "loadCustomData", { enumerable: true, get: function () { return ent_1.loadCustomData; } });
|
|
34
38
|
Object.defineProperty(exports, "loadCustomEnts", { enumerable: true, get: function () { return ent_1.loadCustomEnts; } });
|
|
39
|
+
Object.defineProperty(exports, "loadCustomCount", { enumerable: true, get: function () { return ent_1.loadCustomCount; } });
|
|
35
40
|
Object.defineProperty(exports, "loadEntX", { enumerable: true, get: function () { return ent_1.loadEntX; } });
|
|
36
41
|
Object.defineProperty(exports, "loadEnts", { enumerable: true, get: function () { return ent_1.loadEnts; } });
|
|
37
42
|
Object.defineProperty(exports, "loadDerivedEnt", { enumerable: true, get: function () { return ent_1.loadDerivedEnt; } });
|
|
@@ -44,6 +49,7 @@ Object.defineProperty(exports, "loadRowX", { enumerable: true, get: function ()
|
|
|
44
49
|
Object.defineProperty(exports, "loadRow", { enumerable: true, get: function () { return ent_1.loadRow; } });
|
|
45
50
|
Object.defineProperty(exports, "loadRows", { enumerable: true, get: function () { return ent_1.loadRows; } });
|
|
46
51
|
Object.defineProperty(exports, "EditNodeOperation", { enumerable: true, get: function () { return ent_1.EditNodeOperation; } });
|
|
52
|
+
Object.defineProperty(exports, "RawQueryOperation", { enumerable: true, get: function () { return ent_1.RawQueryOperation; } });
|
|
47
53
|
Object.defineProperty(exports, "EdgeOperation", { enumerable: true, get: function () { return ent_1.EdgeOperation; } });
|
|
48
54
|
Object.defineProperty(exports, "DeleteNodeOperation", { enumerable: true, get: function () { return ent_1.DeleteNodeOperation; } });
|
|
49
55
|
Object.defineProperty(exports, "AssocEdge", { enumerable: true, get: function () { return ent_1.AssocEdge; } });
|
|
@@ -57,6 +63,8 @@ Object.defineProperty(exports, "loadRawEdgeCountX", { enumerable: true, get: fun
|
|
|
57
63
|
Object.defineProperty(exports, "loadEdgeForID2", { enumerable: true, get: function () { return ent_1.loadEdgeForID2; } });
|
|
58
64
|
Object.defineProperty(exports, "loadNodesByEdge", { enumerable: true, get: function () { return ent_1.loadNodesByEdge; } });
|
|
59
65
|
Object.defineProperty(exports, "getEdgeTypeInGroup", { enumerable: true, get: function () { return ent_1.getEdgeTypeInGroup; } });
|
|
66
|
+
var global_schema_1 = require("./core/global_schema");
|
|
67
|
+
Object.defineProperty(exports, "setGlobalSchema", { enumerable: true, get: function () { return global_schema_1.setGlobalSchema; } });
|
|
60
68
|
const db_1 = __importDefault(require("./core/db"));
|
|
61
69
|
exports.DB = db_1.default;
|
|
62
70
|
__exportStar(require("./core/loaders"), exports);
|
|
@@ -109,6 +117,7 @@ const query = {
|
|
|
109
117
|
And: q.And,
|
|
110
118
|
AndOptional: q.AndOptional,
|
|
111
119
|
Or: q.Or,
|
|
120
|
+
OrOptional: q.OrOptional,
|
|
112
121
|
In: q.In,
|
|
113
122
|
Greater: q.Greater,
|
|
114
123
|
Less: q.Less,
|
|
@@ -116,10 +125,15 @@ const query = {
|
|
|
116
125
|
LessEq: q.LessEq,
|
|
117
126
|
ArrayEq: q.ArrayEq,
|
|
118
127
|
ArrayNotEq: q.ArrayNotEq,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
128
|
+
PostgresArrayContainsValue: q.PostgresArrayContainsValue,
|
|
129
|
+
PostgresArrayContains: q.PostgresArrayContains,
|
|
130
|
+
PostgresArrayNotContainsValue: q.PostgresArrayNotContainsValue,
|
|
131
|
+
PostgresArrayNotContains: q.PostgresArrayNotContains,
|
|
132
|
+
PostgresArrayOverlaps: q.PostgresArrayOverlaps,
|
|
133
|
+
PostgresArrayNotOverlaps: q.PostgresArrayNotOverlaps,
|
|
134
|
+
JSONPathValuePredicate: q.JSONPathValuePredicate,
|
|
135
|
+
JSONObjectFieldKeyASJSON: q.JSONObjectFieldKeyASJSON,
|
|
136
|
+
JSONObjectFieldKeyAsText: q.JSONObjectFieldKeyAsText,
|
|
123
137
|
TsQuery: q.TsQuery,
|
|
124
138
|
PlainToTsQuery: q.PlainToTsQuery,
|
|
125
139
|
PhraseToTsQuery: q.PhraseToTsQuery,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowtop/ent",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-alpha131",
|
|
4
4
|
"description": "snowtop ent framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -8,26 +8,26 @@
|
|
|
8
8
|
"example": "examples"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@types/node": "^
|
|
11
|
+
"@types/node": "^18.11.18",
|
|
12
12
|
"camel-case": "^4.1.2",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
13
|
+
"cosmiconfig": "^8.0.0",
|
|
14
|
+
"dataloader": "^2.1.0",
|
|
15
|
+
"glob": "^8.0.3",
|
|
16
|
+
"graph-data-structure": "^2.0.0",
|
|
16
17
|
"js-yaml": "^4.1.0",
|
|
17
|
-
"json5": "^2.
|
|
18
|
-
"luxon": "^1.
|
|
18
|
+
"json5": "^2.2.2",
|
|
19
|
+
"luxon": "^3.1.1",
|
|
19
20
|
"memoizee": "^0.4.15",
|
|
20
|
-
"minimist": "^1.2.
|
|
21
|
+
"minimist": "^1.2.7",
|
|
21
22
|
"pascal-case": "^3.1.2",
|
|
22
|
-
"pg": "^8.0
|
|
23
|
-
"prettier": "^2.
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"uuid": "^8.3.2"
|
|
23
|
+
"pg": "^8.8.0",
|
|
24
|
+
"prettier": "^2.8.1",
|
|
25
|
+
"snake-case": "^3.0.4",
|
|
26
|
+
"ts-node": "^10.9.1",
|
|
27
|
+
"tsconfig-paths": "^4.2.0",
|
|
28
|
+
"tslib": "^2.5.0",
|
|
29
|
+
"typescript": "^5.0.4",
|
|
30
|
+
"uuid": "^9.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"better-sqlite3": "^7.4.1",
|
package/parse_schema/parse.d.ts
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
import { Schema, Field, AssocEdge, AssocEdgeGroup, Action } from "../schema";
|
|
2
|
-
import { ActionField, Type } from "../schema/schema";
|
|
2
|
+
import { ActionField, Type, GlobalSchema, TransformReadBetaResult } from "../schema/schema";
|
|
3
3
|
declare enum NullableResult {
|
|
4
4
|
CONTENTS = "contents",
|
|
5
5
|
CONTENTS_AND_LIST = "contentsAndList",
|
|
6
6
|
ITEM = "true"
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
type ProcessedActionField = Omit<ActionField, "nullable"> & {
|
|
9
9
|
nullable?: NullableResult;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type ProcessedAssocEdge = Omit<AssocEdge, "actionOnlyFields" | "edgeActions"> & {
|
|
12
12
|
patternName?: string;
|
|
13
13
|
edgeActions?: OutputAction[];
|
|
14
14
|
};
|
|
15
15
|
interface TransformFlags {
|
|
16
16
|
transformsSelect?: boolean;
|
|
17
17
|
transformsDelete?: boolean;
|
|
18
|
+
transformsLoaderCodegen?: TransformReadBetaResult;
|
|
18
19
|
transformsInsert?: boolean;
|
|
19
20
|
transformsUpdate?: boolean;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
type ProcessedSchema = Omit<Schema, "edges" | "actions" | "edgeGroups" | "fields"> & TransformFlags & {
|
|
22
23
|
actions: OutputAction[];
|
|
23
24
|
assocEdges: ProcessedAssocEdge[];
|
|
24
25
|
assocEdgeGroups: ProcessedAssocEdgeGroup[];
|
|
25
26
|
fields: ProcessedField[];
|
|
26
27
|
schemaPath?: string;
|
|
28
|
+
patternNames?: string[];
|
|
27
29
|
};
|
|
28
|
-
|
|
30
|
+
type ProcessedAssocEdgeGroup = Omit<AssocEdgeGroup, "edgeAction"> & {
|
|
29
31
|
edgeAction?: OutputAction;
|
|
30
32
|
};
|
|
31
|
-
|
|
33
|
+
type OutputAction = Omit<Action, "actionOnlyFields"> & {
|
|
32
34
|
actionOnlyFields?: ProcessedActionField[];
|
|
33
35
|
};
|
|
34
36
|
interface schemasDict {
|
|
@@ -38,13 +40,14 @@ interface ProcessedPattern {
|
|
|
38
40
|
name: string;
|
|
39
41
|
assocEdges: ProcessedAssocEdge[];
|
|
40
42
|
fields: ProcessedField[];
|
|
43
|
+
disableMixin?: boolean;
|
|
41
44
|
}
|
|
42
|
-
|
|
45
|
+
type ProcessedType = Omit<Type, "subFields" | "listElemType" | "unionFields"> & {
|
|
43
46
|
subFields?: ProcessedField[];
|
|
44
47
|
listElemType?: ProcessedType;
|
|
45
48
|
unionFields?: ProcessedField[];
|
|
46
49
|
};
|
|
47
|
-
|
|
50
|
+
type ProcessedField = Omit<Field, "defaultValueOnEdit" | "defaultValueOnCreate" | "privacyPolicy" | "type" | "serverDefault"> & {
|
|
48
51
|
name: string;
|
|
49
52
|
hasDefaultValueOnCreate?: boolean;
|
|
50
53
|
hasDefaultValueOnEdit?: boolean;
|
|
@@ -52,6 +55,7 @@ declare type ProcessedField = Omit<Field, "defaultValueOnEdit" | "defaultValueOn
|
|
|
52
55
|
hasFieldPrivacy?: boolean;
|
|
53
56
|
derivedFields?: ProcessedField[];
|
|
54
57
|
type: ProcessedType;
|
|
58
|
+
serverDefault?: string;
|
|
55
59
|
};
|
|
56
60
|
interface patternsDict {
|
|
57
61
|
[key: string]: ProcessedPattern;
|
|
@@ -59,9 +63,27 @@ interface patternsDict {
|
|
|
59
63
|
interface Result {
|
|
60
64
|
schemas: schemasDict;
|
|
61
65
|
patterns: patternsDict;
|
|
66
|
+
globalSchema?: ProcessedGlobalSchema;
|
|
67
|
+
config?: {
|
|
68
|
+
rome?: RomeConfig;
|
|
69
|
+
};
|
|
62
70
|
}
|
|
63
71
|
declare type PotentialSchemas = {
|
|
64
72
|
[key: string]: any;
|
|
65
73
|
};
|
|
66
|
-
export declare function parseSchema(potentialSchemas: PotentialSchemas): Result
|
|
74
|
+
export declare function parseSchema(potentialSchemas: PotentialSchemas, globalSchema?: GlobalSchema): Promise<Result>;
|
|
75
|
+
interface RomeConfig {
|
|
76
|
+
indentStyle?: string;
|
|
77
|
+
lineWidth?: number;
|
|
78
|
+
indentSize?: number;
|
|
79
|
+
quoteStyle?: string;
|
|
80
|
+
quoteProperties?: string;
|
|
81
|
+
trailingComma?: string;
|
|
82
|
+
}
|
|
83
|
+
interface ProcessedGlobalSchema {
|
|
84
|
+
globalEdges: ProcessedAssocEdge[];
|
|
85
|
+
extraEdgeFields: ProcessedField[];
|
|
86
|
+
init?: boolean;
|
|
87
|
+
globalFields?: ProcessedField[];
|
|
88
|
+
}
|
|
67
89
|
export {};
|
package/parse_schema/parse.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseSchema = void 0;
|
|
4
|
-
|
|
4
|
+
const cosmiconfig_1 = require("cosmiconfig");
|
|
5
|
+
const const_1 = require("../core/const");
|
|
6
|
+
const global_schema_1 = require("../core/global_schema");
|
|
7
|
+
async function processFields(src, patternName) {
|
|
5
8
|
const ret = [];
|
|
6
9
|
let m = {};
|
|
7
10
|
if (Array.isArray(src)) {
|
|
@@ -19,7 +22,7 @@ function processFields(src, patternName) {
|
|
|
19
22
|
for (const name in m) {
|
|
20
23
|
const field = m[name];
|
|
21
24
|
//@ts-ignore type and other changed fields with different type in ProcessedField vs Field
|
|
22
|
-
let f = {
|
|
25
|
+
let f = { ...field, name };
|
|
23
26
|
f.hasDefaultValueOnCreate = field.defaultValueOnCreate != undefined;
|
|
24
27
|
f.hasDefaultValueOnEdit = field.defaultValueOnEdit != undefined;
|
|
25
28
|
f.hasFieldPrivacy = field.privacyPolicy !== undefined;
|
|
@@ -36,6 +39,19 @@ function processFields(src, patternName) {
|
|
|
36
39
|
else {
|
|
37
40
|
delete f.polymorphic;
|
|
38
41
|
}
|
|
42
|
+
if (field.private) {
|
|
43
|
+
// convert boolean into object
|
|
44
|
+
// we keep boolean as an option to keep API simple
|
|
45
|
+
if (typeof field.private === "boolean") {
|
|
46
|
+
f.private = {};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
f.private = field.private;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
delete f.private;
|
|
54
|
+
}
|
|
39
55
|
// convert string to object to make API consumed by go simple
|
|
40
56
|
if (f.fieldEdge && f.fieldEdge.inverseEdge) {
|
|
41
57
|
if (typeof f.fieldEdge.inverseEdge === "string") {
|
|
@@ -47,26 +63,48 @@ function processFields(src, patternName) {
|
|
|
47
63
|
if (patternName) {
|
|
48
64
|
f.patternName = patternName;
|
|
49
65
|
}
|
|
66
|
+
if (field.serverDefault !== undefined) {
|
|
67
|
+
f.serverDefault = await transformServerDefault(name, field, field.serverDefault);
|
|
68
|
+
}
|
|
50
69
|
transformType(field.type);
|
|
51
70
|
if (field.getDerivedFields) {
|
|
52
|
-
f.derivedFields = processFields(field.getDerivedFields(name));
|
|
71
|
+
f.derivedFields = await processFields(field.getDerivedFields(name));
|
|
53
72
|
}
|
|
54
73
|
if (field.type.subFields) {
|
|
55
|
-
f.type.subFields = processFields(field.type.subFields);
|
|
74
|
+
f.type.subFields = await processFields(field.type.subFields);
|
|
56
75
|
}
|
|
57
76
|
if (field.type.unionFields) {
|
|
58
|
-
f.type.unionFields = processFields(field.type.unionFields);
|
|
77
|
+
f.type.unionFields = await processFields(field.type.unionFields);
|
|
59
78
|
}
|
|
60
79
|
if (field.type.listElemType &&
|
|
61
80
|
field.type.listElemType.subFields &&
|
|
62
81
|
// check to avoid ts-ignore below. exists just for tsc
|
|
63
82
|
f.type.listElemType) {
|
|
64
|
-
f.type.listElemType.subFields = processFields(field.type.listElemType.subFields);
|
|
83
|
+
f.type.listElemType.subFields = await processFields(field.type.listElemType.subFields);
|
|
65
84
|
}
|
|
66
85
|
ret.push(f);
|
|
67
86
|
}
|
|
68
87
|
return ret;
|
|
69
88
|
}
|
|
89
|
+
async function transformServerDefault(name, f, value) {
|
|
90
|
+
if (f.valid) {
|
|
91
|
+
if (!(await f.valid(value))) {
|
|
92
|
+
throw new Error(`invalid value ${value} passed to field ${name}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (f.format) {
|
|
96
|
+
value = await f.format(value);
|
|
97
|
+
}
|
|
98
|
+
switch (typeof value) {
|
|
99
|
+
case "boolean":
|
|
100
|
+
case "number":
|
|
101
|
+
case "bigint":
|
|
102
|
+
case "string":
|
|
103
|
+
return `${value}`;
|
|
104
|
+
default:
|
|
105
|
+
throw new Error(`invalid value ${value} passed to field ${name}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
70
108
|
function transformImportType(typ) {
|
|
71
109
|
if (!typ.importType) {
|
|
72
110
|
return;
|
|
@@ -108,12 +146,12 @@ function processEdgeGroups(processedSchema, edgeGroups) {
|
|
|
108
146
|
processedSchema.assocEdgeGroups.push(group2);
|
|
109
147
|
}
|
|
110
148
|
}
|
|
111
|
-
function processPattern(patterns, pattern, processedSchema) {
|
|
149
|
+
async function processPattern(patterns, pattern, processedSchema) {
|
|
112
150
|
let ret = {
|
|
113
151
|
...pattern,
|
|
114
152
|
};
|
|
115
153
|
const name = pattern.name;
|
|
116
|
-
const fields = processFields(pattern.fields, pattern.name);
|
|
154
|
+
const fields = await processFields(pattern.fields, pattern.name);
|
|
117
155
|
processedSchema.fields.push(...fields);
|
|
118
156
|
if (pattern.edges) {
|
|
119
157
|
const edges = processEdges(pattern.edges, pattern.name);
|
|
@@ -122,6 +160,23 @@ function processPattern(patterns, pattern, processedSchema) {
|
|
|
122
160
|
// flag transformsSelect
|
|
123
161
|
if (pattern.transformRead) {
|
|
124
162
|
ret.transformsSelect = true;
|
|
163
|
+
if (pattern.transformReadCodegen_BETA) {
|
|
164
|
+
const r = pattern.transformReadCodegen_BETA();
|
|
165
|
+
if (typeof r === "string") {
|
|
166
|
+
ret.transformsLoaderCodegen = {
|
|
167
|
+
code: r,
|
|
168
|
+
imports: [
|
|
169
|
+
{
|
|
170
|
+
importPath: const_1.PACKAGE,
|
|
171
|
+
import: "query",
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
ret.transformsLoaderCodegen = r;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
125
180
|
}
|
|
126
181
|
if (patterns[name] === undefined) {
|
|
127
182
|
// intentionally processing separately and not passing pattern.name
|
|
@@ -130,6 +185,7 @@ function processPattern(patterns, pattern, processedSchema) {
|
|
|
130
185
|
name: pattern.name,
|
|
131
186
|
assocEdges: edges,
|
|
132
187
|
fields: fields,
|
|
188
|
+
disableMixin: pattern.disableMixin,
|
|
133
189
|
};
|
|
134
190
|
}
|
|
135
191
|
else {
|
|
@@ -162,18 +218,29 @@ function processAction(action) {
|
|
|
162
218
|
if (f.nullable === "contentsAndList") {
|
|
163
219
|
f2.nullable = NullableResult.CONTENTS_AND_LIST;
|
|
164
220
|
}
|
|
165
|
-
else {
|
|
221
|
+
else if (f.nullable === "contents") {
|
|
166
222
|
f2.nullable = NullableResult.CONTENTS;
|
|
167
223
|
}
|
|
224
|
+
else if (f.nullable === "true") {
|
|
225
|
+
// shouldn't happen but ran into weirdness where it did...
|
|
226
|
+
f2.nullable = NullableResult.ITEM;
|
|
227
|
+
}
|
|
168
228
|
}
|
|
169
229
|
return f2;
|
|
170
230
|
});
|
|
171
231
|
ret.actionOnlyFields = actionOnlyFields;
|
|
172
232
|
return ret;
|
|
173
233
|
}
|
|
174
|
-
function parseSchema(potentialSchemas) {
|
|
234
|
+
async function parseSchema(potentialSchemas, globalSchema) {
|
|
175
235
|
let schemas = {};
|
|
176
236
|
let patterns = {};
|
|
237
|
+
let parsedGlobalSchema;
|
|
238
|
+
if (globalSchema) {
|
|
239
|
+
parsedGlobalSchema = await parseGlobalSchema(globalSchema);
|
|
240
|
+
// set this so that we can use it, if we're trying to process server default or anything
|
|
241
|
+
// that ends up parsing,validating and formatting fields
|
|
242
|
+
(0, global_schema_1.setGlobalSchema)(globalSchema);
|
|
243
|
+
}
|
|
177
244
|
for (const key in potentialSchemas) {
|
|
178
245
|
const value = potentialSchemas[key];
|
|
179
246
|
let schema;
|
|
@@ -189,6 +256,7 @@ function parseSchema(potentialSchemas) {
|
|
|
189
256
|
}
|
|
190
257
|
let processedSchema = {
|
|
191
258
|
fields: [],
|
|
259
|
+
fieldOverrides: schema.fieldOverrides,
|
|
192
260
|
schemaPath: schema.schemaPath,
|
|
193
261
|
tableName: schema.tableName,
|
|
194
262
|
enumTable: schema.enumTable,
|
|
@@ -199,17 +267,24 @@ function parseSchema(potentialSchemas) {
|
|
|
199
267
|
actions: schema.actions?.map((action) => processAction(action)) || [],
|
|
200
268
|
assocEdges: [],
|
|
201
269
|
assocEdgeGroups: [],
|
|
270
|
+
customGraphQLInterfaces: schema.customGraphQLInterfaces,
|
|
202
271
|
};
|
|
203
272
|
// let's put patterns first just so we have id, created_at, updated_at first
|
|
204
273
|
// ¯\_(ツ)_/¯
|
|
274
|
+
let patternNames = [];
|
|
205
275
|
if (schema.patterns) {
|
|
206
276
|
for (const pattern of schema.patterns) {
|
|
207
|
-
const ret = processPattern(patterns, pattern, processedSchema);
|
|
277
|
+
const ret = await processPattern(patterns, pattern, processedSchema);
|
|
278
|
+
patternNames.push(pattern.name);
|
|
208
279
|
if (ret.transformsSelect) {
|
|
209
280
|
if (processedSchema.transformsSelect) {
|
|
210
281
|
throw new Error(`can only have one pattern which transforms default querying behavior`);
|
|
211
282
|
}
|
|
212
283
|
processedSchema.transformsSelect = true;
|
|
284
|
+
if (ret.transformsLoaderCodegen) {
|
|
285
|
+
processedSchema.transformsLoaderCodegen =
|
|
286
|
+
ret.transformsLoaderCodegen;
|
|
287
|
+
}
|
|
213
288
|
}
|
|
214
289
|
if (ret.transformsDelete) {
|
|
215
290
|
if (processedSchema.transformsDelete) {
|
|
@@ -219,8 +294,9 @@ function parseSchema(potentialSchemas) {
|
|
|
219
294
|
}
|
|
220
295
|
}
|
|
221
296
|
}
|
|
222
|
-
const fields = processFields(schema.fields);
|
|
297
|
+
const fields = await processFields(schema.fields);
|
|
223
298
|
processedSchema.fields.push(...fields);
|
|
299
|
+
processedSchema.patternNames = patternNames;
|
|
224
300
|
if (schema.edges) {
|
|
225
301
|
const edges = processEdges(schema.edges);
|
|
226
302
|
processedSchema.assocEdges.push(...edges);
|
|
@@ -230,6 +306,72 @@ function parseSchema(potentialSchemas) {
|
|
|
230
306
|
}
|
|
231
307
|
schemas[key] = processedSchema;
|
|
232
308
|
}
|
|
233
|
-
|
|
309
|
+
const rome = translatePrettier();
|
|
310
|
+
return {
|
|
311
|
+
schemas,
|
|
312
|
+
patterns,
|
|
313
|
+
globalSchema: parsedGlobalSchema,
|
|
314
|
+
config: {
|
|
315
|
+
rome,
|
|
316
|
+
},
|
|
317
|
+
};
|
|
234
318
|
}
|
|
235
319
|
exports.parseSchema = parseSchema;
|
|
320
|
+
function translatePrettier() {
|
|
321
|
+
const r = (0, cosmiconfig_1.cosmiconfigSync)("prettier").search();
|
|
322
|
+
if (!r) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
const ret = {};
|
|
326
|
+
if (r.config.printWidth !== undefined) {
|
|
327
|
+
ret.lineWidth = parseInt(r.config.printWidth);
|
|
328
|
+
}
|
|
329
|
+
if (r.config.useTabs) {
|
|
330
|
+
ret.indentStyle = "tab";
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
ret.indentStyle = "space";
|
|
334
|
+
}
|
|
335
|
+
if (r.config.tabWidth !== undefined) {
|
|
336
|
+
ret.indentSize = parseInt(r.config.tabWidth);
|
|
337
|
+
}
|
|
338
|
+
if (r.config.singleQuote) {
|
|
339
|
+
ret.quoteStyle = "single";
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
ret.quoteStyle = "double";
|
|
343
|
+
}
|
|
344
|
+
if (r.config.quoteProps !== undefined) {
|
|
345
|
+
if (r.config.quoteProps === "consistent") {
|
|
346
|
+
// rome doesn't support this
|
|
347
|
+
ret.quoteProperties = "as-needed";
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
ret.quoteProperties = r.config.quoteProps;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (r.config.trailingComma !== undefined) {
|
|
354
|
+
ret.trailingComma = r.config.trailingComma;
|
|
355
|
+
}
|
|
356
|
+
return ret;
|
|
357
|
+
}
|
|
358
|
+
async function parseGlobalSchema(s) {
|
|
359
|
+
const ret = {
|
|
360
|
+
globalEdges: [],
|
|
361
|
+
extraEdgeFields: [],
|
|
362
|
+
init: !!s.extraEdgeFields ||
|
|
363
|
+
s.transformEdgeRead !== undefined ||
|
|
364
|
+
s.transformEdgeWrite !== undefined ||
|
|
365
|
+
s.fields !== undefined,
|
|
366
|
+
};
|
|
367
|
+
if (s.extraEdgeFields) {
|
|
368
|
+
ret.extraEdgeFields = await processFields(s.extraEdgeFields);
|
|
369
|
+
}
|
|
370
|
+
if (s.edges) {
|
|
371
|
+
ret.globalEdges = processEdges(s.edges);
|
|
372
|
+
}
|
|
373
|
+
if (s.fields) {
|
|
374
|
+
ret.globalFields = await processFields(s.fields);
|
|
375
|
+
}
|
|
376
|
+
return ret;
|
|
377
|
+
}
|
package/schema/base_schema.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FieldMap, Pattern, FieldOverrideMap } from "./schema";
|
|
2
2
|
import { Action, AssocEdgeGroup, Constraint, Edge, Index, Schema } from ".";
|
|
3
3
|
export declare const Timestamps: Pattern;
|
|
4
4
|
export declare const Node: Pattern;
|
|
5
5
|
export interface SchemaConfig extends Schema {
|
|
6
6
|
}
|
|
7
7
|
export declare class EntSchema implements Schema {
|
|
8
|
-
fields: FieldMap
|
|
8
|
+
fields: FieldMap;
|
|
9
|
+
fieldOverrides: FieldOverrideMap | undefined;
|
|
9
10
|
tableName: string | undefined;
|
|
10
11
|
patterns: Pattern[];
|
|
11
12
|
edges: Edge[] | undefined;
|
|
@@ -18,10 +19,12 @@ export declare class EntSchema implements Schema {
|
|
|
18
19
|
constraints: Constraint[] | undefined;
|
|
19
20
|
indices: Index[] | undefined;
|
|
20
21
|
hideFromGraphQL?: boolean;
|
|
22
|
+
customGraphQLInterfaces?: string[] | undefined;
|
|
21
23
|
constructor(cfg: SchemaConfig);
|
|
22
24
|
}
|
|
23
25
|
export declare class EntSchemaWithTZ implements Schema {
|
|
24
|
-
fields: FieldMap
|
|
26
|
+
fields: FieldMap;
|
|
27
|
+
fieldOverrides: FieldOverrideMap | undefined;
|
|
25
28
|
tableName: string | undefined;
|
|
26
29
|
patterns: Pattern[];
|
|
27
30
|
edges: Edge[] | undefined;
|
|
@@ -34,6 +37,7 @@ export declare class EntSchemaWithTZ implements Schema {
|
|
|
34
37
|
constraints: Constraint[] | undefined;
|
|
35
38
|
indices: Index[] | undefined;
|
|
36
39
|
hideFromGraphQL?: boolean;
|
|
40
|
+
customGraphQLInterfaces?: string[] | undefined;
|
|
37
41
|
constructor(cfg: SchemaConfig);
|
|
38
42
|
}
|
|
39
43
|
export declare abstract class BaseEntSchema {
|