@api-client/core 0.12.5 → 0.12.7
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/ApiSchemaValues.d.ts +6 -2
- package/build/src/amf/ApiSchemaValues.d.ts.map +1 -1
- package/build/src/amf/ApiSchemaValues.js +17 -12
- package/build/src/amf/ApiSchemaValues.js.map +1 -1
- package/build/src/amf/shape/ShapeBase.d.ts +1 -1
- package/build/src/amf/shape/ShapeBase.d.ts.map +1 -1
- package/build/src/amf/shape/ShapeBase.js +1 -1
- package/build/src/amf/shape/ShapeBase.js.map +1 -1
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts.map +1 -1
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +1 -2
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -1
- package/build/src/events/BaseEvents.d.ts +3 -3
- package/build/src/events/BaseEvents.d.ts.map +1 -1
- package/build/src/events/BaseEvents.js.map +1 -1
- package/build/src/mocking/LegacyInterfaces.d.ts +1 -1
- package/build/src/mocking/LegacyInterfaces.d.ts.map +1 -1
- package/build/src/mocking/LegacyInterfaces.js.map +1 -1
- package/build/src/mocking/LegacyMock.d.ts +1 -1
- package/build/src/mocking/LegacyMock.d.ts.map +1 -1
- package/build/src/mocking/LegacyMock.js +1 -1
- package/build/src/mocking/LegacyMock.js.map +1 -1
- package/build/src/mocking/ProjectMock.d.ts +2 -1
- package/build/src/mocking/ProjectMock.d.ts.map +1 -1
- package/build/src/mocking/ProjectMock.js +1 -1
- package/build/src/mocking/ProjectMock.js.map +1 -1
- package/build/src/mocking/legacy/Authorization.d.ts +2 -1
- package/build/src/mocking/legacy/Authorization.d.ts.map +1 -1
- package/build/src/mocking/legacy/Authorization.js +2 -1
- package/build/src/mocking/legacy/Authorization.js.map +1 -1
- package/build/src/mocking/legacy/Certificates.d.ts +3 -1
- package/build/src/mocking/legacy/Certificates.d.ts.map +1 -1
- package/build/src/mocking/legacy/Certificates.js +6 -3
- package/build/src/mocking/legacy/Certificates.js.map +1 -1
- package/build/src/mocking/legacy/Cookies.d.ts +3 -1
- package/build/src/mocking/legacy/Cookies.d.ts.map +1 -1
- package/build/src/mocking/legacy/Cookies.js +3 -1
- package/build/src/mocking/legacy/Cookies.js.map +1 -1
- package/build/src/mocking/legacy/HostRules.d.ts +3 -1
- package/build/src/mocking/legacy/HostRules.d.ts.map +1 -1
- package/build/src/mocking/legacy/HostRules.js +3 -1
- package/build/src/mocking/legacy/HostRules.js.map +1 -1
- package/build/src/mocking/legacy/Http.d.ts +6 -1
- package/build/src/mocking/legacy/Http.d.ts.map +1 -1
- package/build/src/mocking/legacy/Http.js +5 -1
- package/build/src/mocking/legacy/Http.js.map +1 -1
- package/build/src/mocking/legacy/HttpResponse.d.ts +3 -2
- package/build/src/mocking/legacy/HttpResponse.d.ts.map +1 -1
- package/build/src/mocking/legacy/HttpResponse.js +2 -2
- package/build/src/mocking/legacy/HttpResponse.js.map +1 -1
- package/build/src/mocking/legacy/RestApi.d.ts +3 -1
- package/build/src/mocking/legacy/RestApi.d.ts.map +1 -1
- package/build/src/mocking/legacy/RestApi.js +3 -1
- package/build/src/mocking/legacy/RestApi.js.map +1 -1
- package/build/src/mocking/legacy/Urls.d.ts +3 -1
- package/build/src/mocking/legacy/Urls.d.ts.map +1 -1
- package/build/src/mocking/legacy/Urls.js +3 -1
- package/build/src/mocking/legacy/Urls.js.map +1 -1
- package/build/src/mocking/legacy/Variables.d.ts +2 -1
- package/build/src/mocking/legacy/Variables.d.ts.map +1 -1
- package/build/src/mocking/legacy/Variables.js +2 -1
- package/build/src/mocking/legacy/Variables.js.map +1 -1
- package/build/src/mocking/lib/Certificates.d.ts +4 -1
- package/build/src/mocking/lib/Certificates.d.ts.map +1 -1
- package/build/src/mocking/lib/Certificates.js +5 -2
- package/build/src/mocking/lib/Certificates.js.map +1 -1
- package/build/src/mocking/lib/History.d.ts +5 -1
- package/build/src/mocking/lib/History.d.ts.map +1 -1
- package/build/src/mocking/lib/History.js +4 -1
- package/build/src/mocking/lib/History.js.map +1 -1
- package/build/src/mocking/lib/HostRules.d.ts +4 -1
- package/build/src/mocking/lib/HostRules.d.ts.map +1 -1
- package/build/src/mocking/lib/HostRules.js +3 -1
- package/build/src/mocking/lib/HostRules.js.map +1 -1
- package/build/src/mocking/lib/Request.d.ts +5 -1
- package/build/src/mocking/lib/Request.d.ts.map +1 -1
- package/build/src/mocking/lib/Request.js +4 -1
- package/build/src/mocking/lib/Request.js.map +1 -1
- package/build/src/mocking/lib/Response.d.ts +7 -1
- package/build/src/mocking/lib/Response.d.ts.map +1 -1
- package/build/src/mocking/lib/Response.js +6 -1
- package/build/src/mocking/lib/Response.js.map +1 -1
- package/build/src/mocking/lib/Url.d.ts +4 -1
- package/build/src/mocking/lib/Url.d.ts.map +1 -1
- package/build/src/mocking/lib/Url.js +3 -1
- package/build/src/mocking/lib/Url.js.map +1 -1
- package/build/src/mocking/lib/User.d.ts +5 -1
- package/build/src/mocking/lib/User.d.ts.map +1 -1
- package/build/src/mocking/lib/User.js +4 -1
- package/build/src/mocking/lib/User.js.map +1 -1
- package/build/src/modeling/DataDomain.d.ts +1 -1
- package/build/src/modeling/DataDomain.d.ts.map +1 -1
- package/build/src/modeling/DataDomain.js.map +1 -1
- package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
- package/build/src/modeling/DomainAssociation.js +2 -3
- package/build/src/modeling/DomainAssociation.js.map +1 -1
- package/build/src/modeling/DomainSerialization.d.ts.map +1 -1
- package/build/src/modeling/DomainSerialization.js +1 -1
- package/build/src/modeling/DomainSerialization.js.map +1 -1
- package/build/src/modeling/DomainVersioning.js.map +1 -1
- package/build/src/modeling/GraphUtils.d.ts +1 -1
- package/build/src/modeling/GraphUtils.d.ts.map +1 -1
- package/build/src/modeling/GraphUtils.js.map +1 -1
- package/build/src/modeling/legacy/DataAssociation.d.ts.map +1 -1
- package/build/src/modeling/legacy/DataAssociation.js +4 -5
- package/build/src/modeling/legacy/DataAssociation.js.map +1 -1
- package/build/src/modeling/legacy/DataProperty.d.ts.map +1 -1
- package/build/src/modeling/legacy/DataProperty.js +4 -5
- package/build/src/modeling/legacy/DataProperty.js.map +1 -1
- package/build/src/modeling/types.d.ts +2 -1
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/src/models/ProjectExecution.d.ts.map +1 -1
- package/build/src/models/ProjectExecution.js +2 -3
- package/build/src/models/ProjectExecution.js.map +1 -1
- package/build/src/models/Request.d.ts.map +1 -1
- package/build/src/models/Request.js +4 -5
- package/build/src/models/Request.js.map +1 -1
- package/build/src/models/store/Revision.d.ts +1 -1
- package/build/src/models/store/Revision.d.ts.map +1 -1
- package/build/src/models/store/Revision.js.map +1 -1
- package/build/src/patch/PatchClient.d.ts +2 -1
- package/build/src/patch/PatchClient.d.ts.map +1 -1
- package/build/src/patch/PatchClient.js +1 -1
- package/build/src/patch/PatchClient.js.map +1 -1
- package/build/src/patch/types.d.ts +1 -1
- package/build/src/patch/types.d.ts.map +1 -1
- package/build/src/patch/types.js.map +1 -1
- package/data/models/example-generator-api.json +22 -22
- package/package.json +21 -20
- package/src/amf/ApiSchemaValues.ts +18 -13
- package/src/amf/shape/ShapeBase.ts +1 -1
- package/src/amf/shape/ShapeXmlSchemaGenerator.ts +1 -2
- package/src/events/BaseEvents.ts +3 -3
- package/src/mocking/LegacyInterfaces.ts +1 -1
- package/src/mocking/LegacyMock.ts +1 -1
- package/src/mocking/ProjectMock.ts +2 -1
- package/src/mocking/legacy/Authorization.ts +2 -1
- package/src/mocking/legacy/Certificates.ts +6 -3
- package/src/mocking/legacy/Cookies.ts +3 -1
- package/src/mocking/legacy/HostRules.ts +3 -1
- package/src/mocking/legacy/Http.ts +6 -1
- package/src/mocking/legacy/HttpResponse.ts +3 -7
- package/src/mocking/legacy/RestApi.ts +3 -1
- package/src/mocking/legacy/Urls.ts +3 -1
- package/src/mocking/legacy/Variables.ts +2 -1
- package/src/mocking/lib/Certificates.ts +6 -2
- package/src/mocking/lib/History.ts +5 -1
- package/src/mocking/lib/HostRules.ts +4 -1
- package/src/mocking/lib/Request.ts +5 -1
- package/src/mocking/lib/Response.ts +7 -12
- package/src/mocking/lib/Url.ts +4 -1
- package/src/mocking/lib/User.ts +5 -1
- package/src/modeling/DataDomain.ts +1 -1
- package/src/modeling/DomainAssociation.ts +2 -3
- package/src/modeling/DomainSerialization.ts +2 -1
- package/src/modeling/DomainVersioning.ts +1 -1
- package/src/modeling/GraphUtils.ts +1 -1
- package/src/modeling/legacy/DataAssociation.ts +4 -5
- package/src/modeling/legacy/DataProperty.ts +4 -5
- package/src/modeling/types.ts +2 -1
- package/src/models/ProjectExecution.ts +2 -3
- package/src/models/Request.ts +4 -5
- package/src/models/store/Revision.ts +1 -1
- package/src/patch/PatchClient.ts +2 -1
- package/src/patch/types.ts +1 -1
- package/tests/servers/express-routes/StreamApi.ts +6 -4
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Json } from '@api-client/json'
|
|
2
1
|
import { AmfNamespace as ns } from '../definitions/Namespace.js'
|
|
3
2
|
import { ShapeBase } from './ShapeBase.js'
|
|
4
3
|
import { XmlDataNodeGenerator } from '../data-node/XmlDataNodeGenerator.js'
|
|
@@ -869,7 +868,7 @@ export class ShapeXmlSchemaGenerator extends ShapeBase {
|
|
|
869
868
|
const { and = [], xone = [], or = [] } = schema
|
|
870
869
|
if (and.length) {
|
|
871
870
|
// we combine all properties together under `schema` with changed properties
|
|
872
|
-
const copy =
|
|
871
|
+
const copy = structuredClone(schema) as IApiNodeShape
|
|
873
872
|
copy.and = []
|
|
874
873
|
copy.properties = []
|
|
875
874
|
and.forEach((item) => {
|
package/src/events/BaseEvents.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Operation } from '@api-client/json/patch/types.js'
|
|
2
2
|
import CustomEvent from './CustomEvent.js'
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -588,7 +588,7 @@ export interface IPatchInfo extends IPatchBase {
|
|
|
588
588
|
/**
|
|
589
589
|
* The patch generated by the client.
|
|
590
590
|
*/
|
|
591
|
-
patch:
|
|
591
|
+
patch: Operation[]
|
|
592
592
|
}
|
|
593
593
|
|
|
594
594
|
/**
|
|
@@ -601,5 +601,5 @@ export interface IPatchRevision extends IPatchInfo {
|
|
|
601
601
|
/**
|
|
602
602
|
* The patch to apply to the object to revert the changes.
|
|
603
603
|
*/
|
|
604
|
-
revert:
|
|
604
|
+
revert: Operation[]
|
|
605
605
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataMock } from '@pawel-up/data-mock'
|
|
1
|
+
import { DataMock } from '@pawel-up/data-mock/DataMock.js'
|
|
2
2
|
import { Authorization } from './legacy/Authorization.js'
|
|
3
3
|
import { Certificates } from './legacy/Certificates.js'
|
|
4
4
|
import { Cookies } from './legacy/Cookies.js'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DataMock
|
|
1
|
+
import { DataMock } from '@pawel-up/data-mock/DataMock.js'
|
|
2
|
+
import type { IDataMockInit } from '@pawel-up/data-mock/types.js'
|
|
2
3
|
import { Request } from './lib/Request.js'
|
|
3
4
|
import { Response } from './lib/Response.js'
|
|
4
5
|
import { User } from './lib/User.js'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Internet
|
|
1
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
2
3
|
import { ArcDataMockInit } from '../LegacyInterfaces.js'
|
|
3
4
|
import { ARCAuthData } from '../../models/legacy/models/AuthData.js'
|
|
4
5
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bufferToBase64, strToBuffer } from '@pawel-up/data-mock/Utils.js'
|
|
2
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
3
|
+
import { Random } from '@pawel-up/data-mock/Random.js'
|
|
4
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
2
5
|
import { ArcDataMockInit } from '../LegacyInterfaces.js'
|
|
3
6
|
import { Certificate, CertificateIndex, ClientCertificate } from '../../models/legacy/models/ClientCertificate.js'
|
|
4
7
|
import { ExportArcClientCertificateData } from '../../models/legacy/DataExport.js'
|
|
@@ -31,7 +34,7 @@ export class Certificates {
|
|
|
31
34
|
data,
|
|
32
35
|
}
|
|
33
36
|
if (opts.binary) {
|
|
34
|
-
result.data =
|
|
37
|
+
result.data = strToBuffer(data)
|
|
35
38
|
}
|
|
36
39
|
if (!opts.noPassphrase) {
|
|
37
40
|
result.passphrase = this.lorem.word()
|
|
@@ -138,7 +141,7 @@ export class Certificates {
|
|
|
138
141
|
if (typeof cert.data === 'string') {
|
|
139
142
|
return cert
|
|
140
143
|
}
|
|
141
|
-
const data =
|
|
144
|
+
const data = bufferToBase64(cert.data as ArrayBuffer)
|
|
142
145
|
const copy = { ...cert, type: 'buffer', data }
|
|
143
146
|
return copy
|
|
144
147
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Lorem
|
|
1
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
3
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js'
|
|
2
4
|
import { ArcDataMockInit } from '../LegacyInterfaces.js'
|
|
3
5
|
import { ARCCookie } from '../../models/legacy/models/Cookies.js'
|
|
4
6
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Lorem
|
|
1
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
3
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js'
|
|
2
4
|
import { ArcDataMockInit } from '../LegacyInterfaces.js'
|
|
3
5
|
import { ARCHostRule } from '../../models/legacy/models/HostRule.js'
|
|
4
6
|
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Base from '@pawel-up/data-mock/Http.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
3
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
4
|
+
import { Time } from '@pawel-up/data-mock/Time.js'
|
|
5
|
+
import { Random } from '@pawel-up/data-mock/Random.js'
|
|
6
|
+
import { IHttpRequestInit } from '@pawel-up/data-mock/types.js'
|
|
2
7
|
import { ArcDataMockInit } from '../LegacyInterfaces.js'
|
|
3
8
|
import { HttpResponse } from './HttpResponse.js'
|
|
4
9
|
import { ARCHistoryRequest, ARCSavedRequest, TransportRequest } from '../../models/legacy/request/ArcRequest.js'
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import Base, {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
typesValue,
|
|
5
|
-
loremValue,
|
|
6
|
-
} from '@pawel-up/data-mock/build/src/lib/http/Response.js'
|
|
7
|
-
import { Har, DataMockLocale } from '@pawel-up/data-mock'
|
|
1
|
+
import Base, { headersValue, payloadValue, typesValue, loremValue } from '@pawel-up/data-mock/http/Response.js'
|
|
2
|
+
import { Har } from '@pawel-up/data-mock/Har.js'
|
|
3
|
+
import { DataMockLocale } from '@pawel-up/data-mock/locales/Types.js'
|
|
8
4
|
import { ArcDataMockInit, HttpResponseArcInit, HttpResponseRedirectInit } from '../LegacyInterfaces.js'
|
|
9
5
|
import { ResponseRedirect, Response, ErrorResponse } from '../../models/legacy/request/ArcResponse.js'
|
|
10
6
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Lorem
|
|
1
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
3
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js'
|
|
2
4
|
import { ArcDataMockInit, RestApiIndexInit } from '../LegacyInterfaces.js'
|
|
3
5
|
import { ARCRestApi, ARCRestApiIndex } from '../../models/legacy/models/RestApi.js'
|
|
4
6
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Time } from '@pawel-up/data-mock/Time.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
3
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js'
|
|
2
4
|
import { ArcDataMockInit } from '../LegacyInterfaces.js'
|
|
3
5
|
import { ARCUrlHistory } from '../../models/legacy/models/UrlHistory.js'
|
|
4
6
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Lorem
|
|
1
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
2
3
|
import { ArcDataMockInit, VariableInit } from '../LegacyInterfaces.js'
|
|
3
4
|
import { ARCVariable } from '../../models/legacy/models/Variable.js'
|
|
4
5
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
2
|
+
import { Random } from '@pawel-up/data-mock/Random.js'
|
|
3
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
4
|
+
import type { IDataMockInit } from '@pawel-up/data-mock/types.js'
|
|
5
|
+
import { strToBuffer } from '@pawel-up/data-mock/Utils.js'
|
|
2
6
|
import { HttpCertificate, Certificate, ICertificateData } from '../../models/ClientCertificate.js'
|
|
3
7
|
|
|
4
8
|
export declare interface CertificateCreateInit {
|
|
@@ -24,7 +28,7 @@ export class Certificates {
|
|
|
24
28
|
certificate(opts: CertificateCreateInit = {}): HttpCertificate {
|
|
25
29
|
const type = opts.type ? opts.type : this.random.pickOne(['p12', 'pem'])
|
|
26
30
|
const data = this.lorem.paragraph()
|
|
27
|
-
const cert = opts.binary ?
|
|
31
|
+
const cert = opts.binary ? strToBuffer(data) : data
|
|
28
32
|
let instance: Certificate
|
|
29
33
|
if (type === 'p12') {
|
|
30
34
|
instance = Certificate.fromP12(cert, this.lorem.word())
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IDataMockInit, ITypeDateTimeInit } from '@pawel-up/data-mock/types.js'
|
|
2
|
+
import { Random } from '@pawel-up/data-mock/Random.js'
|
|
3
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
4
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js'
|
|
5
|
+
import { Person } from '@pawel-up/data-mock/Person.js'
|
|
2
6
|
// import { randomValue } from '@pawel-up/data-mock/src/lib/Http.js';
|
|
3
7
|
import { IHttpHistory, Kind as HttpHistoryKind } from '../../models/HttpHistory.js'
|
|
4
8
|
import { Request, IRequestLogInit } from './Request.js'
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IDataMockInit } from '@pawel-up/data-mock/types.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
3
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js'
|
|
4
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
2
5
|
import { IHostRule } from '../../models/HostRule.js'
|
|
3
6
|
|
|
4
7
|
export class HostRules {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IDataMockInit, IHttpRequestInit } from '@pawel-up/data-mock/types.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
3
|
+
import { Time } from '@pawel-up/data-mock/Time.js'
|
|
4
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
5
|
+
import Http from '@pawel-up/data-mock/Http.js'
|
|
2
6
|
// import { randomValue } from '@pawel-up/data-mock/src/lib/Http.js';
|
|
3
7
|
import { IHttpRequest, Kind as HttpRequestKind } from '../../models/HttpRequest.js'
|
|
4
8
|
import { IRequest, Kind as RequestKind, Request as RequestModel } from '../../models/Request.js'
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
IHttpResponseInit,
|
|
9
|
-
IHarTimingInit,
|
|
10
|
-
Internet,
|
|
11
|
-
IHttpPayloadInit,
|
|
12
|
-
} from '@pawel-up/data-mock'
|
|
1
|
+
import type { IDataMockInit, IHttpResponseInit, IHarTimingInit, IHttpPayloadInit } from '@pawel-up/data-mock/types.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
3
|
+
import { Time } from '@pawel-up/data-mock/Time.js'
|
|
4
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
5
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js'
|
|
6
|
+
import { Har } from '@pawel-up/data-mock/Har.js'
|
|
7
|
+
import Http from '@pawel-up/data-mock/Http.js'
|
|
13
8
|
import { IHttpResponse, HttpResponse } from '../../models/HttpResponse.js'
|
|
14
9
|
import { IResponse } from '../../models/Response.js'
|
|
15
10
|
import { IRequestsSize } from '../../models/RequestsSize.js'
|
package/src/mocking/lib/Url.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IDataMockInit } from '@pawel-up/data-mock/types.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
3
|
+
import { Time } from '@pawel-up/data-mock/Time.js'
|
|
4
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js'
|
|
2
5
|
import { IUrl } from '../../models/Url.js'
|
|
3
6
|
|
|
4
7
|
export class Url {
|
package/src/mocking/lib/User.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IDataMockInit } from '@pawel-up/data-mock/types.js'
|
|
2
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
3
|
+
import { Person } from '@pawel-up/data-mock/Person.js'
|
|
4
|
+
import { Internet } from '@pawel-up/data-mock/Internet.js'
|
|
5
|
+
import { Random } from '@pawel-up/data-mock/Random.js'
|
|
2
6
|
import { IUser, Kind as UserKind } from '../../models/store/User.js'
|
|
3
7
|
|
|
4
8
|
export interface IUserInit {
|
|
@@ -7,7 +7,6 @@ import { observed, retargetChange, toRaw } from './observed.js'
|
|
|
7
7
|
import type { DomainEntity } from './DomainEntity.js'
|
|
8
8
|
import type { IApiAssociationShape, IApiPropertyShape } from '../amf/definitions/Shapes.js'
|
|
9
9
|
import type { AssociationBinding, AssociationBindings, AssociationWebBindings } from './Bindings.js'
|
|
10
|
-
import { Json } from '@api-client/json'
|
|
11
10
|
import { DomainAttributeAttribute, DomainAttributeAttributes } from './DataFormat.js'
|
|
12
11
|
import type { AssociationTarget, DomainGraphEdge } from './types.js'
|
|
13
12
|
import { ShapeGenerator } from './amf/ShapeGenerator.js'
|
|
@@ -222,7 +221,7 @@ export class DomainAssociation extends DomainElement {
|
|
|
222
221
|
info: this.info.toJSON(),
|
|
223
222
|
}
|
|
224
223
|
if (this.schema) {
|
|
225
|
-
result.schema =
|
|
224
|
+
result.schema = structuredClone(toRaw(this, this.schema))
|
|
226
225
|
}
|
|
227
226
|
if (typeof this.multiple === 'boolean') {
|
|
228
227
|
result.multiple = this.multiple
|
|
@@ -231,7 +230,7 @@ export class DomainAssociation extends DomainElement {
|
|
|
231
230
|
result.required = this.required
|
|
232
231
|
}
|
|
233
232
|
if (Array.isArray(this.bindings) && this.bindings.length) {
|
|
234
|
-
result.bindings = (toRaw(this, this.bindings) as AssociationBinding[]).map((i) =>
|
|
233
|
+
result.bindings = (toRaw(this, this.bindings) as AssociationBinding[]).map((i) => structuredClone(i))
|
|
235
234
|
}
|
|
236
235
|
if (Array.isArray(this.targets) && this.targets.length) {
|
|
237
236
|
result.targets = (toRaw(this, this.targets) as AssociationTarget[]).map((i) => ({ ...i }))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { JsonEdge, Node } from '@api-client/graph/graph/types.js'
|
|
2
|
+
import { Graph } from '@api-client/graph/graph/Graph.js'
|
|
2
3
|
import type { DataDomainGraph, DomainGraphEdge, DomainGraphNodeType, SerializedGraph } from './types.js'
|
|
3
4
|
import {
|
|
4
5
|
DomainAssociationKind,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JsonEdge, Node } from '@api-client/graph'
|
|
1
|
+
import type { JsonEdge, Node } from '@api-client/graph/graph/types.js'
|
|
2
2
|
import type { DataDomain, DataDomainSchema } from './DataDomain.js'
|
|
3
3
|
import type { DomainGraphEdge, DataDomainGraph, SerializedGraph } from './types.js'
|
|
4
4
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Json } from '@api-client/json'
|
|
2
1
|
import { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js'
|
|
3
2
|
import { IApiAssociationShape, IApiPropertyShape } from '../../amf/definitions/Shapes.js'
|
|
4
3
|
import { nanoid } from 'nanoid'
|
|
@@ -253,7 +252,7 @@ export class DataAssociation {
|
|
|
253
252
|
this.info = Thing.fromName('')
|
|
254
253
|
}
|
|
255
254
|
if (schema) {
|
|
256
|
-
this.schema =
|
|
255
|
+
this.schema = structuredClone(schema)
|
|
257
256
|
} else {
|
|
258
257
|
this.schema = undefined
|
|
259
258
|
}
|
|
@@ -273,7 +272,7 @@ export class DataAssociation {
|
|
|
273
272
|
this.targets = []
|
|
274
273
|
}
|
|
275
274
|
if (Array.isArray(bindings)) {
|
|
276
|
-
this.bindings = bindings.map((i) =>
|
|
275
|
+
this.bindings = bindings.map((i) => structuredClone(i))
|
|
277
276
|
} else {
|
|
278
277
|
this.bindings = []
|
|
279
278
|
}
|
|
@@ -330,7 +329,7 @@ export class DataAssociation {
|
|
|
330
329
|
info: this.info.toJSON(),
|
|
331
330
|
}
|
|
332
331
|
if (this.schema) {
|
|
333
|
-
result.schema =
|
|
332
|
+
result.schema = structuredClone(this.schema)
|
|
334
333
|
}
|
|
335
334
|
if (typeof this.multiple === 'boolean') {
|
|
336
335
|
result.multiple = this.multiple
|
|
@@ -342,7 +341,7 @@ export class DataAssociation {
|
|
|
342
341
|
result.targets = this.targets.map((i) => ({ ...i }))
|
|
343
342
|
}
|
|
344
343
|
if (Array.isArray(this.bindings) && this.bindings.length) {
|
|
345
|
-
result.bindings = this.bindings.map((i) =>
|
|
344
|
+
result.bindings = this.bindings.map((i) => structuredClone(i))
|
|
346
345
|
}
|
|
347
346
|
return result
|
|
348
347
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Json } from '@api-client/json'
|
|
2
1
|
import { IThing, Thing } from '../../models/Thing.js'
|
|
3
2
|
import { nanoid } from 'nanoid'
|
|
4
3
|
import { DataNamespace } from './DataNamespace.js'
|
|
@@ -387,12 +386,12 @@ export class DataProperty {
|
|
|
387
386
|
this.taxonomy = []
|
|
388
387
|
}
|
|
389
388
|
if (schema) {
|
|
390
|
-
this.schema =
|
|
389
|
+
this.schema = structuredClone(schema)
|
|
391
390
|
} else {
|
|
392
391
|
this.schema = undefined
|
|
393
392
|
}
|
|
394
393
|
if (Array.isArray(bindings)) {
|
|
395
|
-
this.bindings = bindings.map((i) =>
|
|
394
|
+
this.bindings = bindings.map((i) => structuredClone(i))
|
|
396
395
|
} else {
|
|
397
396
|
this.bindings = []
|
|
398
397
|
}
|
|
@@ -441,10 +440,10 @@ export class DataProperty {
|
|
|
441
440
|
result.taxonomy = [...this.taxonomy]
|
|
442
441
|
}
|
|
443
442
|
if (this.schema) {
|
|
444
|
-
result.schema =
|
|
443
|
+
result.schema = structuredClone(this.schema)
|
|
445
444
|
}
|
|
446
445
|
if (Array.isArray(this.bindings) && this.bindings.length) {
|
|
447
|
-
result.bindings = this.bindings.map((i) =>
|
|
446
|
+
result.bindings = this.bindings.map((i) => structuredClone(i))
|
|
448
447
|
}
|
|
449
448
|
return result
|
|
450
449
|
}
|
package/src/modeling/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GraphJson } from '@api-client/graph/graph/types.js'
|
|
2
|
+
import type { Graph } from '@api-client/graph/graph/Graph.js'
|
|
2
3
|
import type { DomainAssociation } from './DomainAssociation.js'
|
|
3
4
|
import type { DomainEntity } from './DomainEntity.js'
|
|
4
5
|
import type { DomainModel } from './DomainModel.js'
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Json } from '@api-client/json'
|
|
2
1
|
import { IRequestLog } from './RequestLog.js'
|
|
3
2
|
|
|
4
3
|
export const Kind = 'Core#ProjectExecution'
|
|
@@ -166,7 +165,7 @@ export class ProjectExecution implements IProjectExecution {
|
|
|
166
165
|
const { started = Date.now(), midnight, project, user, key, app, ended = started, iterations, parent } = init
|
|
167
166
|
this.started = started
|
|
168
167
|
this.ended = ended
|
|
169
|
-
this.iterations = iterations.map((i) =>
|
|
168
|
+
this.iterations = iterations.map((i) => structuredClone(i))
|
|
170
169
|
if (key) {
|
|
171
170
|
this.key = key
|
|
172
171
|
} else {
|
|
@@ -206,7 +205,7 @@ export class ProjectExecution implements IProjectExecution {
|
|
|
206
205
|
project: this.project,
|
|
207
206
|
app: this.app,
|
|
208
207
|
ended: this.ended,
|
|
209
|
-
iterations: this.iterations.map((i) =>
|
|
208
|
+
iterations: this.iterations.map((i) => structuredClone(i)),
|
|
210
209
|
started: this.started,
|
|
211
210
|
}
|
|
212
211
|
if (this.parent) {
|
package/src/models/Request.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Json } from '@api-client/json'
|
|
2
1
|
import { IRequestConfig, RequestConfig } from './RequestConfig.js'
|
|
3
2
|
import { Thing, IThing } from './Thing.js'
|
|
4
3
|
import { HttpCertificate, Certificate } from './ClientCertificate.js'
|
|
@@ -384,12 +383,12 @@ export class Request {
|
|
|
384
383
|
this.midnight = midnight
|
|
385
384
|
}
|
|
386
385
|
if (Array.isArray(flows)) {
|
|
387
|
-
this.flows = flows.map((i) =>
|
|
386
|
+
this.flows = flows.map((i) => structuredClone(i))
|
|
388
387
|
} else {
|
|
389
388
|
this.flows = undefined
|
|
390
389
|
}
|
|
391
390
|
if (Array.isArray(assertions)) {
|
|
392
|
-
this.assertions = assertions.map((i) =>
|
|
391
|
+
this.assertions = assertions.map((i) => structuredClone(i))
|
|
393
392
|
} else {
|
|
394
393
|
this.assertions = undefined
|
|
395
394
|
}
|
|
@@ -419,10 +418,10 @@ export class Request {
|
|
|
419
418
|
result.authorization = this.authorization.map((i) => i.toJSON())
|
|
420
419
|
}
|
|
421
420
|
if (Array.isArray(this.flows)) {
|
|
422
|
-
result.flows = this.flows.map((i) =>
|
|
421
|
+
result.flows = this.flows.map((i) => structuredClone(i))
|
|
423
422
|
}
|
|
424
423
|
if (Array.isArray(this.assertions)) {
|
|
425
|
-
result.assertions = this.assertions.map((i) =>
|
|
424
|
+
result.assertions = this.assertions.map((i) => structuredClone(i))
|
|
426
425
|
}
|
|
427
426
|
if (this.clientCertificate) {
|
|
428
427
|
result.clientCertificate = this.clientCertificate.toJSON()
|
package/src/patch/PatchClient.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Operation
|
|
1
|
+
import type { Operation } from '@api-client/json/patch/types.js'
|
|
2
|
+
import { JsonDocument } from '@api-client/json/patch/json_document.js'
|
|
2
3
|
import { nanoid } from 'nanoid'
|
|
3
4
|
import type { MediaPatchInfo, PatchInfo } from './types.js'
|
|
4
5
|
|
package/src/patch/types.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Router, Request, Response } from 'express'
|
|
2
|
+
import { Lorem } from '@pawel-up/data-mock/Lorem.js'
|
|
3
|
+
import { Types } from '@pawel-up/data-mock/Types.js'
|
|
2
4
|
import { BaseApi } from './BaseApi.js'
|
|
3
5
|
import cors from 'cors'
|
|
4
|
-
import { DataMock } from '@pawel-up/data-mock'
|
|
5
6
|
|
|
6
7
|
const router = Router()
|
|
7
8
|
export default router
|
|
8
9
|
|
|
9
10
|
class StreamRoute extends BaseApi {
|
|
10
|
-
#
|
|
11
|
+
#lorem = new Lorem()
|
|
12
|
+
#types = new Types()
|
|
11
13
|
|
|
12
14
|
async index(req: Request, res: Response): Promise<void> {
|
|
13
15
|
res.writeHead(200, {
|
|
@@ -17,7 +19,7 @@ class StreamRoute extends BaseApi {
|
|
|
17
19
|
this.#writeChunk(res)
|
|
18
20
|
let time = 0
|
|
19
21
|
for (let i = 0; i < 4; i++) {
|
|
20
|
-
const timeout = this.#
|
|
22
|
+
const timeout = this.#types.number({ min: 1, max: 10 })
|
|
21
23
|
time += timeout
|
|
22
24
|
setTimeout(() => this.#writeChunk(res), timeout)
|
|
23
25
|
}
|
|
@@ -28,7 +30,7 @@ class StreamRoute extends BaseApi {
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
#writeChunk(res: Response): void {
|
|
31
|
-
const word = this.#
|
|
33
|
+
const word = this.#lorem.word({ length: 128 })
|
|
32
34
|
res.write(`${word}\n`)
|
|
33
35
|
}
|
|
34
36
|
}
|