core-mb 1.1.3 → 1.1.5

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.
@@ -0,0 +1,2 @@
1
+ export * from "./item";
2
+ export * from "./stock";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./item"), exports);
18
+ __exportStar(require("./stock"), exports);
@@ -0,0 +1,15 @@
1
+ export declare enum ProductionOptionEnums {
2
+ STANDARD = 0,
3
+ VARIANT = 1,
4
+ COMPOSITE = 2
5
+ }
6
+ export declare enum ProductSerialTypeEnums {
7
+ SERIAL = 0,
8
+ NON_INVENTORY = 1,
9
+ STANDARD = 2,
10
+ LICENSE = 3
11
+ }
12
+ export declare enum TypeOfProductGenerateSKU {
13
+ MANAUL = 1,
14
+ AUTO = 2
15
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeOfProductGenerateSKU = exports.ProductSerialTypeEnums = exports.ProductionOptionEnums = void 0;
4
+ var ProductionOptionEnums;
5
+ (function (ProductionOptionEnums) {
6
+ ProductionOptionEnums[ProductionOptionEnums["STANDARD"] = 0] = "STANDARD";
7
+ ProductionOptionEnums[ProductionOptionEnums["VARIANT"] = 1] = "VARIANT";
8
+ ProductionOptionEnums[ProductionOptionEnums["COMPOSITE"] = 2] = "COMPOSITE";
9
+ })(ProductionOptionEnums || (exports.ProductionOptionEnums = ProductionOptionEnums = {}));
10
+ var ProductSerialTypeEnums;
11
+ (function (ProductSerialTypeEnums) {
12
+ ProductSerialTypeEnums[ProductSerialTypeEnums["SERIAL"] = 0] = "SERIAL";
13
+ ProductSerialTypeEnums[ProductSerialTypeEnums["NON_INVENTORY"] = 1] = "NON_INVENTORY";
14
+ ProductSerialTypeEnums[ProductSerialTypeEnums["STANDARD"] = 2] = "STANDARD";
15
+ ProductSerialTypeEnums[ProductSerialTypeEnums["LICENSE"] = 3] = "LICENSE";
16
+ })(ProductSerialTypeEnums || (exports.ProductSerialTypeEnums = ProductSerialTypeEnums = {}));
17
+ var TypeOfProductGenerateSKU;
18
+ (function (TypeOfProductGenerateSKU) {
19
+ TypeOfProductGenerateSKU[TypeOfProductGenerateSKU["MANAUL"] = 1] = "MANAUL";
20
+ TypeOfProductGenerateSKU[TypeOfProductGenerateSKU["AUTO"] = 2] = "AUTO";
21
+ })(TypeOfProductGenerateSKU || (exports.TypeOfProductGenerateSKU = TypeOfProductGenerateSKU = {}));
@@ -0,0 +1,32 @@
1
+ /**
2
+ * StockIOTypeEnum
3
+ *
4
+ * | Type | Meaning |
5
+ * | ---- | ------------------------------ |
6
+ * | IN | Stock coming into inventory |
7
+ * | OUT | Stock going out of inventory |
8
+ * | ADJUSTMENT | Manual adjustment of stock |
9
+ */
10
+ export declare enum StockIOType {
11
+ IN = "IN",
12
+ OUT = "OUT",
13
+ ADJUSTMENT = "ADJUSTMENT"
14
+ }
15
+ /**
16
+ * StockIOStatus Enum
17
+ *
18
+ * | Status | Meaning for SME user |
19
+ * | ------- | ------------------------------------- |
20
+ * | DRAFT | Created, not yet applied |
21
+ * | PENDING | Waiting for approval / processing |
22
+ * | APPLIED | Stock updated, effective in inventory |
23
+ */
24
+ export declare enum StockIOStatus {
25
+ DRAFT = 0,// Not processed
26
+ PENDING = 1,// Waiting / in progress
27
+ APPLIED = 2
28
+ }
29
+ /**
30
+ * Human-readable labels for status
31
+ */
32
+ export declare const StockIOStatusLabels: Record<StockIOStatus, string>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StockIOStatusLabels = exports.StockIOStatus = exports.StockIOType = void 0;
4
+ /**
5
+ * StockIOTypeEnum
6
+ *
7
+ * | Type | Meaning |
8
+ * | ---- | ------------------------------ |
9
+ * | IN | Stock coming into inventory |
10
+ * | OUT | Stock going out of inventory |
11
+ * | ADJUSTMENT | Manual adjustment of stock |
12
+ */
13
+ var StockIOType;
14
+ (function (StockIOType) {
15
+ StockIOType["IN"] = "IN";
16
+ StockIOType["OUT"] = "OUT";
17
+ StockIOType["ADJUSTMENT"] = "ADJUSTMENT";
18
+ })(StockIOType || (exports.StockIOType = StockIOType = {}));
19
+ /**
20
+ * StockIOStatus Enum
21
+ *
22
+ * | Status | Meaning for SME user |
23
+ * | ------- | ------------------------------------- |
24
+ * | DRAFT | Created, not yet applied |
25
+ * | PENDING | Waiting for approval / processing |
26
+ * | APPLIED | Stock updated, effective in inventory |
27
+ */
28
+ var StockIOStatus;
29
+ (function (StockIOStatus) {
30
+ StockIOStatus[StockIOStatus["DRAFT"] = 0] = "DRAFT";
31
+ StockIOStatus[StockIOStatus["PENDING"] = 1] = "PENDING";
32
+ StockIOStatus[StockIOStatus["APPLIED"] = 2] = "APPLIED";
33
+ })(StockIOStatus || (exports.StockIOStatus = StockIOStatus = {}));
34
+ /**
35
+ * Human-readable labels for status
36
+ */
37
+ exports.StockIOStatusLabels = {
38
+ [StockIOStatus.DRAFT]: "Not Processed",
39
+ [StockIOStatus.PENDING]: "Processing",
40
+ [StockIOStatus.APPLIED]: "Stock Updated",
41
+ };
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from "class-validator";
6
6
  export * from "./transformer.helper";
7
7
  export * from './logging.helper';
8
8
  export * from './object.helper';
9
+ export * from "./enums";
package/dist/index.js CHANGED
@@ -22,3 +22,4 @@ __exportStar(require("class-validator"), exports);
22
22
  __exportStar(require("./transformer.helper"), exports);
23
23
  __exportStar(require("./logging.helper"), exports);
24
24
  __exportStar(require("./object.helper"), exports);
25
+ __exportStar(require("./enums"), exports);
@@ -1,2 +1,2 @@
1
- declare const logger: import("winston").Logger;
1
+ declare let logger: any;
2
2
  export { logger };
@@ -7,29 +7,38 @@ function getDate() {
7
7
  const formatted = today.toISOString().slice(0, 10);
8
8
  return formatted;
9
9
  }
10
- const logger = (0, winston_1.createLogger)({
11
- level: "info",
12
- format: winston_1.format.combine(winston_1.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), winston_1.format.printf(({ level, message, timestamp, ...meta }) => {
13
- return `${timestamp} [${level.toUpperCase()}]: ${message} ${Object.keys(meta).length ? JSON.stringify(meta) : ""}`;
14
- })),
15
- transports: [
16
- // Console output
17
- new winston_1.transports.Console(),
18
- // File for info
19
- new winston_1.transports.File({
20
- filename: `logs/info-${getDate()}.log`,
21
- level: "info",
22
- }),
23
- // File for warnings
24
- new winston_1.transports.File({
25
- filename: `logs/warning-${getDate()}.log`,
26
- level: "warn",
27
- }),
28
- // File for errors
29
- new winston_1.transports.File({
30
- filename: `logs/error-${getDate()}.log`,
31
- level: "error",
32
- }),
33
- ],
34
- });
35
- exports.logger = logger;
10
+ let logger;
11
+ if (typeof window === 'undefined') {
12
+ exports.logger = logger = (0, winston_1.createLogger)({
13
+ level: "info",
14
+ format: winston_1.format.combine(winston_1.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), winston_1.format.printf(({ level, message, timestamp, ...meta }) => {
15
+ return `${timestamp} [${level.toUpperCase()}]: ${message} ${Object.keys(meta).length ? JSON.stringify(meta) : ""}`;
16
+ })),
17
+ transports: [
18
+ // Console output
19
+ new winston_1.transports.Console(),
20
+ // File for info
21
+ new winston_1.transports.File({
22
+ filename: `logs/info-${getDate()}.log`,
23
+ level: "info",
24
+ }),
25
+ // File for warnings
26
+ new winston_1.transports.File({
27
+ filename: `logs/warning-${getDate()}.log`,
28
+ level: "warn",
29
+ }),
30
+ // File for errors
31
+ new winston_1.transports.File({
32
+ filename: `logs/error-${getDate()}.log`,
33
+ level: "error",
34
+ }),
35
+ ],
36
+ });
37
+ }
38
+ else {
39
+ exports.logger = logger = {
40
+ info: console.log,
41
+ error: console.error,
42
+ warn: console.warn,
43
+ };
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-mb",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Core utility functions for the MB ecosystem in TypeScript",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,6 +24,10 @@
24
24
  "type": "git",
25
25
  "url": "git+https://github.com/marcojourney/core-mb.git"
26
26
  },
27
+ "exports": {
28
+ "./enums": "./dist/enums/index.js",
29
+ ".": "./dist/index.js"
30
+ },
27
31
  "devDependencies": {
28
32
  "@types/jest": "^30.0.0",
29
33
  "@types/node": "^20.19.11",
@@ -0,0 +1,2 @@
1
+ export * from "./item"
2
+ export * from "./stock";
@@ -0,0 +1,17 @@
1
+ export enum ProductionOptionEnums {
2
+ STANDARD = 0,
3
+ VARIANT = 1,
4
+ COMPOSITE = 2,
5
+ }
6
+
7
+ export enum ProductSerialTypeEnums {
8
+ SERIAL = 0,
9
+ NON_INVENTORY = 1,
10
+ STANDARD = 2,
11
+ LICENSE = 3,
12
+ }
13
+
14
+ export enum TypeOfProductGenerateSKU {
15
+ MANAUL = 1,
16
+ AUTO = 2,
17
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * StockIOTypeEnum
3
+ *
4
+ * | Type | Meaning |
5
+ * | ---- | ------------------------------ |
6
+ * | IN | Stock coming into inventory |
7
+ * | OUT | Stock going out of inventory |
8
+ * | ADJUSTMENT | Manual adjustment of stock |
9
+ */
10
+ export enum StockIOType {
11
+ IN = "IN",
12
+ OUT = "OUT",
13
+ ADJUSTMENT = "ADJUSTMENT",
14
+ }
15
+
16
+ /**
17
+ * StockIOStatus Enum
18
+ *
19
+ * | Status | Meaning for SME user |
20
+ * | ------- | ------------------------------------- |
21
+ * | DRAFT | Created, not yet applied |
22
+ * | PENDING | Waiting for approval / processing |
23
+ * | APPLIED | Stock updated, effective in inventory |
24
+ */
25
+ export enum StockIOStatus {
26
+ DRAFT = 0, // Not processed
27
+ PENDING = 1, // Waiting / in progress
28
+ APPLIED = 2, // Stock updated
29
+ }
30
+
31
+ /**
32
+ * Human-readable labels for status
33
+ */
34
+ export const StockIOStatusLabels: Record<StockIOStatus, string> = {
35
+ [StockIOStatus.DRAFT]: "Not Processed",
36
+ [StockIOStatus.PENDING]: "Processing",
37
+ [StockIOStatus.APPLIED]: "Stock Updated",
38
+ };
package/src/index.ts CHANGED
@@ -5,4 +5,5 @@ export * from "./validation.helper"
5
5
  export * from "class-validator"
6
6
  export * from "./transformer.helper";
7
7
  export * from './logging.helper';
8
- export * from './object.helper';
8
+ export * from './object.helper';
9
+ export * from "./enums"
@@ -6,38 +6,48 @@ function getDate() {
6
6
  return formatted;
7
7
  }
8
8
 
9
- const logger = createLogger({
10
- level: "info",
11
- format: format.combine(
12
- format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
13
- format.printf(({ level, message, timestamp, ...meta }) => {
14
- return `${timestamp} [${level.toUpperCase()}]: ${message} ${
15
- Object.keys(meta).length ? JSON.stringify(meta) : ""
16
- }`;
17
- })
18
- ),
19
- transports: [
20
- // Console output
21
- new transports.Console(),
9
+ let logger;
22
10
 
23
- // File for info
24
- new transports.File({
25
- filename: `logs/info-${getDate()}.log`,
26
- level: "info",
27
- }),
11
+ if (typeof window === 'undefined') {
12
+ logger = createLogger({
13
+ level: "info",
14
+ format: format.combine(
15
+ format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
16
+ format.printf(({ level, message, timestamp, ...meta }) => {
17
+ return `${timestamp} [${level.toUpperCase()}]: ${message} ${
18
+ Object.keys(meta).length ? JSON.stringify(meta) : ""
19
+ }`;
20
+ })
21
+ ),
22
+ transports: [
23
+ // Console output
24
+ new transports.Console(),
28
25
 
29
- // File for warnings
30
- new transports.File({
31
- filename: `logs/warning-${getDate()}.log`,
32
- level: "warn",
33
- }),
26
+ // File for info
27
+ new transports.File({
28
+ filename: `logs/info-${getDate()}.log`,
29
+ level: "info",
30
+ }),
34
31
 
35
- // File for errors
36
- new transports.File({
37
- filename: `logs/error-${getDate()}.log`,
38
- level: "error",
39
- }),
40
- ],
41
- });
32
+ // File for warnings
33
+ new transports.File({
34
+ filename: `logs/warning-${getDate()}.log`,
35
+ level: "warn",
36
+ }),
37
+
38
+ // File for errors
39
+ new transports.File({
40
+ filename: `logs/error-${getDate()}.log`,
41
+ level: "error",
42
+ }),
43
+ ],
44
+ });
45
+ } else {
46
+ logger = {
47
+ info: console.log,
48
+ error: console.error,
49
+ warn: console.warn,
50
+ };
51
+ }
42
52
 
43
53
  export { logger };