@snowtop/ent 0.2.0-alpha.6.test2 → 0.2.0-alpha.8
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/core/clause.d.ts +44 -0
- package/core/clause.js +75 -2
- package/core/db.d.ts +1 -1
- package/core/db.js +2 -2
- package/core/ent.d.ts +10 -2
- package/core/ent.js +11 -18
- package/core/loaders/assoc_edge_loader.d.ts +1 -1
- package/core/loaders/assoc_edge_loader.js +3 -3
- package/core/query/assoc_query.d.ts +2 -2
- package/core/query/assoc_query.js +14 -2
- package/core/query/custom_clause_query.d.ts +8 -6
- package/core/query/custom_clause_query.js +22 -7
- package/core/query/custom_query.d.ts +2 -2
- package/core/query/custom_query.js +1 -1
- package/core/query/query.d.ts +3 -7
- package/core/query/query.js +73 -199
- package/core/query/shared_test.d.ts +3 -3
- package/core/query/shared_test.js +31 -23
- package/core/query_impl.d.ts +0 -1
- package/graphql/query/edge_connection.d.ts +5 -4
- package/graphql/query/edge_connection.js +34 -14
- package/graphql/query/shared_edge_connection.d.ts +2 -2
- package/graphql/query/shared_edge_connection.js +26 -13
- package/package.json +1 -1
- package/testutils/db_mock.d.ts +1 -1
- package/testutils/db_mock.js +1 -1
- package/testutils/ent-graphql-tests/index.d.ts +1 -1
- package/testutils/ent-graphql-tests/index.js +5 -5
- package/testutils/fake_data/user_query.d.ts +5 -5
- package/testutils/fake_data/user_query.js +11 -14
- package/tsc/compilerOptions.js +1 -4
|
@@ -1,23 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GraphQLEdgeConnection = void 0;
|
|
4
|
+
const query_1 = require("../../core/query");
|
|
4
5
|
// TODO probably need to template Ent. maybe 2 ents?
|
|
5
6
|
class GraphQLEdgeConnection {
|
|
6
7
|
constructor(viewer, arg2, arg3, args) {
|
|
7
8
|
this.results = [];
|
|
8
9
|
this.viewer = viewer;
|
|
10
|
+
async function resolveQuery(query, source) {
|
|
11
|
+
const resolved = await query;
|
|
12
|
+
// To have pagination correctly work with CustomClauseQuery in GraphQL contexts, we need to
|
|
13
|
+
// pass the source to the query so that we can set the page info correctly
|
|
14
|
+
// See https://github.com/lolopinto/ent/issues/1836 for full details of how this breaks down
|
|
15
|
+
if (resolved instanceof query_1.CustomClauseQuery && source !== undefined) {
|
|
16
|
+
resolved.__maybeSetSource(source);
|
|
17
|
+
}
|
|
18
|
+
return resolved;
|
|
19
|
+
}
|
|
20
|
+
let query;
|
|
21
|
+
let source;
|
|
9
22
|
if (typeof arg2 === "function") {
|
|
10
|
-
|
|
23
|
+
query = arg2(this.viewer);
|
|
11
24
|
}
|
|
12
25
|
else {
|
|
13
26
|
this.source = arg2;
|
|
27
|
+
source = arg2;
|
|
14
28
|
}
|
|
15
29
|
if (typeof arg3 === "function") {
|
|
16
|
-
|
|
30
|
+
query = arg3(this.viewer, this.source);
|
|
17
31
|
}
|
|
18
32
|
else {
|
|
19
33
|
this.args = arg3;
|
|
20
34
|
}
|
|
35
|
+
this.query = Promise.resolve(resolveQuery(query, source));
|
|
21
36
|
if (args !== undefined) {
|
|
22
37
|
this.args = args;
|
|
23
38
|
}
|
|
@@ -29,27 +44,31 @@ class GraphQLEdgeConnection {
|
|
|
29
44
|
throw new Error("cannot process before without last");
|
|
30
45
|
}
|
|
31
46
|
if (this.args.first) {
|
|
32
|
-
|
|
47
|
+
const argFirst = this.args.first;
|
|
48
|
+
const argAfter = this.args.after;
|
|
49
|
+
this.query = this.query.then((query) => query.first(argFirst, argAfter));
|
|
33
50
|
}
|
|
34
51
|
if (this.args.last) {
|
|
35
|
-
|
|
52
|
+
const argLast = this.args.last;
|
|
53
|
+
const argBefore = this.args.before;
|
|
54
|
+
this.query = this.query.then((query) => query.last(argLast, argBefore));
|
|
36
55
|
}
|
|
37
56
|
// TODO custom args
|
|
38
57
|
// how to proceed
|
|
39
58
|
}
|
|
40
59
|
}
|
|
41
60
|
first(limit, cursor) {
|
|
42
|
-
this.query = this.query.first(limit, cursor);
|
|
61
|
+
this.query = this.query.then((query) => query.first(limit, cursor));
|
|
43
62
|
}
|
|
44
63
|
last(limit, cursor) {
|
|
45
|
-
this.query = this.query.last(limit, cursor);
|
|
64
|
+
this.query = this.query.then((query) => query.last(limit, cursor));
|
|
46
65
|
}
|
|
47
66
|
// any custom filters can be applied here...
|
|
48
67
|
modifyQuery(fn) {
|
|
49
|
-
this.query =
|
|
68
|
+
this.query = this.query.then((query) => fn(query));
|
|
50
69
|
}
|
|
51
70
|
async queryTotalCount() {
|
|
52
|
-
return this.query.queryRawCount();
|
|
71
|
+
return (await this.query).queryRawCount();
|
|
53
72
|
}
|
|
54
73
|
async queryEdges() {
|
|
55
74
|
// because of privacy, we need to query the node regardless of if the node is there
|
|
@@ -60,7 +79,7 @@ class GraphQLEdgeConnection {
|
|
|
60
79
|
// if nodes queried just return ents
|
|
61
80
|
// unlikely to query nodes and pageInfo so we just load this separately for now
|
|
62
81
|
async queryNodes() {
|
|
63
|
-
return this.query.queryEnts();
|
|
82
|
+
return (await this.query).queryEnts();
|
|
64
83
|
}
|
|
65
84
|
defaultPageInfo() {
|
|
66
85
|
return {
|
|
@@ -72,7 +91,7 @@ class GraphQLEdgeConnection {
|
|
|
72
91
|
}
|
|
73
92
|
async queryPageInfo() {
|
|
74
93
|
await this.queryData();
|
|
75
|
-
const paginationInfo = this.query.paginationInfo();
|
|
94
|
+
const paginationInfo = (await this.query).paginationInfo();
|
|
76
95
|
if (this.source !== undefined) {
|
|
77
96
|
return paginationInfo.get(this.source.id) || this.defaultPageInfo();
|
|
78
97
|
}
|
|
@@ -85,24 +104,25 @@ class GraphQLEdgeConnection {
|
|
|
85
104
|
return this.defaultPageInfo();
|
|
86
105
|
}
|
|
87
106
|
async queryData() {
|
|
107
|
+
const query = await this.query;
|
|
88
108
|
const [edges, ents] = await Promise.all([
|
|
89
109
|
// TODO need a test that this will only fetch edges once
|
|
90
110
|
// and then fetch ents afterward
|
|
91
|
-
|
|
92
|
-
|
|
111
|
+
query.queryEdges(),
|
|
112
|
+
query.queryEnts(),
|
|
93
113
|
]);
|
|
94
114
|
let entsMap = new Map();
|
|
95
115
|
ents.forEach((ent) => entsMap.set(ent.id, ent));
|
|
96
116
|
let results = [];
|
|
97
117
|
for (const edge of edges) {
|
|
98
|
-
const node = entsMap.get(
|
|
118
|
+
const node = entsMap.get(query.dataToID(edge));
|
|
99
119
|
if (!node) {
|
|
100
120
|
continue;
|
|
101
121
|
}
|
|
102
122
|
results.push({
|
|
103
123
|
edge,
|
|
104
124
|
node,
|
|
105
|
-
cursor:
|
|
125
|
+
cursor: query.getCursor(edge),
|
|
106
126
|
});
|
|
107
127
|
}
|
|
108
128
|
this.results = results;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FakeContact } from "../../testutils/fake_data/index";
|
|
1
|
+
import { Data, Ent, Viewer } from "../../core/base";
|
|
3
2
|
import { EdgeQuery } from "../../core/query/query";
|
|
3
|
+
import { FakeContact } from "../../testutils/fake_data/index";
|
|
4
4
|
interface options<TEnt extends Ent, TEdge extends Data> {
|
|
5
5
|
getQuery: (v: Viewer, src: Ent) => EdgeQuery<TEnt, Ent, TEdge>;
|
|
6
6
|
tableName: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.commonTests = void 0;
|
|
4
|
-
const
|
|
4
|
+
const query_1 = require("../../core/query");
|
|
5
5
|
const ent_1 = require("../../core/ent");
|
|
6
|
-
const
|
|
6
|
+
const viewer_1 = require("../../core/viewer");
|
|
7
7
|
const index_1 = require("../../testutils/fake_data/index");
|
|
8
8
|
const test_helpers_1 = require("../../testutils/fake_data/test_helpers");
|
|
9
|
+
const edge_connection_1 = require("./edge_connection");
|
|
9
10
|
class TestConnection {
|
|
10
11
|
constructor(getQuery, ents, filter) {
|
|
11
12
|
this.getQuery = getQuery;
|
|
@@ -18,10 +19,20 @@ class TestConnection {
|
|
|
18
19
|
this.allContacts = this.allContacts.reverse();
|
|
19
20
|
this.conn = new edge_connection_1.GraphQLEdgeConnection(new viewer_1.IDViewer(this.user.id), this.user, (v, user) => this.getQuery(v, user));
|
|
20
21
|
if (this.filter) {
|
|
21
|
-
this.filter(this.conn, this.user, this.allContacts);
|
|
22
|
+
await this.filter(this.conn, this.user, this.allContacts);
|
|
22
23
|
}
|
|
23
24
|
this.filteredContacts = this.ents(this.allContacts);
|
|
24
25
|
}
|
|
26
|
+
async testAsyncConn() {
|
|
27
|
+
const asyncConn = new edge_connection_1.GraphQLEdgeConnection(new viewer_1.IDViewer(this.user.id), this.user, (v, user) => new Promise((resolve) => {
|
|
28
|
+
setTimeout(() => resolve(this.getQuery(v, user)), 0);
|
|
29
|
+
}));
|
|
30
|
+
if (this.filter) {
|
|
31
|
+
await this.filter(asyncConn, this.user, this.allContacts);
|
|
32
|
+
}
|
|
33
|
+
const count = await asyncConn.queryTotalCount();
|
|
34
|
+
expect(count).toBe(test_helpers_1.inputs.length);
|
|
35
|
+
}
|
|
25
36
|
async testTotalCount() {
|
|
26
37
|
const count = await this.conn.queryTotalCount();
|
|
27
38
|
expect(count).toBe(test_helpers_1.inputs.length);
|
|
@@ -39,7 +50,7 @@ class TestConnection {
|
|
|
39
50
|
for (let i = 0; i < this.filteredContacts.length; i++) {
|
|
40
51
|
const edge = edges[i];
|
|
41
52
|
expect(edge.node.id).toBe(this.filteredContacts[i].id);
|
|
42
|
-
expect(this.conn.query.dataToID(edge.edge)).toBe(this.filteredContacts[i].id);
|
|
53
|
+
expect((await this.conn.query).dataToID(edge.edge)).toBe(this.filteredContacts[i].id);
|
|
43
54
|
}
|
|
44
55
|
}
|
|
45
56
|
}
|
|
@@ -50,14 +61,16 @@ const commonTests = (opts) => {
|
|
|
50
61
|
q instanceof index_1.UserToContactsFkeyQueryDeprecated ||
|
|
51
62
|
q instanceof index_1.UserToContactsFkeyQueryAsc ||
|
|
52
63
|
q instanceof index_1.UserToContactsFkeyQueryDeletedAt ||
|
|
53
|
-
q instanceof index_1.UserToContactsFkeyQueryDeletedAtAsc
|
|
64
|
+
q instanceof index_1.UserToContactsFkeyQueryDeletedAtAsc ||
|
|
65
|
+
q instanceof query_1.CustomClauseQuery);
|
|
54
66
|
}
|
|
55
67
|
function getCursorFrom(q, contacts, idx) {
|
|
56
68
|
let opts;
|
|
57
69
|
if (isCustomQuery(q)) {
|
|
58
70
|
opts = {
|
|
59
71
|
row: contacts[idx],
|
|
60
|
-
|
|
72
|
+
cursorKeys: ["created_at", "id"],
|
|
73
|
+
rowKeys: ["createdAt", "id"],
|
|
61
74
|
};
|
|
62
75
|
}
|
|
63
76
|
else {
|
|
@@ -65,8 +78,8 @@ const commonTests = (opts) => {
|
|
|
65
78
|
// is from assoc_edge table id2 field and so cursor takes it from there
|
|
66
79
|
opts = {
|
|
67
80
|
row: contacts[idx],
|
|
68
|
-
|
|
69
|
-
|
|
81
|
+
cursorKeys: ["time", "id2"],
|
|
82
|
+
rowKeys: ["createdAt", "id"],
|
|
70
83
|
};
|
|
71
84
|
}
|
|
72
85
|
return (0, ent_1.getCursor)(opts);
|
|
@@ -92,7 +105,7 @@ const commonTests = (opts) => {
|
|
|
92
105
|
});
|
|
93
106
|
});
|
|
94
107
|
describe("filters. firstN", () => {
|
|
95
|
-
const filter = new TestConnection((v, user) => opts.getQuery(v, user), (contacts) => contacts.slice(0, 2), (conn) => {
|
|
108
|
+
const filter = new TestConnection((v, user) => opts.getQuery(v, user), (contacts) => contacts.slice(0, 2), async (conn) => {
|
|
96
109
|
conn.first(2);
|
|
97
110
|
});
|
|
98
111
|
beforeEach(async () => {
|
|
@@ -124,8 +137,8 @@ const commonTests = (opts) => {
|
|
|
124
137
|
const N = 3;
|
|
125
138
|
const filter = new TestConnection((v, user) => opts.getQuery(v, user),
|
|
126
139
|
// get the next 2
|
|
127
|
-
(contacts) => contacts.slice(idx + 1, idx + N), (conn, user, contacts) => {
|
|
128
|
-
const cursor = getCursorFrom(conn.query, contacts, idx);
|
|
140
|
+
(contacts) => contacts.slice(idx + 1, idx + N), async (conn, user, contacts) => {
|
|
141
|
+
const cursor = getCursorFrom(await conn.query, contacts, idx);
|
|
129
142
|
conn.first(2, cursor);
|
|
130
143
|
});
|
|
131
144
|
beforeEach(async () => {
|
|
@@ -153,9 +166,9 @@ const commonTests = (opts) => {
|
|
|
153
166
|
});
|
|
154
167
|
});
|
|
155
168
|
describe("filters. before cursor", () => {
|
|
156
|
-
const filter = new TestConnection((v, user) => opts.getQuery(v, user), (contacts) => contacts.slice(2, 4).reverse(), (conn, user, contacts) => {
|
|
169
|
+
const filter = new TestConnection((v, user) => opts.getQuery(v, user), (contacts) => contacts.slice(2, 4).reverse(), async (conn, user, contacts) => {
|
|
157
170
|
// get the 2 before it
|
|
158
|
-
const cursor = getCursorFrom(conn.query, contacts, 4);
|
|
171
|
+
const cursor = getCursorFrom(await conn.query, contacts, 4);
|
|
159
172
|
conn.last(2, cursor);
|
|
160
173
|
});
|
|
161
174
|
beforeEach(async () => {
|
package/package.json
CHANGED
package/testutils/db_mock.d.ts
CHANGED
package/testutils/db_mock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QueryRecorder = exports.queryType = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
4
|
const jest_mock_1 = require("jest-mock");
|
|
5
|
+
const uuid_1 = require("uuid");
|
|
6
6
|
const parse_sql_1 = require("./parse_sql");
|
|
7
7
|
const eventEmitter = {
|
|
8
8
|
on: jest.fn(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Express, RequestHandler } from "express";
|
|
2
|
-
import { Viewer } from "../../core/base";
|
|
3
2
|
import { GraphQLSchema } from "graphql";
|
|
4
3
|
import supertest from "supertest";
|
|
4
|
+
import { Viewer } from "../../core/base";
|
|
5
5
|
export type Option = [string, any] | [string, any, string];
|
|
6
6
|
interface queryConfig {
|
|
7
7
|
viewer?: Viewer;
|
|
@@ -30,12 +30,12 @@ exports.expectMutation = exports.expectQueryFromRoot = void 0;
|
|
|
30
30
|
// NB: this is copied from ent-graphql-tests package until I have time to figure out how to share code here effectively
|
|
31
31
|
// the circular dependencies btw this package and ent-graphql-tests seems to imply something needs to change
|
|
32
32
|
const express_1 = __importDefault(require("express"));
|
|
33
|
-
const
|
|
33
|
+
const fs = __importStar(require("fs"));
|
|
34
34
|
const graphql_1 = require("graphql");
|
|
35
|
-
const
|
|
35
|
+
const graphql_helix_1 = require("graphql-helix");
|
|
36
36
|
const supertest_1 = __importDefault(require("supertest"));
|
|
37
|
-
const fs = __importStar(require("fs"));
|
|
38
37
|
const util_1 = require("util");
|
|
38
|
+
const auth_1 = require("../../auth");
|
|
39
39
|
function server(config) {
|
|
40
40
|
const viewer = config.viewer;
|
|
41
41
|
if (viewer) {
|
|
@@ -125,7 +125,7 @@ function makeGraphQLRequest(config, query, fieldArgs) {
|
|
|
125
125
|
if (files.size) {
|
|
126
126
|
let ret = test
|
|
127
127
|
.post(config.graphQLPath || "/graphql")
|
|
128
|
-
.set(config.headers || {});
|
|
128
|
+
.set((config.headers || {}));
|
|
129
129
|
ret.field("operations", JSON.stringify({
|
|
130
130
|
query: query,
|
|
131
131
|
variables: variables,
|
|
@@ -152,7 +152,7 @@ function makeGraphQLRequest(config, query, fieldArgs) {
|
|
|
152
152
|
test,
|
|
153
153
|
test
|
|
154
154
|
.post(config.graphQLPath || "/graphql")
|
|
155
|
-
.set(config.headers || {})
|
|
155
|
+
.set((config.headers || {}))
|
|
156
156
|
.send({
|
|
157
157
|
query: query,
|
|
158
158
|
variables: JSON.stringify(variables),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Data, Ent, ID, Viewer } from "../../core/base";
|
|
2
|
-
import { CustomEdgeQueryBase } from "../../core/query/custom_query";
|
|
3
|
-
import { AssocEdge } from "../../core/ent";
|
|
4
2
|
import * as clause from "../../core/clause";
|
|
5
|
-
import {
|
|
6
|
-
import { FakeUser, FakeEvent, FakeContact, EventToAttendeesQuery, EventToDeclinedQuery, EventToHostsQuery, EventToInvitedQuery, EventToMaybeQuery } from "./internal";
|
|
7
|
-
import { RawCountLoaderFactory } from "../../core/loaders/raw_count_loader";
|
|
3
|
+
import { AssocEdge } from "../../core/ent";
|
|
8
4
|
import { QueryLoaderFactory } from "../../core/loaders/query_loader";
|
|
5
|
+
import { RawCountLoaderFactory } from "../../core/loaders/raw_count_loader";
|
|
6
|
+
import { AssocEdgeQueryBase, EdgeQuerySource } from "../../core/query/assoc_query";
|
|
7
|
+
import { CustomEdgeQueryBase } from "../../core/query/custom_query";
|
|
8
|
+
import { EventToAttendeesQuery, EventToDeclinedQuery, EventToHostsQuery, EventToInvitedQuery, EventToMaybeQuery, FakeContact, FakeEvent, FakeUser } from "./internal";
|
|
9
9
|
export declare class UserToContactsQuery extends AssocEdgeQueryBase<FakeUser, FakeContact, AssocEdge> {
|
|
10
10
|
constructor(viewer: Viewer, src: EdgeQuerySource<FakeUser>);
|
|
11
11
|
static query(viewer: Viewer, src: EdgeQuerySource<FakeUser>): UserToContactsQuery;
|
|
@@ -24,21 +24,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.UserToFollowingQuery = exports.UserToEventsInNextWeekQuery = exports.getCompleteClause = exports.getNextWeekClause = exports.UserToHostedEventsQuery = exports.UserToEventsAttendingQuery = exports.UserToIncomingFriendRequestsQuery = exports.UserToFriendRequestsQuery = exports.UserToCustomEdgeQuery = exports.CustomEdge = exports.UserToFriendsQuery = exports.UserToContactsFkeyQueryDeletedAtAsc = exports.UserToContactsFkeyQueryAsc = exports.UserToContactsFkeyQueryDeletedAt = exports.UserToContactsFkeyQuery = exports.UserToContactsFkeyQueryDeprecated = exports.userToContactsDataLoaderFactory = exports.userToContactsCountLoaderFactory = exports.UserToContactsQuery = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
27
|
+
const jest_date_mock_1 = require("jest-date-mock");
|
|
28
|
+
const _1 = require(".");
|
|
29
29
|
const clause = __importStar(require("../../core/clause"));
|
|
30
|
-
const
|
|
31
|
-
const internal_1 = require("./internal");
|
|
32
|
-
const raw_count_loader_1 = require("../../core/loaders/raw_count_loader");
|
|
30
|
+
const ent_1 = require("../../core/ent");
|
|
33
31
|
const assoc_count_loader_1 = require("../../core/loaders/assoc_count_loader");
|
|
34
32
|
const assoc_edge_loader_1 = require("../../core/loaders/assoc_edge_loader");
|
|
35
|
-
const fake_contact_1 = require("./fake_contact");
|
|
36
|
-
const jest_date_mock_1 = require("jest-date-mock");
|
|
37
|
-
const luxon_1 = require("luxon");
|
|
38
33
|
const query_loader_1 = require("../../core/loaders/query_loader");
|
|
39
|
-
const
|
|
40
|
-
const _1 = require(".");
|
|
34
|
+
const raw_count_loader_1 = require("../../core/loaders/raw_count_loader");
|
|
41
35
|
const privacy_1 = require("../../core/privacy");
|
|
36
|
+
const assoc_query_1 = require("../../core/query/assoc_query");
|
|
37
|
+
const custom_query_1 = require("../../core/query/custom_query");
|
|
38
|
+
const mock_date_1 = require("./../mock_date");
|
|
39
|
+
const fake_contact_1 = require("./fake_contact");
|
|
40
|
+
const internal_1 = require("./internal");
|
|
42
41
|
class UserToContactsQuery extends assoc_query_1.AssocEdgeQueryBase {
|
|
43
42
|
constructor(viewer, src) {
|
|
44
43
|
super(viewer, src, new assoc_count_loader_1.AssocEdgeCountLoaderFactory(internal_1.EdgeType.UserToContacts), new assoc_edge_loader_1.AssocEdgeLoaderFactory(internal_1.EdgeType.UserToContacts, ent_1.AssocEdge), internal_1.FakeContact.loaderOptions());
|
|
@@ -351,10 +350,8 @@ const getNextWeekClause = () => {
|
|
|
351
350
|
(0, jest_date_mock_1.clear)();
|
|
352
351
|
const start = mock_date_1.MockDate.getDate();
|
|
353
352
|
// 7 days
|
|
354
|
-
const end =
|
|
355
|
-
|
|
356
|
-
.toISO();
|
|
357
|
-
return clause.And(clause.GreaterEq("start_time", start.toISOString()), clause.LessEq("start_time", end));
|
|
353
|
+
const end = new Date(start.getTime() + 86400 * 1000 * 7);
|
|
354
|
+
return clause.And(clause.GreaterEq("start_time", start.toISOString()), clause.LessEq("start_time", end.toISOString()));
|
|
358
355
|
};
|
|
359
356
|
exports.getNextWeekClause = getNextWeekClause;
|
|
360
357
|
function getCompleteClause(id) {
|
package/tsc/compilerOptions.js
CHANGED
|
@@ -60,9 +60,6 @@ function readCompilerOptions(filePath) {
|
|
|
60
60
|
if (options.moduleResolution === "node") {
|
|
61
61
|
options.moduleResolution = typescript_1.default.ModuleResolutionKind.NodeJs;
|
|
62
62
|
}
|
|
63
|
-
if (options.target) {
|
|
64
|
-
options.target = getTarget(options.target.toString());
|
|
65
|
-
}
|
|
66
63
|
return options;
|
|
67
64
|
}
|
|
68
65
|
exports.readCompilerOptions = readCompilerOptions;
|
|
@@ -95,7 +92,7 @@ function getTarget(target) {
|
|
|
95
92
|
exports.getTarget = getTarget;
|
|
96
93
|
function getTargetFromCurrentDir() {
|
|
97
94
|
const options = readCompilerOptions(".");
|
|
98
|
-
return options.target
|
|
95
|
+
return getTarget(options.target?.toString());
|
|
99
96
|
}
|
|
100
97
|
exports.getTargetFromCurrentDir = getTargetFromCurrentDir;
|
|
101
98
|
function createSourceFile(target, file) {
|