@epilot/cli 0.1.150 → 0.1.152

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/README.md CHANGED
@@ -29,7 +29,7 @@ npm install -g @epilot/cli
29
29
 
30
30
  <!-- usage-help -->
31
31
  ```
32
- epilot v0.1.150 — CLI for epilot APIs
32
+ epilot v0.1.152 — CLI for epilot APIs
33
33
 
34
34
  USAGE
35
35
  epilot <api> <operationId> [params...] [flags]
@@ -124,6 +124,9 @@
124
124
  "401": {
125
125
  "$ref": "#/components/responses/UnauthorizedError"
126
126
  },
127
+ "422": {
128
+ "$ref": "#/components/responses/UnprocessableEntityError"
129
+ },
127
130
  "500": {
128
131
  "$ref": "#/components/responses/InternalServerError"
129
132
  }
@@ -281,6 +284,9 @@
281
284
  "404": {
282
285
  "$ref": "#/components/responses/NotFoundError"
283
286
  },
287
+ "422": {
288
+ "$ref": "#/components/responses/UnprocessableEntityError"
289
+ },
284
290
  "500": {
285
291
  "$ref": "#/components/responses/InternalServerError"
286
292
  }
@@ -366,6 +372,9 @@
366
372
  "401": {
367
373
  "$ref": "#/components/responses/UnauthorizedError"
368
374
  },
375
+ "422": {
376
+ "$ref": "#/components/responses/UnprocessableEntityError"
377
+ },
369
378
  "500": {
370
379
  "$ref": "#/components/responses/InternalServerError"
371
380
  }
@@ -431,6 +440,9 @@
431
440
  "401": {
432
441
  "$ref": "#/components/responses/UnauthorizedError"
433
442
  },
443
+ "422": {
444
+ "$ref": "#/components/responses/UnprocessableEntityError"
445
+ },
434
446
  "500": {
435
447
  "$ref": "#/components/responses/InternalServerError"
436
448
  }
@@ -1297,6 +1309,73 @@
1297
1309
  }
1298
1310
  }
1299
1311
  },
1312
+ "/v1/files/validations": {
1313
+ "post": {
1314
+ "operationId": "validateFile",
1315
+ "summary": "validateFile",
1316
+ "description": "Validate an uploaded file against one or more document validation rules\n(validation-rules-api rules with `input_type: document`).\n\nThe file is referenced either by its file entity id or, for an upload that has not been\nsaved as an entity yet (e.g. a journey upload in the temporary prefix), by its S3 reference.\nThe service collects an observation of the file - deterministic facts such as the sniffed\nmime type, size, page count, image resolution, blank and password-protection detection -\nand evaluates every rule against it with the shared validation rules engine.\n\nThe response carries one result per rule with a per-condition outcome (`pass`, `fail`,\n`uncertain`, `skipped`), plus the observation the results were derived from. `status` is\n`completed` for checks that finish synchronously; `pending` is reserved for check levels\nthat need asynchronous content extraction.\n",
1317
+ "tags": [
1318
+ "File"
1319
+ ],
1320
+ "requestBody": {
1321
+ "required": true,
1322
+ "content": {
1323
+ "application/json": {
1324
+ "schema": {
1325
+ "$ref": "#/components/schemas/FileValidationRequest"
1326
+ }
1327
+ }
1328
+ }
1329
+ },
1330
+ "responses": {
1331
+ "200": {
1332
+ "description": "The validation result",
1333
+ "content": {
1334
+ "application/json": {
1335
+ "schema": {
1336
+ "$ref": "#/components/schemas/FileValidation"
1337
+ }
1338
+ }
1339
+ }
1340
+ },
1341
+ "400": {
1342
+ "$ref": "#/components/responses/BadRequestError"
1343
+ },
1344
+ "401": {
1345
+ "$ref": "#/components/responses/UnauthorizedError"
1346
+ },
1347
+ "403": {
1348
+ "$ref": "#/components/responses/ForbiddenError"
1349
+ },
1350
+ "404": {
1351
+ "$ref": "#/components/responses/NotFoundError"
1352
+ },
1353
+ "413": {
1354
+ "description": "The file is too large to validate",
1355
+ "content": {
1356
+ "application/json": {
1357
+ "schema": {
1358
+ "$ref": "#/components/schemas/ErrorObject"
1359
+ }
1360
+ }
1361
+ }
1362
+ },
1363
+ "422": {
1364
+ "description": "The file could not be read",
1365
+ "content": {
1366
+ "application/json": {
1367
+ "schema": {
1368
+ "$ref": "#/components/schemas/ErrorObject"
1369
+ }
1370
+ }
1371
+ }
1372
+ },
1373
+ "500": {
1374
+ "$ref": "#/components/responses/InternalServerError"
1375
+ }
1376
+ }
1377
+ }
1378
+ },
1300
1379
  "/v1/files/{id}/preview": {
1301
1380
  "get": {
1302
1381
  "operationId": "previewFile",
@@ -2090,6 +2169,9 @@
2090
2169
  "400": {
2091
2170
  "$ref": "#/components/responses/BadRequestError"
2092
2171
  },
2172
+ "422": {
2173
+ "$ref": "#/components/responses/UnprocessableEntityError"
2174
+ },
2093
2175
  "500": {
2094
2176
  "$ref": "#/components/responses/InternalServerError"
2095
2177
  }
@@ -2806,6 +2888,296 @@
2806
2888
  ],
2807
2889
  "readOnly": true
2808
2890
  },
2891
+ "FileValidationRequest": {
2892
+ "type": "object",
2893
+ "required": [
2894
+ "file",
2895
+ "rule_ids"
2896
+ ],
2897
+ "additionalProperties": false,
2898
+ "properties": {
2899
+ "file": {
2900
+ "$ref": "#/components/schemas/FileValidationFileReference"
2901
+ },
2902
+ "rule_ids": {
2903
+ "type": "array",
2904
+ "description": "Document validation rules to evaluate. Rules of another input type are rejected.",
2905
+ "minItems": 1,
2906
+ "maxItems": 10,
2907
+ "uniqueItems": true,
2908
+ "items": {
2909
+ "type": "string",
2910
+ "minLength": 1
2911
+ }
2912
+ }
2913
+ }
2914
+ },
2915
+ "FileValidationFileReference": {
2916
+ "description": "The file to validate - a saved file entity, or an uploaded object not saved as an entity yet.",
2917
+ "oneOf": [
2918
+ {
2919
+ "type": "object",
2920
+ "required": [
2921
+ "entity_id"
2922
+ ],
2923
+ "additionalProperties": false,
2924
+ "properties": {
2925
+ "entity_id": {
2926
+ "$ref": "#/components/schemas/FileEntityId"
2927
+ }
2928
+ }
2929
+ },
2930
+ {
2931
+ "type": "object",
2932
+ "required": [
2933
+ "s3ref"
2934
+ ],
2935
+ "additionalProperties": false,
2936
+ "properties": {
2937
+ "s3ref": {
2938
+ "$ref": "#/components/schemas/S3Ref"
2939
+ }
2940
+ }
2941
+ }
2942
+ ]
2943
+ },
2944
+ "FileValidation": {
2945
+ "type": "object",
2946
+ "required": [
2947
+ "id",
2948
+ "status",
2949
+ "file",
2950
+ "observation",
2951
+ "results",
2952
+ "created_at"
2953
+ ],
2954
+ "properties": {
2955
+ "id": {
2956
+ "type": "string",
2957
+ "description": "Identifier of this validation run."
2958
+ },
2959
+ "status": {
2960
+ "type": "string",
2961
+ "enum": [
2962
+ "completed",
2963
+ "pending",
2964
+ "failed"
2965
+ ],
2966
+ "description": "`completed` when every rule was evaluated. `pending` is reserved for check levels that\nneed asynchronous content extraction; `failed` when the observation could not be produced.\n"
2967
+ },
2968
+ "file": {
2969
+ "$ref": "#/components/schemas/FileValidationFile"
2970
+ },
2971
+ "observation": {
2972
+ "$ref": "#/components/schemas/FileValidationObservation"
2973
+ },
2974
+ "results": {
2975
+ "type": "array",
2976
+ "items": {
2977
+ "$ref": "#/components/schemas/FileValidationRuleResult"
2978
+ }
2979
+ },
2980
+ "created_at": {
2981
+ "type": "string",
2982
+ "format": "date-time"
2983
+ }
2984
+ }
2985
+ },
2986
+ "FileValidationFile": {
2987
+ "type": "object",
2988
+ "description": "The file that was validated, with the identity facts collected from its content.",
2989
+ "properties": {
2990
+ "entity_id": {
2991
+ "$ref": "#/components/schemas/FileEntityId"
2992
+ },
2993
+ "s3ref": {
2994
+ "$ref": "#/components/schemas/S3Ref"
2995
+ },
2996
+ "filename": {
2997
+ "type": "string"
2998
+ },
2999
+ "mime_type": {
3000
+ "type": "string",
3001
+ "description": "Mime type detected from the file content, falling back to the declared type."
3002
+ },
3003
+ "size_bytes": {
3004
+ "type": "integer"
3005
+ }
3006
+ }
3007
+ },
3008
+ "FileValidationObservation": {
3009
+ "type": "object",
3010
+ "description": "Everything observed about the file, as passed to the validation rules engine.",
3011
+ "required": [
3012
+ "facts"
3013
+ ],
3014
+ "properties": {
3015
+ "facts": {
3016
+ "$ref": "#/components/schemas/FileValidationFacts"
3017
+ },
3018
+ "judgements": {
3019
+ "type": "object",
3020
+ "description": "Content judgements keyed by condition id, produced by the document requirements\ncheck for `meetsCriteria` conditions at the `standard` and `advanced` levels.\nAbsent when no content check ran (basic level, unsupported file, or the check\ndid not finish within its budget).\n",
3021
+ "additionalProperties": {
3022
+ "$ref": "#/components/schemas/FileValidationJudgement"
3023
+ }
3024
+ },
3025
+ "document_type": {
3026
+ "type": "object",
3027
+ "description": "Document type detected by the content check, when it ran.",
3028
+ "properties": {
3029
+ "slug": {
3030
+ "type": "string"
3031
+ },
3032
+ "confidence": {
3033
+ "type": "number"
3034
+ }
3035
+ }
3036
+ }
3037
+ }
3038
+ },
3039
+ "FileValidationJudgement": {
3040
+ "type": "object",
3041
+ "required": [
3042
+ "result"
3043
+ ],
3044
+ "properties": {
3045
+ "result": {
3046
+ "type": "string",
3047
+ "enum": [
3048
+ "pass",
3049
+ "fail",
3050
+ "uncertain"
3051
+ ]
3052
+ },
3053
+ "confidence": {
3054
+ "type": "number"
3055
+ },
3056
+ "evidence": {
3057
+ "type": "string"
3058
+ },
3059
+ "explanation": {
3060
+ "type": "string"
3061
+ }
3062
+ }
3063
+ },
3064
+ "FileValidationFacts": {
3065
+ "type": "object",
3066
+ "description": "Deterministic properties of the file. A property that is absent could not be determined\n(for example the resolution of an image the service cannot decode); conditions that need it\nare skipped rather than failed.\n",
3067
+ "properties": {
3068
+ "mime_type": {
3069
+ "type": "string"
3070
+ },
3071
+ "size_bytes": {
3072
+ "type": "integer"
3073
+ },
3074
+ "page_count": {
3075
+ "type": "integer",
3076
+ "description": "Pages of a PDF; 1 for images."
3077
+ },
3078
+ "longer_edge_px": {
3079
+ "type": "integer",
3080
+ "description": "Longer edge of an image in pixels."
3081
+ },
3082
+ "is_blank": {
3083
+ "type": "boolean"
3084
+ },
3085
+ "is_password_protected": {
3086
+ "type": "boolean"
3087
+ }
3088
+ }
3089
+ },
3090
+ "FileValidationRuleResult": {
3091
+ "type": "object",
3092
+ "required": [
3093
+ "rule_id",
3094
+ "level",
3095
+ "is_valid",
3096
+ "conditions"
3097
+ ],
3098
+ "properties": {
3099
+ "rule_id": {
3100
+ "type": "string"
3101
+ },
3102
+ "rule_title": {
3103
+ "type": "string"
3104
+ },
3105
+ "level": {
3106
+ "type": "string",
3107
+ "enum": [
3108
+ "basic",
3109
+ "standard",
3110
+ "advanced"
3111
+ ],
3112
+ "description": "The rule's check level."
3113
+ },
3114
+ "is_valid": {
3115
+ "type": "boolean",
3116
+ "description": "True when every blocking condition passed or was skipped."
3117
+ },
3118
+ "failed_parts": {
3119
+ "type": "array",
3120
+ "description": "Error messages of blocking conditions that failed.",
3121
+ "items": {
3122
+ "type": "string"
3123
+ }
3124
+ },
3125
+ "warnings": {
3126
+ "type": "array",
3127
+ "description": "Error messages of advisory conditions that failed and of uncertain judgements.",
3128
+ "items": {
3129
+ "type": "string"
3130
+ }
3131
+ },
3132
+ "conditions": {
3133
+ "type": "array",
3134
+ "items": {
3135
+ "$ref": "#/components/schemas/FileValidationConditionResult"
3136
+ }
3137
+ }
3138
+ }
3139
+ },
3140
+ "FileValidationConditionResult": {
3141
+ "type": "object",
3142
+ "required": [
3143
+ "id",
3144
+ "operator",
3145
+ "outcome",
3146
+ "blocking",
3147
+ "message"
3148
+ ],
3149
+ "properties": {
3150
+ "id": {
3151
+ "type": "string"
3152
+ },
3153
+ "operator": {
3154
+ "type": "string"
3155
+ },
3156
+ "outcome": {
3157
+ "type": "string",
3158
+ "enum": [
3159
+ "pass",
3160
+ "fail",
3161
+ "uncertain",
3162
+ "skipped"
3163
+ ]
3164
+ },
3165
+ "blocking": {
3166
+ "type": "boolean",
3167
+ "description": "True when this outcome makes the file invalid."
3168
+ },
3169
+ "message": {
3170
+ "type": "string",
3171
+ "description": "The condition's configured error message."
3172
+ },
3173
+ "evidence": {
3174
+ "type": "string"
3175
+ },
3176
+ "explanation": {
3177
+ "type": "string"
3178
+ }
3179
+ }
3180
+ },
2809
3181
  "FileText": {
2810
3182
  "type": "object",
2811
3183
  "properties": {
@@ -3795,6 +4167,26 @@
3795
4167
  }
3796
4168
  }
3797
4169
  },
4170
+ "UnprocessableEntityError": {
4171
+ "description": "The request was well-formed but the file's type or content is not acceptable",
4172
+ "content": {
4173
+ "application/json": {
4174
+ "schema": {
4175
+ "allOf": [
4176
+ {
4177
+ "$ref": "#/components/schemas/ErrorObject"
4178
+ },
4179
+ {
4180
+ "example": {
4181
+ "status": 422,
4182
+ "error": "File type not allowed"
4183
+ }
4184
+ }
4185
+ ]
4186
+ }
4187
+ }
4188
+ }
4189
+ },
3798
4190
  "UnauthorizedError": {
3799
4191
  "description": "Authentication required or invalid credentials",
3800
4192
  "content": {