erpnext-queue-client 1.0.2
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/dist/client.d.ts +25 -0
- package/dist/client.js +141 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.js +26 -0
- package/dist/erpnext/decryptFromErpNext.server.d.ts +2 -0
- package/dist/erpnext/decryptFromErpNext.server.js +17 -0
- package/dist/erpnext/decryptFromErpNext.server.test.d.ts +1 -0
- package/dist/erpnext/decryptFromErpNext.server.test.js +30 -0
- package/dist/erpnext/erpnextRequestWrapper.d.ts +5 -0
- package/dist/erpnext/erpnextRequestWrapper.js +91 -0
- package/dist/erpnext/erpnextRequests.d.ts +1786 -0
- package/dist/erpnext/erpnextRequests.js +339 -0
- package/dist/erpnext/model/Address.d.ts +349 -0
- package/dist/erpnext/model/Address.js +99 -0
- package/dist/erpnext/model/Contact.d.ts +546 -0
- package/dist/erpnext/model/Contact.js +118 -0
- package/dist/erpnext/model/Country.d.ts +78 -0
- package/dist/erpnext/model/Country.js +30 -0
- package/dist/erpnext/model/Customer.d.ts +99 -0
- package/dist/erpnext/model/Customer.js +42 -0
- package/dist/erpnext/model/DateSchema.d.ts +2 -0
- package/dist/erpnext/model/DateSchema.js +8 -0
- package/dist/erpnext/model/DeliveryNote.d.ts +1648 -0
- package/dist/erpnext/model/DeliveryNote.js +219 -0
- package/dist/erpnext/model/DispatchRun.d.ts +688 -0
- package/dist/erpnext/model/DispatchRun.js +167 -0
- package/dist/erpnext/model/DispatcherPreset.d.ts +159 -0
- package/dist/erpnext/model/DispatcherPreset.js +43 -0
- package/dist/erpnext/model/ERPNextQueue.d.ts +48 -0
- package/dist/erpnext/model/ERPNextQueue.js +5 -0
- package/dist/erpnext/model/ERPNextRequest.d.ts +29 -0
- package/dist/erpnext/model/ERPNextRequest.js +2 -0
- package/dist/erpnext/model/ERPNextResponse.d.ts +17 -0
- package/dist/erpnext/model/ERPNextResponse.js +18 -0
- package/dist/erpnext/model/File.d.ts +146 -0
- package/dist/erpnext/model/File.js +36 -0
- package/dist/erpnext/model/Fulfiller.d.ts +175 -0
- package/dist/erpnext/model/Fulfiller.js +79 -0
- package/dist/erpnext/model/FulfillerSettings.d.ts +130 -0
- package/dist/erpnext/model/FulfillerSettings.js +34 -0
- package/dist/erpnext/model/FulfillmentStation.d.ts +9 -0
- package/dist/erpnext/model/FulfillmentStation.js +9 -0
- package/dist/erpnext/model/Item.d.ts +1710 -0
- package/dist/erpnext/model/Item.js +239 -0
- package/dist/erpnext/model/ProjectedQuantityReport.d.ts +281 -0
- package/dist/erpnext/model/ProjectedQuantityReport.js +72 -0
- package/dist/erpnext/model/PurchaseOrder.d.ts +906 -0
- package/dist/erpnext/model/PurchaseOrder.js +248 -0
- package/dist/erpnext/model/Receipt.d.ts +790 -0
- package/dist/erpnext/model/Receipt.js +212 -0
- package/dist/erpnext/model/ReceiptDraft.d.ts +541 -0
- package/dist/erpnext/model/ReceiptDraft.js +149 -0
- package/dist/erpnext/model/Shipment.d.ts +1139 -0
- package/dist/erpnext/model/Shipment.js +191 -0
- package/dist/erpnext/model/ShippingProvider.d.ts +434 -0
- package/dist/erpnext/model/ShippingProvider.js +204 -0
- package/dist/erpnext/model/StockDict.d.ts +3 -0
- package/dist/erpnext/model/StockDict.js +7 -0
- package/dist/erpnext/model/WarehouseCategory.d.ts +20 -0
- package/dist/erpnext/model/WarehouseCategory.js +15 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/utils/fernet.server.d.ts +150 -0
- package/dist/utils/fernet.server.js +344 -0
- package/dist/utils/logger.d.ts +5 -0
- package/dist/utils/logger.js +45 -0
- package/dist/utils/request.d.ts +28 -0
- package/dist/utils/request.js +107 -0
- package/dist/utils/utils.d.ts +4 -0
- package/dist/utils/utils.js +23 -0
- package/dist/utils/zodUtils.d.ts +2 -0
- package/dist/utils/zodUtils.js +17 -0
- package/package.json +32 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillbeeShippingProviderCredentials = exports.ShippingProviderCredentials = exports.ShippingProviderList = exports.ShippingProviderFromList = exports.ShippingProvider = exports.LabelService = exports.ShopifyCarrier = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
var ShopifyCarrier;
|
|
7
|
+
(function (ShopifyCarrier) {
|
|
8
|
+
// Germany specific
|
|
9
|
+
ShopifyCarrier["Deutsche Post (DE)"] = "Deutsche Post (DE)";
|
|
10
|
+
ShopifyCarrier["Deutsche Post (EN)"] = "Deutsche Post (EN)";
|
|
11
|
+
ShopifyCarrier["DHL"] = "DHL";
|
|
12
|
+
ShopifyCarrier["Swiship"] = "Swiship";
|
|
13
|
+
ShopifyCarrier["Hermes"] = "Hermes";
|
|
14
|
+
// International
|
|
15
|
+
ShopifyCarrier["4PX"] = "4PX";
|
|
16
|
+
ShopifyCarrier["AGS"] = "AGS";
|
|
17
|
+
ShopifyCarrier["Amazon Logistics UK"] = "Amazon Logistics UK";
|
|
18
|
+
ShopifyCarrier["Amazon Logistics US"] = "Amazon Logistics US";
|
|
19
|
+
ShopifyCarrier["An Post"] = "An Post";
|
|
20
|
+
ShopifyCarrier["Anjun Logistics"] = "Anjun Logistics";
|
|
21
|
+
ShopifyCarrier["APC"] = "APC";
|
|
22
|
+
ShopifyCarrier["Asendia USA"] = "Asendia USA";
|
|
23
|
+
ShopifyCarrier["Australia Post"] = "Australia Post";
|
|
24
|
+
ShopifyCarrier["Bonshaw"] = "Bonshaw";
|
|
25
|
+
ShopifyCarrier["BPost"] = "BPost";
|
|
26
|
+
ShopifyCarrier["BPost International"] = "BPost International";
|
|
27
|
+
ShopifyCarrier["Canada Post"] = "Canada Post";
|
|
28
|
+
ShopifyCarrier["Canpar"] = "Canpar";
|
|
29
|
+
ShopifyCarrier["CDL Last Mile"] = "CDL Last Mile";
|
|
30
|
+
ShopifyCarrier["China Post"] = "China Post";
|
|
31
|
+
ShopifyCarrier["Chronopost"] = "Chronopost";
|
|
32
|
+
ShopifyCarrier["Chukou1"] = "Chukou1";
|
|
33
|
+
ShopifyCarrier["Colissimo"] = "Colissimo";
|
|
34
|
+
ShopifyCarrier["Comingle"] = "Comingle";
|
|
35
|
+
ShopifyCarrier["Coordinadora"] = "Coordinadora";
|
|
36
|
+
ShopifyCarrier["Correios"] = "Correios";
|
|
37
|
+
ShopifyCarrier["Correos"] = "Correos";
|
|
38
|
+
ShopifyCarrier["CTT"] = "CTT";
|
|
39
|
+
ShopifyCarrier["CTT Express"] = "CTT Express";
|
|
40
|
+
ShopifyCarrier["Cyprus Post"] = "Cyprus Post";
|
|
41
|
+
ShopifyCarrier["Delnext"] = "Delnext";
|
|
42
|
+
ShopifyCarrier["Deutsche Post"] = "Deutsche Post";
|
|
43
|
+
ShopifyCarrier["DHL eCommerce"] = "DHL eCommerce";
|
|
44
|
+
ShopifyCarrier["DHL eCommerce Asia"] = "DHL eCommerce Asia";
|
|
45
|
+
ShopifyCarrier["DHL Express"] = "DHL Express";
|
|
46
|
+
ShopifyCarrier["DoorDash"] = "DoorDash";
|
|
47
|
+
ShopifyCarrier["DPD"] = "DPD";
|
|
48
|
+
ShopifyCarrier["DPD Local"] = "DPD Local";
|
|
49
|
+
ShopifyCarrier["DPD UK"] = "DPD UK";
|
|
50
|
+
ShopifyCarrier["DTD Express"] = "DTD Express";
|
|
51
|
+
ShopifyCarrier["DX"] = "DX";
|
|
52
|
+
ShopifyCarrier["Eagle"] = "Eagle";
|
|
53
|
+
ShopifyCarrier["Estes"] = "Estes";
|
|
54
|
+
ShopifyCarrier["Evri"] = "Evri";
|
|
55
|
+
ShopifyCarrier["FedEx"] = "FedEx";
|
|
56
|
+
ShopifyCarrier["First Global Logistics"] = "First Global Logistics";
|
|
57
|
+
ShopifyCarrier["First Line"] = "First Line";
|
|
58
|
+
ShopifyCarrier["FSC"] = "FSC";
|
|
59
|
+
ShopifyCarrier["Fulfilla"] = "Fulfilla";
|
|
60
|
+
ShopifyCarrier["GLS DE"] = "GLS DE";
|
|
61
|
+
ShopifyCarrier["Guangdong Weisuyi Information Technology (WSE)"] = "Guangdong Weisuyi Information Technology (WSE)";
|
|
62
|
+
ShopifyCarrier["Heppner Internationale Spedition GmbH & Co."] = "Heppner Internationale Spedition GmbH & Co.";
|
|
63
|
+
ShopifyCarrier["Iceland Post"] = "Iceland Post";
|
|
64
|
+
ShopifyCarrier["IDEX"] = "IDEX";
|
|
65
|
+
ShopifyCarrier["Israel Post"] = "Israel Post";
|
|
66
|
+
ShopifyCarrier["Japan Post (EN)"] = "Japan Post (EN)";
|
|
67
|
+
ShopifyCarrier["Japan Post (JA)"] = "Japan Post (JA)";
|
|
68
|
+
ShopifyCarrier["La Poste"] = "La Poste";
|
|
69
|
+
ShopifyCarrier["Lasership"] = "Lasership";
|
|
70
|
+
ShopifyCarrier["Latvia Post"] = "Latvia Post";
|
|
71
|
+
ShopifyCarrier["Lietuvos Pa\u0161tas"] = "Lietuvos Pa\u0161tas";
|
|
72
|
+
ShopifyCarrier["Logisters"] = "Logisters";
|
|
73
|
+
ShopifyCarrier["Lone Star Overnight"] = "Lone Star Overnight";
|
|
74
|
+
ShopifyCarrier["M3 Logistics"] = "M3 Logistics";
|
|
75
|
+
ShopifyCarrier["Meteor Space"] = "Meteor Space";
|
|
76
|
+
ShopifyCarrier["Mondial Relay"] = "Mondial Relay";
|
|
77
|
+
ShopifyCarrier["New Zealand Post"] = "New Zealand Post";
|
|
78
|
+
ShopifyCarrier["NinjaVan"] = "NinjaVan";
|
|
79
|
+
ShopifyCarrier["North Russia Supply Chain (Shenzhen) Co."] = "North Russia Supply Chain (Shenzhen) Co.";
|
|
80
|
+
ShopifyCarrier["OnTrac"] = "OnTrac";
|
|
81
|
+
ShopifyCarrier["Packeta"] = "Packeta";
|
|
82
|
+
ShopifyCarrier["Pago Logistics"] = "Pago Logistics";
|
|
83
|
+
ShopifyCarrier["Ping An Da Tengfei Express"] = "Ping An Da Tengfei Express";
|
|
84
|
+
ShopifyCarrier["Pitney Bowes"] = "Pitney Bowes";
|
|
85
|
+
ShopifyCarrier["Portal PostNord"] = "Portal PostNord";
|
|
86
|
+
ShopifyCarrier["Poste Italiane"] = "Poste Italiane";
|
|
87
|
+
ShopifyCarrier["PostNL"] = "PostNL";
|
|
88
|
+
ShopifyCarrier["PostNord DK"] = "PostNord DK";
|
|
89
|
+
ShopifyCarrier["PostNord NO"] = "PostNord NO";
|
|
90
|
+
ShopifyCarrier["PostNord SE"] = "PostNord SE";
|
|
91
|
+
ShopifyCarrier["Purolator"] = "Purolator";
|
|
92
|
+
ShopifyCarrier["Qxpress"] = "Qxpress";
|
|
93
|
+
ShopifyCarrier["Qyun Express"] = "Qyun Express";
|
|
94
|
+
ShopifyCarrier["Royal Mail"] = "Royal Mail";
|
|
95
|
+
ShopifyCarrier["Royal Shipments"] = "Royal Shipments";
|
|
96
|
+
ShopifyCarrier["Sagawa (EN)"] = "Sagawa (EN)";
|
|
97
|
+
ShopifyCarrier["Sagawa (JA)"] = "Sagawa (JA)";
|
|
98
|
+
ShopifyCarrier["Sendle"] = "Sendle";
|
|
99
|
+
ShopifyCarrier["SF Express"] = "SF Express";
|
|
100
|
+
ShopifyCarrier["SFC Fulfillment"] = "SFC Fulfillment";
|
|
101
|
+
ShopifyCarrier["SHREE NANDAN COURIER"] = "SHREE NANDAN COURIER";
|
|
102
|
+
ShopifyCarrier["Singapore Post"] = "Singapore Post";
|
|
103
|
+
ShopifyCarrier["Southwest Air Cargo"] = "Southwest Air Cargo";
|
|
104
|
+
ShopifyCarrier["StarTrack"] = "StarTrack";
|
|
105
|
+
ShopifyCarrier["Step Forward Freight"] = "Step Forward Freight";
|
|
106
|
+
ShopifyCarrier["Swiss Post"] = "Swiss Post";
|
|
107
|
+
ShopifyCarrier["TForce Final Mile"] = "TForce Final Mile";
|
|
108
|
+
ShopifyCarrier["Tinghao"] = "Tinghao";
|
|
109
|
+
ShopifyCarrier["TNT"] = "TNT";
|
|
110
|
+
ShopifyCarrier["Toll IPEC"] = "Toll IPEC";
|
|
111
|
+
ShopifyCarrier["United Delivery Service"] = "United Delivery Service";
|
|
112
|
+
ShopifyCarrier["UPS"] = "UPS";
|
|
113
|
+
ShopifyCarrier["USPS"] = "USPS";
|
|
114
|
+
ShopifyCarrier["Venipak"] = "Venipak";
|
|
115
|
+
ShopifyCarrier["We Post"] = "We Post";
|
|
116
|
+
ShopifyCarrier["Whistl"] = "Whistl";
|
|
117
|
+
ShopifyCarrier["Wizmo"] = "Wizmo";
|
|
118
|
+
ShopifyCarrier["WMYC"] = "WMYC";
|
|
119
|
+
ShopifyCarrier["Xpedigo"] = "Xpedigo";
|
|
120
|
+
ShopifyCarrier["XPO Logistics"] = "XPO Logistics";
|
|
121
|
+
ShopifyCarrier["Yamato (EN)"] = "Yamato (EN)";
|
|
122
|
+
ShopifyCarrier["Yamato (JA)"] = "Yamato (JA)";
|
|
123
|
+
ShopifyCarrier["YiFan Express"] = "YiFan Express";
|
|
124
|
+
ShopifyCarrier["YunExpress"] = "YunExpress";
|
|
125
|
+
})(ShopifyCarrier || (exports.ShopifyCarrier = ShopifyCarrier = {}));
|
|
126
|
+
exports.LabelService = zod_1.z
|
|
127
|
+
.literal("GLS Germany")
|
|
128
|
+
.or(zod_1.z.literal("GLS ADE-plus"))
|
|
129
|
+
.or(zod_1.z.literal("DHL"))
|
|
130
|
+
.or(zod_1.z.literal("DHL-2-Mann"))
|
|
131
|
+
.or(zod_1.z.literal("Deutsche Post"))
|
|
132
|
+
.or(zod_1.z.literal("Billbee"))
|
|
133
|
+
.or(zod_1.z.literal("Billbee Amazon MCF"));
|
|
134
|
+
exports.ShippingProvider = zod_1.z
|
|
135
|
+
.object({
|
|
136
|
+
name: zod_1.z.string(),
|
|
137
|
+
creation: zod_1.z.string(),
|
|
138
|
+
modified: zod_1.z.string(),
|
|
139
|
+
modified_by: zod_1.z.string(),
|
|
140
|
+
owner: zod_1.z.string(),
|
|
141
|
+
docstatus: zod_1.z.number(),
|
|
142
|
+
parent: zod_1.z.string().optional().nullable(),
|
|
143
|
+
parentfield: zod_1.z.string().optional().nullable(),
|
|
144
|
+
parenttype: zod_1.z.string().optional().nullable(),
|
|
145
|
+
idx: zod_1.z.number(),
|
|
146
|
+
is_transport_by_freight_forwarding: zod_1.z.number().transform(Boolean),
|
|
147
|
+
is_print_label: zod_1.z.number().transform(Boolean),
|
|
148
|
+
label_service: exports.LabelService,
|
|
149
|
+
dhl_ekp_number: zod_1.z.string().optional().nullable(),
|
|
150
|
+
api_user: zod_1.z.string().optional().nullable(),
|
|
151
|
+
api_password: zod_1.z.string().optional().nullable(),
|
|
152
|
+
api_base_url: zod_1.z.string().optional().nullable(),
|
|
153
|
+
gls_shipper_id: zod_1.z.string().optional().nullable(),
|
|
154
|
+
billbee_shipping_provider_id: zod_1.z.string(),
|
|
155
|
+
product_id_germany: zod_1.z.string(),
|
|
156
|
+
product_id_europe: zod_1.z.string(),
|
|
157
|
+
sender_address: zod_1.z.string(),
|
|
158
|
+
title: zod_1.z.string(),
|
|
159
|
+
shopify_carrier_mapping: zod_1.z
|
|
160
|
+
.nativeEnum(ShopifyCarrier)
|
|
161
|
+
.or(zod_1.z.literal(""))
|
|
162
|
+
.optional()
|
|
163
|
+
.nullable(),
|
|
164
|
+
doctype: zod_1.z.string(),
|
|
165
|
+
})
|
|
166
|
+
.describe("Shipping Provider");
|
|
167
|
+
exports.ShippingProviderFromList = exports.ShippingProvider.omit({
|
|
168
|
+
doctype: true,
|
|
169
|
+
}).describe("Shipping Provider From List");
|
|
170
|
+
exports.ShippingProviderList = zod_1.z
|
|
171
|
+
.preprocess((input) => {
|
|
172
|
+
return (0, lodash_1.isArray)(input) && Array.isArray(input)
|
|
173
|
+
? input.filter((item) => {
|
|
174
|
+
if (!("label_service" in item))
|
|
175
|
+
return false;
|
|
176
|
+
const validated = exports.LabelService.safeParse(item.label_service);
|
|
177
|
+
if (validated.success)
|
|
178
|
+
return true;
|
|
179
|
+
else
|
|
180
|
+
return false;
|
|
181
|
+
})
|
|
182
|
+
: input;
|
|
183
|
+
}, zod_1.z.array(exports.ShippingProviderFromList))
|
|
184
|
+
.describe("Shipping Provider List");
|
|
185
|
+
exports.ShippingProviderCredentials = zod_1.z
|
|
186
|
+
.object({
|
|
187
|
+
api_user: zod_1.z.string().optional().nullable(),
|
|
188
|
+
api_password: zod_1.z.string().optional().nullable(),
|
|
189
|
+
// Billbee Provider used for all providers
|
|
190
|
+
// to link to shipping provider in Billbee Order
|
|
191
|
+
billbee_shipping_provider_id: zod_1.z.string(),
|
|
192
|
+
// GLS Germany only
|
|
193
|
+
gls_shipper_id: zod_1.z.string().optional().nullable(),
|
|
194
|
+
// DHL only
|
|
195
|
+
dhl_ekp_number: zod_1.z.string().optional().nullable(),
|
|
196
|
+
// Billbee only
|
|
197
|
+
product_id_germany: zod_1.z.string().optional().nullable(),
|
|
198
|
+
product_id_europe: zod_1.z.string().optional().nullable(),
|
|
199
|
+
})
|
|
200
|
+
.describe("Shipping Provider Credentials");
|
|
201
|
+
exports.BillbeeShippingProviderCredentials = exports.ShippingProviderCredentials.extend({
|
|
202
|
+
product_id_germany: zod_1.z.string(),
|
|
203
|
+
product_id_europe: zod_1.z.string(),
|
|
204
|
+
}).describe("BillbeeShippingProviderCredentials");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StockDict = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.StockDict = zod_1.z
|
|
6
|
+
.record(zod_1.z.union([zod_1.z.string(), zod_1.z.number()]), zod_1.z.number())
|
|
7
|
+
.describe("StockDict");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const WarehouseCategoryList: z.ZodArray<z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
name?: string;
|
|
6
|
+
}, {
|
|
7
|
+
name?: string;
|
|
8
|
+
}>, "many">;
|
|
9
|
+
export type WarehouseCategoryListType = z.infer<typeof WarehouseCategoryList>;
|
|
10
|
+
export declare const WarehouseCategoryMethodResponse: z.ZodArray<z.ZodObject<{
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
fulfillment_stations: z.ZodArray<z.ZodString, "many">;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
name?: string;
|
|
15
|
+
fulfillment_stations?: string[];
|
|
16
|
+
}, {
|
|
17
|
+
name?: string;
|
|
18
|
+
fulfillment_stations?: string[];
|
|
19
|
+
}>, "many">;
|
|
20
|
+
export type WarehouseCategoryMethodResponseType = z.infer<typeof WarehouseCategoryMethodResponse>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WarehouseCategoryMethodResponse = exports.WarehouseCategoryList = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.WarehouseCategoryList = zod_1.z
|
|
6
|
+
.array(zod_1.z.object({
|
|
7
|
+
name: zod_1.z.string(),
|
|
8
|
+
}))
|
|
9
|
+
.describe("Warehouse Category List");
|
|
10
|
+
exports.WarehouseCategoryMethodResponse = zod_1.z
|
|
11
|
+
.array(zod_1.z.object({
|
|
12
|
+
name: zod_1.z.string(),
|
|
13
|
+
fulfillment_stations: zod_1.z.array(zod_1.z.string()),
|
|
14
|
+
}))
|
|
15
|
+
.describe("Warehouse Category Method Response");
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ERPNextResourceResponse = exports.ERPNextMethodResponse = exports.ERPNextClient = void 0;
|
|
4
|
+
const client_1 = require("./client");
|
|
5
|
+
var client_2 = require("./client");
|
|
6
|
+
Object.defineProperty(exports, "ERPNextClient", { enumerable: true, get: function () { return client_2.ERPNextClient; } });
|
|
7
|
+
var ERPNextResponse_1 = require("./erpnext/model/ERPNextResponse");
|
|
8
|
+
Object.defineProperty(exports, "ERPNextMethodResponse", { enumerable: true, get: function () { return ERPNextResponse_1.ERPNextMethodResponse; } });
|
|
9
|
+
Object.defineProperty(exports, "ERPNextResourceResponse", { enumerable: true, get: function () { return ERPNextResponse_1.ERPNextResourceResponse; } });
|
|
10
|
+
const { erpnext, utils: { decryptFromErpNext }, } = new client_1.ERPNextClient({
|
|
11
|
+
temporalCredentials: {
|
|
12
|
+
temporalHost: "temporal.api.com",
|
|
13
|
+
temporalCert: "temporalCert",
|
|
14
|
+
temporalKey: "temporalKey",
|
|
15
|
+
temporalNamespace: "temporalNamespace",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
decryptFromErpNext("TEST");
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This an es6 port of the library found here:
|
|
3
|
+
* https://github.com/csquared/fernet.js
|
|
4
|
+
*
|
|
5
|
+
* This was ported due to issues with the global module scope and caused issues with rollup.js.
|
|
6
|
+
*/
|
|
7
|
+
import { Buffer } from "buffer";
|
|
8
|
+
import Hex from "crypto-js/enc-hex";
|
|
9
|
+
import Base64 from "crypto-js/enc-base64";
|
|
10
|
+
declare const defaults: Partial<FernetOptions>;
|
|
11
|
+
type TextKey = string | CryptoJS.lib.WordArray;
|
|
12
|
+
/**
|
|
13
|
+
* Makes a Base64 string a url-safe base64 slertring
|
|
14
|
+
* @param {String} string - input string to make url-safe
|
|
15
|
+
* @return {String} a url-safe base64 string
|
|
16
|
+
*/
|
|
17
|
+
declare function urlsafe(string: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* turn bits into number of chars in a hex string
|
|
20
|
+
* @param {Number} bits - input bits to convert to hex
|
|
21
|
+
* @return {Number} number of chars in hex string
|
|
22
|
+
*/
|
|
23
|
+
declare function hexBits(bits: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* convert base64 string to hex string
|
|
26
|
+
* @param {String} string - input base64 string to hex
|
|
27
|
+
* @return {String} a hex string
|
|
28
|
+
*/
|
|
29
|
+
declare function decode64toHex(string: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* convert array to hex string
|
|
32
|
+
* @param {Number[]} array - iv array of integers
|
|
33
|
+
* @return {String} a hex string
|
|
34
|
+
*/
|
|
35
|
+
declare function ArrayToHex(array: number[]): string;
|
|
36
|
+
/**
|
|
37
|
+
* convert Time object or now into WordArray
|
|
38
|
+
* @param {Date} time - input Date object to convert to WordArray
|
|
39
|
+
* @return {Number[]} a word array
|
|
40
|
+
*/
|
|
41
|
+
declare function timeBytes(time: Date | number): CryptoJS.lib.WordArray;
|
|
42
|
+
/**
|
|
43
|
+
* convenience function to create a new instance of a Secret() and sets it as the default for all future tokens
|
|
44
|
+
* @param {String} secret64 - base64 encoded secret string
|
|
45
|
+
* @return {Secret} a Secret
|
|
46
|
+
*/
|
|
47
|
+
declare function setSecret(secret64: string): Secret;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a SHA256 undigested byte string
|
|
50
|
+
* @param {Number[]} signingKey - signing key for encyrption
|
|
51
|
+
* @param {Date} time - time stamp for verification
|
|
52
|
+
* @param {Number[]} iv - IV Array
|
|
53
|
+
* @param {String} cipherText - the cipher text
|
|
54
|
+
* @return {String} an undigested byte string
|
|
55
|
+
*/
|
|
56
|
+
declare function createHmac(signingKey: TextKey, time: CryptoJS.lib.WordArray, iv: CryptoJS.lib.WordArray, cipherText: TextKey): CryptoJS.lib.WordArray;
|
|
57
|
+
/**
|
|
58
|
+
* Instance of a Secret to be used for the token encryption
|
|
59
|
+
*/
|
|
60
|
+
declare class Secret {
|
|
61
|
+
signingKeyHex: string;
|
|
62
|
+
signingKey: CryptoJS.lib.WordArray;
|
|
63
|
+
encryptionKeyHex: string;
|
|
64
|
+
encryptionKey: CryptoJS.lib.WordArray;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a Secret to be used for the token encryption
|
|
67
|
+
* @param {String} secret64 - base64 encoded secret string
|
|
68
|
+
*/
|
|
69
|
+
constructor(secret64: string);
|
|
70
|
+
}
|
|
71
|
+
interface FernetOptions {
|
|
72
|
+
/** time to live in seconds, if specfied a token
|
|
73
|
+
* whose lifespan is longer than TTL will not be decrypted
|
|
74
|
+
* */
|
|
75
|
+
ttl?: number;
|
|
76
|
+
/** the hex version number */
|
|
77
|
+
versionHex?: string;
|
|
78
|
+
/** the fernet Secret */
|
|
79
|
+
secret?: Secret;
|
|
80
|
+
/** message to encrypt */
|
|
81
|
+
message: string;
|
|
82
|
+
/** cipher text to decrypt */
|
|
83
|
+
cipherText?: CryptoJS.lib.WordArray;
|
|
84
|
+
/** token string */
|
|
85
|
+
token?: string;
|
|
86
|
+
/** version of token */
|
|
87
|
+
version?: number;
|
|
88
|
+
/** the IV array */
|
|
89
|
+
iv?: CryptoJS.lib.WordArray | number[];
|
|
90
|
+
/** date string */
|
|
91
|
+
time: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Options for token object to perform encryption
|
|
95
|
+
* @typedef TokenOptions
|
|
96
|
+
* @property {Number} [ttl=60] - time to live in seconds
|
|
97
|
+
* @property {Secret} secret - Secret object to use for encryption/decryption
|
|
98
|
+
* @property {String} message - message to encrypt
|
|
99
|
+
* @property {String} cipherText - cipher text to decrypt
|
|
100
|
+
* @property {String} token - a token string
|
|
101
|
+
* @property {String} [version='80'] - version of the token
|
|
102
|
+
* @property {Number[]} iv - IV Array
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* Token object to perform encryption/decryption
|
|
106
|
+
*/
|
|
107
|
+
declare class Token {
|
|
108
|
+
secret?: Secret;
|
|
109
|
+
ttl?: number;
|
|
110
|
+
message: string;
|
|
111
|
+
/** cipher text to decrypt */
|
|
112
|
+
cipherText?: CryptoJS.lib.WordArray;
|
|
113
|
+
cipherTextHex?: string;
|
|
114
|
+
/** token string */
|
|
115
|
+
token?: string;
|
|
116
|
+
/** version of token */
|
|
117
|
+
version?: string | number;
|
|
118
|
+
/** the IV array */
|
|
119
|
+
optsIV?: CryptoJS.lib.WordArray;
|
|
120
|
+
maxClockSkew: number;
|
|
121
|
+
time: Date | CryptoJS.lib.WordArray;
|
|
122
|
+
encoded: boolean;
|
|
123
|
+
iv?: CryptoJS.lib.WordArray;
|
|
124
|
+
ivHex?: string;
|
|
125
|
+
hmacHex?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Token object to perform encryption/decryption
|
|
128
|
+
* @param {TokenOptions} opts - options for token initialization
|
|
129
|
+
*/
|
|
130
|
+
constructor(opts?: Partial<FernetOptions>);
|
|
131
|
+
/**
|
|
132
|
+
* converts token to string
|
|
133
|
+
* @return {String} to stringified token
|
|
134
|
+
*/
|
|
135
|
+
toString(): string;
|
|
136
|
+
/**
|
|
137
|
+
* Encrypts a message
|
|
138
|
+
* @param {String} message - message to encrypt
|
|
139
|
+
* @return {String} encoded token string
|
|
140
|
+
*/
|
|
141
|
+
encode(message?: string): string;
|
|
142
|
+
/**
|
|
143
|
+
* Decrypts a token
|
|
144
|
+
* @param {String} token - token to decrypt
|
|
145
|
+
* @return {String} decoded message
|
|
146
|
+
*/
|
|
147
|
+
decode(token?: string): string;
|
|
148
|
+
}
|
|
149
|
+
export { defaults, Buffer, Secret, Token, setSecret, ArrayToHex, timeBytes, decode64toHex, createHmac, hexBits, urlsafe, Base64, Hex, };
|
|
150
|
+
export type { TextKey, FernetOptions };
|