@dosgato/templating 0.0.34 → 0.0.37

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.
@@ -181,9 +181,9 @@ export interface Migration<DataType, ExtraType> {
181
181
  up: (data: DataType, extras: ExtraType) => DataType | Promise<DataType>;
182
182
  down: (data: DataType, extras: ExtraType) => DataType | Promise<DataType>;
183
183
  }
184
- declare type ComponentMigration = Migration<ComponentData, ComponentExtras>;
185
- declare type PageMigration = Migration<PageData, PageExtras>;
186
- declare type DataMigration = Migration<DataData, DataExtras>;
184
+ export declare type ComponentMigration = Migration<ComponentData, ComponentExtras>;
185
+ export declare type PageMigration = Migration<PageData, PageExtras>;
186
+ export declare type DataMigration = Migration<DataData, DataExtras>;
187
187
  export declare type AnyMigration = ComponentMigration | PageMigration | DataMigration;
188
188
  export declare type LinkGatheringFn = (data: any) => LinkDefinition[];
189
189
  export declare type FulltextGatheringFn = (data: any) => string[];
@@ -192,12 +192,11 @@ export declare type GraphQLQueryFn = <T>(query: string, variables?: any) => Prom
192
192
  * This function is used by API template definitions to help them identify links inside large blocks
193
193
  * of text and return them for indexing.
194
194
  */
195
- export declare function extractLinksFromText(text: string): LinkDefinition[];
195
+ export declare function extractLinksFromText(text: string | undefined): LinkDefinition[];
196
196
  /**
197
197
  * This function is used by API template definitions to help them identify all the searchable
198
198
  * words in a large block of text and return them for indexing.
199
199
  */
200
- export declare function getKeywords(text: string, options?: {
200
+ export declare function getKeywords(text?: string, options?: {
201
201
  stopwords?: boolean;
202
202
  }): string[];
203
- export {};
@@ -10,6 +10,8 @@ export var ValidationMessageType;
10
10
  * of text and return them for indexing.
11
11
  */
12
12
  export function extractLinksFromText(text) {
13
+ if (!text)
14
+ return [];
13
15
  const matches = text.matchAll(/{.*"type"\s?:\s+"\w+".*?}/gi);
14
16
  return Array.from(matches).map(m => JSON.parse(m[0]));
15
17
  }
@@ -18,6 +20,8 @@ export function extractLinksFromText(text) {
18
20
  * words in a large block of text and return them for indexing.
19
21
  */
20
22
  export function getKeywords(text, options) {
23
+ if (!text)
24
+ return [];
21
25
  return Array.from(new Set(text
22
26
  .toLocaleLowerCase()
23
27
  .normalize('NFD').replace(/\p{Diacritic}/gu, '')
@@ -171,11 +171,11 @@ export interface ComponentData {
171
171
  areas?: Record<string, ComponentData[]>;
172
172
  }
173
173
  export interface PageData extends ComponentData {
174
- savedAtVersion: Date;
174
+ savedAtVersion: string;
175
175
  }
176
176
  export interface DataData {
177
177
  templateKey: string;
178
- savedAtVersion: Date;
178
+ savedAtVersion: string;
179
179
  }
180
180
  export interface ContextBase {
181
181
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.34",
3
+ "version": "0.0.37",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {