@fontoxml/fontoxml-development-tools 3.10.0 → 3.12.0-beta.1

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 (206) hide show
  1. package/npm-shrinkwrap.json +3842 -8330
  2. package/package.json +13 -19
  3. package/src/App.js +1 -1
  4. package/src/FdtCommand.js +3 -3
  5. package/src/FdtLicense.js +95 -114
  6. package/src/ModuleRegistrationApi.js +44 -16
  7. package/src/addCoreModulesToApp.js +8 -0
  8. package/src/editorVersions.js +19 -5
  9. package/src/modules/connectors/index.js +109 -16
  10. package/src/modules/connectors/instanceBuild/Dockerfile.build +1 -1
  11. package/src/modules/connectors/instanceBuild/Dockerfile.run +1 -1
  12. package/src/modules/connectors/instanceDevBuild/docker-compose.yml +2 -2
  13. package/src/modules/content-quality/index.js +101 -20
  14. package/src/modules/content-quality/instanceBuild/Dockerfile +1 -1
  15. package/src/modules/content-quality/instanceDevBuild/docker-compose.yml +1 -1
  16. package/src/modules/core/src/precontroller.help.js +23 -26
  17. package/src/modules/document-history/index.js +101 -20
  18. package/src/modules/document-history/instanceBuild/Dockerfile +1 -1
  19. package/src/modules/document-history/instanceDevBuild/docker-compose.yml +1 -1
  20. package/src/modules/editor/dev-cms/connectors-cms-standard/configureConnectorsCmsStandardDocumentRouter.js +10 -0
  21. package/src/modules/editor/dev-cms/connectors-cms-standard/configureDocumentHistoryGetPostRouteHandler.js +51 -0
  22. package/src/modules/editor/dev-cms/connectors-cms-standard/configureDocumentPostRouteHandler.js +65 -76
  23. package/src/modules/editor/dev-cms/connectors-cms-standard/configureDocumentPresearchPostRouteHandler.js +10 -7
  24. package/src/modules/editor/dev-cms/connectors-cms-standard/configureDocumentPreviewRouteHandler.js +10 -0
  25. package/src/modules/editor/dev-cms/connectors-cms-standard/configureDocumentRevisionGetPostRouteHandler.js +69 -0
  26. package/src/modules/editor/src/commands/command.convert.editor.controller.js +11 -4
  27. package/src/modules/editor/src/commands/command.convert.package.controller.js +11 -4
  28. package/src/modules/editor/src/getAppManifest.js +3 -3
  29. package/src/modules/editor/src/getWebpackConfig.js +13 -0
  30. package/src/modules/editor/src/webpackPlugins/CheckDeepImportsResolvePlugin.js +4 -0
  31. package/src/modules/editor-pre-7-7-0/src/api/downloadEditorSDK.js +16 -12
  32. package/src/modules/editor-pre-7-7-0/src/api/executeAndLog.js +3 -2
  33. package/src/modules/editor-pre-7-7-0/src/api/init/createConfigConfiguration.js +86 -48
  34. package/src/modules/editor-pre-7-7-0/src/api/schema/compile.js +16 -22
  35. package/src/modules/editor-pre-7-7-0/src/api/schema/createSchemaPackages.js +8 -0
  36. package/src/modules/editor-pre-7-7-0/src/api/schema/getSchemaFontoJson.js +76 -48
  37. package/src/modules/editor-pre-7-7-0/src/api/schema/zipHelpers.js +6 -1
  38. package/src/modules/editor-pre-7-7-0/src/command.schema.compile.controller.js +51 -2
  39. package/src/modules/editor-pre-7-7-0/test/api/init/createConfigConfiguration.test.js +71 -33
  40. package/src/modules/editor-pre-7-7-0/test/api/init/fixtures/configjs-7160.js +45 -0
  41. package/src/modules/editor-pre-7-7-0/test/api/init/fixtures/configjs-800.js +45 -0
  42. package/src/modules/editor-pre-7-7-0/test/api/init/fixtures/configjs-810.js +32 -0
  43. package/src/modules/editor-pre-7-7-0/test/api/schema/buildSchemaExperienceConfigurationModel.test.js +70 -79
  44. package/src/modules/editor-pre-7-7-0/test/api/schema/fixtures/dita-example-schema-bundle/listOfFiles.json +1 -36
  45. package/src/modules/editor-pre-7-7-0/test/api/schema/fixtures/invalid-fonto-json/fonto.json +1 -0
  46. package/src/modules/editor-pre-7-7-0/test/api/schema/getSchemaFontoJson.test.js +174 -0
  47. package/src/modules/editor-pre-7-7-0/test/api/schema/zipSchemaSource.test.js +10 -4
  48. package/src/modules/editor-pre-7-7-0/test/schemaCompileController.test.js +205 -0
  49. package/src/modules/localization/index.js +2 -2
  50. package/src/modules/operations/src/api/getOperations.js +3 -3
  51. package/src/modules/review/index.js +103 -18
  52. package/src/modules/review/instanceBuild/Dockerfile +1 -1
  53. package/src/modules/review/instanceDevBuild/docker-compose.yml +1 -1
  54. package/src/modules/schema/src/api/getSchemaSummaries.js +2 -2
  55. package/src/modules/schema/test/getSchemaSummaries.test.js +14 -10
  56. package/src/modules/schema-compiler/index.js +99 -18
  57. package/src/modules/schema-compiler/instanceBuild/Dockerfile +1 -1
  58. package/src/modules/schema-compiler/instanceDevBuild/docker-compose.yml +1 -1
  59. package/src/modules/shared/index.js +3 -0
  60. package/src/modules/shared/package.json +14 -0
  61. package/src/modules/shared/src/addBackendDockerCommands.js +334 -0
  62. package/src/modules/shared/src/addBackendDownloadSelfContainedCommands.js +78 -0
  63. package/src/modules/shared/src/addBackendVersionsCommands.js +55 -0
  64. package/src/modules/shared/src/controller-templates/command.backend.build.controller.factory.js +273 -0
  65. package/src/modules/shared/src/controller-templates/command.backend.download-self-contained.controller.factory.js +131 -0
  66. package/src/modules/shared/src/controller-templates/command.backend.init.controller.factory.js +88 -0
  67. package/src/modules/shared/src/controller-templates/command.backend.run.controller.factory.js +420 -0
  68. package/src/modules/shared/src/controller-templates/command.backend.upgrade.controller.factory.js +79 -0
  69. package/src/modules/shared/src/controller-templates/command.backend.versions.controller.factory.js +23 -0
  70. package/src/modules/shared/src/controller-templates/docker/BackendManifest.js +42 -0
  71. package/src/modules/shared/src/controller-templates/docker/copyWhitelistedFiles.js +23 -0
  72. package/src/modules/shared/src/controller-templates/docker/dockerCleanup.js +146 -0
  73. package/src/modules/shared/src/controller-templates/docker/tryDockerLogout.js +31 -0
  74. package/src/modules/shared/src/controller-templates/docker/validateBackendInstance.js +48 -0
  75. package/src/modules/shared/src/ensureDockerCommands.js +61 -0
  76. package/src/modules/shared/src/executeAndLog.js +113 -0
  77. package/src/modules/{review/src/utilities/setEntryVisibility.js → shared/src/setFileVisibility.js} +8 -2
  78. package/src/modules/spell-checker/index.js +101 -18
  79. package/src/modules/spell-checker/instanceBuild/Dockerfile +1 -1
  80. package/src/modules/spell-checker/instanceDevBuild/docker-compose.yml +1 -1
  81. package/test/module.shared.test.js +81 -0
  82. package/src/modules/connectors/src/command.build.controller.js +0 -256
  83. package/src/modules/connectors/src/command.build.js +0 -54
  84. package/src/modules/connectors/src/command.download-self-contained.controller.js +0 -110
  85. package/src/modules/connectors/src/command.download-self-contained.js +0 -50
  86. package/src/modules/connectors/src/command.init.controller.js +0 -91
  87. package/src/modules/connectors/src/command.init.js +0 -42
  88. package/src/modules/connectors/src/command.run.controller.js +0 -462
  89. package/src/modules/connectors/src/command.run.js +0 -67
  90. package/src/modules/connectors/src/command.upgrade.controller.js +0 -52
  91. package/src/modules/connectors/src/command.upgrade.js +0 -42
  92. package/src/modules/connectors/src/command.versions.controller.js +0 -14
  93. package/src/modules/connectors/src/command.versions.js +0 -25
  94. package/src/modules/connectors/src/utilities/FontoxmlConnectorsManifest.js +0 -32
  95. package/src/modules/connectors/src/utilities/cleanup.js +0 -70
  96. package/src/modules/connectors/src/utilities/constants.js +0 -42
  97. package/src/modules/connectors/src/utilities/copyWhitelistedFiles.js +0 -22
  98. package/src/modules/connectors/src/utilities/executeAndLog.js +0 -63
  99. package/src/modules/connectors/src/utilities/getVerbosityLevel.js +0 -11
  100. package/src/modules/connectors/src/utilities/getWhitelist.js +0 -16
  101. package/src/modules/connectors/src/utilities/setEntryVisibility.js +0 -22
  102. package/src/modules/connectors/src/utilities/validateInstance.js +0 -29
  103. package/src/modules/content-quality/src/command.build.controller.js +0 -260
  104. package/src/modules/content-quality/src/command.build.js +0 -56
  105. package/src/modules/content-quality/src/command.download-self-contained.controller.js +0 -110
  106. package/src/modules/content-quality/src/command.download-self-contained.js +0 -52
  107. package/src/modules/content-quality/src/command.init.controller.js +0 -91
  108. package/src/modules/content-quality/src/command.init.js +0 -44
  109. package/src/modules/content-quality/src/command.run.controller.js +0 -444
  110. package/src/modules/content-quality/src/command.run.js +0 -64
  111. package/src/modules/content-quality/src/command.upgrade.controller.js +0 -52
  112. package/src/modules/content-quality/src/command.upgrade.js +0 -44
  113. package/src/modules/content-quality/src/command.versions.controller.js +0 -14
  114. package/src/modules/content-quality/src/command.versions.js +0 -25
  115. package/src/modules/content-quality/src/utilities/FontoxmlFcqManifest.js +0 -30
  116. package/src/modules/content-quality/src/utilities/cleanup.js +0 -70
  117. package/src/modules/content-quality/src/utilities/constants.js +0 -44
  118. package/src/modules/content-quality/src/utilities/copyWhitelistedFiles.js +0 -22
  119. package/src/modules/content-quality/src/utilities/executeAndLog.js +0 -63
  120. package/src/modules/content-quality/src/utilities/getVerbosityLevel.js +0 -11
  121. package/src/modules/content-quality/src/utilities/getWhitelist.js +0 -16
  122. package/src/modules/content-quality/src/utilities/setEntryVisibility.js +0 -22
  123. package/src/modules/content-quality/src/utilities/validateInstance.js +0 -29
  124. package/src/modules/document-history/src/command.build.controller.js +0 -260
  125. package/src/modules/document-history/src/command.build.js +0 -56
  126. package/src/modules/document-history/src/command.download-self-contained.controller.js +0 -110
  127. package/src/modules/document-history/src/command.download-self-contained.js +0 -50
  128. package/src/modules/document-history/src/command.init.controller.js +0 -91
  129. package/src/modules/document-history/src/command.init.js +0 -44
  130. package/src/modules/document-history/src/command.run.controller.js +0 -444
  131. package/src/modules/document-history/src/command.run.js +0 -64
  132. package/src/modules/document-history/src/command.upgrade.controller.js +0 -52
  133. package/src/modules/document-history/src/command.upgrade.js +0 -44
  134. package/src/modules/document-history/src/command.versions.controller.js +0 -14
  135. package/src/modules/document-history/src/command.versions.js +0 -25
  136. package/src/modules/document-history/src/utilities/FontoxmlFdhManifest.js +0 -30
  137. package/src/modules/document-history/src/utilities/cleanup.js +0 -70
  138. package/src/modules/document-history/src/utilities/constants.js +0 -44
  139. package/src/modules/document-history/src/utilities/copyWhitelistedFiles.js +0 -22
  140. package/src/modules/document-history/src/utilities/executeAndLog.js +0 -63
  141. package/src/modules/document-history/src/utilities/getVerbosityLevel.js +0 -11
  142. package/src/modules/document-history/src/utilities/getWhitelist.js +0 -16
  143. package/src/modules/document-history/src/utilities/setEntryVisibility.js +0 -22
  144. package/src/modules/document-history/src/utilities/validateInstance.js +0 -29
  145. package/src/modules/review/src/command.build.controller.js +0 -256
  146. package/src/modules/review/src/command.build.js +0 -54
  147. package/src/modules/review/src/command.download-self-contained.controller.js +0 -107
  148. package/src/modules/review/src/command.download-self-contained.js +0 -50
  149. package/src/modules/review/src/command.init.controller.js +0 -89
  150. package/src/modules/review/src/command.init.js +0 -42
  151. package/src/modules/review/src/command.run.controller.js +0 -428
  152. package/src/modules/review/src/command.run.js +0 -60
  153. package/src/modules/review/src/command.upgrade.controller.js +0 -59
  154. package/src/modules/review/src/command.upgrade.js +0 -42
  155. package/src/modules/review/src/command.versions.controller.js +0 -12
  156. package/src/modules/review/src/command.versions.js +0 -25
  157. package/src/modules/review/src/utilities/FontoxmlReviewManifest.js +0 -30
  158. package/src/modules/review/src/utilities/cleanup.js +0 -70
  159. package/src/modules/review/src/utilities/constants.js +0 -42
  160. package/src/modules/review/src/utilities/copyWhitelistedFiles.js +0 -22
  161. package/src/modules/review/src/utilities/executeAndLog.js +0 -63
  162. package/src/modules/review/src/utilities/getVerbosityLevel.js +0 -11
  163. package/src/modules/review/src/utilities/getWhitelist.js +0 -16
  164. package/src/modules/review/src/utilities/validateInstance.js +0 -45
  165. package/src/modules/schema-compiler/src/command.build.controller.js +0 -256
  166. package/src/modules/schema-compiler/src/command.build.js +0 -54
  167. package/src/modules/schema-compiler/src/command.download-self-contained.controller.js +0 -110
  168. package/src/modules/schema-compiler/src/command.download-self-contained.js +0 -50
  169. package/src/modules/schema-compiler/src/command.init.controller.js +0 -91
  170. package/src/modules/schema-compiler/src/command.init.js +0 -42
  171. package/src/modules/schema-compiler/src/command.run.controller.js +0 -430
  172. package/src/modules/schema-compiler/src/command.run.js +0 -60
  173. package/src/modules/schema-compiler/src/command.upgrade.controller.js +0 -64
  174. package/src/modules/schema-compiler/src/command.upgrade.js +0 -42
  175. package/src/modules/schema-compiler/src/command.versions.controller.js +0 -14
  176. package/src/modules/schema-compiler/src/command.versions.js +0 -25
  177. package/src/modules/schema-compiler/src/utilities/FontoxmlSchemaCompilerManifest.js +0 -32
  178. package/src/modules/schema-compiler/src/utilities/cleanup.js +0 -70
  179. package/src/modules/schema-compiler/src/utilities/constants.js +0 -43
  180. package/src/modules/schema-compiler/src/utilities/copyWhitelistedFiles.js +0 -22
  181. package/src/modules/schema-compiler/src/utilities/executeAndLog.js +0 -63
  182. package/src/modules/schema-compiler/src/utilities/getVerbosityLevel.js +0 -11
  183. package/src/modules/schema-compiler/src/utilities/getWhitelist.js +0 -16
  184. package/src/modules/schema-compiler/src/utilities/setEntryVisibility.js +0 -22
  185. package/src/modules/schema-compiler/src/utilities/validateInstance.js +0 -47
  186. package/src/modules/spell-checker/src/command.build.controller.js +0 -257
  187. package/src/modules/spell-checker/src/command.build.js +0 -54
  188. package/src/modules/spell-checker/src/command.download-self-contained.controller.js +0 -110
  189. package/src/modules/spell-checker/src/command.download-self-contained.js +0 -50
  190. package/src/modules/spell-checker/src/command.init.controller.js +0 -91
  191. package/src/modules/spell-checker/src/command.init.js +0 -42
  192. package/src/modules/spell-checker/src/command.run.controller.js +0 -430
  193. package/src/modules/spell-checker/src/command.run.js +0 -62
  194. package/src/modules/spell-checker/src/command.upgrade.controller.js +0 -61
  195. package/src/modules/spell-checker/src/command.upgrade.js +0 -42
  196. package/src/modules/spell-checker/src/command.versions.controller.js +0 -14
  197. package/src/modules/spell-checker/src/command.versions.js +0 -25
  198. package/src/modules/spell-checker/src/utilities/FontoxmlSpellCheckerManifest.js +0 -32
  199. package/src/modules/spell-checker/src/utilities/cleanup.js +0 -70
  200. package/src/modules/spell-checker/src/utilities/constants.js +0 -42
  201. package/src/modules/spell-checker/src/utilities/copyWhitelistedFiles.js +0 -22
  202. package/src/modules/spell-checker/src/utilities/executeAndLog.js +0 -63
  203. package/src/modules/spell-checker/src/utilities/getVerbosityLevel.js +0 -11
  204. package/src/modules/spell-checker/src/utilities/getWhitelist.js +0 -16
  205. package/src/modules/spell-checker/src/utilities/setEntryVisibility.js +0 -22
  206. package/src/modules/spell-checker/src/utilities/validateInstance.js +0 -47
@@ -0,0 +1,45 @@
1
+ // This configuration file defines constants that can be used throughout the rest of your FontoXML
2
+ // Editor configuration. You can configure existing product options, or create custom configuration
3
+ // options. Values that you set here may be either a value or an asynchronous promise to a value,
4
+ // and can be used in other files by importing the configurationManager and using
5
+ // configurationManager.get().
6
+ // For more information:
7
+ // https://documentation.fontoxml.com/latest/configurationmanager-3e0d8dbacb90
8
+ import configurationManager from 'fontoxml-configuration/src/configurationManager';
9
+
10
+ // Enable an experiment where, when pressing enter at the edges of elements, the cursor is prevented
11
+ // from ending up in positions that are not reachable using the cursor keys.
12
+ // For more information:
13
+ // https://documentation.fontoxml.com/latest/enable-experiment-correct-selection-after-enter-8d2ce78e26b8
14
+ configurationManager.set(
15
+ 'enable-experiment/correct-selection-after-enter',
16
+ true
17
+ );
18
+
19
+ // The node name of the element that will be created for paragraphs in pasted plain-text content.
20
+ // The configuration value is the paragraph counterpart element name.
21
+ // Additional clipboard configuration can be found in the editor-clipboard-configuration package.
22
+ // For more information:
23
+ // https://documentation.fontoxml.com/latest/configure-clipboard-behavior-bc607964d3f5
24
+ // https://documentation.fontoxml.com/latest/paragraph-node-name-for-pasting-94d4327c8363
25
+ //
26
+ // TODO 👉: Verify that "p" is a sensible default text container.
27
+ // Example:
28
+ // configurationManager.set('paragraph-node-name-for-pasting', 'p');
29
+
30
+ // Set to an array of objects to determine the identifying attributes for which a GUID will be
31
+ // generated automatically.
32
+ // For more information:
33
+ // https://documentation.fontoxml.com/latest/unique-id-configurations-94fe53ca7bfb
34
+ //
35
+ // TODO 👉: If identifier attributes are missing, add them.
36
+ // TODO 👉: Adjust the selector to exclude elements where identifiers are not desired.
37
+ // Example:
38
+ // configurationManager.set('unique-id-configurations', [
39
+ // {
40
+ // selector: 'self::*',
41
+ // namespaceURI: null,
42
+ // localName: 'id',
43
+ // strategy: 'unique-for-document',
44
+ // },
45
+ // ]);
@@ -0,0 +1,45 @@
1
+ // This configuration file defines constants that can be used throughout the rest of your FontoXML
2
+ // Editor configuration. You can configure existing product options, or create custom configuration
3
+ // options. Values that you set here may be either a value or an asynchronous promise to a value,
4
+ // and can be used in other files by importing the configurationManager and using
5
+ // configurationManager.get().
6
+ // For more information:
7
+ // https://documentation.fontoxml.com/latest/configurationmanager-3e0d8dbacb90
8
+ import configurationManager from 'fontoxml-configuration/src/configurationManager';
9
+ import xq from 'fontoxml-selectors/src/xq';
10
+
11
+ // Enable an experiment where, when pressing enter at the edges of elements, the cursor is prevented
12
+ // from ending up in positions that are not reachable using the cursor keys.
13
+ // For more information:
14
+ // https://documentation.fontoxml.com/latest/enable-experiment-correct-selection-after-enter-8d2ce78e26b8
15
+ configurationManager.set(
16
+ 'enable-experiment/correct-selection-after-enter',
17
+ true
18
+ );
19
+
20
+ // The node name of the element that will be created for paragraphs in pasted plain-text content.
21
+ // The configuration value is the paragraph counterpart element name.
22
+ // Additional clipboard configuration can be found in the editor-clipboard-configuration package.
23
+ // For more information:
24
+ // https://documentation.fontoxml.com/latest/configure-clipboard-behavior-bc607964d3f5
25
+ // https://documentation.fontoxml.com/latest/paragraph-node-name-for-pasting-94d4327c8363
26
+ //
27
+ // TODO 👉: Verify that "p" is a sensible default text container.
28
+ configurationManager.set('paragraph-node-name-for-pasting', 'p');
29
+
30
+ // Set to an array of objects to determine the identifying attributes for which a GUID will be
31
+ // generated automatically.
32
+ // For more information:
33
+ // https://documentation.fontoxml.com/latest/unique-id-configurations-94fe53ca7bfb
34
+ //
35
+ // TODO 👉: If identifier attributes are missing, add them.
36
+ // TODO 👉: Adjust the selector to exclude elements where identifiers are not desired.
37
+ // Example:
38
+ // configurationManager.set('unique-id-configurations', [
39
+ // {
40
+ // selector: xq`self::*`,
41
+ // namespaceURI: null,
42
+ // localName: 'id',
43
+ // strategy: 'unique-for-document',
44
+ // },
45
+ // ]);
@@ -0,0 +1,32 @@
1
+ // This configuration file defines constants that can be used throughout the rest of your FontoXML
2
+ // Editor configuration. You can configure existing product options, or create custom configuration
3
+ // options. Values that you set here may be either a value or an asynchronous promise to a value,
4
+ // and can be used in other files by importing the configurationManager and using
5
+ // configurationManager.get().
6
+ // For more information:
7
+ // https://documentation.fontoxml.com/latest/configurationmanager-3e0d8dbacb90
8
+ import configurationManager from 'fontoxml-configuration/src/configurationManager';
9
+ import namespaceManager from 'fontoxml-dom-namespaces/src/namespaceManager';
10
+ import xq from 'fontoxml-selectors/src/xq';
11
+
12
+ // Set to an array of objects to determine the identifying attributes for which a GUID will be
13
+ // generated automatically.
14
+ // For more information:
15
+ // https://documentation.fontoxml.com/latest/unique-id-configurations-94fe53ca7bfb
16
+ //
17
+ // TODO 👉: If identifier attributes are missing, add them.
18
+ // TODO 👉: Adjust the selector to exclude elements where identifiers are not desired.
19
+ configurationManager.set('unique-id-configurations', [
20
+ {
21
+ selector: xq`self::*`,
22
+ namespaceURI: null,
23
+ localName: 'id',
24
+ strategy: 'unique-for-document',
25
+ },
26
+ ]);
27
+
28
+ // Register namespaces with prefixes.
29
+ // For more information:
30
+ // https://documentation.fontoxml.com/latest/namespacemanager-c80956c5d6d7
31
+ // https://documentation.fontoxml.com/latest/namespaces-2b1bbc7b4f79
32
+ namespaceManager.addNamespace('mml', 'http://www.w3.org/1998/Math/MathML');
@@ -505,93 +505,84 @@ describe('api/schema/buildSchemaExperienceConfigurationModel', () => {
505
505
  throw new Error('No fixtures found.');
506
506
  }
507
507
 
508
- const fixturesBlacklist = [];
508
+ const fixturesBlacklist = ['invalid-fonto-json'];
509
509
  fixtures.forEach((fixture) => {
510
- const testFunction = fixturesBlacklist.includes(fixture)
511
- ? it.skip
512
- : it;
513
-
514
- testFunction(
515
- `can build model for fixture "${fixture}"`,
516
- async function () {
517
- this.slow(500);
518
-
519
- const fixturePath = path.join(fixturesPath, fixture);
520
- const compiledSchemaFilePath = path.join(
521
- fixturePath,
522
- 'compiledSchema.json'
523
- );
524
- const fontoJsonFilePath = path.join(
525
- fixturePath,
526
- 'fonto.json'
527
- );
510
+ if (fixturesBlacklist.includes(fixture)) {
511
+ return;
512
+ }
528
513
 
529
- // Recompile the schema using the schema compiler when updating snapshots and the compiled schema does NOT exist.
530
- if (
531
- UPDATE_SNAPSHOTS &&
532
- !(await fs
533
- .access(compiledSchemaFilePath)
534
- .then(() => true)
535
- .catch(() => false))
536
- ) {
537
- this.timeout(120000);
538
- this.slow(60000);
539
- console.warn(
540
- mochaColoring(
541
- 'error stack',
542
- ` - Compiling schema for fixture "${fixture}"...`
543
- )
544
- );
545
- const schemaCompileResults = await compileSchema(
546
- fixturePath
547
- );
548
- await fs.writeJson(
549
- compiledSchemaFilePath,
550
- schemaCompileResults
551
- );
552
- }
514
+ it(`can build model for fixture "${fixture}"`, async function () {
515
+ this.slow(500);
553
516
 
554
- // Build the schema model.
555
- const fontoJson = await fs.readJson(fontoJsonFilePath);
556
- const schemaPackagesByXsdPath = fontoJson.rootSchemas;
557
- const compiledSchemaResultsByXsdPath = await fs.readJson(
558
- compiledSchemaFilePath
559
- );
560
- const prefixByNamespaceUri = getprefixByNamespaceUri(
561
- compiledSchemaResultsByXsdPath
562
- );
563
- const result = buildSchemaExperienceConfigurationModel(
564
- schemaPackagesByXsdPath,
565
- compiledSchemaResultsByXsdPath,
566
- prefixByNamespaceUri
567
- );
517
+ const fixturePath = path.join(fixturesPath, fixture);
518
+ const compiledSchemaFilePath = path.join(
519
+ fixturePath,
520
+ 'compiledSchema.json'
521
+ );
522
+ const fontoJsonFilePath = path.join(fixturePath, 'fonto.json');
568
523
 
569
- // Sanity check.
570
- sanityCheckResult(
571
- result,
572
- schemaPackagesByXsdPath,
573
- compiledSchemaResultsByXsdPath
524
+ // Recompile the schema using the schema compiler when updating snapshots and the compiled schema does NOT exist.
525
+ if (
526
+ UPDATE_SNAPSHOTS &&
527
+ !(await fs
528
+ .access(compiledSchemaFilePath)
529
+ .then(() => true)
530
+ .catch(() => false))
531
+ ) {
532
+ this.timeout(120000);
533
+ this.slow(60000);
534
+ console.warn(
535
+ mochaColoring(
536
+ 'error stack',
537
+ ` - Compiling schema for fixture "${fixture}"...`
538
+ )
574
539
  );
575
-
576
- // Assert against snapshot, and optionally update the snapshot.
577
- const serializedResult = JSON.stringify(
578
- result,
579
- (_key, value) => {
580
- return value instanceof Map
581
- ? Array.from(value.entries())
582
- : value instanceof Set
583
- ? Array.from(value)
584
- : value;
585
- },
586
- '\t'
540
+ const schemaCompileResults = await compileSchema(
541
+ fixturePath
587
542
  );
588
- const snapshotPath = path.join(
589
- fixturePath,
590
- 'model.out.json'
543
+ await fs.writeJson(
544
+ compiledSchemaFilePath,
545
+ schemaCompileResults
591
546
  );
592
- await assertFixtureSnapshot(serializedResult, snapshotPath);
593
547
  }
594
- );
548
+
549
+ // Build the schema model.
550
+ const fontoJson = await fs.readJson(fontoJsonFilePath);
551
+ const schemaPackagesByXsdPath = fontoJson.rootSchemas;
552
+ const compiledSchemaResultsByXsdPath = await fs.readJson(
553
+ compiledSchemaFilePath
554
+ );
555
+ const prefixByNamespaceUri = getprefixByNamespaceUri(
556
+ compiledSchemaResultsByXsdPath
557
+ );
558
+ const result = buildSchemaExperienceConfigurationModel(
559
+ schemaPackagesByXsdPath,
560
+ compiledSchemaResultsByXsdPath,
561
+ prefixByNamespaceUri
562
+ );
563
+
564
+ // Sanity check.
565
+ sanityCheckResult(
566
+ result,
567
+ schemaPackagesByXsdPath,
568
+ compiledSchemaResultsByXsdPath
569
+ );
570
+
571
+ // Assert against snapshot, and optionally update the snapshot.
572
+ const serializedResult = JSON.stringify(
573
+ result,
574
+ (_key, value) => {
575
+ return value instanceof Map
576
+ ? Array.from(value.entries())
577
+ : value instanceof Set
578
+ ? Array.from(value)
579
+ : value;
580
+ },
581
+ '\t'
582
+ );
583
+ const snapshotPath = path.join(fixturePath, 'model.out.json');
584
+ await assertFixtureSnapshot(serializedResult, snapshotPath);
585
+ });
595
586
  });
596
587
  });
597
588
  });
@@ -1,15 +1,7 @@
1
1
  [
2
- "LICENSE.md",
3
- "README.md",
4
2
  "catalog.xml",
5
- "compiledSchema.json",
6
3
  "fonto.json",
7
- "listOfFiles.json",
8
- "model.out.json",
9
- "schema/",
10
- "schema/base/",
11
4
  "schema/base/catalog.xml",
12
- "schema/base/xsd/",
13
5
  "schema/base/xsd/basemap.xsd",
14
6
  "schema/base/xsd/basetopic.xsd",
15
7
  "schema/base/xsd/commonElementGrp.xsd",
@@ -32,20 +24,14 @@
32
24
  "schema/base/xsd/topicMod.xsd",
33
25
  "schema/base/xsd/utilitiesDomain.xsd",
34
26
  "schema/base/xsd/xml.xsd",
35
- "schema/bookmap/",
36
27
  "schema/bookmap/catalog.xml",
37
- "schema/bookmap/xsd/",
38
28
  "schema/bookmap/xsd/bookmap.xsd",
39
29
  "schema/bookmap/xsd/bookmapGrp.xsd",
40
30
  "schema/bookmap/xsd/bookmapMod.xsd",
41
31
  "schema/catalog.xml",
42
- "schema/ditaval/",
43
32
  "schema/ditaval/catalog.xml",
44
- "schema/ditaval/xsd/",
45
33
  "schema/ditaval/xsd/ditaval.xsd",
46
- "schema/fontoxml/",
47
34
  "schema/fontoxml/catalog.xml",
48
- "schema/fontoxml/constraints/",
49
35
  "schema/fontoxml/constraints/machineryTaskbodyConstraintMod.xsd",
50
36
  "schema/fontoxml/constraints/strictCommonElementConstraint.xsd",
51
37
  "schema/fontoxml/constraints/strictCommonElementConstraintInt.xsd",
@@ -62,7 +48,6 @@
62
48
  "schema/fontoxml/constraints/strictTblDeclConstraint.xsd",
63
49
  "schema/fontoxml/constraints/strictTopicConstraint.xsd",
64
50
  "schema/fontoxml/constraints/strictTroubleshootingConstraint.xsd",
65
- "schema/fontoxml/shells/",
66
51
  "schema/fontoxml/shells/basemap.xsd",
67
52
  "schema/fontoxml/shells/basetopic.xsd",
68
53
  "schema/fontoxml/shells/bookmap.xsd",
@@ -89,9 +74,7 @@
89
74
  "schema/fontoxml/shells/task.xsd",
90
75
  "schema/fontoxml/shells/topic.xsd",
91
76
  "schema/fontoxml/shells/troubleshooting.xsd",
92
- "schema/learning/",
93
77
  "schema/learning/catalog.xml",
94
- "schema/learning/xsd/",
95
78
  "schema/learning/xsd/learning2Domain.xsd",
96
79
  "schema/learning/xsd/learningAggregationsTopicrefConstraintMod.xsd",
97
80
  "schema/learning/xsd/learningAssessment.xsd",
@@ -126,23 +109,17 @@
126
109
  "schema/learning/xsd/learningSummary.xsd",
127
110
  "schema/learning/xsd/learningSummaryGrp.xsd",
128
111
  "schema/learning/xsd/learningSummaryMod.xsd",
129
- "schema/machineryIndustry/",
130
112
  "schema/machineryIndustry/catalog.xml",
131
- "schema/machineryIndustry/xsd/",
132
113
  "schema/machineryIndustry/xsd/machineryTask.xsd",
133
114
  "schema/machineryIndustry/xsd/machineryTaskbodyConstraintIntMod.xsd",
134
115
  "schema/machineryIndustry/xsd/machineryTaskbodyConstraintMod.xsd",
135
- "schema/subjectScheme/",
136
116
  "schema/subjectScheme/catalog.xml",
137
- "schema/subjectScheme/xsd/",
138
117
  "schema/subjectScheme/xsd/classifyDomain.xsd",
139
118
  "schema/subjectScheme/xsd/classifyMap.xsd",
140
119
  "schema/subjectScheme/xsd/subjectScheme.xsd",
141
120
  "schema/subjectScheme/xsd/subjectSchemeGrp.xsd",
142
121
  "schema/subjectScheme/xsd/subjectSchemeMod.xsd",
143
- "schema/technicalContent/",
144
122
  "schema/technicalContent/catalog.xml",
145
- "schema/technicalContent/xsd/",
146
123
  "schema/technicalContent/xsd/abbreviateDomain.xsd",
147
124
  "schema/technicalContent/xsd/concept.xsd",
148
125
  "schema/technicalContent/xsd/conceptGrp.xsd",
@@ -163,8 +140,6 @@
163
140
  "schema/technicalContent/xsd/glossrefDomain.xsd",
164
141
  "schema/technicalContent/xsd/map.xsd",
165
142
  "schema/technicalContent/xsd/markupDomain.xsd",
166
- "schema/technicalContent/xsd/mathml/",
167
- "schema/technicalContent/xsd/mathml/mathml3/",
168
143
  "schema/technicalContent/xsd/mathml/mathml3/mathml3-common.xsd",
169
144
  "schema/technicalContent/xsd/mathml/mathml3/mathml3-content.xsd",
170
145
  "schema/technicalContent/xsd/mathml/mathml3/mathml3-presentation.xsd",
@@ -178,8 +153,6 @@
178
153
  "schema/technicalContent/xsd/releaseManagementDomain.xsd",
179
154
  "schema/technicalContent/xsd/softwareDomain.xsd",
180
155
  "schema/technicalContent/xsd/strictTaskbodyConstraintMod.xsd",
181
- "schema/technicalContent/xsd/svg/",
182
- "schema/technicalContent/xsd/svg/svg11/",
183
156
  "schema/technicalContent/xsd/svg/svg11/local.xsd",
184
157
  "schema/technicalContent/xsd/svg/svg11/svg-animation.xsd",
185
158
  "schema/technicalContent/xsd/svg/svg11/svg-animevents-attrib.xsd",
@@ -231,19 +204,11 @@
231
204
  "schema/technicalContent/xsd/troubleshootingMod.xsd",
232
205
  "schema/technicalContent/xsd/uiDomain.xsd",
233
206
  "schema/technicalContent/xsd/xmlDomain.xsd",
234
- "schema/xnal/",
235
207
  "schema/xnal/catalog.xml",
236
- "schema/xnal/xsd/",
237
208
  "schema/xnal/xsd/xnalDomain.xsd",
238
- "xslt/",
239
- "xslt/unit test/",
240
209
  "xslt/unit test/TestBrokenFileXslt.xml",
241
- "xslt/unit test/TestMixedContent-result.html",
242
- "xslt/unit test/TestMixedContent.xspec",
243
210
  "xslt/unit test/inputFuleFileTest.xml",
244
211
  "xslt/unit test/inputFuleFileTest2.xml",
245
212
  "xslt/unit test/outputFuleFileTest.xml",
246
- "xslt/unit test/outputFuleFileTest2.xml",
247
- "xslt/xsltFixBrokenContent.xsl",
248
- "xslt/xsltMixedContent.xsl"
213
+ "xslt/unit test/outputFuleFileTest2.xml"
249
214
  ]
@@ -0,0 +1,174 @@
1
+ import assert from 'assert';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ import getSchemaFontoJson, {
6
+ validateSchemaFontoJson,
7
+ } from '../../../src/api/schema/getSchemaFontoJson.js';
8
+
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = path.dirname(__filename);
11
+
12
+ describe('api/schema/getSchemaFontoJson', () => {
13
+ it('can get a schema fonto.json', async () => {
14
+ const fixturePath = path.join(__dirname, 'fixtures', 'abstract-test');
15
+ const fontoJson = await getSchemaFontoJson(fixturePath);
16
+ assert.deepEqual(fontoJson, {
17
+ rootSchemas: {
18
+ 'abstractTest.xsd': {
19
+ packageName: 'abstract-test-sx-shell',
20
+ locations: ['urn:fonto:abstract:test'],
21
+ },
22
+ },
23
+ });
24
+ });
25
+
26
+ it('throws when the directory does not exist', async () => {
27
+ const fixturePath = path.join(__dirname, 'fixtures', 'non-existing');
28
+ await getSchemaFontoJson(fixturePath)
29
+ .then(() => {
30
+ throw new Error('Should have thrown.');
31
+ })
32
+ .catch((error) => {
33
+ assert.ok(error);
34
+ assert.ok(
35
+ error.message.match(/Schema source path does not exist/)
36
+ );
37
+ });
38
+ });
39
+
40
+ it('throws when the fonto.json file does not exist', async () => {
41
+ const fixturePath = path.join(__dirname, 'fixtures');
42
+ await getSchemaFontoJson(fixturePath)
43
+ .then(() => {
44
+ throw new Error('Should have thrown.');
45
+ })
46
+ .catch((error) => {
47
+ assert.ok(error);
48
+ assert.ok(
49
+ error.message.match(/schema source path does not exist/)
50
+ );
51
+ });
52
+ });
53
+
54
+ it('throws when the fonto.json could not be parsed', async () => {
55
+ const fixturePath = path.join(
56
+ __dirname,
57
+ 'fixtures',
58
+ 'invalid-fonto-json'
59
+ );
60
+ await getSchemaFontoJson(fixturePath)
61
+ .then(() => {
62
+ throw new Error('Should have thrown.');
63
+ })
64
+ .catch((error) => {
65
+ assert.ok(error);
66
+ assert.ok(error.message.match(/could not be parsed/));
67
+ });
68
+ });
69
+
70
+ describe('validateSchemaFontoJson', () => {
71
+ it('throws when there is no rootSchemas property', () => {
72
+ assert.throws(() => {
73
+ validateSchemaFontoJson({});
74
+ }, /Missing "rootSchemas" property/);
75
+ });
76
+
77
+ it('throws when a rootSchemas property is not an object', () => {
78
+ assert.throws(() => {
79
+ validateSchemaFontoJson({ rootSchemas: [] });
80
+ }, /The "rootSchemas" property is not an object/);
81
+ });
82
+
83
+ it('throws when a root schema is not an object', () => {
84
+ assert.throws(() => {
85
+ validateSchemaFontoJson({ rootSchemas: { 'test.xsd': [] } });
86
+ }, /Root schema "test.xsd" is not an object/);
87
+ });
88
+
89
+ it('throws when a root schema is missing the packageName property', () => {
90
+ assert.throws(() => {
91
+ validateSchemaFontoJson({ rootSchemas: { 'test.xsd': {} } });
92
+ }, /Root schema "test.xsd" does not have a valid "packageName" property/);
93
+ });
94
+
95
+ it('throws when a root schema has an invalid location property', () => {
96
+ // Non array.
97
+ assert.throws(() => {
98
+ validateSchemaFontoJson({
99
+ rootSchemas: {
100
+ 'test.xsd': {
101
+ packageName: 'test-package',
102
+ locations: {},
103
+ },
104
+ },
105
+ });
106
+ }, /Root schema "test.xsd" has an invalid "locations" property/);
107
+
108
+ // Non string value.
109
+ assert.throws(() => {
110
+ validateSchemaFontoJson({
111
+ rootSchemas: {
112
+ 'test.xsd': {
113
+ packageName: 'test-package',
114
+ locations: [false],
115
+ },
116
+ },
117
+ });
118
+ }, /Root schema "test.xsd" has an invalid "locations" property/);
119
+
120
+ // Empty string value.
121
+ assert.throws(() => {
122
+ validateSchemaFontoJson({
123
+ rootSchemas: {
124
+ 'test.xsd': {
125
+ packageName: 'test-package',
126
+ locations: [''],
127
+ },
128
+ },
129
+ });
130
+ }, /Root schema "test.xsd" has an invalid "locations" property/);
131
+ });
132
+
133
+ it('throws when there are multiple root schemas but one is missing the location property', () => {
134
+ // Missing locations property.
135
+ assert.throws(() => {
136
+ validateSchemaFontoJson({
137
+ rootSchemas: {
138
+ 'test1.xsd': {
139
+ packageName: 'test-package',
140
+ locations: ['urn:test1'],
141
+ },
142
+ 'test2.xsd': {
143
+ packageName: 'test-package',
144
+ },
145
+ 'test3.xsd': {
146
+ packageName: 'test-package',
147
+ locations: ['urn:test1'],
148
+ },
149
+ },
150
+ });
151
+ }, /Root schema "test2.xsd" is missing the "locations" property/);
152
+
153
+ // Empty locations property.
154
+ assert.throws(() => {
155
+ validateSchemaFontoJson({
156
+ rootSchemas: {
157
+ 'test1.xsd': {
158
+ packageName: 'test-package',
159
+ locations: ['urn:test1'],
160
+ },
161
+ 'test2.xsd': {
162
+ packageName: 'test-package',
163
+ locations: [],
164
+ },
165
+ 'test3.xsd': {
166
+ packageName: 'test-package',
167
+ locations: ['urn:test1'],
168
+ },
169
+ },
170
+ });
171
+ }, /Root schema "test2.xsd" has an empty "locations" property/);
172
+ });
173
+ });
174
+ });
@@ -43,10 +43,8 @@ describe('api/schema/schemaZipHelpers', () => {
43
43
  );
44
44
 
45
45
  const directory = await unzipper.Open.buffer(zipBuffer);
46
- const listOfFiles = [];
47
- directory.files.forEach((file) => {
48
- listOfFiles.push(file.path);
49
- });
46
+ // Sort this list to guarrantee that the order is always the same
47
+ const listOfFiles = directory.files.map((file) => file.path).sort();
50
48
 
51
49
  const listOfFilesInJson = await fs.readJson(
52
50
  path.join(fixturePath, 'listOfFiles.json')
@@ -82,6 +80,14 @@ describe('api/schema/schemaZipHelpers', () => {
82
80
  path.join(tmpDir.path, 'schema/learning')
83
81
  );
84
82
 
83
+ // Remove fonto.json
84
+ await fs.remove(path.join(tmpDir.path, 'fonto.json'));
85
+ // Link fonto.json
86
+ await fs.ensureSymlink(
87
+ path.join(fixturePath, 'fonto.json'),
88
+ path.join(tmpDir.path, 'fonto.json')
89
+ );
90
+
85
91
  try {
86
92
  await testSchemaBundle(tmpDir.path);
87
93
  } finally {