@usestatemachines/sdk 0.4.0 → 0.5.0

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 (81) hide show
  1. package/README.md +59 -6
  2. package/agents/index.js +2 -2
  3. package/agents/llms.txt +3 -2
  4. package/esm/extensions/client.d.ts +16 -4
  5. package/esm/extensions/client.js +17 -4
  6. package/esm/extensions/index.d.ts +2 -2
  7. package/esm/extensions/running-environment.d.ts +5 -5
  8. package/esm/extensions/running-environment.js +1 -1
  9. package/esm/extensions/wait.js +1 -1
  10. package/esm/funcs/{get-environment-exchange.d.ts → environments-get-request-payload.d.ts} +1 -1
  11. package/esm/funcs/environments-get-request-payload.js +100 -0
  12. package/esm/funcs/environments-get-request-stats.d.ts +11 -0
  13. package/esm/funcs/{get-environment-position.js → environments-get-request-stats.js} +17 -6
  14. package/esm/funcs/{list-environment-history.d.ts → environments-get-request.d.ts} +1 -1
  15. package/esm/funcs/{get-environment-exchange.js → environments-get-request.js} +6 -6
  16. package/esm/funcs/{get-environment-position.d.ts → environments-list-requests.d.ts} +1 -1
  17. package/esm/funcs/{list-environment-history.js → environments-list-requests.js} +13 -5
  18. package/esm/funcs/environments-resume.js +1 -0
  19. package/esm/funcs/environments-stop.js +1 -0
  20. package/esm/funcs/environments-suspend.js +1 -0
  21. package/esm/lib/config.d.ts +2 -2
  22. package/esm/lib/config.js +2 -2
  23. package/esm/models/environment-app.d.ts +0 -8
  24. package/esm/models/environment-app.js +0 -10
  25. package/esm/models/environment-request-detail.d.ts +40 -0
  26. package/esm/models/environment-request-detail.js +39 -0
  27. package/esm/models/environment-request-stats.d.ts +26 -0
  28. package/esm/models/environment-request-stats.js +31 -0
  29. package/esm/models/environment-request.d.ts +31 -0
  30. package/esm/models/environment-request.js +34 -0
  31. package/esm/models/error-response.d.ts +0 -1
  32. package/esm/models/error-response.js +0 -1
  33. package/esm/models/index.d.ts +4 -6
  34. package/esm/models/index.js +4 -6
  35. package/esm/models/operations/create-environment-definition.d.ts +10 -82
  36. package/esm/models/operations/create-environment-definition.js +4 -60
  37. package/esm/models/operations/get-environment-request-payload.d.ts +23 -0
  38. package/esm/models/operations/get-environment-request-payload.js +19 -0
  39. package/esm/models/operations/get-environment-request-stats.d.ts +70 -0
  40. package/esm/models/operations/get-environment-request-stats.js +55 -0
  41. package/esm/models/operations/get-environment-request.d.ts +25 -0
  42. package/esm/models/operations/get-environment-request.js +21 -0
  43. package/esm/models/operations/index.d.ts +4 -3
  44. package/esm/models/operations/index.js +4 -3
  45. package/esm/models/operations/list-environment-requests.d.ts +75 -0
  46. package/esm/models/operations/list-environment-requests.js +59 -0
  47. package/esm/models/operations/resume-environment.d.ts +2 -0
  48. package/esm/models/operations/resume-environment.js +8 -2
  49. package/esm/models/operations/stop-environment.d.ts +2 -0
  50. package/esm/models/operations/stop-environment.js +8 -2
  51. package/esm/models/operations/suspend-environment.d.ts +2 -0
  52. package/esm/models/operations/suspend-environment.js +8 -2
  53. package/esm/models/request-payload-preview.d.ts +31 -0
  54. package/esm/models/request-payload-preview.js +33 -0
  55. package/esm/sdk/environments.d.ts +4 -0
  56. package/esm/sdk/environments.js +16 -0
  57. package/esm/sdk/sdk.d.ts +0 -3
  58. package/esm/sdk/sdk.js +0 -12
  59. package/esm/types/smart-union.js +1 -2
  60. package/openapi.json +584 -524
  61. package/package.json +2 -2
  62. package/esm/models/environment-exchange.d.ts +0 -116
  63. package/esm/models/environment-exchange.js +0 -126
  64. package/esm/models/environment-position.d.ts +0 -25
  65. package/esm/models/environment-position.js +0 -32
  66. package/esm/models/history-body.d.ts +0 -28
  67. package/esm/models/history-body.js +0 -33
  68. package/esm/models/history-cause.d.ts +0 -48
  69. package/esm/models/history-cause.js +0 -63
  70. package/esm/models/history-position.d.ts +0 -11
  71. package/esm/models/history-position.js +0 -15
  72. package/esm/models/history-transaction.d.ts +0 -16
  73. package/esm/models/history-transaction.js +0 -20
  74. package/esm/models/operations/get-environment-exchange.d.ts +0 -25
  75. package/esm/models/operations/get-environment-exchange.js +0 -21
  76. package/esm/models/operations/get-environment-position.d.ts +0 -23
  77. package/esm/models/operations/get-environment-position.js +0 -20
  78. package/esm/models/operations/list-environment-history.d.ts +0 -28
  79. package/esm/models/operations/list-environment-history.js +0 -24
  80. package/esm/types/discriminated-union.d.ts +0 -24
  81. package/esm/types/discriminated-union.js +0 -60
package/openapi.json CHANGED
@@ -573,20 +573,6 @@
573
573
  "format": "date-time",
574
574
  "type": ["string", "null"]
575
575
  },
576
- "forkedAt": {
577
- "default": null,
578
- "properties": {
579
- "generation": {
580
- "minimum": 1,
581
- "type": "integer"
582
- },
583
- "lsn": {
584
- "type": "string"
585
- }
586
- },
587
- "required": ["generation", "lsn"],
588
- "type": ["object", "null"]
589
- },
590
576
  "id": {
591
577
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
592
578
  "type": "string"
@@ -645,250 +631,197 @@
645
631
  ],
646
632
  "type": "object"
647
633
  },
648
- "EnvironmentExchange": {
634
+ "EnvironmentLifetime": {
649
635
  "properties": {
650
- "actor": {
651
- "properties": {
652
- "credentialId": {
653
- "type": ["string", "null"]
654
- },
655
- "vendorUserId": {
656
- "type": ["string", "null"]
657
- }
658
- },
659
- "required": ["vendorUserId", "credentialId"],
660
- "type": ["object", "null"]
661
- },
662
- "appKey": {
663
- "pattern": "^[a-z][a-z0-9-]{0,39}$",
664
- "type": "string"
665
- },
666
- "bodies": {
667
- "properties": {
668
- "request": {
669
- "$ref": "#/components/schemas/HistoryBody"
670
- },
671
- "response": {
672
- "$ref": "#/components/schemas/HistoryBody"
673
- }
674
- },
675
- "required": ["request", "response"],
676
- "type": ["object", "null"]
636
+ "defaultMinutes": {
637
+ "type": "integer"
677
638
  },
678
- "channel": {
679
- "enum": [
680
- "api",
681
- "ui",
682
- "reactor",
683
- "timer",
684
- "inbound-webhook",
685
- "bootstrap",
686
- "restore",
687
- null
688
- ],
639
+ "maximumMinutes": {
640
+ "type": "integer"
641
+ }
642
+ },
643
+ "required": ["defaultMinutes", "maximumMinutes"],
644
+ "type": "object"
645
+ },
646
+ "EnvironmentRequest": {
647
+ "properties": {
648
+ "appInstanceId": {
689
649
  "type": ["string", "null"]
690
650
  },
691
- "eventIds": {
692
- "items": {
693
- "type": "string"
694
- },
695
- "type": "array"
651
+ "appKey": {
652
+ "type": "string"
696
653
  },
697
- "exchangeId": {
698
- "maxLength": 128,
699
- "minLength": 1,
654
+ "completedAt": {
655
+ "format": "date-time",
700
656
  "type": "string"
701
657
  },
702
- "objectCount": {
658
+ "durationMs": {
659
+ "minimum": 0,
703
660
  "type": "integer"
704
661
  },
705
- "objects": {
706
- "items": {
707
- "type": "string"
708
- },
709
- "type": "array"
662
+ "environmentId": {
663
+ "type": "string"
710
664
  },
711
- "observedAt": {
712
- "format": "date-time",
665
+ "errorCode": {
666
+ "type": ["string", "null"]
667
+ },
668
+ "id": {
669
+ "format": "uuid",
713
670
  "type": "string"
714
671
  },
715
- "operation": {
716
- "properties": {
717
- "id": {
718
- "type": ["string", "null"]
719
- },
720
- "method": {
721
- "type": "string"
722
- },
723
- "profile": {
724
- "type": "string"
725
- },
726
- "route": {
727
- "type": "string"
728
- },
729
- "target": {
730
- "type": "string"
731
- }
732
- },
733
- "required": ["id", "profile", "method", "route", "target"],
734
- "type": ["object", "null"]
672
+ "method": {
673
+ "type": "string"
735
674
  },
736
675
  "outcome": {
737
- "properties": {
738
- "refusal": {
739
- "enum": [
740
- "auth",
741
- "not-served",
742
- "unsupported",
743
- "limit",
744
- "validation",
745
- "conflict",
746
- null
747
- ],
748
- "type": ["string", "null"]
749
- },
750
- "status": {
751
- "type": "integer"
752
- },
753
- "vendorErrorCode": {
754
- "type": ["string", "null"]
755
- }
756
- },
757
- "required": ["status", "vendorErrorCode", "refusal"],
758
- "type": ["object", "null"]
676
+ "enum": ["replica_response", "gateway_error"],
677
+ "type": "string"
759
678
  },
760
- "position": {
761
- "$ref": "#/components/schemas/HistoryPosition"
679
+ "path": {
680
+ "type": "string"
762
681
  },
763
- "state": {
764
- "enum": ["recorded", "unknown"],
682
+ "query": {
765
683
  "type": "string"
766
684
  },
767
- "timing": {
768
- "properties": {
769
- "clockSource": {
770
- "enum": ["gateway", "runner"],
771
- "type": "string"
772
- },
773
- "databaseMs": {
774
- "type": "number"
775
- },
776
- "environmentTime": {
777
- "type": "string"
778
- },
779
- "handlerMs": {
780
- "type": "number"
781
- },
782
- "leaseWaitMs": {
783
- "type": "number"
784
- },
785
- "responseReadyAt": {
786
- "type": "string"
787
- }
788
- },
789
- "required": [
790
- "clockSource",
791
- "leaseWaitMs",
792
- "handlerMs",
793
- "databaseMs",
794
- "responseReadyAt",
795
- "environmentTime"
796
- ],
797
- "type": ["object", "null"]
685
+ "receivedAt": {
686
+ "format": "date-time",
687
+ "type": "string"
798
688
  },
799
- "trace": {
800
- "properties": {
801
- "parentSpanId": {
802
- "type": ["string", "null"]
803
- },
804
- "spanId": {
805
- "type": "string"
806
- },
807
- "traceId": {
808
- "type": "string"
809
- }
810
- },
811
- "required": ["traceId", "parentSpanId", "spanId"],
812
- "type": ["object", "null"]
689
+ "requestBytes": {
690
+ "type": ["integer", "null"]
813
691
  },
814
- "transactions": {
815
- "items": {
816
- "$ref": "#/components/schemas/HistoryTransaction"
817
- },
818
- "type": "array"
692
+ "responseBytes": {
693
+ "type": ["integer", "null"]
694
+ },
695
+ "status": {
696
+ "type": "integer"
819
697
  }
820
698
  },
821
699
  "required": [
822
- "exchangeId",
700
+ "id",
701
+ "environmentId",
823
702
  "appKey",
824
- "state",
825
- "observedAt",
826
- "position",
827
- "channel",
828
- "operation",
703
+ "appInstanceId",
704
+ "method",
705
+ "path",
706
+ "query",
707
+ "receivedAt",
708
+ "completedAt",
709
+ "durationMs",
710
+ "status",
829
711
  "outcome",
830
- "actor",
831
- "trace",
832
- "timing",
833
- "bodies",
834
- "objects",
835
- "objectCount",
836
- "eventIds",
837
- "transactions"
712
+ "errorCode",
713
+ "requestBytes",
714
+ "responseBytes"
838
715
  ],
839
716
  "type": "object"
840
717
  },
841
- "EnvironmentLifetime": {
842
- "properties": {
843
- "defaultMinutes": {
844
- "type": "integer"
718
+ "EnvironmentRequestDetail": {
719
+ "allOf": [
720
+ {
721
+ "$ref": "#/components/schemas/EnvironmentRequest"
845
722
  },
846
- "maximumMinutes": {
847
- "type": "integer"
723
+ {
724
+ "properties": {
725
+ "requestBody": {
726
+ "$ref": "#/components/schemas/RequestPayloadPreview"
727
+ },
728
+ "requestHeaders": {
729
+ "additionalProperties": {
730
+ "type": "string"
731
+ },
732
+ "type": "object"
733
+ },
734
+ "responseBody": {
735
+ "$ref": "#/components/schemas/RequestPayloadPreview"
736
+ },
737
+ "responseHeaders": {
738
+ "additionalProperties": {
739
+ "type": "string"
740
+ },
741
+ "type": "object"
742
+ }
743
+ },
744
+ "required": [
745
+ "requestHeaders",
746
+ "responseHeaders",
747
+ "requestBody",
748
+ "responseBody"
749
+ ],
750
+ "type": "object"
848
751
  }
849
- },
850
- "required": ["defaultMinutes", "maximumMinutes"],
851
- "type": "object"
752
+ ]
852
753
  },
853
- "EnvironmentPosition": {
754
+ "EnvironmentRequestStats": {
854
755
  "properties": {
855
- "apps": {
756
+ "buckets": {
856
757
  "items": {
857
758
  "properties": {
858
- "appInstanceId": {
859
- "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
860
- "type": "string"
759
+ "clientError": {
760
+ "minimum": 0,
761
+ "type": "integer"
861
762
  },
862
- "key": {
863
- "pattern": "^[a-z][a-z0-9-]{0,39}$",
763
+ "from": {
764
+ "format": "date-time",
864
765
  "type": "string"
865
766
  },
866
- "position": {
867
- "properties": {
868
- "generation": {
869
- "minimum": 1,
870
- "type": "integer"
871
- },
872
- "lsn": {
873
- "pattern": "^[0-9A-F]{1,8}\\/[0-9A-F]{1,8}$",
874
- "type": "string"
875
- }
876
- },
877
- "required": ["generation", "lsn"],
878
- "type": ["object", "null"]
767
+ "serverError": {
768
+ "minimum": 0,
769
+ "type": "integer"
770
+ },
771
+ "success": {
772
+ "minimum": 0,
773
+ "type": "integer"
879
774
  }
880
775
  },
881
- "required": ["key", "appInstanceId", "position"],
776
+ "required": ["from", "success", "clientError", "serverError"],
882
777
  "type": "object"
883
778
  },
884
779
  "type": "array"
885
780
  },
886
- "environmentId": {
887
- "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
781
+ "clientErrorCount": {
782
+ "minimum": 0,
783
+ "type": "integer"
784
+ },
785
+ "count": {
786
+ "minimum": 0,
787
+ "type": "integer"
788
+ },
789
+ "from": {
790
+ "format": "date-time",
791
+ "type": "string"
792
+ },
793
+ "p50Ms": {
794
+ "minimum": 0,
795
+ "type": ["number", "null"]
796
+ },
797
+ "p95Ms": {
798
+ "minimum": 0,
799
+ "type": ["number", "null"]
800
+ },
801
+ "serverErrorCount": {
802
+ "minimum": 0,
803
+ "type": "integer"
804
+ },
805
+ "successCount": {
806
+ "minimum": 0,
807
+ "type": "integer"
808
+ },
809
+ "to": {
810
+ "format": "date-time",
888
811
  "type": "string"
889
812
  }
890
813
  },
891
- "required": ["environmentId", "apps"],
814
+ "required": [
815
+ "from",
816
+ "to",
817
+ "count",
818
+ "successCount",
819
+ "clientErrorCount",
820
+ "serverErrorCount",
821
+ "p50Ms",
822
+ "p95Ms",
823
+ "buckets"
824
+ ],
892
825
  "type": "object"
893
826
  },
894
827
  "EnvironmentSnapshot": {
@@ -995,7 +928,6 @@
995
928
  "not-snapshottable",
996
929
  "not-suspended",
997
930
  "organization-required",
998
- "position-unavailable",
999
931
  "release-gone",
1000
932
  "release-lifecycle",
1001
933
  "release-unavailable",
@@ -1097,188 +1029,6 @@
1097
1029
  "required": ["data", "nextCursor"],
1098
1030
  "type": "object"
1099
1031
  },
1100
- "HistoryBody": {
1101
- "properties": {
1102
- "blob": {
1103
- "properties": {
1104
- "bytes": {
1105
- "type": "integer"
1106
- },
1107
- "sha256": {
1108
- "type": "string"
1109
- }
1110
- },
1111
- "required": ["sha256", "bytes"],
1112
- "type": ["object", "null"]
1113
- },
1114
- "coverage": {
1115
- "enum": ["complete", "redacted", "truncated", "omitted"],
1116
- "type": "string"
1117
- },
1118
- "inline": {
1119
- "type": ["string", "null"]
1120
- }
1121
- },
1122
- "required": ["coverage", "inline", "blob"],
1123
- "type": "object"
1124
- },
1125
- "HistoryCause": {
1126
- "oneOf": [
1127
- {
1128
- "properties": {
1129
- "exchangeId": {
1130
- "maxLength": 128,
1131
- "minLength": 1,
1132
- "type": "string"
1133
- },
1134
- "kind": {
1135
- "enum": ["exchange"],
1136
- "type": "string"
1137
- }
1138
- },
1139
- "required": ["kind", "exchangeId"],
1140
- "type": "object"
1141
- },
1142
- {
1143
- "properties": {
1144
- "depth": {
1145
- "type": "integer"
1146
- },
1147
- "eventId": {
1148
- "type": "string"
1149
- },
1150
- "kind": {
1151
- "enum": ["reactor"],
1152
- "type": "string"
1153
- },
1154
- "reactor": {
1155
- "type": "string"
1156
- },
1157
- "rootExchangeId": {
1158
- "maxLength": 128,
1159
- "minLength": 1,
1160
- "type": ["string", "null"]
1161
- }
1162
- },
1163
- "required": [
1164
- "kind",
1165
- "reactor",
1166
- "eventId",
1167
- "rootExchangeId",
1168
- "depth"
1169
- ],
1170
- "type": "object"
1171
- },
1172
- {
1173
- "properties": {
1174
- "depth": {
1175
- "type": "integer"
1176
- },
1177
- "kind": {
1178
- "enum": ["timer"],
1179
- "type": "string"
1180
- },
1181
- "rootExchangeId": {
1182
- "maxLength": 128,
1183
- "minLength": 1,
1184
- "type": ["string", "null"]
1185
- },
1186
- "timerId": {
1187
- "type": "string"
1188
- }
1189
- },
1190
- "required": ["kind", "timerId", "rootExchangeId", "depth"],
1191
- "type": "object"
1192
- },
1193
- {
1194
- "properties": {
1195
- "fromGeneration": {
1196
- "type": "integer"
1197
- },
1198
- "kind": {
1199
- "enum": ["restore"],
1200
- "type": "string"
1201
- },
1202
- "lsn": {
1203
- "type": "string"
1204
- }
1205
- },
1206
- "required": ["kind", "fromGeneration", "lsn"],
1207
- "type": "object"
1208
- },
1209
- {
1210
- "properties": {
1211
- "kind": {
1212
- "enum": ["bootstrap"],
1213
- "type": "string"
1214
- }
1215
- },
1216
- "required": ["kind"],
1217
- "type": "object"
1218
- },
1219
- {
1220
- "type": "null"
1221
- }
1222
- ]
1223
- },
1224
- "HistoryPosition": {
1225
- "properties": {
1226
- "generation": {
1227
- "minimum": 1,
1228
- "type": "integer"
1229
- },
1230
- "lsn": {
1231
- "pattern": "^[0-9A-F]{1,8}\\/[0-9A-F]{1,8}$",
1232
- "type": "string"
1233
- },
1234
- "until": {
1235
- "pattern": "^[0-9A-F]{1,8}\\/[0-9A-F]{1,8}$",
1236
- "type": ["string", "null"]
1237
- }
1238
- },
1239
- "required": ["generation", "lsn", "until"],
1240
- "type": "object"
1241
- },
1242
- "HistoryTransaction": {
1243
- "properties": {
1244
- "cause": {
1245
- "$ref": "#/components/schemas/HistoryCause"
1246
- },
1247
- "changes": {
1248
- "type": "integer"
1249
- },
1250
- "committedAt": {
1251
- "format": "date-time",
1252
- "type": "string"
1253
- },
1254
- "generation": {
1255
- "type": "integer"
1256
- },
1257
- "lsn": {
1258
- "pattern": "^[0-9A-F]{1,8}\\/[0-9A-F]{1,8}$",
1259
- "type": "string"
1260
- },
1261
- "tables": {
1262
- "items": {
1263
- "type": "string"
1264
- },
1265
- "type": "array"
1266
- },
1267
- "xid": {
1268
- "type": "integer"
1269
- }
1270
- },
1271
- "required": [
1272
- "generation",
1273
- "xid",
1274
- "lsn",
1275
- "committedAt",
1276
- "cause",
1277
- "tables",
1278
- "changes"
1279
- ],
1280
- "type": "object"
1281
- },
1282
1032
  "Release": {
1283
1033
  "properties": {
1284
1034
  "actors": {
@@ -1350,6 +1100,43 @@
1350
1100
  "required": ["id", "name", "summary"],
1351
1101
  "type": "object"
1352
1102
  },
1103
+ "RequestPayloadPreview": {
1104
+ "properties": {
1105
+ "bytes": {
1106
+ "type": ["integer", "null"]
1107
+ },
1108
+ "contentType": {
1109
+ "type": ["string", "null"]
1110
+ },
1111
+ "coverage": {
1112
+ "enum": ["captured", "redacted", "omitted"],
1113
+ "type": "string"
1114
+ },
1115
+ "encoding": {
1116
+ "enum": ["utf8", "binary"],
1117
+ "type": "string"
1118
+ },
1119
+ "preview": {
1120
+ "type": ["string", "null"]
1121
+ },
1122
+ "previewTruncated": {
1123
+ "type": "boolean"
1124
+ },
1125
+ "reason": {
1126
+ "type": ["string", "null"]
1127
+ }
1128
+ },
1129
+ "required": [
1130
+ "coverage",
1131
+ "reason",
1132
+ "contentType",
1133
+ "bytes",
1134
+ "encoding",
1135
+ "preview",
1136
+ "previewTruncated"
1137
+ ],
1138
+ "type": "object"
1139
+ },
1353
1140
  "Workspace": {
1354
1141
  "properties": {
1355
1142
  "archivedAt": {
@@ -2324,17 +2111,172 @@
2324
2111
  "content": {
2325
2112
  "application/json": {
2326
2113
  "schema": {
2327
- "properties": {
2328
- "data": {
2329
- "$ref": "#/components/schemas/ConnectionSecret"
2330
- }
2331
- },
2332
- "required": ["data"],
2333
- "type": "object"
2114
+ "properties": {
2115
+ "data": {
2116
+ "$ref": "#/components/schemas/ConnectionSecret"
2117
+ }
2118
+ },
2119
+ "required": ["data"],
2120
+ "type": "object"
2121
+ }
2122
+ }
2123
+ },
2124
+ "description": "Live credentials for one actor; recorded as an event"
2125
+ },
2126
+ "400": {
2127
+ "content": {
2128
+ "application/json": {
2129
+ "schema": {
2130
+ "$ref": "#/components/schemas/ErrorResponse"
2131
+ }
2132
+ }
2133
+ },
2134
+ "description": "Invalid request"
2135
+ },
2136
+ "401": {
2137
+ "content": {
2138
+ "application/json": {
2139
+ "schema": {
2140
+ "$ref": "#/components/schemas/ErrorResponse"
2141
+ }
2142
+ }
2143
+ },
2144
+ "description": "Authentication required"
2145
+ },
2146
+ "403": {
2147
+ "content": {
2148
+ "application/json": {
2149
+ "schema": {
2150
+ "$ref": "#/components/schemas/ErrorResponse"
2151
+ }
2152
+ }
2153
+ },
2154
+ "description": "Permission denied"
2155
+ },
2156
+ "404": {
2157
+ "content": {
2158
+ "application/json": {
2159
+ "schema": {
2160
+ "$ref": "#/components/schemas/ErrorResponse"
2161
+ }
2162
+ }
2163
+ },
2164
+ "description": "Resource not found"
2165
+ },
2166
+ "409": {
2167
+ "content": {
2168
+ "application/json": {
2169
+ "schema": {
2170
+ "$ref": "#/components/schemas/ErrorResponse"
2171
+ }
2172
+ }
2173
+ },
2174
+ "description": "Conflicting request or version"
2175
+ },
2176
+ "413": {
2177
+ "content": {
2178
+ "application/json": {
2179
+ "schema": {
2180
+ "$ref": "#/components/schemas/ErrorResponse"
2181
+ }
2182
+ }
2183
+ },
2184
+ "description": "Request body too large"
2185
+ },
2186
+ "422": {
2187
+ "content": {
2188
+ "application/json": {
2189
+ "schema": {
2190
+ "$ref": "#/components/schemas/ErrorResponse"
2191
+ }
2192
+ }
2193
+ },
2194
+ "description": "Unsupported configuration"
2195
+ },
2196
+ "429": {
2197
+ "content": {
2198
+ "application/json": {
2199
+ "schema": {
2200
+ "$ref": "#/components/schemas/ErrorResponse"
2201
+ }
2202
+ }
2203
+ },
2204
+ "description": "Admission limit reached"
2205
+ },
2206
+ "500": {
2207
+ "content": {
2208
+ "application/json": {
2209
+ "schema": {
2210
+ "$ref": "#/components/schemas/ErrorResponse"
2211
+ }
2212
+ }
2213
+ },
2214
+ "description": "Unexpected failure"
2215
+ },
2216
+ "503": {
2217
+ "content": {
2218
+ "application/json": {
2219
+ "schema": {
2220
+ "$ref": "#/components/schemas/ErrorResponse"
2221
+ }
2222
+ }
2223
+ },
2224
+ "description": "Dependency unavailable"
2225
+ }
2226
+ },
2227
+ "security": [
2228
+ {
2229
+ "bearerAuth": []
2230
+ }
2231
+ ],
2232
+ "x-state-credentials": ["user", "api_key"]
2233
+ }
2234
+ },
2235
+ "/v1/environments/{environmentId}/events": {
2236
+ "get": {
2237
+ "operationId": "listEnvironmentEvents",
2238
+ "parameters": [
2239
+ {
2240
+ "in": "path",
2241
+ "name": "environmentId",
2242
+ "required": true,
2243
+ "schema": {
2244
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
2245
+ "type": "string"
2246
+ }
2247
+ },
2248
+ {
2249
+ "in": "query",
2250
+ "name": "limit",
2251
+ "required": false,
2252
+ "schema": {
2253
+ "default": 50,
2254
+ "maximum": 100,
2255
+ "minimum": 1,
2256
+ "type": "integer"
2257
+ }
2258
+ },
2259
+ {
2260
+ "in": "query",
2261
+ "name": "cursor",
2262
+ "required": false,
2263
+ "schema": {
2264
+ "maxLength": 64,
2265
+ "pattern": "^\\d+$",
2266
+ "type": "string"
2267
+ }
2268
+ }
2269
+ ],
2270
+ "responses": {
2271
+ "200": {
2272
+ "content": {
2273
+ "application/json": {
2274
+ "schema": {
2275
+ "$ref": "#/components/schemas/EventPage"
2334
2276
  }
2335
2277
  }
2336
2278
  },
2337
- "description": "Live credentials for one actor; recorded as an event"
2279
+ "description": "The environment's timeline, oldest first"
2338
2280
  },
2339
2281
  "400": {
2340
2282
  "content": {
@@ -2445,9 +2387,9 @@
2445
2387
  "x-state-credentials": ["user", "api_key"]
2446
2388
  }
2447
2389
  },
2448
- "/v1/environments/{environmentId}/events": {
2390
+ "/v1/environments/{environmentId}/requests": {
2449
2391
  "get": {
2450
- "operationId": "listEnvironmentEvents",
2392
+ "operationId": "listEnvironmentRequests",
2451
2393
  "parameters": [
2452
2394
  {
2453
2395
  "in": "path",
@@ -2474,8 +2416,91 @@
2474
2416
  "name": "cursor",
2475
2417
  "required": false,
2476
2418
  "schema": {
2477
- "maxLength": 64,
2478
- "pattern": "^\\d+$",
2419
+ "maxLength": 2048,
2420
+ "type": "string"
2421
+ }
2422
+ },
2423
+ {
2424
+ "in": "query",
2425
+ "name": "appKey",
2426
+ "required": false,
2427
+ "schema": {
2428
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
2429
+ "type": "string"
2430
+ }
2431
+ },
2432
+ {
2433
+ "in": "query",
2434
+ "name": "status",
2435
+ "required": false,
2436
+ "schema": {
2437
+ "maximum": 599,
2438
+ "minimum": 100,
2439
+ "type": "integer"
2440
+ }
2441
+ },
2442
+ {
2443
+ "in": "query",
2444
+ "name": "statusClass",
2445
+ "required": false,
2446
+ "schema": {
2447
+ "enum": ["2xx", "3xx", "4xx", "5xx"],
2448
+ "type": "string"
2449
+ }
2450
+ },
2451
+ {
2452
+ "in": "query",
2453
+ "name": "method",
2454
+ "required": false,
2455
+ "schema": {
2456
+ "enum": [
2457
+ "GET",
2458
+ "HEAD",
2459
+ "POST",
2460
+ "PUT",
2461
+ "PATCH",
2462
+ "DELETE",
2463
+ "OPTIONS",
2464
+ "CONNECT",
2465
+ "TRACE"
2466
+ ],
2467
+ "type": "string"
2468
+ }
2469
+ },
2470
+ {
2471
+ "in": "query",
2472
+ "name": "search",
2473
+ "required": false,
2474
+ "schema": {
2475
+ "maxLength": 200,
2476
+ "pattern": "^[^\\0]*$",
2477
+ "type": "string"
2478
+ }
2479
+ },
2480
+ {
2481
+ "in": "query",
2482
+ "name": "writesOnly",
2483
+ "required": false,
2484
+ "schema": {
2485
+ "enum": ["true", "false"],
2486
+ "type": "string"
2487
+ }
2488
+ },
2489
+ {
2490
+ "in": "query",
2491
+ "name": "from",
2492
+ "required": false,
2493
+ "schema": {
2494
+ "format": "date-time",
2495
+ "type": "string"
2496
+ }
2497
+ },
2498
+ {
2499
+ "in": "query",
2500
+ "name": "to",
2501
+ "required": false,
2502
+ "schema": {
2503
+ "format": "date-time",
2479
2504
  "type": "string"
2480
2505
  }
2481
2506
  }
@@ -2485,11 +2510,23 @@
2485
2510
  "content": {
2486
2511
  "application/json": {
2487
2512
  "schema": {
2488
- "$ref": "#/components/schemas/EventPage"
2513
+ "properties": {
2514
+ "data": {
2515
+ "items": {
2516
+ "$ref": "#/components/schemas/EnvironmentRequest"
2517
+ },
2518
+ "type": "array"
2519
+ },
2520
+ "nextCursor": {
2521
+ "type": ["string", "null"]
2522
+ }
2523
+ },
2524
+ "required": ["data", "nextCursor"],
2525
+ "type": "object"
2489
2526
  }
2490
2527
  }
2491
2528
  },
2492
- "description": "The environment's timeline, oldest first"
2529
+ "description": "Best-effort recorded replica requests, newest first"
2493
2530
  },
2494
2531
  "400": {
2495
2532
  "content": {
@@ -2600,9 +2637,9 @@
2600
2637
  "x-state-credentials": ["user", "api_key"]
2601
2638
  }
2602
2639
  },
2603
- "/v1/environments/{environmentId}/history": {
2640
+ "/v1/environments/{environmentId}/requests/stats": {
2604
2641
  "get": {
2605
- "operationId": "listEnvironmentHistory",
2642
+ "operationId": "getEnvironmentRequestStats",
2606
2643
  "parameters": [
2607
2644
  {
2608
2645
  "in": "path",
@@ -2615,21 +2652,85 @@
2615
2652
  },
2616
2653
  {
2617
2654
  "in": "query",
2618
- "name": "limit",
2655
+ "name": "appKey",
2619
2656
  "required": false,
2620
2657
  "schema": {
2621
- "default": 50,
2622
- "maximum": 100,
2623
- "minimum": 1,
2658
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
2659
+ "type": "string"
2660
+ }
2661
+ },
2662
+ {
2663
+ "in": "query",
2664
+ "name": "status",
2665
+ "required": false,
2666
+ "schema": {
2667
+ "maximum": 599,
2668
+ "minimum": 100,
2624
2669
  "type": "integer"
2625
2670
  }
2626
2671
  },
2627
2672
  {
2628
2673
  "in": "query",
2629
- "name": "cursor",
2674
+ "name": "statusClass",
2630
2675
  "required": false,
2631
2676
  "schema": {
2632
- "maxLength": 2048,
2677
+ "enum": ["2xx", "3xx", "4xx", "5xx"],
2678
+ "type": "string"
2679
+ }
2680
+ },
2681
+ {
2682
+ "in": "query",
2683
+ "name": "method",
2684
+ "required": false,
2685
+ "schema": {
2686
+ "enum": [
2687
+ "GET",
2688
+ "HEAD",
2689
+ "POST",
2690
+ "PUT",
2691
+ "PATCH",
2692
+ "DELETE",
2693
+ "OPTIONS",
2694
+ "CONNECT",
2695
+ "TRACE"
2696
+ ],
2697
+ "type": "string"
2698
+ }
2699
+ },
2700
+ {
2701
+ "in": "query",
2702
+ "name": "search",
2703
+ "required": false,
2704
+ "schema": {
2705
+ "maxLength": 200,
2706
+ "pattern": "^[^\\0]*$",
2707
+ "type": "string"
2708
+ }
2709
+ },
2710
+ {
2711
+ "in": "query",
2712
+ "name": "writesOnly",
2713
+ "required": false,
2714
+ "schema": {
2715
+ "enum": ["true", "false"],
2716
+ "type": "string"
2717
+ }
2718
+ },
2719
+ {
2720
+ "in": "query",
2721
+ "name": "from",
2722
+ "required": true,
2723
+ "schema": {
2724
+ "format": "date-time",
2725
+ "type": "string"
2726
+ }
2727
+ },
2728
+ {
2729
+ "in": "query",
2730
+ "name": "to",
2731
+ "required": true,
2732
+ "schema": {
2733
+ "format": "date-time",
2633
2734
  "type": "string"
2634
2735
  }
2635
2736
  }
@@ -2641,21 +2742,15 @@
2641
2742
  "schema": {
2642
2743
  "properties": {
2643
2744
  "data": {
2644
- "items": {
2645
- "$ref": "#/components/schemas/EnvironmentExchange"
2646
- },
2647
- "type": "array"
2648
- },
2649
- "nextCursor": {
2650
- "type": ["string", "null"]
2745
+ "$ref": "#/components/schemas/EnvironmentRequestStats"
2651
2746
  }
2652
2747
  },
2653
- "required": ["data", "nextCursor"],
2748
+ "required": ["data"],
2654
2749
  "type": "object"
2655
2750
  }
2656
2751
  }
2657
2752
  },
2658
- "description": "The environment's exchanges in gateway order, each with its transactions and events"
2753
+ "description": "Recorded request statistics across the selected time window"
2659
2754
  },
2660
2755
  "400": {
2661
2756
  "content": {
@@ -2766,9 +2861,9 @@
2766
2861
  "x-state-credentials": ["user", "api_key"]
2767
2862
  }
2768
2863
  },
2769
- "/v1/environments/{environmentId}/history/position": {
2864
+ "/v1/environments/{environmentId}/requests/{requestId}": {
2770
2865
  "get": {
2771
- "operationId": "getEnvironmentPosition",
2866
+ "operationId": "getEnvironmentRequest",
2772
2867
  "parameters": [
2773
2868
  {
2774
2869
  "in": "path",
@@ -2778,6 +2873,15 @@
2778
2873
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
2779
2874
  "type": "string"
2780
2875
  }
2876
+ },
2877
+ {
2878
+ "in": "path",
2879
+ "name": "requestId",
2880
+ "required": true,
2881
+ "schema": {
2882
+ "format": "uuid",
2883
+ "type": "string"
2884
+ }
2781
2885
  }
2782
2886
  ],
2783
2887
  "responses": {
@@ -2787,7 +2891,7 @@
2787
2891
  "schema": {
2788
2892
  "properties": {
2789
2893
  "data": {
2790
- "$ref": "#/components/schemas/EnvironmentPosition"
2894
+ "$ref": "#/components/schemas/EnvironmentRequestDetail"
2791
2895
  }
2792
2896
  },
2793
2897
  "required": ["data"],
@@ -2795,7 +2899,7 @@
2795
2899
  }
2796
2900
  }
2797
2901
  },
2798
- "description": "Each app's current head position, as a fork from it would start"
2902
+ "description": "Recorded request with bounded payload previews"
2799
2903
  },
2800
2904
  "400": {
2801
2905
  "content": {
@@ -2906,9 +3010,9 @@
2906
3010
  "x-state-credentials": ["user", "api_key"]
2907
3011
  }
2908
3012
  },
2909
- "/v1/environments/{environmentId}/history/{exchangeId}": {
3013
+ "/v1/environments/{environmentId}/requests/{requestId}/payload/{direction}": {
2910
3014
  "get": {
2911
- "operationId": "getEnvironmentExchange",
3015
+ "operationId": "getEnvironmentRequestPayload",
2912
3016
  "parameters": [
2913
3017
  {
2914
3018
  "in": "path",
@@ -2921,11 +3025,19 @@
2921
3025
  },
2922
3026
  {
2923
3027
  "in": "path",
2924
- "name": "exchangeId",
3028
+ "name": "requestId",
2925
3029
  "required": true,
2926
3030
  "schema": {
2927
- "maxLength": 128,
2928
- "minLength": 1,
3031
+ "format": "uuid",
3032
+ "type": "string"
3033
+ }
3034
+ },
3035
+ {
3036
+ "in": "path",
3037
+ "name": "direction",
3038
+ "required": true,
3039
+ "schema": {
3040
+ "enum": ["request", "response"],
2929
3041
  "type": "string"
2930
3042
  }
2931
3043
  }
@@ -2933,19 +3045,14 @@
2933
3045
  "responses": {
2934
3046
  "200": {
2935
3047
  "content": {
2936
- "application/json": {
3048
+ "application/octet-stream": {
2937
3049
  "schema": {
2938
- "properties": {
2939
- "data": {
2940
- "$ref": "#/components/schemas/EnvironmentExchange"
2941
- }
2942
- },
2943
- "required": ["data"],
2944
- "type": "object"
3050
+ "format": "binary",
3051
+ "type": "string"
2945
3052
  }
2946
3053
  }
2947
3054
  },
2948
- "description": "One exchange of the environment, with the position a fork after it starts from"
3055
+ "description": "Recorded payload as a safe attachment"
2949
3056
  },
2950
3057
  "400": {
2951
3058
  "content": {
@@ -3068,6 +3175,17 @@
3068
3175
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
3069
3176
  "type": "string"
3070
3177
  }
3178
+ },
3179
+ {
3180
+ "in": "header",
3181
+ "name": "idempotency-key",
3182
+ "required": false,
3183
+ "schema": {
3184
+ "maxLength": 128,
3185
+ "minLength": 8,
3186
+ "pattern": "^[A-Za-z0-9._:-]+$",
3187
+ "type": "string"
3188
+ }
3071
3189
  }
3072
3190
  ],
3073
3191
  "responses": {
@@ -3208,6 +3326,17 @@
3208
3326
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
3209
3327
  "type": "string"
3210
3328
  }
3329
+ },
3330
+ {
3331
+ "in": "header",
3332
+ "name": "idempotency-key",
3333
+ "required": false,
3334
+ "schema": {
3335
+ "maxLength": 128,
3336
+ "minLength": 8,
3337
+ "pattern": "^[A-Za-z0-9._:-]+$",
3338
+ "type": "string"
3339
+ }
3211
3340
  }
3212
3341
  ],
3213
3342
  "responses": {
@@ -3348,6 +3477,17 @@
3348
3477
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
3349
3478
  "type": "string"
3350
3479
  }
3480
+ },
3481
+ {
3482
+ "in": "header",
3483
+ "name": "idempotency-key",
3484
+ "required": false,
3485
+ "schema": {
3486
+ "maxLength": 128,
3487
+ "minLength": 8,
3488
+ "pattern": "^[A-Za-z0-9._:-]+$",
3489
+ "type": "string"
3490
+ }
3351
3491
  }
3352
3492
  ],
3353
3493
  "responses": {
@@ -4361,86 +4501,6 @@
4361
4501
  },
4362
4502
  "required": ["from"],
4363
4503
  "type": "object"
4364
- },
4365
- {
4366
- "additionalProperties": false,
4367
- "properties": {
4368
- "from": {
4369
- "additionalProperties": false,
4370
- "properties": {
4371
- "at": {
4372
- "anyOf": [
4373
- {
4374
- "additionalProperties": false,
4375
- "properties": {
4376
- "position": {
4377
- "additionalProperties": false,
4378
- "properties": {
4379
- "generation": {
4380
- "minimum": 1,
4381
- "type": "integer"
4382
- },
4383
- "lsn": {
4384
- "pattern": "^[0-9A-F]{1,8}\\/[0-9A-F]{1,8}$",
4385
- "type": "string"
4386
- }
4387
- },
4388
- "required": ["generation", "lsn"],
4389
- "type": "object"
4390
- }
4391
- },
4392
- "required": ["position"],
4393
- "type": "object"
4394
- },
4395
- {
4396
- "additionalProperties": false,
4397
- "properties": {
4398
- "exchangeId": {
4399
- "maxLength": 128,
4400
- "minLength": 1,
4401
- "type": "string"
4402
- }
4403
- },
4404
- "required": ["exchangeId"],
4405
- "type": "object"
4406
- }
4407
- ]
4408
- },
4409
- "environment": {
4410
- "maxLength": 128,
4411
- "minLength": 1,
4412
- "type": "string"
4413
- }
4414
- },
4415
- "required": ["environment", "at"],
4416
- "type": "object"
4417
- },
4418
- "labels": {
4419
- "additionalProperties": {
4420
- "maxLength": 256,
4421
- "type": "string"
4422
- },
4423
- "default": {},
4424
- "type": "object"
4425
- },
4426
- "lifetimeMinutes": {
4427
- "maximum": 1440,
4428
- "minimum": 1,
4429
- "type": "integer"
4430
- },
4431
- "name": {
4432
- "maxLength": 120,
4433
- "minLength": 1,
4434
- "type": "string"
4435
- },
4436
- "version": {
4437
- "default": 1,
4438
- "enum": [1],
4439
- "type": "number"
4440
- }
4441
- },
4442
- "required": ["from"],
4443
- "type": "object"
4444
4504
  }
4445
4505
  ]
4446
4506
  }