@api-client/core 0.6.29 → 0.6.30
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,4 @@
|
|
|
1
1
|
import { Request } from "../Request.js";
|
|
2
|
-
import v4 from "../../lib/uuid.js";
|
|
3
2
|
import { HttpRequest } from "../HttpRequest.js";
|
|
4
3
|
import { Thing } from "../Thing.js";
|
|
5
4
|
export const Kind = 'Arc#ArcRequest';
|
|
@@ -7,6 +6,7 @@ export class ArcHttpRequest extends Request {
|
|
|
7
6
|
kind = Kind;
|
|
8
7
|
/**
|
|
9
8
|
* The identifier of the request.
|
|
9
|
+
* The key is related to the `created` property. It is the `new Date(created).toJSON()` value.
|
|
10
10
|
*/
|
|
11
11
|
key = '';
|
|
12
12
|
/**
|
|
@@ -15,9 +15,10 @@ export class ArcHttpRequest extends Request {
|
|
|
15
15
|
* @param url The Request URL. This is required.
|
|
16
16
|
*/
|
|
17
17
|
static fromUrl(url) {
|
|
18
|
-
const
|
|
18
|
+
const d = new Date();
|
|
19
|
+
const now = d.getTime();
|
|
19
20
|
const request = new ArcHttpRequest({
|
|
20
|
-
key:
|
|
21
|
+
key: d.toJSON(),
|
|
21
22
|
kind: Kind,
|
|
22
23
|
created: now,
|
|
23
24
|
updated: now,
|
|
@@ -32,9 +33,10 @@ export class ArcHttpRequest extends Request {
|
|
|
32
33
|
* @param name The Request name.
|
|
33
34
|
*/
|
|
34
35
|
static fromName(name) {
|
|
35
|
-
const
|
|
36
|
+
const d = new Date();
|
|
37
|
+
const now = d.getTime();
|
|
36
38
|
const request = new ArcHttpRequest({
|
|
37
|
-
key:
|
|
39
|
+
key: d.toJSON(),
|
|
38
40
|
kind: Kind,
|
|
39
41
|
created: now,
|
|
40
42
|
updated: now,
|
|
@@ -49,9 +51,10 @@ export class ArcHttpRequest extends Request {
|
|
|
49
51
|
* @param info The request data.
|
|
50
52
|
*/
|
|
51
53
|
static fromHttpRequest(info) {
|
|
52
|
-
const
|
|
54
|
+
const d = new Date();
|
|
55
|
+
const now = d.getTime();
|
|
53
56
|
const request = new ArcHttpRequest({
|
|
54
|
-
key:
|
|
57
|
+
key: d.toJSON(),
|
|
55
58
|
kind: Kind,
|
|
56
59
|
created: now,
|
|
57
60
|
updated: now,
|
|
@@ -64,11 +67,13 @@ export class ArcHttpRequest extends Request {
|
|
|
64
67
|
* Creates a request for a schema of a Request.
|
|
65
68
|
*/
|
|
66
69
|
static fromRequest(request) {
|
|
67
|
-
const
|
|
70
|
+
const d = new Date(request.created || Date.now());
|
|
71
|
+
const now = d.getTime();
|
|
68
72
|
const init = {
|
|
69
73
|
...request,
|
|
70
|
-
key,
|
|
71
|
-
kind: Kind
|
|
74
|
+
key: d.toJSON(),
|
|
75
|
+
kind: Kind,
|
|
76
|
+
created: now,
|
|
72
77
|
};
|
|
73
78
|
const result = new ArcHttpRequest(init);
|
|
74
79
|
return result;
|
|
@@ -83,14 +88,17 @@ export class ArcHttpRequest extends Request {
|
|
|
83
88
|
init = input;
|
|
84
89
|
}
|
|
85
90
|
if (init) {
|
|
86
|
-
this.key = init.key
|
|
91
|
+
this.key = init.key;
|
|
92
|
+
}
|
|
93
|
+
if (!this.key) {
|
|
94
|
+
this.key = new Date(this.created || Date.now()).toJSON();
|
|
87
95
|
}
|
|
88
96
|
this.kind = Kind;
|
|
89
97
|
}
|
|
90
98
|
new(init) {
|
|
91
99
|
super.new(init);
|
|
92
100
|
const { key } = init;
|
|
93
|
-
this.key = key ||
|
|
101
|
+
this.key = key || new Date(init.created || Date.now()).toJSON();
|
|
94
102
|
this.kind = Kind;
|
|
95
103
|
}
|
|
96
104
|
toJSON() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcHttpRequest.js","sourceRoot":"","sources":["../../../../src/models/arc/ArcHttpRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,OAAO,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,
|
|
1
|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
1
|
import { IRequest, Request } from "../Request.js";
|
|
2
|
-
import v4 from "../../lib/uuid.js";
|
|
3
2
|
import { HttpRequest, IHttpRequest } from "../HttpRequest.js";
|
|
4
3
|
import { Thing } from "../Thing.js";
|
|
5
4
|
|
|
@@ -15,6 +14,7 @@ export class ArcHttpRequest extends Request {
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* The identifier of the request.
|
|
17
|
+
* The key is related to the `created` property. It is the `new Date(created).toJSON()` value.
|
|
18
18
|
*/
|
|
19
19
|
key = '';
|
|
20
20
|
|
|
@@ -24,9 +24,10 @@ export class ArcHttpRequest extends Request {
|
|
|
24
24
|
* @param url The Request URL. This is required.
|
|
25
25
|
*/
|
|
26
26
|
static fromUrl(url: string): ArcHttpRequest {
|
|
27
|
-
const
|
|
27
|
+
const d = new Date();
|
|
28
|
+
const now: number = d.getTime();
|
|
28
29
|
const request = new ArcHttpRequest({
|
|
29
|
-
key:
|
|
30
|
+
key: d.toJSON(),
|
|
30
31
|
kind: Kind,
|
|
31
32
|
created: now,
|
|
32
33
|
updated: now,
|
|
@@ -42,9 +43,10 @@ export class ArcHttpRequest extends Request {
|
|
|
42
43
|
* @param name The Request name.
|
|
43
44
|
*/
|
|
44
45
|
static fromName(name: string): ArcHttpRequest {
|
|
45
|
-
const
|
|
46
|
+
const d = new Date();
|
|
47
|
+
const now: number = d.getTime();
|
|
46
48
|
const request = new ArcHttpRequest({
|
|
47
|
-
key:
|
|
49
|
+
key: d.toJSON(),
|
|
48
50
|
kind: Kind,
|
|
49
51
|
created: now,
|
|
50
52
|
updated: now,
|
|
@@ -60,9 +62,10 @@ export class ArcHttpRequest extends Request {
|
|
|
60
62
|
* @param info The request data.
|
|
61
63
|
*/
|
|
62
64
|
static fromHttpRequest(info: IHttpRequest): ArcHttpRequest {
|
|
63
|
-
const
|
|
65
|
+
const d = new Date();
|
|
66
|
+
const now: number = d.getTime();
|
|
64
67
|
const request = new ArcHttpRequest({
|
|
65
|
-
key:
|
|
68
|
+
key: d.toJSON(),
|
|
66
69
|
kind: Kind,
|
|
67
70
|
created: now,
|
|
68
71
|
updated: now,
|
|
@@ -76,11 +79,13 @@ export class ArcHttpRequest extends Request {
|
|
|
76
79
|
* Creates a request for a schema of a Request.
|
|
77
80
|
*/
|
|
78
81
|
static fromRequest(request: IArcHttpRequest): ArcHttpRequest {
|
|
79
|
-
const
|
|
82
|
+
const d = new Date(request.created || Date.now());
|
|
83
|
+
const now: number = d.getTime();
|
|
80
84
|
const init: IArcHttpRequest = {
|
|
81
85
|
...request,
|
|
82
|
-
key,
|
|
83
|
-
kind: Kind
|
|
86
|
+
key: d.toJSON(),
|
|
87
|
+
kind: Kind,
|
|
88
|
+
created: now,
|
|
84
89
|
};
|
|
85
90
|
const result = new ArcHttpRequest(init);
|
|
86
91
|
return result;
|
|
@@ -96,7 +101,10 @@ export class ArcHttpRequest extends Request {
|
|
|
96
101
|
init = input;
|
|
97
102
|
}
|
|
98
103
|
if (init) {
|
|
99
|
-
this.key = init.key
|
|
104
|
+
this.key = init.key;
|
|
105
|
+
}
|
|
106
|
+
if (!this.key) {
|
|
107
|
+
this.key = new Date(this.created || Date.now()).toJSON();
|
|
100
108
|
}
|
|
101
109
|
this.kind = Kind;
|
|
102
110
|
}
|
|
@@ -105,7 +113,7 @@ export class ArcHttpRequest extends Request {
|
|
|
105
113
|
super.new(init);
|
|
106
114
|
|
|
107
115
|
const { key } = init;
|
|
108
|
-
this.key = key ||
|
|
116
|
+
this.key = key || new Date(init.created || Date.now()).toJSON();
|
|
109
117
|
this.kind = Kind;
|
|
110
118
|
}
|
|
111
119
|
|