node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
'use strict';
var strapiAdmin = require('@strapi/admin/strapi-admin');
const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
addTagTypes: [
'ComponentConfiguration',
'ContentTypesConfiguration',
'ContentTypeSettings',
'Document',
'InitialData',
'HistoryVersion',
'Relations',
'UidAvailability',
'RecentDocumentList'
]
});
exports.contentManagerApi = contentManagerApi;
//# sourceMappingURL=api.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"api.js","sources":["../../../admin/src/services/api.ts"],"sourcesContent":["import { adminApi } from '@strapi/admin/strapi-admin';\n\nconst contentManagerApi = adminApi.enhanceEndpoints({\n addTagTypes: [\n 'ComponentConfiguration',\n 'ContentTypesConfiguration',\n 'ContentTypeSettings',\n 'Document',\n 'InitialData',\n 'HistoryVersion',\n 'Relations',\n 'UidAvailability',\n 'RecentDocumentList',\n ],\n});\n\nexport { contentManagerApi };\n"],"names":["contentManagerApi","adminApi","enhanceEndpoints","addTagTypes"],"mappings":";;;;AAEMA,MAAAA,iBAAAA,GAAoBC,oBAASC,CAAAA,gBAAgB,CAAC;IAClDC,WAAa,EAAA;AACX,QAAA,wBAAA;AACA,QAAA,2BAAA;AACA,QAAA,qBAAA;AACA,QAAA,UAAA;AACA,QAAA,aAAA;AACA,QAAA,gBAAA;AACA,QAAA,WAAA;AACA,QAAA,iBAAA;AACA,QAAA;AACD;AACH,CAAA;;;;"}

View File

@@ -0,0 +1,18 @@
import { adminApi } from '@strapi/admin/strapi-admin';
const contentManagerApi = adminApi.enhanceEndpoints({
addTagTypes: [
'ComponentConfiguration',
'ContentTypesConfiguration',
'ContentTypeSettings',
'Document',
'InitialData',
'HistoryVersion',
'Relations',
'UidAvailability',
'RecentDocumentList'
]
});
export { contentManagerApi };
//# sourceMappingURL=api.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"api.mjs","sources":["../../../admin/src/services/api.ts"],"sourcesContent":["import { adminApi } from '@strapi/admin/strapi-admin';\n\nconst contentManagerApi = adminApi.enhanceEndpoints({\n addTagTypes: [\n 'ComponentConfiguration',\n 'ContentTypesConfiguration',\n 'ContentTypeSettings',\n 'Document',\n 'InitialData',\n 'HistoryVersion',\n 'Relations',\n 'UidAvailability',\n 'RecentDocumentList',\n ],\n});\n\nexport { contentManagerApi };\n"],"names":["contentManagerApi","adminApi","enhanceEndpoints","addTagTypes"],"mappings":";;AAEMA,MAAAA,iBAAAA,GAAoBC,QAASC,CAAAA,gBAAgB,CAAC;IAClDC,WAAa,EAAA;AACX,QAAA,wBAAA;AACA,QAAA,2BAAA;AACA,QAAA,qBAAA;AACA,QAAA,UAAA;AACA,QAAA,aAAA;AACA,QAAA,gBAAA;AACA,QAAA,WAAA;AACA,QAAA,iBAAA;AACA,QAAA;AACD;AACH,CAAA;;;;"}

View File

@@ -0,0 +1,42 @@
'use strict';
var api = require('./api.js');
const componentsApi = api.contentManagerApi.injectEndpoints({
endpoints: (builder)=>({
getComponentConfiguration: builder.query({
query: (uid)=>`/content-manager/components/${uid}/configuration`,
transformResponse: (response)=>response.data,
providesTags: (_result, _error, uid)=>[
{
type: 'ComponentConfiguration',
id: uid
}
]
}),
updateComponentConfiguration: builder.mutation({
query: ({ uid, ...body })=>({
url: `/content-manager/components/${uid}/configuration`,
method: 'PUT',
data: body
}),
transformResponse: (response)=>response.data,
invalidatesTags: (_result, _error, { uid })=>[
{
type: 'ComponentConfiguration',
id: uid
},
// otherwise layouts already fetched will have stale component configuration data.
{
type: 'ContentTypeSettings',
id: 'LIST'
}
]
})
})
});
const { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } = componentsApi;
exports.useGetComponentConfigurationQuery = useGetComponentConfigurationQuery;
exports.useUpdateComponentConfigurationMutation = useUpdateComponentConfigurationMutation;
//# sourceMappingURL=components.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"components.js","sources":["../../../admin/src/services/components.ts"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type {\n FindComponentConfiguration,\n UpdateComponentConfiguration,\n} from '../../../shared/contracts/components';\n\nconst componentsApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getComponentConfiguration: builder.query<\n FindComponentConfiguration.Response['data'],\n FindComponentConfiguration.Params['uid']\n >({\n query: (uid) => `/content-manager/components/${uid}/configuration`,\n transformResponse: (response: FindComponentConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [{ type: 'ComponentConfiguration', id: uid }],\n }),\n updateComponentConfiguration: builder.mutation({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/components/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateComponentConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ComponentConfiguration', id: uid },\n // otherwise layouts already fetched will have stale component configuration data.\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n }),\n});\n\nconst { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } =\n componentsApi;\n\nexport { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };\n"],"names":["componentsApi","contentManagerApi","injectEndpoints","endpoints","builder","getComponentConfiguration","query","uid","transformResponse","response","data","providesTags","_result","_error","type","id","updateComponentConfiguration","mutation","body","url","method","invalidatesTags","useGetComponentConfigurationQuery","useUpdateComponentConfigurationMutation"],"mappings":";;;;AAOA,MAAMA,aAAAA,GAAgBC,qBAAkBC,CAAAA,eAAe,CAAC;IACtDC,SAAW,EAAA,CAACC,WAAa;YACvBC,yBAA2BD,EAAAA,OAAAA,CAAQE,KAAK,CAGtC;AACAA,gBAAAA,KAAAA,EAAO,CAACC,GAAQ,GAAA,CAAC,4BAA4B,EAAEA,GAAAA,CAAI,cAAc,CAAC;gBAClEC,iBAAmB,EAAA,CAACC,QAAkDA,GAAAA,QAAAA,CAASC,IAAI;gBACnFC,YAAc,EAAA,CAACC,OAASC,EAAAA,MAAAA,EAAQN,GAAQ,GAAA;AAAC,wBAAA;4BAAEO,IAAM,EAAA,wBAAA;4BAA0BC,EAAIR,EAAAA;AAAI;AAAE;AACvF,aAAA,CAAA;YACAS,4BAA8BZ,EAAAA,OAAAA,CAAQa,QAAQ,CAAC;AAC7CX,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,GAAG,EAAE,GAAGW,IAAAA,EAAM,IAAM;AAC5BC,wBAAAA,GAAAA,EAAK,CAAC,4BAA4B,EAAEZ,GAAAA,CAAI,cAAc,CAAC;wBACvDa,MAAQ,EAAA,KAAA;wBACRV,IAAMQ,EAAAA;qBACR,CAAA;gBACAV,iBAAmB,EAAA,CAACC,QAAoDA,GAAAA,QAAAA,CAASC,IAAI;AACrFW,gBAAAA,eAAAA,EAAiB,CAACT,OAASC,EAAAA,MAAAA,EAAQ,EAAEN,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAEO,IAAM,EAAA,wBAAA;4BAA0BC,EAAIR,EAAAA;AAAI,yBAAA;;AAE1C,wBAAA;4BAAEO,IAAM,EAAA,qBAAA;4BAAuBC,EAAI,EAAA;AAAO;AAC3C;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EAAEO,iCAAiC,EAAEC,uCAAuC,EAAE,GAClFvB;;;;;"}

View File

@@ -0,0 +1,39 @@
import { contentManagerApi } from './api.mjs';
const componentsApi = contentManagerApi.injectEndpoints({
endpoints: (builder)=>({
getComponentConfiguration: builder.query({
query: (uid)=>`/content-manager/components/${uid}/configuration`,
transformResponse: (response)=>response.data,
providesTags: (_result, _error, uid)=>[
{
type: 'ComponentConfiguration',
id: uid
}
]
}),
updateComponentConfiguration: builder.mutation({
query: ({ uid, ...body })=>({
url: `/content-manager/components/${uid}/configuration`,
method: 'PUT',
data: body
}),
transformResponse: (response)=>response.data,
invalidatesTags: (_result, _error, { uid })=>[
{
type: 'ComponentConfiguration',
id: uid
},
// otherwise layouts already fetched will have stale component configuration data.
{
type: 'ContentTypeSettings',
id: 'LIST'
}
]
})
})
});
const { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } = componentsApi;
export { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };
//# sourceMappingURL=components.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"components.mjs","sources":["../../../admin/src/services/components.ts"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type {\n FindComponentConfiguration,\n UpdateComponentConfiguration,\n} from '../../../shared/contracts/components';\n\nconst componentsApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getComponentConfiguration: builder.query<\n FindComponentConfiguration.Response['data'],\n FindComponentConfiguration.Params['uid']\n >({\n query: (uid) => `/content-manager/components/${uid}/configuration`,\n transformResponse: (response: FindComponentConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [{ type: 'ComponentConfiguration', id: uid }],\n }),\n updateComponentConfiguration: builder.mutation({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/components/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateComponentConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ComponentConfiguration', id: uid },\n // otherwise layouts already fetched will have stale component configuration data.\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n }),\n});\n\nconst { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } =\n componentsApi;\n\nexport { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };\n"],"names":["componentsApi","contentManagerApi","injectEndpoints","endpoints","builder","getComponentConfiguration","query","uid","transformResponse","response","data","providesTags","_result","_error","type","id","updateComponentConfiguration","mutation","body","url","method","invalidatesTags","useGetComponentConfigurationQuery","useUpdateComponentConfigurationMutation"],"mappings":";;AAOA,MAAMA,aAAAA,GAAgBC,iBAAkBC,CAAAA,eAAe,CAAC;IACtDC,SAAW,EAAA,CAACC,WAAa;YACvBC,yBAA2BD,EAAAA,OAAAA,CAAQE,KAAK,CAGtC;AACAA,gBAAAA,KAAAA,EAAO,CAACC,GAAQ,GAAA,CAAC,4BAA4B,EAAEA,GAAAA,CAAI,cAAc,CAAC;gBAClEC,iBAAmB,EAAA,CAACC,QAAkDA,GAAAA,QAAAA,CAASC,IAAI;gBACnFC,YAAc,EAAA,CAACC,OAASC,EAAAA,MAAAA,EAAQN,GAAQ,GAAA;AAAC,wBAAA;4BAAEO,IAAM,EAAA,wBAAA;4BAA0BC,EAAIR,EAAAA;AAAI;AAAE;AACvF,aAAA,CAAA;YACAS,4BAA8BZ,EAAAA,OAAAA,CAAQa,QAAQ,CAAC;AAC7CX,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,GAAG,EAAE,GAAGW,IAAAA,EAAM,IAAM;AAC5BC,wBAAAA,GAAAA,EAAK,CAAC,4BAA4B,EAAEZ,GAAAA,CAAI,cAAc,CAAC;wBACvDa,MAAQ,EAAA,KAAA;wBACRV,IAAMQ,EAAAA;qBACR,CAAA;gBACAV,iBAAmB,EAAA,CAACC,QAAoDA,GAAAA,QAAAA,CAASC,IAAI;AACrFW,gBAAAA,eAAAA,EAAiB,CAACT,OAASC,EAAAA,MAAAA,EAAQ,EAAEN,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAEO,IAAM,EAAA,wBAAA;4BAA0BC,EAAIR,EAAAA;AAAI,yBAAA;;AAE1C,wBAAA;4BAAEO,IAAM,EAAA,qBAAA;4BAAuBC,EAAI,EAAA;AAAO;AAC3C;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EAAEO,iCAAiC,EAAEC,uCAAuC,EAAE,GAClFvB;;;;"}

View File

@@ -0,0 +1,63 @@
'use strict';
var api = require('./api.js');
const contentTypesApi = api.contentManagerApi.injectEndpoints({
endpoints: (builder)=>({
getContentTypeConfiguration: builder.query({
query: (uid)=>({
url: `/content-manager/content-types/${uid}/configuration`,
method: 'GET'
}),
transformResponse: (response)=>response.data,
providesTags: (_result, _error, uid)=>[
{
type: 'ContentTypesConfiguration',
id: uid
},
{
type: 'ContentTypeSettings',
id: 'LIST'
}
]
}),
getAllContentTypeSettings: builder.query({
query: ()=>'/content-manager/content-types-settings',
transformResponse: (response)=>response.data,
providesTags: [
{
type: 'ContentTypeSettings',
id: 'LIST'
}
]
}),
updateContentTypeConfiguration: builder.mutation({
query: ({ uid, ...body })=>({
url: `/content-manager/content-types/${uid}/configuration`,
method: 'PUT',
data: body
}),
transformResponse: (response)=>response.data,
invalidatesTags: (_result, _error, { uid })=>[
{
type: 'ContentTypesConfiguration',
id: uid
},
{
type: 'ContentTypeSettings',
id: 'LIST'
},
// Is this necessary?
{
type: 'InitialData'
}
]
})
})
});
const { useGetContentTypeConfigurationQuery, useGetAllContentTypeSettingsQuery, useUpdateContentTypeConfigurationMutation } = contentTypesApi;
exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
//# sourceMappingURL=contentTypes.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"contentTypes.js","sources":["../../../admin/src/services/contentTypes.ts"],"sourcesContent":["import {\n FindContentTypeConfiguration,\n UpdateContentTypeConfiguration,\n FindContentTypesSettings,\n} from '../../../shared/contracts/content-types';\n\nimport { contentManagerApi } from './api';\n\nconst contentTypesApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getContentTypeConfiguration: builder.query<\n FindContentTypeConfiguration.Response['data'],\n string\n >({\n query: (uid) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'GET',\n }),\n transformResponse: (response: FindContentTypeConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n getAllContentTypeSettings: builder.query<FindContentTypesSettings.Response['data'], void>({\n query: () => '/content-manager/content-types-settings',\n transformResponse: (response: FindContentTypesSettings.Response) => response.data,\n providesTags: [{ type: 'ContentTypeSettings', id: 'LIST' }],\n }),\n updateContentTypeConfiguration: builder.mutation<\n UpdateContentTypeConfiguration.Response['data'],\n UpdateContentTypeConfiguration.Request['body'] & {\n uid: string;\n }\n >({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateContentTypeConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n // Is this necessary?\n { type: 'InitialData' },\n ],\n }),\n }),\n});\n\nconst {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n} = contentTypesApi;\n\nexport {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n};\n"],"names":["contentTypesApi","contentManagerApi","injectEndpoints","endpoints","builder","getContentTypeConfiguration","query","uid","url","method","transformResponse","response","data","providesTags","_result","_error","type","id","getAllContentTypeSettings","updateContentTypeConfiguration","mutation","body","invalidatesTags","useGetContentTypeConfigurationQuery","useGetAllContentTypeSettingsQuery","useUpdateContentTypeConfigurationMutation"],"mappings":";;;;AAQA,MAAMA,eAAAA,GAAkBC,qBAAkBC,CAAAA,eAAe,CAAC;IACxDC,SAAW,EAAA,CAACC,WAAa;YACvBC,2BAA6BD,EAAAA,OAAAA,CAAQE,KAAK,CAGxC;gBACAA,KAAO,EAAA,CAACC,OAAS;AACfC,wBAAAA,GAAAA,EAAK,CAAC,+BAA+B,EAAED,GAAAA,CAAI,cAAc,CAAC;wBAC1DE,MAAQ,EAAA;qBACV,CAAA;gBACAC,iBAAmB,EAAA,CAACC,QAAoDA,GAAAA,QAAAA,CAASC,IAAI;gBACrFC,YAAc,EAAA,CAACC,OAASC,EAAAA,MAAAA,EAAQR,GAAQ,GAAA;AACtC,wBAAA;4BAAES,IAAM,EAAA,2BAAA;4BAA6BC,EAAIV,EAAAA;AAAI,yBAAA;AAC7C,wBAAA;4BAAES,IAAM,EAAA,qBAAA;4BAAuBC,EAAI,EAAA;AAAO;AAC3C;AACH,aAAA,CAAA;YACAC,yBAA2Bd,EAAAA,OAAAA,CAAQE,KAAK,CAAkD;AACxFA,gBAAAA,KAAAA,EAAO,IAAM,yCAAA;gBACbI,iBAAmB,EAAA,CAACC,QAAgDA,GAAAA,QAAAA,CAASC,IAAI;gBACjFC,YAAc,EAAA;AAAC,oBAAA;wBAAEG,IAAM,EAAA,qBAAA;wBAAuBC,EAAI,EAAA;AAAO;AAAE;AAC7D,aAAA,CAAA;YACAE,8BAAgCf,EAAAA,OAAAA,CAAQgB,QAAQ,CAK9C;AACAd,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,GAAG,EAAE,GAAGc,IAAAA,EAAM,IAAM;AAC5Bb,wBAAAA,GAAAA,EAAK,CAAC,+BAA+B,EAAED,GAAAA,CAAI,cAAc,CAAC;wBAC1DE,MAAQ,EAAA,KAAA;wBACRG,IAAMS,EAAAA;qBACR,CAAA;gBACAX,iBAAmB,EAAA,CAACC,QAAsDA,GAAAA,QAAAA,CAASC,IAAI;AACvFU,gBAAAA,eAAAA,EAAiB,CAACR,OAASC,EAAAA,MAAAA,EAAQ,EAAER,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAES,IAAM,EAAA,2BAAA;4BAA6BC,EAAIV,EAAAA;AAAI,yBAAA;AAC7C,wBAAA;4BAAES,IAAM,EAAA,qBAAA;4BAAuBC,EAAI,EAAA;AAAO,yBAAA;;AAE1C,wBAAA;4BAAED,IAAM,EAAA;AAAc;AACvB;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EACJO,mCAAmC,EACnCC,iCAAiC,EACjCC,yCAAyC,EAC1C,GAAGzB;;;;;;"}

View File

@@ -0,0 +1,59 @@
import { contentManagerApi } from './api.mjs';
const contentTypesApi = contentManagerApi.injectEndpoints({
endpoints: (builder)=>({
getContentTypeConfiguration: builder.query({
query: (uid)=>({
url: `/content-manager/content-types/${uid}/configuration`,
method: 'GET'
}),
transformResponse: (response)=>response.data,
providesTags: (_result, _error, uid)=>[
{
type: 'ContentTypesConfiguration',
id: uid
},
{
type: 'ContentTypeSettings',
id: 'LIST'
}
]
}),
getAllContentTypeSettings: builder.query({
query: ()=>'/content-manager/content-types-settings',
transformResponse: (response)=>response.data,
providesTags: [
{
type: 'ContentTypeSettings',
id: 'LIST'
}
]
}),
updateContentTypeConfiguration: builder.mutation({
query: ({ uid, ...body })=>({
url: `/content-manager/content-types/${uid}/configuration`,
method: 'PUT',
data: body
}),
transformResponse: (response)=>response.data,
invalidatesTags: (_result, _error, { uid })=>[
{
type: 'ContentTypesConfiguration',
id: uid
},
{
type: 'ContentTypeSettings',
id: 'LIST'
},
// Is this necessary?
{
type: 'InitialData'
}
]
})
})
});
const { useGetContentTypeConfigurationQuery, useGetAllContentTypeSettingsQuery, useUpdateContentTypeConfigurationMutation } = contentTypesApi;
export { useGetAllContentTypeSettingsQuery, useGetContentTypeConfigurationQuery, useUpdateContentTypeConfigurationMutation };
//# sourceMappingURL=contentTypes.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"contentTypes.mjs","sources":["../../../admin/src/services/contentTypes.ts"],"sourcesContent":["import {\n FindContentTypeConfiguration,\n UpdateContentTypeConfiguration,\n FindContentTypesSettings,\n} from '../../../shared/contracts/content-types';\n\nimport { contentManagerApi } from './api';\n\nconst contentTypesApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getContentTypeConfiguration: builder.query<\n FindContentTypeConfiguration.Response['data'],\n string\n >({\n query: (uid) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'GET',\n }),\n transformResponse: (response: FindContentTypeConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n getAllContentTypeSettings: builder.query<FindContentTypesSettings.Response['data'], void>({\n query: () => '/content-manager/content-types-settings',\n transformResponse: (response: FindContentTypesSettings.Response) => response.data,\n providesTags: [{ type: 'ContentTypeSettings', id: 'LIST' }],\n }),\n updateContentTypeConfiguration: builder.mutation<\n UpdateContentTypeConfiguration.Response['data'],\n UpdateContentTypeConfiguration.Request['body'] & {\n uid: string;\n }\n >({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateContentTypeConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n // Is this necessary?\n { type: 'InitialData' },\n ],\n }),\n }),\n});\n\nconst {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n} = contentTypesApi;\n\nexport {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n};\n"],"names":["contentTypesApi","contentManagerApi","injectEndpoints","endpoints","builder","getContentTypeConfiguration","query","uid","url","method","transformResponse","response","data","providesTags","_result","_error","type","id","getAllContentTypeSettings","updateContentTypeConfiguration","mutation","body","invalidatesTags","useGetContentTypeConfigurationQuery","useGetAllContentTypeSettingsQuery","useUpdateContentTypeConfigurationMutation"],"mappings":";;AAQA,MAAMA,eAAAA,GAAkBC,iBAAkBC,CAAAA,eAAe,CAAC;IACxDC,SAAW,EAAA,CAACC,WAAa;YACvBC,2BAA6BD,EAAAA,OAAAA,CAAQE,KAAK,CAGxC;gBACAA,KAAO,EAAA,CAACC,OAAS;AACfC,wBAAAA,GAAAA,EAAK,CAAC,+BAA+B,EAAED,GAAAA,CAAI,cAAc,CAAC;wBAC1DE,MAAQ,EAAA;qBACV,CAAA;gBACAC,iBAAmB,EAAA,CAACC,QAAoDA,GAAAA,QAAAA,CAASC,IAAI;gBACrFC,YAAc,EAAA,CAACC,OAASC,EAAAA,MAAAA,EAAQR,GAAQ,GAAA;AACtC,wBAAA;4BAAES,IAAM,EAAA,2BAAA;4BAA6BC,EAAIV,EAAAA;AAAI,yBAAA;AAC7C,wBAAA;4BAAES,IAAM,EAAA,qBAAA;4BAAuBC,EAAI,EAAA;AAAO;AAC3C;AACH,aAAA,CAAA;YACAC,yBAA2Bd,EAAAA,OAAAA,CAAQE,KAAK,CAAkD;AACxFA,gBAAAA,KAAAA,EAAO,IAAM,yCAAA;gBACbI,iBAAmB,EAAA,CAACC,QAAgDA,GAAAA,QAAAA,CAASC,IAAI;gBACjFC,YAAc,EAAA;AAAC,oBAAA;wBAAEG,IAAM,EAAA,qBAAA;wBAAuBC,EAAI,EAAA;AAAO;AAAE;AAC7D,aAAA,CAAA;YACAE,8BAAgCf,EAAAA,OAAAA,CAAQgB,QAAQ,CAK9C;AACAd,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,GAAG,EAAE,GAAGc,IAAAA,EAAM,IAAM;AAC5Bb,wBAAAA,GAAAA,EAAK,CAAC,+BAA+B,EAAED,GAAAA,CAAI,cAAc,CAAC;wBAC1DE,MAAQ,EAAA,KAAA;wBACRG,IAAMS,EAAAA;qBACR,CAAA;gBACAX,iBAAmB,EAAA,CAACC,QAAsDA,GAAAA,QAAAA,CAASC,IAAI;AACvFU,gBAAAA,eAAAA,EAAiB,CAACR,OAASC,EAAAA,MAAAA,EAAQ,EAAER,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAES,IAAM,EAAA,2BAAA;4BAA6BC,EAAIV,EAAAA;AAAI,yBAAA;AAC7C,wBAAA;4BAAES,IAAM,EAAA,qBAAA;4BAAuBC,EAAI,EAAA;AAAO,yBAAA;;AAE1C,wBAAA;4BAAED,IAAM,EAAA;AAAc;AACvB;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EACJO,mCAAmC,EACnCC,iCAAiC,EACjCC,yCAAyC,EAC1C,GAAGzB;;;;"}

View File

@@ -0,0 +1,390 @@
'use strict';
var qs = require('qs');
var collections = require('../constants/collections.js');
var api = require('./api.js');
const documentApi = api.contentManagerApi.injectEndpoints({
overrideExisting: true,
endpoints: (builder)=>({
autoCloneDocument: builder.mutation({
query: ({ model, sourceId, query })=>({
url: `/content-manager/collection-types/${model}/auto-clone/${sourceId}`,
method: 'POST',
config: {
params: query
}
}),
invalidatesTags: (_result, error, { model })=>{
if (error) {
return [];
}
return [
{
type: 'Document',
id: `${model}_LIST`
},
'RecentDocumentList'
];
}
}),
cloneDocument: builder.mutation({
query: ({ model, sourceId, data, params })=>({
url: `/content-manager/collection-types/${model}/clone/${sourceId}`,
method: 'POST',
data,
config: {
params
}
}),
invalidatesTags: (_result, _error, { model })=>[
{
type: 'Document',
id: `${model}_LIST`
},
{
type: 'UidAvailability',
id: model
},
'RecentDocumentList'
]
}),
/**
* Creates a new collection-type document. This should ONLY be used for collection-types.
* single-types should always be using `updateDocument` since they always exist.
*/ createDocument: builder.mutation({
query: ({ model, data, params })=>({
url: `/content-manager/collection-types/${model}`,
method: 'POST',
data,
config: {
params
}
}),
invalidatesTags: (result, _error, { model })=>[
{
type: 'Document',
id: `${model}_LIST`
},
'Relations',
{
type: 'UidAvailability',
id: model
},
'RecentDocumentList'
],
transformResponse: (response, meta, arg)=>{
/**
* TODO v6
* Adapt plugin:users-permissions.user to return the same response
* shape as all other requests. The error is returned as expected.
*/ if (!('data' in response) && arg.model === 'plugin::users-permissions.user') {
return {
data: response,
meta: {
availableStatus: [],
availableLocales: []
}
};
}
return response;
}
}),
deleteDocument: builder.mutation({
query: ({ collectionType, model, documentId, params })=>({
url: `/content-manager/${collectionType}/${model}${collectionType !== collections.SINGLE_TYPES && documentId ? `/${documentId}` : ''}`,
method: 'DELETE',
config: {
params
}
}),
invalidatesTags: (_result, _error, { collectionType, model })=>[
{
type: 'Document',
id: collectionType !== collections.SINGLE_TYPES ? `${model}_LIST` : model
},
'RecentDocumentList'
]
}),
deleteManyDocuments: builder.mutation({
query: ({ model, params, ...body })=>({
url: `/content-manager/collection-types/${model}/actions/bulkDelete`,
method: 'POST',
data: body,
config: {
params
}
}),
invalidatesTags: (_res, _error, { model })=>[
{
type: 'Document',
id: `${model}_LIST`
},
'RecentDocumentList'
]
}),
discardDocument: builder.mutation({
query: ({ collectionType, model, documentId, params })=>({
url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/discard` : `/content-manager/${collectionType}/${model}/actions/discard`,
method: 'POST',
config: {
params
}
}),
invalidatesTags: (_result, _error, { collectionType, model, documentId })=>{
return [
{
type: 'Document',
id: collectionType !== collections.SINGLE_TYPES ? `${model}_${documentId}` : model
},
{
type: 'Document',
id: `${model}_LIST`
},
'Relations',
{
type: 'UidAvailability',
id: model
},
'RecentDocumentList'
];
}
}),
/**
* Gets all documents of a collection type or single type.
* By passing different params you can get different results e.g. only published documents or 'es' documents.
*/ getAllDocuments: builder.query({
query: ({ model, params })=>({
url: `/content-manager/collection-types/${model}`,
method: 'GET',
config: {
params: qs.stringify(params, {
encode: true
})
}
}),
providesTags: (result, _error, arg)=>{
return [
{
type: 'Document',
id: `ALL_LIST`
},
{
type: 'Document',
id: `${arg.model}_LIST`
},
...result?.results.map(({ documentId })=>({
type: 'Document',
id: `${arg.model}_${documentId}`
})) ?? []
];
}
}),
getDraftRelationCount: builder.query({
query: ({ collectionType, model, documentId, params })=>({
url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/countDraftRelations` : `/content-manager/${collectionType}/${model}/actions/countDraftRelations`,
method: 'GET',
config: {
params
}
})
}),
getDocument: builder.query({
// @ts-expect-error TODO: fix ts error where data unknown doesn't work with response via an assertion?
queryFn: async ({ collectionType, model, documentId, params }, _api, _extraOpts, baseQuery)=>{
const res = await baseQuery({
url: `/content-manager/${collectionType}/${model}${documentId ? `/${documentId}` : ''}`,
method: 'GET',
config: {
params
}
});
/**
* To stop the query from locking itself in multiple retries, we intercept the error here and manage correctly.
* This is because single-types don't have a list view and fetching them with the route `/single-types/:model`
* never returns a list, just a single document but this won't exist if you've not made one before.
*/ if (res.error && res.error.name === 'NotFoundError' && collectionType === collections.SINGLE_TYPES) {
return {
data: {
document: undefined
},
error: undefined
};
}
return res;
},
providesTags: (result, _error, { collectionType, model, documentId })=>{
return [
// we prefer the result's id because we don't fetch single-types with an ID.
{
type: 'Document',
id: collectionType !== collections.SINGLE_TYPES ? `${model}_${result && 'documentId' in result ? result.documentId : documentId}` : model
},
// Make it easy to invalidate all individual documents queries for a model
{
type: 'Document',
id: `${model}_ALL_ITEMS`
}
];
}
}),
getManyDraftRelationCount: builder.query({
query: ({ model, ...params })=>({
url: `/content-manager/collection-types/${model}/actions/countManyEntriesDraftRelations`,
method: 'GET',
config: {
params
}
}),
transformResponse: (response)=>response.data
}),
/**
* This endpoint will either create or update documents at the same time as publishing.
*/ publishDocument: builder.mutation({
query: ({ collectionType, model, documentId, params, data })=>({
url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/publish` : `/content-manager/${collectionType}/${model}/actions/publish`,
method: 'POST',
data,
config: {
params
}
}),
invalidatesTags: (_result, _error, { collectionType, model, documentId })=>{
return [
{
type: 'Document',
id: collectionType !== collections.SINGLE_TYPES ? `${model}_${documentId}` : model
},
{
type: 'Document',
id: `${model}_LIST`
},
'Relations',
'RecentDocumentList'
];
}
}),
publishManyDocuments: builder.mutation({
query: ({ model, params, ...body })=>({
url: `/content-manager/collection-types/${model}/actions/bulkPublish`,
method: 'POST',
data: body,
config: {
params
}
}),
invalidatesTags: (_res, _error, { model, documentIds })=>documentIds.map((id)=>({
type: 'Document',
id: `${model}_${id}`
}))
}),
updateDocument: builder.mutation({
query: ({ collectionType, model, documentId, data, params })=>({
url: `/content-manager/${collectionType}/${model}${documentId ? `/${documentId}` : ''}`,
method: 'PUT',
data,
config: {
params
}
}),
invalidatesTags: (_result, _error, { collectionType, model, documentId })=>{
return [
{
type: 'Document',
id: collectionType !== collections.SINGLE_TYPES ? `${model}_${documentId}` : model
},
'Relations',
{
type: 'UidAvailability',
id: model
},
'RecentDocumentList',
'RecentDocumentList'
];
},
async onQueryStarted ({ data, ...patch }, { dispatch, queryFulfilled }) {
// Optimistically update the cache with the new data
const patchResult = dispatch(documentApi.util.updateQueryData('getDocument', patch, (draft)=>{
Object.assign(draft.data, data);
}));
try {
await queryFulfilled;
} catch {
// Rollback the optimistic update if there's an error
patchResult.undo();
}
},
transformResponse: (response, meta, arg)=>{
/**
* TODO v6
* Adapt plugin:users-permissions.user to return the same response
* shape as all other requests. The error is returned as expected.
*/ if (!('data' in response) && arg.model === 'plugin::users-permissions.user') {
return {
data: response,
meta: {
availableStatus: [],
availableLocales: []
}
};
}
return response;
}
}),
unpublishDocument: builder.mutation({
query: ({ collectionType, model, documentId, params, data })=>({
url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/unpublish` : `/content-manager/${collectionType}/${model}/actions/unpublish`,
method: 'POST',
data,
config: {
params
}
}),
invalidatesTags: (_result, _error, { collectionType, model, documentId })=>{
return [
{
type: 'Document',
id: collectionType !== collections.SINGLE_TYPES ? `${model}_${documentId}` : model
},
'RecentDocumentList'
];
}
}),
unpublishManyDocuments: builder.mutation({
query: ({ model, params, ...body })=>({
url: `/content-manager/collection-types/${model}/actions/bulkUnpublish`,
method: 'POST',
data: body,
config: {
params
}
}),
invalidatesTags: (_res, _error, { model, documentIds })=>[
...documentIds.map((id)=>({
type: 'Document',
id: `${model}_${id}`
})),
'RecentDocumentList'
]
})
})
});
const { useAutoCloneDocumentMutation, useCloneDocumentMutation, useCreateDocumentMutation, useDeleteDocumentMutation, useDeleteManyDocumentsMutation, useDiscardDocumentMutation, useGetAllDocumentsQuery, useLazyGetDocumentQuery, useGetDocumentQuery, useLazyGetDraftRelationCountQuery, useGetManyDraftRelationCountQuery, usePublishDocumentMutation, usePublishManyDocumentsMutation, useUpdateDocumentMutation, useUnpublishDocumentMutation, useUnpublishManyDocumentsMutation } = documentApi;
exports.useAutoCloneDocumentMutation = useAutoCloneDocumentMutation;
exports.useCloneDocumentMutation = useCloneDocumentMutation;
exports.useCreateDocumentMutation = useCreateDocumentMutation;
exports.useDeleteDocumentMutation = useDeleteDocumentMutation;
exports.useDeleteManyDocumentsMutation = useDeleteManyDocumentsMutation;
exports.useDiscardDocumentMutation = useDiscardDocumentMutation;
exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
exports.useGetDocumentQuery = useGetDocumentQuery;
exports.useGetDraftRelationCountQuery = useLazyGetDraftRelationCountQuery;
exports.useGetManyDraftRelationCountQuery = useGetManyDraftRelationCountQuery;
exports.useLazyGetDocumentQuery = useLazyGetDocumentQuery;
exports.usePublishDocumentMutation = usePublishDocumentMutation;
exports.usePublishManyDocumentsMutation = usePublishManyDocumentsMutation;
exports.useUnpublishDocumentMutation = useUnpublishDocumentMutation;
exports.useUnpublishManyDocumentsMutation = useUnpublishManyDocumentsMutation;
exports.useUpdateDocumentMutation = useUpdateDocumentMutation;
//# sourceMappingURL=documents.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,373 @@
import { stringify } from 'qs';
import { SINGLE_TYPES } from '../constants/collections.mjs';
import { contentManagerApi } from './api.mjs';
const documentApi = contentManagerApi.injectEndpoints({
overrideExisting: true,
endpoints: (builder)=>({
autoCloneDocument: builder.mutation({
query: ({ model, sourceId, query })=>({
url: `/content-manager/collection-types/${model}/auto-clone/${sourceId}`,
method: 'POST',
config: {
params: query
}
}),
invalidatesTags: (_result, error, { model })=>{
if (error) {
return [];
}
return [
{
type: 'Document',
id: `${model}_LIST`
},
'RecentDocumentList'
];
}
}),
cloneDocument: builder.mutation({
query: ({ model, sourceId, data, params })=>({
url: `/content-manager/collection-types/${model}/clone/${sourceId}`,
method: 'POST',
data,
config: {
params
}
}),
invalidatesTags: (_result, _error, { model })=>[
{
type: 'Document',
id: `${model}_LIST`
},
{
type: 'UidAvailability',
id: model
},
'RecentDocumentList'
]
}),
/**
* Creates a new collection-type document. This should ONLY be used for collection-types.
* single-types should always be using `updateDocument` since they always exist.
*/ createDocument: builder.mutation({
query: ({ model, data, params })=>({
url: `/content-manager/collection-types/${model}`,
method: 'POST',
data,
config: {
params
}
}),
invalidatesTags: (result, _error, { model })=>[
{
type: 'Document',
id: `${model}_LIST`
},
'Relations',
{
type: 'UidAvailability',
id: model
},
'RecentDocumentList'
],
transformResponse: (response, meta, arg)=>{
/**
* TODO v6
* Adapt plugin:users-permissions.user to return the same response
* shape as all other requests. The error is returned as expected.
*/ if (!('data' in response) && arg.model === 'plugin::users-permissions.user') {
return {
data: response,
meta: {
availableStatus: [],
availableLocales: []
}
};
}
return response;
}
}),
deleteDocument: builder.mutation({
query: ({ collectionType, model, documentId, params })=>({
url: `/content-manager/${collectionType}/${model}${collectionType !== SINGLE_TYPES && documentId ? `/${documentId}` : ''}`,
method: 'DELETE',
config: {
params
}
}),
invalidatesTags: (_result, _error, { collectionType, model })=>[
{
type: 'Document',
id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model
},
'RecentDocumentList'
]
}),
deleteManyDocuments: builder.mutation({
query: ({ model, params, ...body })=>({
url: `/content-manager/collection-types/${model}/actions/bulkDelete`,
method: 'POST',
data: body,
config: {
params
}
}),
invalidatesTags: (_res, _error, { model })=>[
{
type: 'Document',
id: `${model}_LIST`
},
'RecentDocumentList'
]
}),
discardDocument: builder.mutation({
query: ({ collectionType, model, documentId, params })=>({
url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/discard` : `/content-manager/${collectionType}/${model}/actions/discard`,
method: 'POST',
config: {
params
}
}),
invalidatesTags: (_result, _error, { collectionType, model, documentId })=>{
return [
{
type: 'Document',
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
},
{
type: 'Document',
id: `${model}_LIST`
},
'Relations',
{
type: 'UidAvailability',
id: model
},
'RecentDocumentList'
];
}
}),
/**
* Gets all documents of a collection type or single type.
* By passing different params you can get different results e.g. only published documents or 'es' documents.
*/ getAllDocuments: builder.query({
query: ({ model, params })=>({
url: `/content-manager/collection-types/${model}`,
method: 'GET',
config: {
params: stringify(params, {
encode: true
})
}
}),
providesTags: (result, _error, arg)=>{
return [
{
type: 'Document',
id: `ALL_LIST`
},
{
type: 'Document',
id: `${arg.model}_LIST`
},
...result?.results.map(({ documentId })=>({
type: 'Document',
id: `${arg.model}_${documentId}`
})) ?? []
];
}
}),
getDraftRelationCount: builder.query({
query: ({ collectionType, model, documentId, params })=>({
url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/countDraftRelations` : `/content-manager/${collectionType}/${model}/actions/countDraftRelations`,
method: 'GET',
config: {
params
}
})
}),
getDocument: builder.query({
// @ts-expect-error TODO: fix ts error where data unknown doesn't work with response via an assertion?
queryFn: async ({ collectionType, model, documentId, params }, _api, _extraOpts, baseQuery)=>{
const res = await baseQuery({
url: `/content-manager/${collectionType}/${model}${documentId ? `/${documentId}` : ''}`,
method: 'GET',
config: {
params
}
});
/**
* To stop the query from locking itself in multiple retries, we intercept the error here and manage correctly.
* This is because single-types don't have a list view and fetching them with the route `/single-types/:model`
* never returns a list, just a single document but this won't exist if you've not made one before.
*/ if (res.error && res.error.name === 'NotFoundError' && collectionType === SINGLE_TYPES) {
return {
data: {
document: undefined
},
error: undefined
};
}
return res;
},
providesTags: (result, _error, { collectionType, model, documentId })=>{
return [
// we prefer the result's id because we don't fetch single-types with an ID.
{
type: 'Document',
id: collectionType !== SINGLE_TYPES ? `${model}_${result && 'documentId' in result ? result.documentId : documentId}` : model
},
// Make it easy to invalidate all individual documents queries for a model
{
type: 'Document',
id: `${model}_ALL_ITEMS`
}
];
}
}),
getManyDraftRelationCount: builder.query({
query: ({ model, ...params })=>({
url: `/content-manager/collection-types/${model}/actions/countManyEntriesDraftRelations`,
method: 'GET',
config: {
params
}
}),
transformResponse: (response)=>response.data
}),
/**
* This endpoint will either create or update documents at the same time as publishing.
*/ publishDocument: builder.mutation({
query: ({ collectionType, model, documentId, params, data })=>({
url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/publish` : `/content-manager/${collectionType}/${model}/actions/publish`,
method: 'POST',
data,
config: {
params
}
}),
invalidatesTags: (_result, _error, { collectionType, model, documentId })=>{
return [
{
type: 'Document',
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
},
{
type: 'Document',
id: `${model}_LIST`
},
'Relations',
'RecentDocumentList'
];
}
}),
publishManyDocuments: builder.mutation({
query: ({ model, params, ...body })=>({
url: `/content-manager/collection-types/${model}/actions/bulkPublish`,
method: 'POST',
data: body,
config: {
params
}
}),
invalidatesTags: (_res, _error, { model, documentIds })=>documentIds.map((id)=>({
type: 'Document',
id: `${model}_${id}`
}))
}),
updateDocument: builder.mutation({
query: ({ collectionType, model, documentId, data, params })=>({
url: `/content-manager/${collectionType}/${model}${documentId ? `/${documentId}` : ''}`,
method: 'PUT',
data,
config: {
params
}
}),
invalidatesTags: (_result, _error, { collectionType, model, documentId })=>{
return [
{
type: 'Document',
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
},
'Relations',
{
type: 'UidAvailability',
id: model
},
'RecentDocumentList',
'RecentDocumentList'
];
},
async onQueryStarted ({ data, ...patch }, { dispatch, queryFulfilled }) {
// Optimistically update the cache with the new data
const patchResult = dispatch(documentApi.util.updateQueryData('getDocument', patch, (draft)=>{
Object.assign(draft.data, data);
}));
try {
await queryFulfilled;
} catch {
// Rollback the optimistic update if there's an error
patchResult.undo();
}
},
transformResponse: (response, meta, arg)=>{
/**
* TODO v6
* Adapt plugin:users-permissions.user to return the same response
* shape as all other requests. The error is returned as expected.
*/ if (!('data' in response) && arg.model === 'plugin::users-permissions.user') {
return {
data: response,
meta: {
availableStatus: [],
availableLocales: []
}
};
}
return response;
}
}),
unpublishDocument: builder.mutation({
query: ({ collectionType, model, documentId, params, data })=>({
url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/unpublish` : `/content-manager/${collectionType}/${model}/actions/unpublish`,
method: 'POST',
data,
config: {
params
}
}),
invalidatesTags: (_result, _error, { collectionType, model, documentId })=>{
return [
{
type: 'Document',
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
},
'RecentDocumentList'
];
}
}),
unpublishManyDocuments: builder.mutation({
query: ({ model, params, ...body })=>({
url: `/content-manager/collection-types/${model}/actions/bulkUnpublish`,
method: 'POST',
data: body,
config: {
params
}
}),
invalidatesTags: (_res, _error, { model, documentIds })=>[
...documentIds.map((id)=>({
type: 'Document',
id: `${model}_${id}`
})),
'RecentDocumentList'
]
})
})
});
const { useAutoCloneDocumentMutation, useCloneDocumentMutation, useCreateDocumentMutation, useDeleteDocumentMutation, useDeleteManyDocumentsMutation, useDiscardDocumentMutation, useGetAllDocumentsQuery, useLazyGetDocumentQuery, useGetDocumentQuery, useLazyGetDraftRelationCountQuery, useGetManyDraftRelationCountQuery, usePublishDocumentMutation, usePublishManyDocumentsMutation, useUpdateDocumentMutation, useUnpublishDocumentMutation, useUnpublishManyDocumentsMutation } = documentApi;
export { useAutoCloneDocumentMutation, useCloneDocumentMutation, useCreateDocumentMutation, useDeleteDocumentMutation, useDeleteManyDocumentsMutation, useDiscardDocumentMutation, useGetAllDocumentsQuery, useGetDocumentQuery, useLazyGetDraftRelationCountQuery as useGetDraftRelationCountQuery, useGetManyDraftRelationCountQuery, useLazyGetDocumentQuery, usePublishDocumentMutation, usePublishManyDocumentsMutation, useUnpublishDocumentMutation, useUnpublishManyDocumentsMutation, useUpdateDocumentMutation };
//# sourceMappingURL=documents.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,30 @@
'use strict';
var api = require('./api.js');
const homepageService = api.contentManagerApi.enhanceEndpoints({
addTagTypes: [
'RecentDocumentList'
]
}).injectEndpoints({
/**
* TODO: Remove overrideExisting when we remove the future flag
* and delete the old homepage service in the admin
*/ overrideExisting: true,
endpoints: (builder)=>({
getRecentDocuments: builder.query({
query: (params)=>`/content-manager/homepage/recent-documents?action=${params.action}`,
transformResponse: (response)=>response.data,
providesTags: (res, _err, { action })=>[
{
type: 'RecentDocumentList',
id: action
}
]
})
})
});
const { useGetRecentDocumentsQuery } = homepageService;
exports.useGetRecentDocumentsQuery = useGetRecentDocumentsQuery;
//# sourceMappingURL=homepage.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"homepage.js","sources":["../../../admin/src/services/homepage.ts"],"sourcesContent":["import * as Homepage from '../../../shared/contracts/homepage';\n\nimport { contentManagerApi } from './api';\n\nconst homepageService = contentManagerApi\n .enhanceEndpoints({\n addTagTypes: ['RecentDocumentList'],\n })\n .injectEndpoints({\n /**\n * TODO: Remove overrideExisting when we remove the future flag\n * and delete the old homepage service in the admin\n */\n overrideExisting: true,\n endpoints: (builder) => ({\n getRecentDocuments: builder.query<\n Homepage.GetRecentDocuments.Response['data'],\n Homepage.GetRecentDocuments.Request['query']\n >({\n query: (params) => `/content-manager/homepage/recent-documents?action=${params.action}`,\n transformResponse: (response: Homepage.GetRecentDocuments.Response) => response.data,\n providesTags: (res, _err, { action }) => [\n { type: 'RecentDocumentList' as const, id: action },\n ],\n }),\n }),\n });\n\nconst { useGetRecentDocumentsQuery } = homepageService;\n\nexport { useGetRecentDocumentsQuery };\n"],"names":["homepageService","contentManagerApi","enhanceEndpoints","addTagTypes","injectEndpoints","overrideExisting","endpoints","builder","getRecentDocuments","query","params","action","transformResponse","response","data","providesTags","res","_err","type","id","useGetRecentDocumentsQuery"],"mappings":";;;;AAIA,MAAMA,eAAAA,GAAkBC,qBACrBC,CAAAA,gBAAgB,CAAC;IAChBC,WAAa,EAAA;AAAC,QAAA;AAAqB;AACrC,CAAA,CAAA,CACCC,eAAe,CAAC;AACf;;;AAGC,QACDC,gBAAkB,EAAA,IAAA;IAClBC,SAAW,EAAA,CAACC,WAAa;YACvBC,kBAAoBD,EAAAA,OAAAA,CAAQE,KAAK,CAG/B;gBACAA,KAAO,EAAA,CAACC,SAAW,CAAC,kDAAkD,EAAEA,MAAOC,CAAAA,MAAM,CAAC,CAAC;gBACvFC,iBAAmB,EAAA,CAACC,QAAmDA,GAAAA,QAAAA,CAASC,IAAI;AACpFC,gBAAAA,YAAAA,EAAc,CAACC,GAAKC,EAAAA,IAAAA,EAAM,EAAEN,MAAM,EAAE,GAAK;AACvC,wBAAA;4BAAEO,IAAM,EAAA,oBAAA;4BAA+BC,EAAIR,EAAAA;AAAO;AACnD;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEI,MAAA,EAAES,0BAA0B,EAAE,GAAGpB;;;;"}

View File

@@ -0,0 +1,28 @@
import { contentManagerApi } from './api.mjs';
const homepageService = contentManagerApi.enhanceEndpoints({
addTagTypes: [
'RecentDocumentList'
]
}).injectEndpoints({
/**
* TODO: Remove overrideExisting when we remove the future flag
* and delete the old homepage service in the admin
*/ overrideExisting: true,
endpoints: (builder)=>({
getRecentDocuments: builder.query({
query: (params)=>`/content-manager/homepage/recent-documents?action=${params.action}`,
transformResponse: (response)=>response.data,
providesTags: (res, _err, { action })=>[
{
type: 'RecentDocumentList',
id: action
}
]
})
})
});
const { useGetRecentDocumentsQuery } = homepageService;
export { useGetRecentDocumentsQuery };
//# sourceMappingURL=homepage.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"homepage.mjs","sources":["../../../admin/src/services/homepage.ts"],"sourcesContent":["import * as Homepage from '../../../shared/contracts/homepage';\n\nimport { contentManagerApi } from './api';\n\nconst homepageService = contentManagerApi\n .enhanceEndpoints({\n addTagTypes: ['RecentDocumentList'],\n })\n .injectEndpoints({\n /**\n * TODO: Remove overrideExisting when we remove the future flag\n * and delete the old homepage service in the admin\n */\n overrideExisting: true,\n endpoints: (builder) => ({\n getRecentDocuments: builder.query<\n Homepage.GetRecentDocuments.Response['data'],\n Homepage.GetRecentDocuments.Request['query']\n >({\n query: (params) => `/content-manager/homepage/recent-documents?action=${params.action}`,\n transformResponse: (response: Homepage.GetRecentDocuments.Response) => response.data,\n providesTags: (res, _err, { action }) => [\n { type: 'RecentDocumentList' as const, id: action },\n ],\n }),\n }),\n });\n\nconst { useGetRecentDocumentsQuery } = homepageService;\n\nexport { useGetRecentDocumentsQuery };\n"],"names":["homepageService","contentManagerApi","enhanceEndpoints","addTagTypes","injectEndpoints","overrideExisting","endpoints","builder","getRecentDocuments","query","params","action","transformResponse","response","data","providesTags","res","_err","type","id","useGetRecentDocumentsQuery"],"mappings":";;AAIA,MAAMA,eAAAA,GAAkBC,iBACrBC,CAAAA,gBAAgB,CAAC;IAChBC,WAAa,EAAA;AAAC,QAAA;AAAqB;AACrC,CAAA,CAAA,CACCC,eAAe,CAAC;AACf;;;AAGC,QACDC,gBAAkB,EAAA,IAAA;IAClBC,SAAW,EAAA,CAACC,WAAa;YACvBC,kBAAoBD,EAAAA,OAAAA,CAAQE,KAAK,CAG/B;gBACAA,KAAO,EAAA,CAACC,SAAW,CAAC,kDAAkD,EAAEA,MAAOC,CAAAA,MAAM,CAAC,CAAC;gBACvFC,iBAAmB,EAAA,CAACC,QAAmDA,GAAAA,QAAAA,CAASC,IAAI;AACpFC,gBAAAA,YAAAA,EAAc,CAACC,GAAKC,EAAAA,IAAAA,EAAM,EAAEN,MAAM,EAAE,GAAK;AACvC,wBAAA;4BAAEO,IAAM,EAAA,oBAAA;4BAA+BC,EAAIR,EAAAA;AAAO;AACnD;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEI,MAAA,EAAES,0BAA0B,EAAE,GAAGpB;;;;"}

View File

@@ -0,0 +1,19 @@
'use strict';
var api = require('./api.js');
const initApi = api.contentManagerApi.injectEndpoints({
endpoints: (builder)=>({
getInitialData: builder.query({
query: ()=>'/content-manager/init',
transformResponse: (response)=>response.data,
providesTags: [
'InitialData'
]
})
})
});
const { useGetInitialDataQuery } = initApi;
exports.useGetInitialDataQuery = useGetInitialDataQuery;
//# sourceMappingURL=init.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"init.js","sources":["../../../admin/src/services/init.ts"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type { GetInitData } from '../../../shared/contracts/init';\n\nconst initApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getInitialData: builder.query<GetInitData.Response['data'], void>({\n query: () => '/content-manager/init',\n transformResponse: (response: GetInitData.Response) => response.data,\n providesTags: ['InitialData'],\n }),\n }),\n});\n\nconst { useGetInitialDataQuery } = initApi;\n\nexport { useGetInitialDataQuery };\n"],"names":["initApi","contentManagerApi","injectEndpoints","endpoints","builder","getInitialData","query","transformResponse","response","data","providesTags","useGetInitialDataQuery"],"mappings":";;;;AAIA,MAAMA,OAAAA,GAAUC,qBAAkBC,CAAAA,eAAe,CAAC;IAChDC,SAAW,EAAA,CAACC,WAAa;YACvBC,cAAgBD,EAAAA,OAAAA,CAAQE,KAAK,CAAqC;AAChEA,gBAAAA,KAAAA,EAAO,IAAM,uBAAA;gBACbC,iBAAmB,EAAA,CAACC,QAAmCA,GAAAA,QAAAA,CAASC,IAAI;gBACpEC,YAAc,EAAA;AAAC,oBAAA;AAAc;AAC/B,aAAA;SACF;AACF,CAAA,CAAA;AAEM,MAAA,EAAEC,sBAAsB,EAAE,GAAGX;;;;"}

View File

@@ -0,0 +1,17 @@
import { contentManagerApi } from './api.mjs';
const initApi = contentManagerApi.injectEndpoints({
endpoints: (builder)=>({
getInitialData: builder.query({
query: ()=>'/content-manager/init',
transformResponse: (response)=>response.data,
providesTags: [
'InitialData'
]
})
})
});
const { useGetInitialDataQuery } = initApi;
export { useGetInitialDataQuery };
//# sourceMappingURL=init.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"init.mjs","sources":["../../../admin/src/services/init.ts"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type { GetInitData } from '../../../shared/contracts/init';\n\nconst initApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getInitialData: builder.query<GetInitData.Response['data'], void>({\n query: () => '/content-manager/init',\n transformResponse: (response: GetInitData.Response) => response.data,\n providesTags: ['InitialData'],\n }),\n }),\n});\n\nconst { useGetInitialDataQuery } = initApi;\n\nexport { useGetInitialDataQuery };\n"],"names":["initApi","contentManagerApi","injectEndpoints","endpoints","builder","getInitialData","query","transformResponse","response","data","providesTags","useGetInitialDataQuery"],"mappings":";;AAIA,MAAMA,OAAAA,GAAUC,iBAAkBC,CAAAA,eAAe,CAAC;IAChDC,SAAW,EAAA,CAACC,WAAa;YACvBC,cAAgBD,EAAAA,OAAAA,CAAQE,KAAK,CAAqC;AAChEA,gBAAAA,KAAAA,EAAO,IAAM,uBAAA;gBACbC,iBAAmB,EAAA,CAACC,QAAmCA,GAAAA,QAAAA,CAASC,IAAI;gBACpEC,YAAc,EAAA;AAAC,oBAAA;AAAc;AAC/B,aAAA;SACF;AACF,CAAA,CAAA;AAEM,MAAA,EAAEC,sBAAsB,EAAE,GAAGX;;;;"}

View File

@@ -0,0 +1,144 @@
'use strict';
var fractionalIndexing = require('fractional-indexing');
var api = require('./api.js');
const relationsApi = api.contentManagerApi.injectEndpoints({
endpoints: (build)=>({
getRelations: build.query({
query: ({ model, id, targetField, params })=>{
return {
url: `/content-manager/relations/${model}/${id}/${targetField}`,
method: 'GET',
config: {
params
}
};
},
serializeQueryArgs: (args)=>{
const { endpointName, queryArgs } = args;
return {
endpointName,
model: queryArgs.model,
id: queryArgs.id,
targetField: queryArgs.targetField,
locale: queryArgs.params?.locale,
status: queryArgs.params?.status
};
},
merge: (currentCache, newItems)=>{
if (currentCache.pagination && newItems.pagination) {
if (currentCache.pagination.page < newItems.pagination.page) {
/**
* Relations will always have unique IDs, so we can therefore assume
* that we only need to push the new items to the cache.
*
* Push new items at the beginning as latest items are shown first
*/ currentCache.results = [
...prepareTempKeys(newItems.results, currentCache.results),
...currentCache.results
];
currentCache.pagination = newItems.pagination;
} else if (newItems.pagination.page === 1) {
/**
* We're resetting the relations
*/ currentCache.results = prepareTempKeys(newItems.results);
currentCache.pagination = newItems.pagination;
}
}
},
forceRefetch ({ currentArg, previousArg }) {
if (!currentArg?.params && !previousArg?.params) {
return false;
}
return currentArg?.params?.page !== previousArg?.params?.page || currentArg?.params?.pageSize !== previousArg?.params?.pageSize;
},
transformResponse: (response)=>{
if ('results' in response && response.results) {
return {
...response,
results: prepareTempKeys(response.results.toReversed())
};
} else {
return response;
}
},
providesTags: [
'Relations'
]
}),
searchRelations: build.query({
query: ({ model, targetField, params })=>{
return {
url: `/content-manager/relations/${model}/${targetField}`,
method: 'GET',
config: {
params
}
};
},
serializeQueryArgs: (args)=>{
const { endpointName, queryArgs } = args;
return {
endpointName,
model: queryArgs.model,
targetField: queryArgs.targetField,
_q: queryArgs.params?._q,
idsToOmit: queryArgs.params?.idsToOmit,
idsToInclude: queryArgs.params?.idsToInclude
};
},
merge: (currentCache, newItems)=>{
if (currentCache.pagination && newItems.pagination) {
if (currentCache.pagination.page < newItems.pagination.page) {
/**
* Relations will always have unique IDs, so we can therefore assume
* that we only need to push the new items to the cache.
*/ const existingIds = currentCache.results.map((item)=>item.documentId);
const uniqueNewItems = newItems.results.filter((item)=>!existingIds.includes(item.documentId));
currentCache.results.push(...uniqueNewItems);
currentCache.pagination = newItems.pagination;
} else if (newItems.pagination.page === 1) {
/**
* We're resetting the relations
*/ currentCache.results = newItems.results;
currentCache.pagination = newItems.pagination;
}
}
},
forceRefetch ({ currentArg, previousArg }) {
if (!currentArg?.params && !previousArg?.params) {
return false;
}
return currentArg?.params?.page !== previousArg?.params?.page || currentArg?.params?.pageSize !== previousArg?.params?.pageSize;
},
transformResponse: (response)=>{
if (response.results) {
return {
...response,
results: response.results
};
} else {
return response;
}
}
})
})
});
/**
* @internal
* @description Adds a `__temp_key__` to each relation item. This gives us
* a stable identifier regardless of it's ids etc. that we can then use for drag and drop.
*/ const prepareTempKeys = (relations, existingRelations = [])=>{
const [firstItem] = existingRelations.slice(0);
const keys = fractionalIndexing.generateNKeysBetween(null, firstItem?.__temp_key__ ?? null, relations.length);
return relations.map((datum, index)=>({
...datum,
__temp_key__: keys[index]
}));
};
const { useGetRelationsQuery, useLazySearchRelationsQuery } = relationsApi;
exports.useGetRelationsQuery = useGetRelationsQuery;
exports.useLazySearchRelationsQuery = useLazySearchRelationsQuery;
//# sourceMappingURL=relations.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,141 @@
import { generateNKeysBetween } from 'fractional-indexing';
import { contentManagerApi } from './api.mjs';
const relationsApi = contentManagerApi.injectEndpoints({
endpoints: (build)=>({
getRelations: build.query({
query: ({ model, id, targetField, params })=>{
return {
url: `/content-manager/relations/${model}/${id}/${targetField}`,
method: 'GET',
config: {
params
}
};
},
serializeQueryArgs: (args)=>{
const { endpointName, queryArgs } = args;
return {
endpointName,
model: queryArgs.model,
id: queryArgs.id,
targetField: queryArgs.targetField,
locale: queryArgs.params?.locale,
status: queryArgs.params?.status
};
},
merge: (currentCache, newItems)=>{
if (currentCache.pagination && newItems.pagination) {
if (currentCache.pagination.page < newItems.pagination.page) {
/**
* Relations will always have unique IDs, so we can therefore assume
* that we only need to push the new items to the cache.
*
* Push new items at the beginning as latest items are shown first
*/ currentCache.results = [
...prepareTempKeys(newItems.results, currentCache.results),
...currentCache.results
];
currentCache.pagination = newItems.pagination;
} else if (newItems.pagination.page === 1) {
/**
* We're resetting the relations
*/ currentCache.results = prepareTempKeys(newItems.results);
currentCache.pagination = newItems.pagination;
}
}
},
forceRefetch ({ currentArg, previousArg }) {
if (!currentArg?.params && !previousArg?.params) {
return false;
}
return currentArg?.params?.page !== previousArg?.params?.page || currentArg?.params?.pageSize !== previousArg?.params?.pageSize;
},
transformResponse: (response)=>{
if ('results' in response && response.results) {
return {
...response,
results: prepareTempKeys(response.results.toReversed())
};
} else {
return response;
}
},
providesTags: [
'Relations'
]
}),
searchRelations: build.query({
query: ({ model, targetField, params })=>{
return {
url: `/content-manager/relations/${model}/${targetField}`,
method: 'GET',
config: {
params
}
};
},
serializeQueryArgs: (args)=>{
const { endpointName, queryArgs } = args;
return {
endpointName,
model: queryArgs.model,
targetField: queryArgs.targetField,
_q: queryArgs.params?._q,
idsToOmit: queryArgs.params?.idsToOmit,
idsToInclude: queryArgs.params?.idsToInclude
};
},
merge: (currentCache, newItems)=>{
if (currentCache.pagination && newItems.pagination) {
if (currentCache.pagination.page < newItems.pagination.page) {
/**
* Relations will always have unique IDs, so we can therefore assume
* that we only need to push the new items to the cache.
*/ const existingIds = currentCache.results.map((item)=>item.documentId);
const uniqueNewItems = newItems.results.filter((item)=>!existingIds.includes(item.documentId));
currentCache.results.push(...uniqueNewItems);
currentCache.pagination = newItems.pagination;
} else if (newItems.pagination.page === 1) {
/**
* We're resetting the relations
*/ currentCache.results = newItems.results;
currentCache.pagination = newItems.pagination;
}
}
},
forceRefetch ({ currentArg, previousArg }) {
if (!currentArg?.params && !previousArg?.params) {
return false;
}
return currentArg?.params?.page !== previousArg?.params?.page || currentArg?.params?.pageSize !== previousArg?.params?.pageSize;
},
transformResponse: (response)=>{
if (response.results) {
return {
...response,
results: response.results
};
} else {
return response;
}
}
})
})
});
/**
* @internal
* @description Adds a `__temp_key__` to each relation item. This gives us
* a stable identifier regardless of it's ids etc. that we can then use for drag and drop.
*/ const prepareTempKeys = (relations, existingRelations = [])=>{
const [firstItem] = existingRelations.slice(0);
const keys = generateNKeysBetween(null, firstItem?.__temp_key__ ?? null, relations.length);
return relations.map((datum, index)=>({
...datum,
__temp_key__: keys[index]
}));
};
const { useGetRelationsQuery, useLazySearchRelationsQuery } = relationsApi;
export { useGetRelationsQuery, useLazySearchRelationsQuery };
//# sourceMappingURL=relations.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,54 @@
'use strict';
var api = require('./api.js');
const uidApi = api.contentManagerApi.injectEndpoints({
endpoints: (builder)=>({
getDefaultUID: builder.query({
query: ({ params, ...data })=>{
return {
url: '/content-manager/uid/generate',
method: 'POST',
data,
config: {
params
}
};
},
transformResponse: (response)=>response.data
}),
generateUID: builder.mutation({
query: ({ params, ...data })=>({
url: '/content-manager/uid/generate',
method: 'POST',
data,
config: {
params
}
}),
transformResponse: (response)=>response.data
}),
getAvailability: builder.query({
query: ({ params, ...data })=>({
url: '/content-manager/uid/check-availability',
method: 'POST',
data,
config: {
params
}
}),
providesTags: (_res, _error, params)=>[
{
type: 'UidAvailability',
id: params.contentTypeUID
}
]
})
})
});
const { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;
exports.useGenerateUIDMutation = useGenerateUIDMutation;
exports.useGetAvailabilityQuery = useGetAvailabilityQuery;
exports.useGetDefaultUIDQuery = useGetDefaultUIDQuery;
//# sourceMappingURL=uid.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"uid.js","sources":["../../../admin/src/services/uid.ts"],"sourcesContent":["/**\n * Related to the InputUID component, not the UIDs of content-types.\n */\n\nimport { GenerateUID, CheckUIDAvailability } from '../../../shared/contracts/uid';\n\nimport { contentManagerApi } from './api';\n\nconst uidApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getDefaultUID: builder.query<\n GenerateUID.Response['data'],\n GenerateUID.Request['body'] & {\n params: GenerateUID.Request['query'];\n }\n >({\n query: ({ params, ...data }) => {\n return {\n url: '/content-manager/uid/generate',\n method: 'POST',\n data,\n config: {\n params,\n },\n };\n },\n transformResponse: (response: GenerateUID.Response) => response.data,\n }),\n generateUID: builder.mutation<\n GenerateUID.Response['data'],\n GenerateUID.Request['body'] & {\n params: GenerateUID.Request['query'];\n }\n >({\n query: ({ params, ...data }) => ({\n url: '/content-manager/uid/generate',\n method: 'POST',\n data,\n config: {\n params,\n },\n }),\n transformResponse: (response: GenerateUID.Response) => response.data,\n }),\n getAvailability: builder.query<\n CheckUIDAvailability.Response,\n CheckUIDAvailability.Request['body'] & {\n params: CheckUIDAvailability.Request['query'];\n }\n >({\n query: ({ params, ...data }) => ({\n url: '/content-manager/uid/check-availability',\n method: 'POST',\n data,\n config: {\n params,\n },\n }),\n providesTags: (_res, _error, params) => [\n { type: 'UidAvailability', id: params.contentTypeUID },\n ],\n }),\n }),\n});\n\nconst { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;\n\nexport { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery };\n"],"names":["uidApi","contentManagerApi","injectEndpoints","endpoints","builder","getDefaultUID","query","params","data","url","method","config","transformResponse","response","generateUID","mutation","getAvailability","providesTags","_res","_error","type","id","contentTypeUID","useGenerateUIDMutation","useGetDefaultUIDQuery","useGetAvailabilityQuery"],"mappings":";;;;AAQA,MAAMA,MAAAA,GAASC,qBAAkBC,CAAAA,eAAe,CAAC;IAC/CC,SAAW,EAAA,CAACC,WAAa;YACvBC,aAAeD,EAAAA,OAAAA,CAAQE,KAAK,CAK1B;AACAA,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,MAAM,EAAE,GAAGC,IAAM,EAAA,GAAA;oBACzB,OAAO;wBACLC,GAAK,EAAA,+BAAA;wBACLC,MAAQ,EAAA,MAAA;AACRF,wBAAAA,IAAAA;wBACAG,MAAQ,EAAA;AACNJ,4BAAAA;AACF;AACF,qBAAA;AACF,iBAAA;gBACAK,iBAAmB,EAAA,CAACC,QAAmCA,GAAAA,QAAAA,CAASL;AAClE,aAAA,CAAA;YACAM,WAAaV,EAAAA,OAAAA,CAAQW,QAAQ,CAK3B;AACAT,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,MAAM,EAAE,GAAGC,IAAAA,EAAM,IAAM;wBAC/BC,GAAK,EAAA,+BAAA;wBACLC,MAAQ,EAAA,MAAA;AACRF,wBAAAA,IAAAA;wBACAG,MAAQ,EAAA;AACNJ,4BAAAA;AACF;qBACF,CAAA;gBACAK,iBAAmB,EAAA,CAACC,QAAmCA,GAAAA,QAAAA,CAASL;AAClE,aAAA,CAAA;YACAQ,eAAiBZ,EAAAA,OAAAA,CAAQE,KAAK,CAK5B;AACAA,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,MAAM,EAAE,GAAGC,IAAAA,EAAM,IAAM;wBAC/BC,GAAK,EAAA,yCAAA;wBACLC,MAAQ,EAAA,MAAA;AACRF,wBAAAA,IAAAA;wBACAG,MAAQ,EAAA;AACNJ,4BAAAA;AACF;qBACF,CAAA;gBACAU,YAAc,EAAA,CAACC,IAAMC,EAAAA,MAAAA,EAAQZ,MAAW,GAAA;AACtC,wBAAA;4BAAEa,IAAM,EAAA,iBAAA;AAAmBC,4BAAAA,EAAAA,EAAId,OAAOe;AAAe;AACtD;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EAAEC,sBAAsB,EAAEC,qBAAqB,EAAEC,uBAAuB,EAAE,GAAGzB;;;;;;"}

View File

@@ -0,0 +1,50 @@
import { contentManagerApi } from './api.mjs';
const uidApi = contentManagerApi.injectEndpoints({
endpoints: (builder)=>({
getDefaultUID: builder.query({
query: ({ params, ...data })=>{
return {
url: '/content-manager/uid/generate',
method: 'POST',
data,
config: {
params
}
};
},
transformResponse: (response)=>response.data
}),
generateUID: builder.mutation({
query: ({ params, ...data })=>({
url: '/content-manager/uid/generate',
method: 'POST',
data,
config: {
params
}
}),
transformResponse: (response)=>response.data
}),
getAvailability: builder.query({
query: ({ params, ...data })=>({
url: '/content-manager/uid/check-availability',
method: 'POST',
data,
config: {
params
}
}),
providesTags: (_res, _error, params)=>[
{
type: 'UidAvailability',
id: params.contentTypeUID
}
]
})
})
});
const { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;
export { useGenerateUIDMutation, useGetAvailabilityQuery, useGetDefaultUIDQuery };
//# sourceMappingURL=uid.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"uid.mjs","sources":["../../../admin/src/services/uid.ts"],"sourcesContent":["/**\n * Related to the InputUID component, not the UIDs of content-types.\n */\n\nimport { GenerateUID, CheckUIDAvailability } from '../../../shared/contracts/uid';\n\nimport { contentManagerApi } from './api';\n\nconst uidApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getDefaultUID: builder.query<\n GenerateUID.Response['data'],\n GenerateUID.Request['body'] & {\n params: GenerateUID.Request['query'];\n }\n >({\n query: ({ params, ...data }) => {\n return {\n url: '/content-manager/uid/generate',\n method: 'POST',\n data,\n config: {\n params,\n },\n };\n },\n transformResponse: (response: GenerateUID.Response) => response.data,\n }),\n generateUID: builder.mutation<\n GenerateUID.Response['data'],\n GenerateUID.Request['body'] & {\n params: GenerateUID.Request['query'];\n }\n >({\n query: ({ params, ...data }) => ({\n url: '/content-manager/uid/generate',\n method: 'POST',\n data,\n config: {\n params,\n },\n }),\n transformResponse: (response: GenerateUID.Response) => response.data,\n }),\n getAvailability: builder.query<\n CheckUIDAvailability.Response,\n CheckUIDAvailability.Request['body'] & {\n params: CheckUIDAvailability.Request['query'];\n }\n >({\n query: ({ params, ...data }) => ({\n url: '/content-manager/uid/check-availability',\n method: 'POST',\n data,\n config: {\n params,\n },\n }),\n providesTags: (_res, _error, params) => [\n { type: 'UidAvailability', id: params.contentTypeUID },\n ],\n }),\n }),\n});\n\nconst { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;\n\nexport { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery };\n"],"names":["uidApi","contentManagerApi","injectEndpoints","endpoints","builder","getDefaultUID","query","params","data","url","method","config","transformResponse","response","generateUID","mutation","getAvailability","providesTags","_res","_error","type","id","contentTypeUID","useGenerateUIDMutation","useGetDefaultUIDQuery","useGetAvailabilityQuery"],"mappings":";;AAQA,MAAMA,MAAAA,GAASC,iBAAkBC,CAAAA,eAAe,CAAC;IAC/CC,SAAW,EAAA,CAACC,WAAa;YACvBC,aAAeD,EAAAA,OAAAA,CAAQE,KAAK,CAK1B;AACAA,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,MAAM,EAAE,GAAGC,IAAM,EAAA,GAAA;oBACzB,OAAO;wBACLC,GAAK,EAAA,+BAAA;wBACLC,MAAQ,EAAA,MAAA;AACRF,wBAAAA,IAAAA;wBACAG,MAAQ,EAAA;AACNJ,4BAAAA;AACF;AACF,qBAAA;AACF,iBAAA;gBACAK,iBAAmB,EAAA,CAACC,QAAmCA,GAAAA,QAAAA,CAASL;AAClE,aAAA,CAAA;YACAM,WAAaV,EAAAA,OAAAA,CAAQW,QAAQ,CAK3B;AACAT,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,MAAM,EAAE,GAAGC,IAAAA,EAAM,IAAM;wBAC/BC,GAAK,EAAA,+BAAA;wBACLC,MAAQ,EAAA,MAAA;AACRF,wBAAAA,IAAAA;wBACAG,MAAQ,EAAA;AACNJ,4BAAAA;AACF;qBACF,CAAA;gBACAK,iBAAmB,EAAA,CAACC,QAAmCA,GAAAA,QAAAA,CAASL;AAClE,aAAA,CAAA;YACAQ,eAAiBZ,EAAAA,OAAAA,CAAQE,KAAK,CAK5B;AACAA,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,MAAM,EAAE,GAAGC,IAAAA,EAAM,IAAM;wBAC/BC,GAAK,EAAA,yCAAA;wBACLC,MAAQ,EAAA,MAAA;AACRF,wBAAAA,IAAAA;wBACAG,MAAQ,EAAA;AACNJ,4BAAAA;AACF;qBACF,CAAA;gBACAU,YAAc,EAAA,CAACC,IAAMC,EAAAA,MAAAA,EAAQZ,MAAW,GAAA;AACtC,wBAAA;4BAAEa,IAAM,EAAA,iBAAA;AAAmBC,4BAAAA,EAAAA,EAAId,OAAOe;AAAe;AACtD;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EAAEC,sBAAsB,EAAEC,qBAAqB,EAAEC,uBAAuB,EAAE,GAAGzB;;;;"}