UNPKG

@seasketch/geoprocessing

Version:

Geoprocessing and reporting framework for SeaSketch 2.0

91 lines (90 loc) 3.6 kB
import { Flatbush } from "flatbush"; import { CompositeIndexDetails } from "./indexes.js"; /** * Retrieves metadata from the given DataSource on s3. If a deployed version of * the DataSource has not been created yet, 0 will be returned. * @export * @param {string} name DataSource name * @returns {number} */ export declare function getDataSourceVersion(name: string): Promise<{ currentVersion: number; lastPublished?: Date; bucket?: string; }>; /** * Create a bucket on S3 for storing a DataSource * @export * @param {string} name DataSource name * @param {boolean} [publicAccess] Only public DataSources at this time. * @returns {Promise<string>} Bucket website url */ export declare function createBucket(name: string, region: string, publicAccess?: boolean): Promise<string>; /** * Create a CloudFront distribution * @export * @param {string} name DataSource name * @returns {Promise<string>} Distribution url */ export declare function createCloudfrontDistribution(name: string, isRaster: boolean): Promise<CloudfrontDistributionDetails>; /** * Save a bundle to the DataSource's s3 bucket. * @export * @param {number} id * @param {number} version * @param {Uint8Array} geobuf */ export declare function putBundle(id: number, dataSourceName: string, version: number, geobuf: Uint8Array): Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>; /** * Save a bundle to the DataSource's s3 bucket. * @export * @param {number} id * @param {number} version * @param {Uint8Array} geobuf */ export declare function putRasterBundle(dataSourceName: any, fileName: string, version: number): Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>; /** * Save metadata and index resources to s3. Includes metadata.json and index * files. Function will split single Flatbush index into a composite index of * several files. Authors of geoprocessing function can use the main index or * the composites depending on performance needs. * @export * @param {string} dataSourceName * @param {number} version * @param {Flatbush} index * @param {CompositeIndexDetails} compositeIndexes */ export declare function putResources(dataSourceName: string, version: number, index: Flatbush, compositeIndexes: CompositeIndexDetails[]): Promise<void>; /** * Save metadata.json for raster resources to s3. Includes metadata.json. * files. * @export * @param {string} dataSourceName * @param {number} version */ export declare function putMetadataResources(dataSourceName: string, version: number): Promise<void>; /** * Invalidate cache of metadata.json related to the DataSource * @export * @param {string} name DataSource name */ export declare function invalidateCloudfrontDistribution(name: string): Promise<CloudfrontDistributionDetails>; export interface CloudfrontDistributionDetails { location: string; arn: string; id: string; } export declare function getCloudfrontDistributionDetails(name: string): Promise<CloudfrontDistributionDetails>; /** * Schedules old version of the given DataSource for deletion by creating new * Lifecycle Rules on the bucket. Objects will be deleted after 24 hours in * order to prevent disruption of DataSource use by existing clients. * In order to prevent Lifecycle Rules from constantly piling up, rules that are * more that 48 hours old will be deleted. * * @export * @param {string} dataSourceName * @param {number} version * @param {Date} lastPublished */ export declare function scheduleObjectsForDeletion(dataSourceName: string, version: number, lastPublished: Date): Promise<Date>;