@formfeed/devkit 0.3.10 → 0.3.12

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.
package/types/index.d.ts CHANGED
@@ -1,16 +1,18 @@
1
1
  export { DevkitError } from './lib/errors.js';
2
- export { defaultProjectConfig, findProject, isIgnored, loadProject, projectAround, writeProjectConfig } from './lib/project-config.js';
2
+ export { defaultProjectConfig, findProject, isIgnored, loadProject, projectAround, writeProjectConfig, } from './lib/project-config.js';
3
3
  export type { Project, ProjectConfig } from './lib/project-config.js';
4
4
  export { contentHash, defaultData, listTemplateSlugs, officeVersionPayload, partialContentHash, partialResolver, readState, readTemplate, recordSharedPartial, recordSync, sharedPartialNames, sharedPartialPath, templateDir, templateFileName, titleFromSlug, versionPayload, writePartials, writeState, writeTemplate, } from './lib/project.js';
5
- export type { LocalOfficeFile, LocalTemplate, ProjectState, SharedPartialState, TemplateMeta, TemplateState } from './lib/project.js';
5
+ export type { LocalOfficeFile, LocalTemplate, ProjectState, SharedPartialState, TemplateMeta, TemplateState, } from './lib/project.js';
6
6
  export { brandFromJson, brandPath, readBrand, writeBrand } from './lib/brand.js';
7
7
  export { collectPartials } from './lib/partials.js';
8
8
  export type { CollectedPartials } from './lib/partials.js';
9
- export { diagnose, htmlSnapshot, officeSnapshot, prettyXml, previewDocument, renderContext, renderLocal, renderOfficeLocal, renderedSettings } from './lib/local-render.js';
9
+ export { diagnose, htmlSnapshot, officeSnapshot, prettyXml, previewDocument, renderContext, renderLocal, renderOfficeLocal, renderedSettings, } from './lib/local-render.js';
10
10
  export type { LocalDiagnostic, OfficeLocalOptions } from './lib/local-render.js';
11
- export { contentTypeFor, listLocalFiles, localFilePath, sha256File, writeLocalFile } from './lib/files.js';
11
+ export { declaredEinvoice, diagnoseEinvoice, localEinvoiceXml, } from './lib/einvoice.js';
12
+ export type { DataSetDiagnostics } from './lib/einvoice.js';
13
+ export { contentTypeFor, listLocalFiles, localFilePath, sha256File, writeLocalFile, } from './lib/files.js';
12
14
  export type { LocalFile, LocalFileListing } from './lib/files.js';
13
15
  export type { LocalRenderOptions } from './lib/local-render.js';
14
16
  export { parseRedactPath, redactData, redactString } from './lib/redact.js';
15
17
  export { defaultTypesFile, generateTypes, localTypeSource } from './lib/types/index.js';
16
- export type { SchemaOrigin, TypeScriptOptions, TypeSource, TypesLanguage } from './lib/types/index.js';
18
+ export type { SchemaOrigin, TypeScriptOptions, TypeSource, TypesLanguage, } from './lib/types/index.js';
@@ -0,0 +1,37 @@
1
+ import { type EinvoiceOptions, type EinvoiceOptionsInput, type Invoice } from '@formfeed/engine';
2
+ import type { LocalDiagnostic } from './local-render.cjs';
3
+ import type { LocalTemplate } from './project.cjs';
4
+ /**
5
+ * The e-invoice of a template folder (spec 17): what `settings.json` declares, the check of every
6
+ * data set against it, and the XML itself. All of it runs offline, with the code the API runs, so
7
+ * what `formfeed validate` accepts the API accepts too.
8
+ */
9
+ /**
10
+ * The e-invoice a template declares in `settings.json`, with every default filled in; `null` when
11
+ * it declares none. `override` is merged over it like a request's `post.einvoice`; `{}` asks for an
12
+ * e-invoice with the defaults from a template that declares nothing.
13
+ */
14
+ export declare function declaredEinvoice(tpl: LocalTemplate, override?: EinvoiceOptionsInput | false): EinvoiceOptions | null;
15
+ /** The findings of one data set, with the file they are in. */
16
+ export interface DataSetDiagnostics {
17
+ dataSet: string;
18
+ /** Relative to the template folder: `data/default.json`. */
19
+ file: string;
20
+ diagnostics: LocalDiagnostic[];
21
+ }
22
+ /**
23
+ * Every data set of an invoice template against the `_invoice` schema and the rules of EN 16931
24
+ * (spec 17 §8). Each is an error: a render with that data fails with `einvoice_data_invalid`, and a
25
+ * template that declares an e-invoice renders nothing else. Empty for a template that declares
26
+ * none; one warning for an image template, where the declaration has no effect.
27
+ */
28
+ export declare function diagnoseEinvoice(tpl: LocalTemplate): DataSetDiagnostics[];
29
+ /**
30
+ * The XML of one data set, as a render of the template would embed it. Throws a validation error
31
+ * that lists what is wrong with the block when it does not pass.
32
+ */
33
+ export declare function localEinvoiceXml(tpl: LocalTemplate, data: unknown, override?: EinvoiceOptionsInput): {
34
+ xml: string;
35
+ invoice: Invoice;
36
+ options: EinvoiceOptions;
37
+ };
@@ -0,0 +1,37 @@
1
+ import { type EinvoiceOptions, type EinvoiceOptionsInput, type Invoice } from '@formfeed/engine';
2
+ import type { LocalDiagnostic } from './local-render.js';
3
+ import type { LocalTemplate } from './project.js';
4
+ /**
5
+ * The e-invoice of a template folder (spec 17): what `settings.json` declares, the check of every
6
+ * data set against it, and the XML itself. All of it runs offline, with the code the API runs, so
7
+ * what `formfeed validate` accepts the API accepts too.
8
+ */
9
+ /**
10
+ * The e-invoice a template declares in `settings.json`, with every default filled in; `null` when
11
+ * it declares none. `override` is merged over it like a request's `post.einvoice`; `{}` asks for an
12
+ * e-invoice with the defaults from a template that declares nothing.
13
+ */
14
+ export declare function declaredEinvoice(tpl: LocalTemplate, override?: EinvoiceOptionsInput | false): EinvoiceOptions | null;
15
+ /** The findings of one data set, with the file they are in. */
16
+ export interface DataSetDiagnostics {
17
+ dataSet: string;
18
+ /** Relative to the template folder: `data/default.json`. */
19
+ file: string;
20
+ diagnostics: LocalDiagnostic[];
21
+ }
22
+ /**
23
+ * Every data set of an invoice template against the `_invoice` schema and the rules of EN 16931
24
+ * (spec 17 §8). Each is an error: a render with that data fails with `einvoice_data_invalid`, and a
25
+ * template that declares an e-invoice renders nothing else. Empty for a template that declares
26
+ * none; one warning for an image template, where the declaration has no effect.
27
+ */
28
+ export declare function diagnoseEinvoice(tpl: LocalTemplate): DataSetDiagnostics[];
29
+ /**
30
+ * The XML of one data set, as a render of the template would embed it. Throws a validation error
31
+ * that lists what is wrong with the block when it does not pass.
32
+ */
33
+ export declare function localEinvoiceXml(tpl: LocalTemplate, data: unknown, override?: EinvoiceOptionsInput): {
34
+ xml: string;
35
+ invoice: Invoice;
36
+ options: EinvoiceOptions;
37
+ };
@@ -5,7 +5,8 @@ import type { Project } from './project-config.cjs';
5
5
  * The template folder of spec 15 §2. `template.json` (name, kind, engine, description, tags) is
6
6
  * the one addition to the spec's layout: `push` needs it to create a template that does not exist
7
7
  * remotely, `pull` writes it. Header and footer live in their own files and fold back into
8
- * `settings.header.html` / `settings.footer.html`, as the editor's tabs do.
8
+ * `settings.header.html` / `settings.footer.html`, as the editor's tabs do; a visual design lives in
9
+ * `design.json` and folds back into `settings.design`.
9
10
  */
10
11
  export interface TemplateMeta {
11
12
  name: string;
@@ -5,7 +5,8 @@ import type { Project } from './project-config.js';
5
5
  * The template folder of spec 15 §2. `template.json` (name, kind, engine, description, tags) is
6
6
  * the one addition to the spec's layout: `push` needs it to create a template that does not exist
7
7
  * remotely, `pull` writes it. Header and footer live in their own files and fold back into
8
- * `settings.header.html` / `settings.footer.html`, as the editor's tabs do.
8
+ * `settings.header.html` / `settings.footer.html`, as the editor's tabs do; a visual design lives in
9
+ * `design.json` and folds back into `settings.design`.
9
10
  */
10
11
  export interface TemplateMeta {
11
12
  name: string;