@topolo/sdk 0.10.3 → 0.10.5
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 +455 -33
- package/dist/index.d.cts +121 -1
- package/dist/index.d.ts +121 -1
- package/dist/index.js +441 -33
- package/dist/node/credential-store.cjs +254 -25
- package/dist/node/credential-store.d.cts +10 -3
- package/dist/node/credential-store.d.ts +10 -3
- package/dist/node/credential-store.js +251 -25
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -31,6 +31,12 @@ interface AgentIdentity {
|
|
|
31
31
|
agentName?: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
declare const TOPOLO_RUNTIME_ENVIRONMENTS: readonly ["production", "staging", "development", "local"];
|
|
35
|
+
type TopoloRuntimeEnvironment = (typeof TOPOLO_RUNTIME_ENVIRONMENTS)[number];
|
|
36
|
+
declare const TOPOLO_ENVIRONMENT_SERVICE_URLS: Record<TopoloRuntimeEnvironment, Record<string, string>>;
|
|
37
|
+
declare function assertTopoloServiceUrlEnvironment(service: string, value: string, environment: TopoloRuntimeEnvironment): string;
|
|
38
|
+
declare function topoloServiceOrigins(serviceUrls: Record<string, string> | undefined, environment: TopoloRuntimeEnvironment): Record<string, string>;
|
|
39
|
+
|
|
34
40
|
interface TopoloActionValidationIssue {
|
|
35
41
|
path: string;
|
|
36
42
|
code: string;
|
|
@@ -80,6 +86,8 @@ interface TopoloClientOptions {
|
|
|
80
86
|
agent: AgentIdentity;
|
|
81
87
|
/** Per-service URL overrides. Useful for staging/dev. */
|
|
82
88
|
serviceUrls?: Record<string, string>;
|
|
89
|
+
/** Explicit environment used to reject cross-environment service and action origins. */
|
|
90
|
+
environment?: TopoloRuntimeEnvironment;
|
|
83
91
|
/** Per-service TopoloAuth app id overrides from the owning app/deployment. */
|
|
84
92
|
appIds?: Record<string, string>;
|
|
85
93
|
/**
|
|
@@ -223,6 +231,7 @@ interface TopoloActionCatalogEntry {
|
|
|
223
231
|
path: string;
|
|
224
232
|
permissionName: string;
|
|
225
233
|
requiredPermission: string;
|
|
234
|
+
principalAccess?: 'platform_admin' | 'platform_super_admin' | null;
|
|
226
235
|
/** Static RBAC, contextual runtime policy, or an explicit public/service exception. */
|
|
227
236
|
authorizationMode?: 'static' | 'runtime' | 'public' | 'service';
|
|
228
237
|
allowedServices?: string[];
|
|
@@ -283,6 +292,18 @@ interface TopoloActionPlan {
|
|
|
283
292
|
rollbackActionId: string | null;
|
|
284
293
|
nextActionIds: string[];
|
|
285
294
|
}
|
|
295
|
+
interface TopoloActionPreparation {
|
|
296
|
+
action: TopoloActionCatalogEntry;
|
|
297
|
+
example: {
|
|
298
|
+
title?: string;
|
|
299
|
+
description?: string;
|
|
300
|
+
input: Record<string, unknown>;
|
|
301
|
+
} | null;
|
|
302
|
+
input: Record<string, unknown>;
|
|
303
|
+
inputSource: 'provided' | 'example' | 'empty';
|
|
304
|
+
missingFields: string[];
|
|
305
|
+
plan: TopoloActionPlan;
|
|
306
|
+
}
|
|
286
307
|
interface TopoloCatalogPage {
|
|
287
308
|
nextCursor: string | null;
|
|
288
309
|
hasMore: boolean;
|
|
@@ -309,6 +330,7 @@ declare class TopoloClient {
|
|
|
309
330
|
private credential;
|
|
310
331
|
private readonly agent;
|
|
311
332
|
private readonly serviceUrls?;
|
|
333
|
+
private readonly environment?;
|
|
312
334
|
private readonly appIds?;
|
|
313
335
|
private readonly requireConfirmForWrites;
|
|
314
336
|
private readonly timeoutMs;
|
|
@@ -340,6 +362,8 @@ declare class TopoloClient {
|
|
|
340
362
|
request<T = unknown>(opts: RequestOptions): Promise<T>;
|
|
341
363
|
private loadCurrentCredential;
|
|
342
364
|
private refreshRejectedAccessToken;
|
|
365
|
+
private validatedServiceOrigin;
|
|
366
|
+
private validatedActionEntry;
|
|
343
367
|
private resolveRequestService;
|
|
344
368
|
private resolveLiveCallableService;
|
|
345
369
|
/**
|
|
@@ -419,6 +443,14 @@ declare class TopoloClient {
|
|
|
419
443
|
resourceId: string;
|
|
420
444
|
};
|
|
421
445
|
}): Promise<TopoloActionPlan>;
|
|
446
|
+
prepareAction(action: string, input?: Record<string, unknown>, options?: {
|
|
447
|
+
confirm?: boolean;
|
|
448
|
+
resource?: {
|
|
449
|
+
resourceType: string;
|
|
450
|
+
resourceId: string;
|
|
451
|
+
};
|
|
452
|
+
}): Promise<TopoloActionPreparation>;
|
|
453
|
+
private planResolvedAction;
|
|
422
454
|
readAction<T = unknown>(action: string, input?: Record<string, unknown>, options?: {
|
|
423
455
|
resource?: {
|
|
424
456
|
resourceType: string;
|
|
@@ -743,6 +775,72 @@ declare function compactActionPlan(plan: TopoloActionPlan): {
|
|
|
743
775
|
rollbackActionId: string | null;
|
|
744
776
|
nextActionIds: string[];
|
|
745
777
|
};
|
|
778
|
+
interface TopoloAgentExecutionContext {
|
|
779
|
+
environment: TopoloRuntimeEnvironment;
|
|
780
|
+
contextKey: string | null;
|
|
781
|
+
user: {
|
|
782
|
+
id: string;
|
|
783
|
+
email: string;
|
|
784
|
+
name: string | null;
|
|
785
|
+
role: string;
|
|
786
|
+
};
|
|
787
|
+
organization: {
|
|
788
|
+
id: string;
|
|
789
|
+
slug: string;
|
|
790
|
+
name: string;
|
|
791
|
+
} | null;
|
|
792
|
+
serviceOrigins: Record<string, string>;
|
|
793
|
+
}
|
|
794
|
+
declare function createTopoloAgentExecutionContext(input: {
|
|
795
|
+
environment: TopoloRuntimeEnvironment;
|
|
796
|
+
contextKey: string | null;
|
|
797
|
+
identity: CredentialIntrospection;
|
|
798
|
+
serviceUrls?: Record<string, string>;
|
|
799
|
+
}): TopoloAgentExecutionContext;
|
|
800
|
+
declare function compactActionPreparationCore(preparation: TopoloActionPreparation): {
|
|
801
|
+
action: {
|
|
802
|
+
id: string;
|
|
803
|
+
title: string;
|
|
804
|
+
docsUrl: string | null;
|
|
805
|
+
};
|
|
806
|
+
example: {
|
|
807
|
+
title: string | null;
|
|
808
|
+
input: Record<string, unknown>;
|
|
809
|
+
} | null;
|
|
810
|
+
input: {
|
|
811
|
+
source: "example";
|
|
812
|
+
value?: undefined;
|
|
813
|
+
} | {
|
|
814
|
+
source: "provided" | "empty";
|
|
815
|
+
value: Record<string, unknown>;
|
|
816
|
+
};
|
|
817
|
+
missingFields: string[];
|
|
818
|
+
valid: boolean;
|
|
819
|
+
errors: TopoloActionValidationIssue[];
|
|
820
|
+
request: {
|
|
821
|
+
method: TopoloActionCatalogEntry["method"];
|
|
822
|
+
service: string;
|
|
823
|
+
apiBaseUrl: string | null;
|
|
824
|
+
path: string;
|
|
825
|
+
query?: Record<string, string | number | boolean>;
|
|
826
|
+
body?: unknown;
|
|
827
|
+
resource?: {
|
|
828
|
+
resourceType: string;
|
|
829
|
+
resourceId: string;
|
|
830
|
+
};
|
|
831
|
+
} | null;
|
|
832
|
+
confirmation: {
|
|
833
|
+
required: boolean;
|
|
834
|
+
provided: boolean;
|
|
835
|
+
};
|
|
836
|
+
executable: boolean;
|
|
837
|
+
verification: string[];
|
|
838
|
+
rollbackActionId: string | null;
|
|
839
|
+
};
|
|
840
|
+
declare function compactActionPreparation(preparation: TopoloActionPreparation): ReturnType<typeof compactActionPreparationCore>;
|
|
841
|
+
declare function compactActionPreparation(preparation: TopoloActionPreparation, context: TopoloAgentExecutionContext): ReturnType<typeof compactActionPreparationCore> & {
|
|
842
|
+
context: TopoloAgentExecutionContext;
|
|
843
|
+
};
|
|
746
844
|
declare function compactApplicationAudit(report: ApplicationRequirementsAuditReport): {
|
|
747
845
|
version: string;
|
|
748
846
|
applications: {
|
|
@@ -761,6 +859,7 @@ interface TopoloActionDigestInput {
|
|
|
761
859
|
path: string;
|
|
762
860
|
permission?: string | null;
|
|
763
861
|
permissionName?: string | null;
|
|
862
|
+
principalAccess?: 'platform_admin' | 'platform_super_admin' | null;
|
|
764
863
|
authorizationMode?: string | null;
|
|
765
864
|
allowedServices?: string[] | null;
|
|
766
865
|
target?: string | null;
|
|
@@ -2077,6 +2176,10 @@ declare class TopoloSdkError extends Error {
|
|
|
2077
2176
|
readonly code: string;
|
|
2078
2177
|
constructor(code: string, message: string);
|
|
2079
2178
|
}
|
|
2179
|
+
declare function canonicalTopoloErrorCode(value: unknown): string | null;
|
|
2180
|
+
declare function canonicalTopoloRequestId(value: unknown): string | undefined;
|
|
2181
|
+
declare function canonicalTopoloRetryAfter(value: unknown): string | undefined;
|
|
2182
|
+
declare function canonicalTopoloRequired(value: unknown): string[];
|
|
2080
2183
|
declare class TopoloAuthError extends TopoloSdkError {
|
|
2081
2184
|
readonly status: number;
|
|
2082
2185
|
readonly body: unknown;
|
|
@@ -2084,6 +2187,7 @@ declare class TopoloAuthError extends TopoloSdkError {
|
|
|
2084
2187
|
readonly path?: string;
|
|
2085
2188
|
readonly requestId?: string;
|
|
2086
2189
|
readonly retryAfter?: string;
|
|
2190
|
+
readonly details: unknown;
|
|
2087
2191
|
constructor(message: string, code?: string, options?: HttpErrorContext);
|
|
2088
2192
|
}
|
|
2089
2193
|
declare class TopoloPermissionError extends TopoloSdkError {
|
|
@@ -2094,16 +2198,31 @@ declare class TopoloPermissionError extends TopoloSdkError {
|
|
|
2094
2198
|
readonly path?: string;
|
|
2095
2199
|
readonly requestId?: string;
|
|
2096
2200
|
readonly retryAfter?: string;
|
|
2201
|
+
readonly details: unknown;
|
|
2097
2202
|
constructor(message: string, required: string[], options?: HttpErrorContext);
|
|
2098
2203
|
}
|
|
2099
2204
|
interface HttpErrorContext {
|
|
2205
|
+
code?: string;
|
|
2100
2206
|
status?: number;
|
|
2101
2207
|
body?: unknown;
|
|
2102
2208
|
service?: string;
|
|
2103
2209
|
path?: string;
|
|
2104
2210
|
requestId?: string;
|
|
2105
2211
|
retryAfter?: string;
|
|
2212
|
+
details?: unknown;
|
|
2106
2213
|
}
|
|
2214
|
+
declare function extractTopoloServiceErrorCode(body: unknown): string | null;
|
|
2215
|
+
declare function extractTopoloServiceErrorDetails(body: unknown): unknown;
|
|
2216
|
+
declare function publicTopoloErrorMessage(error: string | {
|
|
2217
|
+
code?: string;
|
|
2218
|
+
body?: unknown;
|
|
2219
|
+
status?: number;
|
|
2220
|
+
message?: string;
|
|
2221
|
+
}): string;
|
|
2222
|
+
declare function topoloErrorHint(error: string | {
|
|
2223
|
+
code?: string;
|
|
2224
|
+
body?: unknown;
|
|
2225
|
+
}): string | undefined;
|
|
2107
2226
|
declare class TopoloConfirmationRequiredError extends TopoloSdkError {
|
|
2108
2227
|
constructor(message: string);
|
|
2109
2228
|
}
|
|
@@ -2114,6 +2233,7 @@ declare class TopoloHttpError extends TopoloSdkError {
|
|
|
2114
2233
|
readonly path: string;
|
|
2115
2234
|
readonly requestId?: string;
|
|
2116
2235
|
readonly retryAfter?: string;
|
|
2236
|
+
readonly details: unknown;
|
|
2117
2237
|
constructor(service: string, path: string, status: number, body: unknown, message?: string, options?: HttpErrorContext);
|
|
2118
2238
|
}
|
|
2119
2239
|
|
|
@@ -2661,4 +2781,4 @@ declare function createTopolo(options: TopoloClientOptions): {
|
|
|
2661
2781
|
};
|
|
2662
2782
|
type Topolo = ReturnType<typeof createTopolo>;
|
|
2663
2783
|
|
|
2664
|
-
export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, 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_WIDGET_ENDPOINT, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, applicationRequirementScopes, auditAllApplicationRequirements, auditApplicationEntries, auditApplicationRequirements, compactActionCatalogEntry, compactActionPlan, compactActionValidation, compactApplicationAudit, createTopolo, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, requirementsForApplication, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, staticApplicationDirectory, validateTopoloActionInput, validateTopoloWidgetResponse };
|
|
2784
|
+
export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, 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_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_ENDPOINT, 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 TopoloAgentExecutionContext, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, type TopoloRuntimeEnvironment, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, applicationRequirementScopes, assertTopoloServiceUrlEnvironment, auditAllApplicationRequirements, auditApplicationEntries, auditApplicationRequirements, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionValidation, compactApplicationAudit, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, publicTopoloErrorMessage, requirementsForApplication, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, staticApplicationDirectory, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,12 @@ interface AgentIdentity {
|
|
|
31
31
|
agentName?: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
declare const TOPOLO_RUNTIME_ENVIRONMENTS: readonly ["production", "staging", "development", "local"];
|
|
35
|
+
type TopoloRuntimeEnvironment = (typeof TOPOLO_RUNTIME_ENVIRONMENTS)[number];
|
|
36
|
+
declare const TOPOLO_ENVIRONMENT_SERVICE_URLS: Record<TopoloRuntimeEnvironment, Record<string, string>>;
|
|
37
|
+
declare function assertTopoloServiceUrlEnvironment(service: string, value: string, environment: TopoloRuntimeEnvironment): string;
|
|
38
|
+
declare function topoloServiceOrigins(serviceUrls: Record<string, string> | undefined, environment: TopoloRuntimeEnvironment): Record<string, string>;
|
|
39
|
+
|
|
34
40
|
interface TopoloActionValidationIssue {
|
|
35
41
|
path: string;
|
|
36
42
|
code: string;
|
|
@@ -80,6 +86,8 @@ interface TopoloClientOptions {
|
|
|
80
86
|
agent: AgentIdentity;
|
|
81
87
|
/** Per-service URL overrides. Useful for staging/dev. */
|
|
82
88
|
serviceUrls?: Record<string, string>;
|
|
89
|
+
/** Explicit environment used to reject cross-environment service and action origins. */
|
|
90
|
+
environment?: TopoloRuntimeEnvironment;
|
|
83
91
|
/** Per-service TopoloAuth app id overrides from the owning app/deployment. */
|
|
84
92
|
appIds?: Record<string, string>;
|
|
85
93
|
/**
|
|
@@ -223,6 +231,7 @@ interface TopoloActionCatalogEntry {
|
|
|
223
231
|
path: string;
|
|
224
232
|
permissionName: string;
|
|
225
233
|
requiredPermission: string;
|
|
234
|
+
principalAccess?: 'platform_admin' | 'platform_super_admin' | null;
|
|
226
235
|
/** Static RBAC, contextual runtime policy, or an explicit public/service exception. */
|
|
227
236
|
authorizationMode?: 'static' | 'runtime' | 'public' | 'service';
|
|
228
237
|
allowedServices?: string[];
|
|
@@ -283,6 +292,18 @@ interface TopoloActionPlan {
|
|
|
283
292
|
rollbackActionId: string | null;
|
|
284
293
|
nextActionIds: string[];
|
|
285
294
|
}
|
|
295
|
+
interface TopoloActionPreparation {
|
|
296
|
+
action: TopoloActionCatalogEntry;
|
|
297
|
+
example: {
|
|
298
|
+
title?: string;
|
|
299
|
+
description?: string;
|
|
300
|
+
input: Record<string, unknown>;
|
|
301
|
+
} | null;
|
|
302
|
+
input: Record<string, unknown>;
|
|
303
|
+
inputSource: 'provided' | 'example' | 'empty';
|
|
304
|
+
missingFields: string[];
|
|
305
|
+
plan: TopoloActionPlan;
|
|
306
|
+
}
|
|
286
307
|
interface TopoloCatalogPage {
|
|
287
308
|
nextCursor: string | null;
|
|
288
309
|
hasMore: boolean;
|
|
@@ -309,6 +330,7 @@ declare class TopoloClient {
|
|
|
309
330
|
private credential;
|
|
310
331
|
private readonly agent;
|
|
311
332
|
private readonly serviceUrls?;
|
|
333
|
+
private readonly environment?;
|
|
312
334
|
private readonly appIds?;
|
|
313
335
|
private readonly requireConfirmForWrites;
|
|
314
336
|
private readonly timeoutMs;
|
|
@@ -340,6 +362,8 @@ declare class TopoloClient {
|
|
|
340
362
|
request<T = unknown>(opts: RequestOptions): Promise<T>;
|
|
341
363
|
private loadCurrentCredential;
|
|
342
364
|
private refreshRejectedAccessToken;
|
|
365
|
+
private validatedServiceOrigin;
|
|
366
|
+
private validatedActionEntry;
|
|
343
367
|
private resolveRequestService;
|
|
344
368
|
private resolveLiveCallableService;
|
|
345
369
|
/**
|
|
@@ -419,6 +443,14 @@ declare class TopoloClient {
|
|
|
419
443
|
resourceId: string;
|
|
420
444
|
};
|
|
421
445
|
}): Promise<TopoloActionPlan>;
|
|
446
|
+
prepareAction(action: string, input?: Record<string, unknown>, options?: {
|
|
447
|
+
confirm?: boolean;
|
|
448
|
+
resource?: {
|
|
449
|
+
resourceType: string;
|
|
450
|
+
resourceId: string;
|
|
451
|
+
};
|
|
452
|
+
}): Promise<TopoloActionPreparation>;
|
|
453
|
+
private planResolvedAction;
|
|
422
454
|
readAction<T = unknown>(action: string, input?: Record<string, unknown>, options?: {
|
|
423
455
|
resource?: {
|
|
424
456
|
resourceType: string;
|
|
@@ -743,6 +775,72 @@ declare function compactActionPlan(plan: TopoloActionPlan): {
|
|
|
743
775
|
rollbackActionId: string | null;
|
|
744
776
|
nextActionIds: string[];
|
|
745
777
|
};
|
|
778
|
+
interface TopoloAgentExecutionContext {
|
|
779
|
+
environment: TopoloRuntimeEnvironment;
|
|
780
|
+
contextKey: string | null;
|
|
781
|
+
user: {
|
|
782
|
+
id: string;
|
|
783
|
+
email: string;
|
|
784
|
+
name: string | null;
|
|
785
|
+
role: string;
|
|
786
|
+
};
|
|
787
|
+
organization: {
|
|
788
|
+
id: string;
|
|
789
|
+
slug: string;
|
|
790
|
+
name: string;
|
|
791
|
+
} | null;
|
|
792
|
+
serviceOrigins: Record<string, string>;
|
|
793
|
+
}
|
|
794
|
+
declare function createTopoloAgentExecutionContext(input: {
|
|
795
|
+
environment: TopoloRuntimeEnvironment;
|
|
796
|
+
contextKey: string | null;
|
|
797
|
+
identity: CredentialIntrospection;
|
|
798
|
+
serviceUrls?: Record<string, string>;
|
|
799
|
+
}): TopoloAgentExecutionContext;
|
|
800
|
+
declare function compactActionPreparationCore(preparation: TopoloActionPreparation): {
|
|
801
|
+
action: {
|
|
802
|
+
id: string;
|
|
803
|
+
title: string;
|
|
804
|
+
docsUrl: string | null;
|
|
805
|
+
};
|
|
806
|
+
example: {
|
|
807
|
+
title: string | null;
|
|
808
|
+
input: Record<string, unknown>;
|
|
809
|
+
} | null;
|
|
810
|
+
input: {
|
|
811
|
+
source: "example";
|
|
812
|
+
value?: undefined;
|
|
813
|
+
} | {
|
|
814
|
+
source: "provided" | "empty";
|
|
815
|
+
value: Record<string, unknown>;
|
|
816
|
+
};
|
|
817
|
+
missingFields: string[];
|
|
818
|
+
valid: boolean;
|
|
819
|
+
errors: TopoloActionValidationIssue[];
|
|
820
|
+
request: {
|
|
821
|
+
method: TopoloActionCatalogEntry["method"];
|
|
822
|
+
service: string;
|
|
823
|
+
apiBaseUrl: string | null;
|
|
824
|
+
path: string;
|
|
825
|
+
query?: Record<string, string | number | boolean>;
|
|
826
|
+
body?: unknown;
|
|
827
|
+
resource?: {
|
|
828
|
+
resourceType: string;
|
|
829
|
+
resourceId: string;
|
|
830
|
+
};
|
|
831
|
+
} | null;
|
|
832
|
+
confirmation: {
|
|
833
|
+
required: boolean;
|
|
834
|
+
provided: boolean;
|
|
835
|
+
};
|
|
836
|
+
executable: boolean;
|
|
837
|
+
verification: string[];
|
|
838
|
+
rollbackActionId: string | null;
|
|
839
|
+
};
|
|
840
|
+
declare function compactActionPreparation(preparation: TopoloActionPreparation): ReturnType<typeof compactActionPreparationCore>;
|
|
841
|
+
declare function compactActionPreparation(preparation: TopoloActionPreparation, context: TopoloAgentExecutionContext): ReturnType<typeof compactActionPreparationCore> & {
|
|
842
|
+
context: TopoloAgentExecutionContext;
|
|
843
|
+
};
|
|
746
844
|
declare function compactApplicationAudit(report: ApplicationRequirementsAuditReport): {
|
|
747
845
|
version: string;
|
|
748
846
|
applications: {
|
|
@@ -761,6 +859,7 @@ interface TopoloActionDigestInput {
|
|
|
761
859
|
path: string;
|
|
762
860
|
permission?: string | null;
|
|
763
861
|
permissionName?: string | null;
|
|
862
|
+
principalAccess?: 'platform_admin' | 'platform_super_admin' | null;
|
|
764
863
|
authorizationMode?: string | null;
|
|
765
864
|
allowedServices?: string[] | null;
|
|
766
865
|
target?: string | null;
|
|
@@ -2077,6 +2176,10 @@ declare class TopoloSdkError extends Error {
|
|
|
2077
2176
|
readonly code: string;
|
|
2078
2177
|
constructor(code: string, message: string);
|
|
2079
2178
|
}
|
|
2179
|
+
declare function canonicalTopoloErrorCode(value: unknown): string | null;
|
|
2180
|
+
declare function canonicalTopoloRequestId(value: unknown): string | undefined;
|
|
2181
|
+
declare function canonicalTopoloRetryAfter(value: unknown): string | undefined;
|
|
2182
|
+
declare function canonicalTopoloRequired(value: unknown): string[];
|
|
2080
2183
|
declare class TopoloAuthError extends TopoloSdkError {
|
|
2081
2184
|
readonly status: number;
|
|
2082
2185
|
readonly body: unknown;
|
|
@@ -2084,6 +2187,7 @@ declare class TopoloAuthError extends TopoloSdkError {
|
|
|
2084
2187
|
readonly path?: string;
|
|
2085
2188
|
readonly requestId?: string;
|
|
2086
2189
|
readonly retryAfter?: string;
|
|
2190
|
+
readonly details: unknown;
|
|
2087
2191
|
constructor(message: string, code?: string, options?: HttpErrorContext);
|
|
2088
2192
|
}
|
|
2089
2193
|
declare class TopoloPermissionError extends TopoloSdkError {
|
|
@@ -2094,16 +2198,31 @@ declare class TopoloPermissionError extends TopoloSdkError {
|
|
|
2094
2198
|
readonly path?: string;
|
|
2095
2199
|
readonly requestId?: string;
|
|
2096
2200
|
readonly retryAfter?: string;
|
|
2201
|
+
readonly details: unknown;
|
|
2097
2202
|
constructor(message: string, required: string[], options?: HttpErrorContext);
|
|
2098
2203
|
}
|
|
2099
2204
|
interface HttpErrorContext {
|
|
2205
|
+
code?: string;
|
|
2100
2206
|
status?: number;
|
|
2101
2207
|
body?: unknown;
|
|
2102
2208
|
service?: string;
|
|
2103
2209
|
path?: string;
|
|
2104
2210
|
requestId?: string;
|
|
2105
2211
|
retryAfter?: string;
|
|
2212
|
+
details?: unknown;
|
|
2106
2213
|
}
|
|
2214
|
+
declare function extractTopoloServiceErrorCode(body: unknown): string | null;
|
|
2215
|
+
declare function extractTopoloServiceErrorDetails(body: unknown): unknown;
|
|
2216
|
+
declare function publicTopoloErrorMessage(error: string | {
|
|
2217
|
+
code?: string;
|
|
2218
|
+
body?: unknown;
|
|
2219
|
+
status?: number;
|
|
2220
|
+
message?: string;
|
|
2221
|
+
}): string;
|
|
2222
|
+
declare function topoloErrorHint(error: string | {
|
|
2223
|
+
code?: string;
|
|
2224
|
+
body?: unknown;
|
|
2225
|
+
}): string | undefined;
|
|
2107
2226
|
declare class TopoloConfirmationRequiredError extends TopoloSdkError {
|
|
2108
2227
|
constructor(message: string);
|
|
2109
2228
|
}
|
|
@@ -2114,6 +2233,7 @@ declare class TopoloHttpError extends TopoloSdkError {
|
|
|
2114
2233
|
readonly path: string;
|
|
2115
2234
|
readonly requestId?: string;
|
|
2116
2235
|
readonly retryAfter?: string;
|
|
2236
|
+
readonly details: unknown;
|
|
2117
2237
|
constructor(service: string, path: string, status: number, body: unknown, message?: string, options?: HttpErrorContext);
|
|
2118
2238
|
}
|
|
2119
2239
|
|
|
@@ -2661,4 +2781,4 @@ declare function createTopolo(options: TopoloClientOptions): {
|
|
|
2661
2781
|
};
|
|
2662
2782
|
type Topolo = ReturnType<typeof createTopolo>;
|
|
2663
2783
|
|
|
2664
|
-
export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, 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_WIDGET_ENDPOINT, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, applicationRequirementScopes, auditAllApplicationRequirements, auditApplicationEntries, auditApplicationRequirements, compactActionCatalogEntry, compactActionPlan, compactActionValidation, compactApplicationAudit, createTopolo, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, requirementsForApplication, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, staticApplicationDirectory, validateTopoloActionInput, validateTopoloWidgetResponse };
|
|
2784
|
+
export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, 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_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_ENDPOINT, 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 TopoloAgentExecutionContext, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, type TopoloRuntimeEnvironment, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, applicationRequirementScopes, assertTopoloServiceUrlEnvironment, auditAllApplicationRequirements, auditApplicationEntries, auditApplicationRequirements, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionValidation, compactApplicationAudit, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, publicTopoloErrorMessage, requirementsForApplication, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, staticApplicationDirectory, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
|