samlesa 2.12.3

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 (99) hide show
  1. package/.editorconfig +19 -0
  2. package/.github/FUNDING.yml +1 -0
  3. package/.idea/compiler.xml +6 -0
  4. package/.idea/deployment.xml +14 -0
  5. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  6. package/.idea/jsLibraryMappings.xml +6 -0
  7. package/.idea/modules.xml +8 -0
  8. package/.idea/samlify.iml +12 -0
  9. package/.idea/vcs.xml +6 -0
  10. package/.pre-commit.sh +15 -0
  11. package/.snyk +8 -0
  12. package/.travis.yml +29 -0
  13. package/LICENSE +22 -0
  14. package/Makefile +25 -0
  15. package/README.md +84 -0
  16. package/build/.idea/workspace.xml +58 -0
  17. package/build/index.js +65 -0
  18. package/build/index.js.map +1 -0
  19. package/build/src/api.js +24 -0
  20. package/build/src/api.js.map +1 -0
  21. package/build/src/binding-post.js +369 -0
  22. package/build/src/binding-post.js.map +1 -0
  23. package/build/src/binding-redirect.js +333 -0
  24. package/build/src/binding-redirect.js.map +1 -0
  25. package/build/src/binding-simplesign.js +233 -0
  26. package/build/src/binding-simplesign.js.map +1 -0
  27. package/build/src/entity-idp.js +131 -0
  28. package/build/src/entity-idp.js.map +1 -0
  29. package/build/src/entity-sp.js +97 -0
  30. package/build/src/entity-sp.js.map +1 -0
  31. package/build/src/entity.js +236 -0
  32. package/build/src/entity.js.map +1 -0
  33. package/build/src/extractor.js +370 -0
  34. package/build/src/extractor.js.map +1 -0
  35. package/build/src/flow.js +320 -0
  36. package/build/src/flow.js.map +1 -0
  37. package/build/src/libsaml.js +642 -0
  38. package/build/src/libsaml.js.map +1 -0
  39. package/build/src/metadata-idp.js +128 -0
  40. package/build/src/metadata-idp.js.map +1 -0
  41. package/build/src/metadata-sp.js +232 -0
  42. package/build/src/metadata-sp.js.map +1 -0
  43. package/build/src/metadata.js +177 -0
  44. package/build/src/metadata.js.map +1 -0
  45. package/build/src/types.js +12 -0
  46. package/build/src/types.js.map +1 -0
  47. package/build/src/urn.js +213 -0
  48. package/build/src/urn.js.map +1 -0
  49. package/build/src/utility.js +249 -0
  50. package/build/src/utility.js.map +1 -0
  51. package/build/src/validator.js +27 -0
  52. package/build/src/validator.js.map +1 -0
  53. package/index.d.ts +10 -0
  54. package/index.js +19 -0
  55. package/index.js.map +1 -0
  56. package/index.ts +28 -0
  57. package/package.json +74 -0
  58. package/qodana.yaml +29 -0
  59. package/src/.idea/modules.xml +8 -0
  60. package/src/.idea/src.iml +12 -0
  61. package/src/.idea/vcs.xml +6 -0
  62. package/src/api.ts +36 -0
  63. package/src/binding-post.ts +338 -0
  64. package/src/binding-redirect.ts +331 -0
  65. package/src/binding-simplesign.ts +231 -0
  66. package/src/entity-idp.ts +145 -0
  67. package/src/entity-sp.ts +114 -0
  68. package/src/entity.ts +243 -0
  69. package/src/extractor.ts +392 -0
  70. package/src/flow.ts +467 -0
  71. package/src/libsaml.ts +786 -0
  72. package/src/metadata-idp.ts +146 -0
  73. package/src/metadata-sp.ts +268 -0
  74. package/src/metadata.ts +166 -0
  75. package/src/types.ts +153 -0
  76. package/src/urn.ts +211 -0
  77. package/src/utility.ts +248 -0
  78. package/src/validator.ts +44 -0
  79. package/tsconfig.json +38 -0
  80. package/tslint.json +35 -0
  81. package/types/index.d.ts +10 -0
  82. package/types/src/api.d.ts +13 -0
  83. package/types/src/binding-post.d.ts +46 -0
  84. package/types/src/binding-redirect.d.ts +52 -0
  85. package/types/src/binding-simplesign.d.ts +39 -0
  86. package/types/src/entity-idp.d.ts +42 -0
  87. package/types/src/entity-sp.d.ts +36 -0
  88. package/types/src/entity.d.ts +99 -0
  89. package/types/src/extractor.d.ts +25 -0
  90. package/types/src/flow.d.ts +6 -0
  91. package/types/src/libsaml.d.ts +210 -0
  92. package/types/src/metadata-idp.d.ts +24 -0
  93. package/types/src/metadata-sp.d.ts +36 -0
  94. package/types/src/metadata.d.ts +57 -0
  95. package/types/src/types.d.ts +127 -0
  96. package/types/src/urn.d.ts +194 -0
  97. package/types/src/utility.d.ts +134 -0
  98. package/types/src/validator.d.ts +3 -0
  99. package/types.d.ts +2 -0
package/.editorconfig ADDED
@@ -0,0 +1,19 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = tab
5
+ end_of_line = lf
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
9
+
10
+ [*.{json,js,ts,jsx,html,css}]
11
+ indent_style = space
12
+ indent_size = 2
13
+
14
+ [.eslintrc]
15
+ indent_style = space
16
+ indent_size = 2
17
+
18
+ [*.md]
19
+ trim_trailing_whitespace = false
@@ -0,0 +1 @@
1
+ github: [tngan]
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="TypeScriptCompiler">
4
+ <option name="useTypesFromServer" value="true" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
4
+ <serverData>
5
+ <paths name="阿里云">
6
+ <serverdata>
7
+ <mappings>
8
+ <mapping local="$PROJECT_DIR$" web="/" />
9
+ </mappings>
10
+ </serverdata>
11
+ </paths>
12
+ </serverData>
13
+ </component>
14
+ </project>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ </profile>
6
+ </component>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptLibraryMappings">
4
+ <includedPredefinedLibrary name="Node.js Core" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/samlify.iml" filepath="$PROJECT_DIR$/.idea/samlify.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
package/.pre-commit.sh ADDED
@@ -0,0 +1,15 @@
1
+ echo "Linting"
2
+ npm run lint
3
+ LINTRESULT=$?
4
+
5
+ echo "Compiling"
6
+ $(npm bin)/tsc
7
+ BUILDRESULT=$?
8
+
9
+ if [[ $LINTRESULT -ne 0 || $BUILDRESULT -ne 0 ]]; then
10
+ echo "Fix errors before commit"
11
+ exit 1
12
+ else
13
+ echo "Ok to commit"
14
+ exit 0
15
+ fi
package/.snyk ADDED
@@ -0,0 +1,8 @@
1
+ # Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
2
+ version: v1.14.0
3
+ ignore: {}
4
+ # patches apply the minimum changes required to fix a vulnerability
5
+ patch:
6
+ SNYK-JS-LODASH-450202:
7
+ - '@authenio/xml-encryption > async > lodash':
8
+ patched: '2019-12-11T18:53:51.541Z'
package/.travis.yml ADDED
@@ -0,0 +1,29 @@
1
+ language: node_js
2
+
3
+ node_js:
4
+ - "16"
5
+ - "18"
6
+ - "20"
7
+
8
+ env:
9
+ - INSTALL_JDK=1
10
+ - INSTALL_JDK=0
11
+
12
+ before_install:
13
+ - if [[ "$INSTALL_JDK" == "1" ]] ; then make install_jdk ; fi
14
+
15
+ install:
16
+ - yarn install --production=true
17
+
18
+ script:
19
+ - yarn add @authenio/samlify-xsd-schema-validator
20
+ - yarn test --timeout=30s
21
+
22
+ branches:
23
+ only:
24
+ - master
25
+ - /^.*-alpha$/
26
+ - /^.*-rc.*$/
27
+ - /^feature\/.*$/
28
+
29
+ after_success: npm run coverage
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016-present Tony Ngan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/Makefile ADDED
@@ -0,0 +1,25 @@
1
+ PROJECT = "samlify"
2
+
3
+ install: ;@echo "install ${PROJECT}"; \
4
+ npm install;
5
+
6
+ clean: ;
7
+ rm -rf node_modules
8
+
9
+ rebuild: ;
10
+ rm -rf build; \
11
+ tsc; \
12
+
13
+ pretest: ;
14
+ mkdir -p build/test; \
15
+ cp -a test/key test/misc build/test;
16
+
17
+ install_jdk:
18
+ sudo add-apt-repository ppa:openjdk-r/ppa -y
19
+ sudo apt-get -qq update
20
+ sudo apt-get install -y openjdk-9-jdk
21
+
22
+ doc: ;@echo "prepare and serve the docs"; \
23
+ docsify serve ./docs
24
+
25
+ .PHONY: rebuild pretest doc install_jdk
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # samlify &middot;
2
+
3
+ [![Build Status](https://img.shields.io/circleci/build/github/tngan/samlify?style=for-the-badge&logo=circleci)](https://app.circleci.com/pipelines/github/tngan/samlify)
4
+ [![npm version](https://img.shields.io/npm/v/samlify.svg?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/samlify)
5
+ [![NPM](https://img.shields.io/npm/dm/samlify.svg?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/samlify)
6
+ [![Coverage Status](https://img.shields.io/coveralls/tngan/samlify/master.svg?style=for-the-badge&logo=coveralls)](https://coveralls.io/github/tngan/samlify?branch=master)
7
+
8
+ Highly configuarable Node.js SAML 2.0 library for Single Sign On
9
+
10
+ ## 🔄 此仓库为 [samlify](https://github.com/tngan/samlify) 的维护分支,修复了以下问题
11
+
12
+ - 将依赖包 @authenio/xml-encryption 更换成 xml-encryption并升级了版本,xml-encryption最新版本添加对 sha256/512 加密密钥 OAEP 摘要方法的支持,并将默认密钥签名算法指定为 sha-512
13
+ - 修复了断言加密的一些错误 如libsaml.ts对加密断言仍然采用Assertion字段提取获取,增加了EncryptedAssertion字段提取逻辑
14
+ - 默认elementsOrder增加了 AttributeConsumingService,并在参数增加了 attributeConsumingService字段能够根据字段生成attributeElement包括attributeValue
15
+ - 默认替换增加了自定义函数模板 增加了对多值的attributeValue支持与替换
16
+ - 默认替签名算法替换为SHA-256及更高,加密算法为默认AES_256_GCM模式
17
+
18
+
19
+ ## Welcome PRs
20
+
21
+ Welcome all PRs for maintaining this project, or provide a link to the repositories especially for use cases alongside with different frameworks.
22
+
23
+ ### Installation
24
+
25
+ Multiple schema validators are currently supported by our system, with couple validator modules available and the option to create custom ones. It is essential to utilize the setSchemaValidator function at the outset to avoid errors.
26
+
27
+ ```js
28
+ import * as samlify from 'samlify';
29
+ import * as validator from '@authenio/samlify-xsd-schema-validator';
30
+ // import * as validator from '@authenio/samlify-validate-with-xmllint';
31
+ // import * as validator from '@authenio/samlify-node-xmllint';
32
+
33
+ samlify.setSchemaValidator(validator);
34
+ ```
35
+
36
+ Now you can create your own schema validator and even suppress it but you have to take the risk for accepting malicious response.
37
+
38
+ ```typescript
39
+ samlify.setSchemaValidator({
40
+ validate: (response: string) => {
41
+ /* implment your own or always returns a resolved promise to skip */
42
+ return Promise.resolve('skipped');
43
+ }
44
+ });
45
+ ```
46
+
47
+ For those using Windows, `windows-build-tools` should be installed globally before installing samlify if you are using `libxml` validator.
48
+
49
+ ```console
50
+ yarn global add windows-build-tools
51
+ ```
52
+
53
+ ### Development
54
+
55
+ This project is now developed using TypeScript, also support Yarn which is a new package manager.
56
+
57
+ ```console
58
+ yarn global add typescript
59
+ yarn
60
+ ```
61
+
62
+ ### Get Started
63
+
64
+ ```javascript
65
+ const saml = require('samlify');
66
+ ```
67
+
68
+ See full documentation [here](https://samlify.js.org/)
69
+
70
+ ### Example
71
+
72
+ [react-samlify](https://github.com/passify/react-samlify) SP example powered by React, TypeScript and Webpack
73
+
74
+ ### Talks
75
+
76
+ [An introduction to Single Sign On](http://www.slideshare.net/TonyNgan/an-introduction-of-single-sign-on)
77
+
78
+ ### License
79
+
80
+ [MIT](LICENSE)
81
+
82
+ ### Copyright
83
+
84
+ Copyright (C) 2016-present Tony Ngan, released under the MIT License.
@@ -0,0 +1,58 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AutoImportSettings">
4
+ <option name="autoReloadType" value="SELECTIVE" />
5
+ </component>
6
+ <component name="ChangeListManager">
7
+ <list default="true" id="bd9fb792-e752-426e-b2f5-6b9b9086ce24" name="更改" comment="" />
8
+ <option name="SHOW_DIALOG" value="false" />
9
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
+ <option name="LAST_RESOLUTION" value="IGNORE" />
12
+ </component>
13
+ <component name="ProjectColorInfo">{
14
+ &quot;customColor&quot;: &quot;&quot;,
15
+ &quot;associatedIndex&quot;: 8
16
+ }</component>
17
+ <component name="ProjectId" id="2x1xvhQuH75Qdyg5ofvvmYeuJj5" />
18
+ <component name="ProjectViewState">
19
+ <option name="hideEmptyMiddlePackages" value="true" />
20
+ <option name="showExcludedFiles" value="false" />
21
+ <option name="showLibraryContents" value="true" />
22
+ </component>
23
+ <component name="PropertiesComponent">{
24
+ &quot;keyToString&quot;: {
25
+ &quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
26
+ &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
27
+ &quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
28
+ &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
29
+ &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
30
+ &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
31
+ &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
32
+ &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
33
+ &quot;ts.external.directory.path&quot;: &quot;D:\\software\\WebStorm 2022.3.3\\plugins\\javascript-plugin\\jsLanguageServicesImpl\\external&quot;,
34
+ &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
35
+ }
36
+ }</component>
37
+ <component name="SharedIndexes">
38
+ <attachedChunks>
39
+ <set>
40
+ <option value="bundled-js-predefined-d6986cc7102b-f27c65a3e318-JavaScript-WS-251.23774.424" />
41
+ </set>
42
+ </attachedChunks>
43
+ </component>
44
+ <component name="TaskManager">
45
+ <task active="true" id="Default" summary="默认任务">
46
+ <changelist id="bd9fb792-e752-426e-b2f5-6b9b9086ce24" name="更改" comment="" />
47
+ <created>1747119613080</created>
48
+ <option name="number" value="Default" />
49
+ <option name="presentableId" value="Default" />
50
+ <updated>1747119613080</updated>
51
+ <workItem from="1747119614232" duration="2240000" />
52
+ </task>
53
+ <servers />
54
+ </component>
55
+ <component name="TypeScriptGeneratedFilesManager">
56
+ <option name="version" value="3" />
57
+ </component>
58
+ </project>
package/build/index.js ADDED
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.setDOMParserOptions = exports.setSchemaValidator = exports.ServiceProviderInstance = exports.ServiceProvider = exports.IdentityProviderInstance = exports.IdentityProvider = exports.Extractor = exports.Constants = exports.SamlLib = exports.Utility = exports.SPMetadata = exports.IdPMetadata = void 0;
40
+ // version <= 1.25
41
+ const entity_idp_js_1 = __importStar(require("./src/entity-idp.js"));
42
+ exports.IdentityProvider = entity_idp_js_1.default;
43
+ Object.defineProperty(exports, "IdentityProviderInstance", { enumerable: true, get: function () { return entity_idp_js_1.IdentityProvider; } });
44
+ const entity_sp_js_1 = __importStar(require("./src/entity-sp.js"));
45
+ exports.ServiceProvider = entity_sp_js_1.default;
46
+ Object.defineProperty(exports, "ServiceProviderInstance", { enumerable: true, get: function () { return entity_sp_js_1.ServiceProvider; } });
47
+ var metadata_idp_js_1 = require("./src/metadata-idp.js");
48
+ Object.defineProperty(exports, "IdPMetadata", { enumerable: true, get: function () { return __importDefault(metadata_idp_js_1).default; } });
49
+ var metadata_sp_js_1 = require("./src/metadata-sp.js");
50
+ Object.defineProperty(exports, "SPMetadata", { enumerable: true, get: function () { return __importDefault(metadata_sp_js_1).default; } });
51
+ var utility_js_1 = require("./src/utility.js");
52
+ Object.defineProperty(exports, "Utility", { enumerable: true, get: function () { return __importDefault(utility_js_1).default; } });
53
+ var libsaml_js_1 = require("./src/libsaml.js");
54
+ Object.defineProperty(exports, "SamlLib", { enumerable: true, get: function () { return __importDefault(libsaml_js_1).default; } });
55
+ // roadmap
56
+ // new name convention in version >= 3.0
57
+ const Constants = __importStar(require("./src/urn.js"));
58
+ exports.Constants = Constants;
59
+ const Extractor = __importStar(require("./src/extractor.js"));
60
+ exports.Extractor = Extractor;
61
+ // exposed methods for customizing samlify
62
+ const api_js_1 = require("./src/api.js");
63
+ Object.defineProperty(exports, "setSchemaValidator", { enumerable: true, get: function () { return api_js_1.setSchemaValidator; } });
64
+ Object.defineProperty(exports, "setDOMParserOptions", { enumerable: true, get: function () { return api_js_1.setDOMParserOptions; } });
65
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,qEAAqG;AAmBnG,2BAnBK,uBAAgB,CAmBL;AAChB,yGApB6C,gCAAwB,OAoB7C;AAnB1B,mEAAiG;AAoB/F,0BApBK,sBAAe,CAoBL;AACf,wGArB2C,8BAAuB,OAqB3C;AAnBzB,yDAA+D;AAAtD,+HAAA,OAAO,OAAe;AAC/B,uDAA6D;AAApD,6HAAA,OAAO,OAAc;AAC9B,+CAAsD;AAA7C,sHAAA,OAAO,OAAW;AAC3B,+CAAsD;AAA7C,sHAAA,OAAO,OAAW;AAC3B,UAAU;AACV,wCAAwC;AACxC,wDAA0C;AAOxC,8BAAS;AANX,8DAAgD;AAO9C,8BAAS;AALX,0CAA0C;AAC1C,yCAAuE;AAWrE,mGAXO,2BAAkB,OAWP;AAClB,oGAZ2B,4BAAmB,OAY3B"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getContext = getContext;
4
+ exports.setSchemaValidator = setSchemaValidator;
5
+ exports.setDOMParserOptions = setDOMParserOptions;
6
+ const xmldom_1 = require("@xmldom/xmldom");
7
+ const context = {
8
+ validate: undefined,
9
+ dom: new xmldom_1.DOMParser()
10
+ };
11
+ function getContext() {
12
+ return context;
13
+ }
14
+ function setSchemaValidator(params) {
15
+ if (typeof params.validate !== 'function') {
16
+ throw new Error('validate must be a callback function having one argument as xml input');
17
+ }
18
+ // assign the validate function to the context
19
+ context.validate = params.validate;
20
+ }
21
+ function setDOMParserOptions(options = {}) {
22
+ context.dom = new xmldom_1.DOMParser(options);
23
+ }
24
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":";;AAkBA,gCAEC;AAED,gDASC;AAED,kDAEC;AAnCD,2CAA+E;AAa/E,MAAM,OAAO,GAAY;IACvB,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,IAAI,kBAAG,EAAE;CACf,CAAC;AAEF,SAAgB,UAAU;IACxB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,kBAAkB,CAAC,MAAwB;IAEzD,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IAED,8CAA8C;IAC9C,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAErC,CAAC;AAED,SAAgB,mBAAmB,CAAC,UAA4B,EAAE;IAChE,OAAO,CAAC,GAAG,GAAG,IAAI,kBAAG,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}