Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@koopjs/geoservice-utils

Package Overview
Dependencies
Maintainers
7
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@koopjs/geoservice-utils - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

120

dist/standardize-geometry-filter/helpers.js

@@ -6,5 +6,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.isEnvelopeArray = exports.isSinglePointArray = exports.isArcgisEnvelope = exports.filterSchema = void 0;
exports.isEnvelopeArray = exports.isSinglePointArray = exports.isArcgisObject = exports.filterSchema = void 0;
const joi_1 = __importDefault(require("joi"));
const envelopeSchema = joi_1.default.object({
const envelopeSchema = joi_1.default
.object({
ymin: joi_1.default.number().strict().required(),

@@ -14,33 +15,96 @@ ymax: joi_1.default.number().strict().required(),

xmax: joi_1.default.number().strict().required(),
spatialReference: joi_1.default.object({
wkid: joi_1.default.number().strict().required()
}).unknown(true).optional()
});
spatialReference: joi_1.default
.object({
wkid: joi_1.default.number().strict().required(),
})
.unknown(true)
.optional(),
})
.unknown(true);
const envelopeArraySchema = joi_1.default.array().items(joi_1.default.number()).length(4);
const pointArraySchema = joi_1.default.array().items(joi_1.default.number()).length(2);
const pointSchema = joi_1.default.object({
const pointSchema = joi_1.default
.object({
y: joi_1.default.number().strict().required(),
x: joi_1.default.number().strict().required()
});
const multiPointSchema = joi_1.default.object({
points: joi_1.default.array().items(pointArraySchema).min(2)
});
const lineStringSchema = joi_1.default.object({
paths: joi_1.default.array().items(joi_1.default.array().items(pointArraySchema).length(1))
});
const multiLineStringSchema = joi_1.default.object({
paths: joi_1.default.array().items(joi_1.default.array().items(pointArraySchema).min(2))
});
const polygonSchema = joi_1.default.object({
rings: joi_1.default.array().items(joi_1.default.array().items(pointArraySchema).length(1))
});
const multipolygonSchema = joi_1.default.object({
rings: joi_1.default.array().items(joi_1.default.array().items(pointArraySchema).min(2))
});
exports.filterSchema = joi_1.default.alternatives(envelopeSchema, envelopeArraySchema, pointArraySchema, pointSchema, multiPointSchema, lineStringSchema, multiLineStringSchema, polygonSchema, multipolygonSchema).required();
function isArcgisEnvelope(input) {
const { error } = envelopeSchema.validate(input);
x: joi_1.default.number().strict().required(),
spatialReference: joi_1.default
.object({
wkid: joi_1.default.number().strict().required(),
})
.unknown(true)
.optional(),
})
.unknown(true);
const multiPointSchema = joi_1.default
.object({
points: joi_1.default.array().items(pointArraySchema).min(2).required(),
spatialReference: joi_1.default
.object({
wkid: joi_1.default.number().strict().required(),
})
.unknown(true)
.optional(),
})
.unknown(true);
const lineStringSchema = joi_1.default
.object({
paths: joi_1.default.array().items(joi_1.default.array().items(pointArraySchema).length(1)).required(),
spatialReference: joi_1.default
.object({
wkid: joi_1.default.number().strict().required(),
})
.unknown(true)
.optional(),
})
.unknown(true);
const multiLineStringSchema = joi_1.default
.object({
paths: joi_1.default.array().items(joi_1.default.array().items(pointArraySchema).min(2)).required(),
spatialReference: joi_1.default
.object({
wkid: joi_1.default.number().strict().required(),
})
.unknown(true)
.optional(),
})
.unknown(true);
const polygonSchema = joi_1.default
.object({
rings: joi_1.default.array().items(joi_1.default.array().items(pointArraySchema).length(1)).required(),
spatialReference: joi_1.default
.object({
wkid: joi_1.default.number().strict().required(),
})
.unknown(true)
.optional(),
})
.unknown(true);
const multipolygonSchema = joi_1.default
.object({
rings: joi_1.default.array().items(joi_1.default.array().items(pointArraySchema).min(2)).required(),
spatialReference: joi_1.default
.object({
wkid: joi_1.default.number().strict().required(),
})
.unknown(true)
.optional(),
})
.unknown(true);
exports.filterSchema = joi_1.default
.alternatives(envelopeSchema, envelopeArraySchema, pointArraySchema, pointSchema, multiPointSchema, lineStringSchema, multiLineStringSchema, polygonSchema, multipolygonSchema)
.required();
function passesValidation(schema, input) {
const { error } = schema.validate(input);
return !error;
}
exports.isArcgisEnvelope = isArcgisEnvelope;
function isArcgisObject(input) {
return (passesValidation(envelopeSchema, input) ||
passesValidation(pointSchema, input) ||
passesValidation(lineStringSchema, input) ||
passesValidation(polygonSchema, input) ||
passesValidation(multiPointSchema, input) ||
passesValidation(multiLineStringSchema, input) ||
passesValidation(multipolygonSchema, input));
}
exports.isArcgisObject = isArcgisObject;
function isSinglePointArray(input) {

@@ -47,0 +111,0 @@ const { error } = pointArraySchema.validate(input);

@@ -64,3 +64,3 @@ "use strict";

function extractGeometryFilterSpatialReference(filter) {
if ((0, helpers_1.isArcgisEnvelope)(filter)) {
if ((0, helpers_1.isArcgisObject)(filter)) {
return filter.spatialReference;

@@ -67,0 +67,0 @@ }

{
"name": "@koopjs/geoservice-utils",
"version": "2.1.2",
"version": "2.1.3",
"description": "A set of utilities for working with Geoservice requests and parameters.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc