@flashbacktech/tsclient 0.4.67 → 0.4.69
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/dist/index.cjs +44 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -2
- package/dist/index.d.ts +33 -2
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -564,6 +564,49 @@ function normalizeGatewayToken(wire) {
|
|
|
564
564
|
createdAt: wire.createdAt
|
|
565
565
|
};
|
|
566
566
|
}
|
|
567
|
+
function normalizeAgentToken(wire) {
|
|
568
|
+
return {
|
|
569
|
+
id: wire.id,
|
|
570
|
+
sandboxId: wire.sandboxId ?? wire.repoId ?? "",
|
|
571
|
+
label: wire.label,
|
|
572
|
+
tokenPrefix: wire.tokenPrefix,
|
|
573
|
+
lastUsedAt: wire.lastUsedAt ?? void 0,
|
|
574
|
+
createdAt: wire.createdAt
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// src/modules/credentials/AgentTokensClient.ts
|
|
579
|
+
var AgentTokensClient = class {
|
|
580
|
+
constructor(http) {
|
|
581
|
+
this.http = http;
|
|
582
|
+
}
|
|
583
|
+
async list(sandboxId) {
|
|
584
|
+
const res = await this.http.get(
|
|
585
|
+
`/sandbox/${sandboxId}/agent-token`
|
|
586
|
+
);
|
|
587
|
+
const list = res.tokens ?? res.data ?? [];
|
|
588
|
+
return list.map(normalizeAgentToken);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* create returns both the persisted token row and the plaintext bearer
|
|
592
|
+
* (`secret`). The bearer is shown only here; surface it to the user
|
|
593
|
+
* immediately. If they navigate away without copying, they must delete the
|
|
594
|
+
* token and create a new one.
|
|
595
|
+
*/
|
|
596
|
+
async create(sandboxId, body) {
|
|
597
|
+
const res = await this.http.post(`/sandbox/${sandboxId}/agent-token`, { body });
|
|
598
|
+
if (!res.token || !res.secret) {
|
|
599
|
+
throw new Error("createAgentToken response missing token or secret.");
|
|
600
|
+
}
|
|
601
|
+
return {
|
|
602
|
+
token: normalizeAgentToken(res.token),
|
|
603
|
+
secret: res.secret
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
delete(sandboxId, tokenId) {
|
|
607
|
+
return this.http.delete(`/sandbox/${sandboxId}/agent-token/${tokenId}`);
|
|
608
|
+
}
|
|
609
|
+
};
|
|
567
610
|
|
|
568
611
|
// src/modules/credentials/GatewayTokensClient.ts
|
|
569
612
|
var GatewayTokensClient = class {
|
|
@@ -624,6 +667,7 @@ var CredentialsClient = class {
|
|
|
624
667
|
this.http = http;
|
|
625
668
|
this.sandbox = new SandboxCredentialScope(http);
|
|
626
669
|
this.gatewayTokens = new GatewayTokensClient(http);
|
|
670
|
+
this.agentTokens = new AgentTokensClient(http);
|
|
627
671
|
}
|
|
628
672
|
async list(query) {
|
|
629
673
|
const res = await this.http.get(
|