{"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/zod/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n                       ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website:                  https://stormsoftware.com\n Repository:               https://github.com/storm-software/stryke\n Documentation:            https://docs.stormsoftware.com/projects/stryke\n Contact:                  https://stormsoftware.com/contact\n\n SPDX-License-Identifier:  Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ConnectorType, DMMF } from \"@prisma/generator-helper\";\nimport type { Writeable } from \"../types\";\nimport { addMissingInputObjectTypesForAggregate } from \"./aggregate-helpers\";\nimport { addMissingInputObjectTypesForInclude } from \"./include-helpers\";\nimport { addMissingInputObjectTypesForModelArgs } from \"./modelArgs-helpers\";\nimport { addMissingInputObjectTypesForMongoDbRawOpsAndQueries } from \"./mongodb-helpers\";\nimport { addMissingInputObjectTypesForSelect } from \"./select-helpers\";\nimport Transformer from \"./transformer\";\nimport { changeOptionalToRequiredFields } from \"./whereUniqueInput-helpers\";\n\ninterface AddMissingInputObjectTypeOptions {\n  isGenerateSelect: boolean;\n  isGenerateInclude: boolean;\n}\n\nexport function addMissingZodInputObjectTypes(\n  inputObjectTypes: DMMF.InputType[],\n  outputObjectTypes: DMMF.OutputType[],\n  models: DMMF.Model[],\n  modelOperations: DMMF.ModelMapping[],\n  dataSourceProvider: ConnectorType,\n  options: AddMissingInputObjectTypeOptions\n) {\n  // TODO: remove once Prisma fix this issue: https://github.com/prisma/prisma/issues/14900\n  if (dataSourceProvider === \"mongodb\") {\n    addMissingInputObjectTypesForMongoDbRawOpsAndQueries(\n      modelOperations,\n      outputObjectTypes,\n      inputObjectTypes\n    );\n  }\n  addMissingInputObjectTypesForAggregate(inputObjectTypes, outputObjectTypes);\n  if (options.isGenerateSelect) {\n    addMissingInputObjectTypesForSelect(\n      inputObjectTypes,\n      outputObjectTypes,\n      models\n    );\n    Transformer.setIsGenerateSelect(true);\n  }\n  if (options.isGenerateSelect || options.isGenerateInclude) {\n    addMissingInputObjectTypesForModelArgs(\n      inputObjectTypes,\n      models,\n      options.isGenerateSelect,\n      options.isGenerateInclude\n    );\n  }\n  if (options.isGenerateInclude) {\n    addMissingInputObjectTypesForInclude(\n      inputObjectTypes,\n      models,\n      options.isGenerateSelect\n    );\n    Transformer.setIsGenerateInclude(true);\n  }\n\n  changeOptionalToRequiredFields(\n    inputObjectTypes as Writeable<DMMF.InputType[]>\n  );\n}\n"],"mappings":";;;;;;;;;AAiCA,SAAgB,8BACd,kBACA,mBACA,QACA,iBACA,oBACA,SACA;AAEA,KAAI,uBAAuB,UACzB,sDACE,iBACA,mBACA,iBACD;AAEH,wCAAuC,kBAAkB,kBAAkB;AAC3E,KAAI,QAAQ,kBAAkB;AAC5B,sCACE,kBACA,mBACA,OACD;AACD,cAAY,oBAAoB,KAAK;;AAEvC,KAAI,QAAQ,oBAAoB,QAAQ,kBACtC,wCACE,kBACA,QACA,QAAQ,kBACR,QAAQ,kBACT;AAEH,KAAI,QAAQ,mBAAmB;AAC7B,uCACE,kBACA,QACA,QAAQ,iBACT;AACD,cAAY,qBAAqB,KAAK;;AAGxC,gCACE,iBACD"}