@opra/client 0.13.0 → 0.15.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/content-disposition-d575fee5.js +473 -0
- package/cjs/cookie-signature-3e974173.js +64 -0
- package/cjs/index.min.mjs +7946 -7135
- package/cjs/mime-db-49f150d0.js +10719 -0
- package/cjs/mime-types-6e2bdb57.js +201 -0
- package/cjs/safe-buffer-8acd60c7.js +78 -0
- package/esm/content-disposition-65f281a9.js +470 -0
- package/esm/cookie-signature-bf274b6b.js +62 -0
- package/esm/index.min.mjs +7546 -6703
- package/esm/mime-db-d0f15d8f.js +10717 -0
- package/esm/mime-types-79c091fd.js +199 -0
- package/esm/safe-buffer-63383356.js +76 -0
- package/package.json +9 -3
- package/typings/common/document/api-document.d.ts +102 -0
- package/typings/common/document/constants.d.ts +3 -0
- package/typings/common/document/data-type/api-field.d.ts +41 -0
- package/typings/common/document/data-type/builtin/any.type.d.ts +2 -0
- package/typings/common/document/data-type/builtin/base64.type.d.ts +6 -0
- package/typings/common/document/data-type/builtin/bigint.type.d.ts +6 -0
- package/typings/common/document/data-type/builtin/boolean.type.d.ts +5 -0
- package/typings/common/document/data-type/builtin/date.type.d.ts +4 -0
- package/typings/common/document/data-type/builtin/guid.type.d.ts +7 -0
- package/typings/common/document/data-type/builtin/index.d.ts +10 -0
- package/typings/common/document/data-type/builtin/integer.type.d.ts +6 -0
- package/typings/common/document/data-type/builtin/number.type.d.ts +6 -0
- package/typings/common/document/data-type/builtin/object.type.d.ts +3 -0
- package/typings/common/document/data-type/builtin/string.type.d.ts +5 -0
- package/typings/common/document/data-type/builtin/time.type.d.ts +7 -0
- package/typings/common/document/data-type/builtin/timestamp.type.d.ts +5 -0
- package/typings/common/document/data-type/complex-type.d.ts +50 -0
- package/typings/common/document/data-type/data-type.d.ts +33 -0
- package/typings/common/document/data-type/enum-type.d.ts +32 -0
- package/typings/common/document/data-type/mapped-type.d.ts +53 -0
- package/typings/common/document/data-type/simple-type.d.ts +33 -0
- package/typings/common/document/data-type/union-type.d.ts +42 -0
- package/typings/common/document/factory/add-references.d.ts +4 -0
- package/typings/common/document/factory/create-document.d.ts +12 -0
- package/typings/common/document/factory/factory.d.ts +61 -0
- package/typings/common/document/factory/import-resource-class.d.ts +9 -0
- package/typings/common/document/factory/import-type-class.d.ts +17 -0
- package/typings/common/document/factory/index.d.ts +1 -0
- package/typings/common/document/factory/process-resources.d.ts +7 -0
- package/typings/common/document/factory/process-types.d.ts +6 -0
- package/typings/common/document/index.d.ts +14 -0
- package/typings/common/document/resource/collection.d.ts +67 -0
- package/typings/common/document/resource/resource.d.ts +29 -0
- package/typings/common/document/resource/singleton.d.ts +49 -0
- package/typings/common/exception/resource-errors/resource-not-found.error.d.ts +4 -0
- package/typings/common/helpers/function-utils.d.ts +4 -0
- package/typings/common/helpers/get-stack-filename.d.ts +1 -0
- package/typings/common/helpers/index.d.ts +7 -0
- package/typings/common/helpers/is-url.d.ts +1 -0
- package/typings/common/{schema/utils/clone-object.util.d.ts → helpers/object-utils.d.ts} +1 -0
- package/typings/common/helpers/path-to-object-tree.d.ts +4 -0
- package/typings/common/helpers/responsive-map.d.ts +15 -13
- package/typings/common/{utils → helpers}/type-guards.d.ts +3 -1
- package/typings/common/http/codecs/boolean-codec.d.ts +5 -0
- package/typings/common/http/{param-codec → codecs}/date-codec.d.ts +2 -2
- package/typings/common/http/{param-codec → codecs}/filter-codec.d.ts +2 -2
- package/typings/common/http/codecs/integer-codec.d.ts +11 -0
- package/typings/common/http/codecs/number-codec.d.ts +14 -0
- package/typings/common/http/codecs/string-codec.d.ts +16 -0
- package/typings/common/http/enums/http-headers-codes.enum.d.ts +13 -4
- package/typings/common/http/enums/http-status-messages.d.ts +65 -0
- package/typings/common/http/http-headers.d.ts +50 -34
- package/typings/common/http/http-message.host.d.ts +122 -0
- package/typings/common/http/http-params.d.ts +43 -29
- package/typings/common/http/http-request-message.d.ts +213 -0
- package/typings/common/http/http-response-message.d.ts +318 -0
- package/typings/common/http/index.d.ts +8 -11
- package/typings/common/http/interfaces/cookie-options.interface.d.ts +4 -0
- package/typings/common/http/multipart/batch-multipart.d.ts +0 -31
- package/typings/common/http/multipart/http-request-content.d.ts +0 -8
- package/typings/common/http/multipart/http-response-content.d.ts +0 -7
- package/typings/common/http/multipart/index.d.ts +0 -1
- package/typings/common/index.d.ts +6 -5
- package/typings/common/schema/constants.d.ts +2 -8
- package/typings/common/schema/data-type/complex-type.interface.d.ts +16 -0
- package/typings/common/schema/data-type/data-type.interface.d.ts +14 -0
- package/typings/common/schema/data-type/enum-type.interface.d.ts +15 -0
- package/typings/common/schema/data-type/field.interface.d.ts +21 -0
- package/typings/common/schema/data-type/mapped-type.interface.d.ts +11 -0
- package/typings/common/schema/data-type/simple-type.interface.d.ts +18 -0
- package/typings/common/schema/data-type/union-type.interface.d.ts +10 -0
- package/typings/common/schema/document.interface.d.ts +34 -0
- package/typings/common/schema/index.d.ts +51 -25
- package/typings/common/schema/resource/collection.interface.d.ts +33 -0
- package/typings/common/schema/resource/container.interface.d.ts +9 -0
- package/typings/common/schema/resource/endpoint.interface.d.ts +29 -0
- package/typings/common/schema/resource/resource.interface.d.ts +12 -0
- package/typings/common/schema/resource/singleton.interface.d.ts +22 -0
- package/typings/common/schema/type-guards.d.ts +20 -0
- package/typings/common/{schema/types.d.ts → types.d.ts} +0 -3
- package/typings/common/url/index.d.ts +2 -2
- package/typings/common/url/opra-url.d.ts +8 -27
- package/typings/common/url/utils/decode-path-component.d.ts +5 -0
- package/typings/common/url/utils/encode-path-component.d.ts +1 -0
- package/typings/common/utils/path-utils.d.ts +2 -0
- package/typings/constants.d.ts +1 -0
- package/typings/http/http-client.d.ts +27 -25
- package/typings/http/http-collection-node.d.ts +116 -0
- package/typings/http/http-request-observable.d.ts +28 -0
- package/typings/{common/http → http}/http-request.d.ts +4 -6
- package/typings/{common/http → http}/http-response.d.ts +12 -10
- package/typings/http/http-service-base.d.ts +5 -0
- package/typings/http/http-singleton-node.d.ts +65 -0
- package/typings/http/http-types.d.ts +17 -9
- package/typings/index.d.ts +7 -13
- package/typings/common/constants.d.ts +0 -0
- package/typings/common/http/http-param-codec.d.ts +0 -4
- package/typings/common/http/http-request-node.d.ts +0 -34
- package/typings/common/http/param-codec/boolean-codec.d.ts +0 -5
- package/typings/common/http/param-codec/integer-codec.d.ts +0 -9
- package/typings/common/http/param-codec/number-codec.d.ts +0 -12
- package/typings/common/http/param-codec/string-codec.d.ts +0 -14
- package/typings/common/http/utils/encodeURIParam.d.ts +0 -1
- package/typings/common/http/utils/normalize-headers.d.ts +0 -1
- package/typings/common/schema/decorators/opr-collection-resource.decorator.d.ts +0 -8
- package/typings/common/schema/decorators/opr-complex-type.decorator.d.ts +0 -6
- package/typings/common/schema/decorators/opr-field.decorator.d.ts +0 -3
- package/typings/common/schema/decorators/opr-resolver.decorator.d.ts +0 -8
- package/typings/common/schema/decorators/opr-simple-type.decorator.d.ts +0 -6
- package/typings/common/schema/decorators/opr-singleton-resource.decorator.d.ts +0 -8
- package/typings/common/schema/implementation/data-type/builtin/any.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin/base64-binary.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin/bigint.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin/boolean.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin/date-string.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin/date.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin/guid.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin/integer.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin/number.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin/object.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin/string.type.d.ts +0 -2
- package/typings/common/schema/implementation/data-type/builtin-data-types.d.ts +0 -4
- package/typings/common/schema/implementation/data-type/complex-type.d.ts +0 -29
- package/typings/common/schema/implementation/data-type/data-type.d.ts +0 -17
- package/typings/common/schema/implementation/data-type/simple-type.d.ts +0 -12
- package/typings/common/schema/implementation/data-type/union-type.d.ts +0 -16
- package/typings/common/schema/implementation/document-builder.d.ts +0 -16
- package/typings/common/schema/implementation/opra-document.d.ts +0 -44
- package/typings/common/schema/implementation/query/collection-count-query.d.ts +0 -14
- package/typings/common/schema/implementation/query/collection-create-query.d.ts +0 -18
- package/typings/common/schema/implementation/query/collection-delete-many-query.d.ts +0 -14
- package/typings/common/schema/implementation/query/collection-delete-query.d.ts +0 -10
- package/typings/common/schema/implementation/query/collection-get-query.d.ts +0 -21
- package/typings/common/schema/implementation/query/collection-search-query.d.ts +0 -30
- package/typings/common/schema/implementation/query/collection-update-many-query.d.ts +0 -15
- package/typings/common/schema/implementation/query/collection-update-query.d.ts +0 -19
- package/typings/common/schema/implementation/query/field-get-query.d.ts +0 -30
- package/typings/common/schema/implementation/query/index.d.ts +0 -27
- package/typings/common/schema/implementation/query/singleton-get-query.d.ts +0 -20
- package/typings/common/schema/implementation/resource/collection-resource-info.d.ts +0 -22
- package/typings/common/schema/implementation/resource/container-resource-info.d.ts +0 -13
- package/typings/common/schema/implementation/resource/resource-info.d.ts +0 -17
- package/typings/common/schema/implementation/resource/singleton-resource-info.d.ts +0 -15
- package/typings/common/schema/implementation/schema-builder/extract-resource-metadata.util.d.ts +0 -3
- package/typings/common/schema/implementation/schema-builder/extract-type-metadata.util.d.ts +0 -4
- package/typings/common/schema/interfaces/child-field-query.interface.d.ts +0 -4
- package/typings/common/schema/interfaces/data-type.metadata.d.ts +0 -18
- package/typings/common/schema/interfaces/resource-container.interface.d.ts +0 -8
- package/typings/common/schema/interfaces/resource.metadata.d.ts +0 -18
- package/typings/common/schema/opra-schema.definition.d.ts +0 -178
- package/typings/common/schema/type-helpers/extend-type.helper.d.ts +0 -3
- package/typings/common/schema/type-helpers/mixin-type.helper.d.ts +0 -2
- package/typings/common/schema/utils/class.utils.d.ts +0 -2
- package/typings/common/schema/utils/normalize-field-array.util.d.ts +0 -3
- package/typings/common/schema/utils/path-to-tree.util.d.ts +0 -4
- package/typings/common/url/formats/boolean-format.d.ts +0 -5
- package/typings/common/url/formats/date-format.d.ts +0 -16
- package/typings/common/url/formats/filter-format.d.ts +0 -6
- package/typings/common/url/formats/format.d.ts +0 -4
- package/typings/common/url/formats/integer-format.d.ts +0 -9
- package/typings/common/url/formats/number-format.d.ts +0 -12
- package/typings/common/url/formats/string-format.d.ts +0 -14
- package/typings/common/url/opra-url-search-params.d.ts +0 -5
- package/typings/common/url/utils/path-utils.d.ts +0 -8
- package/typings/common/utils/index.d.ts +0 -3
- package/typings/common/utils/is-url.d.ts +0 -1
- package/typings/common/utils/path-to-tree.d.ts +0 -4
- package/typings/http/http-collection-service.d.ts +0 -76
- package/typings/http/http-request-host.d.ts +0 -18
- package/typings/http/http-singleton-service.d.ts +0 -28
- package/typings/http/requests/collection-create-request.d.ts +0 -7
- package/typings/http/requests/collection-delete-many-request.d.ts +0 -7
- package/typings/http/requests/collection-delete-request.d.ts +0 -7
- package/typings/http/requests/collection-get-request.d.ts +0 -7
- package/typings/http/requests/collection-search-request.d.ts +0 -7
- package/typings/http/requests/collection-update-many-request.d.ts +0 -7
- package/typings/http/requests/collection-update-request.d.ts +0 -7
- package/typings/http/requests/singleton-create-request.d.ts +0 -7
- package/typings/http/requests/singleton-delete-request.d.ts +0 -7
- package/typings/http/requests/singleton-get-request.d.ts +0 -7
- package/typings/interfaces/http-options.interface.d.ts +0 -17
- package/typings/interfaces/http-request-config.interface.d.ts +0 -23
- /package/typings/common/{schema → document}/utils/inspect.util.d.ts +0 -0
- /package/typings/common/{schema → document}/utils/string-compare.util.d.ts +0 -0
- /package/typings/common/{schema/type-helpers/mixin.utils.d.ts → helpers/mixin-utils.d.ts} +0 -0
- /package/typings/http/{requests/batch-request.d.ts → batch-request.d.ts} +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { g as getDefaultExportFromCjs } from './content-disposition-65f281a9.js';
|
|
2
|
+
import { m as mimeDb } from './mime-db-d0f15d8f.js';
|
|
3
|
+
import path from 'path-browserify';
|
|
4
|
+
|
|
5
|
+
var mimeTypes = {};
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
* mime-types
|
|
9
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
10
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
11
|
+
* MIT Licensed
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
(function (exports) {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Module dependencies.
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
var db = mimeDb;
|
|
22
|
+
var extname = path.extname;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Module variables.
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
30
|
+
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Module exports.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
exports.charset = charset;
|
|
38
|
+
exports.charsets = { lookup: charset };
|
|
39
|
+
exports.contentType = contentType;
|
|
40
|
+
exports.extension = extension;
|
|
41
|
+
exports.extensions = Object.create(null);
|
|
42
|
+
exports.lookup = lookup;
|
|
43
|
+
exports.types = Object.create(null);
|
|
44
|
+
|
|
45
|
+
// Populate the extensions/types maps
|
|
46
|
+
populateMaps(exports.extensions, exports.types);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the default charset for a MIME type.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} type
|
|
52
|
+
* @return {boolean|string}
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
function charset (type) {
|
|
56
|
+
if (!type || typeof type !== 'string') {
|
|
57
|
+
return false
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// TODO: use media-typer
|
|
61
|
+
var match = EXTRACT_TYPE_REGEXP.exec(type);
|
|
62
|
+
var mime = match && db[match[1].toLowerCase()];
|
|
63
|
+
|
|
64
|
+
if (mime && mime.charset) {
|
|
65
|
+
return mime.charset
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// default text/* to utf-8
|
|
69
|
+
if (match && TEXT_TYPE_REGEXP.test(match[1])) {
|
|
70
|
+
return 'UTF-8'
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return false
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Create a full Content-Type header given a MIME type or extension.
|
|
78
|
+
*
|
|
79
|
+
* @param {string} str
|
|
80
|
+
* @return {boolean|string}
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
function contentType (str) {
|
|
84
|
+
// TODO: should this even be in this module?
|
|
85
|
+
if (!str || typeof str !== 'string') {
|
|
86
|
+
return false
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var mime = str.indexOf('/') === -1
|
|
90
|
+
? exports.lookup(str)
|
|
91
|
+
: str;
|
|
92
|
+
|
|
93
|
+
if (!mime) {
|
|
94
|
+
return false
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// TODO: use content-type or other module
|
|
98
|
+
if (mime.indexOf('charset') === -1) {
|
|
99
|
+
var charset = exports.charset(mime);
|
|
100
|
+
if (charset) mime += '; charset=' + charset.toLowerCase();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return mime
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get the default extension for a MIME type.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} type
|
|
110
|
+
* @return {boolean|string}
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
function extension (type) {
|
|
114
|
+
if (!type || typeof type !== 'string') {
|
|
115
|
+
return false
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// TODO: use media-typer
|
|
119
|
+
var match = EXTRACT_TYPE_REGEXP.exec(type);
|
|
120
|
+
|
|
121
|
+
// get extensions
|
|
122
|
+
var exts = match && exports.extensions[match[1].toLowerCase()];
|
|
123
|
+
|
|
124
|
+
if (!exts || !exts.length) {
|
|
125
|
+
return false
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return exts[0]
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Lookup the MIME type for a file path/extension.
|
|
133
|
+
*
|
|
134
|
+
* @param {string} path
|
|
135
|
+
* @return {boolean|string}
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
function lookup (path) {
|
|
139
|
+
if (!path || typeof path !== 'string') {
|
|
140
|
+
return false
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// get the extension ("ext" or ".ext" or full path)
|
|
144
|
+
var extension = extname('x.' + path)
|
|
145
|
+
.toLowerCase()
|
|
146
|
+
.substr(1);
|
|
147
|
+
|
|
148
|
+
if (!extension) {
|
|
149
|
+
return false
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return exports.types[extension] || false
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Populate the extensions and types maps.
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
function populateMaps (extensions, types) {
|
|
161
|
+
// source preference (least -> most)
|
|
162
|
+
var preference = ['nginx', 'apache', undefined, 'iana'];
|
|
163
|
+
|
|
164
|
+
Object.keys(db).forEach(function forEachMimeType (type) {
|
|
165
|
+
var mime = db[type];
|
|
166
|
+
var exts = mime.extensions;
|
|
167
|
+
|
|
168
|
+
if (!exts || !exts.length) {
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// mime -> extensions
|
|
173
|
+
extensions[type] = exts;
|
|
174
|
+
|
|
175
|
+
// extension -> mime
|
|
176
|
+
for (var i = 0; i < exts.length; i++) {
|
|
177
|
+
var extension = exts[i];
|
|
178
|
+
|
|
179
|
+
if (types[extension]) {
|
|
180
|
+
var from = preference.indexOf(db[types[extension]].source);
|
|
181
|
+
var to = preference.indexOf(mime.source);
|
|
182
|
+
|
|
183
|
+
if (types[extension] !== 'application/octet-stream' &&
|
|
184
|
+
(from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) {
|
|
185
|
+
// skip the remapping
|
|
186
|
+
continue
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// set the extension -> mime
|
|
191
|
+
types[extension] = type;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
} (mimeTypes));
|
|
196
|
+
|
|
197
|
+
var mime = /*@__PURE__*/getDefaultExportFromCjs(mimeTypes);
|
|
198
|
+
|
|
199
|
+
export { mime as m };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import require$$0 from 'buffer';
|
|
2
|
+
|
|
3
|
+
var safeBuffer = {exports: {}};
|
|
4
|
+
|
|
5
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
6
|
+
|
|
7
|
+
(function (module, exports) {
|
|
8
|
+
/* eslint-disable node/no-deprecated-api */
|
|
9
|
+
var buffer = require$$0;
|
|
10
|
+
var Buffer = buffer.Buffer;
|
|
11
|
+
|
|
12
|
+
// alternative to using Object.keys for old browsers
|
|
13
|
+
function copyProps (src, dst) {
|
|
14
|
+
for (var key in src) {
|
|
15
|
+
dst[key] = src[key];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
|
19
|
+
module.exports = buffer;
|
|
20
|
+
} else {
|
|
21
|
+
// Copy properties from require('buffer')
|
|
22
|
+
copyProps(buffer, exports);
|
|
23
|
+
exports.Buffer = SafeBuffer;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
27
|
+
return Buffer(arg, encodingOrOffset, length)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
SafeBuffer.prototype = Object.create(Buffer.prototype);
|
|
31
|
+
|
|
32
|
+
// Copy static methods from Buffer
|
|
33
|
+
copyProps(Buffer, SafeBuffer);
|
|
34
|
+
|
|
35
|
+
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
|
36
|
+
if (typeof arg === 'number') {
|
|
37
|
+
throw new TypeError('Argument must not be a number')
|
|
38
|
+
}
|
|
39
|
+
return Buffer(arg, encodingOrOffset, length)
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
SafeBuffer.alloc = function (size, fill, encoding) {
|
|
43
|
+
if (typeof size !== 'number') {
|
|
44
|
+
throw new TypeError('Argument must be a number')
|
|
45
|
+
}
|
|
46
|
+
var buf = Buffer(size);
|
|
47
|
+
if (fill !== undefined) {
|
|
48
|
+
if (typeof encoding === 'string') {
|
|
49
|
+
buf.fill(fill, encoding);
|
|
50
|
+
} else {
|
|
51
|
+
buf.fill(fill);
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
buf.fill(0);
|
|
55
|
+
}
|
|
56
|
+
return buf
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
SafeBuffer.allocUnsafe = function (size) {
|
|
60
|
+
if (typeof size !== 'number') {
|
|
61
|
+
throw new TypeError('Argument must be a number')
|
|
62
|
+
}
|
|
63
|
+
return Buffer(size)
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
SafeBuffer.allocUnsafeSlow = function (size) {
|
|
67
|
+
if (typeof size !== 'number') {
|
|
68
|
+
throw new TypeError('Argument must be a number')
|
|
69
|
+
}
|
|
70
|
+
return buffer.SlowBuffer(size)
|
|
71
|
+
};
|
|
72
|
+
} (safeBuffer, safeBuffer.exports));
|
|
73
|
+
|
|
74
|
+
var safeBufferExports = safeBuffer.exports;
|
|
75
|
+
|
|
76
|
+
export { safeBufferExports as s };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Opra Client package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,19 +31,25 @@
|
|
|
31
31
|
"@browsery/i18next": "^0.2.0",
|
|
32
32
|
"@browsery/stream": "^0.2.0",
|
|
33
33
|
"@browsery/util": "^0.2.0",
|
|
34
|
+
"accepts": "^1.3.8",
|
|
34
35
|
"buffer": "^6.0.3",
|
|
36
|
+
"crypto-browserify": "^3.12.0",
|
|
37
|
+
"cookie": "^0.5.0",
|
|
38
|
+
"dayjs": "^1.11.7",
|
|
39
|
+
"encodeurl": "^1.0.2",
|
|
35
40
|
"events": "^3.3.0",
|
|
36
|
-
"fast-tokenizer": "^1.2.
|
|
41
|
+
"fast-tokenizer": "^1.2.2",
|
|
37
42
|
"lodash.omit": "^4.5.0",
|
|
38
43
|
"path-browserify": "^1.0.1",
|
|
39
44
|
"process": "^0.11.10",
|
|
40
45
|
"putil-isplainobject": "^1.1.5",
|
|
41
|
-
"putil-merge": "^3.10.
|
|
46
|
+
"putil-merge": "^3.10.3",
|
|
42
47
|
"putil-promisify": "^1.10.0",
|
|
43
48
|
"putil-varhelpers": "^1.6.5",
|
|
44
49
|
"reflect-metadata": "^0.1.13",
|
|
45
50
|
"rxjs": "^7.8.0",
|
|
46
51
|
"ts-lib": "^0.0.5",
|
|
52
|
+
"type-is": "^1.6.18",
|
|
47
53
|
"uid": "^2.0.1"
|
|
48
54
|
},
|
|
49
55
|
"devDependencies": {},
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Type } from 'ts-gems';
|
|
2
|
+
import { ResponsiveMap } from '../helpers/index.js';
|
|
3
|
+
import { OpraSchema } from '../schema/index.js';
|
|
4
|
+
import { ComplexType } from './data-type/complex-type.js';
|
|
5
|
+
import type { DataType } from './data-type/data-type.js';
|
|
6
|
+
import { SimpleType } from './data-type/simple-type.js';
|
|
7
|
+
import type { Collection } from './resource/collection.js';
|
|
8
|
+
import { Resource } from './resource/resource.js';
|
|
9
|
+
import { Singleton } from './resource/singleton.js';
|
|
10
|
+
export declare class ApiDocument {
|
|
11
|
+
protected _typeCache: ResponsiveMap<DataType | null>;
|
|
12
|
+
protected _typesCacheByCtor: Map<object | Type<any>, DataType | null>;
|
|
13
|
+
url?: string;
|
|
14
|
+
info: OpraSchema.DocumentInfo;
|
|
15
|
+
references: ResponsiveMap<ApiDocument>;
|
|
16
|
+
types: ResponsiveMap<DataType>;
|
|
17
|
+
resources: ResponsiveMap<Resource>;
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Returns DataType instance by name or Constructor. Returns undefined if not found
|
|
21
|
+
* @param nameOrCtor
|
|
22
|
+
* @param silent
|
|
23
|
+
*/
|
|
24
|
+
getDataType(nameOrCtor: string | Type | object, silent: true): DataType | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Returns DataType instance by name or Constructor. Throws error if not found
|
|
27
|
+
* @param nameOrCtor
|
|
28
|
+
*/
|
|
29
|
+
getDataType(nameOrCtor: string | Type | object): DataType;
|
|
30
|
+
/**
|
|
31
|
+
* Returns ComplexType instance by name or Constructor.
|
|
32
|
+
* Returns undefined if not found
|
|
33
|
+
* Throws error if data type is not a ComplexType
|
|
34
|
+
* @param nameOrCtor
|
|
35
|
+
* @param silent
|
|
36
|
+
*/
|
|
37
|
+
getComplexType(nameOrCtor: string | Type, silent: true): ComplexType | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Returns ComplexType instance by name or Constructor.
|
|
40
|
+
* Throws error undefined if not found or data type is not a ComplexType
|
|
41
|
+
* @param nameOrCtor
|
|
42
|
+
*/
|
|
43
|
+
getComplexType(nameOrCtor: string | Type): ComplexType;
|
|
44
|
+
/**
|
|
45
|
+
* Returns SimpleType instance by name or Constructor.
|
|
46
|
+
* Returns undefined if not found
|
|
47
|
+
* Throws error if data type is not a SimpleType
|
|
48
|
+
* @param nameOrCtor
|
|
49
|
+
* @param silent
|
|
50
|
+
*/
|
|
51
|
+
getSimpleType(nameOrCtor: string | Type, silent: true): SimpleType | undefined;
|
|
52
|
+
/**
|
|
53
|
+
Returns SimpleType instance by name or Constructor.
|
|
54
|
+
Throws error undefined if not found or data type is not a SimpleType
|
|
55
|
+
* @param nameOrCtor
|
|
56
|
+
*/
|
|
57
|
+
getSimpleType(nameOrCtor: string | Type): SimpleType;
|
|
58
|
+
/**
|
|
59
|
+
* Returns Resource instance by path. Returns undefined if not found
|
|
60
|
+
* @param path
|
|
61
|
+
* @param silent
|
|
62
|
+
*/
|
|
63
|
+
getResource(path: string, silent: boolean): Resource | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Returns Resource instance by path. Throws error if not found
|
|
66
|
+
* @param path
|
|
67
|
+
*/
|
|
68
|
+
getResource(path: string): Resource;
|
|
69
|
+
/**
|
|
70
|
+
* Returns Collection resource instance by path
|
|
71
|
+
* Returns undefined if not found
|
|
72
|
+
* Throws error if resource is not a Collection
|
|
73
|
+
* @param path
|
|
74
|
+
* @param silent
|
|
75
|
+
*/
|
|
76
|
+
getCollection(path: string, silent: true): Collection | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Returns ComplexType instance by name or Constructor.
|
|
79
|
+
* Throws error undefined if not found or data type is not a ComplexType
|
|
80
|
+
* @param path
|
|
81
|
+
*/
|
|
82
|
+
getCollection(path: string): Collection;
|
|
83
|
+
/**
|
|
84
|
+
* Returns Singleton resource instance by path
|
|
85
|
+
* Returns undefined if not found
|
|
86
|
+
* Throws error if resource is not a Collection
|
|
87
|
+
* @param path
|
|
88
|
+
* @param silent
|
|
89
|
+
*/
|
|
90
|
+
getSingleton(path: string, silent: true): Singleton | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Returns ComplexType instance by name or Constructor.
|
|
93
|
+
* Throws error undefined if not found or data type is not a ComplexType
|
|
94
|
+
* @param path
|
|
95
|
+
*/
|
|
96
|
+
getSingleton(path: string): Singleton;
|
|
97
|
+
/**
|
|
98
|
+
* Export as Opra schema definition object
|
|
99
|
+
*/
|
|
100
|
+
exportSchema(): OpraSchema.ApiDocument;
|
|
101
|
+
invalidate(): void;
|
|
102
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { StrictOmit, Type } from 'ts-gems';
|
|
2
|
+
import { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import { TypeThunkAsync } from '../../types.js';
|
|
4
|
+
import type { ComplexType } from './complex-type.js';
|
|
5
|
+
import { DataType } from './data-type.js';
|
|
6
|
+
export declare namespace ApiField {
|
|
7
|
+
interface InitArguments extends StrictOmit<OpraSchema.Field, 'type'> {
|
|
8
|
+
name: string;
|
|
9
|
+
type: DataType;
|
|
10
|
+
origin?: ComplexType;
|
|
11
|
+
}
|
|
12
|
+
interface DecoratorOptions extends Partial<StrictOmit<OpraSchema.Field, 'isArray' | 'type'>> {
|
|
13
|
+
type?: string | OpraSchema.DataType | TypeThunkAsync;
|
|
14
|
+
enum?: OpraSchema.EnumObject | string[];
|
|
15
|
+
}
|
|
16
|
+
interface Metadata extends StrictOmit<OpraSchema.Field, 'type'> {
|
|
17
|
+
type?: string | OpraSchema.DataType | TypeThunkAsync;
|
|
18
|
+
enum?: OpraSchema.EnumObject;
|
|
19
|
+
designType?: Type;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export interface ApiField extends StrictOmit<OpraSchema.Field, 'type'> {
|
|
23
|
+
readonly owner: ComplexType;
|
|
24
|
+
readonly origin?: ComplexType;
|
|
25
|
+
readonly type: DataType;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
exportSchema(): OpraSchema.Field;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Type definition of ComplexType constructor type
|
|
31
|
+
* @type ApiFieldConstructor
|
|
32
|
+
*/
|
|
33
|
+
export interface ApiFieldConstructor {
|
|
34
|
+
new (owner: ComplexType, init: ApiField.InitArguments): ApiField;
|
|
35
|
+
(options?: ApiField.DecoratorOptions): PropertyDecorator;
|
|
36
|
+
prototype: ApiField;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @class ComplexType
|
|
40
|
+
*/
|
|
41
|
+
export declare const ApiField: ApiFieldConstructor;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './any.type.js';
|
|
2
|
+
export * from './base64.type.js';
|
|
3
|
+
export * from './bigint.type.js';
|
|
4
|
+
export * from './boolean.type.js';
|
|
5
|
+
export * from './date.type.js';
|
|
6
|
+
export * from './guid.type.js';
|
|
7
|
+
export * from './integer.type.js';
|
|
8
|
+
export * from './number.type.js';
|
|
9
|
+
export * from './object.type.js';
|
|
10
|
+
export * from './string.type.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { StrictOmit, Type } from 'ts-gems';
|
|
2
|
+
import { ResponsiveMap } from '../../helpers/index.js';
|
|
3
|
+
import { OpraSchema } from '../../schema/index.js';
|
|
4
|
+
import type { ApiDocument } from '../api-document.js';
|
|
5
|
+
import { ApiField } from './api-field.js';
|
|
6
|
+
import { DataType } from './data-type.js';
|
|
7
|
+
import type { UnionType } from './union-type';
|
|
8
|
+
/**
|
|
9
|
+
* @namespace ComplexType
|
|
10
|
+
*/
|
|
11
|
+
export declare namespace ComplexType {
|
|
12
|
+
interface InitArguments extends DataType.InitArguments, Pick<OpraSchema.ComplexType, 'ctor' | 'abstract' | 'additionalFields'> {
|
|
13
|
+
base?: ComplexType | UnionType;
|
|
14
|
+
}
|
|
15
|
+
interface OwnProperties extends DataType.OwnProperties, Readonly<Pick<OpraSchema.ComplexType, 'ctor' | 'abstract' | 'additionalFields'>> {
|
|
16
|
+
readonly fields: ResponsiveMap<ApiField>;
|
|
17
|
+
}
|
|
18
|
+
interface DecoratorOptions extends DataType.DecoratorOptions, Pick<InitArguments, 'ctor' | 'base' | 'additionalFields' | 'abstract'> {
|
|
19
|
+
}
|
|
20
|
+
interface Metadata extends StrictOmit<OpraSchema.ComplexType, 'fields'> {
|
|
21
|
+
name: string;
|
|
22
|
+
fields?: Record<string, ApiField.Metadata>;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Type definition of ComplexType prototype
|
|
27
|
+
* @type ComplexType
|
|
28
|
+
*/
|
|
29
|
+
export interface ComplexType extends StrictOmit<DataType, 'own' | 'exportSchema'>, ComplexType.OwnProperties {
|
|
30
|
+
readonly ctor: Type;
|
|
31
|
+
readonly base?: ComplexType | UnionType;
|
|
32
|
+
readonly own: ComplexType.OwnProperties;
|
|
33
|
+
exportSchema(): OpraSchema.ComplexType;
|
|
34
|
+
addField(init: ApiField.InitArguments): ApiField;
|
|
35
|
+
getField(name: string): ApiField;
|
|
36
|
+
normalizeFieldNames(fields: string | string[]): string[] | undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Type definition of ComplexType constructor type
|
|
40
|
+
* @type ComplexTypeConstructor
|
|
41
|
+
*/
|
|
42
|
+
export interface ComplexTypeConstructor {
|
|
43
|
+
new (document: ApiDocument, init: ComplexType.InitArguments): ComplexType;
|
|
44
|
+
(options?: ComplexType.DecoratorOptions): ClassDecorator;
|
|
45
|
+
prototype: ComplexType;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @class ComplexType
|
|
49
|
+
*/
|
|
50
|
+
export declare const ComplexType: ComplexTypeConstructor;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Type } from 'ts-gems';
|
|
2
|
+
import { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import type { ApiDocument } from '../api-document.js';
|
|
4
|
+
import { nodeInspectCustom } from '../utils/inspect.util.js';
|
|
5
|
+
export declare namespace DataType {
|
|
6
|
+
interface InitArguments extends Partial<Pick<OpraSchema.DataTypeBase, 'description'>> {
|
|
7
|
+
name?: string;
|
|
8
|
+
}
|
|
9
|
+
interface OwnProperties {
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
interface DecoratorOptions extends Pick<InitArguments, 'name' | 'description'> {
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export interface DataType extends DataType.OwnProperties {
|
|
16
|
+
readonly document: ApiDocument;
|
|
17
|
+
readonly kind: OpraSchema.DataType.Kind;
|
|
18
|
+
readonly name?: string;
|
|
19
|
+
readonly own: DataType.OwnProperties;
|
|
20
|
+
readonly isAnonymous: boolean;
|
|
21
|
+
coerce(value: any): any;
|
|
22
|
+
validate(v: any): void;
|
|
23
|
+
extendsFrom(t: string | Type | DataType): boolean;
|
|
24
|
+
exportSchema(): OpraSchema.DataType;
|
|
25
|
+
toString(): string;
|
|
26
|
+
[nodeInspectCustom](): string;
|
|
27
|
+
}
|
|
28
|
+
export interface DataTypeConstructor {
|
|
29
|
+
new (document: ApiDocument, init?: DataType.InitArguments): DataType;
|
|
30
|
+
(...args: any[]): void;
|
|
31
|
+
prototype: DataType;
|
|
32
|
+
}
|
|
33
|
+
export declare const DataType: DataTypeConstructor;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { StrictOmit } from 'ts-gems';
|
|
2
|
+
import { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import type { ApiDocument } from '../api-document.js';
|
|
4
|
+
import { DataType } from './data-type.js';
|
|
5
|
+
export declare namespace EnumType {
|
|
6
|
+
interface InitArguments extends DataType.InitArguments, Pick<OpraSchema.EnumType, 'base' | 'values' | 'meanings'> {
|
|
7
|
+
base?: EnumType;
|
|
8
|
+
}
|
|
9
|
+
interface OwnProperties extends DataType.OwnProperties, Required<Readonly<Pick<OpraSchema.EnumType, 'values' | 'meanings'>>> {
|
|
10
|
+
}
|
|
11
|
+
interface Options<T, Keys extends (string | number | symbol) = T extends readonly any[] ? T[number] : keyof T> extends DataType.DecoratorOptions {
|
|
12
|
+
name?: string;
|
|
13
|
+
base?: OpraSchema.EnumObject;
|
|
14
|
+
meanings?: Record<Keys, string>;
|
|
15
|
+
}
|
|
16
|
+
interface Metadata extends OpraSchema.EnumType {
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export interface EnumType extends StrictOmit<DataType, 'own' | 'exportSchema'>, EnumType.OwnProperties {
|
|
21
|
+
readonly base?: EnumType;
|
|
22
|
+
readonly own: EnumType.OwnProperties;
|
|
23
|
+
exportSchema(): OpraSchema.EnumType;
|
|
24
|
+
}
|
|
25
|
+
export interface EnumTypeConstructor {
|
|
26
|
+
new (document: ApiDocument, init?: EnumType.InitArguments): EnumType;
|
|
27
|
+
<T extends OpraSchema.EnumObject | readonly (string | number)[]>(target: T, options?: EnumType.Options<T>): T;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @class EnumType
|
|
31
|
+
*/
|
|
32
|
+
export declare const EnumType: EnumTypeConstructor;
|