@topolo/sdk 0.18.0 → 0.19.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.
- package/dist/index.cjs +70 -4
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +68 -4
- package/dist/node/credential-store.d.cts +9 -5
- package/dist/node/credential-store.d.ts +9 -5
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -46,6 +46,7 @@ __export(index_exports, {
|
|
|
46
46
|
actionContractCompleteness: () => actionContractCompleteness,
|
|
47
47
|
applicationEntryFromCatalog: () => applicationEntryFromCatalog,
|
|
48
48
|
assertTopoloServiceUrlEnvironment: () => assertTopoloServiceUrlEnvironment,
|
|
49
|
+
calculateDpopJkt: () => calculateDpopJkt,
|
|
49
50
|
canonicalJson: () => canonicalJson,
|
|
50
51
|
canonicalTopoloErrorCode: () => canonicalTopoloErrorCode,
|
|
51
52
|
canonicalTopoloRequestId: () => canonicalTopoloRequestId,
|
|
@@ -57,6 +58,7 @@ __export(index_exports, {
|
|
|
57
58
|
compactActionPreparation: () => compactActionPreparation,
|
|
58
59
|
compactActionResult: () => compactActionResult,
|
|
59
60
|
compactActionValidation: () => compactActionValidation,
|
|
61
|
+
createDpopProof: () => createDpopProof,
|
|
60
62
|
createTopolo: () => createTopolo,
|
|
61
63
|
createTopoloAgentExecutionContext: () => createTopoloAgentExecutionContext,
|
|
62
64
|
createTopoloWidgetError: () => createTopoloWidgetError,
|
|
@@ -101,7 +103,7 @@ function applyAuthHeaders(headers, credential) {
|
|
|
101
103
|
headers.set("X-Api-Key", credential.apiKey);
|
|
102
104
|
return;
|
|
103
105
|
}
|
|
104
|
-
headers.set("Authorization",
|
|
106
|
+
headers.set("Authorization", `${credential.kind === "dpop_access_token" ? "DPoP" : "Bearer"} ${credential.accessToken}`);
|
|
105
107
|
}
|
|
106
108
|
function applyAuditHeaders(headers, agent, requestId) {
|
|
107
109
|
headers.set("X-Topolo-Client", `${agent.clientName}/${agent.clientVersion}`);
|
|
@@ -115,6 +117,60 @@ function generateRequestId() {
|
|
|
115
117
|
return `req_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
116
118
|
}
|
|
117
119
|
|
|
120
|
+
// src/dpop.ts
|
|
121
|
+
var encoder = new TextEncoder();
|
|
122
|
+
function encodeBase64Url(value) {
|
|
123
|
+
const bytes = value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
124
|
+
let binary = "";
|
|
125
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
126
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
127
|
+
}
|
|
128
|
+
function encodeJson(value) {
|
|
129
|
+
return encodeBase64Url(encoder.encode(JSON.stringify(value)));
|
|
130
|
+
}
|
|
131
|
+
async function sha256Base64Url(value) {
|
|
132
|
+
return encodeBase64Url(await crypto.subtle.digest("SHA-256", encoder.encode(value)));
|
|
133
|
+
}
|
|
134
|
+
function publicJwk(privateJwk) {
|
|
135
|
+
const { crv, kty, x, y } = privateJwk;
|
|
136
|
+
if (kty !== "EC" || crv !== "P-256" || !x || !y || !privateJwk.d) {
|
|
137
|
+
throw new TypeError("A private P-256 JSON Web Key is required for DPoP signing.");
|
|
138
|
+
}
|
|
139
|
+
return { crv, kty, x, y };
|
|
140
|
+
}
|
|
141
|
+
function canonicalTargetUrl(value) {
|
|
142
|
+
const url = new URL(value);
|
|
143
|
+
return `${url.origin}${url.pathname}`;
|
|
144
|
+
}
|
|
145
|
+
async function calculateDpopJkt(privateJwk) {
|
|
146
|
+
const jwk = publicJwk(privateJwk);
|
|
147
|
+
return sha256Base64Url(JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y }));
|
|
148
|
+
}
|
|
149
|
+
async function createDpopProof(input) {
|
|
150
|
+
const jwk = publicJwk(input.privateJwk);
|
|
151
|
+
const key = await crypto.subtle.importKey(
|
|
152
|
+
"jwk",
|
|
153
|
+
input.privateJwk,
|
|
154
|
+
{ name: "ECDSA", namedCurve: "P-256" },
|
|
155
|
+
false,
|
|
156
|
+
["sign"]
|
|
157
|
+
);
|
|
158
|
+
const header = encodeJson({ alg: "ES256", typ: "dpop+jwt", jwk });
|
|
159
|
+
const claims = encodeJson({
|
|
160
|
+
jti: crypto.randomUUID(),
|
|
161
|
+
iat: Math.floor(Date.now() / 1e3),
|
|
162
|
+
htm: input.method.toUpperCase(),
|
|
163
|
+
htu: canonicalTargetUrl(input.targetUrl),
|
|
164
|
+
ath: await sha256Base64Url(input.accessToken)
|
|
165
|
+
});
|
|
166
|
+
const signature = await crypto.subtle.sign(
|
|
167
|
+
{ name: "ECDSA", hash: "SHA-256" },
|
|
168
|
+
key,
|
|
169
|
+
encoder.encode(`${header}.${claims}`)
|
|
170
|
+
);
|
|
171
|
+
return `${header}.${claims}.${encodeBase64Url(signature)}`;
|
|
172
|
+
}
|
|
173
|
+
|
|
118
174
|
// src/errors.ts
|
|
119
175
|
var TopoloSdkError = class extends Error {
|
|
120
176
|
code;
|
|
@@ -1471,7 +1527,6 @@ var TopoloClient = class _TopoloClient {
|
|
|
1471
1527
|
if (opts.body !== void 0) headers.set("Content-Type", "application/json");
|
|
1472
1528
|
const platformAppId = resolveConfiguredAppId(resolvedService.serviceKey, this.appIds);
|
|
1473
1529
|
if (platformAppId) headers.set("X-App-ID", platformAppId);
|
|
1474
|
-
applyAuthHeaders(headers, this.credential);
|
|
1475
1530
|
const actorEnvelope = opts.actorEnvelope === void 0 ? void 0 : parseActorEnvelope(opts.actorEnvelope);
|
|
1476
1531
|
const requestId = actorEnvelope?.action.requestId ?? generateRequestId();
|
|
1477
1532
|
applyAuditHeaders(headers, this.agent, requestId);
|
|
@@ -1505,9 +1560,19 @@ var TopoloClient = class _TopoloClient {
|
|
|
1505
1560
|
}, this.timeoutMs);
|
|
1506
1561
|
const signal = opts.signal ? mergeSignals(opts.signal, controller.signal) : controller.signal;
|
|
1507
1562
|
try {
|
|
1563
|
+
const requestHeaders = new Headers(headers);
|
|
1564
|
+
applyAuthHeaders(requestHeaders, this.credential);
|
|
1565
|
+
if (this.credential.kind === "dpop_access_token") {
|
|
1566
|
+
requestHeaders.set("DPoP", await createDpopProof({
|
|
1567
|
+
accessToken: this.credential.accessToken,
|
|
1568
|
+
method,
|
|
1569
|
+
targetUrl: urlStr,
|
|
1570
|
+
privateJwk: this.credential.privateJwk
|
|
1571
|
+
}));
|
|
1572
|
+
}
|
|
1508
1573
|
return await this.fetchImpl(urlStr, {
|
|
1509
1574
|
method,
|
|
1510
|
-
headers:
|
|
1575
|
+
headers: requestHeaders,
|
|
1511
1576
|
body: opts.rawBody ?? (opts.body !== void 0 ? JSON.stringify(opts.body) : null),
|
|
1512
1577
|
signal
|
|
1513
1578
|
});
|
|
@@ -1544,7 +1609,6 @@ var TopoloClient = class _TopoloClient {
|
|
|
1544
1609
|
await res.body?.cancel().catch(() => void 0);
|
|
1545
1610
|
const refreshed = await this.refreshRejectedAccessToken(attemptedCredential.accessToken);
|
|
1546
1611
|
if (refreshed) {
|
|
1547
|
-
applyAuthHeaders(headers, refreshed);
|
|
1548
1612
|
res = await fetchWithReadRetry();
|
|
1549
1613
|
}
|
|
1550
1614
|
}
|
|
@@ -4899,6 +4963,7 @@ function createTopolo(options) {
|
|
|
4899
4963
|
actionContractCompleteness,
|
|
4900
4964
|
applicationEntryFromCatalog,
|
|
4901
4965
|
assertTopoloServiceUrlEnvironment,
|
|
4966
|
+
calculateDpopJkt,
|
|
4902
4967
|
canonicalJson,
|
|
4903
4968
|
canonicalTopoloErrorCode,
|
|
4904
4969
|
canonicalTopoloRequestId,
|
|
@@ -4910,6 +4975,7 @@ function createTopolo(options) {
|
|
|
4910
4975
|
compactActionPreparation,
|
|
4911
4976
|
compactActionResult,
|
|
4912
4977
|
compactActionValidation,
|
|
4978
|
+
createDpopProof,
|
|
4913
4979
|
createTopolo,
|
|
4914
4980
|
createTopoloAgentExecutionContext,
|
|
4915
4981
|
createTopoloWidgetError,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auth credential types used by the SDK.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Supported modes:
|
|
5
5
|
* - `api_key`: a single platform API key (service-scoped at issuance).
|
|
6
|
-
*
|
|
6
|
+
* Used for service integrations that are not installation-bound.
|
|
7
7
|
* - `access_token`: a short-lived JWT from the interactive login flow.
|
|
8
8
|
* Used by TopoloCli after `topolo auth login`.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* PKCE flow in TopoloAuth. Those will plug in as a third variant.
|
|
9
|
+
* - `dpop_access_token`: a short-lived delegated token bound to an external
|
|
10
|
+
* agent installation key. Every request proves possession of that key.
|
|
12
11
|
*/
|
|
13
12
|
type TopoloCredential = {
|
|
14
13
|
kind: 'api_key';
|
|
@@ -18,6 +17,11 @@ type TopoloCredential = {
|
|
|
18
17
|
accessToken: string;
|
|
19
18
|
refreshToken?: string;
|
|
20
19
|
expiresAt?: number;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'dpop_access_token';
|
|
22
|
+
accessToken: string;
|
|
23
|
+
privateJwk: JsonWebKey;
|
|
24
|
+
expiresAt?: number;
|
|
21
25
|
};
|
|
22
26
|
interface AgentIdentity {
|
|
23
27
|
/** Display name of the agent or tool making requests. Included in audit headers. */
|
|
@@ -761,6 +765,14 @@ declare function actionContractCompleteness(
|
|
|
761
765
|
action: ActionContractSource,
|
|
762
766
|
): Record<string, boolean>;
|
|
763
767
|
|
|
768
|
+
declare function calculateDpopJkt(privateJwk: JsonWebKey): Promise<string>;
|
|
769
|
+
declare function createDpopProof(input: {
|
|
770
|
+
accessToken: string;
|
|
771
|
+
method: string;
|
|
772
|
+
targetUrl: string;
|
|
773
|
+
privateJwk: JsonWebKey;
|
|
774
|
+
}): Promise<string>;
|
|
775
|
+
|
|
764
776
|
/**
|
|
765
777
|
* Bootstrap seed URLs — the ONLY static service endpoints in the SDK.
|
|
766
778
|
*
|
|
@@ -1694,4 +1706,4 @@ declare function createTopolo(options: TopoloClientOptions): {
|
|
|
1694
1706
|
};
|
|
1695
1707
|
type Topolo = ReturnType<typeof createTopolo>;
|
|
1696
1708
|
|
|
1697
|
-
export { ACTION_CATALOG_DIGEST_ALGORITHM, ACTOR_AUDIT_PROJECTION_VERSION, ACTOR_ENVELOPE_VERSION, type AccountableSubject, type AccountableSubjectType, type ActionContractManifest, type ActionContractSource, type ActorAssurance, type ActorAuditEventRole, type ActorAuditProjection, type ActorChannel, type ActorDelegationHop, type ActorEnvelope, ActorEnvelopeValidationError, type ActorIdentity, type ActorPrincipalType, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_APP_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceCatalogUrlEntry, TOPOLO_ACTOR_ENVELOPE_HEADER, TOPOLO_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_CONTRACT_VERSION, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_OUTPUT_SCHEMA, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionPreparation, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloActionsWidget, type TopoloActivityWidget, type TopoloAgentExecutionContext, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBinaryResponse, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloJsonSchema, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloRuntimeEnvironment, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetAccessibility, type TopoloWidgetActionBinding, type TopoloWidgetActionRecovery, type TopoloWidgetActivityItem, type TopoloWidgetApiError, type TopoloWidgetApiErrorResponse, type TopoloWidgetApiResponse, type TopoloWidgetApiSuccessResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetConfiguration, type TopoloWidgetConfigurationField, type TopoloWidgetConfigurationOption, type TopoloWidgetContext, type TopoloWidgetContribution, type TopoloWidgetDatasetDefinition, type TopoloWidgetDimension, type TopoloWidgetDimensionDefinition, type TopoloWidgetDraft, type TopoloWidgetDrilldown, type TopoloWidgetErrorResponseOptions, type TopoloWidgetEventDefinition, type TopoloWidgetLifecycleStage, type TopoloWidgetLocalization, type TopoloWidgetMetric, type TopoloWidgetMetricAggregation, type TopoloWidgetMetricComparison, type TopoloWidgetMetricDefinition, type TopoloWidgetMetricSemantic, type TopoloWidgetNotificationItem, type TopoloWidgetPeriod, type TopoloWidgetPresentation, type TopoloWidgetRefreshPolicy, type TopoloWidgetResourceBinding, type TopoloWidgetResponseOptions, type TopoloWidgetSeries, type TopoloWidgetSeriesDefinition, type TopoloWidgetSeriesPoint, type TopoloWidgetSize, type TopoloWidgetState, type TopoloWidgetStatus, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWidgetVisualizationFamily, type TopoloWidgetWorkspaceSelector, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, assertTopoloServiceUrlEnvironment, canonicalJson, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, canonicalizeActorEnvelope, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionResult, compactActionValidation, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, decodeActorEnvelopeHeader, defineTopoloActionsWidget, defineTopoloActivityWidget, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, encodeActorEnvelopeHeader, encodeTopoloActionBase64, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, isTopoloWidgetOutputSchema, listApplicationDirectory, parseActorEnvelope, parseTopoloActionUploadContract, preferExactActionMatches, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, projectActorAuditEvent, publicTopoloErrorMessage, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, sha256CanonicalValue, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
|
|
1709
|
+
export { ACTION_CATALOG_DIGEST_ALGORITHM, ACTOR_AUDIT_PROJECTION_VERSION, ACTOR_ENVELOPE_VERSION, type AccountableSubject, type AccountableSubjectType, type ActionContractManifest, type ActionContractSource, type ActorAssurance, type ActorAuditEventRole, type ActorAuditProjection, type ActorChannel, type ActorDelegationHop, type ActorEnvelope, ActorEnvelopeValidationError, type ActorIdentity, type ActorPrincipalType, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_APP_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceCatalogUrlEntry, TOPOLO_ACTOR_ENVELOPE_HEADER, TOPOLO_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_CONTRACT_VERSION, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_OUTPUT_SCHEMA, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionPreparation, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloActionsWidget, type TopoloActivityWidget, type TopoloAgentExecutionContext, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBinaryResponse, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloJsonSchema, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloRuntimeEnvironment, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetAccessibility, type TopoloWidgetActionBinding, type TopoloWidgetActionRecovery, type TopoloWidgetActivityItem, type TopoloWidgetApiError, type TopoloWidgetApiErrorResponse, type TopoloWidgetApiResponse, type TopoloWidgetApiSuccessResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetConfiguration, type TopoloWidgetConfigurationField, type TopoloWidgetConfigurationOption, type TopoloWidgetContext, type TopoloWidgetContribution, type TopoloWidgetDatasetDefinition, type TopoloWidgetDimension, type TopoloWidgetDimensionDefinition, type TopoloWidgetDraft, type TopoloWidgetDrilldown, type TopoloWidgetErrorResponseOptions, type TopoloWidgetEventDefinition, type TopoloWidgetLifecycleStage, type TopoloWidgetLocalization, type TopoloWidgetMetric, type TopoloWidgetMetricAggregation, type TopoloWidgetMetricComparison, type TopoloWidgetMetricDefinition, type TopoloWidgetMetricSemantic, type TopoloWidgetNotificationItem, type TopoloWidgetPeriod, type TopoloWidgetPresentation, type TopoloWidgetRefreshPolicy, type TopoloWidgetResourceBinding, type TopoloWidgetResponseOptions, type TopoloWidgetSeries, type TopoloWidgetSeriesDefinition, type TopoloWidgetSeriesPoint, type TopoloWidgetSize, type TopoloWidgetState, type TopoloWidgetStatus, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWidgetVisualizationFamily, type TopoloWidgetWorkspaceSelector, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, assertTopoloServiceUrlEnvironment, calculateDpopJkt, canonicalJson, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, canonicalizeActorEnvelope, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionResult, compactActionValidation, createDpopProof, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, decodeActorEnvelopeHeader, defineTopoloActionsWidget, defineTopoloActivityWidget, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, encodeActorEnvelopeHeader, encodeTopoloActionBase64, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, isTopoloWidgetOutputSchema, listApplicationDirectory, parseActorEnvelope, parseTopoloActionUploadContract, preferExactActionMatches, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, projectActorAuditEvent, publicTopoloErrorMessage, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, sha256CanonicalValue, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auth credential types used by the SDK.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Supported modes:
|
|
5
5
|
* - `api_key`: a single platform API key (service-scoped at issuance).
|
|
6
|
-
*
|
|
6
|
+
* Used for service integrations that are not installation-bound.
|
|
7
7
|
* - `access_token`: a short-lived JWT from the interactive login flow.
|
|
8
8
|
* Used by TopoloCli after `topolo auth login`.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* PKCE flow in TopoloAuth. Those will plug in as a third variant.
|
|
9
|
+
* - `dpop_access_token`: a short-lived delegated token bound to an external
|
|
10
|
+
* agent installation key. Every request proves possession of that key.
|
|
12
11
|
*/
|
|
13
12
|
type TopoloCredential = {
|
|
14
13
|
kind: 'api_key';
|
|
@@ -18,6 +17,11 @@ type TopoloCredential = {
|
|
|
18
17
|
accessToken: string;
|
|
19
18
|
refreshToken?: string;
|
|
20
19
|
expiresAt?: number;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'dpop_access_token';
|
|
22
|
+
accessToken: string;
|
|
23
|
+
privateJwk: JsonWebKey;
|
|
24
|
+
expiresAt?: number;
|
|
21
25
|
};
|
|
22
26
|
interface AgentIdentity {
|
|
23
27
|
/** Display name of the agent or tool making requests. Included in audit headers. */
|
|
@@ -761,6 +765,14 @@ declare function actionContractCompleteness(
|
|
|
761
765
|
action: ActionContractSource,
|
|
762
766
|
): Record<string, boolean>;
|
|
763
767
|
|
|
768
|
+
declare function calculateDpopJkt(privateJwk: JsonWebKey): Promise<string>;
|
|
769
|
+
declare function createDpopProof(input: {
|
|
770
|
+
accessToken: string;
|
|
771
|
+
method: string;
|
|
772
|
+
targetUrl: string;
|
|
773
|
+
privateJwk: JsonWebKey;
|
|
774
|
+
}): Promise<string>;
|
|
775
|
+
|
|
764
776
|
/**
|
|
765
777
|
* Bootstrap seed URLs — the ONLY static service endpoints in the SDK.
|
|
766
778
|
*
|
|
@@ -1694,4 +1706,4 @@ declare function createTopolo(options: TopoloClientOptions): {
|
|
|
1694
1706
|
};
|
|
1695
1707
|
type Topolo = ReturnType<typeof createTopolo>;
|
|
1696
1708
|
|
|
1697
|
-
export { ACTION_CATALOG_DIGEST_ALGORITHM, ACTOR_AUDIT_PROJECTION_VERSION, ACTOR_ENVELOPE_VERSION, type AccountableSubject, type AccountableSubjectType, type ActionContractManifest, type ActionContractSource, type ActorAssurance, type ActorAuditEventRole, type ActorAuditProjection, type ActorChannel, type ActorDelegationHop, type ActorEnvelope, ActorEnvelopeValidationError, type ActorIdentity, type ActorPrincipalType, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_APP_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceCatalogUrlEntry, TOPOLO_ACTOR_ENVELOPE_HEADER, TOPOLO_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_CONTRACT_VERSION, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_OUTPUT_SCHEMA, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionPreparation, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloActionsWidget, type TopoloActivityWidget, type TopoloAgentExecutionContext, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBinaryResponse, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloJsonSchema, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloRuntimeEnvironment, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetAccessibility, type TopoloWidgetActionBinding, type TopoloWidgetActionRecovery, type TopoloWidgetActivityItem, type TopoloWidgetApiError, type TopoloWidgetApiErrorResponse, type TopoloWidgetApiResponse, type TopoloWidgetApiSuccessResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetConfiguration, type TopoloWidgetConfigurationField, type TopoloWidgetConfigurationOption, type TopoloWidgetContext, type TopoloWidgetContribution, type TopoloWidgetDatasetDefinition, type TopoloWidgetDimension, type TopoloWidgetDimensionDefinition, type TopoloWidgetDraft, type TopoloWidgetDrilldown, type TopoloWidgetErrorResponseOptions, type TopoloWidgetEventDefinition, type TopoloWidgetLifecycleStage, type TopoloWidgetLocalization, type TopoloWidgetMetric, type TopoloWidgetMetricAggregation, type TopoloWidgetMetricComparison, type TopoloWidgetMetricDefinition, type TopoloWidgetMetricSemantic, type TopoloWidgetNotificationItem, type TopoloWidgetPeriod, type TopoloWidgetPresentation, type TopoloWidgetRefreshPolicy, type TopoloWidgetResourceBinding, type TopoloWidgetResponseOptions, type TopoloWidgetSeries, type TopoloWidgetSeriesDefinition, type TopoloWidgetSeriesPoint, type TopoloWidgetSize, type TopoloWidgetState, type TopoloWidgetStatus, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWidgetVisualizationFamily, type TopoloWidgetWorkspaceSelector, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, assertTopoloServiceUrlEnvironment, canonicalJson, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, canonicalizeActorEnvelope, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionResult, compactActionValidation, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, decodeActorEnvelopeHeader, defineTopoloActionsWidget, defineTopoloActivityWidget, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, encodeActorEnvelopeHeader, encodeTopoloActionBase64, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, isTopoloWidgetOutputSchema, listApplicationDirectory, parseActorEnvelope, parseTopoloActionUploadContract, preferExactActionMatches, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, projectActorAuditEvent, publicTopoloErrorMessage, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, sha256CanonicalValue, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
|
|
1709
|
+
export { ACTION_CATALOG_DIGEST_ALGORITHM, ACTOR_AUDIT_PROJECTION_VERSION, ACTOR_ENVELOPE_VERSION, type AccountableSubject, type AccountableSubjectType, type ActionContractManifest, type ActionContractSource, type ActorAssurance, type ActorAuditEventRole, type ActorAuditProjection, type ActorChannel, type ActorDelegationHop, type ActorEnvelope, ActorEnvelopeValidationError, type ActorIdentity, type ActorPrincipalType, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_APP_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceCatalogUrlEntry, TOPOLO_ACTOR_ENVELOPE_HEADER, TOPOLO_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_CONTRACT_VERSION, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_OUTPUT_SCHEMA, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionPreparation, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloActionsWidget, type TopoloActivityWidget, type TopoloAgentExecutionContext, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBinaryResponse, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloJsonSchema, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloRuntimeEnvironment, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetAccessibility, type TopoloWidgetActionBinding, type TopoloWidgetActionRecovery, type TopoloWidgetActivityItem, type TopoloWidgetApiError, type TopoloWidgetApiErrorResponse, type TopoloWidgetApiResponse, type TopoloWidgetApiSuccessResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetConfiguration, type TopoloWidgetConfigurationField, type TopoloWidgetConfigurationOption, type TopoloWidgetContext, type TopoloWidgetContribution, type TopoloWidgetDatasetDefinition, type TopoloWidgetDimension, type TopoloWidgetDimensionDefinition, type TopoloWidgetDraft, type TopoloWidgetDrilldown, type TopoloWidgetErrorResponseOptions, type TopoloWidgetEventDefinition, type TopoloWidgetLifecycleStage, type TopoloWidgetLocalization, type TopoloWidgetMetric, type TopoloWidgetMetricAggregation, type TopoloWidgetMetricComparison, type TopoloWidgetMetricDefinition, type TopoloWidgetMetricSemantic, type TopoloWidgetNotificationItem, type TopoloWidgetPeriod, type TopoloWidgetPresentation, type TopoloWidgetRefreshPolicy, type TopoloWidgetResourceBinding, type TopoloWidgetResponseOptions, type TopoloWidgetSeries, type TopoloWidgetSeriesDefinition, type TopoloWidgetSeriesPoint, type TopoloWidgetSize, type TopoloWidgetState, type TopoloWidgetStatus, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWidgetVisualizationFamily, type TopoloWidgetWorkspaceSelector, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, assertTopoloServiceUrlEnvironment, calculateDpopJkt, canonicalJson, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, canonicalizeActorEnvelope, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionResult, compactActionValidation, createDpopProof, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, decodeActorEnvelopeHeader, defineTopoloActionsWidget, defineTopoloActivityWidget, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, encodeActorEnvelopeHeader, encodeTopoloActionBase64, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, isTopoloWidgetOutputSchema, listApplicationDirectory, parseActorEnvelope, parseTopoloActionUploadContract, preferExactActionMatches, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, projectActorAuditEvent, publicTopoloErrorMessage, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, sha256CanonicalValue, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ function applyAuthHeaders(headers, credential) {
|
|
|
4
4
|
headers.set("X-Api-Key", credential.apiKey);
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
|
-
headers.set("Authorization",
|
|
7
|
+
headers.set("Authorization", `${credential.kind === "dpop_access_token" ? "DPoP" : "Bearer"} ${credential.accessToken}`);
|
|
8
8
|
}
|
|
9
9
|
function applyAuditHeaders(headers, agent, requestId) {
|
|
10
10
|
headers.set("X-Topolo-Client", `${agent.clientName}/${agent.clientVersion}`);
|
|
@@ -18,6 +18,60 @@ function generateRequestId() {
|
|
|
18
18
|
return `req_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
// src/dpop.ts
|
|
22
|
+
var encoder = new TextEncoder();
|
|
23
|
+
function encodeBase64Url(value) {
|
|
24
|
+
const bytes = value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
25
|
+
let binary = "";
|
|
26
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
27
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
28
|
+
}
|
|
29
|
+
function encodeJson(value) {
|
|
30
|
+
return encodeBase64Url(encoder.encode(JSON.stringify(value)));
|
|
31
|
+
}
|
|
32
|
+
async function sha256Base64Url(value) {
|
|
33
|
+
return encodeBase64Url(await crypto.subtle.digest("SHA-256", encoder.encode(value)));
|
|
34
|
+
}
|
|
35
|
+
function publicJwk(privateJwk) {
|
|
36
|
+
const { crv, kty, x, y } = privateJwk;
|
|
37
|
+
if (kty !== "EC" || crv !== "P-256" || !x || !y || !privateJwk.d) {
|
|
38
|
+
throw new TypeError("A private P-256 JSON Web Key is required for DPoP signing.");
|
|
39
|
+
}
|
|
40
|
+
return { crv, kty, x, y };
|
|
41
|
+
}
|
|
42
|
+
function canonicalTargetUrl(value) {
|
|
43
|
+
const url = new URL(value);
|
|
44
|
+
return `${url.origin}${url.pathname}`;
|
|
45
|
+
}
|
|
46
|
+
async function calculateDpopJkt(privateJwk) {
|
|
47
|
+
const jwk = publicJwk(privateJwk);
|
|
48
|
+
return sha256Base64Url(JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y }));
|
|
49
|
+
}
|
|
50
|
+
async function createDpopProof(input) {
|
|
51
|
+
const jwk = publicJwk(input.privateJwk);
|
|
52
|
+
const key = await crypto.subtle.importKey(
|
|
53
|
+
"jwk",
|
|
54
|
+
input.privateJwk,
|
|
55
|
+
{ name: "ECDSA", namedCurve: "P-256" },
|
|
56
|
+
false,
|
|
57
|
+
["sign"]
|
|
58
|
+
);
|
|
59
|
+
const header = encodeJson({ alg: "ES256", typ: "dpop+jwt", jwk });
|
|
60
|
+
const claims = encodeJson({
|
|
61
|
+
jti: crypto.randomUUID(),
|
|
62
|
+
iat: Math.floor(Date.now() / 1e3),
|
|
63
|
+
htm: input.method.toUpperCase(),
|
|
64
|
+
htu: canonicalTargetUrl(input.targetUrl),
|
|
65
|
+
ath: await sha256Base64Url(input.accessToken)
|
|
66
|
+
});
|
|
67
|
+
const signature = await crypto.subtle.sign(
|
|
68
|
+
{ name: "ECDSA", hash: "SHA-256" },
|
|
69
|
+
key,
|
|
70
|
+
encoder.encode(`${header}.${claims}`)
|
|
71
|
+
);
|
|
72
|
+
return `${header}.${claims}.${encodeBase64Url(signature)}`;
|
|
73
|
+
}
|
|
74
|
+
|
|
21
75
|
// src/errors.ts
|
|
22
76
|
var TopoloSdkError = class extends Error {
|
|
23
77
|
code;
|
|
@@ -1374,7 +1428,6 @@ var TopoloClient = class _TopoloClient {
|
|
|
1374
1428
|
if (opts.body !== void 0) headers.set("Content-Type", "application/json");
|
|
1375
1429
|
const platformAppId = resolveConfiguredAppId(resolvedService.serviceKey, this.appIds);
|
|
1376
1430
|
if (platformAppId) headers.set("X-App-ID", platformAppId);
|
|
1377
|
-
applyAuthHeaders(headers, this.credential);
|
|
1378
1431
|
const actorEnvelope = opts.actorEnvelope === void 0 ? void 0 : parseActorEnvelope(opts.actorEnvelope);
|
|
1379
1432
|
const requestId = actorEnvelope?.action.requestId ?? generateRequestId();
|
|
1380
1433
|
applyAuditHeaders(headers, this.agent, requestId);
|
|
@@ -1408,9 +1461,19 @@ var TopoloClient = class _TopoloClient {
|
|
|
1408
1461
|
}, this.timeoutMs);
|
|
1409
1462
|
const signal = opts.signal ? mergeSignals(opts.signal, controller.signal) : controller.signal;
|
|
1410
1463
|
try {
|
|
1464
|
+
const requestHeaders = new Headers(headers);
|
|
1465
|
+
applyAuthHeaders(requestHeaders, this.credential);
|
|
1466
|
+
if (this.credential.kind === "dpop_access_token") {
|
|
1467
|
+
requestHeaders.set("DPoP", await createDpopProof({
|
|
1468
|
+
accessToken: this.credential.accessToken,
|
|
1469
|
+
method,
|
|
1470
|
+
targetUrl: urlStr,
|
|
1471
|
+
privateJwk: this.credential.privateJwk
|
|
1472
|
+
}));
|
|
1473
|
+
}
|
|
1411
1474
|
return await this.fetchImpl(urlStr, {
|
|
1412
1475
|
method,
|
|
1413
|
-
headers:
|
|
1476
|
+
headers: requestHeaders,
|
|
1414
1477
|
body: opts.rawBody ?? (opts.body !== void 0 ? JSON.stringify(opts.body) : null),
|
|
1415
1478
|
signal
|
|
1416
1479
|
});
|
|
@@ -1447,7 +1510,6 @@ var TopoloClient = class _TopoloClient {
|
|
|
1447
1510
|
await res.body?.cancel().catch(() => void 0);
|
|
1448
1511
|
const refreshed = await this.refreshRejectedAccessToken(attemptedCredential.accessToken);
|
|
1449
1512
|
if (refreshed) {
|
|
1450
|
-
applyAuthHeaders(headers, refreshed);
|
|
1451
1513
|
res = await fetchWithReadRetry();
|
|
1452
1514
|
}
|
|
1453
1515
|
}
|
|
@@ -4801,6 +4863,7 @@ export {
|
|
|
4801
4863
|
actionContractCompleteness,
|
|
4802
4864
|
applicationEntryFromCatalog,
|
|
4803
4865
|
assertTopoloServiceUrlEnvironment,
|
|
4866
|
+
calculateDpopJkt,
|
|
4804
4867
|
canonicalJson,
|
|
4805
4868
|
canonicalTopoloErrorCode,
|
|
4806
4869
|
canonicalTopoloRequestId,
|
|
@@ -4812,6 +4875,7 @@ export {
|
|
|
4812
4875
|
compactActionPreparation,
|
|
4813
4876
|
compactActionResult,
|
|
4814
4877
|
compactActionValidation,
|
|
4878
|
+
createDpopProof,
|
|
4815
4879
|
createTopolo,
|
|
4816
4880
|
createTopoloAgentExecutionContext,
|
|
4817
4881
|
createTopoloWidgetError,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auth credential types used by the SDK.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Supported modes:
|
|
5
5
|
* - `api_key`: a single platform API key (service-scoped at issuance).
|
|
6
|
-
*
|
|
6
|
+
* Used for service integrations that are not installation-bound.
|
|
7
7
|
* - `access_token`: a short-lived JWT from the interactive login flow.
|
|
8
8
|
* Used by TopoloCli after `topolo auth login`.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* PKCE flow in TopoloAuth. Those will plug in as a third variant.
|
|
9
|
+
* - `dpop_access_token`: a short-lived delegated token bound to an external
|
|
10
|
+
* agent installation key. Every request proves possession of that key.
|
|
12
11
|
*/
|
|
13
12
|
type TopoloCredential = {
|
|
14
13
|
kind: 'api_key';
|
|
@@ -18,6 +17,11 @@ type TopoloCredential = {
|
|
|
18
17
|
accessToken: string;
|
|
19
18
|
refreshToken?: string;
|
|
20
19
|
expiresAt?: number;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'dpop_access_token';
|
|
22
|
+
accessToken: string;
|
|
23
|
+
privateJwk: JsonWebKey;
|
|
24
|
+
expiresAt?: number;
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
declare const TOPOLO_RUNTIME_ENVIRONMENTS: readonly ["production", "staging", "development", "local"];
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auth credential types used by the SDK.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Supported modes:
|
|
5
5
|
* - `api_key`: a single platform API key (service-scoped at issuance).
|
|
6
|
-
*
|
|
6
|
+
* Used for service integrations that are not installation-bound.
|
|
7
7
|
* - `access_token`: a short-lived JWT from the interactive login flow.
|
|
8
8
|
* Used by TopoloCli after `topolo auth login`.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* PKCE flow in TopoloAuth. Those will plug in as a third variant.
|
|
9
|
+
* - `dpop_access_token`: a short-lived delegated token bound to an external
|
|
10
|
+
* agent installation key. Every request proves possession of that key.
|
|
12
11
|
*/
|
|
13
12
|
type TopoloCredential = {
|
|
14
13
|
kind: 'api_key';
|
|
@@ -18,6 +17,11 @@ type TopoloCredential = {
|
|
|
18
17
|
accessToken: string;
|
|
19
18
|
refreshToken?: string;
|
|
20
19
|
expiresAt?: number;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'dpop_access_token';
|
|
22
|
+
accessToken: string;
|
|
23
|
+
privateJwk: JsonWebKey;
|
|
24
|
+
expiresAt?: number;
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
declare const TOPOLO_RUNTIME_ENVIRONMENTS: readonly ["production", "staging", "development", "local"];
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/sdk",
|
|
3
3
|
"packageManager": "pnpm@10.17.1",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"topoloPublishedVersion": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
5
|
+
"topoloPublishedVersion": "0.19.0",
|
|
6
6
|
"description": "Typed client SDK for the Topolo platform. Used by TopoloCli, TopoloMCP, and third-party agents.",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"author": "Topolo",
|