@opra/client 0.16.2 → 0.17.1

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.
@@ -1,5 +1,3 @@
1
- 'use strict';
2
-
3
1
  var require$$0 = {
4
2
  "application/1d-interleaved-parityfec": {
5
3
  source: "iana"
@@ -10710,18 +10708,10 @@ var require$$0 = {
10710
10708
  * MIT Licensed
10711
10709
  */
10712
10710
 
10713
- var mimeDb;
10714
- var hasRequiredMimeDb;
10715
-
10716
- function requireMimeDb () {
10717
- if (hasRequiredMimeDb) return mimeDb;
10718
- hasRequiredMimeDb = 1;
10719
- /**
10720
- * Module exports.
10721
- */
10711
+ /**
10712
+ * Module exports.
10713
+ */
10722
10714
 
10723
- mimeDb = require$$0;
10724
- return mimeDb;
10725
- }
10715
+ var mimeDb = require$$0;
10726
10716
 
10727
- exports.requireMimeDb = requireMimeDb;
10717
+ export { mimeDb as m };
@@ -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.16.2",
3
+ "version": "0.17.1",
4
4
  "description": "Opra Client package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -30,10 +30,16 @@ export interface ComplexType extends StrictOmit<DataType, 'own' | 'exportSchema'
30
30
  readonly ctor: Type;
31
31
  readonly base?: ComplexType | UnionType;
32
32
  readonly own: ComplexType.OwnProperties;
33
+ readonly abstract?: boolean;
34
+ readonly additionalFields?: boolean;
33
35
  exportSchema(): OpraSchema.ComplexType;
34
36
  addField(init: ApiField.InitArguments): ApiField;
35
- getField(name: string): ApiField;
36
- normalizeFieldNames(fields: string | string[]): string[] | undefined;
37
+ iteratePath(path: string, silent?: boolean): IterableIterator<[string, ApiField | undefined, string]>;
38
+ getField(nameOrPath: string): ApiField;
39
+ findField(nameOrPath: string): ApiField | undefined;
40
+ normalizeFieldPath(fields: string): string;
41
+ normalizeFieldPath(fields: string[]): string[];
42
+ normalizeFieldPath(fields: string | string[]): string | string[];
37
43
  }
38
44
  /**
39
45
  * Type definition of ComplexType constructor type
@@ -44,9 +44,11 @@ export interface Collection extends StrictOmit<Resource, 'exportSchema' | '_cons
44
44
  readonly primaryKey: string[];
45
45
  exportSchema(): OpraSchema.Collection;
46
46
  parseKeyValue(value: any): any;
47
- normalizeFieldNames(fields: string[]): string[] | undefined;
48
- normalizeSortFields(fields: string[]): string[] | undefined;
49
- normalizeFilterFields(ast: Expression): Expression;
47
+ normalizeFieldPath(fields: string): string;
48
+ normalizeFieldPath(fields: string[]): string[];
49
+ normalizeFieldPath(fields: string | string[]): string | string[];
50
+ normalizeSortFields(fields: string | string[]): string[];
51
+ normalizeFilter(ast: Expression): Expression;
50
52
  _construct(init: Collection.InitArguments): void;
51
53
  }
52
54
  export interface CollectionConstructor {
@@ -34,7 +34,9 @@ export interface Singleton extends StrictOmit<Resource, 'exportSchema' | '_const
34
34
  readonly operations: Singleton.Operations;
35
35
  readonly controller?: object | Type;
36
36
  exportSchema(): OpraSchema.Singleton;
37
- normalizeFieldNames(fields: string[]): string[] | undefined;
37
+ normalizeFieldPath(fields: string): string;
38
+ normalizeFieldPath(fields: string[]): string[];
39
+ normalizeFieldPath(fields: string | string[]): string | string[];
38
40
  _construct(init: Singleton.InitArguments): void;
39
41
  }
40
42
  export interface SingletonConstructor {
@@ -1,4 +1,8 @@
1
+ import type { ApiField } from '../../../document/data-type/api-field.js';
2
+ import { DataType } from '../../../document/data-type/data-type.js';
1
3
  import { Literal } from '../abstract/literal.js';
2
4
  export declare class QualifiedIdentifier extends Literal {
5
+ dataType: DataType;
6
+ field?: ApiField;
3
7
  constructor(value: string);
4
8
  }
@@ -7,7 +7,8 @@ import { IntegerCodec } from './codecs/integer-codec.js';
7
7
  import { NumberCodec } from './codecs/number-codec.js';
8
8
  import { StringCodec } from './codecs/string-codec.js';
9
9
  export declare namespace HttpParams {
10
- type Initiator = string | URLSearchParams | HttpParams | Map<string, any> | Record<string, any>;
10
+ type Initiator = string | URLSearchParams | HttpParams | Map<string, HttpParams.Value> | Record<string, HttpParams.Value>;
11
+ type Value = string | number | boolean | object | null;
11
12
  interface Options {
12
13
  onChange?: () => void;
13
14
  params?: Record<string, ParamDefinition>;
@@ -16,8 +17,8 @@ export declare namespace HttpParams {
16
17
  codec?: Codec | string;
17
18
  };
18
19
  interface Codec {
19
- decode(value: string): any;
20
- encode(value: any): string;
20
+ decode(value: string): HttpParams.Value;
21
+ encode(value: HttpParams.Value): string;
21
22
  }
22
23
  }
23
24
  interface HttpParamMetadata {
@@ -36,7 +37,7 @@ export declare class HttpParams {
36
37
  protected static kSize: symbol;
37
38
  protected static kParamDefs: symbol;
38
39
  protected static kOptions: symbol;
39
- protected [kEntries]: ResponsiveMap<any[]>;
40
+ protected [kEntries]: ResponsiveMap<HttpParams.Value[]>;
40
41
  protected [kSize]: number;
41
42
  protected [kOptions]: HttpParams.Options;
42
43
  protected [kParamDefs]: Map<string, HttpParamMetadata>;
@@ -46,27 +47,27 @@ export declare class HttpParams {
46
47
  * Appends a new value to the existing set of values for a parameter
47
48
  * and returns this instance
48
49
  */
49
- append(name: string, value?: any): this;
50
+ append(name: string, value?: HttpParams.Value): this;
50
51
  appendAll(input: HttpParams.Initiator): this;
51
52
  changed(): void;
52
53
  clear(): void;
53
54
  /**
54
55
  * Deletes values for a given parameter
55
56
  */
56
- delete(name: string, value?: any): this;
57
+ delete(name: string, value?: HttpParams.Value): this;
57
58
  /**
58
59
  * Returns an iterable of key, value pairs for every entry in the map.
59
60
  */
60
- entries(): IterableIterator<[string, string]>;
61
- forEach(callbackFn: (value: string, key: string, parent: HttpParams) => void, thisArg?: any): void;
61
+ entries(): IterableIterator<[string, HttpParams.Value]>;
62
+ forEach(callbackFn: (value: HttpParams.Value, key: string, parent: HttpParams) => void, thisArg?: any): void;
62
63
  /**
63
64
  * Retrieves value of a given parameter at given index
64
65
  */
65
- get(name: string, index?: number): any;
66
+ get(name: string, index?: number): HttpParams.Value;
66
67
  /**
67
68
  * Retrieves an array of values for a given parameter.
68
69
  */
69
- getAll(name: string): any[] | null;
70
+ getAll(name: string): HttpParams.Value[] | null;
70
71
  /**
71
72
  * Retrieves the names of the parameters.
72
73
  */
@@ -74,7 +75,7 @@ export declare class HttpParams {
74
75
  /**
75
76
  * Retrieves the names of the parameters.
76
77
  */
77
- values(): IterableIterator<any>;
78
+ values(): IterableIterator<HttpParams.Value>;
78
79
  /**
79
80
  * Checks for existence of a parameter.
80
81
  */
@@ -83,23 +84,23 @@ export declare class HttpParams {
83
84
  * Sets or modifies a value for a given parameter.
84
85
  * If the header already exists, its value is replaced with the given value
85
86
  */
86
- set(name: string, value: any): this;
87
+ set(name: string, value?: HttpParams.Value): this;
87
88
  sort(compareFn?: (a: string, b: string) => number): this;
88
89
  /**
89
90
  * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
90
91
  * separated by `&`s.
91
92
  */
92
93
  toString(): string;
93
- getProxy(): Record<string, any>;
94
+ getProxy(): Record<string, HttpParams.Value>;
94
95
  define(params: Record<string, HttpParams.ParamDefinition>): this;
95
96
  define(name: string, options: HttpParams.ParamDefinition): this;
96
- encodeValue(value: any, key: string): string;
97
- decodeValue(value: string, key: string): any;
98
- protected _append(name: string, value?: any): void;
99
- protected _delete(name: string, value?: string | string[]): boolean;
100
- protected _set(name: string, value: any, index?: number): void;
101
- [Symbol.iterator](): IterableIterator<[string, string]>;
97
+ encodeValue(value: HttpParams.Value, key: string): string;
98
+ decodeValue(value: string, key: string): HttpParams.Value;
99
+ [Symbol.iterator](): IterableIterator<[string, HttpParams.Value]>;
102
100
  get [Symbol.toStringTag](): string;
101
+ protected _append(name: string, value?: HttpParams.Value): void;
102
+ protected _delete(name: string, value?: HttpParams.Value): boolean;
103
+ protected _set(name: string, value?: HttpParams.Value, index?: number): void;
103
104
  static codecs: {
104
105
  boolean: BooleanCodec;
105
106
  date: DateCodec;