@api-client/core 0.6.16 → 0.6.19
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/build/src/amf/ApiSchemaGenerator.d.ts +5 -5
- package/build/src/amf/ApiSchemaGenerator.js.map +1 -1
- package/build/src/amf/ApiSchemaValues.d.ts +6 -0
- package/build/src/amf/ApiSchemaValues.js +31 -0
- package/build/src/amf/ApiSchemaValues.js.map +1 -1
- package/build/src/amf/Parsing.d.ts +46 -0
- package/build/src/amf/Parsing.js +2 -0
- package/build/src/amf/Parsing.js.map +1 -0
- package/build/src/amf/shape/ShapeBase.d.ts +3 -3
- package/build/src/amf/shape/ShapeBase.js +3 -0
- package/build/src/amf/shape/ShapeBase.js.map +1 -1
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.js +4 -1
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +1 -1
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +1 -1
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -1
- package/build/src/events/EventTypes.d.ts +6 -0
- package/build/src/events/EventTypes.js +2 -0
- package/build/src/events/EventTypes.js.map +1 -1
- package/build/src/events/Events.d.ts +5 -3
- package/build/src/events/Events.js +2 -0
- package/build/src/events/Events.js.map +1 -1
- package/build/src/events/amf/AmfEventTypes.d.ts +6 -0
- package/build/src/events/amf/AmfEventTypes.js +7 -0
- package/build/src/events/amf/AmfEventTypes.js.map +1 -0
- package/build/src/events/amf/AmfEvents.d.ts +34 -0
- package/build/src/events/amf/AmfEvents.js +59 -0
- package/build/src/events/amf/AmfEvents.js.map +1 -0
- package/build/src/events/authorization/AuthorizationEvents.d.ts +8 -8
- package/build/src/events/authorization/AuthorizationEvents.js +8 -8
- package/build/src/events/authorization/AuthorizationEvents.js.map +1 -1
- package/build/src/events/cookies/CookieEvents.d.ts +8 -8
- package/build/src/events/cookies/CookieEvents.js +8 -8
- package/build/src/events/cookies/CookieEvents.js.map +1 -1
- package/build/src/events/encryption/EncryptionEvents.d.ts +4 -4
- package/build/src/events/encryption/EncryptionEvents.js +4 -4
- package/build/src/events/encryption/EncryptionEvents.js.map +1 -1
- package/build/src/events/environment/EnvironmentEvents.d.ts +2 -2
- package/build/src/events/environment/EnvironmentEvents.js +2 -2
- package/build/src/events/environment/EnvironmentEvents.js.map +1 -1
- package/build/src/events/models/ClientCertificateEvents.d.ts +11 -11
- package/build/src/events/models/ClientCertificateEvents.js +11 -11
- package/build/src/events/models/ClientCertificateEvents.js.map +1 -1
- package/build/src/events/process/ProcessEvents.d.ts +6 -6
- package/build/src/events/process/ProcessEvents.js +6 -6
- package/build/src/events/process/ProcessEvents.js.map +1 -1
- package/build/src/events/reporting/ReportingEvents.d.ts +2 -2
- package/build/src/events/reporting/ReportingEvents.js +2 -2
- package/build/src/events/reporting/ReportingEvents.js.map +1 -1
- package/build/src/events/telemetry/TelemetryEvents.d.ts +6 -6
- package/build/src/events/telemetry/TelemetryEvents.js +6 -6
- package/build/src/events/telemetry/TelemetryEvents.js.map +1 -1
- package/build/src/events/transport/TransportEvents.d.ts +3 -3
- package/build/src/events/transport/TransportEvents.js +3 -3
- package/build/src/events/transport/TransportEvents.js.map +1 -1
- package/build/src/models/data/DataAssociation.d.ts +4 -0
- package/build/src/models/data/DataAssociation.js +8 -0
- package/build/src/models/data/DataAssociation.js.map +1 -1
- package/build/src/models/data/DataEntity.d.ts +16 -12
- package/build/src/models/data/DataEntity.js +54 -50
- package/build/src/models/data/DataEntity.js.map +1 -1
- package/build/src/models/data/DataNamespace.d.ts +14 -0
- package/build/src/models/data/DataNamespace.js +50 -0
- package/build/src/models/data/DataNamespace.js.map +1 -1
- package/build/src/runtime/actions/runnable/DeleteCookieRunnable.js +2 -2
- package/build/src/runtime/actions/runnable/DeleteCookieRunnable.js.map +1 -1
- package/build/src/runtime/actions/runnable/SetCookieRunnable.js +1 -1
- package/build/src/runtime/actions/runnable/SetCookieRunnable.js.map +1 -1
- package/build/src/runtime/actions/runnable/SetVariableRunnable.js +1 -1
- package/build/src/runtime/actions/runnable/SetVariableRunnable.js.map +1 -1
- package/build/src/runtime/modules/RequestCookies.js +2 -2
- package/build/src/runtime/modules/RequestCookies.js.map +1 -1
- package/package.json +1 -1
- package/src/amf/ApiSchemaGenerator.ts +5 -5
- package/src/amf/ApiSchemaValues.ts +32 -0
- package/src/amf/Parsing.ts +49 -0
- package/src/amf/shape/ShapeBase.ts +6 -3
- package/src/amf/shape/ShapeJsonSchemaGenerator.ts +4 -1
- package/src/amf/shape/ShapeXmlSchemaGenerator.ts +1 -1
- package/src/events/EventTypes.ts +2 -0
- package/src/events/Events.ts +2 -0
- package/src/events/amf/AmfEventTypes.ts +6 -0
- package/src/events/amf/AmfEvents.ts +63 -0
- package/src/events/authorization/AuthorizationEvents.ts +8 -8
- package/src/events/cookies/CookieEvents.ts +8 -8
- package/src/events/encryption/EncryptionEvents.ts +4 -4
- package/src/events/environment/EnvironmentEvents.ts +2 -2
- package/src/events/models/ClientCertificateEvents.ts +11 -11
- package/src/events/process/ProcessEvents.ts +6 -6
- package/src/events/reporting/ReportingEvents.ts +2 -2
- package/src/events/telemetry/TelemetryEvents.ts +6 -6
- package/src/events/transport/TransportEvents.ts +3 -3
- package/src/models/data/DataAssociation.ts +9 -0
- package/src/models/data/DataEntity.ts +56 -53
- package/src/models/data/DataNamespace.ts +54 -0
- package/src/runtime/actions/runnable/DeleteCookieRunnable.ts +2 -2
- package/src/runtime/actions/runnable/SetCookieRunnable.ts +1 -1
- package/src/runtime/actions/runnable/SetVariableRunnable.ts +1 -1
- package/src/runtime/modules/RequestCookies.ts +2 -2
- package/build/src/models/data/DataAssociationSchema.d.ts +0 -68
- package/build/src/models/data/DataAssociationSchema.js +0 -2
- package/build/src/models/data/DataAssociationSchema.js.map +0 -1
- package/src/models/data/DataAssociationSchema.ts +0 -70
|
@@ -48,7 +48,7 @@ export class CookieEvents {
|
|
|
48
48
|
* @param domain The cookie domain
|
|
49
49
|
* @returns The list of project index objects.
|
|
50
50
|
*/
|
|
51
|
-
static async listDomain(
|
|
51
|
+
static async listDomain(domain: string, target: EventTarget = window): Promise<IHttpCookie[] | undefined> {
|
|
52
52
|
const detail: ICookieDomainListDetail = { domain };
|
|
53
53
|
const e = new ContextEvent<ICookieDomainListDetail, IHttpCookie[]>(CookieEventTypes.listDomain, detail);
|
|
54
54
|
target.dispatchEvent(e);
|
|
@@ -60,7 +60,7 @@ export class CookieEvents {
|
|
|
60
60
|
* @param url The cookie URL
|
|
61
61
|
* @returns The list of project index objects.
|
|
62
62
|
*/
|
|
63
|
-
static async listUrl(
|
|
63
|
+
static async listUrl(url: string, target: EventTarget = window): Promise<IHttpCookie[] | undefined> {
|
|
64
64
|
const detail: ICookieUrlListDetail = { url };
|
|
65
65
|
const e = new ContextEvent<ICookieUrlListDetail, IHttpCookie[]>(CookieEventTypes.listUrl, detail);
|
|
66
66
|
target.dispatchEvent(e);
|
|
@@ -73,7 +73,7 @@ export class CookieEvents {
|
|
|
73
73
|
* @param target The target on which to dispatch the event
|
|
74
74
|
* @param cookies The list of cookies to remove
|
|
75
75
|
*/
|
|
76
|
-
static async delete(
|
|
76
|
+
static async delete(cookies: IHttpCookie[], target: EventTarget = window): Promise<void> {
|
|
77
77
|
const detail: ICookieItemsDetail = { cookies };
|
|
78
78
|
const e = new ContextEvent<ICookieItemsDetail, void>(CookieEventTypes.delete, detail);
|
|
79
79
|
target.dispatchEvent(e);
|
|
@@ -87,7 +87,7 @@ export class CookieEvents {
|
|
|
87
87
|
* @param url The url associated with the cookie. Depending on the session mechanism the URL or the domain and the path is used.
|
|
88
88
|
* @param name The name of the cookie to remove. When not set all cookies are removed for the given URL.
|
|
89
89
|
*/
|
|
90
|
-
static async deleteUrl(
|
|
90
|
+
static async deleteUrl(url: string, name?: string, target: EventTarget = window): Promise<void> {
|
|
91
91
|
const detail: ICookieDeleteUrlDetail = { url, name };
|
|
92
92
|
const e = new ContextEvent<ICookieDeleteUrlDetail, void>(CookieEventTypes.deleteUrl, detail);
|
|
93
93
|
target.dispatchEvent(e);
|
|
@@ -101,7 +101,7 @@ export class CookieEvents {
|
|
|
101
101
|
* @param cookie A cookie to update
|
|
102
102
|
* @returns The change record of the updated cookie.
|
|
103
103
|
*/
|
|
104
|
-
static async update(
|
|
104
|
+
static async update(cookie: IHttpCookie, target: EventTarget = window): Promise<ContextChangeRecord<IHttpCookie> | undefined> {
|
|
105
105
|
const e = new ContextUpdateEvent(CookieEventTypes.update, { item: cookie });
|
|
106
106
|
target.dispatchEvent(e);
|
|
107
107
|
return e.detail.result;
|
|
@@ -114,7 +114,7 @@ export class CookieEvents {
|
|
|
114
114
|
* @param cookies A list of cookies to update
|
|
115
115
|
* @returns The change record of the updated cookie.
|
|
116
116
|
*/
|
|
117
|
-
static async updateBulk(
|
|
117
|
+
static async updateBulk(cookies: IHttpCookie[], target: EventTarget = window): Promise<void> {
|
|
118
118
|
const detail: ICookieItemsDetail = { cookies };
|
|
119
119
|
const e = new ContextEvent<ICookieItemsDetail, void>(CookieEventTypes.updateBulk, detail);
|
|
120
120
|
target.dispatchEvent(e);
|
|
@@ -135,7 +135,7 @@ class StateEvents {
|
|
|
135
135
|
* @param target The target on which to dispatch the event
|
|
136
136
|
* @param cookie The schema of the removed cookie
|
|
137
137
|
*/
|
|
138
|
-
static delete(
|
|
138
|
+
static delete(cookie: IHttpCookie, target: EventTarget = window): void {
|
|
139
139
|
const e = new CustomEvent<ICookieDetail>(CookieEventTypes.State.delete, {
|
|
140
140
|
bubbles: true,
|
|
141
141
|
composed: true,
|
|
@@ -150,7 +150,7 @@ class StateEvents {
|
|
|
150
150
|
* @param target The target on which to dispatch the event
|
|
151
151
|
* @param record The change record.
|
|
152
152
|
*/
|
|
153
|
-
static update(target: EventTarget
|
|
153
|
+
static update(record: ContextChangeRecord<IHttpCookie>, target: EventTarget = window): void {
|
|
154
154
|
const e = new ContextStateUpdateEvent<IHttpCookie>(CookieEventTypes.State.update, record);
|
|
155
155
|
target.dispatchEvent(e);
|
|
156
156
|
}
|
|
@@ -20,13 +20,13 @@ export class EncryptionEvents {
|
|
|
20
20
|
/**
|
|
21
21
|
* Dispatches an event handled by the encryption module to encrypt the data
|
|
22
22
|
*
|
|
23
|
-
* @param target A node on which to dispatch the event.
|
|
24
23
|
* @param data The data to encrypt
|
|
25
24
|
* @param passphrase The passphrase to use in 2-way data encryption
|
|
26
25
|
* @param method Encryption method to use
|
|
26
|
+
* @param target A node on which to dispatch the event.
|
|
27
27
|
* @returns Promise resolved to the encryption result
|
|
28
28
|
*/
|
|
29
|
-
static async encrypt(
|
|
29
|
+
static async encrypt(data: any, passphrase: string, method: string, target: EventTarget = window): Promise<string | undefined> {
|
|
30
30
|
const config: IEncryptionEventDetail = { data, passphrase, method };
|
|
31
31
|
const e = new ContextEvent<IEncryptionEventDetail, string>(EncryptionEventTypes.encrypt, config);
|
|
32
32
|
target.dispatchEvent(e);
|
|
@@ -36,13 +36,13 @@ export class EncryptionEvents {
|
|
|
36
36
|
/**
|
|
37
37
|
* Dispatches an event handled by the encryption module to decrypt the data
|
|
38
38
|
*
|
|
39
|
-
* @param target A node on which to dispatch the event.
|
|
40
39
|
* @param data The data to decrypt
|
|
41
40
|
* @param passphrase The passphrase to use to decrypt the data
|
|
42
41
|
* @param method Method used to encrypt the data
|
|
42
|
+
* @param target A node on which to dispatch the event.
|
|
43
43
|
* @returns Promise resolved to the decrypted result
|
|
44
44
|
*/
|
|
45
|
-
static async decrypt(
|
|
45
|
+
static async decrypt(data: any, passphrase: string, method: string, target: EventTarget = window): Promise<string | undefined> {
|
|
46
46
|
const config: IEncryptionEventDetail = { data, passphrase, method };
|
|
47
47
|
const e = new ContextEvent<IEncryptionEventDetail, string>(EncryptionEventTypes.decrypt, config);
|
|
48
48
|
target.dispatchEvent(e);
|
|
@@ -10,12 +10,12 @@ export class EnvironmentEvents {
|
|
|
10
10
|
/**
|
|
11
11
|
* An event dispatched to set a variable in the current environment.
|
|
12
12
|
*
|
|
13
|
-
* @param target A node on which to dispatch the event.
|
|
14
13
|
* @param name Variable name
|
|
15
14
|
* @param value Variable value
|
|
15
|
+
* @param target A node on which to dispatch the event.
|
|
16
16
|
* @returns Nothing. The promise resolves when the variable is set.
|
|
17
17
|
*/
|
|
18
|
-
static async set(
|
|
18
|
+
static async set(name: string, value: string, target: EventTarget = window): Promise<void> {
|
|
19
19
|
const detail: ISetVariableDetail = { name, value };
|
|
20
20
|
const e = new ContextEvent<ISetVariableDetail, void>(EnvironmentEventTypes.set, detail);
|
|
21
21
|
target.dispatchEvent(e);
|
|
@@ -6,11 +6,11 @@ export class ClientCertificateEvents {
|
|
|
6
6
|
/**
|
|
7
7
|
* Dispatches an event handled by the data store to read the client certificate.
|
|
8
8
|
*
|
|
9
|
-
* @param target A node on which to dispatch the event.
|
|
10
9
|
* @param id The id of the client certificate
|
|
10
|
+
* @param target A node on which to dispatch the event.
|
|
11
11
|
* @returns Promise resolved to a client certificate model.
|
|
12
12
|
*/
|
|
13
|
-
static async read(
|
|
13
|
+
static async read(id: string, target: EventTarget = window): Promise<HttpCertificate | undefined> {
|
|
14
14
|
const e = new ContextReadEvent<HttpCertificate>(ModelEventTypes.ClientCertificate.read, id);
|
|
15
15
|
target.dispatchEvent(e);
|
|
16
16
|
return e.detail.result;
|
|
@@ -19,11 +19,11 @@ export class ClientCertificateEvents {
|
|
|
19
19
|
/**
|
|
20
20
|
* Dispatches an event to list the client certificates data.
|
|
21
21
|
*
|
|
22
|
-
* @param target A node on which to dispatch the event.
|
|
23
22
|
* @param opts Query options.
|
|
23
|
+
* @param target A node on which to dispatch the event.
|
|
24
24
|
* @returns The list result.
|
|
25
25
|
*/
|
|
26
|
-
static async list(target: EventTarget
|
|
26
|
+
static async list(opts?: ContextListOptions, target: EventTarget = window): Promise<ContextListResult<HttpCertificate> | undefined> {
|
|
27
27
|
const e = new ContextListEvent<HttpCertificate>(ModelEventTypes.ClientCertificate.list, opts);
|
|
28
28
|
target.dispatchEvent(e);
|
|
29
29
|
return e.detail.result;
|
|
@@ -32,11 +32,11 @@ export class ClientCertificateEvents {
|
|
|
32
32
|
/**
|
|
33
33
|
* Dispatches an event handled by the data store to delete a client certificate
|
|
34
34
|
*
|
|
35
|
-
* @param target A node on which to dispatch the event.
|
|
36
35
|
* @param id The id of the project to delete.
|
|
36
|
+
* @param target A node on which to dispatch the event.
|
|
37
37
|
* @returns Promise resolved to a new revision after delete.
|
|
38
38
|
*/
|
|
39
|
-
static async delete(
|
|
39
|
+
static async delete(id: string, target: EventTarget = window): Promise<ContextDeleteRecord | undefined> {
|
|
40
40
|
const e = new ContextDeleteEvent(ModelEventTypes.ClientCertificate.delete, id, undefined);
|
|
41
41
|
target.dispatchEvent(e);
|
|
42
42
|
return e.detail.result;
|
|
@@ -45,11 +45,11 @@ export class ClientCertificateEvents {
|
|
|
45
45
|
/**
|
|
46
46
|
* Dispatches an event handled by the data store to insert a new client certificate.
|
|
47
47
|
*
|
|
48
|
-
* @param target A node on which to dispatch the event.
|
|
49
48
|
* @param item The certificate object.
|
|
49
|
+
* @param target A node on which to dispatch the event.
|
|
50
50
|
* @returns Promise resolved to the change record
|
|
51
51
|
*/
|
|
52
|
-
static async insert(
|
|
52
|
+
static async insert(item: ICertificateCreateOptions, target: EventTarget = window): Promise<ContextChangeRecord<HttpCertificate> | undefined> {
|
|
53
53
|
const e = new ContextUpdateEvent<ICertificateCreateOptions, HttpCertificate>(ModelEventTypes.ClientCertificate.insert, { item, });
|
|
54
54
|
target.dispatchEvent(e);
|
|
55
55
|
return e.detail.result;
|
|
@@ -67,7 +67,7 @@ class StateEvents {
|
|
|
67
67
|
* @param target A node on which to dispatch the event.
|
|
68
68
|
* @param record Change record
|
|
69
69
|
*/
|
|
70
|
-
static update(target: EventTarget
|
|
70
|
+
static update(record: ContextChangeRecord<HttpCertificate>, target: EventTarget = window): void {
|
|
71
71
|
const e = new ContextStateUpdateEvent<HttpCertificate>(ModelEventTypes.ClientCertificate.State.update, record);
|
|
72
72
|
target.dispatchEvent(e);
|
|
73
73
|
}
|
|
@@ -75,10 +75,10 @@ class StateEvents {
|
|
|
75
75
|
/**
|
|
76
76
|
* Dispatches an event after a client certificate was deleted
|
|
77
77
|
*
|
|
78
|
-
* @param target A node on which to dispatch the event.
|
|
79
78
|
* @param record The context store delete record
|
|
79
|
+
* @param target A node on which to dispatch the event.
|
|
80
80
|
*/
|
|
81
|
-
static delete(
|
|
81
|
+
static delete(record: ContextDeleteRecord, target: EventTarget = window): void {
|
|
82
82
|
const e = new ContextStateDeleteEvent(ModelEventTypes.ClientCertificate.State.delete, record);
|
|
83
83
|
target.dispatchEvent(e);
|
|
84
84
|
}
|
|
@@ -21,11 +21,11 @@ export class ProcessEvents {
|
|
|
21
21
|
* in the background. The side effect of the event is the UI showing a process
|
|
22
22
|
* indicator.
|
|
23
23
|
*
|
|
24
|
-
* @param target A node on which to dispatch the event.
|
|
25
24
|
* @param pid The id of the process. The same id has to be passed to the stop event.
|
|
26
25
|
* @param message Optional message rendered in the UI.
|
|
26
|
+
* @param target A node on which to dispatch the event.
|
|
27
27
|
*/
|
|
28
|
-
static loadingStart(
|
|
28
|
+
static loadingStart(pid: string, message: string, target: EventTarget = window): void {
|
|
29
29
|
const detail: IProcessStartDetail = { pid, message };
|
|
30
30
|
const e = new CustomEvent(ProcessEventTypes.loadingStart, {
|
|
31
31
|
cancelable: true,
|
|
@@ -40,10 +40,10 @@ export class ProcessEvents {
|
|
|
40
40
|
* An event to be dispatched when the application has finished a long running process
|
|
41
41
|
* in the background.
|
|
42
42
|
*
|
|
43
|
-
* @param target A node on which to dispatch the event.
|
|
44
43
|
* @param pid The id of the process. The same id has to be passed to the stop event.
|
|
44
|
+
* @param target A node on which to dispatch the event.
|
|
45
45
|
*/
|
|
46
|
-
static loadingStop(
|
|
46
|
+
static loadingStop(pid: string, target: EventTarget = window): void {
|
|
47
47
|
const detail: IProcessStopDetail = { pid };
|
|
48
48
|
const e = new CustomEvent(ProcessEventTypes.loadingStop, {
|
|
49
49
|
cancelable: true,
|
|
@@ -58,12 +58,12 @@ export class ProcessEvents {
|
|
|
58
58
|
* An event to be dispatched when the application has finished a long running process
|
|
59
59
|
* in the background with an error.
|
|
60
60
|
*
|
|
61
|
-
* @param target A node on which to dispatch the event.
|
|
62
61
|
* @param pid The id of the process used to start it.
|
|
63
62
|
* @param message The message to be rendered to the user.
|
|
64
63
|
* @param error The error object caused the event. Optional.
|
|
64
|
+
* @param target A node on which to dispatch the event.
|
|
65
65
|
*/
|
|
66
|
-
static loadingError(
|
|
66
|
+
static loadingError(pid: string, message: string, error?: Error, target: EventTarget = window): void {
|
|
67
67
|
const detail: IProcessErrorDetail = { pid, message, error };
|
|
68
68
|
const e = new CustomEvent(ProcessEventTypes.loadingError, {
|
|
69
69
|
cancelable: true,
|
|
@@ -10,12 +10,12 @@ export class ReportingEvents {
|
|
|
10
10
|
/**
|
|
11
11
|
* Dispatches the general error event for UI logging purposes.
|
|
12
12
|
*
|
|
13
|
-
* @param target A node on which to dispatch the event
|
|
14
13
|
* @param description The error description
|
|
15
14
|
* @param error Optional original error object that has caused this event
|
|
16
15
|
* @param component Optional component name.
|
|
16
|
+
* @param target A node on which to dispatch the event
|
|
17
17
|
*/
|
|
18
|
-
static error(
|
|
18
|
+
static error(description: string, error?: Error, component?: string, target: EventTarget = window): void {
|
|
19
19
|
const detail: IReportingErrorDetail = { error, description, component };
|
|
20
20
|
const e = new CustomEvent(ReportingEventTypes.error, {
|
|
21
21
|
bubbles: true,
|
|
@@ -48,7 +48,7 @@ export class TelemetryEvents {
|
|
|
48
48
|
* @param screenName The screen name
|
|
49
49
|
* @param info Analytics base configuration
|
|
50
50
|
*/
|
|
51
|
-
static view(
|
|
51
|
+
static view(screenName: string, target: EventTarget = window, info: ITelemetryDetail = {}): void {
|
|
52
52
|
const detail: ITelemetryScreenViewDetail = {
|
|
53
53
|
...info, screenName,
|
|
54
54
|
};
|
|
@@ -66,7 +66,7 @@ export class TelemetryEvents {
|
|
|
66
66
|
* @param target A node on which to dispatch the event
|
|
67
67
|
* @param detail The event configuration
|
|
68
68
|
*/
|
|
69
|
-
static event(
|
|
69
|
+
static event(detail: ITelemetryEventDetail, target: EventTarget = window): void {
|
|
70
70
|
const e = new CustomEvent(TelemetryEventTypes.event, {
|
|
71
71
|
bubbles: true,
|
|
72
72
|
composed: true,
|
|
@@ -83,7 +83,7 @@ export class TelemetryEvents {
|
|
|
83
83
|
* @param fatal Whether the exception was fatal to the application
|
|
84
84
|
* @param info Analytics base configuration
|
|
85
85
|
*/
|
|
86
|
-
static exception(
|
|
86
|
+
static exception(description: string, fatal?: boolean, target: EventTarget = window, info: ITelemetryDetail = {}): void {
|
|
87
87
|
const detail: ITelemetryExceptionDetail = { ...info, description, fatal };
|
|
88
88
|
const e = new CustomEvent(TelemetryEventTypes.exception, {
|
|
89
89
|
bubbles: true,
|
|
@@ -102,7 +102,7 @@ export class TelemetryEvents {
|
|
|
102
102
|
* @param url The share url
|
|
103
103
|
* @param info Analytics base configuration
|
|
104
104
|
*/
|
|
105
|
-
static social(
|
|
105
|
+
static social(network: string, action: string, url: string, target: EventTarget = window, info: ITelemetryDetail = {}): void {
|
|
106
106
|
const detail: ITelemetrySocialDetail = { ...info, network, action, target: url };
|
|
107
107
|
const e = new CustomEvent(TelemetryEventTypes.social, {
|
|
108
108
|
bubbles: true,
|
|
@@ -122,7 +122,7 @@ export class TelemetryEvents {
|
|
|
122
122
|
* @param label The timing label
|
|
123
123
|
* @param info Analytics base configuration
|
|
124
124
|
*/
|
|
125
|
-
static timing(
|
|
125
|
+
static timing(category: string, variable: string, value: number, label?: string, target: EventTarget = window, info: ITelemetryDetail = {}): void {
|
|
126
126
|
const detail: ITelemetryTimingDetail = { ...info, category, variable, value, label };
|
|
127
127
|
const e = new CustomEvent(TelemetryEventTypes.timing, {
|
|
128
128
|
bubbles: true,
|
|
@@ -145,7 +145,7 @@ class StateEvents {
|
|
|
145
145
|
*
|
|
146
146
|
* @param target The node on which to dispatch the event.
|
|
147
147
|
*/
|
|
148
|
-
static set(target: EventTarget): void {
|
|
148
|
+
static set(target: EventTarget = window): void {
|
|
149
149
|
const e = new Event(TelemetryEventTypes.State.set, {
|
|
150
150
|
composed: true,
|
|
151
151
|
cancelable: true,
|
|
@@ -39,7 +39,7 @@ export const TransportEvent = Object.freeze({
|
|
|
39
39
|
* @param config Optional request configuration.
|
|
40
40
|
* @returns The execution log or `undefined` when the event was not handled.
|
|
41
41
|
*/
|
|
42
|
-
send: async (
|
|
42
|
+
send: async (request: IHttpRequest, authorization?: IRequestAuthorization[], config?: IRequestBaseConfig, target: EventTarget = window): Promise<IRequestLog | undefined> => {
|
|
43
43
|
const e = new ContextEvent<ICoreRequestDetail, IRequestLog>(TransportEventTypes.Core.send, {
|
|
44
44
|
request,
|
|
45
45
|
authorization,
|
|
@@ -62,7 +62,7 @@ export const TransportEvent = Object.freeze({
|
|
|
62
62
|
* @param init Optional request init options compatible with the Fetch API.
|
|
63
63
|
* @returns Compatible with the Fetch API Response object or `undefined` when the event was not handled.
|
|
64
64
|
*/
|
|
65
|
-
send: async (
|
|
65
|
+
send: async (request: IHttpRequest, init?: RequestInit, target: EventTarget = window): Promise<Response | undefined> => {
|
|
66
66
|
const e = new ContextEvent<IHttpRequestDetail, Response>(TransportEventTypes.Http.send, {
|
|
67
67
|
request,
|
|
68
68
|
init,
|
|
@@ -82,7 +82,7 @@ export const TransportEvent = Object.freeze({
|
|
|
82
82
|
* @param opts The project execution options.
|
|
83
83
|
* @returns
|
|
84
84
|
*/
|
|
85
|
-
send: async (
|
|
85
|
+
send: async (project: HttpProject | string, opts: IProjectRunnerOptions, target: EventTarget = window): Promise<IProjectExecutionLog | undefined> => {
|
|
86
86
|
const e = new ContextEvent<IProjectRequestDetail, IProjectExecutionLog>(TransportEventTypes.Project.send, {
|
|
87
87
|
project,
|
|
88
88
|
opts,
|
|
@@ -383,4 +383,13 @@ export class DataAssociation {
|
|
|
383
383
|
this.adapts = association.key;
|
|
384
384
|
return association;
|
|
385
385
|
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* @returns The definition of the parent entity of this association.
|
|
389
|
+
*/
|
|
390
|
+
getParent(): DataEntity {
|
|
391
|
+
// this is forced as an association is only created when an entity is created
|
|
392
|
+
// so it has to be defined.
|
|
393
|
+
return this.root.definitions.entities.find(i => i.associations.includes(this)) as DataEntity;
|
|
394
|
+
}
|
|
386
395
|
}
|
|
@@ -8,6 +8,7 @@ import { DataModel } from "./DataModel.js";
|
|
|
8
8
|
import { INodeShape, IShapeUnion } from "../../amf/definitions/Shapes.js";
|
|
9
9
|
import { AmfShapeGenerator } from "../../amf/AmfShapeGenerator.js";
|
|
10
10
|
import { ApiSchemaGenerator } from "../../amf/ApiSchemaGenerator.js";
|
|
11
|
+
import { IShapeRenderOptions } from "../../amf/shape/ShapeBase.js";
|
|
11
12
|
|
|
12
13
|
export const Kind = 'Core#DataEntity';
|
|
13
14
|
|
|
@@ -465,63 +466,38 @@ export class DataEntity {
|
|
|
465
466
|
* @yields The path containing keys of entities from this entity to the `toEntity` (inclusive) and all entities in between.
|
|
466
467
|
*/
|
|
467
468
|
* associationPath(toEntity: string): Generator<string[]> {
|
|
468
|
-
const graph = this.
|
|
469
|
-
for (const path of this.
|
|
469
|
+
const graph = this.root.associationGraph();
|
|
470
|
+
for (const path of this.root.associationPath(this.key, toEntity, graph)) {
|
|
470
471
|
yield path;
|
|
471
472
|
}
|
|
472
473
|
}
|
|
473
474
|
|
|
474
475
|
/**
|
|
475
|
-
*
|
|
476
|
+
* Returns a list of entities that are association with this entity through an association
|
|
477
|
+
* that the target property points to this entity.
|
|
476
478
|
*
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
488
|
-
if (visited.has(from)) {
|
|
489
|
-
// it's a cycle
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
if (g[from]) {
|
|
493
|
-
visited.add(from);
|
|
494
|
-
path.push(from);
|
|
495
|
-
|
|
496
|
-
for (const neighbor of g[from]) {
|
|
497
|
-
yield *this._associationPath(neighbor, to, g, path, visited);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
visited.delete(from);
|
|
501
|
-
path.pop();
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* @returns The graph of associations where keys are the source entities and the value is the list of all target entities.
|
|
479
|
+
* In other words, if entity `A` has association target with `B`, then asking `B` for related entities will
|
|
480
|
+
* result with `[A]`.
|
|
481
|
+
*
|
|
482
|
+
* ```plain
|
|
483
|
+
* A -> B -> C
|
|
484
|
+
* D -> C
|
|
485
|
+
*
|
|
486
|
+
* C => [B, D]
|
|
487
|
+
* B => [A, C]
|
|
488
|
+
* ```
|
|
507
489
|
*/
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
if (!srcEntity) {
|
|
517
|
-
continue;
|
|
518
|
-
}
|
|
519
|
-
if (!graph[srcEntity.key]) {
|
|
520
|
-
graph[srcEntity.key] = [];
|
|
490
|
+
getRelatedEntities(): DataEntity[] {
|
|
491
|
+
const { key, root } = this;
|
|
492
|
+
const result: DataEntity[] = [];
|
|
493
|
+
const inverse = root.definitions.associations.filter(i => i.targets.includes(key));
|
|
494
|
+
inverse.forEach((assoc) => {
|
|
495
|
+
const entity = root.definitions.entities.find(e => e.associations.includes(assoc));
|
|
496
|
+
if (entity) {
|
|
497
|
+
result.push(entity);
|
|
521
498
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
return graph;
|
|
499
|
+
});
|
|
500
|
+
return result;
|
|
525
501
|
}
|
|
526
502
|
|
|
527
503
|
/**
|
|
@@ -617,12 +593,13 @@ export class DataEntity {
|
|
|
617
593
|
/**
|
|
618
594
|
* Reads the schema of the Entity and generates an example for it.
|
|
619
595
|
*/
|
|
620
|
-
toExample(mime: string): string | number | boolean | null | undefined {
|
|
596
|
+
toExample(mime: string, opts: IShapeRenderOptions = {}): string | number | boolean | null | undefined {
|
|
621
597
|
const shape = this.toApiShape();
|
|
622
598
|
const generator = new ApiSchemaGenerator(mime, {
|
|
623
|
-
renderExamples: true,
|
|
624
|
-
renderMocked: true,
|
|
625
|
-
renderOptional: true,
|
|
599
|
+
renderExamples: typeof opts.renderExamples === 'boolean' ? opts.renderExamples : true,
|
|
600
|
+
renderMocked: typeof opts.renderMocked === 'boolean' ? opts.renderMocked : true,
|
|
601
|
+
renderOptional: typeof opts.renderOptional === 'boolean' ? opts.renderOptional : true,
|
|
602
|
+
selectedUnions: opts.selectedUnions,
|
|
626
603
|
});
|
|
627
604
|
return generator.generate(shape);
|
|
628
605
|
}
|
|
@@ -650,4 +627,30 @@ export class DataEntity {
|
|
|
650
627
|
this.adapts = entity.key;
|
|
651
628
|
return entity;
|
|
652
629
|
}
|
|
630
|
+
|
|
631
|
+
hasClosedCycle(rootEntity: string, targetEntity: string): boolean {
|
|
632
|
+
if (targetEntity === this.key) {
|
|
633
|
+
// self association
|
|
634
|
+
return true;
|
|
635
|
+
}
|
|
636
|
+
const g = this.root.associationGraph();
|
|
637
|
+
const selfPaths: string[][] = [];
|
|
638
|
+
const targetPaths: string[][] = [];
|
|
639
|
+
for (const path of this.root.associationPath(rootEntity, this.key, g)) {
|
|
640
|
+
selfPaths.push(path);
|
|
641
|
+
}
|
|
642
|
+
for (const path of this.root.associationPath(targetEntity, this.key, g)) {
|
|
643
|
+
targetPaths.push(path);
|
|
644
|
+
}
|
|
645
|
+
const checker = (arr: string[], target: string[]): boolean => target.every(v => arr.includes(v));
|
|
646
|
+
for (const sp of selfPaths) {
|
|
647
|
+
for (const tp of targetPaths) {
|
|
648
|
+
const result = checker(sp, tp);
|
|
649
|
+
if (result) {
|
|
650
|
+
return result;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return false;
|
|
655
|
+
}
|
|
653
656
|
}
|
|
@@ -534,4 +534,58 @@ export class DataNamespace extends DataNamespaceParent {
|
|
|
534
534
|
model.remove();
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @returns The graph of associations where keys are the source entities and the value is the list of all target entities.
|
|
540
|
+
*/
|
|
541
|
+
associationGraph(): Record<string, string[]> {
|
|
542
|
+
const graph: Record<string, string[]> = {};
|
|
543
|
+
const { definitions } = this.root || this;
|
|
544
|
+
const { associations, entities } = definitions;
|
|
545
|
+
for (const assoc of associations) {
|
|
546
|
+
if (!assoc.targets.length) {
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
const srcEntity = entities.find(i => i.associations.some(a => a === assoc));
|
|
550
|
+
if (!srcEntity) {
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
if (!graph[srcEntity.key]) {
|
|
554
|
+
graph[srcEntity.key] = [];
|
|
555
|
+
}
|
|
556
|
+
graph[srcEntity.key].splice(0, 0, ...assoc.targets);
|
|
557
|
+
}
|
|
558
|
+
return graph;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Prints out all associations from one entity to another through all entities that may be in between.
|
|
563
|
+
*
|
|
564
|
+
* @param from The key of the from entity
|
|
565
|
+
* @param to The key of the target entity
|
|
566
|
+
* @param g The graph generated with `associationGraph()`
|
|
567
|
+
* @param path The current list of entity ids. Do not set this, it is for the recursive processing of the graph.
|
|
568
|
+
* @param visited The list of visited paths to avoid cycles. Do not set this, it is for the recursive processing of the graph.
|
|
569
|
+
*/
|
|
570
|
+
* associationPath(from: string, to: string, g: Record<string, string[]>, path: string[] = [], visited: Set<string> = new Set()): Generator<string[]> {
|
|
571
|
+
if (from === to) {
|
|
572
|
+
yield path.concat(to);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
if (visited.has(from)) {
|
|
576
|
+
// it's a cycle
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
if (g[from]) {
|
|
580
|
+
visited.add(from);
|
|
581
|
+
path.push(from);
|
|
582
|
+
|
|
583
|
+
for (const neighbor of g[from]) {
|
|
584
|
+
yield *this.associationPath(neighbor, to, g, path, visited);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
visited.delete(from);
|
|
588
|
+
path.pop();
|
|
589
|
+
}
|
|
590
|
+
}
|
|
537
591
|
}
|
|
@@ -19,7 +19,7 @@ export class DeleteCookieRunnable extends ActionRunnable {
|
|
|
19
19
|
if (!url) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
Events.Cookie.deleteUrl(
|
|
22
|
+
Events.Cookie.deleteUrl(url, config.name, this.eventTarget);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async request(request: IHttpRequest): Promise<void> {
|
|
@@ -34,6 +34,6 @@ export class DeleteCookieRunnable extends ActionRunnable {
|
|
|
34
34
|
if (!url) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
Events.Cookie.deleteUrl(
|
|
37
|
+
Events.Cookie.deleteUrl(url, config.name, this.eventTarget);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -68,7 +68,7 @@ export class SetCookieRunnable extends ActionRunnable {
|
|
|
68
68
|
if (typeof config.secure === 'boolean') {
|
|
69
69
|
cookie.secure = config.secure;
|
|
70
70
|
}
|
|
71
|
-
Events.Cookie.update(this.eventTarget
|
|
71
|
+
Events.Cookie.update(cookie, this.eventTarget);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
async response(log: IRequestLog): Promise<void> {
|
|
@@ -29,7 +29,7 @@ export class SetVariableRunnable extends ActionRunnable {
|
|
|
29
29
|
|
|
30
30
|
async setVariable(config: ISetVariableAction, value: string): Promise<void> {
|
|
31
31
|
const { name } = config;
|
|
32
|
-
Events.Environment.set(
|
|
32
|
+
Events.Environment.set(name, value, this.eventTarget);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
async response(log: IRequestLog): Promise<void> {
|
|
@@ -19,7 +19,7 @@ import { Cookie } from '../../lib/cookies/Cookie.js';
|
|
|
19
19
|
* @returns A promise that resolves to header value string.
|
|
20
20
|
*/
|
|
21
21
|
async function getCookiesHeaderValue(eventsTarget: EventTarget, url: string): Promise<string> {
|
|
22
|
-
const cookies = await CookieEvents.listUrl(
|
|
22
|
+
const cookies = await CookieEvents.listUrl(url, eventsTarget);
|
|
23
23
|
if (!cookies || !cookies.length) {
|
|
24
24
|
return '';
|
|
25
25
|
}
|
|
@@ -141,6 +141,6 @@ export async function processResponseCookies(log: IRequestLog, context: Executio
|
|
|
141
141
|
const typedResponse = log.response as IResponse;
|
|
142
142
|
const result = extract(typedResponse, log.request.url, log.redirects);
|
|
143
143
|
if (result.cookies.length) {
|
|
144
|
-
await CookieEvents.updateBulk(
|
|
144
|
+
await CookieEvents.updateBulk(result.cookies.map(c => HttpCookie.fromCookieParser(c).toJSON()), context.eventsTarget);
|
|
145
145
|
}
|
|
146
146
|
}
|