@payloadcms/graphql 3.67.0-canary.0 → 3.67.0-internal.1ea538b
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initGlobals.d.ts","sourceRoot":"","sources":["../../src/schema/initGlobals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,WAAW,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"initGlobals.d.ts","sourceRoot":"","sources":["../../src/schema/initGlobals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,WAAW,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAA;AAkBzF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,WAAW,CAAA;CAC3B,CAAA;AACD,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,sBAAsB,GAAG,IAAI,CA8KnF"}
|
|
@@ -2,6 +2,7 @@ import { GraphQLBoolean, GraphQLInt, GraphQLNonNull, GraphQLString } from 'graph
|
|
|
2
2
|
import pluralize from 'pluralize';
|
|
3
3
|
const { singular } = pluralize;
|
|
4
4
|
import { buildVersionGlobalFields, toWords } from 'payload';
|
|
5
|
+
import { hasDraftsEnabled } from 'payload/shared';
|
|
5
6
|
import { docAccessResolver } from '../resolvers/globals/docAccess.js';
|
|
6
7
|
import { findOne } from '../resolvers/globals/findOne.js';
|
|
7
8
|
import { findVersionByID } from '../resolvers/globals/findVersionByID.js';
|
|
@@ -17,12 +18,12 @@ import { buildWhereInputType } from './buildWhereInputType.js';
|
|
|
17
18
|
export function initGlobals({ config, graphqlResult }) {
|
|
18
19
|
Object.keys(graphqlResult.globals.config).forEach((slug)=>{
|
|
19
20
|
const global = graphqlResult.globals.config[slug];
|
|
20
|
-
const { fields, graphQL
|
|
21
|
+
const { fields, graphQL } = global;
|
|
21
22
|
if (graphQL === false) {
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
25
|
const formattedName = graphQL?.name ? graphQL.name : singular(toWords(global.slug, true));
|
|
25
|
-
const forceNullableObjectType =
|
|
26
|
+
const forceNullableObjectType = hasDraftsEnabled(global);
|
|
26
27
|
if (!graphqlResult.globals.graphQL) {
|
|
27
28
|
graphqlResult.globals.graphQL = {};
|
|
28
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/initGlobals.ts"],"sourcesContent":["import { GraphQLBoolean, GraphQLInt, GraphQLNonNull, GraphQLString } from 'graphql'\nimport pluralize from 'pluralize'\nconst { singular } = pluralize\n\nimport type { Field, GraphQLInfo, SanitizedConfig, SanitizedGlobalConfig } from 'payload'\n\nimport { buildVersionGlobalFields, toWords } from 'payload'\n\nimport { docAccessResolver } from '../resolvers/globals/docAccess.js'\nimport { findOne } from '../resolvers/globals/findOne.js'\nimport { findVersionByID } from '../resolvers/globals/findVersionByID.js'\nimport { findVersions } from '../resolvers/globals/findVersions.js'\nimport { restoreVersion } from '../resolvers/globals/restoreVersion.js'\nimport { update } from '../resolvers/globals/update.js'\nimport { formatName } from '../utilities/formatName.js'\nimport { buildMutationInputType } from './buildMutationInputType.js'\nimport { buildObjectType } from './buildObjectType.js'\nimport { buildPaginatedListType } from './buildPaginatedListType.js'\nimport { buildPolicyType } from './buildPoliciesType.js'\nimport { buildWhereInputType } from './buildWhereInputType.js'\n\ntype InitGlobalsGraphQLArgs = {\n config: SanitizedConfig\n graphqlResult: GraphQLInfo\n}\nexport function initGlobals({ config, graphqlResult }: InitGlobalsGraphQLArgs): void {\n Object.keys(graphqlResult.globals.config).forEach((slug) => {\n const global: SanitizedGlobalConfig = graphqlResult.globals.config[slug]\n const { fields, graphQL, versions } = global\n\n if (graphQL === false) {\n return\n }\n\n const formattedName = graphQL?.name ? graphQL.name : singular(toWords(global.slug, true))\n\n const forceNullableObjectType = Boolean(versions?.drafts)\n\n if (!graphqlResult.globals.graphQL) {\n graphqlResult.globals.graphQL = {}\n }\n\n const updateMutationInputType = buildMutationInputType({\n name: formattedName,\n config,\n fields,\n graphqlResult,\n parentIsLocalized: false,\n parentName: formattedName,\n })\n graphqlResult.globals.graphQL[slug] = {\n type: buildObjectType({\n name: formattedName,\n config,\n fields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: formattedName,\n }),\n mutationInputType: updateMutationInputType\n ? new GraphQLNonNull(updateMutationInputType)\n : null,\n }\n\n const queriesEnabled = typeof global.graphQL !== 'object' || !global.graphQL.disableQueries\n const mutationsEnabled = typeof global.graphQL !== 'object' || !global.graphQL.disableMutations\n\n if (queriesEnabled) {\n graphqlResult.Query.fields[formattedName] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n select: { type: GraphQLBoolean },\n },\n resolve: findOne(global),\n }\n\n graphqlResult.Query.fields[`docAccess${formattedName}`] = {\n type: buildPolicyType({\n type: 'global',\n entity: global,\n scope: 'docAccess',\n typeSuffix: 'DocAccess',\n }),\n resolve: docAccessResolver(global),\n }\n }\n\n if (mutationsEnabled) {\n graphqlResult.Mutation.fields[`update${formattedName}`] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n ...(updateMutationInputType\n ? { data: { type: graphqlResult.globals.graphQL[slug].mutationInputType } }\n : {}),\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: update(global),\n }\n }\n\n if (global.versions) {\n const idType = config.db.defaultIDType === 'number' ? GraphQLInt : GraphQLString\n\n const versionGlobalFields: Field[] = [\n ...buildVersionGlobalFields(config, global),\n {\n name: 'id',\n type: config.db.defaultIDType as 'text',\n },\n {\n name: 'createdAt',\n type: 'date',\n label: 'Created At',\n },\n {\n name: 'updatedAt',\n type: 'date',\n label: 'Updated At',\n },\n ]\n\n graphqlResult.globals.graphQL[slug].versionType = buildObjectType({\n name: `${formattedName}Version`,\n config,\n fields: versionGlobalFields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: `${formattedName}Version`,\n })\n\n if (queriesEnabled) {\n graphqlResult.Query.fields[`version${formatName(formattedName)}`] = {\n type: graphqlResult.globals.graphQL[slug].versionType,\n args: {\n id: { type: idType },\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n select: { type: GraphQLBoolean },\n },\n resolve: findVersionByID(global),\n }\n graphqlResult.Query.fields[`versions${formattedName}`] = {\n type: buildPaginatedListType(\n `versions${formatName(formattedName)}`,\n graphqlResult.globals.graphQL[slug].versionType,\n ),\n args: {\n where: {\n type: buildWhereInputType({\n name: `versions${formattedName}`,\n fields: versionGlobalFields,\n parentName: `versions${formattedName}`,\n }),\n },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n limit: { type: GraphQLInt },\n page: { type: GraphQLInt },\n pagination: { type: GraphQLBoolean },\n select: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n },\n resolve: findVersions(global),\n }\n }\n\n if (mutationsEnabled) {\n graphqlResult.Mutation.fields[`restoreVersion${formatName(formattedName)}`] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n id: { type: idType },\n draft: { type: GraphQLBoolean },\n },\n resolve: restoreVersion(global),\n }\n }\n }\n })\n}\n"],"names":["GraphQLBoolean","GraphQLInt","GraphQLNonNull","GraphQLString","pluralize","singular","buildVersionGlobalFields","toWords","docAccessResolver","findOne","findVersionByID","findVersions","restoreVersion","update","formatName","buildMutationInputType","buildObjectType","buildPaginatedListType","buildPolicyType","buildWhereInputType","initGlobals","config","graphqlResult","Object","keys","globals","forEach","slug","global","fields","graphQL","versions","formattedName","name","forceNullableObjectType","Boolean","drafts","updateMutationInputType","parentIsLocalized","parentName","type","forceNullable","mutationInputType","queriesEnabled","disableQueries","mutationsEnabled","disableMutations","Query","args","draft","localization","fallbackLocale","types","fallbackLocaleInputType","locale","localeInputType","select","resolve","entity","scope","typeSuffix","Mutation","data","idType","db","defaultIDType","versionGlobalFields","label","versionType","id","where","limit","page","pagination","sort"],"mappings":"AAAA,SAASA,cAAc,EAAEC,UAAU,EAAEC,cAAc,EAAEC,aAAa,QAAQ,UAAS;AACnF,OAAOC,eAAe,YAAW;AACjC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;AAIrB,SAASE,wBAAwB,EAAEC,OAAO,QAAQ,UAAS;AAE3D,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,OAAO,QAAQ,kCAAiC;AACzD,SAASC,eAAe,QAAQ,0CAAyC;AACzE,SAASC,YAAY,QAAQ,uCAAsC;AACnE,SAASC,cAAc,QAAQ,yCAAwC;AACvE,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,UAAU,QAAQ,6BAA4B;AACvD,SAASC,sBAAsB,QAAQ,8BAA6B;AACpE,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,sBAAsB,QAAQ,8BAA6B;AACpE,SAASC,eAAe,QAAQ,yBAAwB;AACxD,SAASC,mBAAmB,QAAQ,2BAA0B;AAM9D,OAAO,SAASC,YAAY,EAAEC,MAAM,EAAEC,aAAa,EAA0B;IAC3EC,OAAOC,IAAI,CAACF,cAAcG,OAAO,CAACJ,MAAM,EAAEK,OAAO,CAAC,CAACC;QACjD,MAAMC,SAAgCN,cAAcG,OAAO,CAACJ,MAAM,CAACM,KAAK;QACxE,MAAM,EAAEE,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGH;QAEtC,IAAIE,YAAY,OAAO;YACrB;QACF;QAEA,MAAME,gBAAgBF,SA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AAEhB,MAAMxC;wBAAe;wBAC/B0E,MAAM;4BAAElC,MAAMrC;wBAAc;oBAC9B;oBACAsD,SAAS9C,aAAaiB;gBACxB;YACF;YAEA,IAAIiB,kBAAkB;gBACpBvB,cAAcuC,QAAQ,CAAChC,MAAM,CAAC,CAAC,cAAc,EAAEf,WAAWkB,gBAAgB,CAAC,GAAG;oBAC5EQ,MAAMlB,cAAcG,OAAO,CAACK,OAAO,CAACH,KAAK,CAACa,IAAI;oBAC9CQ,MAAM;wBACJqB,IAAI;4BAAE7B,MAAMuB;wBAAO;wBACnBd,OAAO;4BAAET,MAAMxC;wBAAe;oBAChC;oBACAyD,SAAS7C,eAAegB;gBAC1B;YACF;QACF;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/schema/initGlobals.ts"],"sourcesContent":["import { GraphQLBoolean, GraphQLInt, GraphQLNonNull, GraphQLString } from 'graphql'\nimport pluralize from 'pluralize'\nconst { singular } = pluralize\n\nimport type { Field, GraphQLInfo, SanitizedConfig, SanitizedGlobalConfig } from 'payload'\n\nimport { buildVersionGlobalFields, toWords } from 'payload'\nimport { hasDraftsEnabled } from 'payload/shared'\n\nimport { docAccessResolver } from '../resolvers/globals/docAccess.js'\nimport { findOne } from '../resolvers/globals/findOne.js'\nimport { findVersionByID } from '../resolvers/globals/findVersionByID.js'\nimport { findVersions } from '../resolvers/globals/findVersions.js'\nimport { restoreVersion } from '../resolvers/globals/restoreVersion.js'\nimport { update } from '../resolvers/globals/update.js'\nimport { formatName } from '../utilities/formatName.js'\nimport { buildMutationInputType } from './buildMutationInputType.js'\nimport { buildObjectType } from './buildObjectType.js'\nimport { buildPaginatedListType } from './buildPaginatedListType.js'\nimport { buildPolicyType } from './buildPoliciesType.js'\nimport { buildWhereInputType } from './buildWhereInputType.js'\n\ntype InitGlobalsGraphQLArgs = {\n config: SanitizedConfig\n graphqlResult: GraphQLInfo\n}\nexport function initGlobals({ config, graphqlResult }: InitGlobalsGraphQLArgs): void {\n Object.keys(graphqlResult.globals.config).forEach((slug) => {\n const global: SanitizedGlobalConfig = graphqlResult.globals.config[slug]\n const { fields, graphQL } = global\n\n if (graphQL === false) {\n return\n }\n\n const formattedName = graphQL?.name ? graphQL.name : singular(toWords(global.slug, true))\n\n const forceNullableObjectType = hasDraftsEnabled(global)\n\n if (!graphqlResult.globals.graphQL) {\n graphqlResult.globals.graphQL = {}\n }\n\n const updateMutationInputType = buildMutationInputType({\n name: formattedName,\n config,\n fields,\n graphqlResult,\n parentIsLocalized: false,\n parentName: formattedName,\n })\n graphqlResult.globals.graphQL[slug] = {\n type: buildObjectType({\n name: formattedName,\n config,\n fields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: formattedName,\n }),\n mutationInputType: updateMutationInputType\n ? new GraphQLNonNull(updateMutationInputType)\n : null,\n }\n\n const queriesEnabled = typeof global.graphQL !== 'object' || !global.graphQL.disableQueries\n const mutationsEnabled = typeof global.graphQL !== 'object' || !global.graphQL.disableMutations\n\n if (queriesEnabled) {\n graphqlResult.Query.fields[formattedName] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n select: { type: GraphQLBoolean },\n },\n resolve: findOne(global),\n }\n\n graphqlResult.Query.fields[`docAccess${formattedName}`] = {\n type: buildPolicyType({\n type: 'global',\n entity: global,\n scope: 'docAccess',\n typeSuffix: 'DocAccess',\n }),\n resolve: docAccessResolver(global),\n }\n }\n\n if (mutationsEnabled) {\n graphqlResult.Mutation.fields[`update${formattedName}`] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n ...(updateMutationInputType\n ? { data: { type: graphqlResult.globals.graphQL[slug].mutationInputType } }\n : {}),\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n },\n resolve: update(global),\n }\n }\n\n if (global.versions) {\n const idType = config.db.defaultIDType === 'number' ? GraphQLInt : GraphQLString\n\n const versionGlobalFields: Field[] = [\n ...buildVersionGlobalFields(config, global),\n {\n name: 'id',\n type: config.db.defaultIDType as 'text',\n },\n {\n name: 'createdAt',\n type: 'date',\n label: 'Created At',\n },\n {\n name: 'updatedAt',\n type: 'date',\n label: 'Updated At',\n },\n ]\n\n graphqlResult.globals.graphQL[slug].versionType = buildObjectType({\n name: `${formattedName}Version`,\n config,\n fields: versionGlobalFields,\n forceNullable: forceNullableObjectType,\n graphqlResult,\n parentName: `${formattedName}Version`,\n })\n\n if (queriesEnabled) {\n graphqlResult.Query.fields[`version${formatName(formattedName)}`] = {\n type: graphqlResult.globals.graphQL[slug].versionType,\n args: {\n id: { type: idType },\n draft: { type: GraphQLBoolean },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n select: { type: GraphQLBoolean },\n },\n resolve: findVersionByID(global),\n }\n graphqlResult.Query.fields[`versions${formattedName}`] = {\n type: buildPaginatedListType(\n `versions${formatName(formattedName)}`,\n graphqlResult.globals.graphQL[slug].versionType,\n ),\n args: {\n where: {\n type: buildWhereInputType({\n name: `versions${formattedName}`,\n fields: versionGlobalFields,\n parentName: `versions${formattedName}`,\n }),\n },\n ...(config.localization\n ? {\n fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType },\n locale: { type: graphqlResult.types.localeInputType },\n }\n : {}),\n limit: { type: GraphQLInt },\n page: { type: GraphQLInt },\n pagination: { type: GraphQLBoolean },\n select: { type: GraphQLBoolean },\n sort: { type: GraphQLString },\n },\n resolve: findVersions(global),\n }\n }\n\n if (mutationsEnabled) {\n graphqlResult.Mutation.fields[`restoreVersion${formatName(formattedName)}`] = {\n type: graphqlResult.globals.graphQL[slug].type,\n args: {\n id: { type: idType },\n draft: { type: GraphQLBoolean },\n },\n resolve: restoreVersion(global),\n }\n }\n }\n })\n}\n"],"names":["GraphQLBoolean","GraphQLInt","GraphQLNonNull","GraphQLString","pluralize","singular","buildVersionGlobalFields","toWords","hasDraftsEnabled","docAccessResolver","findOne","findVersionByID","findVersions","restoreVersion","update","formatName","buildMutationInputType","buildObjectType","buildPaginatedListType","buildPolicyType","buildWhereInputType","initGlobals","config","graphqlResult","Object","keys","globals","forEach","slug","global","fields","graphQL","formattedName","name","forceNullableObjectType","updateMutationInputType","parentIsLocalized","parentName","type","forceNullable","mutationInputType","queriesEnabled","disableQueries","mutationsEnabled","disableMutations","Query","args","draft","localization","fallbackLocale","types","fallbackLocaleInputType","locale","localeInputType","select","resolve","entity","scope","typeSuffix","Mutation","data","versions","idType","db","defaultIDType","versionGlobalFields","label","versionType","id","where","limit","page","pagination","sort"],"mappings":"AAAA,SAASA,cAAc,EAAEC,UAAU,EAAEC,cAAc,EAAEC,aAAa,QAAQ,UAAS;AACnF,OAAOC,eAAe,YAAW;AACjC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;AAIrB,SAASE,wBAAwB,EAAEC,OAAO,QAAQ,UAAS;AAC3D,SAASC,gBAAgB,QAAQ,iBAAgB;AAEjD,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,OAAO,QAAQ,kCAAiC;AACzD,SAASC,eAAe,QAAQ,0CAAyC;AACzE,SAASC,YAAY,QAAQ,uCAAsC;AACnE,SAASC,cAAc,QAAQ,yCAAwC;AACvE,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,UAAU,QAAQ,6BAA4B;AACvD,SAASC,sBAAsB,QAAQ,8BAA6B;AACpE,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,sBAAsB,QAAQ,8BAA6B;AACpE,SAASC,eAAe,QAAQ,yBAAwB;AACxD,SAASC,mBAAmB,QAAQ,2BAA0B;AAM9D,OAAO,SAASC,YAAY,EAAEC,MAAM,EAAEC,aAAa,EAA0B;IAC3EC,OAAOC,IAAI,CAACF,cAAcG,OAAO,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CAACG,eAAe;4BAAC;wBACtD,IACA,CAAC,CAAC;wBACNiB,OAAO;4BAAEhC,MAAMrC;wBAAW;wBAC1BsE,MAAM;4BAAEjC,MAAMrC;wBAAW;wBACzBuE,YAAY;4BAAElC,MAAMtC;wBAAe;wBACnCsD,QAAQ;4BAAEhB,MAAMtC;wBAAe;wBAC/ByE,MAAM;4BAAEnC,MAAMnC;wBAAc;oBAC9B;oBACAoD,SAAS3C,aAAaiB;gBACxB;YACF;YAEA,IAAIc,kBAAkB;gBACpBpB,cAAcoC,QAAQ,CAAC7B,MAAM,CAAC,CAAC,cAAc,EAAEf,WAAWiB,gBAAgB,CAAC,GAAG;oBAC5EM,MAAMf,cAAcG,OAAO,CAACK,OAAO,CAACH,KAAK,CAACU,IAAI;oBAC9CQ,MAAM;wBACJsB,IAAI;4BAAE9B,MAAMwB;wBAAO;wBACnBf,OAAO;4BAAET,MAAMtC;wBAAe;oBAChC;oBACAuD,SAAS1C,eAAegB;gBAC1B;YACF;QACF;IACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/graphql",
|
|
3
|
-
"version": "3.67.0-
|
|
3
|
+
"version": "3.67.0-internal.1ea538b",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"@types/pluralize": "^0.0.33",
|
|
54
54
|
"graphql-http": "^1.22.0",
|
|
55
55
|
"@payloadcms/eslint-config": "3.28.0",
|
|
56
|
-
"payload": "3.67.0-
|
|
56
|
+
"payload": "3.67.0-internal.1ea538b"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"graphql": "^16.8.1",
|
|
60
|
-
"payload": "3.67.0-
|
|
60
|
+
"payload": "3.67.0-internal.1ea538b"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "pnpm build:types && pnpm build:swc",
|