Skip to content

Commit

Permalink
Release 0.0.1-next.11
Browse files Browse the repository at this point in the history
  • Loading branch information
accuser committed Nov 1, 2024
1 parent 1ca0c5c commit b630283
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 100 deletions.
57 changes: 25 additions & 32 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
import { PipelineStage } from '@typematter/pipeline';

declare module '@typematter/pipeline' {
interface PipelineContext {
content?: string;
name?: string;
}
}
declare const createLocalLoader: (path: string) => PipelineStage;

declare module '@typematter/pipeline' {
interface PipelineContext {
content?: string;
name?: string;
}
}
declare const createRemoteLoader: (baseUrl: string | URL) => PipelineStage;

interface UnknownField {
type: string;
description?: string;
Expand Down Expand Up @@ -92,35 +110,14 @@ interface ArchetypeStore {
load(name: string): Promise<Archetype>;
}

/**
* Error thrown when a local archetype fails to load.
*/
declare class LocalArchetypeLoadError extends ArchetypeLoadError {
constructor(name: string, originalError: Error);
interface StoreOptions {
/**
* Cache loaded archetypes
*/
cache?: boolean;
}
/**
* Creates a store that loads archetype schemas from local markdown files.
*
* @param root - The root directory containing the archetype schemas.
* @returns A store that loads archetype schemas from local markdown files.
* @throws {LocalArchetypeLoadError} If the archetype schema could not be loaded
*/
declare const createLocalStore: (root: string) => ArchetypeStore;

/**
* Error thrown when a remote archetype fails to load.
*/
declare class RemoteArchetypeLoadError extends ArchetypeLoadError {
constructor(name: string, statusText: string);
}
/**
* Creates a store that loads archetype schemas from remote markdown files.
*
* @param baseUrl - The base URL to load the archetype from.
* @returns A store that loads archetype schemas from remote markdown files.
* @throws {RemoteArchetypeLoadError} If the archetype schema could not be loaded
*/
declare const createRemoteStore: (baseUrl: string | URL) => ArchetypeStore;
declare const createStore: (loadContent: PipelineStage, options?: StoreOptions) => ArchetypeStore;

interface ValidationError {
path: string[];
Expand Down Expand Up @@ -163,10 +160,6 @@ interface ValidatorOptions {
* Where to load archetypes from
*/
store: ArchetypeStore;
/**
* Cache loaded archetypes
*/
cache?: boolean;
/**
* Validation options
*/
Expand Down Expand Up @@ -194,4 +187,4 @@ interface ValidatorOptions {
*/
declare const createValidator: (options: ValidatorOptions) => Promise<ArchetypeValidator>;

export { type Archetype, ArchetypeLoadError, type ArchetypeStore, type ArchetypeValidator, LocalArchetypeLoadError, RemoteArchetypeLoadError, type SchemaField, type ValidationError, type ValidationResult, type ValidatorOptions, createLocalStore, createRemoteStore, createValidator };
export { type Archetype, ArchetypeLoadError, type ArchetypeStore, type ArchetypeValidator, type SchemaField, type ValidationError, type ValidationResult, type ValidatorOptions, createLocalLoader, createRemoteLoader, createStore, createValidator };
179 changes: 121 additions & 58 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typematter/archetype",
"version": "0.0.1-next.10",
"version": "0.0.1-next.11",
"description": "Archetype system for validating frontmatter.",
"private": false,
"type": "module",
Expand Down
11 changes: 3 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
export {
LocalArchetypeLoadError,
default as createLocalStore
} from './lib/store/create-local-store.js';
export {
RemoteArchetypeLoadError,
default as createRemoteStore
} from './lib/store/create-remote-store.js';
export { default as createLocalLoader } from './lib/store/create-local-loader.js';
export { default as createRemoteLoader } from './lib/store/create-remote-loader.js';
export { default as createStore } from './lib/store/create-store.js';
export { default as createValidator } from './lib/validator/create-validator.js';
export { ArchetypeLoadError, type ArchetypeStore } from './types/archetype-store.js';
export type { ArchetypeValidator } from './types/archetype-validator.js';
Expand Down

0 comments on commit b630283

Please sign in to comment.