@eventvisor/core 0.0.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.
Files changed (165) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/jest.config.js +4 -0
  4. package/lib/builder/buildProject.d.ts +21 -0
  5. package/lib/builder/buildProject.js +153 -0
  6. package/lib/builder/buildProject.js.map +1 -0
  7. package/lib/builder/hashes.d.ts +2 -0
  8. package/lib/builder/hashes.js +59 -0
  9. package/lib/builder/hashes.js.map +1 -0
  10. package/lib/builder/index.d.ts +1 -0
  11. package/lib/builder/index.js +18 -0
  12. package/lib/builder/index.js.map +1 -0
  13. package/lib/cli/cli.d.ts +26 -0
  14. package/lib/cli/cli.js +69 -0
  15. package/lib/cli/cli.js.map +1 -0
  16. package/lib/cli/index.d.ts +1 -0
  17. package/lib/cli/index.js +18 -0
  18. package/lib/cli/index.js.map +1 -0
  19. package/lib/cli/plugins.d.ts +4 -0
  20. package/lib/cli/plugins.js +12 -0
  21. package/lib/cli/plugins.js.map +1 -0
  22. package/lib/config/index.d.ts +2 -0
  23. package/lib/config/index.js +19 -0
  24. package/lib/config/index.js.map +1 -0
  25. package/lib/config/parsers.d.ts +15 -0
  26. package/lib/config/parsers.js +65 -0
  27. package/lib/config/parsers.js.map +1 -0
  28. package/lib/config/projectConfig.d.ts +42 -0
  29. package/lib/config/projectConfig.js +137 -0
  30. package/lib/config/projectConfig.js.map +1 -0
  31. package/lib/datasource/adapter.d.ts +16 -0
  32. package/lib/datasource/adapter.js +7 -0
  33. package/lib/datasource/adapter.js.map +1 -0
  34. package/lib/datasource/datasource.d.ts +48 -0
  35. package/lib/datasource/datasource.js +117 -0
  36. package/lib/datasource/datasource.js.map +1 -0
  37. package/lib/datasource/filesystemAdapter.d.ts +29 -0
  38. package/lib/datasource/filesystemAdapter.js +192 -0
  39. package/lib/datasource/filesystemAdapter.js.map +1 -0
  40. package/lib/datasource/index.d.ts +3 -0
  41. package/lib/datasource/index.js +20 -0
  42. package/lib/datasource/index.js.map +1 -0
  43. package/lib/dependencies.d.ts +11 -0
  44. package/lib/dependencies.js +3 -0
  45. package/lib/dependencies.js.map +1 -0
  46. package/lib/index.d.ts +4 -0
  47. package/lib/index.js +21 -0
  48. package/lib/index.js.map +1 -0
  49. package/lib/index.spec.d.ts +0 -0
  50. package/lib/index.spec.js +6 -0
  51. package/lib/index.spec.js.map +1 -0
  52. package/lib/init/index.d.ts +8 -0
  53. package/lib/init/index.js +90 -0
  54. package/lib/init/index.js.map +1 -0
  55. package/lib/linter/attributeSchema.d.ts +5 -0
  56. package/lib/linter/attributeSchema.js +55 -0
  57. package/lib/linter/attributeSchema.js.map +1 -0
  58. package/lib/linter/conditionsSchema.d.ts +303 -0
  59. package/lib/linter/conditionsSchema.js +106 -0
  60. package/lib/linter/conditionsSchema.js.map +1 -0
  61. package/lib/linter/destinationSchema.d.ts +5 -0
  62. package/lib/linter/destinationSchema.js +57 -0
  63. package/lib/linter/destinationSchema.js.map +1 -0
  64. package/lib/linter/effectSchema.d.ts +1257 -0
  65. package/lib/linter/effectSchema.js +77 -0
  66. package/lib/linter/effectSchema.js.map +1 -0
  67. package/lib/linter/eventSchema.d.ts +5 -0
  68. package/lib/linter/eventSchema.js +70 -0
  69. package/lib/linter/eventSchema.js.map +1 -0
  70. package/lib/linter/index.d.ts +1 -0
  71. package/lib/linter/index.js +18 -0
  72. package/lib/linter/index.js.map +1 -0
  73. package/lib/linter/jsonSchema.d.ts +25 -0
  74. package/lib/linter/jsonSchema.js +487 -0
  75. package/lib/linter/jsonSchema.js.map +1 -0
  76. package/lib/linter/jsonSchema.spec.d.ts +1 -0
  77. package/lib/linter/jsonSchema.spec.js +875 -0
  78. package/lib/linter/jsonSchema.spec.js.map +1 -0
  79. package/lib/linter/lintProject.d.ts +2 -0
  80. package/lib/linter/lintProject.js +141 -0
  81. package/lib/linter/lintProject.js.map +1 -0
  82. package/lib/linter/persistSchema.d.ts +609 -0
  83. package/lib/linter/persistSchema.js +52 -0
  84. package/lib/linter/persistSchema.js.map +1 -0
  85. package/lib/linter/printError.d.ts +9 -0
  86. package/lib/linter/printError.js +75 -0
  87. package/lib/linter/printError.js.map +1 -0
  88. package/lib/linter/sampleSchema.d.ts +331 -0
  89. package/lib/linter/sampleSchema.js +70 -0
  90. package/lib/linter/sampleSchema.js.map +1 -0
  91. package/lib/linter/sourceSchema.d.ts +11 -0
  92. package/lib/linter/sourceSchema.js +73 -0
  93. package/lib/linter/sourceSchema.js.map +1 -0
  94. package/lib/linter/tagsSchema.d.ts +3 -0
  95. package/lib/linter/tagsSchema.js +44 -0
  96. package/lib/linter/tagsSchema.js.map +1 -0
  97. package/lib/linter/testSchema.d.ts +5 -0
  98. package/lib/linter/testSchema.js +44 -0
  99. package/lib/linter/testSchema.js.map +1 -0
  100. package/lib/linter/transformsSchema.d.ts +29 -0
  101. package/lib/linter/transformsSchema.js +66 -0
  102. package/lib/linter/transformsSchema.js.map +1 -0
  103. package/lib/tester/createTestInstance.d.ts +16 -0
  104. package/lib/tester/createTestInstance.js +158 -0
  105. package/lib/tester/createTestInstance.js.map +1 -0
  106. package/lib/tester/executeTest.d.ts +24 -0
  107. package/lib/tester/executeTest.js +305 -0
  108. package/lib/tester/executeTest.js.map +1 -0
  109. package/lib/tester/index.d.ts +1 -0
  110. package/lib/tester/index.js +18 -0
  111. package/lib/tester/index.js.map +1 -0
  112. package/lib/tester/printTestResult.d.ts +10 -0
  113. package/lib/tester/printTestResult.js +80 -0
  114. package/lib/tester/printTestResult.js.map +1 -0
  115. package/lib/tester/testProject.d.ts +12 -0
  116. package/lib/tester/testProject.js +93 -0
  117. package/lib/tester/testProject.js.map +1 -0
  118. package/lib/utils/index.d.ts +1 -0
  119. package/lib/utils/index.js +18 -0
  120. package/lib/utils/index.js.map +1 -0
  121. package/lib/utils/prettyDuration.d.ts +1 -0
  122. package/lib/utils/prettyDuration.js +27 -0
  123. package/lib/utils/prettyDuration.js.map +1 -0
  124. package/package.json +42 -0
  125. package/src/builder/buildProject.ts +222 -0
  126. package/src/builder/hashes.ts +30 -0
  127. package/src/builder/index.ts +1 -0
  128. package/src/cli/cli.ts +110 -0
  129. package/src/cli/index.ts +1 -0
  130. package/src/cli/plugins.ts +13 -0
  131. package/src/config/index.ts +2 -0
  132. package/src/config/parsers.ts +40 -0
  133. package/src/config/projectConfig.ts +158 -0
  134. package/src/datasource/adapter.ts +23 -0
  135. package/src/datasource/datasource.ts +164 -0
  136. package/src/datasource/filesystemAdapter.ts +206 -0
  137. package/src/datasource/index.ts +3 -0
  138. package/src/dependencies.ts +13 -0
  139. package/src/index.spec.ts +5 -0
  140. package/src/index.ts +4 -0
  141. package/src/init/index.ts +65 -0
  142. package/src/linter/attributeSchema.ts +23 -0
  143. package/src/linter/conditionsSchema.ts +89 -0
  144. package/src/linter/destinationSchema.ts +25 -0
  145. package/src/linter/effectSchema.ts +49 -0
  146. package/src/linter/eventSchema.ts +40 -0
  147. package/src/linter/index.ts +1 -0
  148. package/src/linter/jsonSchema.spec.ts +934 -0
  149. package/src/linter/jsonSchema.ts +533 -0
  150. package/src/linter/lintProject.ts +182 -0
  151. package/src/linter/persistSchema.ts +21 -0
  152. package/src/linter/printError.ts +50 -0
  153. package/src/linter/sampleSchema.ts +45 -0
  154. package/src/linter/sourceSchema.ts +42 -0
  155. package/src/linter/tagsSchema.ts +12 -0
  156. package/src/linter/testSchema.ts +9 -0
  157. package/src/linter/transformsSchema.ts +35 -0
  158. package/src/tester/createTestInstance.ts +209 -0
  159. package/src/tester/executeTest.ts +436 -0
  160. package/src/tester/index.ts +1 -0
  161. package/src/tester/printTestResult.ts +60 -0
  162. package/src/tester/testProject.ts +129 -0
  163. package/src/utils/index.ts +1 -0
  164. package/src/utils/prettyDuration.ts +27 -0
  165. package/tsconfig.cjs.json +11 -0
package/src/cli/cli.ts ADDED
@@ -0,0 +1,110 @@
1
+ import type { ProjectConfig } from "../config";
2
+ import { Datasource } from "../datasource";
3
+
4
+ import { commonPlugins, nonProjectPlugins, projectBasedPlugins } from "./plugins";
5
+
6
+ export interface ParsedOptions {
7
+ _: string[];
8
+ [key: string]: any;
9
+ }
10
+
11
+ export interface PluginHandlerOptions {
12
+ rootDirectoryPath: string;
13
+ projectConfig: ProjectConfig;
14
+ datasource: Datasource;
15
+ parsed: ParsedOptions;
16
+ }
17
+
18
+ export interface Plugin {
19
+ command: string; // single word
20
+ handler: (options: PluginHandlerOptions) => Promise<void | boolean>;
21
+ examples: {
22
+ command: string; // full command usage
23
+ description: string;
24
+ }[];
25
+ }
26
+
27
+ export interface RunnerOptions {
28
+ rootDirectoryPath: string;
29
+
30
+ // optional because CLI can be used without a project
31
+ projectConfig?: ProjectConfig;
32
+ datasource?: Datasource;
33
+ }
34
+
35
+ export async function runCLI(runnerOptions: RunnerOptions) {
36
+ const yargs = require("yargs");
37
+
38
+ let y = yargs(process.argv.slice(2)).usage("Usage: <command> [options]");
39
+ const registeredSubcommands: string[] = [];
40
+
41
+ const { rootDirectoryPath, projectConfig, datasource } = runnerOptions;
42
+
43
+ function registerPlugin(plugin: Plugin) {
44
+ const subcommand = plugin.command.split(" ")[0];
45
+
46
+ if (registeredSubcommands.includes(subcommand)) {
47
+ console.warn(`Plugin "${subcommand}" already registered. Skipping.`);
48
+ return;
49
+ }
50
+
51
+ y = y.command({
52
+ command: plugin.command,
53
+ handler: async function (parsed: ParsedOptions) {
54
+ // @NOTE: in future, allow yargs options to be defined via plugins
55
+ if (parsed.schemaVersion && typeof parsed.schemaVersion !== "string") {
56
+ parsed.schemaVersion = parsed.schemaVersion.toString();
57
+ }
58
+
59
+ try {
60
+ const result = await plugin.handler({
61
+ rootDirectoryPath,
62
+ projectConfig,
63
+ datasource,
64
+ parsed,
65
+ } as PluginHandlerOptions);
66
+
67
+ if (result === false) {
68
+ process.exit(1);
69
+ }
70
+ } catch (error) {
71
+ console.error(error);
72
+ process.exit(1);
73
+ }
74
+ },
75
+ });
76
+
77
+ for (const example of plugin.examples) {
78
+ y = y.example(`$0 ${example.command}`, example.description);
79
+ }
80
+
81
+ registeredSubcommands.push(subcommand);
82
+ }
83
+
84
+ // non project-based plugins
85
+ if (!projectConfig) {
86
+ for (const plugin of nonProjectPlugins) {
87
+ registerPlugin(plugin);
88
+ }
89
+ }
90
+
91
+ // project-based plugins
92
+ if (projectConfig) {
93
+ for (const plugin of [...projectBasedPlugins, ...(projectConfig.plugins || [])]) {
94
+ registerPlugin(plugin);
95
+ }
96
+ }
97
+
98
+ // common plugins
99
+ for (const plugin of commonPlugins) {
100
+ registerPlugin(plugin);
101
+ }
102
+
103
+ // show help if no command is provided
104
+ y.command({
105
+ command: "*",
106
+ handler() {
107
+ y.showHelp();
108
+ },
109
+ }).argv;
110
+ }
@@ -0,0 +1 @@
1
+ export * from "./cli";
@@ -0,0 +1,13 @@
1
+ import type { Plugin } from "./cli";
2
+
3
+ import { configPlugin } from "../config";
4
+ import { lintPlugin } from "../linter";
5
+ import { buildPlugin } from "../builder";
6
+ import { testPlugin } from "../tester";
7
+ import { initPlugin } from "../init";
8
+
9
+ export const commonPlugins: Plugin[] = [];
10
+
11
+ export const nonProjectPlugins: Plugin[] = [initPlugin];
12
+
13
+ export const projectBasedPlugins: Plugin[] = [configPlugin, lintPlugin, buildPlugin, testPlugin];
@@ -0,0 +1,2 @@
1
+ export * from "./projectConfig";
2
+ export * from "./parsers";
@@ -0,0 +1,40 @@
1
+ import * as YAML from "js-yaml";
2
+
3
+ /**
4
+ * If we want to add more built-in parsers,
5
+ * add them to this object with new file extension as the key,
6
+ * and a function that takes file content as string and returns parsed object as the value.
7
+ */
8
+ export const parsers: { [key: string]: CustomParser } = {
9
+ // YAML
10
+ yml: {
11
+ extension: "yml",
12
+ parse: function <T>(content: string): T {
13
+ return YAML.load(content) as T;
14
+ },
15
+ stringify: function (content: any) {
16
+ return YAML.dump(content);
17
+ },
18
+ },
19
+
20
+ // JSON
21
+ json: {
22
+ extension: "json",
23
+ parse: function <T>(content: string): T {
24
+ return JSON.parse(content) as T;
25
+ },
26
+ stringify: function (content: any) {
27
+ return JSON.stringify(content, null, 2);
28
+ },
29
+ },
30
+ };
31
+
32
+ export type BuiltInParser = keyof typeof parsers; // keys of parsers object
33
+
34
+ export interface CustomParser {
35
+ extension: string;
36
+ parse: <T>(content: string, filePath?: string) => T;
37
+ stringify: (content: any) => string;
38
+ }
39
+
40
+ export type Parser = BuiltInParser | CustomParser;
@@ -0,0 +1,158 @@
1
+ import * as path from "path";
2
+
3
+ import { Parser, parsers } from "./parsers";
4
+ import { FilesystemAdapter } from "../datasource/filesystemAdapter";
5
+ import type { Plugin } from "../cli";
6
+
7
+ export const EVENTS_DIRECTORY_NAME = "events";
8
+ export const ATTRIBUTES_DIRECTORY_NAME = "attributes";
9
+ export const DESTINATIONS_DIRECTORY_NAME = "destinations";
10
+ export const STATES_DIRECTORY_NAME = "states";
11
+ export const EFFECTS_DIRECTORY_NAME = "effects";
12
+ export const TESTS_DIRECTORY_NAME = "tests";
13
+ export const SYSTEM_DIRECTORY_NAME = ".eventvisor";
14
+ export const DATAFILES_DIRECTORY_NAME = "datafiles";
15
+ export const DATAFILE_NAME_PATTERN = "eventvisor-%s.json";
16
+ export const SITE_EXPORT_DIRECTORY_NAME = "out";
17
+
18
+ export const CONFIG_MODULE_NAME = "eventvisor.config.js";
19
+ export const ROOT_DIR_PLACEHOLDER = "<rootDir>";
20
+
21
+ export const DEFAULT_PRETTY_DATAFILE = false;
22
+
23
+ export const DEFAULT_TAGS = ["all"];
24
+ export const DEFAULT_PARSER: Parser = "yml";
25
+
26
+ export const SCHEMA_VERSION = "1"; // default schema version
27
+
28
+ export interface ProjectConfig {
29
+ eventsDirectoryPath: string;
30
+ attributesDirectoryPath: string;
31
+ destinationsDirectoryPath: string;
32
+ statesDirectoryPath: string;
33
+ effectsDirectoryPath: string;
34
+ testsDirectoryPath: string;
35
+ datafilesDirectoryPath: string;
36
+ systemDirectoryPath: string;
37
+ datafileNamePattern: string;
38
+
39
+ tags: string[];
40
+
41
+ adapter: any; // @NOTE: type this properly later
42
+ plugins: Plugin[];
43
+
44
+ parser: Parser;
45
+
46
+ prettyDatafile: boolean;
47
+ stringify: boolean;
48
+ }
49
+
50
+ // rootDirectoryPath: path to the root directory of the project (without ending with a slash)
51
+ export function getProjectConfig(rootDirectoryPath: string): ProjectConfig {
52
+ const baseConfig: ProjectConfig = {
53
+ tags: DEFAULT_TAGS,
54
+
55
+ parser: DEFAULT_PARSER,
56
+
57
+ prettyDatafile: DEFAULT_PRETTY_DATAFILE,
58
+ stringify: true,
59
+
60
+ adapter: FilesystemAdapter,
61
+
62
+ eventsDirectoryPath: path.join(rootDirectoryPath, EVENTS_DIRECTORY_NAME),
63
+ attributesDirectoryPath: path.join(rootDirectoryPath, ATTRIBUTES_DIRECTORY_NAME),
64
+ destinationsDirectoryPath: path.join(rootDirectoryPath, DESTINATIONS_DIRECTORY_NAME),
65
+ statesDirectoryPath: path.join(rootDirectoryPath, STATES_DIRECTORY_NAME),
66
+ effectsDirectoryPath: path.join(rootDirectoryPath, EFFECTS_DIRECTORY_NAME),
67
+ testsDirectoryPath: path.join(rootDirectoryPath, TESTS_DIRECTORY_NAME),
68
+ datafilesDirectoryPath: path.join(rootDirectoryPath, DATAFILES_DIRECTORY_NAME),
69
+ datafileNamePattern: DATAFILE_NAME_PATTERN,
70
+ systemDirectoryPath: path.join(rootDirectoryPath, SYSTEM_DIRECTORY_NAME),
71
+
72
+ plugins: [],
73
+ };
74
+
75
+ const configModulePath = path.join(rootDirectoryPath, CONFIG_MODULE_NAME);
76
+ const customConfig = require(configModulePath);
77
+
78
+ const mergedConfig = {};
79
+
80
+ Object.keys(baseConfig).forEach((key) => {
81
+ mergedConfig[key] =
82
+ typeof customConfig[key] !== "undefined" ? customConfig[key] : baseConfig[key];
83
+
84
+ if (key.endsWith("Path") && mergedConfig[key].indexOf(ROOT_DIR_PLACEHOLDER) !== -1) {
85
+ mergedConfig[key] = mergedConfig[key].replace(ROOT_DIR_PLACEHOLDER, rootDirectoryPath);
86
+ }
87
+ });
88
+
89
+ const finalConfig = mergedConfig as ProjectConfig;
90
+
91
+ if (typeof finalConfig.parser === "string") {
92
+ const allowedParsers = Object.keys(parsers);
93
+ if (allowedParsers.indexOf(finalConfig.parser) === -1) {
94
+ throw new Error(`Invalid parser: ${finalConfig.parser}`);
95
+ }
96
+
97
+ finalConfig.parser = parsers[finalConfig.parser];
98
+ }
99
+
100
+ return finalConfig as ProjectConfig;
101
+ }
102
+
103
+ export interface ShowProjectConfigOptions {
104
+ json?: boolean;
105
+ pretty?: boolean;
106
+ }
107
+
108
+ export function showProjectConfig(
109
+ projectConfig: ProjectConfig,
110
+ options: ShowProjectConfigOptions = {},
111
+ ) {
112
+ if (options.json) {
113
+ console.log(
114
+ options.pretty ? JSON.stringify(projectConfig, null, 2) : JSON.stringify(projectConfig),
115
+ );
116
+
117
+ return;
118
+ }
119
+
120
+ console.log("\nProject configuration:\n");
121
+
122
+ const keys = Object.keys(projectConfig);
123
+ const longestKeyLength = keys.reduce((acc, key) => (key.length > acc ? key.length : acc), 0);
124
+ const ignoreKeys = ["adapter", "parser"];
125
+
126
+ for (const key of keys) {
127
+ if (ignoreKeys.indexOf(key) !== -1) {
128
+ continue;
129
+ }
130
+
131
+ console.log(` - ${key.padEnd(longestKeyLength, " ")}: ${projectConfig[key]}`);
132
+ }
133
+ }
134
+
135
+ export const configPlugin: Plugin = {
136
+ command: "config",
137
+ handler: async ({ rootDirectoryPath, parsed }) => {
138
+ const projectConfig = getProjectConfig(rootDirectoryPath);
139
+ showProjectConfig(projectConfig, {
140
+ json: parsed.json,
141
+ pretty: parsed.pretty,
142
+ });
143
+ },
144
+ examples: [
145
+ {
146
+ command: "config",
147
+ description: "show the project configuration",
148
+ },
149
+ {
150
+ command: "config --print",
151
+ description: "show the project configuration as JSON",
152
+ },
153
+ {
154
+ command: "config --print --pretty",
155
+ description: "show the project configuration (as pretty JSON)",
156
+ },
157
+ ],
158
+ };
@@ -0,0 +1,23 @@
1
+ import type { DatafileContent, EntityType } from "@eventvisor/types";
2
+
3
+ export interface DatafileOptions {
4
+ tag: string;
5
+ datafilesDir?: string;
6
+ }
7
+
8
+ export abstract class Adapter {
9
+ // entities
10
+ abstract listEntities(entityType: EntityType): Promise<string[]>;
11
+ abstract entityExists(entityType: EntityType, entityKey: string): Promise<boolean>;
12
+ abstract readEntity<T>(entityType: EntityType, entityKey: string): Promise<T>;
13
+ abstract writeEntity<T>(entityType: EntityType, entityKey: string, entity: T): Promise<T>;
14
+ abstract deleteEntity(entityType: EntityType, entityKey: string): Promise<void>;
15
+
16
+ // datafile
17
+ abstract readDatafile(options: DatafileOptions): Promise<DatafileContent>;
18
+ abstract writeDatafile(datafileContent: DatafileContent, options: DatafileOptions): Promise<void>;
19
+
20
+ // revision
21
+ abstract readRevision(): Promise<string>;
22
+ abstract writeRevision(revision: string): Promise<void>;
23
+ }
@@ -0,0 +1,164 @@
1
+ import type {
2
+ Event,
3
+ EventName,
4
+ Attribute,
5
+ AttributeName,
6
+ Destination,
7
+ DestinationName,
8
+ Effect,
9
+ EffectName,
10
+ Test,
11
+ TestName,
12
+ DatafileContent,
13
+ } from "@eventvisor/types";
14
+
15
+ import { ProjectConfig, CustomParser } from "../config";
16
+
17
+ import { Adapter, DatafileOptions } from "./adapter";
18
+
19
+ export class Datasource {
20
+ private adapter: Adapter;
21
+
22
+ constructor(
23
+ private config: ProjectConfig,
24
+ private rootDirectoryPath?: string,
25
+ ) {
26
+ this.adapter = new config.adapter(config, rootDirectoryPath);
27
+ }
28
+
29
+ // @NOTE: only site generator needs it, find a way to get it out of here later
30
+ getExtension() {
31
+ return (this.config.parser as CustomParser).extension;
32
+ }
33
+
34
+ /**
35
+ * Revision
36
+ */
37
+ readRevision() {
38
+ return this.adapter.readRevision();
39
+ }
40
+
41
+ writeRevision(revision: string) {
42
+ return this.adapter.writeRevision(revision);
43
+ }
44
+
45
+ /**
46
+ * Datafile
47
+ */
48
+ readDatafile(options: DatafileOptions) {
49
+ return this.adapter.readDatafile(options);
50
+ }
51
+
52
+ writeDatafile(datafileContent: DatafileContent, options: DatafileOptions) {
53
+ return this.adapter.writeDatafile(datafileContent, options);
54
+ }
55
+
56
+ /**
57
+ * Entity specific methods
58
+ */
59
+
60
+ // events
61
+ listEvents() {
62
+ return this.adapter.listEntities("event");
63
+ }
64
+
65
+ eventExists(eventName: EventName) {
66
+ return this.adapter.entityExists("event", eventName);
67
+ }
68
+
69
+ readEvent(eventName: EventName) {
70
+ return this.adapter.readEntity<Event>("event", eventName);
71
+ }
72
+
73
+ writeEvent(eventName: EventName, event: Event) {
74
+ return this.adapter.writeEntity<Event>("event", eventName, event);
75
+ }
76
+
77
+ deleteEvent(eventName: EventName) {
78
+ return this.adapter.deleteEntity("event", eventName);
79
+ }
80
+
81
+ // attributes
82
+ listAttributes() {
83
+ return this.adapter.listEntities("attribute");
84
+ }
85
+
86
+ attributeExists(attributeName: AttributeName) {
87
+ return this.adapter.entityExists("attribute", attributeName);
88
+ }
89
+
90
+ readAttribute(attributeName: AttributeName) {
91
+ return this.adapter.readEntity<Attribute>("attribute", attributeName);
92
+ }
93
+
94
+ writeAttribute(attributeName: AttributeName, attribute: Attribute) {
95
+ return this.adapter.writeEntity<Attribute>("attribute", attributeName, attribute);
96
+ }
97
+
98
+ deleteAttribute(attributeName: AttributeName) {
99
+ return this.adapter.deleteEntity("attribute", attributeName);
100
+ }
101
+
102
+ // destinations
103
+ listDestinations() {
104
+ return this.adapter.listEntities("destination");
105
+ }
106
+
107
+ destinationExists(destinationName: DestinationName) {
108
+ return this.adapter.entityExists("destination", destinationName);
109
+ }
110
+
111
+ readDestination(destinationName: DestinationName) {
112
+ return this.adapter.readEntity<Destination>("destination", destinationName);
113
+ }
114
+
115
+ writeDestination(destinationName: DestinationName, destination: Destination) {
116
+ return this.adapter.writeEntity<Destination>("destination", destinationName, destination);
117
+ }
118
+
119
+ deleteDestination(destinationName: DestinationName) {
120
+ return this.adapter.deleteEntity("destination", destinationName);
121
+ }
122
+
123
+ // effects
124
+ listEffects() {
125
+ return this.adapter.listEntities("effect");
126
+ }
127
+
128
+ effectExists(effectName: EffectName) {
129
+ return this.adapter.entityExists("effect", effectName);
130
+ }
131
+
132
+ readEffect(effectName: EffectName) {
133
+ return this.adapter.readEntity<Effect>("effect", effectName);
134
+ }
135
+
136
+ writeEffect(effectName: EffectName, effect: Effect) {
137
+ return this.adapter.writeEntity<Effect>("effect", effectName, effect);
138
+ }
139
+
140
+ deleteEffect(effectName: EffectName) {
141
+ return this.adapter.deleteEntity("effect", effectName);
142
+ }
143
+
144
+ // tests
145
+ listTests() {
146
+ return this.adapter.listEntities("test");
147
+ }
148
+
149
+ readTest(testName: TestName) {
150
+ return this.adapter.readEntity<Test>("test", testName);
151
+ }
152
+
153
+ writeTest(testName: TestName, test: Test) {
154
+ return this.adapter.writeEntity<Test>("test", testName, test);
155
+ }
156
+
157
+ deleteTest(testName: TestName) {
158
+ return this.adapter.deleteEntity("test", testName);
159
+ }
160
+
161
+ getTestSpecName(testName: TestName) {
162
+ return `${testName}.${this.getExtension()}`;
163
+ }
164
+ }