@snowtop/ent 0.1.14-test3 → 0.1.14
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
CHANGED
|
@@ -24,7 +24,7 @@ export interface Builder<TEnt extends Ent<TViewer>, TViewer extends Viewer = Vie
|
|
|
24
24
|
getInput(): Data;
|
|
25
25
|
orchestrator: BuilderOrchestrator;
|
|
26
26
|
}
|
|
27
|
-
export interface Executor extends Iterable<DataOperation
|
|
27
|
+
export interface Executor extends Iterable<DataOperation>, Iterator<DataOperation> {
|
|
28
28
|
placeholderID: ID;
|
|
29
29
|
resolveValue(val: any): Ent | null;
|
|
30
30
|
builderOpChanged(builder: Builder<any>): boolean;
|
package/action/executor.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare class ComplexExecutor<T extends Ent> implements Executor {
|
|
|
40
40
|
private executors;
|
|
41
41
|
private changedOps;
|
|
42
42
|
builder?: Builder<Ent> | undefined;
|
|
43
|
-
constructor(viewer: Viewer, placeholderID: ID, operations: DataOperation
|
|
43
|
+
constructor(viewer: Viewer, placeholderID: ID, operations: DataOperation[], dependencies: Map<ID, Builder<T>>, changesets: Changeset[], options?: OrchestratorOptions<T, Data, Viewer>, complexOptions?: ComplexExecutorOptions | undefined);
|
|
44
44
|
[Symbol.iterator](): this;
|
|
45
45
|
private handleCreatedEnt;
|
|
46
46
|
next(): IteratorResult<DataOperation<Ent>>;
|
|
@@ -51,5 +51,5 @@ export declare class ComplexExecutor<T extends Ent> implements Executor {
|
|
|
51
51
|
preFetch?(queryer: Queryer, context: Context): Promise<void>;
|
|
52
52
|
postFetch?(queryer: Queryer, context: Context): Promise<void>;
|
|
53
53
|
}
|
|
54
|
-
export declare function executeOperations(executor: Executor, context?: Context, trackOps?: true): Promise<DataOperation<Ent<Viewer<Ent<any> | null, ID | null
|
|
54
|
+
export declare function executeOperations(executor: Executor, context?: Context, trackOps?: true): Promise<DataOperation<Ent<Viewer<Ent<any> | null, ID | null>>>[]>;
|
|
55
55
|
export {};
|
package/action/operations.d.ts
CHANGED
|
@@ -3,62 +3,62 @@ import { Viewer, Ent, ID, Data, DataOptions, EditRowOptions, LoadEntOptions, Con
|
|
|
3
3
|
import { Executor } from "../action/action";
|
|
4
4
|
import { WriteOperation, Builder } from "../action";
|
|
5
5
|
import { AssocEdgeData, parameterizedQueryOptions } from "../core/ent";
|
|
6
|
-
export interface UpdatedOperation
|
|
6
|
+
export interface UpdatedOperation {
|
|
7
7
|
operation: WriteOperation;
|
|
8
|
-
builder: Builder<
|
|
8
|
+
builder: Builder<any>;
|
|
9
9
|
}
|
|
10
|
-
export interface DataOperation<
|
|
11
|
-
builder: Builder<
|
|
10
|
+
export interface DataOperation<T extends Ent = Ent> {
|
|
11
|
+
builder: Builder<T>;
|
|
12
12
|
preFetch?(queryer: Queryer, context?: Context): Promise<void>;
|
|
13
13
|
performWriteSync(queryer: SyncQueryer, context?: Context): void;
|
|
14
14
|
performWrite(queryer: Queryer, context?: Context): Promise<void>;
|
|
15
15
|
placeholderID?: ID;
|
|
16
16
|
returnedRow?(): Data | null;
|
|
17
|
-
createdEnt?(viewer: Viewer):
|
|
17
|
+
createdEnt?(viewer: Viewer): T | null;
|
|
18
18
|
shortCircuit?(executor: Executor): boolean;
|
|
19
|
-
updatedOperation?(): UpdatedOperation
|
|
19
|
+
updatedOperation?(): UpdatedOperation | null;
|
|
20
20
|
resolve?(executor: Executor): void;
|
|
21
21
|
postFetch?(queryer: Queryer, context?: Context): Promise<void>;
|
|
22
22
|
}
|
|
23
|
-
export declare class DeleteNodeOperation
|
|
23
|
+
export declare class DeleteNodeOperation implements DataOperation {
|
|
24
24
|
private id;
|
|
25
|
-
readonly builder: Builder<
|
|
25
|
+
readonly builder: Builder<Ent>;
|
|
26
26
|
private options;
|
|
27
|
-
constructor(id: ID, builder: Builder<
|
|
27
|
+
constructor(id: ID, builder: Builder<Ent>, options: DataOptions);
|
|
28
28
|
performWrite(queryer: Queryer, context?: Context): Promise<void>;
|
|
29
29
|
performWriteSync(queryer: SyncQueryer, context?: Context): void;
|
|
30
30
|
}
|
|
31
|
-
export declare class RawQueryOperation<TEnt extends Ent<TViewer>, TViewer extends Viewer = Viewer> implements DataOperation<TEnt
|
|
31
|
+
export declare class RawQueryOperation<TEnt extends Ent<TViewer>, TViewer extends Viewer = Viewer> implements DataOperation<TEnt> {
|
|
32
32
|
builder: Builder<TEnt, TViewer>;
|
|
33
33
|
private queries;
|
|
34
34
|
constructor(builder: Builder<TEnt, TViewer>, queries: (string | parameterizedQueryOptions)[]);
|
|
35
35
|
performWrite(queryer: Queryer, context?: Context): Promise<void>;
|
|
36
36
|
performWriteSync(queryer: SyncQueryer, context?: Context): void;
|
|
37
37
|
}
|
|
38
|
-
export interface EditNodeOptions<
|
|
38
|
+
export interface EditNodeOptions<T extends Ent> extends EditRowOptions {
|
|
39
39
|
fieldsToResolve: string[];
|
|
40
|
-
loadEntOptions: LoadEntOptions<
|
|
40
|
+
loadEntOptions: LoadEntOptions<T>;
|
|
41
41
|
key: string;
|
|
42
42
|
onConflict?: CreateRowOptions["onConflict"];
|
|
43
|
-
builder: Builder<
|
|
43
|
+
builder: Builder<T>;
|
|
44
44
|
}
|
|
45
|
-
export declare class NoOperation<
|
|
46
|
-
builder: Builder<
|
|
45
|
+
export declare class NoOperation<T extends Ent> implements DataOperation<T> {
|
|
46
|
+
builder: Builder<any>;
|
|
47
47
|
private row;
|
|
48
|
-
constructor(builder: Builder<
|
|
48
|
+
constructor(builder: Builder<any>, existingEnt?: Ent | null);
|
|
49
49
|
performWrite(queryer: Queryer, context?: Context): Promise<void>;
|
|
50
50
|
performWriteSync(queryer: SyncQueryer, context?: Context): void;
|
|
51
51
|
returnedRow(): Data | null;
|
|
52
52
|
}
|
|
53
|
-
export declare class EditNodeOperation<
|
|
54
|
-
options: EditNodeOptions<
|
|
53
|
+
export declare class EditNodeOperation<T extends Ent> implements DataOperation {
|
|
54
|
+
options: EditNodeOptions<T>;
|
|
55
55
|
private existingEnt;
|
|
56
56
|
private row;
|
|
57
57
|
placeholderID?: ID | undefined;
|
|
58
58
|
private updatedOp;
|
|
59
|
-
builder: Builder<
|
|
59
|
+
builder: Builder<T>;
|
|
60
60
|
private resolved;
|
|
61
|
-
constructor(options: EditNodeOptions<
|
|
61
|
+
constructor(options: EditNodeOptions<T>, existingEnt?: Ent | null);
|
|
62
62
|
resolve<T extends Ent>(executor: Executor): void;
|
|
63
63
|
private hasData;
|
|
64
64
|
private buildOnConflictQuery;
|
|
@@ -67,8 +67,8 @@ export declare class EditNodeOperation<TEnt extends Ent<TViewer>, TViewer extend
|
|
|
67
67
|
private reloadRow;
|
|
68
68
|
performWriteSync(queryer: SyncQueryer, context?: Context): void;
|
|
69
69
|
returnedRow(): Data | null;
|
|
70
|
-
createdEnt(viewer: Viewer):
|
|
71
|
-
updatedOperation(): UpdatedOperation
|
|
70
|
+
createdEnt(viewer: Viewer): T | null;
|
|
71
|
+
updatedOperation(): UpdatedOperation | null;
|
|
72
72
|
}
|
|
73
73
|
export interface AssocEdgeInputOptions extends AssocEdgeOptions {
|
|
74
74
|
time?: Date;
|
|
@@ -85,8 +85,8 @@ export interface AssocEdgeInput extends AssocEdgeInputOptions {
|
|
|
85
85
|
id2: ID;
|
|
86
86
|
id2Type: string;
|
|
87
87
|
}
|
|
88
|
-
export declare class EdgeOperation
|
|
89
|
-
builder: Builder<any
|
|
88
|
+
export declare class EdgeOperation implements DataOperation {
|
|
89
|
+
builder: Builder<any>;
|
|
90
90
|
edgeInput: AssocEdgeInput;
|
|
91
91
|
private options;
|
|
92
92
|
private edgeData;
|
|
@@ -102,33 +102,33 @@ export declare class EdgeOperation<TViewer extends Viewer = Viewer> implements D
|
|
|
102
102
|
private performInsertWriteSync;
|
|
103
103
|
private resolveImpl;
|
|
104
104
|
resolve(executor: Executor): void;
|
|
105
|
-
symmetricEdge(): EdgeOperation
|
|
106
|
-
inverseEdge(edgeData: AssocEdgeData): EdgeOperation
|
|
105
|
+
symmetricEdge(): EdgeOperation;
|
|
106
|
+
inverseEdge(edgeData: AssocEdgeData): EdgeOperation;
|
|
107
107
|
private static resolveIDs;
|
|
108
108
|
private static isBuilder;
|
|
109
109
|
private static resolveData;
|
|
110
|
-
static inboundEdge<T extends Ent
|
|
111
|
-
static outboundEdge<T extends Ent
|
|
112
|
-
static removeInboundEdge<T extends Ent
|
|
113
|
-
static removeOutboundEdge<T extends Ent
|
|
110
|
+
static inboundEdge<T extends Ent, T2 extends Ent>(builder: Builder<T>, edgeType: string, id1: Builder<T2> | ID, nodeType: string, options?: AssocEdgeInputOptions): EdgeOperation;
|
|
111
|
+
static outboundEdge<T extends Ent, T2 extends Ent>(builder: Builder<T>, edgeType: string, id2: Builder<T2> | ID, nodeType: string, options?: AssocEdgeInputOptions): EdgeOperation;
|
|
112
|
+
static removeInboundEdge<T extends Ent>(builder: Builder<T>, edgeType: string, id1: ID, options?: AssocEdgeInputOptions): EdgeOperation;
|
|
113
|
+
static removeOutboundEdge<T extends Ent>(builder: Builder<T>, edgeType: string, id2: ID, options?: AssocEdgeInputOptions): EdgeOperation;
|
|
114
114
|
}
|
|
115
|
-
export declare class ConditionalOperation<
|
|
116
|
-
protected op: DataOperation<
|
|
115
|
+
export declare class ConditionalOperation<T extends Ent = Ent> implements DataOperation<T> {
|
|
116
|
+
protected op: DataOperation<T>;
|
|
117
117
|
private conditionalBuilder;
|
|
118
118
|
placeholderID?: ID | undefined;
|
|
119
119
|
protected shortCircuited: boolean;
|
|
120
|
-
readonly builder: Builder<
|
|
121
|
-
constructor(op: DataOperation<
|
|
120
|
+
readonly builder: Builder<T>;
|
|
121
|
+
constructor(op: DataOperation<T>, conditionalBuilder: Builder<any>);
|
|
122
122
|
shortCircuit(executor: Executor): boolean;
|
|
123
123
|
preFetch(queryer: Queryer, context?: Context<Viewer<Ent<any> | null, ID | null>> | undefined): Promise<void>;
|
|
124
124
|
performWriteSync(queryer: SyncQueryer, context?: Context<Viewer<Ent<any> | null, ID | null>> | undefined): void;
|
|
125
125
|
performWrite(queryer: Queryer, context?: Context<Viewer<Ent<any> | null, ID | null>> | undefined): Promise<void>;
|
|
126
126
|
returnedRow(): Data | null;
|
|
127
|
-
updatedOperation(): UpdatedOperation
|
|
127
|
+
updatedOperation(): UpdatedOperation | null;
|
|
128
128
|
resolve(executor: Executor): void;
|
|
129
129
|
postFetch(queryer: Queryer, context?: Context<Viewer<Ent<any> | null, ID | null>> | undefined): Promise<void>;
|
|
130
130
|
}
|
|
131
|
-
export declare class ConditionalNodeOperation<
|
|
132
|
-
createdEnt(viewer: Viewer):
|
|
133
|
-
updatedOperation(): UpdatedOperation
|
|
131
|
+
export declare class ConditionalNodeOperation<T extends Ent> extends ConditionalOperation<T> {
|
|
132
|
+
createdEnt(viewer: Viewer): T | null;
|
|
133
|
+
updatedOperation(): UpdatedOperation | null;
|
|
134
134
|
}
|
package/action/orchestrator.d.ts
CHANGED
|
@@ -21,14 +21,14 @@ export interface OrchestratorOptions<TEnt extends Ent<TViewer>, TInput extends D
|
|
|
21
21
|
expressions?: Map<string, clause.Clause>;
|
|
22
22
|
fieldInfo: FieldInfoMap;
|
|
23
23
|
}
|
|
24
|
-
interface edgeInputDataOpts
|
|
24
|
+
interface edgeInputDataOpts {
|
|
25
25
|
edgeType: string;
|
|
26
|
-
id: Builder<
|
|
26
|
+
id: Builder<Ent> | ID;
|
|
27
27
|
nodeType?: string;
|
|
28
28
|
options?: AssocEdgeInputOptions;
|
|
29
29
|
}
|
|
30
|
-
export interface EdgeInputData
|
|
31
|
-
isBuilder(id: Builder<
|
|
30
|
+
export interface EdgeInputData extends edgeInputDataOpts {
|
|
31
|
+
isBuilder(id: Builder<Ent> | ID): id is Builder<Ent>;
|
|
32
32
|
}
|
|
33
33
|
export declare enum edgeDirection {
|
|
34
34
|
inboundEdge = 0,
|
|
@@ -62,7 +62,7 @@ export declare class Orchestrator<TEnt extends Ent<TViewer>, TInput extends Data
|
|
|
62
62
|
addOutboundEdge<T2 extends Ent>(id2: ID | Builder<T2, any>, edgeType: string, nodeType: string, options?: AssocEdgeInputOptions): void;
|
|
63
63
|
removeInboundEdge(id1: ID, edgeType: string, options?: AssocEdgeOptions): void;
|
|
64
64
|
removeOutboundEdge(id2: ID, edgeType: string, options?: AssocEdgeOptions): void;
|
|
65
|
-
getInputEdges(edgeType: string, op: WriteOperation): EdgeInputData
|
|
65
|
+
getInputEdges(edgeType: string, op: WriteOperation): EdgeInputData[];
|
|
66
66
|
clearInputEdges(edgeType: string, op: WriteOperation, id?: ID): void;
|
|
67
67
|
private buildMainOp;
|
|
68
68
|
private getEdgeOperation;
|
|
@@ -108,24 +108,24 @@ export declare class Orchestrator<TEnt extends Ent<TViewer>, TInput extends Data
|
|
|
108
108
|
editedEnt(): Promise<TEnt | null>;
|
|
109
109
|
editedEntX(): Promise<TEnt>;
|
|
110
110
|
}
|
|
111
|
-
export declare class EntChangeset<
|
|
111
|
+
export declare class EntChangeset<T extends Ent> implements Changeset {
|
|
112
112
|
viewer: Viewer;
|
|
113
113
|
private builder;
|
|
114
114
|
readonly placeholderID: ID;
|
|
115
115
|
private conditionalOverride;
|
|
116
|
-
operations: DataOperation
|
|
116
|
+
operations: DataOperation[];
|
|
117
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;
|
|
118
118
|
changesets?: Changeset[] | undefined;
|
|
119
119
|
private options?;
|
|
120
120
|
private _executor;
|
|
121
|
-
constructor(viewer: Viewer, builder: Builder<
|
|
122
|
-
static changesetFrom
|
|
123
|
-
static changesetFromQueries
|
|
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>;
|
|
124
124
|
private static changesetFromEdgeOp;
|
|
125
|
-
static changesetFromOutboundEdge
|
|
126
|
-
static changesetFromInboundEdge
|
|
127
|
-
static changesetRemoveFromOutboundEdge
|
|
128
|
-
static changesetRemoveFromInboundEdge
|
|
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>>;
|
|
129
129
|
executor(): Executor;
|
|
130
130
|
}
|
|
131
131
|
export {};
|
package/action/transaction.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { Ent, Viewer
|
|
2
|
-
import { Action } from "./action";
|
|
3
|
-
|
|
4
|
-
type MaybeNull<T extends Ent> = T | null;
|
|
5
|
-
type TMaybleNullableEnt<T extends Ent> = T | MaybeNull<T>;
|
|
6
|
-
type ActionAny<TEnt extends Ent<TViewer>, TViewer extends Viewer, TInput extends Data, TExistingEnt extends TMaybleNullableEnt<TEnt> = MaybeNull<TEnt>> = Action<TEnt, EntBuilder<TEnt, TViewer, TInput, TExistingEnt>, TViewer, TInput, TExistingEnt>;
|
|
1
|
+
import { Ent, Viewer } from "../core/base";
|
|
2
|
+
import { Action, Builder } from "./action";
|
|
3
|
+
type ActionAny<TViewer extends Viewer = Viewer> = Action<Ent<TViewer>, Builder<Ent<TViewer>, TViewer, any>, Viewer<any, any>, any, any>;
|
|
7
4
|
export declare class Transaction<TViewer extends Viewer = Viewer> {
|
|
8
5
|
private viewer;
|
|
9
6
|
private actions;
|
|
10
|
-
constructor(viewer: TViewer, actions: ActionAny<
|
|
7
|
+
constructor(viewer: TViewer, actions: ActionAny<TViewer>[]);
|
|
11
8
|
run(): Promise<void>;
|
|
12
9
|
}
|
|
13
10
|
export {};
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ import { MockLogs } from "../../testutils/mock_log";
|
|
|
7
7
|
import { Table } from "../db/temp_db";
|
|
8
8
|
export declare function setupTest(): void;
|
|
9
9
|
export declare function getML(): MockLogs;
|
|
10
|
-
export declare function getOperations(): DataOperation<
|
|
10
|
+
export declare function getOperations(): DataOperation<Ent<Viewer<Ent<any> | null, ID | null>>>[];
|
|
11
11
|
export declare const UserSchema: BuilderSchema<User>;
|
|
12
12
|
export declare class UserWithBalance extends User {
|
|
13
13
|
}
|
|
@@ -45,7 +45,7 @@ export declare class UserAction extends SimpleAction<User> {
|
|
|
45
45
|
getTriggers(): Trigger<User, SimpleBuilder<User>>[];
|
|
46
46
|
getObservers(): Observer<User, SimpleBuilder<User>>[];
|
|
47
47
|
}
|
|
48
|
-
type getMembershipFunction = (viewer: Viewer, edge: EdgeInputData
|
|
48
|
+
type getMembershipFunction = (viewer: Viewer, edge: EdgeInputData) => SimpleAction<Ent>;
|
|
49
49
|
export declare class GroupMembershipTrigger implements Trigger<Group, SimpleBuilder<Group>> {
|
|
50
50
|
private getter;
|
|
51
51
|
constructor(getter: getMembershipFunction);
|