@snowtop/ent 0.1.0-alpha15 → 0.1.0-alpha150
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 +51 -21
- package/core/base.js +7 -1
- package/core/clause.d.ts +85 -40
- package/core/clause.js +375 -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 +535 -586
- 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.js +5 -1
- 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 +14 -5
- package/index.js +26 -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
|
@@ -18,7 +18,8 @@ export declare enum EdgeType {
|
|
|
18
18
|
export declare enum NodeType {
|
|
19
19
|
FakeUser = "user",
|
|
20
20
|
FakeContact = "contact",
|
|
21
|
-
FakeEvent = "event"
|
|
21
|
+
FakeEvent = "event",
|
|
22
|
+
FakeTag = "tag"
|
|
22
23
|
}
|
|
23
24
|
export declare const SymmetricEdges: Set<string>;
|
|
24
25
|
export declare const InverseEdges: Map<EdgeType, EdgeType>;
|
|
@@ -27,6 +27,7 @@ var NodeType;
|
|
|
27
27
|
NodeType["FakeUser"] = "user";
|
|
28
28
|
NodeType["FakeContact"] = "contact";
|
|
29
29
|
NodeType["FakeEvent"] = "event";
|
|
30
|
+
NodeType["FakeTag"] = "tag";
|
|
30
31
|
})(NodeType = exports.NodeType || (exports.NodeType = {}));
|
|
31
32
|
exports.SymmetricEdges = new Set();
|
|
32
33
|
exports.SymmetricEdges.add(EdgeType.UserToFriends);
|
|
@@ -48,6 +49,8 @@ function getLoaderOptions(type) {
|
|
|
48
49
|
return internal_1.FakeUser.loaderOptions();
|
|
49
50
|
case NodeType.FakeEvent:
|
|
50
51
|
return internal_1.FakeEvent.loaderOptions();
|
|
52
|
+
case NodeType.FakeTag:
|
|
53
|
+
return internal_1.FakeTag.loaderOptions();
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
exports.getLoaderOptions = getLoaderOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ID, Ent, Viewer, Data, LoadEntOptions, PrivacyPolicy } from "../../core/base";
|
|
1
|
+
import { ID, Ent, Viewer, Data, LoadEntOptions, PrivacyPolicy, Context } from "../../core/base";
|
|
2
2
|
import { SimpleBuilder } from "../builder";
|
|
3
3
|
import { NodeType } from "./const";
|
|
4
4
|
import { ObjectLoaderFactory } from "../../core/loaders";
|
|
@@ -15,11 +15,13 @@ export declare class FakeContact implements Ent {
|
|
|
15
15
|
readonly userID: ID;
|
|
16
16
|
getPrivacyPolicy(): PrivacyPolicy<this>;
|
|
17
17
|
constructor(viewer: Viewer, data: Data);
|
|
18
|
+
__setRawDBData(data: Data): void;
|
|
18
19
|
static getFields(): string[];
|
|
19
|
-
static getTestTable(): import("../db/
|
|
20
|
+
static getTestTable(): import("../db/temp_db").Table;
|
|
20
21
|
static loaderOptions(): LoadEntOptions<FakeContact>;
|
|
21
22
|
static load(v: Viewer, id: ID): Promise<FakeContact | null>;
|
|
22
23
|
static loadX(v: Viewer, id: ID): Promise<FakeContact>;
|
|
24
|
+
static loadRawData(id: ID, context?: Context): Promise<Data | null>;
|
|
23
25
|
}
|
|
24
26
|
export declare const FakeContactSchema: import("../builder").BuilderSchema<FakeContact>;
|
|
25
27
|
export interface ContactCreateInput {
|
|
@@ -27,7 +29,9 @@ export interface ContactCreateInput {
|
|
|
27
29
|
lastName: string;
|
|
28
30
|
emailAddress: string;
|
|
29
31
|
userID: ID;
|
|
32
|
+
createdAt?: Date;
|
|
33
|
+
updatedAt?: Date;
|
|
30
34
|
}
|
|
31
35
|
export declare function getContactBuilder(viewer: Viewer, input: ContactCreateInput): SimpleBuilder<FakeContact, null>;
|
|
32
36
|
export declare function createContact(viewer: Viewer, input: ContactCreateInput): Promise<void>;
|
|
33
|
-
export declare const contactLoader: ObjectLoaderFactory<
|
|
37
|
+
export declare const contactLoader: ObjectLoaderFactory<Data>;
|
|
@@ -6,11 +6,16 @@ const privacy_1 = require("../../core/privacy");
|
|
|
6
6
|
const builder_1 = require("../builder");
|
|
7
7
|
const schema_1 = require("../../schema");
|
|
8
8
|
const const_1 = require("./const");
|
|
9
|
-
const
|
|
9
|
+
const temp_db_1 = require("../db/temp_db");
|
|
10
10
|
const loaders_1 = require("../../core/loaders");
|
|
11
11
|
const convert_1 = require("../../core/convert");
|
|
12
12
|
const action_1 = require("../../action");
|
|
13
13
|
class FakeContact {
|
|
14
|
+
getPrivacyPolicy() {
|
|
15
|
+
return {
|
|
16
|
+
rules: [new privacy_1.AllowIfViewerIsRule("userID"), privacy_1.AlwaysDenyRule],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
14
19
|
constructor(viewer, data) {
|
|
15
20
|
this.viewer = viewer;
|
|
16
21
|
this.nodeType = const_1.NodeType.FakeContact;
|
|
@@ -23,11 +28,7 @@ class FakeContact {
|
|
|
23
28
|
this.emailAddress = data.email_address;
|
|
24
29
|
this.userID = data.user_id;
|
|
25
30
|
}
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
rules: [new privacy_1.AllowIfViewerIsRule("userID"), privacy_1.AlwaysDenyRule],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
+
__setRawDBData(data) { }
|
|
31
32
|
static getFields() {
|
|
32
33
|
return [
|
|
33
34
|
"id",
|
|
@@ -40,7 +41,7 @@ class FakeContact {
|
|
|
40
41
|
];
|
|
41
42
|
}
|
|
42
43
|
static getTestTable() {
|
|
43
|
-
return (0,
|
|
44
|
+
return (0, temp_db_1.table)("fake_contacts", (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.uuid)("user_id"));
|
|
44
45
|
}
|
|
45
46
|
static loaderOptions() {
|
|
46
47
|
return {
|
|
@@ -60,6 +61,11 @@ class FakeContact {
|
|
|
60
61
|
static async loadX(v, id) {
|
|
61
62
|
return (0, ent_1.loadEntX)(v, id, FakeContact.loaderOptions());
|
|
62
63
|
}
|
|
64
|
+
static async loadRawData(id, context) {
|
|
65
|
+
return FakeContact.loaderOptions()
|
|
66
|
+
.loaderFactory.createLoader(context)
|
|
67
|
+
.load(id);
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
exports.FakeContact = FakeContact;
|
|
65
71
|
exports.FakeContactSchema = (0, builder_1.getBuilderSchemaFromFields)({
|
|
@@ -16,14 +16,17 @@ export declare class FakeEvent implements Ent {
|
|
|
16
16
|
readonly userID: ID;
|
|
17
17
|
getPrivacyPolicy(): PrivacyPolicy<this>;
|
|
18
18
|
constructor(viewer: Viewer, data: Data);
|
|
19
|
+
__setRawDBData(data: Data): void;
|
|
19
20
|
private static getFields;
|
|
20
|
-
static getTestTable(): import("../db/
|
|
21
|
+
static getTestTable(): import("../db/temp_db").Table;
|
|
21
22
|
static loaderOptions(): LoadEntOptions<FakeEvent>;
|
|
22
23
|
static load(v: Viewer, id: ID): Promise<FakeEvent | null>;
|
|
23
24
|
static loadX(v: Viewer, id: ID): Promise<FakeEvent>;
|
|
24
25
|
}
|
|
25
26
|
export declare const FakeEventSchema: import("../builder").BuilderSchema<FakeEvent>;
|
|
26
27
|
export interface EventCreateInput {
|
|
28
|
+
createdAt?: Date;
|
|
29
|
+
updatedAt?: Date;
|
|
27
30
|
startTime: Date;
|
|
28
31
|
endTime?: Date | null;
|
|
29
32
|
location: string;
|
|
@@ -6,11 +6,14 @@ const privacy_1 = require("../../core/privacy");
|
|
|
6
6
|
const builder_1 = require("../builder");
|
|
7
7
|
const schema_1 = require("../../schema");
|
|
8
8
|
const const_1 = require("./const");
|
|
9
|
-
const
|
|
9
|
+
const temp_db_1 = require("../db/temp_db");
|
|
10
10
|
const loaders_1 = require("../../core/loaders");
|
|
11
11
|
const convert_1 = require("../../core/convert");
|
|
12
12
|
const action_1 = require("../../action");
|
|
13
13
|
class FakeEvent {
|
|
14
|
+
getPrivacyPolicy() {
|
|
15
|
+
return privacy_1.AlwaysAllowPrivacyPolicy;
|
|
16
|
+
}
|
|
14
17
|
constructor(viewer, data) {
|
|
15
18
|
this.viewer = viewer;
|
|
16
19
|
this.nodeType = const_1.NodeType.FakeEvent;
|
|
@@ -25,9 +28,7 @@ class FakeEvent {
|
|
|
25
28
|
this.description = data.description;
|
|
26
29
|
this.userID = data.user_id;
|
|
27
30
|
}
|
|
28
|
-
|
|
29
|
-
return privacy_1.AlwaysAllowPrivacyPolicy;
|
|
30
|
-
}
|
|
31
|
+
__setRawDBData(data) { }
|
|
31
32
|
static getFields() {
|
|
32
33
|
return [
|
|
33
34
|
"id",
|
|
@@ -42,9 +43,9 @@ class FakeEvent {
|
|
|
42
43
|
];
|
|
43
44
|
}
|
|
44
45
|
static getTestTable() {
|
|
45
|
-
return (0,
|
|
46
|
+
return (0, temp_db_1.table)("fake_events", (0, temp_db_1.uuid)("id", { primaryKey: true }), (0, temp_db_1.timestamptz)("created_at"), (0, temp_db_1.timestamptz)("updated_at"),
|
|
46
47
|
// TODO index:true
|
|
47
|
-
(0,
|
|
48
|
+
(0, temp_db_1.timestamptz)("start_time"), (0, temp_db_1.timestamptz)("end_time", { nullable: true }), (0, temp_db_1.text)("location"), (0, temp_db_1.text)("title"), (0, temp_db_1.text)("description", { nullable: true }), (0, temp_db_1.uuid)("user_id"));
|
|
48
49
|
}
|
|
49
50
|
static loaderOptions() {
|
|
50
51
|
return {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ID, Ent, Viewer, Data, LoadEntOptions, PrivacyPolicy } from "../../core/base";
|
|
2
|
+
import { SimpleAction } from "../builder";
|
|
3
|
+
import { NodeType } from "./const";
|
|
4
|
+
import { ObjectLoaderFactory } from "../../core/loaders";
|
|
5
|
+
export declare class FakeTag implements Ent {
|
|
6
|
+
viewer: Viewer;
|
|
7
|
+
readonly id: ID;
|
|
8
|
+
readonly data: Data;
|
|
9
|
+
readonly nodeType = NodeType.FakeUser;
|
|
10
|
+
readonly createdAt: Date;
|
|
11
|
+
readonly updatedAt: Date;
|
|
12
|
+
readonly displayName: string;
|
|
13
|
+
readonly canonicalName: string;
|
|
14
|
+
readonly ownerID: string;
|
|
15
|
+
getPrivacyPolicy(): PrivacyPolicy<this>;
|
|
16
|
+
constructor(viewer: Viewer, data: Data);
|
|
17
|
+
__setRawDBData(data: Data): void;
|
|
18
|
+
static getFields(): string[];
|
|
19
|
+
static getTestTable(): import("../db/temp_db").Table;
|
|
20
|
+
static loaderOptions(): LoadEntOptions<FakeTag>;
|
|
21
|
+
static load(v: Viewer, id: ID): Promise<FakeTag | null>;
|
|
22
|
+
static loadX(v: Viewer, id: ID): Promise<FakeTag>;
|
|
23
|
+
}
|
|
24
|
+
export declare const FakeTagSchema: import("../builder").BuilderSchema<FakeTag>;
|
|
25
|
+
export interface TagCreateInput {
|
|
26
|
+
displayName: string;
|
|
27
|
+
canonicalName: string;
|
|
28
|
+
ownerID: ID;
|
|
29
|
+
createdAt?: Date;
|
|
30
|
+
updatedAt?: Date;
|
|
31
|
+
}
|
|
32
|
+
export type TagEditInput = Partial<TagCreateInput>;
|
|
33
|
+
export declare function getTagBuilder(viewer: Viewer, input: TagCreateInput): import("../builder").SimpleBuilder<FakeTag, null>;
|
|
34
|
+
export declare function getTagAction(viewer: Viewer, input: TagCreateInput): SimpleAction<FakeTag, null>;
|
|
35
|
+
export declare function createTag(viewer: Viewer, input: TagCreateInput): Promise<FakeTag>;
|
|
36
|
+
export declare const tagLoader: ObjectLoaderFactory<Data>;
|
|
@@ -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) {
|
|
@@ -241,7 +257,7 @@ async function createAllEvents(opts) {
|
|
|
241
257
|
const input = opts.eventInputs?.[idx];
|
|
242
258
|
const builder = (0, fake_event_1.getEventBuilder)(user.viewer, getEventInput(user, input));
|
|
243
259
|
await builder.saveX();
|
|
244
|
-
return
|
|
260
|
+
return builder.editedEntX();
|
|
245
261
|
}));
|
|
246
262
|
expect(events.length).toBe(opts.howMany);
|
|
247
263
|
return [user, events];
|