@api-client/core 0.18.5 → 0.18.6
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/build/src/lib/dom_purify.d.ts +4 -0
- package/build/src/lib/dom_purify.d.ts.map +1 -0
- package/build/src/lib/dom_purify.js +23 -0
- package/build/src/lib/dom_purify.js.map +1 -0
- package/build/src/modeling/helpers/database.js +2 -2
- package/build/src/modeling/helpers/database.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +23 -23
- package/package.json +4 -2
- package/src/lib/dom_purify.ts +25 -0
- package/src/modeling/helpers/database.ts +2 -2
- package/tests/unit/lib/dom_purify.spec.ts +12 -0
|
@@ -42065,21 +42065,21 @@
|
|
|
42065
42065
|
"@id": "#191"
|
|
42066
42066
|
},
|
|
42067
42067
|
{
|
|
42068
|
+
"@id": "#200"
|
|
42069
|
+
},
|
|
42070
|
+
{
|
|
42068
42071
|
"@id": "#194"
|
|
42069
42072
|
},
|
|
42070
42073
|
{
|
|
42071
42074
|
"@id": "#197"
|
|
42072
42075
|
},
|
|
42073
42076
|
{
|
|
42074
|
-
"@id": "#
|
|
42077
|
+
"@id": "#206"
|
|
42075
42078
|
},
|
|
42076
42079
|
{
|
|
42077
42080
|
"@id": "#203"
|
|
42078
42081
|
},
|
|
42079
42082
|
{
|
|
42080
|
-
"@id": "#206"
|
|
42081
|
-
},
|
|
42082
|
-
{
|
|
42083
42083
|
"@id": "#209"
|
|
42084
42084
|
}
|
|
42085
42085
|
],
|
|
@@ -42813,13 +42813,13 @@
|
|
|
42813
42813
|
"@id": "#210"
|
|
42814
42814
|
},
|
|
42815
42815
|
{
|
|
42816
|
-
"@id": "#
|
|
42816
|
+
"@id": "#219"
|
|
42817
42817
|
},
|
|
42818
42818
|
{
|
|
42819
|
-
"@id": "#
|
|
42819
|
+
"@id": "#213"
|
|
42820
42820
|
},
|
|
42821
42821
|
{
|
|
42822
|
-
"@id": "#
|
|
42822
|
+
"@id": "#216"
|
|
42823
42823
|
}
|
|
42824
42824
|
],
|
|
42825
42825
|
"doc:root": false,
|
|
@@ -43457,7 +43457,7 @@
|
|
|
43457
43457
|
"doc:ExternalDomainElement",
|
|
43458
43458
|
"doc:DomainElement"
|
|
43459
43459
|
],
|
|
43460
|
-
"doc:raw": "
|
|
43460
|
+
"doc:raw": "code: '5'\ndescription: 'Limited company'\n",
|
|
43461
43461
|
"core:mediaType": "application/yaml",
|
|
43462
43462
|
"sourcemaps:sources": [
|
|
43463
43463
|
{
|
|
@@ -43478,7 +43478,7 @@
|
|
|
43478
43478
|
"doc:ExternalDomainElement",
|
|
43479
43479
|
"doc:DomainElement"
|
|
43480
43480
|
],
|
|
43481
|
-
"doc:raw": "
|
|
43481
|
+
"doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
|
|
43482
43482
|
"core:mediaType": "application/yaml",
|
|
43483
43483
|
"sourcemaps:sources": [
|
|
43484
43484
|
{
|
|
@@ -43499,7 +43499,7 @@
|
|
|
43499
43499
|
"doc:ExternalDomainElement",
|
|
43500
43500
|
"doc:DomainElement"
|
|
43501
43501
|
],
|
|
43502
|
-
"doc:raw": "
|
|
43502
|
+
"doc:raw": "addressType: 'REGISTERED-OFFICE-ADDRESS'\nstreetName: 'UITBREIDINGSTRAAT'\nhouseNumber: '84'\nhouseNumberAddition: '/1'\npostalCode: '2600'\ncity: 'BERCHEM (ANTWERPEN)'\ncountry: 'Belgium'\ncountryCode: 'BE'\nfullFormatedAddress: \"UITBREIDINGSTRAAT 84 /1, 2600 BERCHEM (ANTWERPEN), BELIUM\"\n",
|
|
43503
43503
|
"core:mediaType": "application/yaml",
|
|
43504
43504
|
"sourcemaps:sources": [
|
|
43505
43505
|
{
|
|
@@ -43520,7 +43520,7 @@
|
|
|
43520
43520
|
"doc:ExternalDomainElement",
|
|
43521
43521
|
"doc:DomainElement"
|
|
43522
43522
|
],
|
|
43523
|
-
"doc:raw": "code: '
|
|
43523
|
+
"doc:raw": "code: '7487'\ndescription: 'Financial and insurance activities'\ntype: \"PRIMARY\"\nclassificationCode: 'BE_NACEBEL2008'\nactivityGroupCode: 'ABCDE'\n",
|
|
43524
43524
|
"core:mediaType": "application/yaml",
|
|
43525
43525
|
"sourcemaps:sources": [
|
|
43526
43526
|
{
|
|
@@ -43541,7 +43541,7 @@
|
|
|
43541
43541
|
"doc:ExternalDomainElement",
|
|
43542
43542
|
"doc:DomainElement"
|
|
43543
43543
|
],
|
|
43544
|
-
"doc:raw": "code: '
|
|
43544
|
+
"doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
|
|
43545
43545
|
"core:mediaType": "application/yaml",
|
|
43546
43546
|
"sourcemaps:sources": [
|
|
43547
43547
|
{
|
|
@@ -44253,7 +44253,7 @@
|
|
|
44253
44253
|
"doc:ExternalDomainElement",
|
|
44254
44254
|
"doc:DomainElement"
|
|
44255
44255
|
],
|
|
44256
|
-
"doc:raw": "type: 'GENERAL'\
|
|
44256
|
+
"doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
|
|
44257
44257
|
"core:mediaType": "application/yaml",
|
|
44258
44258
|
"sourcemaps:sources": [
|
|
44259
44259
|
{
|
|
@@ -44274,7 +44274,7 @@
|
|
|
44274
44274
|
"doc:ExternalDomainElement",
|
|
44275
44275
|
"doc:DomainElement"
|
|
44276
44276
|
],
|
|
44277
|
-
"doc:raw": "
|
|
44277
|
+
"doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
|
|
44278
44278
|
"core:mediaType": "application/yaml",
|
|
44279
44279
|
"sourcemaps:sources": [
|
|
44280
44280
|
{
|
|
@@ -44295,7 +44295,7 @@
|
|
|
44295
44295
|
"doc:ExternalDomainElement",
|
|
44296
44296
|
"doc:DomainElement"
|
|
44297
44297
|
],
|
|
44298
|
-
"doc:raw": "type:
|
|
44298
|
+
"doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
|
|
44299
44299
|
"core:mediaType": "application/yaml",
|
|
44300
44300
|
"sourcemaps:sources": [
|
|
44301
44301
|
{
|
|
@@ -44761,27 +44761,27 @@
|
|
|
44761
44761
|
{
|
|
44762
44762
|
"@id": "#196/source-map/lexical/element_0",
|
|
44763
44763
|
"sourcemaps:element": "amf://id#196",
|
|
44764
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44764
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
44765
44765
|
},
|
|
44766
44766
|
{
|
|
44767
44767
|
"@id": "#199/source-map/lexical/element_0",
|
|
44768
44768
|
"sourcemaps:element": "amf://id#199",
|
|
44769
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44769
|
+
"sourcemaps:value": "[(1,0)-(5,0)]"
|
|
44770
44770
|
},
|
|
44771
44771
|
{
|
|
44772
44772
|
"@id": "#202/source-map/lexical/element_0",
|
|
44773
44773
|
"sourcemaps:element": "amf://id#202",
|
|
44774
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44774
|
+
"sourcemaps:value": "[(1,0)-(10,0)]"
|
|
44775
44775
|
},
|
|
44776
44776
|
{
|
|
44777
44777
|
"@id": "#205/source-map/lexical/element_0",
|
|
44778
44778
|
"sourcemaps:element": "amf://id#205",
|
|
44779
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44779
|
+
"sourcemaps:value": "[(1,0)-(6,0)]"
|
|
44780
44780
|
},
|
|
44781
44781
|
{
|
|
44782
44782
|
"@id": "#208/source-map/lexical/element_0",
|
|
44783
44783
|
"sourcemaps:element": "amf://id#208",
|
|
44784
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44784
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
44785
44785
|
},
|
|
44786
44786
|
{
|
|
44787
44787
|
"@id": "#223/source-map/lexical/element_0",
|
|
@@ -45121,17 +45121,17 @@
|
|
|
45121
45121
|
{
|
|
45122
45122
|
"@id": "#215/source-map/lexical/element_0",
|
|
45123
45123
|
"sourcemaps:element": "amf://id#215",
|
|
45124
|
-
"sourcemaps:value": "[(1,0)-(
|
|
45124
|
+
"sourcemaps:value": "[(1,0)-(7,0)]"
|
|
45125
45125
|
},
|
|
45126
45126
|
{
|
|
45127
45127
|
"@id": "#218/source-map/lexical/element_0",
|
|
45128
45128
|
"sourcemaps:element": "amf://id#218",
|
|
45129
|
-
"sourcemaps:value": "[(1,0)-(
|
|
45129
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
45130
45130
|
},
|
|
45131
45131
|
{
|
|
45132
45132
|
"@id": "#221/source-map/lexical/element_0",
|
|
45133
45133
|
"sourcemaps:element": "amf://id#221",
|
|
45134
|
-
"sourcemaps:value": "[(1,0)-(
|
|
45134
|
+
"sourcemaps:value": "[(1,0)-(6,0)]"
|
|
45135
45135
|
},
|
|
45136
45136
|
{
|
|
45137
45137
|
"@id": "#338/source-map/synthesized-field/element_1",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@api-client/core",
|
|
3
3
|
"description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.6",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./browser.js": {
|
|
@@ -94,7 +94,8 @@
|
|
|
94
94
|
"amf-json-ld-lib": "^0.0.15",
|
|
95
95
|
"chalk": "^5.4.1",
|
|
96
96
|
"console-table-printer": "^2.11.2",
|
|
97
|
-
"
|
|
97
|
+
"dompurify": "^3.2.6",
|
|
98
|
+
"jsdom": "^26.1.0",
|
|
98
99
|
"nanoid": "^5.1.5",
|
|
99
100
|
"ws": "^8.12.0",
|
|
100
101
|
"xpath": "^0.0.34"
|
|
@@ -154,6 +155,7 @@
|
|
|
154
155
|
"prepare": "husky && npm run fixes && npm run build:ts && npm run build:api-models",
|
|
155
156
|
"fixes": "node scripts/fix-rollup-plugin.js",
|
|
156
157
|
"tsc": "wireit",
|
|
158
|
+
"tsc:tests": "wireit",
|
|
157
159
|
"tsc:watch": "wireit",
|
|
158
160
|
"test:browser": "node --import ts-node-maintained/register/esm --enable-source-maps bin/test-web.ts --playwright --browsers chromium",
|
|
159
161
|
"test:browser:watch": "node --import ts-node-maintained/register/esm --enable-source-maps bin/test-web.ts --watch --playwright --browsers chromium",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import DOMPurify from 'dompurify'
|
|
2
|
+
|
|
3
|
+
let instance: typeof DOMPurify
|
|
4
|
+
|
|
5
|
+
function isNodeJsEnvironment(): boolean {
|
|
6
|
+
return (
|
|
7
|
+
// eslint-disable-next-line no-restricted-globals
|
|
8
|
+
typeof process !== 'undefined' &&
|
|
9
|
+
// eslint-disable-next-line no-restricted-globals
|
|
10
|
+
typeof process.versions !== 'undefined' &&
|
|
11
|
+
// eslint-disable-next-line no-restricted-globals
|
|
12
|
+
typeof process.versions.node !== 'undefined'
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
if (isNodeJsEnvironment()) {
|
|
16
|
+
const { JSDOM } = await import('jsdom')
|
|
17
|
+
const { window } = new JSDOM('<!DOCTYPE html>')
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
instance = DOMPurify(window)
|
|
21
|
+
} else {
|
|
22
|
+
instance = DOMPurify
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default instance
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import DOMPurify from 'isomorphic-dompurify'
|
|
2
1
|
import { snakeCase } from '@pawel-up/jexl/string.js'
|
|
2
|
+
import DOMPurify from '../../lib/dom_purify.js'
|
|
3
3
|
|
|
4
4
|
export function sanitizeInput(input: string): string {
|
|
5
|
-
return DOMPurify.
|
|
5
|
+
return DOMPurify.sanitize(input)
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import DOMPurify from '../../../src/lib/dom_purify.js'
|
|
3
|
+
|
|
4
|
+
test('DOMPurify is initialized correctly', ({ assert }) => {
|
|
5
|
+
assert.isFunction(DOMPurify.sanitize, 'DOMPurify should have a sanitize function')
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
test('DOMPurify sanitizes input correctly', ({ assert }) => {
|
|
9
|
+
const unsafeInput = '<script>alert("XSS")</script>'
|
|
10
|
+
const safeOutput = DOMPurify.sanitize(unsafeInput)
|
|
11
|
+
assert.equal(safeOutput, '', 'Sanitized output should be empty for unsafe input')
|
|
12
|
+
})
|