{"version":3,"file":"diff.cjs","names":[],"sources":["../../../../src/rest/commands/schema/diff.ts"],"sourcesContent":["import type { RestCommand } from '../../types.js';\nimport type { SchemaSnapshotOutput } from './snapshot.js';\n\n// TODO improve typing\nexport type SchemaDiffOutput = {\n\thash: string;\n\tdiff: Record<string, any>;\n};\n\nexport type SchemaDiffMode = 'merge' | 'mirror';\n\nexport type SchemaDiffOptions = {\n\tforce?: boolean;\n\tmode?: SchemaDiffMode;\n};\n\n/**\n * Compare the current instance's schema against the schema snapshot in JSON request body and retrieve the difference. This endpoint is only available to admin users.\n * @param snapshot JSON object containing collections, fields, and relations to apply.\n * @param options Optional diff settings.\n * @param options.force Bypass version and database vendor restrictions.\n * @param options.mode `mirror` (default) returns all operations; `merge` excludes deletions for an additive diff.\n * @returns Returns the differences between the current instance's schema and the schema passed in the request body.\n */\nexport const schemaDiff =\n\t<Schema>(snapshot: SchemaSnapshotOutput, options: SchemaDiffOptions = {}): RestCommand<SchemaDiffOutput, Schema> =>\n\t() => {\n\t\treturn {\n\t\t\tmethod: 'POST',\n\t\t\tpath: '/schema/diff',\n\t\t\tparams: options,\n\t\t\tbody: JSON.stringify(snapshot),\n\t\t};\n\t};\n"],"mappings":"AAwBA,MAAa,GACH,EAAgC,EAA6B,EAAE,QAEhE,CACN,OAAQ,OACR,KAAM,eACN,OAAQ,EACR,KAAM,KAAK,UAAU,EAAS,CAC9B"}