@snowtop/ent 0.1.0-alpha7 → 0.1.0-alpha8
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 +2 -0
- package/action/executor.d.ts +1 -1
- package/action/orchestrator.d.ts +10 -2
- package/action/orchestrator.js +128 -34
- package/core/base.d.ts +5 -1
- package/core/base.js +16 -0
- package/core/clause.d.ts +24 -3
- package/core/clause.js +246 -5
- package/core/config.d.ts +18 -0
- package/core/config.js +17 -0
- package/core/db.d.ts +3 -3
- package/core/db.js +2 -0
- package/core/ent.d.ts +2 -4
- package/core/ent.js +70 -23
- package/core/loaders/assoc_edge_loader.d.ts +1 -1
- package/core/loaders/assoc_edge_loader.js +5 -4
- package/core/loaders/index_loader.js +1 -0
- package/core/loaders/object_loader.d.ts +7 -2
- package/core/loaders/object_loader.js +59 -4
- package/core/privacy.js +3 -0
- package/core/viewer.d.ts +1 -0
- package/core/viewer.js +4 -0
- package/graphql/graphql.d.ts +3 -2
- package/graphql/graphql.js +22 -21
- package/graphql/node_resolver.d.ts +0 -1
- package/index.d.ts +16 -1
- package/index.js +18 -5
- package/package.json +2 -2
- package/parse_schema/parse.d.ts +11 -4
- package/parse_schema/parse.js +50 -6
- package/schema/base_schema.d.ts +36 -1
- package/schema/base_schema.js +48 -2
- package/schema/index.d.ts +2 -2
- package/schema/index.js +8 -1
- package/schema/schema.d.ts +50 -1
- package/schema/schema.js +113 -5
- package/scripts/custom_graphql.js +122 -15
- package/scripts/transform_schema.js +204 -55
- package/testutils/builder.d.ts +5 -1
- package/testutils/builder.js +46 -2
- package/testutils/context/test_context.d.ts +2 -2
- package/testutils/context/test_context.js +7 -1
- package/testutils/db/test_db.d.ts +2 -1
- package/testutils/db/test_db.js +13 -4
- package/testutils/ent-graphql-tests/index.d.ts +2 -0
- package/testutils/ent-graphql-tests/index.js +7 -5
- package/testutils/fake_data/fake_contact.d.ts +2 -6
- package/testutils/fake_data/fake_contact.js +9 -16
- package/testutils/fake_data/fake_event.d.ts +2 -6
- package/testutils/fake_data/fake_event.js +17 -24
- package/testutils/fake_data/fake_user.d.ts +2 -6
- package/testutils/fake_data/fake_user.js +10 -17
- package/testutils/fake_data/test_helpers.js +1 -1
|
@@ -63,35 +63,28 @@ class FakeEvent {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
exports.FakeEvent = FakeEvent;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
userID: (0, schema_1.UUIDType)({
|
|
83
|
-
foreignKey: { schema: "User", column: "ID" },
|
|
84
|
-
}),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.FakeEventSchema = FakeEventSchema;
|
|
66
|
+
exports.FakeEventSchema = (0, builder_1.getBuilderSchemaFromFields)({
|
|
67
|
+
startTime: (0, schema_1.TimestampType)({
|
|
68
|
+
index: true,
|
|
69
|
+
}),
|
|
70
|
+
endTime: (0, schema_1.TimestampType)({
|
|
71
|
+
nullable: true,
|
|
72
|
+
}),
|
|
73
|
+
title: (0, schema_1.StringType)(),
|
|
74
|
+
location: (0, schema_1.StringType)(),
|
|
75
|
+
description: (0, schema_1.StringType)({
|
|
76
|
+
nullable: true,
|
|
77
|
+
}),
|
|
78
|
+
userID: (0, schema_1.UUIDType)({
|
|
79
|
+
foreignKey: { schema: "User", column: "ID" },
|
|
80
|
+
}),
|
|
81
|
+
}, FakeEvent);
|
|
89
82
|
function getEventBuilder(viewer, input) {
|
|
90
83
|
const m = new Map();
|
|
91
84
|
for (const key in input) {
|
|
92
85
|
m.set(key, input[key]);
|
|
93
86
|
}
|
|
94
|
-
return new builder_1.SimpleBuilder(viewer,
|
|
87
|
+
return new builder_1.SimpleBuilder(viewer, exports.FakeEventSchema, m);
|
|
95
88
|
}
|
|
96
89
|
exports.getEventBuilder = getEventBuilder;
|
|
97
90
|
async function createEvent(viewer, input) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ID, Ent, Viewer, Data, LoadEntOptions, PrivacyPolicy } from "../../core/base";
|
|
2
|
-
import {
|
|
3
|
-
import { BaseEntSchema, FieldMap } from "../../schema";
|
|
2
|
+
import { SimpleAction } from "../builder";
|
|
4
3
|
import { NodeType } from "./const";
|
|
5
4
|
import { IDViewer, IDViewerOptions } from "../../core/viewer";
|
|
6
5
|
import { ObjectLoaderFactory } from "../../core/loaders";
|
|
@@ -32,10 +31,7 @@ export declare class FakeUser implements Ent {
|
|
|
32
31
|
static load(v: Viewer, id: ID): Promise<FakeUser | null>;
|
|
33
32
|
static loadX(v: Viewer, id: ID): Promise<FakeUser>;
|
|
34
33
|
}
|
|
35
|
-
export declare
|
|
36
|
-
ent: typeof FakeUser;
|
|
37
|
-
fields: FieldMap;
|
|
38
|
-
}
|
|
34
|
+
export declare const FakeUserSchema: import("../builder").BuilderSchema<FakeUser>;
|
|
39
35
|
export interface UserCreateInput {
|
|
40
36
|
firstName: string;
|
|
41
37
|
lastName: string;
|
|
@@ -89,22 +89,15 @@ class FakeUser {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
exports.FakeUser = FakeUser;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
password: (0, schema_1.StringType)({
|
|
102
|
-
nullable: true,
|
|
103
|
-
}),
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.FakeUserSchema = FakeUserSchema;
|
|
92
|
+
exports.FakeUserSchema = (0, builder_1.getBuilderSchemaFromFields)({
|
|
93
|
+
firstName: (0, schema_1.StringType)(),
|
|
94
|
+
lastName: (0, schema_1.StringType)(),
|
|
95
|
+
emailAddress: (0, schema_1.StringType)(),
|
|
96
|
+
phoneNumber: (0, schema_1.StringType)(),
|
|
97
|
+
password: (0, schema_1.StringType)({
|
|
98
|
+
nullable: true,
|
|
99
|
+
}),
|
|
100
|
+
}, FakeUser);
|
|
108
101
|
function getUserBuilder(viewer, input) {
|
|
109
102
|
const action = getUserAction(viewer, input);
|
|
110
103
|
return action.builder;
|
|
@@ -115,7 +108,7 @@ function getUserAction(viewer, input) {
|
|
|
115
108
|
for (const key in input) {
|
|
116
109
|
m.set(key, input[key]);
|
|
117
110
|
}
|
|
118
|
-
const action = new builder_1.SimpleAction(viewer,
|
|
111
|
+
const action = new builder_1.SimpleAction(viewer, exports.FakeUserSchema, m);
|
|
119
112
|
action.viewerForEntLoad = (data) => {
|
|
120
113
|
// load the created ent using a VC of the newly created user.
|
|
121
114
|
return new viewer_1.IDViewer(data.id);
|
|
@@ -107,7 +107,7 @@ async function createUserPlusFriendRequests(input, slice) {
|
|
|
107
107
|
return createTestUser(input);
|
|
108
108
|
}));
|
|
109
109
|
expect(friendRequests.length).toBe(userInputs.length);
|
|
110
|
-
await addEdge(user,
|
|
110
|
+
await addEdge(user, _1.FakeUserSchema, _1.EdgeType.UserToFriendRequests, true, ...friendRequests);
|
|
111
111
|
return [user, friendRequests];
|
|
112
112
|
}
|
|
113
113
|
exports.createUserPlusFriendRequests = createUserPlusFriendRequests;
|