@dynatrace/backstage-plugin-dql-common
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -1,34 +0,2 @@ | ||
import _ from 'lodash'; | ||
import { z } from 'zod'; | ||
const tableCell = z.string().or( | ||
z.strictObject({ | ||
type: z.literal("link"), | ||
text: z.string(), | ||
url: z.string().url() | ||
}) | ||
); | ||
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 = { | ||
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; | ||
} | ||
}; | ||
export { TabularDataFactory }; | ||
export { TabularDataFactory } from './schema/tabularData.esm.js'; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -5,3 +5,3 @@ { | ||
"license": "Apache-2.0", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"main": "dist/index.cjs.js", | ||
@@ -19,6 +19,12 @@ "types": "dist/index.d.ts", | ||
"url": "git+https://github.com/Dynatrace/backstage-plugin.git", | ||
"directory": "plugins/dql-common" | ||
"directory": "plugins\\dql-common" | ||
}, | ||
"backstage": { | ||
"role": "common-library" | ||
"role": "common-library", | ||
"pluginId": "dql", | ||
"pluginPackages": [ | ||
"@dynatrace/backstage-plugin-dql", | ||
"@dynatrace/backstage-plugin-dql-backend", | ||
"@dynatrace/backstage-plugin-dql-common" | ||
] | ||
}, | ||
@@ -35,3 +41,3 @@ "sideEffects": false, | ||
"devDependencies": { | ||
"@backstage/cli": "^0.26.4", | ||
"@backstage/cli": "^0.26.6", | ||
"@types/lodash": "^4.17.0" | ||
@@ -46,4 +52,4 @@ }, | ||
}, | ||
"gitHead": "f6a63c556035a23eb9f633ffb555eb279be1df9f", | ||
"gitHead": "ea2844b14455e8d0e1d022ecacc86731f7c97266", | ||
"module": "dist/index.esm.js" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
23029
10
125