@@ -8,19 +8,19 @@ import { feature, featureCollection } from '@turf/helpers';
88import { withSpanAsyncV4 , withSpanV4 } from '@map-colonies/telemetry' ;
99import { IConfig , ICreateExportJobResponse , IExportInitRequest , IGeometryRecord , IJobStatusResponse } from '@src/common/interfaces' ;
1010import { MultiPolygon , Polygon } from 'geojson' ;
11- import { calculateEstimateGpkgSize , parseFeatureCollection } from '@src/common/utils' ;
11+ import { calculateEstimatedGpkgSize , parseFeatureCollection } from '@src/common/utils' ;
1212import {
13- LinksDefinition ,
1413 TileFormatStrategy ,
1514 SourceType ,
1615 CallbackExportResponse ,
17- CallbackUrls ,
1816 RoiProperties ,
1917 RasterProductTypes ,
2018 RoiFeatureCollection ,
2119 RasterLayerMetadata ,
2220 CORE_VALIDATIONS ,
2321 generateEntityName ,
22+ CallbackUrl ,
23+ FileNamesTemplates ,
2424} from '@map-colonies/raster-shared' ;
2525import { v4 as uuidv4 } from 'uuid' ;
2626import { CreateExportRequest } from '@src/utils/zod/schemas' ;
@@ -49,7 +49,7 @@ export class ExportManager {
4949
5050 @withSpanAsyncV4
5151 public async createExport ( exportRequest : CreateExportRequest ) : Promise < ICreateExportJobResponse | CallbackExportResponse > {
52- const { dbId : catalogId , crs, priority, callbackURLs , description } = exportRequest ;
52+ const { dbId : catalogId , crs, priority, callbackUrlArray , description } = exportRequest ;
5353 const layerMetadata = await this . validationManager . findLayer ( catalogId ) ;
5454
5555 let roi = exportRequest . roi ;
@@ -61,7 +61,13 @@ export class ExportManager {
6161
6262 const { productId, productVersion : version , maxResolutionDeg : srcRes } = layerMetadata ;
6363 const productType = layerMetadata . productType as RasterProductTypes ;
64- const callbacks = callbackURLs ? callbackURLs . map ( ( url ) => < CallbackUrls > { url } ) : undefined ;
64+ const callbackUrls = callbackUrlArray ?. map (
65+ ( url ) =>
66+ < CallbackUrl > {
67+ url,
68+ }
69+ ) ;
70+
6571 const maxZoom = degreesPerPixelToZoomLevel ( srcRes ) ;
6672
6773 // ROI vs layer validation section - zoom + geo intersection
@@ -72,34 +78,34 @@ export class ExportManager {
7278 srcRes
7379 ) ;
7480
75- const duplicationExist = await this . findJobDuplications ( productId , version , catalogId , roi , crs ?? DEFAULT_CRS , callbacks ) ;
81+ const duplicationExist = await this . findJobDuplications ( productId , version , catalogId , roi , crs ?? DEFAULT_CRS , callbackUrls ) ;
7682 if ( duplicationExist ) {
7783 return duplicationExist ;
7884 }
7985
80- const estimatesGpkgSize = calculateEstimateGpkgSize ( featuresRecords , layerMetadata . tileOutputFormat ) ;
81- await this . validationManager . validateFreeSpace ( estimatesGpkgSize , this . gpkgsLocation ) ;
86+ const gpkgEstimatedSize = calculateEstimatedGpkgSize ( featuresRecords , layerMetadata . tileOutputFormat ) ;
87+ await this . validationManager . validateFreeSpace ( gpkgEstimatedSize , this . gpkgsLocation ) ;
8288
8389 //creation of params
8490 const computedAttributes = this . computeFilePathAttributes ( productType , productId , version , featuresRecords ) ;
8591 const polygonPartsEntityName = generateEntityName ( productId , productType ) ;
8692
8793 const exportInitRequest : IExportInitRequest = {
8894 crs : crs ?? DEFAULT_CRS ,
89- roi : roi ,
90- callbackUrls : callbacks ,
95+ roi,
96+ callbackUrls,
9197 fileNamesTemplates : computedAttributes . fileNamesTemplates ,
9298 relativeDirectoryPath : computedAttributes . additionalIdentifiers ,
9399 packageRelativePath : computedAttributes . packageRelativePath ,
94100 catalogId,
95- version : version ,
101+ version,
96102 productId,
97103 productType,
98104 priority : priority ?? DEFAULT_PRIORITY ,
99105 description,
100106 targetFormat : layerMetadata . tileOutputFormat ,
101107 outputFormatStrategy : TileFormatStrategy . MIXED ,
102- gpkgEstimatedSize : estimatesGpkgSize ,
108+ gpkgEstimatedSize,
103109 jobTrackerUrl : this . jobTrackerUrl ,
104110 polygonPartsEntityName,
105111 } ;
@@ -126,9 +132,9 @@ export class ExportManager {
126132 catalogId : string ,
127133 roi : RoiFeatureCollection ,
128134 crs : string ,
129- callbacks ?: CallbackUrls [ ]
135+ callbackUrls ?: CallbackUrl [ ]
130136 ) : Promise < CallbackExportResponse | ICreateExportJobResponse | undefined > {
131- const duplicationExist = await this . validationManager . checkForExportDuplicate ( productId , version , catalogId , roi , crs , callbacks ) ;
137+ const duplicationExist = await this . validationManager . checkForExportDuplicate ( productId , version , catalogId , roi , crs , callbackUrls ) ;
132138
133139 if ( duplicationExist && duplicationExist . status === OperationStatus . COMPLETED ) {
134140 const callbackParam = duplicationExist as CallbackExportResponse ;
@@ -174,11 +180,11 @@ export class ExportManager {
174180 productId : string ,
175181 version : string ,
176182 featuresRecords : IGeometryRecord [ ]
177- ) : { fileNamesTemplates : LinksDefinition ; additionalIdentifiers : string ; packageRelativePath : string } {
183+ ) : { fileNamesTemplates : FileNamesTemplates ; additionalIdentifiers : string ; packageRelativePath : string } {
178184 const prefixPackageName = this . generateExportFileNames ( productType , productId , version , featuresRecords ) ;
179185 const packageName = `${ prefixPackageName } .gpkg` ;
180- const fileNamesTemplates : LinksDefinition = {
181- dataURI : packageName ,
186+ const fileNamesTemplates = {
187+ packageName,
182188 } ;
183189 const additionalIdentifiers = uuidv4 ( ) ;
184190 const separator = this . getSeparator ( ) ;
0 commit comments