@sdflc/backend-helpers 1.0.111 → 1.0.113

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.
Files changed (206) hide show
  1. package/README.md +1422 -146
  2. package/build/BaseController.d.ts +20 -0
  3. package/build/BaseController.js +64 -0
  4. package/build/BaseCore.d.ts +470 -33
  5. package/build/BaseCore.js +613 -126
  6. package/build/BaseExternalApiGateway.d.ts +16 -0
  7. package/build/BaseExternalApiGateway.js +54 -0
  8. package/build/BaseGateway.d.ts +455 -17
  9. package/build/BaseGateway.js +502 -56
  10. package/build/BaseRestApiCrudController.d.ts +37 -0
  11. package/build/BaseRestApiCrudController.js +134 -0
  12. package/build/DataCache.d.ts +116 -5
  13. package/build/DataCache.js +144 -22
  14. package/build/Database.d.ts +165 -4
  15. package/build/Database.js +224 -51
  16. package/build/DbMigratorAndSeeder.d.ts +127 -26
  17. package/build/DbMigratorAndSeeder.js +180 -69
  18. package/build/RedisDataLoader.d.ts +144 -21
  19. package/build/RedisDataLoader.js +178 -49
  20. package/build/apiContext.d.ts +0 -8
  21. package/build/apiContext.js +12 -27
  22. package/build/checkItHelpers.d.ts +32 -0
  23. package/build/checkItHelpers.js +73 -7
  24. package/build/commonValidators.d.ts +107 -16
  25. package/build/commonValidators.js +211 -106
  26. package/build/configBuilder.d.ts +23 -0
  27. package/build/configBuilder.js +73 -0
  28. package/build/constants.d.ts +134 -17
  29. package/build/constants.js +95 -15
  30. package/build/dbHelpers.d.ts +89 -29
  31. package/build/dbHelpers.js +175 -86
  32. package/build/dbSeeder.d.ts +10 -1
  33. package/build/dbSeeder.js +80 -15
  34. package/build/dbTableHelpers.d.ts +122 -5
  35. package/build/dbTableHelpers.js +151 -13
  36. package/build/downloadHelpers.d.ts +24 -1
  37. package/build/downloadHelpers.js +51 -21
  38. package/build/esm/BaseController.d.ts +20 -0
  39. package/build/esm/BaseController.js +58 -0
  40. package/build/esm/BaseCore.d.ts +470 -33
  41. package/build/esm/BaseCore.js +615 -128
  42. package/build/esm/BaseExternalApiGateway.d.ts +16 -0
  43. package/build/esm/BaseExternalApiGateway.js +48 -0
  44. package/build/esm/BaseGateway.d.ts +455 -17
  45. package/build/esm/BaseGateway.js +503 -57
  46. package/build/esm/BaseRestApiCrudController.d.ts +37 -0
  47. package/build/esm/BaseRestApiCrudController.js +131 -0
  48. package/build/esm/DataCache.d.ts +116 -5
  49. package/build/esm/DataCache.js +142 -20
  50. package/build/esm/Database.d.ts +165 -4
  51. package/build/esm/Database.js +224 -51
  52. package/build/esm/DbMigratorAndSeeder.d.ts +127 -26
  53. package/build/esm/DbMigratorAndSeeder.js +184 -71
  54. package/build/esm/RedisDataLoader.d.ts +144 -21
  55. package/build/esm/RedisDataLoader.js +179 -50
  56. package/build/esm/apiContext.d.ts +0 -8
  57. package/build/esm/apiContext.js +12 -27
  58. package/build/esm/checkItHelpers.d.ts +32 -0
  59. package/build/esm/checkItHelpers.js +73 -7
  60. package/build/esm/commonValidators.d.ts +107 -16
  61. package/build/esm/commonValidators.js +209 -105
  62. package/build/esm/configBuilder.d.ts +23 -0
  63. package/build/esm/configBuilder.js +69 -0
  64. package/build/esm/constants.d.ts +134 -17
  65. package/build/esm/constants.js +94 -14
  66. package/build/esm/dbHelpers.d.ts +89 -29
  67. package/build/esm/dbHelpers.js +171 -81
  68. package/build/esm/dbSeeder.d.ts +10 -1
  69. package/build/esm/dbSeeder.js +81 -16
  70. package/build/esm/dbTableHelpers.d.ts +122 -5
  71. package/build/esm/dbTableHelpers.js +152 -14
  72. package/build/esm/downloadHelpers.d.ts +24 -1
  73. package/build/esm/downloadHelpers.js +51 -21
  74. package/build/esm/index.d.ts +5 -2
  75. package/build/esm/index.js +5 -2
  76. package/build/esm/interfaces/ApiContext.d.ts +7 -3
  77. package/build/esm/interfaces/ApiContextInterface.d.ts +1 -1
  78. package/build/esm/interfaces/BaseControllerPropsInterface.d.ts +5 -0
  79. package/build/esm/interfaces/BaseControllerPropsInterface.js +1 -0
  80. package/build/esm/interfaces/BaseCoreDoAuthOnActionInterface.d.ts +1 -0
  81. package/build/esm/interfaces/BaseCoreDoingWhatInterface.d.ts +11 -11
  82. package/build/esm/interfaces/BaseCorePropsInterface.d.ts +87 -9
  83. package/build/esm/interfaces/BaseCorePropsInterface.js +1 -0
  84. package/build/esm/interfaces/BaseExternalApiGatewayPropsInterface.d.ts +19 -0
  85. package/build/esm/interfaces/BaseExternalApiGatewayPropsInterface.js +2 -0
  86. package/build/esm/interfaces/BaseGatewayPropsInterface.d.ts +78 -3
  87. package/build/esm/interfaces/BaseGatewayPropsInterface.js +1 -0
  88. package/build/esm/interfaces/BaseRestApiCrudControllerPropsInterface.d.ts +28 -0
  89. package/build/esm/interfaces/BaseRestApiCrudControllerPropsInterface.js +2 -0
  90. package/build/esm/interfaces/BuildConfigOptions.d.ts +18 -0
  91. package/build/esm/interfaces/BuildConfigOptions.js +1 -0
  92. package/build/esm/interfaces/BuildListQueryArgsInterface.d.ts +22 -4
  93. package/build/esm/interfaces/BuildListQueryArgsInterface.js +1 -0
  94. package/build/esm/interfaces/CacheInterface.d.ts +18 -1
  95. package/build/esm/interfaces/CacheInterface.js +1 -0
  96. package/build/esm/interfaces/CoreActionInterface.d.ts +20 -0
  97. package/build/esm/interfaces/CreateUserTokenArgs.d.ts +38 -4
  98. package/build/esm/interfaces/CreateUserTokenArgs.js +1 -0
  99. package/build/esm/interfaces/DataCachePropsInterface.d.ts +21 -0
  100. package/build/esm/interfaces/DataCachePropsInterface.js +2 -0
  101. package/build/esm/interfaces/DatabaseOptions.d.ts +24 -10
  102. package/build/esm/interfaces/DatabaseOptions.js +1 -0
  103. package/build/esm/interfaces/DatabaseReadInterface.d.ts +58 -3
  104. package/build/esm/interfaces/DatabaseReadInterface.js +1 -0
  105. package/build/esm/interfaces/DbFieldAddDefaultInterface.d.ts +35 -4
  106. package/build/esm/interfaces/DbFieldAddDefaultInterface.js +1 -0
  107. package/build/esm/interfaces/DownloadFileArgs.d.ts +21 -2
  108. package/build/esm/interfaces/ExtractCredentialsArgs.d.ts +15 -4
  109. package/build/esm/interfaces/ExtractCredentialsArgs.js +1 -0
  110. package/build/esm/interfaces/ListArgsInterface.d.ts +18 -0
  111. package/build/esm/interfaces/ListArgsInterface.js +1 -0
  112. package/build/esm/interfaces/LoaderInterface.d.ts +36 -1
  113. package/build/esm/interfaces/LoaderInterface.js +1 -0
  114. package/build/esm/interfaces/UserTokenParams.d.ts +23 -5
  115. package/build/esm/interfaces/UserTokenParams.js +1 -0
  116. package/build/esm/interfaces/VerifyUserTokenArgs.d.ts +42 -2
  117. package/build/esm/interfaces/VerifyUserTokenArgs.js +1 -0
  118. package/build/esm/interfaces/index.d.ts +4 -0
  119. package/build/esm/interfaces/index.js +4 -0
  120. package/build/esm/knexConfigBuilder.d.ts +25 -0
  121. package/build/esm/knexConfigBuilder.js +100 -36
  122. package/build/esm/parseIds.d.ts +6 -0
  123. package/build/esm/parseIds.js +13 -0
  124. package/build/esm/passwordHelpers.d.ts +22 -0
  125. package/build/esm/passwordHelpers.js +40 -8
  126. package/build/esm/redisClient.d.ts +57 -4
  127. package/build/esm/redisClient.js +40 -54
  128. package/build/esm/resolveClientIp.d.ts +15 -0
  129. package/build/esm/resolveClientIp.js +34 -0
  130. package/build/esm/resolversHelpers.d.ts +21 -1
  131. package/build/esm/resolversHelpers.js +48 -26
  132. package/build/esm/userToken.d.ts +50 -1
  133. package/build/esm/userToken.js +85 -20
  134. package/build/esm/utils.d.ts +20 -0
  135. package/build/esm/utils.js +23 -1
  136. package/build/index.d.ts +5 -2
  137. package/build/index.js +5 -2
  138. package/build/interfaces/ApiContext.d.ts +7 -3
  139. package/build/interfaces/ApiContextInterface.d.ts +1 -1
  140. package/build/interfaces/BaseControllerPropsInterface.d.ts +5 -0
  141. package/build/interfaces/BaseControllerPropsInterface.js +2 -0
  142. package/build/interfaces/BaseCoreDoAuthOnActionInterface.d.ts +1 -0
  143. package/build/interfaces/BaseCoreDoingWhatInterface.d.ts +11 -11
  144. package/build/interfaces/BaseCorePropsInterface.d.ts +87 -9
  145. package/build/interfaces/BaseCorePropsInterface.js +1 -0
  146. package/build/interfaces/BaseExternalApiGatewayPropsInterface.d.ts +19 -0
  147. package/build/interfaces/BaseExternalApiGatewayPropsInterface.js +3 -0
  148. package/build/interfaces/BaseGatewayPropsInterface.d.ts +78 -3
  149. package/build/interfaces/BaseGatewayPropsInterface.js +1 -0
  150. package/build/interfaces/BaseRestApiCrudControllerPropsInterface.d.ts +28 -0
  151. package/build/interfaces/BaseRestApiCrudControllerPropsInterface.js +3 -0
  152. package/build/interfaces/BuildConfigOptions.d.ts +18 -0
  153. package/build/interfaces/BuildConfigOptions.js +1 -0
  154. package/build/interfaces/BuildListQueryArgsInterface.d.ts +22 -4
  155. package/build/interfaces/BuildListQueryArgsInterface.js +1 -0
  156. package/build/interfaces/CacheInterface.d.ts +18 -1
  157. package/build/interfaces/CacheInterface.js +1 -0
  158. package/build/interfaces/CoreActionInterface.d.ts +20 -0
  159. package/build/interfaces/CreateUserTokenArgs.d.ts +38 -4
  160. package/build/interfaces/CreateUserTokenArgs.js +1 -0
  161. package/build/interfaces/DataCachePropsInterface.d.ts +21 -0
  162. package/build/interfaces/DataCachePropsInterface.js +3 -0
  163. package/build/interfaces/DatabaseOptions.d.ts +24 -10
  164. package/build/interfaces/DatabaseOptions.js +1 -0
  165. package/build/interfaces/DatabaseReadInterface.d.ts +58 -3
  166. package/build/interfaces/DatabaseReadInterface.js +1 -0
  167. package/build/interfaces/DbFieldAddDefaultInterface.d.ts +35 -4
  168. package/build/interfaces/DbFieldAddDefaultInterface.js +1 -0
  169. package/build/interfaces/DownloadFileArgs.d.ts +21 -2
  170. package/build/interfaces/ExtractCredentialsArgs.d.ts +15 -4
  171. package/build/interfaces/ExtractCredentialsArgs.js +1 -0
  172. package/build/interfaces/ListArgsInterface.d.ts +18 -0
  173. package/build/interfaces/ListArgsInterface.js +1 -0
  174. package/build/interfaces/LoaderInterface.d.ts +36 -1
  175. package/build/interfaces/LoaderInterface.js +1 -0
  176. package/build/interfaces/UserTokenParams.d.ts +23 -5
  177. package/build/interfaces/UserTokenParams.js +1 -0
  178. package/build/interfaces/VerifyUserTokenArgs.d.ts +42 -2
  179. package/build/interfaces/VerifyUserTokenArgs.js +1 -0
  180. package/build/interfaces/index.d.ts +4 -0
  181. package/build/interfaces/index.js +4 -0
  182. package/build/knexConfigBuilder.d.ts +25 -0
  183. package/build/knexConfigBuilder.js +99 -35
  184. package/build/parseIds.d.ts +6 -0
  185. package/build/parseIds.js +17 -0
  186. package/build/passwordHelpers.d.ts +22 -0
  187. package/build/passwordHelpers.js +40 -8
  188. package/build/redisClient.d.ts +57 -4
  189. package/build/redisClient.js +40 -54
  190. package/build/resolveClientIp.d.ts +15 -0
  191. package/build/resolveClientIp.js +38 -0
  192. package/build/resolversHelpers.d.ts +21 -1
  193. package/build/resolversHelpers.js +48 -26
  194. package/build/userToken.d.ts +50 -1
  195. package/build/userToken.js +85 -20
  196. package/build/utils.d.ts +20 -0
  197. package/build/utils.js +23 -1
  198. package/package.json +19 -18
  199. package/build/baseController.d.ts +0 -17
  200. package/build/baseController.js +0 -63
  201. package/build/configBulder.d.ts +0 -2
  202. package/build/configBulder.js +0 -36
  203. package/build/esm/baseController.d.ts +0 -17
  204. package/build/esm/baseController.js +0 -57
  205. package/build/esm/configBulder.d.ts +0 -2
  206. package/build/esm/configBulder.js +0 -32
@@ -1,3 +1,35 @@
1
1
  import { OpResult } from '@sdflc/api-helpers';
2
+ /**
3
+ * Validates each item in an array using a checkit-style validator and
4
+ * accumulates all field errors into a single OpResult.
5
+ *
6
+ * Returns the OpResult immediately with a top-level error if `arr` is not
7
+ * an array. Otherwise runs `validator.validateSync(item)` on each element
8
+ * and collects any field-level errors, prefixed with the item's index.
9
+ *
10
+ * Error key format: `[prefix][idx].fieldName`
11
+ * e.g. for prefix "items" and index 2: "items[2].email"
12
+ *
13
+ * Supports both single-message errors (`{ message }`) and multi-rule
14
+ * failures (`{ errors: [{ message }, ...] }`) from the checkit library,
15
+ * consistent with the handling in BaseCore.validationFailure().
16
+ *
17
+ * @param arr The array to validate
18
+ * @param validator A checkit-style validator with a `validateSync` method
19
+ * @param prefix Optional key prefix for error paths (e.g. "items", "params")
20
+ */
2
21
  export declare const checkArray: (arr: any, validator: any, prefix?: string) => OpResult;
22
+ /**
23
+ * Converts a checkit validation error object into a VALIDATION_FAILED OpResult.
24
+ *
25
+ * Iterates `checkItResult.errors` and adds each field's error message(s)
26
+ * to the result. Supports both single-message errors (`{ message }`) and
27
+ * multi-rule failures (`{ errors: [{ message }, ...] }`) from the checkit
28
+ * library, consistent with BaseCore.validationFailure().
29
+ *
30
+ * Returns an empty VALIDATION_FAILED result if `checkItResult` is null,
31
+ * undefined, or has no errors, rather than throwing.
32
+ *
33
+ * @param checkItResult A checkit validation error object
34
+ */
3
35
  export declare const createErrorOnCheckError: (checkItResult: any) => OpResult;
@@ -1,23 +1,89 @@
1
+ // ./src/checkItHelpers.ts
1
2
  import { OpResult, OP_RESULT_CODES } from '@sdflc/api-helpers';
3
+ /**
4
+ * Validates each item in an array using a checkit-style validator and
5
+ * accumulates all field errors into a single OpResult.
6
+ *
7
+ * Returns the OpResult immediately with a top-level error if `arr` is not
8
+ * an array. Otherwise runs `validator.validateSync(item)` on each element
9
+ * and collects any field-level errors, prefixed with the item's index.
10
+ *
11
+ * Error key format: `[prefix][idx].fieldName`
12
+ * e.g. for prefix "items" and index 2: "items[2].email"
13
+ *
14
+ * Supports both single-message errors (`{ message }`) and multi-rule
15
+ * failures (`{ errors: [{ message }, ...] }`) from the checkit library,
16
+ * consistent with the handling in BaseCore.validationFailure().
17
+ *
18
+ * @param arr The array to validate
19
+ * @param validator A checkit-style validator with a `validateSync` method
20
+ * @param prefix Optional key prefix for error paths (e.g. "items", "params")
21
+ */
2
22
  export const checkArray = (arr, validator, prefix) => {
3
23
  const result = new OpResult();
4
24
  if (!Array.isArray(arr)) {
5
- return result.addError(prefix || '', 'The value should be an array');
25
+ result.addError(prefix || '', 'The value should be an array');
26
+ return result;
6
27
  }
7
28
  arr.forEach((item, idx) => {
8
- const [itemResult] = validator.validateSync(item);
9
- if (itemResult) {
10
- Object.keys(itemResult.errors).forEach((key) => {
11
- result.addError(`${prefix || ''}[${idx}].${key}`, itemResult.errors[key].message);
12
- });
29
+ try {
30
+ const [itemResult] = validator.validateSync(item);
31
+ if (itemResult?.errors) {
32
+ Object.keys(itemResult.errors).forEach((key) => {
33
+ const fieldError = itemResult.errors[key];
34
+ const keyPath = `${prefix || ''}[${idx}].${key}`;
35
+ // Support both multi-rule failures ({ errors: [...] }) and
36
+ // single-message errors ({ message }) from the checkit library,
37
+ // consistent with BaseCore.validationFailure()
38
+ if (Array.isArray(fieldError.errors)) {
39
+ fieldError.errors.forEach((err) => {
40
+ result.addError(keyPath, err.message);
41
+ });
42
+ }
43
+ else {
44
+ result.addError(keyPath, fieldError.message);
45
+ }
46
+ });
47
+ }
48
+ }
49
+ catch (ex) {
50
+ // If the validator itself throws, add a descriptive error for that
51
+ // index rather than crashing the whole validation pass
52
+ result.addError(`${prefix || ''}[${idx}]`, `Validation failed unexpectedly: ${ex?.message ?? String(ex)}`);
13
53
  }
14
54
  });
15
55
  return result;
16
56
  };
57
+ /**
58
+ * Converts a checkit validation error object into a VALIDATION_FAILED OpResult.
59
+ *
60
+ * Iterates `checkItResult.errors` and adds each field's error message(s)
61
+ * to the result. Supports both single-message errors (`{ message }`) and
62
+ * multi-rule failures (`{ errors: [{ message }, ...] }`) from the checkit
63
+ * library, consistent with BaseCore.validationFailure().
64
+ *
65
+ * Returns an empty VALIDATION_FAILED result if `checkItResult` is null,
66
+ * undefined, or has no errors, rather than throwing.
67
+ *
68
+ * @param checkItResult A checkit validation error object
69
+ */
17
70
  export const createErrorOnCheckError = (checkItResult) => {
18
71
  const result = new OpResult({ code: OP_RESULT_CODES.VALIDATION_FAILED });
72
+ if (!checkItResult?.errors) {
73
+ return result;
74
+ }
19
75
  Object.keys(checkItResult.errors).forEach((key) => {
20
- result.addError(key, checkItResult.errors[key].message);
76
+ const fieldError = checkItResult.errors[key];
77
+ // Support both multi-rule failures ({ errors: [...] }) and
78
+ // single-message errors ({ message }) from the checkit library
79
+ if (Array.isArray(fieldError.errors)) {
80
+ fieldError.errors.forEach((err) => {
81
+ result.addError(key, err.message);
82
+ });
83
+ }
84
+ else {
85
+ result.addError(key, fieldError.message);
86
+ }
21
87
  });
22
88
  return result;
23
89
  };
@@ -1,18 +1,109 @@
1
1
  import { OpResult } from '@sdflc/api-helpers';
2
2
  import { BaseCoreActionsInterface, CommonValidatorArgs } from './interfaces';
3
- export declare const shouldHaveParams: (args: any) => boolean[] | OpResult[];
4
- export declare const shouldHaveId: (id: any) => boolean[] | OpResult[];
5
- export declare const validateSingleIntId: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
6
- export declare const validateSingleUuidId: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
7
- export declare const validateSingleTextId: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
8
- export declare const validateMultipleIntIds: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
9
- export declare const validateMultipleUuidIds: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
10
- export declare const validateMultipleTextIds: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
11
- export declare const validateList: ({ rules }: CommonValidatorArgs) => (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
12
- export declare const validateGet: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
13
- export declare const validateRemove: (args: any, opt: BaseCoreActionsInterface) => Promise<{}[] | {}[]>;
14
- export declare const validateGetMany: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
15
- export declare const validateRemoveMany: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
16
- export declare const validateCreate: ({ rules }: CommonValidatorArgs) => (args: any, opt: BaseCoreActionsInterface) => Promise<{}[] | {}[]>;
17
- export declare const validateUpdate: ({ rules }: CommonValidatorArgs) => (args: any, opt: BaseCoreActionsInterface) => Promise<{}[] | {}[]>;
18
- export declare const validateSet: ({ rules }: CommonValidatorArgs) => (args: any, opt: BaseCoreActionsInterface) => Promise<{}[] | {}[]>;
3
+ /**
4
+ * Guards that `args` is a non-empty plain object.
5
+ * Returns `[result]` where result is a failed OpResult if the check fails,
6
+ * or `[true]` if it passes.
7
+ *
8
+ * Fix: added explicit object type check before Object.keys() to correctly
9
+ * reject non-objects (null, numbers, strings) rather than treating them
10
+ * as empty objects.
11
+ */
12
+ export declare const shouldHaveParams: (args: any) => [OpResult | true];
13
+ /**
14
+ * Guards that `id` is a non-null, non-empty value.
15
+ * Returns `[result]` where result is a failed OpResult if the check fails,
16
+ * or `[true]` if it passes.
17
+ *
18
+ * Fix: replaced falsy check `!id` with explicit null/empty-string check
19
+ * so that `id = 0` (a valid integer id) is not incorrectly rejected.
20
+ */
21
+ export declare const shouldHaveId: (id: any) => [OpResult | true];
22
+ /**
23
+ * Validates that `args.id` is a present integer.
24
+ */
25
+ export declare const validateSingleIntId: (args: any, _opt: BaseCoreActionsInterface) => Promise<any[]>;
26
+ /**
27
+ * Validates that `args.id` is a present UUID v4.
28
+ */
29
+ export declare const validateSingleUuidId: (args: any, _opt: BaseCoreActionsInterface) => Promise<any[]>;
30
+ /**
31
+ * Validates that `args.id` is a present non-empty string.
32
+ */
33
+ export declare const validateSingleTextId: (args: any, _opt: BaseCoreActionsInterface) => Promise<any[]>;
34
+ /**
35
+ * Validates that `args.ids` is a present array of integers.
36
+ */
37
+ export declare const validateMultipleIntIds: (args: any, _opt: BaseCoreActionsInterface) => Promise<any[]>;
38
+ /**
39
+ * Validates that `args.ids` is a present array of UUID v4 values.
40
+ */
41
+ export declare const validateMultipleUuidIds: (args: any, _opt: BaseCoreActionsInterface) => Promise<any[]>;
42
+ /**
43
+ * Validates that `args.ids` is a present array of non-empty strings.
44
+ */
45
+ export declare const validateMultipleTextIds: (args: any, _opt: BaseCoreActionsInterface) => Promise<any[]>;
46
+ /**
47
+ * Validates list filter args using caller-provided rules.
48
+ * Validates `args.filter` rather than `args` directly.
49
+ *
50
+ * Returns a factory function — call with `{ rules }` to get the validator:
51
+ * `validate: validateList({ rules: myCheckitRules })`
52
+ */
53
+ export declare const validateList: ({ rules }: CommonValidatorArgs) => (args: any, _opt: BaseCoreActionsInterface) => Promise<any[]>;
54
+ /**
55
+ * Validates `args` for a get() call using the core's configured idType.
56
+ * Selects the appropriate single-id rule set (int, UUID, or text).
57
+ * Returns `[true, {}]` immediately if idType is ID_TYPES.UNKNOWN or not set,
58
+ * allowing untyped cores to skip id validation.
59
+ */
60
+ export declare const validateGet: (args: any, opt: BaseCoreActionsInterface) => Promise<any[]>;
61
+ /**
62
+ * Validates `args.where` for a remove() call using the core's configured idType.
63
+ * First checks that `where` is a non-empty object via `shouldHaveParams`,
64
+ * then applies the appropriate single-id rule set.
65
+ * Returns `[true, {}]` if idType is ID_TYPES.UNKNOWN or not set.
66
+ */
67
+ export declare const validateRemove: (args: any, opt: BaseCoreActionsInterface) => Promise<any[]>;
68
+ /**
69
+ * Validates `args` for a getMany() call using the core's configured idType.
70
+ * Selects the appropriate multi-id rule set (int, UUID, or text).
71
+ * Returns `[true, {}]` immediately if idType is ID_TYPES.UNKNOWN or not set.
72
+ */
73
+ export declare const validateGetMany: (args: any, opt: BaseCoreActionsInterface) => Promise<any[]>;
74
+ /**
75
+ * Validates `args.where` for a removeMany() call using the core's configured idType.
76
+ *
77
+ * Fix: removeMany() passes `args = { where: [...] }` to its validator, so we
78
+ * must validate `args.where` rather than `args` directly.
79
+ * Previously this was an alias of validateGetMany which validated `args.ids`
80
+ * directly — that worked only when idType was UNKNOWN (rules were skipped),
81
+ * but would fail silently for typed cores since `args.ids` would be undefined.
82
+ */
83
+ export declare const validateRemoveMany: (args: any, opt: BaseCoreActionsInterface) => Promise<any[]>;
84
+ /**
85
+ * Validates `args.params` for a create() call using caller-provided rules.
86
+ * First checks that `params` is a non-empty object, then applies the rules.
87
+ *
88
+ * Returns a factory function — call with `{ rules }` to get the validator:
89
+ * `validate: validateCreate({ rules: myCheckitRules })`
90
+ */
91
+ export declare const validateCreate: ({ rules }: CommonValidatorArgs) => (args: any, _opt: BaseCoreActionsInterface) => Promise<any[]>;
92
+ /**
93
+ * Validates `args.where` and `args.params` for an update() call using
94
+ * caller-provided rules.
95
+ * Checks that both `where` and `params` are non-empty objects, then
96
+ * applies the rules to `params`.
97
+ *
98
+ * Returns a factory function — call with `{ rules }` to get the validator:
99
+ * `validate: validateUpdate({ rules: myCheckitRules })`
100
+ */
101
+ export declare const validateUpdate: ({ rules }: CommonValidatorArgs) => (args: any, _opt: BaseCoreActionsInterface) => Promise<any[]>;
102
+ /**
103
+ * Validates `args.params` for a set() (upsert) call using caller-provided rules.
104
+ * Checks that `params` is a non-empty object, then applies the rules.
105
+ *
106
+ * Returns a factory function — call with `{ rules }` to get the validator:
107
+ * `validate: validateSet({ rules: myCheckitRules })`
108
+ */
109
+ export declare const validateSet: ({ rules }: CommonValidatorArgs) => (args: any, _opt: BaseCoreActionsInterface) => Promise<any[]>;