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

@dynatrace/backstage-plugin-dql-common

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dynatrace/backstage-plugin-dql-common - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

dist/schema/dynatraceQueries.cjs.js

59

dist/index.cjs.js
'use strict';
var _ = require('lodash');
var zod = require('zod');
var tabularData = require('./schema/tabularData.cjs.js');
var dynatraceQueries = require('./schema/dynatraceQueries.cjs.js');
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
var ___default = /*#__PURE__*/_interopDefaultCompat(_);
const tableCell = zod.z.string().or(
zod.z.strictObject({
type: zod.z.literal("link"),
text: zod.z.string(),
url: zod.z.string().url()
})
);
const rowData = zod.z.record(tableCell);
const tabularDataSchema = zod.z.array(rowData);
const validate = (data) => {
if (data.length === 0) return true;
const keys = ___default.default.keys(data[0]);
return data.every((item) => ___default.default.isEqual(___default.default.keys(item), keys));
};
const TabularDataFactory = {
fromString: (input) => {
const data = JSON.parse(input);
return TabularDataFactory.fromObject(data);
},
fromObject: (input) => {
const tabularData = tabularDataSchema.parse(input);
if (!validate(tabularData)) {
throw new Error("Invalid tabular data");
}
return tabularData;
}
};
const entityQuerySchema = zod.z.object({
/**
* The id of the query.
*/
id: zod.z.string(),
/**
* The query itself.
*/
query: zod.z.string(),
/**
* The description of the query.
*/
description: zod.z.string().optional(),
/**
* The environments in which the query is executed.
*/
environments: zod.z.array(zod.z.string()).optional()
});
const dynatraceCatalogQuerySchema = zod.z.array(entityQuerySchema).min(1);
exports.TabularDataFactory = TabularDataFactory;
exports.dynatraceCatalogQuerySchema = dynatraceCatalogQuerySchema;
exports.TableTypes = tabularData.TableTypes;
exports.TabularDataFactory = tabularData.TabularDataFactory;
exports.dynatraceCatalogQuerySchema = dynatraceQueries.dynatraceCatalogQuerySchema;
//# sourceMappingURL=index.cjs.js.map
import { z } from 'zod';
import { EntityMeta, Entity } from '@backstage/catalog-model';
declare const tableCell: z.ZodUnion<[z.ZodString, z.ZodObject<{
type: z.ZodLiteral<"link">;
/**
* @license
* Copyright 2024 Dynatrace LLC
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare enum TableTypes {
LINK = "link",
OBJECT = "object"
}
declare const tableCell: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodNull, z.ZodBoolean]>, z.ZodNumber]>, string, number | boolean | null>]>, z.ZodObject<{
type: z.ZodLiteral<TableTypes.LINK>;
text: z.ZodString;
url: z.ZodString;
}, "strict", z.ZodTypeAny, {
type: "link";
type: TableTypes.LINK;
url: string;
text: string;
}, {
type: "link";
type: TableTypes.LINK;
url: string;
text: string;
}>]>;
declare const rowData: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
type: z.ZodLiteral<"link">;
}>]>, z.ZodEffects<z.ZodUnion<[z.ZodArray<z.ZodAny, "many">, z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>, {
type: TableTypes.OBJECT;
content: string;
}, any[] | z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>;
declare const rowData: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodNull, z.ZodBoolean]>, z.ZodNumber]>, string, number | boolean | null>]>, z.ZodObject<{
type: z.ZodLiteral<TableTypes.LINK>;
text: z.ZodString;
url: z.ZodString;
}, "strict", z.ZodTypeAny, {
type: "link";
type: TableTypes.LINK;
url: string;
text: string;
}, {
type: "link";
type: TableTypes.LINK;
url: string;
text: string;
}>]>>;
declare const tabularDataSchema: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
type: z.ZodLiteral<"link">;
}>]>, z.ZodEffects<z.ZodUnion<[z.ZodArray<z.ZodAny, "many">, z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>, {
type: TableTypes.OBJECT;
content: string;
}, any[] | z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>>;
declare const tabularDataSchema: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodNull, z.ZodBoolean]>, z.ZodNumber]>, string, number | boolean | null>]>, z.ZodObject<{
type: z.ZodLiteral<TableTypes.LINK>;
text: z.ZodString;
url: z.ZodString;
}, "strict", z.ZodTypeAny, {
type: "link";
type: TableTypes.LINK;
url: string;
text: string;
}, {
type: "link";
type: TableTypes.LINK;
url: string;
text: string;
}>]>>, "many">;
}>]>, z.ZodEffects<z.ZodUnion<[z.ZodArray<z.ZodAny, "many">, z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>, {
type: TableTypes.OBJECT;
content: string;
}, any[] | z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>>, "many">;
declare const TabularDataFactory: {
fromString: (input: string) => TabularData;
fromObject: (input: unknown) => Record<string, string | {
type: "link";
type: TableTypes.LINK;
url: string;
text: string;
} | {
type: TableTypes.OBJECT;
content: string;
}>[];

@@ -137,2 +169,2 @@ };

export { type EntityQuery, type ExtendedEntity, type ExtendedEntityMetadata, type TabularData, type TabularDataCell, TabularDataFactory, type TabularDataRow, dynatraceCatalogQuerySchema };
export { type EntityQuery, type ExtendedEntity, type ExtendedEntityMetadata, TableTypes, type TabularData, type TabularDataCell, TabularDataFactory, type TabularDataRow, dynatraceCatalogQuerySchema };

@@ -1,3 +0,3 @@

export { TabularDataFactory } from './schema/tabularData.esm.js';
export { TableTypes, TabularDataFactory } from './schema/tabularData.esm.js';
export { dynatraceCatalogQuerySchema } from './schema/dynatraceQueries.esm.js';
//# sourceMappingURL=index.esm.js.map

@@ -1,18 +0,22 @@

import _ from 'lodash';
import { z } from 'zod';
const tableCell = z.string().or(
var TableTypes = /* @__PURE__ */ ((TableTypes2) => {
TableTypes2["LINK"] = "link";
TableTypes2["OBJECT"] = "object";
return TableTypes2;
})(TableTypes || {});
const tableCell = z.string().or(z.null().or(z.boolean()).or(z.number()).transform(String)).or(
z.strictObject({
type: z.literal("link"),
type: z.literal("link" /* LINK */),
text: z.string(),
url: z.string().url()
})
).or(
z.array(z.any()).or(z.object({}).passthrough()).transform((obj) => ({
type: "object" /* OBJECT */,
content: JSON.stringify(obj, null, 2)
}))
);
const rowData = z.record(tableCell);
const tabularDataSchema = z.array(rowData);
const validate = (data) => {
if (data.length === 0) return true;
const keys = _.keys(data[0]);
return data.every((item) => _.isEqual(_.keys(item), keys));
};
const TabularDataFactory = {

@@ -24,11 +28,7 @@ fromString: (input) => {

fromObject: (input) => {
const tabularData = tabularDataSchema.parse(input);
if (!validate(tabularData)) {
throw new Error("Invalid tabular data");
}
return tabularData;
return tabularDataSchema.parse(input);
}
};
export { TabularDataFactory };
export { TableTypes, TabularDataFactory };
//# sourceMappingURL=tabularData.esm.js.map

@@ -5,3 +5,3 @@ {

"license": "Apache-2.0",
"version": "2.1.3",
"version": "2.1.4",
"main": "dist/index.cjs.js",

@@ -39,3 +39,3 @@ "types": "dist/index.d.ts",

"devDependencies": {
"@backstage/cli": "^0.26.6",
"@backstage/cli": "^0.28.0",
"@types/lodash": "^4.17.0"

@@ -50,4 +50,4 @@ },

},
"gitHead": "01889f85da23390a8a22df038b64be670c4008a8",
"gitHead": "d602fa7705ed5343872f59432c3da4398fa73c40",
"module": "dist/index.esm.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