Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
1.7 KiB
Plaintext
1 line
1.7 KiB
Plaintext
{"version":3,"sources":["../../src/utilities/getCollectionIDFieldTypes.ts"],"sourcesContent":["import type { SanitizedConfig } from '../config/types.js'\n\n/**\n * While the default ID is determined by the db adapter, it can still differ for a collection if they\n * define a custom ID field. This builds a map of collection slugs to their ID field type.\n * @param defaultIDType as defined by the database adapter\n */\nexport function getCollectionIDFieldTypes({\n config,\n defaultIDType,\n}: {\n config: SanitizedConfig\n defaultIDType: 'number' | 'text'\n}): { [key: string]: 'number' | 'string' } {\n return config.collections.reduce(\n (acc, collection) => {\n const customCollectionIdField = collection.fields.find(\n (field) => 'name' in field && field.name === 'id',\n )\n\n acc[collection.slug] = defaultIDType === 'text' ? 'string' : 'number'\n\n if (customCollectionIdField) {\n acc[collection.slug] = customCollectionIdField.type === 'number' ? 'number' : 'string'\n }\n\n return acc\n },\n {} as Record<string, 'number' | 'string'>,\n )\n}\n"],"names":["getCollectionIDFieldTypes","config","defaultIDType","collections","reduce","acc","collection","customCollectionIdField","fields","find","field","name","slug","type"],"mappings":"AAEA;;;;CAIC,GACD,OAAO,SAASA,0BAA0B,EACxCC,MAAM,EACNC,aAAa,EAId;IACC,OAAOD,OAAOE,WAAW,CAACC,MAAM,CAC9B,CAACC,KAAKC;QACJ,MAAMC,0BAA0BD,WAAWE,MAAM,CAACC,IAAI,CACpD,CAACC,QAAU,UAAUA,SAASA,MAAMC,IAAI,KAAK;QAG/CN,GAAG,CAACC,WAAWM,IAAI,CAAC,GAAGV,kBAAkB,SAAS,WAAW;QAE7D,IAAIK,yBAAyB;YAC3BF,GAAG,CAACC,WAAWM,IAAI,CAAC,GAAGL,wBAAwBM,IAAI,KAAK,WAAW,WAAW;QAChF;QAEA,OAAOR;IACT,GACA,CAAC;AAEL"} |