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

@timetac/js-client-library

Package Overview
Dependencies
Maintainers
2
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@timetac/js-client-library - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

dist/utils/pages/pages.d.ts

2

dist/deltaSync/index.js

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

const response = this._get(`${this.getResourceName()}/read`, { params });
return deltaSyncResponse_1.createDeltaSyncResponse(yield rawApiResponse_1.resolveAxiosResponse(response));
return deltaSyncResponse_1.createDeltaSyncResponse(yield rawApiResponse_1.createRawApiResponse(response));
});

@@ -28,0 +28,0 @@ }

import BaseApi from '../baseApi';
import { RequestParams } from '../utils/params/requestParams';
import { ApiResponseOnSuccess } from '../utils/response/apiResponse';
import { ReadRawResponse } from '../utils/response/readRawResponse';
import { GeneralSetting } from './types';

@@ -8,5 +8,5 @@ export declare class GeneralSettingsEndpoint extends BaseApi {

read(requestParams?: RequestParams<GeneralSetting> | Object): Promise<GeneralSetting[]>;
readRaw(requestParams?: RequestParams<GeneralSetting> | Object): Promise<ApiResponseOnSuccess<GeneralSetting[]>>;
readRaw(requestParams: RequestParams<GeneralSetting>): Promise<ReadRawResponse<GeneralSetting>>;
readById(id: number, requestParams?: RequestParams<GeneralSetting> | Object): Promise<GeneralSetting>;
readBySettingType(settingType: string): Promise<GeneralSetting>;
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,2 +15,5 @@ exports.GeneralSettingsEndpoint = void 0;

const requestParams_1 = require("../utils/params/requestParams");
const rawApiResponse_1 = require("../utils/response/rawApiResponse");
const readRawResponse_1 = require("../utils/response/readRawResponse");
const resourceResponse_1 = require("../utils/response/resourceResponse");
const responseHandlers = require("../utils/response/responseHandlers");

@@ -19,5 +31,7 @@ class GeneralSettingsEndpoint extends baseApi_1.default {

readRaw(requestParams) {
const params = requestParams instanceof requestParams_1.RequestParams ? requestParams.getParams() : requestParams;
const response = this._get(`${this.getResourceName()}/read`, { params });
return responseHandlers.toApiResponse(response);
return __awaiter(this, void 0, void 0, function* () {
const params = requestParams.getParams();
const response = this._get(`${this.getResourceName()}/read`, { params });
return readRawResponse_1.createReadRawResponse(resourceResponse_1.createResourceResponse(yield rawApiResponse_1.createRawApiResponse(response)), requestParams);
});
}

@@ -24,0 +38,0 @@ readById(id, requestParams) {

@@ -43,6 +43,8 @@ import { AbsenceDaysEndpoint } from './absenceDays';

export { UserStatusOverview } from './userStatusOverview/types';
export { Pages } from './utils/pages/pages';
export { DeltaSyncParams } from './utils/params/deltaSyncParams';
export { PagingParams } from './utils/params/pagingParams';
export { RequestParams } from './utils/params/requestParams';
export { DeltaSyncResponse } from './utils/response/deltaSyncResponse';
export { RawApiResponse } from './utils/response/rawApiResponse';
export { ReadRawResponse } from './utils/response/readRawResponse';
export { DeletedEntry, ResourceResponse } from './utils/response/resourceResponse';

@@ -49,0 +51,0 @@ export default class Api {

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.RequestParams = exports.PagingParams = exports.DeltaSyncParams = exports.UserStatusOverviewStatus = exports.AbsenceStatus = exports.AbsenceDurationUnit = exports.AbsenceDayType = void 0;
exports.RequestParams = exports.DeltaSyncParams = exports.UserStatusOverviewStatus = exports.AbsenceStatus = exports.AbsenceDurationUnit = exports.AbsenceDayType = void 0;
const absenceDays_1 = require("./absenceDays");

@@ -43,4 +43,2 @@ const absences_1 = require("./absences");

Object.defineProperty(exports, "DeltaSyncParams", { enumerable: true, get: function () { return deltaSyncParams_1.DeltaSyncParams; } });
var pagingParams_1 = require("./utils/params/pagingParams");
Object.defineProperty(exports, "PagingParams", { enumerable: true, get: function () { return pagingParams_1.PagingParams; } });
var requestParams_1 = require("./utils/params/requestParams");

@@ -47,0 +45,0 @@ Object.defineProperty(exports, "RequestParams", { enumerable: true, get: function () { return requestParams_1.RequestParams; } });

import BaseApi from '../baseApi';
import { RequestParams } from '../utils/params/requestParams';
import { ApiResponseOnSuccess } from '../utils/response/apiResponse';
import { ReadRawResponse } from '../utils/response/readRawResponse';
import { Project } from './types';

@@ -8,3 +8,3 @@ export declare class ProjectsEndpoint extends BaseApi {

read(requestParams?: RequestParams<Project> | Object): Promise<Project[]>;
readRaw(requestParams?: RequestParams<Project> | Object): Promise<ApiResponseOnSuccess<Project[]>>;
readRaw(requestParams: RequestParams<Project>): Promise<ReadRawResponse<Project>>;
readById(id: number, requestParams?: RequestParams<Project> | Object): Promise<Project>;

@@ -11,0 +11,0 @@ create(): Promise<Project>;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,2 +15,5 @@ exports.ProjectsEndpoint = void 0;

const requestParams_1 = require("../utils/params/requestParams");
const rawApiResponse_1 = require("../utils/response/rawApiResponse");
const readRawResponse_1 = require("../utils/response/readRawResponse");
const resourceResponse_1 = require("../utils/response/resourceResponse");
const responseHandlers = require("../utils/response/responseHandlers");

@@ -19,5 +31,7 @@ class ProjectsEndpoint extends baseApi_1.default {

readRaw(requestParams) {
const params = requestParams instanceof requestParams_1.RequestParams ? requestParams.getParams() : requestParams;
const response = this._get(`${this.getResourceName()}/read`, { params });
return responseHandlers.toApiResponse(response);
return __awaiter(this, void 0, void 0, function* () {
const params = requestParams.getParams();
const response = this._get(`${this.getResourceName()}/read`, { params });
return readRawResponse_1.createReadRawResponse(resourceResponse_1.createResourceResponse(yield rawApiResponse_1.createRawApiResponse(response)), requestParams);
});
}

@@ -24,0 +38,0 @@ readById(id, requestParams) {

import BaseApi from '../baseApi';
import { RequestParams } from '../utils/params/requestParams';
import { ReadRawResponse } from '../utils/response/readRawResponse';
import { Task } from './types';

@@ -7,2 +8,3 @@ export declare class TasksEndpoint extends BaseApi {

read(requestParams?: RequestParams<Task> | Object): Promise<Task[]>;
readRaw(requestParams: RequestParams<Task>): Promise<ReadRawResponse<Task>>;
readById(id: number, requestParams?: RequestParams<Task> | Object): Promise<Task>;

@@ -9,0 +11,0 @@ create(data: Task): Promise<Task>;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,2 +15,5 @@ exports.TasksEndpoint = void 0;

const requestParams_1 = require("../utils/params/requestParams");
const rawApiResponse_1 = require("../utils/response/rawApiResponse");
const readRawResponse_1 = require("../utils/response/readRawResponse");
const resourceResponse_1 = require("../utils/response/resourceResponse");
const responseHandlers = require("../utils/response/responseHandlers");

@@ -18,2 +30,9 @@ class TasksEndpoint extends baseApi_1.default {

}
readRaw(requestParams) {
return __awaiter(this, void 0, void 0, function* () {
const params = requestParams.getParams();
const response = this._get(`${this.getResourceName()}/read`, { params });
return readRawResponse_1.createReadRawResponse(resourceResponse_1.createResourceResponse(yield rawApiResponse_1.createRawApiResponse(response)), requestParams);
});
}
readById(id, requestParams) {

@@ -20,0 +39,0 @@ const params = requestParams instanceof requestParams_1.RequestParams ? requestParams.getParams() : requestParams;

import BaseApi from '../baseApi';
import { RequestParams } from '../utils/params/requestParams';
import { ApiResponseOnSuccess } from '../utils/response/apiResponse';
import { ReadRawResponse } from '../utils/response/readRawResponse';
import { User } from './types';

@@ -8,3 +8,3 @@ export declare class UsersEndpoint extends BaseApi {

read(requestParams?: RequestParams<User> | Object): Promise<User[]>;
readRaw(requestParams?: RequestParams<User> | Object): Promise<ApiResponseOnSuccess<User[]>>;
readRaw(requestParams: RequestParams<User>): Promise<ReadRawResponse<User>>;
readById(id: number, requestParams?: RequestParams<User> | Object): Promise<User>;

@@ -11,0 +11,0 @@ readMe(requestParams?: RequestParams<User> | Object): Promise<User>;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,2 +15,5 @@ exports.UsersEndpoint = void 0;

const requestParams_1 = require("../utils/params/requestParams");
const rawApiResponse_1 = require("../utils/response/rawApiResponse");
const readRawResponse_1 = require("../utils/response/readRawResponse");
const resourceResponse_1 = require("../utils/response/resourceResponse");
const responseHandlers = require("../utils/response/responseHandlers");

@@ -19,5 +31,7 @@ class UsersEndpoint extends baseApi_1.default {

readRaw(requestParams) {
const params = requestParams instanceof requestParams_1.RequestParams ? requestParams.getParams() : requestParams;
const response = this._get(`${this.getResourceName()}/read`, { params });
return responseHandlers.toApiResponse(response);
return __awaiter(this, void 0, void 0, function* () {
const params = requestParams.getParams();
const response = this._get(`${this.getResourceName()}/read`, { params });
return readRawResponse_1.createReadRawResponse(resourceResponse_1.createResourceResponse(yield rawApiResponse_1.createRawApiResponse(response)), requestParams);
});
}

@@ -24,0 +38,0 @@ readById(id, requestParams) {

@@ -27,2 +27,3 @@ export declare class RequestParams<R extends Object> {

};
clone(source: RequestParams<R>): this;
}

@@ -86,4 +86,8 @@ "use strict";

}
clone(source) {
Object.assign(this.criteria, source.getCriteria());
return this;
}
}
exports.RequestParams = RequestParams;
//# sourceMappingURL=requestParams.js.map
import { AxiosResponse } from 'axios';
export declare type RawApiResponse = {
Host?: string;
Codeversion?: string;
Success?: boolean;
SuccessNested?: boolean;
Host: string;
Codeversion: string;
Success: boolean;
SuccessNested: boolean;
ResourceName: string;
RequestStartTime: string;
RequestEndTime: string;
ServerTimeZone: string;
NumResults?: number;
NumResultsNested?: number;
ResourceName?: string;
RequestStartTime?: string;
RequestEndTime?: string;
ServerTimeZone?: string;
Results?: any;
Deleted?: any;
Affected?: any;
Error?: number;
ErrorMessage?: string;
ErrorInternal?: string;
ErrorExtended?: any;
};
export declare function resolveAxiosResponse(promise: Promise<AxiosResponse<any>>): Promise<RawApiResponse>;
export declare function createRawApiResponse(promise: Promise<AxiosResponse<any>>): Promise<RawApiResponse>;

@@ -12,12 +12,12 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveAxiosResponse = void 0;
function resolveAxiosResponse(promise) {
exports.createRawApiResponse = void 0;
function createRawApiResponse(promise) {
return __awaiter(this, void 0, void 0, function* () {
const resolved = yield promise;
if (resolved === undefined) {
throw new Error('General Error');
const axiosResponse = yield promise;
if (axiosResponse === undefined) {
throw new Error('The Api response is unsuccessful');
}
const rawApiResponse = (yield promise).data;
const rawApiResponse = axiosResponse.data;
if (rawApiResponse.Success == false) {
throw new Error('General Error');
throw new Error('The Api response is unsuccessful');
}

@@ -27,3 +27,3 @@ return rawApiResponse;

}
exports.resolveAxiosResponse = resolveAxiosResponse;
exports.createRawApiResponse = createRawApiResponse;
//# sourceMappingURL=rawApiResponse.js.map
{
"name": "@timetac/js-client-library",
"version": "0.3.0",
"version": "0.3.1",
"description": "TimeTac API JS client library",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/TimeTac/js-client-library#readme",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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