You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@postgresql-typed/util

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@postgresql-typed/util - npm Package Compare versions

Comparing version

to
0.10.1

160

lib/util/config/configs/cli/DefinerModes.js
import { defineUntypedSchema } from "untyped";
const schema = defineUntypedSchema({
bytea: {
$default: "Buffer",
$resolve: (value) => (typeof value === "string" && ["ByteA", "Buffer", "string"].includes(value) ? value : "Buffer"),
},
bit: {

@@ -19,2 +15,10 @@ $default: "string",

},
box: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Box", "string"].includes(value) ? value : "string"),
},
bytea: {
$default: "Buffer",
$resolve: (value) => (typeof value === "string" && ["ByteA", "Buffer", "string"].includes(value) ? value : "Buffer"),
},
character: {

@@ -28,10 +32,6 @@ $default: "string",

},
name: {
circle: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Name", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["Circle", "string"].includes(value) ? value : "string"),
},
text: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Text", "string"].includes(value) ? value : "string"),
},
date: {

@@ -49,50 +49,54 @@ $default: "globalThis.Date",

},
interval: {
enum: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Interval", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["Enum", "string"].includes(value) ? value : "string"),
},
time: {
$default: "globalThis.Date",
$resolve: (value) => typeof value === "string" && ["Time", "globalThis.Date", "luxon.DateTime", "unix", "string"].includes(value) ? value : "globalThis.Date",
float4: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Float4", "string", "BigNumber", "number"].includes(value) ? value : "number"),
},
timestamp: {
$default: "globalThis.Date",
$resolve: (value) => typeof value === "string" && ["Timestamp", "globalThis.Date", "luxon.DateTime", "unix", "string"].includes(value) ? value : "globalThis.Date",
float8: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Float8", "string", "BigNumber", "number"].includes(value) ? value : "number"),
},
timestampMultiRange: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["TimestampMultiRange", "string"].includes(value) ? value : "string"),
int2: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Int2", "string", "number"].includes(value) ? value : "number"),
},
timestampRange: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["TimestampRange", "string"].includes(value) ? value : "string"),
int4: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Int4", "string", "number"].includes(value) ? value : "number"),
},
timestamptz: {
$default: "globalThis.Date",
$resolve: (value) => typeof value === "string" && ["TimestampTZ", "globalThis.Date", "luxon.DateTime", "unix", "string"].includes(value) ? value : "globalThis.Date",
},
timestamptzMultiRange: {
int4MultiRange: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["TimestampTZMultiRange", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["Int4MultiRange", "string"].includes(value) ? value : "string"),
},
timestamptzRange: {
int4Range: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["TimestampTZRange", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["Int4Range", "string"].includes(value) ? value : "string"),
},
timetz: {
$default: "globalThis.Date",
$resolve: (value) => typeof value === "string" && ["TimeTZ", "globalThis.Date", "luxon.DateTime", "unix", "string"].includes(value) ? value : "globalThis.Date",
int8: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Int8", "string", "BigInt", "number"].includes(value) ? value : "number"),
},
enum: {
int8MultiRange: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Enum", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["Int8MultiRange", "string"].includes(value) ? value : "string"),
},
box: {
int8Range: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Box", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["Int8Range", "string"].includes(value) ? value : "string"),
},
circle: {
interval: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Circle", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["Interval", "string"].includes(value) ? value : "string"),
},
json: {
$default: "value",
$resolve: (value) => (typeof value === "string" && ["JSON", "string", "value"].includes(value) ? value : "value"),
},
jsonb: {
$default: "value",
$resolve: (value) => (typeof value === "string" && ["JSON", "string", "value"].includes(value) ? value : "value"),
},
line: {

@@ -106,2 +110,14 @@ $default: "string",

},
money: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Money", "string", "BigNumber", "number"].includes(value) ? value : "number"),
},
name: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Name", "string"].includes(value) ? value : "string"),
},
oid: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["OID", "string", "number"].includes(value) ? value : "number"),
},
path: {

@@ -119,53 +135,37 @@ $default: "string",

},
json: {
$default: "value",
$resolve: (value) => (typeof value === "string" && ["JSON", "string", "value"].includes(value) ? value : "value"),
text: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Text", "string"].includes(value) ? value : "string"),
},
jsonb: {
$default: "value",
$resolve: (value) => (typeof value === "string" && ["JSON", "string", "value"].includes(value) ? value : "value"),
time: {
$default: "globalThis.Date",
$resolve: (value) => typeof value === "string" && ["Time", "globalThis.Date", "luxon.DateTime", "unix", "string"].includes(value) ? value : "globalThis.Date",
},
money: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Money", "string", "BigNumber", "number"].includes(value) ? value : "number"),
timestamp: {
$default: "globalThis.Date",
$resolve: (value) => typeof value === "string" && ["Timestamp", "globalThis.Date", "luxon.DateTime", "unix", "string"].includes(value) ? value : "globalThis.Date",
},
float4: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Float4", "string", "BigNumber", "number"].includes(value) ? value : "number"),
},
float8: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Float8", "string", "BigNumber", "number"].includes(value) ? value : "number"),
},
int2: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Int2", "string", "number"].includes(value) ? value : "number"),
},
int4: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Int4", "string", "number"].includes(value) ? value : "number"),
},
int4MultiRange: {
timestampMultiRange: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Int4MultiRange", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["TimestampMultiRange", "string"].includes(value) ? value : "string"),
},
int4Range: {
timestampRange: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Int4Range", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["TimestampRange", "string"].includes(value) ? value : "string"),
},
int8: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["Int8", "string", "BigInt", "number"].includes(value) ? value : "number"),
timestamptz: {
$default: "globalThis.Date",
$resolve: (value) => typeof value === "string" && ["TimestampTZ", "globalThis.Date", "luxon.DateTime", "unix", "string"].includes(value) ? value : "globalThis.Date",
},
int8MultiRange: {
timestamptzMultiRange: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Int8MultiRange", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["TimestampTZMultiRange", "string"].includes(value) ? value : "string"),
},
int8Range: {
timestamptzRange: {
$default: "string",
$resolve: (value) => (typeof value === "string" && ["Int8Range", "string"].includes(value) ? value : "string"),
$resolve: (value) => (typeof value === "string" && ["TimestampTZRange", "string"].includes(value) ? value : "string"),
},
oid: {
$default: "number",
$resolve: (value) => (typeof value === "string" && ["OID", "string", "number"].includes(value) ? value : "number"),
timetz: {
$default: "globalThis.Date",
$resolve: (value) => typeof value === "string" && ["TimeTZ", "globalThis.Date", "luxon.DateTime", "unix", "string"].includes(value) ? value : "globalThis.Date",
},

@@ -172,0 +172,0 @@ uuid: {

import { defineUntypedSchema } from "untyped";
import definerSchema from "./DefinerModes.js";
const schema = defineUntypedSchema({
directory: {
$default: "__generated__",
$resolve: value => (typeof value === "string" ? value : "__generated__"),
columnName: {
$default: "{{ COLUMN_NAME | camel-case }}",
$resolve: value => (typeof value === "string" ? value : "{{ COLUMN_NAME | camel-case }}"),
},
databaseFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}.ts",
$resolve: value => (typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}.ts"),
},
debug: {

@@ -12,7 +16,2 @@ $default: false,

},
preCompile: {
$default: false,
$resolve: Boolean,
},
definerModes: definerSchema,
debugFileName: {

@@ -22,2 +21,23 @@ $default: "debug_{{ TIMESTAMP }}.json",

},
definerModes: definerSchema,
definerOverrides: {
$default: {},
$resolve: value => {
if (typeof value === "object")
return value;
return {};
},
},
definerTypeOverrides: {
$default: {},
$resolve: value => {
if (typeof value === "object")
return value;
return {};
},
},
directory: {
$default: "__generated__",
$resolve: value => (typeof value === "string" ? value : "__generated__"),
},
domainFileName: {

@@ -31,2 +51,6 @@ $default: "_custom_types.ts",

},
enumFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}/enums/{{ TYPE_NAME | pascal-case }}.ts",
$resolve: value => (typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}/enums/{{ TYPE_NAME | pascal-case }}.ts"),
},
enumName: {

@@ -36,18 +60,26 @@ $default: "{{ TYPE_NAME | pascal-case }}",

},
enumFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}/enums/{{ TYPE_NAME | pascal-case }}.ts",
$resolve: value => (typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}/enums/{{ TYPE_NAME | pascal-case }}.ts"),
preCompile: {
$default: false,
$resolve: Boolean,
},
columnName: {
$default: "{{ COLUMN_NAME | camel-case }}",
$resolve: value => (typeof value === "string" ? value : "{{ COLUMN_NAME | camel-case }}"),
schemaFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}.ts",
$resolve: value => (typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}.ts"),
},
tableTypeName: {
$default: "{{ SCHEMA_NAME | pascal-case }}{{ TABLE_NAME | pascal-case }}",
$resolve: value => (typeof value === "string" ? value : "{{ SCHEMA_NAME | pascal-case }}{{ TABLE_NAME | pascal-case }}"),
schemaName: {
$default: "{{ SCHEMA_NAME | camel-case }}",
$resolve: value => (typeof value === "string" ? value : "{{ SCHEMA_NAME | camel-case }}"),
},
tableTypeFileName: {
schemasFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}/schemas.ts",
$resolve: value => (typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}/schemas.ts"),
},
tableFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}/{{ TABLE_NAME | camel-case }}.ts",
$resolve: value => typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}/{{ TABLE_NAME | camel-case }}.ts",
},
tableInsertTypeFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}/{{ TABLE_NAME | camel-case }}.ts",
$resolve: value => typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}/{{ TABLE_NAME | camel-case }}.ts",
},
tableInsertTypeName: {

@@ -57,6 +89,2 @@ $default: "New{{ SCHEMA_NAME | pascal-case }}{{ TABLE_NAME | pascal-case }}",

},
tableInsertTypeFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}/{{ TABLE_NAME | camel-case }}.ts",
$resolve: value => typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}/{{ TABLE_NAME | camel-case }}.ts",
},
tableName: {

@@ -66,40 +94,12 @@ $default: "{{ SCHEMA_NAME | camel-case }}{{ TABLE_NAME | pascal-case }}",

},
tableFileName: {
tableTypeFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}/{{ TABLE_NAME | camel-case }}.ts",
$resolve: value => typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}/{{ TABLE_NAME | camel-case }}.ts",
},
schemaName: {
$default: "{{ SCHEMA_NAME | camel-case }}",
$resolve: value => (typeof value === "string" ? value : "{{ SCHEMA_NAME | camel-case }}"),
tableTypeName: {
$default: "{{ SCHEMA_NAME | pascal-case }}{{ TABLE_NAME | pascal-case }}",
$resolve: value => (typeof value === "string" ? value : "{{ SCHEMA_NAME | pascal-case }}{{ TABLE_NAME | pascal-case }}"),
},
schemasFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}/schemas.ts",
$resolve: value => (typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}/schemas.ts"),
},
schemaFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}.ts",
$resolve: value => (typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}/{{ SCHEMA_NAME | camel-case }}.ts"),
},
databaseFileName: {
$default: "databases/{{ DATABASE_NAME | camel-case }}.ts",
$resolve: value => (typeof value === "string" ? value : "databases/{{ DATABASE_NAME | camel-case }}.ts"),
},
definerTypeOverrides: {
$default: {},
$resolve: value => {
if (typeof value === "object")
return value;
return {};
},
},
definerOverrides: {
$default: {},
$resolve: value => {
if (typeof value === "object")
return value;
return {};
},
},
});
export default schema;
//# sourceMappingURL=FilesConfig.js.map

@@ -7,2 +7,3 @@ import { defineUntypedSchema } from "untyped";

},
files: filesSchema,
schemas: {

@@ -28,5 +29,4 @@ $default: "*",

},
files: filesSchema,
});
export default schema;
//# sourceMappingURL=index.js.map
import { resolve } from "pathe";
import { defineUntypedSchema } from "untyped";
const schema = defineUntypedSchema({
rootDir: {
$default: process.cwd(),
$resolve: value => (typeof value === "string" ? resolve(value) : process.cwd()),
alias: {
$default: {},
$resolve: async (value, get) => ({
"@": await get("core.srcDir"),
"~": await get("core.srcDir"),
...value,
}),
},
srcDir: {
$default: "src/",
$resolve: async (value, get) => resolve(await get("core.rootDir"), value || "."),
extensions: {
$resolve: values => (Array.isArray(values) ? values.filter(Boolean) : []),
},

@@ -19,12 +22,9 @@ modulesDir: {

},
extensions: {
$resolve: values => (Array.isArray(values) ? values.filter(Boolean) : []),
rootDir: {
$default: process.cwd(),
$resolve: value => (typeof value === "string" ? resolve(value) : process.cwd()),
},
alias: {
$default: {},
$resolve: async (value, get) => ({
"~": await get("core.srcDir"),
"@": await get("core.srcDir"),
...value,
}),
srcDir: {
$default: "src/",
$resolve: async (value, get) => resolve(await get("core.rootDir"), value || "."),
},

@@ -31,0 +31,0 @@ });

@@ -5,7 +5,7 @@ import { loadConfig } from "c12";

let result = await loadConfig({
name: "pgt",
configFile: "pgt.config",
rcFile: ".pgtrc",
dotenv: true,
globalRc: true,
name: "pgt",
rcFile: ".pgtrc",
...options,

@@ -15,7 +15,7 @@ });

result = await loadConfig({
name: "postgresql-typed",
configFile: "postgresql-typed.config",
rcFile: ".postgresql-typedrc",
dotenv: true,
globalRc: true,
name: "postgresql-typed",
rcFile: ".postgresql-typedrc",
...options,

@@ -22,0 +22,0 @@ });

@@ -7,4 +7,4 @@ import { getParsedType } from "./getParsedType.js";

return {
expected: t,
objectKey: k,
expected: t,
received: "undefined",

@@ -19,4 +19,4 @@ };

return {
expected: t,
objectKey: k,
expected: t,
received: objectType,

@@ -28,6 +28,6 @@ };

return {
invalidKeys,
missingKeys,
otherKeys,
success: false,
otherKeys,
missingKeys,
invalidKeys,
};

@@ -37,13 +37,13 @@ }

return {
invalidKeys,
missingKeys: keys.map(([k]) => k),
otherKeys,
success: false,
otherKeys,
missingKeys: keys.map(([k]) => k),
invalidKeys,
};
}
return {
obj: object,
success: true,
obj: object,
};
};
//# sourceMappingURL=hasKeys.js.map
{
"name": "@postgresql-typed/util",
"version": "0.10.0",
"version": "0.10.1",
"description": "Utility functions for PostgreSQL-Typed",

@@ -34,15 +34,15 @@ "type": "module",

"bignumber.js": "^9.1.1",
"c12": "^1.4.1",
"c12": "^1.4.2",
"defu": "^6.1.2",
"hookable": "^5.5.3",
"luxon": "^3.3.0",
"pathe": "^1.1.0",
"untyped": "^1.3.2"
"pathe": "^1.1.1",
"untyped": "^1.4.0"
},
"devDependencies": {
"@types/luxon": "^3.3.0",
"@types/node": "^20.1.2",
"@types/pg": "^8.6.6",
"@types/luxon": "^3.3.1",
"@types/node": "^20.4.6",
"@types/pg": "^8.10.2",
"source-map-support": "^0.5.21",
"typescript": "^4.9.5"
"typescript": "^5.1.6"
},

@@ -52,3 +52,3 @@ "publishConfig": {

},
"packageManager": "pnpm@8.6.0",
"packageManager": "pnpm@8.6.11",
"engines": {

@@ -61,4 +61,4 @@ "node": ">=16",

"build": "tsc",
"lint": "eslint --fix --ext .ts ./ && prettier -w .",
"lint:ci": "eslint --ext .ts ./ && prettier --check .",
"lint": "eslint --ext .ts ./ && prettier --check .",
"lint:fix": "eslint --fix --ext .ts ./ && prettier -w .",
"test": "vitest --run",

@@ -65,0 +65,0 @@ "test:watch": "vitest --ui --coverage",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet