@strapi/database 5.5.2 → 5.6.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.
@@ -0,0 +1,6 @@
1
+ import type { Database } from '..';
2
+ export declare const createRepairManager: (db: Database) => {
3
+ removeOrphanMorphType: (arg: import("./operations/remove-orphan-morph-types").RemoveOrphanMorphTypeOptions) => Promise<void>;
4
+ };
5
+ export type RepairManager = ReturnType<typeof createRepairManager>;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repairs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAInC,eAAO,MAAM,mBAAmB,OAAQ,QAAQ;;CAI/C,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { Database } from '../..';
2
+ export interface RemoveOrphanMorphTypeOptions {
3
+ pivot: string;
4
+ }
5
+ /**
6
+ * Removes morph relation data with invalid or non-existent morph type.
7
+ *
8
+ * This function iterates over the database metadata to identify morph relationships
9
+ * (relations with a `joinTable` containing the specified pivot column) and removes
10
+ * any entries in the relation's join table where the morph type is invalid.
11
+ *
12
+ * Note: This function does not check for orphaned IDs, only orphaned morph types.
13
+ *
14
+ * @param db - The database object containing metadata and a Knex connection.
15
+ * @param options.pivot - The name of the column in the join table representing the morph type.
16
+ */
17
+ export declare const removeOrphanMorphType: (db: Database, { pivot }: RemoveOrphanMorphTypeOptions) => Promise<void>;
18
+ //# sourceMappingURL=remove-orphan-morph-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-orphan-morph-types.d.ts","sourceRoot":"","sources":["../../../src/repairs/operations/remove-orphan-morph-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf;AA0BD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,OAC5B,QAAQ,aACD,4BAA4B,kBA2CxC,CAAC"}
@@ -1,15 +1,15 @@
1
1
  import createSchemaBuilder from './builder';
2
2
  import createSchemaDiff from './diff';
3
3
  import createSchemaStorage from './storage';
4
- import type { Schema } from './types';
4
+ import type { Schema, SchemaDiff } from './types';
5
5
  import type { Database } from '..';
6
6
  export type * from './types';
7
7
  export interface SchemaProvider {
8
8
  builder: ReturnType<typeof createSchemaBuilder>;
9
9
  schemaDiff: ReturnType<typeof createSchemaDiff>;
10
10
  schemaStorage: ReturnType<typeof createSchemaStorage>;
11
- sync(): Promise<void>;
12
- syncSchema(): Promise<void>;
11
+ sync(): Promise<SchemaDiff['status']>;
12
+ syncSchema(): Promise<SchemaDiff['status']>;
13
13
  reset(): Promise<void>;
14
14
  create(): Promise<void>;
15
15
  drop(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAEA,OAAO,mBAAmB,MAAM,WAAW,CAAC;AAC5C,OAAO,gBAAgB,MAAM,QAAQ,CAAC;AACtC,OAAO,mBAAmB,MAAM,WAAW,CAAC;AAG5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAEnC,mBAAmB,SAAS,CAAC;AAI7B,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;IAChD,UAAU,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;IAChD,aAAa,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;IACtD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,UAAU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internal
3
+ */
4
+ export declare const asyncCurry: <Args extends any[], R>(fn: (...args: Args) => Promise<R>) => CurriedAsyncFunction<Args, R>;
5
+ /**
6
+ * @internal
7
+ */
8
+ export type CurriedAsyncFunction<Args extends any[], R> = Args extends [infer First, ...infer Rest] ? Rest extends [] ? (arg: First) => Promise<R> : (arg: First) => CurriedAsyncFunction<Rest, R> : () => Promise<R>;
9
+ //# sourceMappingURL=async-curry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-curry.d.ts","sourceRoot":"","sources":["../../src/utils/async-curry.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,UAAU,8BACjB,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,KAChC,qBAAqB,IAAI,EAAE,CAAC,CAS9B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,IAAI,SAAS,GAAG,EAAE,EAAE,CAAC,IAAI,IAAI,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GAC/F,IAAI,SAAS,EAAE,GACb,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,GAC1B,CAAC,GAAG,EAAE,KAAK,KAAK,oBAAoB,CAAC,IAAI,EAAE,CAAC,CAAC,GAC/C,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/database",
3
- "version": "5.5.2",
3
+ "version": "5.6.0",
4
4
  "description": "Strapi's database layer",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@paralleldrive/cuid2": "2.2.2",
43
- "@strapi/utils": "5.5.2",
43
+ "@strapi/utils": "5.6.0",
44
44
  "ajv": "8.16.0",
45
45
  "date-fns": "2.30.0",
46
46
  "debug": "4.3.4",
@@ -53,8 +53,8 @@
53
53
  "devDependencies": {
54
54
  "@strapi/pack-up": "5.0.2",
55
55
  "@types/fs-extra": "11.0.4",
56
- "eslint-config-custom": "5.5.2",
57
- "tsconfig": "5.5.2"
56
+ "eslint-config-custom": "5.6.0",
57
+ "tsconfig": "5.6.0"
58
58
  },
59
59
  "engines": {
60
60
  "node": ">=18.0.0 <=22.x.x",