@opra/common 1.0.0-alpha.30 → 1.0.0-alpha.32
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 +6 -10
- package/cjs/document/api-document.js +2 -3
- package/cjs/document/common/api-base.js +0 -1
- package/cjs/document/common/document-element.js +2 -3
- package/cjs/document/http/http-api.js +0 -1
- package/cjs/document/http/http-operation-response.js +0 -1
- package/cjs/document/http/http-request-body.js +0 -1
- package/esm/document/api-document.js +2 -2
- package/esm/document/common/api-base.js +0 -1
- package/esm/document/common/document-element.js +2 -2
- package/esm/document/http/http-api.js +0 -1
- package/esm/document/http/http-operation-response.js +0 -1
- package/esm/document/http/http-request-body.js +0 -1
- package/package.json +2 -1
- package/types/document/common/api-base.d.ts +1 -1
- package/types/document/http/http-api.d.ts +1 -1
package/browser.js
CHANGED
|
@@ -830,8 +830,8 @@ __name(ComplexTypeDecorator, "ComplexTypeDecorator");
|
|
|
830
830
|
import { asMutable as asMutable4 } from "ts-gems";
|
|
831
831
|
|
|
832
832
|
// ../../build/common/esm/document/common/document-element.js
|
|
833
|
-
import crypto from "node:crypto";
|
|
834
833
|
import { asMutable } from "ts-gems";
|
|
834
|
+
import { uid } from "uid";
|
|
835
835
|
|
|
836
836
|
// ../../build/common/esm/document/common/document-node.js
|
|
837
837
|
var DocumentNode = class {
|
|
@@ -956,7 +956,7 @@ var DocumentElement = /* @__PURE__ */ __name(function(owner) {
|
|
|
956
956
|
if (!this)
|
|
957
957
|
throw new TypeError('"this" should be passed to call class constructor');
|
|
958
958
|
const _this = asMutable(this);
|
|
959
|
-
_this.id =
|
|
959
|
+
_this.id = uid(16);
|
|
960
960
|
Object.defineProperty(_this, "node", {
|
|
961
961
|
value: new DocumentNode(this, owner?.node),
|
|
962
962
|
enumerable: false,
|
|
@@ -2297,7 +2297,6 @@ var ApiBase = class extends DocumentElement {
|
|
|
2297
2297
|
}
|
|
2298
2298
|
constructor(owner) {
|
|
2299
2299
|
super(owner);
|
|
2300
|
-
this.owner = owner;
|
|
2301
2300
|
this.name = "OpraApi";
|
|
2302
2301
|
}
|
|
2303
2302
|
toJSON() {
|
|
@@ -2634,7 +2633,6 @@ var HttpApi = class extends ApiBase {
|
|
|
2634
2633
|
}
|
|
2635
2634
|
constructor(owner) {
|
|
2636
2635
|
super(owner);
|
|
2637
|
-
this.owner = owner;
|
|
2638
2636
|
this._controllerReverseMap = /* @__PURE__ */ new WeakMap();
|
|
2639
2637
|
this.protocol = "http";
|
|
2640
2638
|
this.controllers = new ResponsiveMap();
|
|
@@ -3324,7 +3322,6 @@ var HttpOperationResponse = class extends HttpMediaType {
|
|
|
3324
3322
|
}
|
|
3325
3323
|
constructor(owner, init) {
|
|
3326
3324
|
super(owner, init);
|
|
3327
|
-
this.owner = owner;
|
|
3328
3325
|
this.parameters = [];
|
|
3329
3326
|
this.statusCode = (Array.isArray(init.statusCode) ? init.statusCode : [init.statusCode]).map((x) => typeof x === "object" ? new HttpStatusRange(x.start, x.end) : new HttpStatusRange(x));
|
|
3330
3327
|
this.partial = init.partial;
|
|
@@ -3430,7 +3427,6 @@ var HttpRequestBody = class extends DocumentElement {
|
|
|
3430
3427
|
}
|
|
3431
3428
|
constructor(owner) {
|
|
3432
3429
|
super(owner);
|
|
3433
|
-
this.owner = owner;
|
|
3434
3430
|
this.content = [];
|
|
3435
3431
|
}
|
|
3436
3432
|
toJSON() {
|
|
@@ -3743,7 +3739,7 @@ var HttpApiFactory = class {
|
|
|
3743
3739
|
};
|
|
3744
3740
|
|
|
3745
3741
|
// ../../build/common/esm/document/api-document.js
|
|
3746
|
-
import
|
|
3742
|
+
import { md5 } from "super-fast-md5";
|
|
3747
3743
|
var _a2;
|
|
3748
3744
|
var ApiDocument = class extends DocumentElement {
|
|
3749
3745
|
static {
|
|
@@ -3821,7 +3817,7 @@ var ApiDocument = class extends DocumentElement {
|
|
|
3821
3817
|
invalidate() {
|
|
3822
3818
|
const x = this.export();
|
|
3823
3819
|
delete x.id;
|
|
3824
|
-
this.id =
|
|
3820
|
+
this.id = md5(JSON.stringify(x));
|
|
3825
3821
|
this[kTypeNSMap] = /* @__PURE__ */ new WeakMap();
|
|
3826
3822
|
}
|
|
3827
3823
|
_findDataType(nameOrCtor, visitedRefs) {
|
|
@@ -13317,7 +13313,7 @@ var classes;
|
|
|
13317
13313
|
})(classes || (classes = {}));
|
|
13318
13314
|
|
|
13319
13315
|
// ../../build/common/esm/index.js
|
|
13320
|
-
import { uid } from "uid";
|
|
13316
|
+
import { uid as uid2 } from "uid";
|
|
13321
13317
|
export {
|
|
13322
13318
|
AnyType,
|
|
13323
13319
|
ApiBase,
|
|
@@ -13429,5 +13425,5 @@ export {
|
|
|
13429
13425
|
parseFieldsProjection,
|
|
13430
13426
|
resolveThunk,
|
|
13431
13427
|
translate,
|
|
13432
|
-
uid
|
|
13428
|
+
uid2 as uid
|
|
13433
13429
|
};
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ApiDocument = void 0;
|
|
5
|
-
const
|
|
6
|
-
const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
|
|
5
|
+
const super_fast_md5_1 = require("super-fast-md5");
|
|
7
6
|
const index_js_1 = require("../helpers/index.js");
|
|
8
7
|
const index_js_2 = require("../schema/index.js");
|
|
9
8
|
const data_type_map_js_1 = require("./common/data-type-map.js");
|
|
@@ -88,7 +87,7 @@ class ApiDocument extends document_element_js_1.DocumentElement {
|
|
|
88
87
|
/** Generate id */
|
|
89
88
|
const x = this.export();
|
|
90
89
|
delete x.id;
|
|
91
|
-
this.id =
|
|
90
|
+
this.id = (0, super_fast_md5_1.md5)(JSON.stringify(x));
|
|
92
91
|
/** Clear [kTypeNSMap] */
|
|
93
92
|
this[constants_js_1.kTypeNSMap] = new WeakMap();
|
|
94
93
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DocumentElement = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
|
|
6
4
|
const ts_gems_1 = require("ts-gems");
|
|
5
|
+
const uid_1 = require("uid");
|
|
7
6
|
const document_node_js_1 = require("./document-node.js");
|
|
8
7
|
/**
|
|
9
8
|
*
|
|
@@ -13,7 +12,7 @@ exports.DocumentElement = function (owner) {
|
|
|
13
12
|
if (!this)
|
|
14
13
|
throw new TypeError('"this" should be passed to call class constructor');
|
|
15
14
|
const _this = (0, ts_gems_1.asMutable)(this);
|
|
16
|
-
_this.id =
|
|
15
|
+
_this.id = (0, uid_1.uid)(16);
|
|
17
16
|
Object.defineProperty(_this, 'node', {
|
|
18
17
|
value: new document_node_js_1.DocumentNode(this, owner?.node),
|
|
19
18
|
enumerable: false,
|
|
@@ -10,7 +10,6 @@ const http_controller_js_1 = require("./http-controller.js");
|
|
|
10
10
|
class HttpApi extends api_base_js_1.ApiBase {
|
|
11
11
|
constructor(owner) {
|
|
12
12
|
super(owner);
|
|
13
|
-
this.owner = owner;
|
|
14
13
|
// noinspection JSUnusedGlobalSymbols
|
|
15
14
|
this._controllerReverseMap = new WeakMap();
|
|
16
15
|
this.protocol = 'http';
|
|
@@ -10,7 +10,6 @@ const http_status_range_js_1 = require("./http-status-range.js");
|
|
|
10
10
|
class HttpOperationResponse extends http_media_type_js_1.HttpMediaType {
|
|
11
11
|
constructor(owner, init) {
|
|
12
12
|
super(owner, init);
|
|
13
|
-
this.owner = owner;
|
|
14
13
|
this.parameters = [];
|
|
15
14
|
this.statusCode = (Array.isArray(init.statusCode) ? init.statusCode : [init.statusCode]).map(x => typeof x === 'object' ? new http_status_range_js_1.HttpStatusRange(x.start, x.end) : new http_status_range_js_1.HttpStatusRange(x));
|
|
16
15
|
this.partial = init.partial;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import
|
|
2
|
+
import { md5 } from 'super-fast-md5';
|
|
3
3
|
import { cloneObject, omitUndefined, ResponsiveMap } from '../helpers/index.js';
|
|
4
4
|
import { OpraSchema } from '../schema/index.js';
|
|
5
5
|
import { DataTypeMap } from './common/data-type-map.js';
|
|
@@ -84,7 +84,7 @@ export class ApiDocument extends DocumentElement {
|
|
|
84
84
|
/** Generate id */
|
|
85
85
|
const x = this.export();
|
|
86
86
|
delete x.id;
|
|
87
|
-
this.id =
|
|
87
|
+
this.id = md5(JSON.stringify(x));
|
|
88
88
|
/** Clear [kTypeNSMap] */
|
|
89
89
|
this[kTypeNSMap] = new WeakMap();
|
|
90
90
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import crypto from 'node:crypto';
|
|
2
1
|
import { asMutable } from 'ts-gems';
|
|
2
|
+
import { uid } from 'uid';
|
|
3
3
|
import { DocumentNode } from './document-node.js';
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
@@ -9,7 +9,7 @@ export const DocumentElement = function (owner) {
|
|
|
9
9
|
if (!this)
|
|
10
10
|
throw new TypeError('"this" should be passed to call class constructor');
|
|
11
11
|
const _this = asMutable(this);
|
|
12
|
-
_this.id =
|
|
12
|
+
_this.id = uid(16);
|
|
13
13
|
Object.defineProperty(_this, 'node', {
|
|
14
14
|
value: new DocumentNode(this, owner?.node),
|
|
15
15
|
enumerable: false,
|
|
@@ -7,7 +7,6 @@ import { HttpController } from './http-controller.js';
|
|
|
7
7
|
export class HttpApi extends ApiBase {
|
|
8
8
|
constructor(owner) {
|
|
9
9
|
super(owner);
|
|
10
|
-
this.owner = owner;
|
|
11
10
|
// noinspection JSUnusedGlobalSymbols
|
|
12
11
|
this._controllerReverseMap = new WeakMap();
|
|
13
12
|
this.protocol = 'http';
|
|
@@ -7,7 +7,6 @@ import { HttpStatusRange } from './http-status-range.js';
|
|
|
7
7
|
export class HttpOperationResponse extends HttpMediaType {
|
|
8
8
|
constructor(owner, init) {
|
|
9
9
|
super(owner, init);
|
|
10
|
-
this.owner = owner;
|
|
11
10
|
this.parameters = [];
|
|
12
11
|
this.statusCode = (Array.isArray(init.statusCode) ? init.statusCode : [init.statusCode]).map(x => typeof x === 'object' ? new HttpStatusRange(x.start, x.end) : new HttpStatusRange(x));
|
|
13
12
|
this.partial = init.partial;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/common",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.32",
|
|
4
4
|
"description": "Opra common package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"putil-promisify": "^1.10.1",
|
|
49
49
|
"putil-varhelpers": "^1.6.5",
|
|
50
50
|
"reflect-metadata": "^0.2.2",
|
|
51
|
+
"super-fast-md5": "^1.0.3",
|
|
51
52
|
"tslib": "^2.6.3",
|
|
52
53
|
"uid": "^2.0.1",
|
|
53
54
|
"valgen": "^5.6.0"
|
|
@@ -7,8 +7,8 @@ export declare namespace ApiBase {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
export declare abstract class ApiBase extends DocumentElement {
|
|
10
|
-
readonly owner: ApiDocument | ApiBase;
|
|
11
10
|
abstract readonly protocol: OpraSchema.Protocol;
|
|
11
|
+
readonly owner: ApiDocument | ApiBase;
|
|
12
12
|
name: string;
|
|
13
13
|
description?: string;
|
|
14
14
|
protected constructor(owner: ApiDocument | ApiBase);
|
|
@@ -9,8 +9,8 @@ import type { HttpOperation } from './http-operation.js';
|
|
|
9
9
|
* @class HttpApi
|
|
10
10
|
*/
|
|
11
11
|
export declare class HttpApi extends ApiBase {
|
|
12
|
-
readonly owner: ApiDocument;
|
|
13
12
|
protected _controllerReverseMap: WeakMap<Type, HttpController | null>;
|
|
13
|
+
readonly owner: ApiDocument;
|
|
14
14
|
readonly protocol = "http";
|
|
15
15
|
controllers: ResponsiveMap<HttpController>;
|
|
16
16
|
url?: string;
|