@rlvt/statistics-openapi-client 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/api.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ import { AxiosInstance, AxiosRequestConfig } from "axios";
2
+ import type { Measure, Dimension, Query, QueryResult } from "./definitions";
3
+ export * from "./definitions";
4
+ export default class {
5
+ axios: AxiosInstance;
6
+ constructor(configOrInstance: AxiosRequestConfig | AxiosInstance);
7
+ private meta;
8
+ private query;
9
+ get Default(): {
10
+ meta: (params: Record<string, never>, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<{
11
+ status: "success";
12
+ program: string;
13
+ version: string;
14
+ datetime: string;
15
+ code?: number | undefined;
16
+ message: string;
17
+ data: {
18
+ measures: {
19
+ [key: string]: Measure;
20
+ };
21
+ dimensions: {
22
+ [key: string]: Dimension;
23
+ };
24
+ };
25
+ }, any>>;
26
+ query: (params: Record<string, never>, data: Query, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<{
27
+ status: "success";
28
+ program: string;
29
+ version: string;
30
+ datetime: string;
31
+ code?: number | undefined;
32
+ message: string;
33
+ data: QueryResult;
34
+ }, any>>;
35
+ };
36
+ }
package/build/api.js ADDED
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ var __importDefault = (this && this.__importDefault) || function (mod) {
19
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ const axios_1 = __importDefault(require("axios"));
23
+ __exportStar(require("./definitions"), exports);
24
+ class default_1 {
25
+ constructor(configOrInstance) {
26
+ this.axios = 'interceptors' in configOrInstance
27
+ ? configOrInstance
28
+ : axios_1.default.create(configOrInstance);
29
+ }
30
+ meta(params, options) {
31
+ return this.axios.get("/meta", options);
32
+ }
33
+ query(params, data, options) {
34
+ return this.axios.post("/query", data, options);
35
+ }
36
+ get Default() {
37
+ return {
38
+ meta: this.meta.bind(this),
39
+ query: this.query.bind(this)
40
+ };
41
+ }
42
+ }
43
+ exports.default = default_1;
44
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxvQkFBb0I7QUFDcEIsb0JBQW9COzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBRXBCLGtEQUFpRTtBQUdqRSxnREFBOEI7QUFFOUI7SUFHSSxZQUFZLGdCQUFvRDtRQUM1RCxJQUFJLENBQUMsS0FBSyxHQUFHLGNBQWMsSUFBSSxnQkFBZ0I7WUFDM0MsQ0FBQyxDQUFDLGdCQUFnQjtZQUNsQixDQUFDLENBQUMsZUFBSyxDQUFDLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFBO0lBQ3hDLENBQUM7SUFFTyxJQUFJLENBQUMsTUFBNkIsRUFBRSxPQUE0QjtRQUNwRSxPQUFPLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxDQWdCakIsT0FBTyxFQUFFLE9BQU8sQ0FDbkIsQ0FBQztJQUNOLENBQUM7SUFFTyxLQUFLLENBQUMsTUFBNkIsRUFBRSxJQUFXLEVBQUUsT0FBNEI7UUFDbEYsT0FBTyxJQUFJLENBQUMsS0FBSyxDQUFDLElBQUksQ0FTbEIsUUFBUSxFQUFFLElBQUksRUFBRSxPQUFPLENBQzFCLENBQUM7SUFDTixDQUFDO0lBRUQsSUFBSSxPQUFPO1FBQ1AsT0FBTztZQUNILElBQUksRUFBRSxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUM7WUFDMUIsS0FBSyxFQUFFLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQztTQUMvQixDQUFDO0lBQ04sQ0FBQztDQUNKO0FBbERELDRCQWtEQyJ9
@@ -0,0 +1,71 @@
1
+ export declare type Measure = {
2
+ id: string;
3
+ name: string;
4
+ format?: "number" | "currency" | "percent";
5
+ unit?: string;
6
+ };
7
+ export declare type Dimension = {
8
+ id: string;
9
+ type: "string" | "number" | "boolean" | "time";
10
+ name: string;
11
+ format?: "number" | "currency" | "percent";
12
+ unit?: string;
13
+ };
14
+ export declare type Serie = {
15
+ dimensions: {
16
+ [key: string]: {
17
+ id: string;
18
+ value: string | number | (false) | (true);
19
+ metadata: {
20
+ link?: string;
21
+ formattedValue?: string;
22
+ };
23
+ };
24
+ };
25
+ measures: {
26
+ id: string;
27
+ values: {
28
+ date: Date;
29
+ value: number;
30
+ metadata: {
31
+ calculation?: ({
32
+ type: "number";
33
+ value: number;
34
+ unit?: "currency" | "percent";
35
+ } | {
36
+ type: "scope";
37
+ value: "(" | ")";
38
+ } | {
39
+ type: "operator";
40
+ value: "/" | "\u00D7" | "-" | "+";
41
+ })[];
42
+ };
43
+ }[];
44
+ }[];
45
+ };
46
+ export declare type QueryResult = {
47
+ series: Serie[];
48
+ };
49
+ export declare type BinaryFilter = {
50
+ dimension?: string;
51
+ member?: string;
52
+ operator: "equals" | "notEquals" | "contains" | "notContains" | "startsWith" | "notStartsWith" | "endsWith" | "notEndsWith" | "gt" | "gte" | "lt" | "lte" | "inDateRange" | "notInDateRange" | "beforeDate" | "afterDate";
53
+ values: string[];
54
+ };
55
+ export declare type TimeDimensionBase = {
56
+ dimension: string;
57
+ granularity?: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
58
+ };
59
+ export declare type TimeDimensionComparisonFields = {
60
+ compareDateRange: (string | (string | string)[])[];
61
+ dateRange?: unknown;
62
+ };
63
+ export declare type TimeDimensionRangedFields = {
64
+ dateRange?: string | (string | string)[];
65
+ };
66
+ export declare type Query = {
67
+ measures: string[];
68
+ dimensions: string[];
69
+ filters: BinaryFilter[];
70
+ timeDimensions: ((TimeDimensionBase & TimeDimensionComparisonFields) | (TimeDimensionBase & TimeDimensionRangedFields))[];
71
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmaW5pdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9kZWZpbml0aW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsb0JBQW9CO0FBQ3BCLG9CQUFvQiJ9
@@ -0,0 +1,8 @@
1
+ import Api from './api';
2
+ export * from './api';
3
+ export default Api;
4
+ declare type Unpromisify<T> = T extends Promise<infer U> ? U : T;
5
+ export declare type FunctionParamsForMethod<T extends Exclude<keyof InstanceType<typeof Api>, 'axios'>, U extends keyof InstanceType<typeof Api>[T]> = Parameters<InstanceType<typeof Api>[T][U]>;
6
+ export declare type ReturnForMethod<T extends Exclude<keyof InstanceType<typeof Api>, 'axios'>, U extends keyof InstanceType<typeof Api>[T]> = Unpromisify<ReturnType<InstanceType<typeof Api>[T][U]>>['data']['data'];
7
+ export declare type BodyForMethod<T extends Exclude<keyof InstanceType<typeof Api>, 'axios'>, U extends keyof InstanceType<typeof Api>[T]> = FunctionParamsForMethod<T, U>[1];
8
+ export declare type ParamsForMethod<T extends Exclude<keyof InstanceType<typeof Api>, 'axios'>, U extends keyof InstanceType<typeof Api>[T]> = FunctionParamsForMethod<T, U>[0];
package/build/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ const api_1 = __importDefault(require("./api"));
21
+ __exportStar(require("./api"), exports);
22
+ exports.default = api_1.default;
23
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsZ0RBQXVCO0FBRXZCLHdDQUFxQjtBQUNyQixrQkFBZSxhQUFHLENBQUEifQ==
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@rlvt/statistics-openapi-client",
3
+ "version": "1.0.0+777710b",
4
+ "description": "Openapi client for reelevant service",
5
+ "main": "build/index.js",
6
+ "repository": "https://github.com/reelevant-tech/openapi-clients",
7
+ "author": "Reelevant",
8
+ "license": "MIT",
9
+ "publishconfig": {
10
+ "access": "public"
11
+ },
12
+ "scripts": {
13
+ "build": "tsc --project .",
14
+ "prepublish": "yarn build"
15
+ },
16
+ "peerDependencies": {
17
+ "axios": "*"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^18.8.5",
21
+ "typescript": "^4.8.4",
22
+ "axios": "^1.1.2"
23
+ }
24
+ }