@epilot/cli 0.1.90 → 0.1.91

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.90 — CLI for epilot APIs
32
+ epilot v0.1.91 — CLI for epilot APIs
33
33
 
34
34
  USAGE
35
35
  epilot <api> <operationId> [params...] [flags]
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.0.3",
3
3
  "info": {
4
4
  "title": "Integration Toolkit API",
5
- "version": "1.5.12",
5
+ "version": "1.7.0",
6
6
  "description": "API for integrating with external systems in a standardised way."
7
7
  },
8
8
  "tags": [
@@ -10,6 +10,10 @@
10
10
  "name": "erp",
11
11
  "description": "ERP integration endpoints"
12
12
  },
13
+ {
14
+ "name": "erp-imports",
15
+ "description": "ERP pricing file import endpoints"
16
+ },
13
17
  {
14
18
  "name": "trigger",
15
19
  "description": "Endpoints to trigger ERP related actions"
@@ -3735,6 +3739,227 @@
3735
3739
  }
3736
3740
  }
3737
3741
  }
3742
+ },
3743
+ "/v2/erp/imports": {
3744
+ "post": {
3745
+ "operationId": "createErpImport",
3746
+ "summary": "createErpImport",
3747
+ "description": "Create a pricing-file import job from an already-uploaded file (S3 ref). Returns a job id and starts the validate phase asynchronously — poll GET /v2/erp/imports/{importId}.",
3748
+ "tags": [
3749
+ "erp-imports"
3750
+ ],
3751
+ "requestBody": {
3752
+ "required": true,
3753
+ "content": {
3754
+ "application/json": {
3755
+ "schema": {
3756
+ "$ref": "#/components/schemas/CreateErpImportRequest"
3757
+ }
3758
+ }
3759
+ }
3760
+ },
3761
+ "responses": {
3762
+ "202": {
3763
+ "description": "Import job accepted",
3764
+ "content": {
3765
+ "application/json": {
3766
+ "schema": {
3767
+ "$ref": "#/components/schemas/CreateErpImportResponse"
3768
+ }
3769
+ }
3770
+ }
3771
+ },
3772
+ "400": {
3773
+ "$ref": "#/components/responses/BadRequest"
3774
+ },
3775
+ "403": {
3776
+ "$ref": "#/components/responses/Forbidden"
3777
+ },
3778
+ "500": {
3779
+ "$ref": "#/components/responses/InternalServerError"
3780
+ }
3781
+ }
3782
+ },
3783
+ "get": {
3784
+ "operationId": "listErpImports",
3785
+ "summary": "listErpImports",
3786
+ "description": "List recent pricing-file import jobs for the org, newest first.\n\nPass `next_cursor` back as `cursor` for the next page. A page can be\nshorter than `limit` and still have more behind it, so stop on\n`next_cursor: null`.\n",
3787
+ "tags": [
3788
+ "erp-imports"
3789
+ ],
3790
+ "parameters": [
3791
+ {
3792
+ "name": "limit",
3793
+ "in": "query",
3794
+ "required": false,
3795
+ "description": "Page size. Values above 100 are clamped to 100.",
3796
+ "schema": {
3797
+ "type": "integer",
3798
+ "minimum": 1,
3799
+ "default": 50
3800
+ }
3801
+ },
3802
+ {
3803
+ "name": "cursor",
3804
+ "in": "query",
3805
+ "required": false,
3806
+ "description": "Opaque cursor from a prior page's `next_cursor`.",
3807
+ "schema": {
3808
+ "type": "string"
3809
+ }
3810
+ }
3811
+ ],
3812
+ "responses": {
3813
+ "200": {
3814
+ "description": "Import jobs",
3815
+ "content": {
3816
+ "application/json": {
3817
+ "schema": {
3818
+ "$ref": "#/components/schemas/ErpImportList"
3819
+ }
3820
+ }
3821
+ }
3822
+ },
3823
+ "400": {
3824
+ "$ref": "#/components/responses/BadRequest"
3825
+ },
3826
+ "403": {
3827
+ "$ref": "#/components/responses/Forbidden"
3828
+ },
3829
+ "500": {
3830
+ "$ref": "#/components/responses/InternalServerError"
3831
+ }
3832
+ }
3833
+ }
3834
+ },
3835
+ "/v2/erp/imports/{importId}": {
3836
+ "get": {
3837
+ "operationId": "getErpImport",
3838
+ "summary": "getErpImport",
3839
+ "description": "Get a pricing-file import job (status, counts, result links).",
3840
+ "tags": [
3841
+ "erp-imports"
3842
+ ],
3843
+ "parameters": [
3844
+ {
3845
+ "name": "importId",
3846
+ "in": "path",
3847
+ "required": true,
3848
+ "schema": {
3849
+ "type": "string"
3850
+ }
3851
+ }
3852
+ ],
3853
+ "responses": {
3854
+ "200": {
3855
+ "description": "The import job",
3856
+ "content": {
3857
+ "application/json": {
3858
+ "schema": {
3859
+ "$ref": "#/components/schemas/ErpImportJob"
3860
+ }
3861
+ }
3862
+ }
3863
+ },
3864
+ "403": {
3865
+ "$ref": "#/components/responses/Forbidden"
3866
+ },
3867
+ "404": {
3868
+ "$ref": "#/components/responses/NotFound"
3869
+ },
3870
+ "500": {
3871
+ "$ref": "#/components/responses/InternalServerError"
3872
+ }
3873
+ }
3874
+ }
3875
+ },
3876
+ "/v2/erp/imports/{importId}:execute": {
3877
+ "post": {
3878
+ "operationId": "executeErpImport",
3879
+ "summary": "executeErpImport",
3880
+ "description": "Confirm and run the write phase of a validated import. Only a READY job may be executed; any other status returns 409.",
3881
+ "tags": [
3882
+ "erp-imports"
3883
+ ],
3884
+ "parameters": [
3885
+ {
3886
+ "name": "importId",
3887
+ "in": "path",
3888
+ "required": true,
3889
+ "schema": {
3890
+ "type": "string"
3891
+ }
3892
+ }
3893
+ ],
3894
+ "responses": {
3895
+ "200": {
3896
+ "description": "Execution started",
3897
+ "content": {
3898
+ "application/json": {
3899
+ "schema": {
3900
+ "$ref": "#/components/schemas/ErpImportJob"
3901
+ }
3902
+ }
3903
+ }
3904
+ },
3905
+ "403": {
3906
+ "$ref": "#/components/responses/Forbidden"
3907
+ },
3908
+ "404": {
3909
+ "$ref": "#/components/responses/NotFound"
3910
+ },
3911
+ "409": {
3912
+ "$ref": "#/components/responses/Conflict"
3913
+ },
3914
+ "500": {
3915
+ "$ref": "#/components/responses/InternalServerError"
3916
+ }
3917
+ }
3918
+ }
3919
+ },
3920
+ "/v2/erp/imports/{importId}:abort": {
3921
+ "post": {
3922
+ "operationId": "abortErpImport",
3923
+ "summary": "abortErpImport",
3924
+ "description": "Ask a running import to stop. Valid while the job is VALIDATING or PROCESSING; any other status returns 409.\nThe stop is cooperative: the job passes through CANCELLING and typically reaches CANCELLED within seconds.\nRows already published to the platform are **kept**: this is a stop, not a rollback. Aborting during VALIDATING has published nothing, so it is always clean; aborting during PROCESSING leaves a partial import, and the rows that landed are visible in monitoring under the job's correlation_id.",
3925
+ "tags": [
3926
+ "erp-imports"
3927
+ ],
3928
+ "parameters": [
3929
+ {
3930
+ "name": "importId",
3931
+ "in": "path",
3932
+ "required": true,
3933
+ "schema": {
3934
+ "type": "string"
3935
+ }
3936
+ }
3937
+ ],
3938
+ "responses": {
3939
+ "202": {
3940
+ "description": "The stop was recorded. The job is still finishing up — poll GET /v2/erp/imports/{importId} to observe CANCELLED.",
3941
+ "content": {
3942
+ "application/json": {
3943
+ "schema": {
3944
+ "$ref": "#/components/schemas/ErpImportJob"
3945
+ }
3946
+ }
3947
+ }
3948
+ },
3949
+ "403": {
3950
+ "$ref": "#/components/responses/Forbidden"
3951
+ },
3952
+ "404": {
3953
+ "$ref": "#/components/responses/NotFound"
3954
+ },
3955
+ "409": {
3956
+ "$ref": "#/components/responses/Conflict"
3957
+ },
3958
+ "500": {
3959
+ "$ref": "#/components/responses/InternalServerError"
3960
+ }
3961
+ }
3962
+ }
3738
3963
  }
3739
3964
  },
3740
3965
  "components": {
@@ -3747,6 +3972,219 @@
3747
3972
  }
3748
3973
  },
3749
3974
  "schemas": {
3975
+ "S3Reference": {
3976
+ "type": "object",
3977
+ "required": [
3978
+ "bucket",
3979
+ "key"
3980
+ ],
3981
+ "properties": {
3982
+ "bucket": {
3983
+ "type": "string"
3984
+ },
3985
+ "key": {
3986
+ "type": "string"
3987
+ }
3988
+ }
3989
+ },
3990
+ "CreateErpImportRequest": {
3991
+ "type": "object",
3992
+ "required": [
3993
+ "s3_reference",
3994
+ "integration_id"
3995
+ ],
3996
+ "properties": {
3997
+ "s3_reference": {
3998
+ "$ref": "#/components/schemas/S3Reference"
3999
+ },
4000
+ "integration_id": {
4001
+ "type": "string"
4002
+ },
4003
+ "use_case_slug": {
4004
+ "type": "string"
4005
+ }
4006
+ }
4007
+ },
4008
+ "ErpImportValidation": {
4009
+ "type": "object",
4010
+ "description": "Validate-phase summary: what the file will create, and whether it may be confirmed. Absent until the validate phase completes. No per-row detail is kept — a rejected file is corrected and imported again.",
4011
+ "required": [
4012
+ "total_rows",
4013
+ "blocking",
4014
+ "warnings",
4015
+ "entities"
4016
+ ],
4017
+ "properties": {
4018
+ "total_rows": {
4019
+ "type": "integer",
4020
+ "description": "Data rows read from the file."
4021
+ },
4022
+ "blocking": {
4023
+ "type": "integer"
4024
+ },
4025
+ "warnings": {
4026
+ "type": "integer"
4027
+ },
4028
+ "entities": {
4029
+ "type": "object",
4030
+ "additionalProperties": {
4031
+ "type": "integer"
4032
+ },
4033
+ "description": "Distinct entities the file expresses, keyed by entity slug."
4034
+ }
4035
+ }
4036
+ },
4037
+ "ErpImportProgress": {
4038
+ "type": "object",
4039
+ "description": "How far the currently running phase has got. Written at every batch boundary, so it advances during long runs rather than only at the end.\n`total_rows` is ABSENT during the validate phase until the file has been read to the end — there is deliberately no counting pass, since that would be a second unbounded read of the whole file. Render an indeterminate indicator while it is missing: dividing by a missing total yields a determinate bar pinned at 0%, which reads as a hung import.",
4040
+ "required": [
4041
+ "processed_rows"
4042
+ ],
4043
+ "properties": {
4044
+ "processed_rows": {
4045
+ "type": "integer",
4046
+ "description": "Rows fully processed. An exact \"the first N rows are done\" watermark, not an estimate — it only advances once a batch has been completely handled."
4047
+ },
4048
+ "total_rows": {
4049
+ "type": "integer",
4050
+ "description": "Rows in the file. Known only once a phase has read to EOF; the execute phase has it from the start, because validate recorded it first."
4051
+ }
4052
+ }
4053
+ },
4054
+ "ErpImportError": {
4055
+ "type": "object",
4056
+ "description": "Why the import failed — present if and only if status = FAILED.",
4057
+ "required": [
4058
+ "type",
4059
+ "message"
4060
+ ],
4061
+ "properties": {
4062
+ "type": {
4063
+ "type": "string",
4064
+ "description": "VALIDATION_BLOCKED = blocking row issues (see `validation`); PROCESSING_ERROR = a named, deterministic failure — retrying the same file cannot help; INTERNAL_ERROR = crashed or never started, so retry.",
4065
+ "enum": [
4066
+ "VALIDATION_BLOCKED",
4067
+ "PROCESSING_ERROR",
4068
+ "INTERNAL_ERROR"
4069
+ ]
4070
+ },
4071
+ "message": {
4072
+ "type": "string",
4073
+ "description": "User-facing explanation of `type`."
4074
+ }
4075
+ }
4076
+ },
4077
+ "CreateErpImportResponse": {
4078
+ "type": "object",
4079
+ "required": [
4080
+ "import_id"
4081
+ ],
4082
+ "properties": {
4083
+ "import_id": {
4084
+ "type": "string",
4085
+ "description": "`imp_{ULID}` — time-ordered, also used as the job's correlation_id."
4086
+ }
4087
+ }
4088
+ },
4089
+ "ErpImportJob": {
4090
+ "type": "object",
4091
+ "required": [
4092
+ "import_id",
4093
+ "org_id",
4094
+ "integration_id",
4095
+ "format",
4096
+ "status",
4097
+ "s3_input_ref",
4098
+ "created_at",
4099
+ "updated_at"
4100
+ ],
4101
+ "properties": {
4102
+ "import_id": {
4103
+ "type": "string",
4104
+ "description": "`imp_{ULID}` — time-ordered, also used as the job's correlation_id."
4105
+ },
4106
+ "org_id": {
4107
+ "type": "string"
4108
+ },
4109
+ "created_by": {
4110
+ "type": "string"
4111
+ },
4112
+ "integration_id": {
4113
+ "type": "string"
4114
+ },
4115
+ "use_case_slug": {
4116
+ "type": "string",
4117
+ "description": "The inbound use case whose mapping drives both phases."
4118
+ },
4119
+ "format": {
4120
+ "type": "string",
4121
+ "enum": [
4122
+ "csv",
4123
+ "xlsx"
4124
+ ]
4125
+ },
4126
+ "status": {
4127
+ "type": "string",
4128
+ "description": "PENDING → VALIDATING → READY → PROCESSING → IMPORTED, with FAILED reachable from any working status, and CANCELLING → CANCELLED reachable from VALIDATING or PROCESSING via :abort. IMPORTED, FAILED and CANCELLED are terminal and final.\nIMPORTED means every row was handed to the platform, not that the platform finished — per-row outcomes live in monitoring, filtered by correlation_id. A file that fails validation is FAILED with error.type = VALIDATION_BLOCKED.\nREADY is legitimately idle for as long as the user takes to confirm, so it carries no running work and never goes stale.\nCANCELLING is transient and cooperative: the abort has been recorded but the worker only notices at its next batch boundary. Rows already published stay published — a stop is not a rollback.",
4129
+ "enum": [
4130
+ "PENDING",
4131
+ "VALIDATING",
4132
+ "READY",
4133
+ "PROCESSING",
4134
+ "IMPORTED",
4135
+ "FAILED",
4136
+ "CANCELLING",
4137
+ "CANCELLED"
4138
+ ]
4139
+ },
4140
+ "s3_input_ref": {
4141
+ "$ref": "#/components/schemas/S3Reference"
4142
+ },
4143
+ "validation": {
4144
+ "$ref": "#/components/schemas/ErpImportValidation"
4145
+ },
4146
+ "progress": {
4147
+ "$ref": "#/components/schemas/ErpImportProgress"
4148
+ },
4149
+ "error": {
4150
+ "$ref": "#/components/schemas/ErpImportError"
4151
+ },
4152
+ "correlation_id": {
4153
+ "type": "string",
4154
+ "description": "Scopes this run in monitoring. Always equal to `import_id`."
4155
+ },
4156
+ "activity_id": {
4157
+ "type": "string"
4158
+ },
4159
+ "created_at": {
4160
+ "type": "string",
4161
+ "format": "date-time"
4162
+ },
4163
+ "updated_at": {
4164
+ "type": "string",
4165
+ "format": "date-time"
4166
+ }
4167
+ }
4168
+ },
4169
+ "ErpImportList": {
4170
+ "type": "object",
4171
+ "required": [
4172
+ "results"
4173
+ ],
4174
+ "properties": {
4175
+ "results": {
4176
+ "type": "array",
4177
+ "items": {
4178
+ "$ref": "#/components/schemas/ErpImportJob"
4179
+ }
4180
+ },
4181
+ "next_cursor": {
4182
+ "type": "string",
4183
+ "nullable": true,
4184
+ "description": "Cursor for the next page, or null when there are no more rows."
4185
+ }
4186
+ }
4187
+ },
3750
4188
  "NotificationHistoryItem": {
3751
4189
  "type": "object",
3752
4190
  "description": "A single notification-history row (one real notification decision).",
@@ -9921,6 +10359,16 @@
9921
10359
  }
9922
10360
  }
9923
10361
  },
10362
+ "Conflict": {
10363
+ "description": "Conflict - the resource is not in a state that allows this operation",
10364
+ "content": {
10365
+ "application/json": {
10366
+ "schema": {
10367
+ "$ref": "#/components/schemas/ErrorResponseBase"
10368
+ }
10369
+ }
10370
+ }
10371
+ },
9924
10372
  "InternalServerError": {
9925
10373
  "description": "Internal Server Error",
9926
10374
  "content": {
@@ -10100,7 +10548,7 @@
10100
10548
  }
10101
10549
  },
10102
10550
  "ReplayEventsResponse": {
10103
- "description": "Events replay initiated",
10551
+ "description": "Events replay initiated. Always 200 — per-event outcomes are reported in `results`, so inspect it (or compare `replayed` against the number of requested ids) rather than treating the status code as success.\n",
10104
10552
  "content": {
10105
10553
  "application/json": {
10106
10554
  "schema": {
@@ -10110,6 +10558,48 @@
10110
10558
  "results"
10111
10559
  ],
10112
10560
  "properties": {
10561
+ "replayed": {
10562
+ "type": "integer",
10563
+ "description": "Number of events actually queued for re-processing.",
10564
+ "example": 2
10565
+ },
10566
+ "results": {
10567
+ "type": "array",
10568
+ "description": "One entry per requested event id, in request order.",
10569
+ "items": {
10570
+ "type": "object",
10571
+ "required": [
10572
+ "event_id",
10573
+ "status"
10574
+ ],
10575
+ "properties": {
10576
+ "event_id": {
10577
+ "type": "string",
10578
+ "description": "The requested (source) event ID."
10579
+ },
10580
+ "status": {
10581
+ "type": "string",
10582
+ "enum": [
10583
+ "success",
10584
+ "queued",
10585
+ "skipped",
10586
+ "ignored",
10587
+ "not_found",
10588
+ "error"
10589
+ ],
10590
+ "description": "Outcome for this event. `success`/`queued` means it was enqueued for re-processing. `not_found` means no inbound event with that ID exists for the organization. `skipped` means it was deduplicated, `ignored` means no enabled use case matched it, and `error` means it could not be queued (see `message`).\n"
10591
+ },
10592
+ "replay_event_id": {
10593
+ "type": "string",
10594
+ "description": "The new event ID assigned to the replayed event. Use it to follow the replay in monitoring.\n"
10595
+ },
10596
+ "message": {
10597
+ "type": "string",
10598
+ "description": "Human-readable detail for this outcome."
10599
+ }
10600
+ }
10601
+ }
10602
+ },
10113
10603
  "event_ids": {
10114
10604
  "type": "array",
10115
10605
  "items": {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  API_LIST
4
- } from "../chunk-CQ2AI324.js";
4
+ } from "../chunk-MDWPNAOH.js";
5
5
 
6
6
  // bin/epilot.ts
7
7
  import { runMain } from "citty";
@@ -11,7 +11,7 @@ import { defineCommand } from "citty";
11
11
  var main = defineCommand({
12
12
  meta: {
13
13
  name: "epilot",
14
- version: "0.1.90",
14
+ version: "0.1.91",
15
15
  description: "CLI for epilot APIs"
16
16
  },
17
17
  args: {
@@ -30,8 +30,8 @@ var main = defineCommand({
30
30
  auth: () => import("../auth-4HG7B2GC.js").then((m) => m.default),
31
31
  profile: () => import("../profile-OZJL5ZPT.js").then((m) => m.default),
32
32
  config: () => import("../config-DGZIMLZK.js").then((m) => m.default),
33
- completion: () => import("../completion-N4BE6543.js").then((m) => m.default),
34
- upgrade: () => import("../upgrade-VGR6IELC.js").then((m) => m.default),
33
+ completion: () => import("../completion-5ZPLEFT7.js").then((m) => m.default),
34
+ upgrade: () => import("../upgrade-S7WKPMSU.js").then((m) => m.default),
35
35
  "access-token": () => import("../access-token-WWE6BDJH.js").then((m) => m.default),
36
36
  address: () => import("../address-EH3C4CVB.js").then((m) => m.default),
37
37
  "address-suggestions": () => import("../address-suggestions-RRSLOBFW.js").then((m) => m.default),
@@ -134,13 +134,13 @@ process.stderr.on("error", (err) => {
134
134
  if (err.code === "EPIPE") process.exit(0);
135
135
  throw err;
136
136
  });
137
- var VERSION = true ? "0.1.90" : (await null).default.version;
137
+ var VERSION = true ? "0.1.91" : (await null).default.version;
138
138
  var reorderedArgv = hoistFlagsAfterSubcommand(process.argv.slice(2));
139
139
  process.argv = [process.argv[0], process.argv[1], ...reorderedArgv];
140
140
  var args = process.argv.slice(2);
141
141
  var completionsIdx = args.indexOf("--_completions");
142
142
  if (completionsIdx >= 0) {
143
- const { handleCompletions } = await import("../completion-N4BE6543.js");
143
+ const { handleCompletions } = await import("../completion-5ZPLEFT7.js");
144
144
  handleCompletions(args[completionsIdx + 1], args[completionsIdx + 2]);
145
145
  process.exit(0);
146
146
  }
@@ -817,7 +817,7 @@ var API_LIST = [
817
817
  kebabName: "integration-toolkit",
818
818
  title: "Integration Toolkit API",
819
819
  serverUrl: "https://integration-toolkit.sls.epilot.io",
820
- operationCount: 56,
820
+ operationCount: 61,
821
821
  operationIds: [
822
822
  "acknowledgeTracking",
823
823
  "triggerErp",
@@ -874,7 +874,12 @@ var API_LIST = [
874
874
  "managedCallExecute",
875
875
  "generateTypesPreview",
876
876
  "generateTypes",
877
- "commitTypes"
877
+ "commitTypes",
878
+ "listErpImports",
879
+ "createErpImport",
880
+ "getErpImport",
881
+ "executeErpImport",
882
+ "abortErpImport"
878
883
  ]
879
884
  },
880
885
  {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  API_LIST
4
- } from "./chunk-CQ2AI324.js";
4
+ } from "./chunk-MDWPNAOH.js";
5
5
  import {
6
6
  DIM,
7
7
  GREEN,
@@ -72,7 +72,7 @@ ${GREEN}${BOLD}Upgraded to @epilot/cli@${latest}${RESET}
72
72
  }
73
73
  });
74
74
  var getCurrentVersion = () => {
75
- if (true) return "0.1.90";
75
+ if (true) return "0.1.91";
76
76
  try {
77
77
  const output = execSync("npm ls -g @epilot/cli --depth=0 --json 2>/dev/null", {
78
78
  encoding: "utf-8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/cli",
3
- "version": "0.1.90",
3
+ "version": "0.1.91",
4
4
  "description": "CLI for epilot APIs",
5
5
  "type": "module",
6
6
  "bin": {