All Downloads are FREE. Search and download functionalities are using the official Maven repository.

typescript-redux-query.runtime.mustache Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
// tslint:disable
{{>licenseInfo}}

import { Meta, OptimisticUpdate, QueryKey, QueryOptions, Rollback, TransformStrategy, Update } from "redux-query";

export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");

export const Configuration = {
    basePath: '', // This is the value that will be prepended to all endpoints.  For compatibility with
                  // previous versions, the default is an empty string.  Other generators typically use
                  // BASE_PATH as the default.
};

export interface TypedQueryConfig {
    force?: boolean;
    meta?: Meta;
    options?: QueryOptions;
    queryKey?: QueryKey;
    update?: Update;
    optimisticUpdate?: OptimisticUpdate;
    retry?: boolean;
    rollback?: Rollback;
    transform?: TransformStrategy
}

export class RequiredError extends Error {
    name: "RequiredError" = "RequiredError";
    constructor(public field: string, msg?: string) {
        super(msg);
    }
}

export const COLLECTION_FORMATS = {
    csv: ",",
    ssv: " ",
    tsv: "\t",
    pipes: "|",
};

export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';

export type HttpHeaders = { [key: string]: string };

export function exists(json: any, key: string) {
    const value = json[key];
    return value !== null && value !== undefined;
}

export function mapValues(data: any, fn: (item: any) => any) {
  return Object.keys(data).reduce(
    (acc, key) => ({ ...acc, [key]: fn(data[key]) }),
    {}
  );
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy