@snowtop/ent 0.1.0-alpha160-test7 → 0.1.0-alpha161-test1
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/{dist/core → core}/query/assoc_query.d.ts +3 -0
- package/{dist/core → core}/query/assoc_query.js +71 -0
- package/{dist/core → core}/query/query.d.ts +3 -0
- package/{dist/core → core}/query/query.js +20 -6
- package/core/query/shared_assoc_test.d.ts +2 -0
- package/core/query/shared_assoc_test.js +1089 -0
- package/core/query/shared_test.d.ts +21 -0
- package/core/query/shared_test.js +736 -0
- package/graphql/query/shared_assoc_test.d.ts +1 -0
- package/graphql/query/shared_assoc_test.js +203 -0
- package/package.json +8 -53
- package/{dist/testutils → testutils}/fake_data/test_helpers.js +2 -1
- package/dist/package.json +0 -64
- package/src/action/action.ts +0 -330
- package/src/action/executor.ts +0 -453
- package/src/action/experimental_action.ts +0 -277
- package/src/action/index.ts +0 -31
- package/src/action/operations.ts +0 -967
- package/src/action/orchestrator.ts +0 -1527
- package/src/action/privacy.ts +0 -37
- package/src/action/relative_value.ts +0 -242
- package/src/action/transaction.ts +0 -38
- package/src/auth/auth.ts +0 -77
- package/src/auth/index.ts +0 -8
- package/src/core/base.ts +0 -367
- package/src/core/clause.ts +0 -1065
- package/src/core/config.ts +0 -219
- package/src/core/const.ts +0 -5
- package/src/core/context.ts +0 -135
- package/src/core/convert.ts +0 -106
- package/src/core/date.ts +0 -23
- package/src/core/db.ts +0 -498
- package/src/core/ent.ts +0 -1740
- package/src/core/global_schema.ts +0 -49
- package/src/core/loaders/assoc_count_loader.ts +0 -99
- package/src/core/loaders/assoc_edge_loader.ts +0 -250
- package/src/core/loaders/index.ts +0 -12
- package/src/core/loaders/loader.ts +0 -66
- package/src/core/loaders/object_loader.ts +0 -489
- package/src/core/loaders/query_loader.ts +0 -314
- package/src/core/loaders/raw_count_loader.ts +0 -175
- package/src/core/logger.ts +0 -49
- package/src/core/privacy.ts +0 -660
- package/src/core/query/assoc_query.ts +0 -240
- package/src/core/query/custom_clause_query.ts +0 -174
- package/src/core/query/custom_query.ts +0 -302
- package/src/core/query/index.ts +0 -9
- package/src/core/query/query.ts +0 -674
- package/src/core/query_impl.ts +0 -32
- package/src/core/viewer.ts +0 -52
- package/src/ent.code-workspace +0 -73
- package/src/graphql/builtins/connection.ts +0 -25
- package/src/graphql/builtins/edge.ts +0 -16
- package/src/graphql/builtins/node.ts +0 -12
- package/src/graphql/graphql.ts +0 -891
- package/src/graphql/graphql_field_helpers.ts +0 -221
- package/src/graphql/index.ts +0 -42
- package/src/graphql/mutations/union.ts +0 -39
- package/src/graphql/node_resolver.ts +0 -122
- package/src/graphql/query/connection_type.ts +0 -113
- package/src/graphql/query/edge_connection.ts +0 -171
- package/src/graphql/query/page_info.ts +0 -34
- package/src/graphql/query/shared_edge_connection.ts +0 -287
- package/src/graphql/scalars/orderby_direction.ts +0 -13
- package/src/graphql/scalars/time.ts +0 -38
- package/src/imports/dataz/example1/_auth.ts +0 -51
- package/src/imports/dataz/example1/_viewer.ts +0 -35
- package/src/imports/index.ts +0 -213
- package/src/index.ts +0 -145
- package/src/parse_schema/parse.ts +0 -585
- package/src/schema/base_schema.ts +0 -224
- package/src/schema/field.ts +0 -1087
- package/src/schema/index.ts +0 -53
- package/src/schema/json_field.ts +0 -94
- package/src/schema/schema.ts +0 -1028
- package/src/schema/struct_field.ts +0 -234
- package/src/schema/union_field.ts +0 -105
- package/src/scripts/custom_compiler.ts +0 -331
- package/src/scripts/custom_graphql.ts +0 -550
- package/src/scripts/migrate_v0.1.ts +0 -41
- package/src/scripts/move_types.ts +0 -131
- package/src/scripts/read_schema.ts +0 -67
- package/src/setupPackage.js +0 -42
- package/src/testutils/action/complex_schemas.ts +0 -517
- package/src/testutils/builder.ts +0 -422
- package/src/testutils/context/test_context.ts +0 -25
- package/src/testutils/db/fixture.ts +0 -32
- package/src/testutils/db/temp_db.ts +0 -941
- package/src/testutils/db/value.ts +0 -294
- package/src/testutils/db_mock.ts +0 -351
- package/src/testutils/db_time_zone.ts +0 -40
- package/src/testutils/ent-graphql-tests/index.ts +0 -653
- package/src/testutils/fake_comms.ts +0 -50
- package/src/testutils/fake_data/const.ts +0 -64
- package/src/testutils/fake_data/events_query.ts +0 -145
- package/src/testutils/fake_data/fake_contact.ts +0 -150
- package/src/testutils/fake_data/fake_event.ts +0 -150
- package/src/testutils/fake_data/fake_tag.ts +0 -139
- package/src/testutils/fake_data/fake_user.ts +0 -232
- package/src/testutils/fake_data/index.ts +0 -1
- package/src/testutils/fake_data/internal.ts +0 -8
- package/src/testutils/fake_data/tag_query.ts +0 -56
- package/src/testutils/fake_data/test_helpers.ts +0 -388
- package/src/testutils/fake_data/user_query.ts +0 -524
- package/src/testutils/fake_log.ts +0 -52
- package/src/testutils/mock_date.ts +0 -10
- package/src/testutils/mock_log.ts +0 -39
- package/src/testutils/parse_sql.ts +0 -685
- package/src/testutils/test_edge_global_schema.ts +0 -49
- package/src/testutils/write.ts +0 -70
- package/src/tsc/ast.ts +0 -351
- package/src/tsc/compilerOptions.ts +0 -85
- package/src/tsc/move_generated.ts +0 -191
- package/src/tsc/transform.ts +0 -226
- package/src/tsc/transform_action.ts +0 -224
- package/src/tsc/transform_ent.ts +0 -66
- package/src/tsc/transform_schema.ts +0 -546
- package/tsconfig.json +0 -20
- /package/{dist/action → action}/action.d.ts +0 -0
- /package/{dist/action → action}/action.js +0 -0
- /package/{dist/action → action}/executor.d.ts +0 -0
- /package/{dist/action → action}/executor.js +0 -0
- /package/{dist/action → action}/experimental_action.d.ts +0 -0
- /package/{dist/action → action}/experimental_action.js +0 -0
- /package/{dist/action → action}/index.d.ts +0 -0
- /package/{dist/action → action}/index.js +0 -0
- /package/{dist/action → action}/operations.d.ts +0 -0
- /package/{dist/action → action}/operations.js +0 -0
- /package/{dist/action → action}/orchestrator.d.ts +0 -0
- /package/{dist/action → action}/orchestrator.js +0 -0
- /package/{dist/action → action}/privacy.d.ts +0 -0
- /package/{dist/action → action}/privacy.js +0 -0
- /package/{dist/action → action}/relative_value.d.ts +0 -0
- /package/{dist/action → action}/relative_value.js +0 -0
- /package/{dist/action → action}/transaction.d.ts +0 -0
- /package/{dist/action → action}/transaction.js +0 -0
- /package/{dist/auth → auth}/auth.d.ts +0 -0
- /package/{dist/auth → auth}/auth.js +0 -0
- /package/{dist/auth → auth}/index.d.ts +0 -0
- /package/{dist/auth → auth}/index.js +0 -0
- /package/{dist/core → core}/base.d.ts +0 -0
- /package/{dist/core → core}/base.js +0 -0
- /package/{dist/core → core}/clause.d.ts +0 -0
- /package/{dist/core → core}/clause.js +0 -0
- /package/{dist/core → core}/config.d.ts +0 -0
- /package/{dist/core → core}/config.js +0 -0
- /package/{dist/core → core}/const.d.ts +0 -0
- /package/{dist/core → core}/const.js +0 -0
- /package/{dist/core → core}/context.d.ts +0 -0
- /package/{dist/core → core}/context.js +0 -0
- /package/{dist/core → core}/convert.d.ts +0 -0
- /package/{dist/core → core}/convert.js +0 -0
- /package/{dist/core → core}/date.d.ts +0 -0
- /package/{dist/core → core}/date.js +0 -0
- /package/{dist/core → core}/db.d.ts +0 -0
- /package/{dist/core → core}/db.js +0 -0
- /package/{dist/core → core}/ent.d.ts +0 -0
- /package/{dist/core → core}/ent.js +0 -0
- /package/{dist/core → core}/global_schema.d.ts +0 -0
- /package/{dist/core → core}/global_schema.js +0 -0
- /package/{dist/core → core}/loaders/assoc_count_loader.d.ts +0 -0
- /package/{dist/core → core}/loaders/assoc_count_loader.js +0 -0
- /package/{dist/core → core}/loaders/assoc_edge_loader.d.ts +0 -0
- /package/{dist/core → core}/loaders/assoc_edge_loader.js +0 -0
- /package/{dist/core → core}/loaders/index.d.ts +0 -0
- /package/{dist/core → core}/loaders/index.js +0 -0
- /package/{dist/core → core}/loaders/loader.d.ts +0 -0
- /package/{dist/core → core}/loaders/loader.js +0 -0
- /package/{dist/core → core}/loaders/object_loader.d.ts +0 -0
- /package/{dist/core → core}/loaders/object_loader.js +0 -0
- /package/{dist/core → core}/loaders/query_loader.d.ts +0 -0
- /package/{dist/core → core}/loaders/query_loader.js +0 -0
- /package/{dist/core → core}/loaders/raw_count_loader.d.ts +0 -0
- /package/{dist/core → core}/loaders/raw_count_loader.js +0 -0
- /package/{dist/core → core}/logger.d.ts +0 -0
- /package/{dist/core → core}/logger.js +0 -0
- /package/{dist/core → core}/privacy.d.ts +0 -0
- /package/{dist/core → core}/privacy.js +0 -0
- /package/{dist/core → core}/query/custom_clause_query.d.ts +0 -0
- /package/{dist/core → core}/query/custom_clause_query.js +0 -0
- /package/{dist/core → core}/query/custom_query.d.ts +0 -0
- /package/{dist/core → core}/query/custom_query.js +0 -0
- /package/{dist/core → core}/query/index.d.ts +0 -0
- /package/{dist/core → core}/query/index.js +0 -0
- /package/{dist/core → core}/query_impl.d.ts +0 -0
- /package/{dist/core → core}/query_impl.js +0 -0
- /package/{dist/core → core}/viewer.d.ts +0 -0
- /package/{dist/core → core}/viewer.js +0 -0
- /package/{dist/graphql → graphql}/builtins/connection.d.ts +0 -0
- /package/{dist/graphql → graphql}/builtins/connection.js +0 -0
- /package/{dist/graphql → graphql}/builtins/edge.d.ts +0 -0
- /package/{dist/graphql → graphql}/builtins/edge.js +0 -0
- /package/{dist/graphql → graphql}/builtins/node.d.ts +0 -0
- /package/{dist/graphql → graphql}/builtins/node.js +0 -0
- /package/{dist/graphql → graphql}/graphql.d.ts +0 -0
- /package/{dist/graphql → graphql}/graphql.js +0 -0
- /package/{dist/graphql → graphql}/graphql_field_helpers.d.ts +0 -0
- /package/{dist/graphql → graphql}/graphql_field_helpers.js +0 -0
- /package/{dist/graphql → graphql}/index.d.ts +0 -0
- /package/{dist/graphql → graphql}/index.js +0 -0
- /package/{dist/graphql → graphql}/mutations/union.d.ts +0 -0
- /package/{dist/graphql → graphql}/mutations/union.js +0 -0
- /package/{dist/graphql → graphql}/node_resolver.d.ts +0 -0
- /package/{dist/graphql → graphql}/node_resolver.js +0 -0
- /package/{dist/graphql → graphql}/query/connection_type.d.ts +0 -0
- /package/{dist/graphql → graphql}/query/connection_type.js +0 -0
- /package/{dist/graphql → graphql}/query/edge_connection.d.ts +0 -0
- /package/{dist/graphql → graphql}/query/edge_connection.js +0 -0
- /package/{dist/graphql → graphql}/query/page_info.d.ts +0 -0
- /package/{dist/graphql → graphql}/query/page_info.js +0 -0
- /package/{dist/graphql → graphql}/query/shared_edge_connection.d.ts +0 -0
- /package/{dist/graphql → graphql}/query/shared_edge_connection.js +0 -0
- /package/{dist/graphql → graphql}/scalars/orderby_direction.d.ts +0 -0
- /package/{dist/graphql → graphql}/scalars/orderby_direction.js +0 -0
- /package/{dist/graphql → graphql}/scalars/time.d.ts +0 -0
- /package/{dist/graphql → graphql}/scalars/time.js +0 -0
- /package/{dist/imports → imports}/dataz/example1/_auth.d.ts +0 -0
- /package/{dist/imports → imports}/dataz/example1/_auth.js +0 -0
- /package/{dist/imports → imports}/dataz/example1/_viewer.d.ts +0 -0
- /package/{dist/imports → imports}/dataz/example1/_viewer.js +0 -0
- /package/{dist/imports → imports}/index.d.ts +0 -0
- /package/{dist/imports → imports}/index.js +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/parse_schema → parse_schema}/parse.d.ts +0 -0
- /package/{dist/parse_schema → parse_schema}/parse.js +0 -0
- /package/{dist/schema → schema}/base_schema.d.ts +0 -0
- /package/{dist/schema → schema}/base_schema.js +0 -0
- /package/{dist/schema → schema}/field.d.ts +0 -0
- /package/{dist/schema → schema}/field.js +0 -0
- /package/{dist/schema → schema}/index.d.ts +0 -0
- /package/{dist/schema → schema}/index.js +0 -0
- /package/{dist/schema → schema}/json_field.d.ts +0 -0
- /package/{dist/schema → schema}/json_field.js +0 -0
- /package/{dist/schema → schema}/schema.d.ts +0 -0
- /package/{dist/schema → schema}/schema.js +0 -0
- /package/{dist/schema → schema}/struct_field.d.ts +0 -0
- /package/{dist/schema → schema}/struct_field.js +0 -0
- /package/{dist/schema → schema}/union_field.d.ts +0 -0
- /package/{dist/schema → schema}/union_field.js +0 -0
- /package/{dist/scripts → scripts}/custom_compiler.d.ts +0 -0
- /package/{dist/scripts → scripts}/custom_compiler.js +0 -0
- /package/{dist/scripts → scripts}/custom_graphql.d.ts +0 -0
- /package/{dist/scripts → scripts}/custom_graphql.js +0 -0
- /package/{dist/scripts → scripts}/migrate_v0.1.d.ts +0 -0
- /package/{dist/scripts → scripts}/migrate_v0.1.js +0 -0
- /package/{dist/scripts → scripts}/move_types.d.ts +0 -0
- /package/{dist/scripts → scripts}/move_types.js +0 -0
- /package/{dist/scripts → scripts}/read_schema.d.ts +0 -0
- /package/{dist/scripts → scripts}/read_schema.js +0 -0
- /package/{dist/testutils → testutils}/action/complex_schemas.d.ts +0 -0
- /package/{dist/testutils → testutils}/action/complex_schemas.js +0 -0
- /package/{dist/testutils → testutils}/builder.d.ts +0 -0
- /package/{dist/testutils → testutils}/builder.js +0 -0
- /package/{dist/testutils → testutils}/context/test_context.d.ts +0 -0
- /package/{dist/testutils → testutils}/context/test_context.js +0 -0
- /package/{dist/testutils → testutils}/db/fixture.d.ts +0 -0
- /package/{dist/testutils → testutils}/db/fixture.js +0 -0
- /package/{dist/testutils → testutils}/db/temp_db.d.ts +0 -0
- /package/{dist/testutils → testutils}/db/temp_db.js +0 -0
- /package/{dist/testutils → testutils}/db/value.d.ts +0 -0
- /package/{dist/testutils → testutils}/db/value.js +0 -0
- /package/{dist/testutils → testutils}/db_mock.d.ts +0 -0
- /package/{dist/testutils → testutils}/db_mock.js +0 -0
- /package/{dist/testutils → testutils}/db_time_zone.d.ts +0 -0
- /package/{dist/testutils → testutils}/db_time_zone.js +0 -0
- /package/{dist/testutils → testutils}/ent-graphql-tests/index.d.ts +0 -0
- /package/{dist/testutils → testutils}/ent-graphql-tests/index.js +0 -0
- /package/{dist/testutils → testutils}/fake_comms.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_comms.js +0 -0
- /package/{dist/testutils → testutils}/fake_data/const.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/const.js +0 -0
- /package/{dist/testutils → testutils}/fake_data/events_query.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/events_query.js +0 -0
- /package/{dist/testutils → testutils}/fake_data/fake_contact.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/fake_contact.js +0 -0
- /package/{dist/testutils → testutils}/fake_data/fake_event.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/fake_event.js +0 -0
- /package/{dist/testutils → testutils}/fake_data/fake_tag.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/fake_tag.js +0 -0
- /package/{dist/testutils → testutils}/fake_data/fake_user.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/fake_user.js +0 -0
- /package/{dist/testutils → testutils}/fake_data/index.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/index.js +0 -0
- /package/{dist/testutils → testutils}/fake_data/internal.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/internal.js +0 -0
- /package/{dist/testutils → testutils}/fake_data/tag_query.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/tag_query.js +0 -0
- /package/{dist/testutils → testutils}/fake_data/test_helpers.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/user_query.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_data/user_query.js +0 -0
- /package/{dist/testutils → testutils}/fake_log.d.ts +0 -0
- /package/{dist/testutils → testutils}/fake_log.js +0 -0
- /package/{dist/testutils → testutils}/mock_date.d.ts +0 -0
- /package/{dist/testutils → testutils}/mock_date.js +0 -0
- /package/{dist/testutils → testutils}/mock_log.d.ts +0 -0
- /package/{dist/testutils → testutils}/mock_log.js +0 -0
- /package/{dist/testutils → testutils}/parse_sql.d.ts +0 -0
- /package/{dist/testutils → testutils}/parse_sql.js +0 -0
- /package/{dist/testutils → testutils}/test_edge_global_schema.d.ts +0 -0
- /package/{dist/testutils → testutils}/test_edge_global_schema.js +0 -0
- /package/{dist/testutils → testutils}/write.d.ts +0 -0
- /package/{dist/testutils → testutils}/write.js +0 -0
- /package/{dist/tsc → tsc}/ast.d.ts +0 -0
- /package/{dist/tsc → tsc}/ast.js +0 -0
- /package/{dist/tsc → tsc}/compilerOptions.d.ts +0 -0
- /package/{dist/tsc → tsc}/compilerOptions.js +0 -0
- /package/{dist/tsc → tsc}/move_generated.d.ts +0 -0
- /package/{dist/tsc → tsc}/move_generated.js +0 -0
- /package/{dist/tsc → tsc}/transform.d.ts +0 -0
- /package/{dist/tsc → tsc}/transform.js +0 -0
- /package/{dist/tsc → tsc}/transform_action.d.ts +0 -0
- /package/{dist/tsc → tsc}/transform_action.js +0 -0
- /package/{dist/tsc → tsc}/transform_ent.d.ts +0 -0
- /package/{dist/tsc → tsc}/transform_ent.js +0 -0
- /package/{dist/tsc → tsc}/transform_schema.d.ts +0 -0
- /package/{dist/tsc → tsc}/transform_schema.js +0 -0
|
@@ -1,524 +0,0 @@
|
|
|
1
|
-
import { Data, Ent, ID, Viewer } from "../../core/base";
|
|
2
|
-
import { CustomEdgeQueryBase } from "../../core/query/custom_query";
|
|
3
|
-
import { AssocEdge } from "../../core/ent";
|
|
4
|
-
import * as clause from "../../core/clause";
|
|
5
|
-
import {
|
|
6
|
-
AssocEdgeQueryBase,
|
|
7
|
-
EdgeQuerySource,
|
|
8
|
-
} from "../../core/query/assoc_query";
|
|
9
|
-
import {
|
|
10
|
-
EdgeType,
|
|
11
|
-
FakeUser,
|
|
12
|
-
FakeEvent,
|
|
13
|
-
FakeContact,
|
|
14
|
-
EventToAttendeesQuery,
|
|
15
|
-
EventToDeclinedQuery,
|
|
16
|
-
EventToHostsQuery,
|
|
17
|
-
EventToInvitedQuery,
|
|
18
|
-
EventToMaybeQuery,
|
|
19
|
-
} from "./internal";
|
|
20
|
-
import { RawCountLoaderFactory } from "../../core/loaders/raw_count_loader";
|
|
21
|
-
import { AssocEdgeCountLoaderFactory } from "../../core/loaders/assoc_count_loader";
|
|
22
|
-
import { AssocEdgeLoaderFactory } from "../../core/loaders/assoc_edge_loader";
|
|
23
|
-
import { contactLoader } from "./fake_contact";
|
|
24
|
-
import { clear } from "jest-date-mock";
|
|
25
|
-
import { Interval } from "luxon";
|
|
26
|
-
import { QueryLoaderFactory } from "../../core/loaders/query_loader";
|
|
27
|
-
import { MockDate } from "./../mock_date";
|
|
28
|
-
import { getLoaderOptions } from ".";
|
|
29
|
-
import { AllowIfViewerPrivacyPolicy } from "../../core/privacy";
|
|
30
|
-
|
|
31
|
-
export class UserToContactsQuery extends AssocEdgeQueryBase<
|
|
32
|
-
FakeUser,
|
|
33
|
-
FakeContact,
|
|
34
|
-
AssocEdge
|
|
35
|
-
> {
|
|
36
|
-
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser>) {
|
|
37
|
-
super(
|
|
38
|
-
viewer,
|
|
39
|
-
src,
|
|
40
|
-
new AssocEdgeCountLoaderFactory(EdgeType.UserToContacts),
|
|
41
|
-
new AssocEdgeLoaderFactory(EdgeType.UserToContacts, AssocEdge),
|
|
42
|
-
FakeContact.loaderOptions(),
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
static query(
|
|
47
|
-
viewer: Viewer,
|
|
48
|
-
src: EdgeQuerySource<FakeUser>,
|
|
49
|
-
): UserToContactsQuery {
|
|
50
|
-
return new UserToContactsQuery(viewer, src);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
sourceEnt(id: ID) {
|
|
54
|
-
return FakeUser.load(this.viewer, id);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export const userToContactsCountLoaderFactory = new RawCountLoaderFactory({
|
|
59
|
-
...FakeContact.loaderOptions(),
|
|
60
|
-
groupCol: "user_id",
|
|
61
|
-
});
|
|
62
|
-
export const userToContactsDataLoaderFactory = new QueryLoaderFactory({
|
|
63
|
-
...FakeContact.loaderOptions(),
|
|
64
|
-
groupCol: "user_id",
|
|
65
|
-
toPrime: [contactLoader],
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// note: this is still used in graphql tests...
|
|
69
|
-
export class UserToContactsFkeyQueryDeprecated extends CustomEdgeQueryBase<
|
|
70
|
-
FakeUser,
|
|
71
|
-
FakeContact
|
|
72
|
-
> {
|
|
73
|
-
constructor(viewer: Viewer, src: ID | FakeUser) {
|
|
74
|
-
super(viewer, {
|
|
75
|
-
src,
|
|
76
|
-
// we want to reuse this and not create a new one every time...
|
|
77
|
-
countLoaderFactory: userToContactsCountLoaderFactory,
|
|
78
|
-
dataLoaderFactory: userToContactsDataLoaderFactory,
|
|
79
|
-
options: FakeContact.loaderOptions(),
|
|
80
|
-
sortColumn: "created_at",
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
static query(
|
|
85
|
-
viewer: Viewer,
|
|
86
|
-
src: FakeUser | ID,
|
|
87
|
-
): UserToContactsFkeyQueryDeprecated {
|
|
88
|
-
return new UserToContactsFkeyQueryDeprecated(viewer, src);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
sourceEnt(id: ID) {
|
|
92
|
-
return FakeUser.load(this.viewer, id);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// this replaces UserToContactsFkeyQueryDeprecated
|
|
97
|
-
export class UserToContactsFkeyQuery extends CustomEdgeQueryBase<
|
|
98
|
-
FakeUser,
|
|
99
|
-
FakeContact
|
|
100
|
-
> {
|
|
101
|
-
constructor(viewer: Viewer, src: ID | FakeUser) {
|
|
102
|
-
super(viewer, {
|
|
103
|
-
src,
|
|
104
|
-
loadEntOptions: FakeContact.loaderOptions(),
|
|
105
|
-
groupCol: "user_id",
|
|
106
|
-
name: "user_to_contacts",
|
|
107
|
-
// instead of the id col...
|
|
108
|
-
sortColumn: "created_at",
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
static query(viewer: Viewer, src: FakeUser | ID): UserToContactsFkeyQuery {
|
|
113
|
-
return new UserToContactsFkeyQuery(viewer, src);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
sourceEnt(id: ID) {
|
|
117
|
-
return FakeUser.load(this.viewer, id);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export class UserToContactsFkeyQueryAsc extends CustomEdgeQueryBase<
|
|
122
|
-
FakeUser,
|
|
123
|
-
FakeContact
|
|
124
|
-
> {
|
|
125
|
-
constructor(viewer: Viewer, src: ID | FakeUser) {
|
|
126
|
-
super(viewer, {
|
|
127
|
-
src,
|
|
128
|
-
loadEntOptions: FakeContact.loaderOptions(),
|
|
129
|
-
groupCol: "user_id",
|
|
130
|
-
name: "user_to_contacts",
|
|
131
|
-
orderby: [
|
|
132
|
-
{
|
|
133
|
-
column: "created_at",
|
|
134
|
-
direction: "ASC",
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
static query(viewer: Viewer, src: FakeUser | ID): UserToContactsFkeyQuery {
|
|
141
|
-
return new UserToContactsFkeyQueryAsc(viewer, src);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
sourceEnt(id: ID) {
|
|
145
|
-
return FakeUser.load(this.viewer, id);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export class UserToFriendsQuery extends AssocEdgeQueryBase<
|
|
150
|
-
FakeUser,
|
|
151
|
-
FakeUser,
|
|
152
|
-
AssocEdge
|
|
153
|
-
> {
|
|
154
|
-
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser>) {
|
|
155
|
-
super(
|
|
156
|
-
viewer,
|
|
157
|
-
src,
|
|
158
|
-
new AssocEdgeCountLoaderFactory(EdgeType.UserToFriends),
|
|
159
|
-
new AssocEdgeLoaderFactory(EdgeType.UserToFriends, AssocEdge),
|
|
160
|
-
FakeUser.loaderOptions(),
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
static query(
|
|
165
|
-
viewer: Viewer,
|
|
166
|
-
src: EdgeQuerySource<FakeUser>,
|
|
167
|
-
): UserToFriendsQuery {
|
|
168
|
-
return new UserToFriendsQuery(viewer, src);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
sourceEnt(id: ID) {
|
|
172
|
-
return FakeUser.load(this.viewer, id);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
queryContacts(): UserToContactsQuery {
|
|
176
|
-
return UserToContactsQuery.query(this.viewer, this);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
queryFriends(): UserToFriendsQuery {
|
|
180
|
-
return UserToFriendsQuery.query(this.viewer, this);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
queryHostedEvents(): UserToHostedEventsQuery {
|
|
184
|
-
return UserToHostedEventsQuery.query(this.viewer, this);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
queryEventsAttending(): UserToEventsAttendingQuery {
|
|
188
|
-
return UserToEventsAttendingQuery.query(this.viewer, this);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
queryCustomEdge(): UserToCustomEdgeQuery {
|
|
192
|
-
return UserToCustomEdgeQuery.query(this.viewer, this);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// example with custom method
|
|
197
|
-
export class CustomEdge extends AssocEdge {
|
|
198
|
-
deleted_at: Date | null = null;
|
|
199
|
-
|
|
200
|
-
constructor(data: Data) {
|
|
201
|
-
super(data);
|
|
202
|
-
this.deleted_at = data.deleted_at;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
async loadUser(viewer: Viewer) {
|
|
206
|
-
return await FakeUser.load(viewer, this.id2);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export class UserToCustomEdgeQuery extends AssocEdgeQueryBase<
|
|
211
|
-
FakeUser,
|
|
212
|
-
FakeUser,
|
|
213
|
-
CustomEdge
|
|
214
|
-
> {
|
|
215
|
-
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser>) {
|
|
216
|
-
super(
|
|
217
|
-
viewer,
|
|
218
|
-
src,
|
|
219
|
-
new AssocEdgeCountLoaderFactory(EdgeType.UserToCustomEdge),
|
|
220
|
-
new AssocEdgeLoaderFactory(EdgeType.UserToCustomEdge, CustomEdge),
|
|
221
|
-
FakeUser.loaderOptions(),
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
static query(
|
|
226
|
-
viewer: Viewer,
|
|
227
|
-
src: EdgeQuerySource<FakeUser>,
|
|
228
|
-
): UserToCustomEdgeQuery {
|
|
229
|
-
return new UserToCustomEdgeQuery(viewer, src);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
sourceEnt(id: ID) {
|
|
233
|
-
return FakeUser.load(this.viewer, id);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
queryContacts(): UserToContactsQuery {
|
|
237
|
-
return UserToContactsQuery.query(this.viewer, this);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
queryFriends(): UserToFriendsQuery {
|
|
241
|
-
return UserToFriendsQuery.query(this.viewer, this);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
queryHostedEvents(): UserToHostedEventsQuery {
|
|
245
|
-
return UserToHostedEventsQuery.query(this.viewer, this);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
queryEventsAttending(): UserToEventsAttendingQuery {
|
|
249
|
-
return UserToEventsAttendingQuery.query(this.viewer, this);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export class UserToFriendRequestsQuery extends AssocEdgeQueryBase<
|
|
254
|
-
FakeUser,
|
|
255
|
-
FakeUser,
|
|
256
|
-
AssocEdge
|
|
257
|
-
> {
|
|
258
|
-
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser>) {
|
|
259
|
-
super(
|
|
260
|
-
viewer,
|
|
261
|
-
src,
|
|
262
|
-
new AssocEdgeCountLoaderFactory(EdgeType.UserToFriendRequests),
|
|
263
|
-
new AssocEdgeLoaderFactory(EdgeType.UserToFriendRequests, AssocEdge),
|
|
264
|
-
FakeUser.loaderOptions(),
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
static query(
|
|
269
|
-
viewer: Viewer,
|
|
270
|
-
src: EdgeQuerySource<FakeUser>,
|
|
271
|
-
): UserToFriendRequestsQuery {
|
|
272
|
-
return new UserToFriendRequestsQuery(viewer, src);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
sourceEnt(id: ID) {
|
|
276
|
-
return FakeUser.load(this.viewer, id);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
queryContacts(): UserToContactsQuery {
|
|
280
|
-
return UserToContactsQuery.query(this.viewer, this);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
queryFriends(): UserToFriendsQuery {
|
|
284
|
-
return UserToFriendsQuery.query(this.viewer, this);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
queryHostedEvents(): UserToHostedEventsQuery {
|
|
288
|
-
return UserToHostedEventsQuery.query(this.viewer, this);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
queryEventsAttending(): UserToEventsAttendingQuery {
|
|
292
|
-
return UserToEventsAttendingQuery.query(this.viewer, this);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
queryCustomEdge(): UserToCustomEdgeQuery {
|
|
296
|
-
return UserToCustomEdgeQuery.query(this.viewer, this);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
export class UserToIncomingFriendRequestsQuery extends AssocEdgeQueryBase<
|
|
301
|
-
FakeUser,
|
|
302
|
-
FakeUser,
|
|
303
|
-
CustomEdge
|
|
304
|
-
> {
|
|
305
|
-
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser, FakeUser>) {
|
|
306
|
-
super(
|
|
307
|
-
viewer,
|
|
308
|
-
src,
|
|
309
|
-
new AssocEdgeCountLoaderFactory(EdgeType.UserToIncomingFriendRequests),
|
|
310
|
-
new AssocEdgeLoaderFactory(
|
|
311
|
-
EdgeType.UserToIncomingFriendRequests,
|
|
312
|
-
CustomEdge,
|
|
313
|
-
),
|
|
314
|
-
FakeUser.loaderOptions(),
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
getPrivacyPolicy() {
|
|
319
|
-
return AllowIfViewerPrivacyPolicy;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
sourceEnt(id: ID) {
|
|
323
|
-
return FakeUser.load(this.viewer, id);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
static query(
|
|
327
|
-
viewer: Viewer,
|
|
328
|
-
src: EdgeQuerySource<FakeUser, FakeUser>,
|
|
329
|
-
): UserToIncomingFriendRequestsQuery {
|
|
330
|
-
return new UserToIncomingFriendRequestsQuery(viewer, src);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
queryContacts(): UserToContactsQuery {
|
|
334
|
-
return UserToContactsQuery.query(this.viewer, this);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
queryFriends(): UserToFriendsQuery {
|
|
338
|
-
return UserToFriendsQuery.query(this.viewer, this);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
queryHostedEvents(): UserToHostedEventsQuery {
|
|
342
|
-
return UserToHostedEventsQuery.query(this.viewer, this);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
queryEventsAttending(): UserToEventsAttendingQuery {
|
|
346
|
-
return UserToEventsAttendingQuery.query(this.viewer, this);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
queryCustomEdge(): UserToCustomEdgeQuery {
|
|
350
|
-
return UserToCustomEdgeQuery.query(this.viewer, this);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
// this is generated in codegen. we'll just add it manually here
|
|
354
|
-
withoutTransformations(): this {
|
|
355
|
-
this.configureEdgeQueryableDataOptions({
|
|
356
|
-
disableTransformations: true,
|
|
357
|
-
});
|
|
358
|
-
return this;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export class UserToEventsAttendingQuery extends AssocEdgeQueryBase<
|
|
363
|
-
FakeUser,
|
|
364
|
-
FakeEvent,
|
|
365
|
-
AssocEdge
|
|
366
|
-
> {
|
|
367
|
-
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser, FakeEvent>) {
|
|
368
|
-
super(
|
|
369
|
-
viewer,
|
|
370
|
-
src,
|
|
371
|
-
new AssocEdgeCountLoaderFactory(EdgeType.UserToEventsAttending),
|
|
372
|
-
new AssocEdgeLoaderFactory(EdgeType.UserToEventsAttending, AssocEdge),
|
|
373
|
-
FakeEvent.loaderOptions(),
|
|
374
|
-
);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
static query(
|
|
378
|
-
viewer: Viewer,
|
|
379
|
-
src: EdgeQuerySource<FakeUser, FakeEvent>,
|
|
380
|
-
): UserToEventsAttendingQuery {
|
|
381
|
-
return new UserToEventsAttendingQuery(viewer, src);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
sourceEnt(id: ID) {
|
|
385
|
-
return FakeUser.load(this.viewer, id);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
queryHosts(): EventToHostsQuery {
|
|
389
|
-
return EventToHostsQuery.query(this.viewer, this);
|
|
390
|
-
}
|
|
391
|
-
queryAttendees(): EventToAttendeesQuery {
|
|
392
|
-
return EventToAttendeesQuery.query(this.viewer, this);
|
|
393
|
-
}
|
|
394
|
-
queryInvited(): EventToInvitedQuery {
|
|
395
|
-
return EventToInvitedQuery.query(this.viewer, this);
|
|
396
|
-
}
|
|
397
|
-
queryDeclined(): EventToDeclinedQuery {
|
|
398
|
-
return EventToDeclinedQuery.query(this.viewer, this);
|
|
399
|
-
}
|
|
400
|
-
queryMaybe(): EventToMaybeQuery {
|
|
401
|
-
return EventToDeclinedQuery.query(this.viewer, this);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
export class UserToHostedEventsQuery extends AssocEdgeQueryBase<
|
|
406
|
-
FakeUser,
|
|
407
|
-
FakeEvent,
|
|
408
|
-
AssocEdge
|
|
409
|
-
> {
|
|
410
|
-
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser, FakeEvent>) {
|
|
411
|
-
super(
|
|
412
|
-
viewer,
|
|
413
|
-
src,
|
|
414
|
-
new AssocEdgeCountLoaderFactory(EdgeType.UserToHostedEvents),
|
|
415
|
-
new AssocEdgeLoaderFactory(EdgeType.UserToHostedEvents, AssocEdge),
|
|
416
|
-
FakeEvent.loaderOptions(),
|
|
417
|
-
);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
static query(
|
|
421
|
-
viewer: Viewer,
|
|
422
|
-
src: EdgeQuerySource<FakeUser, FakeEvent>,
|
|
423
|
-
): UserToHostedEventsQuery {
|
|
424
|
-
return new UserToHostedEventsQuery(viewer, src);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
sourceEnt(id: ID) {
|
|
428
|
-
return FakeUser.load(this.viewer, id);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
queryHosts(): EventToHostsQuery {
|
|
432
|
-
return EventToHostsQuery.query(this.viewer, this);
|
|
433
|
-
}
|
|
434
|
-
queryAttendees(): EventToAttendeesQuery {
|
|
435
|
-
return EventToAttendeesQuery.query(this.viewer, this);
|
|
436
|
-
}
|
|
437
|
-
queryInvited(): EventToInvitedQuery {
|
|
438
|
-
return EventToInvitedQuery.query(this.viewer, this);
|
|
439
|
-
}
|
|
440
|
-
queryDeclined(): EventToDeclinedQuery {
|
|
441
|
-
return EventToDeclinedQuery.query(this.viewer, this);
|
|
442
|
-
}
|
|
443
|
-
queryMaybe(): EventToMaybeQuery {
|
|
444
|
-
return EventToDeclinedQuery.query(this.viewer, this);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
export const getNextWeekClause = (): clause.Clause => {
|
|
449
|
-
// get events starting within the next week
|
|
450
|
-
|
|
451
|
-
clear();
|
|
452
|
-
const start = MockDate.getDate();
|
|
453
|
-
// 7 days
|
|
454
|
-
const end = Interval.after(start, 86400 * 1000 * 7)
|
|
455
|
-
.end.toUTC()
|
|
456
|
-
.toISO();
|
|
457
|
-
|
|
458
|
-
return clause.And(
|
|
459
|
-
clause.GreaterEq("start_time", start.toISOString()),
|
|
460
|
-
clause.LessEq("start_time", end),
|
|
461
|
-
);
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
export function getCompleteClause(id: ID): clause.Clause {
|
|
465
|
-
return clause.And(clause.Eq("user_id", id), getNextWeekClause());
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
export class UserToEventsInNextWeekQuery extends CustomEdgeQueryBase<
|
|
469
|
-
FakeUser,
|
|
470
|
-
FakeEvent
|
|
471
|
-
> {
|
|
472
|
-
constructor(viewer: Viewer, src: ID | FakeUser) {
|
|
473
|
-
super(viewer, {
|
|
474
|
-
src,
|
|
475
|
-
groupCol: "user_id",
|
|
476
|
-
clause: getNextWeekClause(),
|
|
477
|
-
loadEntOptions: FakeEvent.loaderOptions(),
|
|
478
|
-
name: "events_in_next_week",
|
|
479
|
-
sortColumn: "start_time",
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
static query(
|
|
484
|
-
viewer: Viewer,
|
|
485
|
-
src: FakeUser | ID,
|
|
486
|
-
): UserToEventsInNextWeekQuery {
|
|
487
|
-
return new UserToEventsInNextWeekQuery(viewer, src);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
sourceEnt(id: ID) {
|
|
491
|
-
return FakeUser.load(this.viewer, id);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
getPrivacyPolicy() {
|
|
495
|
-
return AllowIfViewerPrivacyPolicy;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
export class UserToFollowingQuery extends AssocEdgeQueryBase<
|
|
500
|
-
FakeUser,
|
|
501
|
-
Ent,
|
|
502
|
-
AssocEdge
|
|
503
|
-
> {
|
|
504
|
-
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser, FakeUser>) {
|
|
505
|
-
super(
|
|
506
|
-
viewer,
|
|
507
|
-
src,
|
|
508
|
-
new AssocEdgeCountLoaderFactory(EdgeType.UserToFollowing),
|
|
509
|
-
new AssocEdgeLoaderFactory(EdgeType.UserToFollowing, AssocEdge),
|
|
510
|
-
getLoaderOptions,
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
static query(
|
|
515
|
-
viewer: Viewer,
|
|
516
|
-
src: EdgeQuerySource<FakeUser, FakeUser>,
|
|
517
|
-
): UserToFollowingQuery {
|
|
518
|
-
return new UserToFollowingQuery(viewer, src);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
sourceEnt(id: ID) {
|
|
522
|
-
return FakeUser.load(this.viewer, id);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Ent, Viewer } from "../core/base";
|
|
2
|
-
import { Builder } from "./../action";
|
|
3
|
-
|
|
4
|
-
export class FakeLogger {
|
|
5
|
-
// todo this is quick and ideal.
|
|
6
|
-
// more ideal is capturing all console.logs
|
|
7
|
-
// we do it in golang for example
|
|
8
|
-
// and will need this for production launch anyways
|
|
9
|
-
private static logs: string[] = [];
|
|
10
|
-
|
|
11
|
-
static log(line: string) {
|
|
12
|
-
this.logs.push(line);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
static verifyNoLogs() {
|
|
16
|
-
expect(this.logs.length).toBe(0);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static verifyLogs(length?: number) {
|
|
20
|
-
expect(this.logs.length).toBeGreaterThan(0);
|
|
21
|
-
if (length) {
|
|
22
|
-
expect(this.logs.length).toBe(length);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
static contains(line: string): boolean {
|
|
27
|
-
return this.logs.some((log) => log === line);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static clear() {
|
|
31
|
-
this.logs = [];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// TODO instead of needing to add this manually
|
|
36
|
-
// we need to build a way to add global observers (and maybe triggers)
|
|
37
|
-
// to be run on every action/mutation
|
|
38
|
-
// logger is an obvious one that's needed/ wanted on every action
|
|
39
|
-
export class EntCreationObserver<
|
|
40
|
-
TEnt extends Ent<TViewer>,
|
|
41
|
-
TViewer extends Viewer = Viewer,
|
|
42
|
-
> {
|
|
43
|
-
async observe(builder: Builder<TEnt, TViewer>) {
|
|
44
|
-
if (!builder.editedEnt) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
let ent = await builder.editedEnt();
|
|
48
|
-
if (ent) {
|
|
49
|
-
FakeLogger.log(`ent ${builder.ent.name} created with id ${ent.id}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export class MockDate {
|
|
2
|
-
private static date: Date | undefined;
|
|
3
|
-
// this exists so that we can reuse the same date across different places in tests
|
|
4
|
-
static getDate(): Date {
|
|
5
|
-
if (this.date === undefined) {
|
|
6
|
-
this.date = new Date();
|
|
7
|
-
}
|
|
8
|
-
return this.date;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export class MockLogs {
|
|
2
|
-
oldConsoleError;
|
|
3
|
-
oldConsoleLog;
|
|
4
|
-
logs: any[] = [];
|
|
5
|
-
errors: any[] = [];
|
|
6
|
-
|
|
7
|
-
mock() {
|
|
8
|
-
this.oldConsoleLog = console.log;
|
|
9
|
-
this.oldConsoleError = console.error;
|
|
10
|
-
|
|
11
|
-
console.log = (...any) => {
|
|
12
|
-
this.logs.push(...any);
|
|
13
|
-
};
|
|
14
|
-
console.error = (...any) => {
|
|
15
|
-
this.errors.push(...any);
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
restore() {
|
|
20
|
-
console.log = this.oldConsoleLog;
|
|
21
|
-
console.error = this.oldConsoleError;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
clear() {
|
|
25
|
-
this.logs = [];
|
|
26
|
-
this.errors = [];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
logAt(idx: number) {
|
|
30
|
-
return this.logs[idx];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
verifyNoErrors() {
|
|
34
|
-
if (this.errors.length !== 0) {
|
|
35
|
-
console.debug(this.errors);
|
|
36
|
-
}
|
|
37
|
-
expect(this.errors.length).toBe(0);
|
|
38
|
-
}
|
|
39
|
-
}
|