@nascentdigital/funnel-core 8.0.3 → 8.1.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/dist/schema/Meta.d.ts +15 -0
- package/dist/schema/Meta.js +24 -0
- package/dist/schema/Page.d.ts +7 -2
- package/dist/schema/Page.js +6 -5
- package/dist/schema/PageModel.js +12 -12
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class Meta {
|
|
2
|
+
readonly id: Meta.Id;
|
|
3
|
+
constructor(args: Meta.ConstructorArgs);
|
|
4
|
+
}
|
|
5
|
+
export declare namespace Meta {
|
|
6
|
+
type Id = 'no-index' | 'internal';
|
|
7
|
+
namespace Id {
|
|
8
|
+
const values: ReadonlyArray<Id>;
|
|
9
|
+
}
|
|
10
|
+
const NoIndex: Meta;
|
|
11
|
+
const Internal: Meta;
|
|
12
|
+
type ConstructorArgs = {
|
|
13
|
+
id: Id;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Meta = void 0;
|
|
4
|
+
// class
|
|
5
|
+
class Meta {
|
|
6
|
+
constructor(args) {
|
|
7
|
+
this.id = args.id;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.Meta = Meta;
|
|
11
|
+
// extension
|
|
12
|
+
(function (Meta) {
|
|
13
|
+
let Id;
|
|
14
|
+
(function (Id) {
|
|
15
|
+
Id.values = ['no-index', 'internal'];
|
|
16
|
+
})(Id = Meta.Id || (Meta.Id = {}));
|
|
17
|
+
// definitions
|
|
18
|
+
Meta.NoIndex = new Meta({
|
|
19
|
+
id: 'no-index',
|
|
20
|
+
});
|
|
21
|
+
Meta.Internal = new Meta({
|
|
22
|
+
id: 'internal',
|
|
23
|
+
});
|
|
24
|
+
})(Meta || (exports.Meta = Meta = {}));
|
package/dist/schema/Page.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { ChangeSet } from './ChangeSet';
|
|
|
7
7
|
import { Collection } from './Collection';
|
|
8
8
|
import { Field, ListField, ObjectField } from './field';
|
|
9
9
|
import { Fields } from './Fields';
|
|
10
|
+
import { Meta } from './Meta';
|
|
10
11
|
import { Optional } from './Optional';
|
|
11
12
|
import { PageRoute } from './PageRoute';
|
|
12
13
|
import type { PageSnapshot } from './PageSnapshot';
|
|
@@ -18,6 +19,7 @@ export declare class Page<TContent extends Page.Content = any, TPreview extends
|
|
|
18
19
|
private _type?;
|
|
19
20
|
readonly variant: Page.Variant;
|
|
20
21
|
readonly route: Localized.Maybe<PageRoute>;
|
|
22
|
+
readonly meta: ReadonlyArray<Meta>;
|
|
21
23
|
readonly tags: ReadonlyArray<TagGroup>;
|
|
22
24
|
readonly name: string;
|
|
23
25
|
readonly description?: string;
|
|
@@ -143,6 +145,7 @@ export declare namespace Page {
|
|
|
143
145
|
groupId: GroupId;
|
|
144
146
|
brand: string;
|
|
145
147
|
type: Type;
|
|
148
|
+
meta: Meta.Id[];
|
|
146
149
|
tags: TagGroup.Data;
|
|
147
150
|
slug?: string;
|
|
148
151
|
url: string;
|
|
@@ -168,6 +171,7 @@ export declare namespace Page {
|
|
|
168
171
|
groupId: GroupId;
|
|
169
172
|
brand: string;
|
|
170
173
|
type: Type;
|
|
174
|
+
meta: Meta.Id[];
|
|
171
175
|
tags: TagGroup.Data;
|
|
172
176
|
slug?: string;
|
|
173
177
|
url: string;
|
|
@@ -192,7 +196,7 @@ export declare namespace Page {
|
|
|
192
196
|
};
|
|
193
197
|
namespace Data {
|
|
194
198
|
namespace Props {
|
|
195
|
-
type Id = Extract<All, 'id' | 'groupId' | 'brand' | 'type' | 'tags' | 'region' | 'language' | 'slug' | 'url' | 'name'>;
|
|
199
|
+
type Id = Extract<All, 'id' | 'groupId' | 'brand' | 'type' | 'meta' | 'tags' | 'region' | 'language' | 'slug' | 'url' | 'name'>;
|
|
196
200
|
const id: ReadonlyArray<Id>;
|
|
197
201
|
type Content = Extract<All, 'discover' | 'preview' | 'content'>;
|
|
198
202
|
const content: ReadonlyArray<Content>;
|
|
@@ -258,7 +262,7 @@ export declare namespace Page {
|
|
|
258
262
|
namespace AsGroup {
|
|
259
263
|
type Instance<TPage extends Page = Page, TRegion extends string = string> = Pick<LegacyData<TPage, TRegion>, Instance.Prop>;
|
|
260
264
|
namespace Instance {
|
|
261
|
-
type Prop = Extract<Props.Id, 'id' | 'name' | 'region' | 'language' | 'url' | 'slug' | 'tags'> | Exclude<Props.Audit, 'publication'>;
|
|
265
|
+
type Prop = Extract<Props.Id, 'id' | 'name' | 'region' | 'language' | 'url' | 'slug' | 'meta' | 'tags'> | Exclude<Props.Audit, 'publication'>;
|
|
262
266
|
const props: ReadonlyArray<Prop>;
|
|
263
267
|
}
|
|
264
268
|
}
|
|
@@ -326,6 +330,7 @@ export declare namespace Page {
|
|
|
326
330
|
namespace ConstructorArgs {
|
|
327
331
|
type Base<TContent extends Content = Content, TPreview extends PreviewTarget<TContent> = PreviewTarget<TContent>> = {
|
|
328
332
|
route: Localized.Maybe<PageRoute>;
|
|
333
|
+
meta?: ReadonlyArray<Meta>;
|
|
329
334
|
tags?: ReadonlyArray<TagGroup>;
|
|
330
335
|
name: string;
|
|
331
336
|
description?: string;
|
package/dist/schema/Page.js
CHANGED
|
@@ -19,15 +19,16 @@ const Tag_1 = require("./Tag");
|
|
|
19
19
|
class Page {
|
|
20
20
|
// constructor
|
|
21
21
|
constructor(args) {
|
|
22
|
-
var _a, _b;
|
|
22
|
+
var _a, _b, _c;
|
|
23
23
|
// initialize common instance variables
|
|
24
24
|
this.variant = args.variant;
|
|
25
25
|
this.route = args.route;
|
|
26
|
-
this.
|
|
26
|
+
this.meta = (_a = args.meta) !== null && _a !== void 0 ? _a : [];
|
|
27
|
+
this.tags = (_b = args.tags) !== null && _b !== void 0 ? _b : [];
|
|
27
28
|
this.name = args.name;
|
|
28
29
|
this.description = args.description;
|
|
29
30
|
this.displayName = args.displayName;
|
|
30
|
-
this.optional = (
|
|
31
|
+
this.optional = (_c = args.optional) !== null && _c !== void 0 ? _c : false;
|
|
31
32
|
this.preview = args.preview;
|
|
32
33
|
this.content = args.content;
|
|
33
34
|
this.navigation = args.navigation;
|
|
@@ -92,7 +93,7 @@ exports.Page = Page;
|
|
|
92
93
|
// props (used to reduce risk of losing data across platform)
|
|
93
94
|
let Props;
|
|
94
95
|
(function (Props) {
|
|
95
|
-
Props.id = ['id', 'groupId', 'brand', 'type', 'tags', 'region', 'language', 'slug', 'url', 'name'];
|
|
96
|
+
Props.id = ['id', 'groupId', 'brand', 'type', 'meta', 'tags', 'region', 'language', 'slug', 'url', 'name'];
|
|
96
97
|
Props.content = ['discover', 'preview', 'content'];
|
|
97
98
|
Props.links = ['files', 'pages', 'collections'];
|
|
98
99
|
Props.audit = ['state', 'errors', 'changeSetId', 'snapshotId', 'createdOn', 'updatedOn', 'publishedOn', 'publication'];
|
|
@@ -173,7 +174,7 @@ exports.Page = Page;
|
|
|
173
174
|
let Instance;
|
|
174
175
|
(function (Instance) {
|
|
175
176
|
Instance.props = [
|
|
176
|
-
'id', 'name', 'region', 'language', 'url', 'slug', 'tags',
|
|
177
|
+
'id', 'name', 'region', 'language', 'url', 'slug', 'meta', 'tags',
|
|
177
178
|
...Props.audit.filter(prop => prop !== 'publication')
|
|
178
179
|
];
|
|
179
180
|
})(Instance = AsGroup.Instance || (AsGroup.Instance = {}));
|
package/dist/schema/PageModel.js
CHANGED
|
@@ -726,28 +726,28 @@ class PageModel {
|
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
728
|
findInBlock(block, context) {
|
|
729
|
-
var _a;
|
|
730
729
|
// return block content if there's no path
|
|
731
730
|
const { path, parentPath } = context;
|
|
732
|
-
if (path.length
|
|
733
|
-
|
|
731
|
+
if (path.length < 2) {
|
|
732
|
+
// warn if path length is one
|
|
733
|
+
if (path.length === 1) {
|
|
734
|
+
console.warn(`[PageChanges/findInBlock] path length should not be one`);
|
|
735
|
+
}
|
|
736
|
+
// otherwise debug
|
|
737
|
+
else {
|
|
738
|
+
console.debug(`[PageChanges/findInBlock] returning Block fields for: ${parentPath.join('.')}`);
|
|
739
|
+
}
|
|
740
|
+
// return block data
|
|
734
741
|
return block;
|
|
735
742
|
}
|
|
736
|
-
// fail if there's not at least 2 keys
|
|
737
|
-
else if (path.length < 2) {
|
|
738
|
-
console.warn(`[PageChanges/findInBlock] invalid path for block in "${block.id}/${parentPath.join('.')}"`, path);
|
|
739
|
-
return undefined;
|
|
740
|
-
}
|
|
741
743
|
// fail if we can't pull the bucket
|
|
742
744
|
const [bucket, key, ...remainingPath] = path;
|
|
743
|
-
if (bucket !== '
|
|
745
|
+
if (bucket !== 'fields') {
|
|
744
746
|
console.warn(`[PageChanges/findInBlock] unrecognized path component "${bucket}" in "${block.type}/${parentPath.join('.')}"`);
|
|
745
747
|
return undefined;
|
|
746
748
|
}
|
|
747
749
|
// resolve item (or bail if it's not there)
|
|
748
|
-
const blockValue =
|
|
749
|
-
? ((_a = block.config) !== null && _a !== void 0 ? _a : {})[key]
|
|
750
|
-
: block.fields[key];
|
|
750
|
+
const blockValue = block.fields[key];
|
|
751
751
|
if (!blockValue) {
|
|
752
752
|
console.warn(`[PageChanges/findInBlock] unable to resolve Block field "${bucket}/${key}" in "${block.type}/${parentPath.join('.')}"`);
|
|
753
753
|
return undefined;
|
package/dist/schema/index.d.ts
CHANGED
package/dist/schema/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __exportStar(require("./Form"), exports);
|
|
|
28
28
|
__exportStar(require("./LinkedCollectionModel"), exports);
|
|
29
29
|
__exportStar(require("./LinkedData"), exports);
|
|
30
30
|
__exportStar(require("./LinkedPage"), exports);
|
|
31
|
+
__exportStar(require("./Meta"), exports);
|
|
31
32
|
__exportStar(require("./Optional"), exports);
|
|
32
33
|
__exportStar(require("./Page"), exports);
|
|
33
34
|
__exportStar(require("./PageModel"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nascentdigital/funnel-core",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/nascentdigital/funnel.git",
|
|
6
6
|
"directory": "libs/core"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"jest-tsd": "^0.2.2",
|
|
66
66
|
"ts-jest": "^29.3.2"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "fdf586ac394c06b0ed2f08377c605e3fa317788a"
|
|
69
69
|
}
|