bx-rest 0.0.3 → 0.0.5
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 +137 -53
- package/src/consts/part-name-metods.ts +11 -0
- package/src/functions/isDate.ts +8 -0
- package/src/functions/isEqual.ts +17 -0
- package/src/functions/isValidDate.ts +9 -0
- package/src/functions/serializeJavascript.ts +229 -0
- package/src/rest/user/user.ts +18 -17
- package/src/services/base.ts +2 -2
- package/src/services/http/HttpBX.ts +176 -0
- package/src/services/http/HttpData.ts +3 -3
- package/src/services/http/base/HttpData.ts +5 -4
- package/src/services/http/base/base.ts +4 -3
- package/src/services/http/base/http.ts +2 -2
- package/src/services/http/http.ts +5 -5
- package/src/services/http/sessionKey.ts +18 -27
- package/src/services/map/base.ts +8 -0
- package/src/services/map/rest/user.ts +82 -0
- package/src/services/snack-bar/snack-bar.service.ts +1 -1
- package/src/services/vanilla/JSON.ts +1 -1
- package/src/services/vanilla/iframe.ts +2 -2
- package/src/services/vanilla/localStorage.ts +1 -1
- package/src/services/vanilla//321/201ookies.ts +1 -1
- package/src/store/auth.ts +1 -1
- package/src/store/users.ts +88 -0
- package/src/tsconfig.base.json +4 -10
- package/src/tsconfig.types.json +1 -1
- package/src/typification/rest/api-lib.ts +2 -2
- package/src/typification/rest/batch/batchRequestParam.ts +1 -1
- package/src/typification/rest/user/CustomUserFieldInfo.ts +2 -2
- package/src/typification/rest/user/user.ts +1 -1
- package/src/typification/rest/user/userFilter.ts +17 -0
- package/tsconfig.json +19 -6
- package/.editorconfig +0 -17
- package/src/services/snack-bar/toast-message/toast-message.component.spec.ts +0 -24
- /package/src/{const → consts}/time.ts +0 -0
package/package.json
CHANGED
|
@@ -1,57 +1,141 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
2
|
+
"name": "bx-rest",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "bitrix rest api",
|
|
5
|
+
"typings": "./index.d.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@angular-devkit/build-optimizer": "0.4.6",
|
|
9
|
+
"@angular-devkit/schematics": "^11.0.7",
|
|
10
|
+
"@angular/common": "^16.1.8",
|
|
11
|
+
"@angular/core": "^16.1.8",
|
|
12
|
+
"@angular/material": "^16.1.7",
|
|
13
|
+
"@angular/router": "^16.1.8",
|
|
14
|
+
"@ngrx/store": "^16.2.0",
|
|
15
|
+
"@swc/core": "^1.2.128",
|
|
16
|
+
"@swc/helpers": "^0.3.2",
|
|
17
|
+
"@types/chai": "^4.2.11",
|
|
18
|
+
"@types/estree": "^1.0.1",
|
|
19
|
+
"@types/lodash": "4.14.102",
|
|
20
|
+
"@types/mocha": "^7.0.2",
|
|
21
|
+
"@types/node": "^14.14.6",
|
|
22
|
+
"@types/shelljs": "^0.8.8",
|
|
23
|
+
"@types/sinon": "4.1.3",
|
|
24
|
+
"@types/sinon-chai": "2.7.29",
|
|
25
|
+
"@types/source-map": "^0.5.2",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^4.29.1",
|
|
27
|
+
"@typescript-eslint/parser": "^4.29.1",
|
|
28
|
+
"babel-polyfill": "6.26.0",
|
|
29
|
+
"chai": "^4.2.0",
|
|
30
|
+
"check-side-effects": "0.0.23",
|
|
31
|
+
"color": "3.0.0",
|
|
32
|
+
"colors": "1.1.2",
|
|
33
|
+
"cross-env": "5.1.3",
|
|
34
|
+
"cz-conventional-changelog": "1.2.0",
|
|
35
|
+
"dependency-cruiser": "^9.12.0",
|
|
36
|
+
"entities": "^4.5.0",
|
|
37
|
+
"escape-string-regexp": "1.0.5",
|
|
38
|
+
"eslint": "^7.8.1",
|
|
39
|
+
"eslint-plugin-jasmine": "^2.10.1",
|
|
40
|
+
"form-data": "^3.0.0",
|
|
41
|
+
"fs-extra": "^11.1.1",
|
|
42
|
+
"glob": "7.1.2",
|
|
43
|
+
"google-closure-compiler-js": "20170218.0.0",
|
|
44
|
+
"husky": "^4.2.5",
|
|
45
|
+
"just-clone": "^6.2.0",
|
|
46
|
+
"just-compare": "^2.3.0",
|
|
47
|
+
"klaw-sync": "3.0.2",
|
|
48
|
+
"lint-staged": "^10.2.11",
|
|
49
|
+
"lodash": "^4.17.15",
|
|
50
|
+
"luxon": "^3.3.0",
|
|
51
|
+
"minimist": "^1.2.5",
|
|
52
|
+
"nodemon": "^1.9.2",
|
|
53
|
+
"npm-run-all": "4.1.2",
|
|
54
|
+
"opn-cli": "3.1.0",
|
|
55
|
+
"parse5": "^7.1.2",
|
|
56
|
+
"platform": "1.3.5",
|
|
57
|
+
"prettier": "^2.5.1",
|
|
58
|
+
"promise": "8.0.1",
|
|
59
|
+
"require": "^2.4.20",
|
|
60
|
+
"requirejs": "^2.3.6",
|
|
61
|
+
"rollup": "0.66.6",
|
|
62
|
+
"rollup-plugin-alias": "1.4.0",
|
|
63
|
+
"rollup-plugin-inject": "2.0.0",
|
|
64
|
+
"rollup-plugin-node-resolve": "2.0.0",
|
|
65
|
+
"rxjs": "^7.8.1",
|
|
66
|
+
"safevalues": "^0.3.4",
|
|
67
|
+
"shelljs": "^0.8.4",
|
|
68
|
+
"shx": "^0.3.2",
|
|
69
|
+
"sinon": "4.3.0",
|
|
70
|
+
"sinon-chai": "2.14.0",
|
|
71
|
+
"source-map-support": "0.5.3",
|
|
72
|
+
"systemjs": "^0.21.0",
|
|
73
|
+
"ts-node": "^9.1.1",
|
|
74
|
+
"tslib": "^2.6.1",
|
|
75
|
+
"tslint": "^5.20.1",
|
|
76
|
+
"tslint-config-prettier": "^1.18.0",
|
|
77
|
+
"tslint-etc": "1.13.10",
|
|
78
|
+
"tslint-no-toplevel-property-access": "0.0.2",
|
|
79
|
+
"tslint-no-unused-expression-chai": "0.0.3",
|
|
80
|
+
"validate-commit-msg": "2.14.0",
|
|
81
|
+
"web-streams-polyfill": "^3.0.2",
|
|
82
|
+
"webpack": "^5.88.2",
|
|
83
|
+
"zone.js": "^0.13.1"
|
|
48
84
|
},
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@types/luxon": "^3.3.1",
|
|
87
|
+
"just-flatten-it": "^5.2.0",
|
|
88
|
+
"typescript": "^4.9.5"
|
|
89
|
+
},
|
|
90
|
+
"repository": {
|
|
91
|
+
"type": "git",
|
|
92
|
+
"url": "git+https://github.com/Aricatofuka/bx-rest.git"
|
|
93
|
+
},
|
|
94
|
+
"scripts": {
|
|
95
|
+
"lint_spec": "tslint -c spec/tslint.json -p spec/tsconfig.json \"spec/**/*.ts\"",
|
|
96
|
+
"lint_src": "tslint -c tslint.json -p src/tsconfig.base.json \"src/**/*.ts\"",
|
|
97
|
+
"lint": "npm-run-all --parallel lint_*",
|
|
98
|
+
"dtslint": "tsc -b ./src/tsconfig.types.json && tslint -c spec-dtslint/tslint.json -p spec-dtslint/tsconfig.json \"spec-dtslint/**/*.ts\"",
|
|
99
|
+
"compile": "tsc -b ./src/tsconfig.cjs.json ./src/tsconfig.cjs.spec.json ./src/tsconfig.esm.json ./src/tsconfig.esm5.json ./src/tsconfig.esm5.rollup.json ./src/tsconfig.types.json ./src/tsconfig.types.spec.json ./spec/tsconfig.json",
|
|
100
|
+
"build:clean": "shx rm -rf ./dist",
|
|
101
|
+
"build:global": "node ./tools/make-umd-bundle.js && node ./tools/make-closure-core.js",
|
|
102
|
+
"build:package": "npm-run-all build:clean compile",
|
|
103
|
+
"watch:dtslint": "nodemon -w \"src/\" -w \"spec-dtslint/\" -e ts -x npm run dtslint"
|
|
104
|
+
},
|
|
105
|
+
"//": [
|
|
106
|
+
"build:package",
|
|
107
|
+
"npm-run-all build:clean compile && node ./tools/generate-alias.js",
|
|
108
|
+
"prepublishOnly",
|
|
109
|
+
"npm run build:package && npm run lint && npm run test && npm run test:circular && npm run dtslint"
|
|
110
|
+
],
|
|
111
|
+
"keywords": [
|
|
112
|
+
"bitrxi",
|
|
113
|
+
"rest",
|
|
114
|
+
"api"
|
|
115
|
+
],
|
|
116
|
+
"author": "Aricatofuka",
|
|
117
|
+
"license": "MIT",
|
|
118
|
+
"bugs": {
|
|
119
|
+
"url": "https://github.com/Aricatofuka/bx-rest/issues"
|
|
120
|
+
},
|
|
121
|
+
"homepage": "https://github.com/Aricatofuka/bx-rest#readme",
|
|
122
|
+
"files": [
|
|
123
|
+
"src",
|
|
124
|
+
"LICENSE.txt",
|
|
125
|
+
"package.json",
|
|
126
|
+
"README.md",
|
|
127
|
+
"tsconfig.json"
|
|
128
|
+
],
|
|
129
|
+
"exports": {
|
|
130
|
+
"./package.json": {
|
|
131
|
+
"default": "./package.json"
|
|
132
|
+
},
|
|
133
|
+
".": {
|
|
134
|
+
"types": "./index.d.ts",
|
|
135
|
+
"node": "./dist/cjs/index.js",
|
|
136
|
+
"require": "./dist/cjs/index.js",
|
|
137
|
+
"es2015": "./dist/esm/index.js",
|
|
138
|
+
"default": "./dist/esm5/index.js"
|
|
139
|
+
}
|
|
55
140
|
}
|
|
56
|
-
}
|
|
57
141
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const $get = 'get'
|
|
2
|
+
export const $add = 'add'
|
|
3
|
+
export const $set = 'set'
|
|
4
|
+
export const $event = 'event'
|
|
5
|
+
export const $update = 'update'
|
|
6
|
+
export const $user = 'user'
|
|
7
|
+
export const $task = 'task'
|
|
8
|
+
export const $calendar = 'calendar'
|
|
9
|
+
export const $meeting = 'meeting'
|
|
10
|
+
export const $list = 'list'
|
|
11
|
+
export const $search = 'search'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isDate } from './isDate';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the two passed arguments are equal
|
|
5
|
+
* Currently supports date objects
|
|
6
|
+
*
|
|
7
|
+
* @param obj1
|
|
8
|
+
* @param obj2
|
|
9
|
+
* @returns: `boolean`
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export const isEqual = (obj1: any, obj2: any): boolean => {
|
|
13
|
+
if (isDate(obj1) && isDate(obj2)) {
|
|
14
|
+
return obj1.getTime() === obj2.getTime();
|
|
15
|
+
}
|
|
16
|
+
return obj1 === obj2;
|
|
17
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// Generate an internal UID to make the regexp pattern harder to guess.
|
|
2
|
+
const UID_LENGTH = 16;
|
|
3
|
+
const UID = generateUID();
|
|
4
|
+
const PLACE_HOLDER_REGEXP = new RegExp('(\\\\)?"@__(F|R|D|M|S|A|U|I|B|L)-' + UID + '-(\\d+)__@"', 'g');
|
|
5
|
+
|
|
6
|
+
const IS_NATIVE_CODE_REGEXP = /\{\s*\[native code]\s*}/g;
|
|
7
|
+
const IS_PURE_FUNCTION = /function.*?\(/;
|
|
8
|
+
const IS_ARROW_FUNCTION = /.*?=>.*?/;
|
|
9
|
+
const UNSAFE_CHARS_REGEXP = /[<>\/\u2028\u2029]/g;
|
|
10
|
+
|
|
11
|
+
const RESERVED_SYMBOLS = ['*', 'async'];
|
|
12
|
+
|
|
13
|
+
// Mapping of unsafe HTML and invalid JavaScript line terminator chars to their
|
|
14
|
+
// Unicode char counterparts which are safe to use in JavaScript strings.
|
|
15
|
+
const ESCAPED_CHARS: {[key: string]: string} = {
|
|
16
|
+
'<': '\\u003C',
|
|
17
|
+
'>': '\\u003E',
|
|
18
|
+
'/': '\\u002F',
|
|
19
|
+
'\u2028': '\\u2028',
|
|
20
|
+
'\u2029': '\\u2029'
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function escapeUnsafeChars(unsafeChar: string): string {
|
|
24
|
+
return (ESCAPED_CHARS.hasOwnProperty(unsafeChar)) ? ESCAPED_CHARS[unsafeChar] : '';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function generateUID() {
|
|
28
|
+
let bytes = window.crypto.getRandomValues(new Uint32Array(UID_LENGTH))
|
|
29
|
+
let result = '';
|
|
30
|
+
for (let i = 0; i < UID_LENGTH; ++i) {
|
|
31
|
+
result += bytes[i].toString(16);
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function deleteFunctions(obj: any) {
|
|
37
|
+
let functionKeys = [];
|
|
38
|
+
for (let key in obj) {
|
|
39
|
+
if (typeof obj[key] === "function") {
|
|
40
|
+
functionKeys.push(key);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
for (let i = 0; i < functionKeys.length; i++) {
|
|
44
|
+
delete obj[functionKeys[i]];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function serialize(obj: any, options: any = {}): any {
|
|
49
|
+
// Backwards-compatibility for `space` as the second argument.
|
|
50
|
+
if (typeof options === 'number' || typeof options === 'string') {
|
|
51
|
+
options = {space: options};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let functions: Function[] = [];
|
|
55
|
+
let regexps: any[] = [];
|
|
56
|
+
let dates: any[] = [];
|
|
57
|
+
let maps: any[] = [];
|
|
58
|
+
let sets: any[] = [];
|
|
59
|
+
let arrays: any[] = [];
|
|
60
|
+
let undefs: any[] = [];
|
|
61
|
+
let infinities: any[] = [];
|
|
62
|
+
let bigInts: any[] = [];
|
|
63
|
+
let urls: any[] = [];
|
|
64
|
+
|
|
65
|
+
// Returns placeholders for functions and regexps (identified by index)
|
|
66
|
+
// which are later replaced by their string representation.
|
|
67
|
+
function replacer(key: string, value: any) {
|
|
68
|
+
|
|
69
|
+
// For nested function
|
|
70
|
+
if (options.ignoreFunction) {
|
|
71
|
+
deleteFunctions(value);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!value && value !== undefined) {
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// let origValue: any = this[key];
|
|
79
|
+
let origValue: any = value;
|
|
80
|
+
let type = typeof origValue;
|
|
81
|
+
|
|
82
|
+
switch (type){
|
|
83
|
+
case 'object':
|
|
84
|
+
|
|
85
|
+
if (origValue instanceof RegExp) {
|
|
86
|
+
return '@__R-' + UID + '-' + (regexps.push(origValue) - 1) + '__@';
|
|
87
|
+
} else if (origValue instanceof Date) {
|
|
88
|
+
return '@__D-' + UID + '-' + (dates.push(origValue) - 1) + '__@';
|
|
89
|
+
} else if (origValue instanceof Map) {
|
|
90
|
+
return '@__M-' + UID + '-' + (maps.push(origValue) - 1) + '__@';
|
|
91
|
+
} else if (origValue instanceof Set) {
|
|
92
|
+
return '@__S-' + UID + '-' + (sets.push(origValue) - 1) + '__@';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (origValue instanceof Array) {
|
|
96
|
+
let isSparse = origValue.filter(function () {
|
|
97
|
+
return true
|
|
98
|
+
}).length !== origValue.length;
|
|
99
|
+
if (isSparse) {
|
|
100
|
+
return '@__A-' + UID + '-' + (arrays.push(origValue) - 1) + '__@';
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (origValue instanceof URL) {
|
|
105
|
+
return '@__L-' + UID + '-' + (urls.push(origValue) - 1) + '__@';
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
108
|
+
case 'function':
|
|
109
|
+
return '@__F-' + UID + '-' + (functions.push(origValue) - 1) + '__@';
|
|
110
|
+
case 'undefined':
|
|
111
|
+
return '@__U-' + UID + '-' + (undefs.push(origValue) - 1) + '__@';
|
|
112
|
+
case 'number':
|
|
113
|
+
return '@__I-' + UID + '-' + (infinities.push(origValue) - 1) + '__@';
|
|
114
|
+
case 'bigint':
|
|
115
|
+
return '@__B-' + UID + '-' + (bigInts.push(origValue) - 1) + '__@';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function serializeFunc(fn: Function) {
|
|
122
|
+
let serializedFn = fn.toString();
|
|
123
|
+
if (IS_NATIVE_CODE_REGEXP.test(serializedFn)) {
|
|
124
|
+
throw new TypeError('Serializing native function: ' + fn.name);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// pure functions, example: {key: function() {}}
|
|
128
|
+
if (IS_PURE_FUNCTION.test(serializedFn)) {
|
|
129
|
+
return serializedFn;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// arrow functions, example: arg1 => arg1+5
|
|
133
|
+
if (IS_ARROW_FUNCTION.test(serializedFn)) {
|
|
134
|
+
return serializedFn;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
let argsStartsAt = serializedFn.indexOf('(');
|
|
138
|
+
let def = serializedFn.slice(0, argsStartsAt)
|
|
139
|
+
.trim()
|
|
140
|
+
.split(' ')
|
|
141
|
+
.filter(function (val) {
|
|
142
|
+
return val.length > 0
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
let nonReservedSymbols = def.filter(function (val) {
|
|
146
|
+
return RESERVED_SYMBOLS.indexOf(val) === -1
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// enhanced literal objects, example: {key() {}}
|
|
150
|
+
if (nonReservedSymbols.length > 0) {
|
|
151
|
+
return (def.indexOf('async') > -1 ? 'async ' : '') + 'function'
|
|
152
|
+
+ (def.join('').indexOf('*') > -1 ? '*' : '')
|
|
153
|
+
+ serializedFn.slice(argsStartsAt);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// arrow functions
|
|
157
|
+
return serializedFn;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Check if the parameter is function
|
|
161
|
+
if (options.ignoreFunction && typeof obj === "function") {
|
|
162
|
+
obj = undefined;
|
|
163
|
+
}
|
|
164
|
+
// Protects against `JSON.stringify()` returning `undefined`, by serializing
|
|
165
|
+
// to the literal string: "undefined".
|
|
166
|
+
if (obj === undefined) {
|
|
167
|
+
return String(obj);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let str: string = '';
|
|
171
|
+
|
|
172
|
+
// Creates a JSON string representation of the value.
|
|
173
|
+
// NOTE: Node 0.12 goes into slow mode with extra JSON.stringify() args.
|
|
174
|
+
if (options.isJSON && !options.space) {
|
|
175
|
+
str = JSON.stringify(obj);
|
|
176
|
+
} else {
|
|
177
|
+
str = JSON.stringify(obj, options.isJSON ? undefined : replacer, options.space);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Replace unsafe HTML and invalid JavaScript line terminator chars with
|
|
181
|
+
// their safe Unicode char counterpart. This _must_ happen before the
|
|
182
|
+
// regexps and functions are serialized and added back to the string.
|
|
183
|
+
if (options.unsafe !== true) {
|
|
184
|
+
str = str.replace(UNSAFE_CHARS_REGEXP, escapeUnsafeChars);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (functions.length === 0 && regexps.length === 0 && dates.length === 0 && maps.length === 0 && sets.length === 0 && arrays.length === 0 && undefs.length === 0 && infinities.length === 0 && bigInts.length === 0 && urls.length === 0) {
|
|
188
|
+
return str;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Replaces all occurrences of function, regexp, date, map and set placeholders in the
|
|
192
|
+
// JSON string with their string representations. If the original value can
|
|
193
|
+
// not be found, then `undefined` is used.
|
|
194
|
+
return str.replace(PLACE_HOLDER_REGEXP, function (match, backSlash, type, valueIndex) {
|
|
195
|
+
// The placeholder may not be preceded by a backslash. This is to prevent
|
|
196
|
+
// replacing things like `"a\"@__R-<UID>-0__@"` and thus outputting
|
|
197
|
+
// invalid JS.
|
|
198
|
+
if (backSlash) {
|
|
199
|
+
return match;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
switch (type){
|
|
203
|
+
case 'D':
|
|
204
|
+
return "new Date(\"" + dates[valueIndex].toISOString() + "\")"
|
|
205
|
+
case 'R':
|
|
206
|
+
return "new RegExp(" + serialize(regexps[valueIndex].source) + ", \"" + regexps[valueIndex].flags + "\")"
|
|
207
|
+
case 'M':
|
|
208
|
+
return "new Map(" + serialize(Array.from(maps[valueIndex].entries()), options) + ")"
|
|
209
|
+
case 'S':
|
|
210
|
+
return "new Set(" + serialize(Array.from(sets[valueIndex].values()), options) + ")"
|
|
211
|
+
case 'A':
|
|
212
|
+
return "Array.prototype.slice.call(" + serialize(Object.assign({length: arrays[valueIndex].length}, arrays[valueIndex]), options) + ")"
|
|
213
|
+
case 'U':
|
|
214
|
+
return 'undefined'
|
|
215
|
+
case 'I':
|
|
216
|
+
return infinities[valueIndex]
|
|
217
|
+
case 'B':
|
|
218
|
+
return "BigInt(\"" + bigInts[valueIndex] + "\")"
|
|
219
|
+
case 'L':
|
|
220
|
+
return "new URL(\"" + urls[valueIndex].toString() + "\")"
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
let fn = functions[valueIndex];
|
|
224
|
+
|
|
225
|
+
return serializeFunc(fn);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export default serialize
|
package/src/rest/user/user.ts
CHANGED
|
@@ -2,20 +2,21 @@ import { Observable, of, take } from 'rxjs'
|
|
|
2
2
|
import { first, map, mergeMap, tap } from 'rxjs/operators'
|
|
3
3
|
import clone from 'just-clone'
|
|
4
4
|
import compare from 'just-compare'
|
|
5
|
-
import { iBXGetParam } from '
|
|
6
|
-
import HttpBXServices from '
|
|
7
|
-
import UserFilterSearch from '
|
|
8
|
-
import ImgServices from '
|
|
5
|
+
import { iBXGetParam } from 'bx-rest/src/typification/rest/user/get'
|
|
6
|
+
import HttpBXServices from 'bx-rest/src/services/http/HttpBX'
|
|
7
|
+
import UserFilterSearch from 'bx-rest/src/typification/rest/user/UserFilterSearch'
|
|
8
|
+
// import ImgServices from 'bx-rest/src/services/api/bitrix/custom/img'
|
|
9
9
|
import { Store } from '@ngrx/store'
|
|
10
|
-
import { loadAll, saveArr, saveIDLoadedDepartment, saveSelf, storeUsers } from '
|
|
11
|
-
import { iCustomUserFieldInfo } from '
|
|
10
|
+
import { loadAll, saveArr, saveIDLoadedDepartment, saveSelf, storeUsers } from 'bx-rest/src/store/users'
|
|
11
|
+
import { iCustomUserFieldInfo } from 'bx-rest/src/typification/rest/user/CustomUserFieldInfo'
|
|
12
12
|
import { DatePipe } from '@angular/common'
|
|
13
|
-
import { BitrixApiUserMapServices } from '
|
|
14
|
-
import DateTrace from '
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
13
|
+
import { BitrixApiUserMapServices } from 'bx-rest/src/services/map/rest/user'
|
|
14
|
+
// import DateTrace from 'bx-rest/src/services/api/trace/metods/date'
|
|
15
|
+
import SnackBarService from 'bx-rest/src/services/snack-bar/snack-bar.service'
|
|
16
|
+
import iHttpAnswerBX from 'bx-rest/src/typification/rest/base/httpAnswerBX'
|
|
17
|
+
import { iBXRestUser, iBXRestUserHttp, iBXRestUserHttpField } from 'bx-rest/src/typification/rest/user/user'
|
|
18
|
+
import { $get, $list, $search, $update, $user } from '../../consts/part-name-metods'
|
|
19
|
+
import { UserFilter } from '../../typification/rest/user/userFilter';
|
|
19
20
|
|
|
20
21
|
export class BXRestUser {
|
|
21
22
|
url = {
|
|
@@ -43,8 +44,8 @@ export class BXRestUser {
|
|
|
43
44
|
constructor(
|
|
44
45
|
private http: HttpBXServices,
|
|
45
46
|
private snackBar: SnackBarService,
|
|
46
|
-
|
|
47
|
-
private dateTrace: DateTrace,
|
|
47
|
+
// private img: ImgServices,
|
|
48
|
+
//private dateTrace: DateTrace,
|
|
48
49
|
private store: Store<{ users: storeUsers }>,
|
|
49
50
|
private userMap: BitrixApiUserMapServices,
|
|
50
51
|
private datePipe: DatePipe
|
|
@@ -307,9 +308,9 @@ export class BXRestUser {
|
|
|
307
308
|
)
|
|
308
309
|
}
|
|
309
310
|
|
|
310
|
-
getUrlCompressedImage(url: string, width: number, height: number) {
|
|
311
|
-
|
|
312
|
-
}
|
|
311
|
+
// getUrlCompressedImage(url: string, width: number, height: number) {
|
|
312
|
+
// return this.img.getUrlCompressed(url, width, height)
|
|
313
|
+
// }
|
|
313
314
|
|
|
314
315
|
setDefParam(params: iBXGetParam) {
|
|
315
316
|
if (!params.hasOwnProperty('ACTIVE')) {
|
package/src/services/base.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core'
|
|
2
|
-
import { time } from '
|
|
3
|
-
// import { environment } from '
|
|
2
|
+
import { time } from 'bx-rest/src/consts/time'
|
|
3
|
+
// import { environment } from 'bx-rest/src/environments/environment'
|
|
4
4
|
import { DateTime } from 'luxon'
|
|
5
5
|
import { DateTimeOptions } from 'luxon/src/datetime'
|
|
6
6
|
|