@hardfin/cli 0.0.2-dev.7 → 0.0.2-dev.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.
- package/README.md +20 -8
- package/dist/cli.js +168 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ Most commands are generated from the published API document rather than written
|
|
|
31
31
|
| `hardfin api` | A call to any endpoint, written by hand, and the escape hatch when no generated command fits |
|
|
32
32
|
| `src/command/surface.generated.ts` | Every endpoint as a command, rewritten by the generator |
|
|
33
33
|
| `surface-overrides.json` | The operations whose generated name is wrong |
|
|
34
|
+
| `spec/core.openapi.yaml` | The API document the generator reads, vendored here |
|
|
34
35
|
| `scripts/generate-surface.mjs` | The generator |
|
|
35
36
|
|
|
36
37
|
### How an endpoint becomes a command
|
|
@@ -70,20 +71,31 @@ Settle it in `surface-overrides.json`, keyed by `operationId`:
|
|
|
70
71
|
An override for an `operationId` the document no longer publishes fails the generator. That
|
|
71
72
|
is deliberate, because a silently dropped override renames a command nobody meant to rename.
|
|
72
73
|
|
|
73
|
-
###
|
|
74
|
+
### The vendored document
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
the generated file changes. It needs the `API_SPEC_READ_DEPLOY_KEY` secret.
|
|
76
|
+
`spec/core.openapi.yaml` is the API document this repository carries, and the generator
|
|
77
|
+
reads it. Nothing fetches a document during a build, a release, or CI.
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
Refresh it with the script, which then rewrites the generated commands:
|
|
80
80
|
|
|
81
81
|
```sh
|
|
82
|
-
|
|
82
|
+
scripts/update-spec.sh # reads hardfinhq/api-spec over your own git access
|
|
83
|
+
scripts/update-spec.sh ../hardfin # bundles the fragmented source in a monorepo checkout
|
|
83
84
|
```
|
|
84
85
|
|
|
85
|
-
The
|
|
86
|
-
|
|
86
|
+
The monorepo form runs the same bundler at the same version CI uses, so the result matches
|
|
87
|
+
what the api-spec bridge publishes. Commit the document and the generated commands together.
|
|
88
|
+
|
|
89
|
+
Two checks keep the pair honest.
|
|
90
|
+
|
|
91
|
+
| Check | Refuses |
|
|
92
|
+
| --- | --- |
|
|
93
|
+
| The generator | a document whose `info.version` is not a date, which means an earlier release |
|
|
94
|
+
| CI | a vendored document that was updated without regenerating the commands |
|
|
95
|
+
|
|
96
|
+
The first one matters because `hardfinhq/api-spec` can sit a release behind the monorepo
|
|
97
|
+
while its bridge pull request is open. Generating from that document would replace the
|
|
98
|
+
current commands with an earlier API's.
|
|
87
99
|
|
|
88
100
|
## Local configuration
|
|
89
101
|
|
package/dist/cli.js
CHANGED
|
@@ -765,6 +765,44 @@ const commands = [
|
|
|
765
765
|
queryFlags: [],
|
|
766
766
|
takesBody: true
|
|
767
767
|
}),
|
|
768
|
+
{
|
|
769
|
+
name: "move",
|
|
770
|
+
summary: "Move commands",
|
|
771
|
+
arguments: [],
|
|
772
|
+
flags: [],
|
|
773
|
+
examples: [],
|
|
774
|
+
subcommands: [{
|
|
775
|
+
name: "execute",
|
|
776
|
+
summary: "Execute commands",
|
|
777
|
+
arguments: [],
|
|
778
|
+
flags: [],
|
|
779
|
+
examples: [],
|
|
780
|
+
subcommands: [defineOperation({
|
|
781
|
+
name: "create",
|
|
782
|
+
summary: "Execute asset move",
|
|
783
|
+
method: "POST",
|
|
784
|
+
path: "/asset/move/execute",
|
|
785
|
+
pathParameters: [],
|
|
786
|
+
queryFlags: [],
|
|
787
|
+
takesBody: true
|
|
788
|
+
})]
|
|
789
|
+
}, {
|
|
790
|
+
name: "plan",
|
|
791
|
+
summary: "Plan commands",
|
|
792
|
+
arguments: [],
|
|
793
|
+
flags: [],
|
|
794
|
+
examples: [],
|
|
795
|
+
subcommands: [defineOperation({
|
|
796
|
+
name: "create",
|
|
797
|
+
summary: "Plan asset move",
|
|
798
|
+
method: "POST",
|
|
799
|
+
path: "/asset/move/plan",
|
|
800
|
+
pathParameters: [],
|
|
801
|
+
queryFlags: [],
|
|
802
|
+
takesBody: true
|
|
803
|
+
})]
|
|
804
|
+
}]
|
|
805
|
+
},
|
|
768
806
|
defineOperation({
|
|
769
807
|
name: "get",
|
|
770
808
|
summary: "Get asset",
|
|
@@ -850,6 +888,74 @@ const commands = [
|
|
|
850
888
|
takesBody: true
|
|
851
889
|
})]
|
|
852
890
|
},
|
|
891
|
+
{
|
|
892
|
+
name: "event",
|
|
893
|
+
summary: "Event commands",
|
|
894
|
+
arguments: [],
|
|
895
|
+
flags: [],
|
|
896
|
+
examples: [],
|
|
897
|
+
subcommands: [defineOperation({
|
|
898
|
+
name: "list",
|
|
899
|
+
summary: "Get asset event list",
|
|
900
|
+
method: "GET",
|
|
901
|
+
path: "/asset/{assetKey}/event",
|
|
902
|
+
pathParameters: [{
|
|
903
|
+
name: "assetKey",
|
|
904
|
+
description: "The asset's key",
|
|
905
|
+
required: true
|
|
906
|
+
}],
|
|
907
|
+
queryFlags: [],
|
|
908
|
+
takesBody: false
|
|
909
|
+
})]
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
name: "event-group",
|
|
913
|
+
summary: "Event group commands",
|
|
914
|
+
arguments: [],
|
|
915
|
+
flags: [],
|
|
916
|
+
examples: [],
|
|
917
|
+
subcommands: [defineOperation({
|
|
918
|
+
name: "list",
|
|
919
|
+
summary: "Get asset event group listing",
|
|
920
|
+
method: "GET",
|
|
921
|
+
path: "/asset/{assetKey}/event-group",
|
|
922
|
+
pathParameters: [{
|
|
923
|
+
name: "assetKey",
|
|
924
|
+
description: "The asset's key",
|
|
925
|
+
required: true
|
|
926
|
+
}],
|
|
927
|
+
queryFlags: [{
|
|
928
|
+
name: "start",
|
|
929
|
+
queryName: "start",
|
|
930
|
+
description: "The earliest an event group may have happened, or null to read from the first",
|
|
931
|
+
valueName: "value",
|
|
932
|
+
schema: z.string()
|
|
933
|
+
}, {
|
|
934
|
+
name: "end",
|
|
935
|
+
queryName: "end",
|
|
936
|
+
description: "The latest an event group may have happened, or null to read through the last",
|
|
937
|
+
valueName: "value",
|
|
938
|
+
schema: z.string()
|
|
939
|
+
}],
|
|
940
|
+
takesBody: false
|
|
941
|
+
}), defineOperation({
|
|
942
|
+
name: "get",
|
|
943
|
+
summary: "Get asset event group",
|
|
944
|
+
method: "GET",
|
|
945
|
+
path: "/asset/{assetKey}/event-group/{eventGroupKey}",
|
|
946
|
+
pathParameters: [{
|
|
947
|
+
name: "assetKey",
|
|
948
|
+
description: "The asset's key",
|
|
949
|
+
required: true
|
|
950
|
+
}, {
|
|
951
|
+
name: "eventGroupKey",
|
|
952
|
+
description: "The event group's key",
|
|
953
|
+
required: true
|
|
954
|
+
}],
|
|
955
|
+
queryFlags: [],
|
|
956
|
+
takesBody: false
|
|
957
|
+
})]
|
|
958
|
+
},
|
|
853
959
|
{
|
|
854
960
|
name: "file",
|
|
855
961
|
summary: "File commands",
|
|
@@ -886,6 +992,26 @@ const commands = [
|
|
|
886
992
|
takesBody: false
|
|
887
993
|
})]
|
|
888
994
|
},
|
|
995
|
+
{
|
|
996
|
+
name: "functional-status",
|
|
997
|
+
summary: "Functional status commands",
|
|
998
|
+
arguments: [],
|
|
999
|
+
flags: [],
|
|
1000
|
+
examples: [],
|
|
1001
|
+
subcommands: [defineOperation({
|
|
1002
|
+
name: "list",
|
|
1003
|
+
summary: "Get asset functional status history",
|
|
1004
|
+
method: "GET",
|
|
1005
|
+
path: "/asset/{assetKey}/functional-status",
|
|
1006
|
+
pathParameters: [{
|
|
1007
|
+
name: "assetKey",
|
|
1008
|
+
description: "The asset's key",
|
|
1009
|
+
required: true
|
|
1010
|
+
}],
|
|
1011
|
+
queryFlags: [],
|
|
1012
|
+
takesBody: false
|
|
1013
|
+
})]
|
|
1014
|
+
},
|
|
889
1015
|
{
|
|
890
1016
|
name: "ownership",
|
|
891
1017
|
summary: "Ownership commands",
|
|
@@ -985,6 +1111,46 @@ const commands = [
|
|
|
985
1111
|
})
|
|
986
1112
|
]
|
|
987
1113
|
},
|
|
1114
|
+
{
|
|
1115
|
+
name: "scrap",
|
|
1116
|
+
summary: "Scrap commands",
|
|
1117
|
+
arguments: [],
|
|
1118
|
+
flags: [],
|
|
1119
|
+
examples: [],
|
|
1120
|
+
subcommands: [defineOperation({
|
|
1121
|
+
name: "create",
|
|
1122
|
+
summary: "Scrap asset",
|
|
1123
|
+
method: "POST",
|
|
1124
|
+
path: "/asset/{assetKey}/scrap",
|
|
1125
|
+
pathParameters: [{
|
|
1126
|
+
name: "assetKey",
|
|
1127
|
+
description: "The asset's key",
|
|
1128
|
+
required: true
|
|
1129
|
+
}],
|
|
1130
|
+
queryFlags: [],
|
|
1131
|
+
takesBody: true
|
|
1132
|
+
})]
|
|
1133
|
+
},
|
|
1134
|
+
{
|
|
1135
|
+
name: "unscrap",
|
|
1136
|
+
summary: "Unscrap commands",
|
|
1137
|
+
arguments: [],
|
|
1138
|
+
flags: [],
|
|
1139
|
+
examples: [],
|
|
1140
|
+
subcommands: [defineOperation({
|
|
1141
|
+
name: "create",
|
|
1142
|
+
summary: "Unscrap asset",
|
|
1143
|
+
method: "POST",
|
|
1144
|
+
path: "/asset/{assetKey}/unscrap",
|
|
1145
|
+
pathParameters: [{
|
|
1146
|
+
name: "assetKey",
|
|
1147
|
+
description: "The asset's key",
|
|
1148
|
+
required: true
|
|
1149
|
+
}],
|
|
1150
|
+
queryFlags: [],
|
|
1151
|
+
takesBody: false
|
|
1152
|
+
})]
|
|
1153
|
+
},
|
|
988
1154
|
{
|
|
989
1155
|
name: "url-link",
|
|
990
1156
|
summary: "URL link commands",
|
|
@@ -1186,9 +1352,8 @@ const commands = [
|
|
|
1186
1352
|
queryFlags: [{
|
|
1187
1353
|
name: "attachment",
|
|
1188
1354
|
queryName: "attachment",
|
|
1189
|
-
description: "
|
|
1190
|
-
|
|
1191
|
-
schema: z.string()
|
|
1355
|
+
description: "True when the file downloads as an attachment rather than opening inline",
|
|
1356
|
+
schema: z.boolean()
|
|
1192
1357
|
}],
|
|
1193
1358
|
takesBody: false
|
|
1194
1359
|
})]
|