@dosgato/templating 0.0.48 → 0.0.51

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.
@@ -20,10 +20,10 @@ export interface ValidationFeedback {
20
20
  export interface PageExtras {
21
21
  /** A function for executing a graphql query to acquire more information than is already at hand. */
22
22
  query: GraphQLQueryFn;
23
- /** The site id in which the page lives or is being created. */
24
- siteId: string;
25
- /** The pagetree id in which the page lives or is being created. */
26
- pagetreeId: string;
23
+ /** The site id in which the page lives or is being created. Null if we are validating creation of a site. */
24
+ siteId?: string;
25
+ /** The pagetree id in which the page lives or is being created. Null if we are validating creation of a site or pagetree. */
26
+ pagetreeId?: string;
27
27
  /** The page id of the page's parent or parent-to-be. Null if it is the root page of a pagetree. */
28
28
  parentId?: string;
29
29
  /** The page's id, presumably to be used in graphql queries. NOTE: will be null during page creation. */
@@ -73,13 +73,13 @@ export interface APITemplate {
73
73
  * can be indexed. Only fields that are links need to be returned. Links inside rich editor
74
74
  * text will be extracted automatically from any text returned by getFulltext (see below)
75
75
  */
76
- getLinks: LinkGatheringFn;
76
+ getLinks?: LinkGatheringFn;
77
77
  /**
78
78
  * Each template must provide the text from any text or rich editor data it possesses, so that
79
79
  * the text can be decomposed into words and indexed for fulltext searches. Any text returned
80
80
  * by this function will also be scanned for links.
81
81
  */
82
- getFulltext: FulltextGatheringFn;
82
+ getFulltext?: FulltextGatheringFn;
83
83
  }
84
84
  export interface APIComponentTemplate extends APITemplate {
85
85
  type: 'component';
@@ -113,19 +113,19 @@ export interface APIComponentTemplate extends APITemplate {
113
113
  * Typically this will start as an empty array and migrations will be added as the template
114
114
  * gets refactored.
115
115
  */
116
- migrations: ComponentMigration[];
116
+ migrations?: ComponentMigration[];
117
117
  }
118
118
  export interface APIPageTemplate extends APITemplate {
119
119
  type: 'page';
120
120
  /**
121
121
  * Page areas are the same as components but are required.
122
122
  */
123
- areas: Record<string, string[]>;
123
+ areas?: Record<string, string[]>;
124
124
  /**
125
125
  * Page template implementations do not receive a path like component templates do.
126
126
  */
127
127
  validate?: (data: PageData, extras: PageExtras) => Promise<ValidationFeedback[]>;
128
- migrations: PageMigration[];
128
+ migrations?: PageMigration[];
129
129
  /**
130
130
  * Hard-coded properties that may be set on page templates to influence the rendering of
131
131
  * components on the page. For instance, a set of color choices that are customized for
@@ -145,7 +145,7 @@ export interface APIDataTemplate extends APITemplate {
145
145
  * null when it is a creation operation.
146
146
  */
147
147
  validate?: (data: ComponentData, extras: DataExtras) => Promise<ValidationFeedback[]>;
148
- migrations: DataMigration[];
148
+ migrations?: DataMigration[];
149
149
  }
150
150
  export declare type APIAnyTemplate = APIComponentTemplate | APIPageTemplate | APIDataTemplate;
151
151
  /**
package/dist/render.d.ts CHANGED
@@ -46,7 +46,10 @@ export interface APIClient {
46
46
  * method to convert a link, as input by a user, into a URL suitable for an href, or optionally
47
47
  * an absolute URL suitable for a backend http request or non-HTML document like an RSS feed.
48
48
  */
49
- resolveLink: (link: string | LinkDefinition, absolute?: boolean) => Promise<string>;
49
+ resolveLink: (lnk: string | LinkDefinition, opts?: {
50
+ absolute?: boolean;
51
+ extension?: string;
52
+ }) => Promise<string>;
50
53
  /**
51
54
  * This function will be provided by the rendering server and should be used inside your fetch
52
55
  * method to prepare editor-provided HTML for rendering. It will do things like find and resolve
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.48",
3
+ "version": "0.0.51",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {