@justanarthur/payload-plugin-translator 1.3.8 → 1.3.9
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.
- package/README.md +215 -215
- package/dist/client/api/index.js.map +1 -1
- package/dist/client/components/CustomButton/CustomButtonWithTranslator.js.map +1 -1
- package/dist/client/components/CustomButton/styles.scss +5 -5
- package/dist/client/components/LocaleLabel/LocaleLabel.js.map +1 -1
- package/dist/client/components/LocaleLabel/index.js.map +1 -1
- package/dist/client/components/ResolverButton/ResolverButton.js.map +1 -1
- package/dist/client/components/ResolverButton/index.js.map +1 -1
- package/dist/client/components/TranslatorModal/Content.js.map +1 -1
- package/dist/client/components/TranslatorModal/TranslatorModal.js.map +1 -1
- package/dist/client/components/TranslatorModal/index.js.map +1 -1
- package/dist/client/components/TranslatorModal/styles.scss +76 -76
- package/dist/client/providers/Translator/TranslatorProvider.js.map +1 -1
- package/dist/client/providers/Translator/context.js.map +1 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/i18n-translations.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/resolvers/copy.js.map +1 -1
- package/dist/resolvers/google.js.map +1 -1
- package/dist/resolvers/libreTranslate.js.map +1 -1
- package/dist/resolvers/openAI.js.map +1 -1
- package/dist/resolvers/types.js.map +1 -1
- package/dist/translate/endpoint.js.map +1 -1
- package/dist/translate/findEntityWithConfig.js.map +1 -1
- package/dist/translate/operation.js.map +1 -1
- package/dist/translate/traverseFields.js.map +1 -1
- package/dist/translate/traverseRichText.d.ts +1 -1
- package/dist/translate/traverseRichText.d.ts.map +1 -1
- package/dist/translate/traverseRichText.js +6 -0
- package/dist/translate/traverseRichText.js.map +1 -1
- package/dist/translate/types.js.map +1 -1
- package/dist/translate/updateEntity.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/chunkArray.js.map +1 -1
- package/dist/utils/isEmpty.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/translate/updateEntity.ts"],"sourcesContent":["import type { CollectionSlug, GlobalSlug, PayloadRequest, TypeWithID } from 'payload'\nimport { APIError } from 'payload'\n\ntype Args = {\n collectionSlug?: string\n data: Record<string, any>\n depth?: number\n globalSlug?: string\n id?: number | string\n locale: string\n overrideAccess?: boolean\n req: PayloadRequest\n}\n\nexport const updateEntity = ({\n collectionSlug,\n data,\n depth: incomingDepth,\n globalSlug,\n id,\n locale,\n overrideAccess,\n req,\n}: Args): Promise<Record<string, unknown> & TypeWithID> => {\n if (!collectionSlug && !globalSlug) throw new APIError('Bad Request', 400)\n\n const isGlobal = !!globalSlug\n\n if (!isGlobal && !id) throw new APIError('Bad Request', 400)\n\n const depth = incomingDepth ?? req.payload.config.defaultDepth\n\n const promise = isGlobal\n ? req.payload.updateGlobal({\n data,\n depth,\n locale: locale as any,\n overrideAccess,\n req,\n slug: globalSlug as GlobalSlug,\n })\n : req.payload.update({\n collection: collectionSlug as CollectionSlug,\n data,\n depth,\n id: id as number | string,\n locale: locale as any,\n overrideAccess,\n req,\n })\n\n return promise as any\n}\n"],"names":["APIError","updateEntity","collectionSlug","data","depth","incomingDepth","globalSlug","id","locale","overrideAccess","req","isGlobal","payload","config","defaultDepth","promise","updateGlobal","slug","update","collection"],"mappings":"AACA,SAASA,QAAQ,QAAQ,UAAS;AAalC,OAAO,MAAMC,eAAe,CAAC,EAC3BC,cAAc,EACdC,IAAI,EACJC,OAAOC,aAAa,EACpBC,UAAU,EACVC,EAAE,EACFC,MAAM,EACNC,cAAc,EACdC,GAAG,EACE;IACL,IAAI,CAACR,kBAAkB,CAACI,YAAY,MAAM,IAAIN,SAAS,eAAe;IAEtE,MAAMW,WAAW,CAAC,CAACL;IAEnB,IAAI,CAACK,YAAY,CAACJ,IAAI,MAAM,IAAIP,SAAS,eAAe;IAExD,MAAMI,QAAQC,iBAAiBK,IAAIE,OAAO,CAACC,MAAM,CAACC,YAAY;IAE9D,MAAMC,UAAUJ,WACZD,IAAIE,OAAO,CAACI,YAAY,CAAC;QACvBb;QACAC;QACAI,QAAQA;QACRC;QACAC;QACAO,MAAMX;IACR,KACAI,IAAIE,OAAO,CAACM,MAAM,CAAC;QACjBC,YAAYjB;QACZC;QACAC;QACAG,IAAIA;QACJC,QAAQA;QACRC;QACAC;IACF;IAEJ,OAAOK;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/translate/updateEntity.ts"],"sourcesContent":["import type { CollectionSlug, GlobalSlug, PayloadRequest, TypeWithID } from 'payload'\r\nimport { APIError } from 'payload'\r\n\r\ntype Args = {\r\n collectionSlug?: string\r\n data: Record<string, any>\r\n depth?: number\r\n globalSlug?: string\r\n id?: number | string\r\n locale: string\r\n overrideAccess?: boolean\r\n req: PayloadRequest\r\n}\r\n\r\nexport const updateEntity = ({\r\n collectionSlug,\r\n data,\r\n depth: incomingDepth,\r\n globalSlug,\r\n id,\r\n locale,\r\n overrideAccess,\r\n req,\r\n}: Args): Promise<Record<string, unknown> & TypeWithID> => {\r\n if (!collectionSlug && !globalSlug) throw new APIError('Bad Request', 400)\r\n\r\n const isGlobal = !!globalSlug\r\n\r\n if (!isGlobal && !id) throw new APIError('Bad Request', 400)\r\n\r\n const depth = incomingDepth ?? req.payload.config.defaultDepth\r\n\r\n const promise = isGlobal\r\n ? req.payload.updateGlobal({\r\n data,\r\n depth,\r\n locale: locale as any,\r\n overrideAccess,\r\n req,\r\n slug: globalSlug as GlobalSlug,\r\n })\r\n : req.payload.update({\r\n collection: collectionSlug as CollectionSlug,\r\n data,\r\n depth,\r\n id: id as number | string,\r\n locale: locale as any,\r\n overrideAccess,\r\n req,\r\n })\r\n\r\n return promise as any\r\n}\r\n"],"names":["APIError","updateEntity","collectionSlug","data","depth","incomingDepth","globalSlug","id","locale","overrideAccess","req","isGlobal","payload","config","defaultDepth","promise","updateGlobal","slug","update","collection"],"mappings":"AACA,SAASA,QAAQ,QAAQ,UAAS;AAalC,OAAO,MAAMC,eAAe,CAAC,EAC3BC,cAAc,EACdC,IAAI,EACJC,OAAOC,aAAa,EACpBC,UAAU,EACVC,EAAE,EACFC,MAAM,EACNC,cAAc,EACdC,GAAG,EACE;IACL,IAAI,CAACR,kBAAkB,CAACI,YAAY,MAAM,IAAIN,SAAS,eAAe;IAEtE,MAAMW,WAAW,CAAC,CAACL;IAEnB,IAAI,CAACK,YAAY,CAACJ,IAAI,MAAM,IAAIP,SAAS,eAAe;IAExD,MAAMI,QAAQC,iBAAiBK,IAAIE,OAAO,CAACC,MAAM,CAACC,YAAY;IAE9D,MAAMC,UAAUJ,WACZD,IAAIE,OAAO,CAACI,YAAY,CAAC;QACvBb;QACAC;QACAI,QAAQA;QACRC;QACAC;QACAO,MAAMX;IACR,KACAI,IAAIE,OAAO,CAACM,MAAM,CAAC;QACjBC,YAAYjB;QACZC;QACAC;QACAG,IAAIA;QACJC,QAAQA;QACRC;QACAC;IACF;IAEJ,OAAOK;AACT,EAAC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionSlug, GlobalSlug } from 'payload'\n\nimport type { TranslateResolver } from './resolvers/types'\n\nexport type TranslatorConfig = {\n /**\n * Collections with the enabled translator in the admin UI\n */\n collections: CollectionSlug[]\n /**\n * Disable the plugin\n */\n disabled?: boolean\n /**\n * Globals with the enabled translator in the admin UI\n */\n globals: GlobalSlug[]\n /**\n * Add resolvers that you want to include, examples on how to write your own in ./plugin/src/resolvers\n */\n resolvers: TranslateResolver[]\n}\n"],"names":[],"mappings":"AAIA,WAiBC"}
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionSlug, GlobalSlug } from 'payload'\r\n\r\nimport type { TranslateResolver } from './resolvers/types'\r\n\r\nexport type TranslatorConfig = {\r\n /**\r\n * Collections with the enabled translator in the admin UI\r\n */\r\n collections: CollectionSlug[]\r\n /**\r\n * Disable the plugin\r\n */\r\n disabled?: boolean\r\n /**\r\n * Globals with the enabled translator in the admin UI\r\n */\r\n globals: GlobalSlug[]\r\n /**\r\n * Add resolvers that you want to include, examples on how to write your own in ./plugin/src/resolvers\r\n */\r\n resolvers: TranslateResolver[]\r\n}\r\n"],"names":[],"mappings":"AAIA,WAiBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/chunkArray.ts"],"sourcesContent":["export const chunkArray = <T>(array: T[], length: number): T[][] => {\n return Array.from({ length: Math.ceil(array.length / length) }, (_, i) =>\n array.slice(i * length, i * length + length),\n )\n}\n"],"names":["chunkArray","array","length","Array","from","Math","ceil","_","i","slice"],"mappings":"AAAA,OAAO,MAAMA,aAAa,CAAIC,OAAYC;IACxC,OAAOC,MAAMC,IAAI,CAAC;QAAEF,QAAQG,KAAKC,IAAI,CAACL,MAAMC,MAAM,GAAGA;IAAQ,GAAG,CAACK,GAAGC,IAClEP,MAAMQ,KAAK,CAACD,IAAIN,QAAQM,IAAIN,SAASA;AAEzC,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/chunkArray.ts"],"sourcesContent":["export const chunkArray = <T>(array: T[], length: number): T[][] => {\r\n return Array.from({ length: Math.ceil(array.length / length) }, (_, i) =>\r\n array.slice(i * length, i * length + length),\r\n )\r\n}\r\n"],"names":["chunkArray","array","length","Array","from","Math","ceil","_","i","slice"],"mappings":"AAAA,OAAO,MAAMA,aAAa,CAAIC,OAAYC;IACxC,OAAOC,MAAMC,IAAI,CAAC;QAAEF,QAAQG,KAAKC,IAAI,CAACL,MAAMC,MAAM,GAAGA;IAAQ,GAAG,CAACK,GAAGC,IAClEP,MAAMQ,KAAK,CAACD,IAAIN,QAAQM,IAAIN,SAASA;AAEzC,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/isEmpty.ts"],"sourcesContent":["export const isEmpty = (value: unknown) => {\n if (Array.isArray(value)) return value.length === 0\n if (value === null || typeof value === 'undefined') return true\n if (typeof value === 'object' && Object.keys(value).length === 0) return true\n\n return false\n}\n"],"names":["isEmpty","value","Array","isArray","length","Object","keys"],"mappings":"AAAA,OAAO,MAAMA,UAAU,CAACC;IACtB,IAAIC,MAAMC,OAAO,CAACF,QAAQ,OAAOA,MAAMG,MAAM,KAAK;IAClD,IAAIH,UAAU,QAAQ,OAAOA,UAAU,aAAa,OAAO;IAC3D,IAAI,OAAOA,UAAU,YAAYI,OAAOC,IAAI,CAACL,OAAOG,MAAM,KAAK,GAAG,OAAO;IAEzE,OAAO;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/isEmpty.ts"],"sourcesContent":["export const isEmpty = (value: unknown) => {\r\n if (Array.isArray(value)) return value.length === 0\r\n if (value === null || typeof value === 'undefined') return true\r\n if (typeof value === 'object' && Object.keys(value).length === 0) return true\r\n\r\n return false\r\n}\r\n"],"names":["isEmpty","value","Array","isArray","length","Object","keys"],"mappings":"AAAA,OAAO,MAAMA,UAAU,CAACC;IACtB,IAAIC,MAAMC,OAAO,CAACF,QAAQ,OAAOA,MAAMG,MAAM,KAAK;IAClD,IAAIH,UAAU,QAAQ,OAAOA,UAAU,aAAa,OAAO;IAC3D,IAAI,OAAOA,UAAU,YAAYI,OAAOC,IAAI,CAACL,OAAOG,MAAM,KAAK,GAAG,OAAO;IAEzE,OAAO;AACT,EAAC"}
|