@loomcore/api 0.1.97 → 0.1.99

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.
Files changed (37) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +77 -77
  3. package/dist/__tests__/common-test.utils.js +3 -5
  4. package/dist/__tests__/postgres-test-migrations/postgres-test-schema.js +266 -266
  5. package/dist/__tests__/postgres.test-database.js +8 -8
  6. package/dist/databases/migrations/migration-runner.js +21 -21
  7. package/dist/databases/mongo-db/utils/convert-operations-to-pipeline.util.js +65 -473
  8. package/dist/databases/operations/index.d.ts +3 -4
  9. package/dist/databases/operations/index.js +3 -4
  10. package/dist/databases/operations/{join.operation.d.ts → inner-join.operation.d.ts} +1 -1
  11. package/dist/databases/operations/{join.operation.js → inner-join.operation.js} +2 -2
  12. package/dist/databases/operations/left-join-many.operation.d.ts +7 -0
  13. package/dist/databases/operations/left-join-many.operation.js +15 -0
  14. package/dist/databases/operations/{join-many.operation.d.ts → left-join.operation.d.ts} +1 -1
  15. package/dist/databases/operations/{join-many.operation.js → left-join.operation.js} +2 -2
  16. package/dist/databases/operations/operation.d.ts +4 -5
  17. package/dist/databases/postgres/commands/postgres-batch-update.command.js +11 -12
  18. package/dist/databases/postgres/commands/postgres-create-many.command.js +4 -4
  19. package/dist/databases/postgres/commands/postgres-create.command.js +4 -4
  20. package/dist/databases/postgres/commands/postgres-full-update-by-id.command.js +14 -14
  21. package/dist/databases/postgres/commands/postgres-partial-update-by-id.command.js +8 -8
  22. package/dist/databases/postgres/commands/postgres-update.command.js +8 -8
  23. package/dist/databases/postgres/migrations/postgres-initial-schema.js +224 -224
  24. package/dist/databases/postgres/postgres.database.js +17 -17
  25. package/dist/databases/postgres/queries/postgres-get-all.query.js +4 -5
  26. package/dist/databases/postgres/queries/postgres-get-by-id.query.js +4 -5
  27. package/dist/databases/postgres/queries/postgres-get.query.js +4 -5
  28. package/dist/databases/postgres/utils/build-join-clauses.d.ts +1 -1
  29. package/dist/databases/postgres/utils/build-join-clauses.js +26 -360
  30. package/dist/databases/postgres/utils/build-select-clause.js +15 -27
  31. package/dist/databases/postgres/utils/does-table-exist.util.js +4 -4
  32. package/dist/databases/postgres/utils/transform-join-results.js +19 -120
  33. package/package.json +92 -92
  34. package/dist/databases/operations/join-through-many.operation.d.ts +0 -10
  35. package/dist/databases/operations/join-through-many.operation.js +0 -21
  36. package/dist/databases/operations/join-through.operation.d.ts +0 -10
  37. package/dist/databases/operations/join-through.operation.js +0 -21
@@ -1,7 +1,6 @@
1
- import { Join } from '../../operations/join.operation.js';
2
- import { JoinMany } from '../../operations/join-many.operation.js';
3
- import { JoinThrough } from '../../operations/join-through.operation.js';
4
- import { JoinThroughMany } from '../../operations/join-through-many.operation.js';
1
+ import { LeftJoin } from '../../operations/left-join.operation.js';
2
+ import { InnerJoin } from '../../operations/inner-join.operation.js';
3
+ import { LeftJoinMany } from '../../operations/left-join-many.operation.js';
5
4
  function findNestedObject(obj, alias, path = []) {
6
5
  if (obj[alias] !== undefined && obj[alias] !== null) {
7
6
  return { obj: obj[alias], path: [...path, alias] };
@@ -45,7 +44,7 @@ function findEnrichmentTarget(operation, operations) {
45
44
  return null;
46
45
  }
47
46
  const [alias] = operation.localField.split('.');
48
- const target = operations.find(op => (op instanceof JoinMany || op instanceof JoinThroughMany) && op.as === alias);
47
+ const target = operations.find(op => op instanceof LeftJoinMany && op.as === alias);
49
48
  if (target && operations.indexOf(target) < operations.indexOf(operation)) {
50
49
  return target;
51
50
  }
@@ -58,24 +57,20 @@ function mapEnrichmentFieldName(fieldName, targetAlias) {
58
57
  return fieldName;
59
58
  }
60
59
  export function transformJoinResults(rows, operations) {
61
- const joinOperations = operations.filter(op => op instanceof Join);
62
- const joinManyOperations = operations.filter(op => op instanceof JoinMany);
63
- const joinThroughOperations = operations.filter(op => op instanceof JoinThrough);
64
- const joinThroughManyOperations = operations.filter(op => op instanceof JoinThroughMany);
65
- if (joinOperations.length === 0 &&
66
- joinManyOperations.length === 0 &&
67
- joinThroughOperations.length === 0 &&
68
- joinThroughManyOperations.length === 0) {
60
+ const leftJoinOperations = operations.filter(op => op instanceof LeftJoin);
61
+ const innerJoinOperations = operations.filter(op => op instanceof InnerJoin);
62
+ const leftJoinManyOperations = operations.filter(op => op instanceof LeftJoinMany);
63
+ const allJoinOperations = [...leftJoinOperations, ...innerJoinOperations];
64
+ if (allJoinOperations.length === 0 &&
65
+ leftJoinManyOperations.length === 0) {
69
66
  return rows;
70
67
  }
71
68
  const allJoinAliases = [
72
- ...joinOperations.map(j => j.as),
73
- ...joinManyOperations.map(j => j.as),
74
- ...joinThroughOperations.map(j => j.as),
75
- ...joinThroughManyOperations.map(j => j.as)
69
+ ...allJoinOperations.map(j => j.as),
70
+ ...leftJoinManyOperations.map(j => j.as)
76
71
  ];
77
72
  const enrichmentMap = new Map();
78
- for (const op of [...joinManyOperations, ...joinThroughManyOperations]) {
73
+ for (const op of leftJoinManyOperations) {
79
74
  const target = findEnrichmentTarget(op, operations);
80
75
  if (target) {
81
76
  enrichmentMap.set(op, target);
@@ -85,7 +80,7 @@ export function transformJoinResults(rows, operations) {
85
80
  const transformed = {};
86
81
  const joinData = {};
87
82
  for (const key of Object.keys(row)) {
88
- const hasJoinPrefix = joinOperations.some(join => key.startsWith(`${join.as}__`));
83
+ const hasJoinPrefix = allJoinOperations.some(join => key.startsWith(`${join.as}__`));
89
84
  const isJoinAlias = allJoinAliases.includes(key);
90
85
  if (!hasJoinPrefix && !isJoinAlias) {
91
86
  transformed[key] = row[key];
@@ -95,7 +90,7 @@ export function transformJoinResults(rows, operations) {
95
90
  if (enrichmentMap.has(operation)) {
96
91
  continue;
97
92
  }
98
- if (operation instanceof Join) {
93
+ if (operation instanceof LeftJoin || operation instanceof InnerJoin) {
99
94
  const prefix = `${operation.as}__`;
100
95
  const joinedData = {};
101
96
  let hasAnyData = false;
@@ -111,15 +106,11 @@ export function transformJoinResults(rows, operations) {
111
106
  }
112
107
  if (operation.localField.includes('.')) {
113
108
  const [tableAlias] = operation.localField.split('.');
114
- const relatedJoin = joinOperations.find(j => j.as === tableAlias);
115
- const relatedJoinThrough = joinThroughOperations.find(j => j.as === tableAlias);
109
+ const relatedJoin = allJoinOperations.find(j => j.as === tableAlias);
116
110
  let targetObject = null;
117
111
  if (relatedJoin && joinData[relatedJoin.as]) {
118
112
  targetObject = joinData[relatedJoin.as];
119
113
  }
120
- else if (relatedJoinThrough && joinData[relatedJoinThrough.as]) {
121
- targetObject = joinData[relatedJoinThrough.as];
122
- }
123
114
  else {
124
115
  const found = findNestedObject(joinData, tableAlias);
125
116
  if (found) {
@@ -137,88 +128,7 @@ export function transformJoinResults(rows, operations) {
137
128
  joinData[operation.as] = hasAnyData ? joinedData : null;
138
129
  }
139
130
  }
140
- else if (operation instanceof JoinThrough) {
141
- const jsonValue = parseJsonValue(row[operation.as]);
142
- if (operation.localField.includes('.')) {
143
- const [tableAlias] = operation.localField.split('.');
144
- const relatedJoin = joinOperations.find(j => j.as === tableAlias);
145
- const relatedJoinThrough = joinThroughOperations.find(j => j.as === tableAlias);
146
- let targetObject = null;
147
- if (relatedJoin && joinData[relatedJoin.as]) {
148
- targetObject = joinData[relatedJoin.as];
149
- }
150
- else if (relatedJoinThrough) {
151
- const found = findNestedObject(joinData, relatedJoinThrough.as);
152
- if (found) {
153
- targetObject = found.obj;
154
- }
155
- }
156
- if (targetObject) {
157
- targetObject[operation.as] = jsonValue;
158
- }
159
- else {
160
- joinData[operation.as] = jsonValue;
161
- }
162
- }
163
- else {
164
- joinData[operation.as] = jsonValue;
165
- }
166
- }
167
- else if (operation instanceof JoinMany) {
168
- const jsonValue = parseJsonValue(row[operation.as]);
169
- let parsedValue = Array.isArray(jsonValue) ? jsonValue : (jsonValue ? [jsonValue] : []);
170
- const enrichments = Array.from(enrichmentMap.entries())
171
- .filter(([_, target]) => target === operation)
172
- .map(([enrichOp]) => enrichOp);
173
- if (enrichments.length > 0 && Array.isArray(parsedValue)) {
174
- for (const item of parsedValue) {
175
- if (item && typeof item === 'object') {
176
- for (const enrichment of enrichments) {
177
- if (item[enrichment.as] !== undefined) {
178
- const mappedName = mapEnrichmentFieldName(enrichment.as, operation.as);
179
- if (mappedName !== enrichment.as) {
180
- item[mappedName] = item[enrichment.as];
181
- delete item[enrichment.as];
182
- }
183
- }
184
- }
185
- }
186
- }
187
- }
188
- if (operation.localField.includes('.')) {
189
- const [tableAlias] = operation.localField.split('.');
190
- const relatedJoin = joinOperations.find(j => j.as === tableAlias);
191
- const relatedJoinMany = joinManyOperations.find(j => j.as === tableAlias);
192
- const relatedJoinThrough = joinThroughOperations.find(j => j.as === tableAlias);
193
- const relatedJoinThroughMany = joinThroughManyOperations.find(j => j.as === tableAlias);
194
- let targetObject = null;
195
- if (relatedJoin && joinData[relatedJoin.as]) {
196
- targetObject = joinData[relatedJoin.as];
197
- }
198
- else if (relatedJoinThrough) {
199
- const found = findNestedObject(joinData, relatedJoinThrough.as);
200
- if (found) {
201
- targetObject = found.obj;
202
- }
203
- }
204
- else if (relatedJoinMany && joinData[relatedJoinMany.as]) {
205
- targetObject = joinData[relatedJoinMany.as];
206
- }
207
- else if (relatedJoinThroughMany && joinData[relatedJoinThroughMany.as]) {
208
- targetObject = joinData[relatedJoinThroughMany.as];
209
- }
210
- if (targetObject) {
211
- targetObject[operation.as] = parsedValue;
212
- }
213
- else {
214
- joinData[operation.as] = parsedValue;
215
- }
216
- }
217
- else {
218
- joinData[operation.as] = parsedValue;
219
- }
220
- }
221
- else if (operation instanceof JoinThroughMany) {
131
+ else if (operation instanceof LeftJoinMany) {
222
132
  const jsonValue = parseJsonValue(row[operation.as]);
223
133
  let parsedValue = Array.isArray(jsonValue) ? jsonValue : (jsonValue ? [jsonValue] : []);
224
134
  const enrichments = Array.from(enrichmentMap.entries())
@@ -241,26 +151,15 @@ export function transformJoinResults(rows, operations) {
241
151
  }
242
152
  if (operation.localField.includes('.')) {
243
153
  const [tableAlias] = operation.localField.split('.');
244
- const relatedJoin = joinOperations.find(j => j.as === tableAlias);
245
- const relatedJoinMany = joinManyOperations.find(j => j.as === tableAlias);
246
- const relatedJoinThrough = joinThroughOperations.find(j => j.as === tableAlias);
247
- const relatedJoinThroughMany = joinThroughManyOperations.find(j => j.as === tableAlias);
154
+ const relatedJoin = allJoinOperations.find(j => j.as === tableAlias);
155
+ const relatedJoinMany = leftJoinManyOperations.find(j => j.as === tableAlias);
248
156
  let targetObject = null;
249
157
  if (relatedJoin && joinData[relatedJoin.as]) {
250
158
  targetObject = joinData[relatedJoin.as];
251
159
  }
252
- else if (relatedJoinThrough) {
253
- const found = findNestedObject(joinData, relatedJoinThrough.as);
254
- if (found) {
255
- targetObject = found.obj;
256
- }
257
- }
258
160
  else if (relatedJoinMany && joinData[relatedJoinMany.as]) {
259
161
  targetObject = joinData[relatedJoinMany.as];
260
162
  }
261
- else if (relatedJoinThroughMany && joinData[relatedJoinThroughMany.as]) {
262
- targetObject = joinData[relatedJoinThroughMany.as];
263
- }
264
163
  if (targetObject) {
265
164
  targetObject[operation.as] = parsedValue;
266
165
  }
package/package.json CHANGED
@@ -1,92 +1,92 @@
1
- {
2
- "name": "@loomcore/api",
3
- "version": "0.1.97",
4
- "private": false,
5
- "description": "Loom Core Api - An opinionated Node.js api using Typescript, Express, and MongoDb or PostgreSQL",
6
- "scripts": {
7
- "clean": "rm -rf dist",
8
- "tsc": "tsc --project tsconfig.prod.json",
9
- "build": "npm-run-all -s clean tsc",
10
- "add": "git add .",
11
- "commit": "git commit -m \"Updates\"",
12
- "patch": "npm version patch",
13
- "push": "git push",
14
- "publishMe": "npm publish --access public",
15
- "pub": "npm-run-all -s add commit patch build push publishMe",
16
- "update-lib-versions": "npx --yes npm-check-updates -u -f @loomcore/common",
17
- "install-updated-libs": "npm i @loomcore/common",
18
- "update-libs": "npm-run-all -s update-lib-versions install-updated-libs",
19
- "typecheck": "tsc",
20
- "test": "npm-run-all -s test:postgres test:mongodb",
21
- "test:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run",
22
- "test:postgres:real": "cross-env NODE_ENV=test TEST_DATABASE=postgres USE_REAL_POSTGRES=true vitest run",
23
- "test:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run",
24
- "test:ci": "npm-run-all -s test:ci:postgres test:ci:mongodb",
25
- "test:ci:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run --reporter=json --outputFile=test-results-postgres.json",
26
- "test:ci:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run --reporter=json --outputFile=test-results-mongodb.json",
27
- "test:watch": "cross-env NODE_ENV=test vitest",
28
- "coverage": "npm-run-all -s coverage:postgres coverage:mongodb",
29
- "coverage:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run --coverage",
30
- "coverage:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run --coverage",
31
- "test:db:start": "docker-compose -f docker-compose.test.yml up -d",
32
- "test:db:stop": "docker-compose -f docker-compose.test.yml down",
33
- "test:db:logs": "docker-compose -f docker-compose.test.yml logs -f"
34
- },
35
- "author": "Tim Hardy",
36
- "license": "Apache 2.0",
37
- "main": "dist/index.js",
38
- "type": "module",
39
- "types": "dist/index.d.ts",
40
- "files": [
41
- "dist/**/*"
42
- ],
43
- "exports": {
44
- "./__tests__": "./dist/__tests__/index.js",
45
- "./config": "./dist/config/index.js",
46
- "./controllers": "./dist/controllers/index.js",
47
- "./databases": "./dist/databases/index.js",
48
- "./errors": "./dist/errors/index.js",
49
- "./middleware": "./dist/middleware/index.js",
50
- "./models": "./dist/models/index.js",
51
- "./services": "./dist/services/index.js",
52
- "./utils": "./dist/utils/index.js"
53
- },
54
- "dependencies": {
55
- "jsonwebtoken": "^9.0.2",
56
- "node-mailjet": "^6.0.8",
57
- "qs": "^6.15.0"
58
- },
59
- "peerDependencies": {
60
- "@loomcore/common": "^0.0.51",
61
- "@sinclair/typebox": "0.34.33",
62
- "cookie-parser": "^1.4.6",
63
- "cors": "^2.8.5",
64
- "express": "^5.1.0",
65
- "lodash": "^4.17.21",
66
- "moment": "^2.30.1",
67
- "mongodb": "^6.16.0",
68
- "pg": "^8.15.6",
69
- "rxjs": "^7.8.0",
70
- "umzug": "^3.8.2"
71
- },
72
- "devDependencies": {
73
- "@types/cookie-parser": "^1.4.7",
74
- "@types/cors": "^2.8.18",
75
- "@types/express": "^5.0.1",
76
- "@types/jsonwebtoken": "^9.0.9",
77
- "@types/lodash": "^4.17.13",
78
- "@types/pg": "^8.15.6",
79
- "@types/qs": "^6.14.0",
80
- "@types/supertest": "^6.0.3",
81
- "@vitest/coverage-v8": "^3.0.9",
82
- "cross-env": "^7.0.3",
83
- "mongodb-memory-server": "^9.3.0",
84
- "npm-run-all": "^4.1.5",
85
- "pg-mem": "^3.0.12",
86
- "rxjs": "^7.8.0",
87
- "supertest": "^7.1.0",
88
- "typescript": "^5.8.3",
89
- "vite": "^6.2.5",
90
- "vitest": "^3.0.9"
91
- }
92
- }
1
+ {
2
+ "name": "@loomcore/api",
3
+ "version": "0.1.99",
4
+ "private": false,
5
+ "description": "Loom Core Api - An opinionated Node.js api using Typescript, Express, and MongoDb or PostgreSQL",
6
+ "scripts": {
7
+ "clean": "rm -rf dist",
8
+ "tsc": "tsc --project tsconfig.prod.json",
9
+ "build": "npm-run-all -s clean tsc",
10
+ "add": "git add .",
11
+ "commit": "git commit -m \"Updates\"",
12
+ "patch": "npm version patch",
13
+ "push": "git push",
14
+ "publishMe": "npm publish --access public",
15
+ "pub": "npm-run-all -s add commit patch build push publishMe",
16
+ "update-lib-versions": "npx --yes npm-check-updates -u -f @loomcore/common",
17
+ "install-updated-libs": "npm i @loomcore/common",
18
+ "update-libs": "npm-run-all -s update-lib-versions install-updated-libs",
19
+ "typecheck": "tsc",
20
+ "test": "npm-run-all -s test:postgres test:mongodb",
21
+ "test:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run",
22
+ "test:postgres:real": "cross-env NODE_ENV=test TEST_DATABASE=postgres USE_REAL_POSTGRES=true vitest run",
23
+ "test:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run",
24
+ "test:ci": "npm-run-all -s test:ci:postgres test:ci:mongodb",
25
+ "test:ci:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run --reporter=json --outputFile=test-results-postgres.json",
26
+ "test:ci:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run --reporter=json --outputFile=test-results-mongodb.json",
27
+ "test:watch": "cross-env NODE_ENV=test vitest",
28
+ "coverage": "npm-run-all -s coverage:postgres coverage:mongodb",
29
+ "coverage:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run --coverage",
30
+ "coverage:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run --coverage",
31
+ "test:db:start": "docker-compose -f docker-compose.test.yml up -d",
32
+ "test:db:stop": "docker-compose -f docker-compose.test.yml down",
33
+ "test:db:logs": "docker-compose -f docker-compose.test.yml logs -f"
34
+ },
35
+ "author": "Tim Hardy",
36
+ "license": "Apache 2.0",
37
+ "main": "dist/index.js",
38
+ "type": "module",
39
+ "types": "dist/index.d.ts",
40
+ "files": [
41
+ "dist/**/*"
42
+ ],
43
+ "exports": {
44
+ "./__tests__": "./dist/__tests__/index.js",
45
+ "./config": "./dist/config/index.js",
46
+ "./controllers": "./dist/controllers/index.js",
47
+ "./databases": "./dist/databases/index.js",
48
+ "./errors": "./dist/errors/index.js",
49
+ "./middleware": "./dist/middleware/index.js",
50
+ "./models": "./dist/models/index.js",
51
+ "./services": "./dist/services/index.js",
52
+ "./utils": "./dist/utils/index.js"
53
+ },
54
+ "dependencies": {
55
+ "jsonwebtoken": "^9.0.2",
56
+ "node-mailjet": "^6.0.8",
57
+ "qs": "^6.15.0"
58
+ },
59
+ "peerDependencies": {
60
+ "@loomcore/common": "^0.0.51",
61
+ "@sinclair/typebox": "0.34.33",
62
+ "cookie-parser": "^1.4.6",
63
+ "cors": "^2.8.5",
64
+ "express": "^5.1.0",
65
+ "lodash": "^4.17.21",
66
+ "moment": "^2.30.1",
67
+ "mongodb": "^6.16.0",
68
+ "pg": "^8.15.6",
69
+ "rxjs": "^7.8.0",
70
+ "umzug": "^3.8.2"
71
+ },
72
+ "devDependencies": {
73
+ "@types/cookie-parser": "^1.4.7",
74
+ "@types/cors": "^2.8.18",
75
+ "@types/express": "^5.0.1",
76
+ "@types/jsonwebtoken": "^9.0.9",
77
+ "@types/lodash": "^4.17.13",
78
+ "@types/pg": "^8.15.6",
79
+ "@types/qs": "^6.14.0",
80
+ "@types/supertest": "^6.0.3",
81
+ "@vitest/coverage-v8": "^3.0.9",
82
+ "cross-env": "^7.0.3",
83
+ "mongodb-memory-server": "^9.3.0",
84
+ "npm-run-all": "^4.1.5",
85
+ "pg-mem": "^3.0.12",
86
+ "rxjs": "^7.8.0",
87
+ "supertest": "^7.1.0",
88
+ "typescript": "^5.8.3",
89
+ "vite": "^6.2.5",
90
+ "vitest": "^3.0.9"
91
+ }
92
+ }
@@ -1,10 +0,0 @@
1
- export declare class JoinThroughMany {
2
- from: string;
3
- through: string;
4
- localField: string;
5
- throughLocalField: string;
6
- throughForeignField: string;
7
- foreignField: string;
8
- as: string;
9
- constructor(from: string, through: string, localField: string, throughLocalField: string, throughForeignField: string, foreignField: string, as: string);
10
- }
@@ -1,21 +0,0 @@
1
- export class JoinThroughMany {
2
- from;
3
- through;
4
- localField;
5
- throughLocalField;
6
- throughForeignField;
7
- foreignField;
8
- as;
9
- constructor(from, through, localField, throughLocalField, throughForeignField, foreignField, as) {
10
- if (from === as) {
11
- throw new Error(`JoinThroughMany alias "${as}" must be different from table name "${from}". The alias is used to identify the join result and must be unique.`);
12
- }
13
- this.from = from;
14
- this.through = through;
15
- this.localField = localField;
16
- this.throughLocalField = throughLocalField;
17
- this.throughForeignField = throughForeignField;
18
- this.foreignField = foreignField;
19
- this.as = as;
20
- }
21
- }
@@ -1,10 +0,0 @@
1
- export declare class JoinThrough {
2
- from: string;
3
- through: string;
4
- localField: string;
5
- throughLocalField: string;
6
- throughForeignField: string;
7
- foreignField: string;
8
- as: string;
9
- constructor(from: string, through: string, localField: string, throughLocalField: string, throughForeignField: string, foreignField: string, as: string);
10
- }
@@ -1,21 +0,0 @@
1
- export class JoinThrough {
2
- from;
3
- through;
4
- localField;
5
- throughLocalField;
6
- throughForeignField;
7
- foreignField;
8
- as;
9
- constructor(from, through, localField, throughLocalField, throughForeignField, foreignField, as) {
10
- if (from === as) {
11
- throw new Error(`JoinThrough alias "${as}" must be different from table name "${from}". The alias is used to identify the join result and must be unique.`);
12
- }
13
- this.from = from;
14
- this.through = through;
15
- this.localField = localField;
16
- this.throughLocalField = throughLocalField;
17
- this.throughForeignField = throughForeignField;
18
- this.foreignField = foreignField;
19
- this.as = as;
20
- }
21
- }