@usestatemachines/sdk 0.3.0 → 0.4.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 (71) hide show
  1. package/README.md +67 -17
  2. package/agents/SKILL.md +10 -7
  3. package/agents/index.js +6 -6
  4. package/agents/llms.txt +16 -9
  5. package/agents/prompt.md +1 -1
  6. package/esm/extensions/client.d.ts +11 -1
  7. package/esm/extensions/client.js +12 -2
  8. package/esm/extensions/running-environment.d.ts +16 -2
  9. package/esm/extensions/running-environment.js +24 -2
  10. package/esm/extensions/wait.d.ts +3 -1
  11. package/esm/extensions/wait.js +16 -1
  12. package/esm/funcs/environments-resume.d.ts +11 -0
  13. package/esm/funcs/environments-resume.js +92 -0
  14. package/esm/funcs/environments-suspend.d.ts +11 -0
  15. package/esm/funcs/environments-suspend.js +92 -0
  16. package/esm/funcs/get-environment-exchange.d.ts +11 -0
  17. package/esm/funcs/get-environment-exchange.js +96 -0
  18. package/esm/funcs/get-environment-position.d.ts +11 -0
  19. package/esm/funcs/get-environment-position.js +92 -0
  20. package/esm/funcs/list-environment-history.d.ts +11 -0
  21. package/esm/funcs/list-environment-history.js +97 -0
  22. package/esm/lib/config.d.ts +2 -2
  23. package/esm/lib/config.js +2 -2
  24. package/esm/models/environment-app.d.ts +10 -0
  25. package/esm/models/environment-app.js +12 -0
  26. package/esm/models/environment-exchange.d.ts +116 -0
  27. package/esm/models/environment-exchange.js +126 -0
  28. package/esm/models/environment-position.d.ts +25 -0
  29. package/esm/models/environment-position.js +32 -0
  30. package/esm/models/environment-snapshot.d.ts +3 -2
  31. package/esm/models/environment-snapshot.js +3 -2
  32. package/esm/models/environment.d.ts +4 -0
  33. package/esm/models/environment.js +4 -0
  34. package/esm/models/error-response.d.ts +8 -0
  35. package/esm/models/error-response.js +8 -0
  36. package/esm/models/history-body.d.ts +28 -0
  37. package/esm/models/history-body.js +33 -0
  38. package/esm/models/history-cause.d.ts +48 -0
  39. package/esm/models/history-cause.js +63 -0
  40. package/esm/models/history-position.d.ts +11 -0
  41. package/esm/models/history-position.js +15 -0
  42. package/esm/models/history-transaction.d.ts +16 -0
  43. package/esm/models/history-transaction.js +20 -0
  44. package/esm/models/index.d.ts +6 -0
  45. package/esm/models/index.js +6 -0
  46. package/esm/models/operations/create-environment-definition.d.ts +92 -10
  47. package/esm/models/operations/create-environment-definition.js +63 -4
  48. package/esm/models/operations/get-environment-exchange.d.ts +25 -0
  49. package/esm/models/operations/get-environment-exchange.js +21 -0
  50. package/esm/models/operations/get-environment-position.d.ts +23 -0
  51. package/esm/models/operations/get-environment-position.js +20 -0
  52. package/esm/models/operations/index.d.ts +5 -0
  53. package/esm/models/operations/index.js +5 -0
  54. package/esm/models/operations/list-environment-history.d.ts +28 -0
  55. package/esm/models/operations/list-environment-history.js +24 -0
  56. package/esm/models/operations/resume-environment.d.ts +23 -0
  57. package/esm/models/operations/resume-environment.js +20 -0
  58. package/esm/models/operations/stop-environment.d.ts +1 -1
  59. package/esm/models/operations/suspend-environment.d.ts +23 -0
  60. package/esm/models/operations/suspend-environment.js +20 -0
  61. package/esm/models/release.d.ts +11 -0
  62. package/esm/models/release.js +10 -0
  63. package/esm/sdk/environments.d.ts +2 -0
  64. package/esm/sdk/environments.js +8 -0
  65. package/esm/sdk/sdk.d.ts +3 -0
  66. package/esm/sdk/sdk.js +12 -0
  67. package/esm/types/discriminated-union.d.ts +24 -0
  68. package/esm/types/discriminated-union.js +60 -0
  69. package/esm/types/smart-union.js +2 -1
  70. package/openapi.json +1433 -142
  71. package/package.json +3 -2
package/openapi.json CHANGED
@@ -482,6 +482,11 @@
482
482
  "name": {
483
483
  "type": ["string", "null"]
484
484
  },
485
+ "sourceEnvironmentId": {
486
+ "default": null,
487
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
488
+ "type": ["string", "null"]
489
+ },
485
490
  "sourceEnvironmentSnapshotId": {
486
491
  "default": null,
487
492
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
@@ -496,6 +501,8 @@
496
501
  "queued",
497
502
  "starting",
498
503
  "running",
504
+ "suspending",
505
+ "suspended",
499
506
  "stopping",
500
507
  "stopped",
501
508
  "failed"
@@ -510,6 +517,10 @@
510
517
  "format": "date-time",
511
518
  "type": ["string", "null"]
512
519
  },
520
+ "suspendedAt": {
521
+ "format": "date-time",
522
+ "type": ["string", "null"]
523
+ },
513
524
  "version": {
514
525
  "type": "integer"
515
526
  },
@@ -530,6 +541,7 @@
530
541
  "createdBy",
531
542
  "createdAt",
532
543
  "startedAt",
544
+ "suspendedAt",
533
545
  "stoppedAt",
534
546
  "expiresAt",
535
547
  "apps"
@@ -561,6 +573,20 @@
561
573
  "format": "date-time",
562
574
  "type": ["string", "null"]
563
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
+ },
564
590
  "id": {
565
591
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
566
592
  "type": "string"
@@ -589,6 +615,8 @@
589
615
  "pending",
590
616
  "starting",
591
617
  "ready",
618
+ "recovering",
619
+ "suspended",
592
620
  "stopping",
593
621
  "stopped",
594
622
  "failed"
@@ -617,6 +645,199 @@
617
645
  ],
618
646
  "type": "object"
619
647
  },
648
+ "EnvironmentExchange": {
649
+ "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"]
677
+ },
678
+ "channel": {
679
+ "enum": [
680
+ "api",
681
+ "ui",
682
+ "reactor",
683
+ "timer",
684
+ "inbound-webhook",
685
+ "bootstrap",
686
+ "restore",
687
+ null
688
+ ],
689
+ "type": ["string", "null"]
690
+ },
691
+ "eventIds": {
692
+ "items": {
693
+ "type": "string"
694
+ },
695
+ "type": "array"
696
+ },
697
+ "exchangeId": {
698
+ "maxLength": 128,
699
+ "minLength": 1,
700
+ "type": "string"
701
+ },
702
+ "objectCount": {
703
+ "type": "integer"
704
+ },
705
+ "objects": {
706
+ "items": {
707
+ "type": "string"
708
+ },
709
+ "type": "array"
710
+ },
711
+ "observedAt": {
712
+ "format": "date-time",
713
+ "type": "string"
714
+ },
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"]
735
+ },
736
+ "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"]
759
+ },
760
+ "position": {
761
+ "$ref": "#/components/schemas/HistoryPosition"
762
+ },
763
+ "state": {
764
+ "enum": ["recorded", "unknown"],
765
+ "type": "string"
766
+ },
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"]
798
+ },
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"]
813
+ },
814
+ "transactions": {
815
+ "items": {
816
+ "$ref": "#/components/schemas/HistoryTransaction"
817
+ },
818
+ "type": "array"
819
+ }
820
+ },
821
+ "required": [
822
+ "exchangeId",
823
+ "appKey",
824
+ "state",
825
+ "observedAt",
826
+ "position",
827
+ "channel",
828
+ "operation",
829
+ "outcome",
830
+ "actor",
831
+ "trace",
832
+ "timing",
833
+ "bodies",
834
+ "objects",
835
+ "objectCount",
836
+ "eventIds",
837
+ "transactions"
838
+ ],
839
+ "type": "object"
840
+ },
620
841
  "EnvironmentLifetime": {
621
842
  "properties": {
622
843
  "defaultMinutes": {
@@ -629,6 +850,47 @@
629
850
  "required": ["defaultMinutes", "maximumMinutes"],
630
851
  "type": "object"
631
852
  },
853
+ "EnvironmentPosition": {
854
+ "properties": {
855
+ "apps": {
856
+ "items": {
857
+ "properties": {
858
+ "appInstanceId": {
859
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
860
+ "type": "string"
861
+ },
862
+ "key": {
863
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
864
+ "type": "string"
865
+ },
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"]
879
+ }
880
+ },
881
+ "required": ["key", "appInstanceId", "position"],
882
+ "type": "object"
883
+ },
884
+ "type": "array"
885
+ },
886
+ "environmentId": {
887
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
888
+ "type": "string"
889
+ }
890
+ },
891
+ "required": ["environmentId", "apps"],
892
+ "type": "object"
893
+ },
632
894
  "EnvironmentSnapshot": {
633
895
  "properties": {
634
896
  "appInstanceSnapshots": {
@@ -638,8 +900,8 @@
638
900
  "type": "array"
639
901
  },
640
902
  "consistency": {
641
- "enum": ["per-app-instance"],
642
- "type": "string"
903
+ "enum": ["environment", "app_instance", null],
904
+ "type": ["string", "null"]
643
905
  },
644
906
  "createdAt": {
645
907
  "format": "date-time",
@@ -710,6 +972,7 @@
710
972
  "code": {
711
973
  "enum": [
712
974
  "body-too-large",
975
+ "capture-in-progress",
713
976
  "connection-not-authorized",
714
977
  "connection-unavailable",
715
978
  "environment-limit",
@@ -729,12 +992,19 @@
729
992
  "lifetime-too-long",
730
993
  "not-found",
731
994
  "not-ready",
995
+ "not-snapshottable",
996
+ "not-suspended",
732
997
  "organization-required",
998
+ "position-unavailable",
999
+ "release-gone",
1000
+ "release-lifecycle",
733
1001
  "release-unavailable",
734
1002
  "request-capacity-reached",
735
1003
  "request-timeout",
736
1004
  "service-unavailable",
737
1005
  "snapshot-limit",
1006
+ "snapshots-unavailable",
1007
+ "suspend-in-progress",
738
1008
  "unauthorized",
739
1009
  "version-conflict",
740
1010
  "workspace-archived",
@@ -827,6 +1097,188 @@
827
1097
  "required": ["data", "nextCursor"],
828
1098
  "type": "object"
829
1099
  },
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
+ },
830
1282
  "Release": {
831
1283
  "properties": {
832
1284
  "actors": {
@@ -861,6 +1313,10 @@
861
1313
  "format": "date-time",
862
1314
  "type": ["string", "null"]
863
1315
  },
1316
+ "status": {
1317
+ "enum": ["candidate", "default", "available", "retired", "gone"],
1318
+ "type": "string"
1319
+ },
864
1320
  "version": {
865
1321
  "type": "string"
866
1322
  }
@@ -870,6 +1326,7 @@
870
1326
  "appId",
871
1327
  "version",
872
1328
  "qualification",
1329
+ "status",
873
1330
  "apis",
874
1331
  "actors",
875
1332
  "createdAt",
@@ -1210,31 +1667,829 @@
1210
1667
  },
1211
1668
  "security": [
1212
1669
  {
1213
- "bearerAuth": []
1670
+ "bearerAuth": []
1671
+ }
1672
+ ],
1673
+ "x-state-credentials": ["user", "api_key"]
1674
+ }
1675
+ },
1676
+ "/v1/credential": {
1677
+ "get": {
1678
+ "operationId": "getCredential",
1679
+ "responses": {
1680
+ "200": {
1681
+ "content": {
1682
+ "application/json": {
1683
+ "schema": {
1684
+ "properties": {
1685
+ "data": {
1686
+ "$ref": "#/components/schemas/Credential"
1687
+ }
1688
+ },
1689
+ "required": ["data"],
1690
+ "type": "object"
1691
+ }
1692
+ }
1693
+ },
1694
+ "description": "The calling credential, its workspace and its limits"
1695
+ },
1696
+ "400": {
1697
+ "content": {
1698
+ "application/json": {
1699
+ "schema": {
1700
+ "$ref": "#/components/schemas/ErrorResponse"
1701
+ }
1702
+ }
1703
+ },
1704
+ "description": "Invalid request"
1705
+ },
1706
+ "401": {
1707
+ "content": {
1708
+ "application/json": {
1709
+ "schema": {
1710
+ "$ref": "#/components/schemas/ErrorResponse"
1711
+ }
1712
+ }
1713
+ },
1714
+ "description": "Authentication required"
1715
+ },
1716
+ "403": {
1717
+ "content": {
1718
+ "application/json": {
1719
+ "schema": {
1720
+ "$ref": "#/components/schemas/ErrorResponse"
1721
+ }
1722
+ }
1723
+ },
1724
+ "description": "Permission denied"
1725
+ },
1726
+ "404": {
1727
+ "content": {
1728
+ "application/json": {
1729
+ "schema": {
1730
+ "$ref": "#/components/schemas/ErrorResponse"
1731
+ }
1732
+ }
1733
+ },
1734
+ "description": "Resource not found"
1735
+ },
1736
+ "409": {
1737
+ "content": {
1738
+ "application/json": {
1739
+ "schema": {
1740
+ "$ref": "#/components/schemas/ErrorResponse"
1741
+ }
1742
+ }
1743
+ },
1744
+ "description": "Conflicting request or version"
1745
+ },
1746
+ "413": {
1747
+ "content": {
1748
+ "application/json": {
1749
+ "schema": {
1750
+ "$ref": "#/components/schemas/ErrorResponse"
1751
+ }
1752
+ }
1753
+ },
1754
+ "description": "Request body too large"
1755
+ },
1756
+ "422": {
1757
+ "content": {
1758
+ "application/json": {
1759
+ "schema": {
1760
+ "$ref": "#/components/schemas/ErrorResponse"
1761
+ }
1762
+ }
1763
+ },
1764
+ "description": "Unsupported configuration"
1765
+ },
1766
+ "429": {
1767
+ "content": {
1768
+ "application/json": {
1769
+ "schema": {
1770
+ "$ref": "#/components/schemas/ErrorResponse"
1771
+ }
1772
+ }
1773
+ },
1774
+ "description": "Admission limit reached"
1775
+ },
1776
+ "500": {
1777
+ "content": {
1778
+ "application/json": {
1779
+ "schema": {
1780
+ "$ref": "#/components/schemas/ErrorResponse"
1781
+ }
1782
+ }
1783
+ },
1784
+ "description": "Unexpected failure"
1785
+ },
1786
+ "503": {
1787
+ "content": {
1788
+ "application/json": {
1789
+ "schema": {
1790
+ "$ref": "#/components/schemas/ErrorResponse"
1791
+ }
1792
+ }
1793
+ },
1794
+ "description": "Dependency unavailable"
1795
+ }
1796
+ },
1797
+ "security": [
1798
+ {
1799
+ "bearerAuth": []
1800
+ }
1801
+ ],
1802
+ "x-state-credentials": ["user", "api_key"]
1803
+ }
1804
+ },
1805
+ "/v1/environments/{environmentId}": {
1806
+ "get": {
1807
+ "operationId": "getEnvironment",
1808
+ "parameters": [
1809
+ {
1810
+ "in": "path",
1811
+ "name": "environmentId",
1812
+ "required": true,
1813
+ "schema": {
1814
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
1815
+ "type": "string"
1816
+ }
1817
+ }
1818
+ ],
1819
+ "responses": {
1820
+ "200": {
1821
+ "content": {
1822
+ "application/json": {
1823
+ "schema": {
1824
+ "properties": {
1825
+ "data": {
1826
+ "$ref": "#/components/schemas/Environment"
1827
+ }
1828
+ },
1829
+ "required": ["data"],
1830
+ "type": "object"
1831
+ }
1832
+ }
1833
+ },
1834
+ "description": "Environment and its apps"
1835
+ },
1836
+ "400": {
1837
+ "content": {
1838
+ "application/json": {
1839
+ "schema": {
1840
+ "$ref": "#/components/schemas/ErrorResponse"
1841
+ }
1842
+ }
1843
+ },
1844
+ "description": "Invalid request"
1845
+ },
1846
+ "401": {
1847
+ "content": {
1848
+ "application/json": {
1849
+ "schema": {
1850
+ "$ref": "#/components/schemas/ErrorResponse"
1851
+ }
1852
+ }
1853
+ },
1854
+ "description": "Authentication required"
1855
+ },
1856
+ "403": {
1857
+ "content": {
1858
+ "application/json": {
1859
+ "schema": {
1860
+ "$ref": "#/components/schemas/ErrorResponse"
1861
+ }
1862
+ }
1863
+ },
1864
+ "description": "Permission denied"
1865
+ },
1866
+ "404": {
1867
+ "content": {
1868
+ "application/json": {
1869
+ "schema": {
1870
+ "$ref": "#/components/schemas/ErrorResponse"
1871
+ }
1872
+ }
1873
+ },
1874
+ "description": "Resource not found"
1875
+ },
1876
+ "409": {
1877
+ "content": {
1878
+ "application/json": {
1879
+ "schema": {
1880
+ "$ref": "#/components/schemas/ErrorResponse"
1881
+ }
1882
+ }
1883
+ },
1884
+ "description": "Conflicting request or version"
1885
+ },
1886
+ "413": {
1887
+ "content": {
1888
+ "application/json": {
1889
+ "schema": {
1890
+ "$ref": "#/components/schemas/ErrorResponse"
1891
+ }
1892
+ }
1893
+ },
1894
+ "description": "Request body too large"
1895
+ },
1896
+ "422": {
1897
+ "content": {
1898
+ "application/json": {
1899
+ "schema": {
1900
+ "$ref": "#/components/schemas/ErrorResponse"
1901
+ }
1902
+ }
1903
+ },
1904
+ "description": "Unsupported configuration"
1905
+ },
1906
+ "429": {
1907
+ "content": {
1908
+ "application/json": {
1909
+ "schema": {
1910
+ "$ref": "#/components/schemas/ErrorResponse"
1911
+ }
1912
+ }
1913
+ },
1914
+ "description": "Admission limit reached"
1915
+ },
1916
+ "500": {
1917
+ "content": {
1918
+ "application/json": {
1919
+ "schema": {
1920
+ "$ref": "#/components/schemas/ErrorResponse"
1921
+ }
1922
+ }
1923
+ },
1924
+ "description": "Unexpected failure"
1925
+ },
1926
+ "503": {
1927
+ "content": {
1928
+ "application/json": {
1929
+ "schema": {
1930
+ "$ref": "#/components/schemas/ErrorResponse"
1931
+ }
1932
+ }
1933
+ },
1934
+ "description": "Dependency unavailable"
1935
+ }
1936
+ },
1937
+ "security": [
1938
+ {
1939
+ "bearerAuth": []
1940
+ }
1941
+ ],
1942
+ "x-state-credentials": ["user", "api_key"]
1943
+ },
1944
+ "patch": {
1945
+ "operationId": "updateEnvironment",
1946
+ "parameters": [
1947
+ {
1948
+ "in": "path",
1949
+ "name": "environmentId",
1950
+ "required": true,
1951
+ "schema": {
1952
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
1953
+ "type": "string"
1954
+ }
1955
+ }
1956
+ ],
1957
+ "requestBody": {
1958
+ "content": {
1959
+ "application/json": {
1960
+ "schema": {
1961
+ "properties": {
1962
+ "expectedVersion": {
1963
+ "minimum": 1,
1964
+ "type": "integer"
1965
+ },
1966
+ "labels": {
1967
+ "additionalProperties": {
1968
+ "maxLength": 256,
1969
+ "type": "string"
1970
+ },
1971
+ "type": "object"
1972
+ },
1973
+ "name": {
1974
+ "maxLength": 120,
1975
+ "minLength": 1,
1976
+ "type": ["string", "null"]
1977
+ }
1978
+ },
1979
+ "required": ["expectedVersion"],
1980
+ "type": "object"
1981
+ }
1982
+ }
1983
+ },
1984
+ "required": true
1985
+ },
1986
+ "responses": {
1987
+ "200": {
1988
+ "content": {
1989
+ "application/json": {
1990
+ "schema": {
1991
+ "properties": {
1992
+ "data": {
1993
+ "$ref": "#/components/schemas/Environment"
1994
+ }
1995
+ },
1996
+ "required": ["data"],
1997
+ "type": "object"
1998
+ }
1999
+ }
2000
+ },
2001
+ "description": "Environment renamed or relabeled"
2002
+ },
2003
+ "400": {
2004
+ "content": {
2005
+ "application/json": {
2006
+ "schema": {
2007
+ "$ref": "#/components/schemas/ErrorResponse"
2008
+ }
2009
+ }
2010
+ },
2011
+ "description": "Invalid request"
2012
+ },
2013
+ "401": {
2014
+ "content": {
2015
+ "application/json": {
2016
+ "schema": {
2017
+ "$ref": "#/components/schemas/ErrorResponse"
2018
+ }
2019
+ }
2020
+ },
2021
+ "description": "Authentication required"
2022
+ },
2023
+ "403": {
2024
+ "content": {
2025
+ "application/json": {
2026
+ "schema": {
2027
+ "$ref": "#/components/schemas/ErrorResponse"
2028
+ }
2029
+ }
2030
+ },
2031
+ "description": "Permission denied"
2032
+ },
2033
+ "404": {
2034
+ "content": {
2035
+ "application/json": {
2036
+ "schema": {
2037
+ "$ref": "#/components/schemas/ErrorResponse"
2038
+ }
2039
+ }
2040
+ },
2041
+ "description": "Resource not found"
2042
+ },
2043
+ "409": {
2044
+ "content": {
2045
+ "application/json": {
2046
+ "schema": {
2047
+ "$ref": "#/components/schemas/ErrorResponse"
2048
+ }
2049
+ }
2050
+ },
2051
+ "description": "Conflicting request or version"
2052
+ },
2053
+ "413": {
2054
+ "content": {
2055
+ "application/json": {
2056
+ "schema": {
2057
+ "$ref": "#/components/schemas/ErrorResponse"
2058
+ }
2059
+ }
2060
+ },
2061
+ "description": "Request body too large"
2062
+ },
2063
+ "422": {
2064
+ "content": {
2065
+ "application/json": {
2066
+ "schema": {
2067
+ "$ref": "#/components/schemas/ErrorResponse"
2068
+ }
2069
+ }
2070
+ },
2071
+ "description": "Unsupported configuration"
2072
+ },
2073
+ "429": {
2074
+ "content": {
2075
+ "application/json": {
2076
+ "schema": {
2077
+ "$ref": "#/components/schemas/ErrorResponse"
2078
+ }
2079
+ }
2080
+ },
2081
+ "description": "Admission limit reached"
2082
+ },
2083
+ "500": {
2084
+ "content": {
2085
+ "application/json": {
2086
+ "schema": {
2087
+ "$ref": "#/components/schemas/ErrorResponse"
2088
+ }
2089
+ }
2090
+ },
2091
+ "description": "Unexpected failure"
2092
+ },
2093
+ "503": {
2094
+ "content": {
2095
+ "application/json": {
2096
+ "schema": {
2097
+ "$ref": "#/components/schemas/ErrorResponse"
2098
+ }
2099
+ }
2100
+ },
2101
+ "description": "Dependency unavailable"
2102
+ }
2103
+ },
2104
+ "security": [
2105
+ {
2106
+ "bearerAuth": []
2107
+ }
2108
+ ],
2109
+ "x-state-credentials": ["user", "api_key"]
2110
+ }
2111
+ },
2112
+ "/v1/environments/{environmentId}/apps/{appKey}/connection": {
2113
+ "get": {
2114
+ "operationId": "getConnection",
2115
+ "parameters": [
2116
+ {
2117
+ "in": "path",
2118
+ "name": "environmentId",
2119
+ "required": true,
2120
+ "schema": {
2121
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
2122
+ "type": "string"
2123
+ }
2124
+ },
2125
+ {
2126
+ "in": "path",
2127
+ "name": "appKey",
2128
+ "required": true,
2129
+ "schema": {
2130
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
2131
+ "type": "string"
2132
+ }
2133
+ }
2134
+ ],
2135
+ "responses": {
2136
+ "200": {
2137
+ "content": {
2138
+ "application/json": {
2139
+ "schema": {
2140
+ "properties": {
2141
+ "data": {
2142
+ "$ref": "#/components/schemas/Connection"
2143
+ }
2144
+ },
2145
+ "required": ["data"],
2146
+ "type": "object"
2147
+ }
2148
+ }
2149
+ },
2150
+ "description": "How to reach one app; never contains secrets"
2151
+ },
2152
+ "400": {
2153
+ "content": {
2154
+ "application/json": {
2155
+ "schema": {
2156
+ "$ref": "#/components/schemas/ErrorResponse"
2157
+ }
2158
+ }
2159
+ },
2160
+ "description": "Invalid request"
2161
+ },
2162
+ "401": {
2163
+ "content": {
2164
+ "application/json": {
2165
+ "schema": {
2166
+ "$ref": "#/components/schemas/ErrorResponse"
2167
+ }
2168
+ }
2169
+ },
2170
+ "description": "Authentication required"
2171
+ },
2172
+ "403": {
2173
+ "content": {
2174
+ "application/json": {
2175
+ "schema": {
2176
+ "$ref": "#/components/schemas/ErrorResponse"
2177
+ }
2178
+ }
2179
+ },
2180
+ "description": "Permission denied"
2181
+ },
2182
+ "404": {
2183
+ "content": {
2184
+ "application/json": {
2185
+ "schema": {
2186
+ "$ref": "#/components/schemas/ErrorResponse"
2187
+ }
2188
+ }
2189
+ },
2190
+ "description": "Resource not found"
2191
+ },
2192
+ "409": {
2193
+ "content": {
2194
+ "application/json": {
2195
+ "schema": {
2196
+ "$ref": "#/components/schemas/ErrorResponse"
2197
+ }
2198
+ }
2199
+ },
2200
+ "description": "Conflicting request or version"
2201
+ },
2202
+ "413": {
2203
+ "content": {
2204
+ "application/json": {
2205
+ "schema": {
2206
+ "$ref": "#/components/schemas/ErrorResponse"
2207
+ }
2208
+ }
2209
+ },
2210
+ "description": "Request body too large"
2211
+ },
2212
+ "422": {
2213
+ "content": {
2214
+ "application/json": {
2215
+ "schema": {
2216
+ "$ref": "#/components/schemas/ErrorResponse"
2217
+ }
2218
+ }
2219
+ },
2220
+ "description": "Unsupported configuration"
2221
+ },
2222
+ "429": {
2223
+ "content": {
2224
+ "application/json": {
2225
+ "schema": {
2226
+ "$ref": "#/components/schemas/ErrorResponse"
2227
+ }
2228
+ }
2229
+ },
2230
+ "description": "Admission limit reached"
2231
+ },
2232
+ "500": {
2233
+ "content": {
2234
+ "application/json": {
2235
+ "schema": {
2236
+ "$ref": "#/components/schemas/ErrorResponse"
2237
+ }
2238
+ }
2239
+ },
2240
+ "description": "Unexpected failure"
2241
+ },
2242
+ "503": {
2243
+ "content": {
2244
+ "application/json": {
2245
+ "schema": {
2246
+ "$ref": "#/components/schemas/ErrorResponse"
2247
+ }
2248
+ }
2249
+ },
2250
+ "description": "Dependency unavailable"
2251
+ }
2252
+ },
2253
+ "security": [
2254
+ {
2255
+ "bearerAuth": []
2256
+ }
2257
+ ],
2258
+ "x-state-credentials": ["user", "api_key"]
2259
+ }
2260
+ },
2261
+ "/v1/environments/{environmentId}/apps/{appKey}/connection/reveal": {
2262
+ "post": {
2263
+ "operationId": "revealConnection",
2264
+ "parameters": [
2265
+ {
2266
+ "in": "path",
2267
+ "name": "environmentId",
2268
+ "required": true,
2269
+ "schema": {
2270
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
2271
+ "type": "string"
2272
+ }
2273
+ },
2274
+ {
2275
+ "in": "path",
2276
+ "name": "appKey",
2277
+ "required": true,
2278
+ "schema": {
2279
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
2280
+ "type": "string"
2281
+ }
2282
+ }
2283
+ ],
2284
+ "requestBody": {
2285
+ "content": {
2286
+ "application/json": {
2287
+ "schema": {
2288
+ "anyOf": [
2289
+ {
2290
+ "additionalProperties": false,
2291
+ "properties": {
2292
+ "connectionKey": {
2293
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
2294
+ "type": "string"
2295
+ }
2296
+ },
2297
+ "required": ["connectionKey"],
2298
+ "type": "object"
2299
+ },
2300
+ {
2301
+ "additionalProperties": false,
2302
+ "properties": {
2303
+ "actorId": {
2304
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
2305
+ "type": "string"
2306
+ }
2307
+ },
2308
+ "required": ["actorId"],
2309
+ "type": "object"
2310
+ },
2311
+ {
2312
+ "additionalProperties": false,
2313
+ "properties": {},
2314
+ "type": "object"
2315
+ }
2316
+ ]
2317
+ }
2318
+ }
2319
+ },
2320
+ "required": true
2321
+ },
2322
+ "responses": {
2323
+ "200": {
2324
+ "content": {
2325
+ "application/json": {
2326
+ "schema": {
2327
+ "properties": {
2328
+ "data": {
2329
+ "$ref": "#/components/schemas/ConnectionSecret"
2330
+ }
2331
+ },
2332
+ "required": ["data"],
2333
+ "type": "object"
2334
+ }
2335
+ }
2336
+ },
2337
+ "description": "Live credentials for one actor; recorded as an event"
2338
+ },
2339
+ "400": {
2340
+ "content": {
2341
+ "application/json": {
2342
+ "schema": {
2343
+ "$ref": "#/components/schemas/ErrorResponse"
2344
+ }
2345
+ }
2346
+ },
2347
+ "description": "Invalid request"
2348
+ },
2349
+ "401": {
2350
+ "content": {
2351
+ "application/json": {
2352
+ "schema": {
2353
+ "$ref": "#/components/schemas/ErrorResponse"
2354
+ }
2355
+ }
2356
+ },
2357
+ "description": "Authentication required"
2358
+ },
2359
+ "403": {
2360
+ "content": {
2361
+ "application/json": {
2362
+ "schema": {
2363
+ "$ref": "#/components/schemas/ErrorResponse"
2364
+ }
2365
+ }
2366
+ },
2367
+ "description": "Permission denied"
2368
+ },
2369
+ "404": {
2370
+ "content": {
2371
+ "application/json": {
2372
+ "schema": {
2373
+ "$ref": "#/components/schemas/ErrorResponse"
2374
+ }
2375
+ }
2376
+ },
2377
+ "description": "Resource not found"
2378
+ },
2379
+ "409": {
2380
+ "content": {
2381
+ "application/json": {
2382
+ "schema": {
2383
+ "$ref": "#/components/schemas/ErrorResponse"
2384
+ }
2385
+ }
2386
+ },
2387
+ "description": "Conflicting request or version"
2388
+ },
2389
+ "413": {
2390
+ "content": {
2391
+ "application/json": {
2392
+ "schema": {
2393
+ "$ref": "#/components/schemas/ErrorResponse"
2394
+ }
2395
+ }
2396
+ },
2397
+ "description": "Request body too large"
2398
+ },
2399
+ "422": {
2400
+ "content": {
2401
+ "application/json": {
2402
+ "schema": {
2403
+ "$ref": "#/components/schemas/ErrorResponse"
2404
+ }
2405
+ }
2406
+ },
2407
+ "description": "Unsupported configuration"
2408
+ },
2409
+ "429": {
2410
+ "content": {
2411
+ "application/json": {
2412
+ "schema": {
2413
+ "$ref": "#/components/schemas/ErrorResponse"
2414
+ }
2415
+ }
2416
+ },
2417
+ "description": "Admission limit reached"
2418
+ },
2419
+ "500": {
2420
+ "content": {
2421
+ "application/json": {
2422
+ "schema": {
2423
+ "$ref": "#/components/schemas/ErrorResponse"
2424
+ }
2425
+ }
2426
+ },
2427
+ "description": "Unexpected failure"
2428
+ },
2429
+ "503": {
2430
+ "content": {
2431
+ "application/json": {
2432
+ "schema": {
2433
+ "$ref": "#/components/schemas/ErrorResponse"
2434
+ }
2435
+ }
2436
+ },
2437
+ "description": "Dependency unavailable"
2438
+ }
2439
+ },
2440
+ "security": [
2441
+ {
2442
+ "bearerAuth": []
2443
+ }
2444
+ ],
2445
+ "x-state-credentials": ["user", "api_key"]
2446
+ }
2447
+ },
2448
+ "/v1/environments/{environmentId}/events": {
2449
+ "get": {
2450
+ "operationId": "listEnvironmentEvents",
2451
+ "parameters": [
2452
+ {
2453
+ "in": "path",
2454
+ "name": "environmentId",
2455
+ "required": true,
2456
+ "schema": {
2457
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
2458
+ "type": "string"
2459
+ }
2460
+ },
2461
+ {
2462
+ "in": "query",
2463
+ "name": "limit",
2464
+ "required": false,
2465
+ "schema": {
2466
+ "default": 50,
2467
+ "maximum": 100,
2468
+ "minimum": 1,
2469
+ "type": "integer"
2470
+ }
2471
+ },
2472
+ {
2473
+ "in": "query",
2474
+ "name": "cursor",
2475
+ "required": false,
2476
+ "schema": {
2477
+ "maxLength": 64,
2478
+ "pattern": "^\\d+$",
2479
+ "type": "string"
2480
+ }
1214
2481
  }
1215
2482
  ],
1216
- "x-state-credentials": ["user", "api_key"]
1217
- }
1218
- },
1219
- "/v1/credential": {
1220
- "get": {
1221
- "operationId": "getCredential",
1222
2483
  "responses": {
1223
2484
  "200": {
1224
2485
  "content": {
1225
2486
  "application/json": {
1226
2487
  "schema": {
1227
- "properties": {
1228
- "data": {
1229
- "$ref": "#/components/schemas/Credential"
1230
- }
1231
- },
1232
- "required": ["data"],
1233
- "type": "object"
2488
+ "$ref": "#/components/schemas/EventPage"
1234
2489
  }
1235
2490
  }
1236
2491
  },
1237
- "description": "The calling credential, its workspace and its limits"
2492
+ "description": "The environment's timeline, oldest first"
1238
2493
  },
1239
2494
  "400": {
1240
2495
  "content": {
@@ -1345,9 +2600,9 @@
1345
2600
  "x-state-credentials": ["user", "api_key"]
1346
2601
  }
1347
2602
  },
1348
- "/v1/environments/{environmentId}": {
2603
+ "/v1/environments/{environmentId}/history": {
1349
2604
  "get": {
1350
- "operationId": "getEnvironment",
2605
+ "operationId": "listEnvironmentHistory",
1351
2606
  "parameters": [
1352
2607
  {
1353
2608
  "in": "path",
@@ -1357,6 +2612,26 @@
1357
2612
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
1358
2613
  "type": "string"
1359
2614
  }
2615
+ },
2616
+ {
2617
+ "in": "query",
2618
+ "name": "limit",
2619
+ "required": false,
2620
+ "schema": {
2621
+ "default": 50,
2622
+ "maximum": 100,
2623
+ "minimum": 1,
2624
+ "type": "integer"
2625
+ }
2626
+ },
2627
+ {
2628
+ "in": "query",
2629
+ "name": "cursor",
2630
+ "required": false,
2631
+ "schema": {
2632
+ "maxLength": 2048,
2633
+ "type": "string"
2634
+ }
1360
2635
  }
1361
2636
  ],
1362
2637
  "responses": {
@@ -1366,15 +2641,21 @@
1366
2641
  "schema": {
1367
2642
  "properties": {
1368
2643
  "data": {
1369
- "$ref": "#/components/schemas/Environment"
2644
+ "items": {
2645
+ "$ref": "#/components/schemas/EnvironmentExchange"
2646
+ },
2647
+ "type": "array"
2648
+ },
2649
+ "nextCursor": {
2650
+ "type": ["string", "null"]
1370
2651
  }
1371
2652
  },
1372
- "required": ["data"],
2653
+ "required": ["data", "nextCursor"],
1373
2654
  "type": "object"
1374
2655
  }
1375
2656
  }
1376
2657
  },
1377
- "description": "Environment and its apps"
2658
+ "description": "The environment's exchanges in gateway order, each with its transactions and events"
1378
2659
  },
1379
2660
  "400": {
1380
2661
  "content": {
@@ -1483,9 +2764,11 @@
1483
2764
  }
1484
2765
  ],
1485
2766
  "x-state-credentials": ["user", "api_key"]
1486
- },
1487
- "patch": {
1488
- "operationId": "updateEnvironment",
2767
+ }
2768
+ },
2769
+ "/v1/environments/{environmentId}/history/position": {
2770
+ "get": {
2771
+ "operationId": "getEnvironmentPosition",
1489
2772
  "parameters": [
1490
2773
  {
1491
2774
  "in": "path",
@@ -1497,35 +2780,6 @@
1497
2780
  }
1498
2781
  }
1499
2782
  ],
1500
- "requestBody": {
1501
- "content": {
1502
- "application/json": {
1503
- "schema": {
1504
- "properties": {
1505
- "expectedVersion": {
1506
- "minimum": 1,
1507
- "type": "integer"
1508
- },
1509
- "labels": {
1510
- "additionalProperties": {
1511
- "maxLength": 256,
1512
- "type": "string"
1513
- },
1514
- "type": "object"
1515
- },
1516
- "name": {
1517
- "maxLength": 120,
1518
- "minLength": 1,
1519
- "type": ["string", "null"]
1520
- }
1521
- },
1522
- "required": ["expectedVersion"],
1523
- "type": "object"
1524
- }
1525
- }
1526
- },
1527
- "required": true
1528
- },
1529
2783
  "responses": {
1530
2784
  "200": {
1531
2785
  "content": {
@@ -1533,7 +2787,7 @@
1533
2787
  "schema": {
1534
2788
  "properties": {
1535
2789
  "data": {
1536
- "$ref": "#/components/schemas/Environment"
2790
+ "$ref": "#/components/schemas/EnvironmentPosition"
1537
2791
  }
1538
2792
  },
1539
2793
  "required": ["data"],
@@ -1541,7 +2795,7 @@
1541
2795
  }
1542
2796
  }
1543
2797
  },
1544
- "description": "Environment renamed or relabeled"
2798
+ "description": "Each app's current head position, as a fork from it would start"
1545
2799
  },
1546
2800
  "400": {
1547
2801
  "content": {
@@ -1652,9 +2906,9 @@
1652
2906
  "x-state-credentials": ["user", "api_key"]
1653
2907
  }
1654
2908
  },
1655
- "/v1/environments/{environmentId}/apps/{appKey}/connection": {
2909
+ "/v1/environments/{environmentId}/history/{exchangeId}": {
1656
2910
  "get": {
1657
- "operationId": "getConnection",
2911
+ "operationId": "getEnvironmentExchange",
1658
2912
  "parameters": [
1659
2913
  {
1660
2914
  "in": "path",
@@ -1667,10 +2921,11 @@
1667
2921
  },
1668
2922
  {
1669
2923
  "in": "path",
1670
- "name": "appKey",
2924
+ "name": "exchangeId",
1671
2925
  "required": true,
1672
2926
  "schema": {
1673
- "pattern": "^[a-z][a-z0-9-]{0,39}$",
2927
+ "maxLength": 128,
2928
+ "minLength": 1,
1674
2929
  "type": "string"
1675
2930
  }
1676
2931
  }
@@ -1682,7 +2937,7 @@
1682
2937
  "schema": {
1683
2938
  "properties": {
1684
2939
  "data": {
1685
- "$ref": "#/components/schemas/Connection"
2940
+ "$ref": "#/components/schemas/EnvironmentExchange"
1686
2941
  }
1687
2942
  },
1688
2943
  "required": ["data"],
@@ -1690,7 +2945,7 @@
1690
2945
  }
1691
2946
  }
1692
2947
  },
1693
- "description": "How to reach one app; never contains secrets"
2948
+ "description": "One exchange of the environment, with the position a fork after it starts from"
1694
2949
  },
1695
2950
  "400": {
1696
2951
  "content": {
@@ -1801,9 +3056,9 @@
1801
3056
  "x-state-credentials": ["user", "api_key"]
1802
3057
  }
1803
3058
  },
1804
- "/v1/environments/{environmentId}/apps/{appKey}/connection/reveal": {
3059
+ "/v1/environments/{environmentId}/resume": {
1805
3060
  "post": {
1806
- "operationId": "revealConnection",
3061
+ "operationId": "resumeEnvironment",
1807
3062
  "parameters": [
1808
3063
  {
1809
3064
  "in": "path",
@@ -1813,55 +3068,8 @@
1813
3068
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
1814
3069
  "type": "string"
1815
3070
  }
1816
- },
1817
- {
1818
- "in": "path",
1819
- "name": "appKey",
1820
- "required": true,
1821
- "schema": {
1822
- "pattern": "^[a-z][a-z0-9-]{0,39}$",
1823
- "type": "string"
1824
- }
1825
3071
  }
1826
3072
  ],
1827
- "requestBody": {
1828
- "content": {
1829
- "application/json": {
1830
- "schema": {
1831
- "anyOf": [
1832
- {
1833
- "additionalProperties": false,
1834
- "properties": {
1835
- "connectionKey": {
1836
- "pattern": "^[a-z][a-z0-9-]{0,39}$",
1837
- "type": "string"
1838
- }
1839
- },
1840
- "required": ["connectionKey"],
1841
- "type": "object"
1842
- },
1843
- {
1844
- "additionalProperties": false,
1845
- "properties": {
1846
- "actorId": {
1847
- "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
1848
- "type": "string"
1849
- }
1850
- },
1851
- "required": ["actorId"],
1852
- "type": "object"
1853
- },
1854
- {
1855
- "additionalProperties": false,
1856
- "properties": {},
1857
- "type": "object"
1858
- }
1859
- ]
1860
- }
1861
- }
1862
- },
1863
- "required": true
1864
- },
1865
3073
  "responses": {
1866
3074
  "200": {
1867
3075
  "content": {
@@ -1869,7 +3077,7 @@
1869
3077
  "schema": {
1870
3078
  "properties": {
1871
3079
  "data": {
1872
- "$ref": "#/components/schemas/ConnectionSecret"
3080
+ "$ref": "#/components/schemas/Environment"
1873
3081
  }
1874
3082
  },
1875
3083
  "required": ["data"],
@@ -1877,7 +3085,7 @@
1877
3085
  }
1878
3086
  }
1879
3087
  },
1880
- "description": "Live credentials for one actor; recorded as an event"
3088
+ "description": "Environment queued to run again on the data it was suspended with"
1881
3089
  },
1882
3090
  "400": {
1883
3091
  "content": {
@@ -1988,9 +3196,9 @@
1988
3196
  "x-state-credentials": ["user", "api_key"]
1989
3197
  }
1990
3198
  },
1991
- "/v1/environments/{environmentId}/events": {
1992
- "get": {
1993
- "operationId": "listEnvironmentEvents",
3199
+ "/v1/environments/{environmentId}/stop": {
3200
+ "post": {
3201
+ "operationId": "stopEnvironment",
1994
3202
  "parameters": [
1995
3203
  {
1996
3204
  "in": "path",
@@ -2000,27 +3208,6 @@
2000
3208
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
2001
3209
  "type": "string"
2002
3210
  }
2003
- },
2004
- {
2005
- "in": "query",
2006
- "name": "limit",
2007
- "required": false,
2008
- "schema": {
2009
- "default": 50,
2010
- "maximum": 100,
2011
- "minimum": 1,
2012
- "type": "integer"
2013
- }
2014
- },
2015
- {
2016
- "in": "query",
2017
- "name": "cursor",
2018
- "required": false,
2019
- "schema": {
2020
- "maxLength": 64,
2021
- "pattern": "^\\d+$",
2022
- "type": "string"
2023
- }
2024
3211
  }
2025
3212
  ],
2026
3213
  "responses": {
@@ -2028,11 +3215,17 @@
2028
3215
  "content": {
2029
3216
  "application/json": {
2030
3217
  "schema": {
2031
- "$ref": "#/components/schemas/EventPage"
3218
+ "properties": {
3219
+ "data": {
3220
+ "$ref": "#/components/schemas/Environment"
3221
+ }
3222
+ },
3223
+ "required": ["data"],
3224
+ "type": "object"
2032
3225
  }
2033
3226
  }
2034
3227
  },
2035
- "description": "The environment's timeline, oldest first"
3228
+ "description": "Environment stopping or stopped; its data is discarded"
2036
3229
  },
2037
3230
  "400": {
2038
3231
  "content": {
@@ -2143,9 +3336,9 @@
2143
3336
  "x-state-credentials": ["user", "api_key"]
2144
3337
  }
2145
3338
  },
2146
- "/v1/environments/{environmentId}/stop": {
3339
+ "/v1/environments/{environmentId}/suspend": {
2147
3340
  "post": {
2148
- "operationId": "stopEnvironment",
3341
+ "operationId": "suspendEnvironment",
2149
3342
  "parameters": [
2150
3343
  {
2151
3344
  "in": "path",
@@ -2172,7 +3365,7 @@
2172
3365
  }
2173
3366
  }
2174
3367
  },
2175
- "description": "Environment stopped or stopping"
3368
+ "description": "Environment suspending or suspended: its sandboxes go, its data stays for a resume"
2176
3369
  },
2177
3370
  "400": {
2178
3371
  "content": {
@@ -3142,6 +4335,104 @@
3142
4335
  "required": ["snapshot"],
3143
4336
  "type": "object"
3144
4337
  },
4338
+ "labels": {
4339
+ "additionalProperties": {
4340
+ "maxLength": 256,
4341
+ "type": "string"
4342
+ },
4343
+ "default": {},
4344
+ "type": "object"
4345
+ },
4346
+ "lifetimeMinutes": {
4347
+ "maximum": 1440,
4348
+ "minimum": 1,
4349
+ "type": "integer"
4350
+ },
4351
+ "name": {
4352
+ "maxLength": 120,
4353
+ "minLength": 1,
4354
+ "type": "string"
4355
+ },
4356
+ "version": {
4357
+ "default": 1,
4358
+ "enum": [1],
4359
+ "type": "number"
4360
+ }
4361
+ },
4362
+ "required": ["from"],
4363
+ "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
+ },
3145
4436
  "version": {
3146
4437
  "default": 1,
3147
4438
  "enum": [1],