@accordproject/template-engine 2.2.0 → 2.3.2
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/dist/index.d.ts +7 -77
- package/dist/index.js +38 -736
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -736
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/runtime.tgz +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as _accordproject_concerto_core_types_lib_model_resource from '@accordproject/concerto-core/types/lib/model/resource';
|
|
2
|
-
import { ModelManager, ClassDeclaration
|
|
3
|
-
import { FileWriter } from '@accordproject/concerto-util';
|
|
2
|
+
import { ModelManager, ClassDeclaration } from '@accordproject/concerto-core';
|
|
4
3
|
|
|
5
4
|
type TemplateData = Record<string, unknown>;
|
|
6
5
|
|
|
@@ -45,79 +44,10 @@ declare class TemplateMarkInterpreter {
|
|
|
45
44
|
generate(templateMark: object, data: TemplateData, options?: GenerationOptions): Promise<any>;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
* Converts TemplateMark DOM to a Typescript function, that, when run with JSON data
|
|
54
|
-
* that conforms to the template model will produce AgreementMark JSON output.
|
|
55
|
-
*/
|
|
56
|
-
declare class TemplateMarkToTypeScriptCompiler {
|
|
57
|
-
modelManager: ModelManager;
|
|
58
|
-
templateClass: ClassDeclaration;
|
|
59
|
-
constructor(modelManager: ModelManager, templateConceptFqn?: string);
|
|
60
|
-
writeFunction(fw: FileWriter, functionName: string, returnType: string, code: string): void;
|
|
61
|
-
/**
|
|
62
|
-
* Get a model manager with templatemark model
|
|
63
|
-
* @param {string} outputDir the output directory
|
|
64
|
-
* @returns {ModelManager} the model manager
|
|
65
|
-
*/
|
|
66
|
-
getTemplateMarkModelManager(): ModelManager;
|
|
67
|
-
/**
|
|
68
|
-
* Get a model manager with templatemark model
|
|
69
|
-
* @param {string} outputDir the output directory
|
|
70
|
-
* @returns {ModelManager} the model manager
|
|
71
|
-
*/
|
|
72
|
-
getCiceroMarkModelManager(): ModelManager;
|
|
73
|
-
generateTypeScript(modelManager: ModelManager, outputDir: string): void;
|
|
74
|
-
generateSampleData(modelManager: ModelManager, outputDir: string): void;
|
|
75
|
-
/**
|
|
76
|
-
* The main iteration function over templatemark. This function
|
|
77
|
-
* looks up an INodeCompiler that can handle each templatemark node
|
|
78
|
-
* and delegates to it for code generation.
|
|
79
|
-
* Note that the result of code generation (a CiceroMark node) is left in
|
|
80
|
-
* the $result global varianble.
|
|
81
|
-
* @param {FileWriter} fw the file writer to use
|
|
82
|
-
* @param {number} level the indentation level
|
|
83
|
-
* @param {object} templateMark the templatemark node to iterate over
|
|
84
|
-
*/
|
|
85
|
-
static doIt(fw: FileWriter, level: number, templateMark: any): void;
|
|
86
|
-
/**
|
|
87
|
-
* Converts a TemplateMark document to typescript code that is parameterised
|
|
88
|
-
* by the 'data' argument.
|
|
89
|
-
*
|
|
90
|
-
* The strategy is to traverse the template mark json, converting each node into
|
|
91
|
-
* typescript statements that add an equivalent ciceromark node. Variables will
|
|
92
|
-
* pull values from 'data'.
|
|
93
|
-
*
|
|
94
|
-
* Conditionals and formulae will call the functions produced by
|
|
95
|
-
* compileUserCode.
|
|
96
|
-
*
|
|
97
|
-
* Note that code generation process is itself recursive, for example, when
|
|
98
|
-
* a list definition node is encountered the list must be iterated over
|
|
99
|
-
* based on a variable value coming from data, and code must be
|
|
100
|
-
* generated to produce each list item.
|
|
101
|
-
*
|
|
102
|
-
* All internal variables are prefixed with '$' to ensure (?)
|
|
103
|
-
* that they cannot collide with end user variable names.
|
|
104
|
-
*
|
|
105
|
-
* @param {IDocument} templateMark the TemplateMark Concerto resource
|
|
106
|
-
* @param {string} outputDir the output directory for code
|
|
107
|
-
*/
|
|
108
|
-
compileGenerator(templateMark: any, outputDir: string): void;
|
|
109
|
-
/**
|
|
110
|
-
* Decompresses the base64 zipped runtime into an output folder.
|
|
111
|
-
* @param {string} outputDir the output directory to copy the runtime to
|
|
112
|
-
*/
|
|
113
|
-
copyRuntime(outputDir: string): void;
|
|
114
|
-
/**
|
|
115
|
-
* Create package.json for the generated code
|
|
116
|
-
* @param {string} outputDir the output directory to copy the runtime to
|
|
117
|
-
*/
|
|
118
|
-
createPackage(outputDir: string): void;
|
|
119
|
-
compile(templateMark: Resource | any, outputDir: string, options?: CompilationOptions): void;
|
|
120
|
-
compileUserCode(templateMark: any, outputDir: string): void;
|
|
121
|
-
}
|
|
47
|
+
declare function ensureDirSync(path: string): void;
|
|
48
|
+
declare function removeSync(path: string): void;
|
|
49
|
+
declare function writeFunctionToString(templateClass: ClassDeclaration, functionName: string, returnType: string, code: string): string;
|
|
50
|
+
declare function nameUserCode(templateMarkDom: any): any;
|
|
51
|
+
declare function getTemplateClassDeclaration(modelManager: ModelManager, templateConceptFqn?: string): ClassDeclaration;
|
|
122
52
|
|
|
123
|
-
export { TemplateMarkInterpreter,
|
|
53
|
+
export { TemplateMarkInterpreter, ensureDirSync, getTemplateClassDeclaration, nameUserCode, removeSync, writeFunctionToString };
|