@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/action/orchestrator.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { ID, Data, Ent, Viewer,
|
|
2
|
-
import {
|
|
1
|
+
import { ID, Data, Ent, Viewer, LoadEntOptions, CreateRowOptions } from "../core/base";
|
|
2
|
+
import { parameterizedQueryOptions } from "../core/ent";
|
|
3
3
|
import { SchemaInputType, FieldInfoMap } from "../schema/schema";
|
|
4
|
-
import { Changeset, Executor } from "../action/action";
|
|
4
|
+
import { Changeset, ChangesetOptions, Executor } from "../action/action";
|
|
5
|
+
import { AssocEdgeInputOptions, DataOperation, AssocEdgeOptions } from "./operations";
|
|
5
6
|
import { WriteOperation, Builder, Action } from "../action";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import * as clause from "../core/clause";
|
|
8
|
+
type MaybeNull<T extends Ent> = T | null;
|
|
9
|
+
type TMaybleNullableEnt<T extends Ent> = T | MaybeNull<T>;
|
|
10
|
+
export interface OrchestratorOptions<TEnt extends Ent<TViewer>, TInput extends Data, TViewer extends Viewer, TExistingEnt extends TMaybleNullableEnt<TEnt> = MaybeNull<TEnt>> {
|
|
11
|
+
viewer: TViewer;
|
|
10
12
|
operation: WriteOperation;
|
|
11
13
|
tableName: string;
|
|
12
14
|
loaderOptions: LoadEntOptions<TEnt, TViewer>;
|
|
@@ -16,6 +18,7 @@ export interface OrchestratorOptions<TEnt extends Ent<TViewer>, TViewer extends
|
|
|
16
18
|
schema: SchemaInputType;
|
|
17
19
|
editedFields(): Map<string, any> | Promise<Map<string, any>>;
|
|
18
20
|
updateInput?: (data: TInput) => void;
|
|
21
|
+
expressions?: Map<string, clause.Clause>;
|
|
19
22
|
fieldInfo: FieldInfoMap;
|
|
20
23
|
}
|
|
21
24
|
interface edgeInputDataOpts {
|
|
@@ -35,6 +38,7 @@ export declare class Orchestrator<TEnt extends Ent<TViewer>, TInput extends Data
|
|
|
35
38
|
private options;
|
|
36
39
|
private edgeSet;
|
|
37
40
|
private edges;
|
|
41
|
+
private conditionalEdges;
|
|
38
42
|
private validatedFields;
|
|
39
43
|
private logValues;
|
|
40
44
|
private changesets;
|
|
@@ -47,25 +51,34 @@ export declare class Orchestrator<TEnt extends Ent<TViewer>, TInput extends Data
|
|
|
47
51
|
private actualOperation;
|
|
48
52
|
private existingEnt;
|
|
49
53
|
private disableTransformations;
|
|
54
|
+
private onConflict;
|
|
50
55
|
private memoizedGetFields;
|
|
51
|
-
constructor(options: OrchestratorOptions<TEnt,
|
|
56
|
+
constructor(options: OrchestratorOptions<TEnt, TInput, TViewer, TExistingEnt>);
|
|
57
|
+
__getOptions(): OrchestratorOptions<any, any, any, any>;
|
|
52
58
|
private addEdge;
|
|
53
59
|
setDisableTransformations(val: boolean): void;
|
|
60
|
+
setOnConflictOptions(onConflict: CreateRowOptions["onConflict"]): void;
|
|
54
61
|
addInboundEdge<T2 extends Ent>(id1: ID | Builder<T2, any>, edgeType: string, nodeType: string, options?: AssocEdgeInputOptions): void;
|
|
55
62
|
addOutboundEdge<T2 extends Ent>(id2: ID | Builder<T2, any>, edgeType: string, nodeType: string, options?: AssocEdgeInputOptions): void;
|
|
56
|
-
removeInboundEdge(id1: ID, edgeType: string): void;
|
|
57
|
-
removeOutboundEdge(id2: ID, edgeType: string): void;
|
|
63
|
+
removeInboundEdge(id1: ID, edgeType: string, options?: AssocEdgeOptions): void;
|
|
64
|
+
removeOutboundEdge(id2: ID, edgeType: string, options?: AssocEdgeOptions): void;
|
|
58
65
|
getInputEdges(edgeType: string, op: WriteOperation): EdgeInputData[];
|
|
59
66
|
clearInputEdges(edgeType: string, op: WriteOperation, id?: ID): void;
|
|
60
67
|
private buildMainOp;
|
|
61
68
|
private getEdgeOperation;
|
|
62
69
|
private buildEdgeOps;
|
|
63
70
|
private throwError;
|
|
71
|
+
private getRowForPrivacyPolicyImpl;
|
|
64
72
|
private getEntForPrivacyPolicyImpl;
|
|
65
73
|
private getSQLStatementOperation;
|
|
66
74
|
private getWriteOpForSQLStamentOp;
|
|
67
75
|
getPossibleUnsafeEntForPrivacy(): Promise<TEnt>;
|
|
68
76
|
getEditedData(): Promise<Data>;
|
|
77
|
+
/**
|
|
78
|
+
* @returns validated and formatted fields that would be written to the db
|
|
79
|
+
* throws an error if called before valid() or validX() has been called
|
|
80
|
+
*/
|
|
81
|
+
getValidatedFields(): Data;
|
|
69
82
|
private getFieldsInfo;
|
|
70
83
|
private validate;
|
|
71
84
|
private triggers;
|
|
@@ -79,7 +92,17 @@ export declare class Orchestrator<TEnt extends Ent<TViewer>, TInput extends Data
|
|
|
79
92
|
private formatAndValidateFields;
|
|
80
93
|
valid(): Promise<boolean>;
|
|
81
94
|
validX(): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* @experimental API that's not guaranteed to remain in the future which returns
|
|
97
|
+
* a list of errors encountered
|
|
98
|
+
* 0 errors indicates valid
|
|
99
|
+
* NOTE that this currently doesn't catch errors returned by validators().
|
|
100
|
+
* If those throws, this still throws and doesn't return them
|
|
101
|
+
*/
|
|
102
|
+
validWithErrors(): Promise<Error[]>;
|
|
103
|
+
private buildPlusChangeset;
|
|
82
104
|
build(): Promise<EntChangeset<TEnt>>;
|
|
105
|
+
buildWithOptions_BETA(options: ChangesetOptions): Promise<EntChangeset<TEnt>>;
|
|
83
106
|
private viewerForEntLoad;
|
|
84
107
|
returnedRow(): Promise<Data | null>;
|
|
85
108
|
editedEnt(): Promise<TEnt | null>;
|
|
@@ -87,14 +110,17 @@ export declare class Orchestrator<TEnt extends Ent<TViewer>, TInput extends Data
|
|
|
87
110
|
}
|
|
88
111
|
export declare class EntChangeset<T extends Ent> implements Changeset {
|
|
89
112
|
viewer: Viewer;
|
|
113
|
+
private builder;
|
|
90
114
|
readonly placeholderID: ID;
|
|
91
|
-
|
|
115
|
+
private conditionalOverride;
|
|
92
116
|
operations: DataOperation[];
|
|
93
117
|
dependencies?: Map<ID, Builder<Ent<Viewer<Ent<any> | null, ID | null>>, Viewer<Ent<any> | null, ID | null>, Ent<Viewer<Ent<any> | null, ID | null>> | null>> | undefined;
|
|
94
118
|
changesets?: Changeset[] | undefined;
|
|
95
119
|
private options?;
|
|
96
120
|
private _executor;
|
|
97
|
-
constructor(viewer: Viewer, placeholderID: ID,
|
|
121
|
+
constructor(viewer: Viewer, builder: Builder<T>, placeholderID: ID, conditionalOverride: boolean, operations: DataOperation[], dependencies?: Map<ID, Builder<Ent<Viewer<Ent<any> | null, ID | null>>, Viewer<Ent<any> | null, ID | null>, Ent<Viewer<Ent<any> | null, ID | null>> | null>> | undefined, changesets?: Changeset[] | undefined, options?: OrchestratorOptions<T, Data, Viewer<Ent<any> | null, ID | null>, MaybeNull<T>> | undefined);
|
|
122
|
+
static changesetFrom(builder: Builder<any, any, any>, ops: DataOperation[]): EntChangeset<any>;
|
|
123
|
+
static changesetFromQueries(builder: Builder<any, any, any>, queries: Array<string | parameterizedQueryOptions>): EntChangeset<any>;
|
|
98
124
|
executor(): Executor;
|
|
99
125
|
}
|
|
100
126
|
export {};
|