@deepraxis/sdk 0.1.1-dev.daf2585 → 0.1.1-dev.dc553d7
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/METHODS.md +177 -13
- package/README.md +1 -1
- package/dist/core/credentials.d.ts +12 -3
- package/dist/core/credentials.js +22 -2
- package/dist/core/transport.d.ts +1 -1
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/index.js +1 -1
- package/dist/generated/sdk.gen.d.ts +359 -23
- package/dist/generated/sdk.gen.js +1871 -923
- package/dist/generated/types.gen.d.ts +20144 -13929
- package/dist/operations.generated.d.ts +35 -19629
- package/dist/operations.generated.js +6653 -4649
- package/dist/resources.generated.d.ts +104 -9
- package/dist/resources.generated.js +104 -8
- package/package.json +1 -1
package/METHODS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SDK methods
|
|
2
2
|
|
|
3
|
-
Generated by `bun run generate`.
|
|
3
|
+
Generated by `bun run generate`. 676 HTTP operations, plus product aliases. Version segments and path parameters are omitted from resource names. Inputs use typed `{ path, query, body, headers }` options. Collections form nested resource objects; POST actions retain their verb. Naming rules are documented in `scripts/resources.ts`; semantic exceptions and aliases with reasons are in `scripts/naming-overrides.ts`.
|
|
4
4
|
|
|
5
5
|
`always` returns an AsyncIterable; `optional` streams with `{ stream: true }`; `yes` pagination returns a Page. Only `{ data, next_cursor }` + `cursor` query contracts are automatically paginated.
|
|
6
6
|
|
|
@@ -576,9 +576,11 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
576
576
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
577
577
|
|---|---|---|---|---|
|
|
578
578
|
| create | POST | `/browser/v1/sessions` | no | no |
|
|
579
|
+
| frames | GET | `/browser/v1/sessions/{sessionId}/frames` | always | no |
|
|
579
580
|
| list | GET | `/browser/v1/sessions` | no | no |
|
|
580
581
|
| retrieve | GET | `/browser/v1/sessions/{sessionId}` | no | no |
|
|
581
582
|
| retrieveDebug | GET | `/browser/v1/sessions/{sessionId}/debug` | no | no |
|
|
583
|
+
| retrieveFrame | GET | `/browser/v1/sessions/{sessionId}/frame` | no | no |
|
|
582
584
|
| stream | GET | `/browser/v1/sessions/{sessionId}/stream` | always | no |
|
|
583
585
|
| update | POST | `/browser/v1/sessions/{sessionId}` | no | no |
|
|
584
586
|
|
|
@@ -878,12 +880,78 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
878
880
|
|
|
879
881
|
## devops
|
|
880
882
|
|
|
883
|
+
### devops.environments.checkpoints
|
|
884
|
+
|
|
885
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
886
|
+
|---|---|---|---|---|
|
|
887
|
+
| list | GET | `/devops/v1/environments/{id}/checkpoints` | no | no |
|
|
888
|
+
|
|
889
|
+
### devops.flags
|
|
890
|
+
|
|
891
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
892
|
+
|---|---|---|---|---|
|
|
893
|
+
| archive | POST | `/devops/v1/flags/{id}:archive` | no | no |
|
|
894
|
+
| conclude | POST | `/devops/v1/flags/{id}:conclude` | no | no |
|
|
895
|
+
| retrieve | GET | `/devops/v1/flags/{id}` | no | no |
|
|
896
|
+
| update | PATCH | `/devops/v1/flags/{id}` | no | no |
|
|
897
|
+
|
|
898
|
+
### devops.flags.environments
|
|
899
|
+
|
|
900
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
901
|
+
|---|---|---|---|---|
|
|
902
|
+
| update | PATCH | `/devops/v1/flags/{id}/environments/{environment}` | no | no |
|
|
903
|
+
|
|
904
|
+
### devops.progressiveRollouts
|
|
905
|
+
|
|
906
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
907
|
+
|---|---|---|---|---|
|
|
908
|
+
| create | POST | `/devops/v1/progressive-rollouts` | no | no |
|
|
909
|
+
| pause | POST | `/devops/v1/progressive-rollouts/{id}:pause` | no | no |
|
|
910
|
+
| resume | POST | `/devops/v1/progressive-rollouts/{id}:resume` | no | no |
|
|
911
|
+
| retrieve | GET | `/devops/v1/progressive-rollouts/{id}` | no | no |
|
|
912
|
+
| rollback | POST | `/devops/v1/progressive-rollouts/{id}:rollback` | no | no |
|
|
913
|
+
|
|
881
914
|
### devops.projects
|
|
882
915
|
|
|
883
916
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
884
917
|
|---|---|---|---|---|
|
|
918
|
+
| list | GET | `/devops/v1/projects` | no | no |
|
|
919
|
+
| retrieve | GET | `/devops/v1/projects/{id}` | no | no |
|
|
885
920
|
| retrieveTestCatalog | GET | `/devops/v1/projects/{project}/test-catalog` | no | no |
|
|
886
921
|
|
|
922
|
+
### devops.projects.environments
|
|
923
|
+
|
|
924
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
925
|
+
|---|---|---|---|---|
|
|
926
|
+
| list | GET | `/devops/v1/projects/{project}/environments` | no | no |
|
|
927
|
+
|
|
928
|
+
### devops.projects.flags
|
|
929
|
+
|
|
930
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
931
|
+
|---|---|---|---|---|
|
|
932
|
+
| create | POST | `/devops/v1/projects/{project}/flags` | no | no |
|
|
933
|
+
| list | GET | `/devops/v1/projects/{project}/flags` | no | no |
|
|
934
|
+
|
|
935
|
+
### devops.projects.promotions
|
|
936
|
+
|
|
937
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
938
|
+
|---|---|---|---|---|
|
|
939
|
+
| list | GET | `/devops/v1/projects/{project}/promotions` | no | no |
|
|
940
|
+
|
|
941
|
+
### devops.projects.releases
|
|
942
|
+
|
|
943
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
944
|
+
|---|---|---|---|---|
|
|
945
|
+
| create | POST | `/devops/v1/projects/{project}/releases` | no | no |
|
|
946
|
+
| list | GET | `/devops/v1/projects/{project}/releases` | no | no |
|
|
947
|
+
|
|
948
|
+
### devops.projects.targets
|
|
949
|
+
|
|
950
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
951
|
+
|---|---|---|---|---|
|
|
952
|
+
| list | GET | `/devops/v1/projects/{project}/targets` | no | no |
|
|
953
|
+
| refresh | POST | `/devops/v1/projects/{project}/targets:refresh` | no | no |
|
|
954
|
+
|
|
887
955
|
### devops.projects.testCases
|
|
888
956
|
|
|
889
957
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -916,6 +984,36 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
916
984
|
|---|---|---|---|---|
|
|
917
985
|
| list | GET | `/devops/v1/projects/{project}/test-suites` | no | no |
|
|
918
986
|
|
|
987
|
+
### devops.promotions
|
|
988
|
+
|
|
989
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
990
|
+
|---|---|---|---|---|
|
|
991
|
+
| approve | POST | `/devops/v1/promotions/{id}:approve` | no | no |
|
|
992
|
+
| cancel | POST | `/devops/v1/promotions/{id}:cancel` | no | no |
|
|
993
|
+
| conclude | POST | `/devops/v1/promotions/{id}:conclude` | no | no |
|
|
994
|
+
| create | POST | `/devops/v1/promotions` | no | no |
|
|
995
|
+
| retrieve | GET | `/devops/v1/promotions/{id}` | no | no |
|
|
996
|
+
| retry | POST | `/devops/v1/promotions/{id}:retry` | no | no |
|
|
997
|
+
|
|
998
|
+
### devops.promotions.rollouts
|
|
999
|
+
|
|
1000
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1001
|
+
|---|---|---|---|---|
|
|
1002
|
+
| list | GET | `/devops/v1/promotions/{promotion}/rollouts` | no | no |
|
|
1003
|
+
|
|
1004
|
+
### devops.releases
|
|
1005
|
+
|
|
1006
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1007
|
+
|---|---|---|---|---|
|
|
1008
|
+
| abandon | POST | `/devops/v1/releases/{id}:abandon` | no | no |
|
|
1009
|
+
| retrieve | GET | `/devops/v1/releases/{id}` | no | no |
|
|
1010
|
+
|
|
1011
|
+
### devops.rollouts
|
|
1012
|
+
|
|
1013
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1014
|
+
|---|---|---|---|---|
|
|
1015
|
+
| retrieve | GET | `/devops/v1/rollouts/{id}` | no | no |
|
|
1016
|
+
|
|
919
1017
|
### devops.testCases
|
|
920
1018
|
|
|
921
1019
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -1068,12 +1166,25 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1068
1166
|
|
|
1069
1167
|
## media
|
|
1070
1168
|
|
|
1169
|
+
### media.assets
|
|
1170
|
+
|
|
1171
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1172
|
+
|---|---|---|---|---|
|
|
1173
|
+
| edit | POST | `/media/v1/libraries/{library_id}/assets/{asset_id}/edits` | no | no |
|
|
1174
|
+
| lineage | GET | `/media/v1/libraries/{library_id}/assets/{asset_id}/lineage` | no | no |
|
|
1175
|
+
|
|
1071
1176
|
### media.generation.capabilities
|
|
1072
1177
|
|
|
1073
1178
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
1074
1179
|
|---|---|---|---|---|
|
|
1075
1180
|
| list | GET | `/media/v1/generation/capabilities` | no | no |
|
|
1076
1181
|
|
|
1182
|
+
### media.images
|
|
1183
|
+
|
|
1184
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1185
|
+
|---|---|---|---|---|
|
|
1186
|
+
| generate | POST | `/media/v1/libraries/{library_id}/images/generations` | no | no |
|
|
1187
|
+
|
|
1077
1188
|
### media.libraries
|
|
1078
1189
|
|
|
1079
1190
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -1083,6 +1194,8 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1083
1194
|
| list | GET | `/media/v1/libraries` | no | yes |
|
|
1084
1195
|
| restore | POST | `/media/v1/libraries/{library_id}/restore` | no | no |
|
|
1085
1196
|
| retrieve | GET | `/media/v1/libraries/{library_id}` | no | no |
|
|
1197
|
+
| retrieveDefault | GET | `/media/v1/libraries/default` | no | no |
|
|
1198
|
+
| setDefault | PUT | `/media/v1/libraries/default` | no | no |
|
|
1086
1199
|
| update | PATCH | `/media/v1/libraries/{library_id}` | no | no |
|
|
1087
1200
|
|
|
1088
1201
|
### media.libraries.assets
|
|
@@ -1145,12 +1258,6 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1145
1258
|
|---|---|---|---|---|
|
|
1146
1259
|
| list | GET | `/media/v1/libraries/{library_id}/folders` | no | no |
|
|
1147
1260
|
|
|
1148
|
-
### media.libraries.generations
|
|
1149
|
-
|
|
1150
|
-
| Method | HTTP | Path | Streaming | Pagination |
|
|
1151
|
-
|---|---|---|---|---|
|
|
1152
|
-
| create | POST | `/media/v1/libraries/{library_id}/generations` | no | no |
|
|
1153
|
-
|
|
1154
1261
|
### media.libraries.jobs
|
|
1155
1262
|
|
|
1156
1263
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -1159,12 +1266,6 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1159
1266
|
| list | GET | `/media/v1/libraries/{library_id}/jobs` | no | yes |
|
|
1160
1267
|
| retrieve | GET | `/media/v1/libraries/{library_id}/jobs/{job_id}` | no | no |
|
|
1161
1268
|
|
|
1162
|
-
### media.libraries.jobs.outputs.save
|
|
1163
|
-
|
|
1164
|
-
| Method | HTTP | Path | Streaming | Pagination |
|
|
1165
|
-
|---|---|---|---|---|
|
|
1166
|
-
| create | POST | `/media/v1/libraries/{library_id}/jobs/{job_id}/outputs/{index}/save` | no | no |
|
|
1167
|
-
|
|
1168
1269
|
### media.libraries.purge
|
|
1169
1270
|
|
|
1170
1271
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -1202,6 +1303,18 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1202
1303
|
| list | GET | `/media/v1/libraries/{library_id}/understandings` | no | yes |
|
|
1203
1304
|
| retrieveFailureSummary | GET | `/media/v1/libraries/{library_id}/understandings/failure_summary` | no | no |
|
|
1204
1305
|
|
|
1306
|
+
### media.speech
|
|
1307
|
+
|
|
1308
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1309
|
+
|---|---|---|---|---|
|
|
1310
|
+
| create | POST | `/media/v1/libraries/{library_id}/audio/speech` | no | no |
|
|
1311
|
+
|
|
1312
|
+
### media.videos
|
|
1313
|
+
|
|
1314
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1315
|
+
|---|---|---|---|---|
|
|
1316
|
+
| generate | POST | `/media/v1/libraries/{library_id}/videos/generations` | no | no |
|
|
1317
|
+
|
|
1205
1318
|
## meta
|
|
1206
1319
|
|
|
1207
1320
|
### meta.docs
|
|
@@ -1635,6 +1748,13 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1635
1748
|
| list | GET | `/studio/v1/platforms` | no | no |
|
|
1636
1749
|
| retrieve | GET | `/studio/v1/platforms/{platform}` | no | no |
|
|
1637
1750
|
|
|
1751
|
+
### studio.reviewers
|
|
1752
|
+
|
|
1753
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1754
|
+
|---|---|---|---|---|
|
|
1755
|
+
| list | GET | `/studio/v1/reviewers` | no | no |
|
|
1756
|
+
| update | PATCH | `/studio/v1/reviewers/{agent}` | no | no |
|
|
1757
|
+
|
|
1638
1758
|
### studio.styles
|
|
1639
1759
|
|
|
1640
1760
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -1688,6 +1808,12 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1688
1808
|
| retrieveReview | GET | `/studio/v1/works/{work}/drafts/{draft}/review` | no | no |
|
|
1689
1809
|
| update | PATCH | `/studio/v1/works/{work}/drafts/{draft}` | no | no |
|
|
1690
1810
|
|
|
1811
|
+
### studio.works.drafts.renditions
|
|
1812
|
+
|
|
1813
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1814
|
+
|---|---|---|---|---|
|
|
1815
|
+
| create | POST | `/studio/v1/works/{work}/drafts/{draft}/renditions` | no | no |
|
|
1816
|
+
|
|
1691
1817
|
### studio.works.drafts.status
|
|
1692
1818
|
|
|
1693
1819
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -1702,6 +1828,35 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1702
1828
|
| batchUpdate | POST | `/studio/v1/works/{work}/drafts/{draft}/units:batchUpdate` | no | no |
|
|
1703
1829
|
| create | POST | `/studio/v1/works/{work}/drafts/{draft}/units` | no | no |
|
|
1704
1830
|
|
|
1831
|
+
### studio.works.renditions
|
|
1832
|
+
|
|
1833
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1834
|
+
|---|---|---|---|---|
|
|
1835
|
+
| delete | DELETE | `/studio/v1/works/{work}/renditions/{rendition}` | no | no |
|
|
1836
|
+
| list | GET | `/studio/v1/works/{work}/renditions` | no | no |
|
|
1837
|
+
| publish | POST | `/studio/v1/works/{work}/renditions/{rendition}:publish` | no | no |
|
|
1838
|
+
| render | POST | `/studio/v1/works/{work}/renditions/{rendition}:render` | no | no |
|
|
1839
|
+
| retrieve | GET | `/studio/v1/works/{work}/renditions/{rendition}` | no | no |
|
|
1840
|
+
| retrieveContent | GET | `/studio/v1/works/{work}/renditions/{rendition}/content` | no | no |
|
|
1841
|
+
| update | PATCH | `/studio/v1/works/{work}/renditions/{rendition}` | no | no |
|
|
1842
|
+
|
|
1843
|
+
### studio.works.reviewSettings
|
|
1844
|
+
|
|
1845
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1846
|
+
|---|---|---|---|---|
|
|
1847
|
+
| retrieve | GET | `/studio/v1/works/{work}/review-settings` | no | no |
|
|
1848
|
+
| update | PATCH | `/studio/v1/works/{work}/review-settings` | no | no |
|
|
1849
|
+
|
|
1850
|
+
### studio.works.reviews
|
|
1851
|
+
|
|
1852
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1853
|
+
|---|---|---|---|---|
|
|
1854
|
+
| appeal | POST | `/studio/v1/works/{work}/reviews/{review}:appeal` | no | no |
|
|
1855
|
+
| cancel | POST | `/studio/v1/works/{work}/reviews/{review}:cancel` | no | no |
|
|
1856
|
+
| create | POST | `/studio/v1/works/{work}/reviews` | no | no |
|
|
1857
|
+
| list | GET | `/studio/v1/works/{work}/reviews` | no | no |
|
|
1858
|
+
| retrieve | GET | `/studio/v1/works/{work}/reviews/{review}` | no | no |
|
|
1859
|
+
|
|
1705
1860
|
### studio.works.units
|
|
1706
1861
|
|
|
1707
1862
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -1765,6 +1920,7 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1765
1920
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
1766
1921
|
|---|---|---|---|---|
|
|
1767
1922
|
| list | GET | `/ticket/v1/repositories` | no | no |
|
|
1923
|
+
| update | PATCH | `/ticket/v1/repositories/{id}` | no | no |
|
|
1768
1924
|
|
|
1769
1925
|
### ticket.tickets
|
|
1770
1926
|
|
|
@@ -1956,11 +2112,19 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1956
2112
|
| crm.properties.archive | CRM DELETE archives the resource rather than permanently deleting it; expose the archive product verb. |
|
|
1957
2113
|
| database.databases.rest.create | The final parameter identifies a table collection; POST inserts rows rather than updating the table. |
|
|
1958
2114
|
| file.uploads.createSigned | Signed upload creation returns a one-time local PUT URL; ADR-039 names this operation uploads.createSigned. |
|
|
2115
|
+
| media.libraries.retrieveDefault | ADR-094 §9 names the default-library read libraries.retrieveDefault; the URL names a reference rather than an id, so the path-derived name would otherwise read as retrieving a library called default. |
|
|
2116
|
+
| media.libraries.setDefault | ADR-094 §9 names the default-library write libraries.setDefault; the URL has no library id because the organization owns one default library, so the path alone cannot say which. |
|
|
2117
|
+
| media.assets.edit | ADR-094 §9 names the edit write assets.edit; an edit acts on the addressed asset and returns a Job, so the URL nesting under a library is a mount rather than an SDK resource level. |
|
|
2118
|
+
| media.assets.lineage | ADR-094 §9 names the edit-tree read assets.lineage; lineage is the product verb and the URL nesting under a library is a mount, not an SDK resource level. |
|
|
2119
|
+
| media.speech.create | ADR-094 §1/§9 names speech synthesis speech.create; the URL says audio/speech because that is the artifact the caller gets back, and the path alone would derive a speech collection create under an audio level that is not an SDK resource. |
|
|
2120
|
+
| media.images.generate | ADR-094 §9 names image generation images.generate; the URL mounts it under a library, but generation is an operation on images and the path alone would derive a generations collection create. |
|
|
2121
|
+
| media.videos.generate | ADR-094 §2/§9 names video generation videos.generate beside images.generate; the URL mounts it under a library, but generation is an operation on videos and the path alone would derive a generations collection create. The unqualified videos resource is the video lane, distinct from the batch and legacy job resources. |
|
|
1959
2122
|
| meta.docs.search | Documentation keyword search is an operation on docs, not a nested collection. |
|
|
1960
2123
|
| sandbox.sandboxes.commands.run | Sandbox data operations use the E2B SDK verb while preserving URL resource nesting. |
|
|
1961
2124
|
| sandbox.sandboxes.files.remove | Sandbox data operations use the E2B SDK verb while preserving URL resource nesting. |
|
|
1962
2125
|
| sandbox.sandboxes.files.read | Sandbox data operations use the E2B SDK verb while preserving URL resource nesting. |
|
|
1963
2126
|
| sandbox.sandboxes.files.write | Sandbox data operations use the E2B SDK verb while preserving URL resource nesting. |
|
|
2127
|
+
| studio.works.reviewSettings.retrieve | A work has one review-settings singleton; the segment ends in s only because English writes it that way, so the collection rule would derive reviewSettings.list for a read that returns the settings object itself. |
|
|
1964
2128
|
| vault.oauth.retrieveClientMetadata | The literal .json filename otherwise introduces a dot inside a method identifier. |
|
|
1965
2129
|
|
|
1966
2130
|
## SDK parameter aliases
|
package/README.md
CHANGED
|
@@ -122,7 +122,7 @@ conversation with it, on its own machine.
|
|
|
122
122
|
```ts
|
|
123
123
|
const { sandboxes } = praxis.sandbox;
|
|
124
124
|
const sandbox = await sandboxes.create({
|
|
125
|
-
body: { templateID: 'base' },
|
|
125
|
+
body: { templateID: 'base', autoPause: false }, // ends at its timeout; autoPause: true keeps a long-lived computer
|
|
126
126
|
});
|
|
127
127
|
const result = await sandboxes.commands.run({
|
|
128
128
|
path: { sandbox_id: sandbox.sandboxID },
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Default credential chain for code running on a Praxis computer (ticket-5367):
|
|
3
|
-
* PRAXIS_API_TOKEN environment variable, then
|
|
4
|
-
*
|
|
2
|
+
* Default credential chain for code running on a Praxis computer (ticket-5367, ADR-098 §2):
|
|
3
|
+
* the PRAXIS_API_TOKEN environment variable, then the login file of the environment,
|
|
4
|
+
* `~/.praxis/cli/<env>.json` — the one file `praxis login` writes for a person and the platform writes
|
|
5
|
+
* for a managed login. Resolved at call time so a token the platform renewed in the file is picked up
|
|
6
|
+
* by an already-running process.
|
|
5
7
|
*/
|
|
6
8
|
export interface ResolvedCredentials {
|
|
7
9
|
token?: string;
|
|
@@ -9,6 +11,13 @@ export interface ResolvedCredentials {
|
|
|
9
11
|
}
|
|
10
12
|
type Env = Record<string, string | undefined>;
|
|
11
13
|
type ReadFile = (path: string) => string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Which environment's login file applies: PRAXIS_ENV when it names one, otherwise a `-develop.` host in
|
|
16
|
+
* PRAXIS_API_URL means develop and any other host production — the rule apps/cli/src/config/env.ts
|
|
17
|
+
* applies. A PRAXIS_ENV that is not a plain name is no environment at all and is ignored. Pure.
|
|
18
|
+
*/
|
|
19
|
+
export declare function credentialsEnv(env: Env): string;
|
|
20
|
+
/** The one login file, the same path the CLI reads for this environment. Null without a home directory. Pure. */
|
|
12
21
|
export declare function credentialsPath(env: Env): string | null;
|
|
13
22
|
export declare function resolveDefaultCredentials(env?: Env, readFile?: ReadFile): ResolvedCredentials;
|
|
14
23
|
export {};
|
package/dist/core/credentials.js
CHANGED
|
@@ -8,9 +8,29 @@ function defaultReadFile(path) {
|
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Which environment's login file applies: PRAXIS_ENV when it names one, otherwise a `-develop.` host in
|
|
13
|
+
* PRAXIS_API_URL means develop and any other host production — the rule apps/cli/src/config/env.ts
|
|
14
|
+
* applies. A PRAXIS_ENV that is not a plain name is no environment at all and is ignored. Pure.
|
|
15
|
+
*/
|
|
16
|
+
export function credentialsEnv(env) {
|
|
17
|
+
const declared = nonEmpty(env.PRAXIS_ENV);
|
|
18
|
+
if (declared && /^[A-Za-z0-9_-]+$/.test(declared))
|
|
19
|
+
return declared;
|
|
20
|
+
const apiUrl = nonEmpty(env.PRAXIS_API_URL);
|
|
21
|
+
if (apiUrl) {
|
|
22
|
+
try {
|
|
23
|
+
if (new URL(apiUrl).hostname.includes('-develop.'))
|
|
24
|
+
return 'develop';
|
|
25
|
+
}
|
|
26
|
+
catch { /* a malformed URL is not evidence of develop */ }
|
|
27
|
+
}
|
|
28
|
+
return 'production';
|
|
29
|
+
}
|
|
30
|
+
/** The one login file, the same path the CLI reads for this environment. Null without a home directory. Pure. */
|
|
11
31
|
export function credentialsPath(env) {
|
|
12
32
|
const home = nonEmpty(env.HOME) ?? nonEmpty(env.USERPROFILE);
|
|
13
|
-
return home ? `${home.replace(
|
|
33
|
+
return home ? `${home.replace(/[/\\]+$/, '')}/.praxis/cli/${credentialsEnv(env)}.json` : null;
|
|
14
34
|
}
|
|
15
35
|
export function resolveDefaultCredentials(env = globalThis.process?.env ?? {}, readFile = defaultReadFile) {
|
|
16
36
|
const envToken = nonEmpty(env.PRAXIS_API_TOKEN);
|
|
@@ -23,7 +43,7 @@ export function resolveDefaultCredentials(env = globalThis.process?.env ?? {}, r
|
|
|
23
43
|
return envUrl ? { apiUrl: envUrl } : {};
|
|
24
44
|
try {
|
|
25
45
|
const file = JSON.parse(text);
|
|
26
|
-
const token = nonEmpty(file.
|
|
46
|
+
const token = nonEmpty(file.access_token);
|
|
27
47
|
const apiUrl = envUrl ?? nonEmpty(file.api_url);
|
|
28
48
|
return { ...(token ? { token } : {}), ...(apiUrl ? { apiUrl } : {}) };
|
|
29
49
|
}
|
package/dist/core/transport.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type SSEEvent } from './sse.js';
|
|
2
2
|
export interface PraxisOptions {
|
|
3
|
-
/** Explicit key. Omitted on a Praxis computer: PRAXIS_API_TOKEN, then
|
|
3
|
+
/** Explicit key. Omitted on a Praxis computer: PRAXIS_API_TOKEN, then the login file `~/.praxis/cli/<env>.json`, are used. */
|
|
4
4
|
apiKey?: string;
|
|
5
5
|
baseUrl?: string;
|
|
6
6
|
timeoutMs?: number;
|