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

@figuredev/orders-sdk

Package Overview
Dependencies
Maintainers
9
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@figuredev/orders-sdk - npm Package Compare versions

Comparing version 0.12.105 to 0.13.0

95

lib/index.d.ts

@@ -14,59 +14,62 @@ import { Maybe } from "@figurepos/fgr-lib-backend/lib/types";

};
export declare type GetInventoryInfoParams = {
locationId: string;
productIds?: string[];
};
export declare type GetOrdersCountParams = {
source?: string;
customerId?: string;
locationId?: string;
from?: IsoDateTime;
};
export declare type GetOrdersPreviewsParams = {
from?: IsoDateTime;
limit: number;
serviceId?: string;
customerId?: string;
externalUserId?: string;
};
export declare type GetReportPreparationTimeByItemParams = {
locationIds: string[];
from: IsoDate;
to: IsoDate;
};
export declare type GetReportPreparationTimeHourlyParams = {
locationIds: string[];
from: IsoDate;
to: IsoDate;
};
export declare type GetTillsCountParams = {
olderThan?: Maybe<string>;
includeDeleted: boolean;
includeClosed: boolean;
};
export declare type GetTillsParams = {
limit: Maybe<number>;
olderThan?: Maybe<string>;
includeDeleted: boolean;
includeClosed: boolean;
};
export declare class OrdersClient {
private config;
constructor(config: OrdersClientConfig);
prepareHeaders(ctx: UserContext): {
"twbrds-terminal-id": string;
"twbrds-location-id": string;
"twbrds-account-id": string;
"fgr-service-token": string;
};
placeOrder(order: OrderInputDTO, ctx: UserContext): Promise<import("axios").AxiosResponse<any>>;
getOrderForTable(ctx: UserContext, assignmentId: Maybe<string>): Promise<any>;
placeOrder(order: OrderInputDTO, ctx: UserContext): Promise<unknown>;
getOrderForTable(ctx: UserContext, assignmentId: Maybe<string>): Promise<unknown>;
getOrder(ctx: UserContext, id: string): Promise<OrderDTO>;
getOrdersPreviews(ctx: UserContext, params: {
from?: IsoDateTime;
limit: number;
serviceId?: string;
customerId?: string;
externalUserId?: string;
}): Promise<OrderPreviewDTO[]>;
getOrdersCount(ctx: UserContext, params: {
source?: string;
customerId?: string;
locationId?: string;
from?: IsoDateTime;
}): Promise<number>;
getOrdersPreviews(ctx: UserContext, params: GetOrdersPreviewsParams): Promise<OrderPreviewDTO[]>;
getOrdersCount(ctx: UserContext, params: GetOrdersCountParams): Promise<number>;
checkOrderExists(ctx: UserContext, id: string): Promise<boolean>;
getInventoryInfo(ctx: UserContext, params: {
locationId: string;
productIds?: string[];
}): Promise<InventoryInfoDTO[]>;
getInventoryInfo(ctx: UserContext, params: GetInventoryInfoParams): Promise<InventoryInfoDTO[]>;
getLoyaltyPrograms(ctx: UserContext): Promise<LoyaltyProgramDTO[]>;
getLoyaltyProgramTransactionsByTransactionIds(ctx: UserContext, transactionIds: string[]): Promise<LoyaltyProgramTransactionDTO[]>;
getLoyaltyProgramTransactionsByCustomerLoyaltyProgramId(ctx: UserContext, customerLoyaltyProgramId: string): Promise<LoyaltyProgramTransactionDTO[]>;
getReportPreparationTimeByItem(ctx: UserContext, params: {
locationIds: string[];
from: IsoDate;
to: IsoDate;
}): Promise<ReportPreparationTimeByItemDTO>;
getReportPreparationTimeHourly(ctx: UserContext, params: {
locationIds: string[];
from: IsoDate;
to: IsoDate;
}): Promise<ReportPreparationTimeHourlyDTO>;
getTillsCount(ctx: UserContext, params: {
olderThan?: Maybe<string>;
includeDeleted: boolean;
includeClosed: boolean;
}): Promise<TillCountDTO>;
getTills(ctx: UserContext, params: {
limit: Maybe<number>;
olderThan?: Maybe<string>;
includeDeleted: boolean;
includeClosed: boolean;
}): Promise<TillDTO[]>;
getReportPreparationTimeByItem(ctx: UserContext, params: GetReportPreparationTimeByItemParams): Promise<ReportPreparationTimeByItemDTO>;
getReportPreparationTimeHourly(ctx: UserContext, params: GetReportPreparationTimeHourlyParams): Promise<ReportPreparationTimeHourlyDTO>;
getTillsCount(ctx: UserContext, params: GetTillsCountParams): Promise<TillCountDTO>;
getTills(ctx: UserContext, params: GetTillsParams): Promise<TillDTO[]>;
getPreparedFileUploadUrl(ctx: UserContext, filename: string, fileType: string, fileUploadType: FileUploadTypeDTO): Promise<PreparedFileUploadDTO | null>;
private prepareHeaders;
private post;
private get;
}
export {};

@@ -19,16 +19,5 @@ "use strict";

}
prepareHeaders(ctx) {
return Object.assign(Object.assign(Object.assign({ "fgr-service-token": this.config.secret }, (ctx.accountId ? { "twbrds-account-id": ctx.accountId } : null)), (ctx.locationId ? { "twbrds-location-id": ctx.locationId } : null)), (ctx.terminalId ? { "twbrds-terminal-id": ctx.terminalId } : null));
}
placeOrder(order, ctx) {
return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "POST",
url: "/order/v3",
headers: this.prepareHeaders(ctx),
data: {
order: order,
},
});
return this.post(ctx, "/order/v3", { order: order });
});

@@ -38,13 +27,7 @@ }

return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "POST",
url: "/order/order-lookup",
headers: this.prepareHeaders(ctx),
data: {
assignmentId: assignmentId,
state: [order_1.OrderStateDTO.Created, order_1.OrderStateDTO.Active],
deleted: false,
},
}).then((r) => r.data);
return this.post(ctx, "/order/order-lookup", {
assignmentId: assignmentId,
state: [order_1.OrderStateDTO.Created, order_1.OrderStateDTO.Active],
deleted: false,
});
});

@@ -54,8 +37,3 @@ }

return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "GET",
url: `/order/${id}`,
headers: this.prepareHeaders(ctx),
}).then((r) => r.data);
return this.get(ctx, `/order/${id}`);
});

@@ -65,15 +43,9 @@ }

return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "POST",
url: "/order-previews",
headers: this.prepareHeaders(ctx),
params: {
from: params.from,
limit: params.limit,
serviceId: params.serviceId,
customerId: params.customerId,
externalUserId: params.externalUserId,
},
}).then((r) => r.data);
return this.post(ctx, "/order-previews", {
from: params.from,
limit: params.limit,
serviceId: params.serviceId,
customerId: params.customerId,
externalUserId: params.externalUserId,
});
});

@@ -83,24 +55,16 @@ }

return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "GET",
url: "/orders-count",
headers: this.prepareHeaders(ctx),
params: {
source: params.source,
customerId: params.customerId,
locationId: params.locationId,
from: params.from,
},
}).then((r) => r.data.count);
const result = yield this.get(ctx, "/orders-count", {
source: params.source,
customerId: params.customerId,
locationId: params.locationId,
from: params.from,
});
return result.count;
});
}
checkOrderExists(ctx, id) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "GET",
url: `/check-order-exists/${id}`,
headers: this.prepareHeaders(ctx),
}).then((r) => { var _a; return (_a = r.data.exists) !== null && _a !== void 0 ? _a : false; });
const result = yield this.get(ctx, `/check-order-exists/${id}`);
return (_a = result.exists) !== null && _a !== void 0 ? _a : false;
});

@@ -110,12 +74,6 @@ }

return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "GET",
url: "/inventory/info",
headers: this.prepareHeaders(ctx),
params: {
locationId: params.locationId,
productIds: params.productIds,
},
}).then((r) => { var _a; return (_a = r.data) !== null && _a !== void 0 ? _a : []; });
return this.get(ctx, "/inventory/info", {
locationId: params.locationId,
productIds: params.productIds,
});
});

@@ -142,51 +100,32 @@ }

getReportPreparationTimeByItem(ctx, params) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "GET",
url: "/report/preparation/item",
headers: this.prepareHeaders(ctx),
params: {
locationIds: params.locationIds,
from: params.from,
to: params.to,
},
}).then((r) => { var _a; return (_a = r.data) !== null && _a !== void 0 ? _a : { items: [] }; });
return ((_a = this.get(ctx, "/report/preparation/item", {
locationIds: params.locationIds,
from: params.from,
to: params.to,
})) !== null && _a !== void 0 ? _a : { items: [] });
});
}
getReportPreparationTimeHourly(ctx, params) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "GET",
url: "/report/preparation/hourly",
headers: this.prepareHeaders(ctx),
params: {
locationIds: params.locationIds,
from: params.from,
to: params.to,
},
}).then((r) => { var _a; return (_a = r.data) !== null && _a !== void 0 ? _a : { hours: [] }; });
return ((_a = this.get(ctx, "/report/preparation/hourly", {
locationIds: params.locationIds,
from: params.from,
to: params.to,
})) !== null && _a !== void 0 ? _a : { hours: [] });
});
}
getTillsCount(ctx, params) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "GET",
url: "/till/count",
headers: this.prepareHeaders(ctx),
params: {
olderThan: params.olderThan,
includeDeleted: params.includeDeleted,
includeClosed: params.includeClosed,
},
}).then((r) => {
var _a;
return (_a = r.data) !== null && _a !== void 0 ? _a : {
count: 0,
olderThan: params.olderThan,
includeDeleted: params.includeDeleted,
includeClosed: params.includeClosed,
};
return ((_a = this.get(ctx, "/till/count", {
olderThan: params.olderThan,
includeDeleted: params.includeDeleted,
includeClosed: params.includeClosed,
})) !== null && _a !== void 0 ? _a : {
count: 0,
includeDeleted: params.includeDeleted,
includeClosed: params.includeClosed,
});

@@ -197,14 +136,8 @@ });

return __awaiter(this, void 0, void 0, function* () {
return yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "GET",
url: "/till",
headers: this.prepareHeaders(ctx),
params: {
limit: params.limit,
olderThan: params.olderThan,
includeDeleted: params.includeDeleted,
includeClosed: params.includeClosed,
},
}).then((r) => { var _a; return (_a = r.data) !== null && _a !== void 0 ? _a : []; });
return this.get(ctx, "/till", {
limit: params.limit,
olderThan: params.olderThan,
includeDeleted: params.includeDeleted,
includeClosed: params.includeClosed,
});
});

@@ -214,14 +147,22 @@ }

return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.createHttpRequest)({
return this.post(ctx, "/file/prepare", {
filename: filename,
fileType: fileType,
fileUploadType: fileUploadType,
});
});
}
prepareHeaders(ctx) {
return Object.assign(Object.assign(Object.assign({ "fgr-service-token": this.config.secret }, (ctx.accountId ? { "twbrds-account-id": ctx.accountId } : null)), (ctx.locationId ? { "twbrds-location-id": ctx.locationId } : null)), (ctx.terminalId ? { "twbrds-terminal-id": ctx.terminalId } : null));
}
post(ctx, url, data) {
return __awaiter(this, void 0, void 0, function* () {
const r = yield (0, http_1.createHttpRequest)({
baseURL: this.config.baseUrl,
method: "POST",
url: `/file/prepare`,
url: url,
headers: this.prepareHeaders(ctx),
data: {
filename: filename,
fileType: fileType,
fileUploadType: fileUploadType,
},
data: data,
});
return response.data;
return r.data;
});

@@ -228,0 +169,0 @@ }

{
"name": "@figuredev/orders-sdk",
"version": "0.12.105",
"version": "0.13.0",
"license": "ISC",

@@ -5,0 +5,0 @@ "files": [

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