@mat3ra/esse 2026.8.18-0 → 2026.8.18-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 (39) hide show
  1. package/dist/js/esse/JSONSchemasGenerator.d.ts +21 -0
  2. package/dist/js/esse/JSONSchemasGenerator.js +72 -0
  3. package/dist/js/esse/JSONSchemasInterface.d.ts +48 -0
  4. package/dist/js/esse/JSONSchemasInterface.js +80 -0
  5. package/dist/js/esse/JSONSchemasInterfaceServer.d.ts +9 -0
  6. package/dist/js/esse/JSONSchemasInterfaceServer.js +45 -0
  7. package/dist/js/esse/schemaUtils.d.ts +4 -0
  8. package/dist/js/esse/schemaUtils.js +16 -0
  9. package/dist/js/esse/server/utils.d.ts +12 -0
  10. package/dist/js/esse/server/utils.js +67 -0
  11. package/dist/js/esse/settings.d.ts +3 -0
  12. package/dist/js/esse/settings.js +10 -0
  13. package/dist/js/esse/types.d.ts +3 -0
  14. package/dist/js/esse/types.js +2 -0
  15. package/dist/js/esse/utils.d.ts +5 -0
  16. package/dist/js/esse/utils.js +51 -0
  17. package/dist/js/json_include/index.d.ts +22 -0
  18. package/dist/js/json_include/index.js +75 -0
  19. package/dist/js/json_include/settings.d.ts +3 -0
  20. package/dist/js/json_include/settings.js +6 -0
  21. package/dist/js/scripts/compileTs.d.ts +1 -0
  22. package/dist/js/scripts/compileTs.js +80 -0
  23. package/dist/js/scripts/createEnumsFromYaml.d.ts +1 -0
  24. package/dist/js/scripts/createEnumsFromYaml.js +28 -0
  25. package/dist/js/scripts/setSchemaIds.d.ts +5 -0
  26. package/dist/js/scripts/setSchemaIds.js +30 -0
  27. package/dist/js/types.d.ts +80178 -0
  28. package/dist/js/types.js +91 -0
  29. package/dist/js/utils/ajv.d.ts +34 -0
  30. package/dist/js/utils/ajv.js +125 -0
  31. package/dist/js/utils/ajvKeywords/jsonSchemaToTypescriptKeywords.d.ts +7 -0
  32. package/dist/js/utils/ajvKeywords/jsonSchemaToTypescriptKeywords.js +21 -0
  33. package/dist/js/utils/common.d.ts +6 -0
  34. package/dist/js/utils/common.js +14 -0
  35. package/dist/js/utils/filesystem.d.ts +2 -0
  36. package/dist/js/utils/filesystem.js +37 -0
  37. package/dist/js/utils/removeEmptyAndNullProperties.d.ts +9 -0
  38. package/dist/js/utils/removeEmptyAndNullProperties.js +29 -0
  39. package/package.json +3 -2
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const js_yaml_1 = __importDefault(require("js-yaml"));
8
+ const lodash_1 = __importDefault(require("lodash"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const filesystem_1 = require("../utils/filesystem");
11
+ /**
12
+ * We use YAML files to list enum options which need to be reused in other places.
13
+ * The format also allows for additional context to the often shortened slugs, such as DOIs.
14
+ * This script converts the enum lists to JSON files for $ref blocks inside schemas.
15
+ */
16
+ const SCHEMA_DIR = "../../../schema/";
17
+ (0, filesystem_1.walkDir)(SCHEMA_DIR, (filePath) => {
18
+ if (path_1.default.extname(filePath) !== ".yml") {
19
+ return;
20
+ }
21
+ console.log(filePath);
22
+ const outFilename = `${path_1.default.basename(filePath, ".yml")}.json`;
23
+ const dirname = path_1.default.dirname(filePath);
24
+ const fileContents = fs_1.default.readFileSync(filePath);
25
+ const obj = js_yaml_1.default.load(fileContents.toString());
26
+ const enumObj = lodash_1.default.mapValues(obj, (value) => ({ enum: value }));
27
+ fs_1.default.writeFileSync(`${path_1.default.join(dirname, outFilename)}`, `${JSON.stringify(enumObj, null, 4)}\n`);
28
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Helper script.
3
+ * Applies correct $id to all schemas based on the schema path
4
+ */
5
+ export default function setSchemaIds(schemaDir: string): void;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = setSchemaIds;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const filesystem_1 = require("../utils/filesystem");
10
+ /**
11
+ * Helper script.
12
+ * Applies correct $id to all schemas based on the schema path
13
+ */
14
+ function setSchemaIds(schemaDir) {
15
+ (0, filesystem_1.walkDirSync)(schemaDir, (filePath) => {
16
+ if (path_1.default.extname(filePath) !== ".json") {
17
+ return;
18
+ }
19
+ const fileContents = fs_1.default.readFileSync(filePath);
20
+ console.log(filePath);
21
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+ const { $id, ...schema } = JSON.parse(fileContents.toString());
23
+ const schemaId = filePath.replace(schemaDir, "").replace(".json", "").replace(/_/g, "-");
24
+ if ($id !== schemaId) {
25
+ console.log(`Set correct $id: ${filePath}`);
26
+ const newContent = JSON.stringify({ $id: schemaId, ...schema }, null, 4);
27
+ fs_1.default.writeFileSync(filePath, `${newContent}\n`);
28
+ }
29
+ });
30
+ }