@snowtop/ent 0.2.0-alpha.10-test1 → 0.2.0-alpha.11-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/action/action.js +5 -5
- package/action/executor.d.ts +1 -1
- package/action/executor.js +4 -4
- package/action/experimental_action.js +5 -5
- package/action/orchestrator.d.ts +2 -2
- package/action/privacy.d.ts +2 -2
- package/action/relative_value.js +3 -3
- package/auth/auth.d.ts +0 -1
- package/auth/auth.js +4 -5
- package/core/base.js +5 -5
- package/core/clause.js +59 -60
- package/core/config.d.ts +0 -1
- package/core/config.js +1 -2
- package/core/context.d.ts +0 -1
- package/core/convert.d.ts +0 -1
- package/core/convert.js +16 -17
- package/core/date.js +1 -2
- package/core/ent.js +50 -51
- package/core/global_schema.js +6 -7
- package/core/loaders/assoc_count_loader.d.ts +2 -2
- package/core/loaders/assoc_edge_loader.d.ts +2 -2
- package/core/loaders/loader.js +3 -3
- package/core/loaders/object_loader.d.ts +4 -4
- package/core/loaders/query_loader.d.ts +2 -2
- package/core/loaders/raw_count_loader.d.ts +2 -2
- package/core/loaders/raw_count_loader.js +2 -2
- package/core/logger.js +6 -7
- package/core/privacy.d.ts +2 -2
- package/core/privacy.js +4 -4
- package/core/query/shared_assoc_test.js +1 -2
- package/core/query_impl.js +4 -5
- package/core/viewer.d.ts +2 -2
- package/graphql/graphql_field_helpers.js +22 -22
- package/graphql/mutations/union.js +1 -2
- package/graphql/node_resolver.js +7 -7
- package/graphql/query/shared_assoc_test.js +1 -2
- package/graphql/scalars/time.d.ts +1 -1
- package/imports/dataz/example1/_auth.js +14 -10
- package/imports/index.js +1 -2
- package/names/names.js +5 -6
- package/package.json +13 -13
- package/parse_schema/parse.js +2 -3
- package/schema/binary_field.d.ts +2 -2
- package/schema/binary_field.js +3 -3
- package/schema/field.js +28 -28
- package/schema/json_field.js +7 -7
- package/schema/schema.d.ts +0 -1
- package/schema/schema.js +12 -12
- package/schema/struct_field.js +39 -15
- package/schema/union_field.js +3 -3
- package/testutils/action/complex_schemas.js +11 -11
- package/testutils/builder.d.ts +1 -1
- package/testutils/builder.js +7 -7
- package/testutils/db/fixture.js +1 -2
- package/testutils/db/temp_db.js +37 -37
- package/testutils/db/value.js +3 -4
- package/testutils/db_mock.js +38 -6
- package/testutils/ent-graphql-tests/index.d.ts +3 -3
- package/testutils/ent-graphql-tests/index.js +10 -11
- package/testutils/fake_data/const.js +2 -2
- package/testutils/fake_data/fake_contact.js +3 -3
- package/testutils/fake_data/fake_event.js +3 -3
- package/testutils/fake_data/fake_tag.js +4 -4
- package/testutils/fake_data/fake_user.js +4 -4
- package/testutils/fake_data/test_helpers.js +17 -17
- package/testutils/fake_data/user_query.js +2 -2
- package/testutils/parse_sql.js +3 -3
- package/testutils/query.js +2 -3
- package/testutils/write.js +3 -4
- package/tsc/ast.js +10 -11
- package/tsc/compilerOptions.js +5 -9
- package/tsc/move_generated.js +1 -2
- package/tsc/transform.js +1 -2
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.inputs = void 0;
|
|
4
|
+
exports.getContactInput = getContactInput;
|
|
5
|
+
exports.getUserInput = getUserInput;
|
|
6
|
+
exports.getEventInput = getEventInput;
|
|
7
|
+
exports.createTestUser = createTestUser;
|
|
8
|
+
exports.createAllContacts = createAllContacts;
|
|
9
|
+
exports.createUserPlusFriendRequests = createUserPlusFriendRequests;
|
|
10
|
+
exports.addEdge = addEdge;
|
|
11
|
+
exports.verifyUserToContactEdges = verifyUserToContactEdges;
|
|
12
|
+
exports.verifyUserToContactRawData = verifyUserToContactRawData;
|
|
13
|
+
exports.verifyUserToContacts = verifyUserToContacts;
|
|
14
|
+
exports.createEdges = createEdges;
|
|
15
|
+
exports.edgeTableNames = edgeTableNames;
|
|
16
|
+
exports.createTestEvent = createTestEvent;
|
|
17
|
+
exports.setupTempDB = setupTempDB;
|
|
18
|
+
exports.tempDBTables = tempDBTables;
|
|
19
|
+
exports.createAllEvents = createAllEvents;
|
|
4
20
|
const jest_date_mock_1 = require("jest-date-mock");
|
|
5
21
|
const viewer_1 = require("../../core/viewer");
|
|
6
22
|
const ent_1 = require("../../core/ent");
|
|
@@ -26,7 +42,6 @@ function getContactInput(user, input) {
|
|
|
26
42
|
...input,
|
|
27
43
|
};
|
|
28
44
|
}
|
|
29
|
-
exports.getContactInput = getContactInput;
|
|
30
45
|
function getUserInput(input) {
|
|
31
46
|
return {
|
|
32
47
|
firstName: "Jon",
|
|
@@ -39,7 +54,6 @@ function getUserInput(input) {
|
|
|
39
54
|
...input,
|
|
40
55
|
};
|
|
41
56
|
}
|
|
42
|
-
exports.getUserInput = getUserInput;
|
|
43
57
|
function getEventInput(user, input) {
|
|
44
58
|
return {
|
|
45
59
|
startTime: new Date(),
|
|
@@ -52,7 +66,6 @@ function getEventInput(user, input) {
|
|
|
52
66
|
...input,
|
|
53
67
|
};
|
|
54
68
|
}
|
|
55
|
-
exports.getEventInput = getEventInput;
|
|
56
69
|
async function createTestUser(input, ctx) {
|
|
57
70
|
const user = await (0, _1.createUser)(new viewer_1.LoggedOutViewer(ctx), {
|
|
58
71
|
firstName: "Jon",
|
|
@@ -67,7 +80,6 @@ async function createTestUser(input, ctx) {
|
|
|
67
80
|
}
|
|
68
81
|
return user;
|
|
69
82
|
}
|
|
70
|
-
exports.createTestUser = createTestUser;
|
|
71
83
|
exports.inputs = [
|
|
72
84
|
{
|
|
73
85
|
firstName: "Arya",
|
|
@@ -115,7 +127,6 @@ async function createAllContacts(opts) {
|
|
|
115
127
|
expect(contacts.length).toBe(userInputs.length);
|
|
116
128
|
return [userr, contacts];
|
|
117
129
|
}
|
|
118
|
-
exports.createAllContacts = createAllContacts;
|
|
119
130
|
async function createUserPlusFriendRequests(input, slice) {
|
|
120
131
|
const user = await createTestUser(input);
|
|
121
132
|
let userInputs = exports.inputs.slice(0, slice || exports.inputs.length);
|
|
@@ -126,7 +137,6 @@ async function createUserPlusFriendRequests(input, slice) {
|
|
|
126
137
|
await addEdge(user, _1.FakeUserSchema, _1.EdgeType.UserToFriendRequests, true, ...friendRequests);
|
|
127
138
|
return [user, friendRequests];
|
|
128
139
|
}
|
|
129
|
-
exports.createUserPlusFriendRequests = createUserPlusFriendRequests;
|
|
130
140
|
async function addEdge(source, schema, edgeType, inbound, // inbound or outbound
|
|
131
141
|
...dest) {
|
|
132
142
|
const action = new builder_1.SimpleAction(source.viewer, schema, new Map(), action_1.WriteOperation.Edit, source);
|
|
@@ -147,7 +157,6 @@ async function addEdge(source, schema, edgeType, inbound, // inbound or outbound
|
|
|
147
157
|
});
|
|
148
158
|
await action.saveX();
|
|
149
159
|
}
|
|
150
|
-
exports.addEdge = addEdge;
|
|
151
160
|
function verifyUserToContactEdges(user, edges, contacts) {
|
|
152
161
|
expect(edges.length).toBe(contacts.length);
|
|
153
162
|
for (let i = 0; i < contacts.length; i++) {
|
|
@@ -164,7 +173,6 @@ function verifyUserToContactEdges(user, edges, contacts) {
|
|
|
164
173
|
expect(edge.getCursor()).not.toBe("");
|
|
165
174
|
}
|
|
166
175
|
}
|
|
167
|
-
exports.verifyUserToContactEdges = verifyUserToContactEdges;
|
|
168
176
|
function verifyUserToContactRawData(user, edges, contacts) {
|
|
169
177
|
expect(edges.length).toBe(contacts.length);
|
|
170
178
|
for (let i = 0; i < contacts.length; i++) {
|
|
@@ -174,13 +182,11 @@ function verifyUserToContactRawData(user, edges, contacts) {
|
|
|
174
182
|
expect(edge, `${i}th index`).toMatchObject(expectedEdge);
|
|
175
183
|
}
|
|
176
184
|
}
|
|
177
|
-
exports.verifyUserToContactRawData = verifyUserToContactRawData;
|
|
178
185
|
function verifyUserToContacts(user, ents, contacts) {
|
|
179
186
|
expect(ents.length).toBe(contacts.length);
|
|
180
187
|
const expectedContacts = contacts.map((contact) => contact.id);
|
|
181
188
|
expect(ents.map((contact) => contact.id)).toStrictEqual(expectedContacts);
|
|
182
189
|
}
|
|
183
|
-
exports.verifyUserToContacts = verifyUserToContacts;
|
|
184
190
|
async function createEdges() {
|
|
185
191
|
// create all edges// for now all one-way
|
|
186
192
|
const edgeNames = Object.keys(_1.EdgeType);
|
|
@@ -203,12 +209,10 @@ async function createEdges() {
|
|
|
203
209
|
expect(edgeData).toBeDefined();
|
|
204
210
|
}
|
|
205
211
|
}
|
|
206
|
-
exports.createEdges = createEdges;
|
|
207
212
|
function edgeTableNames() {
|
|
208
213
|
const edges = Object.values(_1.EdgeType);
|
|
209
214
|
return edges.map((edge) => (0, names_1.toDBColumnOrTable)(edge, "table"));
|
|
210
215
|
}
|
|
211
|
-
exports.edgeTableNames = edgeTableNames;
|
|
212
216
|
async function createTestEvent(user, input) {
|
|
213
217
|
const vc = new viewer_1.IDViewer(user.id);
|
|
214
218
|
const builder = (0, fake_event_1.getEventBuilder)(vc, {
|
|
@@ -223,7 +227,6 @@ async function createTestEvent(user, input) {
|
|
|
223
227
|
await builder.saveX();
|
|
224
228
|
return builder.editedEntX();
|
|
225
229
|
}
|
|
226
|
-
exports.createTestEvent = createTestEvent;
|
|
227
230
|
async function setupTempDB(global = false) {
|
|
228
231
|
const tdb = new temp_db_1.TempDB(db_1.Dialect.Postgres, tempDBTables(global));
|
|
229
232
|
await tdb.beforeAll();
|
|
@@ -231,7 +234,6 @@ async function setupTempDB(global = false) {
|
|
|
231
234
|
await createEdges();
|
|
232
235
|
return tdb;
|
|
233
236
|
}
|
|
234
|
-
exports.setupTempDB = setupTempDB;
|
|
235
237
|
function tempDBTables(global = false) {
|
|
236
238
|
const tables = [
|
|
237
239
|
_1.FakeUser.getTestTableWithDeletedAt(),
|
|
@@ -243,7 +245,6 @@ function tempDBTables(global = false) {
|
|
|
243
245
|
edgeTableNames().forEach((tableName) => tables.push((0, temp_db_1.assoc_edge_table)(tableName, global)));
|
|
244
246
|
return tables;
|
|
245
247
|
}
|
|
246
|
-
exports.tempDBTables = tempDBTables;
|
|
247
248
|
async function createAllEvents(opts) {
|
|
248
249
|
const user = await createTestUser(opts.userInput);
|
|
249
250
|
let arr = new Array(opts.howMany);
|
|
@@ -263,4 +264,3 @@ async function createAllEvents(opts) {
|
|
|
263
264
|
expect(events.length).toBe(opts.howMany);
|
|
264
265
|
return [user, events];
|
|
265
266
|
}
|
|
266
|
-
exports.createAllEvents = createAllEvents;
|
|
@@ -23,7 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.UserToFollowingQuery = exports.UserToEventsInNextWeekQuery = exports.
|
|
26
|
+
exports.UserToFollowingQuery = exports.UserToEventsInNextWeekQuery = 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
|
+
exports.getCompleteClause = getCompleteClause;
|
|
27
28
|
const jest_date_mock_1 = require("jest-date-mock");
|
|
28
29
|
const _1 = require(".");
|
|
29
30
|
const clause = __importStar(require("../../core/clause"));
|
|
@@ -357,7 +358,6 @@ exports.getNextWeekClause = getNextWeekClause;
|
|
|
357
358
|
function getCompleteClause(id) {
|
|
358
359
|
return clause.And(clause.Eq("user_id", id), (0, exports.getNextWeekClause)());
|
|
359
360
|
}
|
|
360
|
-
exports.getCompleteClause = getCompleteClause;
|
|
361
361
|
class UserToEventsInNextWeekQuery extends custom_query_1.CustomEdgeQueryBase {
|
|
362
362
|
constructor(viewer, src) {
|
|
363
363
|
super(viewer, {
|
package/testutils/parse_sql.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OrOp = exports.AndOp = exports.InOp = exports.LessEqOp = exports.GreaterEqOp = exports.LessOp = exports.GreaterOp = exports.NotEqOp = exports.EqOp = void 0;
|
|
4
|
+
exports.getDataToReturn = getDataToReturn;
|
|
5
|
+
exports.performQuery = performQuery;
|
|
4
6
|
const node_sql_parser_1 = require("node-sql-parser");
|
|
5
7
|
function getTableName(table) {
|
|
6
8
|
if (Array.isArray(table)) {
|
|
@@ -120,7 +122,6 @@ function getDataToReturn(data, colNames, returningAll) {
|
|
|
120
122
|
}
|
|
121
123
|
return ret;
|
|
122
124
|
}
|
|
123
|
-
exports.getDataToReturn = getDataToReturn;
|
|
124
125
|
function processBeforeStoring(val) {
|
|
125
126
|
if (typeof val !== "string") {
|
|
126
127
|
return val;
|
|
@@ -577,4 +578,3 @@ function performQuery(query, values, map) {
|
|
|
577
578
|
parseDeleteStatement(ast, values, map);
|
|
578
579
|
}
|
|
579
580
|
}
|
|
580
|
-
exports.performQuery = performQuery;
|
package/testutils/query.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getVerifyAfterEachCursorGeneric = getVerifyAfterEachCursorGeneric;
|
|
4
|
+
exports.getWhereClause = getWhereClause;
|
|
4
5
|
function getVerifyAfterEachCursorGeneric(edges, pageLength, user, getQuery, ml, verifyQuery) {
|
|
5
6
|
let query;
|
|
6
7
|
async function verify(i, hasEdge, hasNextPage, cursor) {
|
|
@@ -34,7 +35,6 @@ function getVerifyAfterEachCursorGeneric(edges, pageLength, user, getQuery, ml,
|
|
|
34
35
|
}
|
|
35
36
|
return { verify, getCursor };
|
|
36
37
|
}
|
|
37
|
-
exports.getVerifyAfterEachCursorGeneric = getVerifyAfterEachCursorGeneric;
|
|
38
38
|
function getWhereClause(query) {
|
|
39
39
|
const idx = query.query.indexOf("WHERE");
|
|
40
40
|
if (idx !== -1) {
|
|
@@ -42,4 +42,3 @@ function getWhereClause(query) {
|
|
|
42
42
|
}
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
|
-
exports.getWhereClause = getWhereClause;
|
package/testutils/write.js
CHANGED
|
@@ -23,7 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.createRowForTest = createRowForTest;
|
|
27
|
+
exports.editRowForTest = editRowForTest;
|
|
28
|
+
exports.deleteRowsForTest = deleteRowsForTest;
|
|
27
29
|
const ent_1 = require("../core/ent");
|
|
28
30
|
const db_1 = __importStar(require("../core/db"));
|
|
29
31
|
function isSyncClient(client) {
|
|
@@ -47,7 +49,6 @@ async function createRowForTest(options, suffix) {
|
|
|
47
49
|
client.release();
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
|
-
exports.createRowForTest = createRowForTest;
|
|
51
52
|
async function editRowForTest(options, suffix) {
|
|
52
53
|
const client = await db_1.default.getInstance().getNewClient();
|
|
53
54
|
try {
|
|
@@ -60,7 +61,6 @@ async function editRowForTest(options, suffix) {
|
|
|
60
61
|
client.release();
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
exports.editRowForTest = editRowForTest;
|
|
64
64
|
async function deleteRowsForTest(options, cls) {
|
|
65
65
|
const client = await db_1.default.getInstance().getNewClient();
|
|
66
66
|
try {
|
|
@@ -73,4 +73,3 @@ async function deleteRowsForTest(options, cls) {
|
|
|
73
73
|
client.release();
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
exports.deleteRowsForTest = deleteRowsForTest;
|
package/tsc/ast.js
CHANGED
|
@@ -26,7 +26,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.getPreText = getPreText;
|
|
30
|
+
exports.getClassInfo = getClassInfo;
|
|
31
|
+
exports.transformImport = transformImport;
|
|
32
|
+
exports.updateImportPath = updateImportPath;
|
|
33
|
+
exports.isRelativeImport = isRelativeImport;
|
|
34
|
+
exports.isRelativeGeneratedImport = isRelativeGeneratedImport;
|
|
35
|
+
exports.isSrcGeneratedImport = isSrcGeneratedImport;
|
|
36
|
+
exports.getImportInfo = getImportInfo;
|
|
37
|
+
exports.transformRelative = transformRelative;
|
|
38
|
+
exports.getCustomInfo = getCustomInfo;
|
|
30
39
|
const typescript_1 = __importDefault(require("typescript"));
|
|
31
40
|
const path = __importStar(require("path"));
|
|
32
41
|
const js_yaml_1 = require("js-yaml");
|
|
@@ -35,7 +44,6 @@ const const_1 = require("../core/const");
|
|
|
35
44
|
function getPreText(fileContents, node, sourceFile) {
|
|
36
45
|
return fileContents.substring(node.getFullStart(), node.getStart(sourceFile));
|
|
37
46
|
}
|
|
38
|
-
exports.getPreText = getPreText;
|
|
39
47
|
function getClassInfo(fileContents, sourceFile, node, override) {
|
|
40
48
|
let className = node.name?.text;
|
|
41
49
|
let classExtends;
|
|
@@ -108,7 +116,6 @@ function getClassInfo(fileContents, sourceFile, node, override) {
|
|
|
108
116
|
default: hasDefault,
|
|
109
117
|
};
|
|
110
118
|
}
|
|
111
|
-
exports.getClassInfo = getClassInfo;
|
|
112
119
|
function transformImport(fileContents, importNode, sourceFile, opts) {
|
|
113
120
|
// remove quotes too
|
|
114
121
|
const text = importNode.moduleSpecifier.getText(sourceFile).slice(1, -1);
|
|
@@ -163,7 +170,6 @@ function transformImport(fileContents, importNode, sourceFile, opts) {
|
|
|
163
170
|
text +
|
|
164
171
|
'";');
|
|
165
172
|
}
|
|
166
|
-
exports.transformImport = transformImport;
|
|
167
173
|
function updateImportPath(fileContents, importNode, sourceFile, newPath) {
|
|
168
174
|
const comment = getPreText(fileContents, importNode, sourceFile);
|
|
169
175
|
// all this copied from above...
|
|
@@ -186,23 +192,19 @@ function updateImportPath(fileContents, importNode, sourceFile, newPath) {
|
|
|
186
192
|
newPath +
|
|
187
193
|
'";');
|
|
188
194
|
}
|
|
189
|
-
exports.updateImportPath = updateImportPath;
|
|
190
195
|
function isRelativeImport(node, sourceFile) {
|
|
191
196
|
const text = node.moduleSpecifier.getText(sourceFile).slice(1, -1);
|
|
192
197
|
return text.startsWith("..") || text.startsWith("./");
|
|
193
198
|
}
|
|
194
|
-
exports.isRelativeImport = isRelativeImport;
|
|
195
199
|
function isRelativeGeneratedImport(node, sourceFile) {
|
|
196
200
|
const text = node.moduleSpecifier.getText(sourceFile).slice(1, -1);
|
|
197
201
|
return ((text.startsWith("..") || text.startsWith("./")) &&
|
|
198
202
|
text.indexOf("/generated") !== -1);
|
|
199
203
|
}
|
|
200
|
-
exports.isRelativeGeneratedImport = isRelativeGeneratedImport;
|
|
201
204
|
function isSrcGeneratedImport(node, sourceFile) {
|
|
202
205
|
const text = node.moduleSpecifier.getText(sourceFile).slice(1, -1);
|
|
203
206
|
return text.startsWith("src") && text.includes("/generated");
|
|
204
207
|
}
|
|
205
|
-
exports.isSrcGeneratedImport = isSrcGeneratedImport;
|
|
206
208
|
// TODO doesn't support default + {} yet
|
|
207
209
|
function getImportInfo(imp, sourceFile) {
|
|
208
210
|
const importText = imp.importClause?.getText(sourceFile) || "";
|
|
@@ -232,7 +234,6 @@ function getImportInfo(imp, sourceFile) {
|
|
|
232
234
|
default: def,
|
|
233
235
|
};
|
|
234
236
|
}
|
|
235
|
-
exports.getImportInfo = getImportInfo;
|
|
236
237
|
function transformRelative(file, importPath, relative) {
|
|
237
238
|
if (!relative || !importPath.startsWith("src")) {
|
|
238
239
|
return importPath;
|
|
@@ -242,7 +243,6 @@ function transformRelative(file, importPath, relative) {
|
|
|
242
243
|
// relative path is from directory
|
|
243
244
|
return normalizePath(path.relative(path.dirname(fileFullPath), impFullPath));
|
|
244
245
|
}
|
|
245
|
-
exports.transformRelative = transformRelative;
|
|
246
246
|
function normalizePath(p) {
|
|
247
247
|
if (p.endsWith("..")) {
|
|
248
248
|
return p + "/";
|
|
@@ -279,4 +279,3 @@ function getCustomInfo() {
|
|
|
279
279
|
globalSchemaPath: yaml.globalSchemaPath,
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
|
-
exports.getCustomInfo = getCustomInfo;
|
package/tsc/compilerOptions.js
CHANGED
|
@@ -26,7 +26,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.readCompilerOptions = readCompilerOptions;
|
|
30
|
+
exports.getTarget = getTarget;
|
|
31
|
+
exports.getTargetFromCurrentDir = getTargetFromCurrentDir;
|
|
32
|
+
exports.createSourceFile = createSourceFile;
|
|
30
33
|
const fs = __importStar(require("fs"));
|
|
31
34
|
const json5_1 = __importDefault(require("json5"));
|
|
32
35
|
const typescript_1 = __importDefault(require("typescript"));
|
|
@@ -60,12 +63,8 @@ function readCompilerOptions(filePath) {
|
|
|
60
63
|
if (options.moduleResolution === "node") {
|
|
61
64
|
options.moduleResolution = typescript_1.default.ModuleResolutionKind.NodeJs;
|
|
62
65
|
}
|
|
63
|
-
if (options.target) {
|
|
64
|
-
options.target = getTarget(options.target.toString());
|
|
65
|
-
}
|
|
66
66
|
return options;
|
|
67
67
|
}
|
|
68
|
-
exports.readCompilerOptions = readCompilerOptions;
|
|
69
68
|
function getTarget(target) {
|
|
70
69
|
switch (target?.toLowerCase()) {
|
|
71
70
|
case "es2015":
|
|
@@ -92,16 +91,13 @@ function getTarget(target) {
|
|
|
92
91
|
return typescript_1.default.ScriptTarget.ESNext;
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
|
-
exports.getTarget = getTarget;
|
|
96
94
|
function getTargetFromCurrentDir() {
|
|
97
95
|
const options = readCompilerOptions(".");
|
|
98
|
-
return options.target
|
|
96
|
+
return getTarget(options.target?.toString());
|
|
99
97
|
}
|
|
100
|
-
exports.getTargetFromCurrentDir = getTargetFromCurrentDir;
|
|
101
98
|
function createSourceFile(target, file) {
|
|
102
99
|
let contents = fs.readFileSync(file).toString();
|
|
103
100
|
// go through the file and print everything back if not starting immediately after other position
|
|
104
101
|
const sourceFile = typescript_1.default.createSourceFile(file, contents, target, false, typescript_1.default.ScriptKind.TS);
|
|
105
102
|
return { contents, sourceFile };
|
|
106
103
|
}
|
|
107
|
-
exports.createSourceFile = createSourceFile;
|
package/tsc/move_generated.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.moveGenerated =
|
|
29
|
+
exports.moveGenerated = moveGenerated;
|
|
30
30
|
const glob = __importStar(require("glob"));
|
|
31
31
|
const path = __importStar(require("path"));
|
|
32
32
|
const fs = __importStar(require("fs"));
|
|
@@ -161,4 +161,3 @@ function moveGenerated(relativeImports) {
|
|
|
161
161
|
(0, transform_1.transform)(new TransformImports("src/ent/**/*.ts", "src/ent/**/*.ts", relativeImports));
|
|
162
162
|
(0, transform_1.transform)(new TransformImports("src/graphql/**/*.ts", "src/graphql/**/*.ts", relativeImports, true));
|
|
163
163
|
}
|
|
164
|
-
exports.moveGenerated = moveGenerated;
|
package/tsc/transform.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.transform =
|
|
29
|
+
exports.transform = transform;
|
|
30
30
|
const glob = __importStar(require("glob"));
|
|
31
31
|
const typescript_1 = __importDefault(require("typescript"));
|
|
32
32
|
const child_process_1 = require("child_process");
|
|
@@ -171,7 +171,6 @@ function transform(transform) {
|
|
|
171
171
|
(0, child_process_1.spawnSync)(`prettier`, [transform.prettierGlob, "--write"]);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
exports.transform = transform;
|
|
175
174
|
function isRequireStatement(node, sourceFile) {
|
|
176
175
|
if (node.kind !== typescript_1.default.SyntaxKind.VariableStatement) {
|
|
177
176
|
return false;
|