@rws-framework/client 2.16.2 → 2.16.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.16.2",
4
+ "version": "2.16.3",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"
@@ -39,8 +39,7 @@
39
39
  "moment": "^2.29.4",
40
40
  "partial-json-parser": "^1.0.0",
41
41
  "reflect-metadata": "^0.2.2",
42
- "resolve-url-loader": "^5.0.0",
43
- "sanitize-html": "^2.14.0",
42
+ "resolve-url-loader": "^5.0.0",
44
43
  "socket.io-client": "^4.7.2",
45
44
  "upload": "^1.3.2",
46
45
  "url-router": "^13.0.0",
@@ -52,8 +51,7 @@
52
51
  "@types/eslint": "^6.0.0",
53
52
  "@types/express-fileupload": "^1.4.4",
54
53
  "@types/glob": "^8.1.0",
55
- "@types/he": "^1.2.3",
56
- "@types/sanitize-html": "^2.11.0",
54
+ "@types/he": "^1.2.3",
57
55
  "@types/uuid": "^9.0.7",
58
56
  "@typescript-eslint/parser": "^5.0.0",
59
57
  "browser-sync": "^2.29.3",
@@ -1,81 +1,81 @@
1
- import { Observable } from '@microsoft/fast-element';
2
- import RWSViewComponent from '../_component';
3
- import DOMService from '../../services/DOMService';
4
- import RWSContainer from '../_container';
5
- import { IOptions } from 'sanitize-html';
1
+ // import { Observable } from '@microsoft/fast-element';
2
+ // import RWSViewComponent from '../_component';
3
+ // import DOMService from '../../services/DOMService';
4
+ // import RWSContainer from '../_container';
5
+ // // import { IOptions } from 'sanitize-html';
6
6
 
7
- import * as he from 'he';
7
+ // import * as he from 'he';
8
8
 
9
- type SanitizeOptions = IOptions & { fullEncode?: boolean };
9
+ // // type SanitizeOptions = IOptions & { fullEncode?: boolean };
10
10
 
11
- const heOpt: he.EncodeOptions = {
12
- useNamedReferences: false,
13
- encodeEverything: true,
14
- };
11
+ // const heOpt: he.EncodeOptions = {
12
+ // useNamedReferences: false,
13
+ // encodeEverything: true,
14
+ // };
15
15
 
16
- function enc(html: string): string
17
- {
18
- return he.encode(html, heOpt);
19
- }
16
+ // function enc(html: string): string
17
+ // {
18
+ // return he.encode(html, heOpt);
19
+ // }
20
20
 
21
21
 
22
- const transformAnyTag = (tagName: string, attribs: { [key: string]: string }) => {
23
- // Example: Wrap the original tag with `span` and indicate the original tag name in a data attribute
24
- return {
25
- tagName: 'span', // Change this to any tag you want to transform to
26
- attribs: {
27
- ...attribs,
28
- 'data-original-tag': tagName
29
- }
30
- };
31
- };
22
+ // const transformAnyTag = (tagName: string, attribs: { [key: string]: string }) => {
23
+ // // Example: Wrap the original tag with `span` and indicate the original tag name in a data attribute
24
+ // return {
25
+ // tagName: 'span', // Change this to any tag you want to transform to
26
+ // attribs: {
27
+ // ...attribs,
28
+ // 'data-original-tag': tagName
29
+ // }
30
+ // };
31
+ // };
32
32
 
33
- function sanitizedAttr(configOrTarget?: SanitizeOptions | RWSViewComponent, prop?: string): void | any
34
- {
35
- if (arguments.length > 1) {
36
- // Decorator used directly without factory invocation
37
- // Apply the decorator immediately without returning anything
38
- applyDecorator(configOrTarget as RWSViewComponent, prop!);
39
- } else {
40
- // Decorator factory invocation
41
- const config = configOrTarget as SanitizeOptions;
42
- // Return a function that applies the decorator, conforming to TypeScript's expectations for decorator factories
43
- return (target: RWSViewComponent, property: string) => applyDecorator(target, property, config);
44
- }
45
- }
33
+ // function sanitizedAttr(configOrTarget?: SanitizeOptions | RWSViewComponent, prop?: string): void | any
34
+ // {
35
+ // if (arguments.length > 1) {
36
+ // // Decorator used directly without factory invocation
37
+ // // Apply the decorator immediately without returning anything
38
+ // applyDecorator(configOrTarget as RWSViewComponent, prop!);
39
+ // } else {
40
+ // // Decorator factory invocation
41
+ // const config = configOrTarget as SanitizeOptions;
42
+ // // Return a function that applies the decorator, conforming to TypeScript's expectations for decorator factories
43
+ // return (target: RWSViewComponent, property: string) => applyDecorator(target, property, config);
44
+ // }
45
+ // }
46
46
 
47
- function applyDecorator(target: RWSViewComponent, prop: string, config: SanitizeOptions = null): void
48
- {
49
- if(config.fullEncode){
50
- const encAllOpts = {transformTags: { '*' : transformAnyTag }, textFilter: function(text: string, tagName?: string) { return tagName ? `${enc('<')}${tagName}${enc('>')}${text}${enc('</')}${tagName}${enc('>')}` : text; }};
51
- config = {...config, ...encAllOpts};
52
- delete config.fullEncode;
53
- }
47
+ // function applyDecorator(target: RWSViewComponent, prop: string, config: SanitizeOptions = null): void
48
+ // {
49
+ // if(config.fullEncode){
50
+ // const encAllOpts = {transformTags: { '*' : transformAnyTag }, textFilter: function(text: string, tagName?: string) { return tagName ? `${enc('<')}${tagName}${enc('>')}${text}${enc('</')}${tagName}${enc('>')}` : text; }};
51
+ // config = {...config, ...encAllOpts};
52
+ // delete config.fullEncode;
53
+ // }
54
54
 
55
- modifyPropertyDescriptor(target, prop, config as IOptions);
56
- }
55
+ // modifyPropertyDescriptor(target, prop, config as IOptions);
56
+ // }
57
57
 
58
- function modifyPropertyDescriptor(target: any, propertyKey: string, config: IOptions = null): void {
59
- const privatePropName = `_${String(propertyKey)}`;
60
- Object.defineProperty(target, privatePropName, {
61
- writable: true,
62
- value: target[propertyKey],
63
- });
58
+ // function modifyPropertyDescriptor(target: any, propertyKey: string, config: IOptions = null): void {
59
+ // const privatePropName = `_${String(propertyKey)}`;
60
+ // Object.defineProperty(target, privatePropName, {
61
+ // writable: true,
62
+ // value: target[propertyKey],
63
+ // });
64
64
 
65
- Object.defineProperty(target, propertyKey, {
66
- get() {
67
- return this[privatePropName];
68
- },
69
- set(value: any) {
70
- if (typeof value === 'string') {
71
- this[privatePropName] = RWSContainer().get(DOMService).sanitizeHTML(value, null, config);
72
- } else {
73
- this[privatePropName] = null;
74
- }
75
- Observable.notify(this, propertyKey);
76
- },
77
- });
78
- }
65
+ // Object.defineProperty(target, propertyKey, {
66
+ // get() {
67
+ // return this[privatePropName];
68
+ // },
69
+ // set(value: any) {
70
+ // if (typeof value === 'string') {
71
+ // this[privatePropName] = RWSContainer().get(DOMService).sanitizeHTML(value, null, config);
72
+ // } else {
73
+ // this[privatePropName] = null;
74
+ // }
75
+ // Observable.notify(this, propertyKey);
76
+ // },
77
+ // });
78
+ // }
79
79
 
80
80
 
81
- export { sanitizedAttr };
81
+ // export { sanitizedAttr };
package/src/index.ts CHANGED
@@ -13,7 +13,7 @@ import type { IBackendRoute, IHTTProute, IPrefixedHTTProutes } from './services/
13
13
 
14
14
  import UtilsService, {UtilsServiceInstance} from './services/UtilsService';
15
15
  import ServiceWorkerService, { ServiceWorkerServiceInstance } from './services/ServiceWorkerService';
16
- import { sanitizedAttr } from './components/_attrs/sanitize-html';
16
+ // import { sanitizedAttr } from './components/_attrs/sanitize-html';
17
17
  import { ngAttr } from './components/_attrs/angular-attr';
18
18
  import { externalObservable } from './components/_attrs/external-observable';
19
19
  import { externalAttr } from './components/_attrs/external-attr';
@@ -80,7 +80,7 @@ export {
80
80
  RWSNotify,
81
81
 
82
82
  RWSView,
83
- sanitizedAttr,
83
+ // sanitizedAttr,
84
84
  RWSIgnore,
85
85
  RWSInject,
86
86
  observable,
@@ -1,6 +1,6 @@
1
1
  import RWSService from './_service';
2
2
  import { DOM } from '@microsoft/fast-element';
3
- import htmlSanitizer, { Transformer, IOptions } from 'sanitize-html';
3
+ // import htmlSanitizer, { Transformer, IOptions } from 'sanitize-html';
4
4
 
5
5
  type TagsProcessorType = { [tagName: string]: string | Transformer };
6
6
  type DOMOutputType<T extends Element> = NodeListOf<T> | T | null;
@@ -67,23 +67,7 @@ class DOMService extends RWSService {
67
67
  });
68
68
 
69
69
  return sanitizedText;
70
- }
71
-
72
- sanitizeHTML(
73
- line: string,
74
- allowedHTMLTags: string[] = null,
75
- sanitizeOptions: IOptions = {})
76
- {
77
- const output: string = line.trim();
78
-
79
- if(allowedHTMLTags){
80
- sanitizeOptions.allowedTags = allowedHTMLTags;
81
- }
82
-
83
- const sanitized = htmlSanitizer(output, sanitizeOptions);
84
-
85
- return sanitized;
86
- }
70
+ }
87
71
 
88
72
  async onDOMLoad(): Promise<void>
89
73
  {