@dosgato/templating 0.0.125 → 0.0.126

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.
@@ -1,5 +1,5 @@
1
- import { ComponentData, DataData, PageData } from './component.js';
2
- import { LinkDefinition } from './links.js';
1
+ import type { ComponentData, DataData, PageData } from './component.js';
2
+ import { type LinkDefinition } from './links.js';
3
3
  export type APITemplateType = 'page' | 'component' | 'data';
4
4
  export declare enum ValidationMessageType {
5
5
  ERROR = "error",
@@ -3,7 +3,7 @@
3
3
  import type { IncomingHttpHeaders } from 'http';
4
4
  import type { ParsedUrlQuery } from 'querystring';
5
5
  import { ResourceProvider } from './provider.js';
6
- import { APIClient } from './render.js';
6
+ import { type APIClient } from './render.js';
7
7
  /**
8
8
  * This is the primary templating class to build your templates. Subclass it and provide
9
9
  * at least a render function.
package/dist/provider.js CHANGED
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * If you do this, don't forget to register the provider along with your templates!
10
10
  */
11
- export class ResourceProvider {
11
+ class ResourceProvider {
12
12
  static webpath(name) { return this.webpaths.get(name); }
13
13
  }
14
14
  /**
@@ -86,3 +86,4 @@ ResourceProvider.files = new Map();
86
86
  * `<img src="${TemplateClass.webpath('keyname')}">`
87
87
  */
88
88
  ResourceProvider.webpaths = new Map();
89
+ export { ResourceProvider };
package/dist/render.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ContextBase, DataData, PageData, PageRecord, PageRecordOptionalData } from './component.js';
2
- import { AssetFolderLink, AssetLink, DataFolderLink, DataLink, LinkDefinition, PageLink } from './links.js';
1
+ import type { ContextBase, DataData, PageData, PageRecord, PageRecordOptionalData } from './component.js';
2
+ import type { AssetFolderLink, AssetLink, DataFolderLink, DataLink, LinkDefinition, PageLink } from './links.js';
3
3
  /**
4
4
  * Safely encapsulates `content` in header tags based on the `ctx` context passed and adds any passed `attributes` to the header tagging.
5
5
  * If the headerLevel passed through `ctx` is outside the range of 1..6 the header tag generated is normalized to the nearest value of 1 or 6.
@@ -52,6 +52,14 @@ export interface AssetRecord {
52
52
  downloadLink: string;
53
53
  image?: PictureAttributes;
54
54
  }
55
+ export interface DataRecord {
56
+ id: string;
57
+ path: string;
58
+ name: string;
59
+ modifiedAt?: Date;
60
+ publishedAt?: Date;
61
+ data: DataData;
62
+ }
55
63
  export interface PageForNavigation {
56
64
  id: string;
57
65
  name: string;
@@ -249,14 +257,22 @@ export interface APIClient {
249
257
  * Get data entries by link or folder link
250
258
  *
251
259
  * Returns an array in case link is a DataFolderLink. If link is a DataLink, will return an
252
- * array with length <= 1.
260
+ * array with length <= 1. If link is a DataFolderLink to a DataRoot, returns all descendant data
261
+ * recursively.
262
+ *
263
+ * Never returns deleted or unpublished data, and only returns the published version
264
+ * of a piece of data, even in edit mode.
253
265
  */
254
- getDataByLink: (link: string | DataLink | DataFolderLink) => Promise<DataData[]>;
266
+ getDataByLink: (link: string | DataLink | DataFolderLink) => Promise<DataRecord[]>;
255
267
  /**
256
268
  * Get data entries by full path including site
257
269
  *
258
270
  * Use '/global' for global data. If path refers to a specific data item, will return
259
- * an array with length <= 1.
271
+ * an array with length <= 1. If path refers to a DataRoot, returns all descendant
272
+ * data recursively.
273
+ *
274
+ * Never returns deleted or unpublished data, and only returns the published version
275
+ * of a piece of data, even in edit mode.
260
276
  */
261
- getDataByPath: (templateKey: string, path: string) => Promise<DataData[]>;
277
+ getDataByPath: (templateKey: string, path: string) => Promise<DataRecord[]>;
262
278
  }
@@ -1,4 +1,4 @@
1
- import { ComponentData, PageData } from './component.js';
1
+ import type { ComponentData, PageData } from './component.js';
2
2
  interface IconifyIcon {
3
3
  body: string;
4
4
  rotate?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.125",
3
+ "version": "0.0.126",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/node": "^18.7.11",
21
- "eslint-config-standard-with-typescript": "^26.0.0",
22
- "typescript": "^4.4.2"
21
+ "eslint-config-standard-with-typescript": "^34.0.0",
22
+ "typescript": "^5.0.4"
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",