@payloadcms/graphql 3.0.0-beta.13 → 3.0.0-beta.130
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/bin.js +54 -0
- package/dist/bin/generateSchema.d.ts +3 -0
- package/dist/bin/generateSchema.d.ts.map +1 -0
- package/dist/bin/generateSchema.js +10 -0
- package/dist/bin/generateSchema.js.map +1 -0
- package/dist/bin/index.d.ts +2 -0
- package/dist/bin/index.d.ts.map +1 -0
- package/dist/bin/index.js +17 -0
- package/dist/bin/index.js.map +1 -0
- package/dist/exports/types.d.ts +4 -0
- package/dist/exports/types.d.ts.map +1 -0
- package/dist/exports/types.js +5 -0
- package/dist/exports/types.js.map +1 -0
- package/dist/exports/utilities.d.ts +3 -0
- package/dist/exports/utilities.d.ts.map +1 -0
- package/dist/exports/utilities.js +4 -0
- package/dist/exports/utilities.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/packages/graphql-query-complexity/QueryComplexity.d.ts +2 -2
- package/dist/packages/graphql-query-complexity/QueryComplexity.d.ts.map +1 -1
- package/dist/packages/graphql-query-complexity/QueryComplexity.js +7 -7
- package/dist/packages/graphql-query-complexity/QueryComplexity.js.map +1 -1
- package/dist/packages/graphql-query-complexity/createComplexityRule.d.ts +1 -1
- package/dist/packages/graphql-query-complexity/createComplexityRule.d.ts.map +1 -1
- package/dist/packages/graphql-query-complexity/createComplexityRule.js +1 -1
- package/dist/packages/graphql-query-complexity/createComplexityRule.js.map +1 -1
- package/dist/packages/graphql-query-complexity/estimators/fieldExtensions/index.js.map +1 -1
- package/dist/packages/graphql-query-complexity/estimators/simple/index.js.map +1 -1
- package/dist/packages/graphql-query-complexity/index.js.map +1 -1
- package/dist/packages/graphql-type-json/index.d.ts.map +1 -1
- package/dist/packages/graphql-type-json/index.js +5 -6
- package/dist/packages/graphql-type-json/index.js.map +1 -1
- package/dist/resolvers/auth/access.d.ts +2 -3
- package/dist/resolvers/auth/access.d.ts.map +1 -1
- package/dist/resolvers/auth/access.js +3 -5
- package/dist/resolvers/auth/access.js.map +1 -1
- package/dist/resolvers/auth/forgotPassword.d.ts +2 -3
- package/dist/resolvers/auth/forgotPassword.d.ts.map +1 -1
- package/dist/resolvers/auth/forgotPassword.js +4 -5
- package/dist/resolvers/auth/forgotPassword.js.map +1 -1
- package/dist/resolvers/auth/init.d.ts +1 -2
- package/dist/resolvers/auth/init.d.ts.map +1 -1
- package/dist/resolvers/auth/init.js +2 -4
- package/dist/resolvers/auth/init.js.map +1 -1
- package/dist/resolvers/auth/login.d.ts +2 -3
- package/dist/resolvers/auth/login.d.ts.map +1 -1
- package/dist/resolvers/auth/login.js +6 -8
- package/dist/resolvers/auth/login.js.map +1 -1
- package/dist/resolvers/auth/logout.d.ts +2 -3
- package/dist/resolvers/auth/logout.d.ts.map +1 -1
- package/dist/resolvers/auth/logout.js +5 -7
- package/dist/resolvers/auth/logout.js.map +1 -1
- package/dist/resolvers/auth/me.d.ts +2 -3
- package/dist/resolvers/auth/me.d.ts.map +1 -1
- package/dist/resolvers/auth/me.js +4 -4
- package/dist/resolvers/auth/me.js.map +1 -1
- package/dist/resolvers/auth/refresh.d.ts +2 -3
- package/dist/resolvers/auth/refresh.d.ts.map +1 -1
- package/dist/resolvers/auth/refresh.js +6 -15
- package/dist/resolvers/auth/refresh.js.map +1 -1
- package/dist/resolvers/auth/resetPassword.d.ts +2 -3
- package/dist/resolvers/auth/resetPassword.d.ts.map +1 -1
- package/dist/resolvers/auth/resetPassword.js +10 -9
- package/dist/resolvers/auth/resetPassword.js.map +1 -1
- package/dist/resolvers/auth/unlock.d.ts +2 -3
- package/dist/resolvers/auth/unlock.d.ts.map +1 -1
- package/dist/resolvers/auth/unlock.js +4 -5
- package/dist/resolvers/auth/unlock.js.map +1 -1
- package/dist/resolvers/auth/verifyEmail.d.ts +2 -3
- package/dist/resolvers/auth/verifyEmail.d.ts.map +1 -1
- package/dist/resolvers/auth/verifyEmail.js +8 -6
- package/dist/resolvers/auth/verifyEmail.js.map +1 -1
- package/dist/resolvers/collections/count.d.ts +2 -3
- package/dist/resolvers/collections/count.d.ts.map +1 -1
- package/dist/resolvers/collections/count.js +3 -3
- package/dist/resolvers/collections/count.js.map +1 -1
- package/dist/resolvers/collections/create.d.ts +5 -8
- package/dist/resolvers/collections/create.d.ts.map +1 -1
- package/dist/resolvers/collections/create.js +2 -3
- package/dist/resolvers/collections/create.js.map +1 -1
- package/dist/resolvers/collections/delete.d.ts +6 -6
- package/dist/resolvers/collections/delete.d.ts.map +1 -1
- package/dist/resolvers/collections/delete.js +12 -6
- package/dist/resolvers/collections/delete.js.map +1 -1
- package/dist/resolvers/collections/docAccess.d.ts +1 -2
- package/dist/resolvers/collections/docAccess.d.ts.map +1 -1
- package/dist/resolvers/collections/docAccess.js +1 -2
- package/dist/resolvers/collections/docAccess.js.map +1 -1
- package/dist/resolvers/collections/duplicate.d.ts +4 -6
- package/dist/resolvers/collections/duplicate.d.ts.map +1 -1
- package/dist/resolvers/collections/duplicate.js +3 -3
- package/dist/resolvers/collections/duplicate.js.map +1 -1
- package/dist/resolvers/collections/find.d.ts +2 -4
- package/dist/resolvers/collections/find.d.ts.map +1 -1
- package/dist/resolvers/collections/find.js +16 -6
- package/dist/resolvers/collections/find.js.map +1 -1
- package/dist/resolvers/collections/findByID.d.ts +4 -6
- package/dist/resolvers/collections/findByID.d.ts.map +1 -1
- package/dist/resolvers/collections/findByID.js +10 -3
- package/dist/resolvers/collections/findByID.js.map +1 -1
- package/dist/resolvers/collections/findVersionByID.d.ts +2 -5
- package/dist/resolvers/collections/findVersionByID.d.ts.map +1 -1
- package/dist/resolvers/collections/findVersionByID.js +3 -4
- package/dist/resolvers/collections/findVersionByID.js.map +1 -1
- package/dist/resolvers/collections/findVersions.d.ts +3 -4
- package/dist/resolvers/collections/findVersions.d.ts.map +1 -1
- package/dist/resolvers/collections/findVersions.js +12 -6
- package/dist/resolvers/collections/findVersions.js.map +1 -1
- package/dist/resolvers/collections/restoreVersion.d.ts +3 -3
- package/dist/resolvers/collections/restoreVersion.d.ts.map +1 -1
- package/dist/resolvers/collections/restoreVersion.js +3 -3
- package/dist/resolvers/collections/restoreVersion.js.map +1 -1
- package/dist/resolvers/collections/update.d.ts +6 -7
- package/dist/resolvers/collections/update.d.ts.map +1 -1
- package/dist/resolvers/collections/update.js +12 -6
- package/dist/resolvers/collections/update.js.map +1 -1
- package/dist/resolvers/globals/docAccess.d.ts +1 -2
- package/dist/resolvers/globals/docAccess.d.ts.map +1 -1
- package/dist/resolvers/globals/docAccess.js +1 -2
- package/dist/resolvers/globals/docAccess.js.map +1 -1
- package/dist/resolvers/globals/findOne.d.ts +2 -2
- package/dist/resolvers/globals/findOne.d.ts.map +1 -1
- package/dist/resolvers/globals/findOne.js +8 -5
- package/dist/resolvers/globals/findOne.js.map +1 -1
- package/dist/resolvers/globals/findVersionByID.d.ts +2 -2
- package/dist/resolvers/globals/findVersionByID.d.ts.map +1 -1
- package/dist/resolvers/globals/findVersionByID.js +8 -5
- package/dist/resolvers/globals/findVersionByID.js.map +1 -1
- package/dist/resolvers/globals/findVersions.d.ts +2 -2
- package/dist/resolvers/globals/findVersions.d.ts.map +1 -1
- package/dist/resolvers/globals/findVersions.js +2 -3
- package/dist/resolvers/globals/findVersions.js.map +1 -1
- package/dist/resolvers/globals/index.d.ts +5 -5
- package/dist/resolvers/globals/index.d.ts.map +1 -1
- package/dist/resolvers/globals/index.js +5 -5
- package/dist/resolvers/globals/index.js.map +1 -1
- package/dist/resolvers/globals/restoreVersion.d.ts +3 -2
- package/dist/resolvers/globals/restoreVersion.d.ts.map +1 -1
- package/dist/resolvers/globals/restoreVersion.js +3 -3
- package/dist/resolvers/globals/restoreVersion.js.map +1 -1
- package/dist/resolvers/globals/update.d.ts +5 -6
- package/dist/resolvers/globals/update.d.ts.map +1 -1
- package/dist/resolvers/globals/update.js +8 -5
- package/dist/resolvers/globals/update.js.map +1 -1
- package/dist/resolvers/types.d.ts +1 -1
- package/dist/resolvers/types.d.ts.map +1 -1
- package/dist/resolvers/types.js.map +1 -1
- package/dist/schema/buildFallbackLocaleInputType.d.ts +2 -3
- package/dist/schema/buildFallbackLocaleInputType.d.ts.map +1 -1
- package/dist/schema/buildFallbackLocaleInputType.js +2 -3
- package/dist/schema/buildFallbackLocaleInputType.js.map +1 -1
- package/dist/schema/buildLocaleInputType.d.ts +2 -3
- package/dist/schema/buildLocaleInputType.d.ts.map +1 -1
- package/dist/schema/buildLocaleInputType.js +2 -3
- package/dist/schema/buildLocaleInputType.js.map +1 -1
- package/dist/schema/buildMutationInputType.d.ts +1 -2
- package/dist/schema/buildMutationInputType.d.ts.map +1 -1
- package/dist/schema/buildMutationInputType.js +60 -17
- package/dist/schema/buildMutationInputType.js.map +1 -1
- package/dist/schema/buildObjectType.d.ts +3 -4
- package/dist/schema/buildObjectType.d.ts.map +1 -1
- package/dist/schema/buildObjectType.js +302 -101
- package/dist/schema/buildObjectType.js.map +1 -1
- package/dist/schema/buildPaginatedListType.d.ts +1 -2
- package/dist/schema/buildPaginatedListType.d.ts.map +1 -1
- package/dist/schema/buildPaginatedListType.js +1 -2
- package/dist/schema/buildPaginatedListType.js.map +1 -1
- package/dist/schema/buildPoliciesType.d.ts +2 -2
- package/dist/schema/buildPoliciesType.d.ts.map +1 -1
- package/dist/schema/buildPoliciesType.js +6 -4
- package/dist/schema/buildPoliciesType.js.map +1 -1
- package/dist/schema/buildWhereInputType.d.ts +3 -3
- package/dist/schema/buildWhereInputType.d.ts.map +1 -1
- package/dist/schema/buildWhereInputType.js +6 -7
- package/dist/schema/buildWhereInputType.js.map +1 -1
- package/dist/schema/fieldToWhereInputSchemaMap.d.ts +2 -2
- package/dist/schema/fieldToWhereInputSchemaMap.d.ts.map +1 -1
- package/dist/schema/fieldToWhereInputSchemaMap.js +31 -7
- package/dist/schema/fieldToWhereInputSchemaMap.js.map +1 -1
- package/dist/schema/initCollections.d.ts +3 -4
- package/dist/schema/initCollections.d.ts.map +1 -1
- package/dist/schema/initCollections.js +65 -53
- package/dist/schema/initCollections.js.map +1 -1
- package/dist/schema/initGlobals.d.ts +3 -4
- package/dist/schema/initGlobals.d.ts.map +1 -1
- package/dist/schema/initGlobals.js +27 -21
- package/dist/schema/initGlobals.js.map +1 -1
- package/dist/schema/isFieldNullable.d.ts +2 -3
- package/dist/schema/isFieldNullable.d.ts.map +1 -1
- package/dist/schema/isFieldNullable.js +2 -3
- package/dist/schema/isFieldNullable.js.map +1 -1
- package/dist/schema/operators.d.ts +1 -2
- package/dist/schema/operators.d.ts.map +1 -1
- package/dist/schema/operators.js +1 -2
- package/dist/schema/operators.js.map +1 -1
- package/dist/schema/recursivelyBuildNestedPaths.d.ts +3 -3
- package/dist/schema/recursivelyBuildNestedPaths.d.ts.map +1 -1
- package/dist/schema/recursivelyBuildNestedPaths.js +3 -4
- package/dist/schema/recursivelyBuildNestedPaths.js.map +1 -1
- package/dist/schema/withNullableType.d.ts +2 -3
- package/dist/schema/withNullableType.d.ts.map +1 -1
- package/dist/schema/withNullableType.js +1 -2
- package/dist/schema/withNullableType.js.map +1 -1
- package/dist/schema/withOperators.d.ts +1 -1
- package/dist/schema/withOperators.d.ts.map +1 -1
- package/dist/schema/withOperators.js +12 -7
- package/dist/schema/withOperators.js.map +1 -1
- package/dist/utilities/combineParentName.d.ts +1 -2
- package/dist/utilities/combineParentName.d.ts.map +1 -1
- package/dist/utilities/combineParentName.js +2 -3
- package/dist/utilities/combineParentName.js.map +1 -1
- package/dist/utilities/formatName.d.ts +1 -2
- package/dist/utilities/formatName.d.ts.map +1 -1
- package/dist/utilities/formatName.js +1 -2
- package/dist/utilities/formatName.js.map +1 -1
- package/dist/utilities/formatName.spec.js +1 -1
- package/dist/utilities/formatName.spec.js.map +1 -1
- package/dist/utilities/formatOptions.d.ts +2 -3
- package/dist/utilities/formatOptions.d.ts.map +1 -1
- package/dist/utilities/formatOptions.js +2 -3
- package/dist/utilities/formatOptions.js.map +1 -1
- package/dist/utilities/groupOrTabHasRequiredSubfield.d.ts +1 -1
- package/dist/utilities/groupOrTabHasRequiredSubfield.d.ts.map +1 -1
- package/dist/utilities/groupOrTabHasRequiredSubfield.js +1 -1
- package/dist/utilities/groupOrTabHasRequiredSubfield.js.map +1 -1
- package/dist/utilities/wrapCustomResolver.d.ts +1 -1
- package/dist/utilities/wrapCustomResolver.d.ts.map +1 -1
- package/dist/utilities/wrapCustomResolver.js +1 -1
- package/dist/utilities/wrapCustomResolver.js.map +1 -1
- package/license.md +22 -0
- package/package.json +45 -20
- package/dist/utilities/getCheckIfLocaleObject.d.ts +0 -5
- package/dist/utilities/getCheckIfLocaleObject.d.ts.map +0 -1
- package/dist/utilities/getCheckIfLocaleObject.js +0 -3
- package/dist/utilities/getCheckIfLocaleObject.js.map +0 -1
- package/dist/utilities/uppercase.d.ts +0 -3
- package/dist/utilities/uppercase.d.ts.map +0 -1
- package/dist/utilities/uppercase.js +0 -11
- package/dist/utilities/uppercase.js.map +0 -1
package/dist/schema/operators.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/operators.ts"],"sourcesContent":["const operators = {\n comparison: ['greater_than_equal', 'greater_than', 'less_than_equal', 'less_than'],\n contains: ['in', 'not_in', 'all'],\n equality: ['equals', 'not_equals'],\n geo: ['near'],\n geojson: ['within', 'intersects'],\n partial: ['like', 'contains'],\n}\n
|
|
1
|
+
{"version":3,"sources":["../../src/schema/operators.ts"],"sourcesContent":["export const operators = {\n comparison: ['greater_than_equal', 'greater_than', 'less_than_equal', 'less_than'],\n contains: ['in', 'not_in', 'all'],\n equality: ['equals', 'not_equals'],\n geo: ['near'],\n geojson: ['within', 'intersects'],\n partial: ['like', 'contains'],\n}\n"],"names":["operators","comparison","contains","equality","geo","geojson","partial"],"mappings":"AAAA,OAAO,MAAMA,YAAY;IACvBC,YAAY;QAAC;QAAsB;QAAgB;QAAmB;KAAY;IAClFC,UAAU;QAAC;QAAM;QAAU;KAAM;IACjCC,UAAU;QAAC;QAAU;KAAa;IAClCC,KAAK;QAAC;KAAO;IACbC,SAAS;QAAC;QAAU;KAAa;IACjCC,SAAS;QAAC;QAAQ;KAAW;AAC/B,EAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { FieldWithSubFields, TabsField } from 'payload
|
|
1
|
+
import type { FieldWithSubFields, TabsField } from 'payload';
|
|
2
2
|
type Args = {
|
|
3
3
|
field: FieldWithSubFields | TabsField;
|
|
4
4
|
nestedFieldName2: string;
|
|
5
5
|
parentName: string;
|
|
6
6
|
};
|
|
7
|
-
declare const recursivelyBuildNestedPaths: ({ field, nestedFieldName2, parentName }: Args) => any;
|
|
8
|
-
export
|
|
7
|
+
export declare const recursivelyBuildNestedPaths: ({ field, nestedFieldName2, parentName }: Args) => any;
|
|
8
|
+
export {};
|
|
9
9
|
//# sourceMappingURL=recursivelyBuildNestedPaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recursivelyBuildNestedPaths.d.ts","sourceRoot":"","sources":["../../src/schema/recursivelyBuildNestedPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"recursivelyBuildNestedPaths.d.ts","sourceRoot":"","sources":["../../src/schema/recursivelyBuildNestedPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAM5D,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAAA;IACrC,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,2BAA2B,4CAA6C,IAAI,QAmExF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fieldAffectsData, fieldIsPresentationalOnly } from 'payload/
|
|
2
|
-
import fieldToSchemaMap from './fieldToWhereInputSchemaMap.js';
|
|
3
|
-
const recursivelyBuildNestedPaths = ({ field, nestedFieldName2, parentName })=>{
|
|
1
|
+
import { fieldAffectsData, fieldIsPresentationalOnly } from 'payload/shared';
|
|
2
|
+
import { fieldToSchemaMap } from './fieldToWhereInputSchemaMap.js';
|
|
3
|
+
export const recursivelyBuildNestedPaths = ({ field, nestedFieldName2, parentName })=>{
|
|
4
4
|
const fieldName = fieldAffectsData(field) ? field.name : undefined;
|
|
5
5
|
const nestedFieldName = fieldName || nestedFieldName2;
|
|
6
6
|
if (field.type === 'tabs') {
|
|
@@ -59,6 +59,5 @@ const recursivelyBuildNestedPaths = ({ field, nestedFieldName2, parentName })=>{
|
|
|
59
59
|
}, []);
|
|
60
60
|
return nestedPaths;
|
|
61
61
|
};
|
|
62
|
-
export default recursivelyBuildNestedPaths;
|
|
63
62
|
|
|
64
63
|
//# sourceMappingURL=recursivelyBuildNestedPaths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/recursivelyBuildNestedPaths.ts"],"sourcesContent":["import type { FieldWithSubFields, TabsField } from 'payload
|
|
1
|
+
{"version":3,"sources":["../../src/schema/recursivelyBuildNestedPaths.ts"],"sourcesContent":["import type { FieldWithSubFields, TabsField } from 'payload'\n\nimport { fieldAffectsData, fieldIsPresentationalOnly } from 'payload/shared'\n\nimport { fieldToSchemaMap } from './fieldToWhereInputSchemaMap.js'\n\ntype Args = {\n field: FieldWithSubFields | TabsField\n nestedFieldName2: string\n parentName: string\n}\n\nexport const recursivelyBuildNestedPaths = ({ field, nestedFieldName2, parentName }: Args) => {\n const fieldName = fieldAffectsData(field) ? field.name : undefined\n const nestedFieldName = fieldName || nestedFieldName2\n\n if (field.type === 'tabs') {\n // if the tab has a name, treat it as a group\n // otherwise, treat it as a row\n return field.tabs.reduce((tabSchema, tab: any) => {\n tabSchema.push(\n ...recursivelyBuildNestedPaths({\n field: {\n ...tab,\n type: 'name' in tab ? 'group' : 'row',\n },\n nestedFieldName2: nestedFieldName,\n parentName,\n }),\n )\n return tabSchema\n }, [])\n }\n\n const nestedPaths = field.fields.reduce((nestedFields, nestedField) => {\n if (!fieldIsPresentationalOnly(nestedField)) {\n if (!fieldAffectsData(nestedField)) {\n return [\n ...nestedFields,\n ...recursivelyBuildNestedPaths({\n field: nestedField,\n nestedFieldName2: nestedFieldName,\n parentName,\n }),\n ]\n }\n\n const nestedPathName = fieldAffectsData(nestedField)\n ? `${nestedFieldName ? `${nestedFieldName}__` : ''}${nestedField.name}`\n : undefined\n const getFieldSchema = fieldToSchemaMap({\n nestedFieldName,\n parentName,\n })[nestedField.type]\n\n if (getFieldSchema) {\n const fieldSchema = getFieldSchema({\n ...nestedField,\n name: nestedPathName,\n })\n\n if (Array.isArray(fieldSchema)) {\n return [...nestedFields, ...fieldSchema]\n }\n\n return [\n ...nestedFields,\n {\n type: fieldSchema,\n key: nestedPathName,\n },\n ]\n }\n }\n\n return nestedFields\n }, [])\n\n return nestedPaths\n}\n"],"names":["fieldAffectsData","fieldIsPresentationalOnly","fieldToSchemaMap","recursivelyBuildNestedPaths","field","nestedFieldName2","parentName","fieldName","name","undefined","nestedFieldName","type","tabs","reduce","tabSchema","tab","push","nestedPaths","fields","nestedFields","nestedField","nestedPathName","getFieldSchema","fieldSchema","Array","isArray","key"],"mappings":"AAEA,SAASA,gBAAgB,EAAEC,yBAAyB,QAAQ,iBAAgB;AAE5E,SAASC,gBAAgB,QAAQ,kCAAiC;AAQlE,OAAO,MAAMC,8BAA8B,CAAC,EAAEC,KAAK,EAAEC,gBAAgB,EAAEC,UAAU,EAAQ;IACvF,MAAMC,YAAYP,iBAAiBI,SAASA,MAAMI,IAAI,GAAGC;IACzD,MAAMC,kBAAkBH,aAAaF;IAErC,IAAID,MAAMO,IAAI,KAAK,QAAQ;QACzB,6CAA6C;QAC7C,+BAA+B;QAC/B,OAAOP,MAAMQ,IAAI,CAACC,MAAM,CAAC,CAACC,WAAWC;YACnCD,UAAUE,IAAI,IACTb,4BAA4B;gBAC7BC,OAAO;oBACL,GAAGW,GAAG;oBACNJ,MAAM,UAAUI,MAAM,UAAU;gBAClC;gBACAV,kBAAkBK;gBAClBJ;YACF;YAEF,OAAOQ;QACT,GAAG,EAAE;IACP;IAEA,MAAMG,cAAcb,MAAMc,MAAM,CAACL,MAAM,CAAC,CAACM,cAAcC;QACrD,IAAI,CAACnB,0BAA0BmB,cAAc;YAC3C,IAAI,CAACpB,iBAAiBoB,cAAc;gBAClC,OAAO;uBACFD;uBACAhB,4BAA4B;wBAC7BC,OAAOgB;wBACPf,kBAAkBK;wBAClBJ;oBACF;iBACD;YACH;YAEA,MAAMe,iBAAiBrB,iBAAiBoB,eACpC,CAAC,EAAEV,kBAAkB,CAAC,EAAEA,gBAAgB,EAAE,CAAC,GAAG,GAAG,EAAEU,YAAYZ,IAAI,CAAC,CAAC,GACrEC;YACJ,MAAMa,iBAAiBpB,iBAAiB;gBACtCQ;gBACAJ;YACF,EAAE,CAACc,YAAYT,IAAI,CAAC;YAEpB,IAAIW,gBAAgB;gBAClB,MAAMC,cAAcD,eAAe;oBACjC,GAAGF,WAAW;oBACdZ,MAAMa;gBACR;gBAEA,IAAIG,MAAMC,OAAO,CAACF,cAAc;oBAC9B,OAAO;2BAAIJ;2BAAiBI;qBAAY;gBAC1C;gBAEA,OAAO;uBACFJ;oBACH;wBACER,MAAMY;wBACNG,KAAKL;oBACP;iBACD;YACH;QACF;QAEA,OAAOF;IACT,GAAG,EAAE;IAEL,OAAOF;AACT,EAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { GraphQLType } from 'graphql';
|
|
2
|
-
import type { FieldAffectingData } from 'payload
|
|
3
|
-
declare const withNullableType: (field: FieldAffectingData, type: GraphQLType, forceNullable?: boolean) => GraphQLType;
|
|
4
|
-
export default withNullableType;
|
|
2
|
+
import type { FieldAffectingData } from 'payload';
|
|
3
|
+
export declare const withNullableType: (field: FieldAffectingData, type: GraphQLType, forceNullable?: boolean) => GraphQLType;
|
|
5
4
|
//# sourceMappingURL=withNullableType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withNullableType.d.ts","sourceRoot":"","sources":["../../src/schema/withNullableType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"withNullableType.d.ts","sourceRoot":"","sources":["../../src/schema/withNullableType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAIjD,eAAO,MAAM,gBAAgB,UACpB,kBAAkB,QACnB,WAAW,8BAEhB,WAkBF,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GraphQLNonNull } from 'graphql';
|
|
2
|
-
const withNullableType = (field, type, forceNullable = false)=>{
|
|
2
|
+
export const withNullableType = (field, type, forceNullable = false)=>{
|
|
3
3
|
const hasReadAccessControl = field.access && field.access.read;
|
|
4
4
|
const condition = field.admin && field.admin.condition;
|
|
5
5
|
const isTimestamp = field.name === 'createdAt' || field.name === 'updatedAt';
|
|
@@ -8,6 +8,5 @@ const withNullableType = (field, type, forceNullable = false)=>{
|
|
|
8
8
|
}
|
|
9
9
|
return type;
|
|
10
10
|
};
|
|
11
|
-
export default withNullableType;
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=withNullableType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/withNullableType.ts"],"sourcesContent":["import type { GraphQLType } from 'graphql'\nimport type { FieldAffectingData } from 'payload
|
|
1
|
+
{"version":3,"sources":["../../src/schema/withNullableType.ts"],"sourcesContent":["import type { GraphQLType } from 'graphql'\nimport type { FieldAffectingData } from 'payload'\n\nimport { GraphQLNonNull } from 'graphql'\n\nexport const withNullableType = (\n field: FieldAffectingData,\n type: GraphQLType,\n forceNullable = false,\n): GraphQLType => {\n const hasReadAccessControl = field.access && field.access.read\n const condition = field.admin && field.admin.condition\n const isTimestamp = field.name === 'createdAt' || field.name === 'updatedAt'\n\n if (\n !forceNullable &&\n 'required' in field &&\n field.required &&\n !field.localized &&\n !condition &&\n !hasReadAccessControl &&\n !isTimestamp\n ) {\n return new GraphQLNonNull(type)\n }\n\n return type\n}\n"],"names":["GraphQLNonNull","withNullableType","field","type","forceNullable","hasReadAccessControl","access","read","condition","admin","isTimestamp","name","required","localized"],"mappings":"AAGA,SAASA,cAAc,QAAQ,UAAS;AAExC,OAAO,MAAMC,mBAAmB,CAC9BC,OACAC,MACAC,gBAAgB,KAAK;IAErB,MAAMC,uBAAuBH,MAAMI,MAAM,IAAIJ,MAAMI,MAAM,CAACC,IAAI;IAC9D,MAAMC,YAAYN,MAAMO,KAAK,IAAIP,MAAMO,KAAK,CAACD,SAAS;IACtD,MAAME,cAAcR,MAAMS,IAAI,KAAK,eAAeT,MAAMS,IAAI,KAAK;IAEjE,IACE,CAACP,iBACD,cAAcF,SACdA,MAAMU,QAAQ,IACd,CAACV,MAAMW,SAAS,IAChB,CAACL,aACD,CAACH,wBACD,CAACK,aACD;QACA,OAAO,IAAIV,eAAeG;IAC5B;IAEA,OAAOA;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withOperators.d.ts","sourceRoot":"","sources":["../../src/schema/withOperators.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAwC,MAAM,
|
|
1
|
+
{"version":3,"file":"withOperators.d.ts","sourceRoot":"","sources":["../../src/schema/withOperators.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAwC,MAAM,SAAS,CAAA;AAEvF,OAAO,EAIL,sBAAsB,EAIvB,MAAM,SAAS,CAAA;AA8OhB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,UACjB,kBAAkB,cACb,MAAM,KACjB,sBAiDF,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { GraphQLBoolean, GraphQLEnumType, GraphQLFloat, GraphQLInputObjectType, GraphQLInt, GraphQLList, GraphQLString } from 'graphql';
|
|
2
2
|
import { DateTimeResolver, EmailAddressResolver } from 'graphql-scalars';
|
|
3
|
-
import { optionIsObject } from 'payload/
|
|
3
|
+
import { optionIsObject } from 'payload/shared';
|
|
4
4
|
import { GraphQLJSON } from '../packages/graphql-type-json/index.js';
|
|
5
|
-
import combineParentName from '../utilities/combineParentName.js';
|
|
6
|
-
import formatName from '../utilities/formatName.js';
|
|
7
|
-
import operators from './operators.js';
|
|
5
|
+
import { combineParentName } from '../utilities/combineParentName.js';
|
|
6
|
+
import { formatName } from '../utilities/formatName.js';
|
|
7
|
+
import { operators } from './operators.js';
|
|
8
8
|
const GeoJSONObject = new GraphQLInputObjectType({
|
|
9
9
|
name: 'GeoJSONObject',
|
|
10
10
|
fields: {
|
|
@@ -222,9 +222,12 @@ const defaults = {
|
|
|
222
222
|
},
|
|
223
223
|
upload: {
|
|
224
224
|
operators: [
|
|
225
|
-
...
|
|
225
|
+
...[
|
|
226
|
+
...operators.equality,
|
|
227
|
+
...operators.contains
|
|
228
|
+
].map((operator)=>({
|
|
226
229
|
name: operator,
|
|
227
|
-
type:
|
|
230
|
+
type: GraphQLJSON
|
|
228
231
|
}))
|
|
229
232
|
]
|
|
230
233
|
}
|
|
@@ -247,7 +250,9 @@ const gqlTypeCache = {};
|
|
|
247
250
|
* @param parentName the name of the parent field (if any)
|
|
248
251
|
* @returns all the operators (including their types) which can be used as a condition for a given field inside a where
|
|
249
252
|
*/ export const withOperators = (field, parentName)=>{
|
|
250
|
-
if (!defaults?.[field.type])
|
|
253
|
+
if (!defaults?.[field.type]) {
|
|
254
|
+
throw new Error(`Error: ${field.type} has no defaults configured.`);
|
|
255
|
+
}
|
|
251
256
|
const name = `${combineParentName(parentName, field.name)}_operator`;
|
|
252
257
|
// Get the default operators for the field type which are hard-coded above
|
|
253
258
|
const fieldOperators = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/withOperators.ts"],"sourcesContent":["import type { GraphQLType } from 'graphql'\nimport type { FieldAffectingData, NumberField, RadioField, SelectField } from 'payload/types'\n\nimport {\n GraphQLBoolean,\n GraphQLEnumType,\n GraphQLFloat,\n GraphQLInputObjectType,\n GraphQLInt,\n GraphQLList,\n GraphQLString,\n} from 'graphql'\nimport { DateTimeResolver, EmailAddressResolver } from 'graphql-scalars'\nimport { optionIsObject } from 'payload/types'\n\nimport { GraphQLJSON } from '../packages/graphql-type-json/index.js'\nimport combineParentName from '../utilities/combineParentName.js'\nimport formatName from '../utilities/formatName.js'\nimport operators from './operators.js'\n\ntype staticTypes =\n | 'checkbox'\n | 'code'\n | 'date'\n | 'email'\n | 'json'\n | 'number'\n | 'point'\n | 'relationship'\n | 'richText'\n | 'text'\n | 'textarea'\n | 'upload'\n\ntype dynamicTypes = 'radio' | 'select'\n\nconst GeoJSONObject = new GraphQLInputObjectType({\n name: 'GeoJSONObject',\n fields: {\n type: { type: GraphQLString },\n coordinates: {\n type: GraphQLJSON,\n },\n },\n})\n\ntype DefaultsType = {\n [key in staticTypes]: {\n operators: {\n name: string\n type: ((field: FieldAffectingData, parentName: string) => GraphQLType) | GraphQLType\n }[]\n }\n} & {\n [key in dynamicTypes]: {\n operators: {\n name: string\n type: (field: FieldAffectingData, parentName: string) => GraphQLType\n }[]\n }\n}\n\nconst defaults: DefaultsType = {\n checkbox: {\n operators: [\n ...operators.equality.map((operator) => ({\n name: operator,\n type: GraphQLBoolean,\n })),\n ],\n },\n code: {\n operators: [\n ...[...operators.equality, ...operators.partial].map((operator) => ({\n name: operator,\n type: GraphQLString,\n })),\n ],\n },\n date: {\n operators: [\n ...[...operators.equality, ...operators.comparison, 'like'].map((operator) => ({\n name: operator,\n type: DateTimeResolver,\n })),\n ],\n },\n email: {\n operators: [\n ...[...operators.equality, ...operators.partial, ...operators.contains].map((operator) => ({\n name: operator,\n type: EmailAddressResolver,\n })),\n ],\n },\n json: {\n operators: [\n ...[...operators.equality, ...operators.partial, ...operators.geojson].map((operator) => ({\n name: operator,\n type: GraphQLJSON,\n })),\n ],\n },\n number: {\n operators: [\n ...[...operators.equality, ...operators.comparison].map((operator) => ({\n name: operator,\n type: (field: NumberField): GraphQLType => {\n return field?.name === 'id' ? GraphQLInt : GraphQLFloat\n },\n })),\n ],\n },\n point: {\n operators: [\n ...[...operators.equality, ...operators.comparison, ...operators.geo].map((operator) => ({\n name: operator,\n type: new GraphQLList(GraphQLFloat),\n })),\n ...operators.geojson.map((operator) => ({\n name: operator,\n /**\n * @example:\n * within: {\n * type: \"Polygon\",\n * coordinates: [[\n * [0.0, 0.0],\n * [1.0, 1.0],\n * [1.0, 0.0],\n * [0.0, 0.0],\n * ]],\n * }\n * @example\n * intersects: {\n * type: \"Point\",\n * coordinates: [ 0.5, 0.5 ]\n * }\n */\n type: GeoJSONObject,\n })),\n ],\n },\n radio: {\n operators: [\n ...[...operators.equality, ...operators.partial].map((operator) => ({\n name: operator,\n type: (field: RadioField, parentName): GraphQLType =>\n new GraphQLEnumType({\n name: `${combineParentName(parentName, field.name)}_Input`,\n values: field.options.reduce((values, option) => {\n if (optionIsObject(option)) {\n return {\n ...values,\n [formatName(option.value)]: {\n value: option.value,\n },\n }\n }\n\n return {\n ...values,\n [formatName(option)]: {\n value: option,\n },\n }\n }, {}),\n }),\n })),\n ],\n },\n relationship: {\n operators: [\n ...[...operators.equality, ...operators.contains].map((operator) => ({\n name: operator,\n type: GraphQLJSON,\n })),\n ],\n },\n richText: {\n operators: [\n ...[...operators.equality, ...operators.partial].map((operator) => ({\n name: operator,\n type: GraphQLJSON,\n })),\n ],\n },\n select: {\n operators: [\n ...[...operators.equality, ...operators.contains].map((operator) => ({\n name: operator,\n type: (field: SelectField, parentName): GraphQLType =>\n new GraphQLEnumType({\n name: `${combineParentName(parentName, field.name)}_Input`,\n values: field.options.reduce((values, option) => {\n if (optionIsObject(option)) {\n return {\n ...values,\n [formatName(option.value)]: {\n value: option.value,\n },\n }\n }\n\n return {\n ...values,\n [formatName(option)]: {\n value: option,\n },\n }\n }, {}),\n }),\n })),\n ],\n },\n text: {\n operators: [\n ...[...operators.equality, ...operators.partial, ...operators.contains].map((operator) => ({\n name: operator,\n type: GraphQLString,\n })),\n ],\n },\n textarea: {\n operators: [\n ...[...operators.equality, ...operators.partial].map((operator) => ({\n name: operator,\n type: GraphQLString,\n })),\n ],\n },\n upload: {\n operators: [\n ...operators.equality.map((operator) => ({\n name: operator,\n type: GraphQLString,\n })),\n ],\n },\n // array: n/a\n // group: n/a\n // row: n/a\n // collapsible: n/a\n // tabs: n/a\n}\n\nconst listOperators = ['in', 'not_in', 'all']\n\nconst gqlTypeCache: Record<string, GraphQLType> = {}\n\n/**\n * In GraphQL, you can use \"where\" as an argument to filter a collection. Example:\n * { Posts(where: { title: { equals: \"Hello\" } }) { text } }\n * This function defines the operators for a field's condition in the \"where\" argument of the collection (it thus gets called for every field).\n * For example, in the example above, it would control that\n * - \"equals\" is a valid operator for the \"title\" field\n * - the accepted type of the \"equals\" argument has to be a string.\n *\n * @param field the field for which their valid operators inside a \"where\" argument is being defined\n * @param parentName the name of the parent field (if any)\n * @returns all the operators (including their types) which can be used as a condition for a given field inside a where\n */\nexport const withOperators = (\n field: FieldAffectingData,\n parentName: string,\n): GraphQLInputObjectType => {\n if (!defaults?.[field.type]) throw new Error(`Error: ${field.type} has no defaults configured.`)\n\n const name = `${combineParentName(parentName, field.name)}_operator`\n\n // Get the default operators for the field type which are hard-coded above\n const fieldOperators = [...defaults[field.type].operators]\n\n if (!('required' in field) || !field.required) {\n fieldOperators.push({\n name: 'exists',\n type: fieldOperators[0].type,\n })\n }\n\n return new GraphQLInputObjectType({\n name,\n fields: fieldOperators.reduce((objectTypeFields, operator) => {\n // Get the type of the operator. It can be either static, or dynamic (=> a function)\n let gqlType: GraphQLType =\n typeof operator.type === 'function' ? operator.type(field, parentName) : operator.type\n\n // GraphQL does not allow types with duplicate names, so we use this cache to avoid that.\n // Without this, select and radio fields would have the same name, and GraphQL would throw an error\n // This usually only happens if a custom type is returned from the operator.type function\n if (typeof operator.type === 'function' && 'name' in gqlType) {\n if (gqlTypeCache[gqlType.name]) {\n gqlType = gqlTypeCache[gqlType.name]\n } else {\n gqlTypeCache[gqlType.name] = gqlType\n }\n }\n\n if (listOperators.includes(operator.name)) {\n gqlType = new GraphQLList(gqlType)\n } else if (operator.name === 'exists') {\n gqlType = GraphQLBoolean\n }\n\n return {\n ...objectTypeFields,\n [operator.name]: {\n type: gqlType,\n },\n }\n }, {}),\n })\n}\n"],"names":["GraphQLBoolean","GraphQLEnumType","GraphQLFloat","GraphQLInputObjectType","GraphQLInt","GraphQLList","GraphQLString","DateTimeResolver","EmailAddressResolver","optionIsObject","GraphQLJSON","combineParentName","formatName","operators","GeoJSONObject","name","fields","type","coordinates","defaults","checkbox","equality","map","operator","code","partial","date","comparison","email","contains","json","geojson","number","field","point","geo","radio","parentName","values","options","reduce","option","value","relationship","richText","select","text","textarea","upload","listOperators","gqlTypeCache","withOperators","Error","fieldOperators","required","push","objectTypeFields","gqlType","includes"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SACEA,cAAc,EACdC,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N,IAAI,KAAK,cAAc,UAAUwC,SAAS;gBAC5D,IAAIP,YAAY,CAACO,QAAQ1C,IAAI,CAAC,EAAE;oBAC9B0C,UAAUP,YAAY,CAACO,QAAQ1C,IAAI,CAAC;gBACtC,OAAO;oBACLmC,YAAY,CAACO,QAAQ1C,IAAI,CAAC,GAAG0C;gBAC/B;YACF;YAEA,IAAIR,cAAcS,QAAQ,CAACnC,SAASR,IAAI,GAAG;gBACzC0C,UAAU,IAAIpD,YAAYoD;YAC5B,OAAO,IAAIlC,SAASR,IAAI,KAAK,UAAU;gBACrC0C,UAAUzD;YACZ;YAEA,OAAO;gBACL,GAAGwD,gBAAgB;gBACnB,CAACjC,SAASR,IAAI,CAAC,EAAE;oBACfE,MAAMwC;gBACR;YACF;QACF,GAAG,CAAC;IACN;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/schema/withOperators.ts"],"sourcesContent":["import type { GraphQLType } from 'graphql'\nimport type { FieldAffectingData, NumberField, RadioField, SelectField } from 'payload'\n\nimport {\n GraphQLBoolean,\n GraphQLEnumType,\n GraphQLFloat,\n GraphQLInputObjectType,\n GraphQLInt,\n GraphQLList,\n GraphQLString,\n} from 'graphql'\nimport { DateTimeResolver, EmailAddressResolver } from 'graphql-scalars'\nimport { optionIsObject } from 'payload/shared'\n\nimport { GraphQLJSON } from '../packages/graphql-type-json/index.js'\nimport { combineParentName } from '../utilities/combineParentName.js'\nimport { formatName } from '../utilities/formatName.js'\nimport { operators } from './operators.js'\n\ntype staticTypes =\n | 'checkbox'\n | 'code'\n | 'date'\n | 'email'\n | 'json'\n | 'number'\n | 'point'\n | 'relationship'\n | 'richText'\n | 'text'\n | 'textarea'\n | 'upload'\n\ntype dynamicTypes = 'radio' | 'select'\n\nconst GeoJSONObject = new GraphQLInputObjectType({\n name: 'GeoJSONObject',\n fields: {\n type: { type: GraphQLString },\n coordinates: {\n type: GraphQLJSON,\n },\n },\n})\n\ntype DefaultsType = {\n [key in dynamicTypes]: {\n operators: {\n name: string\n type: (field: FieldAffectingData, parentName: string) => GraphQLType\n }[]\n }\n} & {\n [key in staticTypes]: {\n operators: {\n name: string\n type: ((field: FieldAffectingData, parentName: string) => GraphQLType) | GraphQLType\n }[]\n }\n}\n\nconst defaults: DefaultsType = {\n checkbox: {\n operators: [\n ...operators.equality.map((operator) => ({\n name: operator,\n type: GraphQLBoolean,\n })),\n ],\n },\n code: {\n operators: [\n ...[...operators.equality, ...operators.partial].map((operator) => ({\n name: operator,\n type: GraphQLString,\n })),\n ],\n },\n date: {\n operators: [\n ...[...operators.equality, ...operators.comparison, 'like'].map((operator) => ({\n name: operator,\n type: DateTimeResolver,\n })),\n ],\n },\n email: {\n operators: [\n ...[...operators.equality, ...operators.partial, ...operators.contains].map((operator) => ({\n name: operator,\n type: EmailAddressResolver,\n })),\n ],\n },\n json: {\n operators: [\n ...[...operators.equality, ...operators.partial, ...operators.geojson].map((operator) => ({\n name: operator,\n type: GraphQLJSON,\n })),\n ],\n },\n number: {\n operators: [\n ...[...operators.equality, ...operators.comparison].map((operator) => ({\n name: operator,\n type: (field: NumberField): GraphQLType => {\n return field?.name === 'id' ? GraphQLInt : GraphQLFloat\n },\n })),\n ],\n },\n point: {\n operators: [\n ...[...operators.equality, ...operators.comparison, ...operators.geo].map((operator) => ({\n name: operator,\n type: new GraphQLList(GraphQLFloat),\n })),\n ...operators.geojson.map((operator) => ({\n name: operator,\n /**\n * @example:\n * within: {\n * type: \"Polygon\",\n * coordinates: [[\n * [0.0, 0.0],\n * [1.0, 1.0],\n * [1.0, 0.0],\n * [0.0, 0.0],\n * ]],\n * }\n * @example\n * intersects: {\n * type: \"Point\",\n * coordinates: [ 0.5, 0.5 ]\n * }\n */\n type: GeoJSONObject,\n })),\n ],\n },\n radio: {\n operators: [\n ...[...operators.equality, ...operators.partial].map((operator) => ({\n name: operator,\n type: (field: RadioField, parentName): GraphQLType =>\n new GraphQLEnumType({\n name: `${combineParentName(parentName, field.name)}_Input`,\n values: field.options.reduce((values, option) => {\n if (optionIsObject(option)) {\n return {\n ...values,\n [formatName(option.value)]: {\n value: option.value,\n },\n }\n }\n\n return {\n ...values,\n [formatName(option)]: {\n value: option,\n },\n }\n }, {}),\n }),\n })),\n ],\n },\n relationship: {\n operators: [\n ...[...operators.equality, ...operators.contains].map((operator) => ({\n name: operator,\n type: GraphQLJSON,\n })),\n ],\n },\n richText: {\n operators: [\n ...[...operators.equality, ...operators.partial].map((operator) => ({\n name: operator,\n type: GraphQLJSON,\n })),\n ],\n },\n select: {\n operators: [\n ...[...operators.equality, ...operators.contains].map((operator) => ({\n name: operator,\n type: (field: SelectField, parentName): GraphQLType =>\n new GraphQLEnumType({\n name: `${combineParentName(parentName, field.name)}_Input`,\n values: field.options.reduce((values, option) => {\n if (optionIsObject(option)) {\n return {\n ...values,\n [formatName(option.value)]: {\n value: option.value,\n },\n }\n }\n\n return {\n ...values,\n [formatName(option)]: {\n value: option,\n },\n }\n }, {}),\n }),\n })),\n ],\n },\n text: {\n operators: [\n ...[...operators.equality, ...operators.partial, ...operators.contains].map((operator) => ({\n name: operator,\n type: GraphQLString,\n })),\n ],\n },\n textarea: {\n operators: [\n ...[...operators.equality, ...operators.partial].map((operator) => ({\n name: operator,\n type: GraphQLString,\n })),\n ],\n },\n upload: {\n operators: [\n ...[...operators.equality, ...operators.contains].map((operator) => ({\n name: operator,\n type: GraphQLJSON,\n })),\n ],\n },\n // array: n/a\n // group: n/a\n // row: n/a\n // collapsible: n/a\n // tabs: n/a\n}\n\nconst listOperators = ['in', 'not_in', 'all']\n\nconst gqlTypeCache: Record<string, GraphQLType> = {}\n\n/**\n * In GraphQL, you can use \"where\" as an argument to filter a collection. Example:\n * { Posts(where: { title: { equals: \"Hello\" } }) { text } }\n * This function defines the operators for a field's condition in the \"where\" argument of the collection (it thus gets called for every field).\n * For example, in the example above, it would control that\n * - \"equals\" is a valid operator for the \"title\" field\n * - the accepted type of the \"equals\" argument has to be a string.\n *\n * @param field the field for which their valid operators inside a \"where\" argument is being defined\n * @param parentName the name of the parent field (if any)\n * @returns all the operators (including their types) which can be used as a condition for a given field inside a where\n */\nexport const withOperators = (\n field: FieldAffectingData,\n parentName: string,\n): GraphQLInputObjectType => {\n if (!defaults?.[field.type]) {\n throw new Error(`Error: ${field.type} has no defaults configured.`)\n }\n\n const name = `${combineParentName(parentName, field.name)}_operator`\n\n // Get the default operators for the field type which are hard-coded above\n const fieldOperators = [...defaults[field.type].operators]\n\n if (!('required' in field) || !field.required) {\n fieldOperators.push({\n name: 'exists',\n type: fieldOperators[0].type,\n })\n }\n\n return new GraphQLInputObjectType({\n name,\n fields: fieldOperators.reduce((objectTypeFields, operator) => {\n // Get the type of the operator. It can be either static, or dynamic (=> a function)\n let gqlType: GraphQLType =\n typeof operator.type === 'function' ? operator.type(field, parentName) : operator.type\n\n // GraphQL does not allow types with duplicate names, so we use this cache to avoid that.\n // Without this, select and radio fields would have the same name, and GraphQL would throw an error\n // This usually only happens if a custom type is returned from the operator.type function\n if (typeof operator.type === 'function' && 'name' in gqlType) {\n if (gqlTypeCache[gqlType.name]) {\n gqlType = gqlTypeCache[gqlType.name]\n } else {\n gqlTypeCache[gqlType.name] = gqlType\n }\n }\n\n if (listOperators.includes(operator.name)) {\n gqlType = new GraphQLList(gqlType)\n } else if (operator.name === 'exists') {\n gqlType = GraphQLBoolean\n }\n\n return {\n ...objectTypeFields,\n [operator.name]: {\n type: gqlType,\n },\n }\n }, {}),\n })\n}\n"],"names":["GraphQLBoolean","GraphQLEnumType","GraphQLFloat","GraphQLInputObjectType","GraphQLInt","GraphQLList","GraphQLString","DateTimeResolver","EmailAddressResolver","optionIsObject","GraphQLJSON","combineParentName","formatName","operators","GeoJSONObject","name","fields","type","coordinates","defaults","checkbox","equality","map","operator","code","partial","date","comparison","email","contains","json","geojson","number","field","point","geo","radio","parentName","values","options","reduce","option","value","relationship","richText","select","text","textarea","upload","listOperators","gqlTypeCache","withOperators","Error","fieldOperators","required","push","objectTypeFields","gqlType","includes"],"mappings":"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OI,cAAcd,SAASN,IAAI;YAExF,yFAAyF;YACzF,mGAAmG;YACnG,yFAAyF;YACzF,IAAI,OAAOM,SAASN,IAAI,KAAK,cAAc,UAAUwC,SAAS;gBAC5D,IAAIP,YAAY,CAACO,QAAQ1C,IAAI,CAAC,EAAE;oBAC9B0C,UAAUP,YAAY,CAACO,QAAQ1C,IAAI,CAAC;gBACtC,OAAO;oBACLmC,YAAY,CAACO,QAAQ1C,IAAI,CAAC,GAAG0C;gBAC/B;YACF;YAEA,IAAIR,cAAcS,QAAQ,CAACnC,SAASR,IAAI,GAAG;gBACzC0C,UAAU,IAAIpD,YAAYoD;YAC5B,OAAO,IAAIlC,SAASR,IAAI,KAAK,UAAU;gBACrC0C,UAAUzD;YACZ;YAEA,OAAO;gBACL,GAAGwD,gBAAgB;gBACnB,CAACjC,SAASR,IAAI,CAAC,EAAE;oBACfE,MAAMwC;gBACR;YACF;QACF,GAAG,CAAC;IACN;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combineParentName.d.ts","sourceRoot":"","sources":["../../src/utilities/combineParentName.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"combineParentName.d.ts","sourceRoot":"","sources":["../../src/utilities/combineParentName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,WAAY,MAAM,QAAQ,MAAM,KAAG,MACb,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import formatName from './formatName.js';
|
|
2
|
-
const combineParentName = (parent, name)=>formatName(`${parent ? `${parent}_` : ''}${name}`);
|
|
3
|
-
export default combineParentName;
|
|
1
|
+
import { formatName } from './formatName.js';
|
|
2
|
+
export const combineParentName = (parent, name)=>formatName(`${parent ? `${parent}_` : ''}${name}`);
|
|
4
3
|
|
|
5
4
|
//# sourceMappingURL=combineParentName.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/combineParentName.ts"],"sourcesContent":["import formatName from './formatName.js'\n\
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/combineParentName.ts"],"sourcesContent":["import { formatName } from './formatName.js'\n\nexport const combineParentName = (parent: string, name: string): string =>\n formatName(`${parent ? `${parent}_` : ''}${name}`)\n"],"names":["formatName","combineParentName","parent","name"],"mappings":"AAAA,SAASA,UAAU,QAAQ,kBAAiB;AAE5C,OAAO,MAAMC,oBAAoB,CAACC,QAAgBC,OAChDH,WAAW,CAAC,EAAEE,SAAS,CAAC,EAAEA,OAAO,CAAC,CAAC,GAAG,GAAG,EAAEC,KAAK,CAAC,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatName.d.ts","sourceRoot":"","sources":["../../src/utilities/formatName.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"formatName.d.ts","sourceRoot":"","sources":["../../src/utilities/formatName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,WAAY,MAAM,KAAG,MAwB3C,CAAA"}
|
|
@@ -10,7 +10,7 @@ const numbers = [
|
|
|
10
10
|
'8',
|
|
11
11
|
'9'
|
|
12
12
|
];
|
|
13
|
-
const formatName = (string)=>{
|
|
13
|
+
export const formatName = (string)=>{
|
|
14
14
|
let sanitizedString = String(string);
|
|
15
15
|
const firstLetter = sanitizedString.substring(0, 1);
|
|
16
16
|
if (numbers.indexOf(firstLetter) > -1) {
|
|
@@ -20,6 +20,5 @@ const formatName = (string)=>{
|
|
|
20
20
|
.normalize('NFKD').replace(/[\u0300-\u036f]/g, '').replace(/\./g, '_').replace(/-|\//g, '_').replace(/\+/g, '_').replace(/,/g, '_').replace(/\(/g, '_').replace(/\)/g, '_').replace(/'/g, '_').replace(/ /g, '');
|
|
21
21
|
return formatted || '_';
|
|
22
22
|
};
|
|
23
|
-
export default formatName;
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=formatName.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/formatName.ts"],"sourcesContent":["const numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n\
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/formatName.ts"],"sourcesContent":["const numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n\nexport const formatName = (string: string): string => {\n let sanitizedString = String(string)\n\n const firstLetter = sanitizedString.substring(0, 1)\n\n if (numbers.indexOf(firstLetter) > -1) {\n sanitizedString = `_${sanitizedString}`\n }\n\n const formatted = sanitizedString\n // Convert accented characters\n .normalize('NFKD')\n .replace(/[\\u0300-\\u036f]/g, '')\n\n .replace(/\\./g, '_')\n .replace(/-|\\//g, '_')\n .replace(/\\+/g, '_')\n .replace(/,/g, '_')\n .replace(/\\(/g, '_')\n .replace(/\\)/g, '_')\n .replace(/'/g, '_')\n .replace(/ /g, '')\n\n return formatted || '_'\n}\n"],"names":["numbers","formatName","string","sanitizedString","String","firstLetter","substring","indexOf","formatted","normalize","replace"],"mappings":"AAAA,MAAMA,UAAU;IAAC;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;CAAI;AAElE,OAAO,MAAMC,aAAa,CAACC;IACzB,IAAIC,kBAAkBC,OAAOF;IAE7B,MAAMG,cAAcF,gBAAgBG,SAAS,CAAC,GAAG;IAEjD,IAAIN,QAAQO,OAAO,CAACF,eAAe,CAAC,GAAG;QACrCF,kBAAkB,CAAC,CAAC,EAAEA,gBAAgB,CAAC;IACzC;IAEA,MAAMK,YAAYL,eAChB,8BAA8B;KAC7BM,SAAS,CAAC,QACVC,OAAO,CAAC,oBAAoB,IAE5BA,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,SAAS,KACjBA,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,MAAM,KACdA,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,MAAM,KACdA,OAAO,CAAC,MAAM;IAEjB,OAAOF,aAAa;AACtB,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/formatName.spec.ts"],"sourcesContent":["/* eslint-disable
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/formatName.spec.ts"],"sourcesContent":["/* eslint-disable jest/prefer-strict-equal */\nimport { formatName } from './formatName'\n\ndescribe('formatName', () => {\n it.each`\n char | expected\n ${'á'} | ${'a'}\n ${'è'} | ${'e'}\n ${'í'} | ${'i'}\n ${'ó'} | ${'o'}\n ${'ú'} | ${'u'}\n ${'ñ'} | ${'n'}\n ${'ü'} | ${'u'}\n `('should convert accented character: $char', ({ char, expected }) => {\n expect(formatName(char)).toEqual(expected)\n })\n})\n"],"names":["formatName","describe","it","each","char","expected","expect","toEqual"],"mappings":"AAAA,2CAA2C,GAC3C,SAASA,UAAU,QAAQ,eAAc;AAEzCC,SAAS,cAAc;IACrBC,GAAGC,IAAI,CAAC;;IAEN,EAAE,IAAI,GAAG,EAAE,IAAI;IACf,EAAE,IAAI,GAAG,EAAE,IAAI;IACf,EAAE,IAAI,GAAG,EAAE,IAAI;IACf,EAAE,IAAI,GAAG,EAAE,IAAI;IACf,EAAE,IAAI,GAAG,EAAE,IAAI;IACf,EAAE,IAAI,GAAG,EAAE,IAAI;IACf,EAAE,IAAI,GAAG,EAAE,IAAI;EACjB,CAAC,CAAC,4CAA4C,CAAC,EAAEC,IAAI,EAAEC,QAAQ,EAAE;QAC/DC,OAAON,WAAWI,OAAOG,OAAO,CAACF;IACnC;AACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { RadioField, SelectField } from 'payload
|
|
2
|
-
declare const formatOptions: (field: RadioField | SelectField) => {};
|
|
3
|
-
export default formatOptions;
|
|
1
|
+
import type { RadioField, SelectField } from 'payload';
|
|
2
|
+
export declare const formatOptions: (field: RadioField | SelectField) => {};
|
|
4
3
|
//# sourceMappingURL=formatOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatOptions.d.ts","sourceRoot":"","sources":["../../src/utilities/formatOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"formatOptions.d.ts","sourceRoot":"","sources":["../../src/utilities/formatOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAItD,eAAO,MAAM,aAAa,UAAW,UAAU,GAAG,WAAW,OAkB5D,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import formatName from './formatName.js';
|
|
2
|
-
const formatOptions = (field)=>{
|
|
1
|
+
import { formatName } from './formatName.js';
|
|
2
|
+
export const formatOptions = (field)=>{
|
|
3
3
|
return field.options.reduce((values, option)=>{
|
|
4
4
|
if (typeof option === 'object') {
|
|
5
5
|
return {
|
|
@@ -17,6 +17,5 @@ const formatOptions = (field)=>{
|
|
|
17
17
|
};
|
|
18
18
|
}, {});
|
|
19
19
|
};
|
|
20
|
-
export default formatOptions;
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=formatOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/formatOptions.ts"],"sourcesContent":["import type { RadioField, SelectField } from 'payload
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/formatOptions.ts"],"sourcesContent":["import type { RadioField, SelectField } from 'payload'\n\nimport { formatName } from './formatName.js'\n\nexport const formatOptions = (field: RadioField | SelectField) => {\n return field.options.reduce((values, option) => {\n if (typeof option === 'object') {\n return {\n ...values,\n [formatName(option.value)]: {\n value: option.value,\n },\n }\n }\n\n return {\n ...values,\n [formatName(option)]: {\n value: option,\n },\n }\n }, {})\n}\n"],"names":["formatName","formatOptions","field","options","reduce","values","option","value"],"mappings":"AAEA,SAASA,UAAU,QAAQ,kBAAiB;AAE5C,OAAO,MAAMC,gBAAgB,CAACC;IAC5B,OAAOA,MAAMC,OAAO,CAACC,MAAM,CAAC,CAACC,QAAQC;QACnC,IAAI,OAAOA,WAAW,UAAU;YAC9B,OAAO;gBACL,GAAGD,MAAM;gBACT,CAACL,WAAWM,OAAOC,KAAK,EAAE,EAAE;oBAC1BA,OAAOD,OAAOC,KAAK;gBACrB;YACF;QACF;QAEA,OAAO;YACL,GAAGF,MAAM;YACT,CAACL,WAAWM,QAAQ,EAAE;gBACpBC,OAAOD;YACT;QACF;IACF,GAAG,CAAC;AACN,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupOrTabHasRequiredSubfield.d.ts","sourceRoot":"","sources":["../../src/utilities/groupOrTabHasRequiredSubfield.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"groupOrTabHasRequiredSubfield.d.ts","sourceRoot":"","sources":["../../src/utilities/groupOrTabHasRequiredSubfield.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAIzC,eAAO,MAAM,6BAA6B,WAAY,KAAK,GAAG,GAAG,KAAG,OAenE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/groupOrTabHasRequiredSubfield.ts"],"sourcesContent":["import type { Field, Tab } from 'payload
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/groupOrTabHasRequiredSubfield.ts"],"sourcesContent":["import type { Field, Tab } from 'payload'\n\nimport { fieldAffectsData } from 'payload/shared'\n\nexport const groupOrTabHasRequiredSubfield = (entity: Field | Tab): boolean => {\n if ('type' in entity && entity.type === 'group') {\n return entity.fields.some((subField) => {\n return (\n (fieldAffectsData(subField) && 'required' in subField && subField.required) ||\n groupOrTabHasRequiredSubfield(subField)\n )\n })\n }\n\n if ('fields' in entity && 'name' in entity) {\n return (entity as Tab).fields.some((subField) => groupOrTabHasRequiredSubfield(subField))\n }\n\n return false\n}\n"],"names":["fieldAffectsData","groupOrTabHasRequiredSubfield","entity","type","fields","some","subField","required"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,iBAAgB;AAEjD,OAAO,MAAMC,gCAAgC,CAACC;IAC5C,IAAI,UAAUA,UAAUA,OAAOC,IAAI,KAAK,SAAS;QAC/C,OAAOD,OAAOE,MAAM,CAACC,IAAI,CAAC,CAACC;YACzB,OACE,AAACN,iBAAiBM,aAAa,cAAcA,YAAYA,SAASC,QAAQ,IAC1EN,8BAA8BK;QAElC;IACF;IAEA,IAAI,YAAYJ,UAAU,UAAUA,QAAQ;QAC1C,OAAO,AAACA,OAAeE,MAAM,CAACC,IAAI,CAAC,CAACC,WAAaL,8BAA8BK;IACjF;IAEA,OAAO;AACT,EAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ObjMap } from 'graphql/jsutils/ObjMap.js';
|
|
2
2
|
import type { GraphQLFieldConfig } from 'graphql/type/definition.js';
|
|
3
|
-
import type { PayloadRequest } from 'payload
|
|
3
|
+
import type { PayloadRequest } from 'payload';
|
|
4
4
|
type PayloadContext = {
|
|
5
5
|
req: PayloadRequest;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapCustomResolver.d.ts","sourceRoot":"","sources":["../../src/utilities/wrapCustomResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,4BAA4B,CAAA;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"wrapCustomResolver.d.ts","sourceRoot":"","sources":["../../src/utilities/wrapCustomResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,4BAA4B,CAAA;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,KAAK,cAAc,GAAG;IAAE,GAAG,EAAE,cAAc,CAAA;CAAE,CAAA;AAe7C,wBAAgB,gBAAgB,CAAC,OAAO,EACtC,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,GAC1D,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAOrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/wrapCustomResolver.ts"],"sourcesContent":["import type { ObjMap } from 'graphql/jsutils/ObjMap.js'\nimport type { GraphQLFieldConfig, GraphQLFieldResolver } from 'graphql/type/definition.js'\nimport type { PayloadRequest } from 'payload
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/wrapCustomResolver.ts"],"sourcesContent":["import type { ObjMap } from 'graphql/jsutils/ObjMap.js'\nimport type { GraphQLFieldConfig, GraphQLFieldResolver } from 'graphql/type/definition.js'\nimport type { PayloadRequest } from 'payload'\n\nimport { isolateObjectProperty } from 'payload'\n\ntype PayloadContext = { req: PayloadRequest }\n\nfunction wrapCustomResolver<TSource, TArgs, TResult>(\n resolver: GraphQLFieldResolver<TSource, PayloadContext, TArgs, TResult>,\n): GraphQLFieldResolver<TSource, PayloadContext, TArgs, TResult> {\n return (source, args, context, info) => {\n return resolver(\n source,\n args,\n { ...context, req: isolateObjectProperty(context.req, 'transactionID') },\n info,\n )\n }\n}\n\nexport function wrapCustomFields<TSource>(\n fields: ObjMap<GraphQLFieldConfig<TSource, PayloadContext>>,\n): ObjMap<GraphQLFieldConfig<TSource, PayloadContext>> {\n for (const key in fields) {\n if (fields[key].resolve) {\n fields[key].resolve = wrapCustomResolver(fields[key].resolve)\n }\n }\n return fields\n}\n"],"names":["isolateObjectProperty","wrapCustomResolver","resolver","source","args","context","info","req","wrapCustomFields","fields","key","resolve"],"mappings":"AAIA,SAASA,qBAAqB,QAAQ,UAAS;AAI/C,SAASC,mBACPC,QAAuE;IAEvE,OAAO,CAACC,QAAQC,MAAMC,SAASC;QAC7B,OAAOJ,SACLC,QACAC,MACA;YAAE,GAAGC,OAAO;YAAEE,KAAKP,sBAAsBK,QAAQE,GAAG,EAAE;QAAiB,GACvED;IAEJ;AACF;AAEA,OAAO,SAASE,iBACdC,MAA2D;IAE3D,IAAK,MAAMC,OAAOD,OAAQ;QACxB,IAAIA,MAAM,CAACC,IAAI,CAACC,OAAO,EAAE;YACvBF,MAAM,CAACC,IAAI,CAACC,OAAO,GAAGV,mBAAmBQ,MAAM,CAACC,IAAI,CAACC,OAAO;QAC9D;IACF;IACA,OAAOF;AACT"}
|
package/license.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-2024 Payload CMS, Inc. <info@payloadcms.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,44 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/graphql",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
4
|
-
"main": "./dist/index.js",
|
|
5
|
-
"types": "./dist/index.d.ts",
|
|
6
|
-
"type": "module",
|
|
3
|
+
"version": "3.0.0-beta.130",
|
|
7
4
|
"homepage": "https://payloadcms.com",
|
|
8
5
|
"repository": {
|
|
9
6
|
"type": "git",
|
|
10
7
|
"url": "https://github.com/payloadcms/payload.git",
|
|
11
8
|
"directory": "packages/graphql"
|
|
12
9
|
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
|
12
|
+
"maintainers": [
|
|
13
|
+
{
|
|
14
|
+
"name": "Payload",
|
|
15
|
+
"email": "info@payloadcms.com",
|
|
16
|
+
"url": "https://payloadcms.com"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
13
20
|
"exports": {
|
|
14
21
|
".": {
|
|
15
22
|
"import": "./dist/index.js",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./types": {
|
|
27
|
+
"import": "./dist/exports/types.js",
|
|
28
|
+
"types": "./dist/exports/types.d.ts",
|
|
29
|
+
"default": "./dist/exports/types.js"
|
|
30
|
+
},
|
|
31
|
+
"./utilities": {
|
|
32
|
+
"import": "./dist/exports/utilities.js",
|
|
33
|
+
"types": "./dist/exports/utilities.d.ts",
|
|
34
|
+
"default": "./dist/exports/utilities.js"
|
|
18
35
|
}
|
|
19
36
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"@payloadcms/eslint-config": "1.1.1",
|
|
25
|
-
"payload": "3.0.0-beta.13"
|
|
37
|
+
"main": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"bin": {
|
|
40
|
+
"payload-graphql": "bin.js"
|
|
26
41
|
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
27
45
|
"dependencies": {
|
|
28
46
|
"graphql-scalars": "1.22.2",
|
|
29
|
-
"pluralize": "8.0.0"
|
|
47
|
+
"pluralize": "8.0.0",
|
|
48
|
+
"ts-essentials": "10.0.3",
|
|
49
|
+
"tsx": "4.19.2"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/pluralize": "^0.0.33",
|
|
53
|
+
"graphql-http": "^1.22.0",
|
|
54
|
+
"@payloadcms/eslint-config": "3.0.0-beta.112",
|
|
55
|
+
"payload": "3.0.0-beta.130"
|
|
30
56
|
},
|
|
31
57
|
"peerDependencies": {
|
|
32
58
|
"graphql": "^16.8.1",
|
|
33
|
-
"payload": "3.0.0-beta.
|
|
59
|
+
"payload": "3.0.0-beta.130"
|
|
34
60
|
},
|
|
35
|
-
"files": [
|
|
36
|
-
"dist"
|
|
37
|
-
],
|
|
38
61
|
"scripts": {
|
|
39
|
-
"build": "pnpm build:
|
|
40
|
-
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
|
62
|
+
"build": "pnpm build:types && pnpm build:swc",
|
|
63
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
|
41
64
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
42
|
-
"clean": "rimraf {dist,*.tsbuildinfo}"
|
|
65
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
66
|
+
"lint": "eslint .",
|
|
67
|
+
"lint:fix": "eslint . --fix"
|
|
43
68
|
}
|
|
44
69
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCheckIfLocaleObject.d.ts","sourceRoot":"","sources":["../../src/utilities/getCheckIfLocaleObject.ts"],"names":[],"mappings":"uCAA8B;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,aACzC,OAAO,KAAG,OAAO;AAD3B,wBAG4E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getCheckIfLocaleObject.ts"],"sourcesContent":["export default (localization: { locales: string[] }) =>\n (value: unknown): boolean =>\n typeof value === 'object' &&\n Object.keys(value).some((key) => localization.locales.indexOf(key) > -1)\n"],"names":["localization","value","Object","keys","some","key","locales","indexOf"],"rangeMappings":"","mappings":"AAAA,eAAe,CAAA,CAACA,eACd,CAACC,QACC,OAAOA,UAAU,YACjBC,OAAOC,IAAI,CAACF,OAAOG,IAAI,CAAC,CAACC,MAAQL,aAAaM,OAAO,CAACC,OAAO,CAACF,OAAO,CAAC,EAAC,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uppercase.d.ts","sourceRoot":"","sources":["../../src/utilities/uppercase.ts"],"names":[],"mappings":"AAAA,iBAAS,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQtC;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function uppercase(str) {
|
|
2
|
-
const array1 = str.split(' ');
|
|
3
|
-
const newarray1 = [];
|
|
4
|
-
for(let x = 0; x < array1.length; x += 1){
|
|
5
|
-
newarray1.push(array1[x].charAt(0).toUpperCase() + array1[x].slice(1));
|
|
6
|
-
}
|
|
7
|
-
return newarray1.join(' ');
|
|
8
|
-
}
|
|
9
|
-
export default uppercase;
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=uppercase.js.map
|