inibase 1.2.17 → 1.2.19

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/index.d.ts CHANGED
@@ -51,7 +51,8 @@ declare global {
51
51
  entries<T extends object>(o: T): Entries<T>;
52
52
  }
53
53
  }
54
- export type ErrorCodes = "GROUP_UNIQUE" | "FIELD_UNIQUE" | "FIELD_REQUIRED" | "NO_SCHEMA" | "TABLE_EMPTY" | "INVALID_ID" | "INVALID_TYPE" | "INVALID_PARAMETERS" | "NO_ENV" | "TABLE_EXISTS" | "TABLE_NOT_EXISTS" | "INVALID_REGEX_MATCH";
54
+ export declare const ERROR_CODES: readonly ["GROUP_UNIQUE", "FIELD_UNIQUE", "FIELD_REQUIRED", "NO_SCHEMA", "TABLE_EMPTY", "INVALID_ID", "INVALID_TYPE", "INVALID_PARAMETERS", "NO_ENV", "TABLE_EXISTS", "TABLE_NOT_EXISTS", "INVALID_REGEX_MATCH"];
55
+ export type ErrorCode = (typeof ERROR_CODES)[number];
55
56
  export type ErrorLang = "en" | "ar" | "fr" | "es";
56
57
  export declare const globalConfig: {
57
58
  [database: string]: {
@@ -71,7 +72,7 @@ export default class Inibase {
71
72
  totalItems: Map<string, number>;
72
73
  constructor(database: string, mainFolder?: string, language?: ErrorLang);
73
74
  private static errorMessages;
74
- createError(name: ErrorCodes, variable?: string | number | (string | number)[]): Error;
75
+ createError(name: ErrorCode, variable?: string | number | (string | number)[]): Error;
75
76
  private getFileExtension;
76
77
  private _schemaToIdsPath;
77
78
  /**
package/dist/index.js CHANGED
@@ -8,6 +8,20 @@ import Inison from "inison";
8
8
  import * as File from "./file.js";
9
9
  import * as Utils from "./utils.js";
10
10
  import * as UtilsServer from "./utils.server.js";
11
+ export const ERROR_CODES = [
12
+ "GROUP_UNIQUE",
13
+ "FIELD_UNIQUE",
14
+ "FIELD_REQUIRED",
15
+ "NO_SCHEMA",
16
+ "TABLE_EMPTY",
17
+ "INVALID_ID",
18
+ "INVALID_TYPE",
19
+ "INVALID_PARAMETERS",
20
+ "NO_ENV",
21
+ "TABLE_EXISTS",
22
+ "TABLE_NOT_EXISTS",
23
+ "INVALID_REGEX_MATCH",
24
+ ];
11
25
  // hide ExperimentalWarning glob()
12
26
  process.removeAllListeners("warning");
13
27
  export const globalConfig = {};
@@ -1294,7 +1308,6 @@ export default class Inibase {
1294
1308
  }
1295
1309
  const LineNumberDataObj = await this.applyCriteria(tableName, options, structuredClone(where));
1296
1310
  if (LineNumberDataObj) {
1297
- this.totalItems.set(`${tableName}-*`, Object.keys(LineNumberDataObj).length);
1298
1311
  if (onlyLinesNumbers)
1299
1312
  return onlyOne
1300
1313
  ? Number(Object.keys(LineNumberDataObj)[0])
@@ -1322,7 +1335,7 @@ export default class Inibase {
1322
1335
  ...(({ columns, ...restOfOptions }) => restOfOptions)(options),
1323
1336
  perPage: Array.isArray(RETURN) ? RETURN.length : 1,
1324
1337
  totalPages: options.perPage < 0
1325
- ? undefined
1338
+ ? 1
1326
1339
  : Math.ceil(greatestTotalItems / options.perPage),
1327
1340
  total: greatestTotalItems,
1328
1341
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",