From e1c4d1e9ca775c2a87f8a4a8635476fe27d9bb23 Mon Sep 17 00:00:00 2001 From: Oleksii Zubko Date: Tue, 6 Sep 2022 11:26:23 +0300 Subject: [PATCH] Remove deprecated code. (#511) Remove deprecated code in dataservice-api. Resolves: OLPEDGE-2772 Signed-off-by: Oleksii Zubko Signed-off-by: Oleksii Zubko --- .../lib/RequestBuilder.ts | 36 +-- .../lib/artifact-api.ts | 114 +------ .../lib/blob.v2.api.ts | 43 +-- .../olp-sdk-dataservice-api/lib/config-api.ts | 301 +----------------- .../lib/interactive-api-v1.ts | 196 ------------ .../test/InteractiveV1Api.test.ts | 132 -------- .../lib/client/ArtifactClient.ts | 4 +- .../test/unit/ArtifactClient.test.ts | 8 +- .../test/unit/CatalogClient.test.ts | 4 +- CHANGELOG.md | 4 +- .../api-breaks/ArtifactApi.test.ts | 102 +++--- .../api-breaks/ArtifactClient.test.ts | 2 +- .../integration/api-breaks/ConfigApi.test.ts | 130 +------- 13 files changed, 93 insertions(+), 983 deletions(-) diff --git a/@here/olp-sdk-dataservice-api/lib/RequestBuilder.ts b/@here/olp-sdk-dataservice-api/lib/RequestBuilder.ts index 1ac0e094..ba49f9e6 100644 --- a/@here/olp-sdk-dataservice-api/lib/RequestBuilder.ts +++ b/@here/olp-sdk-dataservice-api/lib/RequestBuilder.ts @@ -101,40 +101,20 @@ export class UrlBuilder { */ appendQuery( key: string, - value?: - | string - | number - | boolean - | string[] - | number[] - | { [key: string]: string | number }, + value?: string | number | boolean | string[] | number[], operator = "=" ) { if (value === undefined) { return; } - if (value instanceof Object && !(value instanceof Array)) { - let queryString = ""; - for (const propKey in value) { - queryString += UrlBuilder.appendQueryString( - "", - this.hasQuery ? "&" : "?", - propKey, - value[propKey] - ); - } - - this.url += queryString; - } else { - this.url = UrlBuilder.appendQueryString( - this.url, - this.hasQuery ? "&" : "?", - key, - value, - operator - ); - } + this.url = UrlBuilder.appendQueryString( + this.url, + this.hasQuery ? "&" : "?", + key, + value, + operator + ); this.hasQuery = true; } diff --git a/@here/olp-sdk-dataservice-api/lib/artifact-api.ts b/@here/olp-sdk-dataservice-api/lib/artifact-api.ts index 20f3bbc6..b8f86d38 100644 --- a/@here/olp-sdk-dataservice-api/lib/artifact-api.ts +++ b/@here/olp-sdk-dataservice-api/lib/artifact-api.ts @@ -32,18 +32,6 @@ import { RequestBuilder, RequestOptions, UrlBuilder } from "./RequestBuilder"; -/** - * @deprecated This will be removed by 2.2022. Please use `ArtifactObj` instead. - */ -export interface Artifact { - artifactId: string; - created: Date; - groupId: string; - hrn: string; - updated: Date; - version: string; -} - export interface ArtifactObj { artifactId: string; created: string; @@ -57,51 +45,19 @@ export interface ArtifactFile { name?: string; } -/** - * @deprecated This will be removed by 2.2022. Please use `DeleteArtifactResponseObj` instead. - */ -export interface DeleteArtifactResponse { - artifact?: Artifact; - files?: string[]; -} - export interface DeleteArtifactResponseObj { artifact?: ArtifactObj; files?: string[]; } -/** - * @deprecated This will be removed by 2.2022. Please use `DeleteFileResponseObj` instead. - */ -export interface DeleteFileResponse { - artifact?: Artifact; - file?: string; -} - export interface DeleteFileResponseObj { artifact?: ArtifactObj; file?: string; } -/** - * @deprecated This will be removed by 2.2022. Please use `DeleteSchemaResponseObj` instead. - */ -export interface DeleteSchemaResponse { - artifacts?: Artifact[]; - schema?: Schema; -} - export interface DeleteSchemaResponseObj { artifacts?: ArtifactObj[]; - schema?: Schema; -} - -/** - * @deprecated This will be removed by 2.2022. Please use `GetArtifactResponseObj` instead. - */ -export interface GetArtifactResponse { - artifact?: Artifact; - files?: ArtifactFile[]; + schema?: SchemaObj; } export interface GetArtifactResponseObj { @@ -109,16 +65,6 @@ export interface GetArtifactResponseObj { files?: ArtifactFile[]; } -/** - * @deprecated This will be removed by 2.2022. Please use `GetSchemaResponseObj` instead. - */ -export interface GetSchemaResponse { - artifacts?: Artifact[]; - schema?: Schema; - schemaValidationResults?: SchemaValidationResults[]; - variants?: Variant[]; -} - export interface GetSchemaResponseObj { artifacts?: ArtifactObj[]; schema?: SchemaObj; @@ -126,15 +72,6 @@ export interface GetSchemaResponseObj { variants?: Variant[]; } -/** - * @deprecated This will be removed by 2.2022. Please use `ListSchemasResponseObj` instead. - */ -export interface ListSchemasResponse { - items?: Schema[]; - next?: string; - page?: PagedQuery; -} - export interface ListSchemasResponseObj { items?: SchemaObj[]; next?: string; @@ -166,20 +103,6 @@ export interface RegisterArtifactResponse { hrnPrefix?: string; } -/** - * @deprecated This will be removed by 2.2022. Please use `SchemaObj` instead. - */ -export interface Schema { - artifactId: string; - created: Date; - groupId: string; - hrn: string; - name: string; - summary?: string; - updated: Date; - version: string; -} - export interface SchemaObj { artifactId: string; created: string; @@ -231,7 +154,7 @@ export interface Variant { export async function deleteArtifactUsingDELETE( builder: RequestBuilder, params: { artifactHrn: string } -): Promise { +): Promise { const baseUrl = "/artifact/{artifactHrn}".replace( "{artifactHrn}", UrlBuilder.toString(params["artifactHrn"]) @@ -245,10 +168,7 @@ export async function deleteArtifactUsingDELETE( headers }; - return builder.request( - urlBuilder, - options - ); + return builder.request(urlBuilder, options); } /** @@ -261,7 +181,7 @@ export async function deleteArtifactUsingDELETE( export async function deleteFileUsingDELETE( builder: RequestBuilder, params: { artifactHrn: string; fileName: string } -): Promise { +): Promise { const baseUrl = "/artifact/{artifactHrn}/{fileName}" .replace("{artifactHrn}", UrlBuilder.toString(params["artifactHrn"])) .replace("{fileName}", UrlBuilder.toString(params["fileName"])); @@ -274,10 +194,7 @@ export async function deleteFileUsingDELETE( headers }; - return builder.request( - urlBuilder, - options - ); + return builder.request(urlBuilder, options); } /** @@ -409,7 +326,7 @@ export async function registerArtifactUsingPUT( export async function deleteSchemaUsingDELETE( builder: RequestBuilder, params: { schemaHrn: string } -): Promise { +): Promise { const baseUrl = "/schema/{schemaHrn}".replace( "{schemaHrn}", UrlBuilder.toString(params["schemaHrn"]) @@ -423,10 +340,7 @@ export async function deleteSchemaUsingDELETE( headers }; - return builder.request( - urlBuilder, - options - ); + return builder.request(urlBuilder, options); } /** @@ -464,7 +378,7 @@ export async function getDocumentUsingGET( export async function getSchemaUsingGET( builder: RequestBuilder, params: { schemaHrn: string } -): Promise { +): Promise { const baseUrl = "/schema/{schemaHrn}".replace( "{schemaHrn}", UrlBuilder.toString(params["schemaHrn"]) @@ -478,10 +392,7 @@ export async function getSchemaUsingGET( headers }; - return builder.request( - urlBuilder, - options - ); + return builder.request(urlBuilder, options); } /** @@ -501,7 +412,7 @@ export async function listUsingGET( from?: string; limit?: number; } -): Promise { +): Promise { const baseUrl = "/schema"; const urlBuilder = new UrlBuilder(builder.baseUrl + baseUrl); @@ -516,10 +427,7 @@ export async function listUsingGET( headers }; - return builder.request( - urlBuilder, - options - ); + return builder.request(urlBuilder, options); } /** diff --git a/@here/olp-sdk-dataservice-api/lib/blob.v2.api.ts b/@here/olp-sdk-dataservice-api/lib/blob.v2.api.ts index 26d110cd..de480095 100644 --- a/@here/olp-sdk-dataservice-api/lib/blob.v2.api.ts +++ b/@here/olp-sdk-dataservice-api/lib/blob.v2.api.ts @@ -52,30 +52,6 @@ export interface DataHandleResponse { handle: string; } -/** - * Object or common prefix stored in Object Store layer. - * @deprecated This will be removed by 2.2022. Please use `KeysListObjectItemResponseObj` instead. - */ -export interface KeysListObjectItemResponse { - /** - * Name of the object/common prefix. - */ - name: string; - /** - * Object size in bytes or omitted if the `type` field is `commonPrefix`. - */ - size?: number; - /** - * Last modified date and time in RFC 3339 format or omitted if the `type` field is `commonPrefix`. - */ - lastModified?: Date; - /** - * Indicates whether the item is object or common prefix. - * Can be "object" or "commonPrefix"; - */ - type: string; -} - /** * Object or common prefix stored in Object Store layer. */ @@ -99,18 +75,6 @@ export interface KeysListObjectItemResponseObj { type: string; } -/** - * Paginated response of keys and common prefixes. - * @deprecated This will be removed by 2.2022. Please use `KeysListResponseObj` instead. - */ -export interface KeysListResponse { - /** - * Page token to fetch the next page. - */ - pageToken: string; - items: KeysListObjectItemResponse[]; -} - /** * Paginated response of keys and common prefixes. */ @@ -474,7 +438,7 @@ export async function listKeys( limit?: number; deep?: "true" | "false"; } -): Promise { +): Promise { const baseUrl = "/layers/{layerId}/keys".replace( "{layerId}", UrlBuilder.toString(params["layerId"]) @@ -492,10 +456,7 @@ export async function listKeys( headers }; - return builder.request( - urlBuilder, - options - ); + return builder.request(urlBuilder, options); } /** diff --git a/@here/olp-sdk-dataservice-api/lib/config-api.ts b/@here/olp-sdk-dataservice-api/lib/config-api.ts index d15ab49d..516e6294 100644 --- a/@here/olp-sdk-dataservice-api/lib/config-api.ts +++ b/@here/olp-sdk-dataservice-api/lib/config-api.ts @@ -54,216 +54,6 @@ export type BillingTags = string[]; */ export type CRC = "CRC-32C"; -/** - * @deprecated `ParentQuad` will be removed by 03.2022. - */ -export interface ParentQuad { - /** - * Optional value for the additional metadata specified by the publisher - */ - additionalMetadata?: string; - /** - * The checksum field is optional. The response only includes this information if you specify - * the checksum in the request (using the `additionalFields` query parameter) and if the request - * for the commit of the partition specifies a checksum. You need to use the 'sha1' checksum of - * the data content if you want the data comparison to work for this catalog. The maximum length - * of the `checksum` field is 128 characters. - */ - checksum?: string; - /** - * Optional value for the size of the compressed partition data in bytes. Compressed size of the - * data when using Blobstore in the datastore-client with compression enabled to commit to Data - * Service. The response only includes this information if you specify the `compressedDataSize` - * field in the request, and if the request for the commit of the partition specifies a - * `compressedDataSize`. - */ - compressedDataSize?: number; - /** - * The `dataHandle` uniquely identifies a tile within the scope of the layer’s dataUrl. The - * combination of dataURL + `dataHandle` should be a fully qualified URL. To store data in the - * `dataHandle` directly the 'data' URL scheme (RFC 2397) should be used. The `dataHandle` must - * not contain any characters that are not part of the reserved and unreserved set as defined in - * RFC3986. Empty value of this field is allowed. If the `dataHandle` is empty or omitted, it - * means that the partition is deleted. To delete a partition in the new version, the - * `dataHandle` should be omitted or empty string provided. The maximum length of `dataHandle` - * is 1024 characters. - */ - dataHandle: string; - /** - * Optional value for the size of the partition data in bytes. Uncompressed size of the data - * when using Blobstore in the datastore-client with compression enabled or disabled to commit - * to Data Service. The response only includes this information if you specify the `dataSize` - * field in the request, and if the request for the commit of the partition specifies - * `dataSize`. - */ - dataSize?: number; - /** - * The id of the tile - */ - partition: string; - /** - * Version of the catalog when this partition was first published - */ - version: number; -} - -/** - * @deprecated `SubQuad` will be removed by 03.2022. - */ -export interface SubQuad { - /** - * Optional value for the additional meta-data specified by the publisher. - */ - additionalMetadata?: string; - /** - * The checksum field is optional. The response only includes this information if you specify - * checksum in the request (using `additionalFields` query parameter), and if the request for - * the commit of the partition a checksum was provided during commit of the partition. It should - * be set to the sha1 checksum of the data content if the data comparison needs to work for this - * catalog. The maximum length of `checksum` field is 128 characters. - */ - checksum?: string; - /** - * Optional value for the size of the compressed partition data in bytes. Compressed size of the - * data when using Blobstore in the datastore-client with compression enabled to commit to Data - * Service. The response only includes this information if you specify the `compressedDataSize` - * field in the request, and if the request for the commit of the partition specifies - * `compressedDataSize`. - */ - compressedDataSize?: number; - /** - * The `dataHandle` uniquely identifies a tile within the scope of the layer’s dataUrl. The - * combination of dataURL + `dataHandle` should be a fully qualified URL. To store data in the - * `dataHandle` directly the 'data' URL scheme (RFC 2397) should be used. The `dataHandle` must - * not contain any characters that are not part of the reserved and unreserved set as defined in - * RFC3986. Empty value of this field is allowed. If the `dataHandle` is empty or omitted, it - * means that the partition is deleted. To delete a partition in the new version, the - * `dataHandle` should be omitted or empty string provided. The maximum length of `dataHandle` - * is 1024 characters. - */ - dataHandle: string; - /** - * Optional value for the size of the partition data in bytes. Uncompressed size of the data - * when using Blobstore in the datastore-client with compression enabled or disabled to commit - * to Data Service. The response only includes this information if you specify the `dataSize` - * field in the requested, and if the request for the commit of the partition specifies - * `dataSize`. - */ - dataSize?: number; - /** - * Variable length string defining the child of the passed in the quadkey tile. Depending on the - * partitioning scheme of the layer, either a 'quadtree' (deprecated) or a 'heretile' formatted - * id from the sub quad will be returned. When the quadkey is referenced in the response (for - * example, when depth is 0), subQuadKey is an empty string for 'quadtree' partitioning, and '1' - * for 'heretile' partitioning. - */ - subQuadKey: string; - /** - * Version of the catalog when this partition was first published. - */ - version: number; -} - -/** - * @deprecated `Index` will be removed by 03.2022. - */ -export interface Index { - /** - * Result of the index resource call. For each parent tile, one element with the respective - * parent-quad data is contained in the array. - */ - parentQuads: ParentQuad[]; - /** - * Result of the index resource call. For each tile that contains data in the requested quadkey, - * one element with the respective sub-quad data is contained in the array. - */ - subQuads: SubQuad[]; -} - -/** - * - * @deprecated `Layer` will be removed by 03.2022. - * - * Describes the catalog layer properties. - */ -export interface Layer { - /** - * Billing tag is an optional free-form tag, which is used for grouping billing records - * together. If supplied, it must be between 4 - 16 characters, contain only alpha/numeric ASCII - * characters `[A-Za-z0-9]`. - */ - billingTags?: BillingTags; - /** - * Identifies whether the data is compressed. - */ - contentEncoding?: ContentEncoding; - /** - * The mime type of the data is stored in this layer. - */ - contentType?: ContentType; - /** - * The geographic areas that this layer covers, grouped by admin areas. - */ - coverage?: Coverage; - /** - * The person who created this layer. - */ - creator?: Creator; - /** - * A detailed description of the layer and what it contains. This information appears on the - * 'Overview' tab when you open a layer in the platform portal. - */ - description?: string; - /** - * The HERE Resource Name (HRN) of the layer. - */ - hrn: string; - /** - * This ID should be unique to one environment. You can use the same ID again in another context - * such as a production environment. This ID forms part of the HERE Resource Name (HRN) for the - * layer. - */ - id: string; - /** - * The type of data availability that this layer provides. - */ - layerType: - | IndexLayerType - | StreamLayerType - | VersionedLayerType - | VolatileLayerType; - /** - * A descriptive name for the layer. - */ - name?: string; - /** - * The name of the partitioning scheme for this layer. - */ - partitioning: Partitioning; - /** - * The HRN of the data schema for this layer. - */ - schema?: Schema; - /** - * Properties that define the scale of the streaming service required for this layer. - */ - streamProperties?: StreamProperties; - /** - * A one-sentence summary of the layer. You can see this summary when you browse a list of - * layers on the platform portal. - */ - summary?: string; - /** - * Some keywords that help to find the catalog when searching in the platform portal. - */ - tags?: Tags; - /** - * Properties that describe the volume where the data is physically stored. - */ - volume?: DurableVolume | VolatileVolume; - digest?: Digest; -} - /** * Describes the catalog properties. */ @@ -314,16 +104,14 @@ export interface Catalog { /** * The layers in the catalog. */ - layers: - | Layer[] - | Array< - | VersionedLayer - | VolatileLayer - | StreamLayer - | IndexLayer - | InteractiveMapsLayer - | ObjectstoreLayer - >; + layers: Array< + | VersionedLayer + | VolatileLayer + | StreamLayer + | IndexLayer + | InteractiveMapsLayer + | ObjectstoreLayer + >; /** * The version of the catalog configuration. Every change in this number indicates a change in the catalog * configuration. It is incremented every time you make changes, such as change catalog parameters or add layers. @@ -694,29 +482,6 @@ export interface GetBaseLayer { layerType: string; } -/** - * @deprecated `ErrorMessage` will be removed by 03.2022. - * An HTTP Error message that the service provides when there is a problem with request. - */ -export interface ErrorMessage { - /** - * An error code that pertains to a specific error. - */ - code?: string; - /** - * A set of validation error messages. - */ - errors?: ValidationErrorMessage[]; - /** - * A message that describes the cause of the error. - */ - message?: string; - /** - * The HTTP status code of the error response. - */ - status?: number; -} - export interface IndexDefinition { /** * timewindow - represents the time slice (NOT just point in time) and it denotes the finest @@ -1123,19 +888,6 @@ export type StreamLayerType = "stream"; * following formulas: `1 parallelization = 1000 dataInThroughputKbps`, `1 parallelization = 2000 dataOutThroughputKbps`. */ export interface StreamProperties { - /** - * @deprecated `dataInThroughputMbps` will be removed by 03.2022. - * Maximum throughput for incoming data expressed in megabytes per second. - * Throttling occurs when the inbound rate exceeds the maximum inbound throughput. The default is 4 MBps. The maximum is 32 MBps. - */ - dataInThroughputMbps?: number; - /** - * @deprecated `dataOutThroughputMbps` will be removed by 03.2022. - * Maximum throughput for outgoing data expressed in megabytes per second. - * Throttling occurs when the total outbound rate to all consumers exceeds the maximum outbound throughput. - * The default is 8 MBps. The maximum is 64 MBps. - */ - dataOutThroughputMbps?: number; /** * Maximum throughput for incoming data expressed in kilobytes per second. Throttling occurs when the inbound rate * exceeds the maximum inbound throughput. The default is 1000 KBps. The minimum is 100 KBps, the maximum is 32800 KBps. @@ -1174,33 +926,6 @@ export type Ttl = number; */ export type TtlHours = number; -/** - * @deprecated `ValidationErrorMessage` will be removed by 03.2022. - * HTTP Error message thrown by the service. - */ -export interface ValidationErrorMessage { - /** - * Error code that pertains to a specific error. - */ - code?: string; - /** - * The field of the object that is invalid. The field follows RFC 6901 JSON Pointer (see: https://tools.ietf.org/html/rfc6901). - */ - field?: string; - /** - * The value that is invalid that was sent. - */ - invalidValue?: any; - /** - * This is the message for the error. - */ - message?: string; - /** - * Duplicate of the HTTP status that is returned. - */ - status?: number; -} - /** * Describes the catalog versioned layer properties. */ @@ -1286,21 +1011,11 @@ export interface VolatileVolume { * Define keys eviction policy when the memory limit for volatile layer is reached */ maxMemoryPolicy?: MaxMemoryPolicyEnum; - /** - * @deprecated `packageType` will be removed by 03.2022. - * Define initial package type (capacity) of the volatile layer - */ - packageType?: PackageTypeEnum; volumeType: "volatile"; } export type MaxMemoryPolicyEnum = "failOnWrite" | "replaceLessRecentlyUsedKey"; -/** - * @deprecated `PackageTypeEnum` will be removed by 03.2022. - */ -export type PackageTypeEnum = "experimental" | "small" | "medium" | "large"; - /* * =================================================================== * ConfigApi diff --git a/@here/olp-sdk-dataservice-api/lib/interactive-api-v1.ts b/@here/olp-sdk-dataservice-api/lib/interactive-api-v1.ts index d5338f96..ca5311f9 100644 --- a/@here/olp-sdk-dataservice-api/lib/interactive-api-v1.ts +++ b/@here/olp-sdk-dataservice-api/lib/interactive-api-v1.ts @@ -445,40 +445,6 @@ export async function getFeaturesByBBox( clusteringParams?: { [key: string]: string | number }; force2D?: boolean; } -): Promise; -/** - * @deprecated This signature will be removed by 06.2022. - * Please use signature with `SearchParams`. - */ -export async function getFeaturesByBBox( - builder: RequestBuilder, - params: { - layerId: string; - bbox?: Array; - clip?: boolean; - limit?: number; - params?: { [key: string]: string | number }; - selection?: string | Array; - skipCache?: boolean; - clustering?: string; - clusteringParams?: { [key: string]: string | number }; - force2D?: boolean; - } -): Promise; -export async function getFeaturesByBBox( - builder: RequestBuilder, - params: { - layerId: string; - bbox?: Array; - clip?: boolean; - limit?: number; - params?: { [key: string]: string | number } | SearchParams; - selection?: string | Array; - skipCache?: boolean; - clustering?: string; - clusteringParams?: { [key: string]: string | number }; - force2D?: boolean; - } ): Promise { const baseUrl = "/layers/{layerId}/bbox".replace( "{layerId}", @@ -495,12 +461,6 @@ export async function getFeaturesByBBox( searchParams.forEach(param => { urlBuilder.appendQuery(param.key, param.value, param.operator); }); - } else { - // will be removed 06.2022 - urlBuilder.appendQuery( - "params", - params["params"] as { [key: string]: string | number } - ); } urlBuilder.appendQuery("selection", params["selection"]); @@ -616,44 +576,6 @@ export async function getFeaturesBySpatial( skipCache?: boolean; force2D?: boolean; } -): Promise; -/** - * @deprecated This signature will be removed by 06.2022. - * Please use signature with `SearchParams`. - */ -export async function getFeaturesBySpatial( - builder: RequestBuilder, - params: { - layerId: string; - lat?: number; - lng?: number; - refCatalogHrn?: string; - refLayerId?: string; - refFeatureId?: string; - radius?: number; - limit?: number; - params?: { [key: string]: string | number }; - selection?: string | Array; - skipCache?: boolean; - force2D?: boolean; - } -): Promise; -export async function getFeaturesBySpatial( - builder: RequestBuilder, - params: { - layerId: string; - lat?: number; - lng?: number; - refCatalogHrn?: string; - refLayerId?: string; - refFeatureId?: string; - radius?: number; - limit?: number; - params?: { [key: string]: string | number } | SearchParams; - selection?: string | Array; - skipCache?: boolean; - force2D?: boolean; - } ): Promise { const baseUrl = "/layers/{layerId}/spatial".replace( "{layerId}", @@ -674,12 +596,6 @@ export async function getFeaturesBySpatial( searchParams.forEach(param => { urlBuilder.appendQuery(param.key, param.value, param.operator); }); - } else { - // will be removed 06.2022 - urlBuilder.appendQuery( - "params", - params["params"] as { [key: string]: string | number } - ); } urlBuilder.appendQuery("selection", params["selection"]); @@ -767,36 +683,6 @@ export async function getFeaturesBySpatialPost( skipCache?: boolean; force2D?: boolean; } -): Promise; -/** - * @deprecated This signature will be removed by 06.2022. - * Please use signature with `SearchParams`. - */ -export async function getFeaturesBySpatialPost( - builder: RequestBuilder, - params: { - layerId: string; - body?: GetFeaturesBySpatialBody; - radius?: number; - limit?: number; - params?: { [key: string]: string | number }; - selection?: string | Array; - skipCache?: boolean; - force2D?: boolean; - } -): Promise; -export async function getFeaturesBySpatialPost( - builder: RequestBuilder, - params: { - layerId: string; - body?: GetFeaturesBySpatialBody; - radius?: number; - limit?: number; - params?: { [key: string]: string | number } | SearchParams; - selection?: string | Array; - skipCache?: boolean; - force2D?: boolean; - } ): Promise { const baseUrl = "/layers/{layerId}/spatial".replace( "{layerId}", @@ -813,12 +699,6 @@ export async function getFeaturesBySpatialPost( searchParams.forEach(param => { urlBuilder.appendQuery(param.key, param.value, param.operator); }); - } else { - // will be removed 06.2022 - urlBuilder.appendQuery( - "params", - params["params"] as { [key: string]: string | number } - ); } urlBuilder.appendQuery("selection", params["selection"]); @@ -965,44 +845,6 @@ export async function getFeaturesByTile( limit?: number; force2D?: boolean; } -): Promise; -/** - * @deprecated This signature will be removed by 06.2022. - * Please use signature with `SearchParams`. - */ -export async function getFeaturesByTile( - builder: RequestBuilder, - params: { - layerId: string; - tileType: string; - tileId: string; - clip?: boolean; - params?: { [key: string]: string | number }; - selection?: string | Array; - skipCache?: boolean; - clustering?: string; - clusteringParams?: { [key: string]: string | number }; - margin?: number; - limit?: number; - force2D?: boolean; - } -): Promise; -export async function getFeaturesByTile( - builder: RequestBuilder, - params: { - layerId: string; - tileType: string; - tileId: string; - clip?: boolean; - params?: { [key: string]: string | number } | SearchParams; - selection?: string | Array; - skipCache?: boolean; - clustering?: string; - clusteringParams?: { [key: string]: string | number }; - margin?: number; - limit?: number; - force2D?: boolean; - } ): Promise { const baseUrl = "/layers/{layerId}/tile/{tileType}/{tileId}" .replace("{layerId}", UrlBuilder.toString(params["layerId"])) @@ -1018,12 +860,6 @@ export async function getFeaturesByTile( searchParams.forEach(param => { urlBuilder.appendQuery(param.key, param.value, param.operator); }); - } else { - // will be removed 06.2022 - urlBuilder.appendQuery( - "params", - params["params"] as { [key: string]: string | number } - ); } urlBuilder.appendQuery("selection", params["selection"]); @@ -1216,32 +1052,6 @@ export async function searchFeatures( skipCache?: boolean; force2D?: boolean; } -): Promise; -/** - * @deprecated This signature will be removed by 06.2022. - * Please use signature with `SearchParams`. - */ -export async function searchFeatures( - builder: RequestBuilder, - params: { - layerId: string; - limit?: number; - params?: { [key: string]: string | number }; - selection?: string | Array; - skipCache?: boolean; - force2D?: boolean; - } -): Promise; -export async function searchFeatures( - builder: RequestBuilder, - params: { - layerId: string; - limit?: number; - params?: { [key: string]: string | number } | SearchParams; - selection?: string | Array; - skipCache?: boolean; - force2D?: boolean; - } ): Promise { const baseUrl = "/layers/{layerId}/search".replace( "{layerId}", @@ -1257,12 +1067,6 @@ export async function searchFeatures( searchParams.forEach(param => { urlBuilder.appendQuery(param.key, param.value, param.operator); }); - } else { - // will be removed 06.2022 - urlBuilder.appendQuery( - "params", - params["params"] as { [key: string]: string | number } - ); } urlBuilder.appendQuery("selection", params["selection"]); diff --git a/@here/olp-sdk-dataservice-api/test/InteractiveV1Api.test.ts b/@here/olp-sdk-dataservice-api/test/InteractiveV1Api.test.ts index 50005605..c723f65c 100644 --- a/@here/olp-sdk-dataservice-api/test/InteractiveV1Api.test.ts +++ b/@here/olp-sdk-dataservice-api/test/InteractiveV1Api.test.ts @@ -159,39 +159,6 @@ describe("InteractiveApi", function() { }); it("getFeaturesByBBox", async function() { - expect( - await InteractiveApi.getFeaturesByBBox( - new MockedRequestBuilder({ - request: (url: string, options?: RequestOptions): any => { - expect(url).to.be.equals( - `http://mocked.url/layers/mocked-layerId/bbox?bbox=13.082,52.416,13.628,52.626&clip=true&limit=100&p.property_name_1=property_value_1&f.special_property_name_1=special_property_value_1&selection=p.name,p.capacity,p.color&skipCache=true&clustering=hexbin&clustering.resolution=3&clustering.testProperty=a.nest&clustering.testProperty2=testProperty2Value&force2D=true` - ); - expect(options?.method).to.be.equal("GET"); - return Promise.resolve("success"); - } - }), - { - layerId: "mocked-layerId", - bbox: [13.082, 52.416, 13.628, 52.626], - clip: true, - limit: 100, - params: { - "p.property_name_1": "property_value_1", - "f.special_property_name_1": "special_property_value_1" - }, - selection: ["p.name", "p.capacity", "p.color"], - skipCache: true, - clustering: "hexbin", - clusteringParams: { - resolution: 3, - testProperty: "a.nest", - testProperty2: "testProperty2Value" - }, - force2D: true - } - ) - ).eqls("success"); - expect( await InteractiveApi.getFeaturesByBBox( new MockedRequestBuilder({ @@ -272,37 +239,6 @@ describe("InteractiveApi", function() { }); it("getFeaturesBySpatial", async function() { - expect( - await InteractiveApi.getFeaturesBySpatial( - new MockedRequestBuilder({ - request: (url: string, options?: RequestOptions): any => { - expect(url).to.be.equals( - `http://mocked.url/layers/mocked-layerId/spatial?lat=-90&lng=45&refCatalogHrn=mocked-refCatalogHrn&refLayerId=mocked-refLayerId&refFeatureId=mocked-refFeatureId&radius=40&limit=100&p.property_name_1=property_value_1&f.special_property_name_1=special_property_value_1&selection=p.name,p.capacity,p.color&skipCache=true&force2D=true` - ); - expect(options?.method).to.be.equal("GET"); - return Promise.resolve("success"); - } - }), - { - layerId: "mocked-layerId", - lat: -90, - lng: 45, - refCatalogHrn: "mocked-refCatalogHrn", - refLayerId: "mocked-refLayerId", - refFeatureId: "mocked-refFeatureId", - radius: 40, - limit: 100, - params: { - "p.property_name_1": "property_value_1", - "f.special_property_name_1": "special_property_value_1" - }, - selection: ["p.name", "p.capacity", "p.color"], - skipCache: true, - force2D: true - } - ) - ).eqls("success"); - expect( await InteractiveApi.getFeaturesBySpatial( new MockedRequestBuilder({ @@ -380,39 +316,6 @@ describe("InteractiveApi", function() { }); it("getFeaturesBySpatialPost", async function() { - expect( - await InteractiveApi.getFeaturesBySpatialPost( - new MockedRequestBuilder({ - request: (url: string, options?: RequestOptions): any => { - expect(url).to.be.equals( - `http://mocked.url/layers/mocked-layerId/spatial?radius=40&limit=100&p.property_name_1=property_value_1&f.special_property_name_1=special_property_value_1&selection=p.name,p.capacity,p.color&skipCache=true&force2D=true` - ); - expect(options?.body).to.be.equals( - `{"type":"mocked-geojson","bbox":[1,2,3,4]}` - ); - expect(options?.method).to.be.equal("POST"); - return Promise.resolve("success"); - } - }), - { - layerId: "mocked-layerId", - body: { - type: "mocked-geojson", - bbox: [1, 2, 3, 4] - }, - radius: 40, - limit: 100, - params: { - "p.property_name_1": "property_value_1", - "f.special_property_name_1": "special_property_value_1" - }, - selection: ["p.name", "p.capacity", "p.color"], - skipCache: true, - force2D: true - } - ) - ).eqls("success"); - expect( await InteractiveApi.getFeaturesBySpatialPost( new MockedRequestBuilder({ @@ -512,41 +415,6 @@ describe("InteractiveApi", function() { }); it("getFeaturesByTile", async function() { - expect( - await InteractiveApi.getFeaturesByTile( - new MockedRequestBuilder({ - request: (url: string, options?: RequestOptions): any => { - expect(url).to.be.equals( - `http://mocked.url/layers/mocked-layerId/tile/here/mocked-tile-id?clip=true&p.property_name_1=property_value_1&f.special_property_name_1=special_property_value_1&selection=p.name,p.capacity,p.color&skipCache=true&clustering=hexbin&clustering.resolution=3&clustering.testProperty=a.nest&clustering.testProperty2=testProperty2Value&margin=12&limit=100&force2D=true` - ); - expect(options?.method).to.be.equal("GET"); - return Promise.resolve("success"); - } - }), - { - layerId: "mocked-layerId", - tileType: "here", - tileId: "mocked-tile-id", - clip: true, - limit: 100, - params: { - "p.property_name_1": "property_value_1", - "f.special_property_name_1": "special_property_value_1" - }, - selection: ["p.name", "p.capacity", "p.color"], - skipCache: true, - clustering: "hexbin", - clusteringParams: { - resolution: 3, - testProperty: "a.nest", - testProperty2: "testProperty2Value" - }, - force2D: true, - margin: 12 - } - ) - ).eqls("success"); - expect( await InteractiveApi.getFeaturesByTile( new MockedRequestBuilder({ diff --git a/@here/olp-sdk-dataservice-read/lib/client/ArtifactClient.ts b/@here/olp-sdk-dataservice-read/lib/client/ArtifactClient.ts index 34312e1e..a7266837 100644 --- a/@here/olp-sdk-dataservice-read/lib/client/ArtifactClient.ts +++ b/@here/olp-sdk-dataservice-read/lib/client/ArtifactClient.ts @@ -46,9 +46,7 @@ export class ArtifactClient { */ public async getSchemaDetails( schemaDetailsRequest: SchemaDetailsRequest - ): Promise< - ArtifactApi.GetSchemaResponse | ArtifactApi.GetSchemaResponseObj - > { + ): Promise { const hrn = schemaDetailsRequest.getSchema(); if (!hrn) { diff --git a/@here/olp-sdk-dataservice-read/test/unit/ArtifactClient.test.ts b/@here/olp-sdk-dataservice-read/test/unit/ArtifactClient.test.ts index 24ecfca5..d4ab6eda 100644 --- a/@here/olp-sdk-dataservice-read/test/unit/ArtifactClient.test.ts +++ b/@here/olp-sdk-dataservice-read/test/unit/ArtifactClient.test.ts @@ -157,7 +157,7 @@ describe("ArtifactClient", function() { }); it("Should method getSchemaDetails provide data", async function() { - const mockedSchema: ArtifactApi.GetSchemaResponse = { + const mockedSchema: ArtifactApi.GetSchemaResponseObj = { variants: [ { id: "42", @@ -173,7 +173,7 @@ describe("ArtifactClient", function() { ( builder: any, params: any - ): Promise => { + ): Promise => { return Promise.resolve(mockedSchema); } ); @@ -196,7 +196,7 @@ describe("ArtifactClient", function() { "Not found" ); - const mockedSchema: ArtifactApi.GetSchemaResponse = { + const mockedSchema: ArtifactApi.GetSchemaResponseObj = { variants: [ { id: "42", @@ -213,7 +213,7 @@ describe("ArtifactClient", function() { ( builder: any, params: any - ): Promise => { + ): Promise => { return Promise.reject(mockedError); } ); diff --git a/@here/olp-sdk-dataservice-read/test/unit/CatalogClient.test.ts b/@here/olp-sdk-dataservice-read/test/unit/CatalogClient.test.ts index c4b1e85a..b3b494ea 100644 --- a/@here/olp-sdk-dataservice-read/test/unit/CatalogClient.test.ts +++ b/@here/olp-sdk-dataservice-read/test/unit/CatalogClient.test.ts @@ -302,7 +302,7 @@ describe("CatalogClient", function() { }, contentType: "application/x-protobuf", layerType: "versioned" - } + } as any ], version: 3 }; @@ -348,7 +348,7 @@ describe("CatalogClient", function() { }, contentType: "application/x-protobuf", layerType: "versioned" - } + } as any ], version: 3 }; diff --git a/CHANGELOG.md b/CHANGELOG.md index e79573e1..e669739b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## v1.13.0 (02/09/2022) +## v1.13.0 (06/09/2022) **olp-sdk-dataservice-api** @@ -18,6 +18,8 @@ `VolatileBlobApi::putVolatileBlob`. +- Removed deprecated interfaces (Removed the deprecated code (https://github.com/heremaps/here-data-sdk-typescript/pull/511). + ## v1.12.2 (11/01/2022) diff --git a/tests/integration/api-breaks/ArtifactApi.test.ts b/tests/integration/api-breaks/ArtifactApi.test.ts index dd5f80e0..001e979e 100644 --- a/tests/integration/api-breaks/ArtifactApi.test.ts +++ b/tests/integration/api-breaks/ArtifactApi.test.ts @@ -21,15 +21,15 @@ import * as chai from "chai"; import sinonChai = require("sinon-chai"); import { - Artifact, + ArtifactObj, ArtifactFile, - DeleteArtifactResponse, - DeleteFileResponse, - DeleteSchemaResponse, - Schema, - GetArtifactResponse, - GetSchemaResponse, - ListSchemasResponse, + DeleteArtifactResponseObj, + DeleteFileResponseObj, + DeleteSchemaResponseObj, + SchemaObj, + GetArtifactResponseObj, + GetSchemaResponseObj, + ListSchemasResponseObj, PagedQuery, Principal, RegisterArtifactRequest, @@ -50,12 +50,12 @@ const expect = chai.expect; describe("ArtifactApi", function() { it("Artifact with all required params", function() { - const params: Artifact = { + const params: ArtifactObj = { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", - updated: {} as Date, + updated: "", version: "test" }; @@ -77,19 +77,19 @@ describe("ArtifactApi", function() { }); it("DeleteArtifactResponse with all required params", function() { - const params: DeleteArtifactResponse = {}; + const params: DeleteArtifactResponseObj = {}; assert.isDefined(params); }); it("DeleteArtifactResponse with all required and optional params", function() { - const params: DeleteArtifactResponse = { + const params: DeleteArtifactResponseObj = { artifact: { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", - updated: {} as Date, + updated: "", version: "test" }, files: ["test"] @@ -99,19 +99,19 @@ describe("ArtifactApi", function() { }); it("DeleteFileResponse with all required params", function() { - const params: DeleteFileResponse = {}; + const params: DeleteFileResponseObj = {}; assert.isDefined(params); }); it("DeleteFileResponse with all required and optional params", function() { - const params: DeleteFileResponse = { + const params: DeleteFileResponseObj = { artifact: { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", - updated: {} as Date, + updated: "", version: "test" }, file: "test" @@ -121,31 +121,31 @@ describe("ArtifactApi", function() { }); it("DeleteSchemaResponse with all required params", function() { - const params: DeleteSchemaResponse = {}; + const params: DeleteSchemaResponseObj = {}; assert.isDefined(params); }); it("DeleteSchemaResponse with all required and optional params", function() { - const params: DeleteSchemaResponse = { + const params: DeleteSchemaResponseObj = { artifacts: [ { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", - updated: {} as Date, + updated: "", version: "test" } ], schema: { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", name: "test", summary: "test", - updated: {} as Date, + updated: "", version: "test" } }; @@ -154,31 +154,31 @@ describe("ArtifactApi", function() { }); it("DeleteSchemaResponse with all required params", function() { - const params: DeleteSchemaResponse = {}; + const params: DeleteSchemaResponseObj = {}; assert.isDefined(params); }); it("DeleteSchemaResponse with all required and optional params", function() { - const params: DeleteSchemaResponse = { + const params: DeleteSchemaResponseObj = { artifacts: [ { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", - updated: {} as Date, + updated: "", version: "test" } ], schema: { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", name: "test", summary: "test", - updated: {} as Date, + updated: "", version: "test" } }; @@ -187,13 +187,13 @@ describe("ArtifactApi", function() { }); it("Schema with all required params", function() { - const params: Schema = { + const params: SchemaObj = { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", name: "test", - updated: {} as Date, + updated: "", version: "test" }; @@ -201,14 +201,14 @@ describe("ArtifactApi", function() { }); it("Schema with all required and optional params", function() { - const params: Schema = { + const params: SchemaObj = { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", name: "test", summary: "test", - updated: {} as Date, + updated: "", version: "test" }; @@ -216,19 +216,19 @@ describe("ArtifactApi", function() { }); it("GetArtifactResponse with all required params", function() { - const params: GetArtifactResponse = {}; + const params: GetArtifactResponseObj = {}; assert.isDefined(params); }); it("GetArtifactResponse with all required and optional params", function() { - const params: GetArtifactResponse = { + const params: GetArtifactResponseObj = { artifact: { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", - updated: {} as Date, + updated: "", version: "test" }, files: [ @@ -242,30 +242,30 @@ describe("ArtifactApi", function() { }); it("GetSchemaResponse with all required params", function() { - const params: GetSchemaResponse = {}; + const params: GetSchemaResponseObj = {}; assert.isDefined(params); }); it("GetSchemaResponse with all required and optional params", function() { - const params: GetSchemaResponse = { + const params: GetSchemaResponseObj = { artifacts: [ { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", - updated: {} as Date, + updated: "", version: "test" } ], schema: { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", name: "test", - updated: {} as Date, + updated: "", version: "test" }, schemaValidationResults: [], @@ -281,21 +281,21 @@ describe("ArtifactApi", function() { }); it("ListSchemasResponse with all required params", function() { - const params: ListSchemasResponse = {}; + const params: ListSchemasResponseObj = {}; assert.isDefined(params); }); it("ListSchemasResponse with all required and optional params", function() { - const params: ListSchemasResponse = { + const params: ListSchemasResponseObj = { items: [ { artifactId: "test", - created: {} as Date, + created: "", groupId: "test", hrn: "test", name: "test", - updated: {} as Date, + updated: "", version: "test" } ], diff --git a/tests/integration/api-breaks/ArtifactClient.test.ts b/tests/integration/api-breaks/ArtifactClient.test.ts index 93125d29..f46d197c 100644 --- a/tests/integration/api-breaks/ArtifactClient.test.ts +++ b/tests/integration/api-breaks/ArtifactClient.test.ts @@ -38,7 +38,7 @@ describe("ArtifactClient", function() { public async getSchemaDetails( schemaDetailsRequest: dataServiceRead.SchemaDetailsRequest - ): Promise { + ): Promise { return { variants: [ { diff --git a/tests/integration/api-breaks/ConfigApi.test.ts b/tests/integration/api-breaks/ConfigApi.test.ts index c193dbfa..74a42b6d 100644 --- a/tests/integration/api-breaks/ConfigApi.test.ts +++ b/tests/integration/api-breaks/ConfigApi.test.ts @@ -22,10 +22,6 @@ import sinonChai = require("sinon-chai"); import { ConfigApi } from "@here/olp-sdk-dataservice-api"; import { - ParentQuad, - SubQuad, - Index, - Layer, StatusLink, Catalog, CatalogFailureStatus, @@ -42,128 +38,6 @@ const assert = chai.assert; const expect = chai.expect; describe("ConfigApi", function() { - it("ParentQuad with all required params", function() { - const params: ParentQuad = { - dataHandle: "test", - partition: "test", - version: 1 - }; - - assert.isDefined(params); - }); - - it("ParentQuad with all required and optional params", function() { - const params: ParentQuad = { - additionalMetadata: "test", - checksum: "test", - compressedDataSize: 1, - dataHandle: "test", - dataSize: 1, - partition: "test", - version: 1 - }; - - assert.isDefined(params); - }); - - it("SubQuad with all required params", function() { - const params: SubQuad = { - dataHandle: "test", - subQuadKey: "test", - version: 1 - }; - - assert.isDefined(params); - }); - - it("SubQuad with all required and optional params", function() { - const params: SubQuad = { - additionalMetadata: "test", - checksum: "test", - compressedDataSize: 1, - dataHandle: "test", - dataSize: 1, - subQuadKey: "test", - version: 1 - }; - - assert.isDefined(params); - }); - - it("Index with all required params", function() { - const params: Index = { - parentQuads: [ - { - dataHandle: "test", - partition: "test", - version: 1 - } - ], - - subQuads: [ - { - dataHandle: "test", - subQuadKey: "test", - version: 1 - } - ] - }; - - assert.isDefined(params); - }); - - it("Layer with all required params", function() { - const params: Layer = { - hrn: "test", - id: "test", - layerType: "index", - partitioning: { - scheme: "generic", - tileLevels: [1] - } - }; - - assert.isDefined(params); - }); - - it("Layer with all required and optional params", function() { - const params: Layer = { - billingTags: ["test"], - contentEncoding: "gzip", - contentType: "test", - coverage: { - adminAreas: ["test"] - }, - creator: { - id: "test" - }, - description: "test", - hrn: "test", - id: "test", - layerType: "index", - name: "test", - partitioning: { - scheme: "generic", - tileLevels: [1] - }, - schema: { - hrn: "test" - }, - streamProperties: { - dataInThroughputMbps: 1, - dataOutThroughputMbps: 1 - }, - summary: "test", - tags: ["test"], - volume: { - volumeType: "durable" - }, - digest: "MD5" - }; - - assert.isDefined(params); - }); - it("Catalog with all required params", function() { const params: Catalog = { created: "test", @@ -203,7 +77,7 @@ describe("ConfigApi", function() { volumeType: "durable" }, digest: "MD5" - } + } as any ], name: "test", replication: { @@ -265,7 +139,7 @@ describe("ConfigApi", function() { volumeType: "durable" }, digest: "MD5" - } + } as any ], name: "test", notifications: {