@conduit-client/model 3.13.0 → 3.13.1
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/dist/types/v1/api/endpoint.d.ts +1 -1
- package/dist/types/v1/api/validation/bindings.d.ts +1 -1
- package/dist/types/v1/api/validation/endpoint/index.d.ts +1 -1
- package/dist/types/v1/api/validation/index.d.ts +1 -1
- package/dist/types/v1/api/validation/operation/BodyDataValidator.d.ts +2 -2
- package/dist/types/v1/api/validation/operation/InvalidationValidator.d.ts +6 -4
- package/dist/types/v1/api/validation/operation/KeyMatchValidator.d.ts +1 -1
- package/dist/types/v1/api/validation/operation/KeySourceValidator.d.ts +3 -3
- package/dist/types/v1/api/validation/operation/NoNormalizedTypesValidator.d.ts +1 -1
- package/dist/types/v1/api/validation/operation/Response200Validator.d.ts +1 -1
- package/dist/types/v1/api/validation/operation/index.d.ts +2 -2
- package/dist/types/v1/api/validation/operation/utils.d.ts +3 -2
- package/dist/types/v1/parser/amf/endpoints/amf-operation.d.ts +2 -2
- package/dist/types/v1/parser/amf/types/AMFDiscriminatedObjectType.d.ts +3 -2
- package/dist/types/v1/parser/parser-utils.d.ts +1 -1
- package/dist/types/v1/parser/swagger/SwaggerAPI.d.ts +3 -2
- package/dist/types/v1/parser/swagger/endpoints/swagger-operation.d.ts +2 -2
- package/dist/types/v1/parser/swagger/version.d.ts +1 -1
- package/dist/types/v1/parser/zod-schemas.d.ts +2 -2
- package/dist/types/v1/types/types-equal.d.ts +1 -1
- package/dist/types/v1/types/utils.d.ts +1 -1
- package/dist/types/v1/types/validators/extensions/KeyFieldReferenceValidator.d.ts +1 -1
- package/dist/types/v1/types/validators/extensions/KeySourcesValidator.d.ts +2 -2
- package/dist/v1/index.js +184 -184
- package/dist/v1/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -87,7 +87,7 @@ export type BaseOperation<ResponseType extends Type = Type, RequestType extends
|
|
|
87
87
|
defaults: API['defaults'];
|
|
88
88
|
serviceOverrides: ResolvedOperationServices;
|
|
89
89
|
};
|
|
90
|
-
export type BaseOperationWithRequestBody<ResponseType extends Type = Type, RequestType extends Type = Type> = BaseOperation & {
|
|
90
|
+
export type BaseOperationWithRequestBody<ResponseType extends Type = Type, RequestType extends Type = Type> = BaseOperation<ResponseType, RequestType> & {
|
|
91
91
|
configBodyParam: string;
|
|
92
92
|
};
|
|
93
93
|
export type BaseAuraOperation = BaseOperation & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ValidationResult, type Validator } from '../../validation';
|
|
2
|
-
import { API, Operation } from '..';
|
|
2
|
+
import type { API, Operation } from '..';
|
|
3
3
|
export declare class BindingsValidation<S extends API = API> implements Validator<S, Operation> {
|
|
4
4
|
constructor();
|
|
5
5
|
validate(api: S): ValidationResult<Operation>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import type { Validator } from '../../../validation';
|
|
1
2
|
import type { API, EndPoint, Operation, Type } from '../../..';
|
|
2
|
-
import { Validator } from '../../../validation';
|
|
3
3
|
export declare function buildEndpointValidator(api: API): Validator<EndPoint, EndPoint | Operation | Type>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { API } from '../api';
|
|
2
1
|
import { type Validator } from '../../validation';
|
|
2
|
+
import type { API } from '../api';
|
|
3
3
|
import type { Type } from '../../types';
|
|
4
4
|
import type { EndPoint, Operation } from '../endpoint';
|
|
5
5
|
type MessageSourceTypes = API | Type | EndPoint | Operation;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { KeySourcesValidator } from '../../../types/validators/extensions';
|
|
2
|
+
import type { Validator } from '../../../validation';
|
|
1
3
|
import type { Operation, Type, Request, Response } from '../../..';
|
|
2
|
-
import { Validator } from '../../../validation';
|
|
3
|
-
import { KeySourcesValidator } from '../../../types/validators/extensions';
|
|
4
4
|
/**
|
|
5
5
|
* Validates the body of a request or response supports a key path
|
|
6
6
|
*/
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { type Response } from '../../endpoint';
|
|
2
|
+
import { type ReadOnlyTypeRegistry } from '../../..';
|
|
3
|
+
import type { ValidationMessage, Validator } from '../../../validation';
|
|
4
|
+
import type { Operation } from '../../endpoint';
|
|
5
|
+
import type { Type } from '../../..';
|
|
6
|
+
import type { BodyDataValidator } from './BodyDataValidator';
|
|
5
7
|
/**
|
|
6
8
|
* Validates the configuration of 'invalidation'
|
|
7
9
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { ValidationMessage, Validator } from '../../../validation';
|
|
1
2
|
import type { Operation, ReadOnlyTypeRegistry } from '../../..';
|
|
2
|
-
import { ValidationMessage, Validator } from '../../../validation';
|
|
3
3
|
export declare class KeyMatchValidator<T extends Operation = Operation> implements Validator<T, Operation> {
|
|
4
4
|
private types;
|
|
5
5
|
constructor(types: ReadOnlyTypeRegistry);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ValidationMessage, type Validator } from '../../../validation';
|
|
2
|
-
import { Operation, Parameter, QueryParameter, Request } from '../../endpoint';
|
|
3
|
-
import { Type } from '../../..';
|
|
4
|
-
import { BodyDataValidator } from './BodyDataValidator';
|
|
2
|
+
import type { Operation, Parameter, QueryParameter, Request } from '../../endpoint';
|
|
3
|
+
import type { Type } from '../../..';
|
|
4
|
+
import type { BodyDataValidator } from './BodyDataValidator';
|
|
5
5
|
type KeyBySourceCollection = {
|
|
6
6
|
path: string[];
|
|
7
7
|
query: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { ValidationMessage, Validator } from '../../../validation';
|
|
1
2
|
import type { Operation, ReadOnlyTypeRegistry, Type } from '../../..';
|
|
2
|
-
import { ValidationMessage, Validator } from '../../../validation';
|
|
3
3
|
/**
|
|
4
4
|
* Validates that if an operation is not normalized, its responses payloads has
|
|
5
5
|
* NO references to identifiable (i.e., normalized) types
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Validator } from '../../../validation';
|
|
2
|
+
import type { API, Operation, Type } from '../../..';
|
|
3
3
|
export declare function buildOperationValidator(api: API): Validator<Operation, Operation | Type>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ValidationSeverity } from '../../../validation';
|
|
2
|
+
import type { NormalizedOperation, Operation } from '../../endpoint';
|
|
3
|
+
import type { ValidationMessage } from '../../../validation';
|
|
3
4
|
export declare function isNormalizedOperation(operation: Operation): operation is NormalizedOperation;
|
|
4
5
|
export declare function getFormattedMessage<T = Operation>(subject: T, message: string, severity?: ValidationSeverity): ValidationMessage<T>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type LoggerService, type FileParserLogger } from '@conduit-client/utils';
|
|
2
|
+
import { type ResolvedOperationServices } from '../../../api/service-overrides';
|
|
3
|
+
import { OperationSchemaBuilder } from '../../zod-schemas';
|
|
2
4
|
import type amf from 'amf-client-js';
|
|
3
5
|
import type { BaseAuraOperation, AuraOperationWithRequestBody, BaseOperation, HttpMethod, Parameter, Payload, Request, Response, CacheStrategy, ConfigSchemaType, OperationType, ErrorStrategy, Binding, BaseHttpOperation, HttpOperationWithRequestBody, BaseGraphQLOperation } from '../../../api/endpoint';
|
|
4
6
|
import type { AMFType, AMFTypeFactory } from '../types';
|
|
5
7
|
import type { TypeRegistry } from '../../../types';
|
|
6
8
|
import type { AmfEndPoint } from './amf-endpoint';
|
|
7
9
|
import type { API, Server } from '../../../api';
|
|
8
|
-
import { type ResolvedOperationServices } from '../../../api/service-overrides';
|
|
9
|
-
import { OperationSchemaBuilder } from '../../zod-schemas';
|
|
10
10
|
export declare abstract class AmfBaseOperation implements BaseOperation {
|
|
11
11
|
protected amfOperation: amf.Operation;
|
|
12
12
|
protected amfTypeFactory: AMFTypeFactory;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type AMFType, type AMFTypeFactory } from './index';
|
|
2
|
+
import { AMFBaseType } from './AMFBaseType';
|
|
3
|
+
import type { AMFObjectType, AMFTypeProps } from './index';
|
|
2
4
|
import type amf from 'amf-client-js';
|
|
3
5
|
import type { DiscriminatedObjectType, Type, TypeRegistry } from '../../../types';
|
|
4
6
|
import type { API } from '../../../api';
|
|
5
7
|
import type { FileParserLogger, LoggerService } from '@conduit-client/utils';
|
|
6
|
-
import { AMFBaseType } from './AMFBaseType';
|
|
7
8
|
export type AMFDiscriminatedObjectType = AMFTypeProps<amf.NodeShape> & DiscriminatedObjectType;
|
|
8
9
|
export declare class AMFDiscriminatedObjectTypeImpl extends AMFBaseType<'discriminatedObject', amf.NodeShape> implements AMFDiscriminatedObjectType {
|
|
9
10
|
shape: amf.NodeShape;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type FileParserLogger, type NamedLoggerService } from '@conduit-client/utils';
|
|
2
|
-
import { type SwaggerType } from './types';
|
|
3
2
|
import { type ResolvedServiceOverrides } from '../../api/service-overrides';
|
|
4
|
-
import {
|
|
3
|
+
import { type SwaggerType } from './types';
|
|
4
|
+
import { type Position } from './source-position-map';
|
|
5
|
+
import type { SourcePositionMap } from './source-position-map';
|
|
5
6
|
import type { API, EndPoint, Server } from '../../api';
|
|
6
7
|
import type { ReadOnlyTypeRegistry, TypeRegistry } from '../../types';
|
|
7
8
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type LoggerService, type FileParserLogger } from '@conduit-client/utils';
|
|
2
|
+
import { type ResolvedOperationServices } from '../../../api/service-overrides';
|
|
3
|
+
import { OperationSchemaBuilder } from '../../zod-schemas';
|
|
2
4
|
import type { Position } from '../source-position-map';
|
|
3
5
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
6
|
import type { BaseAuraOperation, AuraOperationWithRequestBody, BaseOperation, HttpMethod, Request, Response, CacheStrategy, ConfigSchemaType, OperationType, ErrorStrategy, Binding, BaseHttpOperation, HttpOperationWithRequestBody, BaseGraphQLOperation } from '../../../api/endpoint';
|
|
@@ -6,8 +8,6 @@ import type { SwaggerType, SwaggerTypeFactory } from '../types';
|
|
|
6
8
|
import type { TypeRegistry } from '../../../types';
|
|
7
9
|
import type { SwaggerEndPoint } from './swagger-endpoint';
|
|
8
10
|
import type { API, Server } from '../../../api';
|
|
9
|
-
import { type ResolvedOperationServices } from '../../../api/service-overrides';
|
|
10
|
-
import { OperationSchemaBuilder } from '../../zod-schemas';
|
|
11
11
|
export declare abstract class SwaggerBaseOperation implements BaseOperation {
|
|
12
12
|
protected operation: OpenAPIV3.OperationObject;
|
|
13
13
|
protected methodStr: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { CacheStrategy } from '../api';
|
|
3
|
-
import { HttpMethod } from '../api/endpoint';
|
|
2
|
+
import type { CacheStrategy } from '../api';
|
|
3
|
+
import type { HttpMethod } from '../api/endpoint';
|
|
4
4
|
export declare const rootExtensionSchema: z.ZodObject<{
|
|
5
5
|
onestore: z.ZodObject<{
|
|
6
6
|
version: z.ZodEffects<z.ZodString, import("@conduit-client/utils").Version, string>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Type } from './Type';
|
|
1
|
+
import type { Type } from './Type';
|
|
2
2
|
export declare function typesEqual(a: Type, b: Type): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AllOfType, AnyType, ArrayType, BooleanType, DateTimeOnlyType, DateTimeType, DateType, DiscriminatedObjectType, DoubleType, EnumType, IdentifiableType, IntegerType, NilType, NotType, NumberType, ObjectType, OneOf, RefType, ScalarType, StringType, TimeType, Type } from './Type';
|
|
1
|
+
import type { AllOfType, AnyType, ArrayType, BooleanType, DateTimeOnlyType, DateTimeType, DateType, DiscriminatedObjectType, DoubleType, EnumType, IdentifiableType, IntegerType, NilType, NotType, NumberType, ObjectType, OneOf, RefType, ScalarType, StringType, TimeType, Type } from './Type';
|
|
2
2
|
export declare function isRefType(type: Type): type is RefType;
|
|
3
3
|
export declare function isNilType(type: Type): type is NilType;
|
|
4
4
|
export declare function isBooleanType(type: Type): type is BooleanType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Validator } from '../../../validation';
|
|
2
|
+
import type { KeySourcesValidator } from './KeySourcesValidator';
|
|
2
3
|
import type { Type } from '../../Type';
|
|
3
|
-
import { KeySourcesValidator } from './KeySourcesValidator';
|
|
4
4
|
/**
|
|
5
5
|
* Validates that the fields in a key are valid.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ValidationResult, Validator } from '../../../validation';
|
|
1
|
+
import type { ValidationResult, Validator } from '../../../validation';
|
|
2
2
|
import type { Type } from '../../Type';
|
|
3
|
-
import { ReadOnlyTypeRegistry } from '../../TypeRegistry';
|
|
3
|
+
import type { ReadOnlyTypeRegistry } from '../../TypeRegistry';
|
|
4
4
|
/**
|
|
5
5
|
* Validates that sources used by a types key are valid
|
|
6
6
|
*/
|
package/dist/v1/index.js
CHANGED
|
@@ -139,6 +139,32 @@ function stringIsVersion(s) {
|
|
|
139
139
|
const versionParts = s.split(".");
|
|
140
140
|
return (versionParts.length === 2 || versionParts.length === 3) && versionParts.every((part) => part.match(/^\d+$/));
|
|
141
141
|
}
|
|
142
|
+
var ValidationType = /* @__PURE__ */ ((ValidationType2) => {
|
|
143
|
+
ValidationType2["Api"] = "api";
|
|
144
|
+
ValidationType2["Type"] = "type";
|
|
145
|
+
ValidationType2["Operation"] = "operation";
|
|
146
|
+
ValidationType2["EndPoint"] = "endpoint";
|
|
147
|
+
return ValidationType2;
|
|
148
|
+
})(ValidationType || {});
|
|
149
|
+
var ValidationSeverity = /* @__PURE__ */ ((ValidationSeverity2) => {
|
|
150
|
+
ValidationSeverity2["Info"] = "info";
|
|
151
|
+
ValidationSeverity2["Warning"] = "warn";
|
|
152
|
+
ValidationSeverity2["Error"] = "error";
|
|
153
|
+
return ValidationSeverity2;
|
|
154
|
+
})(ValidationSeverity || {});
|
|
155
|
+
function combineValidationResults(results) {
|
|
156
|
+
const isValid2 = results.every((r) => r.isOk());
|
|
157
|
+
const messages = results.map((r) => r.isOk() ? r.value : r.error).flat();
|
|
158
|
+
return isValid2 ? ok(messages) : err(messages);
|
|
159
|
+
}
|
|
160
|
+
function compose(validators) {
|
|
161
|
+
return {
|
|
162
|
+
validate(subject) {
|
|
163
|
+
const results = validators.map((v) => v.validate(subject));
|
|
164
|
+
return combineValidationResults(results);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
142
168
|
function isRefType(type) {
|
|
143
169
|
return type.type === "ref";
|
|
144
170
|
}
|
|
@@ -247,32 +273,6 @@ class KeyFieldReferenceValidator {
|
|
|
247
273
|
return ok([]);
|
|
248
274
|
}
|
|
249
275
|
}
|
|
250
|
-
var ValidationType = /* @__PURE__ */ ((ValidationType2) => {
|
|
251
|
-
ValidationType2["Api"] = "api";
|
|
252
|
-
ValidationType2["Type"] = "type";
|
|
253
|
-
ValidationType2["Operation"] = "operation";
|
|
254
|
-
ValidationType2["EndPoint"] = "endpoint";
|
|
255
|
-
return ValidationType2;
|
|
256
|
-
})(ValidationType || {});
|
|
257
|
-
var ValidationSeverity = /* @__PURE__ */ ((ValidationSeverity2) => {
|
|
258
|
-
ValidationSeverity2["Info"] = "info";
|
|
259
|
-
ValidationSeverity2["Warning"] = "warn";
|
|
260
|
-
ValidationSeverity2["Error"] = "error";
|
|
261
|
-
return ValidationSeverity2;
|
|
262
|
-
})(ValidationSeverity || {});
|
|
263
|
-
function combineValidationResults(results) {
|
|
264
|
-
const isValid2 = results.every((r) => r.isOk());
|
|
265
|
-
const messages = results.map((r) => r.isOk() ? r.value : r.error).flat();
|
|
266
|
-
return isValid2 ? ok(messages) : err(messages);
|
|
267
|
-
}
|
|
268
|
-
function compose(validators) {
|
|
269
|
-
return {
|
|
270
|
-
validate(subject) {
|
|
271
|
-
const results = validators.map((v) => v.validate(subject));
|
|
272
|
-
return combineValidationResults(results);
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
276
|
function getFormattedMessage$1(subject, message, severity = ValidationSeverity.Error) {
|
|
277
277
|
return {
|
|
278
278
|
validationType: ValidationType.Type,
|
|
@@ -5385,161 +5385,6 @@ function formatZodError(err2) {
|
|
|
5385
5385
|
});
|
|
5386
5386
|
return `${formattedIssues.map((iss) => `- ${iss}`).join("\n")}`;
|
|
5387
5387
|
}
|
|
5388
|
-
const STRING_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#string";
|
|
5389
|
-
const BOOLEAN_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#boolean";
|
|
5390
|
-
const INTEGER_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#integer";
|
|
5391
|
-
const LONG_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#long";
|
|
5392
|
-
const FLOAT_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#float";
|
|
5393
|
-
const DOUBLE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#double";
|
|
5394
|
-
const NUMBER_DATA_TYPE = "http://a.ml/vocabularies/shapes#number";
|
|
5395
|
-
const DATE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#date";
|
|
5396
|
-
const TIME_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#time";
|
|
5397
|
-
const PASSWORD_DATA_TYPE = "http://a.ml/vocabularies/shapes#password";
|
|
5398
|
-
const BYTE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#byte";
|
|
5399
|
-
const BINARY_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#base64Binary";
|
|
5400
|
-
const DATETIME_ONLY_TYPE = "http://a.ml/vocabularies/shapes#dateTimeOnly";
|
|
5401
|
-
const DATETIME_TYPE = "http://www.w3.org/2001/XMLSchema#dateTime";
|
|
5402
|
-
const DATATYPE_TO_SCALAR_TYPE = {
|
|
5403
|
-
[BOOLEAN_DATA_TYPE]: "boolean",
|
|
5404
|
-
[DOUBLE_DATA_TYPE]: "double",
|
|
5405
|
-
[FLOAT_DATA_TYPE]: "number",
|
|
5406
|
-
[INTEGER_DATA_TYPE]: "integer",
|
|
5407
|
-
[LONG_DATA_TYPE]: "integer",
|
|
5408
|
-
[NUMBER_DATA_TYPE]: "number",
|
|
5409
|
-
[STRING_DATA_TYPE]: "string",
|
|
5410
|
-
[DATE_DATA_TYPE]: "date",
|
|
5411
|
-
[TIME_DATA_TYPE]: "time",
|
|
5412
|
-
[PASSWORD_DATA_TYPE]: "string",
|
|
5413
|
-
[BYTE_DATA_TYPE]: "string",
|
|
5414
|
-
[BINARY_DATA_TYPE]: "string",
|
|
5415
|
-
[DATETIME_ONLY_TYPE]: "datetime-only",
|
|
5416
|
-
[DATETIME_TYPE]: "datetime"
|
|
5417
|
-
};
|
|
5418
|
-
function isTypeShape(domainElement) {
|
|
5419
|
-
return domainElement instanceof amf.AnyShape;
|
|
5420
|
-
}
|
|
5421
|
-
function isAnyShape(domainElement) {
|
|
5422
|
-
return Object.getPrototypeOf(domainElement) === amf.AnyShape.prototype;
|
|
5423
|
-
}
|
|
5424
|
-
function isNilShape(shape) {
|
|
5425
|
-
return shape instanceof amf.NilShape;
|
|
5426
|
-
}
|
|
5427
|
-
function isNodeShape(node) {
|
|
5428
|
-
return node instanceof amf.NodeShape;
|
|
5429
|
-
}
|
|
5430
|
-
function isArrayShape(node) {
|
|
5431
|
-
return node instanceof amf.ArrayShape;
|
|
5432
|
-
}
|
|
5433
|
-
function isScalarShape(shape) {
|
|
5434
|
-
return shape instanceof amf.ScalarShape;
|
|
5435
|
-
}
|
|
5436
|
-
function isRefShape(shape) {
|
|
5437
|
-
return shape.isLink;
|
|
5438
|
-
}
|
|
5439
|
-
function isAnyOfShape(shape) {
|
|
5440
|
-
return (shape.or || []).length > 0;
|
|
5441
|
-
}
|
|
5442
|
-
function isOneOfShape(shape) {
|
|
5443
|
-
const isAmfOneOfShape = shape instanceof amf.UnionShape;
|
|
5444
|
-
const hasOneOf = (shape.xone || []).length > 0;
|
|
5445
|
-
const isDiscriminatedObject = isNodeShape(shape) && !shape.discriminator.isNullOrEmpty;
|
|
5446
|
-
return isAmfOneOfShape || hasOneOf && !isDiscriminatedObject;
|
|
5447
|
-
}
|
|
5448
|
-
function isAllOfShape(shape) {
|
|
5449
|
-
return (shape.and || []).length > 0 || isOneOfShape(shape) && !(shape instanceof amf.UnionShape) || isEnumShape(shape);
|
|
5450
|
-
}
|
|
5451
|
-
function isNotShape(shape) {
|
|
5452
|
-
return !!shape.not;
|
|
5453
|
-
}
|
|
5454
|
-
function isScalarNode(node) {
|
|
5455
|
-
return node instanceof amf.ScalarNode;
|
|
5456
|
-
}
|
|
5457
|
-
function isEnumShape(shape) {
|
|
5458
|
-
return shape.values.length > 0;
|
|
5459
|
-
}
|
|
5460
|
-
function getEnumValuesFromShape(shape) {
|
|
5461
|
-
return shape.values.map((val) => extractScalarEnumValue(val, shape));
|
|
5462
|
-
}
|
|
5463
|
-
function extractScalarEnumValue(node, parentShape) {
|
|
5464
|
-
if (isScalarNode(node)) {
|
|
5465
|
-
const scalarType = DATATYPE_TO_SCALAR_TYPE[node.dataType.value()];
|
|
5466
|
-
switch (scalarType) {
|
|
5467
|
-
case "datetime":
|
|
5468
|
-
return String(node.value.value());
|
|
5469
|
-
default:
|
|
5470
|
-
return coerceValueByType(node.value.value(), {
|
|
5471
|
-
type: scalarType
|
|
5472
|
-
});
|
|
5473
|
-
}
|
|
5474
|
-
} else {
|
|
5475
|
-
throw new Error(
|
|
5476
|
-
`Invalid non-scalar enum value provided for shape ${parentShape.name.value()}`
|
|
5477
|
-
);
|
|
5478
|
-
}
|
|
5479
|
-
}
|
|
5480
|
-
function coerceValueByType(value, type) {
|
|
5481
|
-
switch (type.type) {
|
|
5482
|
-
case "string":
|
|
5483
|
-
return String(value);
|
|
5484
|
-
case "boolean":
|
|
5485
|
-
return value === "true";
|
|
5486
|
-
case "number":
|
|
5487
|
-
case "double":
|
|
5488
|
-
case "integer":
|
|
5489
|
-
return Number(value);
|
|
5490
|
-
default:
|
|
5491
|
-
return value;
|
|
5492
|
-
}
|
|
5493
|
-
}
|
|
5494
|
-
const DATA_SCALAR_PROPERTY_NAME = "http://a.ml/vocabularies/data#Scalar";
|
|
5495
|
-
const DATA_OBJECT_PROPERTY_NAME = "http://a.ml/vocabularies/data#Object";
|
|
5496
|
-
const DATA_ARRAY_PROPERTY_NAME = "http://a.ml/vocabularies/data#Array";
|
|
5497
|
-
const DATA_DATATYPE_PROPERTY_NAME = "http://www.w3.org/ns/shacl#datatype";
|
|
5498
|
-
const DATA_VALUE_PROPERTY_NAME = "http://a.ml/vocabularies/data#value";
|
|
5499
|
-
const NAME_PROPERTY_VALUE = "http://a.ml/vocabularies/core#name";
|
|
5500
|
-
function extractExtensions$1(customDomainProperties) {
|
|
5501
|
-
let extensions = {};
|
|
5502
|
-
(customDomainProperties || []).forEach((cdp) => {
|
|
5503
|
-
const name = cdp.name.value();
|
|
5504
|
-
const graph = cdp.extension.graph();
|
|
5505
|
-
extensions[name] = extractExtensionsFromGraph(graph);
|
|
5506
|
-
});
|
|
5507
|
-
return extensions;
|
|
5508
|
-
}
|
|
5509
|
-
function extractExtensionsFromGraph(graph) {
|
|
5510
|
-
if (isObject(graph)) {
|
|
5511
|
-
return buildExtensionsObject(graph);
|
|
5512
|
-
}
|
|
5513
|
-
if (isArray(graph)) {
|
|
5514
|
-
return buildExtensionsArray(graph);
|
|
5515
|
-
}
|
|
5516
|
-
if (isScalar$1(graph)) {
|
|
5517
|
-
return buildExtensionScalar(graph);
|
|
5518
|
-
}
|
|
5519
|
-
throw new Error(`Unsupported AMF graph type: ${graph.types()}`);
|
|
5520
|
-
}
|
|
5521
|
-
const isScalar$1 = (graph) => graph.types().includes(DATA_SCALAR_PROPERTY_NAME);
|
|
5522
|
-
const isObject = (graph) => graph.types().includes(DATA_OBJECT_PROPERTY_NAME);
|
|
5523
|
-
const isArray = (graph) => graph.types().includes(DATA_ARRAY_PROPERTY_NAME);
|
|
5524
|
-
function buildExtensionsObject(graph) {
|
|
5525
|
-
let extensions = {};
|
|
5526
|
-
graph.properties().filter((prop) => prop !== NAME_PROPERTY_VALUE).forEach((fullname) => {
|
|
5527
|
-
const name = fullname.split("#")[1];
|
|
5528
|
-
const propGraph = graph.getObjectByProperty(fullname)[0].graph();
|
|
5529
|
-
extensions[name] = extractExtensionsFromGraph(propGraph);
|
|
5530
|
-
});
|
|
5531
|
-
return extensions;
|
|
5532
|
-
}
|
|
5533
|
-
function buildExtensionsArray(graph) {
|
|
5534
|
-
const propertyUri = "http://www.w3.org/2000/01/rdf-schema#member";
|
|
5535
|
-
return graph.getObjectByProperty(propertyUri).map((item) => extractExtensionsFromGraph(item.graph()));
|
|
5536
|
-
}
|
|
5537
|
-
function buildExtensionScalar(graph) {
|
|
5538
|
-
const rawType = graph.scalarByProperty(DATA_DATATYPE_PROPERTY_NAME)[0];
|
|
5539
|
-
const rawValue = graph.scalarByProperty(DATA_VALUE_PROPERTY_NAME)[0];
|
|
5540
|
-
const value = [DOUBLE_DATA_TYPE, INTEGER_DATA_TYPE, NUMBER_DATA_TYPE].includes(rawType) ? Number(rawValue) : rawType === BOOLEAN_DATA_TYPE ? rawValue === "true" : String(rawValue);
|
|
5541
|
-
return value;
|
|
5542
|
-
}
|
|
5543
5388
|
const rootExtensionSchema = z.object({
|
|
5544
5389
|
onestore: z.object({
|
|
5545
5390
|
version: z.string().refine(stringIsVersion, () => {
|
|
@@ -5942,6 +5787,161 @@ class OperationSchemaBuilder {
|
|
|
5942
5787
|
);
|
|
5943
5788
|
}
|
|
5944
5789
|
}
|
|
5790
|
+
const STRING_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#string";
|
|
5791
|
+
const BOOLEAN_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#boolean";
|
|
5792
|
+
const INTEGER_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#integer";
|
|
5793
|
+
const LONG_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#long";
|
|
5794
|
+
const FLOAT_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#float";
|
|
5795
|
+
const DOUBLE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#double";
|
|
5796
|
+
const NUMBER_DATA_TYPE = "http://a.ml/vocabularies/shapes#number";
|
|
5797
|
+
const DATE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#date";
|
|
5798
|
+
const TIME_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#time";
|
|
5799
|
+
const PASSWORD_DATA_TYPE = "http://a.ml/vocabularies/shapes#password";
|
|
5800
|
+
const BYTE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#byte";
|
|
5801
|
+
const BINARY_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#base64Binary";
|
|
5802
|
+
const DATETIME_ONLY_TYPE = "http://a.ml/vocabularies/shapes#dateTimeOnly";
|
|
5803
|
+
const DATETIME_TYPE = "http://www.w3.org/2001/XMLSchema#dateTime";
|
|
5804
|
+
const DATATYPE_TO_SCALAR_TYPE = {
|
|
5805
|
+
[BOOLEAN_DATA_TYPE]: "boolean",
|
|
5806
|
+
[DOUBLE_DATA_TYPE]: "double",
|
|
5807
|
+
[FLOAT_DATA_TYPE]: "number",
|
|
5808
|
+
[INTEGER_DATA_TYPE]: "integer",
|
|
5809
|
+
[LONG_DATA_TYPE]: "integer",
|
|
5810
|
+
[NUMBER_DATA_TYPE]: "number",
|
|
5811
|
+
[STRING_DATA_TYPE]: "string",
|
|
5812
|
+
[DATE_DATA_TYPE]: "date",
|
|
5813
|
+
[TIME_DATA_TYPE]: "time",
|
|
5814
|
+
[PASSWORD_DATA_TYPE]: "string",
|
|
5815
|
+
[BYTE_DATA_TYPE]: "string",
|
|
5816
|
+
[BINARY_DATA_TYPE]: "string",
|
|
5817
|
+
[DATETIME_ONLY_TYPE]: "datetime-only",
|
|
5818
|
+
[DATETIME_TYPE]: "datetime"
|
|
5819
|
+
};
|
|
5820
|
+
function isTypeShape(domainElement) {
|
|
5821
|
+
return domainElement instanceof amf.AnyShape;
|
|
5822
|
+
}
|
|
5823
|
+
function isAnyShape(domainElement) {
|
|
5824
|
+
return Object.getPrototypeOf(domainElement) === amf.AnyShape.prototype;
|
|
5825
|
+
}
|
|
5826
|
+
function isNilShape(shape) {
|
|
5827
|
+
return shape instanceof amf.NilShape;
|
|
5828
|
+
}
|
|
5829
|
+
function isNodeShape(node) {
|
|
5830
|
+
return node instanceof amf.NodeShape;
|
|
5831
|
+
}
|
|
5832
|
+
function isArrayShape(node) {
|
|
5833
|
+
return node instanceof amf.ArrayShape;
|
|
5834
|
+
}
|
|
5835
|
+
function isScalarShape(shape) {
|
|
5836
|
+
return shape instanceof amf.ScalarShape;
|
|
5837
|
+
}
|
|
5838
|
+
function isRefShape(shape) {
|
|
5839
|
+
return shape.isLink;
|
|
5840
|
+
}
|
|
5841
|
+
function isAnyOfShape(shape) {
|
|
5842
|
+
return (shape.or || []).length > 0;
|
|
5843
|
+
}
|
|
5844
|
+
function isOneOfShape(shape) {
|
|
5845
|
+
const isAmfOneOfShape = shape instanceof amf.UnionShape;
|
|
5846
|
+
const hasOneOf = (shape.xone || []).length > 0;
|
|
5847
|
+
const isDiscriminatedObject = isNodeShape(shape) && !shape.discriminator.isNullOrEmpty;
|
|
5848
|
+
return isAmfOneOfShape || hasOneOf && !isDiscriminatedObject;
|
|
5849
|
+
}
|
|
5850
|
+
function isAllOfShape(shape) {
|
|
5851
|
+
return (shape.and || []).length > 0 || isOneOfShape(shape) && !(shape instanceof amf.UnionShape) || isEnumShape(shape);
|
|
5852
|
+
}
|
|
5853
|
+
function isNotShape(shape) {
|
|
5854
|
+
return !!shape.not;
|
|
5855
|
+
}
|
|
5856
|
+
function isScalarNode(node) {
|
|
5857
|
+
return node instanceof amf.ScalarNode;
|
|
5858
|
+
}
|
|
5859
|
+
function isEnumShape(shape) {
|
|
5860
|
+
return shape.values.length > 0;
|
|
5861
|
+
}
|
|
5862
|
+
function getEnumValuesFromShape(shape) {
|
|
5863
|
+
return shape.values.map((val) => extractScalarEnumValue(val, shape));
|
|
5864
|
+
}
|
|
5865
|
+
function extractScalarEnumValue(node, parentShape) {
|
|
5866
|
+
if (isScalarNode(node)) {
|
|
5867
|
+
const scalarType = DATATYPE_TO_SCALAR_TYPE[node.dataType.value()];
|
|
5868
|
+
switch (scalarType) {
|
|
5869
|
+
case "datetime":
|
|
5870
|
+
return String(node.value.value());
|
|
5871
|
+
default:
|
|
5872
|
+
return coerceValueByType(node.value.value(), {
|
|
5873
|
+
type: scalarType
|
|
5874
|
+
});
|
|
5875
|
+
}
|
|
5876
|
+
} else {
|
|
5877
|
+
throw new Error(
|
|
5878
|
+
`Invalid non-scalar enum value provided for shape ${parentShape.name.value()}`
|
|
5879
|
+
);
|
|
5880
|
+
}
|
|
5881
|
+
}
|
|
5882
|
+
function coerceValueByType(value, type) {
|
|
5883
|
+
switch (type.type) {
|
|
5884
|
+
case "string":
|
|
5885
|
+
return String(value);
|
|
5886
|
+
case "boolean":
|
|
5887
|
+
return value === "true";
|
|
5888
|
+
case "number":
|
|
5889
|
+
case "double":
|
|
5890
|
+
case "integer":
|
|
5891
|
+
return Number(value);
|
|
5892
|
+
default:
|
|
5893
|
+
return value;
|
|
5894
|
+
}
|
|
5895
|
+
}
|
|
5896
|
+
const DATA_SCALAR_PROPERTY_NAME = "http://a.ml/vocabularies/data#Scalar";
|
|
5897
|
+
const DATA_OBJECT_PROPERTY_NAME = "http://a.ml/vocabularies/data#Object";
|
|
5898
|
+
const DATA_ARRAY_PROPERTY_NAME = "http://a.ml/vocabularies/data#Array";
|
|
5899
|
+
const DATA_DATATYPE_PROPERTY_NAME = "http://www.w3.org/ns/shacl#datatype";
|
|
5900
|
+
const DATA_VALUE_PROPERTY_NAME = "http://a.ml/vocabularies/data#value";
|
|
5901
|
+
const NAME_PROPERTY_VALUE = "http://a.ml/vocabularies/core#name";
|
|
5902
|
+
function extractExtensions$1(customDomainProperties) {
|
|
5903
|
+
let extensions = {};
|
|
5904
|
+
(customDomainProperties || []).forEach((cdp) => {
|
|
5905
|
+
const name = cdp.name.value();
|
|
5906
|
+
const graph = cdp.extension.graph();
|
|
5907
|
+
extensions[name] = extractExtensionsFromGraph(graph);
|
|
5908
|
+
});
|
|
5909
|
+
return extensions;
|
|
5910
|
+
}
|
|
5911
|
+
function extractExtensionsFromGraph(graph) {
|
|
5912
|
+
if (isObject(graph)) {
|
|
5913
|
+
return buildExtensionsObject(graph);
|
|
5914
|
+
}
|
|
5915
|
+
if (isArray(graph)) {
|
|
5916
|
+
return buildExtensionsArray(graph);
|
|
5917
|
+
}
|
|
5918
|
+
if (isScalar$1(graph)) {
|
|
5919
|
+
return buildExtensionScalar(graph);
|
|
5920
|
+
}
|
|
5921
|
+
throw new Error(`Unsupported AMF graph type: ${graph.types()}`);
|
|
5922
|
+
}
|
|
5923
|
+
const isScalar$1 = (graph) => graph.types().includes(DATA_SCALAR_PROPERTY_NAME);
|
|
5924
|
+
const isObject = (graph) => graph.types().includes(DATA_OBJECT_PROPERTY_NAME);
|
|
5925
|
+
const isArray = (graph) => graph.types().includes(DATA_ARRAY_PROPERTY_NAME);
|
|
5926
|
+
function buildExtensionsObject(graph) {
|
|
5927
|
+
let extensions = {};
|
|
5928
|
+
graph.properties().filter((prop) => prop !== NAME_PROPERTY_VALUE).forEach((fullname) => {
|
|
5929
|
+
const name = fullname.split("#")[1];
|
|
5930
|
+
const propGraph = graph.getObjectByProperty(fullname)[0].graph();
|
|
5931
|
+
extensions[name] = extractExtensionsFromGraph(propGraph);
|
|
5932
|
+
});
|
|
5933
|
+
return extensions;
|
|
5934
|
+
}
|
|
5935
|
+
function buildExtensionsArray(graph) {
|
|
5936
|
+
const propertyUri = "http://www.w3.org/2000/01/rdf-schema#member";
|
|
5937
|
+
return graph.getObjectByProperty(propertyUri).map((item) => extractExtensionsFromGraph(item.graph()));
|
|
5938
|
+
}
|
|
5939
|
+
function buildExtensionScalar(graph) {
|
|
5940
|
+
const rawType = graph.scalarByProperty(DATA_DATATYPE_PROPERTY_NAME)[0];
|
|
5941
|
+
const rawValue = graph.scalarByProperty(DATA_VALUE_PROPERTY_NAME)[0];
|
|
5942
|
+
const value = [DOUBLE_DATA_TYPE, INTEGER_DATA_TYPE, NUMBER_DATA_TYPE].includes(rawType) ? Number(rawValue) : rawType === BOOLEAN_DATA_TYPE ? rawValue === "true" : String(rawValue);
|
|
5943
|
+
return value;
|
|
5944
|
+
}
|
|
5945
5945
|
class AmfBaseOperation {
|
|
5946
5946
|
constructor(amfOperation, amfTypeFactory2, typeRegistry, logger, fileParserLogger, endpoint, server) {
|
|
5947
5947
|
this.amfOperation = amfOperation;
|
|
@@ -6667,7 +6667,7 @@ class AMFAllOfTypeImpl extends AMFBaseType {
|
|
|
6667
6667
|
).values()
|
|
6668
6668
|
];
|
|
6669
6669
|
if (discriminatedParents.length === 0) {
|
|
6670
|
-
return;
|
|
6670
|
+
return void 0;
|
|
6671
6671
|
}
|
|
6672
6672
|
if (discriminatedParents.length > 1) {
|
|
6673
6673
|
const { line = 0, column = 0 } = ((_a = this.shape.position) == null ? void 0 : _a.start) || {};
|
|
@@ -13895,7 +13895,7 @@ class SwaggerAllOfTypeImpl extends SwaggerBaseType {
|
|
|
13895
13895
|
).values()
|
|
13896
13896
|
];
|
|
13897
13897
|
if (discriminatedParents.length === 0) {
|
|
13898
|
-
return;
|
|
13898
|
+
return void 0;
|
|
13899
13899
|
}
|
|
13900
13900
|
if (discriminatedParents.length > 1) {
|
|
13901
13901
|
this.fileParserLogger.error(
|
|
@@ -14933,7 +14933,7 @@ servers:
|
|
|
14933
14933
|
this._servers = servers.map((server) => {
|
|
14934
14934
|
const uriParameters = {};
|
|
14935
14935
|
if (server.variables) {
|
|
14936
|
-
for (const
|
|
14936
|
+
for (const name of Object.keys(server.variables)) {
|
|
14937
14937
|
uriParameters[name] = {
|
|
14938
14938
|
required: true,
|
|
14939
14939
|
type: { type: "string" },
|