@deepraxis/sdk 0.1.1-dev.457df55 → 0.1.1-dev.45e7ad5
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 +176 -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 +345 -55
- package/dist/generated/sdk.gen.js +909 -86
- package/dist/generated/types.gen.d.ts +11517 -4765
- package/dist/operations.generated.js +3296 -1818
- package/dist/resources.generated.d.ts +1123 -188
- package/dist/resources.generated.js +112 -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`. 845 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
|
|
|
@@ -17,7 +17,9 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
17
17
|
| list | GET | `/agent/v1/agents` | no | no |
|
|
18
18
|
| retrieve | GET | `/agent/v1/agents/{agent_id}` | no | no |
|
|
19
19
|
| retrieveAppearance | GET | `/agent/v1/agents/{agent_id}/appearance` | no | no |
|
|
20
|
+
| retrieveEmbedPolicy | GET | `/agent/v1/agents/{agent_id}/embed_policy` | no | no |
|
|
20
21
|
| update | POST | `/agent/v1/agents/{agent_id}` | no | no |
|
|
22
|
+
| updateEmbedPolicy | POST | `/agent/v1/agents/{agent_id}/embed_policy` | no | no |
|
|
21
23
|
|
|
22
24
|
### agent.agents.consolidations
|
|
23
25
|
|
|
@@ -35,25 +37,6 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
35
37
|
| retrieve | GET | `/agent/v1/agents/{agent_id}/customers/{customer_id}` | no | no |
|
|
36
38
|
| retrieveDeletion | GET | `/agent/v1/agents/{agent_id}/customers/{customer_id}/deletion` | no | no |
|
|
37
39
|
|
|
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
40
|
### agent.agents.customers.block
|
|
58
41
|
|
|
59
42
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -80,6 +63,12 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
80
63
|
| send | POST | `/agent/v1/agents/{agent_id}/events` | no | no |
|
|
81
64
|
| stream | GET | `/agent/v1/agents/{agent_id}/events/stream` | always | no |
|
|
82
65
|
|
|
66
|
+
### agent.agents.inbox.letters
|
|
67
|
+
|
|
68
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
69
|
+
|---|---|---|---|---|
|
|
70
|
+
| list | GET | `/agent/v1/agents/{agent_id}/inbox/letters` | no | no |
|
|
71
|
+
|
|
83
72
|
### agent.agents.unarchive
|
|
84
73
|
|
|
85
74
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -191,6 +180,12 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
191
180
|
| retrieveContext | GET | `/agent/v1/sessions/{session_id}/context` | no | no |
|
|
192
181
|
| update | POST | `/agent/v1/sessions/{session_id}` | no | no |
|
|
193
182
|
|
|
183
|
+
### agent.sessions.agentVersion
|
|
184
|
+
|
|
185
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
186
|
+
|---|---|---|---|---|
|
|
187
|
+
| create | POST | `/agent/v1/sessions/{session_id}/agent_version` | no | no |
|
|
188
|
+
|
|
194
189
|
### agent.sessions.artifacts
|
|
195
190
|
|
|
196
191
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -292,6 +287,18 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
292
287
|
|---|---|---|---|---|
|
|
293
288
|
| list | GET | `/agent/v1/toolsets` | no | no |
|
|
294
289
|
|
|
290
|
+
### agent.uploads
|
|
291
|
+
|
|
292
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
293
|
+
|---|---|---|---|---|
|
|
294
|
+
| create | POST | `/agent/v1/uploads` | no | no |
|
|
295
|
+
|
|
296
|
+
### agent.uploads.contentUrl
|
|
297
|
+
|
|
298
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
299
|
+
|---|---|---|---|---|
|
|
300
|
+
| create | POST | `/agent/v1/uploads/{file_id}/content_url` | no | no |
|
|
301
|
+
|
|
295
302
|
## application
|
|
296
303
|
|
|
297
304
|
### application.assets.upload
|
|
@@ -684,6 +691,33 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
684
691
|
| retrieve | GET | `/canvas/v1/collections/{collection_id}` | no | no |
|
|
685
692
|
| update | PATCH | `/canvas/v1/collections/{collection_id}` | no | no |
|
|
686
693
|
|
|
694
|
+
## content
|
|
695
|
+
|
|
696
|
+
### content.contents
|
|
697
|
+
|
|
698
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
699
|
+
|---|---|---|---|---|
|
|
700
|
+
| archive | POST | `/content/v1/contents/{content_id}/archive` | no | no |
|
|
701
|
+
| create | POST | `/content/v1/contents` | no | no |
|
|
702
|
+
| list | GET | `/content/v1/contents` | no | no |
|
|
703
|
+
| publish | POST | `/content/v1/contents/{content_id}/publish` | no | no |
|
|
704
|
+
| retrieve | GET | `/content/v1/contents/{content_id}` | no | no |
|
|
705
|
+
| unpublish | POST | `/content/v1/contents/{content_id}/unpublish` | no | no |
|
|
706
|
+
| update | PATCH | `/content/v1/contents/{content_id}` | no | no |
|
|
707
|
+
|
|
708
|
+
### content.playbackSessions
|
|
709
|
+
|
|
710
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
711
|
+
|---|---|---|---|---|
|
|
712
|
+
| create | POST | `/content/v1/playback/sessions` | no | no |
|
|
713
|
+
|
|
714
|
+
### content.versions
|
|
715
|
+
|
|
716
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
717
|
+
|---|---|---|---|---|
|
|
718
|
+
| list | GET | `/content/v1/contents/{content_id}/versions` | no | no |
|
|
719
|
+
| retrieve | GET | `/content/v1/contents/{content_id}/versions/{version}` | no | no |
|
|
720
|
+
|
|
687
721
|
## crm
|
|
688
722
|
|
|
689
723
|
### crm.associations
|
|
@@ -777,6 +811,47 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
777
811
|
| create | POST | `/crm/v1/schemas` | no | no |
|
|
778
812
|
| list | GET | `/crm/v1/schemas` | no | no |
|
|
779
813
|
|
|
814
|
+
## customer
|
|
815
|
+
|
|
816
|
+
### customer.accessTokens
|
|
817
|
+
|
|
818
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
819
|
+
|---|---|---|---|---|
|
|
820
|
+
| create | POST | `/customer/v1/access_tokens` | no | no |
|
|
821
|
+
| renew | POST | `/customer/v1/access_tokens/renew` | no | no |
|
|
822
|
+
| revoke | DELETE | `/customer/v1/access_tokens/current` | no | no |
|
|
823
|
+
|
|
824
|
+
### customer.customers
|
|
825
|
+
|
|
826
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
827
|
+
|---|---|---|---|---|
|
|
828
|
+
| block | POST | `/customer/v1/customers/{customer_id}/block` | no | no |
|
|
829
|
+
| delete | DELETE | `/customer/v1/customers/{customer_id}` | no | no |
|
|
830
|
+
| list | GET | `/customer/v1/customers` | no | no |
|
|
831
|
+
| retrieve | GET | `/customer/v1/customers/{customer_id}` | no | no |
|
|
832
|
+
| revokeTokens | POST | `/customer/v1/customers/{customer_id}/revoke_tokens` | no | no |
|
|
833
|
+
| unblock | POST | `/customer/v1/customers/{customer_id}/unblock` | no | no |
|
|
834
|
+
|
|
835
|
+
### customer.grantCodes
|
|
836
|
+
|
|
837
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
838
|
+
|---|---|---|---|---|
|
|
839
|
+
| create | POST | `/customer/v1/grant_codes` | no | no |
|
|
840
|
+
|
|
841
|
+
### customer.publishableKeys
|
|
842
|
+
|
|
843
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
844
|
+
|---|---|---|---|---|
|
|
845
|
+
| create | POST | `/customer/v1/publishable_keys` | no | no |
|
|
846
|
+
| delete | DELETE | `/customer/v1/publishable_keys/{key_id}` | no | no |
|
|
847
|
+
| list | GET | `/customer/v1/publishable_keys` | no | no |
|
|
848
|
+
|
|
849
|
+
### customer.usage
|
|
850
|
+
|
|
851
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
852
|
+
|---|---|---|---|---|
|
|
853
|
+
| retrieve | GET | `/customer/v1/customers/{customer_id}/usage` | no | no |
|
|
854
|
+
|
|
780
855
|
## cut
|
|
781
856
|
|
|
782
857
|
### cut.exports
|
|
@@ -918,7 +993,9 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
918
993
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
919
994
|
|---|---|---|---|---|
|
|
920
995
|
| abandon | POST | `/devops/v1/changes/{id}:abandon` | no | no |
|
|
996
|
+
| gitCredential | POST | `/devops/v1/changes/{id}:gitCredential` | no | no |
|
|
921
997
|
| markLastSlice | POST | `/devops/v1/changes/{id}:markLastSlice` | no | no |
|
|
998
|
+
| openPullRequest | POST | `/devops/v1/changes/{id}:openPullRequest` | no | no |
|
|
922
999
|
| retrieve | GET | `/devops/v1/changes/{id}` | no | no |
|
|
923
1000
|
|
|
924
1001
|
### devops.connections
|
|
@@ -981,6 +1058,7 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
981
1058
|
| list | GET | `/devops/v1/projects` | no | no |
|
|
982
1059
|
| retrieve | GET | `/devops/v1/projects/{id}` | no | no |
|
|
983
1060
|
| retrieveTestCatalog | GET | `/devops/v1/projects/{project}/test-catalog` | no | no |
|
|
1061
|
+
| retrieveTestPlan | GET | `/devops/v1/projects/{project}/test-plan` | no | no |
|
|
984
1062
|
| update | PATCH | `/devops/v1/projects/{id}` | no | no |
|
|
985
1063
|
|
|
986
1064
|
### devops.projects.changes
|
|
@@ -1376,6 +1454,13 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1376
1454
|
|---|---|---|---|---|
|
|
1377
1455
|
| create | POST | `/media/v1/libraries/{library_id}/assets/{asset_id}/frames` | no | no |
|
|
1378
1456
|
|
|
1457
|
+
### media.libraries.assets.hls
|
|
1458
|
+
|
|
1459
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
1460
|
+
|---|---|---|---|---|
|
|
1461
|
+
| create | POST | `/media/v1/libraries/{library_id}/assets/{asset_id}/hls` | no | no |
|
|
1462
|
+
| list | GET | `/media/v1/libraries/{library_id}/assets/{asset_id}/hls` | no | no |
|
|
1463
|
+
|
|
1379
1464
|
### media.libraries.assets.import
|
|
1380
1465
|
|
|
1381
1466
|
| Method | HTTP | Path | Streaming | Pagination |
|
|
@@ -1921,6 +2006,66 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
1921
2006
|
|---|---|---|---|---|
|
|
1922
2007
|
| list | GET | `/organization/v1/usage` | no | no |
|
|
1923
2008
|
|
|
2009
|
+
## registry
|
|
2010
|
+
|
|
2011
|
+
### registry.installations
|
|
2012
|
+
|
|
2013
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2014
|
+
|---|---|---|---|---|
|
|
2015
|
+
| delete | DELETE | `/registry/v1/installations/{installation_id}` | no | no |
|
|
2016
|
+
| update | POST | `/registry/v1/installations/{installation_id}:update` | no | no |
|
|
2017
|
+
|
|
2018
|
+
### registry.packages
|
|
2019
|
+
|
|
2020
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2021
|
+
|---|---|---|---|---|
|
|
2022
|
+
| retrieve | GET | `/registry/v1/packages/{package_id}` | no | no |
|
|
2023
|
+
|
|
2024
|
+
### registry.packages.installations
|
|
2025
|
+
|
|
2026
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2027
|
+
|---|---|---|---|---|
|
|
2028
|
+
| create | POST | `/registry/v1/packages/{package_id}/installations` | no | no |
|
|
2029
|
+
| list | GET | `/registry/v1/packages/{package_id}/installations` | no | no |
|
|
2030
|
+
|
|
2031
|
+
### registry.packages.versions
|
|
2032
|
+
|
|
2033
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2034
|
+
|---|---|---|---|---|
|
|
2035
|
+
| create | POST | `/registry/v1/packages/{package_id}/versions` | no | no |
|
|
2036
|
+
| list | GET | `/registry/v1/packages/{package_id}/versions` | no | yes |
|
|
2037
|
+
| retrieveArchive | GET | `/registry/v1/packages/{package_id}/versions/{version}/archive` | no | no |
|
|
2038
|
+
| withdraw | POST | `/registry/v1/packages/{package_id}/versions/{version}:withdraw` | no | no |
|
|
2039
|
+
|
|
2040
|
+
### registry.packages.versions.contents
|
|
2041
|
+
|
|
2042
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2043
|
+
|---|---|---|---|---|
|
|
2044
|
+
| list | GET | `/registry/v1/packages/{package_id}/versions/{version}/contents` | no | no |
|
|
2045
|
+
|
|
2046
|
+
### registry.packages.versions.files
|
|
2047
|
+
|
|
2048
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2049
|
+
|---|---|---|---|---|
|
|
2050
|
+
| retrieve | GET | `/registry/v1/packages/{package_id}/versions/{version}/files/{path}` | no | no |
|
|
2051
|
+
|
|
2052
|
+
### registry.repositories
|
|
2053
|
+
|
|
2054
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2055
|
+
|---|---|---|---|---|
|
|
2056
|
+
| create | POST | `/registry/v1/repositories` | no | no |
|
|
2057
|
+
| delete | DELETE | `/registry/v1/repositories/{repository_id}` | no | no |
|
|
2058
|
+
| list | GET | `/registry/v1/repositories` | no | yes |
|
|
2059
|
+
| retrieve | GET | `/registry/v1/repositories/{repository_id}` | no | no |
|
|
2060
|
+
| update | PATCH | `/registry/v1/repositories/{repository_id}` | no | no |
|
|
2061
|
+
|
|
2062
|
+
### registry.repositories.packages
|
|
2063
|
+
|
|
2064
|
+
| Method | HTTP | Path | Streaming | Pagination |
|
|
2065
|
+
|---|---|---|---|---|
|
|
2066
|
+
| create | POST | `/registry/v1/repositories/{repository_id}/packages` | no | no |
|
|
2067
|
+
| list | GET | `/registry/v1/repositories/{repository_id}/packages` | no | yes |
|
|
2068
|
+
|
|
1924
2069
|
## sandbox
|
|
1925
2070
|
|
|
1926
2071
|
### sandbox.events.sandboxes
|
|
@@ -2475,6 +2620,7 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
2475
2620
|
|
|
2476
2621
|
| Operation | Reason |
|
|
2477
2622
|
|---|---|
|
|
2623
|
+
| agent.agents.updateEmbedPolicy | The embed policy is a singleton of the agent; POST updates it in part, so it pairs with retrieveEmbedPolicy as agents.updateEmbedPolicy rather than a nested embedPolicy collection create. |
|
|
2478
2624
|
| agent.agents.events.send | ADR-123 (#1550): the agent-subject door fires the session events operation, so it takes the same product verb as sessions.events.send; the path alone would derive events.create. |
|
|
2479
2625
|
| agent.sessions.events.send | Events submit session input; the product verb is send rather than create. |
|
|
2480
2626
|
| automation.hooks.send | Delivers a payload to a trigger's secret webhook URL; it sends an event rather than updating a hook resource. |
|
|
@@ -2484,6 +2630,10 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
2484
2630
|
| automation.workflows.distTags.set | Workflow dist-tags use the same npm-style assignment vocabulary as script dist-tags. |
|
|
2485
2631
|
| automation.workflows.vaults.set | Assign a whole vault to a definition alias, independently of published versions. |
|
|
2486
2632
|
| automation.workflows.versions.create / publish | Creating a workflow version publishes it; publish is a product alias of versions.create. |
|
|
2633
|
+
| 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). |
|
|
2634
|
+
| 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. |
|
|
2635
|
+
| 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. |
|
|
2636
|
+
| 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. |
|
|
2487
2637
|
| crm.objects.list | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
|
|
2488
2638
|
| crm.objects.create | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
|
|
2489
2639
|
| crm.objects.batch.create | The terminal batch segment is the requested operation, not another collection; retain its read/create/update/upsert/archive verb. |
|
|
@@ -2503,6 +2653,12 @@ Multipart request bodies expand plain objects into bracketed fields (for example
|
|
|
2503
2653
|
| crm.properties.list | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
|
|
2504
2654
|
| crm.properties.create | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
|
|
2505
2655
|
| crm.properties.archive | CRM DELETE archives the resource rather than permanently deleting it; expose the archive product verb. |
|
|
2656
|
+
| 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. |
|
|
2657
|
+
| 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. |
|
|
2658
|
+
| 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. |
|
|
2659
|
+
| 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. |
|
|
2660
|
+
| 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. |
|
|
2661
|
+
| 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. |
|
|
2506
2662
|
| database.databases.rest.create | The final parameter identifies a table collection; POST inserts rows rather than updating the table. |
|
|
2507
2663
|
| 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. |
|
|
2508
2664
|
| 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 {
|