@opra/common 0.21.0 → 0.22.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/browser.js CHANGED
@@ -1413,7 +1413,7 @@ var ApiDocument = class {
1413
1413
  */
1414
1414
  getDataType(arg0, silent) {
1415
1415
  let dataType;
1416
- const name = typeof arg0 === "function" ? arg0.name : arg0;
1416
+ const name = typeof arg0 === "function" ? arg0.name : String(arg0);
1417
1417
  const t = typeof arg0 === "string" ? this._typeCache.get(arg0) : this._typesCacheByCtor.get(arg0);
1418
1418
  if (t)
1419
1419
  return t;
@@ -11001,10 +11001,8 @@ __name(encodeURIParam, "encodeURIParam");
11001
11001
  // ../../build/common/esm/http/enums/http-headers-codes.enum.js
11002
11002
  var HttpHeaderCodes;
11003
11003
  (function(HttpHeaderCodes2) {
11004
- HttpHeaderCodes2["X_Opra_Version"] = "X-OPRA-Version";
11005
- HttpHeaderCodes2["X_Opra_Data_Type"] = "X-OPRA-Data-Type";
11006
- HttpHeaderCodes2["X_Opra_Operation"] = "X-OPRA-Operation";
11007
- HttpHeaderCodes2["X_Opra_Total_Matches"] = "X-OPRA-Total-Matches";
11004
+ HttpHeaderCodes2["X_Opra_Version"] = "X-Opra-Version";
11005
+ HttpHeaderCodes2["X_Total_Count"] = "X-Total-Count";
11008
11006
  HttpHeaderCodes2["WWW_Authenticate"] = "WWW-Authenticate";
11009
11007
  HttpHeaderCodes2["Authorization"] = "Authorization";
11010
11008
  HttpHeaderCodes2["Proxy_Authenticate"] = "Proxy-Authenticate";
@@ -11140,7 +11138,7 @@ var HttpStatusCodes;
11140
11138
  HttpStatusCodes2[HttpStatusCodes2["LOCKED"] = 423] = "LOCKED";
11141
11139
  HttpStatusCodes2[HttpStatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
11142
11140
  HttpStatusCodes2[HttpStatusCodes2["TOO_EARLY"] = 425] = "TOO_EARLY";
11143
- HttpStatusCodes2[HttpStatusCodes2["UPGRADE_REQUIRED"] = 428] = "UPGRADE_REQUIRED";
11141
+ HttpStatusCodes2[HttpStatusCodes2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
11144
11142
  HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
11145
11143
  HttpStatusCodes2[HttpStatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
11146
11144
  HttpStatusCodes2[HttpStatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
@@ -35,7 +35,7 @@ class ApiDocument {
35
35
  */
36
36
  getDataType(arg0, silent) {
37
37
  let dataType;
38
- const name = typeof arg0 === 'function' ? arg0.name : arg0;
38
+ const name = typeof arg0 === 'function' ? arg0.name : String(arg0);
39
39
  // Try to get instance from cache
40
40
  const t = typeof arg0 === 'string'
41
41
  ? this._typeCache.get(arg0)
@@ -7,11 +7,9 @@ exports.HttpHeaderCodes = void 0;
7
7
  */
8
8
  var HttpHeaderCodes;
9
9
  (function (HttpHeaderCodes) {
10
- /* *** Opra Headers *** */
11
- HttpHeaderCodes["X_Opra_Version"] = "X-OPRA-Version";
12
- HttpHeaderCodes["X_Opra_Data_Type"] = "X-OPRA-Data-Type";
13
- HttpHeaderCodes["X_Opra_Operation"] = "X-OPRA-Operation";
14
- HttpHeaderCodes["X_Opra_Total_Matches"] = "X-OPRA-Total-Matches";
10
+ /* *** Opra Custom Headers *** */
11
+ HttpHeaderCodes["X_Opra_Version"] = "X-Opra-Version";
12
+ HttpHeaderCodes["X_Total_Count"] = "X-Total-Count";
15
13
  /* *** Authentication *** */
16
14
  /**
17
15
  * Defines the authentication method that should be used to access a resource.
@@ -228,7 +228,7 @@ var HttpStatusCodes;
228
228
  * to do so after the client upgrades to a different protocol. The server sends an Upgrade
229
229
  * header in a 426 response to indicate the required protocol(s).
230
230
  */
231
- HttpStatusCodes[HttpStatusCodes["UPGRADE_REQUIRED"] = 428] = "UPGRADE_REQUIRED";
231
+ HttpStatusCodes[HttpStatusCodes["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
232
232
  /**
233
233
  * The origin server requires the request to be conditional. This response is intended to prevent
234
234
  * the 'lost update' problem, where a client GETs a resource's state, modifies it and PUTs
package/cjs/i18n/i18n.js CHANGED
@@ -126,9 +126,9 @@ class I18n extends exports.BaseI18n {
126
126
  keys.push(token2);
127
127
  }
128
128
  const k = keys.length > 1 ? '$t(' + keys.join(',') + ')' : keys[0];
129
- s += fallback
129
+ s += (fallback
130
130
  ? this.t(k, fallback, { ...options, ...opts })
131
- : this.t(k, { ...options, ...opts });
131
+ : this.t(k, { ...options, ...opts }));
132
132
  continue;
133
133
  }
134
134
  s += token;
@@ -32,7 +32,7 @@ export class ApiDocument {
32
32
  */
33
33
  getDataType(arg0, silent) {
34
34
  let dataType;
35
- const name = typeof arg0 === 'function' ? arg0.name : arg0;
35
+ const name = typeof arg0 === 'function' ? arg0.name : String(arg0);
36
36
  // Try to get instance from cache
37
37
  const t = typeof arg0 === 'string'
38
38
  ? this._typeCache.get(arg0)
@@ -4,11 +4,9 @@
4
4
  */
5
5
  export var HttpHeaderCodes;
6
6
  (function (HttpHeaderCodes) {
7
- /* *** Opra Headers *** */
8
- HttpHeaderCodes["X_Opra_Version"] = "X-OPRA-Version";
9
- HttpHeaderCodes["X_Opra_Data_Type"] = "X-OPRA-Data-Type";
10
- HttpHeaderCodes["X_Opra_Operation"] = "X-OPRA-Operation";
11
- HttpHeaderCodes["X_Opra_Total_Matches"] = "X-OPRA-Total-Matches";
7
+ /* *** Opra Custom Headers *** */
8
+ HttpHeaderCodes["X_Opra_Version"] = "X-Opra-Version";
9
+ HttpHeaderCodes["X_Total_Count"] = "X-Total-Count";
12
10
  /* *** Authentication *** */
13
11
  /**
14
12
  * Defines the authentication method that should be used to access a resource.
@@ -225,7 +225,7 @@ export var HttpStatusCodes;
225
225
  * to do so after the client upgrades to a different protocol. The server sends an Upgrade
226
226
  * header in a 426 response to indicate the required protocol(s).
227
227
  */
228
- HttpStatusCodes[HttpStatusCodes["UPGRADE_REQUIRED"] = 428] = "UPGRADE_REQUIRED";
228
+ HttpStatusCodes[HttpStatusCodes["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
229
229
  /**
230
230
  * The origin server requires the request to be conditional. This response is intended to prevent
231
231
  * the 'lost update' problem, where a client GETs a resource's state, modifies it and PUTs
package/esm/i18n/i18n.js CHANGED
@@ -122,9 +122,9 @@ export class I18n extends BaseI18n {
122
122
  keys.push(token2);
123
123
  }
124
124
  const k = keys.length > 1 ? '$t(' + keys.join(',') + ')' : keys[0];
125
- s += fallback
125
+ s += (fallback
126
126
  ? this.t(k, fallback, { ...options, ...opts })
127
- : this.t(k, { ...options, ...opts });
127
+ : this.t(k, { ...options, ...opts }));
128
128
  continue;
129
129
  }
130
130
  s += token;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/common",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Opra common package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@ declare class CollectionClass extends Resource {
45
45
  readonly primaryKey: string[];
46
46
  constructor(document: ApiDocument, init: Collection.InitArguments);
47
47
  exportSchema(this: Collection): OpraSchema.Collection;
48
- parseKeyValue(this: Collection, value: any): any | undefined;
48
+ parseKeyValue(this: Collection, value: any): any;
49
49
  normalizeFieldPath(this: Collection, path: string | string[]): string | string[];
50
50
  normalizeSortFields(this: Collection, fields: string | string[]): string | string[];
51
51
  normalizeFilter(filter: string | OpraFilter.Expression): OpraFilter.Expression | undefined;
@@ -9,13 +9,13 @@ export declare class ValidationError extends TypeError {
9
9
  }
10
10
  export declare class FilterParseError extends Error {
11
11
  recognizer: Recognizer<any>;
12
- offendingSymbol: any | undefined;
12
+ offendingSymbol?: any;
13
13
  line: number;
14
14
  column: number;
15
15
  e: RecognitionException | undefined;
16
16
  constructor(message: string, args: {
17
17
  recognizer: Recognizer<any>;
18
- offendingSymbol: any | undefined;
18
+ offendingSymbol?: any;
19
19
  line: number;
20
20
  column: number;
21
21
  e: RecognitionException | undefined;
@@ -2,10 +2,8 @@
2
2
  * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers#controls
3
3
  */
4
4
  export declare enum HttpHeaderCodes {
5
- X_Opra_Version = "X-OPRA-Version",
6
- X_Opra_Data_Type = "X-OPRA-Data-Type",
7
- X_Opra_Operation = "X-OPRA-Operation",
8
- X_Opra_Total_Matches = "X-OPRA-Total-Matches",
5
+ X_Opra_Version = "X-Opra-Version",
6
+ X_Total_Count = "X-Total-Count",
9
7
  /**
10
8
  * Defines the authentication method that should be used to access a resource.
11
9
  */
@@ -219,7 +219,7 @@ export declare enum HttpStatusCodes {
219
219
  * to do so after the client upgrades to a different protocol. The server sends an Upgrade
220
220
  * header in a 426 response to indicate the required protocol(s).
221
221
  */
222
- UPGRADE_REQUIRED = 428,
222
+ UPGRADE_REQUIRED = 426,
223
223
  /**
224
224
  * The origin server requires the request to be conditional. This response is intended to prevent
225
225
  * the 'lost update' problem, where a client GETs a resource's state, modifies it and PUTs
@@ -5,7 +5,7 @@ export interface Endpoint {
5
5
  handler?: Endpoint.MethodHandler;
6
6
  }
7
7
  export declare namespace Endpoint {
8
- type MethodHandler = (...args: any[]) => any | Promise<any>;
8
+ type MethodHandler = (...args: any[]) => any;
9
9
  }
10
10
  export declare namespace _Operation {
11
11
  interface Filter {