@platecms/delta-client 0.4.1 → 1.0.0
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 +304 -96
- package/package.json +2 -2
- package/src/__generated__/gql.d.ts +2 -298
- package/src/__generated__/gql.js +1 -149
- package/src/__generated__/gql.js.map +1 -1
- package/src/__generated__/graphql.d.ts +13 -4199
- package/src/__generated__/graphql.js +4 -153
- package/src/__generated__/graphql.js.map +1 -1
- package/src/schema/index.d.ts +14 -2
- package/src/schema/index.js +15 -5
- package/src/schema/index.js.map +1 -1
- package/src/schema/lib/schemas/array.d.ts +6 -0
- package/src/schema/lib/schemas/array.js +20 -0
- package/src/schema/lib/schemas/array.js.map +1 -0
- package/src/schema/lib/schemas/asset.d.ts +5 -0
- package/src/schema/lib/schemas/asset.js +14 -0
- package/src/schema/lib/schemas/asset.js.map +1 -0
- package/src/schema/lib/schemas/baseSchema.d.ts +10 -0
- package/src/schema/lib/schemas/baseSchema.js +36 -0
- package/src/schema/lib/schemas/baseSchema.js.map +1 -0
- package/src/schema/lib/schemas/boolean.d.ts +4 -0
- package/src/schema/lib/schemas/boolean.js +15 -0
- package/src/schema/lib/schemas/boolean.js.map +1 -0
- package/src/schema/lib/schemas/buildingBlock.d.ts +7 -0
- package/src/schema/lib/schemas/buildingBlock.js +26 -0
- package/src/schema/lib/schemas/buildingBlock.js.map +1 -0
- package/src/schema/lib/schemas/contentItem.d.ts +6 -0
- package/src/schema/lib/schemas/contentItem.js +26 -0
- package/src/schema/lib/schemas/contentItem.js.map +1 -0
- package/src/schema/lib/schemas/contentType.d.ts +5 -0
- package/src/schema/lib/schemas/contentType.js +14 -0
- package/src/schema/lib/schemas/contentType.js.map +1 -0
- package/src/schema/lib/schemas/date.d.ts +5 -0
- package/src/schema/lib/schemas/date.js +19 -0
- package/src/schema/lib/schemas/date.js.map +1 -0
- package/src/schema/lib/schemas/gridPlacement.d.ts +5 -0
- package/src/schema/lib/schemas/gridPlacement.js +14 -0
- package/src/schema/lib/schemas/gridPlacement.js.map +1 -0
- package/src/schema/lib/schemas/index.d.ts +55 -0
- package/src/schema/lib/schemas/index.js +33 -0
- package/src/schema/lib/schemas/index.js.map +1 -0
- package/src/schema/lib/schemas/number.d.ts +4 -0
- package/src/schema/lib/schemas/number.js +15 -0
- package/src/schema/lib/schemas/number.js.map +1 -0
- package/src/schema/lib/schemas/pathPart.d.ts +5 -0
- package/src/schema/lib/schemas/pathPart.js +14 -0
- package/src/schema/lib/schemas/pathPart.js.map +1 -0
- package/src/schema/lib/schemas/smartText.d.ts +5 -0
- package/src/schema/lib/schemas/smartText.js +14 -0
- package/src/schema/lib/schemas/smartText.js.map +1 -0
- package/src/schema/lib/schemas/string.d.ts +4 -0
- package/src/schema/lib/schemas/string.js +15 -0
- package/src/schema/lib/schemas/string.js.map +1 -0
- package/src/schema/lib/schemas/tag.d.ts +5 -0
- package/src/schema/lib/schemas/tag.js +14 -0
- package/src/schema/lib/schemas/tag.js.map +1 -0
- package/src/schema/lib/utils/isContentValue.d.ts +2 -0
- package/src/schema/lib/utils/isContentValue.js +17 -0
- package/src/schema/lib/utils/isContentValue.js.map +1 -0
- package/src/schema/lib/utils/isPrimitiveValue.d.ts +5 -0
- package/src/schema/lib/utils/isPrimitiveValue.js +8 -0
- package/src/schema/lib/utils/isPrimitiveValue.js.map +1 -0
- package/src/schema/lib/nodes.d.ts +0 -46
- package/src/schema/lib/nodes.js +0 -14
- package/src/schema/lib/nodes.js.map +0 -1
- package/src/schema/lib/parser.d.ts +0 -12
- package/src/schema/lib/parser.js +0 -49
- package/src/schema/lib/parser.js.map +0 -1
- package/src/schema/lib/schema.d.ts +0 -17
- package/src/schema/lib/schema.js +0 -65
- package/src/schema/lib/schema.js.map +0 -1
- package/src/schema/lib/utils.d.ts +0 -12
- package/src/schema/lib/utils.js +0 -66
- package/src/schema/lib/utils.js.map +0 -1
package/src/schema/index.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from "./lib/schemas";
|
|
2
|
+
export * from "./lib/schemas/contentItem";
|
|
3
|
+
export * from "./lib/schemas/buildingBlock";
|
|
4
|
+
export * from "./lib/schemas/array";
|
|
5
|
+
export * from "./lib/schemas/string";
|
|
6
|
+
export * from "./lib/schemas/number";
|
|
7
|
+
export * from "./lib/schemas/boolean";
|
|
8
|
+
export * from "./lib/schemas/date";
|
|
9
|
+
export * from "./lib/schemas/asset";
|
|
10
|
+
export * from "./lib/schemas/smartText";
|
|
11
|
+
export * from "./lib/schemas/gridPlacement";
|
|
12
|
+
export * from "./lib/schemas/contentType";
|
|
13
|
+
export * from "./lib/schemas/pathPart";
|
|
14
|
+
export * from "./lib/schemas/tag";
|
package/src/schema/index.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/schemas"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./lib/schemas/contentItem"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/schemas/buildingBlock"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lib/schemas/array"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib/schemas/string"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./lib/schemas/number"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./lib/schemas/boolean"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./lib/schemas/date"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./lib/schemas/asset"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./lib/schemas/smartText"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./lib/schemas/gridPlacement"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./lib/schemas/contentType"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./lib/schemas/pathPart"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./lib/schemas/tag"), exports);
|
|
8
18
|
//# sourceMappingURL=index.js.map
|
package/src/schema/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/delta-client/src/schema/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/delta-client/src/schema/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAE9B,oEAA0C;AAC1C,sEAA4C;AAC5C,8DAAoC;AAEpC,+DAAqC;AACrC,+DAAqC;AACrC,gEAAsC;AACtC,6DAAmC;AACnC,8DAAoC;AACpC,kEAAwC;AACxC,sEAA4C;AAC5C,oEAA0C;AAC1C,iEAAuC;AACvC,4DAAkC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Schema, SchemaConfig } from ".";
|
|
2
|
+
export declare class ArraySchema<T extends Schema | Schema[]> implements Schema<T extends Schema[] ? T[number]["parse"][] : T extends Schema ? T["parse"][] : never, unknown> {
|
|
3
|
+
private readonly structure;
|
|
4
|
+
constructor(structure: T);
|
|
5
|
+
parse(data: unknown, config?: SchemaConfig): T extends Schema[] ? T[number]["parse"][] : T extends Schema ? T["parse"][] : never;
|
|
6
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArraySchema = void 0;
|
|
4
|
+
class ArraySchema {
|
|
5
|
+
constructor(structure) {
|
|
6
|
+
this.structure = structure;
|
|
7
|
+
}
|
|
8
|
+
parse(data, config) {
|
|
9
|
+
if (Array.isArray(data)) {
|
|
10
|
+
return data.map((item) => {
|
|
11
|
+
const structures = Array.isArray(this.structure) ? this.structure : [this.structure];
|
|
12
|
+
const results = structures.map((schema) => schema.parse(item, config));
|
|
13
|
+
return results.find((result) => result !== null) ?? results[0];
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ArraySchema = ArraySchema;
|
|
20
|
+
//# sourceMappingURL=array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/array.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IAGtB,YAAoC,SAAY;QAAZ,cAAS,GAAT,SAAS,CAAG;IAAG,CAAC;IAE7C,KAAK,CACV,IAAa,EACb,MAAqB;QAErB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACvB,MAAM,UAAU,GAAa,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAC/F,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;gBAEvE,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;YACjE,CAAC,CAAwF,CAAC;QAC5F,CAAC;QAED,OAAO,EAAoG,CAAC;IAC9G,CAAC;CACF;AApBD,kCAoBC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssetSchema = void 0;
|
|
4
|
+
const baseSchema_1 = require("./baseSchema");
|
|
5
|
+
class AssetSchema extends baseSchema_1.BaseSchema {
|
|
6
|
+
findValue(data) {
|
|
7
|
+
if (typeof data === "object" && data !== null && "linkedAsset" in data) {
|
|
8
|
+
return data.linkedAsset;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AssetSchema = AssetSchema;
|
|
14
|
+
//# sourceMappingURL=asset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/asset.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAE1C,MAAa,WAAY,SAAQ,uBAAiC;IAC7C,SAAS,CAAC,IAAa;QACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,aAAa,IAAI,IAAI,EAAE,CAAC;YACvE,OAAQ,IAA+B,CAAC,WAAW,CAAC;QACtD,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AARD,kCAQC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ResultType, Schema, SchemaConfig } from ".";
|
|
2
|
+
export declare abstract class BaseSchema<TResult extends ResultType, TData> implements Schema<TResult, TData> {
|
|
3
|
+
protected _isNullable: boolean;
|
|
4
|
+
protected _placeholder: TResult | null;
|
|
5
|
+
nullable(value?: boolean): this;
|
|
6
|
+
placeholder(placeholder: Partial<TResult>): this;
|
|
7
|
+
parse(data: TData | TData[], config?: SchemaConfig): TResult | null;
|
|
8
|
+
private findIndex;
|
|
9
|
+
protected abstract findValue(data: TData): TResult | null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseSchema = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
class BaseSchema {
|
|
6
|
+
constructor() {
|
|
7
|
+
this._isNullable = true;
|
|
8
|
+
this._placeholder = null;
|
|
9
|
+
}
|
|
10
|
+
nullable(value = false) {
|
|
11
|
+
this._isNullable = value;
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
placeholder(placeholder) {
|
|
15
|
+
this._placeholder = placeholder;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
parse(data, config) {
|
|
19
|
+
if ((0, lodash_1.isArray)(data)) {
|
|
20
|
+
data = data[this.findIndex(data)];
|
|
21
|
+
}
|
|
22
|
+
if (this.findValue(data) !== null) {
|
|
23
|
+
return this.findValue(data);
|
|
24
|
+
}
|
|
25
|
+
if (!this._isNullable) {
|
|
26
|
+
throw new Error("Data could not be found and is not nullable");
|
|
27
|
+
}
|
|
28
|
+
return config?.placeholders === true ? this._placeholder : null;
|
|
29
|
+
}
|
|
30
|
+
findIndex(data) {
|
|
31
|
+
const index = data.findIndex((item) => this.findValue(item) !== null);
|
|
32
|
+
return index !== -1 ? index : 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.BaseSchema = BaseSchema;
|
|
36
|
+
//# sourceMappingURL=baseSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseSchema.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/baseSchema.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AAGjC,MAAsB,UAAU;IAAhC;QACY,gBAAW,GAAG,IAAI,CAAC;QACnB,iBAAY,GAAmB,IAAI,CAAC;IAoChD,CAAC;IAlCQ,QAAQ,CAAC,QAAiB,KAAK;QACpC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,WAAW,CAAC,WAA6B;QAC9C,IAAI,CAAC,YAAY,GAAG,WAAsB,CAAC;QAE3C,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,IAAqB,EAAE,MAAqB;QACvD,IAAI,IAAA,gBAAO,EAAC,IAAI,CAAC,EAAE,CAAC;YAClB,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QAED,OAAO,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;IAClE,CAAC;IAEO,SAAS,CAAC,IAAa;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QACtE,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;CAGF;AAtCD,gCAsCC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BooleanSchema = void 0;
|
|
4
|
+
const baseSchema_1 = require("./baseSchema");
|
|
5
|
+
const isPrimitiveValue_1 = require("../utils/isPrimitiveValue");
|
|
6
|
+
class BooleanSchema extends baseSchema_1.BaseSchema {
|
|
7
|
+
findValue(data) {
|
|
8
|
+
if ((0, isPrimitiveValue_1.isPrimitiveValue)(data) && typeof data.primitiveValue === "boolean") {
|
|
9
|
+
return data.primitiveValue;
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.BooleanSchema = BooleanSchema;
|
|
15
|
+
//# sourceMappingURL=boolean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/boolean.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,gEAA6D;AAE7D,MAAa,aAAc,SAAQ,uBAA4B;IAC1C,SAAS,CAAC,IAAa;QACxC,IAAI,IAAA,mCAAgB,EAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;YACvE,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AARD,sCAQC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BuildingBlockFieldFulfillment } from "../../../__generated__/graphql";
|
|
2
|
+
import { ObjectSchema, Schema, SchemaConfig } from ".";
|
|
3
|
+
export declare class BuildingBlockSchema<T extends Record<string, Schema | Schema[]>> implements Schema<ObjectSchema<T>, BuildingBlockFieldFulfillment> {
|
|
4
|
+
private readonly structure;
|
|
5
|
+
constructor(structure: T);
|
|
6
|
+
parse(data: BuildingBlockFieldFulfillment | BuildingBlockFieldFulfillment[], config?: SchemaConfig): ObjectSchema<T>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildingBlockSchema = void 0;
|
|
4
|
+
class BuildingBlockSchema {
|
|
5
|
+
constructor(structure) {
|
|
6
|
+
this.structure = structure;
|
|
7
|
+
}
|
|
8
|
+
parse(data, config) {
|
|
9
|
+
if (!Array.isArray(data)) {
|
|
10
|
+
data = [data];
|
|
11
|
+
}
|
|
12
|
+
const result = {};
|
|
13
|
+
for (const [key, schemaOrSchemas] of Object.entries(this.structure)) {
|
|
14
|
+
const valuesForField = data
|
|
15
|
+
.filter((item) => item.buildingBlockField.slug === key)
|
|
16
|
+
.map((item) => item.contentValue);
|
|
17
|
+
const schemas = Array.isArray(schemaOrSchemas) ? schemaOrSchemas : [schemaOrSchemas];
|
|
18
|
+
const parsedValues = schemas.map((schema) => schema.parse(valuesForField, config));
|
|
19
|
+
result[key] = (parsedValues.find((parsedValue) => parsedValue !== null) ??
|
|
20
|
+
null);
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.BuildingBlockSchema = BuildingBlockSchema;
|
|
26
|
+
//# sourceMappingURL=buildingBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildingBlock.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/buildingBlock.ts"],"names":[],"mappings":";;;AAGA,MAAa,mBAAmB;IAG9B,YAAoC,SAAY;QAAZ,cAAS,GAAT,SAAS,CAAG;IAAG,CAAC;IAE7C,KAAK,CACV,IAAqE,EACrE,MAAqB;QAErB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC;QAED,MAAM,MAAM,GAAG,EAAgC,CAAC;QAEhD,KAAK,MAAM,CAAC,GAAG,EAAE,eAAe,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACpE,MAAM,cAAc,GAAG,IAAI;iBACxB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,KAAK,GAAG,CAAC;iBACtD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAEpC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;YACrF,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;YAEnF,MAAM,CAAC,GAAc,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,KAAK,IAAI,CAAC;gBAChF,IAAI,CAA6B,CAAC;QACtC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA7BD,kDA6BC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ObjectSchema, Schema, SchemaConfig } from ".";
|
|
2
|
+
export declare class ContentItemSchema<T extends Record<string, Schema | Schema[]>> implements Schema<ObjectSchema<T>, unknown> {
|
|
3
|
+
private readonly structure;
|
|
4
|
+
constructor(structure: T);
|
|
5
|
+
parse(data: unknown, config?: SchemaConfig): ObjectSchema<T> | null;
|
|
6
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentItemSchema = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const isContentValue_1 = require("../utils/isContentValue");
|
|
6
|
+
class ContentItemSchema {
|
|
7
|
+
constructor(structure) {
|
|
8
|
+
this.structure = structure;
|
|
9
|
+
}
|
|
10
|
+
parse(data, config) {
|
|
11
|
+
if ((0, lodash_1.isArray)(data)) {
|
|
12
|
+
data = data[0];
|
|
13
|
+
}
|
|
14
|
+
return Object.entries(this.structure).reduce((acc, [key, value]) => {
|
|
15
|
+
const relatedContentItem = (0, isContentValue_1.isContentValue)(data) ? data.relatedContentItem : null;
|
|
16
|
+
const contentValuesForKey = relatedContentItem?.contentValues.filter((contentValue) => contentValue.contentField?.name === key) ?? [];
|
|
17
|
+
const shapes = Array.isArray(value) ? value : [value];
|
|
18
|
+
const parsedValues = shapes.map((shape) => shape.parse(contentValuesForKey, config));
|
|
19
|
+
acc[key] = (parsedValues.find((parsedValue) => parsedValue !== null) ??
|
|
20
|
+
null);
|
|
21
|
+
return acc;
|
|
22
|
+
}, {});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ContentItemSchema = ContentItemSchema;
|
|
26
|
+
//# sourceMappingURL=contentItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentItem.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/contentItem.ts"],"names":[],"mappings":";;;AACA,mCAAiC;AACjC,4DAAyD;AAEzD,MAAa,iBAAiB;IAG5B,YAAoC,SAAY;QAAZ,cAAS,GAAT,SAAS,CAAG;IAAG,CAAC;IAE7C,KAAK,CAAC,IAAa,EAAE,MAAqB;QAC/C,IAAI,IAAA,gBAAO,EAAC,IAAI,CAAC,EAAE,CAAC;YAClB,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAC1C,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACpB,MAAM,kBAAkB,GAAG,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC;YAEjF,MAAM,mBAAmB,GACvB,kBAAkB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;YAC5G,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACtD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC;YAErF,GAAG,CAAC,GAAc,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,KAAK,IAAI,CAAC;gBAC7E,IAAI,CAA6B,CAAC;YACpC,OAAO,GAAG,CAAC;QACb,CAAC,EACD,EAAgC,CACjC,CAAC;IACJ,CAAC;CACF;AA1BD,8CA0BC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentTypeSchema = void 0;
|
|
4
|
+
const baseSchema_1 = require("./baseSchema");
|
|
5
|
+
class ContentTypeSchema extends baseSchema_1.BaseSchema {
|
|
6
|
+
findValue(data) {
|
|
7
|
+
if (typeof data === "object" && data !== null && "linkedContentType" in data) {
|
|
8
|
+
return data.linkedContentType;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ContentTypeSchema = ContentTypeSchema;
|
|
14
|
+
//# sourceMappingURL=contentType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentType.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/contentType.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAE1C,MAAa,iBAAkB,SAAQ,uBAAuC;IACzD,SAAS,CAAC,IAAa;QACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,mBAAmB,IAAI,IAAI,EAAE,CAAC;YAC7E,OAAQ,IAA2C,CAAC,iBAAiB,CAAC;QACxE,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AARD,8CAQC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DateSchema = void 0;
|
|
4
|
+
const baseSchema_1 = require("./baseSchema");
|
|
5
|
+
const isPrimitiveValue_1 = require("../utils/isPrimitiveValue");
|
|
6
|
+
class DateSchema extends baseSchema_1.BaseSchema {
|
|
7
|
+
placeholderFromString(date) {
|
|
8
|
+
this._placeholder = new Date(date);
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
findValue(data) {
|
|
12
|
+
if ((0, isPrimitiveValue_1.isPrimitiveValue)(data) && typeof data.primitiveValue === "string") {
|
|
13
|
+
return new Date(data.primitiveValue);
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.DateSchema = DateSchema;
|
|
19
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/date.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,gEAA6D;AAE7D,MAAa,UAAW,SAAQ,uBAAgC;IACvD,qBAAqB,CAAC,IAAY;QACvC,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAEkB,SAAS,CAAC,IAAa;QACxC,IAAI,IAAA,mCAAgB,EAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;YACtE,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAbD,gCAaC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridPlacementSchema = void 0;
|
|
4
|
+
const baseSchema_1 = require("./baseSchema");
|
|
5
|
+
class GridPlacementSchema extends baseSchema_1.BaseSchema {
|
|
6
|
+
findValue(data) {
|
|
7
|
+
if (typeof data === "object" && data !== null && "gridPlacement" in data) {
|
|
8
|
+
return data.gridPlacement;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.GridPlacementSchema = GridPlacementSchema;
|
|
14
|
+
//# sourceMappingURL=gridPlacement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridPlacement.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/gridPlacement.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAE1C,MAAa,mBAAoB,SAAQ,uBAAyC;IAC7D,SAAS,CAAC,IAAa;QACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,eAAe,IAAI,IAAI,EAAE,CAAC;YACzE,OAAQ,IAAyC,CAAC,aAAa,CAAC;QAClE,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AARD,kDAQC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { StringSchema } from "./string";
|
|
2
|
+
import { ContentItemSchema } from "./contentItem";
|
|
3
|
+
import { ArraySchema } from "./array";
|
|
4
|
+
import { BuildingBlockSchema } from "./buildingBlock";
|
|
5
|
+
import { NumberSchema } from "./number";
|
|
6
|
+
import { BooleanSchema } from "./boolean";
|
|
7
|
+
import { DateSchema } from "./date";
|
|
8
|
+
import { AssetSchema } from "./asset";
|
|
9
|
+
import { SmartTextSchema } from "./smartText";
|
|
10
|
+
import { GridPlacementSchema } from "./gridPlacement";
|
|
11
|
+
import { PathPartSchema } from "./pathPart";
|
|
12
|
+
import { TagSchema } from "./tag";
|
|
13
|
+
import { ContentTypeSchema } from "./contentType";
|
|
14
|
+
import { Asset, ContentType, GridPlacement, PathPart, Tag } from "../../../__generated__/graphql";
|
|
15
|
+
import { Root } from "@platecms/delta-cast";
|
|
16
|
+
export type ResultType = Asset | ContentType | Date | GridPlacement | PathPart | Root | Tag | boolean | number | string | null;
|
|
17
|
+
export interface Schema<TResult = unknown, TData = unknown> {
|
|
18
|
+
parse: (data: TData | TData[], config?: SchemaConfig) => TResult | null;
|
|
19
|
+
}
|
|
20
|
+
export type ObjectSchema<T extends Record<string, Schema | Schema[]>> = {
|
|
21
|
+
[key in keyof T]: T[key] extends Schema[] ? ReturnType<T[key][number]["parse"]> | null : T[key] extends Schema ? ReturnType<T[key]["parse"]> | null : never;
|
|
22
|
+
};
|
|
23
|
+
export interface SchemaConfig {
|
|
24
|
+
placeholders?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const schema: {
|
|
27
|
+
buildingBlock: <T extends Record<string, Schema | Schema[]>>(structure: T) => BuildingBlockSchema<T>;
|
|
28
|
+
contentItem: <T extends Record<string, Schema | Schema[]>>(structure: T) => ContentItemSchema<T>;
|
|
29
|
+
array: <T extends Schema>(structure: T) => ArraySchema<T>;
|
|
30
|
+
string: () => StringSchema;
|
|
31
|
+
number: () => NumberSchema;
|
|
32
|
+
boolean: () => BooleanSchema;
|
|
33
|
+
date: () => DateSchema;
|
|
34
|
+
asset: () => AssetSchema;
|
|
35
|
+
smartText: () => SmartTextSchema;
|
|
36
|
+
gridPlacement: () => GridPlacementSchema;
|
|
37
|
+
contentType: () => ContentTypeSchema;
|
|
38
|
+
pathPart: () => PathPartSchema;
|
|
39
|
+
tag: () => TagSchema;
|
|
40
|
+
};
|
|
41
|
+
export declare const s: {
|
|
42
|
+
buildingBlock: <T extends Record<string, Schema | Schema[]>>(structure: T) => BuildingBlockSchema<T>;
|
|
43
|
+
contentItem: <T extends Record<string, Schema | Schema[]>>(structure: T) => ContentItemSchema<T>;
|
|
44
|
+
array: <T extends Schema>(structure: T) => ArraySchema<T>;
|
|
45
|
+
string: () => StringSchema;
|
|
46
|
+
number: () => NumberSchema;
|
|
47
|
+
boolean: () => BooleanSchema;
|
|
48
|
+
date: () => DateSchema;
|
|
49
|
+
asset: () => AssetSchema;
|
|
50
|
+
smartText: () => SmartTextSchema;
|
|
51
|
+
gridPlacement: () => GridPlacementSchema;
|
|
52
|
+
contentType: () => ContentTypeSchema;
|
|
53
|
+
pathPart: () => PathPartSchema;
|
|
54
|
+
tag: () => TagSchema;
|
|
55
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.s = exports.schema = void 0;
|
|
4
|
+
const string_1 = require("./string");
|
|
5
|
+
const contentItem_1 = require("./contentItem");
|
|
6
|
+
const array_1 = require("./array");
|
|
7
|
+
const buildingBlock_1 = require("./buildingBlock");
|
|
8
|
+
const number_1 = require("./number");
|
|
9
|
+
const boolean_1 = require("./boolean");
|
|
10
|
+
const date_1 = require("./date");
|
|
11
|
+
const asset_1 = require("./asset");
|
|
12
|
+
const smartText_1 = require("./smartText");
|
|
13
|
+
const gridPlacement_1 = require("./gridPlacement");
|
|
14
|
+
const pathPart_1 = require("./pathPart");
|
|
15
|
+
const tag_1 = require("./tag");
|
|
16
|
+
const contentType_1 = require("./contentType");
|
|
17
|
+
exports.schema = {
|
|
18
|
+
buildingBlock: (structure) => new buildingBlock_1.BuildingBlockSchema(structure),
|
|
19
|
+
contentItem: (structure) => new contentItem_1.ContentItemSchema(structure),
|
|
20
|
+
array: (structure) => new array_1.ArraySchema(structure),
|
|
21
|
+
string: () => new string_1.StringSchema(),
|
|
22
|
+
number: () => new number_1.NumberSchema(),
|
|
23
|
+
boolean: () => new boolean_1.BooleanSchema(),
|
|
24
|
+
date: () => new date_1.DateSchema(),
|
|
25
|
+
asset: () => new asset_1.AssetSchema(),
|
|
26
|
+
smartText: () => new smartText_1.SmartTextSchema(),
|
|
27
|
+
gridPlacement: () => new gridPlacement_1.GridPlacementSchema(),
|
|
28
|
+
contentType: () => new contentType_1.ContentTypeSchema(),
|
|
29
|
+
pathPart: () => new pathPart_1.PathPartSchema(),
|
|
30
|
+
tag: () => new tag_1.TagSchema(),
|
|
31
|
+
};
|
|
32
|
+
exports.s = exports.schema;
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/index.ts"],"names":[],"mappings":";;;AAAA,qCAAwC;AACxC,+CAAkD;AAClD,mCAAsC;AACtC,mDAAsD;AACtD,qCAAwC;AACxC,uCAA0C;AAC1C,iCAAoC;AACpC,mCAAsC;AACtC,2CAA8C;AAC9C,mDAAsD;AACtD,yCAA4C;AAC5C,+BAAkC;AAClC,+CAAkD;AAkCrC,QAAA,MAAM,GAAG;IACpB,aAAa,EAAE,CAA8C,SAAY,EAA0B,EAAE,CACnG,IAAI,mCAAmB,CAAC,SAAS,CAAC;IACpC,WAAW,EAAE,CAA8C,SAAY,EAAwB,EAAE,CAC/F,IAAI,+BAAiB,CAAC,SAAS,CAAC;IAClC,KAAK,EAAE,CAAmB,SAAY,EAAkB,EAAE,CAAC,IAAI,mBAAW,CAAC,SAAS,CAAC;IACrF,MAAM,EAAE,GAAiB,EAAE,CAAC,IAAI,qBAAY,EAAE;IAC9C,MAAM,EAAE,GAAiB,EAAE,CAAC,IAAI,qBAAY,EAAE;IAC9C,OAAO,EAAE,GAAkB,EAAE,CAAC,IAAI,uBAAa,EAAE;IACjD,IAAI,EAAE,GAAe,EAAE,CAAC,IAAI,iBAAU,EAAE;IACxC,KAAK,EAAE,GAAgB,EAAE,CAAC,IAAI,mBAAW,EAAE;IAC3C,SAAS,EAAE,GAAoB,EAAE,CAAC,IAAI,2BAAe,EAAE;IACvD,aAAa,EAAE,GAAwB,EAAE,CAAC,IAAI,mCAAmB,EAAE;IACnE,WAAW,EAAE,GAAsB,EAAE,CAAC,IAAI,+BAAiB,EAAE;IAC7D,QAAQ,EAAE,GAAmB,EAAE,CAAC,IAAI,yBAAc,EAAE;IACpD,GAAG,EAAE,GAAc,EAAE,CAAC,IAAI,eAAS,EAAE;CACtC,CAAC;AAGW,QAAA,CAAC,GAAG,cAAM,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberSchema = void 0;
|
|
4
|
+
const baseSchema_1 = require("./baseSchema");
|
|
5
|
+
const isPrimitiveValue_1 = require("../utils/isPrimitiveValue");
|
|
6
|
+
class NumberSchema extends baseSchema_1.BaseSchema {
|
|
7
|
+
findValue(data) {
|
|
8
|
+
if ((0, isPrimitiveValue_1.isPrimitiveValue)(data) && typeof data.primitiveValue === "number") {
|
|
9
|
+
return data.primitiveValue;
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.NumberSchema = NumberSchema;
|
|
15
|
+
//# sourceMappingURL=number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/number.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,gEAA6D;AAE7D,MAAa,YAAa,SAAQ,uBAAkC;IAC/C,SAAS,CAAC,IAAa;QACxC,IAAI,IAAA,mCAAgB,EAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;YACtE,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AARD,oCAQC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PathPartSchema = void 0;
|
|
4
|
+
const baseSchema_1 = require("./baseSchema");
|
|
5
|
+
class PathPartSchema extends baseSchema_1.BaseSchema {
|
|
6
|
+
findValue(data) {
|
|
7
|
+
if (typeof data === "object" && data !== null && "pathPart" in data) {
|
|
8
|
+
return data.pathPart;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.PathPartSchema = PathPartSchema;
|
|
14
|
+
//# sourceMappingURL=pathPart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathPart.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/pathPart.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAE1C,MAAa,cAAe,SAAQ,uBAAoC;IACnD,SAAS,CAAC,IAAa;QACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;YACpE,OAAQ,IAA+B,CAAC,QAAQ,CAAC;QACnD,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AARD,wCAQC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmartTextSchema = void 0;
|
|
4
|
+
const baseSchema_1 = require("./baseSchema");
|
|
5
|
+
class SmartTextSchema extends baseSchema_1.BaseSchema {
|
|
6
|
+
findValue(data) {
|
|
7
|
+
if (typeof data === "object" && data !== null && "interpolatedSmartText" in data) {
|
|
8
|
+
return data.interpolatedSmartText;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.SmartTextSchema = SmartTextSchema;
|
|
14
|
+
//# sourceMappingURL=smartText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smartText.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/smartText.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAE1C,MAAa,eAAgB,SAAQ,uBAAqC;IACrD,SAAS,CAAC,IAAa;QACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,uBAAuB,IAAI,IAAI,EAAE,CAAC;YACjF,OAAQ,IAA6C,CAAC,qBAAqB,CAAC;QAC9E,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AARD,0CAQC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringSchema = void 0;
|
|
4
|
+
const baseSchema_1 = require("./baseSchema");
|
|
5
|
+
const isPrimitiveValue_1 = require("../utils/isPrimitiveValue");
|
|
6
|
+
class StringSchema extends baseSchema_1.BaseSchema {
|
|
7
|
+
findValue(data) {
|
|
8
|
+
if ((0, isPrimitiveValue_1.isPrimitiveValue)(data) && typeof data.primitiveValue === "string") {
|
|
9
|
+
return data.primitiveValue;
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.StringSchema = StringSchema;
|
|
15
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/string.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,gEAA6D;AAE7D,MAAa,YAAa,SAAQ,uBAAkC;IAC/C,SAAS,CAAC,IAAa;QACxC,IAAI,IAAA,mCAAgB,EAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;YACtE,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AARD,oCAQC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TagSchema = void 0;
|
|
4
|
+
const baseSchema_1 = require("./baseSchema");
|
|
5
|
+
class TagSchema extends baseSchema_1.BaseSchema {
|
|
6
|
+
findValue(data) {
|
|
7
|
+
if (typeof data === "object" && data !== null && "linkedTag" in data) {
|
|
8
|
+
return data.linkedTag;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.TagSchema = TagSchema;
|
|
14
|
+
//# sourceMappingURL=tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/schemas/tag.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAE1C,MAAa,SAAU,SAAQ,uBAA+B;IACzC,SAAS,CAAC,IAAa;QACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;YACrE,OAAQ,IAA2B,CAAC,SAAS,CAAC;QAChD,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AARD,8BAQC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isContentValue = isContentValue;
|
|
4
|
+
function isContentValue(data) {
|
|
5
|
+
return (data !== null &&
|
|
6
|
+
typeof data === "object" &&
|
|
7
|
+
("primitiveValue" in data ||
|
|
8
|
+
"relatedAsset" in data ||
|
|
9
|
+
"linkedContentType" in data ||
|
|
10
|
+
"linkedGridPlacement" in data ||
|
|
11
|
+
"linkedPathPart" in data ||
|
|
12
|
+
"linkedTag" in data ||
|
|
13
|
+
"relatedContentItem" in data ||
|
|
14
|
+
"smartText" in data ||
|
|
15
|
+
"interpolatedSmartText" in data));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=isContentValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isContentValue.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/schema/lib/utils/isContentValue.ts"],"names":[],"mappings":";;AAEA,wCAcC;AAdD,SAAgB,cAAc,CAAC,IAAa;IAC1C,OAAO,CACL,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,KAAK,QAAQ;QACxB,CAAC,gBAAgB,IAAI,IAAI;YACvB,cAAc,IAAI,IAAI;YACtB,mBAAmB,IAAI,IAAI;YAC3B,qBAAqB,IAAI,IAAI;YAC7B,gBAAgB,IAAI,IAAI;YACxB,WAAW,IAAI,IAAI;YACnB,oBAAoB,IAAI,IAAI;YAC5B,WAAW,IAAI,IAAI;YACnB,uBAAuB,IAAI,IAAI,CAAC,CACnC,CAAC;AACJ,CAAC"}
|