New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@db-auto/tables

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@db-auto/tables - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

4

dist/src/clean.d.ts
import { NameAnd } from "@db-auto/utils";
import { CleanColumnData, ColumnDataObj, HereLinkAndThereLink, Key, Query, Table } from "./tables";
import { CleanColumnData, CleanLink, ColumnDataObj, Key, Query, Table } from "./tables";
export interface CleanTable {

@@ -10,3 +10,3 @@ table: string;

queries: NameAnd<Required<Query>>;
links: NameAnd<HereLinkAndThereLink>;
links: NameAnd<CleanLink>;
}

@@ -13,0 +13,0 @@ export declare function mapToNameAndColumnData(n: NameAnd<ColumnDataObj>): NameAnd<CleanColumnData>;

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

const queries = (0, utils_1.mapObject)((0, utils_1.safeObject)(table.queries), q => (Object.assign({ name: "", description: "", type: "string" }, q)));
const links = (0, utils_1.mapObject)((0, utils_1.safeObject)(table.links), tables_1.toHereLinkAndThereLink);
const links = (0, utils_1.mapObject)((0, utils_1.safeObject)(table.links), tables_1.toCleanLink);
return ({

@@ -36,0 +36,0 @@ table: tableName,

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

"mission": { "type": "one-to-many", "idHereAndThere": "driverId" },
"audit": { "type": "one-to-many", "idHereAndThere": "driverId" }
"audit": { "type": "one-to-many", "table": "driver_aud", "idHereAndThere": "driverId" }
},

@@ -20,0 +20,0 @@ "dataColumns": {

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

return [`Cannot find link ${p} in table ${table.table}. Full path is ${path}. Available links are: ${Object.keys(table.links)}`];
const nextTable = tables[p];
const nextTable = tables[link.table];
if (nextTable === undefined)

@@ -23,0 +23,0 @@ return [`Cannot find table ${p} in tables. Path is ${path.slice(0, index)}. Available tables are: ${Object.keys(tables)}`];

@@ -37,2 +37,17 @@ "use strict";

});
it("should build selectData when the link isn't the table name", () => {
expect((0, utils_1.mapErrors)((0, query_1.buildPlan)(query_fixture_1.clean, ["driver", "audit"]), (0, sql_1.selectData)("all"))).toEqual([
{
"alias": "T0",
"columns": ["*"],
"table": "DriverTable",
"where": "T0.driverId = T1.driverId"
},
{
"alias": "T1",
"columns": ["*"],
"table": "driver_aud"
}
]);
});
it("should build selectData with three steps", () => {

@@ -88,2 +103,8 @@ expect((0, utils_1.mapErrors)((0, query_1.buildPlan)(query_fixture_1.clean, ["driver", "mission", "mission_aud"]), (0, sql_1.selectData)("all"))).toEqual([

});
it("should make sql when link name isn't table name", () => {
expect((0, utils_1.mapErrors)((0, query_1.buildPlan)(query_fixture_1.clean, ["driver", "audit"]), plan => (0, sql_1.sqlFor)((0, sql_1.mergeSelectData)((0, sql_1.selectData)("all")(plan))))).toEqual([
"select T0.*, T1.*",
" from DriverTable T0, driver_aud T1 where T0.driverId = T1.driverId"
]);
});
});

@@ -23,6 +23,7 @@ import { NameAnd, NameAndValidator } from "@db-auto/utils";

export declare function idThere(link: Link): string;
export declare function toHereLinkAndThereLink(link: Link): HereLinkAndThereLink;
export declare function toCleanLink(link: Link, defaultTable: string): CleanLink;
export interface HereAndThereLink {
type: LinkType;
idHereAndThere: string;
table?: string;
}

@@ -34,3 +35,5 @@ export declare function isHereAndThereLink(link: Link): link is HereAndThereLink;

idThere: string;
table?: string;
}
export type CleanLink = Required<HereLinkAndThereLink>;
export declare function isHereLinkAndThereLink(link: Link): link is HereLinkAndThereLink;

@@ -37,0 +40,0 @@ export type View = string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanTable = exports.tableValidator = exports.linkValidator = exports.hereLinkAndThereLinkValidator = exports.hereAndThereLinkValidator = exports.linkTypeValidator = exports.keyValidator = exports.nameOfKey = exports.isHereLinkAndThereLink = exports.isHereAndThereLink = exports.toHereLinkAndThereLink = exports.idThere = exports.idHere = void 0;
exports.cleanTable = exports.tableValidator = exports.linkValidator = exports.hereLinkAndThereLinkValidator = exports.hereAndThereLinkValidator = exports.linkTypeValidator = exports.keyValidator = exports.nameOfKey = exports.isHereLinkAndThereLink = exports.isHereAndThereLink = exports.toCleanLink = exports.idThere = exports.idHere = void 0;
const utils_1 = require("@db-auto/utils");

@@ -19,8 +19,9 @@ function idHere(link) {

exports.idThere = idThere;
function toHereLinkAndThereLink(link) {
function toCleanLink(link, defaultTable) {
const table = link.table || defaultTable;
if (isHereAndThereLink(link))
return { type: link.type, idHere: link.idHereAndThere, idThere: link.idHereAndThere };
return link;
return { type: link.type, idHere: link.idHereAndThere, idThere: link.idHereAndThere, table };
return Object.assign({ table }, link);
}
exports.toHereLinkAndThereLink = toHereLinkAndThereLink;
exports.toCleanLink = toCleanLink;
function isHereAndThereLink(link) {

@@ -27,0 +28,0 @@ return link.idHereAndThere !== undefined;

{
"name": "@db-auto/tables",
"description": "",
"version": "0.0.7",
"version": "0.0.8",
"main": "dist/index",

@@ -20,3 +20,3 @@ "types": "dist/index",

"dependencies": {
"@db-auto/utils": "0.0.7"
"@db-auto/utils": "0.0.8"
},

@@ -23,0 +23,0 @@ "devDependencies": {

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