Skip to content

fix: upgrade to prisma 5.9.1, feathers 4.5.17 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ node_modules

.env

## Popular IDE's
.vscode
.idea

.eslintcache
2 changes: 1 addition & 1 deletion dist/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function getType(v) {
common: v >= 1000 && v < 2000,
query: v >= 2000 && v < 3000,
migration: v >= 3000 && v < 4000,
introspection: v >= 4000 && v < 4000,
introspection: v >= 4000 && v < 5000,
};
Object.keys(cases).map((key) => {
// @ts-ignore
Expand Down
1 change: 0 additions & 1 deletion dist/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { EagerQuery, FeathersQueryData, IdField, QueryParam, QueryParamRecordFil
export declare const castToNumberBooleanStringOrNull: (value: string | boolean | number) => string | number | boolean | null;
export declare const castFeathersQueryToPrismaFilters: (p: QueryParamRecordFilters, whitelist: string[]) => Record<string, any>;
export declare const castEagerQueryToPrismaInclude: (value: EagerQuery, whitelist: string[], idField: string) => EagerQuery;
export declare const mergeFiltersWithSameKey: (where: Record<string, any>, key: string, filter: Record<string, any> | string | number | boolean | null) => Record<string, any> | string | number | boolean;
/**
* WARN: This method is not safe for Feathers queries because unwanted queries can reach the Prisma-Client.
**/
Expand Down
18 changes: 3 additions & 15 deletions dist/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildSelectOrInclude = exports.buildPrismaQueryParams = exports.buildBasePrismaQueryParams = exports.buildWhereWithId = exports.hasIdObject = exports.buildPagination = exports.buildOrderBy = exports.buildSelect = exports.buildWhereAndInclude = exports.buildIdField = exports.mergeFiltersWithSameKey = exports.castEagerQueryToPrismaInclude = exports.castFeathersQueryToPrismaFilters = exports.castToNumberBooleanStringOrNull = void 0;
exports.buildSelectOrInclude = exports.buildPrismaQueryParams = exports.buildBasePrismaQueryParams = exports.buildWhereWithId = exports.hasIdObject = exports.buildPagination = exports.buildOrderBy = exports.buildSelect = exports.buildWhereAndInclude = exports.buildIdField = exports.castEagerQueryToPrismaInclude = exports.castFeathersQueryToPrismaFilters = exports.castToNumberBooleanStringOrNull = void 0;
const constants_1 = require("./constants");
const castToNumberBooleanStringOrNull = (value) => {
const isNumber = typeof value === 'number';
Expand Down Expand Up @@ -40,9 +40,10 @@ const castFeathersQueryToPrismaFilters = (p, whitelist) => {
return filters;
};
exports.castFeathersQueryToPrismaFilters = castFeathersQueryToPrismaFilters;
// eslint-disable-next-line
const castEagerQueryToPrismaInclude = (value, whitelist, idField) => {
// we don't care about feathers compliance, we want where queries in our include
// thus just returnung the $eager value as include 1:1
// thus just returning the $eager value as include 1:1
return value;
// const include: Record<string, any> = {};
// if (Array.isArray(value)) {
Expand Down Expand Up @@ -83,19 +84,6 @@ const castEagerQueryToPrismaInclude = (value, whitelist, idField) => {
// return include;
};
exports.castEagerQueryToPrismaInclude = castEagerQueryToPrismaInclude;
const mergeFiltersWithSameKey = (where, key, filter) => {
const current = where[key];
if (typeof filter === 'object') {
const currentIsObj = typeof current === 'object';
return {
...(currentIsObj ? current : {}),
...filter,
...(!currentIsObj && current ? { equals: current } : {})
};
}
return filter;
};
exports.mergeFiltersWithSameKey = mergeFiltersWithSameKey;
/**
* WARN: This method is not safe for Feathers queries because unwanted queries can reach the Prisma-Client.
**/
Expand Down
Loading