node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
import type { Diff } from '../../../utils/json';
declare const strategies: {
exact(diffs: Diff[]): Diff[];
strict(diffs: Diff[]): Diff[];
};
declare const compareSchemas: <T, P>(a: T, b: P, strategy: keyof typeof strategies) => Diff[];
export { compareSchemas };
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/engine/validation/schemas/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAqChD,QAAA,MAAM,UAAU;iBAED,IAAI,EAAE;kBAOL,IAAI,EAAE;CAGrB,CAAC;AAEF,QAAA,MAAM,cAAc,YAAa,CAAC,KAAK,CAAC,YAAY,MAAM,iBAAiB,WAG1E,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}

View File

@@ -0,0 +1,57 @@
'use strict';
var fp = require('lodash/fp');
require('crypto');
require('stream');
var json = require('../../../utils/json.js');
require('events');
const OPTIONAL_CONTENT_TYPES = [
'audit-log'
];
const isAttributeIgnorable = (diff)=>{
return diff.path.length === 3 && // Root property must be attributes
diff.path[0] === 'attributes' && // Need a valid string attribute name
typeof diff.path[1] === 'string' && // The diff must be on ignorable attribute properties
[
'private',
'required',
'configurable',
'default'
].includes(diff.path[2]);
};
// TODO: clean up the type checking, which will require cleaning up the typings in utils/json.ts
// exclude admin tables that are not transferable and are optionally available (such as audit logs which are only available in EE)
const isOptionalAdminType = (diff)=>{
// added/deleted
if ('value' in diff && fp.isObject(diff.value)) {
const name = diff?.value?.info?.singularName;
return OPTIONAL_CONTENT_TYPES.includes(name);
}
// modified
if ('values' in diff && fp.isArray(diff.values) && fp.isObject(diff.values[0])) {
const name = diff?.values[0]?.info?.singularName;
return OPTIONAL_CONTENT_TYPES.includes(name);
}
return false;
};
const isIgnorableStrict = (diff)=>isAttributeIgnorable(diff) || isOptionalAdminType(diff);
const strategies = {
// No diffs
exact (diffs) {
return diffs;
},
// Strict: all content types must match except:
// - the property within a content type is an ignorable one
// - those that are (not transferrable and optionally available), for example EE features such as audit logs
strict (diffs) {
return fp.reject(isIgnorableStrict, diffs);
}
};
const compareSchemas = (a, b, strategy)=>{
const diffs = json.diff(a, b);
return strategies[strategy](diffs);
};
exports.compareSchemas = compareSchemas;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../src/engine/validation/schemas/index.ts"],"sourcesContent":["import type { Struct } from '@strapi/types';\nimport { isArray, isObject, reject } from 'lodash/fp';\nimport type { Diff } from '../../../utils/json';\nimport * as utils from '../../../utils';\n\nconst OPTIONAL_CONTENT_TYPES = ['audit-log'] as const;\n\nconst isAttributeIgnorable = (diff: Diff) => {\n return (\n diff.path.length === 3 &&\n // Root property must be attributes\n diff.path[0] === 'attributes' &&\n // Need a valid string attribute name\n typeof diff.path[1] === 'string' &&\n // The diff must be on ignorable attribute properties\n ['private', 'required', 'configurable', 'default'].includes(diff.path[2])\n );\n};\n\n// TODO: clean up the type checking, which will require cleaning up the typings in utils/json.ts\n// exclude admin tables that are not transferable and are optionally available (such as audit logs which are only available in EE)\nconst isOptionalAdminType = (diff: Diff) => {\n // added/deleted\n if ('value' in diff && isObject(diff.value)) {\n const name = (diff?.value as Struct.ContentTypeSchema)?.info?.singularName;\n return (OPTIONAL_CONTENT_TYPES as ReadonlyArray<string | undefined>).includes(name);\n }\n\n // modified\n if ('values' in diff && isArray(diff.values) && isObject(diff.values[0])) {\n const name = (diff?.values[0] as Struct.ContentTypeSchema)?.info?.singularName;\n return (OPTIONAL_CONTENT_TYPES as ReadonlyArray<string | undefined>).includes(name);\n }\n\n return false;\n};\n\nconst isIgnorableStrict = (diff: Diff) => isAttributeIgnorable(diff) || isOptionalAdminType(diff);\n\nconst strategies = {\n // No diffs\n exact(diffs: Diff[]) {\n return diffs;\n },\n\n // Strict: all content types must match except:\n // - the property within a content type is an ignorable one\n // - those that are (not transferrable and optionally available), for example EE features such as audit logs\n strict(diffs: Diff[]) {\n return reject(isIgnorableStrict, diffs);\n },\n};\n\nconst compareSchemas = <T, P>(a: T, b: P, strategy: keyof typeof strategies) => {\n const diffs = utils.json.diff(a, b);\n return strategies[strategy](diffs);\n};\n\nexport { compareSchemas };\n"],"names":["OPTIONAL_CONTENT_TYPES","isAttributeIgnorable","diff","path","length","includes","isOptionalAdminType","isObject","value","name","info","singularName","isArray","values","isIgnorableStrict","strategies","exact","diffs","strict","reject","compareSchemas","a","b","strategy","utils"],"mappings":";;;;;;;;AAKA,MAAMA,sBAAyB,GAAA;AAAC,IAAA;AAAY,CAAA;AAE5C,MAAMC,uBAAuB,CAACC,IAAAA,GAAAA;AAC5B,IAAA,OACEA,KAAKC,IAAI,CAACC,MAAM,KAAK;AAErBF,IAAAA,IAAAA,CAAKC,IAAI,CAAC,CAAE,CAAA,KAAK;AAEjB,IAAA,OAAOD,KAAKC,IAAI,CAAC,CAAE,CAAA,KAAK;AAExB,IAAA;AAAC,QAAA,SAAA;AAAW,QAAA,UAAA;AAAY,QAAA,cAAA;AAAgB,QAAA;AAAU,KAAA,CAACE,QAAQ,CAACH,IAAKC,CAAAA,IAAI,CAAC,CAAE,CAAA,CAAA;AAE5E,CAAA;AAEA;AACA;AACA,MAAMG,sBAAsB,CAACJ,IAAAA,GAAAA;;AAE3B,IAAA,IAAI,OAAWA,IAAAA,IAAAA,IAAQK,WAASL,CAAAA,IAAAA,CAAKM,KAAK,CAAG,EAAA;QAC3C,MAAMC,IAAAA,GAAQP,IAAMM,EAAAA,KAAAA,EAAoCE,IAAMC,EAAAA,YAAAA;QAC9D,OAAQX,sBAA6DK,CAAAA,QAAQ,CAACI,IAAAA,CAAAA;AAChF;;IAGA,IAAI,QAAA,IAAYP,IAAQU,IAAAA,UAAAA,CAAQV,IAAKW,CAAAA,MAAM,CAAKN,IAAAA,WAAAA,CAASL,IAAKW,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAG,EAAA;AACxE,QAAA,MAAMJ,OAAQP,IAAMW,EAAAA,MAAM,CAAC,CAAA,CAAE,EAA+BH,IAAMC,EAAAA,YAAAA;QAClE,OAAQX,sBAA6DK,CAAAA,QAAQ,CAACI,IAAAA,CAAAA;AAChF;IAEA,OAAO,KAAA;AACT,CAAA;AAEA,MAAMK,iBAAoB,GAAA,CAACZ,IAAeD,GAAAA,oBAAAA,CAAqBC,SAASI,mBAAoBJ,CAAAA,IAAAA,CAAAA;AAE5F,MAAMa,UAAa,GAAA;;AAEjBC,IAAAA,KAAAA,CAAAA,CAAMC,KAAa,EAAA;QACjB,OAAOA,KAAAA;AACT,KAAA;;;;AAKAC,IAAAA,MAAAA,CAAAA,CAAOD,KAAa,EAAA;AAClB,QAAA,OAAOE,UAAOL,iBAAmBG,EAAAA,KAAAA,CAAAA;AACnC;AACF,CAAA;AAEMG,MAAAA,cAAAA,GAAiB,CAAOC,CAAAA,EAAMC,CAAMC,EAAAA,QAAAA,GAAAA;AACxC,IAAA,MAAMN,QAAQO,SAAe,CAACH,CAAGC,EAAAA,CAAAA,CAAAA;IACjC,OAAOP,UAAU,CAACQ,QAAAA,CAAS,CAACN,KAAAA,CAAAA;AAC9B;;;;"}

View File

@@ -0,0 +1,55 @@
import { reject, isObject, isArray } from 'lodash/fp';
import 'crypto';
import 'stream';
import { diff } from '../../../utils/json.mjs';
import 'events';
const OPTIONAL_CONTENT_TYPES = [
'audit-log'
];
const isAttributeIgnorable = (diff)=>{
return diff.path.length === 3 && // Root property must be attributes
diff.path[0] === 'attributes' && // Need a valid string attribute name
typeof diff.path[1] === 'string' && // The diff must be on ignorable attribute properties
[
'private',
'required',
'configurable',
'default'
].includes(diff.path[2]);
};
// TODO: clean up the type checking, which will require cleaning up the typings in utils/json.ts
// exclude admin tables that are not transferable and are optionally available (such as audit logs which are only available in EE)
const isOptionalAdminType = (diff)=>{
// added/deleted
if ('value' in diff && isObject(diff.value)) {
const name = diff?.value?.info?.singularName;
return OPTIONAL_CONTENT_TYPES.includes(name);
}
// modified
if ('values' in diff && isArray(diff.values) && isObject(diff.values[0])) {
const name = diff?.values[0]?.info?.singularName;
return OPTIONAL_CONTENT_TYPES.includes(name);
}
return false;
};
const isIgnorableStrict = (diff)=>isAttributeIgnorable(diff) || isOptionalAdminType(diff);
const strategies = {
// No diffs
exact (diffs) {
return diffs;
},
// Strict: all content types must match except:
// - the property within a content type is an ignorable one
// - those that are (not transferrable and optionally available), for example EE features such as audit logs
strict (diffs) {
return reject(isIgnorableStrict, diffs);
}
};
const compareSchemas = (a, b, strategy)=>{
const diffs = diff(a, b);
return strategies[strategy](diffs);
};
export { compareSchemas };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../src/engine/validation/schemas/index.ts"],"sourcesContent":["import type { Struct } from '@strapi/types';\nimport { isArray, isObject, reject } from 'lodash/fp';\nimport type { Diff } from '../../../utils/json';\nimport * as utils from '../../../utils';\n\nconst OPTIONAL_CONTENT_TYPES = ['audit-log'] as const;\n\nconst isAttributeIgnorable = (diff: Diff) => {\n return (\n diff.path.length === 3 &&\n // Root property must be attributes\n diff.path[0] === 'attributes' &&\n // Need a valid string attribute name\n typeof diff.path[1] === 'string' &&\n // The diff must be on ignorable attribute properties\n ['private', 'required', 'configurable', 'default'].includes(diff.path[2])\n );\n};\n\n// TODO: clean up the type checking, which will require cleaning up the typings in utils/json.ts\n// exclude admin tables that are not transferable and are optionally available (such as audit logs which are only available in EE)\nconst isOptionalAdminType = (diff: Diff) => {\n // added/deleted\n if ('value' in diff && isObject(diff.value)) {\n const name = (diff?.value as Struct.ContentTypeSchema)?.info?.singularName;\n return (OPTIONAL_CONTENT_TYPES as ReadonlyArray<string | undefined>).includes(name);\n }\n\n // modified\n if ('values' in diff && isArray(diff.values) && isObject(diff.values[0])) {\n const name = (diff?.values[0] as Struct.ContentTypeSchema)?.info?.singularName;\n return (OPTIONAL_CONTENT_TYPES as ReadonlyArray<string | undefined>).includes(name);\n }\n\n return false;\n};\n\nconst isIgnorableStrict = (diff: Diff) => isAttributeIgnorable(diff) || isOptionalAdminType(diff);\n\nconst strategies = {\n // No diffs\n exact(diffs: Diff[]) {\n return diffs;\n },\n\n // Strict: all content types must match except:\n // - the property within a content type is an ignorable one\n // - those that are (not transferrable and optionally available), for example EE features such as audit logs\n strict(diffs: Diff[]) {\n return reject(isIgnorableStrict, diffs);\n },\n};\n\nconst compareSchemas = <T, P>(a: T, b: P, strategy: keyof typeof strategies) => {\n const diffs = utils.json.diff(a, b);\n return strategies[strategy](diffs);\n};\n\nexport { compareSchemas };\n"],"names":["OPTIONAL_CONTENT_TYPES","isAttributeIgnorable","diff","path","length","includes","isOptionalAdminType","isObject","value","name","info","singularName","isArray","values","isIgnorableStrict","strategies","exact","diffs","strict","reject","compareSchemas","a","b","strategy","utils"],"mappings":";;;;;;AAKA,MAAMA,sBAAyB,GAAA;AAAC,IAAA;AAAY,CAAA;AAE5C,MAAMC,uBAAuB,CAACC,IAAAA,GAAAA;AAC5B,IAAA,OACEA,KAAKC,IAAI,CAACC,MAAM,KAAK;AAErBF,IAAAA,IAAAA,CAAKC,IAAI,CAAC,CAAE,CAAA,KAAK;AAEjB,IAAA,OAAOD,KAAKC,IAAI,CAAC,CAAE,CAAA,KAAK;AAExB,IAAA;AAAC,QAAA,SAAA;AAAW,QAAA,UAAA;AAAY,QAAA,cAAA;AAAgB,QAAA;AAAU,KAAA,CAACE,QAAQ,CAACH,IAAKC,CAAAA,IAAI,CAAC,CAAE,CAAA,CAAA;AAE5E,CAAA;AAEA;AACA;AACA,MAAMG,sBAAsB,CAACJ,IAAAA,GAAAA;;AAE3B,IAAA,IAAI,OAAWA,IAAAA,IAAAA,IAAQK,QAASL,CAAAA,IAAAA,CAAKM,KAAK,CAAG,EAAA;QAC3C,MAAMC,IAAAA,GAAQP,IAAMM,EAAA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