@snowtop/ent 0.1.0-alpha160-test5 → 0.1.0-alpha160-test7
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/package.json +64 -0
- package/package.json +52 -7
- package/src/action/action.ts +330 -0
- package/src/action/executor.ts +453 -0
- package/src/action/experimental_action.ts +277 -0
- package/src/action/index.ts +31 -0
- package/src/action/operations.ts +967 -0
- package/src/action/orchestrator.ts +1527 -0
- package/src/action/privacy.ts +37 -0
- package/src/action/relative_value.ts +242 -0
- package/src/action/transaction.ts +38 -0
- package/src/auth/auth.ts +77 -0
- package/src/auth/index.ts +8 -0
- package/src/core/base.ts +367 -0
- package/src/core/clause.ts +1065 -0
- package/src/core/config.ts +219 -0
- package/src/core/const.ts +5 -0
- package/src/core/context.ts +135 -0
- package/src/core/convert.ts +106 -0
- package/src/core/date.ts +23 -0
- package/src/core/db.ts +498 -0
- package/src/core/ent.ts +1740 -0
- package/src/core/global_schema.ts +49 -0
- package/src/core/loaders/assoc_count_loader.ts +99 -0
- package/src/core/loaders/assoc_edge_loader.ts +250 -0
- package/src/core/loaders/index.ts +12 -0
- package/src/core/loaders/loader.ts +66 -0
- package/src/core/loaders/object_loader.ts +489 -0
- package/src/core/loaders/query_loader.ts +314 -0
- package/src/core/loaders/raw_count_loader.ts +175 -0
- package/src/core/logger.ts +49 -0
- package/src/core/privacy.ts +660 -0
- package/src/core/query/assoc_query.ts +240 -0
- package/src/core/query/custom_clause_query.ts +174 -0
- package/src/core/query/custom_query.ts +302 -0
- package/src/core/query/index.ts +9 -0
- package/src/core/query/query.ts +674 -0
- package/src/core/query_impl.ts +32 -0
- package/src/core/viewer.ts +52 -0
- package/src/ent.code-workspace +73 -0
- package/src/graphql/builtins/connection.ts +25 -0
- package/src/graphql/builtins/edge.ts +16 -0
- package/src/graphql/builtins/node.ts +12 -0
- package/src/graphql/graphql.ts +891 -0
- package/src/graphql/graphql_field_helpers.ts +221 -0
- package/src/graphql/index.ts +42 -0
- package/src/graphql/mutations/union.ts +39 -0
- package/src/graphql/node_resolver.ts +122 -0
- package/src/graphql/query/connection_type.ts +113 -0
- package/src/graphql/query/edge_connection.ts +171 -0
- package/src/graphql/query/page_info.ts +34 -0
- package/src/graphql/query/shared_edge_connection.ts +287 -0
- package/src/graphql/scalars/orderby_direction.ts +13 -0
- package/src/graphql/scalars/time.ts +38 -0
- package/src/imports/dataz/example1/_auth.ts +51 -0
- package/src/imports/dataz/example1/_viewer.ts +35 -0
- package/src/imports/index.ts +213 -0
- package/src/index.ts +145 -0
- package/src/parse_schema/parse.ts +585 -0
- package/src/schema/base_schema.ts +224 -0
- package/src/schema/field.ts +1087 -0
- package/src/schema/index.ts +53 -0
- package/src/schema/json_field.ts +94 -0
- package/src/schema/schema.ts +1028 -0
- package/src/schema/struct_field.ts +234 -0
- package/src/schema/union_field.ts +105 -0
- package/src/scripts/custom_compiler.ts +331 -0
- package/src/scripts/custom_graphql.ts +550 -0
- package/src/scripts/migrate_v0.1.ts +41 -0
- package/src/scripts/move_types.ts +131 -0
- package/src/scripts/read_schema.ts +67 -0
- package/src/setupPackage.js +42 -0
- package/src/testutils/action/complex_schemas.ts +517 -0
- package/src/testutils/builder.ts +422 -0
- package/src/testutils/context/test_context.ts +25 -0
- package/src/testutils/db/fixture.ts +32 -0
- package/src/testutils/db/temp_db.ts +941 -0
- package/src/testutils/db/value.ts +294 -0
- package/src/testutils/db_mock.ts +351 -0
- package/src/testutils/db_time_zone.ts +40 -0
- package/src/testutils/ent-graphql-tests/index.ts +653 -0
- package/src/testutils/fake_comms.ts +50 -0
- package/src/testutils/fake_data/const.ts +64 -0
- package/src/testutils/fake_data/events_query.ts +145 -0
- package/src/testutils/fake_data/fake_contact.ts +150 -0
- package/src/testutils/fake_data/fake_event.ts +150 -0
- package/src/testutils/fake_data/fake_tag.ts +139 -0
- package/src/testutils/fake_data/fake_user.ts +232 -0
- package/src/testutils/fake_data/index.ts +1 -0
- package/src/testutils/fake_data/internal.ts +8 -0
- package/src/testutils/fake_data/tag_query.ts +56 -0
- package/src/testutils/fake_data/test_helpers.ts +388 -0
- package/src/testutils/fake_data/user_query.ts +524 -0
- package/src/testutils/fake_log.ts +52 -0
- package/src/testutils/mock_date.ts +10 -0
- package/src/testutils/mock_log.ts +39 -0
- package/src/testutils/parse_sql.ts +685 -0
- package/src/testutils/test_edge_global_schema.ts +49 -0
- package/src/testutils/write.ts +70 -0
- package/src/tsc/ast.ts +351 -0
- package/src/tsc/compilerOptions.ts +85 -0
- package/src/tsc/move_generated.ts +191 -0
- package/src/tsc/transform.ts +226 -0
- package/src/tsc/transform_action.ts +224 -0
- package/src/tsc/transform_ent.ts +66 -0
- package/src/tsc/transform_schema.ts +546 -0
- package/tsconfig.json +20 -0
- package/core/query/shared_assoc_test.d.ts +0 -2
- package/core/query/shared_assoc_test.js +0 -804
- package/core/query/shared_test.d.ts +0 -21
- package/core/query/shared_test.js +0 -736
- package/graphql/query/shared_assoc_test.d.ts +0 -1
- package/graphql/query/shared_assoc_test.js +0 -203
- /package/{action → dist/action}/action.d.ts +0 -0
- /package/{action → dist/action}/action.js +0 -0
- /package/{action → dist/action}/executor.d.ts +0 -0
- /package/{action → dist/action}/executor.js +0 -0
- /package/{action → dist/action}/experimental_action.d.ts +0 -0
- /package/{action → dist/action}/experimental_action.js +0 -0
- /package/{action → dist/action}/index.d.ts +0 -0
- /package/{action → dist/action}/index.js +0 -0
- /package/{action → dist/action}/operations.d.ts +0 -0
- /package/{action → dist/action}/operations.js +0 -0
- /package/{action → dist/action}/orchestrator.d.ts +0 -0
- /package/{action → dist/action}/orchestrator.js +0 -0
- /package/{action → dist/action}/privacy.d.ts +0 -0
- /package/{action → dist/action}/privacy.js +0 -0
- /package/{action → dist/action}/relative_value.d.ts +0 -0
- /package/{action → dist/action}/relative_value.js +0 -0
- /package/{action → dist/action}/transaction.d.ts +0 -0
- /package/{action → dist/action}/transaction.js +0 -0
- /package/{auth → dist/auth}/auth.d.ts +0 -0
- /package/{auth → dist/auth}/auth.js +0 -0
- /package/{auth → dist/auth}/index.d.ts +0 -0
- /package/{auth → dist/auth}/index.js +0 -0
- /package/{core → dist/core}/base.d.ts +0 -0
- /package/{core → dist/core}/base.js +0 -0
- /package/{core → dist/core}/clause.d.ts +0 -0
- /package/{core → dist/core}/clause.js +0 -0
- /package/{core → dist/core}/config.d.ts +0 -0
- /package/{core → dist/core}/config.js +0 -0
- /package/{core → dist/core}/const.d.ts +0 -0
- /package/{core → dist/core}/const.js +0 -0
- /package/{core → dist/core}/context.d.ts +0 -0
- /package/{core → dist/core}/context.js +0 -0
- /package/{core → dist/core}/convert.d.ts +0 -0
- /package/{core → dist/core}/convert.js +0 -0
- /package/{core → dist/core}/date.d.ts +0 -0
- /package/{core → dist/core}/date.js +0 -0
- /package/{core → dist/core}/db.d.ts +0 -0
- /package/{core → dist/core}/db.js +0 -0
- /package/{core → dist/core}/ent.d.ts +0 -0
- /package/{core → dist/core}/ent.js +0 -0
- /package/{core → dist/core}/global_schema.d.ts +0 -0
- /package/{core → dist/core}/global_schema.js +0 -0
- /package/{core → dist/core}/loaders/assoc_count_loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/assoc_count_loader.js +0 -0
- /package/{core → dist/core}/loaders/assoc_edge_loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/assoc_edge_loader.js +0 -0
- /package/{core → dist/core}/loaders/index.d.ts +0 -0
- /package/{core → dist/core}/loaders/index.js +0 -0
- /package/{core → dist/core}/loaders/loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/loader.js +0 -0
- /package/{core → dist/core}/loaders/object_loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/object_loader.js +0 -0
- /package/{core → dist/core}/loaders/query_loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/query_loader.js +0 -0
- /package/{core → dist/core}/loaders/raw_count_loader.d.ts +0 -0
- /package/{core → dist/core}/loaders/raw_count_loader.js +0 -0
- /package/{core → dist/core}/logger.d.ts +0 -0
- /package/{core → dist/core}/logger.js +0 -0
- /package/{core → dist/core}/privacy.d.ts +0 -0
- /package/{core → dist/core}/privacy.js +0 -0
- /package/{core → dist/core}/query/assoc_query.d.ts +0 -0
- /package/{core → dist/core}/query/assoc_query.js +0 -0
- /package/{core → dist/core}/query/custom_clause_query.d.ts +0 -0
- /package/{core → dist/core}/query/custom_clause_query.js +0 -0
- /package/{core → dist/core}/query/custom_query.d.ts +0 -0
- /package/{core → dist/core}/query/custom_query.js +0 -0
- /package/{core → dist/core}/query/index.d.ts +0 -0
- /package/{core → dist/core}/query/index.js +0 -0
- /package/{core → dist/core}/query/query.d.ts +0 -0
- /package/{core → dist/core}/query/query.js +0 -0
- /package/{core → dist/core}/query_impl.d.ts +0 -0
- /package/{core → dist/core}/query_impl.js +0 -0
- /package/{core → dist/core}/viewer.d.ts +0 -0
- /package/{core → dist/core}/viewer.js +0 -0
- /package/{graphql → dist/graphql}/builtins/connection.d.ts +0 -0
- /package/{graphql → dist/graphql}/builtins/connection.js +0 -0
- /package/{graphql → dist/graphql}/builtins/edge.d.ts +0 -0
- /package/{graphql → dist/graphql}/builtins/edge.js +0 -0
- /package/{graphql → dist/graphql}/builtins/node.d.ts +0 -0
- /package/{graphql → dist/graphql}/builtins/node.js +0 -0
- /package/{graphql → dist/graphql}/graphql.d.ts +0 -0
- /package/{graphql → dist/graphql}/graphql.js +0 -0
- /package/{graphql → dist/graphql}/graphql_field_helpers.d.ts +0 -0
- /package/{graphql → dist/graphql}/graphql_field_helpers.js +0 -0
- /package/{graphql → dist/graphql}/index.d.ts +0 -0
- /package/{graphql → dist/graphql}/index.js +0 -0
- /package/{graphql → dist/graphql}/mutations/union.d.ts +0 -0
- /package/{graphql → dist/graphql}/mutations/union.js +0 -0
- /package/{graphql → dist/graphql}/node_resolver.d.ts +0 -0
- /package/{graphql → dist/graphql}/node_resolver.js +0 -0
- /package/{graphql → dist/graphql}/query/connection_type.d.ts +0 -0
- /package/{graphql → dist/graphql}/query/connection_type.js +0 -0
- /package/{graphql → dist/graphql}/query/edge_connection.d.ts +0 -0
- /package/{graphql → dist/graphql}/query/edge_connection.js +0 -0
- /package/{graphql → dist/graphql}/query/page_info.d.ts +0 -0
- /package/{graphql → dist/graphql}/query/page_info.js +0 -0
- /package/{graphql → dist/graphql}/query/shared_edge_connection.d.ts +0 -0
- /package/{graphql → dist/graphql}/query/shared_edge_connection.js +0 -0
- /package/{graphql → dist/graphql}/scalars/orderby_direction.d.ts +0 -0
- /package/{graphql → dist/graphql}/scalars/orderby_direction.js +0 -0
- /package/{graphql → dist/graphql}/scalars/time.d.ts +0 -0
- /package/{graphql → dist/graphql}/scalars/time.js +0 -0
- /package/{imports → dist/imports}/dataz/example1/_auth.d.ts +0 -0
- /package/{imports → dist/imports}/dataz/example1/_auth.js +0 -0
- /package/{imports → dist/imports}/dataz/example1/_viewer.d.ts +0 -0
- /package/{imports → dist/imports}/dataz/example1/_viewer.js +0 -0
- /package/{imports → dist/imports}/index.d.ts +0 -0
- /package/{imports → dist/imports}/index.js +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{parse_schema → dist/parse_schema}/parse.d.ts +0 -0
- /package/{parse_schema → dist/parse_schema}/parse.js +0 -0
- /package/{schema → dist/schema}/base_schema.d.ts +0 -0
- /package/{schema → dist/schema}/base_schema.js +0 -0
- /package/{schema → dist/schema}/field.d.ts +0 -0
- /package/{schema → dist/schema}/field.js +0 -0
- /package/{schema → dist/schema}/index.d.ts +0 -0
- /package/{schema → dist/schema}/index.js +0 -0
- /package/{schema → dist/schema}/json_field.d.ts +0 -0
- /package/{schema → dist/schema}/json_field.js +0 -0
- /package/{schema → dist/schema}/schema.d.ts +0 -0
- /package/{schema → dist/schema}/schema.js +0 -0
- /package/{schema → dist/schema}/struct_field.d.ts +0 -0
- /package/{schema → dist/schema}/struct_field.js +0 -0
- /package/{schema → dist/schema}/union_field.d.ts +0 -0
- /package/{schema → dist/schema}/union_field.js +0 -0
- /package/{scripts → dist/scripts}/custom_compiler.d.ts +0 -0
- /package/{scripts → dist/scripts}/custom_compiler.js +0 -0
- /package/{scripts → dist/scripts}/custom_graphql.d.ts +0 -0
- /package/{scripts → dist/scripts}/custom_graphql.js +0 -0
- /package/{scripts → dist/scripts}/migrate_v0.1.d.ts +0 -0
- /package/{scripts → dist/scripts}/migrate_v0.1.js +0 -0
- /package/{scripts → dist/scripts}/move_types.d.ts +0 -0
- /package/{scripts → dist/scripts}/move_types.js +0 -0
- /package/{scripts → dist/scripts}/read_schema.d.ts +0 -0
- /package/{scripts → dist/scripts}/read_schema.js +0 -0
- /package/{testutils → dist/testutils}/action/complex_schemas.d.ts +0 -0
- /package/{testutils → dist/testutils}/action/complex_schemas.js +0 -0
- /package/{testutils → dist/testutils}/builder.d.ts +0 -0
- /package/{testutils → dist/testutils}/builder.js +0 -0
- /package/{testutils → dist/testutils}/context/test_context.d.ts +0 -0
- /package/{testutils → dist/testutils}/context/test_context.js +0 -0
- /package/{testutils → dist/testutils}/db/fixture.d.ts +0 -0
- /package/{testutils → dist/testutils}/db/fixture.js +0 -0
- /package/{testutils → dist/testutils}/db/temp_db.d.ts +0 -0
- /package/{testutils → dist/testutils}/db/temp_db.js +0 -0
- /package/{testutils → dist/testutils}/db/value.d.ts +0 -0
- /package/{testutils → dist/testutils}/db/value.js +0 -0
- /package/{testutils → dist/testutils}/db_mock.d.ts +0 -0
- /package/{testutils → dist/testutils}/db_mock.js +0 -0
- /package/{testutils → dist/testutils}/db_time_zone.d.ts +0 -0
- /package/{testutils → dist/testutils}/db_time_zone.js +0 -0
- /package/{testutils → dist/testutils}/ent-graphql-tests/index.d.ts +0 -0
- /package/{testutils → dist/testutils}/ent-graphql-tests/index.js +0 -0
- /package/{testutils → dist/testutils}/fake_comms.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_comms.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/const.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/const.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/events_query.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/events_query.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_contact.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_contact.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_event.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_event.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_tag.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_tag.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_user.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/fake_user.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/index.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/index.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/internal.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/internal.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/tag_query.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/tag_query.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/test_helpers.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/test_helpers.js +0 -0
- /package/{testutils → dist/testutils}/fake_data/user_query.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_data/user_query.js +0 -0
- /package/{testutils → dist/testutils}/fake_log.d.ts +0 -0
- /package/{testutils → dist/testutils}/fake_log.js +0 -0
- /package/{testutils → dist/testutils}/mock_date.d.ts +0 -0
- /package/{testutils → dist/testutils}/mock_date.js +0 -0
- /package/{testutils → dist/testutils}/mock_log.d.ts +0 -0
- /package/{testutils → dist/testutils}/mock_log.js +0 -0
- /package/{testutils → dist/testutils}/parse_sql.d.ts +0 -0
- /package/{testutils → dist/testutils}/parse_sql.js +0 -0
- /package/{testutils → dist/testutils}/test_edge_global_schema.d.ts +0 -0
- /package/{testutils → dist/testutils}/test_edge_global_schema.js +0 -0
- /package/{testutils → dist/testutils}/write.d.ts +0 -0
- /package/{testutils → dist/testutils}/write.js +0 -0
- /package/{tsc → dist/tsc}/ast.d.ts +0 -0
- /package/{tsc → dist/tsc}/ast.js +0 -0
- /package/{tsc → dist/tsc}/compilerOptions.d.ts +0 -0
- /package/{tsc → dist/tsc}/compilerOptions.js +0 -0
- /package/{tsc → dist/tsc}/move_generated.d.ts +0 -0
- /package/{tsc → dist/tsc}/move_generated.js +0 -0
- /package/{tsc → dist/tsc}/transform.d.ts +0 -0
- /package/{tsc → dist/tsc}/transform.js +0 -0
- /package/{tsc → dist/tsc}/transform_action.d.ts +0 -0
- /package/{tsc → dist/tsc}/transform_action.js +0 -0
- /package/{tsc → dist/tsc}/transform_ent.d.ts +0 -0
- /package/{tsc → dist/tsc}/transform_ent.js +0 -0
- /package/{tsc → dist/tsc}/transform_schema.d.ts +0 -0
- /package/{tsc → dist/tsc}/transform_schema.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function sharedAssocTests(): void;
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sharedAssocTests = void 0;
|
|
4
|
-
const viewer_1 = require("../../core/viewer");
|
|
5
|
-
const jest_date_mock_1 = require("jest-date-mock");
|
|
6
|
-
const edge_connection_1 = require("./edge_connection");
|
|
7
|
-
const connection_type_1 = require("./connection_type");
|
|
8
|
-
const graphql_1 = require("graphql");
|
|
9
|
-
const node_1 = require("../builtins/node");
|
|
10
|
-
const ent_graphql_tests_1 = require("../../testutils/ent-graphql-tests");
|
|
11
|
-
const index_1 = require("../../testutils/fake_data/index");
|
|
12
|
-
const test_helpers_1 = require("../../testutils/fake_data/test_helpers");
|
|
13
|
-
function sharedAssocTests() {
|
|
14
|
-
// pretty sure this works for custom ents but need tests for this eventually
|
|
15
|
-
describe("not all ents visible", () => {
|
|
16
|
-
let user;
|
|
17
|
-
let event;
|
|
18
|
-
let users;
|
|
19
|
-
let conn;
|
|
20
|
-
let friendCount;
|
|
21
|
-
// let's make it big. 20 people
|
|
22
|
-
let friendsInput = [...test_helpers_1.inputs, ...test_helpers_1.inputs, ...test_helpers_1.inputs, ...test_helpers_1.inputs];
|
|
23
|
-
beforeEach(async () => {
|
|
24
|
-
friendCount = 0;
|
|
25
|
-
user = await (0, test_helpers_1.createTestUser)();
|
|
26
|
-
event = await (0, test_helpers_1.createTestEvent)(user);
|
|
27
|
-
let promises = [];
|
|
28
|
-
for (let i = 0; i < friendsInput.length; i++) {
|
|
29
|
-
(0, jest_date_mock_1.advanceBy)(100);
|
|
30
|
-
let input = friendsInput[i];
|
|
31
|
-
const builder = (0, index_1.getUserBuilder)(user.viewer, (0, test_helpers_1.getUserInput)(input));
|
|
32
|
-
if (i % 2 == 1) {
|
|
33
|
-
builder.orchestrator.addOutboundEdge(user.id, index_1.EdgeType.UserToFriends, "User");
|
|
34
|
-
friendCount++;
|
|
35
|
-
}
|
|
36
|
-
// invite user to events
|
|
37
|
-
builder.orchestrator.addInboundEdge(event.id, index_1.EdgeType.EventToInvited, "User", {
|
|
38
|
-
// just to make times deterministic so that tests can consistently work
|
|
39
|
-
time: new Date(),
|
|
40
|
-
});
|
|
41
|
-
promises.push((async function () {
|
|
42
|
-
await builder.saveX();
|
|
43
|
-
return builder.editedEntX();
|
|
44
|
-
})());
|
|
45
|
-
}
|
|
46
|
-
users = await Promise.all(promises);
|
|
47
|
-
// only few of the users invited as friends
|
|
48
|
-
const vc = new viewer_1.IDViewer(user.id);
|
|
49
|
-
const friendsEdge = await index_1.UserToFriendsQuery.query(vc, user.id).queryEdges();
|
|
50
|
-
expect(friendsEdge.length).toBe(friendCount);
|
|
51
|
-
// everyone invited to event
|
|
52
|
-
const invitedEventsEdges = await index_1.EventToInvitedQuery.query(vc, event.id).queryEdges();
|
|
53
|
-
expect(invitedEventsEdges.length).toBe(friendsInput.length);
|
|
54
|
-
resetConn();
|
|
55
|
-
});
|
|
56
|
-
function resetConn() {
|
|
57
|
-
conn = new edge_connection_1.GraphQLEdgeConnection(new viewer_1.IDViewer(user.id), event, (v, event) => new index_1.EventToInvitedQuery(v, event));
|
|
58
|
-
}
|
|
59
|
-
test("totalCount", async () => {
|
|
60
|
-
const count = await conn.queryTotalCount();
|
|
61
|
-
expect(count).toBe(users.length);
|
|
62
|
-
});
|
|
63
|
-
test("nodes", async () => {
|
|
64
|
-
const nodes = await conn.queryNodes();
|
|
65
|
-
expect(nodes.length).toBe(friendCount);
|
|
66
|
-
});
|
|
67
|
-
test("edges", async () => {
|
|
68
|
-
const edges = await conn.queryEdges();
|
|
69
|
-
expect(edges.length).toBe(friendCount);
|
|
70
|
-
});
|
|
71
|
-
test("pagination", async () => {
|
|
72
|
-
const edges = await index_1.EventToInvitedQuery.query(new viewer_1.LoggedOutViewer(), event).queryEdges();
|
|
73
|
-
async function verify(first, length, hasNextpage, index) {
|
|
74
|
-
let cursor;
|
|
75
|
-
if (index) {
|
|
76
|
-
cursor = edges[index].getCursor();
|
|
77
|
-
}
|
|
78
|
-
resetConn();
|
|
79
|
-
conn.first(first, cursor);
|
|
80
|
-
const [pagination, gqlEdges, nodes] = await Promise.all([
|
|
81
|
-
conn.queryPageInfo(),
|
|
82
|
-
conn.queryEdges(),
|
|
83
|
-
conn.queryNodes(),
|
|
84
|
-
]);
|
|
85
|
-
expect(pagination.hasNextPage, `${index}`).toBe(hasNextpage);
|
|
86
|
-
expect(pagination.hasPreviousPage, `${index}`).toBe(false);
|
|
87
|
-
expect(gqlEdges.length, `${index}`).toBe(length);
|
|
88
|
-
expect(nodes.length, `${index}`).toBe(length);
|
|
89
|
-
// TODO: not equal even though we're querying only one because the cursors are not privacy-aware
|
|
90
|
-
// TODO: fix
|
|
91
|
-
}
|
|
92
|
-
// TODO build exponential backoff into EntQuery so this isn't needed
|
|
93
|
-
// but this is how it is for now
|
|
94
|
-
await verify(1, 1, true);
|
|
95
|
-
await verify(2, 1, true);
|
|
96
|
-
await verify(2, 1, true, 0);
|
|
97
|
-
await verify(2, 1, true, 2);
|
|
98
|
-
await verify(2, 1, true, 4);
|
|
99
|
-
await verify(2, 1, true, 6);
|
|
100
|
-
await verify(2, 1, true, 8);
|
|
101
|
-
await verify(2, 1, true, 10);
|
|
102
|
-
await verify(2, 1, true, 12);
|
|
103
|
-
await verify(2, 1, true, 14);
|
|
104
|
-
await verify(2, 1, true, 16);
|
|
105
|
-
await verify(2, 1, false, 17);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
test("custom edge fields", async () => {
|
|
109
|
-
let userType = new graphql_1.GraphQLObjectType({
|
|
110
|
-
name: "User",
|
|
111
|
-
fields: {
|
|
112
|
-
id: {
|
|
113
|
-
type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLID),
|
|
114
|
-
},
|
|
115
|
-
firstName: {
|
|
116
|
-
type: graphql_1.GraphQLString,
|
|
117
|
-
},
|
|
118
|
-
lastName: {
|
|
119
|
-
type: graphql_1.GraphQLString,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
interfaces: [node_1.GraphQLNodeInterface],
|
|
123
|
-
isTypeOf(obj, _context) {
|
|
124
|
-
return obj instanceof index_1.FakeUser;
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
let eventType = new graphql_1.GraphQLObjectType({
|
|
128
|
-
name: "Event",
|
|
129
|
-
fields: {
|
|
130
|
-
id: {
|
|
131
|
-
type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLID),
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
interfaces: [node_1.GraphQLNodeInterface],
|
|
135
|
-
isTypeOf(obj, _context) {
|
|
136
|
-
return obj instanceof index_1.FakeEvent;
|
|
137
|
-
},
|
|
138
|
-
});
|
|
139
|
-
const conn = new connection_type_1.GraphQLConnectionType("CustomEdge", eventType);
|
|
140
|
-
const length = (m) => {
|
|
141
|
-
let count = 0;
|
|
142
|
-
for (let _ in m) {
|
|
143
|
-
count++;
|
|
144
|
-
}
|
|
145
|
-
return count;
|
|
146
|
-
};
|
|
147
|
-
const fields = conn.edgeType.getFields();
|
|
148
|
-
// default.
|
|
149
|
-
expect(length(fields)).toBe(2);
|
|
150
|
-
expect(fields["node"]).toBeDefined();
|
|
151
|
-
expect(fields["cursor"]).toBeDefined();
|
|
152
|
-
const conn2 = new connection_type_1.GraphQLConnectionType("CustomEdge", eventType, {
|
|
153
|
-
fields: () => ({
|
|
154
|
-
bar: {
|
|
155
|
-
type: graphql_1.GraphQLString,
|
|
156
|
-
resolve() {
|
|
157
|
-
return "customEdgeData";
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
}),
|
|
161
|
-
});
|
|
162
|
-
const fields2 = conn2.edgeType.getFields();
|
|
163
|
-
expect(length(fields2)).toBe(3);
|
|
164
|
-
expect(fields2["bar"]).toBeDefined();
|
|
165
|
-
expect(fields2["node"]).toBeDefined();
|
|
166
|
-
expect(fields2["cursor"]).toBeDefined();
|
|
167
|
-
const user = await (0, test_helpers_1.createTestUser)();
|
|
168
|
-
const event = await (0, test_helpers_1.createTestEvent)(user);
|
|
169
|
-
let rootQuery = new graphql_1.GraphQLObjectType({
|
|
170
|
-
name: "RootQueryType",
|
|
171
|
-
fields: {
|
|
172
|
-
conn: {
|
|
173
|
-
type: conn2,
|
|
174
|
-
async resolve(_source, { id }, context) {
|
|
175
|
-
return new edge_connection_1.GraphQLEdgeConnection(new viewer_1.IDViewer(user.id), user, (v, event) => new index_1.UserToHostedEventsQuery(v, event));
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
let schema = new graphql_1.GraphQLSchema({
|
|
181
|
-
query: rootQuery,
|
|
182
|
-
types: [userType, eventType],
|
|
183
|
-
});
|
|
184
|
-
let cfg = {
|
|
185
|
-
schema: schema,
|
|
186
|
-
root: "conn",
|
|
187
|
-
viewer: new viewer_1.IDViewer(user.id),
|
|
188
|
-
args: {},
|
|
189
|
-
};
|
|
190
|
-
await (0, ent_graphql_tests_1.expectQueryFromRoot)(cfg, [
|
|
191
|
-
"edges",
|
|
192
|
-
[
|
|
193
|
-
{
|
|
194
|
-
node: {
|
|
195
|
-
id: event.id,
|
|
196
|
-
},
|
|
197
|
-
bar: "customEdgeData",
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
]);
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
exports.sharedAssocTests = sharedAssocTests;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|