@api-client/core 0.6.17 → 0.6.20
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/legacy.d.ts +39 -0
- package/build/legacy.js +40 -0
- package/build/legacy.js.map +1 -0
- 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 +4 -6
- package/build/src/models/data/DataEntity.js +25 -25
- package/build/src/models/data/DataEntity.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/legacy.ts +41 -0
- package/package.json +3 -3
- 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 +26 -27
- 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
|
@@ -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
|
|
|
@@ -483,20 +484,19 @@ export class DataEntity {
|
|
|
483
484
|
* D -> C
|
|
484
485
|
*
|
|
485
486
|
* C => [B, D]
|
|
487
|
+
* B => [A, C]
|
|
486
488
|
* ```
|
|
487
489
|
*/
|
|
488
490
|
getRelatedEntities(): DataEntity[] {
|
|
489
491
|
const { key, root } = this;
|
|
490
492
|
const result: DataEntity[] = [];
|
|
491
493
|
const inverse = root.definitions.associations.filter(i => i.targets.includes(key));
|
|
492
|
-
|
|
493
494
|
inverse.forEach((assoc) => {
|
|
494
495
|
const entity = root.definitions.entities.find(e => e.associations.includes(assoc));
|
|
495
496
|
if (entity) {
|
|
496
497
|
result.push(entity);
|
|
497
498
|
}
|
|
498
499
|
});
|
|
499
|
-
|
|
500
500
|
return result;
|
|
501
501
|
}
|
|
502
502
|
|
|
@@ -593,12 +593,13 @@ export class DataEntity {
|
|
|
593
593
|
/**
|
|
594
594
|
* Reads the schema of the Entity and generates an example for it.
|
|
595
595
|
*/
|
|
596
|
-
toExample(mime: string): string | number | boolean | null | undefined {
|
|
596
|
+
toExample(mime: string, opts: IShapeRenderOptions = {}): string | number | boolean | null | undefined {
|
|
597
597
|
const shape = this.toApiShape();
|
|
598
598
|
const generator = new ApiSchemaGenerator(mime, {
|
|
599
|
-
renderExamples: true,
|
|
600
|
-
renderMocked: true,
|
|
601
|
-
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,
|
|
602
603
|
});
|
|
603
604
|
return generator.generate(shape);
|
|
604
605
|
}
|
|
@@ -627,29 +628,27 @@ export class DataEntity {
|
|
|
627
628
|
return entity;
|
|
628
629
|
}
|
|
629
630
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
*/
|
|
634
|
-
hasForwardCycle(target: string, g = this.root.associationGraph(), key = this.key): boolean {
|
|
635
|
-
if (target === key) {
|
|
636
|
-
return true;
|
|
637
|
-
}
|
|
638
|
-
const neighbors: string[] = [];
|
|
639
|
-
Object.keys(g).forEach(prop => {
|
|
640
|
-
if (g[prop].includes(key)) {
|
|
641
|
-
neighbors.push(prop);
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
if (neighbors.includes(target)) {
|
|
631
|
+
hasClosedCycle(rootEntity: string, targetEntity: string): boolean {
|
|
632
|
+
if (targetEntity === this.key) {
|
|
633
|
+
// self association
|
|
645
634
|
return true;
|
|
646
635
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
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
|
+
}
|
|
653
652
|
}
|
|
654
653
|
}
|
|
655
654
|
return false;
|
|
@@ -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
|
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export interface IDataAssociationSchema {
|
|
2
|
-
/**
|
|
3
|
-
* Whether the target entity should be embedded under the property name.
|
|
4
|
-
* When false, this association is just an information that one entity depend on another.
|
|
5
|
-
* When true, it changes the definition of the schema having this association to
|
|
6
|
-
* add the target schema properties inline with this property.
|
|
7
|
-
*
|
|
8
|
-
* **When true**
|
|
9
|
-
*
|
|
10
|
-
* ```javascript
|
|
11
|
-
* // generated schema for `address` association
|
|
12
|
-
* {
|
|
13
|
-
* "name": "example value",
|
|
14
|
-
* "address": {
|
|
15
|
-
* "city": "example value",
|
|
16
|
-
* ...
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* **When false**
|
|
22
|
-
*
|
|
23
|
-
* ```javascript
|
|
24
|
-
* // generated schema for `address` association
|
|
25
|
-
* {
|
|
26
|
-
* "name": "example value",
|
|
27
|
-
* "address": "the key of the referenced schema"
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
embedded?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Describes XML specific serialization.
|
|
34
|
-
*/
|
|
35
|
-
xml?: {
|
|
36
|
-
/**
|
|
37
|
-
* The name of the attribute or a wrapped property to use when serializing the property.
|
|
38
|
-
*
|
|
39
|
-
* ```
|
|
40
|
-
* <Person fullName="John Doe"></Person>
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
name?: string;
|
|
44
|
-
/**
|
|
45
|
-
* When the property is an array (has the `multiple` set to true)
|
|
46
|
-
* then it tells that the list of values should be wrapped with a parent
|
|
47
|
-
* element:
|
|
48
|
-
*
|
|
49
|
-
* ```
|
|
50
|
-
* <Person>
|
|
51
|
-
* <Person fullName="John Doe"></Person>
|
|
52
|
-
* </Person>
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* Use this with the combination with `name` to describe the name of the wrapped
|
|
56
|
-
* element
|
|
57
|
-
*
|
|
58
|
-
* ```
|
|
59
|
-
* <people>
|
|
60
|
-
* <Person fullName="John Doe"></Person>
|
|
61
|
-
* </people>
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* Note, this is mutually exclusive with `attribute`.
|
|
65
|
-
*/
|
|
66
|
-
wrapped?: boolean;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataAssociationSchema.js","sourceRoot":"","sources":["../../../../src/models/data/DataAssociationSchema.ts"],"names":[],"mappings":""}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
export interface IDataAssociationSchema {
|
|
2
|
-
/**
|
|
3
|
-
* Whether the target entity should be embedded under the property name.
|
|
4
|
-
* When false, this association is just an information that one entity depend on another.
|
|
5
|
-
* When true, it changes the definition of the schema having this association to
|
|
6
|
-
* add the target schema properties inline with this property.
|
|
7
|
-
*
|
|
8
|
-
* **When true**
|
|
9
|
-
*
|
|
10
|
-
* ```javascript
|
|
11
|
-
* // generated schema for `address` association
|
|
12
|
-
* {
|
|
13
|
-
* "name": "example value",
|
|
14
|
-
* "address": {
|
|
15
|
-
* "city": "example value",
|
|
16
|
-
* ...
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* **When false**
|
|
22
|
-
*
|
|
23
|
-
* ```javascript
|
|
24
|
-
* // generated schema for `address` association
|
|
25
|
-
* {
|
|
26
|
-
* "name": "example value",
|
|
27
|
-
* "address": "the key of the referenced schema"
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
embedded?: boolean;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Describes XML specific serialization.
|
|
35
|
-
*/
|
|
36
|
-
xml?: {
|
|
37
|
-
/**
|
|
38
|
-
* The name of the attribute or a wrapped property to use when serializing the property.
|
|
39
|
-
*
|
|
40
|
-
* ```
|
|
41
|
-
* <Person fullName="John Doe"></Person>
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
name?: string;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* When the property is an array (has the `multiple` set to true)
|
|
48
|
-
* then it tells that the list of values should be wrapped with a parent
|
|
49
|
-
* element:
|
|
50
|
-
*
|
|
51
|
-
* ```
|
|
52
|
-
* <Person>
|
|
53
|
-
* <Person fullName="John Doe"></Person>
|
|
54
|
-
* </Person>
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* Use this with the combination with `name` to describe the name of the wrapped
|
|
58
|
-
* element
|
|
59
|
-
*
|
|
60
|
-
* ```
|
|
61
|
-
* <people>
|
|
62
|
-
* <Person fullName="John Doe"></Person>
|
|
63
|
-
* </people>
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* Note, this is mutually exclusive with `attribute`.
|
|
67
|
-
*/
|
|
68
|
-
wrapped?: boolean;
|
|
69
|
-
}
|
|
70
|
-
}
|