@snowtop/ent 0.1.0-alpha99 → 0.1.0
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 +8 -1
- package/action/executor.d.ts +16 -3
- package/action/executor.js +83 -27
- package/action/index.d.ts +2 -1
- package/action/operations.d.ts +126 -0
- package/action/operations.js +686 -0
- package/action/orchestrator.d.ts +22 -8
- package/action/orchestrator.js +278 -67
- package/core/base.d.ts +34 -24
- package/core/clause.d.ts +62 -79
- package/core/clause.js +77 -5
- package/core/config.d.ts +5 -1
- package/core/config.js +3 -0
- package/core/const.d.ts +3 -0
- package/core/const.js +6 -0
- package/core/context.d.ts +4 -3
- package/core/context.js +2 -1
- package/core/db.d.ts +1 -0
- package/core/db.js +7 -7
- package/core/ent.d.ts +53 -105
- package/core/ent.js +104 -599
- package/core/global_schema.d.ts +7 -0
- package/core/global_schema.js +51 -0
- package/core/loaders/assoc_count_loader.d.ts +4 -2
- package/core/loaders/assoc_count_loader.js +10 -2
- package/core/loaders/assoc_edge_loader.d.ts +2 -3
- package/core/loaders/assoc_edge_loader.js +16 -7
- package/core/loaders/index.d.ts +0 -1
- package/core/loaders/index.js +1 -3
- package/core/loaders/loader.d.ts +3 -3
- package/core/loaders/loader.js +3 -20
- package/core/loaders/object_loader.d.ts +30 -10
- package/core/loaders/object_loader.js +179 -40
- package/core/loaders/query_loader.d.ts +4 -4
- package/core/loaders/query_loader.js +14 -19
- package/core/loaders/raw_count_loader.d.ts +1 -0
- package/core/loaders/raw_count_loader.js +3 -2
- package/core/privacy.d.ts +19 -10
- package/core/privacy.js +47 -26
- package/core/query/assoc_query.js +1 -1
- package/core/query/custom_clause_query.d.ts +6 -3
- package/core/query/custom_clause_query.js +36 -9
- package/core/query/custom_query.d.ts +3 -1
- package/core/query/custom_query.js +29 -6
- package/core/query/query.d.ts +12 -2
- package/core/query/query.js +67 -38
- package/core/query/shared_assoc_test.js +151 -10
- package/core/query/shared_test.d.ts +2 -2
- package/core/query/shared_test.js +90 -30
- package/core/query_impl.d.ts +8 -0
- package/core/query_impl.js +28 -0
- package/core/viewer.d.ts +2 -0
- package/core/viewer.js +2 -0
- package/graphql/graphql.d.ts +103 -19
- package/graphql/graphql.js +169 -134
- package/graphql/graphql_field_helpers.d.ts +9 -3
- package/graphql/graphql_field_helpers.js +22 -2
- package/graphql/index.d.ts +2 -1
- package/graphql/index.js +5 -2
- 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 +1 -1
- package/imports/index.js +2 -2
- package/index.d.ts +12 -1
- package/index.js +18 -6
- package/package.json +20 -17
- package/parse_schema/parse.d.ts +10 -4
- package/parse_schema/parse.js +70 -24
- package/schema/base_schema.d.ts +8 -0
- package/schema/base_schema.js +11 -0
- package/schema/field.d.ts +6 -3
- package/schema/field.js +72 -17
- package/schema/index.d.ts +1 -1
- package/schema/index.js +2 -1
- package/schema/json_field.d.ts +3 -3
- package/schema/json_field.js +4 -1
- package/schema/schema.d.ts +42 -5
- package/schema/schema.js +35 -41
- package/schema/struct_field.d.ts +8 -6
- package/schema/struct_field.js +67 -8
- package/schema/union_field.d.ts +1 -1
- package/scripts/custom_compiler.js +4 -4
- package/scripts/custom_graphql.js +105 -75
- package/scripts/move_types.js +4 -1
- package/scripts/read_schema.js +2 -2
- package/testutils/action/complex_schemas.d.ts +1 -1
- package/testutils/action/complex_schemas.js +10 -3
- package/testutils/builder.d.ts +3 -0
- package/testutils/builder.js +6 -0
- package/testutils/db/temp_db.d.ts +9 -1
- package/testutils/db/temp_db.js +82 -14
- package/testutils/db_mock.js +1 -3
- package/testutils/ent-graphql-tests/index.d.ts +1 -1
- package/testutils/ent-graphql-tests/index.js +30 -19
- package/testutils/fake_comms.js +1 -1
- package/testutils/fake_data/fake_contact.d.ts +1 -1
- package/testutils/fake_data/fake_tag.d.ts +1 -1
- package/testutils/fake_data/fake_user.d.ts +3 -3
- package/testutils/fake_data/fake_user.js +15 -4
- package/testutils/fake_data/tag_query.js +8 -3
- package/testutils/fake_data/test_helpers.d.ts +3 -2
- package/testutils/fake_data/test_helpers.js +4 -4
- package/testutils/fake_data/user_query.d.ts +5 -2
- package/testutils/fake_data/user_query.js +19 -2
- package/testutils/fake_log.js +1 -1
- package/tsc/ast.js +2 -1
- package/tsc/move_generated.js +2 -2
- package/tsc/transform.d.ts +2 -2
- package/tsc/transform.js +4 -3
- package/tsc/transform_ent.js +2 -1
- package/tsc/transform_schema.js +4 -3
- package/core/loaders/index_loader.d.ts +0 -14
- package/core/loaders/index_loader.js +0 -27
package/graphql/graphql.d.ts
CHANGED
|
@@ -1,36 +1,112 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
1
|
import { GraphQLScalarType } from "graphql";
|
|
2
|
+
import type { FieldMap } from "../schema";
|
|
3
|
+
import { ProcessedField as ParsedProcessedField } from "../parse_schema/parse";
|
|
4
|
+
import { ImportPath } from "../schema/schema";
|
|
3
5
|
interface ClassType<T = any> {
|
|
4
6
|
new (...args: any[]): T;
|
|
5
7
|
}
|
|
6
|
-
|
|
8
|
+
declare type StringToStringMap = {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
interface CustomFieldInput {
|
|
12
|
+
graphQLName?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
functionName?: string;
|
|
15
|
+
args?: Field[];
|
|
16
|
+
results?: Field[];
|
|
17
|
+
fieldType: CustomFieldTypeInput;
|
|
18
|
+
description?: string;
|
|
19
|
+
}
|
|
20
|
+
interface CustomTopLevelInput {
|
|
21
|
+
class?: string;
|
|
22
|
+
graphQLName?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
functionName?: string;
|
|
25
|
+
edgeName?: string;
|
|
26
|
+
args?: Field[];
|
|
27
|
+
results?: Field[];
|
|
28
|
+
extraImports?: ImportPath[];
|
|
29
|
+
functionContents?: string;
|
|
30
|
+
fieldType: CustomFieldTypeInput;
|
|
31
|
+
description?: string;
|
|
32
|
+
list?: boolean;
|
|
33
|
+
connection?: boolean;
|
|
34
|
+
resultType?: string;
|
|
35
|
+
}
|
|
36
|
+
type CustomFieldInputMap = {
|
|
37
|
+
[key: string]: CustomFieldInput[];
|
|
38
|
+
};
|
|
39
|
+
type CustomTypeInputMap = {
|
|
40
|
+
[key: string]: CustomTypeInput;
|
|
41
|
+
};
|
|
42
|
+
interface CustomObjectInput {
|
|
43
|
+
name: string;
|
|
44
|
+
graphQLName?: string;
|
|
45
|
+
fields?: CustomFieldInput[];
|
|
46
|
+
}
|
|
47
|
+
export interface CustomGraphQLInput {
|
|
48
|
+
fields?: CustomFieldInputMap;
|
|
49
|
+
inputs?: CustomObjectInput[];
|
|
50
|
+
objects?: CustomObjectInput[];
|
|
51
|
+
args?: CustomObjectInput[];
|
|
52
|
+
queries?: CustomTopLevelInput[];
|
|
53
|
+
mutations?: CustomTopLevelInput[];
|
|
54
|
+
customTypes?: CustomTypeInputMap;
|
|
55
|
+
}
|
|
56
|
+
export interface CustomTypeInput {
|
|
7
57
|
type: string;
|
|
8
58
|
importPath: string;
|
|
9
59
|
tsType?: string;
|
|
10
60
|
tsImportPath?: string;
|
|
61
|
+
enumMap?: StringToStringMap;
|
|
62
|
+
structFields?: FieldMap;
|
|
63
|
+
inputType?: boolean;
|
|
11
64
|
[x: string]: any;
|
|
12
65
|
}
|
|
13
|
-
type
|
|
66
|
+
export type CustomType = Omit<CustomTypeInput, "structFields"> & {
|
|
67
|
+
structFields?: ParsedProcessedField[];
|
|
68
|
+
};
|
|
69
|
+
type Type = GraphQLScalarType | ClassType | string | CustomTypeInput;
|
|
14
70
|
export type GraphQLConnection<T> = {
|
|
15
71
|
node: T;
|
|
16
72
|
};
|
|
17
|
-
|
|
73
|
+
interface gqlFieldOptionsBase {
|
|
18
74
|
name?: string;
|
|
19
75
|
nullable?: boolean | NullableListOptions;
|
|
20
76
|
description?: string;
|
|
21
77
|
type?: Type | Array<Type> | GraphQLConnection<Type>;
|
|
22
78
|
}
|
|
79
|
+
interface gqlFieldArg extends Omit<gqlFieldOptionsBase, "name"> {
|
|
80
|
+
isContextArg?: boolean;
|
|
81
|
+
name: string;
|
|
82
|
+
}
|
|
83
|
+
export interface gqlFieldOptions extends gqlFieldOptionsBase {
|
|
84
|
+
class: string;
|
|
85
|
+
args?: gqlFieldArg[];
|
|
86
|
+
async?: boolean;
|
|
87
|
+
type: NonNullable<gqlFieldOptionsBase["type"]>;
|
|
88
|
+
}
|
|
23
89
|
export interface gqlObjectOptions {
|
|
24
90
|
name?: string;
|
|
25
91
|
description?: string;
|
|
26
92
|
}
|
|
27
|
-
|
|
93
|
+
export interface gqlObjectWithInterfaceOptions extends gqlObjectOptions {
|
|
94
|
+
interfaces?: string[];
|
|
95
|
+
}
|
|
96
|
+
export interface gqlObjectWithUnionOptions extends gqlObjectOptions {
|
|
97
|
+
unionTypes: string[];
|
|
98
|
+
}
|
|
99
|
+
type gqlMutationOptions = Omit<gqlFieldOptions, "nullable" | "type"> & {
|
|
100
|
+
type?: gqlFieldOptionsBase["type"];
|
|
101
|
+
};
|
|
102
|
+
type gqlQueryOptions = gqlFieldOptions;
|
|
28
103
|
export declare enum CustomFieldType {
|
|
29
104
|
Accessor = "ACCESSOR",
|
|
30
105
|
Field = "FIELD",
|
|
31
106
|
Function = "FUNCTION",
|
|
32
107
|
AsyncFunction = "ASYNC_FUNCTION"
|
|
33
108
|
}
|
|
109
|
+
export type CustomFieldTypeInput = "ACCESSOR" | "FIELD" | "FUNCTION" | "ASYNC_FUNCTION";
|
|
34
110
|
interface CustomFieldImpl {
|
|
35
111
|
nodeName: string;
|
|
36
112
|
gqlName: string;
|
|
@@ -42,8 +118,9 @@ interface CustomFieldImpl {
|
|
|
42
118
|
export interface CustomField extends CustomFieldImpl {
|
|
43
119
|
args: Field[];
|
|
44
120
|
results: Field[];
|
|
45
|
-
extraImports?:
|
|
121
|
+
extraImports?: ImportPath[];
|
|
46
122
|
functionContents?: string;
|
|
123
|
+
edgeName?: string;
|
|
47
124
|
}
|
|
48
125
|
export interface CustomMutation extends CustomField {
|
|
49
126
|
}
|
|
@@ -60,6 +137,8 @@ export interface CustomObject {
|
|
|
60
137
|
nodeName: string;
|
|
61
138
|
className: string;
|
|
62
139
|
description?: string;
|
|
140
|
+
interfaces?: string[];
|
|
141
|
+
unionTypes?: string[];
|
|
63
142
|
}
|
|
64
143
|
type NullableListOptions = "contents" | "contentsAndList";
|
|
65
144
|
interface FieldImpl {
|
|
@@ -86,8 +165,9 @@ declare enum NullableResult {
|
|
|
86
165
|
}
|
|
87
166
|
export declare const knownAllowedNames: Map<string, string>;
|
|
88
167
|
export declare const knownDisAllowedNames: Map<string, boolean>;
|
|
89
|
-
export declare const
|
|
90
|
-
export declare const
|
|
168
|
+
export declare const knownInterfaces: Map<string, boolean>;
|
|
169
|
+
export declare const isCustomType: (type: Type) => type is CustomTypeInput;
|
|
170
|
+
export declare const addCustomType: (type: CustomTypeInput, gqlCapture: typeof GQLCapture) => Promise<void>;
|
|
91
171
|
export declare class GQLCapture {
|
|
92
172
|
private static enabled;
|
|
93
173
|
static enable(enabled: boolean): void;
|
|
@@ -98,6 +178,8 @@ export declare class GQLCapture {
|
|
|
98
178
|
private static customArgs;
|
|
99
179
|
private static customInputObjects;
|
|
100
180
|
private static customObjects;
|
|
181
|
+
private static customInterfaces;
|
|
182
|
+
private static customUnions;
|
|
101
183
|
private static customTypes;
|
|
102
184
|
static clear(): void;
|
|
103
185
|
static getCustomFields(): Map<string, CustomField[]>;
|
|
@@ -106,36 +188,38 @@ export declare class GQLCapture {
|
|
|
106
188
|
static getCustomArgs(): Map<string, CustomObject>;
|
|
107
189
|
static getCustomInputObjects(): Map<string, CustomObject>;
|
|
108
190
|
static getCustomObjects(): Map<string, CustomObject>;
|
|
191
|
+
static getCustomInterfaces(): Map<string, CustomObject>;
|
|
192
|
+
static getCustomUnions(): Map<string, CustomObject>;
|
|
109
193
|
static getCustomTypes(): Map<string, CustomType>;
|
|
110
194
|
private static getNullableArg;
|
|
111
195
|
static getProcessedCustomFields(): ProcessCustomFieldMap;
|
|
112
196
|
static getProcessedCustomMutations(): ProcessedCustomField[];
|
|
113
197
|
static getProcessedCustomQueries(): ProcessedCustomField[];
|
|
114
198
|
private static getProcessedCustomFieldsImpl;
|
|
115
|
-
private static
|
|
116
|
-
static gqlField(options
|
|
199
|
+
private static getField;
|
|
200
|
+
static gqlField(options: gqlFieldOptions): any;
|
|
117
201
|
private static getCustomField;
|
|
118
|
-
|
|
119
|
-
private static argImpl;
|
|
120
|
-
static gqlArg(name: string, options?: gqlFieldOptions): any;
|
|
121
|
-
static gqlContextType(): any;
|
|
202
|
+
static gqlContextType(): gqlFieldArg;
|
|
122
203
|
static gqlArgType(options?: gqlObjectOptions): any;
|
|
123
204
|
static gqlInputObjectType(options?: gqlObjectOptions): any;
|
|
124
|
-
static gqlObjectType(options?:
|
|
205
|
+
static gqlObjectType(options?: gqlObjectWithInterfaceOptions): any;
|
|
206
|
+
static gqlUnionType(options: gqlObjectWithUnionOptions): any;
|
|
207
|
+
static gqlInterfaceType(options?: gqlObjectOptions): any;
|
|
125
208
|
private static customGQLObject;
|
|
126
|
-
static gqlQuery(options
|
|
127
|
-
static gqlMutation(options
|
|
209
|
+
static gqlQuery(options: gqlQueryOptions): any;
|
|
210
|
+
static gqlMutation(options: gqlMutationOptions): any;
|
|
128
211
|
static gqlConnection(type: Type): any;
|
|
129
212
|
static resolve(objects: string[]): void;
|
|
130
213
|
}
|
|
131
214
|
export declare const gqlField: typeof GQLCapture.gqlField;
|
|
132
|
-
export declare const gqlArg: typeof GQLCapture.gqlArg;
|
|
133
215
|
export declare const gqlArgType: typeof GQLCapture.gqlArgType;
|
|
134
216
|
export declare const gqlInputObjectType: typeof GQLCapture.gqlInputObjectType;
|
|
135
217
|
export declare const gqlObjectType: typeof GQLCapture.gqlObjectType;
|
|
218
|
+
export declare const gqlInterfaceType: typeof GQLCapture.gqlInterfaceType;
|
|
219
|
+
export declare const gqlUnionType: typeof GQLCapture.gqlUnionType;
|
|
136
220
|
export declare const gqlQuery: typeof GQLCapture.gqlQuery;
|
|
137
221
|
export declare const gqlMutation: typeof GQLCapture.gqlMutation;
|
|
138
222
|
export declare const gqlContextType: typeof GQLCapture.gqlContextType;
|
|
139
223
|
export declare const gqlConnection: typeof GQLCapture.gqlConnection;
|
|
140
|
-
declare const gqlFileUpload:
|
|
224
|
+
declare const gqlFileUpload: CustomTypeInput;
|
|
141
225
|
export { gqlFileUpload };
|