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

rapiq

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rapiq - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

2

dist/build/parameter/type.d.ts
import { FieldsBuildInput, FiltersBuildInput, PaginationBuildInput, RelationsBuildInput, SortBuildInput } from '../../parameter';
import { Parameter, URLParameter } from '../../constants';
export declare type BuildParameterInput<P extends `${Parameter}` | `${URLParameter}`, T extends Record<string, any> = Record<string, any>> = P extends `${Parameter.FIELDS}` | `${URLParameter.FIELDS}` ? FieldsBuildInput<T> : P extends `${Parameter.FILTERS}` | `${URLParameter.FILTERS}` ? FiltersBuildInput<T> : P extends `${Parameter.RELATIONS}` | `${URLParameter.RELATIONS}` ? RelationsBuildInput<T> : P extends `${Parameter.PAGINATION}` | `${URLParameter.PAGINATION}` ? PaginationBuildInput<T> : P extends `${Parameter.SORT}` | `${URLParameter.SORT}` ? SortBuildInput<T> : never;
export type BuildParameterInput<P extends `${Parameter}` | `${URLParameter}`, T extends Record<string, any> = Record<string, any>> = P extends `${Parameter.FIELDS}` | `${URLParameter.FIELDS}` ? FieldsBuildInput<T> : P extends `${Parameter.FILTERS}` | `${URLParameter.FILTERS}` ? FiltersBuildInput<T> : P extends `${Parameter.RELATIONS}` | `${URLParameter.RELATIONS}` ? RelationsBuildInput<T> : P extends `${Parameter.PAGINATION}` | `${URLParameter.PAGINATION}` ? PaginationBuildInput<T> : P extends `${Parameter.SORT}` | `${URLParameter.SORT}` ? SortBuildInput<T> : never;
import { Parameter, URLParameter } from '../constants';
import { BuildParameterInput } from './parameter';
export declare type BuildInput<T extends Record<string, any>> = {
export type BuildInput<T extends Record<string, any>> = {
[P in `${Parameter}` | `${URLParameter}`]?: BuildParameterInput<P, T>;
};

@@ -5,4 +5,4 @@ import { Flatten, KeyWithOptionalPrefix, NestedKeys, OnlyObject, SimpleKeys } from '../../type';

import { FieldOperator } from './constants';
declare type FieldWithOperator<T extends string> = KeyWithOptionalPrefix<T, FieldOperator>;
export declare type FieldsBuildInput<T extends Record<string, any>> = {
type FieldWithOperator<T extends string> = KeyWithOptionalPrefix<T, FieldOperator>;
export type FieldsBuildInput<T extends Record<string, any>> = {
[K in keyof T]?: Flatten<T[K]> extends OnlyObject<T[K]> ? FieldsBuildInput<Flatten<T[K]>> : never;

@@ -12,3 +12,3 @@ } | (FieldWithOperator<SimpleKeys<T>>[] | {

})[] | FieldWithOperator<NestedKeys<T>>[] | FieldWithOperator<NestedKeys<T>>;
export declare type FieldsParseOptions<T extends Record<string, any> = Record<string, any>> = {
export type FieldsParseOptions<T extends Record<string, any> = Record<string, any>> = {
mapping?: Record<string, string>;

@@ -20,3 +20,3 @@ allowed?: ParseAllowedOption<T>;

};
export declare type FieldsParseOutputElement = {
export type FieldsParseOutputElement = {
key: string;

@@ -26,4 +26,4 @@ path?: string;

};
export declare type FieldsParseOutput = FieldsParseOutputElement[];
export declare type FieldsInputTransformed = {
export type FieldsParseOutput = FieldsParseOutputElement[];
export type FieldsInputTransformed = {
default: string[];

@@ -30,0 +30,0 @@ included: string[];

@@ -23,4 +23,16 @@ "use strict";

if (Array.isArray(input)) {
// todo: check array elements are string
output[key] = input.join(',');
// preserve null values
const data = [];
for (let i = 0; i < input.length; i++) {
if (input[i] === null) {
input[i] = 'null';
}
if (typeof input[i] === 'number') {
input[i] = `${input[i]}`;
}
if (typeof input[i] === 'string') {
data.push(input[i]);
}
}
output[key] = data.join(',');
return true;

@@ -27,0 +39,0 @@ }

@@ -5,9 +5,9 @@ import { Flatten, NestedKeys, ObjectLiteral, OnlyObject, OnlyScalar, TypeFromNestedKeyPath } from '../../type';

import { FilterComparisonOperator } from './constants';
declare type FilterValueInputPrimitive = boolean | number | string;
declare type FilterValueInput = FilterValueInputPrimitive | null | undefined;
export declare type FilterValueSimple<V extends FilterValueInput = FilterValueInput> = V extends string | number ? (V | V[]) : V;
export declare type FilterValueWithOperator<V extends FilterValueInput = FilterValueInput> = V extends string | number ? V | `!${V}` | `!~${V}` | `~${V}` | `<${V}` | `<=${V}` | `>${V}` | `>=${V}` | null | '!null' : V extends boolean ? V | null | '!null' : never;
export declare type FilterValue<V extends FilterValueInput = FilterValueInput> = V extends string | number ? (FilterValueSimple<V> | FilterValueWithOperator<V> | Array<FilterValueWithOperator<V>>) : V;
export declare type FiltersBuildInputValue<T> = T extends OnlyScalar<T> ? T | FilterValue<T> : never;
export declare type FiltersBuildInput<T extends Record<string, any>> = {
type FilterValueInputPrimitive = boolean | number | string;
type FilterValueInput = FilterValueInputPrimitive | null | undefined;
export type FilterValueSimple<V extends FilterValueInput = FilterValueInput> = V extends string | number ? (V | V[]) : V;
export type FilterValueWithOperator<V extends FilterValueInput = FilterValueInput> = V extends string | number ? V | `!${V}` | `!~${V}` | `~${V}` | `<${V}` | `<=${V}` | `>${V}` | `>=${V}` | null | '!null' : V extends boolean ? V | null | '!null' : never;
export type FilterValue<V extends FilterValueInput = FilterValueInput> = V extends string | number ? (FilterValueSimple<V> | FilterValueWithOperator<V> | Array<FilterValueWithOperator<V>>) : V;
export type FiltersBuildInputValue<T> = T extends OnlyScalar<T> ? T | FilterValue<T> : never;
export type FiltersBuildInput<T extends Record<string, any>> = {
[K in keyof T]?: Flatten<T[K]> extends Record<string, any> ? FiltersBuildInput<Flatten<T[K]>> : FiltersBuildInputValue<Flatten<T[K]>>;

@@ -17,3 +17,3 @@ } & {

};
export declare type FiltersParseDefaultOption<T extends Record<string, any>> = {
export type FiltersParseDefaultOption<T extends Record<string, any>> = {
[K in keyof T]?: Flatten<T[K]> extends OnlyObject<T[K]> ? FiltersParseDefaultOption<Flatten<T[K]>> : (K extends string ? FilterValue<TypeFromNestedKeyPath<T, K>> : never);

@@ -23,4 +23,4 @@ } | {

};
export declare type FiltersValidatorOption<K extends string> = (key: K, value: unknown) => boolean;
export declare type FiltersParseOptions<T extends ObjectLiteral = ObjectLiteral> = {
export type FiltersValidatorOption<K extends string> = (key: K, value: unknown) => boolean;
export type FiltersParseOptions<T extends ObjectLiteral = ObjectLiteral> = {
mapping?: Record<string, string>;

@@ -34,3 +34,3 @@ allowed?: ParseAllowedOption<T>;

};
export declare type FiltersParseOutputElement = {
export type FiltersParseOutputElement = {
operator?: `${FilterComparisonOperator}`;

@@ -41,3 +41,3 @@ value: FilterValueSimple;

};
export declare type FiltersParseOutput = FiltersParseOutputElement[];
export type FiltersParseOutput = FiltersParseOutputElement[];
export {};

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

return input
.filter((n) => n === 0 || !!n);
.filter((n) => n === 0 || n === null || !!n);
}

@@ -43,0 +43,0 @@ if (typeof input === 'undefined' || input === null) {

@@ -1,11 +0,11 @@

export declare type PaginationBuildInput<T> = {
export type PaginationBuildInput<T> = {
limit?: number;
offset?: number;
};
export declare type PaginationParseOptions = {
export type PaginationParseOptions = {
maxLimit?: number;
};
export declare type PaginationParseOutput = {
export type PaginationParseOutput = {
limit?: number;
offset?: number;
};
import { Flatten, NestedResourceKeys, OnlyObject } from '../../type';
export declare type RelationsBuildInput<T extends Record<string, any>> = {
export type RelationsBuildInput<T extends Record<string, any>> = {
[K in keyof T]?: Flatten<T[K]> extends OnlyObject<T[K]> ? RelationsBuildInput<Flatten<T[K]>> | boolean : never;
} | NestedResourceKeys<T>[];
export declare type RelationsParseOptions<T extends Record<string, any> = Record<string, any>> = {
export type RelationsParseOptions<T extends Record<string, any> = Record<string, any>> = {
allowed?: NestedResourceKeys<T>[];

@@ -11,6 +11,6 @@ mapping?: Record<string, string>;

};
export declare type RelationsParseOutputElement = {
export type RelationsParseOutputElement = {
key: string;
value: string;
};
export declare type RelationsParseOutput = RelationsParseOutputElement[];
export type RelationsParseOutput = RelationsParseOutputElement[];

@@ -8,4 +8,4 @@ import { Flatten, KeyWithOptionalPrefix, NestedKeys, OnlyObject, SimpleKeys } from '../../type';

}
declare type SortWithOperator<T extends string> = KeyWithOptionalPrefix<T, '-'>;
export declare type SortBuildInput<T extends Record<string, any>> = {
type SortWithOperator<T extends string> = KeyWithOptionalPrefix<T, '-'>;
export type SortBuildInput<T extends Record<string, any>> = {
[K in keyof T]?: Flatten<T[K]> extends OnlyObject<T[K]> ? SortBuildInput<Flatten<T[K]>> : `${SortDirection}`;

@@ -15,3 +15,3 @@ } | (SortWithOperator<SimpleKeys<T>>[] | {

})[] | SortWithOperator<NestedKeys<T>>[] | SortWithOperator<NestedKeys<T>>;
export declare type SortParseDefaultOption<T extends Record<string, any>> = {
export type SortParseDefaultOption<T extends Record<string, any>> = {
[K in keyof T]?: Flatten<T[K]> extends OnlyObject<T[K]> ? SortParseDefaultOption<Flatten<T[K]>> : `${SortDirection}`;

@@ -21,3 +21,3 @@ } | {

};
export declare type SortParseOptions<T extends Record<string, any> = Record<string, any>> = {
export type SortParseOptions<T extends Record<string, any> = Record<string, any>> = {
allowed?: ParseAllowedOption<T>;

@@ -29,3 +29,3 @@ mapping?: Record<string, string>;

};
export declare type SortParseOutputElement = {
export type SortParseOutputElement = {
key: string;

@@ -35,3 +35,3 @@ value: `${SortDirection}`;

};
export declare type SortParseOutput = SortParseOutputElement[];
export type SortParseOutput = SortParseOutputElement[];
export {};
import { Flatten, NestedKeys, ObjectLiteral, OnlyObject, SimpleKeys } from '../type';
declare type ParseAllowedObjectOption<T extends ObjectLiteral = ObjectLiteral> = {
type ParseAllowedObjectOption<T extends ObjectLiteral = ObjectLiteral> = {
[K in keyof T]?: T[K] extends OnlyObject<T[K]> ? ParseAllowedOption<Flatten<T[K]>> : never;
};
export declare type ParseAllowedOption<T extends ObjectLiteral = ObjectLiteral> = T extends ObjectLiteral ? (ParseAllowedObjectOption<T> | (SimpleKeys<T>[] | ParseAllowedObjectOption<T>)[] | NestedKeys<T>[]) : string[];
export type ParseAllowedOption<T extends ObjectLiteral = ObjectLiteral> = T extends ObjectLiteral ? (ParseAllowedObjectOption<T> | (SimpleKeys<T>[] | ParseAllowedObjectOption<T>)[] | NestedKeys<T>[]) : string[];
export {};
import { FieldsParseOptions, FieldsParseOutput, FiltersParseOptions, FiltersParseOutput, PaginationParseOptions, PaginationParseOutput, RelationsParseOptions, RelationsParseOutput, SortParseOptions, SortParseOutput } from '../../parameter';
import { Parameter, URLParameter } from '../../constants';
import { ObjectLiteral } from '../../type';
export declare type ParseParameterOptions<P extends `${Parameter}` | `${URLParameter}`, T extends ObjectLiteral = ObjectLiteral> = P extends `${Parameter.FIELDS}` | `${URLParameter.FIELDS}` ? FieldsParseOptions<T> : P extends `${Parameter.FILTERS}` | `${URLParameter.FILTERS}` ? FiltersParseOptions<T> : P extends `${Parameter.RELATIONS}` | `${URLParameter.RELATIONS}` ? RelationsParseOptions<T> : P extends `${Parameter.PAGINATION}` | `${URLParameter.PAGINATION}` ? PaginationParseOptions : P extends `${Parameter.SORT}` | `${URLParameter.SORT}` ? SortParseOptions<T> : never;
export declare type ParseParameterOutput<P extends `${Parameter}` | `${URLParameter}`> = P extends `${Parameter.FIELDS}` | `${URLParameter.FIELDS}` ? FieldsParseOutput : P extends `${Parameter.FILTERS}` | `${URLParameter.FILTERS}` ? FiltersParseOutput : P extends `${Parameter.RELATIONS}` | `${URLParameter.RELATIONS}` ? RelationsParseOutput : P extends `${Parameter.PAGINATION}` | `${URLParameter.PAGINATION}` ? PaginationParseOutput : P extends `${Parameter.SORT}` | `${URLParameter.SORT}` ? SortParseOutput : never;
export type ParseParameterOptions<P extends `${Parameter}` | `${URLParameter}`, T extends ObjectLiteral = ObjectLiteral> = P extends `${Parameter.FIELDS}` | `${URLParameter.FIELDS}` ? FieldsParseOptions<T> : P extends `${Parameter.FILTERS}` | `${URLParameter.FILTERS}` ? FiltersParseOptions<T> : P extends `${Parameter.RELATIONS}` | `${URLParameter.RELATIONS}` ? RelationsParseOptions<T> : P extends `${Parameter.PAGINATION}` | `${URLParameter.PAGINATION}` ? PaginationParseOptions : P extends `${Parameter.SORT}` | `${URLParameter.SORT}` ? SortParseOptions<T> : never;
export type ParseParameterOutput<P extends `${Parameter}` | `${URLParameter}`> = P extends `${Parameter.FIELDS}` | `${URLParameter.FIELDS}` ? FieldsParseOutput : P extends `${Parameter.FILTERS}` | `${URLParameter.FILTERS}` ? FiltersParseOutput : P extends `${Parameter.RELATIONS}` | `${URLParameter.RELATIONS}` ? RelationsParseOutput : P extends `${Parameter.PAGINATION}` | `${URLParameter.PAGINATION}` ? PaginationParseOutput : P extends `${Parameter.SORT}` | `${URLParameter.SORT}` ? SortParseOutput : never;
import { Parameter, URLParameter } from '../constants';
import { ObjectLiteral } from '../type';
import { ParseParameterOptions, ParseParameterOutput } from './parameter';
export declare type ParseInput = {
export type ParseInput = {
[K in `${Parameter}` | `${URLParameter}`]?: unknown;
};
export declare type ParseOptions<T extends ObjectLiteral = ObjectLiteral> = {
export type ParseOptions<T extends ObjectLiteral = ObjectLiteral> = {
[P in `${Parameter}`]?: boolean | ParseParameterOptions<P, T>;

@@ -12,3 +12,3 @@ } & {

};
export declare type ParseOutput = {
export type ParseOutput = {
[K in `${Parameter}`]?: ParseParameterOutput<K>;

@@ -15,0 +15,0 @@ } & {

@@ -1,14 +0,14 @@

export declare type ObjectLiteral = Record<string, any>;
export declare type Flatten<Type> = Type extends Array<infer Item> ? Item : Type;
export declare type OnlyScalar<T> = T extends string | number | boolean | undefined | null ? T : never;
export declare type OnlySingleObject<T> = T extends {
export type ObjectLiteral = Record<string, any>;
export type Flatten<Type> = Type extends Array<infer Item> ? Item : Type;
export type OnlyScalar<T> = T extends string | number | boolean | undefined | null ? T : never;
export type OnlySingleObject<T> = T extends {
[key: string]: any;
} ? T : never;
export declare type OnlyObject<T> = Flatten<T> extends OnlySingleObject<Flatten<T>> ? T | Flatten<T> : never;
export declare type KeyWithOptionalPrefix<T, O extends string> = T extends string ? (`${O}${T}` | T) : never;
declare type PrevIndex = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
export declare type SimpleKeys<T extends ObjectLiteral> = T extends ObjectLiteral ? ({
export type OnlyObject<T> = Flatten<T> extends OnlySingleObject<Flatten<T>> ? T | Flatten<T> : never;
export type KeyWithOptionalPrefix<T, O extends string> = T extends string ? (`${O}${T}` | T) : never;
type PrevIndex = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
export type SimpleKeys<T extends ObjectLiteral> = T extends ObjectLiteral ? ({
[Key in keyof T & (string | number)]: Flatten<T[Key]> extends Record<string, any> ? (Flatten<T[Key]> extends Date ? `${Key}` : never) : `${Key}`;
}[keyof T & (string | number)]) : string;
export declare type NestedKeys<T extends ObjectLiteral, Depth extends number = 4> = T extends ObjectLiteral ? ([
export type NestedKeys<T extends ObjectLiteral, Depth extends number = 4> = T extends ObjectLiteral ? ([
Depth

@@ -18,3 +18,3 @@ ] extends [0] ? never : {

}[keyof T & (string | number)]) : string;
export declare type NestedResourceKeys<T extends ObjectLiteral, Depth extends number = 4> = T extends ObjectLiteral ? ([
export type NestedResourceKeys<T extends ObjectLiteral, Depth extends number = 4> = T extends ObjectLiteral ? ([
Depth

@@ -24,5 +24,5 @@ ] extends [0] ? never : {

}[keyof T & (string | number)]) : string;
export declare type TypeFromNestedKeyPath<T extends ObjectLiteral, Path extends string> = {
export type TypeFromNestedKeyPath<T extends ObjectLiteral, Path extends string> = {
[K in Path]: K extends keyof T ? Flatten<T[K]> : K extends `${infer P}.${infer S}` ? Flatten<T[P]> extends Record<string, any> ? TypeFromNestedKeyPath<Flatten<T[P]>, S> : never : never;
}[Path];
export {};
export declare function buildKeyPath(key: string, prefix?: string): string;
declare type Options = {
type Options = {
transformer?: (input: unknown, output: string[], prefix?: string) => boolean | undefined;

@@ -4,0 +4,0 @@ };

export declare function hasOwnProperty<X extends Record<string, any>, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown>;
declare type Options = {
type Options = {
transformer?: (input: unknown, output: Record<string, any>, key: string) => boolean | undefined;

@@ -4,0 +4,0 @@ };

@@ -1,4 +0,4 @@

export declare type FieldDetails = {
export type FieldDetails = {
name: string;
path?: string;
};
{
"name": "rapiq",
"version": "0.4.1",
"version": "0.5.0",
"description": "A tiny library which provides utility types/functions for request and response query handling.",

@@ -57,6 +57,6 @@ "main": "./dist/index.js",

"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-angular": "^17.1.0",
"@commitlint/config-conventional": "^17.1.0",
"@commitlint/cz-commitlint": "^17.1.2",
"@commitlint/cli": "^17.3.0",
"@commitlint/config-angular": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@commitlint/cz-commitlint": "^17.3.0",
"@semantic-release/changelog": "^6.0.1",

@@ -68,9 +68,9 @@ "@semantic-release/commit-analyzer": "^9.0.2",

"@semantic-release/release-notes-generator": "^10.0.3",
"@tada5hi/eslint-config-typescript": "^1.0.9",
"@tada5hi/eslint-config-typescript": "^1.0.10",
"@types/jest": "^27.5.0",
"@types/minimatch": "^5.1.2",
"@types/node": "^18.11.7",
"@types/node": "^18.11.9",
"cross-env": "^7.0.3",
"eslint": "^8.26.0",
"husky": "^8.0.1",
"eslint": "^8.28.0",
"husky": "^8.0.2",
"jest": "^27.5.1",

@@ -80,5 +80,5 @@ "rimraf": "^3.0.2",

"ts-jest": "^27.1.4",
"typescript": "^4.8.4",
"vitepress": "^1.0.0-alpha.26",
"vue": "^3.2.41"
"typescript": "^4.9.3",
"vitepress": "^1.0.0-alpha.29",
"vue": "^3.2.45"
},

@@ -85,0 +85,0 @@ "config": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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