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

@compas/store

Package Overview
Dependencies
Maintainers
1
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@compas/store - npm Package Compare versions

Comparing version 0.0.109 to 0.0.110

8

package.json
{
"name": "@compas/store",
"version": "0.0.109",
"version": "0.0.110",
"description": "Postgres & S3-compatible wrappers for common things",

@@ -17,4 +17,4 @@ "main": "./index.js",

"dependencies": {
"@compas/insight": "0.0.109",
"@compas/stdlib": "0.0.109",
"@compas/insight": "0.0.110",
"@compas/stdlib": "0.0.110",
"@types/minio": "7.0.7",

@@ -46,3 +46,3 @@ "mime-types": "2.1.28",

},
"gitHead": "9f9183bd35de467eb134a6b45256de05edb39573"
"gitHead": "c5c836870d2be6c9b55f421eb64035a176fa70d1"
}

@@ -27,3 +27,3 @@ import { createReadStream } from "fs";

* @param {string} bucketName
* @param {StoreFileInsertPartial_Input & { id?: string }} props
* @param {StoreFileInsertPartial} props
* @param {ReadStream|string} streamOrPath

@@ -30,0 +30,0 @@ * @returns {Promise<StoreFile>}

@@ -95,3 +95,3 @@ // Generated by @compas/code-gen

${internalQueryFileGroup(builder.group, query`AND fg."file" = f."id"`)}
ORDER BY ${fileGroupOrderBy()}
ORDER BY ${fileGroupOrderBy("fg.")}
${offsetLimitQb}

@@ -133,3 +133,3 @@ ) as "ljl_0" ON TRUE`);

${internalQueryFileGroupView(builder.groupView, query`AND fgv."file" = f."id"`)}
ORDER BY ${fileGroupViewOrderBy()}
ORDER BY ${fileGroupViewOrderBy("fgv.")}
${offsetLimitQb}

@@ -145,2 +145,7 @@ ) as "ljl_1" ON TRUE`);

/**
* @typedef {StoreFile} QueryResultStoreFile
* @property {QueryResultStoreFileGroup|string|number} [group]
* @property {QueryResultStoreFileGroupView|string|number} [groupView]
*/
/**
* Query Builder for file

@@ -150,3 +155,3 @@ * Note that nested limit and offset don't work yet.

* @returns {{
* exec: function(sql: Postgres): Promise<*[]>,
* exec: function(sql: Postgres): Promise<QueryResultStoreFile[]>,
* execRaw: function(sql: Postgres): Promise<*[]>

@@ -160,3 +165,3 @@ * queryPart: QueryPart,

if (builder.group) {
joinedKeys.push(`'${builder.group?.as ?? "group"}'`, '"ljl_0"."result"');
joinedKeys.push(`'${builder.group?.as ?? "group"}'`, `"ljl_0"."result"`);
}

@@ -166,3 +171,3 @@ if (builder.groupView) {

`'${builder.groupView?.as ?? "groupView"}'`,
'"ljl_1"."result"',
`"ljl_1"."result"`,
);

@@ -201,3 +206,3 @@ }

*/
function internalQueryFileGroup(builder = {}, wherePartial) {
function internalQueryFileGroup2(builder = {}, wherePartial) {
const joinQb = query``;

@@ -276,4 +281,4 @@ if (builder.viaFile) {

])}) as "result"
${internalQueryFile(builder.file, query`AND f."id" = fg."file"`)}
ORDER BY ${fileOrderBy()}
${internalQueryFile(builder.file, query`AND f."id" = fg2."file"`)}
ORDER BY ${fileOrderBy("f.")}
${offsetLimitQb}

@@ -312,4 +317,4 @@ ) as "ljl_2" ON TRUE`);

])}) as "result"
${internalQueryFileGroup(builder.parent, query`AND fg."id" = fg."parent"`)}
ORDER BY ${fileGroupOrderBy()}
${internalQueryFileGroup(builder.parent, query`AND fg."id" = fg2."parent"`)}
ORDER BY ${fileGroupOrderBy("fg.")}
${offsetLimitQb}

@@ -349,4 +354,169 @@ ) as "ljl_3" ON TRUE`);

joinedKeys.join(","),
])}) ORDER BY ${fileGroupOrderBy()}), NULL) as "result"
${internalQueryFileGroup(builder.children, query`AND fg."parent" = fg."id"`)}
])}) ORDER BY ${fileGroupOrderBy("fg.")}), NULL) as "result"
${internalQueryFileGroup(builder.children, query`AND fg."parent" = fg2."id"`)}
GROUP BY fg2."id"
ORDER BY fg2."id"
${offsetLimitQb}
) as "ljl_4" ON TRUE`);
}
return query`
FROM "fileGroup" fg2
${joinQb}
WHERE ${fileGroupWhere(builder.where, "fg2.", {
skipValidator: true,
})} ${wherePartial}
`;
}
/**
* @param {StoreFileGroupQueryBuilder|StoreFileGroupQueryTraverser} [builder={}]
* @param {QueryPart} wherePartial
* @returns {QueryPart}
*/
function internalQueryFileGroup(builder = {}, wherePartial) {
const joinQb = query``;
if (builder.viaFile) {
builder.where = builder.where ?? {};
const offsetLimitQb = !isNil(builder.viaFile.offset)
? query`OFFSET ${builder.viaFile.offset}`
: query``;
if (!isNil(builder.viaFile.limit)) {
offsetLimitQb.append(
query`FETCH NEXT ${builder.viaFile.limit} ROWS ONLY`,
);
}
builder.where.fileIn = query`
SELECT DISTINCT f."id"
${internalQueryFile(builder.viaFile)}
${offsetLimitQb}
`;
}
if (builder.viaParent) {
builder.where = builder.where ?? {};
const offsetLimitQb = !isNil(builder.viaParent.offset)
? query`OFFSET ${builder.viaParent.offset}`
: query``;
if (!isNil(builder.viaParent.limit)) {
offsetLimitQb.append(
query`FETCH NEXT ${builder.viaParent.limit} ROWS ONLY`,
);
}
builder.where.parentIn = query`
SELECT DISTINCT fg2."id"
${internalQueryFileGroup2(builder.viaParent)}
${offsetLimitQb}
`;
}
if (builder.viaChildren) {
builder.where = builder.where ?? {};
const offsetLimitQb = !isNil(builder.viaChildren.offset)
? query`OFFSET ${builder.viaChildren.offset}`
: query``;
if (!isNil(builder.viaChildren.limit)) {
offsetLimitQb.append(
query`FETCH NEXT ${builder.viaChildren.limit} ROWS ONLY`,
);
}
builder.where.idIn = query`
SELECT DISTINCT fg2."parent"
${internalQueryFileGroup2(builder.viaChildren)}
${offsetLimitQb}
`;
}
if (builder.file) {
const joinedKeys = [];
const offsetLimitQb = !isNil(builder.file.offset)
? query`OFFSET ${builder.file.offset}`
: query``;
if (!isNil(builder.file.limit)) {
offsetLimitQb.append(query`FETCH NEXT ${builder.file.limit} ROWS ONLY`);
}
if (builder.file.group) {
joinedKeys.push(
`'${builder.file.group?.as ?? "group"}'`,
'"ljl_0"."result"',
);
}
if (builder.file.groupView) {
joinedKeys.push(
`'${builder.file.groupView?.as ?? "groupView"}'`,
'"ljl_1"."result"',
);
}
joinQb.append(query`LEFT JOIN LATERAL (
SELECT to_jsonb(f.*) || jsonb_build_object(${query([
joinedKeys.join(","),
])}) as "result"
${internalQueryFile(builder.file, query`AND f."id" = fg."file"`)}
ORDER BY ${fileOrderBy("f.")}
${offsetLimitQb}
) as "ljl_2" ON TRUE`);
}
if (builder.parent) {
const joinedKeys = [];
const offsetLimitQb = !isNil(builder.parent.offset)
? query`OFFSET ${builder.parent.offset}`
: query``;
if (!isNil(builder.parent.limit)) {
offsetLimitQb.append(query`FETCH NEXT ${builder.parent.limit} ROWS ONLY`);
}
if (builder.parent.file) {
joinedKeys.push(
`'${builder.parent.file?.as ?? "file"}'`,
'"ljl_2"."result"',
);
}
if (builder.parent.parent) {
joinedKeys.push(
`'${builder.parent.parent?.as ?? "parent"}'`,
'"ljl_3"."result"',
);
}
if (builder.parent.children) {
joinedKeys.push(
`'${builder.parent.children?.as ?? "children"}'`,
'"ljl_4"."result"',
);
}
joinQb.append(query`LEFT JOIN LATERAL (
SELECT to_jsonb(fg2.*) || jsonb_build_object(${query([
joinedKeys.join(","),
])}) as "result"
${internalQueryFileGroup2(builder.parent, query`AND fg2."id" = fg."parent"`)}
ORDER BY ${fileGroupOrderBy("fg2.")}
${offsetLimitQb}
) as "ljl_3" ON TRUE`);
}
if (builder.children) {
const joinedKeys = [];
const offsetLimitQb = !isNil(builder.children.offset)
? query`OFFSET ${builder.children.offset}`
: query``;
if (!isNil(builder.children.limit)) {
offsetLimitQb.append(
query`FETCH NEXT ${builder.children.limit} ROWS ONLY`,
);
}
if (builder.children.file) {
joinedKeys.push(
`'${builder.children.file?.as ?? "file"}'`,
'"ljl_2"."result"',
);
}
if (builder.children.parent) {
joinedKeys.push(
`'${builder.children.parent?.as ?? "parent"}'`,
'"ljl_3"."result"',
);
}
if (builder.children.children) {
joinedKeys.push(
`'${builder.children.children?.as ?? "children"}'`,
'"ljl_4"."result"',
);
}
joinQb.append(query`LEFT JOIN LATERAL (
SELECT array_remove(array_agg(to_jsonb(fg2.*) || jsonb_build_object(${query([
joinedKeys.join(","),
])}) ORDER BY ${fileGroupOrderBy("fg2.")}), NULL) as "result"
${internalQueryFileGroup2(builder.children, query`AND fg2."parent" = fg."id"`)}
GROUP BY fg."id"

@@ -366,2 +536,8 @@ ORDER BY fg."id"

/**
* @typedef {StoreFileGroup} QueryResultStoreFileGroup
* @property {QueryResultStoreFile|string|number} [file]
* @property {QueryResultStoreFileGroup|string|number} [parent]
* @property {QueryResultStoreFileGroup[]} [children]
*/
/**
* Query Builder for fileGroup

@@ -371,3 +547,3 @@ * Note that nested limit and offset don't work yet.

* @returns {{
* exec: function(sql: Postgres): Promise<*[]>,
* exec: function(sql: Postgres): Promise<QueryResultStoreFileGroup[]>,
* execRaw: function(sql: Postgres): Promise<*[]>

@@ -381,6 +557,6 @@ * queryPart: QueryPart,

if (builder.file) {
joinedKeys.push(`'${builder.file?.as ?? "file"}'`, '"ljl_2"."result"');
joinedKeys.push(`'${builder.file?.as ?? "file"}'`, `"ljl_2"."result"`);
}
if (builder.parent) {
joinedKeys.push(`'${builder.parent?.as ?? "parent"}'`, '"ljl_3"."result"');
joinedKeys.push(`'${builder.parent?.as ?? "parent"}'`, `"ljl_3"."result"`);
}

@@ -390,3 +566,3 @@ if (builder.children) {

`'${builder.children?.as ?? "children"}'`,
'"ljl_4"."result"',
`coalesce("ljl_4"."result", '{}')`,
);

@@ -425,3 +601,3 @@ }

*/
function internalQueryFileGroupView(builder = {}, wherePartial) {
function internalQueryFileGroupView2(builder = {}, wherePartial) {
const joinQb = query``;

@@ -500,4 +676,4 @@ if (builder.viaFile) {

])}) as "result"
${internalQueryFile(builder.file, query`AND f."id" = fgv."file"`)}
ORDER BY ${fileOrderBy()}
${internalQueryFile(builder.file, query`AND f."id" = fgv2."file"`)}
ORDER BY ${fileOrderBy("f.")}
${offsetLimitQb}

@@ -538,5 +714,5 @@ ) as "ljl_5" ON TRUE`);

builder.parent,
query`AND fgv."id" = fgv."parent"`,
query`AND fgv."id" = fgv2."parent"`,
)}
ORDER BY ${fileGroupViewOrderBy()}
ORDER BY ${fileGroupViewOrderBy("fgv.")}
${offsetLimitQb}

@@ -576,7 +752,178 @@ ) as "ljl_6" ON TRUE`);

joinedKeys.join(","),
])}) ORDER BY ${fileGroupViewOrderBy()}), NULL) as "result"
])}) ORDER BY ${fileGroupViewOrderBy("fgv.")}), NULL) as "result"
${internalQueryFileGroupView(
builder.children,
query`AND fgv."parent" = fgv."id"`,
query`AND fgv."parent" = fgv2."id"`,
)}
GROUP BY fgv2."id"
ORDER BY fgv2."id"
${offsetLimitQb}
) as "ljl_7" ON TRUE`);
}
return query`
FROM "fileGroupView" fgv2
${joinQb}
WHERE ${fileGroupViewWhere(builder.where, "fgv2.", {
skipValidator: true,
})} ${wherePartial}
`;
}
/**
* @param {StoreFileGroupViewQueryBuilder|StoreFileGroupViewQueryTraverser} [builder={}]
* @param {QueryPart} wherePartial
* @returns {QueryPart}
*/
function internalQueryFileGroupView(builder = {}, wherePartial) {
const joinQb = query``;
if (builder.viaFile) {
builder.where = builder.where ?? {};
const offsetLimitQb = !isNil(builder.viaFile.offset)
? query`OFFSET ${builder.viaFile.offset}`
: query``;
if (!isNil(builder.viaFile.limit)) {
offsetLimitQb.append(
query`FETCH NEXT ${builder.viaFile.limit} ROWS ONLY`,
);
}
builder.where.fileIn = query`
SELECT DISTINCT f."id"
${internalQueryFile(builder.viaFile)}
${offsetLimitQb}
`;
}
if (builder.viaParent) {
builder.where = builder.where ?? {};
const offsetLimitQb = !isNil(builder.viaParent.offset)
? query`OFFSET ${builder.viaParent.offset}`
: query``;
if (!isNil(builder.viaParent.limit)) {
offsetLimitQb.append(
query`FETCH NEXT ${builder.viaParent.limit} ROWS ONLY`,
);
}
builder.where.parentIn = query`
SELECT DISTINCT fgv2."id"
${internalQueryFileGroupView2(builder.viaParent)}
${offsetLimitQb}
`;
}
if (builder.viaChildren) {
builder.where = builder.where ?? {};
const offsetLimitQb = !isNil(builder.viaChildren.offset)
? query`OFFSET ${builder.viaChildren.offset}`
: query``;
if (!isNil(builder.viaChildren.limit)) {
offsetLimitQb.append(
query`FETCH NEXT ${builder.viaChildren.limit} ROWS ONLY`,
);
}
builder.where.idIn = query`
SELECT DISTINCT fgv2."parent"
${internalQueryFileGroupView2(builder.viaChildren)}
${offsetLimitQb}
`;
}
if (builder.file) {
const joinedKeys = [];
const offsetLimitQb = !isNil(builder.file.offset)
? query`OFFSET ${builder.file.offset}`
: query``;
if (!isNil(builder.file.limit)) {
offsetLimitQb.append(query`FETCH NEXT ${builder.file.limit} ROWS ONLY`);
}
if (builder.file.group) {
joinedKeys.push(
`'${builder.file.group?.as ?? "group"}'`,
'"ljl_0"."result"',
);
}
if (builder.file.groupView) {
joinedKeys.push(
`'${builder.file.groupView?.as ?? "groupView"}'`,
'"ljl_1"."result"',
);
}
joinQb.append(query`LEFT JOIN LATERAL (
SELECT to_jsonb(f.*) || jsonb_build_object(${query([
joinedKeys.join(","),
])}) as "result"
${internalQueryFile(builder.file, query`AND f."id" = fgv."file"`)}
ORDER BY ${fileOrderBy("f.")}
${offsetLimitQb}
) as "ljl_5" ON TRUE`);
}
if (builder.parent) {
const joinedKeys = [];
const offsetLimitQb = !isNil(builder.parent.offset)
? query`OFFSET ${builder.parent.offset}`
: query``;
if (!isNil(builder.parent.limit)) {
offsetLimitQb.append(query`FETCH NEXT ${builder.parent.limit} ROWS ONLY`);
}
if (builder.parent.file) {
joinedKeys.push(
`'${builder.parent.file?.as ?? "file"}'`,
'"ljl_5"."result"',
);
}
if (builder.parent.parent) {
joinedKeys.push(
`'${builder.parent.parent?.as ?? "parent"}'`,
'"ljl_6"."result"',
);
}
if (builder.parent.children) {
joinedKeys.push(
`'${builder.parent.children?.as ?? "children"}'`,
'"ljl_7"."result"',
);
}
joinQb.append(query`LEFT JOIN LATERAL (
SELECT to_jsonb(fgv2.*) || jsonb_build_object(${query([
joinedKeys.join(","),
])}) as "result"
${internalQueryFileGroupView2(
builder.parent,
query`AND fgv2."id" = fgv."parent"`,
)}
ORDER BY ${fileGroupViewOrderBy("fgv2.")}
${offsetLimitQb}
) as "ljl_6" ON TRUE`);
}
if (builder.children) {
const joinedKeys = [];
const offsetLimitQb = !isNil(builder.children.offset)
? query`OFFSET ${builder.children.offset}`
: query``;
if (!isNil(builder.children.limit)) {
offsetLimitQb.append(
query`FETCH NEXT ${builder.children.limit} ROWS ONLY`,
);
}
if (builder.children.file) {
joinedKeys.push(
`'${builder.children.file?.as ?? "file"}'`,
'"ljl_5"."result"',
);
}
if (builder.children.parent) {
joinedKeys.push(
`'${builder.children.parent?.as ?? "parent"}'`,
'"ljl_6"."result"',
);
}
if (builder.children.children) {
joinedKeys.push(
`'${builder.children.children?.as ?? "children"}'`,
'"ljl_7"."result"',
);
}
joinQb.append(query`LEFT JOIN LATERAL (
SELECT array_remove(array_agg(to_jsonb(fgv2.*) || jsonb_build_object(${query([
joinedKeys.join(","),
])}) ORDER BY ${fileGroupViewOrderBy("fgv2.")}), NULL) as "result"
${internalQueryFileGroupView2(
builder.children,
query`AND fgv2."parent" = fgv."id"`,
)}
GROUP BY fgv."id"

@@ -596,2 +943,8 @@ ORDER BY fgv."id"

/**
* @typedef {StoreFileGroupView} QueryResultStoreFileGroupView
* @property {QueryResultStoreFile|string|number} [file]
* @property {QueryResultStoreFileGroupView|string|number} [parent]
* @property {QueryResultStoreFileGroupView[]} [children]
*/
/**
* Query Builder for fileGroupView

@@ -601,3 +954,3 @@ * Note that nested limit and offset don't work yet.

* @returns {{
* exec: function(sql: Postgres): Promise<*[]>,
* exec: function(sql: Postgres): Promise<QueryResultStoreFileGroupView[]>,
* execRaw: function(sql: Postgres): Promise<*[]>

@@ -611,6 +964,6 @@ * queryPart: QueryPart,

if (builder.file) {
joinedKeys.push(`'${builder.file?.as ?? "file"}'`, '"ljl_5"."result"');
joinedKeys.push(`'${builder.file?.as ?? "file"}'`, `"ljl_5"."result"`);
}
if (builder.parent) {
joinedKeys.push(`'${builder.parent?.as ?? "parent"}'`, '"ljl_6"."result"');
joinedKeys.push(`'${builder.parent?.as ?? "parent"}'`, `"ljl_6"."result"`);
}

@@ -620,3 +973,3 @@ if (builder.children) {

`'${builder.children?.as ?? "children"}'`,
'"ljl_7"."result"',
`coalesce("ljl_7"."result", '{}')`,
);

@@ -664,2 +1017,5 @@ }

/**
* @typedef {StoreJob} QueryResultStoreJob
*/
/**
* Query Builder for job

@@ -669,3 +1025,3 @@ * Note that nested limit and offset don't work yet.

* @returns {{
* exec: function(sql: Postgres): Promise<*[]>,
* exec: function(sql: Postgres): Promise<QueryResultStoreJob[]>,
* execRaw: function(sql: Postgres): Promise<*[]>

@@ -720,2 +1076,5 @@ * queryPart: QueryPart,

/**
* @typedef {StoreSession} QueryResultStoreSession
*/
/**
* Query Builder for session

@@ -725,3 +1084,3 @@ * Note that nested limit and offset don't work yet.

* @returns {{
* exec: function(sql: Postgres): Promise<*[]>,
* exec: function(sql: Postgres): Promise<QueryResultStoreSession[]>,
* execRaw: function(sql: Postgres): Promise<*[]>

@@ -728,0 +1087,0 @@ * queryPart: QueryPart,

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