@snowtop/ent 0.1.0-alpha15 → 0.1.0-alpha151
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 +27 -16
- package/action/action.js +22 -7
- package/action/executor.d.ts +16 -3
- package/action/executor.js +90 -23
- package/action/experimental_action.d.ts +25 -16
- package/action/experimental_action.js +35 -9
- package/action/index.d.ts +3 -1
- package/action/index.js +7 -1
- package/action/operations.d.ts +125 -0
- package/action/operations.js +684 -0
- package/action/orchestrator.d.ts +38 -12
- package/action/orchestrator.js +427 -102
- 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 +52 -21
- package/core/base.js +7 -1
- package/core/clause.d.ts +95 -40
- package/core/clause.js +395 -64
- package/core/config.d.ts +15 -1
- package/core/config.js +10 -1
- package/core/const.d.ts +3 -0
- package/core/const.js +6 -0
- package/core/context.d.ts +4 -2
- package/core/context.js +20 -2
- package/core/convert.d.ts +1 -1
- package/core/date.js +1 -5
- package/core/db.d.ts +12 -8
- package/core/db.js +18 -8
- package/core/ent.d.ts +68 -94
- package/core/ent.js +538 -587
- package/core/global_schema.d.ts +7 -0
- package/core/global_schema.js +51 -0
- package/core/loaders/assoc_count_loader.d.ts +1 -0
- package/core/loaders/assoc_count_loader.js +10 -2
- package/core/loaders/assoc_edge_loader.d.ts +1 -1
- package/core/loaders/assoc_edge_loader.js +10 -13
- 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 +30 -9
- package/core/loaders/object_loader.js +225 -78
- package/core/loaders/query_loader.d.ts +6 -12
- package/core/loaders/query_loader.js +54 -13
- package/core/loaders/raw_count_loader.d.ts +1 -0
- package/core/loaders/raw_count_loader.js +7 -2
- package/core/logger.d.ts +1 -1
- package/core/logger.js +1 -0
- package/core/privacy.d.ts +7 -6
- package/core/privacy.js +21 -25
- package/core/query/assoc_query.d.ts +3 -2
- 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 +88 -0
- package/core/query/custom_query.d.ts +17 -2
- package/core/query/custom_query.js +88 -13
- package/core/query/index.d.ts +1 -0
- package/core/query/index.js +3 -1
- package/core/query/query.d.ts +15 -3
- package/core/query/query.js +128 -53
- package/core/query/shared_assoc_test.d.ts +2 -1
- package/core/query/shared_assoc_test.js +44 -54
- package/core/query/shared_test.d.ts +8 -1
- package/core/query/shared_test.js +532 -236
- package/core/viewer.d.ts +2 -0
- package/core/viewer.js +3 -1
- package/graphql/graphql.d.ts +52 -19
- package/graphql/graphql.js +174 -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/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 +7 -2
- package/imports/index.js +20 -5
- package/index.d.ts +18 -5
- package/index.js +30 -10
- package/package.json +18 -17
- package/parse_schema/parse.d.ts +31 -9
- package/parse_schema/parse.js +179 -32
- package/schema/base_schema.d.ts +13 -3
- package/schema/base_schema.js +13 -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 +7 -2
- package/schema/json_field.d.ts +16 -4
- package/schema/json_field.js +32 -2
- package/schema/schema.d.ts +109 -20
- package/schema/schema.js +42 -53
- 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 +12 -8
- package/scripts/custom_graphql.js +145 -34
- package/scripts/migrate_v0.1.js +36 -0
- package/scripts/move_types.js +120 -0
- package/scripts/read_schema.js +22 -7
- package/testutils/action/complex_schemas.d.ts +69 -0
- package/testutils/action/complex_schemas.js +405 -0
- package/testutils/builder.d.ts +39 -43
- package/testutils/builder.js +75 -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} +32 -8
- package/testutils/db/{test_db.js → temp_db.js} +244 -48
- 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 -9
- 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 +56 -26
- 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 +29 -13
- package/testutils/fake_data/user_query.d.ts +11 -4
- package/testutils/fake_data/user_query.js +54 -22
- 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 +182 -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/core/viewer.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ID, Ent, Viewer, Context } from "./base";
|
|
2
2
|
export declare class LoggedOutViewer implements Viewer {
|
|
3
3
|
context?: Context<Viewer<Ent<any> | null, ID | null>> | undefined;
|
|
4
|
+
marker: string;
|
|
4
5
|
constructor(context?: Context<Viewer<Ent<any> | null, ID | null>> | undefined);
|
|
5
6
|
viewerID: null;
|
|
6
7
|
viewer(): Promise<null>;
|
|
@@ -12,6 +13,7 @@ export interface IDViewerOptions {
|
|
|
12
13
|
ent?: Ent | null;
|
|
13
14
|
}
|
|
14
15
|
export declare class IDViewer implements Viewer {
|
|
16
|
+
marker: string;
|
|
15
17
|
viewerID: ID;
|
|
16
18
|
private ent;
|
|
17
19
|
context?: Context;
|
package/core/viewer.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.IDViewer = exports.LoggedOutViewer = void 0;
|
|
|
4
4
|
class LoggedOutViewer {
|
|
5
5
|
constructor(context) {
|
|
6
6
|
this.context = context;
|
|
7
|
+
this.marker = "loggedout";
|
|
7
8
|
this.viewerID = null;
|
|
8
9
|
}
|
|
9
10
|
async viewer() {
|
|
@@ -16,6 +17,7 @@ class LoggedOutViewer {
|
|
|
16
17
|
exports.LoggedOutViewer = LoggedOutViewer;
|
|
17
18
|
class IDViewer {
|
|
18
19
|
constructor(args, opts) {
|
|
20
|
+
this.marker = "idviewer";
|
|
19
21
|
this.ent = null;
|
|
20
22
|
if (typeof args === "object") {
|
|
21
23
|
this.viewerID = args.viewerID;
|
|
@@ -35,7 +37,7 @@ class IDViewer {
|
|
|
35
37
|
return this.ent;
|
|
36
38
|
}
|
|
37
39
|
instanceKey() {
|
|
38
|
-
return `idViewer
|
|
40
|
+
return `idViewer:${this.viewerID}`;
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
exports.IDViewer = IDViewer;
|
package/graphql/graphql.d.ts
CHANGED
|
@@ -1,30 +1,53 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
1
|
import { GraphQLScalarType } from "graphql";
|
|
3
2
|
interface ClassType<T = any> {
|
|
4
3
|
new (...args: any[]): T;
|
|
5
4
|
}
|
|
5
|
+
declare type StringToStringMap = {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
6
8
|
export interface CustomType {
|
|
7
9
|
type: string;
|
|
8
10
|
importPath: string;
|
|
9
11
|
tsType?: string;
|
|
10
12
|
tsImportPath?: string;
|
|
13
|
+
enumMap?: StringToStringMap;
|
|
14
|
+
inputType?: boolean;
|
|
11
15
|
[x: string]: any;
|
|
12
16
|
}
|
|
13
|
-
|
|
14
|
-
export
|
|
17
|
+
type Type = GraphQLScalarType | ClassType | string | CustomType;
|
|
18
|
+
export type GraphQLConnection<T> = {
|
|
15
19
|
node: T;
|
|
16
20
|
};
|
|
17
|
-
|
|
21
|
+
interface gqlFieldOptionsBase {
|
|
18
22
|
name?: string;
|
|
19
23
|
nullable?: boolean | NullableListOptions;
|
|
20
24
|
description?: string;
|
|
21
25
|
type?: Type | Array<Type> | GraphQLConnection<Type>;
|
|
22
26
|
}
|
|
27
|
+
interface gqlFieldArg extends Omit<gqlFieldOptionsBase, "name"> {
|
|
28
|
+
isContextArg?: boolean;
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
export interface gqlFieldOptions extends gqlFieldOptionsBase {
|
|
32
|
+
class: string;
|
|
33
|
+
args?: gqlFieldArg[];
|
|
34
|
+
async?: boolean;
|
|
35
|
+
type: NonNullable<gqlFieldOptionsBase["type"]>;
|
|
36
|
+
}
|
|
23
37
|
export interface gqlObjectOptions {
|
|
24
38
|
name?: string;
|
|
25
39
|
description?: string;
|
|
26
40
|
}
|
|
27
|
-
|
|
41
|
+
export interface gqlObjectWithInterfaceOptions extends gqlObjectOptions {
|
|
42
|
+
interfaces?: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface gqlObjectWithUnionOptions extends gqlObjectOptions {
|
|
45
|
+
unionTypes: string[];
|
|
46
|
+
}
|
|
47
|
+
type gqlMutationOptions = Omit<gqlFieldOptions, "nullable" | "type"> & {
|
|
48
|
+
type?: gqlFieldOptionsBase["type"];
|
|
49
|
+
};
|
|
50
|
+
type gqlQueryOptions = gqlFieldOptions;
|
|
28
51
|
export declare enum CustomFieldType {
|
|
29
52
|
Accessor = "ACCESSOR",
|
|
30
53
|
Field = "FIELD",
|
|
@@ -42,6 +65,9 @@ interface CustomFieldImpl {
|
|
|
42
65
|
export interface CustomField extends CustomFieldImpl {
|
|
43
66
|
args: Field[];
|
|
44
67
|
results: Field[];
|
|
68
|
+
extraImports?: any[];
|
|
69
|
+
functionContents?: string;
|
|
70
|
+
edgeName?: string;
|
|
45
71
|
}
|
|
46
72
|
export interface CustomMutation extends CustomField {
|
|
47
73
|
}
|
|
@@ -51,15 +77,17 @@ export interface ProcessedCustomField extends CustomFieldImpl {
|
|
|
51
77
|
args: ProcessedField[];
|
|
52
78
|
results: ProcessedField[];
|
|
53
79
|
}
|
|
54
|
-
export
|
|
55
|
-
[key: string]: ProcessedCustomField;
|
|
80
|
+
export type ProcessCustomFieldMap = {
|
|
81
|
+
[key: string]: ProcessedCustomField[];
|
|
56
82
|
};
|
|
57
83
|
export interface CustomObject {
|
|
58
84
|
nodeName: string;
|
|
59
85
|
className: string;
|
|
60
86
|
description?: string;
|
|
87
|
+
interfaces?: string[];
|
|
88
|
+
unionTypes?: string[];
|
|
61
89
|
}
|
|
62
|
-
|
|
90
|
+
type NullableListOptions = "contents" | "contentsAndList";
|
|
63
91
|
interface FieldImpl {
|
|
64
92
|
type: string;
|
|
65
93
|
tsType?: string;
|
|
@@ -84,8 +112,9 @@ declare enum NullableResult {
|
|
|
84
112
|
}
|
|
85
113
|
export declare const knownAllowedNames: Map<string, string>;
|
|
86
114
|
export declare const knownDisAllowedNames: Map<string, boolean>;
|
|
115
|
+
export declare const knownInterfaces: Map<string, boolean>;
|
|
87
116
|
export declare const isCustomType: (type: Type) => type is CustomType;
|
|
88
|
-
export declare const addCustomType: (type: CustomType) => void;
|
|
117
|
+
export declare const addCustomType: (type: CustomType, gqlCapture: typeof GQLCapture) => void;
|
|
89
118
|
export declare class GQLCapture {
|
|
90
119
|
private static enabled;
|
|
91
120
|
static enable(enabled: boolean): void;
|
|
@@ -96,6 +125,8 @@ export declare class GQLCapture {
|
|
|
96
125
|
private static customArgs;
|
|
97
126
|
private static customInputObjects;
|
|
98
127
|
private static customObjects;
|
|
128
|
+
private static customInterfaces;
|
|
129
|
+
private static customUnions;
|
|
99
130
|
private static customTypes;
|
|
100
131
|
static clear(): void;
|
|
101
132
|
static getCustomFields(): Map<string, CustomField[]>;
|
|
@@ -104,33 +135,35 @@ export declare class GQLCapture {
|
|
|
104
135
|
static getCustomArgs(): Map<string, CustomObject>;
|
|
105
136
|
static getCustomInputObjects(): Map<string, CustomObject>;
|
|
106
137
|
static getCustomObjects(): Map<string, CustomObject>;
|
|
138
|
+
static getCustomInterfaces(): Map<string, CustomObject>;
|
|
139
|
+
static getCustomUnions(): Map<string, CustomObject>;
|
|
107
140
|
static getCustomTypes(): Map<string, CustomType>;
|
|
108
141
|
private static getNullableArg;
|
|
109
142
|
static getProcessedCustomFields(): ProcessCustomFieldMap;
|
|
110
143
|
static getProcessedCustomMutations(): ProcessedCustomField[];
|
|
111
144
|
static getProcessedCustomQueries(): ProcessedCustomField[];
|
|
112
145
|
private static getProcessedCustomFieldsImpl;
|
|
113
|
-
private static
|
|
114
|
-
static gqlField(options
|
|
146
|
+
private static getField;
|
|
147
|
+
static gqlField(options: gqlFieldOptions): any;
|
|
115
148
|
private static getCustomField;
|
|
116
|
-
|
|
117
|
-
private static argImpl;
|
|
118
|
-
static gqlArg(name: string, options?: gqlFieldOptions): any;
|
|
119
|
-
static gqlContextType(): any;
|
|
149
|
+
static gqlContextType(): gqlFieldArg;
|
|
120
150
|
static gqlArgType(options?: gqlObjectOptions): any;
|
|
121
151
|
static gqlInputObjectType(options?: gqlObjectOptions): any;
|
|
122
|
-
static gqlObjectType(options?:
|
|
152
|
+
static gqlObjectType(options?: gqlObjectWithInterfaceOptions): any;
|
|
153
|
+
static gqlUnionType(options: gqlObjectWithUnionOptions): any;
|
|
154
|
+
static gqlInterfaceType(options?: gqlObjectOptions): any;
|
|
123
155
|
private static customGQLObject;
|
|
124
|
-
static gqlQuery(options
|
|
125
|
-
static gqlMutation(options
|
|
156
|
+
static gqlQuery(options: gqlQueryOptions): any;
|
|
157
|
+
static gqlMutation(options: gqlMutationOptions): any;
|
|
126
158
|
static gqlConnection(type: Type): any;
|
|
127
159
|
static resolve(objects: string[]): void;
|
|
128
160
|
}
|
|
129
161
|
export declare const gqlField: typeof GQLCapture.gqlField;
|
|
130
|
-
export declare const gqlArg: typeof GQLCapture.gqlArg;
|
|
131
162
|
export declare const gqlArgType: typeof GQLCapture.gqlArgType;
|
|
132
163
|
export declare const gqlInputObjectType: typeof GQLCapture.gqlInputObjectType;
|
|
133
164
|
export declare const gqlObjectType: typeof GQLCapture.gqlObjectType;
|
|
165
|
+
export declare const gqlInterfaceType: typeof GQLCapture.gqlInterfaceType;
|
|
166
|
+
export declare const gqlUnionType: typeof GQLCapture.gqlUnionType;
|
|
134
167
|
export declare const gqlQuery: typeof GQLCapture.gqlQuery;
|
|
135
168
|
export declare const gqlMutation: typeof GQLCapture.gqlMutation;
|
|
136
169
|
export declare const gqlContextType: typeof GQLCapture.gqlContextType;
|