@cellaware/utils 5.4.6 → 5.4.8
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/chatwms/client.d.ts +9 -0
- package/dist/chatwms/client.js +21 -0
- package/package.json +1 -1
package/dist/chatwms/client.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export declare const CHATWMS_GENERIC_CLIENT_ID = "chatwms";
|
|
2
2
|
export declare function chatwmsGetClientId(customer: string, warehouse: string): string;
|
|
3
3
|
export declare function chatwmsGetWarehouseFromClientId(clientId: string, customer: string): string;
|
|
4
|
+
export declare function chatwmsGetWarehouse(warehouse: string, organization?: string): string;
|
|
4
5
|
export declare function chatwmsGetOrganizationFromWarehouse(warehouse: string): string | undefined;
|
|
5
6
|
export declare function chatwmsGetOrganizationFromClientId(clientId: string, customer: string): string | undefined;
|
|
7
|
+
export declare function chatwmsExtractWarehouseAndOrganizationFromWarehouse(warehouse: string): {
|
|
8
|
+
warehouse: string;
|
|
9
|
+
organization: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
export declare function chatwmsExtractWarehouseAndOrganizationFromClientId(clientId: string, customer: string): {
|
|
12
|
+
warehouse: string;
|
|
13
|
+
organization: string | undefined;
|
|
14
|
+
};
|
package/dist/chatwms/client.js
CHANGED
|
@@ -6,6 +6,9 @@ export function chatwmsGetWarehouseFromClientId(clientId, customer) {
|
|
|
6
6
|
const prefix = `${customer}_`;
|
|
7
7
|
return clientId.substring(clientId.indexOf(prefix) + prefix.length);
|
|
8
8
|
}
|
|
9
|
+
export function chatwmsGetWarehouse(warehouse, organization) {
|
|
10
|
+
return !!organization ? `${organization}_${warehouse}` : warehouse;
|
|
11
|
+
}
|
|
9
12
|
export function chatwmsGetOrganizationFromWarehouse(warehouse) {
|
|
10
13
|
const lastIdx = warehouse.lastIndexOf('_');
|
|
11
14
|
if (lastIdx === -1) {
|
|
@@ -22,3 +25,21 @@ export function chatwmsGetOrganizationFromWarehouse(warehouse) {
|
|
|
22
25
|
export function chatwmsGetOrganizationFromClientId(clientId, customer) {
|
|
23
26
|
return chatwmsGetOrganizationFromWarehouse(chatwmsGetWarehouseFromClientId(clientId, customer));
|
|
24
27
|
}
|
|
28
|
+
export function chatwmsExtractWarehouseAndOrganizationFromWarehouse(warehouse) {
|
|
29
|
+
const organization = chatwmsGetOrganizationFromWarehouse(warehouse);
|
|
30
|
+
if (!!organization) {
|
|
31
|
+
return {
|
|
32
|
+
warehouse: warehouse.substring(warehouse.lastIndexOf('_') + 1),
|
|
33
|
+
organization
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return {
|
|
38
|
+
warehouse,
|
|
39
|
+
organization: undefined
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function chatwmsExtractWarehouseAndOrganizationFromClientId(clientId, customer) {
|
|
44
|
+
return chatwmsExtractWarehouseAndOrganizationFromWarehouse(chatwmsGetWarehouseFromClientId(clientId, customer));
|
|
45
|
+
}
|