@griddo/core 11.0.18 → 11.0.19

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.
Files changed (49) hide show
  1. package/dist/autotypes-legacy.js +2 -0
  2. package/dist/autotypes-legacy.js.map +1 -0
  3. package/dist/autotypes.js +1 -1
  4. package/dist/autotypes.js.map +1 -1
  5. package/dist/functions/autotypes/factories/index.d.ts +18 -0
  6. package/dist/functions/autotypes/factories/names/getComponents.d.ts +2 -0
  7. package/dist/functions/autotypes/factories/names/getDetailTemplates.d.ts +2 -0
  8. package/dist/functions/autotypes/factories/names/getModules.d.ts +2 -0
  9. package/dist/functions/autotypes/factories/names/getPageData.d.ts +2 -0
  10. package/dist/functions/autotypes/factories/names/getSimpleData.d.ts +2 -0
  11. package/dist/functions/autotypes/factories/names/getTaxonomy.d.ts +2 -0
  12. package/dist/functions/autotypes/factories/names/getTemplates.d.ts +2 -0
  13. package/dist/functions/autotypes/factories/props/getPageData.d.ts +2 -0
  14. package/dist/functions/autotypes/factories/props/getSectionList.d.ts +8 -0
  15. package/dist/functions/autotypes/factories/props/getSimpleData.d.ts +2 -0
  16. package/dist/functions/autotypes/factories/props/getTaxonomyData.d.ts +2 -0
  17. package/dist/functions/autotypes/factories/props/getTypeFromField/index.d.ts +22 -0
  18. package/dist/functions/autotypes/factories/props/getTypeFromField/utils.d.ts +41 -0
  19. package/dist/functions/autotypes/factories/props/getUIAndData/index.d.ts +2 -0
  20. package/dist/functions/autotypes/factories/props/getUIAndData/utils.d.ts +39 -0
  21. package/dist/functions/autotypes/factories/schemas/getDataPacks.d.ts +5 -0
  22. package/dist/functions/autotypes/factories/schemas/getLanguages.d.ts +2 -0
  23. package/dist/functions/autotypes/factories/schemas/getMenuItems/index.d.ts +2 -0
  24. package/dist/functions/autotypes/factories/schemas/getMenuItems/utils.d.ts +3 -0
  25. package/dist/functions/autotypes/factories/schemas/getModuleCategories.d.ts +14 -0
  26. package/dist/functions/autotypes/factories/schemas/getThemes.d.ts +5 -0
  27. package/dist/functions/autotypes/index.d.ts +2 -1
  28. package/dist/functions/autotypes/misc/ascii.d.ts +3 -0
  29. package/dist/functions/autotypes/misc/types.d.ts +55 -0
  30. package/dist/functions/autotypes/misc/utils.d.ts +17 -0
  31. package/dist/functions/autotypes-legacy/index.d.ts +1 -0
  32. package/dist/functions/react-svg-library/utils.d.ts +5 -0
  33. package/dist/react-svg-library.js.map +1 -1
  34. package/dist/types/core/index.d.ts +1 -1
  35. package/dist/types/schemas/AutoTypes.d.ts +3 -3
  36. package/dist/types/schemas/HeaderFooter.d.ts +4 -4
  37. package/dist/types/schemas/UI.d.ts +8 -8
  38. package/dist/types/schemas/base.d.ts +1 -1
  39. package/dist/types/schemas/index.d.ts +2 -2
  40. package/package.json +3 -2
  41. /package/dist/functions/{autotypes → autotypes-legacy}/ascii.d.ts +0 -0
  42. /package/dist/functions/{autotypes → autotypes-legacy}/constants.d.ts +0 -0
  43. /package/dist/functions/{autotypes → autotypes-legacy}/getMenuItemsProps.d.ts +0 -0
  44. /package/dist/functions/{autotypes → autotypes-legacy}/getTypeFromField.d.ts +0 -0
  45. /package/dist/functions/{autotypes → autotypes-legacy}/getTypesFromSchemas.d.ts +0 -0
  46. /package/dist/functions/{autotypes → autotypes-legacy}/index.cjs.d.ts +0 -0
  47. /package/dist/functions/{autotypes → autotypes-legacy}/main.d.ts +0 -0
  48. /package/dist/functions/{autotypes → autotypes-legacy}/types.d.ts +0 -0
  49. /package/dist/functions/{autotypes → autotypes-legacy}/utils.d.ts +0 -0
@@ -0,0 +1,2 @@
1
+ import e from"path";import{writeFile as t}from"fs";import n from"prettier";import o from"node:path";import{fileURLToPath as i}from"node:url";import r from"node:process";import s from"node:fs";function l(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,l)}a((o=o.apply(e,t||[])).next())}))}const a="/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-use-before-define */\n//\n//\n// ' ____\n// /\\ \\\n// º / /\\ \\\n// ' / / \\ _>\n// ' _\\ \\__> \\__\n// ' O ( __;·;______ ) AutoTypes\n// O º, | , , \\ \\\\ ·..~~.·~.·\n// ,,, /| , , /\\ <\\\\\n// \\''\\-' ⎩, <\\/\\ \\ \\\n// \\_/ /\\_____⎩/ > > >\n// '___' <_(_)__> / \\ <\n// / / ´ \\ | \\___//\\\\\n// / / | / > > \\\\\n// · ··~~~~·~·~~~~~~~·~··~~~~~·~·~~·~~~~·~~~~~·· · ·\n//\n// Embrace the beauty of effortless typing by indulging in the benefits of them\n// sans the actual typing!\n//\n// Behold! These dynamically generated types were conjured from the schemas\n// nestled within this repository. However, should you yearn to expand upon\n// these types, kindly abstain from doing so in this file, lest AutoTypes'\n// magic shall smite your changes with each schema modification.\n//\n// Check out the details of Griddo AutoTypes in:\n// https://griddoio.notion.site/Griddo-AutoTypes-e7420867dd2e489c8da34a493b763cd8>\n//\n// Happy magic types!\n//\nimport { Core, Fields, Hideable, NonEmptyArray } from \"@griddo/core\"\n//\n",p="autotypes.d.ts",c="Props",u="ContentType",d="List",m=/[\p{Lu}]/u,y=/[\p{Ll}]/u,f=/^[\p{Lu}](?![\p{Lu}])/gu,g=/([\p{Alpha}\p{N}_]|$)/u,h=/[_.\- ]+/,$=new RegExp("^"+h.source),F=new RegExp(h.source+g.source,"gu"),T=new RegExp("\\d+"+g.source,"gu"),C=(e,t,n,o)=>{let i=!1,r=!1,s=!1,l=!1;for(let a=0;a<e.length;a++){const p=e[a];l=!(a>2)||"-"===e[a-3],i&&m.test(p)?(e=e.slice(0,a)+"-"+e.slice(a),i=!1,s=r,r=!0,a++):r&&s&&y.test(p)&&(!l||o)?(e=e.slice(0,a-1)+"-"+e.slice(a-1),s=r,r=!1,i=!0):(i=t(p)===p&&n(p)!==p,s=r,r=n(p)===p&&t(p)!==p)}return e},v=(e,t)=>(f.lastIndex=0,e.replaceAll(f,(e=>t(e)))),b=(e,t)=>(F.lastIndex=0,T.lastIndex=0,e.replaceAll(T,((n,o,i)=>["_","-"].includes(e.charAt(i+n.length))?n:t(n))).replaceAll(F,((e,n)=>t(n))));const j={directory:"isDirectory",file:"isFile"};const k=(e,t)=>t[j[e]](),_=e=>e instanceof URL?i(e):e;function x(e,{cwd:t=r.cwd(),type:n="file",allowSymlinks:i=!0}={}){!function(e){if(!Object.hasOwnProperty.call(j,e))throw new Error(`Invalid type specified: ${e}`)}(n),t=_(t);const l=i?s.statSync:s.lstatSync;for(const i of e)try{const e=l(o.resolve(t,i),{throwIfNoEntry:!1});if(!e)continue;if(k(n,e))return i}catch{}}const S=e=>e instanceof URL?i(e):e,A=Symbol("findUpStop");function w(e,t={}){const n=function(e,t={}){let n=o.resolve(S(t.cwd)||"");const{root:i}=o.parse(n),r=t.stopAt||i,s=t.limit||Number.POSITIVE_INFINITY,l=[e].flat(),a=t=>{if("function"!=typeof e)return x(l,t);const n=e(t.cwd);return"string"==typeof n?x([n],t):n},p=[];for(;;){const e=a({...t,cwd:n});if(e===A)break;if(e&&p.push(o.resolve(n,e)),n===r||p.length>=s)break;n=o.dirname(n)}return p}(e,{...t,limit:1});return n[0]}function D(e,t){var n;const{returnTypeName:o,generic:i}=t||{},r="hideable"in e&&Boolean(e.hideable),s=i?`<${i}>`:"",l=`${o||P(e.type)}${s}`,a=r?`Hideable<${l}>`:`${l}`;return`\n\t\t${(null===(n=e._autoType)||void 0===n?void 0:n.doc)||""}\n\t\t${`${e.key}?: ${a}`}\n\t`}function L(e,t){const n=(null==t?void 0:t.interfaceSuffix)||c;return e.length>1?`{\n\t\t\t${e.map((e=>`${function(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},0===(e=Array.isArray(e)?e.map((e=>e.trim())).filter((e=>e.length)).join("-"):e.trim()).length)return"";const n=!1===t.locale?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t.locale),o=!1===t.locale?e=>e.toUpperCase():e=>e.toLocaleUpperCase(t.locale);return 1===e.length?h.test(e)?"":t.pascalCase?o(e):n(e):(e!==n(e)&&(e=C(e,n,o,t.preserveConsecutiveUppercase)),e=e.replace($,""),e=t.preserveConsecutiveUppercase?v(e,n):n(e),t.pascalCase&&(e=o(e.charAt(0))+e.slice(1)),b(e,o))}(e)}?: ${e}${n}`)).join(",")}\n\t\t\t}`:e.map((e=>`${e}${n}`)).join("")}function P(e){return{ArrayFieldGroup:"Fields.ArrayFieldGroup",AsyncCheckGroup:"Fields.AsyncCheckGroup",AsyncSelect:"Fields.AsyncSelect",CheckGroup:"Fields.CheckGroup",ColorPicker:"Fields.ColorPicker",ComponentArray:"Fields.ComponentArray",ComponentContainer:"Fields.ComponentContainer",ConditionalField:"Fields.Conditional",DateField:"Fields.Date",FieldGroup:"Fields.FieldGroup",FieldsDivider:"Fields.FieldsDivider",FileField:"Fields.File",HeadingField:"Fields.Heading",ImageField:"Fields.Image",LinkField:"Fields.Link",MultiCheckSelect:"Fields.MultiCheckSelect",MultiCheckSelectGroup:"Fields.MultiCheckSelectGroup",NoteField:"Fields.Note",NumberField:"Fields.Number",RadioGroup:"Fields.RadioGroup",ReferenceField:"Fields.Reference",RichText:"Fields.RichText",Select:"Fields.Select",SliderField:"Fields.Slider",TagsField:"Fields.Tags",TextArea:"Fields.TextArea",TextField:"Fields.Text",TimeField:"Fields.Time",ToggleField:"Fields.Toggle",UniqueCheck:"Fields.UniqueCheck",UrlField:"Fields.Url",VisualUniqueSelection:"Fields.VisualUniqueSelection",Wysiwyg:"Fields.Wysiwyg"}[e]}const I=__dirname.includes("node_modules");function G(){const t=__dirname,n=I?"../../../":"../griddo-components";return e.resolve(function({cwd:e}={}){const t=w("package.json",{cwd:e});return t&&o.dirname(t)}({cwd:t}),n)}function M(e,t,n,o){var i,r;const s=(null==o?void 0:o.interfaceSuffix)||c;if("FieldsDivider"===e.type)return"// FieldsDivider";if(null===(i=e._autoType)||void 0===i?void 0:i.ignore)return"// Ignored by AutoType.ignore";const{type:l,_autoType:a,key:p}=e,{hasDistributorData:u,getStaticData:d}=n;if(!l||!p)return"\n\t\t\t/** · (ノ-_-)ノ ミ ┴┴ You forgot to write the `type` | `key` or some mandatory prop */\n\t\t";if("DateField"===l||"FileField"===l||"ImageField"===l||"NoteField"===l||"NumberField"===l||"RichText"===l||"SliderField"===l||"TagsField"===l||"TextArea"===l||"TextField"===l||"TimeField"===l||"ToggleField"===l||"UniqueCheck"===l||"UrlField"===l||"Wysiwyg"===l)return D(e);if("MultiCheckSelect"===l){if("pageContentType"===t||"simpleContentType"===t){return D(e,{generic:`Relations, FromList, ${`${e.source}ContentTypeProps`}<false, false>, FromDistributor`})}return D(e,{generic:"true"})}if("AsyncCheckGroup"===l){if("pageContentType"===t||"simpleContentType"===t){return D(e,{generic:`Relations, FromList, ${`${e.source}ContentTypeProps`}<false, false>, FromDistributor`})}return D(e,{generic:"true"})}if("MultiCheckSelectGroup"===l){const t=e.elements.map((e=>`"${e.key}"`)).join("|");return D(e,{generic:[t,null===(r=e._autoType)||void 0===r?void 0:r.relations].join(",")})}if("ColorPicker"===l)return e.isThemePalette?D(e,{returnTypeName:"Fields.ColorPickerFixed"}):D(e);if("HeadingField"===l||"RadioGroup"===l||"Select"===l){const{options:t}=e,n=function(e){return e.map((({value:e})=>"string"==typeof e?`"${e}"`:e)).join("|")}(t);return D(e,{generic:n})}if("CheckGroup"===l){const{options:t}=e,n=function(e){return e.map((({name:e})=>"string"==typeof e?`"${e}"`:e)).join("|")}(t);return D(e,{generic:n})}if("LinkField"===l){const{whiteList:t}=e;return D(e,{generic:L(t,o)})}if("AsyncSelect"===l){if("entity"in e&&"menu_containers"===e.entity)return`\n${p}?: Menu`;if("pageContentType"===t||"simpleContentType"===t){return D(e,{generic:`Relations, FromList, ${`${e.source}ContentTypeProps`}<false, false>, FromDistributor`})}return`\n${p}?: Fields.AsyncSelect;`}if("FieldGroup"===l)return`\n\t\t\t// << ${l}\n\t\t\t${e.fields.map((e=>M(e,t,n))).join("")}\n\t\t\t// end >>\n\t\t`;if("ArrayFieldGroup"===l){return`\n\t\t\t\n${(null==a?void 0:a.doc)||""}\n${p}?: Fields.ArrayFieldGroup<{${e.fields.map((e=>M(e,t,n))).join(",")}}>\n\t\t`}if("ConditionalField"===l){const o=e.fields.map((e=>M(e,t,n))),i=(null==a?void 0:a.doc)||"",r="hideable"in e&&e.hideable,s=r?">":"";return`\n\t\t\t// << ${l}\n\t\t\t\n${i}\n${p}?: ${r?"Hideable<":""}${P(l)}<${e.options.map((e=>"string"==typeof e.value?`"${e.value}"`:e.value)).join("|")}>${s};\n\t\t\t${o.join("")}\n\t\t\t// end >>\n\t\t`}if("ComponentArray"===l){const o="template"===t||"pageContentType"===t?"TemplateSection":"ComponentArray",i="template"===t?"":"?",r=e,{key:l,_autoType:a,whiteList:p}=r,c=(null==a?void 0:a.doc)||"",u=(e,t,n)=>e.filter((e=>{if(e&&"schemaType"in e&&"module"===(null==e?void 0:e.schemaType))return(null==e?void 0:e.sectionList)&&!!(null==e?void 0:e.sectionList[t])})).map((e=>({t:null==e?void 0:e.sectionList[t].filter((e=>e===n)),m:null==e?void 0:e.component}))).filter((e=>{var t;return null===(t=null==e?void 0:e.t)||void 0===t?void 0:t.length})).map((e=>null==e?void 0:e.m)).filter(Boolean);let d="";"template"===t&&(d=u(n.moduleSchemas,n.schema.component,l).join("|"));return`\n${c}\n${l}${i}: Fields.${o}<${[...new Set([...d.split("|"),...p])].filter(Boolean).map((e=>`${e}${s}`)).join("|")}>;`}if("ComponentContainer"===l&&("object"===t||"component"===t||"module"===t||"template"===t||"pageContentType"===t)){const t=e,{whiteList:n}=t;return D(e,{generic:L(n,o)})}if("ReferenceField"===l){const t=e.sources||[{structuredData:void 0}],n=Array.isArray(t)&&t.map((e=>e.structuredData?`${e.structuredData}ContentType${s}`:"unknown")).join("|")||"";return`\n\t\t \t${D(e,{generic:n})}\n\t\t \t${u||d?`queriedItems?: Fields.QueriedData<${n}>;`:""}\n\t\t `}if("VisualUniqueSelection"===l){const t=e.options[0],n=e.options[0];let o="";if(t.value){o=e.options.map((e=>`"${e.value}"`)).join("|")}if(n.theme){o=e.options[0].options.map((e=>`"${e.value}"`)).join("|")}return D(e,{generic:o})}return console.warn(`The field ${e.type} has not been implemented yet ㅠ.ㅠ`),""}function R(e){return e?e.map((e=>M(e,"object",{hasDistributorData:!1,getStaticData:!1,moduleSchemas:[],schema:{}}))).join(""):""}function E(e,t){const n=(null==t?void 0:t.contentTypeSuffix)||u,o=(null==t?void 0:t.interfaceSuffix)||c,i=(null==t?void 0:t.publicApiSuffix)||d,r=[],s=[],l=[];return`\n${e.map((t=>{var a;let p,c="",u="",d="",m="",y="",f="",g=!1,h=!1,$="";const{component:F}=t;f=(null===(a=t._autoType)||void 0===a?void 0:a.relations)||!1?"<Relations = unknown, FromList = unknown, FromDistributor = true>":"";const T=e.map((e=>{if("schemaType"in e&&"module"===e.schemaType)return e})).filter(Boolean);if("fromPage"in t){if(p=t.fromPage?"pageContentType":"simpleContentType",c=n,u=`__contentTypeName: "${t.component}";`,d=`__contentTypeKind: "${p}";`,"pageContentType"===p&&r.push(`"${t.component}"`),"simpleContentType"!==p||t.taxonomy||s.push(`"${t.component}"`),"simpleContentType"===p&&t.taxonomy&&l.push(`"${t.component}"`),"schema"in t){const e=t.schema.fields.map((e=>"source"in e&&(null==e?void 0:e.source))).filter(Boolean);m=e.length?`__relatedContentTypeNames: ${JSON.stringify(e)}`:""}f="<Relations = unknown, FromList = unknown, FromDistributor = true>",$=`\n\t\t\t\t/** Type to be consumed by public API: useList(), etc.. */\n\t\t\t\texport type ${F}${c}${i}${o}<R extends Core.ContentTypeRelations = false> = ${F}${c}${o}<R, true>;\n\t\t\t\t`}"schemaType"in t&&(p=t.schemaType,y=`component: "${F}";`,"template"!==t.schemaType&&"module"!==t.schemaType&&"component"!==t.schemaType||(g=t.default.hasDistributorData,h=t.default.getStaticData));const C="fromPage"in t&&!1===t.fromPage&&!0===t.taxonomy,v="schemaType"in t&&"template"===t.schemaType&&("list"===t.type.mode||"paginated-data"===t.type.mode),b=(j=[v?"Fields.ExtraListTemplateProps":""]).filter((e=>e.length)).length<1?"":`extends ${j.join(", ")}`;var j;const k=function(e){if("fromPage"in e)return e.taxonomy?[]:e.schema.fields;if("template"===e.schemaType)return[...e.content||[],...e.config||[]];if("component"===e.schemaType||"module"===e.schemaType)return e.configTabs.flatMap((e=>e.fields));throw new Error(`Wrong schema ${JSON.stringify(e,null,2)}`)}(t).map((e=>M(e,p,{hasDistributorData:g,getStaticData:h,moduleSchemas:T,schema:t}))).filter(Boolean).join("");return`\n\t\t\t\texport interface ${F}${c}${o}${f} ${b} {\n\t\t\t\t\t${u}\n\t\t\t\t\t${d}\n\t\t\t\t\t${m}\n\t\t\t\t\t${y}\n\t\t\t\t\t${k}\n\t\t\t\t\t${C?"title?: string; code?: string":""}\n\t\t\t\t}\n\t\t\t\t${$}\n\t\t\t\t`})).join("")}\n${r&&r.length?`export type PageContentTypes = ${r.join("|")};`:""}\n${s&&s.length?`export type SimpleContentTypes = ${s.join("|")};`:""}\n${l&&l.length?`export type TaxonomyContentTypes = ${l.join("|")};`:""}\n`}const O=e.join(G(),"griddo.config.ts"),N=require(O);!function(o,i,r,s,c,u,d,m,y){var f,g;l(this,void 0,void 0,(function*(){const l=p,h=($=o,Object.keys($).map((e=>Object.assign(Object.assign({},$[e]),{component:e}))));var $;const F=function(e){const t=[],n=[],o=[],i=[];for(let r=e.length,s=0;s<r;++s){const r=e[s];if("component"in r){const e=r.component;"component"===r.schemaType&&t.push(`"${e}"`),"module"===r.schemaType&&n.push(`"${e}"`),"template"===r.schemaType&&(o.push(`"${e}"`),"detail"===r.type.mode&&i.push(`"${e}"`))}}return`\n\t\t\n\t\texport type Components =\n\t\t\t${t.join("|")}\n\t\n\t\t\n\t\texport type Modules =\n\t\t\t${n.join("|")}\n\t\n\t\t\n\t\texport type Templates =\n\t\t\t${o.join("|")}\n\t\n\t\t\n\t\texport type DetailTemplates =\n\t\t\t${i.join("|")}\n\t\n\t`}(h),T=function(e){return`export type SectionList = { ${e.filter((e=>"schemaType"in e&&"template"===e.schemaType)).map((e=>{const t=e,n=t.content.filter((e=>"ComponentArray"===e.type)).map((({key:e})=>`"${e}"`)).filter(Boolean);return n&&(null==n?void 0:n.length)>0?`${t.component}?: NonEmptyArray<${n.join("|")}>;`:""})).join("")} }`}(h),C=E(h,y),v=null===(f=null==i?void 0:i.link)||void 0===f?void 0:f.fields,b=null===(g=null==i?void 0:i.group)||void 0===g?void 0:g.fields,j=`\n\t\texport interface InstanceMenuItems {\n\t\t\tlink:{\n\t\t\t\t${R(v)}\n\t\t\t\tconfig?: {\n\t\t\t\t\theaderStyle?: string;\n\t\t\t\t\tfooterStyle?: string;\n\t\t\t\t\ttype?: "link";\n\t\t\t\t};\n\t\t\t};\n\t\t\tgroup: {\n\t\t\t\turl?: null;\n\t\t\t\t${R(b)}\n\t\t\t\tconfig?: {\n\t\t\t\t\theaderStyle?: string;\n\t\t\t\t\tfooterStyle?: string;\n\t\t\t\t\ttype?: "group";\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\t\texport type LinkMenuElement = Fields.BaseLinkElement<InstanceMenuItems> & InstanceMenuItems["link"];\n\t\texport type GroupMenuElement = Fields.BaseLinkElement<InstanceMenuItems> & InstanceMenuItems["group"];\n\t\texport type MenuElement = LinkMenuElement | GroupMenuElement;\n\t\texport type Menu = Fields.Menu<InstanceMenuItems>;\n\t`,k=`\n\t\t// Type for the language schema\n\t\texport interface SiteLanguage {\n\t\t\tdomain: { id: number; url: string; slug: string };\n\t\t\thome: string;\n\t\t\tid: number;\n\t\t\tisDefault: boolean;\n\t\t\tlabel: ${Object.keys(r).map((e=>`"${r[e].label}"`)).join("|")};\n\t\t\tlanguage: ${Object.keys(r).map((e=>`"${r[e].name}"`)).join("|")};\n\t\t\tlocale: ${Object.keys(r).map((e=>`"${e}"`)).join("|")};\n\t\t\tpath: string;\n\t\t}\n\t`,_=s?`type ModuleCategories = ${s.map((e=>`"${e.value}"`)).join("|")}`:"",x=c?`type Datapacks = ${Object.keys(c).map((e=>`"${e}"`)).join("|")}`:"",S=u?`type DatapacksCategories = ${Object.keys(u).map((e=>`"${e}"`)).join("|")}`:"",A=`type AllTaxonomyContentTypeProps = ${function(e){return e.map((e=>{if("taxonomy"in e&&e.taxonomy)return`${e.component||""}ContentTypeProps`})).filter(Boolean).join("|")}(h)}`,w=`type AllPageContentTypeProps = ${function(e){return e.map((e=>{if("fromPage"in e&&!e.fromPage&&!e.taxonomy)return`${e.component||""}ContentTypeProps`})).filter(Boolean).join("|")}(h)}`,D=`type AllSimpleContentTypeProps = ${function(e){return e.map((e=>{if("fromPage"in e&&e.fromPage)return`${e.component||""}ContentTypeProps`})).filter(Boolean).join("|")}(h)}`,L=d?`type Themes = ${d.map((e=>`"${e.value}"`)).join("|")}`:"",P=m?`type Subthemes = ${m.map((e=>`"${e}"`)).join("|")}`:"",I=yield n.resolveConfigFile(),M=(yield n.resolveConfig(I))||{useTabs:!0},O=`\n\t\t${a}\n\t\t${j}\n\t\t${k}\n\t\t${C}\n\t\t${F}\n\t\t${T}\n\t\t${_}\n\t\t${x}\n\t\t${S}\n\t\t${A}\n\t\t${w}\n\t\t${D}\n\t\t${L}\n\t\t${P}\n\t\t`,N=Object.assign(Object.assign({},M),{parser:"typescript"}),U=(yield n.format(O,N)).replace(/^\s*\n/gm,"");t(`${e.join(G(),l)}`,U,(e=>{if(e)throw e})),console.log("🤖 AutoTypes ✓")}))}(Object.assign(Object.assign(Object.assign({},N.schemas.all),N.schemas.templates),N.schemas.structuredData),N.schemas.menuItems,N.schemas.languages,N.moduleCategories,N.schemas.dataPacks,N.schemas.dataPacksCategories,N.themes,N.subthemes,N.autotypes);
2
+ //# sourceMappingURL=autotypes-legacy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autotypes-legacy.js","sources":["../../../node_modules/tslib/tslib.es6.js","../src/functions/autotypes-legacy/ascii.ts","../src/functions/autotypes-legacy/constants.ts","../node_modules/camelcase/index.js","../node_modules/locate-path/index.js","../node_modules/find-up/index.js","../src/functions/autotypes-legacy/utils.ts","../node_modules/pkg-dir/index.js","../src/functions/autotypes-legacy/getTypeFromField.ts","../src/functions/autotypes-legacy/getMenuItemsProps.ts","../src/functions/autotypes-legacy/getTypesFromSchemas.ts","../src/functions/autotypes-legacy/index.ts","../src/functions/autotypes-legacy/main.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/* eslint-disable no-useless-escape */\nconst HEAD_DESIGN = `/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-use-before-define */\n//\n//\n// ' ____\n// /\\\\ \\\\\n// º / /\\\\ \\\\\n// ' / / \\\\ _>\n// ' _\\\\ \\\\__> \\\\__\n// ' O ( __;·;______ ) AutoTypes\n// O º, | , , \\\\ \\\\\\\\ ·..~~.·~.·\n// ,,, /| , , /\\\\ <\\\\\\\\\n// \\\\''\\\\-' ⎩, <\\\\/\\\\ \\\\ \\\\\n// \\\\_/ /\\\\_____⎩/ > > >\n// '___' <_(_)__> / \\\\ <\n// / / ´ \\\\ | \\\\___//\\\\\\\\\n// / / | / > > \\\\\\\\\n// · ··~~~~·~·~~~~~~~·~··~~~~~·~·~~·~~~~·~~~~~·· · ·\n//\n// Embrace the beauty of effortless typing by indulging in the benefits of them\n// sans the actual typing!\n//\n// Behold! These dynamically generated types were conjured from the schemas\n// nestled within this repository. However, should you yearn to expand upon\n// these types, kindly abstain from doing so in this file, lest AutoTypes'\n// magic shall smite your changes with each schema modification.\n//\n// Check out the details of Griddo AutoTypes in:\n// https://griddoio.notion.site/Griddo-AutoTypes-e7420867dd2e489c8da34a493b763cd8>\n//\n// Happy magic types!\n//\nimport { Core, Fields, Hideable, NonEmptyArray } from \"@griddo/core\"\n//\n`;\n\nconst FOOTER_DESIGN = `\n//\n// . + . . . . . . . ..\n// . . . *\n// . * . . . . . . + . +\n// . . . . + . . .\n// . . . . . . .\n// . . . . . +. + . *\n// + . . . .\n// . . . * . . . . + . .\n// + . . . + . .\n// . . + .+. . .\n// . . . + . . . . .\n// . . . . . . . . ! / +\n// * . . . + . . - O -\n// . . . + . . * . . / | . .\n// . + . . . .. + .\n// . . . . * . * . +.. . * +\n// . . . . . . . . + . . +\n//\n//\n// The beauty of a living thing is not the atoms that go into it,\n// but the way those atoms are put together\n//\n// Carl Sagan\n//\n`;\n\nexport { FOOTER_DESIGN, HEAD_DESIGN };\n","const TYPE_FILE_NAME = \"autotypes.d.ts\";\nconst INTERFACE_SUFFIX = \"Props\";\nconst CONTENT_TYPE_SUFFIX = \"ContentType\";\nconst PUBLIC_API_SUFFIX = \"List\";\n\nexport {\n\tTYPE_FILE_NAME,\n\tINTERFACE_SUFFIX,\n\tCONTENT_TYPE_SUFFIX,\n\tPUBLIC_API_SUFFIX,\n};\n","const UPPERCASE = /[\\p{Lu}]/u;\nconst LOWERCASE = /[\\p{Ll}]/u;\nconst LEADING_CAPITAL = /^[\\p{Lu}](?![\\p{Lu}])/gu;\nconst IDENTIFIER = /([\\p{Alpha}\\p{N}_]|$)/u;\nconst SEPARATORS = /[_.\\- ]+/;\n\nconst LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);\nconst SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');\nconst NUMBERS_AND_IDENTIFIER = new RegExp('\\\\d+' + IDENTIFIER.source, 'gu');\n\nconst preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase) => {\n\tlet isLastCharLower = false;\n\tlet isLastCharUpper = false;\n\tlet isLastLastCharUpper = false;\n\tlet isLastLastCharPreserved = false;\n\n\tfor (let index = 0; index < string.length; index++) {\n\t\tconst character = string[index];\n\t\tisLastLastCharPreserved = index > 2 ? string[index - 3] === '-' : true;\n\n\t\tif (isLastCharLower && UPPERCASE.test(character)) {\n\t\t\tstring = string.slice(0, index) + '-' + string.slice(index);\n\t\t\tisLastCharLower = false;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = true;\n\t\t\tindex++;\n\t\t} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase)) {\n\t\t\tstring = string.slice(0, index - 1) + '-' + string.slice(index - 1);\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = false;\n\t\t\tisLastCharLower = true;\n\t\t} else {\n\t\t\tisLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;\n\t\t}\n\t}\n\n\treturn string;\n};\n\nconst preserveConsecutiveUppercase = (input, toLowerCase) => {\n\tLEADING_CAPITAL.lastIndex = 0;\n\n\treturn input.replaceAll(LEADING_CAPITAL, match => toLowerCase(match));\n};\n\nconst postProcess = (input, toUpperCase) => {\n\tSEPARATORS_AND_IDENTIFIER.lastIndex = 0;\n\tNUMBERS_AND_IDENTIFIER.lastIndex = 0;\n\n\treturn input\n\t\t.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ['_', '-'].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match))\n\t\t.replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));\n};\n\nexport default function camelCase(input, options) {\n\tif (!(typeof input === 'string' || Array.isArray(input))) {\n\t\tthrow new TypeError('Expected the input to be `string | string[]`');\n\t}\n\n\toptions = {\n\t\tpascalCase: false,\n\t\tpreserveConsecutiveUppercase: false,\n\t\t...options,\n\t};\n\n\tif (Array.isArray(input)) {\n\t\tinput = input.map(x => x.trim())\n\t\t\t.filter(x => x.length)\n\t\t\t.join('-');\n\t} else {\n\t\tinput = input.trim();\n\t}\n\n\tif (input.length === 0) {\n\t\treturn '';\n\t}\n\n\tconst toLowerCase = options.locale === false\n\t\t? string => string.toLowerCase()\n\t\t: string => string.toLocaleLowerCase(options.locale);\n\n\tconst toUpperCase = options.locale === false\n\t\t? string => string.toUpperCase()\n\t\t: string => string.toLocaleUpperCase(options.locale);\n\n\tif (input.length === 1) {\n\t\tif (SEPARATORS.test(input)) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn options.pascalCase ? toUpperCase(input) : toLowerCase(input);\n\t}\n\n\tconst hasUpperCase = input !== toLowerCase(input);\n\n\tif (hasUpperCase) {\n\t\tinput = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);\n\t}\n\n\tinput = input.replace(LEADING_SEPARATORS, '');\n\tinput = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);\n\n\tif (options.pascalCase) {\n\t\tinput = toUpperCase(input.charAt(0)) + input.slice(1);\n\t}\n\n\treturn postProcess(input, toUpperCase);\n}\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","import path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport {locatePath, locatePathSync} from 'locate-path';\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) || '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, options.stopAt || root);\n\tconst limit = options.limit || Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) || '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = options.stopAt || root;\n\tconst limit = options.limit || Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import type {\n\tFieldReturnTypes,\n\tFields,\n\tSchemaFieldTypes,\n\tSchemaType,\n\tSchemaTypeWithComponentProp,\n} from \"./types\";\nimport type { Schema } from \"../..\";\nimport type { UITemplateFields } from \"../../types/schema-fields/ui-template-fields\";\nimport type { AutoTypesConfig } from \"../../types/schemas/AutoTypes\";\n\nimport path from \"path\";\n\nimport camelcase from \"camelcase\";\nimport { packageDirectorySync } from \"pkg-dir\";\n\nimport { INTERFACE_SUFFIX } from \"./constants\";\n\n/** Get all fields from one schema */\nfunction getAllFields(schema: SchemaType) {\n\t// ContentType\n\t// Simple, Page\n\tif (\"fromPage\" in schema) {\n\t\t// AutoTypes doesn't generate types from categories\n\t\tif (!schema.taxonomy) {\n\t\t\treturn schema.schema.fields;\n\t\t}\n\t\t// hack???\n\t\treturn [];\n\t}\n\n\t// Templates\n\tif (schema.schemaType === \"template\") {\n\t\tconst content = (schema.content as Array<UITemplateFields>) || [];\n\t\tconst config = (schema.config as Array<UITemplateFields>) || [];\n\t\treturn [...content, ...config];\n\t}\n\n\t// Objects, components and modules\n\tif (schema.schemaType === \"component\" || schema.schemaType === \"module\") {\n\t\treturn schema.configTabs.flatMap((tab) => tab.fields);\n\t}\n\n\tthrow new Error(`Wrong schema ${JSON.stringify(schema, null, 2)}`);\n}\n\n/** Build a interface prop based on the field from the schema.\n * Optionally it can receives a custom value for the type and a generic string to use as generic value\n *\n * @example\n * getInterfacePropType(TextFieldObjectFromSchema)\n * // -> TextFieldObjectFromSchema.key: Fields.TextField\n * getInterfacePropType(TextFieldObjectFromSchema, 'MyCustomValue', 'foo')\n * // -> TextFieldObjectFromSchema.key: MyCustomValue<foo>\n */\ntype GetInterfacePropTypeOptions = {\n\treturnTypeName?: FieldReturnTypes;\n\tgeneric?: string;\n};\n\n/**\n * Return a serialized type from a Griddo schema field.\n *\n * @param Fields A Griddo field object\n * @param options An options object\n * @returns A string that represent a interface prop type.\n * @example\n * interface SomeInterface {\n * \tprop: boolean; // this function returns a string for this: `prop: boolean`\n * }\n */\nfunction getInterfacePropType(\n\tfield: Fields,\n\toptions?: GetInterfacePropTypeOptions,\n) {\n\tconst { returnTypeName, generic } = options || {};\n\n\t// The field has `hideable: true`\n\tconst hasHideable = \"hideable\" in field ? Boolean(field.hideable) : false;\n\t// Generic part\n\tconst genericStr = generic ? `<${generic}>` : \"\";\n\t// The field type is from field.type prop or custom\n\tconst returnTypeNameStr = returnTypeName || returnType(field.type);\n\t// Field type with generic: field<generic>\n\tconst returnTypeNameWithGeneriStr = `${returnTypeNameStr}${genericStr}`;\n\t// Field type wrapped in Hideable helper type: Hideable<field<generic>>\n\tconst typeWrappedWithHideable = hasHideable\n\t\t? `Hideable<${returnTypeNameWithGeneriStr}>`\n\t\t: `${returnTypeNameWithGeneriStr}`;\n\n\t// JSDoc\n\tconst jsDocString = field._autoType?.doc || \"\";\n\t// prop?: Type\n\tconst typeString = `${field.key}?: ${typeWrappedWithHideable}`;\n\n\treturn `\n\t\t${jsDocString}\n\t\t${typeString}\n\t`;\n}\n\n/**\n * Return a string separated by the pipe char \"|\" using the `value` from object array.\n */\nfunction getGenericFromOptions<T = unknown>(options: Array<{ value: T }>) {\n\treturn options\n\t\t.map(({ value }) => (typeof value === \"string\" ? `\"${value}\"` : value))\n\t\t.join(\"|\");\n}\n\n/**\n * Return a string separated by the pipe char \"|\" using the `name` from object array.\n */\nfunction getGenericFromCheckBoxOptions<T>(options: Array<{ name: T }>) {\n\treturn options\n\t\t.map(({ name }) => (typeof name === \"string\" ? `\"${name}\"` : name))\n\t\t.join(\"|\");\n}\n\n// for components containers\n// whitelist.length = 1\n// whitelist.length > 1\nfunction getGenericFromWhitelist(\n\twhiteList: Array<string>,\n\tconfig?: AutoTypesConfig,\n) {\n\t// Config\n\tconst interfaceSuffix = config?.interfaceSuffix || INTERFACE_SUFFIX;\n\n\tif (whiteList.length > 1) {\n\t\treturn `{\n\t\t\t${whiteList\n\t\t\t\t.map((whiteListItem) => {\n\t\t\t\t\treturn `${camelcase(\n\t\t\t\t\t\twhiteListItem,\n\t\t\t\t\t)}?: ${whiteListItem}${interfaceSuffix}`;\n\t\t\t\t})\n\t\t\t\t.join(\",\")}\n\t\t\t}`;\n\t}\n\n\t// Si solo hay un elemento\n\treturn whiteList.map((item) => `${item}${interfaceSuffix}`).join(\"\");\n}\n\n/**\n * Convert an object of schemas into an array of objects of these schemas.\n *\n * @example\n * input:\n * `schemas` is an object of schemas like so:\n *\t{\n *\t\tBasicContent: {\n *\t\t\tcomponent: \"BasicContent\",\n *\t\t\t...\n *\t\t},\n *\t\t...\n *\t}\n *\n * output:\n * [ {component: \"BasicContent\"}, {component: \"NewsTemplate\"}, ... ]\n */\nfunction schemasToArray(\n\tobjectSchemas: Record<string, SchemaType>,\n): Array<SchemaTypeWithComponentProp> {\n\treturn (Object.keys(objectSchemas) as Array<Capitalize<string>>).map(\n\t\t(componentName) => ({\n\t\t\t// This component prop is for the ContentType schemas,\n\t\t\t// ui schemas have already one.\n\t\t\t...objectSchemas[componentName],\n\t\t\tcomponent: componentName,\n\t\t}),\n\t);\n}\n\nfunction returnType(type: SchemaFieldTypes) {\n\tconst typeObj: Record<SchemaFieldTypes, FieldReturnTypes> = {\n\t\tArrayFieldGroup: \"Fields.ArrayFieldGroup\",\n\t\tAsyncCheckGroup: \"Fields.AsyncCheckGroup\",\n\t\tAsyncSelect: \"Fields.AsyncSelect\",\n\t\tCheckGroup: \"Fields.CheckGroup\",\n\t\tColorPicker: \"Fields.ColorPicker\",\n\t\tComponentArray: \"Fields.ComponentArray\",\n\t\tComponentContainer: \"Fields.ComponentContainer\",\n\t\tConditionalField: \"Fields.Conditional\",\n\t\tDateField: \"Fields.Date\",\n\t\tFieldGroup: \"Fields.FieldGroup\",\n\t\tFieldsDivider: \"Fields.FieldsDivider\",\n\t\tFileField: \"Fields.File\",\n\t\tHeadingField: \"Fields.Heading\",\n\t\tImageField: \"Fields.Image\",\n\t\tLinkField: \"Fields.Link\",\n\t\tMultiCheckSelect: \"Fields.MultiCheckSelect\",\n\t\tMultiCheckSelectGroup: \"Fields.MultiCheckSelectGroup\",\n\t\tNoteField: \"Fields.Note\",\n\t\tNumberField: \"Fields.Number\",\n\t\tRadioGroup: \"Fields.RadioGroup\",\n\t\tReferenceField: \"Fields.Reference\",\n\t\tRichText: \"Fields.RichText\",\n\t\tSelect: \"Fields.Select\",\n\t\tSliderField: \"Fields.Slider\",\n\t\tTagsField: \"Fields.Tags\",\n\t\tTextArea: \"Fields.TextArea\",\n\t\tTextField: \"Fields.Text\",\n\t\tTimeField: \"Fields.Time\",\n\t\tToggleField: \"Fields.Toggle\",\n\t\tUniqueCheck: \"Fields.UniqueCheck\",\n\t\tUrlField: \"Fields.Url\",\n\t\tVisualUniqueSelection: \"Fields.VisualUniqueSelection\",\n\t\tWysiwyg: \"Fields.Wysiwyg\",\n\t};\n\treturn typeObj[type];\n}\n\nfunction extendsType(types: Array<string>) {\n\treturn types.filter((typeStr) => typeStr.length).length < 1\n\t\t? \"\"\n\t\t: `extends ${types.join(\", \")}`;\n}\n\nfunction getPageContentTypesUnionType(\n\tschemas: Array<SchemaTypeWithComponentProp>,\n) {\n\treturn schemas\n\t\t.map((schema) => {\n\t\t\tif (\"fromPage\" in schema && schema.fromPage) {\n\t\t\t\treturn `${schema.component || \"\"}ContentTypeProps`;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t})\n\t\t.filter(Boolean)\n\t\t.join(\"|\");\n}\n\nfunction getSimpleContentTypeUnionProps(\n\tschemas: Array<SchemaTypeWithComponentProp>,\n) {\n\treturn schemas\n\t\t.map((schema) => {\n\t\t\tif (\"fromPage\" in schema && !schema.fromPage && !schema.taxonomy) {\n\t\t\t\treturn `${schema.component || \"\"}ContentTypeProps`;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t})\n\t\t.filter(Boolean)\n\t\t.join(\"|\");\n}\n\nfunction getTaxonomyContentTypesUnionType(\n\tschemas: Array<SchemaTypeWithComponentProp>,\n) {\n\treturn schemas\n\t\t.map((schema) => {\n\t\t\tif (\"taxonomy\" in schema && schema.taxonomy) {\n\t\t\t\treturn `${schema.component || \"\"}ContentTypeProps`;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t})\n\t\t.filter(Boolean)\n\t\t.join(\"|\");\n}\n\n/**\n * Get union types for components, modules and tempaltes like so:\n *\n * @example\n * type Components = \"ComponentA\" | \"ComponentB\"\n * type Modules = \"ModuleA\" | \"ModuleB\"\n * type Templates = \"TemplateA\" | \"TemplateB\"\n */\nfunction getElementsUnionType(schemas: Array<SchemaType>) {\n\tconst unionOfComponents = [];\n\tconst unionOfModules = [];\n\tconst unionOfTemplates = [];\n\tconst detailTemplates = [];\n\tfor (let length = schemas.length, i = 0; i < length; ++i) {\n\t\tconst schema = schemas[i];\n\t\t// `in` to narrow only schemas with `component` prop\n\t\tif (\"component\" in schema) {\n\t\t\tconst componentName = schema.component;\n\t\t\tif (schema.schemaType === \"component\") {\n\t\t\t\tunionOfComponents.push(`\"${componentName}\"`);\n\t\t\t}\n\t\t\tif (schema.schemaType === \"module\") {\n\t\t\t\tunionOfModules.push(`\"${componentName}\"`);\n\t\t\t}\n\t\t\tif (schema.schemaType === \"template\") {\n\t\t\t\tunionOfTemplates.push(`\"${componentName}\"`);\n\t\t\t\tif (schema.type.mode === \"detail\") {\n\t\t\t\t\tdetailTemplates.push(`\"${componentName}\"`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst ComponentsUnion = `\n\t\texport type Components =\n\t\t\t${unionOfComponents.join(\"|\")}\n\t`;\n\n\tconst ModulesUnion = `\n\t\texport type Modules =\n\t\t\t${unionOfModules.join(\"|\")}\n\t`;\n\n\tconst TemplatesUnion = `\n\t\texport type Templates =\n\t\t\t${unionOfTemplates.join(\"|\")}\n\t`;\n\n\tconst DetailTemplatesUnion = `\n\t\texport type DetailTemplates =\n\t\t\t${detailTemplates.join(\"|\")}\n\t`;\n\n\treturn `\n\t\t${ComponentsUnion}\n\t\t${ModulesUnion}\n\t\t${TemplatesUnion}\n\t\t${DetailTemplatesUnion}\n\t`;\n}\n\n/**\n * Lista de templates y sus secciones\n * Esto es algo que se usa en los schemas de Griddo. Es como el inverso a un\n * whitelist donde indicamos en qué secciones de qué templates puede\n * aparecer un módulo.\n */\nfunction getSectionList(schemas: Array<SchemaType>) {\n\tconst names = schemas\n\t\t.filter((schema) => {\n\t\t\tif (\"schemaType\" in schema) {\n\t\t\t\treturn schema.schemaType === \"template\";\n\t\t\t}\n\t\t\treturn false;\n\t\t})\n\t\t.map((schema) => {\n\t\t\tconst templateSchema = schema as Schema.Template;\n\t\t\tconst sectionNames = templateSchema.content\n\t\t\t\t.filter((field) => field.type === \"ComponentArray\")\n\t\t\t\t.map(({ key }) => `\"${key}\"`)\n\t\t\t\t.filter(Boolean);\n\t\t\treturn sectionNames && sectionNames?.length > 0\n\t\t\t\t? `${templateSchema.component}?: NonEmptyArray<${sectionNames.join(\n\t\t\t\t\t\t\"|\",\n\t\t\t\t\t)}>;`\n\t\t\t\t: \"\";\n\t\t})\n\t\t.join(\"\");\n\n\treturn `export type SectionList = { ${names} }`;\n}\n\nconst IS_COMPONENT_LIBRARY = __dirname.includes(\"node_modules\");\n\n/**\n * Returns the instance or monorepo paths.\n *\n * @param customPath The path for the instance components\n */\nfunction resolveComponentsPath() {\n\tconst cwd = __dirname;\n\tconst componentsPath = IS_COMPONENT_LIBRARY\n\t\t? \"../../../\"\n\t\t: \"../griddo-components\";\n\n\treturn path.resolve(packageDirectorySync({ cwd }), componentsPath);\n}\n\nexport {\n\textendsType,\n\tgetAllFields,\n\tgetElementsUnionType,\n\tgetGenericFromCheckBoxOptions,\n\tgetGenericFromOptions,\n\tgetGenericFromWhitelist,\n\tgetInterfacePropType,\n\tgetPageContentTypesUnionType,\n\tgetSectionList,\n\tgetSimpleContentTypeUnionProps,\n\tgetTaxonomyContentTypesUnionType,\n\tresolveComponentsPath,\n\treturnType,\n\tschemasToArray,\n};\n","import path from 'node:path';\nimport {findUp, findUpSync} from 'find-up';\n\nexport async function packageDirectory({cwd} = {}) {\n\tconst filePath = await findUp('package.json', {cwd});\n\treturn filePath && path.dirname(filePath);\n}\n\nexport function packageDirectorySync({cwd} = {}) {\n\tconst filePath = findUpSync('package.json', {cwd});\n\treturn filePath && path.dirname(filePath);\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { KindSchema, SchemaTypeWithComponentProp } from \"./types\";\nimport type * as PageContentType_Fields from \"../../types/schema-fields/page-content-type-fields\";\nimport type { PageContentTypeFields } from \"../../types/schema-fields/page-content-type-fields\";\nimport type {\n\tThemeVisualUniqueSelection,\n\tThumbnailOption,\n} from \"../../types/schema-fields/props\";\nimport type { SimpleContentTypeFields } from \"../../types/schema-fields/simple-content-type-fields\";\nimport type * as UI_Fields from \"../../types/schema-fields/ui-fields\";\nimport type { UIFields } from \"../../types/schema-fields/ui-fields\";\nimport type { UITemplateFields } from \"../../types/schema-fields/ui-template-fields\";\nimport type { Module } from \"../../types/schemas\";\nimport type { AutoTypesConfig } from \"../../types/schemas/AutoTypes\";\n\nimport { INTERFACE_SUFFIX } from \"./constants\";\nimport {\n\tgetGenericFromCheckBoxOptions,\n\tgetGenericFromOptions,\n\tgetGenericFromWhitelist,\n\tgetInterfacePropType,\n\treturnType,\n} from \"./utils\";\n\n/**\n * Return a property with a Griddo type (serialized) based on a schema field.\n *\n * @param field A Griddo field object\n * @param kind Schema type in order to later do some operations with fields\n * @param options Object options\n * @example\n * { type: 'TextField', key: 'name' } => \"name?: Fields.Text\"\n * { type: 'UrlField', key: 'image' } => \"name?: Fields.Url\"\n */\nfunction getTypeFromField(\n\tfield:\n\t\t| UIFields\n\t\t| UITemplateFields\n\t\t| SimpleContentTypeFields\n\t\t| PageContentTypeFields,\n\tkind: KindSchema,\n\toptions: {\n\t\thasDistributorData: boolean;\n\t\tgetStaticData: boolean;\n\t\tmoduleSchemas: Array<Module | undefined>;\n\t\tschema: SchemaTypeWithComponentProp;\n\t},\n\tconfig?: AutoTypesConfig,\n): string | undefined {\n\t// Config\n\tconst interfaceSuffix = config?.interfaceSuffix || INTERFACE_SUFFIX;\n\n\t//\n\t// Ignore - Bypass\n\t//\n\t// Empezamos ignorando ciertos fields que no necesitamos que generen types\n\t// aunque estén en los schemas. De esta manera los quitamos del proceso en\n\t// primera instancia y evitamos errores en los types de esta función.\n\tif (field.type === \"FieldsDivider\") {\n\t\treturn \"// FieldsDivider\";\n\t}\n\n\t// Ignore type generation from schema _autoType prop\n\tif (field._autoType?.ignore) {\n\t\treturn \"// Ignored by AutoType.ignore\";\n\t}\n\n\t//\n\t// Go!\n\t//\n\tconst { type, _autoType, key } = field;\n\tconst { hasDistributorData, getStaticData } = options;\n\n\t// If the field is missing the prop key or type, return an \"error\" string.\n\tif (!type || !key) {\n\t\treturn `\n\t\t\t/** · (ノ-_-)ノ ミ ┴┴ You forgot to write the \\`type\\` | \\`key\\` or some mandatory prop */\n\t\t`;\n\t}\n\n\t// Simple fields\n\t// { type: \"TextField\", key: \"foo\" } --> \"foo?: Fields.Text\"\n\tif (\n\t\ttype === \"DateField\" ||\n\t\ttype === \"FileField\" ||\n\t\ttype === \"ImageField\" ||\n\t\ttype === \"NoteField\" ||\n\t\ttype === \"NumberField\" ||\n\t\ttype === \"RichText\" ||\n\t\ttype === \"SliderField\" ||\n\t\ttype === \"TagsField\" ||\n\t\ttype === \"TextArea\" ||\n\t\ttype === \"TextField\" ||\n\t\ttype === \"TimeField\" ||\n\t\ttype === \"ToggleField\" ||\n\t\ttype === \"UniqueCheck\" ||\n\t\ttype === \"UrlField\" ||\n\t\ttype === \"Wysiwyg\"\n\t) {\n\t\treturn getInterfacePropType(field);\n\t}\n\n\t// MultiCheckSelect\n\t// { type: \"MultiCheckSelect\", key: \"foo\" } --> \"foo?: Fields.MultiCheckSelectGroup<Relations, true>\"\n\tif (type === \"MultiCheckSelect\") {\n\t\t// - MultiCheckSelect in a ContentType schema (page or simple)\n\t\t//\n\t\t// Cuando está dentro de un ContentType el field devuelve cosas\n\t\t// distintas a cuando está dentro de un schema de UI y tiene en cuenta:\n\t\t// - Si está siendo requerido por API pública (useList)\n\t\t// - Si tiene relations\n\t\t// - Se añade el contentType relacionado para poder hacera autocomplete\n\t\tif (kind === \"pageContentType\" || kind === \"simpleContentType\") {\n\t\t\tconst relationData = `${field.source}ContentTypeProps`;\n\t\t\treturn getInterfacePropType(field, {\n\t\t\t\tgeneric: `Relations, FromList, ${relationData}<false, false>, FromDistributor`,\n\t\t\t});\n\t\t}\n\n\t\t// - Rest of schemas\n\t\t//\n\t\t// { type: \"MultiCheckSelect\", key: \"foo\" } --> \"foo?: Fields.MultiCheckSelectGroup<Relations>\"\n\t\treturn getInterfacePropType(field, {\n\t\t\tgeneric: \"true\",\n\t\t});\n\t}\n\n\t// AsyncCheckGroup\n\t// Duplicate from MultiCheckSelect\n\tif (type === \"AsyncCheckGroup\") {\n\t\tif (kind === \"pageContentType\" || kind === \"simpleContentType\") {\n\t\t\tconst relationData = `${field.source}ContentTypeProps`;\n\t\t\treturn getInterfacePropType(field, {\n\t\t\t\tgeneric: `Relations, FromList, ${relationData}<false, false>, FromDistributor`,\n\t\t\t});\n\t\t}\n\n\t\treturn getInterfacePropType(field, {\n\t\t\tgeneric: \"true\",\n\t\t});\n\t}\n\n\t// MultiCheckSelectGroup\n\t// { type: \"MultiCheckSelectGroup\", key: \"foo\" } --> \"foo?: Fields.MultiCheckSelectGroup<>\"\n\tif (type === \"MultiCheckSelectGroup\") {\n\t\tconst keys = field.elements.map((element) => `\"${element.key}\"`).join(\"|\");\n\t\tconst relations = field._autoType?.relations;\n\t\tconst generic = [keys, relations].join(\",\");\n\n\t\treturn getInterfacePropType(field, { generic });\n\t}\n\n\t// ColorPicker\n\t// { type: \"ColorPickerFixed\", key: \"foo\" } --> \"foo?: Fields.ColorPickerFixed<>\"\n\tif (type === \"ColorPicker\") {\n\t\tif (field.isThemePalette) {\n\t\t\treturn getInterfacePropType(field, {\n\t\t\t\treturnTypeName: \"Fields.ColorPickerFixed\",\n\t\t\t});\n\t\t}\n\n\t\treturn getInterfacePropType(field);\n\t}\n\n\t// HeadingField, RadioGroup, Select\n\t// Generic from options.values\n\t// { type: \"HeadingField\", key: \"foo\" } --> \"foo?: Fields.Heading<>\"\n\tif (type === \"HeadingField\" || type === \"RadioGroup\" || type === \"Select\") {\n\t\tconst { options } = field;\n\t\tconst generic = getGenericFromOptions(options);\n\n\t\treturn getInterfacePropType(field, { generic });\n\t}\n\n\t// CheckGroup\n\t// Generic from options.name\n\t// { type: \"CheckGroup\", key: \"foo\" } --> \"Fields.CheckGroup<>\n\tif (type === \"CheckGroup\") {\n\t\tconst { options } = field;\n\t\tconst generic = getGenericFromCheckBoxOptions(options);\n\n\t\treturn getInterfacePropType(field, { generic });\n\t}\n\n\t// LinkField\n\t// Generic from whitelist\n\t// type === \"LinkField\" --> key: Fields.Link<{video:Video, image:Image}>\n\tif (type === \"LinkField\") {\n\t\tconst { whiteList } = field;\n\t\tconst generic = getGenericFromWhitelist(whiteList as Array<string>, config);\n\n\t\treturn getInterfacePropType(field, { generic });\n\t}\n\n\t// AsyncSelect\n\t// { type: \"AsyncSelect\", key: \"foo\" } --> \"foo?: Fields.{AsyncSelectType}\"\n\t// TODO: waiting for the field documentation\n\tif (type === \"AsyncSelect\") {\n\t\t// Entities\n\t\tif (\"entity\" in field) {\n\t\t\t// Menu\n\t\t\tif (field.entity === \"menu_containers\") {\n\t\t\t\treturn `\\n${key}?: Menu`;\n\t\t\t}\n\t\t\t// // Pages\n\t\t\t// if (field.entity === \"sites\") {\n\t\t\t// \treturn `${key}?: Fields.Menu;`;\n\t\t\t// }\n\t\t\t// // Sites\n\t\t\t// if (field.entity === \"pages\") {\n\t\t\t// \treturn `${key}?: Fields.Menu;`;\n\t\t\t// }\n\t\t}\n\n\t\tif (kind === \"pageContentType\" || kind === \"simpleContentType\") {\n\t\t\tconst relationData = `${field.source}ContentTypeProps`;\n\t\t\treturn getInterfacePropType(field, {\n\t\t\t\tgeneric: `Relations, FromList, ${relationData}<false, false>, FromDistributor`,\n\t\t\t});\n\t\t}\n\n\t\treturn `\\n${key}?: Fields.AsyncSelect;`;\n\t}\n\n\t// FieldGroup\n\t// { type: \"FieldGroup\", key: \"foo\" } --> \"foo?: Fields.???\"\n\t// <Recursive>\n\tif (type === \"FieldGroup\") {\n\t\treturn `\n\t\t\t// << ${type}\n\t\t\t${field.fields.map((field) => getTypeFromField(field, kind, options)).join(\"\")}\n\t\t\t// end >>\n\t\t`;\n\t}\n\n\t// ArrayFieldGroup\n\tif (type === \"ArrayFieldGroup\") {\n\t\tconst doc = _autoType?.doc || \"\";\n\n\t\treturn `\n\t\t\t\\n${doc}\\n${key}?: Fields.ArrayFieldGroup<{${field.fields\n\t\t\t\t.map((childField) => getTypeFromField(childField, kind, options))\n\t\t\t\t.join(\",\")}}>\n\t\t`;\n\t}\n\n\t// ConditionalField\n\t// <Recursive>\n\tif (type === \"ConditionalField\") {\n\t\tconst conditionalChildrenFields = field.fields.map((field) => {\n\t\t\treturn getTypeFromField(field, kind, options);\n\t\t});\n\t\tconst doc = _autoType?.doc || \"\";\n\t\tconst conditionalHasHideable = \"hideable\" in field ? field.hideable : false;\n\t\tconst startHideable = conditionalHasHideable ? \"Hideable<\" : \"\";\n\t\tconst endHideable = conditionalHasHideable ? \">\" : \"\";\n\n\t\treturn `\n\t\t\t// << ${type}\n\t\t\t\\n${doc}\\n${key}?: ${startHideable}${returnType(type)}<${field.options\n\t\t\t\t.map((option) => {\n\t\t\t\t\treturn typeof option.value === \"string\"\n\t\t\t\t\t\t? `\"${option.value}\"`\n\t\t\t\t\t\t: option.value;\n\t\t\t\t})\n\t\t\t\t.join(\"|\")}>${endHideable};\n\t\t\t${conditionalChildrenFields.join(\"\")}\n\t\t\t// end >>\n\t\t`;\n\t}\n\n\t// ComponentArray\n\t// <Complex>\n\tif (type === \"ComponentArray\") {\n\t\t// El type de Griddo es dinstinto para un ComponentArray si este está\n\t\t// dentro de un template.\n\t\tconst returnTypeName =\n\t\t\tkind === \"template\" || kind === \"pageContentType\"\n\t\t\t\t? \"TemplateSection\"\n\t\t\t\t: \"ComponentArray\";\n\n\t\tconst optional = kind === \"template\" ? \"\" : \"?\";\n\n\t\t// Type assertion, el field ComponentArray solo puede ser UI o Page\n\t\tconst fieldCasted = field as\n\t\t\t| UI_Fields.ComponentArray\n\t\t\t| PageContentType_Fields.ComponentArray;\n\n\t\tconst { key, _autoType, whiteList } = fieldCasted;\n\t\tconst doc = _autoType?.doc || \"\";\n\n\t\t// TODO: Research to compute this with type itself.\n\t\t// SHAME: Remove anys!!\n\t\tconst getModulesFromTemplateSectionList = (\n\t\t\tmodules: Array<Module | undefined>,\n\t\t\ttemplateName: string,\n\t\t\ttemplateSection: string,\n\t\t): Array<Module | undefined> => {\n\t\t\treturn modules\n\t\t\t\t.filter((entry: any) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tentry &&\n\t\t\t\t\t\t\"schemaType\" in entry &&\n\t\t\t\t\t\tentry?.schemaType === \"module\"\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn entry?.sectionList && !!entry?.sectionList[templateName];\n\t\t\t\t\t}\n\n\t\t\t\t\treturn undefined;\n\t\t\t\t})\n\t\t\t\t.map((entry: any) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tt: entry?.sectionList[templateName].filter(\n\t\t\t\t\t\t\t(s: any) => s === templateSection,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tm: entry?.component,\n\t\t\t\t\t};\n\t\t\t\t})\n\t\t\t\t.filter((entry: any) => entry?.t?.length)\n\t\t\t\t.map((entry: any) => entry?.m)\n\t\t\t\t.filter(Boolean);\n\t\t};\n\n\t\t// BasicTemplate -> mainSection\n\t\tlet modulesInSectionLists = \"\";\n\t\tif (kind === \"template\") {\n\t\t\tmodulesInSectionLists = getModulesFromTemplateSectionList(\n\t\t\t\toptions.moduleSchemas,\n\t\t\t\toptions.schema.component,\n\t\t\t\tkey,\n\t\t\t).join(\"|\");\n\t\t}\n\n\t\t// 1 - Mix whitelist and sectionList\n\t\t// 2 - Remove duplicate modules due to mixing between sectionList and whiteList\n\t\tconst everyModuleInTemplateSection = [\n\t\t\t...new Set([...modulesInSectionLists.split(\"|\"), ...whiteList]),\n\t\t].filter(Boolean);\n\n\t\treturn `\\n${doc}\\n${key}${optional}: Fields.${returnTypeName}<${everyModuleInTemplateSection\n\t\t\t.map((component) => `${component}${interfaceSuffix}`)\n\t\t\t.join(\"|\")}>;`;\n\t}\n\n\t// ComponentContainer\n\t// <Complex>\n\tif (type === \"ComponentContainer\") {\n\t\t// UI\n\t\tif (\n\t\t\tkind === \"object\" ||\n\t\t\tkind === \"component\" ||\n\t\t\tkind === \"module\" ||\n\t\t\tkind === \"template\" ||\n\t\t\tkind === \"pageContentType\"\n\t\t) {\n\t\t\tconst FieldCasted = field as UI_Fields.ComponentContainer;\n\t\t\tconst { whiteList } = FieldCasted;\n\n\t\t\tconst generic = getGenericFromWhitelist(\n\t\t\t\twhiteList as Array<string>,\n\t\t\t\tconfig,\n\t\t\t);\n\n\t\t\treturn getInterfacePropType(field, { generic });\n\t\t}\n\t}\n\n\t// ReferenceField\n\t// TODO: Create correct generic using from/key values\n\tif (type === \"ReferenceField\") {\n\t\tconst sources = field.sources || [{ structuredData: undefined }];\n\t\tconst generic =\n\t\t\t(Array.isArray(sources) &&\n\t\t\t\tsources\n\t\t\t\t\t.map((item) =>\n\t\t\t\t\t\titem.structuredData\n\t\t\t\t\t\t\t? `${item.structuredData}ContentType${interfaceSuffix}`\n\t\t\t\t\t\t\t: \"unknown\",\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"|\")) ||\n\t\t\t\"\";\n\t\tconst referenceField = getInterfacePropType(field, { generic });\n\t\tconst queriedItems =\n\t\t\thasDistributorData || getStaticData\n\t\t\t\t? `queriedItems?: Fields.QueriedData<${generic}>;`\n\t\t\t\t: \"\";\n\n\t\treturn `\n\t\t \t${referenceField}\n\t\t \t${queriedItems}\n\t\t `;\n\n\t\t// const { source } = field;\n\t\t// const generic = source\n\t\t// \t.map((item) => `${item}ContentType${interfaceSuffix}`)\n\t\t// \t.join(\"|\");\n\t\t// const referenceField = getInterfacePropType(field, { generic });\n\t\t// const queriedItems = hasDistributorData\n\t\t// \t? `queriedItems?: Fields.QueriedData<${generic}>;`\n\t\t// \t: \"\";\n\n\t\t// return `\n\t\t// \t${referenceField}\n\t\t// \t${queriedItems}\n\t\t// `;\n\t}\n\n\t// VisualUniqueSelection\n\tif (type === \"VisualUniqueSelection\") {\n\t\tconst withValue = field.options[0] as ThumbnailOption;\n\t\tconst withTheme = field.options[0] as ThemeVisualUniqueSelection;\n\t\tlet generic = \"\";\n\n\t\t// ThumbnailOption\n\t\tif (withValue.value) {\n\t\t\tconst all = field.options as Array<ThumbnailOption>;\n\t\t\tgeneric = all.map((item) => `\"${item.value}\"`).join(\"|\");\n\t\t}\n\n\t\t// ThemeVisualUniqueSelection\n\t\tif (withTheme.theme) {\n\t\t\tconst all = field.options as Array<ThemeVisualUniqueSelection>;\n\t\t\tgeneric = all[0].options.map((i) => `\"${i.value}\"`).join(\"|\");\n\t\t}\n\n\t\treturn getInterfacePropType(field, { generic });\n\t}\n\n\tconsole.warn(`The field ${field.type} has not been implemented yet ㅠ.ㅠ`);\n\n\treturn \"\";\n\n\t// throw new Error(`Wrong schema field! ${JSON.stringify(field, null, 2)}`);\n}\n\nexport { getTypeFromField };\n","import type { Fields, SchemaTypeWithComponentProp } from \"./types\";\n\nimport { getTypeFromField } from \"./getTypeFromField\";\n\nfunction getMenuItemsProps(fields?: Array<Fields>) {\n\tif (!fields) {\n\t\treturn \"\";\n\t}\n\n\treturn fields\n\t\t.map((field) =>\n\t\t\tgetTypeFromField(field, \"object\", {\n\t\t\t\thasDistributorData: false,\n\t\t\t\tgetStaticData: false,\n\t\t\t\tmoduleSchemas: [],\n\t\t\t\tschema: {} as SchemaTypeWithComponentProp,\n\t\t\t}),\n\t\t)\n\t\t.join(\"\");\n}\n\nexport { getMenuItemsProps };\n","import type { KindSchema, SchemaTypeWithComponentProp } from \"./types\";\nimport type { Module } from \"../../types/schemas\";\nimport type { AutoTypesConfig } from \"../../types/schemas/AutoTypes\";\n\nimport {\n\tCONTENT_TYPE_SUFFIX,\n\tINTERFACE_SUFFIX,\n\tPUBLIC_API_SUFFIX,\n} from \"./constants\";\nimport { getTypeFromField } from \"./getTypeFromField\";\nimport { extendsType, getAllFields } from \"./utils\";\n\n/**\n * Return an interface for every schema in the prop schemas.\n *\n * @example\n * interface SchemaProps {\n * \t\tschemaFieldKey: apiResponsveFieldType\n * \t\ttitle: Fields.Heading\n *\t\titemsPerPage: Fields.Number\n *\t\t...\n * }\n */\nfunction getTypesFromSchemas(\n\tschemas: Array<SchemaTypeWithComponentProp>,\n\tconfig?: AutoTypesConfig,\n) {\n\t// Config\n\tconst contentTypeSuffix = config?.contentTypeSuffix || CONTENT_TYPE_SUFFIX;\n\tconst interfaceSuffix = config?.interfaceSuffix || INTERFACE_SUFFIX;\n\tconst publicApiSuffix = config?.publicApiSuffix || PUBLIC_API_SUFFIX;\n\n\t// ContentType names list\n\tconst contentTypePageListNames: Array<string> = [];\n\tconst contentTypeSimpleListNames: Array<string> = [];\n\tconst contentTypeTaxonomyListNames: Array<string> = [];\n\n\t// Map over every schema\n\tconst autoTypesSchemas = schemas\n\t\t.map((schema) => {\n\t\t\tlet kind: KindSchema;\n\t\t\tlet contentTypeSuffixStr = \"\";\n\t\t\tlet contentTypeName = \"\";\n\t\t\tlet contentTypeKind = \"\";\n\t\t\tlet relatedContentTypeNames = \"\";\n\t\t\tlet componentName = \"\";\n\t\t\tlet relationsGeneric = \"\";\n\t\t\tlet hasDistributorData = false;\n\t\t\tlet getStaticData = false;\n\t\t\tlet interfaceForPublicAPI = \"\";\n\n\t\t\tconst { component } = schema;\n\t\t\tconst hasRelations = schema._autoType?.relations || false;\n\n\t\t\t// Si el schema va a tener un field al que se le pueda pasar un\n\t\t\t// relations este es pasado por un genérico en la `interface` que se\n\t\t\t// pondrá si `schema._autoType === true`.\n\t\t\trelationsGeneric = hasRelations\n\t\t\t\t? \"<Relations = unknown, FromList = unknown, FromDistributor = true>\"\n\t\t\t\t: \"\";\n\n\t\t\t// Array of module schemas\n\t\t\tconst MODULE_SCHEMAS: Array<Module | undefined> = schemas\n\t\t\t\t.map((schema) => {\n\t\t\t\t\tif (\"schemaType\" in schema && schema.schemaType === \"module\") {\n\t\t\t\t\t\treturn schema;\n\t\t\t\t\t}\n\t\t\t\t\treturn undefined;\n\t\t\t\t})\n\t\t\t\t.filter(Boolean);\n\n\t\t\t//\n\t\t\t// ContentType schema\n\t\t\t//\n\t\t\tif (\"fromPage\" in schema) {\n\t\t\t\tkind = schema.fromPage ? \"pageContentType\" : \"simpleContentType\";\n\t\t\t\tcontentTypeSuffixStr = contentTypeSuffix;\n\t\t\t\tcontentTypeName = `__contentTypeName: \"${schema.component}\";`;\n\t\t\t\tcontentTypeKind = `__contentTypeKind: \"${kind}\";`;\n\n\t\t\t\t// Add page ContentType name to the array\n\t\t\t\tif (kind === \"pageContentType\") {\n\t\t\t\t\tcontentTypePageListNames.push(`\"${schema.component}\"`);\n\t\t\t\t}\n\t\t\t\t// Add simple ContentType name to the array\n\t\t\t\tif (kind === \"simpleContentType\" && !schema.taxonomy) {\n\t\t\t\t\tcontentTypeSimpleListNames.push(`\"${schema.component}\"`);\n\t\t\t\t}\n\t\t\t\t// Add taxonomy (category) ContentType name to the array\n\t\t\t\tif (kind === \"simpleContentType\" && schema.taxonomy) {\n\t\t\t\t\tcontentTypeTaxonomyListNames.push(`\"${schema.component}\"`);\n\t\t\t\t}\n\n\t\t\t\tif (\"schema\" in schema) {\n\t\t\t\t\tconst relatedContentTypeNamesValues = schema.schema.fields\n\t\t\t\t\t\t.map((field) => {\n\t\t\t\t\t\t\tif (\"source\" in field) {\n\t\t\t\t\t\t\t\treturn field?.source;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.filter(Boolean);\n\n\t\t\t\t\trelatedContentTypeNames = relatedContentTypeNamesValues.length\n\t\t\t\t\t\t? `__relatedContentTypeNames: ${JSON.stringify(\n\t\t\t\t\t\t\t\trelatedContentTypeNamesValues,\n\t\t\t\t\t\t\t)}`\n\t\t\t\t\t\t: \"\";\n\t\t\t\t}\n\n\t\t\t\t// En el caso de los schemas de ContentType se pondrá siempre el\n\t\t\t\t// genérico a unknown para así poder pasarle el relations en el\n\t\t\t\t// componente de React, por ejemplo cuando se utilice el Type en\n\t\t\t\t// un hook como `useContentType`\n\t\t\t\t// `useList<AutoTypes.MEMBERContentType<true>>()`\n\t\t\t\t// ^\n\t\t\t\t// relations\n\t\t\t\trelationsGeneric =\n\t\t\t\t\t\"<Relations = unknown, FromList = unknown, FromDistributor = true>\";\n\n\t\t\t\tinterfaceForPublicAPI = `\n\t\t\t\t/** Type to be consumed by public API: useList(), etc.. */\n\t\t\t\texport type ${component}${contentTypeSuffixStr}${publicApiSuffix}${interfaceSuffix}<R extends Core.ContentTypeRelations = false> = ${component}${contentTypeSuffixStr}${interfaceSuffix}<R, true>;\n\t\t\t\t`;\n\t\t\t}\n\n\t\t\t//\n\t\t\t// UI schema - ALL\n\t\t\t// set:\n\t\t\t// kind, componentName and hasDistributorData/getStaticData\n\t\t\tif (\"schemaType\" in schema) {\n\t\t\t\tkind = schema.schemaType;\n\t\t\t\tcomponentName = `component: \"${component}\";`;\n\n\t\t\t\t// Handle hasDistributorData/getStaticData to create the prop/type queriedData\n\t\t\t\t// automatically.\n\t\t\t\tif (\n\t\t\t\t\tschema.schemaType === \"template\" ||\n\t\t\t\t\tschema.schemaType === \"module\" ||\n\t\t\t\t\tschema.schemaType === \"component\"\n\t\t\t\t) {\n\t\t\t\t\thasDistributorData = schema.default.hasDistributorData as boolean;\n\t\t\t\t\tgetStaticData = schema.default.getStaticData as boolean;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//\n\t\t\t// Is a Category (Simple ContentType) interface\n\t\t\t// TODO: Total SHAME!\n\t\t\tconst isACategoryInterface =\n\t\t\t\t\"fromPage\" in schema &&\n\t\t\t\tschema.fromPage === false &&\n\t\t\t\tschema.taxonomy === true;\n\n\t\t\t//\n\t\t\t// UI Schemas - List templates\n\t\t\t// This kind of templates return several extra properties from the build phase.\n\t\t\t//\n\t\t\tconst isListTemplate =\n\t\t\t\t\"schemaType\" in schema &&\n\t\t\t\tschema.schemaType === \"template\" &&\n\t\t\t\t(schema.type.mode === \"list\" || schema.type.mode === \"paginated-data\");\n\n\t\t\tconst extraListTemplateProps = isListTemplate\n\t\t\t\t? \"Fields.ExtraListTemplateProps\"\n\t\t\t\t: \"\";\n\n\t\t\t//\n\t\t\t// Extra extends for the final interface\n\t\t\t//\n\t\t\tconst extendsString = extendsType([extraListTemplateProps]);\n\n\t\t\t//\n\t\t\t// Props for the interface\n\t\t\t//\n\t\t\tconst propsFromFields = getAllFields(schema)\n\t\t\t\t.map((field) => {\n\t\t\t\t\treturn getTypeFromField(field, kind, {\n\t\t\t\t\t\thasDistributorData,\n\t\t\t\t\t\tgetStaticData,\n\t\t\t\t\t\tmoduleSchemas: MODULE_SCHEMAS,\n\t\t\t\t\t\tschema,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\"\");\n\n\t\t\t//\n\t\t\t// Compose the final interface string\n\t\t\t//\n\t\t\treturn `\n\t\t\t\texport interface ${component}${contentTypeSuffixStr}${interfaceSuffix}${relationsGeneric} ${extendsString} {\n\t\t\t\t\t${contentTypeName}\n\t\t\t\t\t${contentTypeKind}\n\t\t\t\t\t${relatedContentTypeNames}\n\t\t\t\t\t${componentName}\n\t\t\t\t\t${propsFromFields}\n\t\t\t\t\t${isACategoryInterface ? \"title?: string; code?: string\" : \"\"}\n\t\t\t\t}\n\t\t\t\t${interfaceForPublicAPI}\n\t\t\t\t`;\n\t\t})\n\t\t.join(\"\");\n\n\tconst pageContentTypesStr =\n\t\tcontentTypePageListNames && contentTypePageListNames.length\n\t\t\t? `export type PageContentTypes = ${contentTypePageListNames.join(\"|\")};`\n\t\t\t: \"\";\n\tconst simpleContentTypesStr =\n\t\tcontentTypeSimpleListNames && contentTypeSimpleListNames.length\n\t\t\t? `export type SimpleContentTypes = ${contentTypeSimpleListNames.join(\n\t\t\t\t\t\"|\",\n\t\t\t\t)};`\n\t\t\t: \"\";\n\tconst taxonomyContentTypesStr =\n\t\tcontentTypeTaxonomyListNames && contentTypeTaxonomyListNames.length\n\t\t\t? `export type TaxonomyContentTypes = ${contentTypeTaxonomyListNames.join(\n\t\t\t\t\t\"|\",\n\t\t\t\t)};`\n\t\t\t: \"\";\n\n\treturn `\n${autoTypesSchemas}\n${pageContentTypesStr}\n${simpleContentTypesStr}\n${taxonomyContentTypesStr}\n`;\n}\n\nexport { getTypesFromSchemas };\n","/* eslint-disable @typescript-eslint/no-var-requires */\nimport path from \"path\";\n\nimport { main } from \"./main\";\nimport { resolveComponentsPath } from \"./utils\";\n\nconst rawSchemasFromComponents = path.join(\n\tresolveComponentsPath(),\n\t\"griddo.config.ts\",\n);\n\nconst configFile = require(rawSchemasFromComponents);\n\nmain(\n\t{\n\t\t...configFile.schemas.all,\n\t\t...configFile.schemas.templates,\n\t\t...configFile.schemas.structuredData,\n\t},\n\tconfigFile.schemas.menuItems,\n\tconfigFile.schemas.languages,\n\tconfigFile.moduleCategories,\n\tconfigFile.schemas.dataPacks,\n\tconfigFile.schemas.dataPacksCategories,\n\tconfigFile.themes,\n\tconfigFile.subthemes,\n\tconfigFile.autotypes,\n);\n","/* eslint-disable @typescript-eslint/no-var-requires */\nimport type { LanguagesSchema, MenuItemsSchema, SchemaType } from \"./types\";\nimport type {\n\tDataPack,\n\tDataPackCategory,\n\tModuleCategories,\n} from \"../../types/schemas\";\nimport type { AutoTypesConfig } from \"../../types/schemas/AutoTypes\";\nimport type { ThemeEntry } from \"../../types/schemas/Themes\";\n\nimport { writeFile } from \"fs\";\nimport path from \"path\";\n\nimport prettier from \"prettier\";\n\nimport { HEAD_DESIGN } from \"./ascii\";\nimport { TYPE_FILE_NAME } from \"./constants\";\nimport { getMenuItemsProps } from \"./getMenuItemsProps\";\nimport { getTypesFromSchemas } from \"./getTypesFromSchemas\";\nimport {\n\tgetElementsUnionType,\n\tgetPageContentTypesUnionType,\n\tgetSectionList,\n\tgetSimpleContentTypeUnionProps,\n\tgetTaxonomyContentTypesUnionType,\n\tresolveComponentsPath,\n\tschemasToArray,\n} from \"./utils\";\n\n//\n// Main function\n//\nexport async function main(\n\tinputSchemas: Record<string, SchemaType>,\n\tmenuItemsSchemas: MenuItemsSchema,\n\tlanguagesSchemas: LanguagesSchema,\n\tmoduleCategoriesSchema: ModuleCategories,\n\tdatapacksSchema: Record<string, DataPack>,\n\tdatapacksCategoriesSchema: Record<string, DataPackCategory>,\n\tthemesSchema: Array<ThemeEntry>,\n\tsubthemesSchema: Array<string>,\n\tconfig?: AutoTypesConfig,\n) {\n\t// Config\n\tconst typeFileName = TYPE_FILE_NAME;\n\n\t// Schemas\n\tconst schemas = schemasToArray(inputSchemas);\n\n\t// Types\n\tconst elementsUnionTypes = getElementsUnionType(schemas);\n\tconst templateSectionList = getSectionList(schemas);\n\tconst allTypes = getTypesFromSchemas(schemas, config);\n\n\t// Menu items types Griddo + Instance\n\tconst linkFields = menuItemsSchemas?.link?.fields as any;\n\tconst groupFields = menuItemsSchemas?.group?.fields as any;\n\tconst menuItemsLinksProps = getMenuItemsProps(linkFields);\n\tconst menuItemsGroupProps = getMenuItemsProps(groupFields);\n\tconst menuItemsInterface = `\n\t\texport interface InstanceMenuItems {\n\t\t\tlink:{\n\t\t\t\t${menuItemsLinksProps}\n\t\t\t\tconfig?: {\n\t\t\t\t\theaderStyle?: string;\n\t\t\t\t\tfooterStyle?: string;\n\t\t\t\t\ttype?: \"link\";\n\t\t\t\t};\n\t\t\t};\n\t\t\tgroup: {\n\t\t\t\turl?: null;\n\t\t\t\t${menuItemsGroupProps}\n\t\t\t\tconfig?: {\n\t\t\t\t\theaderStyle?: string;\n\t\t\t\t\tfooterStyle?: string;\n\t\t\t\t\ttype?: \"group\";\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\t\texport type LinkMenuElement = Fields.BaseLinkElement<InstanceMenuItems> & InstanceMenuItems[\"link\"];\n\t\texport type GroupMenuElement = Fields.BaseLinkElement<InstanceMenuItems> & InstanceMenuItems[\"group\"];\n\t\texport type MenuElement = LinkMenuElement | GroupMenuElement;\n\t\texport type Menu = Fields.Menu<InstanceMenuItems>;\n\t`;\n\n\t// ${JSON.stringify(languagesSchemas)}\n\n\tconst languagesInterface = `\n\t\t// Type for the language schema\n\t\texport interface SiteLanguage {\n\t\t\tdomain: { id: number; url: string; slug: string };\n\t\t\thome: string;\n\t\t\tid: number;\n\t\t\tisDefault: boolean;\n\t\t\tlabel: ${(Object.keys(languagesSchemas) as Array<keyof typeof languagesSchemas>)\n\t\t\t\t.map((loc) => `\"${languagesSchemas[loc].label}\"`)\n\t\t\t\t.join(\"|\")};\n\t\t\tlanguage: ${(\n\t\t\t\tObject.keys(languagesSchemas) as Array<keyof typeof languagesSchemas>\n\t\t\t)\n\t\t\t\t.map((loc) => `\"${languagesSchemas[loc].name}\"`)\n\t\t\t\t.join(\"|\")};\n\t\t\tlocale: ${Object.keys(languagesSchemas)\n\t\t\t\t.map((loc) => `\"${loc}\"`)\n\t\t\t\t.join(\"|\")};\n\t\t\tpath: string;\n\t\t}\n\t`;\n\n\tconst moduleCategories = moduleCategoriesSchema\n\t\t? `type ModuleCategories = ${moduleCategoriesSchema\n\t\t\t\t.map((entry) => `\"${entry.value}\"`)\n\t\t\t\t.join(\"|\")}`\n\t\t: \"\";\n\n\tconst datapacks = datapacksSchema\n\t\t? `type Datapacks = ${Object.keys(datapacksSchema)\n\t\t\t\t.map((entry) => `\"${entry}\"`)\n\t\t\t\t.join(\"|\")}`\n\t\t: \"\";\n\n\tconst datapacksCategories = datapacksCategoriesSchema\n\t\t? `type DatapacksCategories = ${Object.keys(datapacksCategoriesSchema)\n\t\t\t\t.map((entry) => `\"${entry}\"`)\n\t\t\t\t.join(\"|\")}`\n\t\t: \"\";\n\n\tconst allTaxonomyContentTypeProps = `type AllTaxonomyContentTypeProps = ${getTaxonomyContentTypesUnionType(schemas)}`;\n\tconst allSimpleContentTypeProps = `type AllPageContentTypeProps = ${getSimpleContentTypeUnionProps(schemas)}`;\n\tconst allPageContentTypeProps = `type AllSimpleContentTypeProps = ${getPageContentTypesUnionType(schemas)}`;\n\n\tconst themes = themesSchema\n\t\t? `type Themes = ${themesSchema\n\t\t\t\t.map((entry) => `\"${entry.value}\"`)\n\t\t\t\t.join(\"|\")}`\n\t\t: \"\";\n\n\tconst subthemes = subthemesSchema\n\t\t? `type Subthemes = ${subthemesSchema\n\t\t\t\t.map((entry) => `\"${entry}\"`)\n\t\t\t\t.join(\"|\")}`\n\t\t: \"\";\n\n\t// Prettier\n\tconst localConfFile = await prettier.resolveConfigFile();\n\tconst localConf = await prettier.resolveConfig(localConfFile as string);\n\tconst autoTypesConfig = { useTabs: true };\n\tconst prettierConfig = localConf || autoTypesConfig;\n\n\tconst stringToPrettify = `\n\t\t${HEAD_DESIGN}\n\t\t${menuItemsInterface}\n\t\t${languagesInterface}\n\t\t${allTypes}\n\t\t${elementsUnionTypes}\n\t\t${templateSectionList}\n\t\t${moduleCategories}\n\t\t${datapacks}\n\t\t${datapacksCategories}\n\t\t${allTaxonomyContentTypeProps}\n\t\t${allSimpleContentTypeProps}\n\t\t${allPageContentTypeProps}\n\t\t${themes}\n\t\t${subthemes}\n\t\t`;\n\n\tconst prettierConfigProps = {\n\t\t...prettierConfig,\n\t\tparser: \"typescript\",\n\t};\n\n\tconst allTypesPrettify = await prettier.format(\n\t\tstringToPrettify,\n\t\tprettierConfigProps,\n\t);\n\n\t// Remove extra new lines\n\tconst stringData = allTypesPrettify.replace(/^\\s*\\n/gm, \"\");\n\n\t// Write it out!\n\n\t// const dstPath = path.resolve(pkgDir.sync(__dirname) || \"\", \"../../..\");\n\twriteFile(\n\t\t`${path.join(resolveComponentsPath(), typeFileName)}`,\n\t\tstringData,\n\t\t(err) => {\n\t\t\tif (err) throw err;\n\t\t},\n\t);\n\n\t// :)\n\tconsole.log(\"🤖 AutoTypes ✓\");\n}\n"],"names":["__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","HEAD_DESIGN","TYPE_FILE_NAME","INTERFACE_SUFFIX","CONTENT_TYPE_SUFFIX","PUBLIC_API_SUFFIX","UPPERCASE","LOWERCASE","LEADING_CAPITAL","IDENTIFIER","SEPARATORS","LEADING_SEPARATORS","RegExp","source","SEPARATORS_AND_IDENTIFIER","NUMBERS_AND_IDENTIFIER","preserveCamelCase","string","toLowerCase","toUpperCase","preserveConsecutiveUppercase","isLastCharLower","isLastCharUpper","isLastLastCharUpper","isLastLastCharPreserved","index","length","character","test","slice","input","lastIndex","replaceAll","match","postProcess","pattern","offset","includes","charAt","_","identifier","typeMappings","directory","file","matchType","type","stat","toPath","urlOrPath","URL","fileURLToPath","locatePathSync","paths","cwd","process","allowSymlinks","Object","hasOwnProperty","call","Error","checkType","statFunction","fs","statSync","lstatSync","path_","path","throwIfNoEntry","findUpStop","Symbol","findUpSync","name","options","matches","root","parse","stopAt","limit","Number","POSITIVE_INFINITY","flat","runMatcher","locateOptions","foundPath","push","dirname","findUpMultipleSync","getInterfacePropType","field","returnTypeName","generic","hasHideable","Boolean","hideable","genericStr","returnTypeNameWithGeneriStr","returnType","typeWrappedWithHideable","_a","_autoType","doc","key","getGenericFromWhitelist","whiteList","config","interfaceSuffix","map","whiteListItem","Array","isArray","TypeError","pascalCase","x","trim","filter","join","locale","toLocaleLowerCase","toLocaleUpperCase","replace","camelcase","item","ArrayFieldGroup","AsyncCheckGroup","AsyncSelect","CheckGroup","ColorPicker","ComponentArray","ComponentContainer","ConditionalField","DateField","FieldGroup","FieldsDivider","FileField","HeadingField","ImageField","LinkField","MultiCheckSelect","MultiCheckSelectGroup","NoteField","NumberField","RadioGroup","ReferenceField","RichText","Select","SliderField","TagsField","TextArea","TextField","TimeField","ToggleField","UniqueCheck","UrlField","VisualUniqueSelection","Wysiwyg","IS_COMPONENT_LIBRARY","__dirname","resolveComponentsPath","componentsPath","filePath","packageDirectorySync","getTypeFromField","kind","ignore","hasDistributorData","getStaticData","keys","elements","element","_b","relations","isThemePalette","getGenericFromOptions","getGenericFromCheckBoxOptions","entity","fields","childField","conditionalChildrenFields","conditionalHasHideable","endHideable","option","optional","fieldCasted","getModulesFromTemplateSectionList","modules","templateName","templateSection","entry","schemaType","sectionList","t","s","m","component","modulesInSectionLists","moduleSchemas","schema","Set","split","FieldCasted","sources","structuredData","undefined","withValue","withTheme","theme","i","console","warn","getMenuItemsProps","getTypesFromSchemas","schemas","contentTypeSuffix","publicApiSuffix","contentTypePageListNames","contentTypeSimpleListNames","contentTypeTaxonomyListNames","contentTypeSuffixStr","contentTypeName","contentTypeKind","relatedContentTypeNames","componentName","relationsGeneric","interfaceForPublicAPI","MODULE_SCHEMAS","fromPage","taxonomy","relatedContentTypeNamesValues","JSON","stringify","default","isACategoryInterface","isListTemplate","mode","extendsString","types","typeStr","propsFromFields","content","configTabs","flatMap","tab","getAllFields","rawSchemasFromComponents","configFile","require","inputSchemas","menuItemsSchemas","languagesSchemas","moduleCategoriesSchema","datapacksSchema","datapacksCategoriesSchema","themesSchema","subthemesSchema","typeFileName","objectSchemas","assign","elementsUnionTypes","unionOfComponents","unionOfModules","unionOfTemplates","detailTemplates","getElementsUnionType","templateSectionList","templateSchema","sectionNames","getSectionList","allTypes","linkFields","link","groupFields","group","menuItemsInterface","languagesInterface","loc","label","moduleCategories","datapacks","datapacksCategories","allTaxonomyContentTypeProps","getTaxonomyContentTypesUnionType","allSimpleContentTypeProps","getSimpleContentTypeUnionProps","allPageContentTypeProps","getPageContentTypesUnionType","themes","subthemes","localConfFile","prettier","resolveConfigFile","prettierConfig","resolveConfig","useTabs","stringToPrettify","prettierConfigProps","parser","stringData","format","writeFile","err","log","main","all","templates","menuItems","languages","dataPacks","dataPacksCategories","autotypes"],"mappings":"gMAkHO,SAASA,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKN,EAAUO,KAAKF,GAAU,CAAC,MAAOG,GAAKL,EAAOK,EAAI,CA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K0F,IACL,GAAI,aAAcA,GAAUA,EAAO6B,SAClC,MAAO,GAAG7B,EAAOH,WAAa,oBAEf,IAEhB/E,OAAOtB,SACPuB,KAAK,IACR,CMvGqEyK,CAA6BzE,KAE3F0E,EAASjC,EACZ,iBAAiBA,EAChBlJ,KAAKiF,GAAU,IAAIA,EAAMnM,WACzB2H,KAAK,OACN,GAEG2K,EAAYjC,EACf,oBAAoBA,EACnBnJ,KAAKiF,GAAU,IAAIA,OACnBxE,KAAK,OACN,GAGG4K,QAAsBC,EAASC,oBAG/BC,SAFkBF,EAASG,cAAcJ,KACvB,CAAEK,SAAS,GAG7BC,EAAmB,SACtBpS,UACA+Q,UACAC,UACAN,UACAV,UACAM,UACAa,UACAC,UACAC,UACAC,UACAE,UACAE,UACAE,UACAC,UAGGQ,iCACFJ,GAAc,CACjBK,OAAQ,eASHC,SANyBR,EAASS,OACvCJ,EACAC,IAImC/K,QAAQ,WAAY,IAKxDmL,EACC,GAAGxO,EAAKiD,KAAK0C,IAAyBiG,KACtC0C,GACCG,IACA,GAAIA,EAAK,MAAMA,CAAG,IAKpB5F,QAAQ6F,IAAI,oBACZ,CDnLDC,CAAIrP,OAAAwM,OAAAxM,OAAAwM,OAAAxM,OAAAwM,OAAA,CAAA,EAECZ,EAAWjC,QAAQ2F,KACnB1D,EAAWjC,QAAQ4F,WACnB3D,EAAWjC,QAAQV,gBAEvB2C,EAAWjC,QAAQ6F,UACnB5D,EAAWjC,QAAQ8F,UACnB7D,EAAWgC,iBACXhC,EAAWjC,QAAQ+F,UACnB9D,EAAWjC,QAAQgG,oBACnB/D,EAAWyC,OACXzC,EAAW0C,UACX1C,EAAWgE","x_google_ignoreList":[0,3,4,5,7]}
package/dist/autotypes.js CHANGED
@@ -1,2 +1,2 @@
1
- import e from"path";import{writeFile as t}from"fs";import n from"prettier";import o from"node:path";import{fileURLToPath as i}from"node:url";import r from"node:process";import s from"node:fs";function l(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,l)}a((o=o.apply(e,t||[])).next())}))}const a="/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-use-before-define */\n//\n//\n// ' ____\n// /\\ \\\n// º / /\\ \\\n// ' / / \\ _>\n// ' _\\ \\__> \\__\n// ' O ( __;·;______ ) AutoTypes\n// O º, | , , \\ \\\\ ·..~~.·~.·\n// ,,, /| , , /\\ <\\\\\n// \\''\\-' ⎩, <\\/\\ \\ \\\n// \\_/ /\\_____⎩/ > > >\n// '___' <_(_)__> / \\ <\n// / / ´ \\ | \\___//\\\\\n// / / | / > > \\\\\n// · ··~~~~·~·~~~~~~~·~··~~~~~·~·~~·~~~~·~~~~~·· · ·\n//\n// Embrace the beauty of effortless typing by indulging in the benefits of them\n// sans the actual typing!\n//\n// Behold! These dynamically generated types were conjured from the schemas\n// nestled within this repository. However, should you yearn to expand upon\n// these types, kindly abstain from doing so in this file, lest AutoTypes'\n// magic shall smite your changes with each schema modification.\n//\n// Check out the details of Griddo AutoTypes in:\n// https://griddoio.notion.site/Griddo-AutoTypes-e7420867dd2e489c8da34a493b763cd8>\n//\n// Happy magic types!\n//\nimport { Core, Fields, Hideable, NonEmptyArray } from \"@griddo/core\"\n//\n",p="autotypes.d.ts",c="Props",u="ContentType",d="List",m=/[\p{Lu}]/u,y=/[\p{Ll}]/u,f=/^[\p{Lu}](?![\p{Lu}])/gu,g=/([\p{Alpha}\p{N}_]|$)/u,h=/[_.\- ]+/,$=new RegExp("^"+h.source),F=new RegExp(h.source+g.source,"gu"),T=new RegExp("\\d+"+g.source,"gu"),C=(e,t,n,o)=>{let i=!1,r=!1,s=!1,l=!1;for(let a=0;a<e.length;a++){const p=e[a];l=!(a>2)||"-"===e[a-3],i&&m.test(p)?(e=e.slice(0,a)+"-"+e.slice(a),i=!1,s=r,r=!0,a++):r&&s&&y.test(p)&&(!l||o)?(e=e.slice(0,a-1)+"-"+e.slice(a-1),s=r,r=!1,i=!0):(i=t(p)===p&&n(p)!==p,s=r,r=n(p)===p&&t(p)!==p)}return e},v=(e,t)=>(f.lastIndex=0,e.replaceAll(f,(e=>t(e)))),b=(e,t)=>(F.lastIndex=0,T.lastIndex=0,e.replaceAll(T,((n,o,i)=>["_","-"].includes(e.charAt(i+n.length))?n:t(n))).replaceAll(F,((e,n)=>t(n))));const j={directory:"isDirectory",file:"isFile"};const k=(e,t)=>t[j[e]](),_=e=>e instanceof URL?i(e):e;function x(e,{cwd:t=r.cwd(),type:n="file",allowSymlinks:i=!0}={}){!function(e){if(!Object.hasOwnProperty.call(j,e))throw new Error(`Invalid type specified: ${e}`)}(n),t=_(t);const l=i?s.statSync:s.lstatSync;for(const i of e)try{const e=l(o.resolve(t,i),{throwIfNoEntry:!1});if(!e)continue;if(k(n,e))return i}catch{}}const S=e=>e instanceof URL?i(e):e,A=Symbol("findUpStop");function w(e,t={}){const n=function(e,t={}){let n=o.resolve(S(t.cwd)||"");const{root:i}=o.parse(n),r=t.stopAt||i,s=t.limit||Number.POSITIVE_INFINITY,l=[e].flat(),a=t=>{if("function"!=typeof e)return x(l,t);const n=e(t.cwd);return"string"==typeof n?x([n],t):n},p=[];for(;;){const e=a({...t,cwd:n});if(e===A)break;if(e&&p.push(o.resolve(n,e)),n===r||p.length>=s)break;n=o.dirname(n)}return p}(e,{...t,limit:1});return n[0]}function D(e,t){var n;const{returnTypeName:o,generic:i}=t||{},r="hideable"in e&&Boolean(e.hideable),s=i?`<${i}>`:"",l=`${o||P(e.type)}${s}`,a=r?`Hideable<${l}>`:`${l}`;return`\n\t\t${(null===(n=e._autoType)||void 0===n?void 0:n.doc)||""}\n\t\t${`${e.key}?: ${a}`}\n\t`}function L(e,t){const n=(null==t?void 0:t.interfaceSuffix)||c;return e.length>1?`{\n\t\t\t${e.map((e=>`${function(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},0===(e=Array.isArray(e)?e.map((e=>e.trim())).filter((e=>e.length)).join("-"):e.trim()).length)return"";const n=!1===t.locale?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t.locale),o=!1===t.locale?e=>e.toUpperCase():e=>e.toLocaleUpperCase(t.locale);return 1===e.length?h.test(e)?"":t.pascalCase?o(e):n(e):(e!==n(e)&&(e=C(e,n,o,t.preserveConsecutiveUppercase)),e=e.replace($,""),e=t.preserveConsecutiveUppercase?v(e,n):n(e),t.pascalCase&&(e=o(e.charAt(0))+e.slice(1)),b(e,o))}(e)}?: ${e}${n}`)).join(",")}\n\t\t\t}`:e.map((e=>`${e}${n}`)).join("")}function P(e){return{ArrayFieldGroup:"Fields.ArrayFieldGroup",AsyncCheckGroup:"Fields.AsyncCheckGroup",AsyncSelect:"Fields.AsyncSelect",CheckGroup:"Fields.CheckGroup",ColorPicker:"Fields.ColorPicker",ComponentArray:"Fields.ComponentArray",ComponentContainer:"Fields.ComponentContainer",ConditionalField:"Fields.Conditional",DateField:"Fields.Date",FieldGroup:"Fields.FieldGroup",FieldsDivider:"Fields.FieldsDivider",FileField:"Fields.File",HeadingField:"Fields.Heading",ImageField:"Fields.Image",LinkField:"Fields.Link",MultiCheckSelect:"Fields.MultiCheckSelect",MultiCheckSelectGroup:"Fields.MultiCheckSelectGroup",NoteField:"Fields.Note",NumberField:"Fields.Number",RadioGroup:"Fields.RadioGroup",ReferenceField:"Fields.Reference",RichText:"Fields.RichText",Select:"Fields.Select",SliderField:"Fields.Slider",TagsField:"Fields.Tags",TextArea:"Fields.TextArea",TextField:"Fields.Text",TimeField:"Fields.Time",ToggleField:"Fields.Toggle",UniqueCheck:"Fields.UniqueCheck",UrlField:"Fields.Url",VisualUniqueSelection:"Fields.VisualUniqueSelection",Wysiwyg:"Fields.Wysiwyg"}[e]}const I=__dirname.includes("node_modules");function G(){const t=__dirname,n=I?"../../../":"../griddo-components";return e.resolve(function({cwd:e}={}){const t=w("package.json",{cwd:e});return t&&o.dirname(t)}({cwd:t}),n)}function M(e,t,n,o){var i,r;const s=(null==o?void 0:o.interfaceSuffix)||c;if("FieldsDivider"===e.type)return"// FieldsDivider";if(null===(i=e._autoType)||void 0===i?void 0:i.ignore)return"// Ignored by AutoType.ignore";const{type:l,_autoType:a,key:p}=e,{hasDistributorData:u,getStaticData:d}=n;if(!l||!p)return"\n\t\t\t/** · (ノ-_-)ノ ミ ┴┴ You forgot to write the `type` | `key` or some mandatory prop */\n\t\t";if("DateField"===l||"FileField"===l||"ImageField"===l||"NoteField"===l||"NumberField"===l||"RichText"===l||"SliderField"===l||"TagsField"===l||"TextArea"===l||"TextField"===l||"TimeField"===l||"ToggleField"===l||"UniqueCheck"===l||"UrlField"===l||"Wysiwyg"===l)return D(e);if("MultiCheckSelect"===l){if("pageContentType"===t||"simpleContentType"===t){return D(e,{generic:`Relations, FromList, ${`${e.source}ContentTypeProps`}<false, false>, FromDistributor`})}return D(e,{generic:"true"})}if("AsyncCheckGroup"===l){if("pageContentType"===t||"simpleContentType"===t){return D(e,{generic:`Relations, FromList, ${`${e.source}ContentTypeProps`}<false, false>, FromDistributor`})}return D(e,{generic:"true"})}if("MultiCheckSelectGroup"===l){const t=e.elements.map((e=>`"${e.key}"`)).join("|");return D(e,{generic:[t,null===(r=e._autoType)||void 0===r?void 0:r.relations].join(",")})}if("ColorPicker"===l)return e.isThemePalette?D(e,{returnTypeName:"Fields.ColorPickerFixed"}):D(e);if("HeadingField"===l||"RadioGroup"===l||"Select"===l){const{options:t}=e,n=function(e){return e.map((({value:e})=>"string"==typeof e?`"${e}"`:e)).join("|")}(t);return D(e,{generic:n})}if("CheckGroup"===l){const{options:t}=e,n=function(e){return e.map((({name:e})=>"string"==typeof e?`"${e}"`:e)).join("|")}(t);return D(e,{generic:n})}if("LinkField"===l){const{whiteList:t}=e;return D(e,{generic:L(t,o)})}if("AsyncSelect"===l){if("entity"in e&&"menu_containers"===e.entity)return`\n${p}?: Menu`;if("pageContentType"===t||"simpleContentType"===t){return D(e,{generic:`Relations, FromList, ${`${e.source}ContentTypeProps`}<false, false>, FromDistributor`})}return`\n${p}?: Fields.AsyncSelect;`}if("FieldGroup"===l)return`\n\t\t\t// << ${l}\n\t\t\t${e.fields.map((e=>M(e,t,n))).join("")}\n\t\t\t// end >>\n\t\t`;if("ArrayFieldGroup"===l){return`\n\t\t\t\n${(null==a?void 0:a.doc)||""}\n${p}?: Fields.ArrayFieldGroup<{${e.fields.map((e=>M(e,t,n))).join(",")}}>\n\t\t`}if("ConditionalField"===l){const o=e.fields.map((e=>M(e,t,n))),i=(null==a?void 0:a.doc)||"",r="hideable"in e&&e.hideable,s=r?">":"";return`\n\t\t\t// << ${l}\n\t\t\t\n${i}\n${p}?: ${r?"Hideable<":""}${P(l)}<${e.options.map((e=>"string"==typeof e.value?`"${e.value}"`:e.value)).join("|")}>${s};\n\t\t\t${o.join("")}\n\t\t\t// end >>\n\t\t`}if("ComponentArray"===l){const o="template"===t||"pageContentType"===t?"TemplateSection":"ComponentArray",i="template"===t?"":"?",r=e,{key:l,_autoType:a,whiteList:p}=r,c=(null==a?void 0:a.doc)||"",u=(e,t,n)=>e.filter((e=>{if(e&&"schemaType"in e&&"module"===(null==e?void 0:e.schemaType))return(null==e?void 0:e.sectionList)&&!!(null==e?void 0:e.sectionList[t])})).map((e=>({t:null==e?void 0:e.sectionList[t].filter((e=>e===n)),m:null==e?void 0:e.component}))).filter((e=>{var t;return null===(t=null==e?void 0:e.t)||void 0===t?void 0:t.length})).map((e=>null==e?void 0:e.m)).filter(Boolean);let d="";"template"===t&&(d=u(n.moduleSchemas,n.schema.component,l).join("|"));return`\n${c}\n${l}${i}: Fields.${o}<${[...new Set([...d.split("|"),...p])].filter(Boolean).map((e=>`${e}${s}`)).join("|")}>;`}if("ComponentContainer"===l&&("object"===t||"component"===t||"module"===t||"template"===t||"pageContentType"===t)){const t=e,{whiteList:n}=t;return D(e,{generic:L(n,o)})}if("ReferenceField"===l){const t=e.sources||[{structuredData:void 0}],n=Array.isArray(t)&&t.map((e=>e.structuredData?`${e.structuredData}ContentType${s}`:"unknown")).join("|")||"";return`\n\t\t \t${D(e,{generic:n})}\n\t\t \t${u||d?`queriedItems?: Fields.QueriedData<${n}>;`:""}\n\t\t `}if("VisualUniqueSelection"===l){const t=e.options[0],n=e.options[0];let o="";if(t.value){o=e.options.map((e=>`"${e.value}"`)).join("|")}if(n.theme){o=e.options[0].options.map((e=>`"${e.value}"`)).join("|")}return D(e,{generic:o})}return console.warn(`The field ${e.type} has not been implemented yet ㅠ.ㅠ`),""}function R(e){return e?e.map((e=>M(e,"object",{hasDistributorData:!1,getStaticData:!1,moduleSchemas:[],schema:{}}))).join(""):""}function E(e,t){const n=(null==t?void 0:t.contentTypeSuffix)||u,o=(null==t?void 0:t.interfaceSuffix)||c,i=(null==t?void 0:t.publicApiSuffix)||d,r=[],s=[],l=[];return`\n${e.map((t=>{var a;let p,c="",u="",d="",m="",y="",f="",g=!1,h=!1,$="";const{component:F}=t;f=(null===(a=t._autoType)||void 0===a?void 0:a.relations)||!1?"<Relations = unknown, FromList = unknown, FromDistributor = true>":"";const T=e.map((e=>{if("schemaType"in e&&"module"===e.schemaType)return e})).filter(Boolean);if("fromPage"in t){if(p=t.fromPage?"pageContentType":"simpleContentType",c=n,u=`__contentTypeName: "${t.component}";`,d=`__contentTypeKind: "${p}";`,"pageContentType"===p&&r.push(`"${t.component}"`),"simpleContentType"!==p||t.taxonomy||s.push(`"${t.component}"`),"simpleContentType"===p&&t.taxonomy&&l.push(`"${t.component}"`),"schema"in t){const e=t.schema.fields.map((e=>"source"in e&&(null==e?void 0:e.source))).filter(Boolean);m=e.length?`__relatedContentTypeNames: ${JSON.stringify(e)}`:""}f="<Relations = unknown, FromList = unknown, FromDistributor = true>",$=`\n\t\t\t\t/** Type to be consumed by public API: useList(), etc.. */\n\t\t\t\texport type ${F}${c}${i}${o}<R extends Core.ContentTypeRelations = false> = ${F}${c}${o}<R, true>;\n\t\t\t\t`}"schemaType"in t&&(p=t.schemaType,y=`component: "${F}";`,"template"!==t.schemaType&&"module"!==t.schemaType&&"component"!==t.schemaType||(g=t.default.hasDistributorData,h=t.default.getStaticData));const C="fromPage"in t&&!1===t.fromPage&&!0===t.taxonomy,v="schemaType"in t&&"template"===t.schemaType&&("list"===t.type.mode||"paginated-data"===t.type.mode),b=(j=[v?"Fields.ExtraListTemplateProps":""]).filter((e=>e.length)).length<1?"":`extends ${j.join(", ")}`;var j;const k=function(e){if("fromPage"in e)return e.taxonomy?[]:e.schema.fields;if("template"===e.schemaType)return[...e.content||[],...e.config||[]];if("component"===e.schemaType||"module"===e.schemaType)return e.configTabs.flatMap((e=>e.fields));throw new Error(`Wrong schema ${JSON.stringify(e,null,2)}`)}(t).map((e=>M(e,p,{hasDistributorData:g,getStaticData:h,moduleSchemas:T,schema:t}))).filter(Boolean).join("");return`\n\t\t\t\texport interface ${F}${c}${o}${f} ${b} {\n\t\t\t\t\t${u}\n\t\t\t\t\t${d}\n\t\t\t\t\t${m}\n\t\t\t\t\t${y}\n\t\t\t\t\t${k}\n\t\t\t\t\t${C?"title?: string; code?: string":""}\n\t\t\t\t}\n\t\t\t\t${$}\n\t\t\t\t`})).join("")}\n${r&&r.length?`export type PageContentTypes = ${r.join("|")};`:""}\n${s&&s.length?`export type SimpleContentTypes = ${s.join("|")};`:""}\n${l&&l.length?`export type TaxonomyContentTypes = ${l.join("|")};`:""}\n`}const O=e.join(G(),"griddo.config.ts"),N=require(O);!function(o,i,r,s,c,u,d,m,y){var f,g;l(this,void 0,void 0,(function*(){const l=p,h=($=o,Object.keys($).map((e=>Object.assign(Object.assign({},$[e]),{component:e}))));var $;const F=function(e){const t=[],n=[],o=[],i=[];for(let r=e.length,s=0;s<r;++s){const r=e[s];if("component"in r){const e=r.component;"component"===r.schemaType&&t.push(`"${e}"`),"module"===r.schemaType&&n.push(`"${e}"`),"template"===r.schemaType&&(o.push(`"${e}"`),"detail"===r.type.mode&&i.push(`"${e}"`))}}return`\n\t\t\n\t\texport type Components =\n\t\t\t${t.join("|")}\n\t\n\t\t\n\t\texport type Modules =\n\t\t\t${n.join("|")}\n\t\n\t\t\n\t\texport type Templates =\n\t\t\t${o.join("|")}\n\t\n\t\t\n\t\texport type DetailTemplates =\n\t\t\t${i.join("|")}\n\t\n\t`}(h),T=function(e){return`export type SectionList = { ${e.filter((e=>"schemaType"in e&&"template"===e.schemaType)).map((e=>{const t=e,n=t.content.filter((e=>"ComponentArray"===e.type)).map((({key:e})=>`"${e}"`)).filter(Boolean);return n&&(null==n?void 0:n.length)>0?`${t.component}?: NonEmptyArray<${n.join("|")}>;`:""})).join("")} }`}(h),C=E(h,y),v=null===(f=null==i?void 0:i.link)||void 0===f?void 0:f.fields,b=null===(g=null==i?void 0:i.group)||void 0===g?void 0:g.fields,j=`\n\t\texport interface InstanceMenuItems {\n\t\t\tlink:{\n\t\t\t\t${R(v)}\n\t\t\t\tconfig?: {\n\t\t\t\t\theaderStyle?: string;\n\t\t\t\t\tfooterStyle?: string;\n\t\t\t\t\ttype?: "link";\n\t\t\t\t};\n\t\t\t};\n\t\t\tgroup: {\n\t\t\t\turl?: null;\n\t\t\t\t${R(b)}\n\t\t\t\tconfig?: {\n\t\t\t\t\theaderStyle?: string;\n\t\t\t\t\tfooterStyle?: string;\n\t\t\t\t\ttype?: "group";\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\t\texport type LinkMenuElement = Fields.BaseLinkElement<InstanceMenuItems> & InstanceMenuItems["link"];\n\t\texport type GroupMenuElement = Fields.BaseLinkElement<InstanceMenuItems> & InstanceMenuItems["group"];\n\t\texport type MenuElement = LinkMenuElement | GroupMenuElement;\n\t\texport type Menu = Fields.Menu<InstanceMenuItems>;\n\t`,k=`\n\t\t// Type for the language schema\n\t\texport interface SiteLanguage {\n\t\t\tdomain: { id: number; url: string; slug: string };\n\t\t\thome: string;\n\t\t\tid: number;\n\t\t\tisDefault: boolean;\n\t\t\tlabel: ${Object.keys(r).map((e=>`"${r[e].label}"`)).join("|")};\n\t\t\tlanguage: ${Object.keys(r).map((e=>`"${r[e].name}"`)).join("|")};\n\t\t\tlocale: ${Object.keys(r).map((e=>`"${e}"`)).join("|")};\n\t\t\tpath: string;\n\t\t}\n\t`,_=s?`type ModuleCategories = ${s.map((e=>`"${e.value}"`)).join("|")}`:"",x=c?`type Datapacks = ${Object.keys(c).map((e=>`"${e}"`)).join("|")}`:"",S=u?`type DatapacksCategories = ${Object.keys(u).map((e=>`"${e}"`)).join("|")}`:"",A=`type AllTaxonomyContentTypeProps = ${function(e){return e.map((e=>{if("taxonomy"in e&&e.taxonomy)return`${e.component||""}ContentTypeProps`})).filter(Boolean).join("|")}(h)}`,w=`type AllPageContentTypeProps = ${function(e){return e.map((e=>{if("fromPage"in e&&!e.fromPage&&!e.taxonomy)return`${e.component||""}ContentTypeProps`})).filter(Boolean).join("|")}(h)}`,D=`type AllSimpleContentTypeProps = ${function(e){return e.map((e=>{if("fromPage"in e&&e.fromPage)return`${e.component||""}ContentTypeProps`})).filter(Boolean).join("|")}(h)}`,L=d?`type Themes = ${d.map((e=>`"${e.value}"`)).join("|")}`:"",P=m?`type Subthemes = ${m.map((e=>`"${e}"`)).join("|")}`:"",I=yield n.resolveConfigFile(),M=(yield n.resolveConfig(I))||{useTabs:!0},O=`\n\t\t${a}\n\t\t${j}\n\t\t${k}\n\t\t${C}\n\t\t${F}\n\t\t${T}\n\t\t${_}\n\t\t${x}\n\t\t${S}\n\t\t${A}\n\t\t${w}\n\t\t${D}\n\t\t${L}\n\t\t${P}\n\t\t`,N=Object.assign(Object.assign({},M),{parser:"typescript"}),U=(yield n.format(O,N)).replace(/^\s*\n/gm,"");t(`${e.join(G(),l)}`,U,(e=>{if(e)throw e})),console.log("🤖 AutoTypes ✓")}))}(Object.assign(Object.assign(Object.assign({},N.schemas.all),N.schemas.templates),N.schemas.structuredData),N.schemas.menuItems,N.schemas.languages,N.moduleCategories,N.schemas.dataPacks,N.schemas.dataPacksCategories,N.themes,N.subthemes,N.autotypes);
1
+ import e from"node:fs";import t from"node:path";import{fileURLToPath as n}from"node:url";import i from"node:process";import o from"prettier";function r(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{c(i.next(e))}catch(e){r(e)}}function a(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))}const s={directory:"isDirectory",file:"isFile"};const a=(e,t)=>t[s[e]](),c=e=>e instanceof URL?n(e):e;function l(n,{cwd:o=i.cwd(),type:r="file",allowSymlinks:l=!0}={}){!function(e){if(!Object.hasOwnProperty.call(s,e))throw new Error(`Invalid type specified: ${e}`)}(r),o=c(o);const u=l?e.statSync:e.lstatSync;for(const e of n)try{const n=u(t.resolve(o,e),{throwIfNoEntry:!1});if(!n)continue;if(a(r,n))return e}catch{}}const u=e=>e instanceof URL?n(e):e,p=Symbol("findUpStop");function d(e,n={}){const i=function(e,n={}){let i=t.resolve(u(n.cwd)||"");const{root:o}=t.parse(i),r=n.stopAt||o,s=n.limit||Number.POSITIVE_INFINITY,a=[e].flat(),c=t=>{if("function"!=typeof e)return l(a,t);const n=e(t.cwd);return"string"==typeof n?l([n],t):n},d=[];for(;;){const e=c({...n,cwd:i});if(e===p)break;if(e&&d.push(t.resolve(i,e)),i===r||d.length>=s)break;i=t.dirname(i)}return d}(e,{...n,limit:1});return i[0]}const m=__dirname.includes("node_modules");function f(){const e=__dirname,n=m?"../../../":"../griddo-components";return t.resolve(function({cwd:e}={}){const n=d("package.json",{cwd:e});return n&&t.dirname(n)}({cwd:e}),n)}function y(){var e,n,i;const o=t.join(f(),"griddo.config.ts"),r=require(o);return{interfaceSuffix:(null===(e=r.autotypes)||void 0===e?void 0:e.interfaceSuffix)||"Props",contentTypeSuffix:(null===(n=r.autotypes)||void 0===n?void 0:n.contentTypeSuffix)||"ContentTypes",publicApiSuffix:(null===(i=r.autotypes)||void 0===i?void 0:i.publicApiSuffix)||"List"}}const g=/[\p{Lu}]/u,h=/[\p{Ll}]/u,$=/^[\p{Lu}](?![\p{Lu}])/gu,b=/([\p{Alpha}\p{N}_]|$)/u,T=/[_.\- ]+/,S=new RegExp("^"+T.source),F=new RegExp(T.source+b.source,"gu"),C=new RegExp("\\d+"+b.source,"gu"),v=(e,t,n,i)=>{let o=!1,r=!1,s=!1,a=!1;for(let c=0;c<e.length;c++){const l=e[c];a=!(c>2)||"-"===e[c-3],o&&g.test(l)?(e=e.slice(0,c)+"-"+e.slice(c),o=!1,s=r,r=!0,c++):r&&s&&h.test(l)&&(!a||i)?(e=e.slice(0,c-1)+"-"+e.slice(c-1),s=r,r=!1,o=!0):(o=t(l)===l&&n(l)!==l,s=r,r=n(l)===l&&t(l)!==l)}return e},k=(e,t)=>($.lastIndex=0,e.replaceAll($,(e=>t(e)))),x=(e,t)=>(F.lastIndex=0,C.lastIndex=0,e.replaceAll(C,((n,i,o)=>["_","-"].includes(e.charAt(o+n.length))?n:t(n))).replaceAll(F,((e,n)=>t(n))));function j(e,t){var n;const{returnTypeName:i,generic:o}=t||{},r="hideable"in e&&Boolean(e.hideable),s=o?`<${o}>`:"",a=`${i||_(e.type)}${s}`,c=r?`Hideable<${a}>`:`${a}`;return`\n\t\t${(null===(n=e._autoType)||void 0===n?void 0:n.doc)||""}\n\t\t${`${e.key}?: ${c}`}\n\t`}function A(e){const{interfaceSuffix:t}=y();return e.length>1?`{\n\t\t\t${e.map((e=>`${function(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},0===(e=Array.isArray(e)?e.map((e=>e.trim())).filter((e=>e.length)).join("-"):e.trim()).length)return"";const n=!1===t.locale?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t.locale),i=!1===t.locale?e=>e.toUpperCase():e=>e.toLocaleUpperCase(t.locale);return 1===e.length?T.test(e)?"":t.pascalCase?i(e):n(e):(e!==n(e)&&(e=v(e,n,i,t.preserveConsecutiveUppercase)),e=e.replace(S,""),e=t.preserveConsecutiveUppercase?k(e,n):n(e),t.pascalCase&&(e=i(e.charAt(0))+e.slice(1)),x(e,i))}(e)}?: ${e}${t}`)).join(",")}\n\t\t\t}`:e.map((e=>`${e}${t}`)).join("")}function _(e){return{ArrayFieldGroup:"Fields.ArrayFieldGroup",AsyncCheckGroup:"Fields.AsyncCheckGroup",AsyncSelect:"Fields.AsyncSelect",CheckGroup:"Fields.CheckGroup",ColorPicker:"Fields.ColorPicker",ComponentArray:"Fields.ComponentArray",ComponentContainer:"Fields.ComponentContainer",ConditionalField:"Fields.Conditional",DateField:"Fields.Date",FieldGroup:"Fields.FieldGroup",FieldsDivider:"Fields.FieldsDivider",FileField:"Fields.File",HeadingField:"Fields.Heading",ImageField:"Fields.Image",LinkField:"Fields.Link",MultiCheckSelect:"Fields.MultiCheckSelect",MultiCheckSelectGroup:"Fields.MultiCheckSelectGroup",NoteField:"Fields.Note",NumberField:"Fields.Number",RadioGroup:"Fields.RadioGroup",ReferenceField:"Fields.Reference",RichText:"Fields.RichText",Select:"Fields.Select",SliderField:"Fields.Slider",TagsField:"Fields.Tags",TextArea:"Fields.TextArea",TextField:"Fields.Text",TimeField:"Fields.Time",ToggleField:"Fields.Toggle",UniqueCheck:"Fields.UniqueCheck",UrlField:"Fields.Url",VisualUniqueSelection:"Fields.VisualUniqueSelection",Wysiwyg:"Fields.Wysiwyg"}[e]}function D(e,t,n){var i,o;const{contentTypeSuffix:r,interfaceSuffix:s}=y();if("FieldsDivider"===e.type)return"// FieldsDivider";if(null===(i=e._autoType)||void 0===i?void 0:i.ignore)return"// Ignored by AutoType.ignore";const{type:a,_autoType:c,key:l}=e,{hasDistributorData:u,getStaticData:p}=n;if(!a||!l)return"\n\t\t\t/** · (ノ-_-)ノ ミ ┴┴ You forgot to write the `type` | `key` or some mandatory prop */\n\t\t";if("DateField"===a||"FileField"===a||"ImageField"===a||"NoteField"===a||"NumberField"===a||"RichText"===a||"SliderField"===a||"TagsField"===a||"TextArea"===a||"TextField"===a||"TimeField"===a||"ToggleField"===a||"UniqueCheck"===a||"UrlField"===a||"Wysiwyg"===a)return j(e);if("MultiCheckSelect"===a){if("pageContentType"===t||"simpleContentType"===t){return j(e,{generic:`Relations, FromList, ${`${e.source}${r}${s}`}<false, false>, FromDistributor`})}return j(e,{generic:"true"})}if("AsyncCheckGroup"===a){if("pageContentType"===t||"simpleContentType"===t){return j(e,{generic:`Relations, FromList, ${`${e.source}${r}${s}`}<false, false>, FromDistributor`})}return j(e,{generic:"true"})}if("MultiCheckSelectGroup"===a){const t=e.elements.map((e=>`"${e.key}"`)).join("|");return j(e,{generic:[t,null===(o=e._autoType)||void 0===o?void 0:o.relations].join(",")})}if("ColorPicker"===a)return e.isThemePalette?j(e,{returnTypeName:"Fields.ColorPickerFixed"}):j(e);if("HeadingField"===a||"RadioGroup"===a||"Select"===a){const{options:t}=e,n=function(e){return e.map((({value:e})=>"string"==typeof e?`"${e}"`:e)).join("|")}(t);return j(e,{generic:n})}if("CheckGroup"===a){const{options:t}=e,n=function(e){return e.map((({name:e})=>"string"==typeof e?`"${e}"`:e)).join("|")}(t);return j(e,{generic:n})}if("LinkField"===a){const{whiteList:t}=e;return j(e,{generic:A(t)})}if("AsyncSelect"===a){if("entity"in e&&"menu_containers"===e.entity)return`\n${l}?: Menu`;if("pageContentType"===t||"simpleContentType"===t){return j(e,{generic:`Relations, FromList, ${`${e.source}${r}${s}`}<false, false>, FromDistributor`})}return`\n${l}?: Fields.AsyncSelect;`}if("FieldGroup"===a)return`\n\t\t\t// << ${a}\n\t\t\t${e.fields.map((e=>D(e,t,n))).join("")}\n\t\t\t// end >>\n\t\t`;if("ArrayFieldGroup"===a){return`\n\t\t\t\n${(null==c?void 0:c.doc)||""}\n${l}?: Fields.ArrayFieldGroup<{${e.fields.map((e=>D(e,t,n))).join(",")}}>\n\t\t`}if("ConditionalField"===a){const i=e.fields.map((e=>D(e,t,n))),o=(null==c?void 0:c.doc)||"",r="hideable"in e&&e.hideable,s=r?">":"";return`\n\t\t\t// << ${a}\n\t\t\t\n${o}\n${l}?: ${r?"Hideable<":""}${_(a)}<${e.options.map((e=>"string"==typeof e.value?`"${e.value}"`:e.value)).join("|")}>${s};\n\t\t\t${i.join("")}\n\t\t\t// end >>\n\t\t`}if("ComponentArray"===a){const i="template"===t||"pageContentType"===t?"TemplateSection":"ComponentArray",o="template"===t?"":"?",r=e,{key:a,_autoType:c,whiteList:l}=r,u=(null==c?void 0:c.doc)||"",p=(e,t,n)=>e.filter((e=>{if(e&&"schemaType"in e&&"module"===(null==e?void 0:e.schemaType))return(null==e?void 0:e.sectionList)&&!!(null==e?void 0:e.sectionList[t])})).map((e=>({t:null==e?void 0:e.sectionList[t].filter((e=>e===n)),m:null==e?void 0:e.component}))).filter((e=>{var t;return null===(t=null==e?void 0:e.t)||void 0===t?void 0:t.length})).map((e=>null==e?void 0:e.m)).filter(Boolean);let d="";"template"===t&&(d=p(n.moduleSchemas,n.schema.component,a).join("|"));return`\n${u}\n${a}${o}: Fields.${i}<${[...new Set([...d.split("|"),...l])].filter(Boolean).map((e=>`${e}${s}`)).join("|")}>;`}if("ComponentContainer"===a&&("object"===t||"component"===t||"module"===t||"template"===t||"pageContentType"===t)){const t=e,{whiteList:n}=t;return j(e,{generic:A(n)})}if("ReferenceField"===a){const t=e.sources||[{structuredData:void 0}],n=Array.isArray(t)&&t.map((e=>e.structuredData?`${e.structuredData}${r}${s}`:"unknown")).join("|")||"";return`\n\t\t \t${j(e,{generic:n})}\n\t\t \t${u||p?`queriedItems?: Fields.QueriedData<${n}>;`:""}\n\t\t `}if("VisualUniqueSelection"===a){const t=e.options[0],n=e.options[0];let i="";if(t.value){i=e.options.map((e=>`"${e.value}"`)).join("|")}if(n.theme){i=e.options[0].options.map((e=>`"${e.value}"`)).join("|")}return j(e,{generic:i})}return console.warn(`The field ${e.type} has not been implemented yet ㅠ.ㅠ`),""}function w(e,t,n){return function(e){if("fromPage"in e)return e.taxonomy?[]:e.schema.fields;if("template"===e.schemaType){return[...e.content||[],...e.config||[]]}if("component"===e.schemaType||"module"===e.schemaType)return e.configTabs.flatMap((e=>e.fields));throw new Error(`Wrong schema ${JSON.stringify(e,null,2)}`)}(e).map((i=>D(i,n.kind,{hasDistributorData:n.hasDistributorData,getStaticData:n.getStaticData,moduleSchemas:t,schema:e}))).filter(Boolean).join("")}function O(e){const t=(n=e,Object.keys(n).map((e=>Object.assign(Object.assign({},n[e]),{component:e}))));var n;const{interfaceSuffix:i}=y(),{ARRAY_OF_MODULE_SCHEMAS:o}=function(e){return{ARRAY_OF_MODULE_SCHEMAS:e.map((e=>{if("schemaType"in e&&"module"===e.schemaType)return e})).filter(Boolean)}}(t);return t.map((e=>{var t;let n={kind:"component",contentTypeSuffixStr:"",contentTypeName:"",contentTypeKind:"",relatedContentTypeNames:"",componentName:"",hasDistributorData:!1,getStaticData:!1,interfaceForPublicAPI:"",relationsGeneric:(null===(t=e._autoType)||void 0===t?void 0:t.relations)?"<Relations = unknown, FromList = unknown, FromDistributor = true>":""};if(function(e){return"fromPage"in e}(e)){const t=function(e){const{contentTypeSuffix:t,interfaceSuffix:n,publicApiSuffix:i}=y(),o=[],r=[],s=[],a=e.fromPage?"pageContentType":"simpleContentType";"pageContentType"===a&&o.push(`"${e.component}"`),"simpleContentType"!==a||e.taxonomy||r.push(`"${e.component}"`),"simpleContentType"===a&&e.taxonomy&&s.push(`"${e.component}"`);let c="";if("schema"in e){const t=e.schema.fields.map((e=>"source"in e&&(null==e?void 0:e.source))).filter(Boolean);c=t.length?`__relatedContentTypeNames: ${JSON.stringify(t)}`:""}const l=`\n\t\t\t\t/** Type to be consumed by public API: useList(), etc.. */\n\t\t\t\texport type ${e.component}${t}${i}${n}<R extends Core.ContentTypeRelations = false> = ${e.component}${t}${n}<R, true>;\n\t\t\t\t`;return{kind:a,componentName:"",contentTypeName:`__contentTypeName: "${e.component}";`,contentTypeKind:`__contentTypeKind: "${a}";`,contentTypeSuffixStr:t,getStaticData:!1,hasDistributorData:!1,relatedContentTypeNames:c,relationsGeneric:"<Relations = unknown, FromList = unknown, FromDistributor = true>",interfaceForPublicAPI:l}}(e);n=Object.assign(Object.assign({},n),t)}if(function(e){return"schemaType"in e}(e)){const t=function(e){let t=!1,n=!1;return"template"!==e.schemaType&&"module"!==e.schemaType&&"component"!==e.schemaType||(t=e.default.hasDistributorData,n=e.default.getStaticData),{kind:e.schemaType,componentName:`component: "${e.component}"`,contentTypeName:"",contentTypeKind:"",contentTypeSuffixStr:"",relatedContentTypeNames:"",relationsGeneric:"",interfaceForPublicAPI:"",hasDistributorData:t,getStaticData:n}}(e);n=Object.assign(Object.assign({},n),t)}const r=w(e,o,n);return`\n\t\t\t\texport interface ${e.component}${n.contentTypeSuffixStr}${i}${n.relationsGeneric} ${function(e){const t=function(e){return"schemaType"in e&&"template"===e.schemaType&&("list"===e.type.mode||"paginated-data"===e.type.mode)}(e)?"Fields.ExtraListTemplateProps":"";return(n=[t]).filter((e=>e.length)).length<1?"":`extends ${n.join(", ")}`;var n}(e)} {\n\t\t\t\t\t${n.contentTypeName}\n\t\t\t\t\t${n.contentTypeKind}\n\t\t\t\t\t${n.relatedContentTypeNames}\n\t\t\t\t\t${n.componentName}\n\t\t\t\t\t${r}\n\t\t\t\t\t${function(e){return"fromPage"in e&&!e.fromPage&&!0===e.taxonomy}(e)?"title?: string; code?: string":""}\n\t\t\t\t}\n\t\t\t\t${n.interfaceForPublicAPI}\n\t\t\t`})).join("")}function E(e){return e?e.map((e=>D(e,"object",{hasDistributorData:!1,getStaticData:!1,moduleSchemas:[],schema:{}}))).join(""):""}const{FORCE_COLOR:I,NODE_DISABLE_COLORS:L,TERM:R}=process.env,M={enabled:!L&&"dumb"!==R&&"0"!==I,reset:G(0,0),bold:G(1,22),dim:G(2,22),italic:G(3,23),underline:G(4,24),inverse:G(7,27),hidden:G(8,28),strikethrough:G(9,29),black:G(30,39),red:G(31,39),green:G(32,39),yellow:G(33,39),blue:G(34,39),magenta:G(35,39),cyan:G(36,39),white:G(37,39),gray:G(90,39),grey:G(90,39),bgBlack:G(40,49),bgRed:G(41,49),bgGreen:G(42,49),bgYellow:G(43,49),bgBlue:G(44,49),bgMagenta:G(45,49),bgCyan:G(46,49),bgWhite:G(47,49)};function P(e,t){let n,i=0,o="",r="";for(;i<e.length;i++)n=e[i],o+=n.open,r+=n.close,t.includes(n.close)&&(t=t.replace(n.rgx,n.close+n.open));return o+t+r}function G(e,t){let n={open:`[${e}m`,close:`[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(t){return void 0!==this&&void 0!==this.has?(this.has.includes(e)||(this.has.push(e),this.keys.push(n)),void 0===t?this:M.enabled?P(this.keys,t+""):t+""):void 0===t?function(e,t){let n={has:e,keys:t};return n.reset=M.reset.bind(n),n.bold=M.bold.bind(n),n.dim=M.dim.bind(n),n.italic=M.italic.bind(n),n.underline=M.underline.bind(n),n.inverse=M.inverse.bind(n),n.hidden=M.hidden.bind(n),n.strikethrough=M.strikethrough.bind(n),n.black=M.black.bind(n),n.red=M.red.bind(n),n.green=M.green.bind(n),n.yellow=M.yellow.bind(n),n.blue=M.blue.bind(n),n.magenta=M.magenta.bind(n),n.cyan=M.cyan.bind(n),n.white=M.white.bind(n),n.gray=M.gray.bind(n),n.grey=M.grey.bind(n),n.bgBlack=M.bgBlack.bind(n),n.bgRed=M.bgRed.bind(n),n.bgGreen=M.bgGreen.bind(n),n.bgYellow=M.bgYellow.bind(n),n.bgBlue=M.bgBlue.bind(n),n.bgMagenta=M.bgMagenta.bind(n),n.bgCyan=M.bgCyan.bind(n),n.bgWhite=M.bgWhite.bind(n),n}([e],[n]):M.enabled?P([n],t+""):t+""}}const N="/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-use-before-define */\n//\n//\n// ' ____\n// /\\ \\\n// º / /\\ \\\n// ' / / \\ _>\n// ' _\\ \\__> \\__\n// ' O ( __;·;______ ) AutoTypes\n// O º, | , , \\ \\\\ ·..~~.·~.·\n// ,,, /| , , /\\ <\\\\\n// \\''\\-' ⎩, <\\/\\ \\ \\\n// \\_/ /\\_____⎩/ > > >\n// '___' <_(_)__> / \\ <\n// / / ´ \\ | \\___//\\\\\n// / / | / > > \\\\\n// · ··~~~~·~·~~~~~~~·~··~~~~~·~·~~·~~~~·~~~~~·· · ·\n//\n// Embrace the beauty of effortless typing by indulging in the benefits of them\n// sans the actual typing!\n//\n// Behold! These dynamically generated types were conjured from the schemas\n// nestled within this repository. However, should you yearn to expand upon\n// these types, kindly abstain from doing so in this file, lest AutoTypes'\n// magic shall smite your changes with each schema modification.\n//\n// Check out the details of Griddo AutoTypes in:\n// https://griddoio.notion.site/Griddo-AutoTypes-e7420867dd2e489c8da34a493b763cd8>\n//\n// Happy magic types!\n//\nimport { Core, Fields, Hideable, NonEmptyArray } from \"@griddo/core\"\n//\n",U=`${M.green(" ✔")} AutoTypes`;function B(n){return r(this,void 0,void 0,(function*(){const{categoryContentTypes:i,pageContentTypes:s,simpleContentTypes:a,componentsSchema:c,datapacksCategoriesSchema:l,datapacksSchema:u,languagesSchemas:p,menuItemsSchemas:d,moduleCategoriesSchema:m,modulesSchema:g,structuredDataSchema:h,subthemesSchema:$,templatesSchema:b,themesSchema:T}=n,S=Object.assign(Object.assign(Object.assign(Object.assign({},c),g),b),h),F=t.join(f(),"autotypes.d.ts"),C=O(S),v=function(e){var t,n;const i=null===(t=null==e?void 0:e.link)||void 0===t?void 0:t.fields,o=null===(n=null==e?void 0:e.group)||void 0===n?void 0:n.fields;return`\n\t\texport interface InstanceMenuItems {\n\t\t\tlink:{\n\t\t\t\t${E(i)}\n\t\t\t\tconfig?: {\n\t\t\t\t\theaderStyle?: string;\n\t\t\t\t\tfooterStyle?: string;\n\t\t\t\t\ttype?: "link";\n\t\t\t\t};\n\t\t\t};\n\t\t\tgroup: {\n\t\t\t\turl?: null;\n\t\t\t\t${E(o)}\n\t\t\t\tconfig?: {\n\t\t\t\t\theaderStyle?: string;\n\t\t\t\t\tfooterStyle?: string;\n\t\t\t\t\ttype?: "group";\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\t\texport type LinkMenuElement = Fields.BaseLinkElement<InstanceMenuItems> & InstanceMenuItems["link"];\n\t\texport type GroupMenuElement = Fields.BaseLinkElement<InstanceMenuItems> & InstanceMenuItems["group"];\n\t\texport type MenuElement = LinkMenuElement | GroupMenuElement;\n\t\texport type Menu = Fields.Menu<InstanceMenuItems>;\n\t`}(d),k=function(e){const t=Object.keys(e);return`\n\t\texport interface SiteLanguage {\n\t\t\tdomain: { id: number; url: string; slug: string };\n\t\t\thome: string;\n\t\t\tid: number;\n\t\t\tisDefault: boolean;\n\t\t\tlabel: ${t.map((t=>`"${e[t].label}"`)).join("|")};\n\t\t\tlanguage: ${t.map((t=>`"${e[t].name}"`)).join("|")};\n\t\t\tlocale: ${t.map((e=>`"${e}"`)).join("|")}\n\t\t\tpath: string;\n\t\t}\n\t`}(p),x=(j=m)?`export type ModuleCategories = ${j.map((e=>`"${e.value}"`)).join("|")}`:"";var j;const A=function(e){const t=Object.keys(e).map((e=>`"${e}"`));return t.length?`export type TaxonomyContentTypes = ${t.join("|")}`:""}(i),_=function(e){const t=Object.keys(e).map((e=>`"${e}"`));return t.length?`export type PageContentTypes = ${t.join("|")}`:""}(s),D=function(e){const t=Object.keys(e).map((e=>`"${e}"`));return t.length?`export type SimpleContentTypes = ${t.join("|")}`:""}(a),w=function(e){const t=Object.keys(e).map((e=>`"${e}"`));return t.length?`export type Components = ${t.join("|")}`:""}(c),I=function(e){const t=Object.keys(e).map((e=>`"${e}"`));return t.length?`export type Modules = ${t.join("|")}`:""}(g),L=function(e){const t=Object.keys(e).map((e=>`"${e}"`));return t.length?`export type Templates = ${t.join("|")}`:""}(b),R=function(e){const t=Object.keys(e).map((t=>"detail"===e[t].type.mode?`"${t}"`:"")).filter(Boolean);return t.length?`export type DetailTemplates = ${t.join("|")}`:""}(b),M=function(e){const t=[];for(const n in e){const i=e[n],o=i.content.filter((e=>"ComponentArray"===e.type)).map((({key:e})=>`"${e}"`)).filter(Boolean),r=o&&(null==o?void 0:o.length)>0?`${i.component}?: NonEmptyArray<${o.join("|")}>;`:"";t.push(r)}return`\n\t\texport type SectionList = { ${t.join("")} }\n\t`}(b),P=function(e){const{contentTypeSuffix:t,interfaceSuffix:n}=y(),i=Object.keys(e).map((e=>`${e}${t}${n}`));return i.length?`export type Taxonomy${t}${n} = ${i.join("|")}`:""}(i),G=function(e){const{contentTypeSuffix:t,interfaceSuffix:n}=y(),i=Object.keys(e).map((e=>`${e}${t}${n}`));return i.length?`export type Simple${t}${n} = ${i.join("|")}`:""}(a),B=function(e){const{contentTypeSuffix:t,interfaceSuffix:n}=y(),i=Object.keys(e).map((e=>`${e}${t}${n}`));return i.length?`export type Page${t}${n} = ${i.join("|")}`:""}(s),{SUBTHEMES:H,THEMES:K}=function(e,t){return{THEMES:e?`export type Themes = ${e.map((e=>`"${e.value}"`)).join("|")}`:"",SUBTHEMES:t?`export type Subthemes = ${t.map((e=>`"${e}"`)).join("|")}`:""}}(T,$),{DATAPACKS:q,DATAPACKS_CATEGORIES:W}=function(e,t){return{DATAPACKS:e?`export type Datapacks = ${Object.keys(e).map((e=>`"${e}"`)).join("|")}`:"",DATAPACKS_CATEGORIES:t?`export type DatapacksCategories = ${Object.keys(t).map((e=>`"${e}"`)).join("|")}`:""}}(u,l),Y=yield function(e){return r(this,void 0,void 0,(function*(){const t=yield o.resolveConfigFile(),n=(yield o.resolveConfig(t))||{useTabs:!0},i=Object.assign(Object.assign({},n),{parser:"typescript"});return(yield o.format(e,i)).replace(/^\s*\n/gm,"")}))}(`\n\t\t${N}\n\t\t${v}\n\t\t${k}\n\t\t${C} \n\t\t${_}\n\t\t${D}\n\t\t${A}\n\t\t${w}\n\t\t${I}\n\t\t${L}\n\t\t${R}\n\t\t${M}\n\t\t${x}\n\t\t${q}\n\t\t${W}\n\t\t${P}\n\t\t${G}\n\t\t${B}\n\t\t${K}\n\t\t${H}\n\t\t`);e.writeFileSync(F,Y),console.log(U)}))}r(void 0,void 0,void 0,(function*(){const e=t.join(f(),"griddo.config.ts");try{const t=yield import(e),{categoryContentTypes:n,componentsSchema:i,pageContentTypes:o,simpleContentTypes:r}=function(e){return{categoryContentTypes:function(e){const t={};for(const n in e){const i=e[n];!i.fromPage&&i.taxonomy&&(t[n]=i)}return t}(e.schemas.structuredData),pageContentTypes:function(e){const t={};for(const n in e){const i=e[n];i.fromPage&&(t[n]=i)}return t}(e.schemas.structuredData),simpleContentTypes:function(e){const t={};for(const n in e){const i=e[n];i.fromPage||i.taxonomy||(t[n]=i)}return t}(e.schemas.structuredData),componentsSchema:function(e){const t={};for(const n in e){const i=e[n];"component"===i.schemaType&&(t[n]=i)}return t}(e.schemas.all)}}(t);B({categoryContentTypes:n,pageContentTypes:o,simpleContentTypes:r,componentsSchema:i,modulesSchema:t.schemas.modules,templatesSchema:t.schemas.templates,structuredDataSchema:t.schemas.structuredData,menuItemsSchemas:t.schemas.menuItems,languagesSchemas:t.schemas.languages,moduleCategoriesSchema:t.moduleCategories,datapacksSchema:t.schemas.dataPacks,datapacksCategoriesSchema:t.schemas.dataPacksCategories,themesSchema:t.themes,subthemesSchema:t.subthemes,config:t.autotypes})}catch(t){console.error(`Failed to load config file from ${e}:`,t)}}));export{B as main};
2
2
  //# sourceMappingURL=autotypes.js.map