@epilot/sdk 2.20.7 → 2.20.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.
Files changed (121) hide show
  1. package/definitions/validation-rules.json +184 -6
  2. package/dist/apis/access-token.cjs +6 -6
  3. package/dist/apis/access-token.js +1 -1
  4. package/dist/apis/address-suggestions.cjs +6 -6
  5. package/dist/apis/address-suggestions.js +1 -1
  6. package/dist/apis/address.cjs +6 -6
  7. package/dist/apis/address.js +1 -1
  8. package/dist/apis/ai-agents.cjs +6 -6
  9. package/dist/apis/ai-agents.js +1 -1
  10. package/dist/apis/app.cjs +6 -6
  11. package/dist/apis/app.js +1 -1
  12. package/dist/apis/audit-logs.cjs +6 -6
  13. package/dist/apis/audit-logs.js +1 -1
  14. package/dist/apis/automation.cjs +6 -6
  15. package/dist/apis/automation.js +1 -1
  16. package/dist/apis/billing.cjs +6 -6
  17. package/dist/apis/billing.js +1 -1
  18. package/dist/apis/blueprint-manifest.cjs +6 -6
  19. package/dist/apis/blueprint-manifest.js +1 -1
  20. package/dist/apis/calendar.cjs +6 -6
  21. package/dist/apis/calendar.js +1 -1
  22. package/dist/apis/configuration-hub.cjs +6 -6
  23. package/dist/apis/configuration-hub.js +1 -1
  24. package/dist/apis/consent.cjs +6 -6
  25. package/dist/apis/consent.js +1 -1
  26. package/dist/apis/customer-portal.cjs +6 -6
  27. package/dist/apis/customer-portal.js +1 -1
  28. package/dist/apis/dashboard.cjs +6 -6
  29. package/dist/apis/dashboard.js +1 -1
  30. package/dist/apis/data-governance.cjs +6 -6
  31. package/dist/apis/data-governance.js +1 -1
  32. package/dist/apis/deduplication.cjs +6 -6
  33. package/dist/apis/deduplication.js +1 -1
  34. package/dist/apis/design.cjs +6 -6
  35. package/dist/apis/design.js +1 -1
  36. package/dist/apis/document.cjs +6 -6
  37. package/dist/apis/document.js +1 -1
  38. package/dist/apis/email-settings.cjs +6 -6
  39. package/dist/apis/email-settings.js +1 -1
  40. package/dist/apis/email-template.cjs +6 -6
  41. package/dist/apis/email-template.js +1 -1
  42. package/dist/apis/entity-mapping.cjs +6 -6
  43. package/dist/apis/entity-mapping.js +1 -1
  44. package/dist/apis/entity.cjs +6 -6
  45. package/dist/apis/entity.js +1 -1
  46. package/dist/apis/environments.cjs +6 -6
  47. package/dist/apis/environments.js +1 -1
  48. package/dist/apis/event-catalog.cjs +6 -6
  49. package/dist/apis/event-catalog.js +1 -1
  50. package/dist/apis/file.cjs +6 -6
  51. package/dist/apis/file.js +1 -1
  52. package/dist/apis/iban.cjs +6 -6
  53. package/dist/apis/iban.js +1 -1
  54. package/dist/apis/integration-toolkit.cjs +6 -6
  55. package/dist/apis/integration-toolkit.js +1 -1
  56. package/dist/apis/journey.cjs +6 -6
  57. package/dist/apis/journey.js +1 -1
  58. package/dist/apis/kanban.cjs +6 -6
  59. package/dist/apis/kanban.js +1 -1
  60. package/dist/apis/message.cjs +6 -6
  61. package/dist/apis/message.js +1 -1
  62. package/dist/apis/metering.cjs +6 -6
  63. package/dist/apis/metering.js +1 -1
  64. package/dist/apis/notes.cjs +6 -6
  65. package/dist/apis/notes.js +1 -1
  66. package/dist/apis/notification.cjs +6 -6
  67. package/dist/apis/notification.js +1 -1
  68. package/dist/apis/organization.cjs +6 -6
  69. package/dist/apis/organization.js +1 -1
  70. package/dist/apis/partner-directory.cjs +6 -6
  71. package/dist/apis/partner-directory.js +1 -1
  72. package/dist/apis/permissions.cjs +6 -6
  73. package/dist/apis/permissions.js +1 -1
  74. package/dist/apis/pricing-tier.cjs +6 -6
  75. package/dist/apis/pricing-tier.js +1 -1
  76. package/dist/apis/pricing.cjs +6 -6
  77. package/dist/apis/pricing.js +1 -1
  78. package/dist/apis/purpose.cjs +6 -6
  79. package/dist/apis/purpose.js +1 -1
  80. package/dist/apis/query.cjs +6 -6
  81. package/dist/apis/query.js +1 -1
  82. package/dist/apis/sandbox.cjs +6 -6
  83. package/dist/apis/sandbox.js +1 -1
  84. package/dist/apis/sharing.cjs +6 -6
  85. package/dist/apis/sharing.js +1 -1
  86. package/dist/apis/snapshot.cjs +6 -6
  87. package/dist/apis/snapshot.js +1 -1
  88. package/dist/apis/submission.cjs +6 -6
  89. package/dist/apis/submission.js +1 -1
  90. package/dist/apis/target.cjs +6 -6
  91. package/dist/apis/target.js +1 -1
  92. package/dist/apis/targeting.cjs +6 -6
  93. package/dist/apis/targeting.js +1 -1
  94. package/dist/apis/template-variables.cjs +6 -6
  95. package/dist/apis/template-variables.js +1 -1
  96. package/dist/apis/user.cjs +6 -6
  97. package/dist/apis/user.js +1 -1
  98. package/dist/apis/validation-rules.cjs +6 -6
  99. package/dist/apis/validation-rules.d.cts +2 -2
  100. package/dist/apis/validation-rules.d.ts +2 -2
  101. package/dist/apis/validation-rules.js +1 -1
  102. package/dist/apis/webhooks.cjs +6 -6
  103. package/dist/apis/webhooks.js +1 -1
  104. package/dist/apis/workflow-definition.cjs +6 -6
  105. package/dist/apis/workflow-definition.js +1 -1
  106. package/dist/apis/workflow.cjs +6 -6
  107. package/dist/apis/workflow.js +1 -1
  108. package/dist/{chunk-QRC6XEXV.js → chunk-OOMP6BYJ.js} +1 -1
  109. package/dist/{chunk-22IGZ7VQ.cjs → chunk-VAM7ZIAF.cjs} +1 -1
  110. package/dist/index.cjs +8 -8
  111. package/dist/index.d.cts +1 -1
  112. package/dist/index.d.ts +1 -1
  113. package/dist/index.js +1 -1
  114. package/dist/validation-rules-2JQLB6PH.cjs +7 -0
  115. package/dist/validation-rules-VQXUQSMC.js +7 -0
  116. package/dist/{validation-rules.d-D8X9MYTc.d.cts → validation-rules.d-Bbo90IYn.d.cts} +178 -7
  117. package/dist/{validation-rules.d-D8X9MYTc.d.ts → validation-rules.d-Bbo90IYn.d.ts} +178 -7
  118. package/docs/validation-rules.md +286 -0
  119. package/package.json +1 -1
  120. package/dist/validation-rules-ETOO45CW.js +0 -7
  121. package/dist/validation-rules-MZZ7YMJM.cjs +0 -7
@@ -216,7 +216,20 @@ declare namespace Components {
216
216
  * external (app-provided) comparison values.
217
217
  *
218
218
  */
219
- ComparisonRuleType;
219
+ ComparisonRuleType | /**
220
+ * Declarative validation rule (schema version v2) for uploaded files. The rule declares how deep
221
+ * the check goes (`check.level`) and the conditions the file must satisfy. Property conditions
222
+ * (file type, size, page count, image resolution, blank and password-protected detection) are
223
+ * deterministic and available at every level; the `meetsCriteria` condition judges a free-text
224
+ * requirement against the document's extracted content and is available from level `standard`.
225
+ *
226
+ * Evaluation semantics for content conditions differ from scalar rules: each condition resolves to
227
+ * pass, fail or uncertain. A confident fail on a blocking condition fails the input; an uncertain
228
+ * result is always reported as advisory and never fails the input, regardless of `allow_failure`.
229
+ * Document rules carry no `contexts` yet.
230
+ *
231
+ */
232
+ DocumentRuleType;
220
233
  /**
221
234
  * Declares the dynamic context a v2 rule needs at evaluation time.
222
235
  * `context` condition values reference these sources by using the schema slug
@@ -233,6 +246,108 @@ declare namespace Components {
233
246
  */
234
247
  ContextRequirement[];
235
248
  }
249
+ /**
250
+ * A free-text requirement judged against the document's extracted content, e.g. "The photo shows
251
+ * an electricity meter with the meter number and the current reading fully legible." One requirement
252
+ * per condition keeps results specific and lets each requirement be graded separately.
253
+ *
254
+ */
255
+ export interface CriteriaValue {
256
+ source: "criteria";
257
+ text: string;
258
+ }
259
+ /**
260
+ * How deep the document check goes. Levels are cumulative.
261
+ */
262
+ export interface DocumentCheck {
263
+ /**
264
+ * - `basic`: file properties only (type, size, page count, resolution, blank, password). Instant, no extraction.
265
+ * - `standard`: basic checks plus a quick scan of the content. A few seconds.
266
+ * - `advanced`: basic checks plus a thorough reading of the fully extracted content. Roughly 5 to 10 seconds.
267
+ *
268
+ */
269
+ level: "basic" | "standard" | "advanced";
270
+ }
271
+ /**
272
+ * A single check the uploaded file must satisfy.
273
+ */
274
+ export interface DocumentCondition {
275
+ /**
276
+ * Stable identifier of the condition within the rule, used for editing and error reporting.
277
+ */
278
+ id: string;
279
+ operator: /**
280
+ * Predefined document check. Value compatibility (enforced at write time):
281
+ * - fileTypeIn: `file_types` value listing the accepted file categories.
282
+ * - sizeBelow: static integer, maximum file size in bytes.
283
+ * - pageCountBetween: `range` of static non-negative integers (inclusive).
284
+ * - resolutionAtLeast / resolutionAtMost: static positive integer, the image's longer edge in pixels.
285
+ * - isNotBlank / isNotPasswordProtected: `none` value (unary).
286
+ * - meetsCriteria: `criteria` value with the free-text requirement. Requires check level `standard` or `advanced`.
287
+ *
288
+ */
289
+ DocumentOperator;
290
+ value: /* The value of a document condition - a static scalar, a range, nothing, accepted file categories, or a free-text criterion. */ DocumentConditionValue;
291
+ /**
292
+ * Message shown to the end user when this condition fails.
293
+ */
294
+ error_message: string;
295
+ /**
296
+ * When true, the condition is advisory: a failure is reported but never takes part in the
297
+ * validity verdict. Recommended for `meetsCriteria` until the organisation has reviewed
298
+ * results on real files.
299
+ *
300
+ */
301
+ allow_failure?: boolean;
302
+ }
303
+ /**
304
+ * The value of a document condition - a static scalar, a range, nothing, accepted file categories, or a free-text criterion.
305
+ */
306
+ export type DocumentConditionValue = /* The value of a document condition - a static scalar, a range, nothing, accepted file categories, or a free-text criterion. */ /* A fixed comparison value. */ StaticValue | /* A lower and upper bound for range operators (between, dateBetween, lengthBetween). Bounds are inclusive. */ RangeValue | /* No comparison value - used by unary operators such as notInFuture / notInPast. */ NoValue | /* Accepted file categories; each category expands to a mime list at check time. */ FileTypesValue | /**
307
+ * A free-text requirement judged against the document's extracted content, e.g. "The photo shows
308
+ * an electricity meter with the meter number and the current reading fully legible." One requirement
309
+ * per condition keeps results specific and lets each requirement be graded separately.
310
+ *
311
+ */
312
+ CriteriaValue;
313
+ /**
314
+ * Predefined document check. Value compatibility (enforced at write time):
315
+ * - fileTypeIn: `file_types` value listing the accepted file categories.
316
+ * - sizeBelow: static integer, maximum file size in bytes.
317
+ * - pageCountBetween: `range` of static non-negative integers (inclusive).
318
+ * - resolutionAtLeast / resolutionAtMost: static positive integer, the image's longer edge in pixels.
319
+ * - isNotBlank / isNotPasswordProtected: `none` value (unary).
320
+ * - meetsCriteria: `criteria` value with the free-text requirement. Requires check level `standard` or `advanced`.
321
+ *
322
+ */
323
+ export type DocumentOperator = "fileTypeIn" | "sizeBelow" | "pageCountBetween" | "resolutionAtLeast" | "resolutionAtMost" | "isNotBlank" | "isNotPasswordProtected" | "meetsCriteria";
324
+ /**
325
+ * Declarative validation rule (schema version v2) for uploaded files. The rule declares how deep
326
+ * the check goes (`check.level`) and the conditions the file must satisfy. Property conditions
327
+ * (file type, size, page count, image resolution, blank and password-protected detection) are
328
+ * deterministic and available at every level; the `meetsCriteria` condition judges a free-text
329
+ * requirement against the document's extracted content and is available from level `standard`.
330
+ *
331
+ * Evaluation semantics for content conditions differ from scalar rules: each condition resolves to
332
+ * pass, fail or uncertain. A confident fail on a blocking condition fails the input; an uncertain
333
+ * result is always reported as advisory and never fails the input, regardless of `allow_failure`.
334
+ * Document rules carry no `contexts` yet.
335
+ *
336
+ */
337
+ export interface DocumentRuleType {
338
+ /**
339
+ * Identifies the rule as a document rule. Determines which operators are allowed.
340
+ */
341
+ input_type: "document";
342
+ check: /* How deep the document check goes. Levels are cumulative. */ DocumentCheck;
343
+ /**
344
+ * The checks the uploaded file must satisfy. All blocking conditions must pass for the
345
+ * file to be valid; `allow_failure` conditions are advisory. Must contain at least one
346
+ * condition (enforced at write time).
347
+ *
348
+ */
349
+ conditions: /* A single check the uploaded file must satisfy. */ DocumentCondition[];
350
+ }
236
351
  /**
237
352
  * A comparison value resolved at evaluation time from an organisation environment variable
238
353
  * (environments-api). The rule stores the key, never the value, so one change to the variable
@@ -293,6 +408,16 @@ declare namespace Components {
293
408
  */
294
409
  ValueAdjustment;
295
410
  }
411
+ /**
412
+ * Accepted file categories; each category expands to a mime list at check time.
413
+ */
414
+ export interface FileTypesValue {
415
+ source: "file_types";
416
+ types: [
417
+ ("image" | "pdf" | "document" | "spreadsheet"),
418
+ ...("image" | "pdf" | "document" | "spreadsheet")[]
419
+ ];
420
+ }
296
421
  /**
297
422
  * Response envelope for listing all validation rules within an organization.
298
423
  */
@@ -765,7 +890,20 @@ declare namespace Components {
765
890
  * external (app-provided) comparison values.
766
891
  *
767
892
  */
768
- ComparisonRuleType;
893
+ ComparisonRuleType | /**
894
+ * Declarative validation rule (schema version v2) for uploaded files. The rule declares how deep
895
+ * the check goes (`check.level`) and the conditions the file must satisfy. Property conditions
896
+ * (file type, size, page count, image resolution, blank and password-protected detection) are
897
+ * deterministic and available at every level; the `meetsCriteria` condition judges a free-text
898
+ * requirement against the document's extracted content and is available from level `standard`.
899
+ *
900
+ * Evaluation semantics for content conditions differ from scalar rules: each condition resolves to
901
+ * pass, fail or uncertain. A confident fail on a blocking condition fails the input; an uncertain
902
+ * result is always reported as advisory and never fails the input, regardless of `allow_failure`.
903
+ * Document rules carry no `contexts` yet.
904
+ *
905
+ */
906
+ DocumentRuleType;
769
907
  /**
770
908
  * Declares the dynamic context a v2 rule needs at evaluation time.
771
909
  * `context` condition values reference these sources by using the schema slug
@@ -840,7 +978,20 @@ declare namespace Components {
840
978
  * external (app-provided) comparison values.
841
979
  *
842
980
  */
843
- ComparisonRuleType;
981
+ ComparisonRuleType | /**
982
+ * Declarative validation rule (schema version v2) for uploaded files. The rule declares how deep
983
+ * the check goes (`check.level`) and the conditions the file must satisfy. Property conditions
984
+ * (file type, size, page count, image resolution, blank and password-protected detection) are
985
+ * deterministic and available at every level; the `meetsCriteria` condition judges a free-text
986
+ * requirement against the document's extracted content and is available from level `standard`.
987
+ *
988
+ * Evaluation semantics for content conditions differ from scalar rules: each condition resolves to
989
+ * pass, fail or uncertain. A confident fail on a blocking condition fails the input; an uncertain
990
+ * result is always reported as advisory and never fails the input, regardless of `allow_failure`.
991
+ * Document rules carry no `contexts` yet.
992
+ *
993
+ */
994
+ DocumentRuleType;
844
995
  /**
845
996
  * Declares the dynamic context a v2 rule needs at evaluation time.
846
997
  * `context` condition values reference these sources by using the schema slug
@@ -912,7 +1063,20 @@ declare namespace Components {
912
1063
  * external (app-provided) comparison values.
913
1064
  *
914
1065
  */
915
- ComparisonRuleType;
1066
+ ComparisonRuleType | /**
1067
+ * Declarative validation rule (schema version v2) for uploaded files. The rule declares how deep
1068
+ * the check goes (`check.level`) and the conditions the file must satisfy. Property conditions
1069
+ * (file type, size, page count, image resolution, blank and password-protected detection) are
1070
+ * deterministic and available at every level; the `meetsCriteria` condition judges a free-text
1071
+ * requirement against the document's extracted content and is available from level `standard`.
1072
+ *
1073
+ * Evaluation semantics for content conditions differ from scalar rules: each condition resolves to
1074
+ * pass, fail or uncertain. A confident fail on a blocking condition fails the input; an uncertain
1075
+ * result is always reported as advisory and never fails the input, regardless of `allow_failure`.
1076
+ * Document rules carry no `contexts` yet.
1077
+ *
1078
+ */
1079
+ DocumentRuleType;
916
1080
  /**
917
1081
  * Declares the dynamic context a v2 rule needs at evaluation time.
918
1082
  * `context` condition values reference these sources by using the schema slug
@@ -1044,7 +1208,7 @@ declare namespace Paths {
1044
1208
  * Invalid request body
1045
1209
  */
1046
1210
  message?: string;
1047
- code?: "external_value_not_found" | "external_value_incompatible";
1211
+ code?: "external_value_not_found" | "external_value_incompatible" | "environment_variable_not_found" | "environment_variable_incompatible";
1048
1212
  }
1049
1213
  export interface $401 {
1050
1214
  /**
@@ -1252,7 +1416,7 @@ declare namespace Paths {
1252
1416
  * Invalid request body
1253
1417
  */
1254
1418
  message?: string;
1255
- code?: "external_value_not_found" | "external_value_incompatible";
1419
+ code?: "external_value_not_found" | "external_value_incompatible" | "environment_variable_not_found" | "environment_variable_incompatible";
1256
1420
  }
1257
1421
  export interface $401 {
1258
1422
  /**
@@ -1467,8 +1631,15 @@ type ConditionValue = Components.Schemas.ConditionValue;
1467
1631
  type ContextRequirement = Components.Schemas.ContextRequirement;
1468
1632
  type ContextValue = Components.Schemas.ContextValue;
1469
1633
  type CreateValidationRuleRequest = Components.Schemas.CreateValidationRuleRequest;
1634
+ type CriteriaValue = Components.Schemas.CriteriaValue;
1635
+ type DocumentCheck = Components.Schemas.DocumentCheck;
1636
+ type DocumentCondition = Components.Schemas.DocumentCondition;
1637
+ type DocumentConditionValue = Components.Schemas.DocumentConditionValue;
1638
+ type DocumentOperator = Components.Schemas.DocumentOperator;
1639
+ type DocumentRuleType = Components.Schemas.DocumentRuleType;
1470
1640
  type EnvironmentValue = Components.Schemas.EnvironmentValue;
1471
1641
  type ExternalValue = Components.Schemas.ExternalValue;
1642
+ type FileTypesValue = Components.Schemas.FileTypesValue;
1472
1643
  type GetValidationRulesResponse = Components.Schemas.GetValidationRulesResponse;
1473
1644
  type NoValue = Components.Schemas.NoValue;
1474
1645
  type NumericCondition = Components.Schemas.NumericCondition;
@@ -1494,4 +1665,4 @@ type ValidationRule = Components.Schemas.ValidationRule;
1494
1665
  type ValidationRuleBase = Components.Schemas.ValidationRuleBase;
1495
1666
  type ValueAdjustment = Components.Schemas.ValueAdjustment;
1496
1667
 
1497
- export { type AppliesWhen as A, type ValueAdjustment as B, type Client as C, type EnvironmentValue as E, type GetValidationRulesResponse as G, type NoValue as N, type OperationMethods as O, Paths as P, type RangeValue as R, type ScalarValue as S, type UpdateValidationRuleRequest as U, type ValidationRule as V, Components as a, type PathsDictionary as b, type ComparisonRuleType as c, type Condition as d, type ConditionValue as e, type ContextRequirement as f, type ContextValue as g, type CreateValidationRuleRequest as h, type ExternalValue as i, type NumericCondition as j, type NumericFactCondition as k, type NumericNestedCondition as l, type NumericRuleType as m, type Operator as n, type PatternCondition as o, type PatternFactCondition as p, type PatternNestedCondition as q, type PatternRuleType as r, type RegexCondition as s, type RegexFactCondition as t, type RegexNestedCondition as u, type RegexRuleType as v, type RelativeDateValue as w, type StaticValue as x, type UsedBy as y, type ValidationRuleBase as z };
1668
+ export { type AppliesWhen as A, type RegexRuleType as B, type Client as C, type DocumentCheck as D, type EnvironmentValue as E, type FileTypesValue as F, type GetValidationRulesResponse as G, type RelativeDateValue as H, type StaticValue as I, type UsedBy as J, type ValidationRuleBase as K, type ValueAdjustment as L, type NoValue as N, type OperationMethods as O, Paths as P, type RangeValue as R, type ScalarValue as S, type UpdateValidationRuleRequest as U, type ValidationRule as V, Components as a, type PathsDictionary as b, type ComparisonRuleType as c, type Condition as d, type ConditionValue as e, type ContextRequirement as f, type ContextValue as g, type CreateValidationRuleRequest as h, type CriteriaValue as i, type DocumentCondition as j, type DocumentConditionValue as k, type DocumentOperator as l, type DocumentRuleType as m, type ExternalValue as n, type NumericCondition as o, type NumericFactCondition as p, type NumericNestedCondition as q, type NumericRuleType as r, type Operator as s, type PatternCondition as t, type PatternFactCondition as u, type PatternNestedCondition as v, type PatternRuleType as w, type RegexCondition as x, type RegexFactCondition as y, type RegexNestedCondition as z };
@@ -65,6 +65,13 @@ const { data } = await validationRulesClient.getValidationRules(...)
65
65
  - [`RelativeDateValue`](#relativedatevalue)
66
66
  - [`RangeValue`](#rangevalue)
67
67
  - [`NoValue`](#novalue)
68
+ - [`DocumentRuleType`](#documentruletype)
69
+ - [`DocumentCheck`](#documentcheck)
70
+ - [`DocumentCondition`](#documentcondition)
71
+ - [`DocumentOperator`](#documentoperator)
72
+ - [`DocumentConditionValue`](#documentconditionvalue)
73
+ - [`FileTypesValue`](#filetypesvalue)
74
+ - [`CriteriaValue`](#criteriavalue)
68
75
  - [`AppliesWhen`](#applieswhen)
69
76
  - [`ContextRequirement`](#contextrequirement)
70
77
 
@@ -682,6 +689,18 @@ type UpdateValidationRuleRequest = {
682
689
  applies_when?: { ... }
683
690
  allow_failure?: { ... }
684
691
  }>
692
+ } | {
693
+ input_type: "document"
694
+ check: {
695
+ level: { ... }
696
+ }
697
+ conditions: Array<{
698
+ id: { ... }
699
+ operator: { ... }
700
+ value: { ... }
701
+ error_message: { ... }
702
+ allow_failure?: { ... }
703
+ }>
685
704
  }
686
705
  contexts?: Array<{
687
706
  schema: string
@@ -737,6 +756,18 @@ type ValidationRuleBase = {
737
756
  applies_when?: { ... }
738
757
  allow_failure?: { ... }
739
758
  }>
759
+ } | {
760
+ input_type: "document"
761
+ check: {
762
+ level: { ... }
763
+ }
764
+ conditions: Array<{
765
+ id: { ... }
766
+ operator: { ... }
767
+ value: { ... }
768
+ error_message: { ... }
769
+ allow_failure?: { ... }
770
+ }>
740
771
  }
741
772
  contexts?: Array<{
742
773
  schema: string
@@ -2261,6 +2292,261 @@ type NoValue = {
2261
2292
  }
2262
2293
  ```
2263
2294
 
2295
+ ### `DocumentRuleType`
2296
+
2297
+ Declarative validation rule (schema version v2) for uploaded files. The rule declares how deep
2298
+ the check goes (`check.level`) and the conditions the file must satisfy. Property conditions
2299
+ (file type, size, page count, image resolution, blank and password-protected detection) are
2300
+ deterministic and av
2301
+
2302
+ ```ts
2303
+ type DocumentRuleType = {
2304
+ input_type: "document"
2305
+ check: {
2306
+ level: "basic" | "standard" | "advanced"
2307
+ }
2308
+ conditions: Array<{
2309
+ id: string
2310
+ operator: "fileTypeIn" | "sizeBelow" | "pageCountBetween" | "resolutionAtLeast" | "resolutionAtMost" | "isNotBlank" | "isNotPasswordProtected" | "meetsCriteria"
2311
+ value: {
2312
+ source: { ... }
2313
+ data: { ... }
2314
+ } | {
2315
+ source: { ... }
2316
+ min: { ... }
2317
+ max: { ... }
2318
+ } | {
2319
+ source: { ... }
2320
+ } | {
2321
+ source: { ... }
2322
+ types: { ... }
2323
+ } | {
2324
+ source: { ... }
2325
+ text: { ... }
2326
+ }
2327
+ error_message: string
2328
+ allow_failure?: boolean
2329
+ }>
2330
+ }
2331
+ ```
2332
+
2333
+ ### `DocumentCheck`
2334
+
2335
+ How deep the document check goes. Levels are cumulative.
2336
+
2337
+ ```ts
2338
+ type DocumentCheck = {
2339
+ level: "basic" | "standard" | "advanced"
2340
+ }
2341
+ ```
2342
+
2343
+ ### `DocumentCondition`
2344
+
2345
+ A single check the uploaded file must satisfy.
2346
+
2347
+ ```ts
2348
+ type DocumentCondition = {
2349
+ id: string
2350
+ operator: "fileTypeIn" | "sizeBelow" | "pageCountBetween" | "resolutionAtLeast" | "resolutionAtMost" | "isNotBlank" | "isNotPasswordProtected" | "meetsCriteria"
2351
+ value: {
2352
+ source: "static"
2353
+ data: number | string | boolean
2354
+ } | {
2355
+ source: "range"
2356
+ min: {
2357
+ source: { ... }
2358
+ data: { ... }
2359
+ } | {
2360
+ source: { ... }
2361
+ path: { ... }
2362
+ adjust?: { ... }
2363
+ } | {
2364
+ source: { ... }
2365
+ offset: { ... }
2366
+ unit: { ... }
2367
+ anchor?: { ... }
2368
+ } | {
2369
+ source: { ... }
2370
+ key: { ... }
2371
+ adjust?: { ... }
2372
+ } | {
2373
+ source: { ... }
2374
+ app_id: { ... }
2375
+ hook_id: { ... }
2376
+ result_id: { ... }
2377
+ adjust?: { ... }
2378
+ }
2379
+ max: {
2380
+ source: { ... }
2381
+ data: { ... }
2382
+ } | {
2383
+ source: { ... }
2384
+ path: { ... }
2385
+ adjust?: { ... }
2386
+ } | {
2387
+ source: { ... }
2388
+ offset: { ... }
2389
+ unit: { ... }
2390
+ anchor?: { ... }
2391
+ } | {
2392
+ source: { ... }
2393
+ key: { ... }
2394
+ adjust?: { ... }
2395
+ } | {
2396
+ source: { ... }
2397
+ app_id: { ... }
2398
+ hook_id: { ... }
2399
+ result_id: { ... }
2400
+ adjust?: { ... }
2401
+ }
2402
+ } | {
2403
+ source: "none"
2404
+ } | {
2405
+ source: "file_types"
2406
+ types: "image" | "pdf" | "document" | "spreadsheet"[]
2407
+ } | {
2408
+ source: "criteria"
2409
+ text: string
2410
+ }
2411
+ error_message: string
2412
+ allow_failure?: boolean
2413
+ }
2414
+ ```
2415
+
2416
+ ### `DocumentOperator`
2417
+
2418
+ Predefined document check. Value compatibility (enforced at write time):
2419
+ - fileTypeIn: `file_types` value listing the accepted file categories.
2420
+ - sizeBelow: static integer, maximum file size in bytes.
2421
+ - pageCountBetween: `range` of static non-negative integers (inclusive).
2422
+ - resolutionAtLeast / reso
2423
+
2424
+ ```ts
2425
+ type DocumentOperator = "fileTypeIn" | "sizeBelow" | "pageCountBetween" | "resolutionAtLeast" | "resolutionAtMost" | "isNotBlank" | "isNotPasswordProtected" | "meetsCriteria"
2426
+ ```
2427
+
2428
+ ### `DocumentConditionValue`
2429
+
2430
+ The value of a document condition - a static scalar, a range, nothing, accepted file categories, or a free-text criterion.
2431
+
2432
+ ```ts
2433
+ type DocumentConditionValue = {
2434
+ source: "static"
2435
+ data: number | string | boolean
2436
+ } | {
2437
+ source: "range"
2438
+ min: {
2439
+ source: "static"
2440
+ data: number | string | boolean
2441
+ } | {
2442
+ source: "context"
2443
+ path: string
2444
+ adjust?: {
2445
+ type: { ... }
2446
+ value: { ... }
2447
+ direction: { ... }
2448
+ rounding?: { ... }
2449
+ }
2450
+ } | {
2451
+ source: "relative_date"
2452
+ offset: number
2453
+ unit: "days" | "months" | "years"
2454
+ anchor?: "today"
2455
+ } | {
2456
+ source: "environment"
2457
+ key: string
2458
+ adjust?: {
2459
+ type: { ... }
2460
+ value: { ... }
2461
+ direction: { ... }
2462
+ rounding?: { ... }
2463
+ }
2464
+ } | {
2465
+ source: "external"
2466
+ app_id: string
2467
+ hook_id: string
2468
+ result_id: string
2469
+ adjust?: {
2470
+ type: { ... }
2471
+ value: { ... }
2472
+ direction: { ... }
2473
+ rounding?: { ... }
2474
+ }
2475
+ }
2476
+ max: {
2477
+ source: "static"
2478
+ data: number | string | boolean
2479
+ } | {
2480
+ source: "context"
2481
+ path: string
2482
+ adjust?: {
2483
+ type: { ... }
2484
+ value: { ... }
2485
+ direction: { ... }
2486
+ rounding?: { ... }
2487
+ }
2488
+ } | {
2489
+ source: "relative_date"
2490
+ offset: number
2491
+ unit: "days" | "months" | "years"
2492
+ anchor?: "today"
2493
+ } | {
2494
+ source: "environment"
2495
+ key: string
2496
+ adjust?: {
2497
+ type: { ... }
2498
+ value: { ... }
2499
+ direction: { ... }
2500
+ rounding?: { ... }
2501
+ }
2502
+ } | {
2503
+ source: "external"
2504
+ app_id: string
2505
+ hook_id: string
2506
+ result_id: string
2507
+ adjust?: {
2508
+ type: { ... }
2509
+ value: { ... }
2510
+ direction: { ... }
2511
+ rounding?: { ... }
2512
+ }
2513
+ }
2514
+ } | {
2515
+ source: "none"
2516
+ } | {
2517
+ source: "file_types"
2518
+ types: "image" | "pdf" | "document" | "spreadsheet"[]
2519
+ } | {
2520
+ source: "criteria"
2521
+ text: string
2522
+ }
2523
+ ```
2524
+
2525
+ ### `FileTypesValue`
2526
+
2527
+ Accepted file categories; each category expands to a mime list at check time.
2528
+
2529
+ ```ts
2530
+ type FileTypesValue = {
2531
+ source: "file_types"
2532
+ types: "image" | "pdf" | "document" | "spreadsheet"[]
2533
+ }
2534
+ ```
2535
+
2536
+ ### `CriteriaValue`
2537
+
2538
+ A free-text requirement judged against the document's extracted content, e.g. "The photo shows
2539
+ an electricity meter with the meter number and the current reading fully legible." One requirement
2540
+ per condition keeps results specific and lets each requirement be graded separately.
2541
+
2542
+
2543
+ ```ts
2544
+ type CriteriaValue = {
2545
+ source: "criteria"
2546
+ text: string
2547
+ }
2548
+ ```
2549
+
2264
2550
  ### `AppliesWhen`
2265
2551
 
2266
2552
  Optional precondition on a condition: the condition only takes part in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/sdk",
3
- "version": "2.20.7",
3
+ "version": "2.20.8",
4
4
  "description": "JavaScript/TypeScript SDK for epilot APIs",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",