@deepraxis/sdk 0.1.1-dev.80dd587 → 0.1.1-dev.8711262
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 +189 -20
- package/dist/core/credentials.d.ts +16 -6
- package/dist/core/credentials.js +24 -5
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/index.js +1 -1
- package/dist/generated/sdk.gen.d.ts +351 -51
- package/dist/generated/sdk.gen.js +1028 -187
- package/dist/generated/types.gen.d.ts +6982 -1661
- package/dist/operations.generated.js +7225 -5705
- package/dist/resources.generated.d.ts +512 -115
- package/dist/resources.generated.js +123 -12
- 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`. 841 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
|
|
|
@@ -35,25 +35,6 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
35
35
|
| retrieve | GET | `/agent/v1/agents/{agent_id}/customers/{customer_id}` | no | no |
|
|
36
36
|
| retrieveDeletion | GET | `/agent/v1/agents/{agent_id}/customers/{customer_id}/deletion` | no | no |
|
|
37
37
|
|
|
38
|
-
### agent.agents.customers.auth.accessTokens
|
|
39
|
-
|
|
40
|
-
| Method | HTTP | Path | Streaming | Pagination |
|
|
41
|
-
|---|---|---|---|---|
|
|
42
|
-
| create | POST | `/agent/v1/agents/{agent_id}/customers/auth/access_tokens` | no | no |
|
|
43
|
-
| deleteCurrent | DELETE | `/agent/v1/agents/{agent_id}/customers/auth/access_tokens/current` | no | no |
|
|
44
|
-
|
|
45
|
-
### agent.agents.customers.auth.accessTokens.renew
|
|
46
|
-
|
|
47
|
-
| Method | HTTP | Path | Streaming | Pagination |
|
|
48
|
-
|---|---|---|---|---|
|
|
49
|
-
| create | POST | `/agent/v1/agents/{agent_id}/customers/auth/access_tokens/renew` | no | no |
|
|
50
|
-
|
|
51
|
-
### agent.agents.customers.auth.grantCodes
|
|
52
|
-
|
|
53
|
-
| Method | HTTP | Path | Streaming | Pagination |
|
|
54
|
-
|---|---|---|---|---|
|
|
55
|
-
| create | POST | `/agent/v1/agents/{agent_id}/customers/auth/grant_codes` | no | no |
|
|
56
|
-
|
|
57
38
|
### agent.agents.customers.block
|
|
58
39
|
|
|
59
40
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -80,6 +61,12 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
80
61
|
| send | POST | `/agent/v1/agents/{agent_id}/events` | no | no |
|
|
81
62
|
| stream | GET | `/agent/v1/agents/{agent_id}/events/stream` | always | no |
|
|
82
63
|
|
|
64
|
+
### agent.agents.inbox.letters
|
|
65
|
+
|
|
66
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
67
|
+
|---|---|---|---|---|
|
|
68
|
+
| list | GET | `/agent/v1/agents/{agent_id}/inbox/letters` | no | no |
|
|
69
|
+
|
|
83
70
|
### agent.agents.unarchive
|
|
84
71
|
|
|
85
72
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -225,6 +212,12 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
225
212
|
| send | POST | `/agent/v1/sessions/{session_id}/events` | no | no |
|
|
226
213
|
| stream | GET | `/agent/v1/sessions/{session_id}/events/stream` | always | no |
|
|
227
214
|
|
|
215
|
+
### agent.sessions.requests
|
|
216
|
+
|
|
217
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
218
|
+
|---|---|---|---|---|
|
|
219
|
+
| list | GET | `/agent/v1/sessions/{session_id}/requests` | no | no |
|
|
220
|
+
|
|
228
221
|
### agent.sessions.resources
|
|
229
222
|
|
|
230
223
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -286,6 +279,18 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
286
279
|
|---|---|---|---|---|
|
|
287
280
|
| list | GET | `/agent/v1/toolsets` | no | no |
|
|
288
281
|
|
|
282
|
+
### agent.uploads
|
|
283
|
+
|
|
284
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
285
|
+
|---|---|---|---|---|
|
|
286
|
+
| create | POST | `/agent/v1/uploads` | no | no |
|
|
287
|
+
|
|
288
|
+
### agent.uploads.contentUrl
|
|
289
|
+
|
|
290
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
291
|
+
|---|---|---|---|---|
|
|
292
|
+
| create | POST | `/agent/v1/uploads/{file_id}/content_url` | no | no |
|
|
293
|
+
|
|
289
294
|
## application
|
|
290
295
|
|
|
291
296
|
### application.assets.upload
|
|
@@ -678,6 +683,33 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
678
683
|
| retrieve | GET | `/canvas/v1/collections/{collection_id}` | no | no |
|
|
679
684
|
| update | PATCH | `/canvas/v1/collections/{collection_id}` | no | no |
|
|
680
685
|
|
|
686
|
+
## content
|
|
687
|
+
|
|
688
|
+
### content.contents
|
|
689
|
+
|
|
690
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
691
|
+
|---|---|---|---|---|
|
|
692
|
+
| archive | POST | `/content/v1/contents/{content_id}/archive` | no | no |
|
|
693
|
+
| create | POST | `/content/v1/contents` | no | no |
|
|
694
|
+
| list | GET | `/content/v1/contents` | no | no |
|
|
695
|
+
| publish | POST | `/content/v1/contents/{content_id}/publish` | no | no |
|
|
696
|
+
| retrieve | GET | `/content/v1/contents/{content_id}` | no | no |
|
|
697
|
+
| unpublish | POST | `/content/v1/contents/{content_id}/unpublish` | no | no |
|
|
698
|
+
| update | PATCH | `/content/v1/contents/{content_id}` | no | no |
|
|
699
|
+
|
|
700
|
+
### content.playbackSessions
|
|
701
|
+
|
|
702
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
703
|
+
|---|---|---|---|---|
|
|
704
|
+
| create | POST | `/content/v1/playback/sessions` | no | no |
|
|
705
|
+
|
|
706
|
+
### content.versions
|
|
707
|
+
|
|
708
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
709
|
+
|---|---|---|---|---|
|
|
710
|
+
| list | GET | `/content/v1/contents/{content_id}/versions` | no | no |
|
|
711
|
+
| retrieve | GET | `/content/v1/contents/{content_id}/versions/{version}` | no | no |
|
|
712
|
+
|
|
681
713
|
## crm
|
|
682
714
|
|
|
683
715
|
### crm.associations
|
|
@@ -771,6 +803,47 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
771
803
|
| create | POST | `/crm/v1/schemas` | no | no |
|
|
772
804
|
| list | GET | `/crm/v1/schemas` | no | no |
|
|
773
805
|
|
|
806
|
+
## customer
|
|
807
|
+
|
|
808
|
+
### customer.accessTokens
|
|
809
|
+
|
|
810
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
811
|
+
|---|---|---|---|---|
|
|
812
|
+
| create | POST | `/customer/v1/access_tokens` | no | no |
|
|
813
|
+
| renew | POST | `/customer/v1/access_tokens/renew` | no | no |
|
|
814
|
+
| revoke | DELETE | `/customer/v1/access_tokens/current` | no | no |
|
|
815
|
+
|
|
816
|
+
### customer.customers
|
|
817
|
+
|
|
818
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
819
|
+
|---|---|---|---|---|
|
|
820
|
+
| block | POST | `/customer/v1/customers/{customer_id}/block` | no | no |
|
|
821
|
+
| delete | DELETE | `/customer/v1/customers/{customer_id}` | no | no |
|
|
822
|
+
| list | GET | `/customer/v1/customers` | no | no |
|
|
823
|
+
| retrieve | GET | `/customer/v1/customers/{customer_id}` | no | no |
|
|
824
|
+
| revokeTokens | POST | `/customer/v1/customers/{customer_id}/revoke_tokens` | no | no |
|
|
825
|
+
| unblock | POST | `/customer/v1/customers/{customer_id}/unblock` | no | no |
|
|
826
|
+
|
|
827
|
+
### customer.grantCodes
|
|
828
|
+
|
|
829
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
830
|
+
|---|---|---|---|---|
|
|
831
|
+
| create | POST | `/customer/v1/grant_codes` | no | no |
|
|
832
|
+
|
|
833
|
+
### customer.publishableKeys
|
|
834
|
+
|
|
835
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
836
|
+
|---|---|---|---|---|
|
|
837
|
+
| create | POST | `/customer/v1/publishable_keys` | no | no |
|
|
838
|
+
| delete | DELETE | `/customer/v1/publishable_keys/{key_id}` | no | no |
|
|
839
|
+
| list | GET | `/customer/v1/publishable_keys` | no | no |
|
|
840
|
+
|
|
841
|
+
### customer.usage
|
|
842
|
+
|
|
843
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
844
|
+
|---|---|---|---|---|
|
|
845
|
+
| retrieve | GET | `/customer/v1/customers/{customer_id}/usage` | no | no |
|
|
846
|
+
|
|
774
847
|
## cut
|
|
775
848
|
|
|
776
849
|
### cut.exports
|
|
@@ -913,6 +986,7 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
913
986
|
|---|---|---|---|---|
|
|
914
987
|
| abandon | POST | `/devops/v1/changes/{id}:abandon` | no | no |
|
|
915
988
|
| markLastSlice | POST | `/devops/v1/changes/{id}:markLastSlice` | no | no |
|
|
989
|
+
| openPullRequest | POST | `/devops/v1/changes/{id}:openPullRequest` | no | no |
|
|
916
990
|
| retrieve | GET | `/devops/v1/changes/{id}` | no | no |
|
|
917
991
|
|
|
918
992
|
### devops.connections
|
|
@@ -975,6 +1049,7 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
975
1049
|
| list | GET | `/devops/v1/projects` | no | no |
|
|
976
1050
|
| retrieve | GET | `/devops/v1/projects/{id}` | no | no |
|
|
977
1051
|
| retrieveTestCatalog | GET | `/devops/v1/projects/{project}/test-catalog` | no | no |
|
|
1052
|
+
| retrieveTestPlan | GET | `/devops/v1/projects/{project}/test-plan` | no | no |
|
|
978
1053
|
| update | PATCH | `/devops/v1/projects/{id}` | no | no |
|
|
979
1054
|
|
|
980
1055
|
### devops.projects.changes
|
|
@@ -1358,12 +1433,25 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1358
1433
|
| retrieve | GET | `/media/v1/libraries/{library_id}/assets/{asset_id}` | no | no |
|
|
1359
1434
|
| update | PATCH | `/media/v1/libraries/{library_id}/assets/{asset_id}` | no | no |
|
|
1360
1435
|
|
|
1436
|
+
### media.libraries.assets.align
|
|
1437
|
+
|
|
1438
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1439
|
+
|---|---|---|---|---|
|
|
1440
|
+
| create | POST | `/media/v1/libraries/{library_id}/assets/{asset_id}/align` | no | no |
|
|
1441
|
+
|
|
1361
1442
|
### media.libraries.assets.frames
|
|
1362
1443
|
|
|
1363
1444
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
1364
1445
|
|---|---|---|---|---|
|
|
1365
1446
|
| create | POST | `/media/v1/libraries/{library_id}/assets/{asset_id}/frames` | no | no |
|
|
1366
1447
|
|
|
1448
|
+
### media.libraries.assets.hls
|
|
1449
|
+
|
|
1450
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1451
|
+
|---|---|---|---|---|
|
|
1452
|
+
| create | POST | `/media/v1/libraries/{library_id}/assets/{asset_id}/hls` | no | no |
|
|
1453
|
+
| list | GET | `/media/v1/libraries/{library_id}/assets/{asset_id}/hls` | no | no |
|
|
1454
|
+
|
|
1367
1455
|
### media.libraries.assets.import
|
|
1368
1456
|
|
|
1369
1457
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -1909,6 +1997,66 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1909
1997
|
|---|---|---|---|---|
|
|
1910
1998
|
| list | GET | `/organization/v1/usage` | no | no |
|
|
1911
1999
|
|
|
2000
|
+
## registry
|
|
2001
|
+
|
|
2002
|
+
### registry.installations
|
|
2003
|
+
|
|
2004
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2005
|
+
|---|---|---|---|---|
|
|
2006
|
+
| delete | DELETE | `/registry/v1/installations/{installation_id}` | no | no |
|
|
2007
|
+
| update | POST | `/registry/v1/installations/{installation_id}:update` | no | no |
|
|
2008
|
+
|
|
2009
|
+
### registry.packages
|
|
2010
|
+
|
|
2011
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2012
|
+
|---|---|---|---|---|
|
|
2013
|
+
| retrieve | GET | `/registry/v1/packages/{package_id}` | no | no |
|
|
2014
|
+
|
|
2015
|
+
### registry.packages.installations
|
|
2016
|
+
|
|
2017
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2018
|
+
|---|---|---|---|---|
|
|
2019
|
+
| create | POST | `/registry/v1/packages/{package_id}/installations` | no | no |
|
|
2020
|
+
| list | GET | `/registry/v1/packages/{package_id}/installations` | no | no |
|
|
2021
|
+
|
|
2022
|
+
### registry.packages.versions
|
|
2023
|
+
|
|
2024
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2025
|
+
|---|---|---|---|---|
|
|
2026
|
+
| create | POST | `/registry/v1/packages/{package_id}/versions` | no | no |
|
|
2027
|
+
| list | GET | `/registry/v1/packages/{package_id}/versions` | no | yes |
|
|
2028
|
+
| retrieveArchive | GET | `/registry/v1/packages/{package_id}/versions/{version}/archive` | no | no |
|
|
2029
|
+
| withdraw | POST | `/registry/v1/packages/{package_id}/versions/{version}:withdraw` | no | no |
|
|
2030
|
+
|
|
2031
|
+
### registry.packages.versions.contents
|
|
2032
|
+
|
|
2033
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2034
|
+
|---|---|---|---|---|
|
|
2035
|
+
| list | GET | `/registry/v1/packages/{package_id}/versions/{version}/contents` | no | no |
|
|
2036
|
+
|
|
2037
|
+
### registry.packages.versions.files
|
|
2038
|
+
|
|
2039
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2040
|
+
|---|---|---|---|---|
|
|
2041
|
+
| retrieve | GET | `/registry/v1/packages/{package_id}/versions/{version}/files/{path}` | no | no |
|
|
2042
|
+
|
|
2043
|
+
### registry.repositories
|
|
2044
|
+
|
|
2045
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2046
|
+
|---|---|---|---|---|
|
|
2047
|
+
| create | POST | `/registry/v1/repositories` | no | no |
|
|
2048
|
+
| delete | DELETE | `/registry/v1/repositories/{repository_id}` | no | no |
|
|
2049
|
+
| list | GET | `/registry/v1/repositories` | no | yes |
|
|
2050
|
+
| retrieve | GET | `/registry/v1/repositories/{repository_id}` | no | no |
|
|
2051
|
+
| update | PATCH | `/registry/v1/repositories/{repository_id}` | no | no |
|
|
2052
|
+
|
|
2053
|
+
### registry.repositories.packages
|
|
2054
|
+
|
|
2055
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2056
|
+
|---|---|---|---|---|
|
|
2057
|
+
| create | POST | `/registry/v1/repositories/{repository_id}/packages` | no | no |
|
|
2058
|
+
| list | GET | `/registry/v1/repositories/{repository_id}/packages` | no | yes |
|
|
2059
|
+
|
|
1912
2060
|
## sandbox
|
|
1913
2061
|
|
|
1914
2062
|
### sandbox.events.sandboxes
|
|
@@ -2064,6 +2212,17 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
2064
2212
|
|---|---|---|---|---|
|
|
2065
2213
|
| create | POST | `/search/v1/search` | no | no |
|
|
2066
2214
|
|
|
2215
|
+
## share
|
|
2216
|
+
|
|
2217
|
+
### share.permissions
|
|
2218
|
+
|
|
2219
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2220
|
+
|---|---|---|---|---|
|
|
2221
|
+
| create | POST | `/share/v1/permissions` | no | no |
|
|
2222
|
+
| delete | DELETE | `/share/v1/permissions/{id}` | no | no |
|
|
2223
|
+
| list | GET | `/share/v1/permissions` | no | no |
|
|
2224
|
+
| retrieve | GET | `/share/v1/permissions/{id}` | no | no |
|
|
2225
|
+
|
|
2067
2226
|
## studio
|
|
2068
2227
|
|
|
2069
2228
|
### studio.codexes
|
|
@@ -2461,6 +2620,10 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
2461
2620
|
| automation.workflows.distTags.set | Workflow dist-tags use the same npm-style assignment vocabulary as script dist-tags. |
|
|
2462
2621
|
| automation.workflows.vaults.set | Assign a whole vault to a definition alias, independently of published versions. |
|
|
2463
2622
|
| automation.workflows.versions.create / publish | Creating a workflow version publishes it; publish is a product alias of versions.create. |
|
|
2623
|
+
| content.contents.unpublish | unpublish is the product act that takes a content offline; the generic action table does not carry it, and the path-derived name would read as creating an unpublish sub-resource (services/content's content.contents.unpublish). |
|
|
2624
|
+
| content.versions.list | A content's versions are the immutable snapshot resource of their own (services/content's content.versions.list); nesting them under contents would derive content.contents.versions.list for a read that returns the version history. |
|
|
2625
|
+
| content.versions.retrieve | One version is read by its number from the same versions resource (services/content's content.versions.get); nesting under contents would derive a doubled content.contents.versions.retrieve. |
|
|
2626
|
+
| content.playbackSessions.create | Opening one playback is the playbackSessions operation (services/content's content.playbackSessions.create); the URL's playback group is a mount, not a resource level of its own. |
|
|
2464
2627
|
| crm.objects.list | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
|
|
2465
2628
|
| crm.objects.create | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
|
|
2466
2629
|
| crm.objects.batch.create | The terminal batch segment is the requested operation, not another collection; retain its read/create/update/upsert/archive verb. |
|
|
@@ -2480,6 +2643,12 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
2480
2643
|
| crm.properties.list | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
|
|
2481
2644
|
| crm.properties.create | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
|
|
2482
2645
|
| crm.properties.archive | CRM DELETE archives the resource rather than permanently deleting it; expose the archive product verb. |
|
|
2646
|
+
| customer.accessTokens.revoke | Logout revokes the caller's own sign-in and its tokens (services/customer's customer.accessTokens.revoke); current is a reference to the caller's token, not a revokeCurrent sub-resource. |
|
|
2647
|
+
| customer.accessTokens.renew | renewal acts on the sign-in's access token (services/customer's customer.accessTokens.renew); renew is not in the generic action table, so the path alone would derive customer.accessTokens.renew.create. |
|
|
2648
|
+
| customer.customers.block | block is the administrative act on the customer (services/customer's customer.customers.block); it is not in the generic action table, so the path alone would derive customer.customers.block.create. |
|
|
2649
|
+
| customer.customers.revokeTokens | Revoking every token of one customer is an act on the customer (services/customer's customer.customers.revokeTokens); the path alone would derive customer.customers.revoke_tokens.create. |
|
|
2650
|
+
| customer.customers.unblock | unblock lifts the same block fact on the customer (services/customer's customer.customers.unblock); the path alone would derive customer.customers.unblock.create. |
|
|
2651
|
+
| customer.usage.retrieve | One customer's usage is the usage read (services/customer's customer.usage.get); usage is a projection of the customer read into billing, not a sub-resource of the customer. |
|
|
2483
2652
|
| database.databases.rest.create | The final parameter identifies a table collection; POST inserts rows rather than updating the table. |
|
|
2484
2653
|
| devops.projects.flags.reportCodeRefs | ADR-125 §4 / #1881: a checkout reports where code names each flag key, so the write is an operation on the project's flags (devops.flags.reportCodeRefs) and returns counts, not a code-refs resource; the path alone would derive a nested codeRefs collection create. |
|
|
2485
2654
|
| file.uploads.createSigned | Signed upload creation returns a one-time local PUT URL; ADR-039 names this operation uploads.createSigned. |
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Default credential chain
|
|
3
|
-
* the PRAXIS_API_TOKEN environment variable
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Default credential chain (ticket-5367, ADR-098 §2, ADR-157), the same rule as the `praxis` CLI:
|
|
3
|
+
* 1. the PRAXIS_API_TOKEN environment variable;
|
|
4
|
+
* 2. PRAXIS_CWD set: `$PRAXIS_CWD/.praxis/credentials/<env>.json` and nothing else — no file there means no token,
|
|
5
|
+
* never the home's login and never a parent directory's;
|
|
6
|
+
* 3. otherwise the home: `~/.praxis/credentials/<env>.json`, and while that file is absent the legacy
|
|
7
|
+
* `~/.praxis/cli/<env>.json` that `praxis login` wrote before ADR-157 and the platform still writes for a
|
|
8
|
+
* managed login.
|
|
9
|
+
* Resolved at call time so a token the platform renewed in the file is picked up by an already-running process.
|
|
7
10
|
*/
|
|
8
11
|
export interface ResolvedCredentials {
|
|
9
12
|
token?: string;
|
|
@@ -17,7 +20,14 @@ type ReadFile = (path: string) => string | null;
|
|
|
17
20
|
* applies. A PRAXIS_ENV that is not a plain name is no environment at all and is ignored. Pure.
|
|
18
21
|
*/
|
|
19
22
|
export declare function credentialsEnv(env: Env): string;
|
|
20
|
-
/** The
|
|
23
|
+
/** The credential file of one directory: `<dir>/.praxis/credentials/<env>.json`. Pure. */
|
|
24
|
+
export declare function credentialsFileIn(dir: string, env: Env): string;
|
|
25
|
+
/**
|
|
26
|
+
* The credential files this process reads, in order (ADR-157): a PRAXIS_CWD directory is the only one when named;
|
|
27
|
+
* otherwise the home's file and then its legacy login file. Empty without a home directory. Pure.
|
|
28
|
+
*/
|
|
29
|
+
export declare function credentialsPaths(env: Env): string[];
|
|
30
|
+
/** The first file this process would read (the one `praxis login` writes). Null without a home directory. Pure. */
|
|
21
31
|
export declare function credentialsPath(env: Env): string | null;
|
|
22
32
|
export declare function resolveDefaultCredentials(env?: Env, readFile?: ReadFile): ResolvedCredentials;
|
|
23
33
|
export {};
|
package/dist/core/credentials.js
CHANGED
|
@@ -27,18 +27,37 @@ export function credentialsEnv(env) {
|
|
|
27
27
|
}
|
|
28
28
|
return 'production';
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const trimSlashes = (path) => path.replace(/[/\\]+$/, '') || path;
|
|
31
|
+
/** The credential file of one directory: `<dir>/.praxis/credentials/<env>.json`. Pure. */
|
|
32
|
+
export function credentialsFileIn(dir, env) {
|
|
33
|
+
return `${trimSlashes(dir)}/.praxis/credentials/${credentialsEnv(env)}.json`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The credential files this process reads, in order (ADR-157): a PRAXIS_CWD directory is the only one when named;
|
|
37
|
+
* otherwise the home's file and then its legacy login file. Empty without a home directory. Pure.
|
|
38
|
+
*/
|
|
39
|
+
export function credentialsPaths(env) {
|
|
40
|
+
const named = nonEmpty(env.PRAXIS_CWD);
|
|
41
|
+
if (named)
|
|
42
|
+
return [credentialsFileIn(named, env)];
|
|
32
43
|
const home = nonEmpty(env.HOME) ?? nonEmpty(env.USERPROFILE);
|
|
33
|
-
return home ? `${home
|
|
44
|
+
return home ? [credentialsFileIn(home, env), `${trimSlashes(home)}/.praxis/cli/${credentialsEnv(env)}.json`] : [];
|
|
45
|
+
}
|
|
46
|
+
/** The first file this process would read (the one `praxis login` writes). Null without a home directory. Pure. */
|
|
47
|
+
export function credentialsPath(env) {
|
|
48
|
+
return credentialsPaths(env)[0] ?? null;
|
|
34
49
|
}
|
|
35
50
|
export function resolveDefaultCredentials(env = globalThis.process?.env ?? {}, readFile = defaultReadFile) {
|
|
36
51
|
const envToken = nonEmpty(env.PRAXIS_API_TOKEN);
|
|
37
52
|
const envUrl = nonEmpty(env.PRAXIS_API_URL);
|
|
38
53
|
if (envToken)
|
|
39
54
|
return { token: envToken, ...(envUrl ? { apiUrl: envUrl } : {}) };
|
|
40
|
-
|
|
41
|
-
const
|
|
55
|
+
let text = null;
|
|
56
|
+
for (const path of credentialsPaths(env)) {
|
|
57
|
+
text = readFile(path);
|
|
58
|
+
if (text)
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
42
61
|
if (!text)
|
|
43
62
|
return envUrl ? { apiUrl: envUrl } : {};
|
|
44
63
|
try {
|