@opra/common 0.16.1 → 0.17.0
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/cjs/document/data-type/complex-type.js +69 -56
- package/cjs/document/data-type/simple-type.js +0 -1
- package/cjs/document/resource/collection.js +15 -16
- package/cjs/document/resource/singleton.js +2 -2
- package/cjs/http/http-params.js +10 -11
- package/esm/document/api-document.js +33 -37
- package/esm/document/constants.js +3 -6
- package/esm/document/data-type/api-field.js +12 -15
- package/esm/document/data-type/builtin/any.type.js +5 -8
- package/esm/document/data-type/builtin/base64.type.js +5 -8
- package/esm/document/data-type/builtin/bigint.type.js +5 -8
- package/esm/document/data-type/builtin/boolean.type.js +8 -11
- package/esm/document/data-type/builtin/date.type.js +7 -10
- package/esm/document/data-type/builtin/guid.type.js +9 -12
- package/esm/document/data-type/builtin/index.js +10 -13
- package/esm/document/data-type/builtin/integer.type.js +10 -13
- package/esm/document/data-type/builtin/number.type.js +7 -10
- package/esm/document/data-type/builtin/object.type.js +5 -8
- package/esm/document/data-type/builtin/string.type.js +8 -11
- package/esm/document/data-type/builtin/time.type.js +7 -10
- package/esm/document/data-type/builtin/timestamp.type.js +9 -12
- package/esm/document/data-type/complex-type.js +94 -85
- package/esm/document/data-type/data-type.js +9 -12
- package/esm/document/data-type/enum-type.js +15 -19
- package/esm/document/data-type/mapped-type.js +24 -29
- package/esm/document/data-type/simple-type.js +17 -22
- package/esm/document/data-type/union-type.js +26 -29
- package/esm/document/factory/add-references.js +3 -7
- package/esm/document/factory/create-document.js +10 -16
- package/esm/document/factory/factory.js +33 -37
- package/esm/document/factory/import-resource-class.js +16 -22
- package/esm/document/factory/import-type-class.js +24 -34
- package/esm/document/factory/index.js +1 -4
- package/esm/document/factory/process-resources.js +10 -16
- package/esm/document/factory/process-types.js +31 -37
- package/esm/document/index.js +14 -17
- package/esm/document/resource/collection.js +58 -63
- package/esm/document/resource/resource.js +9 -12
- package/esm/document/resource/singleton.js +27 -31
- package/esm/document/utils/inspect.util.js +4 -7
- package/esm/document/utils/string-compare.util.js +1 -5
- package/esm/exception/enums/issue-severity.enum.js +2 -5
- package/esm/exception/error-issue.js +1 -2
- package/esm/exception/http-errors/bad-request.error.js +4 -8
- package/esm/exception/http-errors/failed-dependency.error.js +4 -8
- package/esm/exception/http-errors/forbidden.error.js +4 -8
- package/esm/exception/http-errors/internal-server.error.js +4 -8
- package/esm/exception/http-errors/method-not-allowed.error.js +4 -8
- package/esm/exception/http-errors/not-acceptable.error.js +4 -8
- package/esm/exception/http-errors/not-found.error.js +4 -8
- package/esm/exception/http-errors/unauthorized.error.js +4 -8
- package/esm/exception/http-errors/unprocessable-entity.error.js +4 -8
- package/esm/exception/index.js +15 -18
- package/esm/exception/opra-exception.js +3 -7
- package/esm/exception/resource-errors/resource-conflict.error.js +4 -8
- package/esm/exception/resource-errors/resource-not-found.error.js +4 -8
- package/esm/exception/wrap-exception.js +20 -24
- package/esm/filter/antlr/OpraFilterLexer.js +6 -9
- package/esm/filter/antlr/OpraFilterListener.js +2 -5
- package/esm/filter/antlr/OpraFilterParser.js +79 -126
- package/esm/filter/antlr/OpraFilterVisitor.js +2 -5
- package/esm/filter/ast/abstract/ast.js +1 -5
- package/esm/filter/ast/abstract/expression.js +2 -6
- package/esm/filter/ast/abstract/literal.js +2 -6
- package/esm/filter/ast/abstract/term.js +2 -6
- package/esm/filter/ast/expressions/arithmetic-expression.js +3 -8
- package/esm/filter/ast/expressions/array-expression.js +2 -6
- package/esm/filter/ast/expressions/comparison-expression.js +2 -6
- package/esm/filter/ast/expressions/logical-expression.js +2 -6
- package/esm/filter/ast/expressions/parentheses-expression.js +2 -6
- package/esm/filter/ast/index.js +16 -19
- package/esm/filter/ast/terms/boolean-literal.js +2 -6
- package/esm/filter/ast/terms/date-literal.js +8 -12
- package/esm/filter/ast/terms/external-constant.js +2 -6
- package/esm/filter/ast/terms/null-literal.js +2 -6
- package/esm/filter/ast/terms/number-literal.js +4 -8
- package/esm/filter/ast/terms/qualified-identifier.js +2 -6
- package/esm/filter/ast/terms/string-literal.js +4 -8
- package/esm/filter/ast/terms/time-literal.js +6 -10
- package/esm/filter/build.js +45 -69
- package/esm/filter/errors.js +3 -9
- package/esm/filter/filter-tree-visitor.js +26 -31
- package/esm/filter/index.js +5 -8
- package/esm/filter/opra-error-listener.js +4 -8
- package/esm/filter/parse.js +14 -19
- package/esm/filter/utils.js +2 -7
- package/esm/helpers/function-utils.js +8 -14
- package/esm/helpers/get-stack-filename.js +1 -5
- package/esm/helpers/index.js +8 -11
- package/esm/helpers/is-url.js +1 -5
- package/esm/helpers/mixin-utils.js +2 -7
- package/esm/helpers/object-utils.js +6 -12
- package/esm/helpers/path-to-object-tree.js +1 -5
- package/esm/helpers/responsive-map.js +1 -5
- package/esm/helpers/type-guards.js +7 -17
- package/esm/http/codecs/boolean-codec.js +1 -5
- package/esm/http/codecs/date-codec.js +1 -5
- package/esm/http/codecs/filter-codec.js +5 -9
- package/esm/http/codecs/integer-codec.js +2 -6
- package/esm/http/codecs/number-codec.js +1 -5
- package/esm/http/codecs/string-codec.js +1 -5
- package/esm/http/enums/http-headers-codes.enum.js +2 -5
- package/esm/http/enums/http-status-codes.enum.js +2 -5
- package/esm/http/enums/http-status-messages.js +1 -4
- package/esm/http/http-headers.js +5 -9
- package/esm/http/http-message.host.js +13 -18
- package/esm/http/http-params.js +30 -36
- package/esm/http/http-request-message.js +18 -22
- package/esm/http/http-response-message.js +23 -28
- package/esm/http/index.js +14 -17
- package/esm/http/interfaces/client-http-headers.interface.js +1 -2
- package/esm/http/interfaces/cookie-options.interface.js +1 -2
- package/esm/http/interfaces/server-http-headers.interface.js +1 -2
- package/esm/i18n/i18n.js +23 -28
- package/esm/i18n/index.js +5 -9
- package/esm/i18n/string-utils.js +2 -7
- package/esm/i18n/translate.js +3 -7
- package/esm/index.js +11 -16
- package/esm/schema/constants.js +1 -4
- package/esm/schema/data-type/complex-type.interface.js +2 -5
- package/esm/schema/data-type/data-type.interface.js +1 -2
- package/esm/schema/data-type/enum-type.interface.js +2 -5
- package/esm/schema/data-type/field.interface.js +1 -2
- package/esm/schema/data-type/mapped-type.interface.js +2 -5
- package/esm/schema/data-type/simple-type.interface.js +2 -5
- package/esm/schema/data-type/union-type.interface.js +2 -5
- package/esm/schema/document.interface.js +1 -2
- package/esm/schema/index.js +31 -34
- package/esm/schema/resource/collection.interface.js +2 -5
- package/esm/schema/resource/container.interface.js +2 -5
- package/esm/schema/resource/endpoint.interface.js +1 -2
- package/esm/schema/resource/resource.interface.js +1 -2
- package/esm/schema/resource/singleton.interface.js +2 -5
- package/esm/schema/type-guards.js +40 -53
- package/esm/types.js +1 -2
- package/esm/url/index.js +5 -8
- package/esm/url/opra-url-path-component.js +3 -7
- package/esm/url/opra-url-path.js +14 -18
- package/esm/url/opra-url.js +15 -19
- package/esm/url/utils/decode-path-component.js +4 -8
- package/esm/url/utils/encode-path-component.js +3 -8
- package/esm/utils/path-utils.js +2 -7
- package/package.json +1 -1
- package/types/document/data-type/complex-type.d.ts +8 -2
- package/types/document/resource/collection.d.ts +5 -3
- package/types/document/resource/singleton.d.ts +3 -1
- package/types/filter/ast/terms/qualified-identifier.d.ts +4 -0
- package/types/http/http-params.d.ts +20 -19
package/esm/i18n/string-utils.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unescapeString = exports.escapeString = void 0;
|
|
4
1
|
const unescapeRegEx = /\\(.)/g;
|
|
5
2
|
const escapeRegEx = /(\\)/g;
|
|
6
|
-
function escapeString(s) {
|
|
3
|
+
export function escapeString(s) {
|
|
7
4
|
return s.replace(escapeRegEx, '\\\\');
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
function unescapeString(s) {
|
|
6
|
+
export function unescapeString(s) {
|
|
11
7
|
return s.replace(unescapeRegEx, '$1');
|
|
12
8
|
}
|
|
13
|
-
exports.unescapeString = unescapeString;
|
package/esm/i18n/translate.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.translate = void 0;
|
|
4
|
-
const string_utils_js_1 = require("./string-utils.js");
|
|
1
|
+
import { escapeString } from './string-utils.js';
|
|
5
2
|
const bracketRegEx = /(\))/g;
|
|
6
|
-
function translate(key, arg0, arg1) {
|
|
3
|
+
export function translate(key, arg0, arg1) {
|
|
7
4
|
const options = arg0 && typeof arg0 === 'object' ? arg0 : undefined;
|
|
8
5
|
const fallback = typeof arg0 === 'string' ? arg0 : arg1;
|
|
9
6
|
return '$t(' +
|
|
10
7
|
key +
|
|
11
8
|
(options ? ',' + JSON.stringify(options) : '') +
|
|
12
|
-
(fallback ? '?' +
|
|
9
|
+
(fallback ? '?' + escapeString(fallback).replace(bracketRegEx, '\\$1') : '') +
|
|
13
10
|
')';
|
|
14
11
|
}
|
|
15
|
-
exports.translate = translate;
|
package/esm/index.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
tslib_1.__exportStar(require("./schema/index.js"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./url/index.js"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./utils/path-utils.js"), exports);
|
|
15
|
-
var uid_1 = require("uid");
|
|
16
|
-
Object.defineProperty(exports, "uid", { enumerable: true, get: function () { return uid_1.uid; } });
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './document/index.js';
|
|
3
|
+
export * from './exception/index.js';
|
|
4
|
+
export * from './filter/index.js'; // todo review
|
|
5
|
+
export * from './helpers/index.js';
|
|
6
|
+
export * from './http/index.js';
|
|
7
|
+
export * from './i18n/index.js';
|
|
8
|
+
export * from './schema/index.js';
|
|
9
|
+
export * from './url/index.js';
|
|
10
|
+
export * from './utils/path-utils.js';
|
|
11
|
+
export { uid } from 'uid';
|
package/esm/schema/constants.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ComplexType = void 0;
|
|
4
|
-
var ComplexType;
|
|
1
|
+
export var ComplexType;
|
|
5
2
|
(function (ComplexType) {
|
|
6
3
|
ComplexType.Kind = 'ComplexType';
|
|
7
|
-
})(ComplexType
|
|
4
|
+
})(ComplexType || (ComplexType = {}));
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EnumType = void 0;
|
|
4
|
-
var EnumType;
|
|
1
|
+
export var EnumType;
|
|
5
2
|
(function (EnumType) {
|
|
6
3
|
EnumType.Kind = 'EnumType';
|
|
7
|
-
})(EnumType
|
|
4
|
+
})(EnumType || (EnumType = {}));
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MappedType = void 0;
|
|
4
|
-
var MappedType;
|
|
1
|
+
export var MappedType;
|
|
5
2
|
(function (MappedType) {
|
|
6
3
|
MappedType.Kind = 'MappedType';
|
|
7
|
-
})(MappedType
|
|
4
|
+
})(MappedType || (MappedType = {}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SimpleType = void 0;
|
|
4
|
-
var SimpleType;
|
|
1
|
+
export var SimpleType;
|
|
5
2
|
(function (SimpleType) {
|
|
6
3
|
SimpleType.Kind = 'SimpleType';
|
|
7
|
-
})(SimpleType
|
|
4
|
+
})(SimpleType || (SimpleType = {}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnionType = void 0;
|
|
4
|
-
var UnionType;
|
|
1
|
+
export var UnionType;
|
|
5
2
|
(function (UnionType) {
|
|
6
3
|
UnionType.Kind = 'UnionType';
|
|
7
|
-
})(UnionType
|
|
4
|
+
})(UnionType || (UnionType = {}));
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/esm/schema/index.js
CHANGED
|
@@ -1,44 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const singleton_interface_js_1 = require("./resource/singleton.interface.js");
|
|
13
|
-
const type_guards_js_1 = require("./type-guards.js");
|
|
14
|
-
var OpraSchema;
|
|
1
|
+
import { SpecVersion as _SpecVersion } from './constants.js';
|
|
2
|
+
import { ComplexType as _ComplexType } from './data-type/complex-type.interface.js';
|
|
3
|
+
import { EnumType as _EnumType } from './data-type/enum-type.interface.js';
|
|
4
|
+
import { MappedType as _MappedType } from './data-type/mapped-type.interface.js';
|
|
5
|
+
import { SimpleType as _SimpleType } from './data-type/simple-type.interface.js';
|
|
6
|
+
import { UnionType as _UnionType } from './data-type/union-type.interface.js';
|
|
7
|
+
import { Collection as _Collection } from './resource/collection.interface.js';
|
|
8
|
+
import { Container as _Container } from './resource/container.interface.js';
|
|
9
|
+
import { Singleton as _Singleton } from './resource/singleton.interface.js';
|
|
10
|
+
import { isCollection as _isCollection, isComplexType as _isComplexType, isContainer as _isContainer, isDataType as _isDataType, isEnumType as _isEnumType, isMappedType as _isMappedType, isResource as _isResource, isSimpleType as _isSimpleType, isSingleton as _isSingleton, isUnionType as _isUnionType } from './type-guards.js';
|
|
11
|
+
export var OpraSchema;
|
|
15
12
|
(function (OpraSchema) {
|
|
16
13
|
// Re-export constants and types
|
|
17
|
-
OpraSchema.SpecVersion =
|
|
14
|
+
OpraSchema.SpecVersion = _SpecVersion;
|
|
18
15
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
-
OpraSchema.ComplexType =
|
|
16
|
+
OpraSchema.ComplexType = _ComplexType;
|
|
20
17
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
|
-
OpraSchema.EnumType =
|
|
18
|
+
OpraSchema.EnumType = _EnumType;
|
|
22
19
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
|
-
OpraSchema.MappedType =
|
|
20
|
+
OpraSchema.MappedType = _MappedType;
|
|
24
21
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
|
-
OpraSchema.SimpleType =
|
|
22
|
+
OpraSchema.SimpleType = _SimpleType;
|
|
26
23
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
|
-
OpraSchema.UnionType =
|
|
24
|
+
OpraSchema.UnionType = _UnionType;
|
|
28
25
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
|
-
OpraSchema.Collection =
|
|
26
|
+
OpraSchema.Collection = _Collection;
|
|
30
27
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
|
-
OpraSchema.Container =
|
|
28
|
+
OpraSchema.Container = _Container;
|
|
32
29
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
-
OpraSchema.Singleton =
|
|
34
|
-
OpraSchema.isDataType =
|
|
35
|
-
OpraSchema.isComplexType =
|
|
36
|
-
OpraSchema.isEnumType =
|
|
37
|
-
OpraSchema.isMappedType =
|
|
38
|
-
OpraSchema.isSimpleType =
|
|
39
|
-
OpraSchema.isUnionType =
|
|
40
|
-
OpraSchema.isResource =
|
|
41
|
-
OpraSchema.isCollection =
|
|
42
|
-
OpraSchema.isContainer =
|
|
43
|
-
OpraSchema.isSingleton =
|
|
44
|
-
})(OpraSchema
|
|
30
|
+
OpraSchema.Singleton = _Singleton;
|
|
31
|
+
OpraSchema.isDataType = _isDataType;
|
|
32
|
+
OpraSchema.isComplexType = _isComplexType;
|
|
33
|
+
OpraSchema.isEnumType = _isEnumType;
|
|
34
|
+
OpraSchema.isMappedType = _isMappedType;
|
|
35
|
+
OpraSchema.isSimpleType = _isSimpleType;
|
|
36
|
+
OpraSchema.isUnionType = _isUnionType;
|
|
37
|
+
OpraSchema.isResource = _isResource;
|
|
38
|
+
OpraSchema.isCollection = _isCollection;
|
|
39
|
+
OpraSchema.isContainer = _isContainer;
|
|
40
|
+
OpraSchema.isSingleton = _isSingleton;
|
|
41
|
+
})(OpraSchema || (OpraSchema = {}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Collection = void 0;
|
|
4
|
-
var Collection;
|
|
1
|
+
export var Collection;
|
|
5
2
|
(function (Collection) {
|
|
6
3
|
Collection.Kind = 'Collection';
|
|
7
|
-
})(Collection
|
|
4
|
+
})(Collection || (Collection = {}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Container = void 0;
|
|
4
|
-
var Container;
|
|
1
|
+
export var Container;
|
|
5
2
|
(function (Container) {
|
|
6
3
|
Container.Kind = 'Container';
|
|
7
|
-
})(Container
|
|
4
|
+
})(Container || (Container = {}));
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Singleton = void 0;
|
|
4
|
-
var Singleton;
|
|
1
|
+
export var Singleton;
|
|
5
2
|
(function (Singleton) {
|
|
6
3
|
Singleton.Kind = 'Singleton';
|
|
7
|
-
})(Singleton
|
|
4
|
+
})(Singleton || (Singleton = {}));
|
|
@@ -1,59 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const container_interface_js_1 = require("./resource/container.interface.js");
|
|
11
|
-
const singleton_interface_js_1 = require("./resource/singleton.interface.js");
|
|
12
|
-
function isDataType(obj) {
|
|
1
|
+
import { ComplexType } from './data-type/complex-type.interface.js';
|
|
2
|
+
import { EnumType } from './data-type/enum-type.interface.js';
|
|
3
|
+
import { MappedType } from './data-type/mapped-type.interface.js';
|
|
4
|
+
import { SimpleType } from './data-type/simple-type.interface.js';
|
|
5
|
+
import { UnionType } from './data-type/union-type.interface.js';
|
|
6
|
+
import { Collection } from './resource/collection.interface.js';
|
|
7
|
+
import { Container } from './resource/container.interface.js';
|
|
8
|
+
import { Singleton } from './resource/singleton.interface.js';
|
|
9
|
+
export function isDataType(obj) {
|
|
13
10
|
return obj && typeof obj === 'object' &&
|
|
14
|
-
(obj.kind ===
|
|
15
|
-
obj.kind ===
|
|
16
|
-
obj.kind ===
|
|
17
|
-
obj.kind ===
|
|
18
|
-
obj.kind ===
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
function
|
|
30
|
-
return obj && typeof obj === 'object' && obj.kind ===
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
exports.isMappedType = isMappedType;
|
|
37
|
-
function isEnumType(obj) {
|
|
38
|
-
return obj && typeof obj === 'object' && obj.kind === enum_type_interface_js_1.EnumType.Kind;
|
|
39
|
-
}
|
|
40
|
-
exports.isEnumType = isEnumType;
|
|
41
|
-
function isResource(obj) {
|
|
11
|
+
(obj.kind === ComplexType.Kind ||
|
|
12
|
+
obj.kind === EnumType.Kind ||
|
|
13
|
+
obj.kind === MappedType.Kind ||
|
|
14
|
+
obj.kind === SimpleType.Kind ||
|
|
15
|
+
obj.kind === UnionType.Kind);
|
|
16
|
+
}
|
|
17
|
+
export function isComplexType(obj) {
|
|
18
|
+
return obj && typeof obj === 'object' && obj.kind === ComplexType.Kind;
|
|
19
|
+
}
|
|
20
|
+
export function isSimpleType(obj) {
|
|
21
|
+
return obj && typeof obj === 'object' && obj.kind === SimpleType.Kind;
|
|
22
|
+
}
|
|
23
|
+
export function isUnionType(obj) {
|
|
24
|
+
return obj && typeof obj === 'object' && obj.kind === UnionType.Kind;
|
|
25
|
+
}
|
|
26
|
+
export function isMappedType(obj) {
|
|
27
|
+
return obj && typeof obj === 'object' && obj.kind === MappedType.Kind;
|
|
28
|
+
}
|
|
29
|
+
export function isEnumType(obj) {
|
|
30
|
+
return obj && typeof obj === 'object' && obj.kind === EnumType.Kind;
|
|
31
|
+
}
|
|
32
|
+
export function isResource(obj) {
|
|
42
33
|
return obj && typeof obj === 'object' &&
|
|
43
|
-
(obj.kind ===
|
|
44
|
-
obj.kind ===
|
|
45
|
-
obj.kind ===
|
|
34
|
+
(obj.kind === Container.Kind ||
|
|
35
|
+
obj.kind === Collection.Kind ||
|
|
36
|
+
obj.kind === Singleton.Kind);
|
|
46
37
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return obj && typeof obj === 'object' && obj.kind === collection_interface_js_1.Collection.Kind;
|
|
38
|
+
export function isCollection(obj) {
|
|
39
|
+
return obj && typeof obj === 'object' && obj.kind === Collection.Kind;
|
|
50
40
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return obj && typeof obj === 'object' && obj.kind === singleton_interface_js_1.Singleton.Kind;
|
|
41
|
+
export function isSingleton(obj) {
|
|
42
|
+
return obj && typeof obj === 'object' && obj.kind === Singleton.Kind;
|
|
54
43
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return obj && typeof obj === 'object' && obj.kind === container_interface_js_1.Container.Kind;
|
|
44
|
+
export function isContainer(obj) {
|
|
45
|
+
return obj && typeof obj === 'object' && obj.kind === Container.Kind;
|
|
58
46
|
}
|
|
59
|
-
exports.isContainer = isContainer;
|
package/esm/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/esm/url/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
tslib_1.__exportStar(require("./opra-url-path-component.js"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./utils/encode-path-component.js"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./utils/decode-path-component.js"), exports);
|
|
1
|
+
export * from './opra-url.js';
|
|
2
|
+
export * from './opra-url-path.js';
|
|
3
|
+
export * from './opra-url-path-component.js';
|
|
4
|
+
export * from './utils/encode-path-component.js';
|
|
5
|
+
export * from './utils/decode-path-component.js';
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OpraURLPathComponent = void 0;
|
|
4
|
-
const encode_path_component_js_1 = require("./utils/encode-path-component.js");
|
|
1
|
+
import { encodePathComponent } from './utils/encode-path-component.js';
|
|
5
2
|
const nodeInspectCustom = Symbol.for('nodejs.util.inspect.custom');
|
|
6
|
-
class OpraURLPathComponent {
|
|
3
|
+
export class OpraURLPathComponent {
|
|
7
4
|
constructor(init) {
|
|
8
5
|
this.resource = init.resource;
|
|
9
6
|
this.key = init.key;
|
|
10
7
|
this.typeCast = init.typeCast;
|
|
11
8
|
}
|
|
12
9
|
toString() {
|
|
13
|
-
const obj =
|
|
10
|
+
const obj = encodePathComponent(this.resource, this.key, this.typeCast);
|
|
14
11
|
if (obj)
|
|
15
12
|
Object.setPrototypeOf(obj, OpraURLPathComponent.prototype);
|
|
16
13
|
return obj;
|
|
@@ -27,4 +24,3 @@ class OpraURLPathComponent {
|
|
|
27
24
|
return out;
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
exports.OpraURLPathComponent = OpraURLPathComponent;
|
package/esm/url/opra-url-path.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var _a;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const decode_path_component_js_1 = require("./utils/decode-path-component.js");
|
|
10
|
-
const encode_path_component_js_1 = require("./utils/encode-path-component.js");
|
|
2
|
+
import { tokenize } from 'fast-tokenizer';
|
|
3
|
+
import { isURL } from '../helpers/index.js';
|
|
4
|
+
import { normalizePath } from '../utils/path-utils.js';
|
|
5
|
+
import { OpraURLPathComponent } from './opra-url-path-component.js';
|
|
6
|
+
import { decodePathComponent } from './utils/decode-path-component.js';
|
|
7
|
+
import { encodePathComponent } from './utils/encode-path-component.js';
|
|
11
8
|
const nodeInspectCustom = Symbol.for('nodejs.util.inspect.custom');
|
|
12
9
|
const kEntries = Symbol('kEntries');
|
|
13
10
|
const kOptions = Symbol('kOptions');
|
|
14
|
-
class OpraURLPath {
|
|
11
|
+
export class OpraURLPath {
|
|
15
12
|
constructor(init, options) {
|
|
16
13
|
this[_a] = [];
|
|
17
14
|
this[kOptions] = { ...options, onChange: undefined };
|
|
@@ -92,7 +89,7 @@ class OpraURLPath {
|
|
|
92
89
|
}
|
|
93
90
|
toString() {
|
|
94
91
|
return this[kEntries]
|
|
95
|
-
.map(x =>
|
|
92
|
+
.map(x => encodePathComponent(x.resource, x.key, x.typeCast)).join('/');
|
|
96
93
|
}
|
|
97
94
|
values() {
|
|
98
95
|
let i = -1;
|
|
@@ -112,24 +109,24 @@ class OpraURLPath {
|
|
|
112
109
|
}
|
|
113
110
|
_join(target, source) {
|
|
114
111
|
if (typeof source === 'string') {
|
|
115
|
-
const pathTokenizer =
|
|
112
|
+
const pathTokenizer = tokenize(normalizePath(source, true), {
|
|
116
113
|
delimiters: '/', quotes: true, brackets: true,
|
|
117
114
|
});
|
|
118
115
|
for (const x of pathTokenizer) {
|
|
119
|
-
const p =
|
|
120
|
-
target.push(new
|
|
116
|
+
const p = decodePathComponent(x);
|
|
117
|
+
target.push(new OpraURLPathComponent(p));
|
|
121
118
|
}
|
|
122
119
|
return;
|
|
123
120
|
}
|
|
124
121
|
if (source instanceof OpraURLPath) {
|
|
125
|
-
target.push(...source[kEntries].map(x => new
|
|
122
|
+
target.push(...source[kEntries].map(x => new OpraURLPathComponent(x)));
|
|
126
123
|
return;
|
|
127
124
|
}
|
|
128
125
|
if (typeof source === 'object' && source.path instanceof OpraURLPath) {
|
|
129
126
|
this._join(target, source.path);
|
|
130
127
|
return;
|
|
131
128
|
}
|
|
132
|
-
if (
|
|
129
|
+
if (isURL(source)) {
|
|
133
130
|
this._join(target, source.pathname);
|
|
134
131
|
return;
|
|
135
132
|
}
|
|
@@ -137,7 +134,7 @@ class OpraURLPath {
|
|
|
137
134
|
source.forEach(x => this._join(target, x));
|
|
138
135
|
return;
|
|
139
136
|
}
|
|
140
|
-
target.push(new
|
|
137
|
+
target.push(new OpraURLPathComponent(source));
|
|
141
138
|
}
|
|
142
139
|
/* istanbul ignore next */
|
|
143
140
|
[(_a = kEntries, nodeInspectCustom)]() {
|
|
@@ -150,6 +147,5 @@ class OpraURLPath {
|
|
|
150
147
|
return 'OpraURLPath';
|
|
151
148
|
}
|
|
152
149
|
}
|
|
153
|
-
exports.OpraURLPath = OpraURLPath;
|
|
154
150
|
OpraURLPath.kEntries = kEntries;
|
|
155
151
|
OpraURLPath.kOptions = kOptions;
|
package/esm/url/opra-url.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var _a;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const opra_url_path_js_1 = require("./opra-url-path.js");
|
|
9
|
-
const decode_path_component_js_1 = require("./utils/decode-path-component.js");
|
|
2
|
+
import { splitString, tokenize } from 'fast-tokenizer';
|
|
3
|
+
import { HttpParams } from '../http/index.js';
|
|
4
|
+
import { normalizePath } from '../utils/path-utils.js';
|
|
5
|
+
import { OpraURLPath } from './opra-url-path.js';
|
|
6
|
+
import { decodePathComponent } from './utils/decode-path-component.js';
|
|
10
7
|
const nodeInspectCustom = Symbol.for('nodejs.util.inspect.custom');
|
|
11
8
|
const urlRegEx = /^(?:((?:[A-Z][A-Z+-.]+:)+)\/\/([^/?]+))?(.*)?$/i;
|
|
12
9
|
const schemeRegEx = /^([A-Z][A-Z+-.]+:?)+$/i;
|
|
@@ -15,7 +12,7 @@ const hostnameRegEx = /^([^/:]+)$/;
|
|
|
15
12
|
const kContext = Symbol('kContext');
|
|
16
13
|
const kPath = Symbol('kPath');
|
|
17
14
|
const kParams = Symbol('kParams');
|
|
18
|
-
class OpraURL {
|
|
15
|
+
export class OpraURL {
|
|
19
16
|
constructor(input, base) {
|
|
20
17
|
this[_a] = {
|
|
21
18
|
protocol: '',
|
|
@@ -26,13 +23,13 @@ class OpraURL {
|
|
|
26
23
|
hash: '',
|
|
27
24
|
password: ''
|
|
28
25
|
};
|
|
29
|
-
this[kPath] = new
|
|
26
|
+
this[kPath] = new OpraURLPath('', {
|
|
30
27
|
onChange: () => {
|
|
31
28
|
this[kContext].pathname = undefined;
|
|
32
29
|
this[kContext].address = undefined;
|
|
33
30
|
}
|
|
34
31
|
});
|
|
35
|
-
this[kParams] = new
|
|
32
|
+
this[kParams] = new HttpParams('', {
|
|
36
33
|
onChange: () => {
|
|
37
34
|
this[kContext].search = undefined;
|
|
38
35
|
}
|
|
@@ -207,10 +204,10 @@ class OpraURL {
|
|
|
207
204
|
this.protocol = m[1];
|
|
208
205
|
const isAbsolute = !!m[2];
|
|
209
206
|
if (isAbsolute) {
|
|
210
|
-
let tokens =
|
|
207
|
+
let tokens = splitString(m[2], { delimiters: '@' });
|
|
211
208
|
if (tokens.length > 1) {
|
|
212
209
|
this.host = tokens[1];
|
|
213
|
-
tokens =
|
|
210
|
+
tokens = splitString(tokens[0], { delimiters: ':' });
|
|
214
211
|
this.username = tokens[0] ? decodeURIComponent(tokens[0]) : '';
|
|
215
212
|
this.password = tokens[1] ? decodeURIComponent(tokens[1]) : '';
|
|
216
213
|
}
|
|
@@ -223,10 +220,10 @@ class OpraURL {
|
|
|
223
220
|
this.password = '';
|
|
224
221
|
}
|
|
225
222
|
input = m[3] || '';
|
|
226
|
-
let tokenizer =
|
|
223
|
+
let tokenizer = tokenize(input, { delimiters: '#', quotes: true, brackets: true });
|
|
227
224
|
input = tokenizer.next() || '';
|
|
228
225
|
this.hash = tokenizer.join('#');
|
|
229
|
-
tokenizer =
|
|
226
|
+
tokenizer = tokenize(input, { delimiters: '?', quotes: true, brackets: true });
|
|
230
227
|
this._setPathname(tokenizer.next() || '', isAbsolute);
|
|
231
228
|
this.search = tokenizer.join('&');
|
|
232
229
|
}
|
|
@@ -281,11 +278,11 @@ class OpraURL {
|
|
|
281
278
|
this.path.clear();
|
|
282
279
|
if (!v)
|
|
283
280
|
return;
|
|
284
|
-
const pathTokenizer =
|
|
281
|
+
const pathTokenizer = tokenize(normalizePath(v, true), {
|
|
285
282
|
delimiters: '/', quotes: true, brackets: true,
|
|
286
283
|
});
|
|
287
284
|
if (trimPrefix && this.prefix) {
|
|
288
|
-
const prefixTokenizer =
|
|
285
|
+
const prefixTokenizer = tokenize(normalizePath(this.prefix, true), {
|
|
289
286
|
delimiters: '/', quotes: true, brackets: true,
|
|
290
287
|
});
|
|
291
288
|
for (const a of prefixTokenizer) {
|
|
@@ -295,12 +292,11 @@ class OpraURL {
|
|
|
295
292
|
}
|
|
296
293
|
}
|
|
297
294
|
for (const x of pathTokenizer) {
|
|
298
|
-
const p =
|
|
295
|
+
const p = decodePathComponent(x);
|
|
299
296
|
this.path.join(p);
|
|
300
297
|
}
|
|
301
298
|
}
|
|
302
299
|
}
|
|
303
|
-
exports.OpraURL = OpraURL;
|
|
304
300
|
OpraURL.kContext = kContext;
|
|
305
301
|
OpraURL.kPath = kPath;
|
|
306
302
|
OpraURL.kParams = kParams;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodePathComponent = void 0;
|
|
4
|
-
const fast_tokenizer_1 = require("fast-tokenizer");
|
|
1
|
+
import { splitString } from 'fast-tokenizer';
|
|
5
2
|
const pathComponentRegEx = /^([^/?#:@]+)(?:@([^/?#:]*))?(?:::(.*))?$/;
|
|
6
|
-
function decodePathComponent(input) {
|
|
3
|
+
export function decodePathComponent(input) {
|
|
7
4
|
const m = pathComponentRegEx.exec(input);
|
|
8
5
|
if (!m)
|
|
9
6
|
throw Object.assign(new TypeError('Invalid URL path'), {
|
|
@@ -14,9 +11,9 @@ function decodePathComponent(input) {
|
|
|
14
11
|
let key;
|
|
15
12
|
if (m[2]) {
|
|
16
13
|
const s = decodeURIComponent(m[2] || '');
|
|
17
|
-
const b =
|
|
14
|
+
const b = splitString(s, { delimiters: ';', quotes: true, escape: false });
|
|
18
15
|
for (const k of b) {
|
|
19
|
-
const c =
|
|
16
|
+
const c = splitString(k, { delimiters: '=', quotes: true, escape: false });
|
|
20
17
|
if ((b.length > 1 && c.length < 2) ||
|
|
21
18
|
(key &&
|
|
22
19
|
(c.length >= 2 && typeof key !== 'object') ||
|
|
@@ -38,4 +35,3 @@ function decodePathComponent(input) {
|
|
|
38
35
|
}
|
|
39
36
|
return { resource, key };
|
|
40
37
|
}
|
|
41
|
-
exports.decodePathComponent = decodePathComponent;
|