@snowtop/ent 0.1.0-alpha13 → 0.1.0-alpha130
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 +33 -29
- package/action/action.js +22 -7
- package/action/executor.d.ts +3 -3
- package/action/executor.js +8 -3
- package/action/experimental_action.d.ts +32 -22
- package/action/experimental_action.js +35 -9
- package/action/index.d.ts +2 -0
- package/action/index.js +7 -1
- package/action/orchestrator.d.ts +32 -15
- package/action/orchestrator.js +249 -53
- package/action/privacy.d.ts +2 -2
- 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 +61 -37
- package/core/base.js +7 -1
- package/core/clause.d.ts +85 -40
- package/core/clause.js +375 -64
- package/core/config.d.ts +12 -1
- package/core/config.js +7 -1
- package/core/const.d.ts +3 -0
- package/core/const.js +6 -0
- package/core/context.d.ts +6 -4
- package/core/context.js +20 -2
- package/core/convert.d.ts +1 -1
- package/core/date.js +1 -5
- package/core/db.d.ts +11 -8
- package/core/db.js +20 -8
- package/core/ent.d.ts +86 -30
- package/core/ent.js +626 -197
- package/core/global_schema.d.ts +7 -0
- package/core/global_schema.js +51 -0
- package/core/loaders/assoc_count_loader.d.ts +3 -2
- package/core/loaders/assoc_count_loader.js +10 -2
- package/core/loaders/assoc_edge_loader.d.ts +2 -2
- package/core/loaders/assoc_edge_loader.js +8 -11
- 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 +32 -11
- package/core/loaders/object_loader.js +225 -78
- package/core/loaders/query_loader.d.ts +7 -13
- package/core/loaders/query_loader.js +52 -11
- package/core/loaders/raw_count_loader.d.ts +2 -2
- package/core/loaders/raw_count_loader.js +5 -1
- package/core/logger.d.ts +1 -1
- package/core/logger.js +1 -0
- package/core/privacy.d.ts +25 -24
- package/core/privacy.js +21 -25
- package/core/query/assoc_query.d.ts +7 -6
- 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 +84 -0
- package/core/query/custom_query.d.ts +20 -5
- package/core/query/custom_query.js +87 -12
- package/core/query/index.d.ts +1 -0
- package/core/query/index.js +3 -1
- package/core/query/query.d.ts +8 -4
- package/core/query/query.js +101 -53
- package/core/query/shared_assoc_test.d.ts +2 -1
- package/core/query/shared_assoc_test.js +35 -45
- package/core/query/shared_test.d.ts +8 -1
- package/core/query/shared_test.js +470 -236
- package/core/viewer.d.ts +3 -3
- package/core/viewer.js +1 -1
- package/graphql/graphql.d.ts +51 -19
- package/graphql/graphql.js +160 -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/edge_connection.d.ts +9 -9
- package/graphql/query/page_info.d.ts +1 -1
- 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 +6 -1
- package/imports/index.js +19 -4
- package/index.d.ts +13 -5
- package/index.js +21 -7
- package/package.json +17 -17
- package/parse_schema/parse.d.ts +31 -9
- package/parse_schema/parse.js +155 -13
- package/schema/base_schema.d.ts +5 -3
- package/schema/base_schema.js +6 -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 +5 -1
- package/schema/json_field.d.ts +16 -4
- package/schema/json_field.js +32 -2
- package/schema/schema.d.ts +89 -19
- package/schema/schema.js +11 -13
- 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 +10 -6
- package/scripts/custom_graphql.js +128 -31
- package/scripts/migrate_v0.1.js +36 -0
- package/scripts/move_types.js +120 -0
- package/scripts/read_schema.js +20 -5
- package/testutils/action/complex_schemas.d.ts +69 -0
- package/testutils/action/complex_schemas.js +398 -0
- package/testutils/builder.d.ts +41 -47
- package/testutils/builder.js +76 -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} +24 -8
- package/testutils/db/{test_db.js → temp_db.js} +182 -45
- 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 -7
- 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 +52 -23
- 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 +28 -12
- package/testutils/fake_data/user_query.d.ts +13 -6
- package/testutils/fake_data/user_query.js +54 -22
- package/testutils/fake_log.d.ts +3 -3
- 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 +181 -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
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tagLoader = exports.createTag = exports.getTagAction = exports.getTagBuilder = exports.FakeTagSchema = exports.FakeTag = void 0;
|
|
4
|
+
const ent_1 = require("../../core/ent");
|
|
5
|
+
const privacy_1 = require("../../core/privacy");
|
|
6
|
+
const builder_1 = require("../builder");
|
|
7
|
+
const schema_1 = require("../../schema");
|
|
8
|
+
const const_1 = require("./const");
|
|
9
|
+
const temp_db_1 = require("../db/temp_db");
|
|
10
|
+
const loaders_1 = require("../../core/loaders");
|
|
11
|
+
const convert_1 = require("../../core/convert");
|
|
12
|
+
const action_1 = require("../../action");
|
|
13
|
+
class FakeTag {
|
|
14
|
+
getPrivacyPolicy() {
|
|
15
|
+
return {
|
|
16
|
+
rules: [new privacy_1.AllowIfViewerIsEntPropertyRule("ownerID"), privacy_1.AlwaysDenyRule],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
constructor(viewer, data) {
|
|
20
|
+
this.viewer = viewer;
|
|
21
|
+
this.nodeType = const_1.NodeType.FakeUser;
|
|
22
|
+
this.data = data;
|
|
23
|
+
this.id = data.id;
|
|
24
|
+
this.createdAt = (0, convert_1.convertDate)(data.created_at);
|
|
25
|
+
this.updatedAt = (0, convert_1.convertDate)(data.updated_at);
|
|
26
|
+
this.displayName = data.display_name;
|
|
27
|
+
this.canonicalName = data.canonical_name;
|
|
28
|
+
this.ownerID = data.owner_id;
|
|
29
|
+
}
|
|
30
|
+
__setRawDBData(data) { }
|
|
31
|
+
static getFields() {
|
|
32
|
+
return [
|
|
33
|
+
"id",
|
|
34
|
+
"created_at",
|
|
35
|
+
"updated_at",
|
|
36
|
+
"display_name",
|
|
37
|
+
"canonical_name",
|
|
38
|
+
"owner_id",
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
static getTestTable() {
|
|
42
|
+
return (0, temp_db_1.table)("fake_tags", (0, temp_db_1.uuid)("id", { primaryKey: true }), (0, temp_db_1.timestamptz)("created_at"), (0, temp_db_1.timestamptz)("updated_at"), (0, temp_db_1.text)("display_name"), (0, temp_db_1.text)("canonical_name"), (0, temp_db_1.uuid)("owner_id"), // TODO index: true sqlite broken?
|
|
43
|
+
(0, temp_db_1.index)("fake_tags", ["canonical_name", "owner_id"], { unique: true }));
|
|
44
|
+
}
|
|
45
|
+
static loaderOptions() {
|
|
46
|
+
return {
|
|
47
|
+
tableName: "fake_tags",
|
|
48
|
+
fields: FakeTag.getFields(),
|
|
49
|
+
ent: this,
|
|
50
|
+
loaderFactory: exports.tagLoader,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
static async load(v, id) {
|
|
54
|
+
return (0, ent_1.loadEnt)(v, id, FakeTag.loaderOptions());
|
|
55
|
+
}
|
|
56
|
+
static async loadX(v, id) {
|
|
57
|
+
return (0, ent_1.loadEntX)(v, id, FakeTag.loaderOptions());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.FakeTag = FakeTag;
|
|
61
|
+
exports.FakeTagSchema = (0, builder_1.getBuilderSchemaFromFields)({
|
|
62
|
+
displayName: (0, schema_1.StringType)(),
|
|
63
|
+
canonicalName: (0, schema_1.StringType)().trim().toLowerCase(),
|
|
64
|
+
ownerID: (0, schema_1.UUIDType)({}),
|
|
65
|
+
}, FakeTag);
|
|
66
|
+
function getTagBuilder(viewer, input) {
|
|
67
|
+
const action = getTagAction(viewer, input);
|
|
68
|
+
return action.builder;
|
|
69
|
+
}
|
|
70
|
+
exports.getTagBuilder = getTagBuilder;
|
|
71
|
+
function getTagAction(viewer, input) {
|
|
72
|
+
const m = new Map();
|
|
73
|
+
for (const key in input) {
|
|
74
|
+
m.set(key, input[key]);
|
|
75
|
+
}
|
|
76
|
+
const action = new builder_1.SimpleAction(viewer, exports.FakeTagSchema, m, action_1.WriteOperation.Insert, null);
|
|
77
|
+
return action;
|
|
78
|
+
}
|
|
79
|
+
exports.getTagAction = getTagAction;
|
|
80
|
+
async function createTag(viewer, input) {
|
|
81
|
+
const action = getTagAction(viewer, input);
|
|
82
|
+
return action.saveX();
|
|
83
|
+
}
|
|
84
|
+
exports.createTag = createTag;
|
|
85
|
+
exports.tagLoader = new loaders_1.ObjectLoaderFactory({
|
|
86
|
+
tableName: "fake_tags",
|
|
87
|
+
fields: FakeTag.getFields(),
|
|
88
|
+
key: "id",
|
|
89
|
+
});
|
|
@@ -25,8 +25,9 @@ export declare class FakeUser implements Ent {
|
|
|
25
25
|
protected readonly password: string | null;
|
|
26
26
|
getPrivacyPolicy(): PrivacyPolicy<this>;
|
|
27
27
|
constructor(viewer: Viewer, data: Data);
|
|
28
|
+
__setRawDBData(data: Data): void;
|
|
28
29
|
static getFields(): string[];
|
|
29
|
-
static getTestTable(): import("../db/
|
|
30
|
+
static getTestTable(): import("../db/temp_db").Table;
|
|
30
31
|
static loaderOptions(): LoadEntOptions<FakeUser>;
|
|
31
32
|
static load(v: Viewer, id: ID): Promise<FakeUser | null>;
|
|
32
33
|
static loadX(v: Viewer, id: ID): Promise<FakeUser>;
|
|
@@ -38,12 +39,14 @@ export interface UserCreateInput {
|
|
|
38
39
|
emailAddress: string;
|
|
39
40
|
phoneNumber: string | null;
|
|
40
41
|
password: string | null;
|
|
42
|
+
createdAt?: Date;
|
|
43
|
+
updatedAt?: Date;
|
|
41
44
|
}
|
|
42
|
-
export
|
|
45
|
+
export type UserEditInput = Partial<UserCreateInput>;
|
|
43
46
|
export declare function getUserBuilder(viewer: Viewer, input: UserCreateInput): import("../builder").SimpleBuilder<FakeUser, null>;
|
|
44
47
|
export declare function getUserAction(viewer: Viewer, input: UserCreateInput): SimpleAction<FakeUser, null>;
|
|
45
48
|
export declare function createUser(viewer: Viewer, input: UserCreateInput): Promise<FakeUser>;
|
|
46
|
-
export declare const userLoader: ObjectLoaderFactory<
|
|
47
|
-
export declare const userEmailLoader: ObjectLoaderFactory<
|
|
48
|
-
export declare const userPhoneNumberLoader: ObjectLoaderFactory<
|
|
49
|
+
export declare const userLoader: ObjectLoaderFactory<Data>;
|
|
50
|
+
export declare const userEmailLoader: ObjectLoaderFactory<Data>;
|
|
51
|
+
export declare const userPhoneNumberLoader: ObjectLoaderFactory<Data>;
|
|
49
52
|
export {};
|
|
@@ -8,7 +8,7 @@ const schema_1 = require("../../schema");
|
|
|
8
8
|
const internal_1 = require("./internal");
|
|
9
9
|
const const_1 = require("./const");
|
|
10
10
|
const viewer_1 = require("../../core/viewer");
|
|
11
|
-
const
|
|
11
|
+
const temp_db_1 = require("../db/temp_db");
|
|
12
12
|
const loaders_1 = require("../../core/loaders");
|
|
13
13
|
const convert_1 = require("../../core/convert");
|
|
14
14
|
const action_1 = require("../../action");
|
|
@@ -24,19 +24,6 @@ class ViewerWithAccessToken extends viewer_1.IDViewer {
|
|
|
24
24
|
}
|
|
25
25
|
exports.ViewerWithAccessToken = ViewerWithAccessToken;
|
|
26
26
|
class FakeUser {
|
|
27
|
-
constructor(viewer, data) {
|
|
28
|
-
this.viewer = viewer;
|
|
29
|
-
this.nodeType = const_1.NodeType.FakeUser;
|
|
30
|
-
this.data = data;
|
|
31
|
-
this.id = data.id;
|
|
32
|
-
this.createdAt = (0, convert_1.convertDate)(data.created_at);
|
|
33
|
-
this.updatedAt = (0, convert_1.convertDate)(data.updated_at);
|
|
34
|
-
this.firstName = data.first_name;
|
|
35
|
-
this.lastName = data.last_name;
|
|
36
|
-
this.emailAddress = data.email_address;
|
|
37
|
-
this.phoneNumber = data.phone_number;
|
|
38
|
-
this.password = data.password;
|
|
39
|
-
}
|
|
40
27
|
getPrivacyPolicy() {
|
|
41
28
|
return {
|
|
42
29
|
rules: [
|
|
@@ -61,6 +48,20 @@ class FakeUser {
|
|
|
61
48
|
],
|
|
62
49
|
};
|
|
63
50
|
}
|
|
51
|
+
constructor(viewer, data) {
|
|
52
|
+
this.viewer = viewer;
|
|
53
|
+
this.nodeType = const_1.NodeType.FakeUser;
|
|
54
|
+
this.data = data;
|
|
55
|
+
this.id = data.id;
|
|
56
|
+
this.createdAt = (0, convert_1.convertDate)(data.created_at);
|
|
57
|
+
this.updatedAt = (0, convert_1.convertDate)(data.updated_at);
|
|
58
|
+
this.firstName = data.first_name;
|
|
59
|
+
this.lastName = data.last_name;
|
|
60
|
+
this.emailAddress = data.email_address;
|
|
61
|
+
this.phoneNumber = data.phone_number;
|
|
62
|
+
this.password = data.password;
|
|
63
|
+
}
|
|
64
|
+
__setRawDBData(data) { }
|
|
64
65
|
static getFields() {
|
|
65
66
|
return [
|
|
66
67
|
"id",
|
|
@@ -74,7 +75,7 @@ class FakeUser {
|
|
|
74
75
|
];
|
|
75
76
|
}
|
|
76
77
|
static getTestTable() {
|
|
77
|
-
return (0,
|
|
78
|
+
return (0, temp_db_1.table)("fake_users", (0, temp_db_1.uuid)("id", { primaryKey: true }), (0, temp_db_1.timestamptz)("created_at"), (0, temp_db_1.timestamptz)("updated_at"), (0, temp_db_1.text)("first_name"), (0, temp_db_1.text)("last_name"), (0, temp_db_1.text)("email_address"), (0, temp_db_1.text)("phone_number"), (0, temp_db_1.text)("password"));
|
|
78
79
|
}
|
|
79
80
|
static loaderOptions() {
|
|
80
81
|
return {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -14,5 +18,7 @@ __exportStar(require("./const"), exports);
|
|
|
14
18
|
__exportStar(require("./fake_contact"), exports);
|
|
15
19
|
__exportStar(require("./fake_user"), exports);
|
|
16
20
|
__exportStar(require("./fake_event"), exports);
|
|
21
|
+
__exportStar(require("./fake_tag"), exports);
|
|
17
22
|
__exportStar(require("./events_query"), exports);
|
|
18
23
|
__exportStar(require("./user_query"), exports);
|
|
24
|
+
__exportStar(require("./tag_query"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ID, Viewer } from "../../core/base";
|
|
2
|
+
import { CustomEdgeQueryBase } from "../../core/query/custom_query";
|
|
3
|
+
import { FakeUser, FakeTag } from "./internal";
|
|
4
|
+
export declare class UserToTagsFkeyQuery extends CustomEdgeQueryBase<FakeUser, FakeTag> {
|
|
5
|
+
constructor(viewer: Viewer, src: ID | FakeUser);
|
|
6
|
+
static query(viewer: Viewer, src: FakeUser | ID): UserToTagsFkeyQuery;
|
|
7
|
+
sourceEnt(id: ID): Promise<FakeUser | null>;
|
|
8
|
+
}
|
|
9
|
+
export declare class UserToTagsFkeyQueryAsc extends CustomEdgeQueryBase<FakeUser, FakeTag> {
|
|
10
|
+
constructor(viewer: Viewer, src: ID | FakeUser);
|
|
11
|
+
static query(viewer: Viewer, src: FakeUser | ID): UserToTagsFkeyQueryAsc;
|
|
12
|
+
sourceEnt(id: ID): Promise<FakeUser | null>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserToTagsFkeyQueryAsc = exports.UserToTagsFkeyQuery = void 0;
|
|
4
|
+
const custom_query_1 = require("../../core/query/custom_query");
|
|
5
|
+
const internal_1 = require("./internal");
|
|
6
|
+
class UserToTagsFkeyQuery extends custom_query_1.CustomEdgeQueryBase {
|
|
7
|
+
constructor(viewer, src) {
|
|
8
|
+
super(viewer, {
|
|
9
|
+
src,
|
|
10
|
+
loadEntOptions: internal_1.FakeTag.loaderOptions(),
|
|
11
|
+
groupCol: "owner_id",
|
|
12
|
+
name: "user_to_tags",
|
|
13
|
+
sortColumn: "canonical_name",
|
|
14
|
+
sortColumnUnique: true,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
static query(viewer, src) {
|
|
18
|
+
return new UserToTagsFkeyQuery(viewer, src);
|
|
19
|
+
}
|
|
20
|
+
sourceEnt(id) {
|
|
21
|
+
return internal_1.FakeUser.load(this.viewer, id);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.UserToTagsFkeyQuery = UserToTagsFkeyQuery;
|
|
25
|
+
class UserToTagsFkeyQueryAsc extends custom_query_1.CustomEdgeQueryBase {
|
|
26
|
+
constructor(viewer, src) {
|
|
27
|
+
super(viewer, {
|
|
28
|
+
src,
|
|
29
|
+
loadEntOptions: internal_1.FakeTag.loaderOptions(),
|
|
30
|
+
groupCol: "owner_id",
|
|
31
|
+
name: "user_to_tags_asc",
|
|
32
|
+
sortColumn: "canonical_name ASC",
|
|
33
|
+
sortColumnUnique: true,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static query(viewer, src) {
|
|
37
|
+
return new UserToTagsFkeyQueryAsc(viewer, src);
|
|
38
|
+
}
|
|
39
|
+
sourceEnt(id) {
|
|
40
|
+
return internal_1.FakeUser.load(this.viewer, id);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.UserToTagsFkeyQueryAsc = UserToTagsFkeyQueryAsc;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Data, Ent } from "../../core/base";
|
|
2
2
|
import { AssocEdge } from "../../core/ent";
|
|
3
|
-
import { TempDB } from "../db/
|
|
3
|
+
import { TempDB } from "../db/temp_db";
|
|
4
4
|
import { FakeUser, UserCreateInput, ContactCreateInput, FakeContact } from ".";
|
|
5
5
|
import { EventCreateInput, FakeEvent } from "./fake_event";
|
|
6
6
|
import { BuilderSchema } from "../builder";
|
|
@@ -9,7 +9,13 @@ export declare function getUserInput(input?: Partial<UserCreateInput>): UserCrea
|
|
|
9
9
|
export declare function getEventInput(user: FakeUser, input?: Partial<EventCreateInput>): EventCreateInput;
|
|
10
10
|
export declare function createTestUser(input?: Partial<UserCreateInput>): Promise<FakeUser>;
|
|
11
11
|
export declare const inputs: Partial<ContactCreateInput>[];
|
|
12
|
-
|
|
12
|
+
interface createContactOptions {
|
|
13
|
+
input?: Partial<UserCreateInput>;
|
|
14
|
+
slice?: number;
|
|
15
|
+
user?: FakeUser;
|
|
16
|
+
start?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function createAllContacts(opts?: createContactOptions): Promise<[FakeUser, FakeContact[]]>;
|
|
13
19
|
export declare function createUserPlusFriendRequests(input?: Partial<UserCreateInput>, slice?: number): Promise<[FakeUser, FakeUser[]]>;
|
|
14
20
|
export declare function addEdge<T extends Ent>(source: T, schema: BuilderSchema<T>, edgeType: string, inbound: boolean, // inbound or outbound
|
|
15
21
|
...dest: Ent[]): Promise<void>;
|
|
@@ -19,13 +25,14 @@ export declare function verifyUserToContacts(user: FakeUser, ents: FakeContact[]
|
|
|
19
25
|
export declare function createEdges(): Promise<void>;
|
|
20
26
|
export declare function edgeTableNames(): string[];
|
|
21
27
|
export declare function createTestEvent(user: FakeUser, input?: Partial<EventCreateInput>): Promise<FakeEvent>;
|
|
22
|
-
export declare function setupTempDB(): Promise<TempDB>;
|
|
23
|
-
export declare function tempDBTables(): import("../db/
|
|
28
|
+
export declare function setupTempDB(global?: boolean): Promise<TempDB>;
|
|
29
|
+
export declare function tempDBTables(global?: boolean): import("../db/temp_db").Table[];
|
|
24
30
|
interface options {
|
|
25
31
|
howMany: number;
|
|
26
32
|
interval: number;
|
|
27
33
|
userInput?: Partial<UserCreateInput>;
|
|
28
34
|
eventInputs?: Partial<EventCreateInput>[];
|
|
35
|
+
startTime?: number | Date;
|
|
29
36
|
}
|
|
30
37
|
export declare function createAllEvents(opts: options): Promise<[FakeUser, FakeEvent[]]>;
|
|
31
38
|
export {};
|
|
@@ -6,19 +6,23 @@ const viewer_1 = require("../../core/viewer");
|
|
|
6
6
|
const ent_1 = require("../../core/ent");
|
|
7
7
|
const snake_case_1 = require("snake-case");
|
|
8
8
|
const write_1 = require("../write");
|
|
9
|
-
const
|
|
9
|
+
const temp_db_1 = require("../db/temp_db");
|
|
10
10
|
const _1 = require(".");
|
|
11
11
|
const fake_event_1 = require("./fake_event");
|
|
12
12
|
const const_1 = require("./const");
|
|
13
13
|
const mock_date_1 = require("./../mock_date");
|
|
14
14
|
const builder_1 = require("../builder");
|
|
15
15
|
const action_1 = require("../../action");
|
|
16
|
+
const fake_tag_1 = require("./fake_tag");
|
|
17
|
+
const db_1 = require("../../core/db");
|
|
16
18
|
function getContactInput(user, input) {
|
|
17
19
|
return {
|
|
18
20
|
firstName: "Jon",
|
|
19
21
|
lastName: "Snow",
|
|
20
22
|
emailAddress: "foo@bar.com",
|
|
21
23
|
userID: user.id,
|
|
24
|
+
createdAt: new Date(),
|
|
25
|
+
updatedAt: new Date(),
|
|
22
26
|
...input,
|
|
23
27
|
};
|
|
24
28
|
}
|
|
@@ -30,6 +34,8 @@ function getUserInput(input) {
|
|
|
30
34
|
emailAddress: "foo@bar.com",
|
|
31
35
|
phoneNumber: "415-212-1212",
|
|
32
36
|
password: "pa$$w0rd",
|
|
37
|
+
createdAt: new Date(),
|
|
38
|
+
updatedAt: new Date(),
|
|
33
39
|
...input,
|
|
34
40
|
};
|
|
35
41
|
}
|
|
@@ -41,6 +47,8 @@ function getEventInput(user, input) {
|
|
|
41
47
|
title: "title",
|
|
42
48
|
description: "fun event",
|
|
43
49
|
userID: user.id,
|
|
50
|
+
createdAt: new Date(),
|
|
51
|
+
updatedAt: new Date(),
|
|
44
52
|
...input,
|
|
45
53
|
};
|
|
46
54
|
}
|
|
@@ -82,22 +90,29 @@ exports.inputs = [
|
|
|
82
90
|
lastName: "Stark",
|
|
83
91
|
},
|
|
84
92
|
];
|
|
85
|
-
async function createAllContacts(
|
|
86
|
-
|
|
93
|
+
async function createAllContacts(opts) {
|
|
94
|
+
let { input, slice, user } = opts || {};
|
|
95
|
+
if (!user) {
|
|
96
|
+
user = await createTestUser(input);
|
|
97
|
+
}
|
|
98
|
+
const userr = user;
|
|
99
|
+
if (opts?.start) {
|
|
100
|
+
(0, jest_date_mock_1.advanceTo)(opts.start);
|
|
101
|
+
}
|
|
87
102
|
let userInputs = exports.inputs.slice(0, slice || exports.inputs.length);
|
|
88
103
|
const contacts = await Promise.all(userInputs.map(async (input) => {
|
|
89
104
|
// just to make times deterministic so that tests can consistently work
|
|
90
105
|
(0, jest_date_mock_1.advanceBy)(100);
|
|
91
|
-
const builder = (0, _1.getContactBuilder)(
|
|
106
|
+
const builder = (0, _1.getContactBuilder)(userr.viewer, getContactInput(userr, input));
|
|
92
107
|
// add edge from user to contact
|
|
93
|
-
builder.orchestrator.addInboundEdge(
|
|
108
|
+
builder.orchestrator.addInboundEdge(userr.id, _1.EdgeType.UserToContacts, const_1.NodeType.FakeUser, {
|
|
94
109
|
time: new Date(), // set time to advanceBy time
|
|
95
110
|
});
|
|
96
111
|
await builder.saveX();
|
|
97
112
|
return await builder.editedEntX();
|
|
98
113
|
}));
|
|
99
114
|
expect(contacts.length).toBe(userInputs.length);
|
|
100
|
-
return [
|
|
115
|
+
return [userr, contacts];
|
|
101
116
|
}
|
|
102
117
|
exports.createAllContacts = createAllContacts;
|
|
103
118
|
async function createUserPlusFriendRequests(input, slice) {
|
|
@@ -208,22 +223,23 @@ async function createTestEvent(user, input) {
|
|
|
208
223
|
return await builder.editedEntX();
|
|
209
224
|
}
|
|
210
225
|
exports.createTestEvent = createTestEvent;
|
|
211
|
-
async function setupTempDB() {
|
|
212
|
-
const tdb = new
|
|
226
|
+
async function setupTempDB(global = false) {
|
|
227
|
+
const tdb = new temp_db_1.TempDB(db_1.Dialect.Postgres, tempDBTables(global));
|
|
213
228
|
await tdb.beforeAll();
|
|
214
229
|
// create once
|
|
215
230
|
await createEdges();
|
|
216
231
|
return tdb;
|
|
217
232
|
}
|
|
218
233
|
exports.setupTempDB = setupTempDB;
|
|
219
|
-
function tempDBTables() {
|
|
234
|
+
function tempDBTables(global = false) {
|
|
220
235
|
const tables = [
|
|
221
236
|
_1.FakeUser.getTestTable(),
|
|
222
237
|
_1.FakeContact.getTestTable(),
|
|
223
238
|
fake_event_1.FakeEvent.getTestTable(),
|
|
224
|
-
|
|
239
|
+
fake_tag_1.FakeTag.getTestTable(),
|
|
240
|
+
(0, temp_db_1.assoc_edge_config_table)(),
|
|
225
241
|
];
|
|
226
|
-
edgeTableNames().forEach((tableName) => tables.push((0,
|
|
242
|
+
edgeTableNames().forEach((tableName) => tables.push((0, temp_db_1.assoc_edge_table)(tableName, global)));
|
|
227
243
|
return tables;
|
|
228
244
|
}
|
|
229
245
|
exports.tempDBTables = tempDBTables;
|
|
@@ -232,7 +248,7 @@ async function createAllEvents(opts) {
|
|
|
232
248
|
let arr = new Array(opts.howMany);
|
|
233
249
|
arr.fill(1);
|
|
234
250
|
// start at date in case something else has used a date already
|
|
235
|
-
(0, jest_date_mock_1.advanceTo)(mock_date_1.MockDate.getDate());
|
|
251
|
+
(0, jest_date_mock_1.advanceTo)(opts.startTime || mock_date_1.MockDate.getDate());
|
|
236
252
|
const events = await Promise.all(arr.map(async (v, idx) => {
|
|
237
253
|
// just to make times deterministic so that tests can consistently work
|
|
238
254
|
if (opts.interval > 0) {
|
|
@@ -5,7 +5,6 @@ import * as clause from "../../core/clause";
|
|
|
5
5
|
import { AssocEdgeQueryBase, EdgeQuerySource } from "../../core/query/assoc_query";
|
|
6
6
|
import { FakeUser, FakeEvent, FakeContact, EventToAttendeesQuery, EventToDeclinedQuery, EventToHostsQuery, EventToInvitedQuery, EventToMaybeQuery } from "./internal";
|
|
7
7
|
import { RawCountLoaderFactory } from "../../core/loaders/raw_count_loader";
|
|
8
|
-
import { IndexLoaderFactory } from "../../core/loaders/index_loader";
|
|
9
8
|
import { QueryLoaderFactory } from "../../core/loaders/query_loader";
|
|
10
9
|
export declare class UserToContactsQuery extends AssocEdgeQueryBase<FakeUser, FakeContact, AssocEdge> {
|
|
11
10
|
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser>);
|
|
@@ -13,12 +12,22 @@ export declare class UserToContactsQuery extends AssocEdgeQueryBase<FakeUser, Fa
|
|
|
13
12
|
sourceEnt(id: ID): Promise<FakeUser | null>;
|
|
14
13
|
}
|
|
15
14
|
export declare const userToContactsCountLoaderFactory: RawCountLoaderFactory;
|
|
16
|
-
export declare const userToContactsDataLoaderFactory:
|
|
15
|
+
export declare const userToContactsDataLoaderFactory: QueryLoaderFactory<unknown>;
|
|
16
|
+
export declare class UserToContactsFkeyQueryDeprecated extends CustomEdgeQueryBase<FakeUser, FakeContact> {
|
|
17
|
+
constructor(viewer: Viewer, src: ID | FakeUser);
|
|
18
|
+
static query(viewer: Viewer, src: FakeUser | ID): UserToContactsFkeyQueryDeprecated;
|
|
19
|
+
sourceEnt(id: ID): Promise<FakeUser | null>;
|
|
20
|
+
}
|
|
17
21
|
export declare class UserToContactsFkeyQuery extends CustomEdgeQueryBase<FakeUser, FakeContact> {
|
|
18
22
|
constructor(viewer: Viewer, src: ID | FakeUser);
|
|
19
23
|
static query(viewer: Viewer, src: FakeUser | ID): UserToContactsFkeyQuery;
|
|
20
24
|
sourceEnt(id: ID): Promise<FakeUser | null>;
|
|
21
25
|
}
|
|
26
|
+
export declare class UserToContactsFkeyQueryAsc extends CustomEdgeQueryBase<FakeUser, FakeContact> {
|
|
27
|
+
constructor(viewer: Viewer, src: ID | FakeUser);
|
|
28
|
+
static query(viewer: Viewer, src: FakeUser | ID): UserToContactsFkeyQuery;
|
|
29
|
+
sourceEnt(id: ID): Promise<FakeUser | null>;
|
|
30
|
+
}
|
|
22
31
|
export declare class UserToFriendsQuery extends AssocEdgeQueryBase<FakeUser, FakeUser, AssocEdge> {
|
|
23
32
|
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser>);
|
|
24
33
|
static query(viewer: Viewer, src: EdgeQuerySource<FakeUser>): UserToFriendsQuery;
|
|
@@ -53,7 +62,7 @@ export declare class UserToFriendRequestsQuery extends AssocEdgeQueryBase<FakeUs
|
|
|
53
62
|
}
|
|
54
63
|
export declare class UserToIncomingFriendRequestsQuery extends AssocEdgeQueryBase<FakeUser, FakeUser, AssocEdge> {
|
|
55
64
|
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser, FakeUser>);
|
|
56
|
-
getPrivacyPolicy(): import("../../core/base").PrivacyPolicy<Ent
|
|
65
|
+
getPrivacyPolicy(): import("../../core/base").PrivacyPolicy<Ent<Viewer<Ent<any> | null, ID | null>>, Viewer<Ent<any> | null, ID | null>>;
|
|
57
66
|
sourceEnt(id: ID): Promise<FakeUser | null>;
|
|
58
67
|
static query(viewer: Viewer, src: EdgeQuerySource<FakeUser, FakeUser>): UserToIncomingFriendRequestsQuery;
|
|
59
68
|
queryContacts(): UserToContactsQuery;
|
|
@@ -84,13 +93,11 @@ export declare class UserToHostedEventsQuery extends AssocEdgeQueryBase<FakeUser
|
|
|
84
93
|
}
|
|
85
94
|
export declare const getNextWeekClause: () => clause.Clause;
|
|
86
95
|
export declare function getCompleteClause(id: ID): clause.Clause;
|
|
87
|
-
export declare const userToEventsInNextWeekCountLoaderFactory: RawCountLoaderFactory;
|
|
88
|
-
export declare const userToEventsInNextWeekDataLoaderFactory: QueryLoaderFactory<unknown>;
|
|
89
96
|
export declare class UserToEventsInNextWeekQuery extends CustomEdgeQueryBase<FakeUser, FakeEvent> {
|
|
90
97
|
constructor(viewer: Viewer, src: ID | FakeUser);
|
|
91
98
|
static query(viewer: Viewer, src: FakeUser | ID): UserToEventsInNextWeekQuery;
|
|
92
99
|
sourceEnt(id: ID): Promise<FakeUser | null>;
|
|
93
|
-
getPrivacyPolicy(): import("../../core/base").PrivacyPolicy<Ent
|
|
100
|
+
getPrivacyPolicy(): import("../../core/base").PrivacyPolicy<Ent<Viewer<Ent<any> | null, ID | null>>, Viewer<Ent<any> | null, ID | null>>;
|
|
94
101
|
}
|
|
95
102
|
export declare class UserToFollowingQuery extends AssocEdgeQueryBase<FakeUser, Ent, AssocEdge> {
|
|
96
103
|
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser, FakeUser>);
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -19,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.UserToFollowingQuery = exports.UserToEventsInNextWeekQuery = exports.
|
|
26
|
+
exports.UserToFollowingQuery = exports.UserToEventsInNextWeekQuery = exports.getCompleteClause = exports.getNextWeekClause = exports.UserToHostedEventsQuery = exports.UserToEventsAttendingQuery = exports.UserToIncomingFriendRequestsQuery = exports.UserToFriendRequestsQuery = exports.UserToCustomEdgeQuery = exports.CustomEdge = exports.UserToFriendsQuery = exports.UserToContactsFkeyQueryAsc = exports.UserToContactsFkeyQuery = exports.UserToContactsFkeyQueryDeprecated = exports.userToContactsDataLoaderFactory = exports.userToContactsCountLoaderFactory = exports.UserToContactsQuery = void 0;
|
|
23
27
|
const custom_query_1 = require("../../core/query/custom_query");
|
|
24
28
|
const ent_1 = require("../../core/ent");
|
|
25
29
|
const clause = __importStar(require("../../core/clause"));
|
|
@@ -28,7 +32,6 @@ const internal_1 = require("./internal");
|
|
|
28
32
|
const raw_count_loader_1 = require("../../core/loaders/raw_count_loader");
|
|
29
33
|
const assoc_count_loader_1 = require("../../core/loaders/assoc_count_loader");
|
|
30
34
|
const assoc_edge_loader_1 = require("../../core/loaders/assoc_edge_loader");
|
|
31
|
-
const index_loader_1 = require("../../core/loaders/index_loader");
|
|
32
35
|
const fake_contact_1 = require("./fake_contact");
|
|
33
36
|
const jest_date_mock_1 = require("jest-date-mock");
|
|
34
37
|
const luxon_1 = require("luxon");
|
|
@@ -52,10 +55,13 @@ exports.userToContactsCountLoaderFactory = new raw_count_loader_1.RawCountLoader
|
|
|
52
55
|
...internal_1.FakeContact.loaderOptions(),
|
|
53
56
|
groupCol: "user_id",
|
|
54
57
|
});
|
|
55
|
-
exports.userToContactsDataLoaderFactory = new
|
|
58
|
+
exports.userToContactsDataLoaderFactory = new query_loader_1.QueryLoaderFactory({
|
|
59
|
+
...internal_1.FakeContact.loaderOptions(),
|
|
60
|
+
groupCol: "user_id",
|
|
56
61
|
toPrime: [fake_contact_1.contactLoader],
|
|
57
62
|
});
|
|
58
|
-
|
|
63
|
+
// note: this is still used in graphql tests...
|
|
64
|
+
class UserToContactsFkeyQueryDeprecated extends custom_query_1.CustomEdgeQueryBase {
|
|
59
65
|
constructor(viewer, src) {
|
|
60
66
|
super(viewer, {
|
|
61
67
|
src,
|
|
@@ -63,6 +69,27 @@ class UserToContactsFkeyQuery extends custom_query_1.CustomEdgeQueryBase {
|
|
|
63
69
|
countLoaderFactory: exports.userToContactsCountLoaderFactory,
|
|
64
70
|
dataLoaderFactory: exports.userToContactsDataLoaderFactory,
|
|
65
71
|
options: internal_1.FakeContact.loaderOptions(),
|
|
72
|
+
sortColumn: "created_at",
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
static query(viewer, src) {
|
|
76
|
+
return new UserToContactsFkeyQueryDeprecated(viewer, src);
|
|
77
|
+
}
|
|
78
|
+
sourceEnt(id) {
|
|
79
|
+
return internal_1.FakeUser.load(this.viewer, id);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.UserToContactsFkeyQueryDeprecated = UserToContactsFkeyQueryDeprecated;
|
|
83
|
+
// this replaces UserToContactsFkeyQueryDeprecated
|
|
84
|
+
class UserToContactsFkeyQuery extends custom_query_1.CustomEdgeQueryBase {
|
|
85
|
+
constructor(viewer, src) {
|
|
86
|
+
super(viewer, {
|
|
87
|
+
src,
|
|
88
|
+
loadEntOptions: internal_1.FakeContact.loaderOptions(),
|
|
89
|
+
groupCol: "user_id",
|
|
90
|
+
name: "user_to_contacts",
|
|
91
|
+
// instead of the id col...
|
|
92
|
+
sortColumn: "created_at",
|
|
66
93
|
});
|
|
67
94
|
}
|
|
68
95
|
static query(viewer, src) {
|
|
@@ -73,6 +100,24 @@ class UserToContactsFkeyQuery extends custom_query_1.CustomEdgeQueryBase {
|
|
|
73
100
|
}
|
|
74
101
|
}
|
|
75
102
|
exports.UserToContactsFkeyQuery = UserToContactsFkeyQuery;
|
|
103
|
+
class UserToContactsFkeyQueryAsc extends custom_query_1.CustomEdgeQueryBase {
|
|
104
|
+
constructor(viewer, src) {
|
|
105
|
+
super(viewer, {
|
|
106
|
+
src,
|
|
107
|
+
loadEntOptions: internal_1.FakeContact.loaderOptions(),
|
|
108
|
+
groupCol: "user_id",
|
|
109
|
+
name: "user_to_contacts",
|
|
110
|
+
sortColumn: "created_at ASC",
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
static query(viewer, src) {
|
|
114
|
+
return new UserToContactsFkeyQueryAsc(viewer, src);
|
|
115
|
+
}
|
|
116
|
+
sourceEnt(id) {
|
|
117
|
+
return internal_1.FakeUser.load(this.viewer, id);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.UserToContactsFkeyQueryAsc = UserToContactsFkeyQueryAsc;
|
|
76
121
|
class UserToFriendsQuery extends assoc_query_1.AssocEdgeQueryBase {
|
|
77
122
|
constructor(viewer, src) {
|
|
78
123
|
super(viewer, src, new assoc_count_loader_1.AssocEdgeCountLoaderFactory(internal_1.EdgeType.UserToFriends), new assoc_edge_loader_1.AssocEdgeLoaderFactory(internal_1.EdgeType.UserToFriends, ent_1.AssocEdge), internal_1.FakeUser.loaderOptions());
|
|
@@ -257,27 +302,14 @@ function getCompleteClause(id) {
|
|
|
257
302
|
return clause.And(clause.Eq("user_id", id), (0, exports.getNextWeekClause)());
|
|
258
303
|
}
|
|
259
304
|
exports.getCompleteClause = getCompleteClause;
|
|
260
|
-
exports.userToEventsInNextWeekCountLoaderFactory = new raw_count_loader_1.RawCountLoaderFactory({
|
|
261
|
-
...internal_1.FakeEvent.loaderOptions(),
|
|
262
|
-
groupCol: "user_id",
|
|
263
|
-
clause: (0, exports.getNextWeekClause)(),
|
|
264
|
-
});
|
|
265
|
-
exports.userToEventsInNextWeekDataLoaderFactory = new query_loader_1.QueryLoaderFactory({
|
|
266
|
-
...internal_1.FakeEvent.loaderOptions(),
|
|
267
|
-
groupCol: "user_id",
|
|
268
|
-
clause: (0, exports.getNextWeekClause)(),
|
|
269
|
-
toPrime: [fake_contact_1.contactLoader],
|
|
270
|
-
sortColumn: "start_time",
|
|
271
|
-
});
|
|
272
305
|
class UserToEventsInNextWeekQuery extends custom_query_1.CustomEdgeQueryBase {
|
|
273
306
|
constructor(viewer, src) {
|
|
274
307
|
super(viewer, {
|
|
275
308
|
src,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
// hmm TODO shouldn't need to write this twice...
|
|
309
|
+
groupCol: "user_id",
|
|
310
|
+
clause: (0, exports.getNextWeekClause)(),
|
|
311
|
+
loadEntOptions: internal_1.FakeEvent.loaderOptions(),
|
|
312
|
+
name: "events_in_next_week",
|
|
281
313
|
sortColumn: "start_time",
|
|
282
314
|
});
|
|
283
315
|
}
|
package/testutils/fake_log.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ent } from "../core/base";
|
|
1
|
+
import { Ent, Viewer } from "../core/base";
|
|
2
2
|
import { Builder } from "./../action";
|
|
3
3
|
export declare class FakeLogger {
|
|
4
4
|
private static logs;
|
|
@@ -8,6 +8,6 @@ export declare class FakeLogger {
|
|
|
8
8
|
static contains(line: string): boolean;
|
|
9
9
|
static clear(): void;
|
|
10
10
|
}
|
|
11
|
-
export declare class EntCreationObserver<
|
|
12
|
-
observe(builder: Builder<
|
|
11
|
+
export declare class EntCreationObserver<TEnt extends Ent<TViewer>, TViewer extends Viewer = Viewer> {
|
|
12
|
+
observe(builder: Builder<TEnt, TViewer>): Promise<void>;
|
|
13
13
|
}
|
package/testutils/fake_log.js
CHANGED
|
@@ -21,12 +21,12 @@ class FakeLogger {
|
|
|
21
21
|
this.logs = [];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
exports.FakeLogger = FakeLogger;
|
|
25
24
|
// todo this is quick and ideal.
|
|
26
25
|
// more ideal is capturing all console.logs
|
|
27
26
|
// we do it in golang for example
|
|
28
27
|
// and will need this for production launch anyways
|
|
29
28
|
FakeLogger.logs = [];
|
|
29
|
+
exports.FakeLogger = FakeLogger;
|
|
30
30
|
// TODO instead of needing to add this manually
|
|
31
31
|
// we need to build a way to add global observers (and maybe triggers)
|
|
32
32
|
// to be run on every action/mutation
|