@goatlab/fluent 0.7.38 → 0.7.40
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/BaseConnector.d.ts +112 -0
- package/dist/BaseConnector.js +343 -0
- package/dist/BaseConnector.js.map +1 -0
- package/dist/Fluent.d.ts +11 -0
- package/dist/Fluent.js +27 -0
- package/dist/Fluent.js.map +1 -0
- package/dist/FluentConnectorInterface.d.ts +17 -0
- package/dist/FluentConnectorInterface.js +3 -0
- package/dist/FluentConnectorInterface.js.map +1 -0
- package/dist/FluentEntity.d.ts +7 -0
- package/dist/FluentEntity.js +29 -0
- package/dist/FluentEntity.js.map +1 -0
- package/dist/TypeOrmConnector/TypeOrmConnector.d.ts +123 -0
- package/dist/TypeOrmConnector/TypeOrmConnector.js +760 -0
- package/dist/TypeOrmConnector/TypeOrmConnector.js.map +1 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoBaseAggregations.d.ts +12 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoBaseAggregations.js +167 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoBaseAggregations.js.map +1 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoFindAggregatedQuery.d.ts +11 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoFindAggregatedQuery.js +52 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoFindAggregatedQuery.js.map +1 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoOrderBy.d.ts +4 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoOrderBy.js +20 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoOrderBy.js.map +1 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoSelect.d.ts +7 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoSelect.js +19 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoSelect.js.map +1 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoWhere.d.ts +11 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoWhere.js +173 -0
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoWhere.js.map +1 -0
- package/dist/TypeOrmConnector/queryBuilder/sql/getQueryBuilderWhere.d.ts +13 -0
- package/dist/TypeOrmConnector/queryBuilder/sql/getQueryBuilderWhere.js +207 -0
- package/dist/TypeOrmConnector/queryBuilder/sql/getQueryBuilderWhere.js.map +1 -0
- package/dist/TypeOrmConnector/queryBuilder/sql/getTypeOrmWhere.d.ts +11 -0
- package/dist/TypeOrmConnector/queryBuilder/sql/getTypeOrmWhere.js +214 -0
- package/dist/TypeOrmConnector/queryBuilder/sql/getTypeOrmWhere.js.map +1 -0
- package/dist/TypeOrmConnector/util/clearEmpties.d.ts +7 -0
- package/dist/TypeOrmConnector/util/clearEmpties.js +33 -0
- package/dist/TypeOrmConnector/util/clearEmpties.js.map +1 -0
- package/dist/TypeOrmConnector/util/extractConditions.d.ts +12 -0
- package/dist/TypeOrmConnector/util/extractConditions.js +89 -0
- package/dist/TypeOrmConnector/util/extractConditions.js.map +1 -0
- package/dist/TypeOrmConnector/util/extractInclude.d.ts +2 -0
- package/dist/TypeOrmConnector/util/extractInclude.js +26 -0
- package/dist/TypeOrmConnector/util/extractInclude.js.map +1 -0
- package/dist/TypeOrmConnector/util/extractMetadataFromKeys.d.ts +12 -0
- package/dist/TypeOrmConnector/util/extractMetadataFromKeys.js +49 -0
- package/dist/TypeOrmConnector/util/extractMetadataFromKeys.js.map +1 -0
- package/dist/TypeOrmConnector/util/extractOrderBy.d.ts +2 -0
- package/dist/TypeOrmConnector/util/extractOrderBy.js +24 -0
- package/dist/TypeOrmConnector/util/extractOrderBy.js.map +1 -0
- package/dist/TypeOrmConnector/util/getRelationsFromModelGenerator.d.ts +19 -0
- package/dist/TypeOrmConnector/util/getRelationsFromModelGenerator.js +27 -0
- package/dist/TypeOrmConnector/util/getRelationsFromModelGenerator.js.map +1 -0
- package/dist/TypeOrmConnector/util/getSelectedKeysFromRawSql.d.ts +6 -0
- package/dist/TypeOrmConnector/util/getSelectedKeysFromRawSql.js +29 -0
- package/dist/TypeOrmConnector/util/getSelectedKeysFromRawSql.js.map +1 -0
- package/dist/TypeOrmConnector/util/isAnyObject.d.ts +1 -0
- package/dist/TypeOrmConnector/util/isAnyObject.js +8 -0
- package/dist/TypeOrmConnector/util/isAnyObject.js.map +1 -0
- package/dist/TypeOrmConnector/util/nestQueryResults.d.ts +2 -0
- package/dist/TypeOrmConnector/util/nestQueryResults.js +38 -0
- package/dist/TypeOrmConnector/util/nestQueryResults.js.map +1 -0
- package/dist/core/Loopback/build-schema.d.ts +148 -0
- package/dist/core/Loopback/build-schema.js +443 -0
- package/dist/core/Loopback/build-schema.js.map +1 -0
- package/dist/core/Loopback/common-types.d.ts +96 -0
- package/dist/core/Loopback/common-types.js +24 -0
- package/dist/core/Loopback/common-types.js.map +1 -0
- package/dist/core/Loopback/json-to-schema.d.ts +41 -0
- package/dist/core/Loopback/json-to-schema.js +113 -0
- package/dist/core/Loopback/json-to-schema.js.map +1 -0
- package/dist/core/Loopback/metadata.d.ts +16 -0
- package/dist/core/Loopback/metadata.js +49 -0
- package/dist/core/Loopback/metadata.js.map +1 -0
- package/dist/core/Loopback/model.d.ts +233 -0
- package/dist/core/Loopback/model.js +387 -0
- package/dist/core/Loopback/model.js.map +1 -0
- package/dist/core/Loopback/query.d.ts +394 -0
- package/dist/core/Loopback/query.js +482 -0
- package/dist/core/Loopback/query.js.map +1 -0
- package/dist/core/Loopback/relation.types.d.ts +141 -0
- package/dist/core/Loopback/relation.types.js +18 -0
- package/dist/core/Loopback/relation.types.js.map +1 -0
- package/dist/core/Loopback/type-resolver.d.ts +42 -0
- package/dist/core/Loopback/type-resolver.js +60 -0
- package/dist/core/Loopback/type-resolver.js.map +1 -0
- package/dist/core/Loopback/type.d.ts +38 -0
- package/dist/core/Loopback/type.js +7 -0
- package/dist/core/Loopback/type.js.map +1 -0
- package/dist/core/Nestjs/applyDecorators.d.ts +10 -0
- package/dist/core/Nestjs/applyDecorators.js +26 -0
- package/dist/core/Nestjs/applyDecorators.js.map +1 -0
- package/dist/core/Nestjs/types/common.d.ts +16 -0
- package/dist/core/Nestjs/types/common.js +38 -0
- package/dist/core/Nestjs/types/common.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/api-hide-property.decorator.d.ts +1 -0
- package/dist/core/Nestjs/types/decorators/api-hide-property.decorator.js +8 -0
- package/dist/core/Nestjs/types/decorators/api-hide-property.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/api-property.decorator.d.ts +27 -0
- package/dist/core/Nestjs/types/decorators/api-property.decorator.js +66 -0
- package/dist/core/Nestjs/types/decorators/api-property.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/apply-is-optional.decorator.d.ts +5 -0
- package/dist/core/Nestjs/types/decorators/apply-is-optional.decorator.js +136 -0
- package/dist/core/Nestjs/types/decorators/apply-is-optional.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/args-type.decorator.d.ts +4 -0
- package/dist/core/Nestjs/types/decorators/args-type.decorator.js +24 -0
- package/dist/core/Nestjs/types/decorators/args-type.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/create-property.decorator.d.ts +2 -0
- package/dist/core/Nestjs/types/decorators/create-property.decorator.js +55 -0
- package/dist/core/Nestjs/types/decorators/create-property.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/directive.decorator.d.ts +4 -0
- package/dist/core/Nestjs/types/decorators/directive.decorator.js +39 -0
- package/dist/core/Nestjs/types/decorators/directive.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/extensions.decorator.d.ts +4 -0
- package/dist/core/Nestjs/types/decorators/extensions.decorator.js +28 -0
- package/dist/core/Nestjs/types/decorators/extensions.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/field.decorator.d.ts +48 -0
- package/dist/core/Nestjs/types/decorators/field.decorator.js +63 -0
- package/dist/core/Nestjs/types/decorators/field.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/input-type.decorator.d.ts +25 -0
- package/dist/core/Nestjs/types/decorators/input-type.decorator.js +29 -0
- package/dist/core/Nestjs/types/decorators/input-type.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/interface-type.decorator.d.ts +33 -0
- package/dist/core/Nestjs/types/decorators/interface-type.decorator.js +35 -0
- package/dist/core/Nestjs/types/decorators/interface-type.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/decorators/partial-type.helper.d.ts +3 -0
- package/dist/core/Nestjs/types/decorators/partial-type.helper.js +46 -0
- package/dist/core/Nestjs/types/decorators/partial-type.helper.js.map +1 -0
- package/dist/core/Nestjs/types/errors/cannot-determine-host-type.error.d.ts +3 -0
- package/dist/core/Nestjs/types/errors/cannot-determine-host-type.error.js +10 -0
- package/dist/core/Nestjs/types/errors/cannot-determine-host-type.error.js.map +1 -0
- package/dist/core/Nestjs/types/errors/directive-parsing.error.d.ts +3 -0
- package/dist/core/Nestjs/types/errors/directive-parsing.error.js +10 -0
- package/dist/core/Nestjs/types/errors/directive-parsing.error.js.map +1 -0
- package/dist/core/Nestjs/types/errors/unable-to-find-fields.error.d.ts +3 -0
- package/dist/core/Nestjs/types/errors/unable-to-find-fields.error.js +10 -0
- package/dist/core/Nestjs/types/errors/unable-to-find-fields.error.js.map +1 -0
- package/dist/core/Nestjs/types/errors/undefined-type.error.d.ts +3 -0
- package/dist/core/Nestjs/types/errors/undefined-type.error.js +11 -0
- package/dist/core/Nestjs/types/errors/undefined-type.error.js.map +1 -0
- package/dist/core/Nestjs/types/interfaces/add-class-type-metadata.util.d.ts +3 -0
- package/dist/core/Nestjs/types/interfaces/add-class-type-metadata.util.js +11 -0
- package/dist/core/Nestjs/types/interfaces/add-class-type-metadata.util.js.map +1 -0
- package/dist/core/Nestjs/types/interfaces/base-type-options.interface.d.ts +11 -0
- package/dist/core/Nestjs/types/interfaces/base-type-options.interface.js +3 -0
- package/dist/core/Nestjs/types/interfaces/base-type-options.interface.js.map +1 -0
- package/dist/core/Nestjs/types/interfaces/class-decorator-factory.interface.d.ts +5 -0
- package/dist/core/Nestjs/types/interfaces/class-decorator-factory.interface.js +3 -0
- package/dist/core/Nestjs/types/interfaces/class-decorator-factory.interface.js.map +1 -0
- package/dist/core/Nestjs/types/interfaces/complexity.interface.d.ts +11 -0
- package/dist/core/Nestjs/types/interfaces/complexity.interface.js +3 -0
- package/dist/core/Nestjs/types/interfaces/complexity.interface.js.map +1 -0
- package/dist/core/Nestjs/types/interfaces/field-middleware.interface.d.ts +15 -0
- package/dist/core/Nestjs/types/interfaces/field-middleware.interface.js +3 -0
- package/dist/core/Nestjs/types/interfaces/field-middleware.interface.js.map +1 -0
- package/dist/core/Nestjs/types/interfaces/open-api-spec.interface.d.ts +239 -0
- package/dist/core/Nestjs/types/interfaces/open-api-spec.interface.js +7 -0
- package/dist/core/Nestjs/types/interfaces/open-api-spec.interface.js.map +1 -0
- package/dist/core/Nestjs/types/interfaces/resolve-type-fn.interface.d.ts +2 -0
- package/dist/core/Nestjs/types/interfaces/resolve-type-fn.interface.js +3 -0
- package/dist/core/Nestjs/types/interfaces/resolve-type-fn.interface.js.map +1 -0
- package/dist/core/Nestjs/types/interfaces/return-type-func.interface.d.ts +5 -0
- package/dist/core/Nestjs/types/interfaces/return-type-func.interface.js +3 -0
- package/dist/core/Nestjs/types/interfaces/return-type-func.interface.js.map +1 -0
- package/dist/core/Nestjs/types/interfaces/schema-object-metadata.interface.d.ts +9 -0
- package/dist/core/Nestjs/types/interfaces/schema-object-metadata.interface.js +3 -0
- package/dist/core/Nestjs/types/interfaces/schema-object-metadata.interface.js.map +1 -0
- package/dist/core/Nestjs/types/interfaces/type-options.interface.d.ts +5 -0
- package/dist/core/Nestjs/types/interfaces/type-options.interface.js +3 -0
- package/dist/core/Nestjs/types/interfaces/type-options.interface.js.map +1 -0
- package/dist/core/Nestjs/types/lazy-metadata.storage.d.ts +15 -0
- package/dist/core/Nestjs/types/lazy-metadata.storage.js +68 -0
- package/dist/core/Nestjs/types/lazy-metadata.storage.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/class.metadata.d.ts +11 -0
- package/dist/core/Nestjs/types/metadata/class.metadata.js +3 -0
- package/dist/core/Nestjs/types/metadata/class.metadata.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/directive.metadata.d.ts +8 -0
- package/dist/core/Nestjs/types/metadata/directive.metadata.js +3 -0
- package/dist/core/Nestjs/types/metadata/directive.metadata.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/enum.metadata.d.ts +11 -0
- package/dist/core/Nestjs/types/metadata/enum.metadata.js +3 -0
- package/dist/core/Nestjs/types/metadata/enum.metadata.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/extensions.metadata.d.ts +8 -0
- package/dist/core/Nestjs/types/metadata/extensions.metadata.js +3 -0
- package/dist/core/Nestjs/types/metadata/extensions.metadata.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/index.d.ts +8 -0
- package/dist/core/Nestjs/types/metadata/index.js +12 -0
- package/dist/core/Nestjs/types/metadata/index.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/interface.metadata.d.ts +6 -0
- package/dist/core/Nestjs/types/metadata/interface.metadata.js +3 -0
- package/dist/core/Nestjs/types/metadata/interface.metadata.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/object-type.metadata.d.ts +4 -0
- package/dist/core/Nestjs/types/metadata/object-type.metadata.js +3 -0
- package/dist/core/Nestjs/types/metadata/object-type.metadata.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/param.metadata.d.ts +18 -0
- package/dist/core/Nestjs/types/metadata/param.metadata.js +3 -0
- package/dist/core/Nestjs/types/metadata/param.metadata.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/property.metadata.d.ts +20 -0
- package/dist/core/Nestjs/types/metadata/property.metadata.js +3 -0
- package/dist/core/Nestjs/types/metadata/property.metadata.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/resolver.metadata.d.ts +34 -0
- package/dist/core/Nestjs/types/metadata/resolver.metadata.js +3 -0
- package/dist/core/Nestjs/types/metadata/resolver.metadata.js.map +1 -0
- package/dist/core/Nestjs/types/metadata/union.metadata.d.ts +9 -0
- package/dist/core/Nestjs/types/metadata/union.metadata.js +3 -0
- package/dist/core/Nestjs/types/metadata/union.metadata.js.map +1 -0
- package/dist/core/Nestjs/types/object-type.decorator.d.ts +32 -0
- package/dist/core/Nestjs/types/object-type.decorator.js +33 -0
- package/dist/core/Nestjs/types/object-type.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/omit-type.d.ts +2 -0
- package/dist/core/Nestjs/types/omit-type.js +34 -0
- package/dist/core/Nestjs/types/omit-type.js.map +1 -0
- package/dist/core/Nestjs/types/reflection.utils.d.ts +15 -0
- package/dist/core/Nestjs/types/reflection.utils.js +65 -0
- package/dist/core/Nestjs/types/reflection.utils.js.map +1 -0
- package/dist/core/Nestjs/types/set-metadata.decorator.d.ts +20 -0
- package/dist/core/Nestjs/types/set-metadata.decorator.js +33 -0
- package/dist/core/Nestjs/types/set-metadata.decorator.js.map +1 -0
- package/dist/core/Nestjs/types/type-metadata.storage.d.ts +73 -0
- package/dist/core/Nestjs/types/type-metadata.storage.js +351 -0
- package/dist/core/Nestjs/types/type-metadata.storage.js.map +1 -0
- package/dist/core/Nestjs/types/utils/enum.utils.d.ts +3 -0
- package/dist/core/Nestjs/types/utils/enum.utils.js +31 -0
- package/dist/core/Nestjs/types/utils/enum.utils.js.map +1 -0
- package/dist/core/Nestjs/types/utils/get-fields-and-decorator.util.d.ts +13 -0
- package/dist/core/Nestjs/types/utils/get-fields-and-decorator.util.js +72 -0
- package/dist/core/Nestjs/types/utils/get-fields-and-decorator.util.js.map +1 -0
- package/dist/core/Nestjs/types/utils/mapped-types.utils.d.ts +2 -0
- package/dist/core/Nestjs/types/utils/mapped-types.utils.js +38 -0
- package/dist/core/Nestjs/types/utils/mapped-types.utils.js.map +1 -0
- package/dist/core/Nestjs/types/utils/model-properties-accessor.d.ts +6 -0
- package/dist/core/Nestjs/types/utils/model-properties-accessor.js +37 -0
- package/dist/core/Nestjs/types/utils/model-properties-accessor.js.map +1 -0
- package/dist/core/Nestjs/types/utils/type-helpers.utils.d.ts +2 -0
- package/dist/core/Nestjs/types/utils/type-helpers.utils.js +16 -0
- package/dist/core/Nestjs/types/utils/type-helpers.utils.js.map +1 -0
- package/dist/core/types.d.ts +23 -0
- package/dist/core/types.js +31 -0
- package/dist/core/types.js.map +1 -0
- package/dist/decorators.d.ts +92 -0
- package/dist/decorators.js +162 -0
- package/dist/decorators.js.map +1 -0
- package/dist/generatorDatasource.d.ts +2 -0
- package/dist/generatorDatasource.js +13 -0
- package/dist/generatorDatasource.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/loadRelations.d.ts +12 -0
- package/dist/loadRelations.js +139 -0
- package/dist/loadRelations.js.map +1 -0
- package/dist/outputKeys.d.ts +2 -0
- package/dist/outputKeys.js +18 -0
- package/dist/outputKeys.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +104 -0
- package/dist/types.js +23 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -24
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JSON_SCHEMA_KEY = void 0;
|
|
4
|
+
exports.buildModelCacheKey = buildModelCacheKey;
|
|
5
|
+
exports.getJsonSchema = getJsonSchema;
|
|
6
|
+
exports.getJsonSchemaRef = getJsonSchemaRef;
|
|
7
|
+
exports.stringTypeToWrapper = stringTypeToWrapper;
|
|
8
|
+
exports.isArrayType = isArrayType;
|
|
9
|
+
exports.metaToJsonProperty = metaToJsonProperty;
|
|
10
|
+
exports.getNavigationalPropertyForRelation = getNavigationalPropertyForRelation;
|
|
11
|
+
exports.modelToJsonSchema = modelToJsonSchema;
|
|
12
|
+
// Copyright IBM Corp. 2018,2020. All Rights Reserved.
|
|
13
|
+
// Node module: @loopback/repository-json-schema
|
|
14
|
+
// This file is licensed under the MIT License.
|
|
15
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
16
|
+
const metadata_1 = require("@loopback/metadata");
|
|
17
|
+
const util_1 = require("util");
|
|
18
|
+
const type_resolver_1 = require("./type-resolver");
|
|
19
|
+
const metadata_2 = require("./metadata");
|
|
20
|
+
exports.JSON_SCHEMA_KEY = metadata_1.MetadataAccessor.create('loopback:json-schema');
|
|
21
|
+
const debug = console.log;
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
function buildModelCacheKey(options = {}) {
|
|
26
|
+
// Backwards compatibility: preserve cache key "modelOnly"
|
|
27
|
+
if (Object.keys(options).length === 0) {
|
|
28
|
+
return 'modelOnly';
|
|
29
|
+
}
|
|
30
|
+
// New key schema: use the same suffix as we use for schema title
|
|
31
|
+
// For example: "modelPartialWithRelations"
|
|
32
|
+
// Note this new key schema preserves the old key "modelWithRelations"
|
|
33
|
+
return `model${options.title ?? ''}${getTitleSuffix(options)}`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets the JSON Schema of a TypeScript model/class by seeing if one exists
|
|
37
|
+
* in a cache. If not, one is generated and then cached.
|
|
38
|
+
* @param ctor - Constructor of class to get JSON Schema from
|
|
39
|
+
*/
|
|
40
|
+
function getJsonSchema(ctor, options) {
|
|
41
|
+
// In the near future the metadata will be an object with
|
|
42
|
+
// different titles as keys
|
|
43
|
+
const cached = metadata_1.MetadataInspector.getClassMetadata(exports.JSON_SCHEMA_KEY, ctor, {
|
|
44
|
+
ownMetadataOnly: true
|
|
45
|
+
});
|
|
46
|
+
const key = buildModelCacheKey(options);
|
|
47
|
+
let schema = cached?.[key];
|
|
48
|
+
if (!schema) {
|
|
49
|
+
// Create new json schema from model
|
|
50
|
+
// if not found in cache for specific key
|
|
51
|
+
schema = modelToJsonSchema(ctor, options);
|
|
52
|
+
if (cached) {
|
|
53
|
+
// Add a new key to the cached schema of the model
|
|
54
|
+
cached[key] = schema;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// Define new metadata and set in cache
|
|
58
|
+
metadata_1.MetadataInspector.defineMetadata(exports.JSON_SCHEMA_KEY.key, { [key]: schema }, ctor);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return schema;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Describe the provided Model as a reference to a definition shared by multiple
|
|
65
|
+
* endpoints. The definition is included in the returned schema.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
*
|
|
69
|
+
* ```ts
|
|
70
|
+
* const schema = {
|
|
71
|
+
* $ref: '/definitions/Product',
|
|
72
|
+
* definitions: {
|
|
73
|
+
* Product: {
|
|
74
|
+
* title: 'Product',
|
|
75
|
+
* properties: {
|
|
76
|
+
* // etc.
|
|
77
|
+
* }
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @param modelCtor - The model constructor (e.g. `Product`)
|
|
84
|
+
* @param options - Additional options
|
|
85
|
+
*/
|
|
86
|
+
function getJsonSchemaRef(modelCtor, options) {
|
|
87
|
+
const schemaWithDefinitions = getJsonSchema(modelCtor, options);
|
|
88
|
+
const key = schemaWithDefinitions.title;
|
|
89
|
+
// ctor is not a model
|
|
90
|
+
if (!key)
|
|
91
|
+
return schemaWithDefinitions;
|
|
92
|
+
const definitions = { ...schemaWithDefinitions.definitions };
|
|
93
|
+
const schema = { ...schemaWithDefinitions };
|
|
94
|
+
delete schema.definitions;
|
|
95
|
+
definitions[key] = schema;
|
|
96
|
+
return {
|
|
97
|
+
$ref: `#/definitions/${key}`,
|
|
98
|
+
definitions
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Gets the wrapper function of primitives string, number, and boolean
|
|
103
|
+
* @param type - Name of type
|
|
104
|
+
*/
|
|
105
|
+
function stringTypeToWrapper(type) {
|
|
106
|
+
if (typeof type === 'function') {
|
|
107
|
+
return type;
|
|
108
|
+
}
|
|
109
|
+
type = type.toLowerCase();
|
|
110
|
+
let wrapper;
|
|
111
|
+
switch (type) {
|
|
112
|
+
case 'number': {
|
|
113
|
+
wrapper = Number;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case 'string': {
|
|
117
|
+
wrapper = String;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
case 'boolean': {
|
|
121
|
+
wrapper = Boolean;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case 'array': {
|
|
125
|
+
wrapper = Array;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case 'object':
|
|
129
|
+
case 'any': {
|
|
130
|
+
wrapper = Object;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case 'date': {
|
|
134
|
+
wrapper = Date;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case 'buffer': {
|
|
138
|
+
wrapper = Buffer;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case 'null': {
|
|
142
|
+
wrapper = type_resolver_1.Null;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
default: {
|
|
146
|
+
throw new Error(`Unsupported type: ${type}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return wrapper;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Determines whether a given string or constructor is array type or not
|
|
153
|
+
* @param type - Type as string or wrapper
|
|
154
|
+
*/
|
|
155
|
+
function isArrayType(type) {
|
|
156
|
+
return type === Array || type === 'array';
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Converts property metadata into a JSON property definition
|
|
160
|
+
* @param meta
|
|
161
|
+
*/
|
|
162
|
+
function metaToJsonProperty(meta) {
|
|
163
|
+
const propDef = {};
|
|
164
|
+
let result;
|
|
165
|
+
let propertyType = meta.type;
|
|
166
|
+
if (isArrayType(propertyType) && meta.itemType) {
|
|
167
|
+
if (isArrayType(meta.itemType) && !meta.jsonSchema) {
|
|
168
|
+
throw new Error('You must provide the "jsonSchema" field when define ' +
|
|
169
|
+
'a nested array property');
|
|
170
|
+
}
|
|
171
|
+
result = { type: 'array', items: propDef };
|
|
172
|
+
propertyType = meta.itemType;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
result = propDef;
|
|
176
|
+
}
|
|
177
|
+
const wrappedType = stringTypeToWrapper(propertyType);
|
|
178
|
+
const resolvedType = (0, type_resolver_1.resolveType)(wrappedType);
|
|
179
|
+
if (resolvedType === Date) {
|
|
180
|
+
Object.assign(propDef, {
|
|
181
|
+
type: 'string',
|
|
182
|
+
format: 'date-time'
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
else if (propertyType === 'any') {
|
|
186
|
+
// no-op, the json schema for any type is {}
|
|
187
|
+
}
|
|
188
|
+
else if ((0, type_resolver_1.isBuiltinType)(resolvedType)) {
|
|
189
|
+
Object.assign(propDef, {
|
|
190
|
+
type: resolvedType.name.toLowerCase()
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
Object.assign(propDef, { $ref: `#/definitions/${resolvedType.name}` });
|
|
195
|
+
}
|
|
196
|
+
if (meta.description) {
|
|
197
|
+
Object.assign(propDef, {
|
|
198
|
+
description: meta.description
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (meta.jsonSchema) {
|
|
202
|
+
Object.assign(propDef, meta.jsonSchema);
|
|
203
|
+
}
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Checks and return navigational property definition for the relation
|
|
208
|
+
* @param relMeta Relation metadata object
|
|
209
|
+
* @param targetRef Schema definition for the target model
|
|
210
|
+
*/
|
|
211
|
+
function getNavigationalPropertyForRelation(relMeta, targetRef) {
|
|
212
|
+
if (relMeta.targetsMany === true) {
|
|
213
|
+
// Targets an array of object, like, hasMany
|
|
214
|
+
return {
|
|
215
|
+
type: 'array',
|
|
216
|
+
items: targetRef
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
if (relMeta.targetsMany === false) {
|
|
220
|
+
// Targets single object, like, hasOne, belongsTo
|
|
221
|
+
return targetRef;
|
|
222
|
+
}
|
|
223
|
+
// targetsMany is undefined or null
|
|
224
|
+
// not allowed if includeRelations is true
|
|
225
|
+
throw new Error(`targetsMany attribute missing for ${relMeta.name}`);
|
|
226
|
+
}
|
|
227
|
+
function buildSchemaTitle(ctor, meta, options) {
|
|
228
|
+
if (options.title)
|
|
229
|
+
return options.title;
|
|
230
|
+
const title = meta.title || ctor.name;
|
|
231
|
+
return title + getTitleSuffix(options);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Checks the options and generates a descriptive suffix using compatible chars
|
|
235
|
+
* @param options json schema options
|
|
236
|
+
*/
|
|
237
|
+
function getTitleSuffix(options = {}) {
|
|
238
|
+
let suffix = '';
|
|
239
|
+
if (options.optional?.length) {
|
|
240
|
+
suffix += `Optional_${options.optional.join('-')}_`;
|
|
241
|
+
}
|
|
242
|
+
else if (options.partial) {
|
|
243
|
+
suffix += 'Partial';
|
|
244
|
+
}
|
|
245
|
+
if (options.exclude?.length) {
|
|
246
|
+
suffix += `Excluding_${options.exclude.join('-')}_`;
|
|
247
|
+
}
|
|
248
|
+
if (options.includeRelations) {
|
|
249
|
+
suffix += 'WithRelations';
|
|
250
|
+
}
|
|
251
|
+
return suffix;
|
|
252
|
+
}
|
|
253
|
+
function stringifyOptions(modelSettings = {}) {
|
|
254
|
+
return (0, util_1.inspect)(modelSettings, {
|
|
255
|
+
depth: Infinity,
|
|
256
|
+
maxArrayLength: Infinity,
|
|
257
|
+
breakLength: Infinity
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function isEmptyJson(obj) {
|
|
261
|
+
return !(obj && Object.keys(obj).length);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Checks the options and generates a descriptive suffix that contains the
|
|
265
|
+
* TypeScript type and options
|
|
266
|
+
* @param typeName - TypeScript's type name
|
|
267
|
+
* @param options - json schema options
|
|
268
|
+
*/
|
|
269
|
+
function getDescriptionSuffix(typeName, rawOptions = {}) {
|
|
270
|
+
const options = { ...rawOptions };
|
|
271
|
+
delete options.visited;
|
|
272
|
+
if (options.optional && !options.optional.length) {
|
|
273
|
+
delete options.optional;
|
|
274
|
+
}
|
|
275
|
+
const type = typeName;
|
|
276
|
+
let tsType = type;
|
|
277
|
+
if (options.includeRelations) {
|
|
278
|
+
tsType = `${type}WithRelations`;
|
|
279
|
+
}
|
|
280
|
+
if (options.partial) {
|
|
281
|
+
tsType = `Partial<${tsType}>`;
|
|
282
|
+
}
|
|
283
|
+
if (options.exclude) {
|
|
284
|
+
const excludedProps = options.exclude.map(p => `'${String(p)}'`);
|
|
285
|
+
tsType = `Omit<${tsType}, ${excludedProps.join(' | ')}>`;
|
|
286
|
+
}
|
|
287
|
+
if (options.optional) {
|
|
288
|
+
const optionalProps = options.optional.map(p => `'${String(p)}'`);
|
|
289
|
+
tsType = `@loopback/repository-json-schema#Optional<${tsType}, ${optionalProps.join(' | ')}>`;
|
|
290
|
+
}
|
|
291
|
+
return !isEmptyJson(options)
|
|
292
|
+
? `(tsType: ${tsType}, schemaOptions: ${stringifyOptions(options)})`
|
|
293
|
+
: '';
|
|
294
|
+
}
|
|
295
|
+
// NOTE(shimks) no metadata for: union, optional, nested array, any, enum,
|
|
296
|
+
// string literal, anonymous types, and inherited properties
|
|
297
|
+
/**
|
|
298
|
+
* Converts a TypeScript class into a JSON Schema using TypeScript's
|
|
299
|
+
* reflection API
|
|
300
|
+
* @param ctor - Constructor of class to convert from
|
|
301
|
+
*/
|
|
302
|
+
function modelToJsonSchema(ctor, jsonSchemaOptions = {}) {
|
|
303
|
+
const options = { ...jsonSchemaOptions };
|
|
304
|
+
options.visited = options.visited ?? {};
|
|
305
|
+
options.optional = options.optional ?? [];
|
|
306
|
+
const partial = options.partial && !options.optional.length;
|
|
307
|
+
if (options.partial && !partial) {
|
|
308
|
+
debug('Overriding "partial" option with "optional" option');
|
|
309
|
+
delete options.partial;
|
|
310
|
+
}
|
|
311
|
+
debug('Creating schema for model %s', ctor.name);
|
|
312
|
+
debug('JSON schema options: %o', options);
|
|
313
|
+
const modelDef = metadata_2.ModelMetadataHelper.getModelMetadata(ctor);
|
|
314
|
+
// returns an empty object if metadata is an empty object
|
|
315
|
+
if (modelDef == null || Object.keys(modelDef).length === 0) {
|
|
316
|
+
return {};
|
|
317
|
+
}
|
|
318
|
+
const meta = modelDef;
|
|
319
|
+
debug('Model settings', meta.settings);
|
|
320
|
+
const title = buildSchemaTitle(ctor, meta, options);
|
|
321
|
+
if (options.visited[title])
|
|
322
|
+
return options.visited[title];
|
|
323
|
+
const result = { title };
|
|
324
|
+
options.visited[title] = result;
|
|
325
|
+
result.type = 'object';
|
|
326
|
+
const descriptionSuffix = getDescriptionSuffix(ctor.name, options);
|
|
327
|
+
if (meta.description) {
|
|
328
|
+
const formatSuffix = descriptionSuffix ? ` ${descriptionSuffix}` : '';
|
|
329
|
+
result.description = meta.description + formatSuffix;
|
|
330
|
+
}
|
|
331
|
+
else if (descriptionSuffix) {
|
|
332
|
+
result.description = descriptionSuffix;
|
|
333
|
+
}
|
|
334
|
+
for (const p in meta.properties) {
|
|
335
|
+
if (options.exclude?.includes(p)) {
|
|
336
|
+
debug('Property % is excluded by %s', p, options.exclude);
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
if (meta.properties?.[p]?.type == null) {
|
|
340
|
+
// Circular import of model classes can lead to this situation
|
|
341
|
+
throw new Error(`Property ${ctor.name}.${p} does not have "type" in its definition`);
|
|
342
|
+
}
|
|
343
|
+
result.properties = result.properties ?? {};
|
|
344
|
+
result.properties[p] = result.properties[p] || {};
|
|
345
|
+
const metaProperty = { ...meta.properties[p] };
|
|
346
|
+
if (!metaProperty.type) {
|
|
347
|
+
throw new Error(`Property ${p} does not have a type`);
|
|
348
|
+
}
|
|
349
|
+
// populating "properties" key
|
|
350
|
+
result.properties[p] = metaToJsonProperty(metaProperty);
|
|
351
|
+
// handling 'required' metadata
|
|
352
|
+
const optional = options.optional.includes(p);
|
|
353
|
+
if (metaProperty.required && !(partial || optional)) {
|
|
354
|
+
result.required = result.required ?? [];
|
|
355
|
+
result.required.push(p);
|
|
356
|
+
}
|
|
357
|
+
// populating JSON Schema 'definitions'
|
|
358
|
+
// shimks: ugly type casting; this should be replaced by logic to throw
|
|
359
|
+
// error if itemType/type is not a string or a function
|
|
360
|
+
const resolvedType = (0, type_resolver_1.resolveType)(metaProperty.type);
|
|
361
|
+
const referenceType = isArrayType(resolvedType)
|
|
362
|
+
? // shimks: ugly type casting; this should be replaced by logic to throw
|
|
363
|
+
// error if itemType/type is not a string or a function
|
|
364
|
+
(0, type_resolver_1.resolveType)(metaProperty.itemType)
|
|
365
|
+
: resolvedType;
|
|
366
|
+
if (typeof referenceType !== 'function' || (0, type_resolver_1.isBuiltinType)(referenceType)) {
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
const propOptions = { ...options };
|
|
370
|
+
if (propOptions.partial !== 'deep') {
|
|
371
|
+
// Do not cascade `partial` to nested properties
|
|
372
|
+
delete propOptions.partial;
|
|
373
|
+
}
|
|
374
|
+
if (propOptions.includeRelations === true) {
|
|
375
|
+
// Do not cascade `includeRelations` to nested properties
|
|
376
|
+
delete propOptions.includeRelations;
|
|
377
|
+
}
|
|
378
|
+
// `title` is the unique identity of a schema,
|
|
379
|
+
// it should be removed from the `options`
|
|
380
|
+
// when generating the relation or property schemas
|
|
381
|
+
delete propOptions.title;
|
|
382
|
+
const propSchema = getJsonSchema(referenceType, propOptions);
|
|
383
|
+
// JSONSchema6Definition allows both boolean and JSONSchema6 types
|
|
384
|
+
if (typeof result.properties[p] !== 'boolean') {
|
|
385
|
+
const prop = result.properties[p];
|
|
386
|
+
const propTitle = propSchema.title ?? referenceType.name;
|
|
387
|
+
const targetRef = { $ref: `#/definitions/${propTitle}` };
|
|
388
|
+
if (prop.type === 'array' && prop.items) {
|
|
389
|
+
// Update $ref for array type
|
|
390
|
+
prop.items = targetRef;
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
result.properties[p] = targetRef;
|
|
394
|
+
}
|
|
395
|
+
includeReferencedSchema(propTitle, propSchema);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
result.additionalProperties = meta.settings.strict === false;
|
|
399
|
+
debug(' additionalProperties?', result.additionalProperties);
|
|
400
|
+
if (options.includeRelations) {
|
|
401
|
+
for (const r in meta.relations) {
|
|
402
|
+
result.properties = result.properties ?? {};
|
|
403
|
+
const relMeta = meta.relations[r];
|
|
404
|
+
if (!relMeta)
|
|
405
|
+
continue;
|
|
406
|
+
const targetType = (0, type_resolver_1.resolveType)(relMeta.target);
|
|
407
|
+
// `title` is the unique identity of a schema,
|
|
408
|
+
// it should be removed from the `options`
|
|
409
|
+
// when generating the relation or property schemas
|
|
410
|
+
const targetOptions = { ...options };
|
|
411
|
+
delete targetOptions.title;
|
|
412
|
+
const targetSchema = getJsonSchema(targetType, targetOptions);
|
|
413
|
+
const targetRef = { $ref: `#/definitions/${targetSchema.title}` };
|
|
414
|
+
const propDef = getNavigationalPropertyForRelation(relMeta, targetRef);
|
|
415
|
+
result.properties[relMeta.name] =
|
|
416
|
+
result.properties[relMeta.name] || propDef;
|
|
417
|
+
includeReferencedSchema(targetSchema.title, targetSchema);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function includeReferencedSchema(name, schema) {
|
|
421
|
+
if (!schema || !Object.keys(schema).length)
|
|
422
|
+
return;
|
|
423
|
+
// promote nested definition to the top level
|
|
424
|
+
if (result !== schema?.definitions) {
|
|
425
|
+
for (const key in schema.definitions) {
|
|
426
|
+
if (key === title)
|
|
427
|
+
continue;
|
|
428
|
+
result.definitions = result.definitions ?? {};
|
|
429
|
+
result.definitions[key] = schema.definitions[key];
|
|
430
|
+
}
|
|
431
|
+
delete schema.definitions;
|
|
432
|
+
}
|
|
433
|
+
if (result !== schema) {
|
|
434
|
+
result.definitions = result.definitions ?? {};
|
|
435
|
+
result.definitions[name] = schema;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (meta.jsonSchema) {
|
|
439
|
+
Object.assign(result, meta.jsonSchema);
|
|
440
|
+
}
|
|
441
|
+
return result;
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=build-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-schema.js","sourceRoot":"","sources":["../../../src/core/Loopback/build-schema.ts"],"names":[],"mappings":";;;AAoGA,gDAYC;AAOD,sCA8BC;AAyBD,4CAmBC;AAMD,kDA6CC;AAMD,kCAEC;AAMD,gDA+CC;AAOD,gFAkBC;AA+FD,8CA6KC;AAtlBD,sDAAsD;AACtD,gDAAgD;AAChD,+CAA+C;AAC/C,gEAAgE;AAChE,iDAAwE;AACxE,+BAA8B;AAU9B,mDAAkE;AAClE,yCAAgD;AAEnC,QAAA,eAAe,GAAG,2BAAgB,CAAC,MAAM,CAGpD,sBAAsB,CAAC,CAAA;AAEzB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAA;AA0EzB;;GAEG;AACH,SAAgB,kBAAkB,CAChC,UAAgC,EAAE;IAElC,0DAA0D;IAC1D,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,iEAAiE;IACjE,2CAA2C;IAC3C,sEAAsE;IACtE,OAAO,QAAQ,OAAO,CAAC,KAAK,IAAI,EAAE,GAAG,cAAc,CAAC,OAAO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es with `new` operator and static properties/methods
|
|
6
|
+
*/
|
|
7
|
+
export interface Class<T> {
|
|
8
|
+
new (...args: any[]): T;
|
|
9
|
+
[property: string]: any;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interface for constructor functions without `new` operator.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* function Foo(x) {
|
|
17
|
+
* if (!(this instanceof Foo)) { return new Foo(x); }
|
|
18
|
+
* this.x = x;
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export interface ConstructorFunction<T> {
|
|
23
|
+
(...args: any[]): T;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Constructor type - class or function
|
|
27
|
+
*/
|
|
28
|
+
export type Constructor<T> = Class<T> | ConstructorFunction<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Objects with open properties
|
|
31
|
+
*/
|
|
32
|
+
export interface AnyObject {
|
|
33
|
+
[property: string]: any;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* An extension of the built-in Partial<T> type which allows partial values
|
|
37
|
+
* in deeply nested properties too.
|
|
38
|
+
*/
|
|
39
|
+
export type DeepPartial<T> = Partial<T> | {
|
|
40
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Type alias for strongly or weakly typed objects of T
|
|
44
|
+
*/
|
|
45
|
+
export type DataObject<T extends object> = T | DeepPartial<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Type alias for Node.js options object
|
|
48
|
+
*/
|
|
49
|
+
export type Options = AnyObject;
|
|
50
|
+
/**
|
|
51
|
+
* Type alias for Node.js callback functions
|
|
52
|
+
*/
|
|
53
|
+
export type Callback<T> = (err: Error | string | null | undefined, result?: T) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Type for a command
|
|
56
|
+
*/
|
|
57
|
+
export type Command = string | AnyObject;
|
|
58
|
+
/**
|
|
59
|
+
* Named parameters, such as `{x: 1, y: 'a'}`
|
|
60
|
+
*/
|
|
61
|
+
export type NamedParameters = AnyObject;
|
|
62
|
+
/**
|
|
63
|
+
* Positional parameters, such as [1, 'a']
|
|
64
|
+
*/
|
|
65
|
+
export type PositionalParameters = any[];
|
|
66
|
+
/**
|
|
67
|
+
* Count of Model instances that were successful for methods like `updateAll`,
|
|
68
|
+
* `deleteAll`, etc.
|
|
69
|
+
*/
|
|
70
|
+
export interface Count {
|
|
71
|
+
count: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* JSON Schema describing the Count interface. It's the response type for
|
|
75
|
+
* REST calls to APIs which return `count`. The type is compatible with
|
|
76
|
+
* `SchemaObject` from `@loopback/openapi-v3`, which is not an explicit
|
|
77
|
+
* dependency for `@loopback/repository`.
|
|
78
|
+
*/
|
|
79
|
+
export declare const CountSchema: {
|
|
80
|
+
type: "object";
|
|
81
|
+
title: string;
|
|
82
|
+
'x-typescript-type': string;
|
|
83
|
+
properties: {
|
|
84
|
+
count: {
|
|
85
|
+
type: "number";
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Type helper to infer prototype from a constructor function.
|
|
91
|
+
*
|
|
92
|
+
* Example: `PrototypeOf<typeof Entity>` is resolved to `Entity`.
|
|
93
|
+
*/
|
|
94
|
+
export type PrototypeOf<Ctor extends Function> = Ctor extends {
|
|
95
|
+
prototype: infer Proto;
|
|
96
|
+
} ? Proto : never;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2017,2020. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/repository
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.CountSchema = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* JSON Schema describing the Count interface. It's the response type for
|
|
10
|
+
* REST calls to APIs which return `count`. The type is compatible with
|
|
11
|
+
* `SchemaObject` from `@loopback/openapi-v3`, which is not an explicit
|
|
12
|
+
* dependency for `@loopback/repository`.
|
|
13
|
+
*/
|
|
14
|
+
exports.CountSchema /* :SchemaObject */ = {
|
|
15
|
+
type: 'object', // Force to be `object` type instead of `string`
|
|
16
|
+
title: 'loopback.Count',
|
|
17
|
+
'x-typescript-type': '@loopback/repository#Count',
|
|
18
|
+
properties: {
|
|
19
|
+
count: {
|
|
20
|
+
type: 'number' // Force to be `number` type instead of `string`
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=common-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-types.js","sourceRoot":"","sources":["../../../src/core/Loopback/common-types.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AA6FhE;;;;;GAKG;AACU,QAAA,WAAW,CAAC,mBAAmB,GAAG;IAC7C,IAAI,EAAE,QAAiB,EAAE,gDAAgD;IACzE,KAAK,EAAE,gBAAgB;IACvB,mBAAmB,EAAE,4BAA4B;IACjD,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,QAAiB,CAAC,gDAAgD;SACzE;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ReferenceObject, SchemasObject } from 'openapi3-ts/oas30';
|
|
2
|
+
import { SchemaObject } from './build-schema';
|
|
3
|
+
/**
|
|
4
|
+
* Custom LoopBack extension: a reference to Schema object that's bundled
|
|
5
|
+
* inside `definitions` property.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const spec: SchemaRef = {
|
|
11
|
+
* $ref: '/components/schemas/Product',
|
|
12
|
+
* definitions: {
|
|
13
|
+
* Product: {
|
|
14
|
+
* title: 'Product',
|
|
15
|
+
* properties: {
|
|
16
|
+
* // etc.
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export type SchemaRef = ReferenceObject & {
|
|
24
|
+
definitions: SchemasObject;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Converts JSON Schemas into a SchemaObject
|
|
28
|
+
* @param json - JSON Schema to convert from
|
|
29
|
+
* @param visited - A map to keep track of mapped json schemas to handle
|
|
30
|
+
* circular references
|
|
31
|
+
*/
|
|
32
|
+
export declare function jsonToSchemaObject(json: SchemaObject, visited?: Map<SchemaObject, SchemaObject | SchemaRef>): SchemaObject | SchemaRef;
|
|
33
|
+
/**
|
|
34
|
+
* Helper function used to interpret boolean values as JSON Schemas.
|
|
35
|
+
* See http://json-schema.org/draft-06/json-schema-release-notes.html
|
|
36
|
+
* @param jsonOrBool - converts boolean values into their representative JSON Schemas
|
|
37
|
+
* @returns A JSON Schema document representing the input value.
|
|
38
|
+
*/
|
|
39
|
+
export declare function jsonOrBooleanToJSON(jsonOrBool: boolean | SchemaObject): SchemaObject | {
|
|
40
|
+
not: {};
|
|
41
|
+
};
|