@snowtop/ent 0.1.0-alpha160-test5 → 0.1.0-alpha160-test7
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/dist/package.json +64 -0
- package/package.json +52 -7
- package/src/action/action.ts +330 -0
- package/src/action/executor.ts +453 -0
- package/src/action/experimental_action.ts +277 -0
- package/src/action/index.ts +31 -0
- package/src/action/operations.ts +967 -0
- package/src/action/orchestrator.ts +1527 -0
- package/src/action/privacy.ts +37 -0
- package/src/action/relative_value.ts +242 -0
- package/src/action/transaction.ts +38 -0
- package/src/auth/auth.ts +77 -0
- package/src/auth/index.ts +8 -0
- package/src/core/base.ts +367 -0
- package/src/core/clause.ts +1065 -0
- package/src/core/config.ts +219 -0
- package/src/core/const.ts +5 -0
- package/src/core/context.ts +135 -0
- package/src/core/convert.ts +106 -0
- package/src/core/date.ts +23 -0
- package/src/core/db.ts +498 -0
- package/src/core/ent.ts +1740 -0
- package/src/core/global_schema.ts +49 -0
- package/src/core/loaders/assoc_count_loader.ts +99 -0
- package/src/core/loaders/assoc_edge_loader.ts +250 -0
- package/src/core/loaders/index.ts +12 -0
- package/src/core/loaders/loader.ts +66 -0
- package/src/core/loaders/object_loader.ts +489 -0
- package/src/core/loaders/query_loader.ts +314 -0
- package/src/core/loaders/raw_count_loader.ts +175 -0
- package/src/core/logger.ts +49 -0
- package/src/core/privacy.ts +660 -0
- package/src/core/query/assoc_query.ts +240 -0
- package/src/core/query/custom_clause_query.ts +174 -0
- package/src/core/query/custom_query.ts +302 -0
- package/src/core/query/index.ts +9 -0
- package/src/core/query/query.ts +674 -0
- package/src/core/query_impl.ts +32 -0
- package/src/core/viewer.ts +52 -0
- package/src/ent.code-workspace +73 -0
- package/src/graphql/builtins/connection.ts +25 -0
- package/src/graphql/builtins/edge.ts +16 -0
- package/src/graphql/builtins/node.ts +12 -0
- package/src/graphql/graphql.ts +891 -0
- package/src/graphql/graphql_field_helpers.ts +221 -0
- package/src/graphql/index.ts +42 -0
- package/src/graphql/mutations/union.ts +39 -0
- package/src/graphql/node_resolver.ts +122 -0
- package/src/graphql/query/connection_type.ts +113 -0
- package/src/graphql/query/edge_connection.ts +171 -0
- package/src/graphql/query/page_info.ts +34 -0
- package/src/graphql/query/shared_edge_connection.ts +287 -0
- package/src/graphql/scalars/orderby_direction.ts +13 -0
- package/src/graphql/scalars/time.ts +38 -0
- package/src/imports/dataz/example1/_auth.ts +51 -0
- package/src/imports/dataz/example1/_viewer.ts +35 -0
- package/src/imports/index.ts +213 -0
- package/src/index.ts +145 -0
- package/src/parse_schema/parse.ts +585 -0
- package/src/schema/base_schema.ts +224 -0
- package/src/schema/field.ts +1087 -0
- package/src/schema/index.ts +53 -0
- package/src/schema/json_field.ts +94 -0
- package/src/schema/schema.ts +1028 -0
- package/src/schema/struct_field.ts +234 -0
- package/src/schema/union_field.ts +105 -0
- package/src/scripts/custom_compiler.ts +331 -0
- package/src/scripts/custom_graphql.ts +550 -0
- package/src/scripts/migrate_v0.1.ts +41 -0
- package/src/scripts/move_types.ts +131 -0
- package/src/scripts/read_schema.ts +67 -0
- package/src/setupPackage.js +42 -0
- package/src/testutils/action/complex_schemas.ts +517 -0
- package/src/testutils/builder.ts +422 -0
- package/src/testutils/context/test_context.ts +25 -0
- package/src/testutils/db/fixture.ts +32 -0
- package/src/testutils/db/temp_db.ts +941 -0
- package/src/testutils/db/value.ts +294 -0
- package/src/testutils/db_mock.ts +351 -0
- package/src/testutils/db_time_zone.ts +40 -0
- package/src/testutils/ent-graphql-tests/index.ts +653 -0
- package/src/testutils/fake_comms.ts +50 -0
- package/src/testutils/fake_data/const.ts +64 -0
- package/src/testutils/fake_data/events_query.ts +145 -0
- package/src/testutils/fake_data/fake_contact.ts +150 -0
- package/src/testutils/fake_data/fake_event.ts +150 -0
- package/src/testutils/fake_data/fake_tag.ts +139 -0
- package/src/testutils/fake_data/fake_user.ts +232 -0
- package/src/testutils/fake_data/index.ts +1 -0
- package/src/testutils/fake_data/internal.ts +8 -0
- package/src/testutils/fake_data/tag_query.ts +56 -0
- package/src/testutils/fake_data/test_helpers.ts +388 -0
- package/src/testutils/fake_data/user_query.ts +524 -0
- package/src/testutils/fake_log.ts +52 -0
- package/src/testutils/mock_date.ts +10 -0
- package/src/testutils/mock_log.ts +39 -0
- package/src/testutils/parse_sql.ts +685 -0
- package/src/testutils/test_edge_global_schema.ts +49 -0
- package/src/testutils/write.ts +70 -0
- package/src/tsc/ast.ts +351 -0
- package/src/tsc/compilerOptions.ts +85 -0
- package/src/tsc/move_generated.ts +191 -0
- package/src/tsc/transform.ts +226 -0
- package/src/tsc/transform_action.ts +224 -0
- package/src/tsc/transform_ent.ts +66 -0
- package/src/tsc/transform_schema.ts +546 -0
- package/tsconfig.json +20 -0
- package/core/query/shared_assoc_test.d.ts +0 -2
- package/core/query/shared_assoc_test.js +0 -804
- package/core/query/shared_test.d.ts +0 -21
- package/core/query/shared_test.js +0 -736
- package/graphql/query/shared_assoc_test.d.ts +0 -1
- package/graphql/query/shared_assoc_test.js +0 -203
- /package/{action → dist/action}/action.d.ts +0 -0
- /package/{action → dist/action}/action.js +0 -0
- /package/{action → dist/action}/executor.d.ts +0 -0
- /package/{action → dist/action}/executor.js +0 -0
- /package/{action → dist/action}/experimental_action.d.ts +0 -0
- /package/{action → dist/action}/experimental_action.js +0 -0
- /package/{action → dist/action}/index.d.ts +0 -0
- /package/{action → dist/action}/index.js +0 -0
- /package/{action → dist/action}/operations.d.ts +0 -0
- /package/{action → dist/action}/operations.js +0 -0
- /package/{action → dist/action}/orchestrator.d.ts +0 -0
- /package/{action → dist/action}/orchestrator.js +0 -0
- /package/{action → dist/action}/privacy.d.ts +0 -0
- /package/{action → dist/action}/privacy.js +0 -0
- /package/{action → dist/action}/relative_value.d.ts +0 -0
- /package/{action → dist/action}/relative_value.js +0 -0
- /package/{action → dist/action}/transaction.d.ts +0 -0
- /package/{action → dist/action}/transaction.js +0 -0
- /package/{auth → dist/auth}/auth.d.ts +0 -0
- /package/{auth → dist/auth}/auth.js +0 -0
- /package/{auth → dist/auth}/index.d.ts +0 -0
- /package/{auth → dist/auth}/index.js +0 -0
- /package/{core → dist/core}/base.d.ts +0 -0
- /package/{core → dist/core}/base.js +0 -0
- /package/{core → dist/core}/clause.d.ts +0 -0
- /package/{core → dist/core}/clause.js +0 -0
- /package/{core → dist/core}/config.d.ts +0 -0
- /package/{core → dist/core}/config.js +0 -0
- /package/{core → dist/core}/const.d.ts +0 -0
- /package/{core → dist/core}/const.js +0 -0
- /package/{core → dist/core}/context.d.ts +0 -0
- /package/{core → dist/core}/context.js +0 -0
- /package/{core → dist/core}/convert.d.ts +0 -0
- /package/{core → dist/core}/convert.js +0 -0
- /package/{core → dist/core}/date.d.ts +0 -0
- /package/{core → dist/core}/date.js +0 -0
- /package/{core → dist/core}/db.d.ts +0 -0
- /package/{core → dist/core}/db.js +0 -0
- /package/{core → dist/core}/ent.d.ts +0 -0
- /package/{core → dist/core}/ent.js +0 -0
- /package/{core → dist/core}/global_schema.d.ts +0 -0
- /package/{core → dist/core}/global_schema.js +0 -0
- /package/{core → dist/core}/loaders/assoc_count_loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/assoc_count_loader.js +0 -0
- /package/{core → dist/core}/loaders/assoc_edge_loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/assoc_edge_loader.js +0 -0
- /package/{core → dist/core}/loaders/index.d.ts +0 -0
- /package/{core → dist/core}/loaders/index.js +0 -0
- /package/{core → dist/core}/loaders/loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/loader.js +0 -0
- /package/{core → dist/core}/loaders/object_loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/object_loader.js +0 -0
- /package/{core → dist/core}/loaders/query_loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/query_loader.js +0 -0
- /package/{core → dist/core}/loaders/raw_count_loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/raw_count_loader.js +0 -0
- /package/{core → dist/core}/logger.d.ts +0 -0
- /package/{core → dist/core}/logger.js +0 -0
- /package/{core → dist/core}/privacy.d.ts +0 -0
- /package/{core → dist/core}/privacy.js +0 -0
- /package/{core → dist/core}/query/assoc_query.d.ts +0 -0
- /package/{core → dist/core}/query/assoc_query.js +0 -0
- /package/{core → dist/core}/query/custom_clause_query.d.ts +0 -0
- /package/{core → dist/core}/query/custom_clause_query.js +0 -0
- /package/{core → dist/core}/query/custom_query.d.ts +0 -0
- /package/{core → dist/core}/query/custom_query.js +0 -0
- /package/{core → dist/core}/query/index.d.ts +0 -0
- /package/{core → dist/core}/query/index.js +0 -0
- /package/{core → dist/core}/query/query.d.ts +0 -0
- /package/{core → dist/core}/query/query.js +0 -0
- /package/{core → dist/core}/query_impl.d.ts +0 -0
- /package/{core → dist/core}/query_impl.js +0 -0
- /package/{core → dist/core}/viewer.d.ts +0 -0
- /package/{core → dist/core}/viewer.js +0 -0
- /package/{graphql → dist/graphql}/builtins/connection.d.ts +0 -0
- /package/{graphql → dist/graphql}/builtins/connection.js +0 -0
- /package/{graphql → dist/graphql}/builtins/edge.d.ts +0 -0
- /package/{graphql → dist/graphql}/builtins/edge.js +0 -0
- /package/{graphql → dist/graphql}/builtins/node.d.ts +0 -0
- /package/{graphql → dist/graphql}/builtins/node.js +0 -0
- /package/{graphql → dist/graphql}/graphql.d.ts +0 -0
- /package/{graphql → dist/graphql}/graphql.js +0 -0
- /package/{graphql → dist/graphql}/graphql_field_helpers.d.ts +0 -0
- /package/{graphql → dist/graphql}/graphql_field_helpers.js +0 -0
- /package/{graphql → dist/graphql}/index.d.ts +0 -0
- /package/{graphql → dist/graphql}/index.js +0 -0
- /package/{graphql → dist/graphql}/mutations/union.d.ts +0 -0
- /package/{graphql → dist/graphql}/mutations/union.js +0 -0
- /package/{graphql → dist/graphql}/node_resolver.d.ts +0 -0
- /package/{graphql → dist/graphql}/node_resolver.js +0 -0
- /package/{graphql → dist/graphql}/query/connection_type.d.ts +0 -0
- /package/{graphql → dist/graphql}/query/connection_type.js +0 -0
- /package/{graphql → dist/graphql}/query/edge_connection.d.ts +0 -0
- /package/{graphql → dist/graphql}/query/edge_connection.js +0 -0
- /package/{graphql → dist/graphql}/query/page_info.d.ts +0 -0
- /package/{graphql → dist/graphql}/query/page_info.js +0 -0
- /package/{graphql → dist/graphql}/query/shared_edge_connection.d.ts +0 -0
- /package/{graphql → dist/graphql}/query/shared_edge_connection.js +0 -0
- /package/{graphql → dist/graphql}/scalars/orderby_direction.d.ts +0 -0
- /package/{graphql → dist/graphql}/scalars/orderby_direction.js +0 -0
- /package/{graphql → dist/graphql}/scalars/time.d.ts +0 -0
- /package/{graphql → dist/graphql}/scalars/time.js +0 -0
- /package/{imports → dist/imports}/dataz/example1/_auth.d.ts +0 -0
- /package/{imports → dist/imports}/dataz/example1/_auth.js +0 -0
- /package/{imports → dist/imports}/dataz/example1/_viewer.d.ts +0 -0
- /package/{imports → dist/imports}/dataz/example1/_viewer.js +0 -0
- /package/{imports → dist/imports}/index.d.ts +0 -0
- /package/{imports → dist/imports}/index.js +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{parse_schema → dist/parse_schema}/parse.d.ts +0 -0
- /package/{parse_schema → dist/parse_schema}/parse.js +0 -0
- /package/{schema → dist/schema}/base_schema.d.ts +0 -0
- /package/{schema → dist/schema}/base_schema.js +0 -0
- /package/{schema → dist/schema}/field.d.ts +0 -0
- /package/{schema → dist/schema}/field.js +0 -0
- /package/{schema → dist/schema}/index.d.ts +0 -0
- /package/{schema → dist/schema}/index.js +0 -0
- /package/{schema → dist/schema}/json_field.d.ts +0 -0
- /package/{schema → dist/schema}/json_field.js +0 -0
- /package/{schema → dist/schema}/schema.d.ts +0 -0
- /package/{schema → dist/schema}/schema.js +0 -0
- /package/{schema → dist/schema}/struct_field.d.ts +0 -0
- /package/{schema → dist/schema}/struct_field.js +0 -0
- /package/{schema → dist/schema}/union_field.d.ts +0 -0
- /package/{schema → dist/schema}/union_field.js +0 -0
- /package/{scripts → dist/scripts}/custom_compiler.d.ts +0 -0
- /package/{scripts → dist/scripts}/custom_compiler.js +0 -0
- /package/{scripts → dist/scripts}/custom_graphql.d.ts +0 -0
- /package/{scripts → dist/scripts}/custom_graphql.js +0 -0
- /package/{scripts → dist/scripts}/migrate_v0.1.d.ts +0 -0
- /package/{scripts → dist/scripts}/migrate_v0.1.js +0 -0
- /package/{scripts → dist/scripts}/move_types.d.ts +0 -0
- /package/{scripts → dist/scripts}/move_types.js +0 -0
- /package/{scripts → dist/scripts}/read_schema.d.ts +0 -0
- /package/{scripts → dist/scripts}/read_schema.js +0 -0
- /package/{testutils → dist/testutils}/action/complex_schemas.d.ts +0 -0
- /package/{testutils → dist/testutils}/action/complex_schemas.js +0 -0
- /package/{testutils → dist/testutils}/builder.d.ts +0 -0
- /package/{testutils → dist/testutils}/builder.js +0 -0
- /package/{testutils → dist/testutils}/context/test_context.d.ts +0 -0
- /package/{testutils → dist/testutils}/context/test_context.js +0 -0
- /package/{testutils → dist/testutils}/db/fixture.d.ts +0 -0
- /package/{testutils → dist/testutils}/db/fixture.js +0 -0
- /package/{testutils → dist/testutils}/db/temp_db.d.ts +0 -0
- /package/{testutils → dist/testutils}/db/temp_db.js +0 -0
- /package/{testutils → dist/testutils}/db/value.d.ts +0 -0
- /package/{testutils → dist/testutils}/db/value.js +0 -0
- /package/{testutils → dist/testutils}/db_mock.d.ts +0 -0
- /package/{testutils → dist/testutils}/db_mock.js +0 -0
- /package/{testutils → dist/testutils}/db_time_zone.d.ts +0 -0
- /package/{testutils → dist/testutils}/db_time_zone.js +0 -0
- /package/{testutils → dist/testutils}/ent-graphql-tests/index.d.ts +0 -0
- /package/{testutils → dist/testutils}/ent-graphql-tests/index.js +0 -0
- /package/{testutils → dist/testutils}/fake_comms.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_comms.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/const.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/const.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/events_query.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/events_query.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_contact.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_contact.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_event.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_event.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_tag.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_tag.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_user.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_user.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/index.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/index.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/internal.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/internal.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/tag_query.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/tag_query.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/test_helpers.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/test_helpers.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/user_query.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/user_query.js +0 -0
- /package/{testutils → dist/testutils}/fake_log.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_log.js +0 -0
- /package/{testutils → dist/testutils}/mock_date.d.ts +0 -0
- /package/{testutils → dist/testutils}/mock_date.js +0 -0
- /package/{testutils → dist/testutils}/mock_log.d.ts +0 -0
- /package/{testutils → dist/testutils}/mock_log.js +0 -0
- /package/{testutils → dist/testutils}/parse_sql.d.ts +0 -0
- /package/{testutils → dist/testutils}/parse_sql.js +0 -0
- /package/{testutils → dist/testutils}/test_edge_global_schema.d.ts +0 -0
- /package/{testutils → dist/testutils}/test_edge_global_schema.js +0 -0
- /package/{testutils → dist/testutils}/write.d.ts +0 -0
- /package/{testutils → dist/testutils}/write.js +0 -0
- /package/{tsc → dist/tsc}/ast.d.ts +0 -0
- /package/{tsc → dist/tsc}/ast.js +0 -0
- /package/{tsc → dist/tsc}/compilerOptions.d.ts +0 -0
- /package/{tsc → dist/tsc}/compilerOptions.js +0 -0
- /package/{tsc → dist/tsc}/move_generated.d.ts +0 -0
- /package/{tsc → dist/tsc}/move_generated.js +0 -0
- /package/{tsc → dist/tsc}/transform.d.ts +0 -0
- /package/{tsc → dist/tsc}/transform.js +0 -0
- /package/{tsc → dist/tsc}/transform_action.d.ts +0 -0
- /package/{tsc → dist/tsc}/transform_action.js +0 -0
- /package/{tsc → dist/tsc}/transform_ent.d.ts +0 -0
- /package/{tsc → dist/tsc}/transform_ent.js +0 -0
- /package/{tsc → dist/tsc}/transform_schema.d.ts +0 -0
- /package/{tsc → dist/tsc}/transform_schema.js +0 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { FieldMap, Pattern, FieldOverrideMap } from "./schema";
|
|
2
|
+
import { v4 as uuidv4 } from "uuid";
|
|
3
|
+
import { TimestampType, UUIDType } from "./field";
|
|
4
|
+
import { Action, AssocEdgeGroup, Constraint, Edge, Index, Schema } from ".";
|
|
5
|
+
|
|
6
|
+
let tsFields: FieldMap = {
|
|
7
|
+
createdAt: TimestampType({
|
|
8
|
+
hideFromGraphQL: true,
|
|
9
|
+
disableUserEditable: true,
|
|
10
|
+
defaultValueOnCreate: () => {
|
|
11
|
+
return new Date();
|
|
12
|
+
},
|
|
13
|
+
}),
|
|
14
|
+
updatedAt: TimestampType({
|
|
15
|
+
hideFromGraphQL: true,
|
|
16
|
+
disableUserEditable: true,
|
|
17
|
+
defaultValueOnCreate: () => {
|
|
18
|
+
return new Date();
|
|
19
|
+
},
|
|
20
|
+
onlyUpdateIfOtherFieldsBeingSet_BETA: true,
|
|
21
|
+
defaultValueOnEdit: () => {
|
|
22
|
+
return new Date();
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Timestamps is a Pattern that adds a createdAt and updatedAt timestamp fields to the ent
|
|
28
|
+
export const Timestamps: Pattern = {
|
|
29
|
+
name: "timestamps",
|
|
30
|
+
fields: tsFields,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
let nodeField = UUIDType({
|
|
34
|
+
primaryKey: true,
|
|
35
|
+
disableUserEditable: true,
|
|
36
|
+
defaultValueOnCreate: () => {
|
|
37
|
+
return uuidv4();
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
let nodeFields: FieldMap = {
|
|
42
|
+
// inconsistent naming :(
|
|
43
|
+
ID: nodeField,
|
|
44
|
+
...tsFields,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
let nodeFieldsWithTZ: FieldMap = {
|
|
48
|
+
// inconsistent naming :(
|
|
49
|
+
ID: nodeField,
|
|
50
|
+
createdAt: TimestampType({
|
|
51
|
+
hideFromGraphQL: true,
|
|
52
|
+
disableUserEditable: true,
|
|
53
|
+
defaultValueOnCreate: () => {
|
|
54
|
+
return new Date();
|
|
55
|
+
},
|
|
56
|
+
withTimezone: true,
|
|
57
|
+
}),
|
|
58
|
+
updatedAt: TimestampType({
|
|
59
|
+
hideFromGraphQL: true,
|
|
60
|
+
disableUserEditable: true,
|
|
61
|
+
defaultValueOnCreate: () => {
|
|
62
|
+
return new Date();
|
|
63
|
+
},
|
|
64
|
+
defaultValueOnEdit: () => {
|
|
65
|
+
return new Date();
|
|
66
|
+
},
|
|
67
|
+
withTimezone: true,
|
|
68
|
+
}),
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Node is a Pattern that adds 3 fields to the ent: (id, createdAt, and updatedAt timestamps)
|
|
72
|
+
export const Node: Pattern = {
|
|
73
|
+
name: "node",
|
|
74
|
+
fields: nodeFields,
|
|
75
|
+
disableMixin: true,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export interface SchemaConfig extends Schema {}
|
|
79
|
+
|
|
80
|
+
// Ent schema. has Node Pattern by default.
|
|
81
|
+
// exists just to have less typing and easier for clients to implement
|
|
82
|
+
export class EntSchema implements Schema {
|
|
83
|
+
fields: FieldMap;
|
|
84
|
+
|
|
85
|
+
fieldOverrides: FieldOverrideMap | undefined;
|
|
86
|
+
|
|
87
|
+
tableName: string | undefined;
|
|
88
|
+
|
|
89
|
+
patterns: Pattern[] = [Node];
|
|
90
|
+
|
|
91
|
+
edges: Edge[] | undefined;
|
|
92
|
+
|
|
93
|
+
edgeGroups: AssocEdgeGroup[] | undefined;
|
|
94
|
+
|
|
95
|
+
actions: Action[] | undefined;
|
|
96
|
+
|
|
97
|
+
enumTable: boolean | undefined;
|
|
98
|
+
|
|
99
|
+
dbRows: { [key: string]: any }[] | undefined;
|
|
100
|
+
|
|
101
|
+
constraints: Constraint[] | undefined;
|
|
102
|
+
|
|
103
|
+
indices: Index[] | undefined;
|
|
104
|
+
|
|
105
|
+
hideFromGraphQL?: boolean;
|
|
106
|
+
|
|
107
|
+
customGraphQLInterfaces?: string[] | undefined;
|
|
108
|
+
|
|
109
|
+
supportUpsert?: boolean | undefined;
|
|
110
|
+
|
|
111
|
+
showCanViewerSee?: boolean | undefined;
|
|
112
|
+
|
|
113
|
+
showCanViewerEdit?: boolean | undefined;
|
|
114
|
+
|
|
115
|
+
constructor(cfg: SchemaConfig) {
|
|
116
|
+
this.fields = cfg.fields;
|
|
117
|
+
this.fieldOverrides = cfg.fieldOverrides;
|
|
118
|
+
this.tableName = cfg.tableName;
|
|
119
|
+
if (cfg.patterns) {
|
|
120
|
+
this.patterns.push(...cfg.patterns);
|
|
121
|
+
}
|
|
122
|
+
this.edges = cfg.edges;
|
|
123
|
+
this.edgeGroups = cfg.edgeGroups;
|
|
124
|
+
this.actions = cfg.actions;
|
|
125
|
+
this.enumTable = cfg.enumTable;
|
|
126
|
+
this.dbRows = cfg.dbRows;
|
|
127
|
+
this.constraints = cfg.constraints;
|
|
128
|
+
this.indices = cfg.indices;
|
|
129
|
+
this.hideFromGraphQL = cfg.hideFromGraphQL;
|
|
130
|
+
// TODO annoying that have to list these...
|
|
131
|
+
this.customGraphQLInterfaces = cfg.customGraphQLInterfaces;
|
|
132
|
+
this.supportUpsert = cfg.supportUpsert;
|
|
133
|
+
this.showCanViewerSee = cfg.showCanViewerSee;
|
|
134
|
+
this.showCanViewerEdit = cfg.showCanViewerEdit;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export class EntSchemaWithTZ implements Schema {
|
|
139
|
+
fields: FieldMap;
|
|
140
|
+
|
|
141
|
+
fieldOverrides: FieldOverrideMap | undefined;
|
|
142
|
+
|
|
143
|
+
tableName: string | undefined;
|
|
144
|
+
|
|
145
|
+
patterns: Pattern[] = [
|
|
146
|
+
{
|
|
147
|
+
// default schema added
|
|
148
|
+
name: "nodeWithTZ",
|
|
149
|
+
fields: nodeFieldsWithTZ,
|
|
150
|
+
disableMixin: true,
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
edges: Edge[] | undefined;
|
|
155
|
+
|
|
156
|
+
edgeGroups: AssocEdgeGroup[] | undefined;
|
|
157
|
+
|
|
158
|
+
actions: Action[] | undefined;
|
|
159
|
+
|
|
160
|
+
enumTable: boolean | undefined;
|
|
161
|
+
|
|
162
|
+
dbRows: { [key: string]: any }[] | undefined;
|
|
163
|
+
|
|
164
|
+
constraints: Constraint[] | undefined;
|
|
165
|
+
|
|
166
|
+
indices: Index[] | undefined;
|
|
167
|
+
|
|
168
|
+
hideFromGraphQL?: boolean;
|
|
169
|
+
|
|
170
|
+
customGraphQLInterfaces?: string[] | undefined;
|
|
171
|
+
|
|
172
|
+
supportUpsert?: boolean | undefined;
|
|
173
|
+
|
|
174
|
+
showCanViewerSee?: boolean | undefined;
|
|
175
|
+
|
|
176
|
+
showCanViewerEdit?: boolean | undefined;
|
|
177
|
+
|
|
178
|
+
constructor(cfg: SchemaConfig) {
|
|
179
|
+
this.fields = cfg.fields;
|
|
180
|
+
this.fieldOverrides = cfg.fieldOverrides;
|
|
181
|
+
this.tableName = cfg.tableName;
|
|
182
|
+
if (cfg.patterns) {
|
|
183
|
+
this.patterns.push(...cfg.patterns);
|
|
184
|
+
}
|
|
185
|
+
this.edges = cfg.edges;
|
|
186
|
+
this.edgeGroups = cfg.edgeGroups;
|
|
187
|
+
this.actions = cfg.actions;
|
|
188
|
+
this.enumTable = cfg.enumTable;
|
|
189
|
+
this.dbRows = cfg.dbRows;
|
|
190
|
+
this.constraints = cfg.constraints;
|
|
191
|
+
this.indices = cfg.indices;
|
|
192
|
+
this.hideFromGraphQL = cfg.hideFromGraphQL;
|
|
193
|
+
// TODO annoying that have to list these...
|
|
194
|
+
this.customGraphQLInterfaces = cfg.customGraphQLInterfaces;
|
|
195
|
+
this.supportUpsert = cfg.supportUpsert;
|
|
196
|
+
this.showCanViewerSee = cfg.showCanViewerSee;
|
|
197
|
+
this.showCanViewerEdit = cfg.showCanViewerEdit;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// @deprecated use EntSchema
|
|
202
|
+
export abstract class BaseEntSchema {
|
|
203
|
+
addPatterns(...patterns: Pattern[]) {
|
|
204
|
+
this.patterns.push(...patterns);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
patterns: Pattern[] = [Node];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// @deprecated use EntSchemaWithTZ
|
|
211
|
+
export abstract class BaseEntSchemaWithTZ {
|
|
212
|
+
addPatterns(...patterns: Pattern[]) {
|
|
213
|
+
this.patterns.push(...patterns);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
patterns: Pattern[] = [
|
|
217
|
+
{
|
|
218
|
+
// default schema added
|
|
219
|
+
name: "nodeWithTZ",
|
|
220
|
+
fields: nodeFieldsWithTZ,
|
|
221
|
+
disableMixin: true,
|
|
222
|
+
},
|
|
223
|
+
];
|
|
224
|
+
}
|