@webiny/api-headless-cms-ddb 0.0.0-mt-2 → 0.0.0-unstable.0156a4c312
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -20
- package/abstractions/CmsDdbDataLoaders.d.ts +5 -0
- package/abstractions/CmsDdbDataLoaders.js +5 -0
- package/abstractions/CmsDdbDataLoaders.js.map +1 -0
- package/abstractions/CmsDdbEntryEntity.d.ts +5 -0
- package/abstractions/CmsDdbEntryEntity.js +5 -0
- package/abstractions/CmsDdbEntryEntity.js.map +1 -0
- package/abstractions/CmsDdbGroupEntity.d.ts +5 -0
- package/abstractions/CmsDdbGroupEntity.js +5 -0
- package/abstractions/CmsDdbGroupEntity.js.map +1 -0
- package/abstractions/CmsDdbModelEntity.d.ts +5 -0
- package/abstractions/CmsDdbModelEntity.js +5 -0
- package/abstractions/CmsDdbModelEntity.js.map +1 -0
- package/abstractions/CmsDdbTable.d.ts +5 -0
- package/abstractions/CmsDdbTable.js +5 -0
- package/abstractions/CmsDdbTable.js.map +1 -0
- package/definitions/entry.d.ts +6 -6
- package/definitions/entry.js +9 -95
- package/definitions/entry.js.map +1 -0
- package/definitions/group.d.ts +6 -6
- package/definitions/group.js +9 -72
- package/definitions/group.js.map +1 -0
- package/definitions/model.d.ts +6 -6
- package/definitions/model.js +9 -94
- package/definitions/model.js.map +1 -0
- package/definitions/table.d.ts +6 -7
- package/definitions/table.js +8 -30
- package/definitions/table.js.map +1 -0
- package/definitions/types.d.ts +65 -0
- package/definitions/types.js +0 -0
- package/index.d.ts +10 -2
- package/index.js +45 -123
- package/index.js.map +1 -0
- package/operations/entry/DdbCreateEntry.d.ts +16 -0
- package/operations/entry/DdbCreateEntry.js +77 -0
- package/operations/entry/DdbCreateEntry.js.map +1 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.d.ts +16 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.js +85 -0
- package/operations/entry/DdbCreateEntryRevisionFrom.js.map +1 -0
- package/operations/entry/DdbDeleteEntry.d.ts +16 -0
- package/operations/entry/DdbDeleteEntry.js +65 -0
- package/operations/entry/DdbDeleteEntry.js.map +1 -0
- package/operations/entry/DdbDeleteEntryRevision.d.ts +17 -0
- package/operations/entry/DdbDeleteEntryRevision.js +91 -0
- package/operations/entry/DdbDeleteEntryRevision.js.map +1 -0
- package/operations/entry/DdbDeleteMultipleEntries.d.ts +16 -0
- package/operations/entry/DdbDeleteMultipleEntries.js +59 -0
- package/operations/entry/DdbDeleteMultipleEntries.js.map +1 -0
- package/operations/entry/DdbGetEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetEntriesByIds.js +31 -0
- package/operations/entry/DdbGetEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetEntry.d.ts +14 -0
- package/operations/entry/DdbGetEntry.js +27 -0
- package/operations/entry/DdbGetEntry.js.map +1 -0
- package/operations/entry/DdbGetLatestEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetLatestEntriesByIds.js +31 -0
- package/operations/entry/DdbGetLatestEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.d.ts +14 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.js +35 -0
- package/operations/entry/DdbGetLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/DdbGetPreviousRevision.d.ts +14 -0
- package/operations/entry/DdbGetPreviousRevision.js +53 -0
- package/operations/entry/DdbGetPreviousRevision.js.map +1 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.js +31 -0
- package/operations/entry/DdbGetPublishedEntriesByIds.js.map +1 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.d.ts +14 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.js +35 -0
- package/operations/entry/DdbGetPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/DdbGetRevisionById.d.ts +14 -0
- package/operations/entry/DdbGetRevisionById.js +34 -0
- package/operations/entry/DdbGetRevisionById.js.map +1 -0
- package/operations/entry/DdbGetRevisions.d.ts +14 -0
- package/operations/entry/DdbGetRevisions.js +33 -0
- package/operations/entry/DdbGetRevisions.js.map +1 -0
- package/operations/entry/DdbGetUniqueFieldValues.d.ts +12 -0
- package/operations/entry/DdbGetUniqueFieldValues.js +31 -0
- package/operations/entry/DdbGetUniqueFieldValues.js.map +1 -0
- package/operations/entry/DdbListEntries.d.ts +30 -0
- package/operations/entry/DdbListEntries.js +133 -0
- package/operations/entry/DdbListEntries.js.map +1 -0
- package/operations/entry/DdbMoveEntry.d.ts +16 -0
- package/operations/entry/DdbMoveEntry.js +63 -0
- package/operations/entry/DdbMoveEntry.js.map +1 -0
- package/operations/entry/DdbMoveToBin.d.ts +16 -0
- package/operations/entry/DdbMoveToBin.js +77 -0
- package/operations/entry/DdbMoveToBin.js.map +1 -0
- package/operations/entry/DdbPublishEntry.d.ts +18 -0
- package/operations/entry/DdbPublishEntry.js +162 -0
- package/operations/entry/DdbPublishEntry.js.map +1 -0
- package/operations/entry/DdbRestoreFromBin.d.ts +16 -0
- package/operations/entry/DdbRestoreFromBin.js +78 -0
- package/operations/entry/DdbRestoreFromBin.js.map +1 -0
- package/operations/entry/DdbUnpublishEntry.d.ts +17 -0
- package/operations/entry/DdbUnpublishEntry.js +112 -0
- package/operations/entry/DdbUnpublishEntry.js.map +1 -0
- package/operations/entry/DdbUpdateEntry.d.ts +17 -0
- package/operations/entry/DdbUpdateEntry.js +105 -0
- package/operations/entry/DdbUpdateEntry.js.map +1 -0
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +27 -0
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
- package/operations/entry/dataLoader/constants.d.ts +1 -0
- package/operations/entry/dataLoader/constants.js +5 -0
- package/operations/entry/dataLoader/constants.js.map +1 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js +10 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js +24 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +40 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +40 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
- package/operations/entry/dataLoader/getRevisionById.js +42 -0
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
- package/operations/entry/dataLoader/index.d.ts +8 -0
- package/operations/entry/dataLoader/index.js +18 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +6 -0
- package/operations/entry/dataLoader/types.js +0 -0
- package/operations/entry/dataLoaders.d.ts +20 -31
- package/operations/entry/dataLoaders.js +91 -296
- package/operations/entry/dataLoaders.js.map +1 -0
- package/operations/entry/feature.d.ts +4 -0
- package/operations/entry/feature.js +55 -0
- package/operations/entry/feature.js.map +1 -0
- package/operations/entry/keys.d.ts +46 -2
- package/operations/entry/keys.js +53 -55
- package/operations/entry/keys.js.map +1 -0
- package/operations/entry/storageEntryUtils.d.ts +8 -0
- package/operations/entry/storageEntryUtils.js +25 -0
- package/operations/entry/storageEntryUtils.js.map +1 -0
- package/operations/group/DdbCreateGroup.d.ts +12 -0
- package/operations/group/DdbCreateGroup.js +35 -0
- package/operations/group/DdbCreateGroup.js.map +1 -0
- package/operations/group/DdbDeleteGroup.d.ts +12 -0
- package/operations/group/DdbDeleteGroup.js +31 -0
- package/operations/group/DdbDeleteGroup.js.map +1 -0
- package/operations/group/DdbGetGroup.d.ts +12 -0
- package/operations/group/DdbGetGroup.js +31 -0
- package/operations/group/DdbGetGroup.js.map +1 -0
- package/operations/group/DdbListGroups.d.ts +14 -0
- package/operations/group/DdbListGroups.js +52 -0
- package/operations/group/DdbListGroups.js.map +1 -0
- package/operations/group/DdbUpdateGroup.d.ts +12 -0
- package/operations/group/DdbUpdateGroup.js +35 -0
- package/operations/group/DdbUpdateGroup.js.map +1 -0
- package/operations/group/feature.d.ts +4 -0
- package/operations/group/feature.js +19 -0
- package/operations/group/feature.js.map +1 -0
- package/operations/group/keys.d.ts +15 -0
- package/operations/group/keys.js +17 -0
- package/operations/group/keys.js.map +1 -0
- package/operations/model/DdbCreateModel.d.ts +12 -0
- package/operations/model/DdbCreateModel.js +37 -0
- package/operations/model/DdbCreateModel.js.map +1 -0
- package/operations/model/DdbDeleteModel.d.ts +12 -0
- package/operations/model/DdbDeleteModel.js +31 -0
- package/operations/model/DdbDeleteModel.js.map +1 -0
- package/operations/model/DdbGetModel.d.ts +12 -0
- package/operations/model/DdbGetModel.js +30 -0
- package/operations/model/DdbGetModel.js.map +1 -0
- package/operations/model/DdbListModels.d.ts +12 -0
- package/operations/model/DdbListModels.js +36 -0
- package/operations/model/DdbListModels.js.map +1 -0
- package/operations/model/DdbUpdateModel.d.ts +12 -0
- package/operations/model/DdbUpdateModel.js +36 -0
- package/operations/model/DdbUpdateModel.js.map +1 -0
- package/operations/model/feature.d.ts +4 -0
- package/operations/model/feature.js +19 -0
- package/operations/model/feature.js.map +1 -0
- package/operations/model/keys.d.ts +15 -0
- package/operations/model/keys.js +16 -0
- package/operations/model/keys.js.map +1 -0
- package/package.json +30 -34
- package/types.d.ts +12 -76
- package/types.js +8 -15
- package/types.js.map +1 -0
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -62
- package/definitions/system.d.ts +0 -8
- package/definitions/system.js +0 -50
- package/dynamoDb/index.d.ts +0 -2
- package/dynamoDb/index.js +0 -24
- package/dynamoDb/path/plainObject.d.ts +0 -3
- package/dynamoDb/path/plainObject.js +0 -33
- package/dynamoDb/path/ref.d.ts +0 -3
- package/dynamoDb/path/ref.js +0 -27
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -65
- package/dynamoDb/storage/longText.d.ts +0 -7
- package/dynamoDb/storage/longText.js +0 -83
- package/dynamoDb/storage/richText.d.ts +0 -8
- package/dynamoDb/storage/richText.js +0 -110
- package/dynamoDb/transformValue/datetime.d.ts +0 -3
- package/dynamoDb/transformValue/datetime.js +0 -47
- package/operations/entry/index.d.ts +0 -8
- package/operations/entry/index.js +0 -823
- package/operations/entry/systemFields.d.ts +0 -2
- package/operations/entry/systemFields.js +0 -50
- package/operations/entry/utils.d.ts +0 -31
- package/operations/entry/utils.js +0 -406
- package/operations/group/index.d.ts +0 -8
- package/operations/group/index.js +0 -198
- package/operations/model/index.d.ts +0 -6
- package/operations/model/index.js +0 -161
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -141
- package/operations/system/index.d.ts +0 -6
- package/operations/system/index.js +0 -105
package/dynamoDb/storage/date.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
-
|
|
12
|
-
var _StorageTransformPlugin = require("@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin");
|
|
13
|
-
|
|
14
|
-
const excludeTypes = ["time", "dateTimeWithTimezone"];
|
|
15
|
-
const plugin = new _StorageTransformPlugin.StorageTransformPlugin({
|
|
16
|
-
fieldType: "datetime",
|
|
17
|
-
fromStorage: async ({
|
|
18
|
-
value,
|
|
19
|
-
field
|
|
20
|
-
}) => {
|
|
21
|
-
const {
|
|
22
|
-
type
|
|
23
|
-
} = field.settings || {};
|
|
24
|
-
|
|
25
|
-
if (!value || !type || excludeTypes.includes(type)) {
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
return new Date(value);
|
|
31
|
-
} catch {
|
|
32
|
-
console.log(`Could not transform from storage for field type`);
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
toStorage: async ({
|
|
37
|
-
value,
|
|
38
|
-
field
|
|
39
|
-
}) => {
|
|
40
|
-
const {
|
|
41
|
-
type
|
|
42
|
-
} = field.settings || {};
|
|
43
|
-
|
|
44
|
-
if (!value || !type || excludeTypes.includes(type)) {
|
|
45
|
-
return value;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (value.toISOString) {
|
|
49
|
-
return value.toISOString();
|
|
50
|
-
} else if (typeof value === "string") {
|
|
51
|
-
return value;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
throw new _error.default("Error converting value to a storage type.", "TO_STORAGE_ERROR", {
|
|
55
|
-
value,
|
|
56
|
-
fieldId: field.fieldId
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
var _default = () => {
|
|
62
|
-
return plugin;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
exports.default = _default;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { StorageTransformPlugin } from "@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin";
|
|
2
|
-
export interface StorageValue {
|
|
3
|
-
compression: string;
|
|
4
|
-
value: any;
|
|
5
|
-
}
|
|
6
|
-
declare const _default: () => StorageTransformPlugin<string, StorageValue>;
|
|
7
|
-
export default _default;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
-
|
|
12
|
-
var _gzip = require("@webiny/utils/compression/gzip");
|
|
13
|
-
|
|
14
|
-
var _StorageTransformPlugin = require("@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin");
|
|
15
|
-
|
|
16
|
-
const GZIP = "gzip";
|
|
17
|
-
const TO_STORAGE_ENCODING = "base64";
|
|
18
|
-
const FROM_STORAGE_ENCODING = "utf8";
|
|
19
|
-
|
|
20
|
-
const convertToBuffer = value => {
|
|
21
|
-
if (typeof value === "string") {
|
|
22
|
-
return Buffer.from(value, TO_STORAGE_ENCODING);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return value;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const plugin = new _StorageTransformPlugin.StorageTransformPlugin({
|
|
29
|
-
fieldType: "long-text",
|
|
30
|
-
fromStorage: async ({
|
|
31
|
-
field,
|
|
32
|
-
value: storageValue
|
|
33
|
-
}) => {
|
|
34
|
-
const typeOf = typeof storageValue;
|
|
35
|
-
|
|
36
|
-
if (!storageValue || typeOf === "string" || typeOf === "number") {
|
|
37
|
-
return storageValue;
|
|
38
|
-
} else if (typeof storageValue !== "object") {
|
|
39
|
-
throw new _error.default(`LongText value received in "fromStorage" function is not an object in field "${field.fieldId}".`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const {
|
|
43
|
-
compression,
|
|
44
|
-
value
|
|
45
|
-
} = storageValue;
|
|
46
|
-
/**
|
|
47
|
-
* Check if possibly undefined, null, empty...
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
if (!compression) {
|
|
51
|
-
throw new _error.default(`Missing compression in "fromStorage" function in field "${field.fieldId}": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
52
|
-
value: storageValue
|
|
53
|
-
});
|
|
54
|
-
} else if (compression !== GZIP) {
|
|
55
|
-
throw new _error.default(`This plugin cannot transform something not compressed with "GZIP".`, "WRONG_COMPRESSION", {
|
|
56
|
-
compression
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const buf = await (0, _gzip.decompress)(convertToBuffer(value));
|
|
62
|
-
return buf.toString(FROM_STORAGE_ENCODING);
|
|
63
|
-
} catch (ex) {
|
|
64
|
-
console.log(ex.message);
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
toStorage: async ({
|
|
69
|
-
value
|
|
70
|
-
}) => {
|
|
71
|
-
const compressedValue = await (0, _gzip.compress)(value);
|
|
72
|
-
return {
|
|
73
|
-
compression: GZIP,
|
|
74
|
-
value: compressedValue.toString(TO_STORAGE_ENCODING)
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
var _default = () => {
|
|
80
|
-
return plugin;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
exports.default = _default;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { StorageTransformPlugin } from "@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin";
|
|
2
|
-
export declare type OriginalValue = Record<string, any> | any[];
|
|
3
|
-
export interface StorageValue {
|
|
4
|
-
compression: string;
|
|
5
|
-
value: any;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: () => StorageTransformPlugin<any, any>;
|
|
8
|
-
export default _default;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _jsonpack = _interopRequireDefault(require("jsonpack"));
|
|
11
|
-
|
|
12
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
-
|
|
14
|
-
var _StorageTransformPlugin = require("@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin");
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Remove when jsonpack gets PR with a fix merged
|
|
18
|
-
* https://github.com/rgcl/jsonpack/pull/25/files
|
|
19
|
-
* NOTE 2021-07-28: it seems PR is not going to be merged so keep this.
|
|
20
|
-
*/
|
|
21
|
-
const transformArray = value => {
|
|
22
|
-
if (!value) {
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let isArray = Array.isArray(value);
|
|
27
|
-
const shouldBeArray = value instanceof Array === false && isArray;
|
|
28
|
-
|
|
29
|
-
if (shouldBeArray) {
|
|
30
|
-
value = Array.from(value);
|
|
31
|
-
isArray = true;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (typeof value === "object" || isArray) {
|
|
35
|
-
for (const k in value) {
|
|
36
|
-
value[k] = transformArray(value[k]);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return value;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const plugin = new _StorageTransformPlugin.StorageTransformPlugin({
|
|
44
|
-
fieldType: "rich-text",
|
|
45
|
-
fromStorage: async ({
|
|
46
|
-
field,
|
|
47
|
-
value: storageValue
|
|
48
|
-
}) => {
|
|
49
|
-
if (!storageValue) {
|
|
50
|
-
return storageValue;
|
|
51
|
-
} else if (typeof storageValue !== "object") {
|
|
52
|
-
throw new _error.default(`RichText value received in "fromStorage" function is not an object in field "${field.fieldId}".`);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* This is to circumvent a bug introduced with 5.8.0 storage operations.
|
|
56
|
-
* Do not remove.
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (storageValue.hasOwnProperty("compression") === false) {
|
|
61
|
-
return storageValue;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const {
|
|
65
|
-
compression,
|
|
66
|
-
value
|
|
67
|
-
} = storageValue;
|
|
68
|
-
|
|
69
|
-
if (!compression) {
|
|
70
|
-
throw new _error.default(`Missing compression in "fromStorage" function in field "${field.fieldId}": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
71
|
-
value: storageValue
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (compression !== "jsonpack") {
|
|
76
|
-
throw new _error.default(`This plugin cannot transform something not packed with "jsonpack".`, "WRONG_COMPRESSION", {
|
|
77
|
-
compression
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
return _jsonpack.default.unpack(value);
|
|
83
|
-
} catch {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
toStorage: async ({
|
|
88
|
-
value
|
|
89
|
-
}) => {
|
|
90
|
-
/**
|
|
91
|
-
* There is a possibility that we are trying to compress already compressed value.
|
|
92
|
-
* Introduced a bug with 5.8.0 storage operations, so just return the value to correct it.
|
|
93
|
-
*/
|
|
94
|
-
if (value && value.hasOwnProperty("compression") === true) {
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
value = transformArray(value);
|
|
99
|
-
return {
|
|
100
|
-
compression: "jsonpack",
|
|
101
|
-
value: value ? _jsonpack.default.pack(value) : value
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
var _default = () => {
|
|
107
|
-
return plugin;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
exports.default = _default;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _TimeTransformPlugin = require("@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin");
|
|
9
|
-
|
|
10
|
-
var _DateTimeTransformPlugin = require("@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin");
|
|
11
|
-
|
|
12
|
-
const timeTransformer = new _TimeTransformPlugin.TimeTransformPlugin({
|
|
13
|
-
fields: ["*"]
|
|
14
|
-
});
|
|
15
|
-
const dateTimeTransformer = new _DateTimeTransformPlugin.DateTimeTransformPlugin({
|
|
16
|
-
fields: ["*"]
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
var _default = () => ({
|
|
20
|
-
type: "cms-field-filter-value-transform",
|
|
21
|
-
name: "cms-field-value-filter-transform-datetime",
|
|
22
|
-
fieldType: "datetime",
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Always transform into the milliseconds.
|
|
26
|
-
*/
|
|
27
|
-
transform: ({
|
|
28
|
-
field,
|
|
29
|
-
value
|
|
30
|
-
}) => {
|
|
31
|
-
const {
|
|
32
|
-
type
|
|
33
|
-
} = field.settings || {};
|
|
34
|
-
|
|
35
|
-
if (type === "time") {
|
|
36
|
-
return timeTransformer.transform({
|
|
37
|
-
value
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return dateTimeTransformer.transform({
|
|
42
|
-
value
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
exports.default = _default;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CmsEntryStorageOperations } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { Entity } from "dynamodb-toolbox";
|
|
3
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
-
export interface Params {
|
|
5
|
-
entity: Entity<any>;
|
|
6
|
-
plugins: PluginsContainer;
|
|
7
|
-
}
|
|
8
|
-
export declare const createEntriesStorageOperations: (params: Params) => CmsEntryStorageOperations;
|