@topolo/sdk 0.9.9 → 0.9.10
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 +64 -0
- package/dist/index.d.cts +62 -1
- package/dist/index.d.ts +62 -1
- package/dist/index.js +63 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
TopoloOAuth: () => TopoloOAuth,
|
|
38
38
|
TopoloPermissionError: () => TopoloPermissionError,
|
|
39
39
|
TopoloSdkError: () => TopoloSdkError,
|
|
40
|
+
WorkspacesModule: () => WorkspacesModule,
|
|
40
41
|
actionContractCompleteness: () => actionContractCompleteness,
|
|
41
42
|
applicationRequirementScopes: () => applicationRequirementScopes,
|
|
42
43
|
auditAllApplicationRequirements: () => auditAllApplicationRequirements,
|
|
@@ -4287,6 +4288,67 @@ var IdentityModule = class {
|
|
|
4287
4288
|
}
|
|
4288
4289
|
};
|
|
4289
4290
|
|
|
4291
|
+
// src/modules/workspaces.ts
|
|
4292
|
+
var ACTIONS = {
|
|
4293
|
+
list: "app_topolo_auth.workspaces.list",
|
|
4294
|
+
create: "app_topolo_auth.workspaces.create",
|
|
4295
|
+
rename: "app_topolo_auth.workspaces.rename",
|
|
4296
|
+
setDefault: "app_topolo_auth.workspaces.default.set"
|
|
4297
|
+
};
|
|
4298
|
+
var WorkspacesModule = class {
|
|
4299
|
+
constructor(client) {
|
|
4300
|
+
this.client = client;
|
|
4301
|
+
}
|
|
4302
|
+
client;
|
|
4303
|
+
async list(application) {
|
|
4304
|
+
const context = await this.resolveContext(application);
|
|
4305
|
+
return this.client.callAction(ACTIONS.list, {
|
|
4306
|
+
org_id: context.organizationId,
|
|
4307
|
+
app_id: context.appId
|
|
4308
|
+
});
|
|
4309
|
+
}
|
|
4310
|
+
async create(application, input) {
|
|
4311
|
+
const current = await this.list(application);
|
|
4312
|
+
if (!current.data.policy.canCreate) {
|
|
4313
|
+
throw new TopoloSdkError(
|
|
4314
|
+
"workspace_creation_not_allowed",
|
|
4315
|
+
`Workspace creation is not allowed for ${current.data.appId}: ${current.data.policy.reason}`
|
|
4316
|
+
);
|
|
4317
|
+
}
|
|
4318
|
+
return this.client.callAction(ACTIONS.create, {
|
|
4319
|
+
organizationId: current.data.organizationId,
|
|
4320
|
+
appId: current.data.appId,
|
|
4321
|
+
name: input.name,
|
|
4322
|
+
...input.isDefault === void 0 ? {} : { isDefault: input.isDefault }
|
|
4323
|
+
}, { confirm: input.confirm === true });
|
|
4324
|
+
}
|
|
4325
|
+
async rename(application, workspaceId, name, confirm = false) {
|
|
4326
|
+
const context = await this.resolveContext(application);
|
|
4327
|
+
return this.client.callAction(ACTIONS.rename, {
|
|
4328
|
+
workspaceId,
|
|
4329
|
+
organizationId: context.organizationId,
|
|
4330
|
+
appId: context.appId,
|
|
4331
|
+
name
|
|
4332
|
+
}, { confirm });
|
|
4333
|
+
}
|
|
4334
|
+
async setDefault(application, workspaceId, confirm = false) {
|
|
4335
|
+
const context = await this.resolveContext(application);
|
|
4336
|
+
return this.client.callAction(ACTIONS.setDefault, {
|
|
4337
|
+
workspaceId,
|
|
4338
|
+
organizationId: context.organizationId,
|
|
4339
|
+
appId: context.appId
|
|
4340
|
+
}, { confirm });
|
|
4341
|
+
}
|
|
4342
|
+
async resolveContext(application) {
|
|
4343
|
+
const identity = await this.client.introspect();
|
|
4344
|
+
if (!identity.organization?.id) {
|
|
4345
|
+
throw new TopoloSdkError("organization_required", "Workspace lifecycle requires an organization-scoped credential.");
|
|
4346
|
+
}
|
|
4347
|
+
const service = await this.client.getService(application);
|
|
4348
|
+
return { organizationId: identity.organization.id, appId: service.appId };
|
|
4349
|
+
}
|
|
4350
|
+
};
|
|
4351
|
+
|
|
4290
4352
|
// src/modules/p2p.ts
|
|
4291
4353
|
var P2PModule = class {
|
|
4292
4354
|
constructor(client) {
|
|
@@ -4745,6 +4807,7 @@ function createTopolo(options) {
|
|
|
4745
4807
|
return {
|
|
4746
4808
|
client,
|
|
4747
4809
|
identity: new IdentityModule(client),
|
|
4810
|
+
workspaces: new WorkspacesModule(client),
|
|
4748
4811
|
crm: new CrmModule(client)
|
|
4749
4812
|
};
|
|
4750
4813
|
}
|
|
@@ -4767,6 +4830,7 @@ function createTopolo(options) {
|
|
|
4767
4830
|
TopoloOAuth,
|
|
4768
4831
|
TopoloPermissionError,
|
|
4769
4832
|
TopoloSdkError,
|
|
4833
|
+
WorkspacesModule,
|
|
4770
4834
|
actionContractCompleteness,
|
|
4771
4835
|
applicationRequirementScopes,
|
|
4772
4836
|
auditAllApplicationRequirements,
|
package/dist/index.d.cts
CHANGED
|
@@ -2056,6 +2056,66 @@ declare class IdentityModule {
|
|
|
2056
2056
|
whoami(): Promise<CredentialIntrospection>;
|
|
2057
2057
|
}
|
|
2058
2058
|
|
|
2059
|
+
interface TopoloWorkspace {
|
|
2060
|
+
id: string;
|
|
2061
|
+
appId: string;
|
|
2062
|
+
organizationId: string;
|
|
2063
|
+
name: string;
|
|
2064
|
+
slug: string;
|
|
2065
|
+
status: string;
|
|
2066
|
+
isDefault: boolean;
|
|
2067
|
+
ownerUserId: string | null;
|
|
2068
|
+
createdByUserId: string | null;
|
|
2069
|
+
createdAt: number;
|
|
2070
|
+
updatedAt: number;
|
|
2071
|
+
archivedAt: number | null;
|
|
2072
|
+
accessRole: string;
|
|
2073
|
+
accessLevel: string;
|
|
2074
|
+
}
|
|
2075
|
+
interface TopoloWorkspacePolicy {
|
|
2076
|
+
mode: string;
|
|
2077
|
+
limit: number | null;
|
|
2078
|
+
remaining: number | null;
|
|
2079
|
+
userLimit: number | null;
|
|
2080
|
+
userRemaining: number | null;
|
|
2081
|
+
canCreate: boolean;
|
|
2082
|
+
reason: string;
|
|
2083
|
+
}
|
|
2084
|
+
interface TopoloWorkspaceListResult {
|
|
2085
|
+
success: boolean;
|
|
2086
|
+
message: string;
|
|
2087
|
+
data: {
|
|
2088
|
+
appId: string;
|
|
2089
|
+
organizationId: string;
|
|
2090
|
+
accessMode: string;
|
|
2091
|
+
canManageAll: boolean;
|
|
2092
|
+
workspaces: TopoloWorkspace[];
|
|
2093
|
+
policy: TopoloWorkspacePolicy;
|
|
2094
|
+
};
|
|
2095
|
+
timestamp?: string;
|
|
2096
|
+
}
|
|
2097
|
+
interface TopoloWorkspaceMutationResult {
|
|
2098
|
+
success: boolean;
|
|
2099
|
+
message: string;
|
|
2100
|
+
data: {
|
|
2101
|
+
workspace: TopoloWorkspace;
|
|
2102
|
+
};
|
|
2103
|
+
timestamp?: string;
|
|
2104
|
+
}
|
|
2105
|
+
declare class WorkspacesModule {
|
|
2106
|
+
private readonly client;
|
|
2107
|
+
constructor(client: TopoloClient);
|
|
2108
|
+
list(application: string): Promise<TopoloWorkspaceListResult>;
|
|
2109
|
+
create(application: string, input: {
|
|
2110
|
+
name: string;
|
|
2111
|
+
isDefault?: boolean;
|
|
2112
|
+
confirm?: boolean;
|
|
2113
|
+
}): Promise<TopoloWorkspaceMutationResult>;
|
|
2114
|
+
rename(application: string, workspaceId: string, name: string, confirm?: boolean): Promise<TopoloWorkspaceMutationResult>;
|
|
2115
|
+
setDefault(application: string, workspaceId: string, confirm?: boolean): Promise<TopoloWorkspaceMutationResult>;
|
|
2116
|
+
private resolveContext;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2059
2119
|
type P2PPricingModel = 'free' | 'fixed' | 'metered' | 'quote' | 'invoice';
|
|
2060
2120
|
interface P2PCapability {
|
|
2061
2121
|
capability_id: string;
|
|
@@ -2481,8 +2541,9 @@ declare function validateTopoloWidgetResponse(response: unknown): TopoloWidgetVa
|
|
|
2481
2541
|
declare function createTopolo(options: TopoloClientOptions): {
|
|
2482
2542
|
client: TopoloClient;
|
|
2483
2543
|
identity: IdentityModule;
|
|
2544
|
+
workspaces: WorkspacesModule;
|
|
2484
2545
|
crm: CrmModule;
|
|
2485
2546
|
};
|
|
2486
2547
|
type Topolo = ReturnType<typeof createTopolo>;
|
|
2487
2548
|
|
|
2488
|
-
export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, 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, actionContractCompleteness, applicationRequirementScopes, auditAllApplicationRequirements, auditApplicationRequirements, createTopolo, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, requirementsForApplication, resolveCatalogServiceUrl, resolveServiceUrl, validateTopoloActionInput, validateTopoloWidgetResponse };
|
|
2549
|
+
export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, 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, applicationRequirementScopes, auditAllApplicationRequirements, auditApplicationRequirements, createTopolo, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, requirementsForApplication, resolveCatalogServiceUrl, resolveServiceUrl, validateTopoloActionInput, validateTopoloWidgetResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -2056,6 +2056,66 @@ declare class IdentityModule {
|
|
|
2056
2056
|
whoami(): Promise<CredentialIntrospection>;
|
|
2057
2057
|
}
|
|
2058
2058
|
|
|
2059
|
+
interface TopoloWorkspace {
|
|
2060
|
+
id: string;
|
|
2061
|
+
appId: string;
|
|
2062
|
+
organizationId: string;
|
|
2063
|
+
name: string;
|
|
2064
|
+
slug: string;
|
|
2065
|
+
status: string;
|
|
2066
|
+
isDefault: boolean;
|
|
2067
|
+
ownerUserId: string | null;
|
|
2068
|
+
createdByUserId: string | null;
|
|
2069
|
+
createdAt: number;
|
|
2070
|
+
updatedAt: number;
|
|
2071
|
+
archivedAt: number | null;
|
|
2072
|
+
accessRole: string;
|
|
2073
|
+
accessLevel: string;
|
|
2074
|
+
}
|
|
2075
|
+
interface TopoloWorkspacePolicy {
|
|
2076
|
+
mode: string;
|
|
2077
|
+
limit: number | null;
|
|
2078
|
+
remaining: number | null;
|
|
2079
|
+
userLimit: number | null;
|
|
2080
|
+
userRemaining: number | null;
|
|
2081
|
+
canCreate: boolean;
|
|
2082
|
+
reason: string;
|
|
2083
|
+
}
|
|
2084
|
+
interface TopoloWorkspaceListResult {
|
|
2085
|
+
success: boolean;
|
|
2086
|
+
message: string;
|
|
2087
|
+
data: {
|
|
2088
|
+
appId: string;
|
|
2089
|
+
organizationId: string;
|
|
2090
|
+
accessMode: string;
|
|
2091
|
+
canManageAll: boolean;
|
|
2092
|
+
workspaces: TopoloWorkspace[];
|
|
2093
|
+
policy: TopoloWorkspacePolicy;
|
|
2094
|
+
};
|
|
2095
|
+
timestamp?: string;
|
|
2096
|
+
}
|
|
2097
|
+
interface TopoloWorkspaceMutationResult {
|
|
2098
|
+
success: boolean;
|
|
2099
|
+
message: string;
|
|
2100
|
+
data: {
|
|
2101
|
+
workspace: TopoloWorkspace;
|
|
2102
|
+
};
|
|
2103
|
+
timestamp?: string;
|
|
2104
|
+
}
|
|
2105
|
+
declare class WorkspacesModule {
|
|
2106
|
+
private readonly client;
|
|
2107
|
+
constructor(client: TopoloClient);
|
|
2108
|
+
list(application: string): Promise<TopoloWorkspaceListResult>;
|
|
2109
|
+
create(application: string, input: {
|
|
2110
|
+
name: string;
|
|
2111
|
+
isDefault?: boolean;
|
|
2112
|
+
confirm?: boolean;
|
|
2113
|
+
}): Promise<TopoloWorkspaceMutationResult>;
|
|
2114
|
+
rename(application: string, workspaceId: string, name: string, confirm?: boolean): Promise<TopoloWorkspaceMutationResult>;
|
|
2115
|
+
setDefault(application: string, workspaceId: string, confirm?: boolean): Promise<TopoloWorkspaceMutationResult>;
|
|
2116
|
+
private resolveContext;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2059
2119
|
type P2PPricingModel = 'free' | 'fixed' | 'metered' | 'quote' | 'invoice';
|
|
2060
2120
|
interface P2PCapability {
|
|
2061
2121
|
capability_id: string;
|
|
@@ -2481,8 +2541,9 @@ declare function validateTopoloWidgetResponse(response: unknown): TopoloWidgetVa
|
|
|
2481
2541
|
declare function createTopolo(options: TopoloClientOptions): {
|
|
2482
2542
|
client: TopoloClient;
|
|
2483
2543
|
identity: IdentityModule;
|
|
2544
|
+
workspaces: WorkspacesModule;
|
|
2484
2545
|
crm: CrmModule;
|
|
2485
2546
|
};
|
|
2486
2547
|
type Topolo = ReturnType<typeof createTopolo>;
|
|
2487
2548
|
|
|
2488
|
-
export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, 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, actionContractCompleteness, applicationRequirementScopes, auditAllApplicationRequirements, auditApplicationRequirements, createTopolo, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, requirementsForApplication, resolveCatalogServiceUrl, resolveServiceUrl, validateTopoloActionInput, validateTopoloWidgetResponse };
|
|
2549
|
+
export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, 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, applicationRequirementScopes, auditAllApplicationRequirements, auditApplicationRequirements, createTopolo, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, requirementsForApplication, resolveCatalogServiceUrl, resolveServiceUrl, validateTopoloActionInput, validateTopoloWidgetResponse };
|
package/dist/index.js
CHANGED
|
@@ -4223,6 +4223,67 @@ var IdentityModule = class {
|
|
|
4223
4223
|
}
|
|
4224
4224
|
};
|
|
4225
4225
|
|
|
4226
|
+
// src/modules/workspaces.ts
|
|
4227
|
+
var ACTIONS = {
|
|
4228
|
+
list: "app_topolo_auth.workspaces.list",
|
|
4229
|
+
create: "app_topolo_auth.workspaces.create",
|
|
4230
|
+
rename: "app_topolo_auth.workspaces.rename",
|
|
4231
|
+
setDefault: "app_topolo_auth.workspaces.default.set"
|
|
4232
|
+
};
|
|
4233
|
+
var WorkspacesModule = class {
|
|
4234
|
+
constructor(client) {
|
|
4235
|
+
this.client = client;
|
|
4236
|
+
}
|
|
4237
|
+
client;
|
|
4238
|
+
async list(application) {
|
|
4239
|
+
const context = await this.resolveContext(application);
|
|
4240
|
+
return this.client.callAction(ACTIONS.list, {
|
|
4241
|
+
org_id: context.organizationId,
|
|
4242
|
+
app_id: context.appId
|
|
4243
|
+
});
|
|
4244
|
+
}
|
|
4245
|
+
async create(application, input) {
|
|
4246
|
+
const current = await this.list(application);
|
|
4247
|
+
if (!current.data.policy.canCreate) {
|
|
4248
|
+
throw new TopoloSdkError(
|
|
4249
|
+
"workspace_creation_not_allowed",
|
|
4250
|
+
`Workspace creation is not allowed for ${current.data.appId}: ${current.data.policy.reason}`
|
|
4251
|
+
);
|
|
4252
|
+
}
|
|
4253
|
+
return this.client.callAction(ACTIONS.create, {
|
|
4254
|
+
organizationId: current.data.organizationId,
|
|
4255
|
+
appId: current.data.appId,
|
|
4256
|
+
name: input.name,
|
|
4257
|
+
...input.isDefault === void 0 ? {} : { isDefault: input.isDefault }
|
|
4258
|
+
}, { confirm: input.confirm === true });
|
|
4259
|
+
}
|
|
4260
|
+
async rename(application, workspaceId, name, confirm = false) {
|
|
4261
|
+
const context = await this.resolveContext(application);
|
|
4262
|
+
return this.client.callAction(ACTIONS.rename, {
|
|
4263
|
+
workspaceId,
|
|
4264
|
+
organizationId: context.organizationId,
|
|
4265
|
+
appId: context.appId,
|
|
4266
|
+
name
|
|
4267
|
+
}, { confirm });
|
|
4268
|
+
}
|
|
4269
|
+
async setDefault(application, workspaceId, confirm = false) {
|
|
4270
|
+
const context = await this.resolveContext(application);
|
|
4271
|
+
return this.client.callAction(ACTIONS.setDefault, {
|
|
4272
|
+
workspaceId,
|
|
4273
|
+
organizationId: context.organizationId,
|
|
4274
|
+
appId: context.appId
|
|
4275
|
+
}, { confirm });
|
|
4276
|
+
}
|
|
4277
|
+
async resolveContext(application) {
|
|
4278
|
+
const identity = await this.client.introspect();
|
|
4279
|
+
if (!identity.organization?.id) {
|
|
4280
|
+
throw new TopoloSdkError("organization_required", "Workspace lifecycle requires an organization-scoped credential.");
|
|
4281
|
+
}
|
|
4282
|
+
const service = await this.client.getService(application);
|
|
4283
|
+
return { organizationId: identity.organization.id, appId: service.appId };
|
|
4284
|
+
}
|
|
4285
|
+
};
|
|
4286
|
+
|
|
4226
4287
|
// src/modules/p2p.ts
|
|
4227
4288
|
var P2PModule = class {
|
|
4228
4289
|
constructor(client) {
|
|
@@ -4681,6 +4742,7 @@ function createTopolo(options) {
|
|
|
4681
4742
|
return {
|
|
4682
4743
|
client,
|
|
4683
4744
|
identity: new IdentityModule(client),
|
|
4745
|
+
workspaces: new WorkspacesModule(client),
|
|
4684
4746
|
crm: new CrmModule(client)
|
|
4685
4747
|
};
|
|
4686
4748
|
}
|
|
@@ -4702,6 +4764,7 @@ export {
|
|
|
4702
4764
|
TopoloOAuth,
|
|
4703
4765
|
TopoloPermissionError,
|
|
4704
4766
|
TopoloSdkError,
|
|
4767
|
+
WorkspacesModule,
|
|
4705
4768
|
actionContractCompleteness,
|
|
4706
4769
|
applicationRequirementScopes,
|
|
4707
4770
|
auditAllApplicationRequirements,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/sdk",
|
|
3
|
-
"version": "0.9.
|
|
4
|
-
"topoloPublishedVersion": "0.9.
|
|
3
|
+
"version": "0.9.10",
|
|
4
|
+
"topoloPublishedVersion": "0.9.10",
|
|
5
5
|
"description": "Typed client SDK for the Topolo platform. Used by TopoloCli, TopoloMCP, and third-party agents.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|