@technicity/data-service-generator 0.19.1 → 0.21.0

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.
@@ -1445,9 +1445,12 @@ const getRelationInfo = _.memoize(async function getRelationInfo(table) {
1445
1445
  const relationsManyToOne = await getRelationsManyToOne(table);
1446
1446
  const relationsOneToMany = await getRelationsOneToMany(table);
1447
1447
  let out = [];
1448
- out = out.concat(relationsManyToOne.map((x) => {
1448
+ out = out.concat(relationsManyToOne.reduce((acc, x) => {
1449
+ if (!x.foreignKey.endsWith("Id")) {
1450
+ return acc;
1451
+ }
1449
1452
  const name = getRelationManyToOneFieldName(x);
1450
- return {
1453
+ acc.push({
1451
1454
  type: "one-to-many__many-to-one",
1452
1455
  kind: "many-to-one",
1453
1456
  grabMany: false,
@@ -1455,10 +1458,14 @@ const getRelationInfo = _.memoize(async function getRelationInfo(table) {
1455
1458
  name,
1456
1459
  relation: x,
1457
1460
  nullable: x.nullable
1458
- };
1459
- }));
1461
+ });
1462
+ return acc;
1463
+ }, []));
1460
1464
  const relationsOneToManyDuplicates = (0, getDuplicates_1.getDuplicates)(relationsOneToMany.map((x) => x.referencedTable));
1461
- out = out.concat(relationsOneToMany.map((x) => {
1465
+ out = out.concat(relationsOneToMany.reduce((acc, x) => {
1466
+ if (!x.referencedKey.endsWith("Id")) {
1467
+ return acc;
1468
+ }
1462
1469
  let name = changeCase.camelCase(x.referencedTable) + "List";
1463
1470
  if (relationsOneToManyDuplicates.includes(x.referencedTable)) {
1464
1471
  // Examples:
@@ -1470,7 +1477,7 @@ const getRelationInfo = _.memoize(async function getRelationInfo(table) {
1470
1477
  changeCase.pascalCase(x.referencedKey.replace(new RegExp(x.foreignKey + "$", "i"), "")) +
1471
1478
  "List";
1472
1479
  }
1473
- return {
1480
+ acc.push({
1474
1481
  type: "one-to-many__many-to-one",
1475
1482
  kind: "one-to-many",
1476
1483
  grabMany: true,
@@ -1478,8 +1485,9 @@ const getRelationInfo = _.memoize(async function getRelationInfo(table) {
1478
1485
  name,
1479
1486
  relation: x,
1480
1487
  nullable: x.nullable
1481
- };
1482
- }));
1488
+ });
1489
+ return acc;
1490
+ }, []));
1483
1491
  const relationsManyToMany = (await getJunctionTables()).reduce((acc, x) => {
1484
1492
  const dataForParentTable = x.relations.find((r) => r.referencedTable === table);
1485
1493
  if (dataForParentTable == null) {
@@ -13,7 +13,7 @@ export declare class RuntimeSQLite implements IRuntime {
13
13
  supplementClientOpts?: ISupplementClientOpts;
14
14
  }, artifacts: IArtifacts);
15
15
  resolve(input: TResolveParams): Promise<any>;
16
- $queryRaw(sql: string, values?: any[]): Promise<any[] | {
16
+ $queryRaw(sql: string, values?: any[]): Promise<unknown[] | {
17
17
  insertId: number | bigint;
18
18
  }>;
19
19
  $use(middleware: TMiddleware): Promise<void>;
@@ -25,7 +25,7 @@ export declare class RuntimeSQLite implements IRuntime {
25
25
  }): Promise<{
26
26
  commit: () => Promise<void>;
27
27
  rollback: () => Promise<void>;
28
- dbCall: (q: string) => Promise<any[] | {
28
+ dbCall: (q: string) => Promise<unknown[] | {
29
29
  insertId: number | bigint;
30
30
  }>;
31
31
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@technicity/data-service-generator",
3
- "version": "0.19.1",
3
+ "version": "0.21.0",
4
4
  "main": "./dist/index.js",
5
5
  "files": [
6
6
  "dist"
@@ -13,8 +13,8 @@
13
13
  "test:unit": "jest ./src"
14
14
  },
15
15
  "dependencies": {
16
- "@types/better-sqlite3": "^7.6.3",
17
- "better-sqlite3": "^8.1.0",
16
+ "@types/better-sqlite3": "^7.6.12",
17
+ "better-sqlite3": "^11.9.1",
18
18
  "change-case": "^4.1.1",
19
19
  "fs-extra": "10.0.0",
20
20
  "graphql": "15.8.0",
@@ -34,6 +34,7 @@
34
34
  "@jest/globals": "^29.4.3",
35
35
  "@swc/core": "^1.3.36",
36
36
  "@swc/jest": "^0.2.24",
37
+ "@testcontainers/mysql": "^10.23.0",
37
38
  "@types/fs-extra": "9.0.13",
38
39
  "@types/lodash": "4.14.177",
39
40
  "@types/node": "^18.14.1",
@@ -42,7 +43,10 @@
42
43
  "@types/uuid": "^8.3.1",
43
44
  "jest": "^29.4.3",
44
45
  "sinon": "12.0.1",
45
- "testcontainers": "^9.1.3",
46
+ "testcontainers": "^10.23.0",
46
47
  "typescript": "5.5.2"
48
+ },
49
+ "resolutions": {
50
+ "tar-fs": "2.1.2"
47
51
  }
48
52
  }