diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 879db5b..1b82b3e 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -24,8 +24,16 @@ jobs: echo "branch=$BRANCH" >> $GITHUB_OUTPUT - name: Publish to npm run: | - if [ "${{ github.ref_name }}" == "alpha" ]; then - npm publish --access public --tag alpha - else - npm publish --access public - fi + echo "is pre-release: ${{ github.event.release.prerelease }}" + echo "publish triggered on: ${{ github.ref_type }}" + if ([[ "${{ github.ref_type }}" == "tag" ]] && + [[ "${{ github.event.release.prerelease }}" == "true" ]] && + [[ "${{ github.ref_name }}" == "v${{ steps.package-info.outputs.version }}" ]]) || + ([[ "${{ github.ref_type }}" == "branch" ]] && + [[ "${{ github.ref_name }}" == "alpha" ]]); then + echo "publishing prerelease with alpha tag from ${{ github.ref_type }}" + npm publish --access public --tag alpha + else + echo "publishing standard release" + npm publish --access public + fi diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 0e88203..356639d 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -46,6 +46,5 @@ jobs: token: ${{ secrets.GH_PAT }} # this is a built-in strategy in release-please, see "Action Inputs" # for more options - release-type: node target-branch: ${{ github.ref_name }} config-file: ${{ steps.prerelease.outputs.prerelease_type_config }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1c3fc07..5a4e564 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "7.10.2" + ".": "8.1.0-alpha.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 66c114e..e244ce9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,59 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [8.1.0-alpha.3](https://github.com/MapColonies/raster-shared/compare/v8.1.0-alpha.2...v8.1.0-alpha.3) (2026-05-05) + + +### Bug Fixes + +* simplify file extension handling in tilesDeletionParamsBaseSchema ([#199](https://github.com/MapColonies/raster-shared/issues/199)) ([383ac19](https://github.com/MapColonies/raster-shared/commit/383ac1988824947cd6ae3c8cb4402a881b0124c9)) + +## [8.1.0-alpha.2](https://github.com/MapColonies/raster-shared/compare/v8.1.0-alpha.1...v8.1.0-alpha.2) (2026-05-05) + + +### Features + +* add tile schema and type exports to core index files ([#197](https://github.com/MapColonies/raster-shared/issues/197)) ([921db4d](https://github.com/MapColonies/raster-shared/commit/921db4dbd25f0c3dc04e08c460b6544bad562ef1)) + +## [8.1.0-alpha.1](https://github.com/MapColonies/raster-shared/compare/v8.1.0-alpha.0...v8.1.0-alpha.1) (2026-05-05) + + +### Features + +* add polygon parts schema and types for intersection api ([#193](https://github.com/MapColonies/raster-shared/issues/193)) ([440f0c5](https://github.com/MapColonies/raster-shared/commit/440f0c52714a559747be55da3eadf76459dfdc3d)) + +## [8.1.0-alpha.0](https://github.com/MapColonies/raster-shared/compare/v8.0.0-alpha.0...v8.1.0-alpha.0) (2026-05-04) + + +### Features + +* add tile deletion schemas and types, refactor source type ([#191](https://github.com/MapColonies/raster-shared/issues/191)) ([c87c428](https://github.com/MapColonies/raster-shared/commit/c87c428efdd98ced15972e6d487d6bb4acce95e9)) + +## [8.0.0-alpha.0](https://github.com/MapColonies/raster-shared/compare/v7.10.2...v8.0.0-alpha.0) (2026-04-29) + + +### ⚠ BREAKING CHANGES + +* change polygon part validation error to new format (MAPCO-10506) ([#183](https://github.com/MapColonies/raster-shared/issues/183)) + +### Features + +* add optional errors summary to ingestion validation schema ([#180](https://github.com/MapColonies/raster-shared/issues/180)) ([5b6f644](https://github.com/MapColonies/raster-shared/commit/5b6f644d0ff2cc7fff26ee6e26f5337b0e1eeb56)) +* add resolution threshold check to thresholds schema ([4f6ef36](https://github.com/MapColonies/raster-shared/commit/4f6ef366cd25b1c4668371e7bb0f59d63148d9b6)) +* update package ([61e08f4](https://github.com/MapColonies/raster-shared/commit/61e08f4785b32f66fa4fed485d9507306dcf4598)) + + +### Bug Fixes + +* bump version ([e726f0d](https://github.com/MapColonies/raster-shared/commit/e726f0dc061e058131ebda051cc11907de1f6d97)) +* package json version ([b72678f](https://github.com/MapColonies/raster-shared/commit/b72678f558cef73468084e313cb654666775634b)) + + +### Code Refactoring + +* change polygon part validation error to new format (MAPCO-10506) ([#183](https://github.com/MapColonies/raster-shared/issues/183)) ([2587722](https://github.com/MapColonies/raster-shared/commit/2587722796704dce3bef9b84228835c6c852a7cd)) +* set release-please initial version ([#186](https://github.com/MapColonies/raster-shared/issues/186)) ([3769756](https://github.com/MapColonies/raster-shared/commit/3769756998f8c903730c1d0dde249a45083a4b95)) + ## [7.10.2](https://github.com/MapColonies/raster-shared/compare/v7.10.1...v7.10.2) (2026-03-17) diff --git a/package-lock.json b/package-lock.json index 9834e17..0b1f069 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@map-colonies/raster-shared", - "version": "7.10.2", + "version": "8.1.0-alpha.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@map-colonies/raster-shared", - "version": "7.10.2", + "version": "8.1.0-alpha.3", "license": "ISC", "dependencies": { "@map-colonies/mc-priority-queue": "^9.1.0", diff --git a/package.json b/package.json index 7a2f4db..4fa5f87 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@map-colonies/raster-shared", - "version": "7.10.2", + "version": "8.1.0-alpha.3", "description": "This is template for map colonies typescript packages", "main": "./dist/index.js", "exports": { diff --git a/release-please-config-alpha.json b/release-please-config-alpha.json index 96e15e0..ce764e4 100644 --- a/release-please-config-alpha.json +++ b/release-please-config-alpha.json @@ -5,7 +5,7 @@ "release-type": "node", "include-component-in-tag": false, "include-v-in-tag": true, - "initial-version": "0.0.1-alpha.1", + "initial-version": "8.0.0-alpha.0", "prerelease": true, "prerelease-type": "alpha", "versioning": "prerelease" diff --git a/release-please-config.json b/release-please-config.json index f8dddcc..1546977 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -2,6 +2,5 @@ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", "release-type": "node", "include-component-in-tag": false, - "include-v-in-tag": true, - "packages": {} + "include-v-in-tag": true } diff --git a/src/constants/core/constants.ts b/src/constants/core/constants.ts index 9f2f477..911e951 100644 --- a/src/constants/core/constants.ts +++ b/src/constants/core/constants.ts @@ -54,3 +54,15 @@ export const CORE_VALIDATIONS = { export const HASH_ALGORITHMS = ['XXH64'] as const; export type HashAlgorithm = (typeof HASH_ALGORITHMS)[number]; + +export const MAX_ZOOM_LEVEL = 22; + +/* eslint-disable @typescript-eslint/naming-convention */ +export const SourceType = { + S3: 'S3', + GPKG: 'GPKG', + FS: 'FS', +} as const; +/* eslint-enable @typescript-eslint/naming-convention */ + +export type SourceType = (typeof SourceType)[keyof typeof SourceType]; diff --git a/src/constants/export/constants.ts b/src/constants/export/constants.ts index b5a6ac8..26c58b4 100644 --- a/src/constants/export/constants.ts +++ b/src/constants/export/constants.ts @@ -9,18 +9,11 @@ export const TileFormatStrategy = { MIXED: 'mixed', } as const; -export const SourceType = { - S3: 'S3', - GPKG: 'GPKG', - FS: 'FS', -} as const; - export const ExportFinalizeType = { Full_Processing: 'FullProcessing', Error_Callback: 'ErrorCallback', } as const; export type TileFormatStrategy = (typeof TileFormatStrategy)[keyof typeof TileFormatStrategy]; -export type SourceType = (typeof SourceType)[keyof typeof SourceType]; export type ExportFinalizeType = (typeof ExportFinalizeType)[keyof typeof ExportFinalizeType]; /* eslint-disable @typescript-eslint/naming-convention */ diff --git a/src/constants/ingestion/constants.ts b/src/constants/ingestion/constants.ts index e300677..16d550a 100644 --- a/src/constants/ingestion/constants.ts +++ b/src/constants/ingestion/constants.ts @@ -49,7 +49,7 @@ export const INGESTION_VALIDATIONS = { max: 4000, }, productId: { - pattern: '^[A-Za-z]{1}[A-Za-z0-9_]{0,37}$', + pattern: '^[A-Za-z]{1}[A-Za-z0-9_]{0,36}$', description: 'Product ID must start with a letter and contain only letters, numbers and underscores', }, productVersion: { diff --git a/src/schemas/core/index.ts b/src/schemas/core/index.ts index 3a73c9e..6438621 100644 --- a/src/schemas/core/index.ts +++ b/src/schemas/core/index.ts @@ -6,3 +6,5 @@ export * from './aggregation.schema'; export * from './callback.schema'; export * from './link.schema'; export * from './file.schema'; +export * from './polygonParts.schema'; +export * from './tile.schema'; diff --git a/src/schemas/core/polygonParts.schema.ts b/src/schemas/core/polygonParts.schema.ts new file mode 100644 index 0000000..7a6d458 --- /dev/null +++ b/src/schemas/core/polygonParts.schema.ts @@ -0,0 +1,90 @@ +import { z } from 'zod'; +import { CORE_VALIDATIONS, INGESTION_VALIDATIONS } from '../../constants'; +import { featureCollectionSchema, featureSchema, multiPolygonSchema, polygonSchema } from './geo.schema'; + +const polygonalGeometrySchema = polygonSchema.or(multiPolygonSchema).describe('polygonalGeometrySchema'); + +export const partSchema = z + .object({ + id: z.string(), + sourceId: z.string({ message: 'Source id should be a string' }).optional(), + sourceName: z.string({ message: 'Source name should be a string' }).min(1, { message: 'Source name should have length of at least 1' }), + description: z.string({ message: 'Description should be a string' }).optional(), + imagingTimeBeginUTC: z.coerce.date({ message: 'Imaging time begin UTC should be a datetime' }), + imagingTimeEndUTC: z.coerce.date({ message: 'Imaging time end UTC should be a datetime' }), + resolutionDegree: z + .number({ message: 'Resolution degree should be a number' }) + .min(CORE_VALIDATIONS.resolutionDeg.min, { + message: `Resolution degree should not be less than ${CORE_VALIDATIONS.resolutionDeg.min}`, + }) + .max(CORE_VALIDATIONS.resolutionDeg.max, { + message: `Resolution degree should not be larger than ${CORE_VALIDATIONS.resolutionDeg.max}`, + }), + resolutionMeter: z + .number({ message: 'Resolution meter should be a number' }) + .min(INGESTION_VALIDATIONS.resolutionMeter.min, { + message: `Resolution meter should not be less than ${INGESTION_VALIDATIONS.resolutionMeter.min}`, + }) + .max(INGESTION_VALIDATIONS.resolutionMeter.max, { + message: `Resolution meter should not be larger than ${INGESTION_VALIDATIONS.resolutionMeter.max}`, + }), + sourceResolutionMeter: z + .number({ message: 'Source resolution meter should be a number' }) + .min(INGESTION_VALIDATIONS.resolutionMeter.min, { + message: `Source resolution meter should not be less than ${INGESTION_VALIDATIONS.resolutionMeter.min}`, + }) + .max(INGESTION_VALIDATIONS.resolutionMeter.max, { + message: `Source resolution meter should not be larger than ${INGESTION_VALIDATIONS.resolutionMeter.max}`, + }), + horizontalAccuracyCE90: z + .number({ message: 'Horizontal accuracy CE90 should be a number' }) + .min(INGESTION_VALIDATIONS.horizontalAccuracyCE90.min, { + message: `Horizontal accuracy CE90 should not be less than ${INGESTION_VALIDATIONS.horizontalAccuracyCE90.min}`, + }) + .max(INGESTION_VALIDATIONS.horizontalAccuracyCE90.max, { + message: `Horizontal accuracy CE90 should not be larger than ${INGESTION_VALIDATIONS.horizontalAccuracyCE90.max}`, + }), + sensors: z + .array( + z.string({ message: 'Sensors should be an array of strings' }).regex(new RegExp(INGESTION_VALIDATIONS.sensor.pattern), { + message: 'Sensors should be an array with items not starting or ending with whitespace characters', + }), + { message: 'Sensors should be an array' } + ) + .min(1, { message: 'Sensors should have an array length of at least 1' }), + countries: z + .array(z.string({ message: 'Countries should be an array of strings' }).min(1, { message: 'Countries should have length of at least 1' }), { + message: 'Countries should be an array', + }) + .optional(), + cities: z + .array(z.string({ message: 'Cities should be an array of strings' }).min(1, { message: 'Cities should have length of at least 1' }), { + message: 'Cities should be an array', + }) + .optional(), + }) + .refine((part) => part.imagingTimeBeginUTC <= part.imagingTimeEndUTC && part.imagingTimeEndUTC <= new Date(), { + message: 'Imaging time begin UTC should be less than or equal to imaging time end UTC and both less than or equal to current timestamp', + }) + .describe('partSchema'); +export const partsSchema = z.array(partSchema).describe('partsSchema'); + +//#region intersection +export const intersectionFeaturePropertiesSchema = partSchema._def.schema + .pick({ resolutionDegree: true }) + .describe('intersectionFeaturePropertiesSchema'); +export const intersectionFeatureGeometrySchema = polygonalGeometrySchema.describe('intersectionFeatureGeometrySchema'); +export const intersectionFeatureSchema = featureSchema(intersectionFeatureGeometrySchema, intersectionFeaturePropertiesSchema).describe( + 'intersectionFeatureGeometrySchema' +); +export const intersectionFeatureCollectionSchema = featureCollectionSchema(intersectionFeatureSchema) + .and(z.object({ features: intersectionFeatureSchema.array().length(1) })) + .describe('intersectionFeatureCollectionSchema'); + +export const intersectedFeaturePropertiesSchema = z.object({}).strict().describe('intersectedFeaturePropertiesSchema'); +export const intersectedFeatureGeometrySchema = polygonalGeometrySchema.describe('intersectedFeatureGeometrySchema'); +export const intersectedFeatureSchema = featureSchema(intersectedFeatureGeometrySchema, intersectedFeaturePropertiesSchema).describe( + 'intersectedFeatureSchema' +); +export const intersectedFeatureCollectionSchema = featureCollectionSchema(intersectedFeatureSchema).describe('intersectedFeatureCollectionSchema'); +//#endregion diff --git a/src/schemas/core/tile.schema.ts b/src/schemas/core/tile.schema.ts new file mode 100644 index 0000000..3e46911 --- /dev/null +++ b/src/schemas/core/tile.schema.ts @@ -0,0 +1,26 @@ +import { z } from 'zod'; +import { MAX_ZOOM_LEVEL, SourceType, TileOutputFormat } from '../../constants'; + +export const tileRangeSchema = z.object({ + zoom: z.number().int().min(0).max(MAX_ZOOM_LEVEL), + minX: z.number().int().min(0), + maxX: z.number().int().min(0), + minY: z.number().int().min(0), + maxY: z.number().int().min(0), +}); + +export const tilesDeletionParamsBaseSchema = z.object({ + tilesPath: z.string().min(1), // Base path for the tiles to be deleted + ranges: z.array(tileRangeSchema).min(1), // Array of tile ranges to be deleted + fileExtension: z.literal(TileOutputFormat.PNG.toLowerCase()).or(z.literal(TileOutputFormat.JPEG.toLowerCase())), // File extension of the tiles (e.g., 'png', 'jpeg') +}); + +export const s3TilesDeletionParamsSchema = tilesDeletionParamsBaseSchema.extend({ + sourceProvider: z.literal(SourceType.S3), +}); + +export const fsTilesDeletionParamsSchema = tilesDeletionParamsBaseSchema.extend({ + sourceProvider: z.literal(SourceType.FS), +}); + +export const tilesDeletionParamsSchema = z.discriminatedUnion('sourceProvider', [s3TilesDeletionParamsSchema, fsTilesDeletionParamsSchema]); diff --git a/src/schemas/ingestion/job.schema.ts b/src/schemas/ingestion/job.schema.ts index a2d1cc7..e475147 100644 --- a/src/schemas/ingestion/job.schema.ts +++ b/src/schemas/ingestion/job.schema.ts @@ -1,10 +1,12 @@ import z from 'zod'; -import { CORE_VALIDATIONS } from '../../constants'; +import { CORE_VALIDATIONS, JobTypes } from '../../constants'; import { urlsArraySchema } from '../core'; import { newAdditionalParamsSchema, swapUpdateAdditionalParamsSchema, updateAdditionalParamsSchema } from './additionalParams.schema'; import { inputFilesSchema } from './inputFiles.schema'; import { newRasterLayerMetadataSchema, updateRasterLayerMetadataSchema } from './metadata.schema'; +export const ingestionJobTypeSchema = z.enum([JobTypes.Ingestion_New, JobTypes.Ingestion_Swap_Update, JobTypes.Ingestion_Update]); + export const ingestionResolutionSchema = z .number({ message: 'Resolution degree should be a number' }) .min(CORE_VALIDATIONS.resolutionDeg.min, { diff --git a/src/schemas/ingestion/polygonParts.schema.ts b/src/schemas/ingestion/polygonParts.schema.ts index f65a918..5a1cef0 100644 --- a/src/schemas/ingestion/polygonParts.schema.ts +++ b/src/schemas/ingestion/polygonParts.schema.ts @@ -1,6 +1,4 @@ import { z } from 'zod'; -import { CORE_VALIDATIONS } from '../../constants'; -import { INGESTION_VALIDATIONS } from '../../constants/ingestion/constants'; import { featureCollectionSchema, featureSchema, @@ -10,74 +8,10 @@ import { resourceIdSchema, versionSchema, } from '../core'; +import { partSchema } from '../core/polygonParts.schema'; +import { ingestionJobTypeSchema } from './job.schema'; import { polygonPartsEntityPatternSchema } from './layerNameFormats.schema'; -export const partSchema = z - .object({ - id: z.string(), - sourceId: z.string({ message: 'Source id should be a string' }).optional(), - sourceName: z.string({ message: 'Source name should be a string' }).min(1, { message: 'Source name should have length of at least 1' }), - description: z.string({ message: 'Description should be a string' }).optional(), - imagingTimeBeginUTC: z.coerce.date({ message: 'Imaging time begin UTC should be a datetime' }), - imagingTimeEndUTC: z.coerce.date({ message: 'Imaging time end UTC should be a datetime' }), - resolutionDegree: z - .number({ message: 'Resolution degree should be a number' }) - .min(CORE_VALIDATIONS.resolutionDeg.min, { - message: `Resolution degree should not be less than ${CORE_VALIDATIONS.resolutionDeg.min}`, - }) - .max(CORE_VALIDATIONS.resolutionDeg.max, { - message: `Resolution degree should not be larger than ${CORE_VALIDATIONS.resolutionDeg.max}`, - }), - resolutionMeter: z - .number({ message: 'Resolution meter should be a number' }) - .min(INGESTION_VALIDATIONS.resolutionMeter.min, { - message: `Resolution meter should not be less than ${INGESTION_VALIDATIONS.resolutionMeter.min}`, - }) - .max(INGESTION_VALIDATIONS.resolutionMeter.max, { - message: `Resolution meter should not be larger than ${INGESTION_VALIDATIONS.resolutionMeter.max}`, - }), - sourceResolutionMeter: z - .number({ message: 'Source resolution meter should be a number' }) - .min(INGESTION_VALIDATIONS.resolutionMeter.min, { - message: `Source resolution meter should not be less than ${INGESTION_VALIDATIONS.resolutionMeter.min}`, - }) - .max(INGESTION_VALIDATIONS.resolutionMeter.max, { - message: `Source resolution meter should not be larger than ${INGESTION_VALIDATIONS.resolutionMeter.max}`, - }), - horizontalAccuracyCE90: z - .number({ message: 'Horizontal accuracy CE90 should be a number' }) - .min(INGESTION_VALIDATIONS.horizontalAccuracyCE90.min, { - message: `Horizontal accuracy CE90 should not be less than ${INGESTION_VALIDATIONS.horizontalAccuracyCE90.min}`, - }) - .max(INGESTION_VALIDATIONS.horizontalAccuracyCE90.max, { - message: `Horizontal accuracy CE90 should not be larger than ${INGESTION_VALIDATIONS.horizontalAccuracyCE90.max}`, - }), - sensors: z - .array( - z.string({ message: 'Sensors should be an array of strings' }).regex(new RegExp(INGESTION_VALIDATIONS.sensor.pattern), { - message: 'Sensors should be an array with items not starting or ending with whitespace characters', - }), - { message: 'Sensors should be an array' } - ) - .min(1, { message: 'Sensors should have an array length of at least 1' }), - countries: z - .array(z.string({ message: 'Countries should be an array of strings' }).min(1, { message: 'Countries should have length of at least 1' }), { - message: 'Countries should be an array', - }) - .optional(), - cities: z - .array(z.string({ message: 'Cities should be an array of strings' }).min(1, { message: 'Cities should have length of at least 1' }), { - message: 'Cities should be an array', - }) - .optional(), - }) - .refine((part) => part.imagingTimeBeginUTC <= part.imagingTimeEndUTC && part.imagingTimeEndUTC <= new Date(), { - message: 'Imaging time begin UTC should be less than or equal to imaging time end UTC and both less than or equal to current timestamp', - }) - .describe('partSchema'); - -export const partsSchema = z.array(partSchema).describe('partsSchema'); - export const polygonPartsEntityNameSchema = z .object({ polygonPartsEntityName: polygonPartsEntityPatternSchema, @@ -89,7 +23,7 @@ export const polygonPartsFeatureSchema = featureSchema(polygonSchema.or(multiPol export const polygonPartsFeatureCollectionSchema = featureCollectionSchema(polygonPartsFeatureSchema); export const polygonPartsPayloadSchema = z.object({ - jobType: z.string(), + jobType: ingestionJobTypeSchema, productType: rasterProductTypeSchema, catalogId: z.string().uuid({ message: 'Catalog ID should be a valid UUID' }), productId: resourceIdSchema, diff --git a/src/schemas/ingestion/validationTask.schema.ts b/src/schemas/ingestion/validationTask.schema.ts index 930ddd7..b3e1824 100644 --- a/src/schemas/ingestion/validationTask.schema.ts +++ b/src/schemas/ingestion/validationTask.schema.ts @@ -22,6 +22,7 @@ export const thresholdsSchema = z.object({ count: counterSchema, }), smallGeometries: thresholdCheckSchema.describe('Small geometries threshold check result'), + resolution: thresholdCheckSchema.describe('Resolution threshold check result'), }); export const validationAggregatedErrorsSchema = z.object({ diff --git a/src/types/core/index.ts b/src/types/core/index.ts index 044b5f9..b27df06 100644 --- a/src/types/core/index.ts +++ b/src/types/core/index.ts @@ -6,3 +6,5 @@ export * from './part.type'; export * from './link.type'; export * from './file.type'; export * from './callback.type'; +export * from './polygonParts.type'; +export * from './tile.type'; diff --git a/src/types/core/polygonParts.type.ts b/src/types/core/polygonParts.type.ts new file mode 100644 index 0000000..4cdd8f1 --- /dev/null +++ b/src/types/core/polygonParts.type.ts @@ -0,0 +1,20 @@ +import { z } from 'zod'; +import type { + intersectionFeaturePropertiesSchema, + intersectionFeatureGeometrySchema, + intersectionFeatureSchema, + intersectionFeatureCollectionSchema, + intersectedFeaturePropertiesSchema, + intersectedFeatureGeometrySchema, + intersectedFeatureSchema, + intersectedFeatureCollectionSchema, +} from '../../schemas/core/polygonParts.schema'; + +export type IntersectionFeatureProperties = z.infer; +export type IntersectionFeatureGeometry = z.infer; +export type IntersectionFeature = z.infer; +export type IntersectionFeatureCollection = z.infer; +export type IntersectedFeatureProperties = z.infer; +export type IntersectedFeatureGeometry = z.infer; +export type IntersectedFeature = z.infer; +export type IntersectedFeatureCollection = z.infer; diff --git a/src/types/core/tile.type.ts b/src/types/core/tile.type.ts new file mode 100644 index 0000000..15570f7 --- /dev/null +++ b/src/types/core/tile.type.ts @@ -0,0 +1,5 @@ +import z from 'zod'; +import { tileRangeSchema, tilesDeletionParamsSchema } from '../../schemas/core/tile.schema'; + +export type TilesDeletionParams = z.infer; +export type TileRange = z.infer; diff --git a/src/types/ingestion/job.type.ts b/src/types/ingestion/job.type.ts index 5925f90..ebd9f16 100644 --- a/src/types/ingestion/job.type.ts +++ b/src/types/ingestion/job.type.ts @@ -1,8 +1,15 @@ import { z } from 'zod'; -import { ingestionNewJobParamsSchema, ingestionSwapUpdateJobParamsSchema, ingestionUpdateJobParamsSchema } from '../../schemas'; +import { + ingestionNewJobParamsSchema, + ingestionSwapUpdateJobParamsSchema, + ingestionUpdateJobParamsSchema, + type ingestionJobTypeSchema, +} from '../../schemas'; //#region IngestionJobParams export type IngestionNewJobParams = z.infer; export type IngestionUpdateJobParams = z.infer; export type IngestionSwapUpdateJobParams = z.infer; //#endregion + +export type IngestionJobType = z.infer; diff --git a/src/types/ingestion/report.type.ts b/src/types/ingestion/report.type.ts index 3de23c8..ebd0c47 100644 --- a/src/types/ingestion/report.type.ts +++ b/src/types/ingestion/report.type.ts @@ -7,9 +7,20 @@ export type PolygonPartValidationErrorsType = Pick< 'RESOLUTION' | 'GEOMETRY_VALIDITY' | 'SMALL_GEOMETRY' | 'SMALL_HOLES' | 'UNKNOWN' >[keyof Pick]; +export interface PolygonPartValidationResolutionErrorItem { + code: (typeof ValidationErrorType)['RESOLUTION']; + isExceeded: boolean; +} + +export interface PolygonPartValidationGeneralErrorItem { + code: Exclude; +} + +export type PolygonPartValidationErrorItem = PolygonPartValidationResolutionErrorItem | PolygonPartValidationGeneralErrorItem; + export interface PolygonPartValidationError { id: string; - errors: PolygonPartValidationErrorsType[]; + errors: PolygonPartValidationErrorItem[]; } export interface PolygonPartsChunkValidationResult { parts: PolygonPartValidationError[];