@stackbit/cms-core 0.8.16-develop.1 → 0.8.16-develop.3
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/dist/.tsbuildinfo +1 -1
- package/dist/content-store.d.ts +18 -0
- package/dist/content-store.d.ts.map +1 -1
- package/dist/content-store.js +77 -3
- package/dist/content-store.js.map +1 -1
- package/dist/types/content-store-documents.d.ts +7 -1
- package/dist/types/content-store-documents.d.ts.map +1 -1
- package/dist/types/content-store-types.d.ts +1 -0
- package/dist/types/content-store-types.d.ts.map +1 -1
- package/dist/utils/csi-to-api-docs-converter.d.ts +22 -0
- package/dist/utils/csi-to-api-docs-converter.d.ts.map +1 -0
- package/dist/utils/csi-to-api-docs-converter.js +44 -0
- package/dist/utils/csi-to-api-docs-converter.js.map +1 -0
- package/package.json +4 -4
- package/src/content-store.ts +123 -4
- package/src/types/content-store-documents.ts +9 -1
- package/src/types/content-store-types.ts +1 -0
- package/src/utils/csi-to-api-docs-converter.ts +75 -0
- package/dist/types/content-store-api-document-fields.d.ts +0 -89
- package/dist/types/content-store-api-document-fields.d.ts.map +0 -1
- package/dist/types/content-store-api-document-fields.js +0 -3
- package/dist/types/content-store-api-document-fields.js.map +0 -1
- package/dist/utils/custom-search-filters.d.ts +0 -12
- package/dist/utils/custom-search-filters.d.ts.map +0 -1
- package/dist/utils/custom-search-filters.js +0 -46
- package/dist/utils/custom-search-filters.js.map +0 -1
- package/dist/utils/store-to-api-v2-docs-converter.d.ts +0 -10
- package/dist/utils/store-to-api-v2-docs-converter.d.ts.map +0 -1
- package/dist/utils/store-to-api-v2-docs-converter.js +0 -338
- package/dist/utils/store-to-api-v2-docs-converter.js.map +0 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapDocumentVersionsToApiDocumentVersions = exports.mapDocumentsToApiObjects = void 0;
|
|
4
|
+
const csi_to_store_docs_converter_1 = require("./csi-to-store-docs-converter");
|
|
5
|
+
const store_to_api_docs_converter_1 = require("./store-to-api-docs-converter");
|
|
6
|
+
function mapDocumentsToApiObjects({ documents, contentSourceData, locale, assetSources, customActionRunStateMap, createConfigDelegate }) {
|
|
7
|
+
const contentStoreDocuments = (0, csi_to_store_docs_converter_1.mapCSIDocumentsToStoreDocuments)({
|
|
8
|
+
csiDocuments: documents,
|
|
9
|
+
contentSourceInstance: contentSourceData.instance,
|
|
10
|
+
modelMap: contentSourceData.modelMap,
|
|
11
|
+
defaultLocaleCode: contentSourceData.defaultLocaleCode,
|
|
12
|
+
createConfigDelegate,
|
|
13
|
+
customActionRunStateMap,
|
|
14
|
+
assetSources
|
|
15
|
+
});
|
|
16
|
+
const apiObjects = (0, store_to_api_docs_converter_1.mapDocumentsToLocalizedApiObjects)({
|
|
17
|
+
documents: contentStoreDocuments,
|
|
18
|
+
locale,
|
|
19
|
+
delegate: createConfigDelegate()
|
|
20
|
+
});
|
|
21
|
+
return apiObjects;
|
|
22
|
+
}
|
|
23
|
+
exports.mapDocumentsToApiObjects = mapDocumentsToApiObjects;
|
|
24
|
+
function mapDocumentVersionsToApiDocumentVersions({ versions, contentSourceData, locale, assetSources, customActionRunStateMap, createConfigDelegate }) {
|
|
25
|
+
return versions.map((version) => {
|
|
26
|
+
if (!version.document) {
|
|
27
|
+
return version;
|
|
28
|
+
}
|
|
29
|
+
const [object] = mapDocumentsToApiObjects({
|
|
30
|
+
documents: [version.document],
|
|
31
|
+
contentSourceData,
|
|
32
|
+
locale,
|
|
33
|
+
assetSources,
|
|
34
|
+
customActionRunStateMap,
|
|
35
|
+
createConfigDelegate
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
...version,
|
|
39
|
+
object
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.mapDocumentVersionsToApiDocumentVersions = mapDocumentVersionsToApiDocumentVersions;
|
|
44
|
+
//# sourceMappingURL=csi-to-api-docs-converter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csi-to-api-docs-converter.js","sourceRoot":"","sources":["../../src/utils/csi-to-api-docs-converter.ts"],"names":[],"mappings":";;;AAEA,+EAAgF;AAChF,+EAAkF;AAUlF,SAAgB,wBAAwB,CAAC,EACrC,SAAS,EACT,iBAAiB,EACjB,MAAM,EACN,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EAQvB;IACG,MAAM,qBAAqB,GAAG,IAAA,6DAA+B,EAAC;QAC1D,YAAY,EAAE,SAAS;QACvB,qBAAqB,EAAE,iBAAiB,CAAC,QAAQ;QACjD,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;QACpC,iBAAiB,EAAE,iBAAiB,CAAC,iBAAiB;QACtD,oBAAoB;QACpB,uBAAuB;QACvB,YAAY;KACf,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,IAAA,+DAAiC,EAAC;QACjD,SAAS,EAAE,qBAAqB;QAChC,MAAM;QACN,QAAQ,EAAE,oBAAoB,EAAE;KACnC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACtB,CAAC;AAhCD,4DAgCC;AAED,SAAgB,wCAAwC,CAAC,EACrD,QAAQ,EACR,iBAAiB,EACjB,MAAM,EACN,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACgD;IACpE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAC5B,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACnB,OAAO,OAAO,CAAC;SAClB;QAED,MAAM,CAAC,MAAM,CAAC,GAAG,wBAAwB,CAAC;YACtC,SAAS,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;YAC7B,iBAAiB;YACjB,MAAM;YACN,YAAY;YACZ,uBAAuB;YACvB,oBAAoB;SACvB,CAAC,CAAC;QAEH,OAAO;YACH,GAAG,OAAO;YACV,MAAM;SACT,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC;AA3BD,4FA2BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackbit/cms-core",
|
|
3
|
-
"version": "0.8.16-develop.
|
|
3
|
+
"version": "0.8.16-develop.3",
|
|
4
4
|
"description": "stackbit-dev",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@babel/parser": "^7.11.5",
|
|
26
26
|
"@babel/traverse": "^7.11.5",
|
|
27
27
|
"@iarna/toml": "^2.2.3",
|
|
28
|
-
"@stackbit/sdk": "0.7.16-develop.
|
|
29
|
-
"@stackbit/types": "0.10.12-develop.
|
|
28
|
+
"@stackbit/sdk": "0.7.16-develop.3",
|
|
29
|
+
"@stackbit/types": "0.10.12-develop.3",
|
|
30
30
|
"@stackbit/utils": "0.3.16-develop.1",
|
|
31
31
|
"chalk": "^4.0.1",
|
|
32
32
|
"content-engine": "0.0.19",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"slugify": "^1.6.5",
|
|
44
44
|
"uuid": "^9.0.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "6fe02acd22a52a326fa322985e06ad68f337feb3"
|
|
47
47
|
}
|
package/src/content-store.ts
CHANGED
|
@@ -71,6 +71,7 @@ import {
|
|
|
71
71
|
pluralize
|
|
72
72
|
} from './utils/user-log-utils';
|
|
73
73
|
import { ContentEngine, PluginRef, contentEngine } from 'content-engine';
|
|
74
|
+
import { mapDocumentVersionsToApiDocumentVersions } from './utils/csi-to-api-docs-converter';
|
|
74
75
|
|
|
75
76
|
export type HandleConfigAssets = <T extends Model>({ models, presets }: { models?: T[]; presets?: PresetMap }) => Promise<{ models: T[]; presets: PresetMap }>;
|
|
76
77
|
|
|
@@ -907,6 +908,8 @@ export class ContentStore {
|
|
|
907
908
|
this.userLogger.warn('Failed to fetch scheduled actions:', { error: err });
|
|
908
909
|
}
|
|
909
910
|
|
|
911
|
+
const enabledDocumentVersions = !!contentSourceInstance.getDocumentVersions;
|
|
912
|
+
|
|
910
913
|
const contentStoreAssets = mapCSIAssetsToStoreAssets({
|
|
911
914
|
csiAssets: csiAssets,
|
|
912
915
|
contentSourceInstance,
|
|
@@ -968,7 +971,10 @@ export class ContentStore {
|
|
|
968
971
|
assets: contentStoreAssets,
|
|
969
972
|
assetMap: assetMap,
|
|
970
973
|
scheduledActions: scheduledActions,
|
|
971
|
-
enabledFeatures: {
|
|
974
|
+
enabledFeatures: {
|
|
975
|
+
scheduledActions: enabledScheduledActions,
|
|
976
|
+
documentVersions: enabledDocumentVersions
|
|
977
|
+
}
|
|
972
978
|
};
|
|
973
979
|
}
|
|
974
980
|
|
|
@@ -1370,11 +1376,25 @@ export class ContentStore {
|
|
|
1370
1376
|
return _.keyBy(contentSourceDataArr, 'id');
|
|
1371
1377
|
}
|
|
1372
1378
|
|
|
1373
|
-
getContentSourceMeta(): {
|
|
1379
|
+
getContentSourceMeta(): {
|
|
1380
|
+
srcType: string;
|
|
1381
|
+
srcProjectId: string;
|
|
1382
|
+
srcVersion: string;
|
|
1383
|
+
csiVersion: string;
|
|
1384
|
+
supportsScheduledActions: boolean;
|
|
1385
|
+
supportsDocumentVersions: boolean;
|
|
1386
|
+
}[] {
|
|
1374
1387
|
return _.reduce(
|
|
1375
1388
|
this.contentSourceDataById,
|
|
1376
1389
|
(
|
|
1377
|
-
result: {
|
|
1390
|
+
result: {
|
|
1391
|
+
srcType: string;
|
|
1392
|
+
srcProjectId: string;
|
|
1393
|
+
srcVersion: string;
|
|
1394
|
+
csiVersion: string;
|
|
1395
|
+
supportsScheduledActions: boolean;
|
|
1396
|
+
supportsDocumentVersions: boolean;
|
|
1397
|
+
}[],
|
|
1378
1398
|
contentSourceData
|
|
1379
1399
|
) => {
|
|
1380
1400
|
return result.concat({
|
|
@@ -1382,7 +1402,8 @@ export class ContentStore {
|
|
|
1382
1402
|
srcProjectId: contentSourceData.srcProjectId,
|
|
1383
1403
|
srcVersion: contentSourceData.version.contentSourceVersion,
|
|
1384
1404
|
csiVersion: contentSourceData.version.interfaceVersion,
|
|
1385
|
-
supportsScheduledActions: contentSourceData?.enabledFeatures.scheduledActions ?? false
|
|
1405
|
+
supportsScheduledActions: contentSourceData?.enabledFeatures.scheduledActions ?? false,
|
|
1406
|
+
supportsDocumentVersions: contentSourceData?.enabledFeatures.documentVersions ?? false
|
|
1386
1407
|
});
|
|
1387
1408
|
},
|
|
1388
1409
|
[]
|
|
@@ -2659,6 +2680,104 @@ export class ContentStore {
|
|
|
2659
2680
|
});
|
|
2660
2681
|
}
|
|
2661
2682
|
|
|
2683
|
+
async getDocumentVersions({
|
|
2684
|
+
srcType,
|
|
2685
|
+
srcProjectId,
|
|
2686
|
+
documentId,
|
|
2687
|
+
locale
|
|
2688
|
+
}: {
|
|
2689
|
+
srcType: string;
|
|
2690
|
+
srcProjectId: string;
|
|
2691
|
+
documentId: string;
|
|
2692
|
+
locale?: string;
|
|
2693
|
+
}): Promise<{ versions: ContentStoreTypes.APIDocumentVersion[] }> {
|
|
2694
|
+
const contentSourceId = getContentSourceId(srcType, srcProjectId);
|
|
2695
|
+
const contentSourceData = this.getContentSourceDataByIdOrThrow(contentSourceId);
|
|
2696
|
+
|
|
2697
|
+
locale = locale ?? contentSourceData.defaultLocaleCode;
|
|
2698
|
+
this.logger.debug('getDocumentVersions', { srcType, srcProjectId, documentId });
|
|
2699
|
+
|
|
2700
|
+
if (!contentSourceData.instance.getDocumentVersions) {
|
|
2701
|
+
this.logger.error('Trying to call getDocumentVersions, but it is not implemented', {
|
|
2702
|
+
srcType,
|
|
2703
|
+
srcProjectId,
|
|
2704
|
+
documentId
|
|
2705
|
+
});
|
|
2706
|
+
throw new Error('Content source plugin missing required method: getDocumentVersions');
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
const { versions } = await contentSourceData.instance.getDocumentVersions({ documentId });
|
|
2710
|
+
const apiVersions = mapDocumentVersionsToApiDocumentVersions({
|
|
2711
|
+
assetSources: this.stackbitConfig?.assetSources ?? [],
|
|
2712
|
+
customActionRunStateMap: this.customActionRunStateMap,
|
|
2713
|
+
createConfigDelegate: getCreateConfigDelegateThunk({
|
|
2714
|
+
getContentSourceDataById: () => this.contentSourceDataById,
|
|
2715
|
+
logger: this.userLogger
|
|
2716
|
+
}),
|
|
2717
|
+
versions,
|
|
2718
|
+
contentSourceData,
|
|
2719
|
+
locale
|
|
2720
|
+
});
|
|
2721
|
+
|
|
2722
|
+
return { versions: apiVersions };
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
async getDocumentForVersion({
|
|
2726
|
+
srcType,
|
|
2727
|
+
srcProjectId,
|
|
2728
|
+
documentId,
|
|
2729
|
+
versionId,
|
|
2730
|
+
locale
|
|
2731
|
+
}: {
|
|
2732
|
+
srcType: string;
|
|
2733
|
+
srcProjectId: string;
|
|
2734
|
+
documentId: string;
|
|
2735
|
+
versionId: string;
|
|
2736
|
+
locale?: string;
|
|
2737
|
+
}): Promise<{ version: ContentStoreTypes.APIDocumentVersionWithDocument }> {
|
|
2738
|
+
const contentSourceId = getContentSourceId(srcType, srcProjectId);
|
|
2739
|
+
const contentSourceData = this.getContentSourceDataByIdOrThrow(contentSourceId);
|
|
2740
|
+
locale = locale ?? contentSourceData.defaultLocaleCode;
|
|
2741
|
+
this.logger.debug('getDocumentForVersion', { srcType, srcProjectId, documentId, versionId });
|
|
2742
|
+
|
|
2743
|
+
if (!contentSourceData.instance.getDocumentForVersion) {
|
|
2744
|
+
this.logger.error('Trying to call getDocumentForVersion, but it is not implemented', {
|
|
2745
|
+
srcType,
|
|
2746
|
+
srcProjectId,
|
|
2747
|
+
documentId,
|
|
2748
|
+
versionId
|
|
2749
|
+
});
|
|
2750
|
+
throw new Error('Content source plugin missing required method: getDocumentForVersion');
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
const { version } = await contentSourceData.instance.getDocumentForVersion({ documentId, versionId });
|
|
2754
|
+
const [apiVersion] = mapDocumentVersionsToApiDocumentVersions({
|
|
2755
|
+
versions: [version],
|
|
2756
|
+
assetSources: this.stackbitConfig?.assetSources ?? [],
|
|
2757
|
+
customActionRunStateMap: this.customActionRunStateMap,
|
|
2758
|
+
createConfigDelegate: getCreateConfigDelegateThunk({
|
|
2759
|
+
getContentSourceDataById: () => this.contentSourceDataById,
|
|
2760
|
+
logger: this.userLogger
|
|
2761
|
+
}),
|
|
2762
|
+
contentSourceData,
|
|
2763
|
+
locale
|
|
2764
|
+
});
|
|
2765
|
+
|
|
2766
|
+
if (!apiVersion || !apiVersion.object || !apiVersion.document) {
|
|
2767
|
+
throw new Error(`getDocumentForVersion could not transform document into api object for document ${version.documentId}`);
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
// unwrap TS types
|
|
2771
|
+
const { object, document } = apiVersion;
|
|
2772
|
+
return {
|
|
2773
|
+
version: {
|
|
2774
|
+
...apiVersion,
|
|
2775
|
+
object,
|
|
2776
|
+
document
|
|
2777
|
+
}
|
|
2778
|
+
};
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2662
2781
|
async publishDocuments({ objects, user }: { objects: { srcType: string; srcProjectId: string; srcObjectId: string }[]; user?: ContentStoreTypes.User }) {
|
|
2663
2782
|
this.logger.debug('publishDocuments');
|
|
2664
2783
|
logPublishDocuments({ userLogger: this.userLogger, objects });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentStatus, ConfigDelegate } from '@stackbit/types';
|
|
1
|
+
import { DocumentStatus, ConfigDelegate, DocumentVersion, DocumentVersionWithDocument } from '@stackbit/types';
|
|
2
2
|
import { DocumentField, DocumentFieldAPI, DocumentFieldAPIForType, DocumentStringLikeFieldForType } from './content-store-document-fields';
|
|
3
3
|
import { APICustomActionDocument } from './custom-actions';
|
|
4
4
|
|
|
@@ -123,3 +123,11 @@ export interface APIAsset {
|
|
|
123
123
|
width?: number;
|
|
124
124
|
height?: number;
|
|
125
125
|
}
|
|
126
|
+
|
|
127
|
+
export type APIDocumentVersion = DocumentVersion & {
|
|
128
|
+
object?: APIObject;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type APIDocumentVersionWithDocument = DocumentVersionWithDocument & {
|
|
132
|
+
object: APIObject;
|
|
133
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type * as StackbitTypes from '@stackbit/types';
|
|
2
|
+
import type * as ContentStoreTypes from '../types';
|
|
3
|
+
import { mapCSIDocumentsToStoreDocuments } from './csi-to-store-docs-converter';
|
|
4
|
+
import { mapDocumentsToLocalizedApiObjects } from './store-to-api-docs-converter';
|
|
5
|
+
|
|
6
|
+
type MapDocumentToApiProps = {
|
|
7
|
+
contentSourceData: ContentStoreTypes.ContentSourceData;
|
|
8
|
+
locale?: string;
|
|
9
|
+
assetSources: StackbitTypes.AssetSource[];
|
|
10
|
+
customActionRunStateMap: ContentStoreTypes.CustomActionRunStateMap;
|
|
11
|
+
createConfigDelegate: () => StackbitTypes.ConfigDelegate;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function mapDocumentsToApiObjects({
|
|
15
|
+
documents,
|
|
16
|
+
contentSourceData,
|
|
17
|
+
locale,
|
|
18
|
+
assetSources,
|
|
19
|
+
customActionRunStateMap,
|
|
20
|
+
createConfigDelegate
|
|
21
|
+
}: {
|
|
22
|
+
documents: StackbitTypes.Document[];
|
|
23
|
+
contentSourceData: ContentStoreTypes.ContentSourceData;
|
|
24
|
+
locale?: string;
|
|
25
|
+
assetSources: StackbitTypes.AssetSource[];
|
|
26
|
+
customActionRunStateMap: ContentStoreTypes.CustomActionRunStateMap;
|
|
27
|
+
createConfigDelegate: () => StackbitTypes.ConfigDelegate;
|
|
28
|
+
}): ContentStoreTypes.APIDocumentObject[] {
|
|
29
|
+
const contentStoreDocuments = mapCSIDocumentsToStoreDocuments({
|
|
30
|
+
csiDocuments: documents,
|
|
31
|
+
contentSourceInstance: contentSourceData.instance,
|
|
32
|
+
modelMap: contentSourceData.modelMap,
|
|
33
|
+
defaultLocaleCode: contentSourceData.defaultLocaleCode,
|
|
34
|
+
createConfigDelegate,
|
|
35
|
+
customActionRunStateMap,
|
|
36
|
+
assetSources
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const apiObjects = mapDocumentsToLocalizedApiObjects({
|
|
40
|
+
documents: contentStoreDocuments,
|
|
41
|
+
locale,
|
|
42
|
+
delegate: createConfigDelegate()
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return apiObjects;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function mapDocumentVersionsToApiDocumentVersions({
|
|
49
|
+
versions,
|
|
50
|
+
contentSourceData,
|
|
51
|
+
locale,
|
|
52
|
+
assetSources,
|
|
53
|
+
customActionRunStateMap,
|
|
54
|
+
createConfigDelegate
|
|
55
|
+
}: MapDocumentToApiProps & { versions: StackbitTypes.DocumentVersion[] }): ContentStoreTypes.APIDocumentVersion[] {
|
|
56
|
+
return versions.map((version) => {
|
|
57
|
+
if (!version.document) {
|
|
58
|
+
return version;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const [object] = mapDocumentsToApiObjects({
|
|
62
|
+
documents: [version.document],
|
|
63
|
+
contentSourceData,
|
|
64
|
+
locale,
|
|
65
|
+
assetSources,
|
|
66
|
+
customActionRunStateMap,
|
|
67
|
+
createConfigDelegate
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
...version,
|
|
72
|
+
object
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { DocumentBooleanFieldLocalized, DocumentBooleanFieldNonLocalized, DocumentCrossReferenceFieldLocalized, DocumentCrossReferenceFieldNonLocalized, DocumentField, DocumentFieldLocalized, DocumentFileFieldLocalized, DocumentFileFieldNonLocalized, DocumentImageFieldLocalized, DocumentImageFieldNonLocalized, DocumentJsonFieldLocalized, DocumentJsonFieldNonLocalized, DocumentListFieldLocalized, DocumentListFieldNonLocalized, DocumentMarkdownFieldLocalized, DocumentMarkdownFieldNonLocalized, DocumentModelFieldLocalized, DocumentModelFieldNonLocalized, DocumentNumberFieldLocalized, DocumentNumberFieldNonLocalized, DocumentObjectFieldLocalized, DocumentObjectFieldNonLocalized, DocumentReferenceFieldLocalized, DocumentReferenceFieldNonLocalized, DocumentRichTextFieldLocalized, DocumentRichTextFieldNonLocalized, DocumentStringLikeFieldLocalized, DocumentStringLikeFieldNonLocalized, DocumentStyleFieldLocalized, DocumentStyleFieldNonLocalized, ExtractByType } from './content-store-document-fields';
|
|
2
|
-
import { APICustomActionDocument, APICustomActionField, APICustomActionObject } from './custom-actions';
|
|
3
|
-
import { Document } from './content-store-documents';
|
|
4
|
-
import { FieldType } from '@stackbit/types';
|
|
5
|
-
export interface APIV2DocumentObject extends Omit<Document, 'getPreview' | 'getDocumentActions' | 'fields'> {
|
|
6
|
-
srcObjectLabel: string;
|
|
7
|
-
actions?: APICustomActionDocument[];
|
|
8
|
-
fields: Record<string, APIV2DocumentField>;
|
|
9
|
-
}
|
|
10
|
-
declare type Overwrite<T, U, O> = Pick<T, Exclude<keyof T, keyof U | O>> & U;
|
|
11
|
-
declare type ValueOf<T> = T[keyof T];
|
|
12
|
-
export declare type APIV2DocumentFieldTransformerNonLocalized<Type extends DocumentField> = Overwrite<Type, {
|
|
13
|
-
actions?: APICustomActionField[];
|
|
14
|
-
}, 'getFieldActions' | 'getPreview'>;
|
|
15
|
-
export declare type APIV2DocumentFieldTransformerLocalized<Type extends DocumentFieldLocalized> = Overwrite<Type, {
|
|
16
|
-
locales: Record<string, Overwrite<ValueOf<Type['locales']>, {
|
|
17
|
-
actions?: APICustomActionField[];
|
|
18
|
-
}, ''>>;
|
|
19
|
-
}, 'getFieldActions' | 'getPreview'>;
|
|
20
|
-
export declare type APIV2DocumentFieldTransformerReferenceNonLocalized<Type extends DocumentReferenceFieldNonLocalized | DocumentCrossReferenceFieldNonLocalized> = Overwrite<Type, {
|
|
21
|
-
actions?: APICustomActionField[];
|
|
22
|
-
srcModelLabel?: string;
|
|
23
|
-
srcObjectLabel?: string;
|
|
24
|
-
isMissing?: boolean;
|
|
25
|
-
}, 'getFieldActions' | 'getPreview'>;
|
|
26
|
-
export declare type APIV2DocumentFieldTransformerReferenceLocalized<Type extends DocumentReferenceFieldLocalized | DocumentCrossReferenceFieldLocalized> = Overwrite<Type, {
|
|
27
|
-
locales: Record<string, Overwrite<ValueOf<Type['locales']>, {
|
|
28
|
-
actions?: APICustomActionField[];
|
|
29
|
-
isMissing?: boolean;
|
|
30
|
-
srcModelLabel?: string;
|
|
31
|
-
srcObjectLabel?: string;
|
|
32
|
-
}, ''>>;
|
|
33
|
-
}, 'getFieldActions' | 'getPreview'>;
|
|
34
|
-
export declare type APIV2DocumentObjectFieldNonLocalized = Overwrite<DocumentObjectFieldNonLocalized, {
|
|
35
|
-
actions?: (APICustomActionField | APICustomActionObject)[];
|
|
36
|
-
} & ({
|
|
37
|
-
isUnset: true;
|
|
38
|
-
} | {
|
|
39
|
-
isUnset?: false;
|
|
40
|
-
srcObjectLabel: string;
|
|
41
|
-
fields: Record<string, APIV2DocumentField>;
|
|
42
|
-
}), 'getFieldActions' | 'getPreview'>;
|
|
43
|
-
export declare type APIV2DocumentModelFieldNonLocalized = Overwrite<DocumentModelFieldNonLocalized, {
|
|
44
|
-
actions?: (APICustomActionField | APICustomActionObject)[];
|
|
45
|
-
} & ({
|
|
46
|
-
isUnset: true;
|
|
47
|
-
} | {
|
|
48
|
-
isUnset?: false;
|
|
49
|
-
srcObjectLabel: string;
|
|
50
|
-
srcModelLabel: string;
|
|
51
|
-
srcModelName: string;
|
|
52
|
-
fields: Record<string, APIV2DocumentField>;
|
|
53
|
-
}), 'getFieldActions' | 'getPreview'>;
|
|
54
|
-
export declare type APIV2DocumentFieldTransformerObjectLocalized<Type extends DocumentObjectFieldLocalized> = Overwrite<Type, {
|
|
55
|
-
locales: Record<string, Overwrite<ValueOf<Type['locales']>, {
|
|
56
|
-
actions?: (APICustomActionField | APICustomActionObject)[];
|
|
57
|
-
fields: Record<string, APIV2DocumentField>;
|
|
58
|
-
srcObjectLabel: string;
|
|
59
|
-
}, 'getObjectActions' | 'getPreview'>>;
|
|
60
|
-
}, 'getFieldActions' | 'getPreview' | 'locales'>;
|
|
61
|
-
export declare type APIV2DocumentFieldTransformerModelLocalized<Type extends DocumentModelFieldLocalized> = Overwrite<Type, {
|
|
62
|
-
locales: Record<string, Overwrite<ValueOf<Type['locales']>, {
|
|
63
|
-
actions?: (APICustomActionField | APICustomActionObject)[];
|
|
64
|
-
fields: Record<string, APIV2DocumentField>;
|
|
65
|
-
srcObjectLabel: string;
|
|
66
|
-
srcModelLabel: string;
|
|
67
|
-
srcModelName: string;
|
|
68
|
-
}, 'getObjectActions' | 'getPreview'>>;
|
|
69
|
-
}, 'getFieldActions' | 'getPreview' | 'locales'>;
|
|
70
|
-
export declare type APIV2DocumentListFieldItems = Exclude<APIV2DocumentFieldNonLocalized, APIV2DocumentFieldListNonLocalized>;
|
|
71
|
-
export declare type APIV2DocumentFieldListNonLocalized = Overwrite<DocumentListFieldNonLocalized, {
|
|
72
|
-
actions?: APICustomActionField[];
|
|
73
|
-
items: APIV2DocumentListFieldItems[];
|
|
74
|
-
}, 'getFieldActions' | 'getPreview' | 'items'>;
|
|
75
|
-
export declare type APIV2DocumentFieldTransformerListLocalized<Type extends DocumentListFieldLocalized> = Overwrite<Type, {
|
|
76
|
-
locales: Record<string, Overwrite<ValueOf<Type['locales']>, {
|
|
77
|
-
actions?: APICustomActionField[];
|
|
78
|
-
items: APIV2DocumentListFieldItems[];
|
|
79
|
-
}, ''>>;
|
|
80
|
-
}, 'getFieldActions' | 'getPreview'>;
|
|
81
|
-
export declare type APIV2DocumentReferenceField = APIV2DocumentFieldTransformerReferenceNonLocalized<DocumentReferenceFieldNonLocalized> | APIV2DocumentFieldTransformerReferenceLocalized<DocumentReferenceFieldLocalized>;
|
|
82
|
-
export declare type APIV2DocumentObjectLikeField = APIV2DocumentObjectFieldNonLocalized | APIV2DocumentFieldTransformerObjectLocalized<DocumentObjectFieldLocalized> | APIV2DocumentModelFieldNonLocalized | APIV2DocumentFieldTransformerModelLocalized<DocumentModelFieldLocalized>;
|
|
83
|
-
export declare type APIV2DocumentField = APIV2DocumentFieldLocalized | APIV2DocumentFieldNonLocalized;
|
|
84
|
-
export declare type APIV2DocumentFieldNonLocalized = APIV2DocumentFieldTransformerNonLocalized<DocumentStringLikeFieldNonLocalized> | APIV2DocumentFieldTransformerNonLocalized<DocumentMarkdownFieldNonLocalized> | APIV2DocumentFieldTransformerNonLocalized<DocumentNumberFieldNonLocalized> | APIV2DocumentFieldTransformerNonLocalized<DocumentBooleanFieldNonLocalized> | APIV2DocumentFieldTransformerNonLocalized<DocumentJsonFieldNonLocalized> | APIV2DocumentFieldTransformerNonLocalized<DocumentStyleFieldNonLocalized> | APIV2DocumentFieldTransformerNonLocalized<DocumentRichTextFieldNonLocalized> | APIV2DocumentFieldTransformerNonLocalized<DocumentImageFieldNonLocalized> | APIV2DocumentFieldTransformerNonLocalized<DocumentFileFieldNonLocalized> | APIV2DocumentObjectFieldNonLocalized | APIV2DocumentModelFieldNonLocalized | APIV2DocumentFieldTransformerReferenceNonLocalized<DocumentReferenceFieldNonLocalized> | APIV2DocumentFieldTransformerReferenceNonLocalized<DocumentCrossReferenceFieldNonLocalized> | APIV2DocumentFieldListNonLocalized;
|
|
85
|
-
export declare type APIV2DocumentFieldLocalized = APIV2DocumentFieldTransformerLocalized<DocumentStringLikeFieldLocalized> | APIV2DocumentFieldTransformerLocalized<DocumentMarkdownFieldLocalized> | APIV2DocumentFieldTransformerLocalized<DocumentNumberFieldLocalized> | APIV2DocumentFieldTransformerLocalized<DocumentBooleanFieldLocalized> | APIV2DocumentFieldTransformerLocalized<DocumentJsonFieldLocalized> | APIV2DocumentFieldTransformerLocalized<DocumentStyleFieldLocalized> | APIV2DocumentFieldTransformerLocalized<DocumentRichTextFieldLocalized> | APIV2DocumentFieldTransformerLocalized<DocumentFileFieldLocalized> | APIV2DocumentFieldTransformerLocalized<DocumentImageFieldLocalized> | APIV2DocumentFieldTransformerObjectLocalized<DocumentObjectFieldLocalized> | APIV2DocumentFieldTransformerModelLocalized<DocumentModelFieldLocalized> | APIV2DocumentFieldTransformerReferenceLocalized<DocumentReferenceFieldLocalized> | APIV2DocumentFieldTransformerReferenceLocalized<DocumentCrossReferenceFieldLocalized> | APIV2DocumentFieldTransformerListLocalized<DocumentListFieldLocalized>;
|
|
86
|
-
export declare type APIV2DocumentFieldNonLocalizedForType<Type extends FieldType> = ExtractByType<APIV2DocumentFieldNonLocalized, Type>;
|
|
87
|
-
export declare type APIV2DocumentFieldForType<Type extends FieldType> = ExtractByType<APIV2DocumentField, Type>;
|
|
88
|
-
export {};
|
|
89
|
-
//# sourceMappingURL=content-store-api-document-fields.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-store-api-document-fields.d.ts","sourceRoot":"","sources":["../../src/types/content-store-api-document-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,6BAA6B,EAC7B,gCAAgC,EAChC,oCAAoC,EACpC,uCAAuC,EACvC,aAAa,EACb,sBAAsB,EACtB,0BAA0B,EAC1B,6BAA6B,EAC7B,2BAA2B,EAC3B,8BAA8B,EAC9B,0BAA0B,EAC1B,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,8BAA8B,EAC9B,iCAAiC,EACjC,2BAA2B,EAC3B,8BAA8B,EAC9B,4BAA4B,EAC5B,+BAA+B,EAC/B,4BAA4B,EAC5B,+BAA+B,EAC/B,+BAA+B,EAC/B,kCAAkC,EAClC,8BAA8B,EAC9B,iCAAiC,EACjC,gCAAgC,EAChC,mCAAmC,EACnC,2BAA2B,EAC3B,8BAA8B,EAC9B,aAAa,EAChB,MAAM,iCAAiC,CAAC;AACzC,OA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AA2B,GACjC,sCAAsC,CAAC,gCAAgC,CAAC,GACxE,sCAAsC,CAAC,8BAA8B,CAAC,GACtE,sCAAsC,CAAC,4BAA4B,CAAC,GACpE,sCAAsC,CAAC,6BAA6B,CAAC,GACrE,sCAAsC,CAAC,0BAA0B,CAAC,GAClE,sCAAsC,CAAC,2BAA2B,CAAC,GACnE,sCAAsC,CAAC,8BAA8B,CAAC,GACtE,sCAAsC,CAAC,0BAA0B,CAAC,GAClE,sCAAsC,CAAC,2BAA2B,CAAC,GACnE,4CAA4C,CAAC,4BAA4B,CAAC,GAC1E,2CAA2C,CAAC,2BAA2B,CAAC,GACxE,+CAA+C,CAAC,+BAA+B,CAAC,GAChF,+CAA+C,CAAC,oCAAoC,CAAC,GACrF,0CAA0C,CAAC,0BAA0B,CAAC,CAAC;AAE7E,oBAAY,qCAAqC,CAAC,IAAI,SAAS,SAAS,IAAI,aAAa,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;AAChI,oBAAY,yBAAyB,CAAC,IAAI,SAAS,SAAS,IAAI,aAAa,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-store-api-document-fields.js","sourceRoot":"","sources":["../../src/types/content-store-api-document-fields.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as ContentStoreTypes from '../types';
|
|
2
|
-
import { SearchFilterItem } from '../types';
|
|
3
|
-
import { ScheduledAction } from '@stackbit/types';
|
|
4
|
-
import { SchemaForSearch } from './search-utils';
|
|
5
|
-
declare type CustomFilterMethod = (filter: SearchFilterItem, document: ContentStoreTypes.Document, opts: {
|
|
6
|
-
locale?: string;
|
|
7
|
-
schema: SchemaForSearch;
|
|
8
|
-
activeScheduledActionsByDocumentId: Record<string, ScheduledAction[]>;
|
|
9
|
-
}) => boolean;
|
|
10
|
-
export declare const CUSTOM_FILTERS: Record<string, CustomFilterMethod>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=custom-search-filters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"custom-search-filters.d.ts","sourceRoot":"","sources":["../../src/utils/custom-search-filters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAqB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAiE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEhH,aAAK,kBAAkB,GAAG,CACtB,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EACpC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,eAAe,CAAC;IAAC,kCAAkC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAA;CAAE,KACxH,OAAO,CAAC;AAEb,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAwC7D,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CUSTOM_FILTERS = void 0;
|
|
4
|
-
const search_utils_1 = require("./search-utils");
|
|
5
|
-
exports.CUSTOM_FILTERS = {
|
|
6
|
-
hasSchedules: (filter, document, opts) => {
|
|
7
|
-
var _a;
|
|
8
|
-
const field = {
|
|
9
|
-
type: 'boolean',
|
|
10
|
-
value: !!((_a = opts.activeScheduledActionsByDocumentId[document.srcObjectId]) === null || _a === void 0 ? void 0 : _a.length)
|
|
11
|
-
};
|
|
12
|
-
return (0, search_utils_1.isBooleanFieldMatches)({ field, filter, locale: opts.locale });
|
|
13
|
-
},
|
|
14
|
-
scheduledActionId: (filter, document, opts) => {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
const field = {
|
|
17
|
-
type: 'list',
|
|
18
|
-
items: (_b = (_a = opts.activeScheduledActionsByDocumentId[document.srcObjectId]) === null || _a === void 0 ? void 0 : _a.map((scheduledAction) => ({
|
|
19
|
-
type: 'string',
|
|
20
|
-
value: scheduledAction.id
|
|
21
|
-
}))) !== null && _b !== void 0 ? _b : []
|
|
22
|
-
};
|
|
23
|
-
const model = {
|
|
24
|
-
type: 'object',
|
|
25
|
-
name: '',
|
|
26
|
-
fields: [
|
|
27
|
-
{
|
|
28
|
-
name: '',
|
|
29
|
-
type: 'list',
|
|
30
|
-
items: {
|
|
31
|
-
type: 'string'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
};
|
|
36
|
-
return (0, search_utils_1.isListFieldMatches)({ field, filter, model, locale: opts.locale, document });
|
|
37
|
-
},
|
|
38
|
-
scheduledActionDate: (filter, document, opts) => {
|
|
39
|
-
var _a, _b;
|
|
40
|
-
return ((_b = (_a = opts.activeScheduledActionsByDocumentId[document.srcObjectId]) === null || _a === void 0 ? void 0 : _a.some((scheduledAction) => {
|
|
41
|
-
const field = { type: 'date', value: scheduledAction.executeAt };
|
|
42
|
-
return (0, search_utils_1.isDateFieldMatches)({ field, filter, locale: opts.locale });
|
|
43
|
-
})) !== null && _b !== void 0 ? _b : false);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=custom-search-filters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"custom-search-filters.js","sourceRoot":"","sources":["../../src/utils/custom-search-filters.ts"],"names":[],"mappings":";;;AAIA,iDAAgH;AAQnG,QAAA,cAAc,GAAuC;IAC9D,YAAY,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;;QACrC,MAAM,KAAK,GAAG;YACV,IAAI,EAAE,SAAkB;YACxB,KAAK,EAAE,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,kC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iCAAkB,EAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACtE,CAAC,CAAC,mCAAI,KAAK,CACd,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as CSITypes from '@stackbit/types';
|
|
2
|
-
import * as ContentStoreTypes from '../types';
|
|
3
|
-
export declare function mapDocumentsToApiV2Objects({ documents, locale, documentMap, assetMap, delegate }: {
|
|
4
|
-
documents: ContentStoreTypes.Document[];
|
|
5
|
-
locale?: string;
|
|
6
|
-
documentMap: Record<string, ContentStoreTypes.Document>;
|
|
7
|
-
assetMap: Record<string, ContentStoreTypes.Asset>;
|
|
8
|
-
delegate: CSITypes.ConfigDelegate;
|
|
9
|
-
}): ContentStoreTypes.APIV2DocumentObject[];
|
|
10
|
-
//# sourceMappingURL=store-to-api-v2-docs-converter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store-to-api-v2-docs-converter.d.ts","sourceRoot":"","sources":["../../src/utils/store-to-api-v2-docs-converter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,iBAAiB,MAAM,UAAU,CAAC;AAc9C,wBAAgB,0BAA0B,CAAC,EACvC,SAAS,EACT,MAAM,EACN,WAAW,EACX,QAAQ,EACR,QAAQ,EACX,EAAE;IACC,SAAS,EAAE,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACxD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAClD,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC;CACrC,GAAG,iBAAiB,CAAC,mBAAmB,EAAE,CAU1C"}
|