@strapi/database 5.60.0 → 5.61.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.
- package/dist/entity-manager/index.d.ts.map +1 -1
- package/dist/entity-manager/index.js +82 -53
- package/dist/entity-manager/index.js.map +1 -1
- package/dist/entity-manager/index.mjs +84 -55
- package/dist/entity-manager/index.mjs.map +1 -1
- package/dist/entity-manager/morph-relations.d.ts +10 -1
- package/dist/entity-manager/morph-relations.d.ts.map +1 -1
- package/dist/entity-manager/morph-relations.js +36 -0
- package/dist/entity-manager/morph-relations.js.map +1 -1
- package/dist/entity-manager/morph-relations.mjs +36 -1
- package/dist/entity-manager/morph-relations.mjs.map +1 -1
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Knex } from 'knex';
|
|
2
2
|
import type { Database } from '..';
|
|
3
|
-
import type { MorphJoinTable } from '../types';
|
|
3
|
+
import type { ID, MorphJoinTable } from '../types';
|
|
4
4
|
type Rows = Record<string, unknown>[];
|
|
5
5
|
export declare const deleteRelatedMorphOneRelationsAfterMorphToManyUpdate: (rows: Rows, { uid, attributeName, joinTable, db, transaction: trx, }: {
|
|
6
6
|
uid: string;
|
|
@@ -9,6 +9,15 @@ export declare const deleteRelatedMorphOneRelationsAfterMorphToManyUpdate: (rows
|
|
|
9
9
|
db: Database;
|
|
10
10
|
transaction?: Knex.Transaction;
|
|
11
11
|
}) => Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Renumber the order column of an entry's morphToMany relations so the values are continuous (1, 2, 3...)
|
|
14
|
+
*/
|
|
15
|
+
export declare const cleanMorphToManyOrderColumn: ({ id, joinTable, db, transaction: trx, }: {
|
|
16
|
+
id: ID;
|
|
17
|
+
joinTable: MorphJoinTable;
|
|
18
|
+
db: Database;
|
|
19
|
+
transaction?: Knex.Transaction;
|
|
20
|
+
}) => Promise<void>;
|
|
12
21
|
/**
|
|
13
22
|
* Encoding utilities for polymorphic relations.
|
|
14
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"morph-relations.d.ts","sourceRoot":"","sources":["../../src/entity-manager/morph-relations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"morph-relations.d.ts","sourceRoot":"","sources":["../../src/entity-manager/morph-relations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAIjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAY,MAAM,UAAU,CAAC;AAE7D,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;AA8BtC,eAAO,MAAM,oDAAoD,GAC/D,MAAM,IAAI,EACV,0DAMG;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,cAAc,CAAC;IAC1B,EAAE,EAAE,QAAQ,CAAC;IACb,WAAW,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC;CAChC,kBAmCF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAU,0CAK/C;IACD,EAAE,EAAE,EAAE,CAAC;IACP,SAAS,EAAE,cAAc,CAAC;IAC1B,EAAE,EAAE,QAAQ,CAAC;IACb,WAAW,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC;CAChC,kBA2CA,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,GAAI,IAAI,MAAM,GAAG,MAAM,EAAE,QAAQ,MAAM,WAEtE,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;YAkBpC,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _ = require('lodash');
|
|
4
4
|
var queryBuilder = require('../query/query-builder.js');
|
|
5
|
+
var knex = require('../utils/knex.js');
|
|
5
6
|
|
|
6
7
|
/* eslint-disable @typescript-eslint/naming-convention */ // allow __type
|
|
7
8
|
const getMorphToManyRowsLinkedToMorphOne = (rows, { uid, attributeName, typeColumn, db })=>rows.filter((row)=>{
|
|
@@ -39,6 +40,40 @@ const deleteRelatedMorphOneRelationsAfterMorphToManyUpdate = async (rows, { uid,
|
|
|
39
40
|
}).transacting(trx).execute();
|
|
40
41
|
}
|
|
41
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Renumber the order column of an entry's morphToMany relations so the values are continuous (1, 2, 3...)
|
|
45
|
+
*/ const cleanMorphToManyOrderColumn = async ({ id, joinTable, db, transaction: trx })=>{
|
|
46
|
+
const { joinColumn } = joinTable;
|
|
47
|
+
const selectRowsToOrder = (joinTableName)=>db.connection(joinTableName).select('id').rowNumber('src_order', 'order', joinColumn.name).where(joinColumn.name, id).toSQL();
|
|
48
|
+
switch(db.dialect.client){
|
|
49
|
+
case 'mysql':
|
|
50
|
+
{
|
|
51
|
+
const select = selectRowsToOrder(joinTable.name);
|
|
52
|
+
await db.getConnection().raw(`UPDATE ?? as a, ( ${select.sql} ) AS b
|
|
53
|
+
SET ?? = b.src_order
|
|
54
|
+
WHERE b.id = a.id`, [
|
|
55
|
+
joinTable.name,
|
|
56
|
+
...select.bindings,
|
|
57
|
+
'order'
|
|
58
|
+
]).transacting(trx);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
{
|
|
63
|
+
const joinTableName = knex.addSchema(db, joinTable.name);
|
|
64
|
+
const select = selectRowsToOrder(joinTableName);
|
|
65
|
+
// raw query as knex doesn't allow updating from a subquery
|
|
66
|
+
await db.connection.raw(`UPDATE ?? as a
|
|
67
|
+
SET ?? = b.src_order
|
|
68
|
+
FROM ( ${select.sql} ) AS b
|
|
69
|
+
WHERE b.id = a.id`, [
|
|
70
|
+
joinTableName,
|
|
71
|
+
'order',
|
|
72
|
+
...select.bindings
|
|
73
|
+
]).transacting(trx);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
42
77
|
/**
|
|
43
78
|
* Encoding utilities for polymorphic relations.
|
|
44
79
|
*
|
|
@@ -65,6 +100,7 @@ const encodePolymorphicRelation = _.curry(({ idColumn, typeColumn }, relation)=>
|
|
|
65
100
|
return newRelation;
|
|
66
101
|
});
|
|
67
102
|
|
|
103
|
+
exports.cleanMorphToManyOrderColumn = cleanMorphToManyOrderColumn;
|
|
68
104
|
exports.deleteRelatedMorphOneRelationsAfterMorphToManyUpdate = deleteRelatedMorphOneRelationsAfterMorphToManyUpdate;
|
|
69
105
|
exports.encodePolymorphicId = encodePolymorphicId;
|
|
70
106
|
exports.encodePolymorphicRelation = encodePolymorphicRelation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"morph-relations.js","sources":["../../src/entity-manager/morph-relations.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */ // allow __type\nimport { curry, groupBy, mapValues, map, isEmpty } from 'lodash';\nimport type { Knex } from 'knex';\n\nimport { createQueryBuilder } from '../query';\nimport type { Database } from '..';\nimport type { MorphJoinTable, Relation } from '../types';\n\ntype Rows = Record<string, unknown>[];\n\nconst getMorphToManyRowsLinkedToMorphOne = (\n rows: Rows,\n {\n uid,\n attributeName,\n typeColumn,\n db,\n }: {\n uid: string;\n attributeName: string;\n typeColumn: { name: string };\n db: Database;\n }\n) =>\n rows.filter((row) => {\n const relatedType = row[typeColumn.name] as string;\n const field = row.field as any;\n\n const targetAttribute = db.metadata.get(relatedType).attributes[field] as Relation.MorphOne;\n\n // ensure targeted field is the right one + check if it is a morphOne\n return (\n targetAttribute?.target === uid &&\n targetAttribute?.morphBy === attributeName &&\n targetAttribute?.relation === 'morphOne'\n );\n });\n\nexport const deleteRelatedMorphOneRelationsAfterMorphToManyUpdate = async (\n rows: Rows,\n {\n uid,\n attributeName,\n joinTable,\n db,\n transaction: trx,\n }: {\n uid: string;\n attributeName: string;\n joinTable: MorphJoinTable;\n db: Database;\n transaction?: Knex.Transaction;\n }\n) => {\n const { morphColumn } = joinTable;\n const { idColumn, typeColumn } = morphColumn;\n\n const morphOneRows = getMorphToManyRowsLinkedToMorphOne(rows, {\n uid,\n attributeName,\n typeColumn,\n db,\n });\n\n const typeAndFieldIdsGrouped = mapValues(groupBy(morphOneRows, typeColumn.name), (typeRows) =>\n groupBy(typeRows, 'field')\n );\n\n const orWhere: object[] = [];\n\n for (const [type, v] of Object.entries(typeAndFieldIdsGrouped)) {\n for (const [field, arr] of Object.entries(v)) {\n orWhere.push({\n [typeColumn.name]: type,\n field,\n [idColumn.name]: { $in: map(arr, idColumn.name) },\n });\n }\n }\n\n if (!isEmpty(orWhere)) {\n await createQueryBuilder(joinTable.name, db)\n .delete()\n .where({ $or: orWhere })\n .transacting(trx)\n .execute();\n }\n};\n\n/**\n * Encoding utilities for polymorphic relations.\n *\n * In some scenarios is useful to encode both the id & __type of the relation\n * to have a unique identifier for the relation. (e.g. relations reordering)\n */\n\nexport const encodePolymorphicId = (id: number | string, __type: string) => {\n return `${id}:::${__type}`;\n};\n\nexport const encodePolymorphicRelation = curry(({ idColumn, typeColumn }, relation?: any): any => {\n // Encode the id of the relation and the positional argument if it exist\n const newRelation = {\n ...relation,\n [idColumn]: encodePolymorphicId(relation[idColumn], relation[typeColumn]),\n };\n\n if (relation.position) {\n const { before, after } = relation.position;\n const __type = relation.position.__type || relation.__type;\n\n newRelation.position = { ...relation.position };\n\n if (before) newRelation.position.before = encodePolymorphicId(before, __type);\n if (after) newRelation.position.after = encodePolymorphicId(after, __type);\n }\n\n return newRelation;\n});\n"],"names":["getMorphToManyRowsLinkedToMorphOne","rows","uid","attributeName","typeColumn","db","filter","row","relatedType","name","field","targetAttribute","metadata","get","attributes","target","morphBy","relation","deleteRelatedMorphOneRelationsAfterMorphToManyUpdate","joinTable","transaction","trx","morphColumn","idColumn","morphOneRows","typeAndFieldIdsGrouped","mapValues","groupBy","typeRows","orWhere","type","v","Object","entries","arr","push","$in","map","isEmpty","createQueryBuilder","delete","where","$or","transacting","execute","
|
|
1
|
+
{"version":3,"file":"morph-relations.js","sources":["../../src/entity-manager/morph-relations.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */ // allow __type\nimport { curry, groupBy, mapValues, map, isEmpty } from 'lodash';\nimport type { Knex } from 'knex';\n\nimport { createQueryBuilder } from '../query';\nimport { addSchema } from '../utils/knex';\nimport type { Database } from '..';\nimport type { ID, MorphJoinTable, Relation } from '../types';\n\ntype Rows = Record<string, unknown>[];\n\nconst getMorphToManyRowsLinkedToMorphOne = (\n rows: Rows,\n {\n uid,\n attributeName,\n typeColumn,\n db,\n }: {\n uid: string;\n attributeName: string;\n typeColumn: { name: string };\n db: Database;\n }\n) =>\n rows.filter((row) => {\n const relatedType = row[typeColumn.name] as string;\n const field = row.field as any;\n\n const targetAttribute = db.metadata.get(relatedType).attributes[field] as Relation.MorphOne;\n\n // ensure targeted field is the right one + check if it is a morphOne\n return (\n targetAttribute?.target === uid &&\n targetAttribute?.morphBy === attributeName &&\n targetAttribute?.relation === 'morphOne'\n );\n });\n\nexport const deleteRelatedMorphOneRelationsAfterMorphToManyUpdate = async (\n rows: Rows,\n {\n uid,\n attributeName,\n joinTable,\n db,\n transaction: trx,\n }: {\n uid: string;\n attributeName: string;\n joinTable: MorphJoinTable;\n db: Database;\n transaction?: Knex.Transaction;\n }\n) => {\n const { morphColumn } = joinTable;\n const { idColumn, typeColumn } = morphColumn;\n\n const morphOneRows = getMorphToManyRowsLinkedToMorphOne(rows, {\n uid,\n attributeName,\n typeColumn,\n db,\n });\n\n const typeAndFieldIdsGrouped = mapValues(groupBy(morphOneRows, typeColumn.name), (typeRows) =>\n groupBy(typeRows, 'field')\n );\n\n const orWhere: object[] = [];\n\n for (const [type, v] of Object.entries(typeAndFieldIdsGrouped)) {\n for (const [field, arr] of Object.entries(v)) {\n orWhere.push({\n [typeColumn.name]: type,\n field,\n [idColumn.name]: { $in: map(arr, idColumn.name) },\n });\n }\n }\n\n if (!isEmpty(orWhere)) {\n await createQueryBuilder(joinTable.name, db)\n .delete()\n .where({ $or: orWhere })\n .transacting(trx)\n .execute();\n }\n};\n\n/**\n * Renumber the order column of an entry's morphToMany relations so the values are continuous (1, 2, 3...)\n */\nexport const cleanMorphToManyOrderColumn = async ({\n id,\n joinTable,\n db,\n transaction: trx,\n}: {\n id: ID;\n joinTable: MorphJoinTable;\n db: Database;\n transaction?: Knex.Transaction;\n}) => {\n const { joinColumn } = joinTable;\n\n const selectRowsToOrder = (joinTableName: string) =>\n db\n .connection(joinTableName)\n .select('id')\n .rowNumber('src_order', 'order', joinColumn.name)\n .where(joinColumn.name, id)\n .toSQL();\n\n switch (db.dialect.client) {\n case 'mysql': {\n const select = selectRowsToOrder(joinTable.name);\n\n await db\n .getConnection()\n .raw(\n `UPDATE ?? as a, ( ${select.sql} ) AS b\n SET ?? = b.src_order\n WHERE b.id = a.id`,\n [joinTable.name, ...select.bindings, 'order']\n )\n .transacting(trx);\n\n break;\n }\n default: {\n const joinTableName = addSchema(db, joinTable.name);\n const select = selectRowsToOrder(joinTableName);\n\n // raw query as knex doesn't allow updating from a subquery\n await db.connection\n .raw(\n `UPDATE ?? as a\n SET ?? = b.src_order\n FROM ( ${select.sql} ) AS b\n WHERE b.id = a.id`,\n [joinTableName, 'order', ...select.bindings]\n )\n .transacting(trx);\n }\n }\n};\n\n/**\n * Encoding utilities for polymorphic relations.\n *\n * In some scenarios is useful to encode both the id & __type of the relation\n * to have a unique identifier for the relation. (e.g. relations reordering)\n */\n\nexport const encodePolymorphicId = (id: number | string, __type: string) => {\n return `${id}:::${__type}`;\n};\n\nexport const encodePolymorphicRelation = curry(({ idColumn, typeColumn }, relation?: any): any => {\n // Encode the id of the relation and the positional argument if it exist\n const newRelation = {\n ...relation,\n [idColumn]: encodePolymorphicId(relation[idColumn], relation[typeColumn]),\n };\n\n if (relation.position) {\n const { before, after } = relation.position;\n const __type = relation.position.__type || relation.__type;\n\n newRelation.position = { ...relation.position };\n\n if (before) newRelation.position.before = encodePolymorphicId(before, __type);\n if (after) newRelation.position.after = encodePolymorphicId(after, __type);\n }\n\n return newRelation;\n});\n"],"names":["getMorphToManyRowsLinkedToMorphOne","rows","uid","attributeName","typeColumn","db","filter","row","relatedType","name","field","targetAttribute","metadata","get","attributes","target","morphBy","relation","deleteRelatedMorphOneRelationsAfterMorphToManyUpdate","joinTable","transaction","trx","morphColumn","idColumn","morphOneRows","typeAndFieldIdsGrouped","mapValues","groupBy","typeRows","orWhere","type","v","Object","entries","arr","push","$in","map","isEmpty","createQueryBuilder","delete","where","$or","transacting","execute","cleanMorphToManyOrderColumn","id","joinColumn","selectRowsToOrder","joinTableName","connection","select","rowNumber","toSQL","dialect","client","getConnection","raw","sql","bindings","addSchema","encodePolymorphicId","__type","encodePolymorphicRelation","curry","newRelation","position","before","after"],"mappings":";;;;;;AAAA;AAWA,MAAMA,qCAAqC,CACzCC,IAAAA,EACA,EACEC,GAAG,EACHC,aAAa,EACbC,UAAU,EACVC,EAAE,EAMH,GAEDJ,IAAAA,CAAKK,MAAM,CAAC,CAACC,GAAAA,GAAAA;AACX,QAAA,MAAMC,WAAAA,GAAcD,GAAG,CAACH,UAAAA,CAAWK,IAAI,CAAC;QACxC,MAAMC,KAAAA,GAAQH,IAAIG,KAAK;QAEvB,MAAMC,eAAAA,GAAkBN,GAAGO,QAAQ,CAACC,GAAG,CAACL,WAAAA,CAAAA,CAAaM,UAAU,CAACJ,KAAAA,CAAM;;AAGtE,QAAA,OACEC,iBAAiBI,MAAAA,KAAWb,GAAAA,IAC5BS,iBAAiBK,OAAAA,KAAYb,aAAAA,IAC7BQ,iBAAiBM,QAAAA,KAAa,UAAA;AAElC,IAAA,CAAA,CAAA;AAEK,MAAMC,oDAAAA,GAAuD,OAClEjB,IAAAA,EACA,EACEC,GAAG,EACHC,aAAa,EACbgB,SAAS,EACTd,EAAE,EACFe,WAAAA,EAAaC,G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createQueryBuilder from '../query/query-builder.mjs';
|
|
3
|
+
import { addSchema } from '../utils/knex.mjs';
|
|
3
4
|
|
|
4
5
|
/* eslint-disable @typescript-eslint/naming-convention */ // allow __type
|
|
5
6
|
const getMorphToManyRowsLinkedToMorphOne = (rows, { uid, attributeName, typeColumn, db })=>rows.filter((row)=>{
|
|
@@ -37,6 +38,40 @@ const deleteRelatedMorphOneRelationsAfterMorphToManyUpdate = async (rows, { uid,
|
|
|
37
38
|
}).transacting(trx).execute();
|
|
38
39
|
}
|
|
39
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Renumber the order column of an entry's morphToMany relations so the values are continuous (1, 2, 3...)
|
|
43
|
+
*/ const cleanMorphToManyOrderColumn = async ({ id, joinTable, db, transaction: trx })=>{
|
|
44
|
+
const { joinColumn } = joinTable;
|
|
45
|
+
const selectRowsToOrder = (joinTableName)=>db.connection(joinTableName).select('id').rowNumber('src_order', 'order', joinColumn.name).where(joinColumn.name, id).toSQL();
|
|
46
|
+
switch(db.dialect.client){
|
|
47
|
+
case 'mysql':
|
|
48
|
+
{
|
|
49
|
+
const select = selectRowsToOrder(joinTable.name);
|
|
50
|
+
await db.getConnection().raw(`UPDATE ?? as a, ( ${select.sql} ) AS b
|
|
51
|
+
SET ?? = b.src_order
|
|
52
|
+
WHERE b.id = a.id`, [
|
|
53
|
+
joinTable.name,
|
|
54
|
+
...select.bindings,
|
|
55
|
+
'order'
|
|
56
|
+
]).transacting(trx);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
default:
|
|
60
|
+
{
|
|
61
|
+
const joinTableName = addSchema(db, joinTable.name);
|
|
62
|
+
const select = selectRowsToOrder(joinTableName);
|
|
63
|
+
// raw query as knex doesn't allow updating from a subquery
|
|
64
|
+
await db.connection.raw(`UPDATE ?? as a
|
|
65
|
+
SET ?? = b.src_order
|
|
66
|
+
FROM ( ${select.sql} ) AS b
|
|
67
|
+
WHERE b.id = a.id`, [
|
|
68
|
+
joinTableName,
|
|
69
|
+
'order',
|
|
70
|
+
...select.bindings
|
|
71
|
+
]).transacting(trx);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
40
75
|
/**
|
|
41
76
|
* Encoding utilities for polymorphic relations.
|
|
42
77
|
*
|
|
@@ -63,5 +98,5 @@ const encodePolymorphicRelation = curry(({ idColumn, typeColumn }, relation)=>{
|
|
|
63
98
|
return newRelation;
|
|
64
99
|
});
|
|
65
100
|
|
|
66
|
-
export { deleteRelatedMorphOneRelationsAfterMorphToManyUpdate, encodePolymorphicId, encodePolymorphicRelation };
|
|
101
|
+
export { cleanMorphToManyOrderColumn, deleteRelatedMorphOneRelationsAfterMorphToManyUpdate, encodePolymorphicId, encodePolymorphicRelation };
|
|
67
102
|
//# sourceMappingURL=morph-relations.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"morph-relations.mjs","sources":["../../src/entity-manager/morph-relations.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */ // allow __type\nimport { curry, groupBy, mapValues, map, isEmpty } from 'lodash';\nimport type { Knex } from 'knex';\n\nimport { createQueryBuilder } from '../query';\nimport type { Database } from '..';\nimport type { MorphJoinTable, Relation } from '../types';\n\ntype Rows = Record<string, unknown>[];\n\nconst getMorphToManyRowsLinkedToMorphOne = (\n rows: Rows,\n {\n uid,\n attributeName,\n typeColumn,\n db,\n }: {\n uid: string;\n attributeName: string;\n typeColumn: { name: string };\n db: Database;\n }\n) =>\n rows.filter((row) => {\n const relatedType = row[typeColumn.name] as string;\n const field = row.field as any;\n\n const targetAttribute = db.metadata.get(relatedType).attributes[field] as Relation.MorphOne;\n\n // ensure targeted field is the right one + check if it is a morphOne\n return (\n targetAttribute?.target === uid &&\n targetAttribute?.morphBy === attributeName &&\n targetAttribute?.relation === 'morphOne'\n );\n });\n\nexport const deleteRelatedMorphOneRelationsAfterMorphToManyUpdate = async (\n rows: Rows,\n {\n uid,\n attributeName,\n joinTable,\n db,\n transaction: trx,\n }: {\n uid: string;\n attributeName: string;\n joinTable: MorphJoinTable;\n db: Database;\n transaction?: Knex.Transaction;\n }\n) => {\n const { morphColumn } = joinTable;\n const { idColumn, typeColumn } = morphColumn;\n\n const morphOneRows = getMorphToManyRowsLinkedToMorphOne(rows, {\n uid,\n attributeName,\n typeColumn,\n db,\n });\n\n const typeAndFieldIdsGrouped = mapValues(groupBy(morphOneRows, typeColumn.name), (typeRows) =>\n groupBy(typeRows, 'field')\n );\n\n const orWhere: object[] = [];\n\n for (const [type, v] of Object.entries(typeAndFieldIdsGrouped)) {\n for (const [field, arr] of Object.entries(v)) {\n orWhere.push({\n [typeColumn.name]: type,\n field,\n [idColumn.name]: { $in: map(arr, idColumn.name) },\n });\n }\n }\n\n if (!isEmpty(orWhere)) {\n await createQueryBuilder(joinTable.name, db)\n .delete()\n .where({ $or: orWhere })\n .transacting(trx)\n .execute();\n }\n};\n\n/**\n * Encoding utilities for polymorphic relations.\n *\n * In some scenarios is useful to encode both the id & __type of the relation\n * to have a unique identifier for the relation. (e.g. relations reordering)\n */\n\nexport const encodePolymorphicId = (id: number | string, __type: string) => {\n return `${id}:::${__type}`;\n};\n\nexport const encodePolymorphicRelation = curry(({ idColumn, typeColumn }, relation?: any): any => {\n // Encode the id of the relation and the positional argument if it exist\n const newRelation = {\n ...relation,\n [idColumn]: encodePolymorphicId(relation[idColumn], relation[typeColumn]),\n };\n\n if (relation.position) {\n const { before, after } = relation.position;\n const __type = relation.position.__type || relation.__type;\n\n newRelation.position = { ...relation.position };\n\n if (before) newRelation.position.before = encodePolymorphicId(before, __type);\n if (after) newRelation.position.after = encodePolymorphicId(after, __type);\n }\n\n return newRelation;\n});\n"],"names":["getMorphToManyRowsLinkedToMorphOne","rows","uid","attributeName","typeColumn","db","filter","row","relatedType","name","field","targetAttribute","metadata","get","attributes","target","morphBy","relation","deleteRelatedMorphOneRelationsAfterMorphToManyUpdate","joinTable","transaction","trx","morphColumn","idColumn","morphOneRows","typeAndFieldIdsGrouped","mapValues","groupBy","typeRows","orWhere","type","v","Object","entries","arr","push","$in","map","isEmpty","createQueryBuilder","delete","where","$or","transacting","execute","
|
|
1
|
+
{"version":3,"file":"morph-relations.mjs","sources":["../../src/entity-manager/morph-relations.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */ // allow __type\nimport { curry, groupBy, mapValues, map, isEmpty } from 'lodash';\nimport type { Knex } from 'knex';\n\nimport { createQueryBuilder } from '../query';\nimport { addSchema } from '../utils/knex';\nimport type { Database } from '..';\nimport type { ID, MorphJoinTable, Relation } from '../types';\n\ntype Rows = Record<string, unknown>[];\n\nconst getMorphToManyRowsLinkedToMorphOne = (\n rows: Rows,\n {\n uid,\n attributeName,\n typeColumn,\n db,\n }: {\n uid: string;\n attributeName: string;\n typeColumn: { name: string };\n db: Database;\n }\n) =>\n rows.filter((row) => {\n const relatedType = row[typeColumn.name] as string;\n const field = row.field as any;\n\n const targetAttribute = db.metadata.get(relatedType).attributes[field] as Relation.MorphOne;\n\n // ensure targeted field is the right one + check if it is a morphOne\n return (\n targetAttribute?.target === uid &&\n targetAttribute?.morphBy === attributeName &&\n targetAttribute?.relation === 'morphOne'\n );\n });\n\nexport const deleteRelatedMorphOneRelationsAfterMorphToManyUpdate = async (\n rows: Rows,\n {\n uid,\n attributeName,\n joinTable,\n db,\n transaction: trx,\n }: {\n uid: string;\n attributeName: string;\n joinTable: MorphJoinTable;\n db: Database;\n transaction?: Knex.Transaction;\n }\n) => {\n const { morphColumn } = joinTable;\n const { idColumn, typeColumn } = morphColumn;\n\n const morphOneRows = getMorphToManyRowsLinkedToMorphOne(rows, {\n uid,\n attributeName,\n typeColumn,\n db,\n });\n\n const typeAndFieldIdsGrouped = mapValues(groupBy(morphOneRows, typeColumn.name), (typeRows) =>\n groupBy(typeRows, 'field')\n );\n\n const orWhere: object[] = [];\n\n for (const [type, v] of Object.entries(typeAndFieldIdsGrouped)) {\n for (const [field, arr] of Object.entries(v)) {\n orWhere.push({\n [typeColumn.name]: type,\n field,\n [idColumn.name]: { $in: map(arr, idColumn.name) },\n });\n }\n }\n\n if (!isEmpty(orWhere)) {\n await createQueryBuilder(joinTable.name, db)\n .delete()\n .where({ $or: orWhere })\n .transacting(trx)\n .execute();\n }\n};\n\n/**\n * Renumber the order column of an entry's morphToMany relations so the values are continuous (1, 2, 3...)\n */\nexport const cleanMorphToManyOrderColumn = async ({\n id,\n joinTable,\n db,\n transaction: trx,\n}: {\n id: ID;\n joinTable: MorphJoinTable;\n db: Database;\n transaction?: Knex.Transaction;\n}) => {\n const { joinColumn } = joinTable;\n\n const selectRowsToOrder = (joinTableName: string) =>\n db\n .connection(joinTableName)\n .select('id')\n .rowNumber('src_order', 'order', joinColumn.name)\n .where(joinColumn.name, id)\n .toSQL();\n\n switch (db.dialect.client) {\n case 'mysql': {\n const select = selectRowsToOrder(joinTable.name);\n\n await db\n .getConnection()\n .raw(\n `UPDATE ?? as a, ( ${select.sql} ) AS b\n SET ?? = b.src_order\n WHERE b.id = a.id`,\n [joinTable.name, ...select.bindings, 'order']\n )\n .transacting(trx);\n\n break;\n }\n default: {\n const joinTableName = addSchema(db, joinTable.name);\n const select = selectRowsToOrder(joinTableName);\n\n // raw query as knex doesn't allow updating from a subquery\n await db.connection\n .raw(\n `UPDATE ?? as a\n SET ?? = b.src_order\n FROM ( ${select.sql} ) AS b\n WHERE b.id = a.id`,\n [joinTableName, 'order', ...select.bindings]\n )\n .transacting(trx);\n }\n }\n};\n\n/**\n * Encoding utilities for polymorphic relations.\n *\n * In some scenarios is useful to encode both the id & __type of the relation\n * to have a unique identifier for the relation. (e.g. relations reordering)\n */\n\nexport const encodePolymorphicId = (id: number | string, __type: string) => {\n return `${id}:::${__type}`;\n};\n\nexport const encodePolymorphicRelation = curry(({ idColumn, typeColumn }, relation?: any): any => {\n // Encode the id of the relation and the positional argument if it exist\n const newRelation = {\n ...relation,\n [idColumn]: encodePolymorphicId(relation[idColumn], relation[typeColumn]),\n };\n\n if (relation.position) {\n const { before, after } = relation.position;\n const __type = relation.position.__type || relation.__type;\n\n newRelation.position = { ...relation.position };\n\n if (before) newRelation.position.before = encodePolymorphicId(before, __type);\n if (after) newRelation.position.after = encodePolymorphicId(after, __type);\n }\n\n return newRelation;\n});\n"],"names":["getMorphToManyRowsLinkedToMorphOne","rows","uid","attributeName","typeColumn","db","filter","row","relatedType","name","field","targetAttribute","metadata","get","attributes","target","morphBy","relation","deleteRelatedMorphOneRelationsAfterMorphToManyUpdate","joinTable","transaction","trx","morphColumn","idColumn","morphOneRows","typeAndFieldIdsGrouped","mapValues","groupBy","typeRows","orWhere","type","v","Object","entries","arr","push","$in","map","isEmpty","createQueryBuilder","delete","where","$or","transacting","execute","cleanMorphToManyOrderColumn","id","joinColumn","selectRowsToOrder","joinTableName","connection","select","rowNumber","toSQL","dialect","client","getConnection","raw","sql","bindings","addSchema","encodePolymorphicId","__type","encodePolymorphicRelation","curry","newRelation","position","before","after"],"mappings":";;;;AAAA;AAWA,MAAMA,qCAAqC,CACzCC,IAAAA,EACA,EACEC,GAAG,EACHC,aAAa,EACbC,UAAU,EACVC,EAAE,EAMH,GAEDJ,IAAAA,CAAKK,MAAM,CAAC,CAACC,GAAAA,GAAAA;AACX,QAAA,MAAMC,WAAAA,GAAcD,GAAG,CAACH,UAAAA,CAAWK,IAAI,CAAC;QACxC,MAAMC,KAAAA,GAAQH,IAAIG,KAAK;QAEvB,MAAMC,eAAAA,GAAkBN,GAAGO,QAAQ,CAACC,GAAG,CAACL,WAAAA,CAAAA,CAAaM,UAAU,CAACJ,KAAAA,CAAM;;AAGtE,QAAA,OACEC,iBAAiBI,MAAAA,KAAWb,GAAAA,IAC5BS,iBAAiBK,OAAAA,KAAYb,aAAAA,IAC7BQ,iBAAiBM,QAAAA,KAAa,UAAA;AAElC,IAAA,CAAA,CAAA;AAEK,MAAMC,oDAAAA,GAAuD,OAClEjB,IAAAA,EACA,EACEC,GAAG,EACHC,aAAa,EACbgB,SAAS,EACTd,EAAE,EACFe,WAA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",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.61.0",
|
|
4
4
|
"description": "Strapi's database layer",
|
|
5
5
|
"homepage": "https://strapi.io",
|
|
6
6
|
"bugs": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@paralleldrive/cuid2": "2.2.2",
|
|
49
|
-
"@strapi/utils": "5.
|
|
49
|
+
"@strapi/utils": "5.61.0",
|
|
50
50
|
"ajv": "8.20.0",
|
|
51
51
|
"date-fns": "2.30.0",
|
|
52
52
|
"debug": "4.3.4",
|
|
@@ -56,18 +56,18 @@
|
|
|
56
56
|
"semver": "7.7.4"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@strapi/typescript-utils": "5.
|
|
59
|
+
"@strapi/typescript-utils": "5.61.0",
|
|
60
60
|
"@types/fs-extra": "11.0.4",
|
|
61
61
|
"@types/jest": "29.5.2",
|
|
62
|
-
"@types/node": "20.
|
|
63
|
-
"eslint-config-custom": "5.
|
|
62
|
+
"@types/node": "22.20.0",
|
|
63
|
+
"eslint-config-custom": "5.61.0",
|
|
64
64
|
"jest": "29.6.0",
|
|
65
|
-
"tsconfig": "5.
|
|
65
|
+
"tsconfig": "5.61.0",
|
|
66
66
|
"vitest": "catalog:",
|
|
67
|
-
"vitest-config": "5.
|
|
67
|
+
"vitest-config": "5.61.0"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|
|
70
|
-
"node": ">=
|
|
70
|
+
"node": ">=22.0.0 <=26.x.x",
|
|
71
71
|
"npm": ">=6.0.0"
|
|
72
72
|
}
|
|
73
73
|
}
|