@datocms/cma-client 5.1.21 → 5.1.23
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/cjs/fieldTypes/single_block.js.map +1 -1
- package/dist/cjs/fieldTypes/slug.js.map +1 -1
- package/dist/cjs/fieldTypes/structured_text.js.map +1 -1
- package/dist/cjs/fieldTypes/validators/index.js +2 -2
- package/dist/cjs/fieldTypes/validators/index.js.map +1 -1
- package/dist/cjs/fieldTypes/validators/{sanitization.js → sanitized_html.js} +1 -1
- package/dist/cjs/fieldTypes/validators/sanitized_html.js.map +1 -0
- package/dist/cjs/generated/Client.js +1 -1
- package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
- package/dist/cjs/utilities/duplicateBlockRecord.js +6 -2
- package/dist/cjs/utilities/duplicateBlockRecord.js.map +1 -1
- package/dist/esm/fieldTypes/single_block.d.ts +0 -1
- package/dist/esm/fieldTypes/single_block.js.map +1 -1
- package/dist/esm/fieldTypes/slug.d.ts +3 -0
- package/dist/esm/fieldTypes/slug.js.map +1 -1
- package/dist/esm/fieldTypes/structured_text.d.ts +3 -0
- package/dist/esm/fieldTypes/structured_text.js.map +1 -1
- package/dist/esm/fieldTypes/text.d.ts +2 -2
- package/dist/esm/fieldTypes/validators/index.d.ts +2 -2
- package/dist/esm/fieldTypes/validators/index.js +2 -2
- package/dist/esm/fieldTypes/validators/index.js.map +1 -1
- package/dist/{types/fieldTypes/validators/sanitization.d.ts → esm/fieldTypes/validators/sanitized_html.d.ts} +1 -1
- package/dist/esm/fieldTypes/validators/sanitized_html.js +2 -0
- package/dist/esm/fieldTypes/validators/sanitized_html.js.map +1 -0
- package/dist/esm/generated/Client.js +1 -1
- package/dist/esm/utilities/buildBlockRecord.d.ts +10 -3
- package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
- package/dist/esm/utilities/duplicateBlockRecord.js +6 -2
- package/dist/esm/utilities/duplicateBlockRecord.js.map +1 -1
- package/dist/types/fieldTypes/single_block.d.ts +0 -1
- package/dist/types/fieldTypes/slug.d.ts +3 -0
- package/dist/types/fieldTypes/structured_text.d.ts +3 -0
- package/dist/types/fieldTypes/text.d.ts +2 -2
- package/dist/types/fieldTypes/validators/index.d.ts +2 -2
- package/dist/{esm/fieldTypes/validators/sanitization.d.ts → types/fieldTypes/validators/sanitized_html.d.ts} +1 -1
- package/dist/types/utilities/buildBlockRecord.d.ts +10 -3
- package/package.json +2 -2
- package/src/fieldTypes/single_block.ts +0 -1
- package/src/fieldTypes/slug.ts +3 -0
- package/src/fieldTypes/structured_text.ts +3 -0
- package/src/fieldTypes/text.ts +2 -2
- package/src/fieldTypes/validators/index.ts +2 -2
- package/src/fieldTypes/validators/{sanitization.ts → sanitized_html.ts} +1 -1
- package/src/generated/Client.ts +1 -1
- package/src/utilities/buildBlockRecord.ts +15 -3
- package/src/utilities/duplicateBlockRecord.ts +7 -2
- package/dist/cjs/fieldTypes/validators/sanitization.js.map +0 -1
- package/dist/esm/fieldTypes/validators/sanitization.js +0 -2
- package/dist/esm/fieldTypes/validators/sanitization.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single_block.js","sourceRoot":"","sources":["../../../src/fieldTypes/single_block.ts"],"names":[],"mappings":";;;AACA,wCAA4C;AAK5C,8EAG4C;
|
|
1
|
+
{"version":3,"file":"single_block.js","sourceRoot":"","sources":["../../../src/fieldTypes/single_block.ts"],"names":[],"mappings":";;;AACA,wCAA4C;AAK5C,8EAG4C;AAyH5C;;;;;GAKG;AAEH;;GAEG;AACH,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAFD,4BAEC;AAMD;;GAEG;AACH,SAAgB,2BAA2B,CAEzC,KAAc;IACd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,KAAK,CAAC,IAAI,KAAK,MA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,CAAC;IAEhC,uFAAuF;IACvF,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAPD,0FAOC;AAED,SAAgB,gDAAgD,CAG9D,KAAc;IAEd,OAAO,CACL,IAAA,6CAAqB,EAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,uCAAuC,CAAC,CACpE,CAAC;AACJ,CAAC;AATD,4GASC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../../src/fieldTypes/slug.ts"],"names":[],"mappings":";;;AAAA,8EAG4C;
|
|
1
|
+
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../../src/fieldTypes/slug.ts"],"names":[],"mappings":";;;AAAA,8EAG4C;AAU5C,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAHD,4CAGC;AAED,SAAgB,yBAAyB,CACvC,KAAc;IAEd,OAAO,CACL,IAAA,6CAAqB,EAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAC7E,CAAC;AACJ,CAAC;AAND,8DAMC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/structured_text.ts"],"names":[],"mappings":";;;AAAA,iFASuC;AACvC,wCAA4C;AAE5C,8EAG4C;AAE5C,iDAMwB;
|
|
1
|
+
{"version":3,"file":"structured_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/structured_text.ts"],"names":[],"mappings":";;;AAAA,iFASuC;AACvC,wCAA4C;AAE5C,8EAG4C;AAE5C,iDAMwB;AA4HxB;;;GAGG;AACH,SAAS,qBAAqB,CAC5B,IAAgB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AAI,CAAC,IAAI,CAAC;QAEvB,YAAY;QACZ,IAAI,IAAA,uBAAQ,EAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAEhC,qCAAqC;QACrC,OAAO,IAAA,0CAA2B,EAAC,IAAI,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC;AAzBD,kFAyBC;AAED,SAAgB,4CAA4C,CAG1D,KAAc;IAEd,OAAO,CACL,IAAA,6CAAqB,EAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAChE,CAAC;AACJ,CAAC;AATD,oGASC;AAED;;;GAGG;AACH,SAAgB,0CAA0C,CAExD,KAAc;IACd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,IAAA,0CAAU,EAAU,KAAK,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,gEAAgE;IAChE,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,2EAA2E;QAC3E,OAAO,IAAA,qCAAsB,EAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AAhBD,gGAgBC;AAED,SAAgB,mDAAmD,CAGjE,KAAc;IAEd,OAAO,CACL,IAAA,6CAAqB,EAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,0CAA0C,CAAC,CACvE,CAAC;AACJ,CAAC;AATD,kHASC"}
|
|
@@ -23,15 +23,15 @@ __exportStar(require("./file_size"), exports);
|
|
|
23
23
|
__exportStar(require("./format"), exports);
|
|
24
24
|
__exportStar(require("./image_aspect_ratio"), exports);
|
|
25
25
|
__exportStar(require("./image_dimensions"), exports);
|
|
26
|
-
__exportStar(require("./item_item_type"), exports);
|
|
27
26
|
__exportStar(require("./items_item_type"), exports);
|
|
27
|
+
__exportStar(require("./item_item_type"), exports);
|
|
28
28
|
__exportStar(require("./length"), exports);
|
|
29
29
|
__exportStar(require("./number_range"), exports);
|
|
30
30
|
__exportStar(require("./required"), exports);
|
|
31
31
|
__exportStar(require("./required_alt_title"), exports);
|
|
32
32
|
__exportStar(require("./required_seo_fields"), exports);
|
|
33
33
|
__exportStar(require("./rich_text_blocks"), exports);
|
|
34
|
-
__exportStar(require("./
|
|
34
|
+
__exportStar(require("./sanitized_html"), exports);
|
|
35
35
|
__exportStar(require("./single_block_blocks"), exports);
|
|
36
36
|
__exportStar(require("./size"), exports);
|
|
37
37
|
__exportStar(require("./slug_format"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fieldTypes/validators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,oDAAkC;AAClC,uDAAqC;AACrC,yCAAuB;AACvB,8CAA4B;AAC5B,8CAA4B;AAC5B,2CAAyB;AACzB,uDAAqC;AACrC,qDAAmC;AACnC,mDAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fieldTypes/validators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,oDAAkC;AAClC,uDAAqC;AACrC,yCAAuB;AACvB,8CAA4B;AAC5B,8CAA4B;AAC5B,2CAAyB;AACzB,uDAAqC;AACrC,qDAAmC;AACnC,oDAAkC;AAClC,mDAAiC;AACjC,2CAAyB;AACzB,iDAA+B;AAC/B,6CAA2B;AAC3B,uDAAqC;AACrC,wDAAsC;AACtC,qDAAmC;AACnC,mDAAiC;AACjC,wDAAsC;AACtC,yCAAuB;AACvB,gDAA8B;AAC9B,qDAAmC;AACnC,2DAAyC;AACzC,kEAAgD;AAChD,0DAAwC;AACxC,iDAA+B;AAC/B,2CAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitized_html.js","sourceRoot":"","sources":["../../../../src/fieldTypes/validators/sanitized_html.ts"],"names":[],"mappings":""}
|
|
@@ -88,7 +88,7 @@ class Client {
|
|
|
88
88
|
return this.config.baseUrl || Client.defaultBaseUrl;
|
|
89
89
|
}
|
|
90
90
|
request(options) {
|
|
91
|
-
return (0, rest_client_utils_1.request)(Object.assign(Object.assign(Object.assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v5.1.
|
|
91
|
+
return (0, rest_client_utils_1.request)(Object.assign(Object.assign(Object.assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v5.1.23', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: Object.assign(Object.assign(Object.assign({}, (this.config.extraHeaders || {})), (this.config.environment
|
|
92
92
|
? { 'X-Environment': this.config.environment }
|
|
93
93
|
: {})), { 'X-API-Version': '3' }), fetchJobResult: (jobId) => {
|
|
94
94
|
return this.jobResultsFetcher
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildBlockRecord.js","sourceRoot":"","sources":["../../../src/utilities/buildBlockRecord.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAoD;AAGpD,sDAA8C;
|
|
1
|
+
{"version":3,"file":"buildBlockRecord.js","sourceRoot":"","sources":["../../../src/utilities/buildBlockRecord.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAoD;AAGpD,sDAA8C;AA6B9C,SAAgB,gBAAgB,CAG9B,IAEuC;IAEvC,OAAO,KAAK,CAAC,oBAAoB,CAE9B,IAAI,EAAE;QACP,IAAI,EAAE,gBAAI,CAAC,IAAI;QACf,UAAU,EAAE,GAAG;QACf,aAAa,EAAE,CAAC,WAAW,CAAC;KAC7B,CAAC,CAAC,IAAI,CAAC;AACV,CAAC;AAdD,4CAcC"}
|
|
@@ -39,8 +39,12 @@ function duplicateBlockRecord(existingBlock, schemaRepository) {
|
|
|
39
39
|
if (typeof block === 'string') {
|
|
40
40
|
throw new Error(`Block cannot be duplicated as it contains nested block at ${path.join('.')} that is expressed as ID (${block}) instead of full object!`);
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
if ('id' in block) {
|
|
43
|
+
const { id, meta } = block, blockWithoutIdAndMeta = __rest(block, ["id", "meta"]);
|
|
44
|
+
return blockWithoutIdAndMeta;
|
|
45
|
+
}
|
|
46
|
+
const { meta } = block, blockWithoutMeta = __rest(block, ["meta"]);
|
|
47
|
+
return blockWithoutMeta;
|
|
44
48
|
});
|
|
45
49
|
}
|
|
46
50
|
return newBlock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplicateBlockRecord.js","sourceRoot":"","sources":["../../../src/utilities/duplicateBlockRecord.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA,uDAAsE;AAKtE,SAAsB,oBAAoB,CAGxC,aAAoD,EACpD,gBAAkC;;QAElC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC;QAExE,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,kBAAkB,CACxD,aAAa,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAC9C,CAAC;QAEF,MAAM,QAAQ,GAAG;YACf,YAAY;YACZ,IAAI;YACJ,aAAa;YACb,UAAU;SACU,CAAC;QAEvB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAErE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;gBAC3C,MAAM,IAAA,mDAAiC,EACrC,QAAQ,CAAC,UAAU,CAAC,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,KAAK,EAAE,IAAI,EAAE,EAAE;oBACd,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;wBAC7B,MAAM,IAAI,KAAK,CACb,6DAA6D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,6BAA6B,KAAK,2BAA2B,CACzI,CAAC;qBACH;oBAED,IAAI,IAAI,IAAI,KAAK,EAAE;wBACjB,MAAM,EAAE,EAAE,EAAE,IAAI,KAA+B,KAAK,EAA/B,qBAAqB,UAAK,KAAK,EAA9C,cAAsC,CAAQ,CAAC;wBAErD,OAAO,qBAA0C,CAAC;qBACnD;oBAED,MAAM,EAAE,IAAI,KAA0B,KAAK,EAA1B,gBAAgB,UAAK,KAAK,EAArC,QAA6B,CAAQ,CAAC;oBAC5C,OAAO,gBAAqC,CAAC;gBAC/C,CAAC,CACF,CAAC;SACL;QAED,OAAO,QAAyC,CAAC;IACnD,CAAC;CAAA;AA/CD,oDA+CC"}
|
|
@@ -60,7 +60,6 @@ export type UpdatedBlockInRequest<D extends ItemTypeDefinition = ItemTypeDefinit
|
|
|
60
60
|
export type NewBlockInRequest<D extends ItemTypeDefinition = ItemTypeDefinition> = {
|
|
61
61
|
__itemTypeId?: D['itemTypeId'];
|
|
62
62
|
type: RawApiTypes.ItemType1;
|
|
63
|
-
id?: RawApiTypes.ItemIdentity;
|
|
64
63
|
relationships: RawApiTypes.ItemRelationships<D>;
|
|
65
64
|
meta?: RawApiTypes.ItemMeta;
|
|
66
65
|
attributes: ToItemAttributesInRequest<D>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single_block.js","sourceRoot":"","sources":["../../../src/fieldTypes/single_block.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"single_block.js","sourceRoot":"","sources":["../../../src/fieldTypes/single_block.ts"],"names":[],"mappings":"AACA,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AO,2BAA2B,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,yCAAyC,CAGvD,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAC7D,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CAErD,KAAc;IACd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,uFAAuF;IACvF,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,gDAAgD,CAG9D,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,uCAAuC,CAAC,CACpE,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
2
2
|
import type { SlugEditorConfiguration } from './appearance/slug';
|
|
3
|
+
import type { UniqueValidator } from './validators';
|
|
3
4
|
import type { LengthValidator } from './validators/length';
|
|
4
5
|
import type { RequiredValidator } from './validators/required';
|
|
5
6
|
import type { SlugFormatValidator } from './validators/slug_format';
|
|
@@ -10,6 +11,8 @@ export declare function isLocalizedSlugFieldValue(value: unknown): value is Loca
|
|
|
10
11
|
export type SlugFieldValidators = {
|
|
11
12
|
/** Value must be specified or it won't be valid */
|
|
12
13
|
required?: RequiredValidator;
|
|
14
|
+
/** The value must be unique across the whole collection of records */
|
|
15
|
+
unique?: UniqueValidator;
|
|
13
16
|
/** Accept strings only with a specified number of characters */
|
|
14
17
|
length?: LengthValidator;
|
|
15
18
|
/** Only accept slugs having a specific format */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../../src/fieldTypes/slug.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../../src/fieldTypes/slug.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAU5C,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAC7E,CAAC;AACJ,CAAC"}
|
|
@@ -3,6 +3,7 @@ import type { ItemTypeDefinition } from '../utilities/itemDefinition';
|
|
|
3
3
|
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
4
4
|
import type { StructuredTextEditorConfiguration } from './appearance/structured_text';
|
|
5
5
|
import { type BlockInNestedResponse, type BlockInRequest } from './single_block';
|
|
6
|
+
import type { RequiredValidator } from './validators';
|
|
6
7
|
import type { LengthValidator } from './validators/length';
|
|
7
8
|
import type { StructuredTextBlocksValidator } from './validators/structured_text_blocks';
|
|
8
9
|
import type { StructuredTextInlineBlocksValidator } from './validators/structured_text_inline_blocks';
|
|
@@ -100,6 +101,8 @@ export declare function isLocalizedStructuredTextFieldValueInRequest<D extends I
|
|
|
100
101
|
export declare function isStructuredTextFieldValueInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is StructuredTextFieldValueInNestedResponse<D>;
|
|
101
102
|
export declare function isLocalizedStructuredTextFieldValueInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValueInNestedResponse<D>>;
|
|
102
103
|
export type StructuredTextFieldValidators = {
|
|
104
|
+
/** Value must be specified or it won't be valid */
|
|
105
|
+
required?: RequiredValidator;
|
|
103
106
|
/** Only accept references to block records of the specified block models */
|
|
104
107
|
structured_text_blocks: StructuredTextBlocksValidator;
|
|
105
108
|
/** Only accept itemLink to inlineItem nodes for records of the specified models */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/structured_text.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAGL,QAAQ,EACR,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"structured_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/structured_text.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAGL,QAAQ,EACR,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AA4HxB;;;GAGG;AACH,SAAS,qBAAqB,CAC5B,IAAgB,EAChB,QAAsD;IAEtD,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;QACrC,wEAAwE;QACxE,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,EAAE;YACtD,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC9B;QACD,qDAAqD;QACrD,OA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MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAChE,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0CAA0C,CAExD,KAAc;IACd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAU,KAAK,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,gEAAgE;IAChE,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,2EAA2E;QAC3E,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mDAAmD,CAGjE,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,0CAA0C,CAAC,CACvE,CAAC;AACJ,CAAC"}
|
|
@@ -2,10 +2,10 @@ import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
|
2
2
|
import type { MarkdownEditorConfiguration } from './appearance/markdown';
|
|
3
3
|
import type { TextareaEditorConfiguration } from './appearance/textarea';
|
|
4
4
|
import type { WysiwygEditorConfiguration } from './appearance/wysiwyg';
|
|
5
|
+
import type { SanitizedHtmlValidator } from './validators';
|
|
5
6
|
import type { FormatValidator } from './validators/format';
|
|
6
7
|
import type { LengthValidator } from './validators/length';
|
|
7
8
|
import type { RequiredValidator } from './validators/required';
|
|
8
|
-
import type { SanitizationValidator } from './validators/sanitization';
|
|
9
9
|
export type TextFieldValue = string | null;
|
|
10
10
|
export declare function isTextFieldValue(value: unknown): value is TextFieldValue;
|
|
11
11
|
export declare function isLocalizedTextFieldValue(value: unknown): value is LocalizedFieldValue<TextFieldValue>;
|
|
@@ -17,7 +17,7 @@ export type TextFieldValidators = {
|
|
|
17
17
|
/** Accepts only strings that match a specified format */
|
|
18
18
|
format?: FormatValidator;
|
|
19
19
|
/** Checks for the presence of malicious code in HTML fields */
|
|
20
|
-
|
|
20
|
+
sanitized_html?: SanitizedHtmlValidator;
|
|
21
21
|
};
|
|
22
22
|
export type TextFieldAppearance = {
|
|
23
23
|
editor: 'markdown';
|
|
@@ -7,15 +7,15 @@ export * from './file_size';
|
|
|
7
7
|
export * from './format';
|
|
8
8
|
export * from './image_aspect_ratio';
|
|
9
9
|
export * from './image_dimensions';
|
|
10
|
-
export * from './item_item_type';
|
|
11
10
|
export * from './items_item_type';
|
|
11
|
+
export * from './item_item_type';
|
|
12
12
|
export * from './length';
|
|
13
13
|
export * from './number_range';
|
|
14
14
|
export * from './required';
|
|
15
15
|
export * from './required_alt_title';
|
|
16
16
|
export * from './required_seo_fields';
|
|
17
17
|
export * from './rich_text_blocks';
|
|
18
|
-
export * from './
|
|
18
|
+
export * from './sanitized_html';
|
|
19
19
|
export * from './single_block_blocks';
|
|
20
20
|
export * from './size';
|
|
21
21
|
export * from './slug_format';
|
|
@@ -7,15 +7,15 @@ export * from './file_size';
|
|
|
7
7
|
export * from './format';
|
|
8
8
|
export * from './image_aspect_ratio';
|
|
9
9
|
export * from './image_dimensions';
|
|
10
|
-
export * from './item_item_type';
|
|
11
10
|
export * from './items_item_type';
|
|
11
|
+
export * from './item_item_type';
|
|
12
12
|
export * from './length';
|
|
13
13
|
export * from './number_range';
|
|
14
14
|
export * from './required';
|
|
15
15
|
export * from './required_alt_title';
|
|
16
16
|
export * from './required_seo_fields';
|
|
17
17
|
export * from './rich_text_blocks';
|
|
18
|
-
export * from './
|
|
18
|
+
export * from './sanitized_html';
|
|
19
19
|
export * from './single_block_blocks';
|
|
20
20
|
export * from './size';
|
|
21
21
|
export * from './slug_format';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fieldTypes/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fieldTypes/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks for the presence of malicious code in HTML fields: content is valid if no dangerous code is present.
|
|
3
3
|
*/
|
|
4
|
-
export type
|
|
4
|
+
export type SanitizedHtmlValidator = {
|
|
5
5
|
/** Content is actively sanitized before applying the validation */
|
|
6
6
|
sanitize_before_validation: boolean;
|
|
7
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitized_html.js","sourceRoot":"","sources":["../../../../src/fieldTypes/validators/sanitized_html.ts"],"names":[],"mappings":""}
|
|
@@ -62,7 +62,7 @@ export class Client {
|
|
|
62
62
|
return this.config.baseUrl || Client.defaultBaseUrl;
|
|
63
63
|
}
|
|
64
64
|
request(options) {
|
|
65
|
-
return request(Object.assign(Object.assign(Object.assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v5.1.
|
|
65
|
+
return request(Object.assign(Object.assign(Object.assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v5.1.23', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: Object.assign(Object.assign(Object.assign({}, (this.config.extraHeaders || {})), (this.config.environment
|
|
66
66
|
? { 'X-Environment': this.config.environment }
|
|
67
67
|
: {})), { 'X-API-Version': '3' }), fetchJobResult: (jobId) => {
|
|
68
68
|
return this.jobResultsFetcher
|
|
@@ -2,13 +2,20 @@ import type { NewBlockInRequest } from '../fieldTypes';
|
|
|
2
2
|
import type * as ApiTypes from '../generated/ApiTypes';
|
|
3
3
|
import type { ItemTypeDefinition, ToItemAttributesInRequest } from './itemDefinition';
|
|
4
4
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
5
|
-
type
|
|
6
|
-
id?: ApiTypes.ItemIdentity;
|
|
5
|
+
type CreateBlockRecordSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
|
|
7
6
|
type?: ApiTypes.ItemType1;
|
|
8
7
|
item_type: ApiTypes.ItemTypeData<D>;
|
|
9
8
|
meta?: ApiTypes.ItemUpdateSchema['meta'];
|
|
10
9
|
creator?: ApiTypes.ItemUpdateSchema['creator'];
|
|
11
10
|
__itemTypeId?: D['itemTypeId'];
|
|
12
11
|
} & ToItemAttributesInRequest<D>;
|
|
13
|
-
|
|
12
|
+
type UpdateBlockRecordSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
|
|
13
|
+
id: ApiTypes.ItemIdentity;
|
|
14
|
+
type?: ApiTypes.ItemType1;
|
|
15
|
+
item_type?: ApiTypes.ItemTypeData<D>;
|
|
16
|
+
meta?: ApiTypes.ItemUpdateSchema['meta'];
|
|
17
|
+
creator?: ApiTypes.ItemUpdateSchema['creator'];
|
|
18
|
+
__itemTypeId?: D['itemTypeId'];
|
|
19
|
+
} & ToItemAttributesInRequest<D>;
|
|
20
|
+
export declare function buildBlockRecord<D extends ItemTypeDefinition = ItemTypeDefinition>(body: CreateBlockRecordSchema<NoInfer<D>> | UpdateBlockRecordSchema<NoInfer<D>>): NewBlockInRequest<NoInfer<D>>;
|
|
14
21
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildBlockRecord.js","sourceRoot":"","sources":["../../../src/utilities/buildBlockRecord.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"buildBlockRecord.js","sourceRoot":"","sources":["../../../src/utilities/buildBlockRecord.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AA6B9C,MAAM,UAAU,gBAAgB,CAG9B,IAEuC;IAEvC,OAAO,KAAK,CAAC,oBAAoB,CAE9B,IAAI,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,UAAU,EAAE,GAAG;QACf,aAAa,EAAE,CAAC,WAAW,CAAC;KAC7B,CAAC,CAAC,IAAI,CAAC;AACV,CAAC"}
|
|
@@ -36,8 +36,12 @@ export function duplicateBlockRecord(existingBlock, schemaRepository) {
|
|
|
36
36
|
if (typeof block === 'string') {
|
|
37
37
|
throw new Error(`Block cannot be duplicated as it contains nested block at ${path.join('.')} that is expressed as ID (${block}) instead of full object!`);
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if ('id' in block) {
|
|
40
|
+
const { id, meta } = block, blockWithoutIdAndMeta = __rest(block, ["id", "meta"]);
|
|
41
|
+
return blockWithoutIdAndMeta;
|
|
42
|
+
}
|
|
43
|
+
const { meta } = block, blockWithoutMeta = __rest(block, ["meta"]);
|
|
44
|
+
return blockWithoutMeta;
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
47
|
return newBlock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplicateBlockRecord.js","sourceRoot":"","sources":["../../../src/utilities/duplicateBlockRecord.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAKA,OAAO,EAAE,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAKtE,MAAM,UAAgB,oBAAoB,CAGxC,aAAoD,EACpD,gBAAkC;;QAElC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC;QAExE,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,kBAAkB,CACxD,aAAa,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAC9C,CAAC;QAEF,MAAM,QAAQ,GAAG;YACf,YAAY;YACZ,IAAI;YACJ,aAAa;YACb,UAAU;SACU,CAAC;QAEvB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAErE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;gBAC3C,MAAM,iCAAiC,CACrC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAC7C,KAAK,CAAC,UAAU,CAAC,UAAU,EAC3B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AAO,KAAK,KAAK,QAAQ,EAAE;wBAC7B,MAAM,IAAI,KAAK,CACb,6DAA6D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,6BAA6B,KAAK,2BAA2B,CACzI,CAAC;qBACH;oBAED,IAAI,IAAI,IAAI,KAAK,EAAE;wBACjB,MAAM,EAAE,EAAE,EAAE,IAAI,KAA+B,KAAK,EAA/B,qBAAqB,UAAK,KAAK,EAA9C,cAAsC,CAAQ,CAAC;wBAErD,OAAO,qBAA0C,CAAC;qBACnD;oBAED,MAAM,EAAE,IAAI,KAA0B,KAAK,EAA1B,gBAAgB,UAAK,KAAK,EAArC,QAA6B,CAAQ,CAAC;oBAC5C,OAAO,gBAAqC,CAAC;gBAC/C,CAAC,CACF,CAAC;SACL;QAED,OAAO,QAAyC,CAAC;IACnD,CAAC;CAAA"}
|
|
@@ -60,7 +60,6 @@ export type UpdatedBlockInRequest<D extends ItemTypeDefinition = ItemTypeDefinit
|
|
|
60
60
|
export type NewBlockInRequest<D extends ItemTypeDefinition = ItemTypeDefinition> = {
|
|
61
61
|
__itemTypeId?: D['itemTypeId'];
|
|
62
62
|
type: RawApiTypes.ItemType1;
|
|
63
|
-
id?: RawApiTypes.ItemIdentity;
|
|
64
63
|
relationships: RawApiTypes.ItemRelationships<D>;
|
|
65
64
|
meta?: RawApiTypes.ItemMeta;
|
|
66
65
|
attributes: ToItemAttributesInRequest<D>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
2
2
|
import type { SlugEditorConfiguration } from './appearance/slug';
|
|
3
|
+
import type { UniqueValidator } from './validators';
|
|
3
4
|
import type { LengthValidator } from './validators/length';
|
|
4
5
|
import type { RequiredValidator } from './validators/required';
|
|
5
6
|
import type { SlugFormatValidator } from './validators/slug_format';
|
|
@@ -10,6 +11,8 @@ export declare function isLocalizedSlugFieldValue(value: unknown): value is Loca
|
|
|
10
11
|
export type SlugFieldValidators = {
|
|
11
12
|
/** Value must be specified or it won't be valid */
|
|
12
13
|
required?: RequiredValidator;
|
|
14
|
+
/** The value must be unique across the whole collection of records */
|
|
15
|
+
unique?: UniqueValidator;
|
|
13
16
|
/** Accept strings only with a specified number of characters */
|
|
14
17
|
length?: LengthValidator;
|
|
15
18
|
/** Only accept slugs having a specific format */
|
|
@@ -3,6 +3,7 @@ import type { ItemTypeDefinition } from '../utilities/itemDefinition';
|
|
|
3
3
|
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
4
4
|
import type { StructuredTextEditorConfiguration } from './appearance/structured_text';
|
|
5
5
|
import { type BlockInNestedResponse, type BlockInRequest } from './single_block';
|
|
6
|
+
import type { RequiredValidator } from './validators';
|
|
6
7
|
import type { LengthValidator } from './validators/length';
|
|
7
8
|
import type { StructuredTextBlocksValidator } from './validators/structured_text_blocks';
|
|
8
9
|
import type { StructuredTextInlineBlocksValidator } from './validators/structured_text_inline_blocks';
|
|
@@ -100,6 +101,8 @@ export declare function isLocalizedStructuredTextFieldValueInRequest<D extends I
|
|
|
100
101
|
export declare function isStructuredTextFieldValueInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is StructuredTextFieldValueInNestedResponse<D>;
|
|
101
102
|
export declare function isLocalizedStructuredTextFieldValueInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValueInNestedResponse<D>>;
|
|
102
103
|
export type StructuredTextFieldValidators = {
|
|
104
|
+
/** Value must be specified or it won't be valid */
|
|
105
|
+
required?: RequiredValidator;
|
|
103
106
|
/** Only accept references to block records of the specified block models */
|
|
104
107
|
structured_text_blocks: StructuredTextBlocksValidator;
|
|
105
108
|
/** Only accept itemLink to inlineItem nodes for records of the specified models */
|
|
@@ -2,10 +2,10 @@ import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
|
2
2
|
import type { MarkdownEditorConfiguration } from './appearance/markdown';
|
|
3
3
|
import type { TextareaEditorConfiguration } from './appearance/textarea';
|
|
4
4
|
import type { WysiwygEditorConfiguration } from './appearance/wysiwyg';
|
|
5
|
+
import type { SanitizedHtmlValidator } from './validators';
|
|
5
6
|
import type { FormatValidator } from './validators/format';
|
|
6
7
|
import type { LengthValidator } from './validators/length';
|
|
7
8
|
import type { RequiredValidator } from './validators/required';
|
|
8
|
-
import type { SanitizationValidator } from './validators/sanitization';
|
|
9
9
|
export type TextFieldValue = string | null;
|
|
10
10
|
export declare function isTextFieldValue(value: unknown): value is TextFieldValue;
|
|
11
11
|
export declare function isLocalizedTextFieldValue(value: unknown): value is LocalizedFieldValue<TextFieldValue>;
|
|
@@ -17,7 +17,7 @@ export type TextFieldValidators = {
|
|
|
17
17
|
/** Accepts only strings that match a specified format */
|
|
18
18
|
format?: FormatValidator;
|
|
19
19
|
/** Checks for the presence of malicious code in HTML fields */
|
|
20
|
-
|
|
20
|
+
sanitized_html?: SanitizedHtmlValidator;
|
|
21
21
|
};
|
|
22
22
|
export type TextFieldAppearance = {
|
|
23
23
|
editor: 'markdown';
|
|
@@ -7,15 +7,15 @@ export * from './file_size';
|
|
|
7
7
|
export * from './format';
|
|
8
8
|
export * from './image_aspect_ratio';
|
|
9
9
|
export * from './image_dimensions';
|
|
10
|
-
export * from './item_item_type';
|
|
11
10
|
export * from './items_item_type';
|
|
11
|
+
export * from './item_item_type';
|
|
12
12
|
export * from './length';
|
|
13
13
|
export * from './number_range';
|
|
14
14
|
export * from './required';
|
|
15
15
|
export * from './required_alt_title';
|
|
16
16
|
export * from './required_seo_fields';
|
|
17
17
|
export * from './rich_text_blocks';
|
|
18
|
-
export * from './
|
|
18
|
+
export * from './sanitized_html';
|
|
19
19
|
export * from './single_block_blocks';
|
|
20
20
|
export * from './size';
|
|
21
21
|
export * from './slug_format';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks for the presence of malicious code in HTML fields: content is valid if no dangerous code is present.
|
|
3
3
|
*/
|
|
4
|
-
export type
|
|
4
|
+
export type SanitizedHtmlValidator = {
|
|
5
5
|
/** Content is actively sanitized before applying the validation */
|
|
6
6
|
sanitize_before_validation: boolean;
|
|
7
7
|
};
|
|
@@ -2,13 +2,20 @@ import type { NewBlockInRequest } from '../fieldTypes';
|
|
|
2
2
|
import type * as ApiTypes from '../generated/ApiTypes';
|
|
3
3
|
import type { ItemTypeDefinition, ToItemAttributesInRequest } from './itemDefinition';
|
|
4
4
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
5
|
-
type
|
|
6
|
-
id?: ApiTypes.ItemIdentity;
|
|
5
|
+
type CreateBlockRecordSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
|
|
7
6
|
type?: ApiTypes.ItemType1;
|
|
8
7
|
item_type: ApiTypes.ItemTypeData<D>;
|
|
9
8
|
meta?: ApiTypes.ItemUpdateSchema['meta'];
|
|
10
9
|
creator?: ApiTypes.ItemUpdateSchema['creator'];
|
|
11
10
|
__itemTypeId?: D['itemTypeId'];
|
|
12
11
|
} & ToItemAttributesInRequest<D>;
|
|
13
|
-
|
|
12
|
+
type UpdateBlockRecordSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
|
|
13
|
+
id: ApiTypes.ItemIdentity;
|
|
14
|
+
type?: ApiTypes.ItemType1;
|
|
15
|
+
item_type?: ApiTypes.ItemTypeData<D>;
|
|
16
|
+
meta?: ApiTypes.ItemUpdateSchema['meta'];
|
|
17
|
+
creator?: ApiTypes.ItemUpdateSchema['creator'];
|
|
18
|
+
__itemTypeId?: D['itemTypeId'];
|
|
19
|
+
} & ToItemAttributesInRequest<D>;
|
|
20
|
+
export declare function buildBlockRecord<D extends ItemTypeDefinition = ItemTypeDefinition>(body: CreateBlockRecordSchema<NoInfer<D>> | UpdateBlockRecordSchema<NoInfer<D>>): NewBlockInRequest<NoInfer<D>>;
|
|
14
21
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datocms/cma-client",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.23",
|
|
4
4
|
"description": "JS client for DatoCMS REST Content Management API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"@datocms/dashboard-client": "^5.1.13",
|
|
46
46
|
"@types/uuid": "^9.0.7"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "8b78b9756e1b6a5828210ac62f0419254d1bf8ce"
|
|
49
49
|
}
|
|
@@ -79,7 +79,6 @@ export type NewBlockInRequest<
|
|
|
79
79
|
> = {
|
|
80
80
|
__itemTypeId?: D['itemTypeId'];
|
|
81
81
|
type: RawApiTypes.ItemType1;
|
|
82
|
-
id?: RawApiTypes.ItemIdentity;
|
|
83
82
|
relationships: RawApiTypes.ItemRelationships<D>;
|
|
84
83
|
meta?: RawApiTypes.ItemMeta;
|
|
85
84
|
attributes: ToItemAttributesInRequest<D>;
|
package/src/fieldTypes/slug.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
isLocalizedFieldValue,
|
|
4
4
|
} from '../utilities/normalizedFieldValues';
|
|
5
5
|
import type { SlugEditorConfiguration } from './appearance/slug';
|
|
6
|
+
import type { UniqueValidator } from './validators';
|
|
6
7
|
import type { LengthValidator } from './validators/length';
|
|
7
8
|
import type { RequiredValidator } from './validators/required';
|
|
8
9
|
import type { SlugFormatValidator } from './validators/slug_format';
|
|
@@ -26,6 +27,8 @@ export function isLocalizedSlugFieldValue(
|
|
|
26
27
|
export type SlugFieldValidators = {
|
|
27
28
|
/** Value must be specified or it won't be valid */
|
|
28
29
|
required?: RequiredValidator;
|
|
30
|
+
/** The value must be unique across the whole collection of records */
|
|
31
|
+
unique?: UniqueValidator;
|
|
29
32
|
/** Accept strings only with a specified number of characters */
|
|
30
33
|
length?: LengthValidator;
|
|
31
34
|
/** Only accept slugs having a specific format */
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
isItemWithOptionalIdAndMeta,
|
|
23
23
|
isItemWithOptionalMeta,
|
|
24
24
|
} from './single_block';
|
|
25
|
+
import type { RequiredValidator } from './validators';
|
|
25
26
|
import type { LengthValidator } from './validators/length';
|
|
26
27
|
import type { StructuredTextBlocksValidator } from './validators/structured_text_blocks';
|
|
27
28
|
import type { StructuredTextInlineBlocksValidator } from './validators/structured_text_inline_blocks';
|
|
@@ -266,6 +267,8 @@ export function isLocalizedStructuredTextFieldValueInNestedResponse<
|
|
|
266
267
|
}
|
|
267
268
|
|
|
268
269
|
export type StructuredTextFieldValidators = {
|
|
270
|
+
/** Value must be specified or it won't be valid */
|
|
271
|
+
required?: RequiredValidator;
|
|
269
272
|
/** Only accept references to block records of the specified block models */
|
|
270
273
|
structured_text_blocks: StructuredTextBlocksValidator;
|
|
271
274
|
/** Only accept itemLink to inlineItem nodes for records of the specified models */
|
package/src/fieldTypes/text.ts
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
import type { MarkdownEditorConfiguration } from './appearance/markdown';
|
|
6
6
|
import type { TextareaEditorConfiguration } from './appearance/textarea';
|
|
7
7
|
import type { WysiwygEditorConfiguration } from './appearance/wysiwyg';
|
|
8
|
+
import type { SanitizedHtmlValidator } from './validators';
|
|
8
9
|
import type { FormatValidator } from './validators/format';
|
|
9
10
|
import type { LengthValidator } from './validators/length';
|
|
10
11
|
import type { RequiredValidator } from './validators/required';
|
|
11
|
-
import type { SanitizationValidator } from './validators/sanitization';
|
|
12
12
|
|
|
13
13
|
export type TextFieldValue = string | null;
|
|
14
14
|
|
|
@@ -32,7 +32,7 @@ export type TextFieldValidators = {
|
|
|
32
32
|
/** Accepts only strings that match a specified format */
|
|
33
33
|
format?: FormatValidator;
|
|
34
34
|
/** Checks for the presence of malicious code in HTML fields */
|
|
35
|
-
|
|
35
|
+
sanitized_html?: SanitizedHtmlValidator;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export type TextFieldAppearance =
|
|
@@ -7,15 +7,15 @@ export * from './file_size';
|
|
|
7
7
|
export * from './format';
|
|
8
8
|
export * from './image_aspect_ratio';
|
|
9
9
|
export * from './image_dimensions';
|
|
10
|
-
export * from './item_item_type';
|
|
11
10
|
export * from './items_item_type';
|
|
11
|
+
export * from './item_item_type';
|
|
12
12
|
export * from './length';
|
|
13
13
|
export * from './number_range';
|
|
14
14
|
export * from './required';
|
|
15
15
|
export * from './required_alt_title';
|
|
16
16
|
export * from './required_seo_fields';
|
|
17
17
|
export * from './rich_text_blocks';
|
|
18
|
-
export * from './
|
|
18
|
+
export * from './sanitized_html';
|
|
19
19
|
export * from './single_block_blocks';
|
|
20
20
|
export * from './size';
|
|
21
21
|
export * from './slug_format';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks for the presence of malicious code in HTML fields: content is valid if no dangerous code is present.
|
|
3
3
|
*/
|
|
4
|
-
export type
|
|
4
|
+
export type SanitizedHtmlValidator = {
|
|
5
5
|
/** Content is actively sanitized before applying the validation */
|
|
6
6
|
sanitize_before_validation: boolean;
|
|
7
7
|
};
|
package/src/generated/Client.ts
CHANGED
|
@@ -147,7 +147,7 @@ export class Client {
|
|
|
147
147
|
...this.config,
|
|
148
148
|
...options,
|
|
149
149
|
logFn: this.config.logFn || console.log,
|
|
150
|
-
userAgent: '@datocms/cma-client v5.1.
|
|
150
|
+
userAgent: '@datocms/cma-client v5.1.23',
|
|
151
151
|
baseUrl: this.baseUrl,
|
|
152
152
|
preCallStack: new Error().stack,
|
|
153
153
|
extraHeaders: {
|
|
@@ -9,10 +9,9 @@ import type {
|
|
|
9
9
|
|
|
10
10
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
11
11
|
|
|
12
|
-
type
|
|
12
|
+
type CreateBlockRecordSchema<
|
|
13
13
|
D extends ItemTypeDefinition = ItemTypeDefinition,
|
|
14
14
|
> = {
|
|
15
|
-
id?: ApiTypes.ItemIdentity;
|
|
16
15
|
type?: ApiTypes.ItemType1;
|
|
17
16
|
item_type: ApiTypes.ItemTypeData<D>;
|
|
18
17
|
meta?: ApiTypes.ItemUpdateSchema['meta'];
|
|
@@ -20,10 +19,23 @@ type UpdateOrCreateBlockRecordSchema<
|
|
|
20
19
|
__itemTypeId?: D['itemTypeId'];
|
|
21
20
|
} & ToItemAttributesInRequest<D>;
|
|
22
21
|
|
|
22
|
+
type UpdateBlockRecordSchema<
|
|
23
|
+
D extends ItemTypeDefinition = ItemTypeDefinition,
|
|
24
|
+
> = {
|
|
25
|
+
id: ApiTypes.ItemIdentity;
|
|
26
|
+
type?: ApiTypes.ItemType1;
|
|
27
|
+
item_type?: ApiTypes.ItemTypeData<D>;
|
|
28
|
+
meta?: ApiTypes.ItemUpdateSchema['meta'];
|
|
29
|
+
creator?: ApiTypes.ItemUpdateSchema['creator'];
|
|
30
|
+
__itemTypeId?: D['itemTypeId'];
|
|
31
|
+
} & ToItemAttributesInRequest<D>;
|
|
32
|
+
|
|
23
33
|
export function buildBlockRecord<
|
|
24
34
|
D extends ItemTypeDefinition = ItemTypeDefinition,
|
|
25
35
|
>(
|
|
26
|
-
body:
|
|
36
|
+
body:
|
|
37
|
+
| CreateBlockRecordSchema<NoInfer<D>>
|
|
38
|
+
| UpdateBlockRecordSchema<NoInfer<D>>,
|
|
27
39
|
): NewBlockInRequest<NoInfer<D>> {
|
|
28
40
|
return Utils.serializeRequestBody<{
|
|
29
41
|
data: NewBlockInRequest<NoInfer<D>>;
|
|
@@ -42,9 +42,14 @@ export async function duplicateBlockRecord<
|
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
if ('id' in block) {
|
|
46
|
+
const { id, meta, ...blockWithoutIdAndMeta } = block;
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
return blockWithoutIdAndMeta as NewBlockInRequest;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const { meta, ...blockWithoutMeta } = block;
|
|
52
|
+
return blockWithoutMeta as NewBlockInRequest;
|
|
48
53
|
},
|
|
49
54
|
);
|
|
50
55
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitization.js","sourceRoot":"","sources":["../../../../src/fieldTypes/validators/sanitization.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitization.js","sourceRoot":"","sources":["../../../../src/fieldTypes/validators/sanitization.ts"],"names":[],"mappings":""}
|