4.2.207 • Published 9 months ago

@open-stock/stock-counter-client v4.2.207

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

@open-stock/stock-counter-client

A universial inventory management library for Javascript on browser with user state management. This only works with (https://github.com/BrianPollar/@open-stock/stock-counter-server) the server library.

Features

stock-cpounter-client implements a full authentication system. It consists of:

  • a Javascript client library (this repository)
  • a Node Js Server for Node.js.

Its main features are:

Reliability

The libarary uses standard encryption for data protection:

Simple and convenient API

Sample code:

import { createStockCounter } from "@open-stock/stock-counter-client";
import Axios from "axios-observable";

// then create an instance
const instance = Axios.create({
  baseURL: "https://yourapi.com",
  timeout: 1000,
  headers: {
    "X-Custom-Header": "foobar",
    Authorization: "auth-token",
  },
});

const { stockCounterClient } = createStockCounter(instance);

Installation

// with npm
npm install @open-stock/stock-counter-client

// with yarn
yarn add @open-stock/stock-counter-client

How to use

The following example gets user from stock-auth-client and gets the chat client and chat controller instances.

import { createStockCounter } from "@open-stock/stock-counter-client";
import Axios from "axios-observable";

// then create an instance
const instance = Axios.create({
  baseURL: "https://yourapi.com",
  timeout: 1000,
  headers: {
    "X-Custom-Header": "foobar",
    Authorization: "auth-token",
  },
});

const { stockCounterClient } = createStockCounter(instance);

Extra Features

Here are the features of the stock-counter-client library

NOTE

Most of the features below are automatically implememnted by the library. But If you want to use the classes and functions provided by the library, you can do so by importing them from the library. Some of them are elaborated below.

transformFaqToNameOrImage

transformFaqToNameOrImage is a function that is used to transform a faq to a name or image.

usage

import { transformFaqToNameOrImage } from "@open-stock/stock-counter-client";

const faq: Faq ={
// ...
};
const type = 'img' || 'name';

const nameOrImage = transformFaqToNameOrImage(faq, type);

transformEstimateId

transformEstimateId is a function that is used to transform an estimate id.

usage

import { transformEstimateId } from "@open-stock/stock-counter-client";

const result = transformEstimateId('123');

transformInvoice

transformInvoice is a function that is used to transform an invoice.

usage

import { transformInvoice } from "@open-stock/stock-counter-client";

const result = transformInvoice('123');

transformUrId

transformUrId is a function that is used to transform a user id.

usage

import { transformUrId } from "@open-stock/stock-counter-client";

const result = transformUrId('123', 'CAR');

likeFn

likeFn is a function that is used to like an item.

usage

import { likeFn, Item } from "@open-stock/stock-counter-client";
import { User } from '@open-stock/stock-auth-client';

const currentUser: User = {
// ...
};
const item: Item = {
// ...
};

const { success } = await likeFn('companyId', currentUser, item);

unLikeFn

unLikeFn is a function that is used to unlike an item.

usage

import { unLikeFn, Item } from "@open-stock/stock-counter-client";
import { User } from '@open-stock/stock-auth-client';

const currentUser: User = {
// ...
};
const item: Item = {
// ...
};

const { success } = await unLikeFn('companyId', currentUser, item);

determineLikedFn

determineLikedFn is a function that is used to determine if an item is liked.

usage

import { determineLikedFn, Item } from "@open-stock/stock-counter-client";
import { User } from '@open-stock/stock-auth-client';

const currentUser: User = {
// ...
};
const item: Item = {
// ...
};

const res = await determineLikedFn(item, currentUser);

markInvStatusAsFn

markInvStatusAsFn is a function that is used to change an invoice status.

usage

import { markInvStatusAsFn, Invoice } from "@open-stock/stock-counter-client";
import { TinvoiceStatus } from '@open-stock/stock-universal';

const invoice: Invoice = {
// ...
};
const status: TinvoiceStatus = 'pending';

const { success } = await markInvStatusAsFn('companyId', invoice, status);

deleteInvoiceFn

deleteInvoiceFn is a function that is used to delete an invoice.

usage

import { deleteInvoiceFn, Invoice } from "@open-stock/stock-counter-client";

const invoices: Invoice[] = [
// ...
];

const { success } = await deleteInvoiceFn('companyId', '_id', invoices);

toggleSelectionFn

toggleSelectionFn is a function that is used to toggle selection.

usage

import { toggleSelectionFn } from "@open-stock/stock-counter-client";

const id = '123';
const selections = ['123', '456'];

toggleSelectionFn(id, selections);

deleteManyInvoicesFn

deleteManyInvoicesFn is a function that is used to delete many invoices.

usage

import { deleteManyInvoicesFn, Invoice } from "@open-stock/stock-counter-client";

const invoices: Invoice[] = [
// ...
];
const selections = ['123', '456'];

const { success } = await deleteManyInvoicesFn('companyId', invoices, selections);

openBoxFn

openBoxFn is a function that is used to open a box.

usage

import { openBoxFn } from "@open-stock/stock-counter-client";

const val = '123';
const boxes = ['123', '456'];

openBoxFn(val, boxes);

transformNoInvId

transformNoInvId is a function that is used to transform a no invoice id.

usage

import { transformNoInvId } from "@open-stock/stock-counter-client";

const suffix = 'ABC';
const val = 123;

const result = transformNoInvId(suffix, val);

applyBlockDateSelect

Applies a block date select filter to the given data array based on the specified condition.

usage

import { applyBlockDateSelect, Estimate } from "@open-stock/stock-counter-client";

const estimates: Estimate[] = [
// ...
];

const result = applyBlockDateSelect(estimates, 'pending');

CalculationsController

CalculationsController is a class that is used to manage calculations. It is used by the StockCounterClient to manage calculations.

usage

import { CalculationsController } from "@open-stock/stock-counter-client";

const calculationsController = new CalculationsController();

// see file definition for all methods descriptions

InventoryController

InventoryController is a class that is used to manage inventory. It is used by the StockCounterClient to manage inventory.

usage

import { InventoryController } from "@open-stock/stock-counter-client";

const inventoryController = new InventoryController();

// see file definition for all methods descriptions

PaymentController

PaymentController is a class that is used to manage payments. It is used by the StockCounterClient to manage payments.

usage

import { PaymentController } from "@open-stock/stock-counter-client";

const paymentController = new PaymentController();

// see file definition for all methods descriptions
```ts

Documentation

The source code of the website can be found here. Contributions are welcome!

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site.

License

MIT

4.2.207

9 months ago

4.2.206

9 months ago

4.2.204

9 months ago

4.2.205

9 months ago

4.2.202

9 months ago

4.2.203

9 months ago

4.2.200

9 months ago

4.2.201

9 months ago

4.2.194

9 months ago

4.2.195

9 months ago

4.2.192

9 months ago

4.2.193

9 months ago

4.2.190

9 months ago

4.2.191

9 months ago

4.2.198

9 months ago

4.2.199

9 months ago

4.2.196

9 months ago

4.2.197

9 months ago

4.2.189

9 months ago

4.2.183

9 months ago

4.2.184

9 months ago

4.2.181

10 months ago

4.2.182

10 months ago

4.2.180

10 months ago

4.2.187

9 months ago

4.2.188

9 months ago

4.2.185

9 months ago

4.2.186

9 months ago

4.2.172

10 months ago

4.2.173

10 months ago

4.2.170

10 months ago

4.2.171

10 months ago

4.2.178

10 months ago

4.2.179

10 months ago

4.2.176

10 months ago

4.2.177

10 months ago

4.2.174

10 months ago

4.2.175

10 months ago

4.2.167

10 months ago

4.2.168

10 months ago

4.2.165

10 months ago

4.2.166

10 months ago

4.2.164

10 months ago

4.2.163

10 months ago

4.2.161

11 months ago

4.2.162

11 months ago

4.2.160

11 months ago

4.2.158

11 months ago

4.2.159

11 months ago

4.2.156

11 months ago

4.2.157

11 months ago

4.2.154

11 months ago

4.2.155

11 months ago

4.2.153

11 months ago

4.2.151

11 months ago

4.2.152

11 months ago

4.2.149

11 months ago

4.2.150

11 months ago

4.2.147

11 months ago

4.2.148

11 months ago

4.2.146

11 months ago

4.2.138

11 months ago

4.2.139

11 months ago

4.2.140

11 months ago

4.2.145

11 months ago

4.2.143

11 months ago

4.2.144

11 months ago

4.2.141

11 months ago

4.2.142

11 months ago

4.2.129

11 months ago

4.2.127

11 months ago

4.2.128

11 months ago

4.2.136

11 months ago

4.2.137

11 months ago

4.2.134

11 months ago

4.2.135

11 months ago

4.2.132

11 months ago

4.2.133

11 months ago

4.2.130

11 months ago

4.2.131

11 months ago

4.2.118

11 months ago

4.2.119

11 months ago

4.2.116

11 months ago

4.2.117

11 months ago

4.2.125

11 months ago

4.2.126

11 months ago

4.2.123

11 months ago

4.2.124

11 months ago

4.2.121

11 months ago

4.2.122

11 months ago

4.2.120

11 months ago

4.2.114

11 months ago

4.2.115

11 months ago

4.2.112

11 months ago

4.2.113

11 months ago

4.2.110

11 months ago

4.2.111

11 months ago

4.1.8

1 year ago

4.1.7

1 year ago

4.1.9

1 year ago

4.2.103

11 months ago

4.2.104

11 months ago

4.2.101

11 months ago

4.2.102

11 months ago

4.2.100

11 months ago

4.0.5

1 year ago

4.0.4

1 year ago

4.0.7

1 year ago

4.0.6

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

4.0.3

1 year ago

4.0.2

1 year ago

4.0.9

1 year ago

4.0.8

1 year ago

4.2.20

1 year ago

4.2.21

1 year ago

4.2.22

1 year ago

4.2.28

1 year ago

4.2.29

1 year ago

4.2.24

1 year ago

4.2.25

1 year ago

4.2.26

1 year ago

4.2.10

1 year ago

4.2.11

1 year ago

4.2.12

1 year ago

4.2.17

1 year ago

4.2.18

1 year ago

4.2.19

1 year ago

4.2.13

1 year ago

4.2.14

1 year ago

4.2.15

1 year ago

4.2.16

1 year ago

3.9.9

1 year ago

3.9.8

1 year ago

3.9.3

1 year ago

3.9.2

1 year ago

3.9.1

1 year ago

3.9.0

1 year ago

3.9.7

1 year ago

3.9.6

1 year ago

3.9.5

1 year ago

3.9.4

1 year ago

4.2.80

11 months ago

4.2.81

11 months ago

4.2.86

11 months ago

4.2.87

11 months ago

4.2.88

11 months ago

4.2.89

11 months ago

4.2.82

11 months ago

4.2.83

11 months ago

4.2.84

11 months ago

4.2.85

11 months ago

4.2.70

11 months ago

4.2.75

11 months ago

4.2.76

11 months ago

4.2.77

11 months ago

4.2.78

11 months ago

4.2.71

11 months ago

4.2.72

11 months ago

4.2.73

11 months ago

4.2.74

11 months ago

4.2.79

11 months ago

4.2.90

11 months ago

4.2.91

11 months ago

4.2.92

11 months ago

4.2.97

11 months ago

4.2.98

11 months ago

4.2.99

11 months ago

4.2.93

11 months ago

4.2.94

11 months ago

4.2.95

11 months ago

4.2.96

11 months ago

4.2.42

12 months ago

4.2.43

12 months ago

4.2.44

12 months ago

4.2.45

12 months ago

4.2.40

12 months ago

4.2.41

12 months ago

4.2.46

12 months ago

4.2.47

12 months ago

4.2.48

12 months ago

4.2.49

12 months ago

4.2.31

12 months ago

4.2.3

1 year ago

4.2.32

12 months ago

4.2.2

1 year ago

4.2.33

12 months ago

4.2.5

1 year ago

4.2.34

12 months ago

4.2.4

1 year ago

4.2.1

1 year ago

4.2.30

1 year ago

4.2.0

1 year ago

4.2.39

12 months ago

4.2.35

12 months ago

4.2.36

12 months ago

4.2.37

12 months ago

4.2.38

12 months ago

4.2.7

1 year ago

4.2.6

1 year ago

4.2.9

1 year ago

4.2.8

1 year ago

4.2.64

12 months ago

4.2.65

12 months ago

4.2.66

12 months ago

4.2.67

11 months ago

4.2.60

12 months ago

4.2.61

12 months ago

4.2.62

12 months ago

4.2.63

12 months ago

4.2.68

11 months ago

4.2.69

11 months ago

4.2.109

11 months ago

4.2.107

11 months ago

4.2.108

11 months ago

4.2.105

11 months ago

4.2.106

11 months ago

4.2.53

12 months ago

4.1.4

1 year ago

4.2.54

12 months ago

4.1.3

1 year ago

4.2.55

12 months ago

4.1.6

1 year ago

4.2.56

12 months ago

4.1.5

1 year ago

4.1.0

1 year ago

4.2.50

12 months ago

4.2.51

12 months ago

4.1.2

1 year ago

4.2.52

12 months ago

4.1.1

1 year ago

4.2.57

12 months ago

4.2.58

12 months ago

4.2.59

12 months ago

3.8.9

1 year ago

3.8.8

1 year ago

3.8.7

1 year ago

3.8.6

1 year ago

3.7.5

1 year ago

3.7.4

1 year ago

3.7.3

1 year ago

3.7.9

1 year ago

3.7.8

1 year ago

3.7.7

1 year ago

3.7.6

1 year ago

3.8.0

1 year ago

3.8.4

1 year ago

3.8.3

1 year ago

3.8.2

1 year ago

3.8.1

1 year ago

3.8.5

1 year ago

3.7.2

1 year ago

3.6.9

1 year ago

3.7.1

1 year ago

3.7.0

1 year ago

3.6.8

1 year ago

3.6.7

1 year ago

3.6.6

1 year ago

3.6.5

1 year ago

3.6.4

1 year ago

3.6.3

1 year ago

3.6.2

1 year ago

3.6.1

1 year ago

3.6.0

1 year ago

3.5.7

1 year ago

3.5.6

1 year ago

3.5.9

1 year ago

3.5.8

1 year ago

3.5.3

1 year ago

3.5.2

1 year ago

3.5.1

1 year ago

3.5.0

1 year ago

3.5.5

1 year ago

3.5.4

1 year ago

3.4.4

1 year ago

3.4.3

1 year ago

3.4.2

1 year ago

3.4.1

1 year ago

3.4.8

1 year ago

3.4.7

1 year ago

3.4.6

1 year ago

3.4.5

1 year ago

3.4.9

1 year ago

3.3.9

1 year ago

3.3.8

1 year ago

3.3.7

1 year ago

3.2.6

1 year ago

3.2.9

1 year ago

3.2.8

1 year ago

3.2.7

1 year ago

3.4.0

1 year ago

3.3.1

1 year ago

3.3.0

1 year ago

3.3.5

1 year ago

3.3.4

1 year ago

3.3.3

1 year ago

3.3.2

1 year ago

3.2.4

1 year ago

3.2.2

1 year ago

3.2.3

1 year ago

3.2.1

1 year ago

3.2.0

1 year ago

3.1.3

1 year ago

3.1.2

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago

3.1.7

1 year ago

3.1.6

1 year ago

3.1.5

1 year ago

3.1.4

1 year ago

3.1.9

1 year ago

3.1.8

1 year ago

3.0.4

1 year ago

3.0.8

1 year ago

3.0.7

1 year ago

3.0.6

1 year ago

3.0.9

1 year ago

3.0.3

1 year ago

2.8.1

1 year ago

2.8.0

1 year ago

2.9.2

1 year ago

2.9.1

1 year ago

2.9.4

1 year ago

2.9.3

1 year ago

2.9.6

1 year ago

2.9.5

1 year ago

2.7.2

1 year ago

2.7.1

1 year ago

2.8.3

1 year ago

2.8.2

1 year ago

2.8.5

1 year ago

2.8.4

1 year ago

2.8.7

1 year ago

2.8.6

1 year ago

2.8.9

1 year ago

2.8.8

1 year ago

3.0.2

1 year ago

3.0.1

1 year ago

2.7.4

1 year ago

2.7.3

1 year ago

2.7.5

1 year ago

3.0.0

1 year ago

2.7.8

1 year ago

2.7.7

1 year ago

2.9.0

1 year ago

2.7.0

1 year ago

2.6.9

1 year ago

2.6.8

1 year ago

2.6.7

1 year ago

2.6.6

1 year ago

2.6.1

1 year ago

2.6.3

1 year ago

2.6.2

1 year ago

2.6.5

1 year ago

2.6.4

1 year ago

2.6.0

1 year ago

2.5.8

1 year ago

2.5.7

1 year ago

2.5.9

1 year ago

2.5.6

1 year ago

2.5.5

1 year ago

2.5.0

1 year ago

2.5.2

1 year ago

2.5.1

1 year ago

2.5.4

1 year ago

2.5.3

1 year ago

2.4.8

2 years ago

2.4.1

2 years ago

2.4.3

2 years ago

2.4.2

2 years ago

2.4.5

2 years ago

2.4.4

2 years ago

2.4.7

2 years ago

2.4.6

2 years ago

2.4.0

2 years ago

2.3.2

2 years ago

2.3.6

2 years ago

2.3.5

2 years ago

2.3.7

2 years ago

2.3.1

2 years ago

2.3.0

2 years ago

2.1.2

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.1.4

2 years ago

2.2.2

2 years ago

2.1.3

2 years ago

2.0.4

2 years ago

2.2.5

2 years ago

2.1.6

2 years ago

2.0.7

2 years ago

2.2.4

2 years ago

2.1.5

2 years ago

2.0.6

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.0.8

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

2.2.9

2 years ago

2.2.8

2 years ago

2.1.9

2 years ago

1.4.5

2 years ago

1.3.5

2 years ago

1.4.0

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.2

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago