@topolo/sdk 0.14.2 → 0.14.4
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 +502 -17
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +500 -17
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -29,6 +29,7 @@ __export(index_exports, {
|
|
|
29
29
|
TOPOLO_RUNTIME_ENVIRONMENTS: () => TOPOLO_RUNTIME_ENVIRONMENTS,
|
|
30
30
|
TOPOLO_WIDGET_CONTRACT_VERSION: () => TOPOLO_WIDGET_CONTRACT_VERSION,
|
|
31
31
|
TOPOLO_WIDGET_ENDPOINT: () => TOPOLO_WIDGET_ENDPOINT,
|
|
32
|
+
TOPOLO_WIDGET_OUTPUT_SCHEMA: () => TOPOLO_WIDGET_OUTPUT_SCHEMA,
|
|
32
33
|
TOPOLO_WIDGET_REFRESH_INTERVAL_MS: () => TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
|
|
33
34
|
TopoloAuthError: () => TopoloAuthError,
|
|
34
35
|
TopoloClient: () => TopoloClient,
|
|
@@ -66,6 +67,7 @@ __export(index_exports, {
|
|
|
66
67
|
extractTopoloServiceErrorDetails: () => extractTopoloServiceErrorDetails,
|
|
67
68
|
formatDirectoryApplicationIds: () => formatDirectoryApplicationIds,
|
|
68
69
|
friendlyAppId: () => friendlyAppId,
|
|
70
|
+
isTopoloWidgetOutputSchema: () => isTopoloWidgetOutputSchema,
|
|
69
71
|
listApplicationDirectory: () => listApplicationDirectory,
|
|
70
72
|
parseTopoloActionUploadContract: () => parseTopoloActionUploadContract,
|
|
71
73
|
preferExactActionMatches: () => preferExactActionMatches,
|
|
@@ -2048,12 +2050,21 @@ function redactActionResult(value) {
|
|
|
2048
2050
|
if (!isRecord3(value)) return value;
|
|
2049
2051
|
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
2050
2052
|
key,
|
|
2051
|
-
isSensitiveActionResultKey(key) ? "[REDACTED]" : redactActionResult(item)
|
|
2053
|
+
isSensitiveActionResultKey(key, item) ? "[REDACTED]" : redactActionResult(item)
|
|
2052
2054
|
]));
|
|
2053
2055
|
}
|
|
2054
|
-
function isSensitiveActionResultKey(key) {
|
|
2056
|
+
function isSensitiveActionResultKey(key, value) {
|
|
2055
2057
|
const normalized = key.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
2056
|
-
|
|
2058
|
+
if (normalized === "capability") return isCredentialShaped(value);
|
|
2059
|
+
return ["authorization", "cookie", "setcookie", "proxyauthorization"].includes(normalized) || /(token|secret|password|privatekey|apikey)$/.test(normalized);
|
|
2060
|
+
}
|
|
2061
|
+
var PLAIN_ENUM_VALUE = /^[a-z][a-z0-9_-]{0,31}$/;
|
|
2062
|
+
function isCredentialShaped(value) {
|
|
2063
|
+
if (typeof value !== "string") return value !== null && value !== void 0 && typeof value !== "boolean" && typeof value !== "number";
|
|
2064
|
+
const trimmed = value.trim();
|
|
2065
|
+
if (!trimmed) return false;
|
|
2066
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed)) return true;
|
|
2067
|
+
return !PLAIN_ENUM_VALUE.test(trimmed);
|
|
2057
2068
|
}
|
|
2058
2069
|
function resolveConfiguredServiceUrl(slug, serviceUrls) {
|
|
2059
2070
|
for (const serviceKey of serviceKeyCandidates2(slug)) {
|
|
@@ -3736,22 +3747,22 @@ function validateRuntimeSemantics(widget, contributionPath, declared, errors) {
|
|
|
3736
3747
|
validateSeriesDimensions(metric.series, declared.dimensionKeys, contributionPath, errors);
|
|
3737
3748
|
}
|
|
3738
3749
|
}
|
|
3739
|
-
const
|
|
3740
|
-
for (const item of
|
|
3750
|
+
const series2 = Array.isArray(widget.series) ? widget.series : [];
|
|
3751
|
+
for (const item of series2) {
|
|
3741
3752
|
if (!isRecord5(item)) continue;
|
|
3742
3753
|
if (typeof item.id === "string" && !declared.seriesKeys.has(item.id)) errors.push(`${contributionPath}.seriesDefinitions is missing runtime series ${item.id}`);
|
|
3743
3754
|
validateSeriesDimensions(item, declared.dimensionKeys, contributionPath, errors);
|
|
3744
3755
|
}
|
|
3745
3756
|
}
|
|
3746
|
-
function validateSeriesDimensions(
|
|
3747
|
-
if (!Array.isArray(
|
|
3748
|
-
for (const point of
|
|
3757
|
+
function validateSeriesDimensions(series2, known, path, errors) {
|
|
3758
|
+
if (!Array.isArray(series2.points)) return;
|
|
3759
|
+
for (const point of series2.points) if (isRecord5(point)) validateRuntimeDimensions(point.dimensions, known, path, errors);
|
|
3749
3760
|
}
|
|
3750
3761
|
function validateRuntimeDimensions(value, known, path, errors) {
|
|
3751
3762
|
if (!Array.isArray(value)) return;
|
|
3752
|
-
for (const
|
|
3753
|
-
if (isRecord5(
|
|
3754
|
-
errors.push(`${path}.dimensions is missing runtime dimension ${
|
|
3763
|
+
for (const dimension2 of value) {
|
|
3764
|
+
if (isRecord5(dimension2) && typeof dimension2.key === "string" && !known.has(dimension2.key)) {
|
|
3765
|
+
errors.push(`${path}.dimensions is missing runtime dimension ${dimension2.key}`);
|
|
3755
3766
|
}
|
|
3756
3767
|
}
|
|
3757
3768
|
}
|
|
@@ -3788,12 +3799,12 @@ function validatePeriod(value, path, errors) {
|
|
|
3788
3799
|
}
|
|
3789
3800
|
function validateDimensions(value, path, errors) {
|
|
3790
3801
|
if (!arrayValue(value, path, errors)) return;
|
|
3791
|
-
value.forEach((
|
|
3802
|
+
value.forEach((dimension2, index) => {
|
|
3792
3803
|
const itemPath = `${path}[${index}]`;
|
|
3793
|
-
if (!recordValue(
|
|
3794
|
-
nonEmptyString(
|
|
3795
|
-
nonEmptyString(
|
|
3796
|
-
nonEmptyString(
|
|
3804
|
+
if (!recordValue(dimension2, itemPath, errors)) return;
|
|
3805
|
+
nonEmptyString(dimension2.key, `${itemPath}.key`, errors);
|
|
3806
|
+
nonEmptyString(dimension2.label, `${itemPath}.label`, errors);
|
|
3807
|
+
nonEmptyString(dimension2.value, `${itemPath}.value`, errors);
|
|
3797
3808
|
});
|
|
3798
3809
|
}
|
|
3799
3810
|
function validateComparison(value, path, errors) {
|
|
@@ -3807,7 +3818,7 @@ function validateComparison(value, path, errors) {
|
|
|
3807
3818
|
}
|
|
3808
3819
|
function validateSeriesCollection(value, path, errors, requireOne) {
|
|
3809
3820
|
if (!arrayValue(value, path, errors, requireOne)) return;
|
|
3810
|
-
value.forEach((
|
|
3821
|
+
value.forEach((series2, index) => validateSeries(series2, `${path}[${index}]`, errors));
|
|
3811
3822
|
}
|
|
3812
3823
|
function validateSeries(value, path, errors) {
|
|
3813
3824
|
if (!recordValue(value, path, errors)) return;
|
|
@@ -4005,6 +4016,478 @@ function toIsoTimestamp(input) {
|
|
|
4005
4016
|
return input ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
4006
4017
|
}
|
|
4007
4018
|
|
|
4019
|
+
// src/widget-output-schema.ts
|
|
4020
|
+
var nonEmptyString2 = { type: "string", minLength: 1 };
|
|
4021
|
+
var stringArray3 = { type: "array", items: nonEmptyString2 };
|
|
4022
|
+
var actionBinding = {
|
|
4023
|
+
type: "object",
|
|
4024
|
+
properties: {
|
|
4025
|
+
id: nonEmptyString2,
|
|
4026
|
+
label: nonEmptyString2,
|
|
4027
|
+
actionId: nonEmptyString2,
|
|
4028
|
+
resourceType: nonEmptyString2,
|
|
4029
|
+
resourceId: nonEmptyString2,
|
|
4030
|
+
input: { type: "object" },
|
|
4031
|
+
requiresConfirmation: { type: "boolean" },
|
|
4032
|
+
destructive: { type: "boolean" },
|
|
4033
|
+
effects: stringArray3,
|
|
4034
|
+
verification: stringArray3,
|
|
4035
|
+
recovery: {
|
|
4036
|
+
type: "object",
|
|
4037
|
+
properties: {
|
|
4038
|
+
mode: { enum: ["not_applicable", "retry", "compensating_action"] },
|
|
4039
|
+
actionId: nonEmptyString2,
|
|
4040
|
+
instructions: nonEmptyString2
|
|
4041
|
+
},
|
|
4042
|
+
required: ["mode", "instructions"],
|
|
4043
|
+
additionalProperties: false
|
|
4044
|
+
}
|
|
4045
|
+
},
|
|
4046
|
+
required: [
|
|
4047
|
+
"id",
|
|
4048
|
+
"label",
|
|
4049
|
+
"actionId",
|
|
4050
|
+
"resourceType",
|
|
4051
|
+
"input",
|
|
4052
|
+
"requiresConfirmation",
|
|
4053
|
+
"destructive",
|
|
4054
|
+
"effects",
|
|
4055
|
+
"verification",
|
|
4056
|
+
"recovery"
|
|
4057
|
+
],
|
|
4058
|
+
additionalProperties: false
|
|
4059
|
+
};
|
|
4060
|
+
var dimension = {
|
|
4061
|
+
type: "object",
|
|
4062
|
+
properties: { key: nonEmptyString2, label: nonEmptyString2, value: nonEmptyString2 },
|
|
4063
|
+
required: ["key", "label", "value"],
|
|
4064
|
+
additionalProperties: false
|
|
4065
|
+
};
|
|
4066
|
+
var period = {
|
|
4067
|
+
type: "object",
|
|
4068
|
+
properties: {
|
|
4069
|
+
start: nonEmptyString2,
|
|
4070
|
+
end: nonEmptyString2,
|
|
4071
|
+
timezone: nonEmptyString2
|
|
4072
|
+
},
|
|
4073
|
+
required: ["start", "end", "timezone"],
|
|
4074
|
+
additionalProperties: false
|
|
4075
|
+
};
|
|
4076
|
+
var series = {
|
|
4077
|
+
type: "object",
|
|
4078
|
+
properties: {
|
|
4079
|
+
id: nonEmptyString2,
|
|
4080
|
+
label: nonEmptyString2,
|
|
4081
|
+
unit: nonEmptyString2,
|
|
4082
|
+
points: {
|
|
4083
|
+
type: "array",
|
|
4084
|
+
items: {
|
|
4085
|
+
type: "object",
|
|
4086
|
+
properties: {
|
|
4087
|
+
timestamp: nonEmptyString2,
|
|
4088
|
+
value: { type: "number" },
|
|
4089
|
+
dimensions: { type: "array", items: dimension }
|
|
4090
|
+
},
|
|
4091
|
+
required: ["timestamp", "value", "dimensions"],
|
|
4092
|
+
additionalProperties: false
|
|
4093
|
+
}
|
|
4094
|
+
}
|
|
4095
|
+
},
|
|
4096
|
+
required: ["id", "label", "unit", "points"],
|
|
4097
|
+
additionalProperties: false
|
|
4098
|
+
};
|
|
4099
|
+
var contribution = {
|
|
4100
|
+
type: "object",
|
|
4101
|
+
properties: {
|
|
4102
|
+
summary: nonEmptyString2,
|
|
4103
|
+
identity: {
|
|
4104
|
+
type: "object",
|
|
4105
|
+
properties: { iconSource: { const: "catalog" } },
|
|
4106
|
+
required: ["iconSource"],
|
|
4107
|
+
additionalProperties: false
|
|
4108
|
+
},
|
|
4109
|
+
workspaceSelector: {
|
|
4110
|
+
type: "object",
|
|
4111
|
+
properties: {
|
|
4112
|
+
mode: { enum: ["none", "optional", "required"] },
|
|
4113
|
+
resourceType: nonEmptyString2,
|
|
4114
|
+
label: nonEmptyString2,
|
|
4115
|
+
supportsMultiple: { type: "boolean" }
|
|
4116
|
+
},
|
|
4117
|
+
required: ["mode", "resourceType", "label", "supportsMultiple"],
|
|
4118
|
+
additionalProperties: false
|
|
4119
|
+
},
|
|
4120
|
+
metricDefinitions: {
|
|
4121
|
+
type: "array",
|
|
4122
|
+
items: {
|
|
4123
|
+
type: "object",
|
|
4124
|
+
properties: {
|
|
4125
|
+
key: nonEmptyString2,
|
|
4126
|
+
label: nonEmptyString2,
|
|
4127
|
+
description: nonEmptyString2,
|
|
4128
|
+
unit: nonEmptyString2,
|
|
4129
|
+
semantic: {
|
|
4130
|
+
enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
|
|
4131
|
+
},
|
|
4132
|
+
aggregation: {
|
|
4133
|
+
enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
|
|
4134
|
+
}
|
|
4135
|
+
},
|
|
4136
|
+
required: ["key", "label", "description", "unit", "semantic", "aggregation"],
|
|
4137
|
+
additionalProperties: false
|
|
4138
|
+
}
|
|
4139
|
+
},
|
|
4140
|
+
seriesDefinitions: {
|
|
4141
|
+
type: "array",
|
|
4142
|
+
items: {
|
|
4143
|
+
type: "object",
|
|
4144
|
+
properties: {
|
|
4145
|
+
key: nonEmptyString2,
|
|
4146
|
+
label: nonEmptyString2,
|
|
4147
|
+
metricKey: nonEmptyString2,
|
|
4148
|
+
unit: nonEmptyString2
|
|
4149
|
+
},
|
|
4150
|
+
required: ["key", "label", "metricKey", "unit"],
|
|
4151
|
+
additionalProperties: false
|
|
4152
|
+
}
|
|
4153
|
+
},
|
|
4154
|
+
dimensions: {
|
|
4155
|
+
type: "array",
|
|
4156
|
+
items: {
|
|
4157
|
+
type: "object",
|
|
4158
|
+
properties: {
|
|
4159
|
+
key: nonEmptyString2,
|
|
4160
|
+
label: nonEmptyString2,
|
|
4161
|
+
description: nonEmptyString2,
|
|
4162
|
+
valueType: { enum: ["string", "number", "boolean", "date", "datetime"] }
|
|
4163
|
+
},
|
|
4164
|
+
required: ["key", "label", "description", "valueType"],
|
|
4165
|
+
additionalProperties: false
|
|
4166
|
+
}
|
|
4167
|
+
},
|
|
4168
|
+
lifecycleStages: {
|
|
4169
|
+
type: "array",
|
|
4170
|
+
items: {
|
|
4171
|
+
type: "object",
|
|
4172
|
+
properties: {
|
|
4173
|
+
key: nonEmptyString2,
|
|
4174
|
+
label: nonEmptyString2,
|
|
4175
|
+
order: { type: "number" },
|
|
4176
|
+
terminal: { type: "boolean" }
|
|
4177
|
+
},
|
|
4178
|
+
required: ["key", "label", "order", "terminal"],
|
|
4179
|
+
additionalProperties: false
|
|
4180
|
+
}
|
|
4181
|
+
},
|
|
4182
|
+
events: {
|
|
4183
|
+
type: "array",
|
|
4184
|
+
items: {
|
|
4185
|
+
type: "object",
|
|
4186
|
+
properties: {
|
|
4187
|
+
key: nonEmptyString2,
|
|
4188
|
+
label: nonEmptyString2,
|
|
4189
|
+
description: nonEmptyString2
|
|
4190
|
+
},
|
|
4191
|
+
required: ["key", "label", "description"],
|
|
4192
|
+
additionalProperties: false
|
|
4193
|
+
}
|
|
4194
|
+
},
|
|
4195
|
+
datasets: {
|
|
4196
|
+
type: "array",
|
|
4197
|
+
minItems: 1,
|
|
4198
|
+
items: {
|
|
4199
|
+
type: "object",
|
|
4200
|
+
properties: {
|
|
4201
|
+
id: nonEmptyString2,
|
|
4202
|
+
label: nonEmptyString2,
|
|
4203
|
+
description: nonEmptyString2,
|
|
4204
|
+
grain: nonEmptyString2,
|
|
4205
|
+
metricKeys: stringArray3,
|
|
4206
|
+
seriesKeys: stringArray3,
|
|
4207
|
+
dimensionKeys: stringArray3,
|
|
4208
|
+
eventKeys: stringArray3,
|
|
4209
|
+
actionIds: stringArray3
|
|
4210
|
+
},
|
|
4211
|
+
required: [
|
|
4212
|
+
"id",
|
|
4213
|
+
"label",
|
|
4214
|
+
"description",
|
|
4215
|
+
"grain",
|
|
4216
|
+
"metricKeys",
|
|
4217
|
+
"seriesKeys",
|
|
4218
|
+
"dimensionKeys",
|
|
4219
|
+
"eventKeys",
|
|
4220
|
+
"actionIds"
|
|
4221
|
+
],
|
|
4222
|
+
additionalProperties: false
|
|
4223
|
+
}
|
|
4224
|
+
},
|
|
4225
|
+
compatibleVisualizations: {
|
|
4226
|
+
type: "array",
|
|
4227
|
+
minItems: 1,
|
|
4228
|
+
items: {
|
|
4229
|
+
enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
|
|
4230
|
+
}
|
|
4231
|
+
},
|
|
4232
|
+
defaultVisualization: {
|
|
4233
|
+
enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
|
|
4234
|
+
}
|
|
4235
|
+
},
|
|
4236
|
+
required: [
|
|
4237
|
+
"summary",
|
|
4238
|
+
"identity",
|
|
4239
|
+
"workspaceSelector",
|
|
4240
|
+
"metricDefinitions",
|
|
4241
|
+
"seriesDefinitions",
|
|
4242
|
+
"dimensions",
|
|
4243
|
+
"lifecycleStages",
|
|
4244
|
+
"events",
|
|
4245
|
+
"datasets",
|
|
4246
|
+
"compatibleVisualizations",
|
|
4247
|
+
"defaultVisualization"
|
|
4248
|
+
],
|
|
4249
|
+
additionalProperties: false
|
|
4250
|
+
};
|
|
4251
|
+
var widgetItem = {
|
|
4252
|
+
type: "object",
|
|
4253
|
+
properties: {
|
|
4254
|
+
id: nonEmptyString2,
|
|
4255
|
+
version: nonEmptyString2,
|
|
4256
|
+
appId: nonEmptyString2,
|
|
4257
|
+
serviceName: nonEmptyString2,
|
|
4258
|
+
lastUpdated: nonEmptyString2,
|
|
4259
|
+
type: { enum: ["stats", "chart", "activity", "notifications", "actions"] },
|
|
4260
|
+
presentation: {
|
|
4261
|
+
type: "object",
|
|
4262
|
+
properties: {
|
|
4263
|
+
title: nonEmptyString2,
|
|
4264
|
+
description: nonEmptyString2,
|
|
4265
|
+
contexts: {
|
|
4266
|
+
type: "array",
|
|
4267
|
+
minItems: 1,
|
|
4268
|
+
items: { enum: ["personal", "organization", "workspace", "resource"] }
|
|
4269
|
+
},
|
|
4270
|
+
supportedSizes: {
|
|
4271
|
+
type: "array",
|
|
4272
|
+
minItems: 1,
|
|
4273
|
+
items: { enum: ["compact", "medium", "wide", "full"] }
|
|
4274
|
+
},
|
|
4275
|
+
defaultSize: { enum: ["compact", "medium", "wide", "full"] }
|
|
4276
|
+
},
|
|
4277
|
+
required: ["title", "contexts", "supportedSizes", "defaultSize"],
|
|
4278
|
+
additionalProperties: false
|
|
4279
|
+
},
|
|
4280
|
+
resource: {
|
|
4281
|
+
type: "object",
|
|
4282
|
+
properties: {
|
|
4283
|
+
resourceType: nonEmptyString2,
|
|
4284
|
+
resourceId: nonEmptyString2,
|
|
4285
|
+
requiredPermissions: stringArray3
|
|
4286
|
+
},
|
|
4287
|
+
required: ["resourceType", "requiredPermissions"],
|
|
4288
|
+
additionalProperties: false
|
|
4289
|
+
},
|
|
4290
|
+
state: {
|
|
4291
|
+
type: "object",
|
|
4292
|
+
properties: {
|
|
4293
|
+
status: { enum: ["ready", "empty", "unavailable", "stale", "error"] },
|
|
4294
|
+
observedAt: nonEmptyString2,
|
|
4295
|
+
lastSuccessfulAt: nonEmptyString2,
|
|
4296
|
+
code: nonEmptyString2,
|
|
4297
|
+
message: nonEmptyString2
|
|
4298
|
+
},
|
|
4299
|
+
required: ["status", "observedAt"],
|
|
4300
|
+
additionalProperties: false
|
|
4301
|
+
},
|
|
4302
|
+
refresh: {
|
|
4303
|
+
type: "object",
|
|
4304
|
+
properties: {
|
|
4305
|
+
intervalSeconds: { type: "number" },
|
|
4306
|
+
timeoutSeconds: { type: "number" },
|
|
4307
|
+
maxAgeSeconds: { type: "number" },
|
|
4308
|
+
staleWhileRevalidateSeconds: { type: "number" }
|
|
4309
|
+
},
|
|
4310
|
+
required: ["intervalSeconds", "timeoutSeconds", "maxAgeSeconds", "staleWhileRevalidateSeconds"],
|
|
4311
|
+
additionalProperties: false
|
|
4312
|
+
},
|
|
4313
|
+
configuration: {
|
|
4314
|
+
type: "object",
|
|
4315
|
+
properties: {
|
|
4316
|
+
allowMultipleInstances: { type: "boolean" },
|
|
4317
|
+
fields: {
|
|
4318
|
+
type: "array",
|
|
4319
|
+
items: {
|
|
4320
|
+
type: "object",
|
|
4321
|
+
properties: {
|
|
4322
|
+
key: nonEmptyString2,
|
|
4323
|
+
label: nonEmptyString2,
|
|
4324
|
+
type: { enum: ["string", "number", "boolean", "select", "multi-select", "date-range"] },
|
|
4325
|
+
required: { type: "boolean" },
|
|
4326
|
+
options: {
|
|
4327
|
+
type: "array",
|
|
4328
|
+
items: {
|
|
4329
|
+
type: "object",
|
|
4330
|
+
properties: { value: nonEmptyString2, label: nonEmptyString2 },
|
|
4331
|
+
required: ["value", "label"],
|
|
4332
|
+
additionalProperties: false
|
|
4333
|
+
}
|
|
4334
|
+
}
|
|
4335
|
+
},
|
|
4336
|
+
required: ["key", "label", "type", "required"],
|
|
4337
|
+
additionalProperties: false
|
|
4338
|
+
}
|
|
4339
|
+
},
|
|
4340
|
+
defaults: { type: "object" }
|
|
4341
|
+
},
|
|
4342
|
+
required: ["allowMultipleInstances", "fields", "defaults"],
|
|
4343
|
+
additionalProperties: false
|
|
4344
|
+
},
|
|
4345
|
+
drilldowns: {
|
|
4346
|
+
type: "array",
|
|
4347
|
+
items: {
|
|
4348
|
+
type: "object",
|
|
4349
|
+
properties: { id: nonEmptyString2, label: nonEmptyString2, href: nonEmptyString2 },
|
|
4350
|
+
required: ["id", "label", "href"],
|
|
4351
|
+
additionalProperties: false
|
|
4352
|
+
}
|
|
4353
|
+
},
|
|
4354
|
+
controls: { type: "array", items: actionBinding },
|
|
4355
|
+
localization: {
|
|
4356
|
+
type: "object",
|
|
4357
|
+
properties: {
|
|
4358
|
+
locale: nonEmptyString2,
|
|
4359
|
+
titleKey: nonEmptyString2,
|
|
4360
|
+
descriptionKey: nonEmptyString2,
|
|
4361
|
+
title: nonEmptyString2,
|
|
4362
|
+
description: nonEmptyString2
|
|
4363
|
+
},
|
|
4364
|
+
required: ["locale", "titleKey"],
|
|
4365
|
+
additionalProperties: false
|
|
4366
|
+
},
|
|
4367
|
+
accessibility: {
|
|
4368
|
+
type: "object",
|
|
4369
|
+
properties: { label: nonEmptyString2, description: nonEmptyString2 },
|
|
4370
|
+
required: ["label"],
|
|
4371
|
+
additionalProperties: false
|
|
4372
|
+
},
|
|
4373
|
+
contribution,
|
|
4374
|
+
metrics: {
|
|
4375
|
+
type: "array",
|
|
4376
|
+
items: {
|
|
4377
|
+
type: "object",
|
|
4378
|
+
properties: {
|
|
4379
|
+
key: nonEmptyString2,
|
|
4380
|
+
label: nonEmptyString2,
|
|
4381
|
+
value: { type: "number" },
|
|
4382
|
+
unit: nonEmptyString2,
|
|
4383
|
+
semantic: {
|
|
4384
|
+
enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
|
|
4385
|
+
},
|
|
4386
|
+
aggregation: {
|
|
4387
|
+
enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
|
|
4388
|
+
},
|
|
4389
|
+
period,
|
|
4390
|
+
dimensions: { type: "array", items: dimension },
|
|
4391
|
+
series
|
|
4392
|
+
},
|
|
4393
|
+
required: ["key", "label", "value", "unit", "semantic", "aggregation", "period", "dimensions"],
|
|
4394
|
+
additionalProperties: false
|
|
4395
|
+
}
|
|
4396
|
+
},
|
|
4397
|
+
chartType: { enum: ["line", "bar", "area", "pie", "donut"] },
|
|
4398
|
+
series: { type: "array", items: series },
|
|
4399
|
+
activities: { type: "array", items: { type: "object" } },
|
|
4400
|
+
notifications: { type: "array", items: { type: "object" } },
|
|
4401
|
+
unreadCount: { type: "number" },
|
|
4402
|
+
actions: { type: "array", items: actionBinding }
|
|
4403
|
+
},
|
|
4404
|
+
required: [
|
|
4405
|
+
"id",
|
|
4406
|
+
"version",
|
|
4407
|
+
"appId",
|
|
4408
|
+
"serviceName",
|
|
4409
|
+
"lastUpdated",
|
|
4410
|
+
"type",
|
|
4411
|
+
"presentation",
|
|
4412
|
+
"resource",
|
|
4413
|
+
"state",
|
|
4414
|
+
"refresh",
|
|
4415
|
+
"configuration",
|
|
4416
|
+
"drilldowns",
|
|
4417
|
+
"controls",
|
|
4418
|
+
"localization",
|
|
4419
|
+
"accessibility",
|
|
4420
|
+
"contribution"
|
|
4421
|
+
],
|
|
4422
|
+
allOf: [
|
|
4423
|
+
{ if: { properties: { type: { const: "stats" } } }, then: { required: ["metrics"] } },
|
|
4424
|
+
{ if: { properties: { type: { const: "chart" } } }, then: { required: ["chartType", "series"] } },
|
|
4425
|
+
{ if: { properties: { type: { const: "activity" } } }, then: { required: ["activities"] } },
|
|
4426
|
+
{
|
|
4427
|
+
if: { properties: { type: { const: "notifications" } } },
|
|
4428
|
+
then: { required: ["notifications", "unreadCount"] }
|
|
4429
|
+
},
|
|
4430
|
+
{ if: { properties: { type: { const: "actions" } } }, then: { required: ["actions"] } }
|
|
4431
|
+
],
|
|
4432
|
+
additionalProperties: false
|
|
4433
|
+
};
|
|
4434
|
+
var TOPOLO_WIDGET_OUTPUT_SCHEMA = Object.freeze({
|
|
4435
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
4436
|
+
type: "object",
|
|
4437
|
+
properties: {
|
|
4438
|
+
success: { type: "boolean", const: true },
|
|
4439
|
+
contractVersion: { type: "string", const: "3.0.0" },
|
|
4440
|
+
appId: nonEmptyString2,
|
|
4441
|
+
serviceName: nonEmptyString2,
|
|
4442
|
+
generatedAt: nonEmptyString2,
|
|
4443
|
+
widgets: { type: "array", minItems: 1, items: widgetItem },
|
|
4444
|
+
workspace: {
|
|
4445
|
+
anyOf: [
|
|
4446
|
+
{
|
|
4447
|
+
type: "object",
|
|
4448
|
+
properties: {
|
|
4449
|
+
id: { anyOf: [{ type: "string" }, { type: "number" }] },
|
|
4450
|
+
name: nonEmptyString2
|
|
4451
|
+
},
|
|
4452
|
+
required: ["id", "name"],
|
|
4453
|
+
additionalProperties: true
|
|
4454
|
+
},
|
|
4455
|
+
{ type: "null" }
|
|
4456
|
+
]
|
|
4457
|
+
},
|
|
4458
|
+
workspaces: {
|
|
4459
|
+
type: "array",
|
|
4460
|
+
items: {
|
|
4461
|
+
type: "object",
|
|
4462
|
+
properties: {
|
|
4463
|
+
id: { anyOf: [{ type: "string" }, { type: "number" }] },
|
|
4464
|
+
name: nonEmptyString2,
|
|
4465
|
+
isDefault: { type: "boolean" }
|
|
4466
|
+
},
|
|
4467
|
+
required: ["id", "name"],
|
|
4468
|
+
additionalProperties: false
|
|
4469
|
+
}
|
|
4470
|
+
}
|
|
4471
|
+
},
|
|
4472
|
+
required: ["success", "contractVersion", "appId", "serviceName", "generatedAt", "widgets"],
|
|
4473
|
+
additionalProperties: false
|
|
4474
|
+
});
|
|
4475
|
+
function isTopoloWidgetOutputSchema(schema) {
|
|
4476
|
+
if (!isRecord6(schema) || !isRecord6(schema.properties)) return false;
|
|
4477
|
+
const properties = schema.properties;
|
|
4478
|
+
const widgetItemSchema = isRecord6(properties.widgets) && isRecord6(properties.widgets.items) ? properties.widgets.items : void 0;
|
|
4479
|
+
const widgetProperties = widgetItemSchema && isRecord6(widgetItemSchema.properties) ? widgetItemSchema.properties : void 0;
|
|
4480
|
+
const contributionSchema = widgetProperties && isRecord6(widgetProperties.contribution) ? widgetProperties.contribution : void 0;
|
|
4481
|
+
const contractVersion = isRecord6(properties.contractVersion) ? properties.contractVersion.const : void 0;
|
|
4482
|
+
return schema.type === "object" && contractVersion === "3.0.0" && isRecord6(properties.widgets) && properties.widgets.type === "array" && widgetItemSchema?.type === "object" && hasRequired(schema, "contractVersion") && hasRequired(schema, "widgets") && hasRequired(widgetItemSchema, "contribution") && hasRequired(contributionSchema, "datasets") && hasRequired(contributionSchema, "compatibleVisualizations") && hasRequired(contributionSchema, "defaultVisualization");
|
|
4483
|
+
}
|
|
4484
|
+
function isRecord6(value) {
|
|
4485
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4486
|
+
}
|
|
4487
|
+
function hasRequired(schema, field) {
|
|
4488
|
+
return isRecord6(schema) && Array.isArray(schema.required) && schema.required.includes(field);
|
|
4489
|
+
}
|
|
4490
|
+
|
|
4008
4491
|
// src/index.ts
|
|
4009
4492
|
function createTopolo(options) {
|
|
4010
4493
|
const client = new TopoloClient(options);
|
|
@@ -4026,6 +4509,7 @@ function createTopolo(options) {
|
|
|
4026
4509
|
TOPOLO_RUNTIME_ENVIRONMENTS,
|
|
4027
4510
|
TOPOLO_WIDGET_CONTRACT_VERSION,
|
|
4028
4511
|
TOPOLO_WIDGET_ENDPOINT,
|
|
4512
|
+
TOPOLO_WIDGET_OUTPUT_SCHEMA,
|
|
4029
4513
|
TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
|
|
4030
4514
|
TopoloAuthError,
|
|
4031
4515
|
TopoloClient,
|
|
@@ -4063,6 +4547,7 @@ function createTopolo(options) {
|
|
|
4063
4547
|
extractTopoloServiceErrorDetails,
|
|
4064
4548
|
formatDirectoryApplicationIds,
|
|
4065
4549
|
friendlyAppId,
|
|
4550
|
+
isTopoloWidgetOutputSchema,
|
|
4066
4551
|
listApplicationDirectory,
|
|
4067
4552
|
parseTopoloActionUploadContract,
|
|
4068
4553
|
preferExactActionMatches,
|
package/dist/index.d.cts
CHANGED
|
@@ -1574,6 +1574,10 @@ declare function defineTopoloActionsWidget(widget: Omit<TopoloActionsWidget, "ty
|
|
|
1574
1574
|
declare function createTopoloWidgetResponse({ appId, serviceName, widgets, now, }: TopoloWidgetResponseOptions): TopoloWidgetApiSuccessResponse;
|
|
1575
1575
|
declare function createTopoloWidgetError({ appId, serviceName, code, message, retryable, retryAfter, now, }: TopoloWidgetErrorResponseOptions): TopoloWidgetApiErrorResponse;
|
|
1576
1576
|
|
|
1577
|
+
type TopoloJsonSchema = Readonly<Record<string, unknown>>;
|
|
1578
|
+
declare const TOPOLO_WIDGET_OUTPUT_SCHEMA: TopoloJsonSchema;
|
|
1579
|
+
declare function isTopoloWidgetOutputSchema(schema: unknown): boolean;
|
|
1580
|
+
|
|
1577
1581
|
/**
|
|
1578
1582
|
* Convenience factory that returns a ready-to-use typed Topolo client plus
|
|
1579
1583
|
* domain module surfaces (identity, crm, ...).
|
|
@@ -1589,4 +1593,4 @@ declare function createTopolo(options: TopoloClientOptions): {
|
|
|
1589
1593
|
};
|
|
1590
1594
|
type Topolo = ReturnType<typeof createTopolo>;
|
|
1591
1595
|
|
|
1592
|
-
export { ACTION_CATALOG_DIGEST_ALGORITHM, type ActionContractManifest, type ActionContractSource, 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_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_CONTRACT_VERSION, 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 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 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, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionResult, compactActionValidation, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloActionsWidget, defineTopoloActivityWidget, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, encodeTopoloActionBase64, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, preferExactActionMatches, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, publicTopoloErrorMessage, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
|
|
1596
|
+
export { ACTION_CATALOG_DIGEST_ALGORITHM, type ActionContractManifest, type ActionContractSource, 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_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, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionResult, compactActionValidation, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloActionsWidget, defineTopoloActivityWidget, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, encodeTopoloActionBase64, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, isTopoloWidgetOutputSchema, listApplicationDirectory, parseTopoloActionUploadContract, preferExactActionMatches, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, publicTopoloErrorMessage, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -1574,6 +1574,10 @@ declare function defineTopoloActionsWidget(widget: Omit<TopoloActionsWidget, "ty
|
|
|
1574
1574
|
declare function createTopoloWidgetResponse({ appId, serviceName, widgets, now, }: TopoloWidgetResponseOptions): TopoloWidgetApiSuccessResponse;
|
|
1575
1575
|
declare function createTopoloWidgetError({ appId, serviceName, code, message, retryable, retryAfter, now, }: TopoloWidgetErrorResponseOptions): TopoloWidgetApiErrorResponse;
|
|
1576
1576
|
|
|
1577
|
+
type TopoloJsonSchema = Readonly<Record<string, unknown>>;
|
|
1578
|
+
declare const TOPOLO_WIDGET_OUTPUT_SCHEMA: TopoloJsonSchema;
|
|
1579
|
+
declare function isTopoloWidgetOutputSchema(schema: unknown): boolean;
|
|
1580
|
+
|
|
1577
1581
|
/**
|
|
1578
1582
|
* Convenience factory that returns a ready-to-use typed Topolo client plus
|
|
1579
1583
|
* domain module surfaces (identity, crm, ...).
|
|
@@ -1589,4 +1593,4 @@ declare function createTopolo(options: TopoloClientOptions): {
|
|
|
1589
1593
|
};
|
|
1590
1594
|
type Topolo = ReturnType<typeof createTopolo>;
|
|
1591
1595
|
|
|
1592
|
-
export { ACTION_CATALOG_DIGEST_ALGORITHM, type ActionContractManifest, type ActionContractSource, 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_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_CONTRACT_VERSION, 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 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 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, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionResult, compactActionValidation, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloActionsWidget, defineTopoloActivityWidget, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, encodeTopoloActionBase64, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, preferExactActionMatches, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, publicTopoloErrorMessage, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
|
|
1596
|
+
export { ACTION_CATALOG_DIGEST_ALGORITHM, type ActionContractManifest, type ActionContractSource, 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_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, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionResult, compactActionValidation, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloActionsWidget, defineTopoloActivityWidget, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, encodeTopoloActionBase64, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, isTopoloWidgetOutputSchema, listApplicationDirectory, parseTopoloActionUploadContract, preferExactActionMatches, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, publicTopoloErrorMessage, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
|
package/dist/index.js
CHANGED
|
@@ -1964,12 +1964,21 @@ function redactActionResult(value) {
|
|
|
1964
1964
|
if (!isRecord3(value)) return value;
|
|
1965
1965
|
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
1966
1966
|
key,
|
|
1967
|
-
isSensitiveActionResultKey(key) ? "[REDACTED]" : redactActionResult(item)
|
|
1967
|
+
isSensitiveActionResultKey(key, item) ? "[REDACTED]" : redactActionResult(item)
|
|
1968
1968
|
]));
|
|
1969
1969
|
}
|
|
1970
|
-
function isSensitiveActionResultKey(key) {
|
|
1970
|
+
function isSensitiveActionResultKey(key, value) {
|
|
1971
1971
|
const normalized = key.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
1972
|
-
|
|
1972
|
+
if (normalized === "capability") return isCredentialShaped(value);
|
|
1973
|
+
return ["authorization", "cookie", "setcookie", "proxyauthorization"].includes(normalized) || /(token|secret|password|privatekey|apikey)$/.test(normalized);
|
|
1974
|
+
}
|
|
1975
|
+
var PLAIN_ENUM_VALUE = /^[a-z][a-z0-9_-]{0,31}$/;
|
|
1976
|
+
function isCredentialShaped(value) {
|
|
1977
|
+
if (typeof value !== "string") return value !== null && value !== void 0 && typeof value !== "boolean" && typeof value !== "number";
|
|
1978
|
+
const trimmed = value.trim();
|
|
1979
|
+
if (!trimmed) return false;
|
|
1980
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed)) return true;
|
|
1981
|
+
return !PLAIN_ENUM_VALUE.test(trimmed);
|
|
1973
1982
|
}
|
|
1974
1983
|
function resolveConfiguredServiceUrl(slug, serviceUrls) {
|
|
1975
1984
|
for (const serviceKey of serviceKeyCandidates2(slug)) {
|
|
@@ -3652,22 +3661,22 @@ function validateRuntimeSemantics(widget, contributionPath, declared, errors) {
|
|
|
3652
3661
|
validateSeriesDimensions(metric.series, declared.dimensionKeys, contributionPath, errors);
|
|
3653
3662
|
}
|
|
3654
3663
|
}
|
|
3655
|
-
const
|
|
3656
|
-
for (const item of
|
|
3664
|
+
const series2 = Array.isArray(widget.series) ? widget.series : [];
|
|
3665
|
+
for (const item of series2) {
|
|
3657
3666
|
if (!isRecord5(item)) continue;
|
|
3658
3667
|
if (typeof item.id === "string" && !declared.seriesKeys.has(item.id)) errors.push(`${contributionPath}.seriesDefinitions is missing runtime series ${item.id}`);
|
|
3659
3668
|
validateSeriesDimensions(item, declared.dimensionKeys, contributionPath, errors);
|
|
3660
3669
|
}
|
|
3661
3670
|
}
|
|
3662
|
-
function validateSeriesDimensions(
|
|
3663
|
-
if (!Array.isArray(
|
|
3664
|
-
for (const point of
|
|
3671
|
+
function validateSeriesDimensions(series2, known, path, errors) {
|
|
3672
|
+
if (!Array.isArray(series2.points)) return;
|
|
3673
|
+
for (const point of series2.points) if (isRecord5(point)) validateRuntimeDimensions(point.dimensions, known, path, errors);
|
|
3665
3674
|
}
|
|
3666
3675
|
function validateRuntimeDimensions(value, known, path, errors) {
|
|
3667
3676
|
if (!Array.isArray(value)) return;
|
|
3668
|
-
for (const
|
|
3669
|
-
if (isRecord5(
|
|
3670
|
-
errors.push(`${path}.dimensions is missing runtime dimension ${
|
|
3677
|
+
for (const dimension2 of value) {
|
|
3678
|
+
if (isRecord5(dimension2) && typeof dimension2.key === "string" && !known.has(dimension2.key)) {
|
|
3679
|
+
errors.push(`${path}.dimensions is missing runtime dimension ${dimension2.key}`);
|
|
3671
3680
|
}
|
|
3672
3681
|
}
|
|
3673
3682
|
}
|
|
@@ -3704,12 +3713,12 @@ function validatePeriod(value, path, errors) {
|
|
|
3704
3713
|
}
|
|
3705
3714
|
function validateDimensions(value, path, errors) {
|
|
3706
3715
|
if (!arrayValue(value, path, errors)) return;
|
|
3707
|
-
value.forEach((
|
|
3716
|
+
value.forEach((dimension2, index) => {
|
|
3708
3717
|
const itemPath = `${path}[${index}]`;
|
|
3709
|
-
if (!recordValue(
|
|
3710
|
-
nonEmptyString(
|
|
3711
|
-
nonEmptyString(
|
|
3712
|
-
nonEmptyString(
|
|
3718
|
+
if (!recordValue(dimension2, itemPath, errors)) return;
|
|
3719
|
+
nonEmptyString(dimension2.key, `${itemPath}.key`, errors);
|
|
3720
|
+
nonEmptyString(dimension2.label, `${itemPath}.label`, errors);
|
|
3721
|
+
nonEmptyString(dimension2.value, `${itemPath}.value`, errors);
|
|
3713
3722
|
});
|
|
3714
3723
|
}
|
|
3715
3724
|
function validateComparison(value, path, errors) {
|
|
@@ -3723,7 +3732,7 @@ function validateComparison(value, path, errors) {
|
|
|
3723
3732
|
}
|
|
3724
3733
|
function validateSeriesCollection(value, path, errors, requireOne) {
|
|
3725
3734
|
if (!arrayValue(value, path, errors, requireOne)) return;
|
|
3726
|
-
value.forEach((
|
|
3735
|
+
value.forEach((series2, index) => validateSeries(series2, `${path}[${index}]`, errors));
|
|
3727
3736
|
}
|
|
3728
3737
|
function validateSeries(value, path, errors) {
|
|
3729
3738
|
if (!recordValue(value, path, errors)) return;
|
|
@@ -3921,6 +3930,478 @@ function toIsoTimestamp(input) {
|
|
|
3921
3930
|
return input ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
3922
3931
|
}
|
|
3923
3932
|
|
|
3933
|
+
// src/widget-output-schema.ts
|
|
3934
|
+
var nonEmptyString2 = { type: "string", minLength: 1 };
|
|
3935
|
+
var stringArray3 = { type: "array", items: nonEmptyString2 };
|
|
3936
|
+
var actionBinding = {
|
|
3937
|
+
type: "object",
|
|
3938
|
+
properties: {
|
|
3939
|
+
id: nonEmptyString2,
|
|
3940
|
+
label: nonEmptyString2,
|
|
3941
|
+
actionId: nonEmptyString2,
|
|
3942
|
+
resourceType: nonEmptyString2,
|
|
3943
|
+
resourceId: nonEmptyString2,
|
|
3944
|
+
input: { type: "object" },
|
|
3945
|
+
requiresConfirmation: { type: "boolean" },
|
|
3946
|
+
destructive: { type: "boolean" },
|
|
3947
|
+
effects: stringArray3,
|
|
3948
|
+
verification: stringArray3,
|
|
3949
|
+
recovery: {
|
|
3950
|
+
type: "object",
|
|
3951
|
+
properties: {
|
|
3952
|
+
mode: { enum: ["not_applicable", "retry", "compensating_action"] },
|
|
3953
|
+
actionId: nonEmptyString2,
|
|
3954
|
+
instructions: nonEmptyString2
|
|
3955
|
+
},
|
|
3956
|
+
required: ["mode", "instructions"],
|
|
3957
|
+
additionalProperties: false
|
|
3958
|
+
}
|
|
3959
|
+
},
|
|
3960
|
+
required: [
|
|
3961
|
+
"id",
|
|
3962
|
+
"label",
|
|
3963
|
+
"actionId",
|
|
3964
|
+
"resourceType",
|
|
3965
|
+
"input",
|
|
3966
|
+
"requiresConfirmation",
|
|
3967
|
+
"destructive",
|
|
3968
|
+
"effects",
|
|
3969
|
+
"verification",
|
|
3970
|
+
"recovery"
|
|
3971
|
+
],
|
|
3972
|
+
additionalProperties: false
|
|
3973
|
+
};
|
|
3974
|
+
var dimension = {
|
|
3975
|
+
type: "object",
|
|
3976
|
+
properties: { key: nonEmptyString2, label: nonEmptyString2, value: nonEmptyString2 },
|
|
3977
|
+
required: ["key", "label", "value"],
|
|
3978
|
+
additionalProperties: false
|
|
3979
|
+
};
|
|
3980
|
+
var period = {
|
|
3981
|
+
type: "object",
|
|
3982
|
+
properties: {
|
|
3983
|
+
start: nonEmptyString2,
|
|
3984
|
+
end: nonEmptyString2,
|
|
3985
|
+
timezone: nonEmptyString2
|
|
3986
|
+
},
|
|
3987
|
+
required: ["start", "end", "timezone"],
|
|
3988
|
+
additionalProperties: false
|
|
3989
|
+
};
|
|
3990
|
+
var series = {
|
|
3991
|
+
type: "object",
|
|
3992
|
+
properties: {
|
|
3993
|
+
id: nonEmptyString2,
|
|
3994
|
+
label: nonEmptyString2,
|
|
3995
|
+
unit: nonEmptyString2,
|
|
3996
|
+
points: {
|
|
3997
|
+
type: "array",
|
|
3998
|
+
items: {
|
|
3999
|
+
type: "object",
|
|
4000
|
+
properties: {
|
|
4001
|
+
timestamp: nonEmptyString2,
|
|
4002
|
+
value: { type: "number" },
|
|
4003
|
+
dimensions: { type: "array", items: dimension }
|
|
4004
|
+
},
|
|
4005
|
+
required: ["timestamp", "value", "dimensions"],
|
|
4006
|
+
additionalProperties: false
|
|
4007
|
+
}
|
|
4008
|
+
}
|
|
4009
|
+
},
|
|
4010
|
+
required: ["id", "label", "unit", "points"],
|
|
4011
|
+
additionalProperties: false
|
|
4012
|
+
};
|
|
4013
|
+
var contribution = {
|
|
4014
|
+
type: "object",
|
|
4015
|
+
properties: {
|
|
4016
|
+
summary: nonEmptyString2,
|
|
4017
|
+
identity: {
|
|
4018
|
+
type: "object",
|
|
4019
|
+
properties: { iconSource: { const: "catalog" } },
|
|
4020
|
+
required: ["iconSource"],
|
|
4021
|
+
additionalProperties: false
|
|
4022
|
+
},
|
|
4023
|
+
workspaceSelector: {
|
|
4024
|
+
type: "object",
|
|
4025
|
+
properties: {
|
|
4026
|
+
mode: { enum: ["none", "optional", "required"] },
|
|
4027
|
+
resourceType: nonEmptyString2,
|
|
4028
|
+
label: nonEmptyString2,
|
|
4029
|
+
supportsMultiple: { type: "boolean" }
|
|
4030
|
+
},
|
|
4031
|
+
required: ["mode", "resourceType", "label", "supportsMultiple"],
|
|
4032
|
+
additionalProperties: false
|
|
4033
|
+
},
|
|
4034
|
+
metricDefinitions: {
|
|
4035
|
+
type: "array",
|
|
4036
|
+
items: {
|
|
4037
|
+
type: "object",
|
|
4038
|
+
properties: {
|
|
4039
|
+
key: nonEmptyString2,
|
|
4040
|
+
label: nonEmptyString2,
|
|
4041
|
+
description: nonEmptyString2,
|
|
4042
|
+
unit: nonEmptyString2,
|
|
4043
|
+
semantic: {
|
|
4044
|
+
enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
|
|
4045
|
+
},
|
|
4046
|
+
aggregation: {
|
|
4047
|
+
enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
|
|
4048
|
+
}
|
|
4049
|
+
},
|
|
4050
|
+
required: ["key", "label", "description", "unit", "semantic", "aggregation"],
|
|
4051
|
+
additionalProperties: false
|
|
4052
|
+
}
|
|
4053
|
+
},
|
|
4054
|
+
seriesDefinitions: {
|
|
4055
|
+
type: "array",
|
|
4056
|
+
items: {
|
|
4057
|
+
type: "object",
|
|
4058
|
+
properties: {
|
|
4059
|
+
key: nonEmptyString2,
|
|
4060
|
+
label: nonEmptyString2,
|
|
4061
|
+
metricKey: nonEmptyString2,
|
|
4062
|
+
unit: nonEmptyString2
|
|
4063
|
+
},
|
|
4064
|
+
required: ["key", "label", "metricKey", "unit"],
|
|
4065
|
+
additionalProperties: false
|
|
4066
|
+
}
|
|
4067
|
+
},
|
|
4068
|
+
dimensions: {
|
|
4069
|
+
type: "array",
|
|
4070
|
+
items: {
|
|
4071
|
+
type: "object",
|
|
4072
|
+
properties: {
|
|
4073
|
+
key: nonEmptyString2,
|
|
4074
|
+
label: nonEmptyString2,
|
|
4075
|
+
description: nonEmptyString2,
|
|
4076
|
+
valueType: { enum: ["string", "number", "boolean", "date", "datetime"] }
|
|
4077
|
+
},
|
|
4078
|
+
required: ["key", "label", "description", "valueType"],
|
|
4079
|
+
additionalProperties: false
|
|
4080
|
+
}
|
|
4081
|
+
},
|
|
4082
|
+
lifecycleStages: {
|
|
4083
|
+
type: "array",
|
|
4084
|
+
items: {
|
|
4085
|
+
type: "object",
|
|
4086
|
+
properties: {
|
|
4087
|
+
key: nonEmptyString2,
|
|
4088
|
+
label: nonEmptyString2,
|
|
4089
|
+
order: { type: "number" },
|
|
4090
|
+
terminal: { type: "boolean" }
|
|
4091
|
+
},
|
|
4092
|
+
required: ["key", "label", "order", "terminal"],
|
|
4093
|
+
additionalProperties: false
|
|
4094
|
+
}
|
|
4095
|
+
},
|
|
4096
|
+
events: {
|
|
4097
|
+
type: "array",
|
|
4098
|
+
items: {
|
|
4099
|
+
type: "object",
|
|
4100
|
+
properties: {
|
|
4101
|
+
key: nonEmptyString2,
|
|
4102
|
+
label: nonEmptyString2,
|
|
4103
|
+
description: nonEmptyString2
|
|
4104
|
+
},
|
|
4105
|
+
required: ["key", "label", "description"],
|
|
4106
|
+
additionalProperties: false
|
|
4107
|
+
}
|
|
4108
|
+
},
|
|
4109
|
+
datasets: {
|
|
4110
|
+
type: "array",
|
|
4111
|
+
minItems: 1,
|
|
4112
|
+
items: {
|
|
4113
|
+
type: "object",
|
|
4114
|
+
properties: {
|
|
4115
|
+
id: nonEmptyString2,
|
|
4116
|
+
label: nonEmptyString2,
|
|
4117
|
+
description: nonEmptyString2,
|
|
4118
|
+
grain: nonEmptyString2,
|
|
4119
|
+
metricKeys: stringArray3,
|
|
4120
|
+
seriesKeys: stringArray3,
|
|
4121
|
+
dimensionKeys: stringArray3,
|
|
4122
|
+
eventKeys: stringArray3,
|
|
4123
|
+
actionIds: stringArray3
|
|
4124
|
+
},
|
|
4125
|
+
required: [
|
|
4126
|
+
"id",
|
|
4127
|
+
"label",
|
|
4128
|
+
"description",
|
|
4129
|
+
"grain",
|
|
4130
|
+
"metricKeys",
|
|
4131
|
+
"seriesKeys",
|
|
4132
|
+
"dimensionKeys",
|
|
4133
|
+
"eventKeys",
|
|
4134
|
+
"actionIds"
|
|
4135
|
+
],
|
|
4136
|
+
additionalProperties: false
|
|
4137
|
+
}
|
|
4138
|
+
},
|
|
4139
|
+
compatibleVisualizations: {
|
|
4140
|
+
type: "array",
|
|
4141
|
+
minItems: 1,
|
|
4142
|
+
items: {
|
|
4143
|
+
enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
|
|
4144
|
+
}
|
|
4145
|
+
},
|
|
4146
|
+
defaultVisualization: {
|
|
4147
|
+
enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
|
|
4148
|
+
}
|
|
4149
|
+
},
|
|
4150
|
+
required: [
|
|
4151
|
+
"summary",
|
|
4152
|
+
"identity",
|
|
4153
|
+
"workspaceSelector",
|
|
4154
|
+
"metricDefinitions",
|
|
4155
|
+
"seriesDefinitions",
|
|
4156
|
+
"dimensions",
|
|
4157
|
+
"lifecycleStages",
|
|
4158
|
+
"events",
|
|
4159
|
+
"datasets",
|
|
4160
|
+
"compatibleVisualizations",
|
|
4161
|
+
"defaultVisualization"
|
|
4162
|
+
],
|
|
4163
|
+
additionalProperties: false
|
|
4164
|
+
};
|
|
4165
|
+
var widgetItem = {
|
|
4166
|
+
type: "object",
|
|
4167
|
+
properties: {
|
|
4168
|
+
id: nonEmptyString2,
|
|
4169
|
+
version: nonEmptyString2,
|
|
4170
|
+
appId: nonEmptyString2,
|
|
4171
|
+
serviceName: nonEmptyString2,
|
|
4172
|
+
lastUpdated: nonEmptyString2,
|
|
4173
|
+
type: { enum: ["stats", "chart", "activity", "notifications", "actions"] },
|
|
4174
|
+
presentation: {
|
|
4175
|
+
type: "object",
|
|
4176
|
+
properties: {
|
|
4177
|
+
title: nonEmptyString2,
|
|
4178
|
+
description: nonEmptyString2,
|
|
4179
|
+
contexts: {
|
|
4180
|
+
type: "array",
|
|
4181
|
+
minItems: 1,
|
|
4182
|
+
items: { enum: ["personal", "organization", "workspace", "resource"] }
|
|
4183
|
+
},
|
|
4184
|
+
supportedSizes: {
|
|
4185
|
+
type: "array",
|
|
4186
|
+
minItems: 1,
|
|
4187
|
+
items: { enum: ["compact", "medium", "wide", "full"] }
|
|
4188
|
+
},
|
|
4189
|
+
defaultSize: { enum: ["compact", "medium", "wide", "full"] }
|
|
4190
|
+
},
|
|
4191
|
+
required: ["title", "contexts", "supportedSizes", "defaultSize"],
|
|
4192
|
+
additionalProperties: false
|
|
4193
|
+
},
|
|
4194
|
+
resource: {
|
|
4195
|
+
type: "object",
|
|
4196
|
+
properties: {
|
|
4197
|
+
resourceType: nonEmptyString2,
|
|
4198
|
+
resourceId: nonEmptyString2,
|
|
4199
|
+
requiredPermissions: stringArray3
|
|
4200
|
+
},
|
|
4201
|
+
required: ["resourceType", "requiredPermissions"],
|
|
4202
|
+
additionalProperties: false
|
|
4203
|
+
},
|
|
4204
|
+
state: {
|
|
4205
|
+
type: "object",
|
|
4206
|
+
properties: {
|
|
4207
|
+
status: { enum: ["ready", "empty", "unavailable", "stale", "error"] },
|
|
4208
|
+
observedAt: nonEmptyString2,
|
|
4209
|
+
lastSuccessfulAt: nonEmptyString2,
|
|
4210
|
+
code: nonEmptyString2,
|
|
4211
|
+
message: nonEmptyString2
|
|
4212
|
+
},
|
|
4213
|
+
required: ["status", "observedAt"],
|
|
4214
|
+
additionalProperties: false
|
|
4215
|
+
},
|
|
4216
|
+
refresh: {
|
|
4217
|
+
type: "object",
|
|
4218
|
+
properties: {
|
|
4219
|
+
intervalSeconds: { type: "number" },
|
|
4220
|
+
timeoutSeconds: { type: "number" },
|
|
4221
|
+
maxAgeSeconds: { type: "number" },
|
|
4222
|
+
staleWhileRevalidateSeconds: { type: "number" }
|
|
4223
|
+
},
|
|
4224
|
+
required: ["intervalSeconds", "timeoutSeconds", "maxAgeSeconds", "staleWhileRevalidateSeconds"],
|
|
4225
|
+
additionalProperties: false
|
|
4226
|
+
},
|
|
4227
|
+
configuration: {
|
|
4228
|
+
type: "object",
|
|
4229
|
+
properties: {
|
|
4230
|
+
allowMultipleInstances: { type: "boolean" },
|
|
4231
|
+
fields: {
|
|
4232
|
+
type: "array",
|
|
4233
|
+
items: {
|
|
4234
|
+
type: "object",
|
|
4235
|
+
properties: {
|
|
4236
|
+
key: nonEmptyString2,
|
|
4237
|
+
label: nonEmptyString2,
|
|
4238
|
+
type: { enum: ["string", "number", "boolean", "select", "multi-select", "date-range"] },
|
|
4239
|
+
required: { type: "boolean" },
|
|
4240
|
+
options: {
|
|
4241
|
+
type: "array",
|
|
4242
|
+
items: {
|
|
4243
|
+
type: "object",
|
|
4244
|
+
properties: { value: nonEmptyString2, label: nonEmptyString2 },
|
|
4245
|
+
required: ["value", "label"],
|
|
4246
|
+
additionalProperties: false
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
},
|
|
4250
|
+
required: ["key", "label", "type", "required"],
|
|
4251
|
+
additionalProperties: false
|
|
4252
|
+
}
|
|
4253
|
+
},
|
|
4254
|
+
defaults: { type: "object" }
|
|
4255
|
+
},
|
|
4256
|
+
required: ["allowMultipleInstances", "fields", "defaults"],
|
|
4257
|
+
additionalProperties: false
|
|
4258
|
+
},
|
|
4259
|
+
drilldowns: {
|
|
4260
|
+
type: "array",
|
|
4261
|
+
items: {
|
|
4262
|
+
type: "object",
|
|
4263
|
+
properties: { id: nonEmptyString2, label: nonEmptyString2, href: nonEmptyString2 },
|
|
4264
|
+
required: ["id", "label", "href"],
|
|
4265
|
+
additionalProperties: false
|
|
4266
|
+
}
|
|
4267
|
+
},
|
|
4268
|
+
controls: { type: "array", items: actionBinding },
|
|
4269
|
+
localization: {
|
|
4270
|
+
type: "object",
|
|
4271
|
+
properties: {
|
|
4272
|
+
locale: nonEmptyString2,
|
|
4273
|
+
titleKey: nonEmptyString2,
|
|
4274
|
+
descriptionKey: nonEmptyString2,
|
|
4275
|
+
title: nonEmptyString2,
|
|
4276
|
+
description: nonEmptyString2
|
|
4277
|
+
},
|
|
4278
|
+
required: ["locale", "titleKey"],
|
|
4279
|
+
additionalProperties: false
|
|
4280
|
+
},
|
|
4281
|
+
accessibility: {
|
|
4282
|
+
type: "object",
|
|
4283
|
+
properties: { label: nonEmptyString2, description: nonEmptyString2 },
|
|
4284
|
+
required: ["label"],
|
|
4285
|
+
additionalProperties: false
|
|
4286
|
+
},
|
|
4287
|
+
contribution,
|
|
4288
|
+
metrics: {
|
|
4289
|
+
type: "array",
|
|
4290
|
+
items: {
|
|
4291
|
+
type: "object",
|
|
4292
|
+
properties: {
|
|
4293
|
+
key: nonEmptyString2,
|
|
4294
|
+
label: nonEmptyString2,
|
|
4295
|
+
value: { type: "number" },
|
|
4296
|
+
unit: nonEmptyString2,
|
|
4297
|
+
semantic: {
|
|
4298
|
+
enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
|
|
4299
|
+
},
|
|
4300
|
+
aggregation: {
|
|
4301
|
+
enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
|
|
4302
|
+
},
|
|
4303
|
+
period,
|
|
4304
|
+
dimensions: { type: "array", items: dimension },
|
|
4305
|
+
series
|
|
4306
|
+
},
|
|
4307
|
+
required: ["key", "label", "value", "unit", "semantic", "aggregation", "period", "dimensions"],
|
|
4308
|
+
additionalProperties: false
|
|
4309
|
+
}
|
|
4310
|
+
},
|
|
4311
|
+
chartType: { enum: ["line", "bar", "area", "pie", "donut"] },
|
|
4312
|
+
series: { type: "array", items: series },
|
|
4313
|
+
activities: { type: "array", items: { type: "object" } },
|
|
4314
|
+
notifications: { type: "array", items: { type: "object" } },
|
|
4315
|
+
unreadCount: { type: "number" },
|
|
4316
|
+
actions: { type: "array", items: actionBinding }
|
|
4317
|
+
},
|
|
4318
|
+
required: [
|
|
4319
|
+
"id",
|
|
4320
|
+
"version",
|
|
4321
|
+
"appId",
|
|
4322
|
+
"serviceName",
|
|
4323
|
+
"lastUpdated",
|
|
4324
|
+
"type",
|
|
4325
|
+
"presentation",
|
|
4326
|
+
"resource",
|
|
4327
|
+
"state",
|
|
4328
|
+
"refresh",
|
|
4329
|
+
"configuration",
|
|
4330
|
+
"drilldowns",
|
|
4331
|
+
"controls",
|
|
4332
|
+
"localization",
|
|
4333
|
+
"accessibility",
|
|
4334
|
+
"contribution"
|
|
4335
|
+
],
|
|
4336
|
+
allOf: [
|
|
4337
|
+
{ if: { properties: { type: { const: "stats" } } }, then: { required: ["metrics"] } },
|
|
4338
|
+
{ if: { properties: { type: { const: "chart" } } }, then: { required: ["chartType", "series"] } },
|
|
4339
|
+
{ if: { properties: { type: { const: "activity" } } }, then: { required: ["activities"] } },
|
|
4340
|
+
{
|
|
4341
|
+
if: { properties: { type: { const: "notifications" } } },
|
|
4342
|
+
then: { required: ["notifications", "unreadCount"] }
|
|
4343
|
+
},
|
|
4344
|
+
{ if: { properties: { type: { const: "actions" } } }, then: { required: ["actions"] } }
|
|
4345
|
+
],
|
|
4346
|
+
additionalProperties: false
|
|
4347
|
+
};
|
|
4348
|
+
var TOPOLO_WIDGET_OUTPUT_SCHEMA = Object.freeze({
|
|
4349
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
4350
|
+
type: "object",
|
|
4351
|
+
properties: {
|
|
4352
|
+
success: { type: "boolean", const: true },
|
|
4353
|
+
contractVersion: { type: "string", const: "3.0.0" },
|
|
4354
|
+
appId: nonEmptyString2,
|
|
4355
|
+
serviceName: nonEmptyString2,
|
|
4356
|
+
generatedAt: nonEmptyString2,
|
|
4357
|
+
widgets: { type: "array", minItems: 1, items: widgetItem },
|
|
4358
|
+
workspace: {
|
|
4359
|
+
anyOf: [
|
|
4360
|
+
{
|
|
4361
|
+
type: "object",
|
|
4362
|
+
properties: {
|
|
4363
|
+
id: { anyOf: [{ type: "string" }, { type: "number" }] },
|
|
4364
|
+
name: nonEmptyString2
|
|
4365
|
+
},
|
|
4366
|
+
required: ["id", "name"],
|
|
4367
|
+
additionalProperties: true
|
|
4368
|
+
},
|
|
4369
|
+
{ type: "null" }
|
|
4370
|
+
]
|
|
4371
|
+
},
|
|
4372
|
+
workspaces: {
|
|
4373
|
+
type: "array",
|
|
4374
|
+
items: {
|
|
4375
|
+
type: "object",
|
|
4376
|
+
properties: {
|
|
4377
|
+
id: { anyOf: [{ type: "string" }, { type: "number" }] },
|
|
4378
|
+
name: nonEmptyString2,
|
|
4379
|
+
isDefault: { type: "boolean" }
|
|
4380
|
+
},
|
|
4381
|
+
required: ["id", "name"],
|
|
4382
|
+
additionalProperties: false
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4385
|
+
},
|
|
4386
|
+
required: ["success", "contractVersion", "appId", "serviceName", "generatedAt", "widgets"],
|
|
4387
|
+
additionalProperties: false
|
|
4388
|
+
});
|
|
4389
|
+
function isTopoloWidgetOutputSchema(schema) {
|
|
4390
|
+
if (!isRecord6(schema) || !isRecord6(schema.properties)) return false;
|
|
4391
|
+
const properties = schema.properties;
|
|
4392
|
+
const widgetItemSchema = isRecord6(properties.widgets) && isRecord6(properties.widgets.items) ? properties.widgets.items : void 0;
|
|
4393
|
+
const widgetProperties = widgetItemSchema && isRecord6(widgetItemSchema.properties) ? widgetItemSchema.properties : void 0;
|
|
4394
|
+
const contributionSchema = widgetProperties && isRecord6(widgetProperties.contribution) ? widgetProperties.contribution : void 0;
|
|
4395
|
+
const contractVersion = isRecord6(properties.contractVersion) ? properties.contractVersion.const : void 0;
|
|
4396
|
+
return schema.type === "object" && contractVersion === "3.0.0" && isRecord6(properties.widgets) && properties.widgets.type === "array" && widgetItemSchema?.type === "object" && hasRequired(schema, "contractVersion") && hasRequired(schema, "widgets") && hasRequired(widgetItemSchema, "contribution") && hasRequired(contributionSchema, "datasets") && hasRequired(contributionSchema, "compatibleVisualizations") && hasRequired(contributionSchema, "defaultVisualization");
|
|
4397
|
+
}
|
|
4398
|
+
function isRecord6(value) {
|
|
4399
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4400
|
+
}
|
|
4401
|
+
function hasRequired(schema, field) {
|
|
4402
|
+
return isRecord6(schema) && Array.isArray(schema.required) && schema.required.includes(field);
|
|
4403
|
+
}
|
|
4404
|
+
|
|
3924
4405
|
// src/index.ts
|
|
3925
4406
|
function createTopolo(options) {
|
|
3926
4407
|
const client = new TopoloClient(options);
|
|
@@ -3941,6 +4422,7 @@ export {
|
|
|
3941
4422
|
TOPOLO_RUNTIME_ENVIRONMENTS,
|
|
3942
4423
|
TOPOLO_WIDGET_CONTRACT_VERSION,
|
|
3943
4424
|
TOPOLO_WIDGET_ENDPOINT,
|
|
4425
|
+
TOPOLO_WIDGET_OUTPUT_SCHEMA,
|
|
3944
4426
|
TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
|
|
3945
4427
|
TopoloAuthError,
|
|
3946
4428
|
TopoloClient,
|
|
@@ -3978,6 +4460,7 @@ export {
|
|
|
3978
4460
|
extractTopoloServiceErrorDetails,
|
|
3979
4461
|
formatDirectoryApplicationIds,
|
|
3980
4462
|
friendlyAppId,
|
|
4463
|
+
isTopoloWidgetOutputSchema,
|
|
3981
4464
|
listApplicationDirectory,
|
|
3982
4465
|
parseTopoloActionUploadContract,
|
|
3983
4466
|
preferExactActionMatches,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/sdk",
|
|
3
|
-
"version": "0.14.
|
|
4
|
-
"topoloPublishedVersion": "0.14.
|
|
3
|
+
"version": "0.14.4",
|
|
4
|
+
"topoloPublishedVersion": "0.14.4",
|
|
5
5
|
"description": "Typed client SDK for the Topolo platform. Used by TopoloCli, TopoloMCP, and third-party agents.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"author": "Topolo",
|