@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/action/orchestrator.d.ts
CHANGED
|
@@ -1,13 +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
|
import * as clause from "../core/clause";
|
|
7
8
|
type MaybeNull<T extends Ent> = T | null;
|
|
8
9
|
type TMaybleNullableEnt<T extends Ent> = T | MaybeNull<T>;
|
|
9
10
|
export interface OrchestratorOptions<TEnt extends Ent<TViewer>, TInput extends Data, TViewer extends Viewer, TExistingEnt extends TMaybleNullableEnt<TEnt> = MaybeNull<TEnt>> {
|
|
10
|
-
viewer:
|
|
11
|
+
viewer: TViewer;
|
|
11
12
|
operation: WriteOperation;
|
|
12
13
|
tableName: string;
|
|
13
14
|
loaderOptions: LoadEntOptions<TEnt, TViewer>;
|
|
@@ -37,6 +38,7 @@ export declare class Orchestrator<TEnt extends Ent<TViewer>, TInput extends Data
|
|
|
37
38
|
private options;
|
|
38
39
|
private edgeSet;
|
|
39
40
|
private edges;
|
|
41
|
+
private conditionalEdges;
|
|
40
42
|
private validatedFields;
|
|
41
43
|
private logValues;
|
|
42
44
|
private changesets;
|
|
@@ -49,21 +51,24 @@ export declare class Orchestrator<TEnt extends Ent<TViewer>, TInput extends Data
|
|
|
49
51
|
private actualOperation;
|
|
50
52
|
private existingEnt;
|
|
51
53
|
private disableTransformations;
|
|
54
|
+
private onConflict;
|
|
52
55
|
private memoizedGetFields;
|
|
53
56
|
constructor(options: OrchestratorOptions<TEnt, TInput, TViewer, TExistingEnt>);
|
|
54
57
|
__getOptions(): OrchestratorOptions<any, any, any, any>;
|
|
55
58
|
private addEdge;
|
|
56
59
|
setDisableTransformations(val: boolean): void;
|
|
60
|
+
setOnConflictOptions(onConflict: CreateRowOptions["onConflict"]): void;
|
|
57
61
|
addInboundEdge<T2 extends Ent>(id1: ID | Builder<T2, any>, edgeType: string, nodeType: string, options?: AssocEdgeInputOptions): void;
|
|
58
62
|
addOutboundEdge<T2 extends Ent>(id2: ID | Builder<T2, any>, edgeType: string, nodeType: string, options?: AssocEdgeInputOptions): void;
|
|
59
|
-
removeInboundEdge(id1: ID, edgeType: string): void;
|
|
60
|
-
removeOutboundEdge(id2: ID, edgeType: string): void;
|
|
63
|
+
removeInboundEdge(id1: ID, edgeType: string, options?: AssocEdgeOptions): void;
|
|
64
|
+
removeOutboundEdge(id2: ID, edgeType: string, options?: AssocEdgeOptions): void;
|
|
61
65
|
getInputEdges(edgeType: string, op: WriteOperation): EdgeInputData[];
|
|
62
66
|
clearInputEdges(edgeType: string, op: WriteOperation, id?: ID): void;
|
|
63
67
|
private buildMainOp;
|
|
64
68
|
private getEdgeOperation;
|
|
65
69
|
private buildEdgeOps;
|
|
66
70
|
private throwError;
|
|
71
|
+
private getRowForPrivacyPolicyImpl;
|
|
67
72
|
private getEntForPrivacyPolicyImpl;
|
|
68
73
|
private getSQLStatementOperation;
|
|
69
74
|
private getWriteOpForSQLStamentOp;
|
|
@@ -95,7 +100,9 @@ export declare class Orchestrator<TEnt extends Ent<TViewer>, TInput extends Data
|
|
|
95
100
|
* If those throws, this still throws and doesn't return them
|
|
96
101
|
*/
|
|
97
102
|
validWithErrors(): Promise<Error[]>;
|
|
103
|
+
private buildPlusChangeset;
|
|
98
104
|
build(): Promise<EntChangeset<TEnt>>;
|
|
105
|
+
buildWithOptions_BETA(options: ChangesetOptions): Promise<EntChangeset<TEnt>>;
|
|
99
106
|
private viewerForEntLoad;
|
|
100
107
|
returnedRow(): Promise<Data | null>;
|
|
101
108
|
editedEnt(): Promise<TEnt | null>;
|
|
@@ -103,15 +110,22 @@ export declare class Orchestrator<TEnt extends Ent<TViewer>, TInput extends Data
|
|
|
103
110
|
}
|
|
104
111
|
export declare class EntChangeset<T extends Ent> implements Changeset {
|
|
105
112
|
viewer: Viewer;
|
|
113
|
+
private builder;
|
|
106
114
|
readonly placeholderID: ID;
|
|
107
|
-
|
|
115
|
+
private conditionalOverride;
|
|
108
116
|
operations: DataOperation[];
|
|
109
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;
|
|
110
118
|
changesets?: Changeset[] | undefined;
|
|
111
119
|
private options?;
|
|
112
120
|
private _executor;
|
|
113
|
-
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);
|
|
114
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>;
|
|
124
|
+
private static changesetFromEdgeOp;
|
|
125
|
+
static changesetFromOutboundEdge(builder: Builder<any, any, any>, edgeType: string, id2: Builder<any> | ID, nodeType: string, options?: AssocEdgeInputOptions): Promise<EntChangeset<any>>;
|
|
126
|
+
static changesetFromInboundEdge(builder: Builder<any, any, any>, edgeType: string, id1: Builder<any> | ID, nodeType: string, options?: AssocEdgeInputOptions): Promise<EntChangeset<any>>;
|
|
127
|
+
static changesetRemoveFromOutboundEdge(builder: Builder<any, any, any>, edgeType: string, id2: ID, options?: AssocEdgeInputOptions): Promise<EntChangeset<any>>;
|
|
128
|
+
static changesetRemoveFromInboundEdge(builder: Builder<any, any, any>, edgeType: string, id1: ID, options?: AssocEdgeInputOptions): Promise<EntChangeset<any>>;
|
|
115
129
|
executor(): Executor;
|
|
116
130
|
}
|
|
117
131
|
export {};
|