Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dosgato/templating

Package Overview
Dependencies
Maintainers
2
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dosgato/templating - npm Package Compare versions

Comparing version 0.0.30 to 0.0.31

61

dist/apitemplate.d.ts

@@ -1,2 +0,2 @@

import { PageRecord, ComponentData } from './component.js';
import { PageRecord, ComponentData, DataData, PageData } from './component.js';
import { LinkDefinition } from './links.js';

@@ -29,14 +29,2 @@ export declare type APITemplateType = 'page' | 'component' | 'data';

/**
* Each template must declare its areas and the template keys of components that will be
* permitted inside each area. The list of allowed component templates can be updated beyond
* the list provided here. See templateRegistry.addAvailableComponent's comment for info on why.
*/
areas: Record<string, string[]>;
/**
* Each template must provide a list of migrations for upgrading the data schema over time.
* Typically this will start as an empty array and migrations will be added as the template
* gets refactored.
*/
migrations: Migration[];
/**
* Each template must provide a function that returns links from its data so that they

@@ -53,3 +41,12 @@ * can be indexed. Only fields that are links need to be returned. Links inside rich editor

getFulltext: FulltextGatheringFn;
}
export interface APIComponentTemplate extends APITemplate {
type: 'component';
/**
* Each template must declare its areas and the template keys of components that will be
* permitted inside each area. The list of allowed component templates can be updated beyond
* the list provided here. See templateRegistry.addAvailableComponent's comment for info on why.
*/
areas?: Record<string, string[]>;
/**
* Each template must provide a validation function so that the API can enforce its data is

@@ -73,2 +70,20 @@ * shaped properly.

/**
* Each template must provide a list of migrations for upgrading the data schema over time.
* Typically this will start as an empty array and migrations will be added as the template
* gets refactored.
*/
migrations: ComponentMigration[];
}
export interface APIPageTemplate extends APITemplate {
type: 'page';
/**
* Page areas are the same as components but are required.
*/
areas: Record<string, string[]>;
/**
* Page template implementations do not receive a path like component templates do.
*/
validate?: (data: ComponentData, query: GraphQLQueryFn, page: PageRecord) => Promise<ValidationFeedback[]>;
migrations: PageMigration[];
/**
* Hard-coded properties that may be set on page templates to influence the rendering of

@@ -84,2 +99,11 @@ * components on the page. For instance, a set of color choices that are customized for

}
export interface APIDataTemplate extends APITemplate {
type: 'data';
/**
* Data template implementations receive the dataId so they can self-reference in queries.
*/
validate?: (data: ComponentData, query: GraphQLQueryFn, dataId: string) => Promise<ValidationFeedback[]>;
migrations: DataMigration[];
}
export declare type APIAnyTemplate = APIComponentTemplate | APIPageTemplate | APIDataTemplate;
/**

@@ -115,5 +139,16 @@ * In dosgato CMS, the data in the database is not altered except during user activity. This

createdAt: Date;
}
export interface ComponentMigration extends Migration {
up: (data: ComponentData, query: GraphQLQueryFn, page: PageRecord, path: string) => ComponentData | Promise<ComponentData>;
down: (data: ComponentData, query: GraphQLQueryFn, page: PageRecord, path: string) => ComponentData | Promise<ComponentData>;
}
export interface PageMigration extends Migration {
up: (data: PageData, query: GraphQLQueryFn, page: PageRecord) => PageData | Promise<PageData>;
down: (data: PageData, query: GraphQLQueryFn, page: PageRecord) => PageData | Promise<PageData>;
}
export interface DataMigration extends Migration {
up: (data: DataData, query: GraphQLQueryFn, dataId: string) => DataData | Promise<DataData>;
down: (data: DataData, query: GraphQLQueryFn, dataId: string) => DataData | Promise<DataData>;
}
export declare type AnyMigration = ComponentMigration | PageMigration | DataMigration;
export declare type LinkGatheringFn = (data: any) => LinkDefinition[];

@@ -120,0 +155,0 @@ export declare type FulltextGatheringFn = (data: any) => string[];

{
"name": "@dosgato/templating",
"version": "0.0.30",
"version": "0.0.31",
"description": "A library to support building templates for dosgato CMS.",

@@ -5,0 +5,0 @@ "type": "module",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc