@topolo/sdk 0.14.2 → 0.14.3
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 +490 -14
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +488 -14
- 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,
|
|
@@ -3736,22 +3738,22 @@ function validateRuntimeSemantics(widget, contributionPath, declared, errors) {
|
|
|
3736
3738
|
validateSeriesDimensions(metric.series, declared.dimensionKeys, contributionPath, errors);
|
|
3737
3739
|
}
|
|
3738
3740
|
}
|
|
3739
|
-
const
|
|
3740
|
-
for (const item of
|
|
3741
|
+
const series2 = Array.isArray(widget.series) ? widget.series : [];
|
|
3742
|
+
for (const item of series2) {
|
|
3741
3743
|
if (!isRecord5(item)) continue;
|
|
3742
3744
|
if (typeof item.id === "string" && !declared.seriesKeys.has(item.id)) errors.push(`${contributionPath}.seriesDefinitions is missing runtime series ${item.id}`);
|
|
3743
3745
|
validateSeriesDimensions(item, declared.dimensionKeys, contributionPath, errors);
|
|
3744
3746
|
}
|
|
3745
3747
|
}
|
|
3746
|
-
function validateSeriesDimensions(
|
|
3747
|
-
if (!Array.isArray(
|
|
3748
|
-
for (const point of
|
|
3748
|
+
function validateSeriesDimensions(series2, known, path, errors) {
|
|
3749
|
+
if (!Array.isArray(series2.points)) return;
|
|
3750
|
+
for (const point of series2.points) if (isRecord5(point)) validateRuntimeDimensions(point.dimensions, known, path, errors);
|
|
3749
3751
|
}
|
|
3750
3752
|
function validateRuntimeDimensions(value, known, path, errors) {
|
|
3751
3753
|
if (!Array.isArray(value)) return;
|
|
3752
|
-
for (const
|
|
3753
|
-
if (isRecord5(
|
|
3754
|
-
errors.push(`${path}.dimensions is missing runtime dimension ${
|
|
3754
|
+
for (const dimension2 of value) {
|
|
3755
|
+
if (isRecord5(dimension2) && typeof dimension2.key === "string" && !known.has(dimension2.key)) {
|
|
3756
|
+
errors.push(`${path}.dimensions is missing runtime dimension ${dimension2.key}`);
|
|
3755
3757
|
}
|
|
3756
3758
|
}
|
|
3757
3759
|
}
|
|
@@ -3788,12 +3790,12 @@ function validatePeriod(value, path, errors) {
|
|
|
3788
3790
|
}
|
|
3789
3791
|
function validateDimensions(value, path, errors) {
|
|
3790
3792
|
if (!arrayValue(value, path, errors)) return;
|
|
3791
|
-
value.forEach((
|
|
3793
|
+
value.forEach((dimension2, index) => {
|
|
3792
3794
|
const itemPath = `${path}[${index}]`;
|
|
3793
|
-
if (!recordValue(
|
|
3794
|
-
nonEmptyString(
|
|
3795
|
-
nonEmptyString(
|
|
3796
|
-
nonEmptyString(
|
|
3795
|
+
if (!recordValue(dimension2, itemPath, errors)) return;
|
|
3796
|
+
nonEmptyString(dimension2.key, `${itemPath}.key`, errors);
|
|
3797
|
+
nonEmptyString(dimension2.label, `${itemPath}.label`, errors);
|
|
3798
|
+
nonEmptyString(dimension2.value, `${itemPath}.value`, errors);
|
|
3797
3799
|
});
|
|
3798
3800
|
}
|
|
3799
3801
|
function validateComparison(value, path, errors) {
|
|
@@ -3807,7 +3809,7 @@ function validateComparison(value, path, errors) {
|
|
|
3807
3809
|
}
|
|
3808
3810
|
function validateSeriesCollection(value, path, errors, requireOne) {
|
|
3809
3811
|
if (!arrayValue(value, path, errors, requireOne)) return;
|
|
3810
|
-
value.forEach((
|
|
3812
|
+
value.forEach((series2, index) => validateSeries(series2, `${path}[${index}]`, errors));
|
|
3811
3813
|
}
|
|
3812
3814
|
function validateSeries(value, path, errors) {
|
|
3813
3815
|
if (!recordValue(value, path, errors)) return;
|
|
@@ -4005,6 +4007,478 @@ function toIsoTimestamp(input) {
|
|
|
4005
4007
|
return input ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
4006
4008
|
}
|
|
4007
4009
|
|
|
4010
|
+
// src/widget-output-schema.ts
|
|
4011
|
+
var nonEmptyString2 = { type: "string", minLength: 1 };
|
|
4012
|
+
var stringArray3 = { type: "array", items: nonEmptyString2 };
|
|
4013
|
+
var actionBinding = {
|
|
4014
|
+
type: "object",
|
|
4015
|
+
properties: {
|
|
4016
|
+
id: nonEmptyString2,
|
|
4017
|
+
label: nonEmptyString2,
|
|
4018
|
+
actionId: nonEmptyString2,
|
|
4019
|
+
resourceType: nonEmptyString2,
|
|
4020
|
+
resourceId: nonEmptyString2,
|
|
4021
|
+
input: { type: "object" },
|
|
4022
|
+
requiresConfirmation: { type: "boolean" },
|
|
4023
|
+
destructive: { type: "boolean" },
|
|
4024
|
+
effects: stringArray3,
|
|
4025
|
+
verification: stringArray3,
|
|
4026
|
+
recovery: {
|
|
4027
|
+
type: "object",
|
|
4028
|
+
properties: {
|
|
4029
|
+
mode: { enum: ["not_applicable", "retry", "compensating_action"] },
|
|
4030
|
+
actionId: nonEmptyString2,
|
|
4031
|
+
instructions: nonEmptyString2
|
|
4032
|
+
},
|
|
4033
|
+
required: ["mode", "instructions"],
|
|
4034
|
+
additionalProperties: false
|
|
4035
|
+
}
|
|
4036
|
+
},
|
|
4037
|
+
required: [
|
|
4038
|
+
"id",
|
|
4039
|
+
"label",
|
|
4040
|
+
"actionId",
|
|
4041
|
+
"resourceType",
|
|
4042
|
+
"input",
|
|
4043
|
+
"requiresConfirmation",
|
|
4044
|
+
"destructive",
|
|
4045
|
+
"effects",
|
|
4046
|
+
"verification",
|
|
4047
|
+
"recovery"
|
|
4048
|
+
],
|
|
4049
|
+
additionalProperties: false
|
|
4050
|
+
};
|
|
4051
|
+
var dimension = {
|
|
4052
|
+
type: "object",
|
|
4053
|
+
properties: { key: nonEmptyString2, label: nonEmptyString2, value: nonEmptyString2 },
|
|
4054
|
+
required: ["key", "label", "value"],
|
|
4055
|
+
additionalProperties: false
|
|
4056
|
+
};
|
|
4057
|
+
var period = {
|
|
4058
|
+
type: "object",
|
|
4059
|
+
properties: {
|
|
4060
|
+
start: nonEmptyString2,
|
|
4061
|
+
end: nonEmptyString2,
|
|
4062
|
+
timezone: nonEmptyString2
|
|
4063
|
+
},
|
|
4064
|
+
required: ["start", "end", "timezone"],
|
|
4065
|
+
additionalProperties: false
|
|
4066
|
+
};
|
|
4067
|
+
var series = {
|
|
4068
|
+
type: "object",
|
|
4069
|
+
properties: {
|
|
4070
|
+
id: nonEmptyString2,
|
|
4071
|
+
label: nonEmptyString2,
|
|
4072
|
+
unit: nonEmptyString2,
|
|
4073
|
+
points: {
|
|
4074
|
+
type: "array",
|
|
4075
|
+
items: {
|
|
4076
|
+
type: "object",
|
|
4077
|
+
properties: {
|
|
4078
|
+
timestamp: nonEmptyString2,
|
|
4079
|
+
value: { type: "number" },
|
|
4080
|
+
dimensions: { type: "array", items: dimension }
|
|
4081
|
+
},
|
|
4082
|
+
required: ["timestamp", "value", "dimensions"],
|
|
4083
|
+
additionalProperties: false
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
},
|
|
4087
|
+
required: ["id", "label", "unit", "points"],
|
|
4088
|
+
additionalProperties: false
|
|
4089
|
+
};
|
|
4090
|
+
var contribution = {
|
|
4091
|
+
type: "object",
|
|
4092
|
+
properties: {
|
|
4093
|
+
summary: nonEmptyString2,
|
|
4094
|
+
identity: {
|
|
4095
|
+
type: "object",
|
|
4096
|
+
properties: { iconSource: { const: "catalog" } },
|
|
4097
|
+
required: ["iconSource"],
|
|
4098
|
+
additionalProperties: false
|
|
4099
|
+
},
|
|
4100
|
+
workspaceSelector: {
|
|
4101
|
+
type: "object",
|
|
4102
|
+
properties: {
|
|
4103
|
+
mode: { enum: ["none", "optional", "required"] },
|
|
4104
|
+
resourceType: nonEmptyString2,
|
|
4105
|
+
label: nonEmptyString2,
|
|
4106
|
+
supportsMultiple: { type: "boolean" }
|
|
4107
|
+
},
|
|
4108
|
+
required: ["mode", "resourceType", "label", "supportsMultiple"],
|
|
4109
|
+
additionalProperties: false
|
|
4110
|
+
},
|
|
4111
|
+
metricDefinitions: {
|
|
4112
|
+
type: "array",
|
|
4113
|
+
items: {
|
|
4114
|
+
type: "object",
|
|
4115
|
+
properties: {
|
|
4116
|
+
key: nonEmptyString2,
|
|
4117
|
+
label: nonEmptyString2,
|
|
4118
|
+
description: nonEmptyString2,
|
|
4119
|
+
unit: nonEmptyString2,
|
|
4120
|
+
semantic: {
|
|
4121
|
+
enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
|
|
4122
|
+
},
|
|
4123
|
+
aggregation: {
|
|
4124
|
+
enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
|
|
4125
|
+
}
|
|
4126
|
+
},
|
|
4127
|
+
required: ["key", "label", "description", "unit", "semantic", "aggregation"],
|
|
4128
|
+
additionalProperties: false
|
|
4129
|
+
}
|
|
4130
|
+
},
|
|
4131
|
+
seriesDefinitions: {
|
|
4132
|
+
type: "array",
|
|
4133
|
+
items: {
|
|
4134
|
+
type: "object",
|
|
4135
|
+
properties: {
|
|
4136
|
+
key: nonEmptyString2,
|
|
4137
|
+
label: nonEmptyString2,
|
|
4138
|
+
metricKey: nonEmptyString2,
|
|
4139
|
+
unit: nonEmptyString2
|
|
4140
|
+
},
|
|
4141
|
+
required: ["key", "label", "metricKey", "unit"],
|
|
4142
|
+
additionalProperties: false
|
|
4143
|
+
}
|
|
4144
|
+
},
|
|
4145
|
+
dimensions: {
|
|
4146
|
+
type: "array",
|
|
4147
|
+
items: {
|
|
4148
|
+
type: "object",
|
|
4149
|
+
properties: {
|
|
4150
|
+
key: nonEmptyString2,
|
|
4151
|
+
label: nonEmptyString2,
|
|
4152
|
+
description: nonEmptyString2,
|
|
4153
|
+
valueType: { enum: ["string", "number", "boolean", "date", "datetime"] }
|
|
4154
|
+
},
|
|
4155
|
+
required: ["key", "label", "description", "valueType"],
|
|
4156
|
+
additionalProperties: false
|
|
4157
|
+
}
|
|
4158
|
+
},
|
|
4159
|
+
lifecycleStages: {
|
|
4160
|
+
type: "array",
|
|
4161
|
+
items: {
|
|
4162
|
+
type: "object",
|
|
4163
|
+
properties: {
|
|
4164
|
+
key: nonEmptyString2,
|
|
4165
|
+
label: nonEmptyString2,
|
|
4166
|
+
order: { type: "number" },
|
|
4167
|
+
terminal: { type: "boolean" }
|
|
4168
|
+
},
|
|
4169
|
+
required: ["key", "label", "order", "terminal"],
|
|
4170
|
+
additionalProperties: false
|
|
4171
|
+
}
|
|
4172
|
+
},
|
|
4173
|
+
events: {
|
|
4174
|
+
type: "array",
|
|
4175
|
+
items: {
|
|
4176
|
+
type: "object",
|
|
4177
|
+
properties: {
|
|
4178
|
+
key: nonEmptyString2,
|
|
4179
|
+
label: nonEmptyString2,
|
|
4180
|
+
description: nonEmptyString2
|
|
4181
|
+
},
|
|
4182
|
+
required: ["key", "label", "description"],
|
|
4183
|
+
additionalProperties: false
|
|
4184
|
+
}
|
|
4185
|
+
},
|
|
4186
|
+
datasets: {
|
|
4187
|
+
type: "array",
|
|
4188
|
+
minItems: 1,
|
|
4189
|
+
items: {
|
|
4190
|
+
type: "object",
|
|
4191
|
+
properties: {
|
|
4192
|
+
id: nonEmptyString2,
|
|
4193
|
+
label: nonEmptyString2,
|
|
4194
|
+
description: nonEmptyString2,
|
|
4195
|
+
grain: nonEmptyString2,
|
|
4196
|
+
metricKeys: stringArray3,
|
|
4197
|
+
seriesKeys: stringArray3,
|
|
4198
|
+
dimensionKeys: stringArray3,
|
|
4199
|
+
eventKeys: stringArray3,
|
|
4200
|
+
actionIds: stringArray3
|
|
4201
|
+
},
|
|
4202
|
+
required: [
|
|
4203
|
+
"id",
|
|
4204
|
+
"label",
|
|
4205
|
+
"description",
|
|
4206
|
+
"grain",
|
|
4207
|
+
"metricKeys",
|
|
4208
|
+
"seriesKeys",
|
|
4209
|
+
"dimensionKeys",
|
|
4210
|
+
"eventKeys",
|
|
4211
|
+
"actionIds"
|
|
4212
|
+
],
|
|
4213
|
+
additionalProperties: false
|
|
4214
|
+
}
|
|
4215
|
+
},
|
|
4216
|
+
compatibleVisualizations: {
|
|
4217
|
+
type: "array",
|
|
4218
|
+
minItems: 1,
|
|
4219
|
+
items: {
|
|
4220
|
+
enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
|
|
4221
|
+
}
|
|
4222
|
+
},
|
|
4223
|
+
defaultVisualization: {
|
|
4224
|
+
enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
|
|
4225
|
+
}
|
|
4226
|
+
},
|
|
4227
|
+
required: [
|
|
4228
|
+
"summary",
|
|
4229
|
+
"identity",
|
|
4230
|
+
"workspaceSelector",
|
|
4231
|
+
"metricDefinitions",
|
|
4232
|
+
"seriesDefinitions",
|
|
4233
|
+
"dimensions",
|
|
4234
|
+
"lifecycleStages",
|
|
4235
|
+
"events",
|
|
4236
|
+
"datasets",
|
|
4237
|
+
"compatibleVisualizations",
|
|
4238
|
+
"defaultVisualization"
|
|
4239
|
+
],
|
|
4240
|
+
additionalProperties: false
|
|
4241
|
+
};
|
|
4242
|
+
var widgetItem = {
|
|
4243
|
+
type: "object",
|
|
4244
|
+
properties: {
|
|
4245
|
+
id: nonEmptyString2,
|
|
4246
|
+
version: nonEmptyString2,
|
|
4247
|
+
appId: nonEmptyString2,
|
|
4248
|
+
serviceName: nonEmptyString2,
|
|
4249
|
+
lastUpdated: nonEmptyString2,
|
|
4250
|
+
type: { enum: ["stats", "chart", "activity", "notifications", "actions"] },
|
|
4251
|
+
presentation: {
|
|
4252
|
+
type: "object",
|
|
4253
|
+
properties: {
|
|
4254
|
+
title: nonEmptyString2,
|
|
4255
|
+
description: nonEmptyString2,
|
|
4256
|
+
contexts: {
|
|
4257
|
+
type: "array",
|
|
4258
|
+
minItems: 1,
|
|
4259
|
+
items: { enum: ["personal", "organization", "workspace", "resource"] }
|
|
4260
|
+
},
|
|
4261
|
+
supportedSizes: {
|
|
4262
|
+
type: "array",
|
|
4263
|
+
minItems: 1,
|
|
4264
|
+
items: { enum: ["compact", "medium", "wide", "full"] }
|
|
4265
|
+
},
|
|
4266
|
+
defaultSize: { enum: ["compact", "medium", "wide", "full"] }
|
|
4267
|
+
},
|
|
4268
|
+
required: ["title", "contexts", "supportedSizes", "defaultSize"],
|
|
4269
|
+
additionalProperties: false
|
|
4270
|
+
},
|
|
4271
|
+
resource: {
|
|
4272
|
+
type: "object",
|
|
4273
|
+
properties: {
|
|
4274
|
+
resourceType: nonEmptyString2,
|
|
4275
|
+
resourceId: nonEmptyString2,
|
|
4276
|
+
requiredPermissions: stringArray3
|
|
4277
|
+
},
|
|
4278
|
+
required: ["resourceType", "requiredPermissions"],
|
|
4279
|
+
additionalProperties: false
|
|
4280
|
+
},
|
|
4281
|
+
state: {
|
|
4282
|
+
type: "object",
|
|
4283
|
+
properties: {
|
|
4284
|
+
status: { enum: ["ready", "empty", "unavailable", "stale", "error"] },
|
|
4285
|
+
observedAt: nonEmptyString2,
|
|
4286
|
+
lastSuccessfulAt: nonEmptyString2,
|
|
4287
|
+
code: nonEmptyString2,
|
|
4288
|
+
message: nonEmptyString2
|
|
4289
|
+
},
|
|
4290
|
+
required: ["status", "observedAt"],
|
|
4291
|
+
additionalProperties: false
|
|
4292
|
+
},
|
|
4293
|
+
refresh: {
|
|
4294
|
+
type: "object",
|
|
4295
|
+
properties: {
|
|
4296
|
+
intervalSeconds: { type: "number" },
|
|
4297
|
+
timeoutSeconds: { type: "number" },
|
|
4298
|
+
maxAgeSeconds: { type: "number" },
|
|
4299
|
+
staleWhileRevalidateSeconds: { type: "number" }
|
|
4300
|
+
},
|
|
4301
|
+
required: ["intervalSeconds", "timeoutSeconds", "maxAgeSeconds", "staleWhileRevalidateSeconds"],
|
|
4302
|
+
additionalProperties: false
|
|
4303
|
+
},
|
|
4304
|
+
configuration: {
|
|
4305
|
+
type: "object",
|
|
4306
|
+
properties: {
|
|
4307
|
+
allowMultipleInstances: { type: "boolean" },
|
|
4308
|
+
fields: {
|
|
4309
|
+
type: "array",
|
|
4310
|
+
items: {
|
|
4311
|
+
type: "object",
|
|
4312
|
+
properties: {
|
|
4313
|
+
key: nonEmptyString2,
|
|
4314
|
+
label: nonEmptyString2,
|
|
4315
|
+
type: { enum: ["string", "number", "boolean", "select", "multi-select", "date-range"] },
|
|
4316
|
+
required: { type: "boolean" },
|
|
4317
|
+
options: {
|
|
4318
|
+
type: "array",
|
|
4319
|
+
items: {
|
|
4320
|
+
type: "object",
|
|
4321
|
+
properties: { value: nonEmptyString2, label: nonEmptyString2 },
|
|
4322
|
+
required: ["value", "label"],
|
|
4323
|
+
additionalProperties: false
|
|
4324
|
+
}
|
|
4325
|
+
}
|
|
4326
|
+
},
|
|
4327
|
+
required: ["key", "label", "type", "required"],
|
|
4328
|
+
additionalProperties: false
|
|
4329
|
+
}
|
|
4330
|
+
},
|
|
4331
|
+
defaults: { type: "object" }
|
|
4332
|
+
},
|
|
4333
|
+
required: ["allowMultipleInstances", "fields", "defaults"],
|
|
4334
|
+
additionalProperties: false
|
|
4335
|
+
},
|
|
4336
|
+
drilldowns: {
|
|
4337
|
+
type: "array",
|
|
4338
|
+
items: {
|
|
4339
|
+
type: "object",
|
|
4340
|
+
properties: { id: nonEmptyString2, label: nonEmptyString2, href: nonEmptyString2 },
|
|
4341
|
+
required: ["id", "label", "href"],
|
|
4342
|
+
additionalProperties: false
|
|
4343
|
+
}
|
|
4344
|
+
},
|
|
4345
|
+
controls: { type: "array", items: actionBinding },
|
|
4346
|
+
localization: {
|
|
4347
|
+
type: "object",
|
|
4348
|
+
properties: {
|
|
4349
|
+
locale: nonEmptyString2,
|
|
4350
|
+
titleKey: nonEmptyString2,
|
|
4351
|
+
descriptionKey: nonEmptyString2,
|
|
4352
|
+
title: nonEmptyString2,
|
|
4353
|
+
description: nonEmptyString2
|
|
4354
|
+
},
|
|
4355
|
+
required: ["locale", "titleKey"],
|
|
4356
|
+
additionalProperties: false
|
|
4357
|
+
},
|
|
4358
|
+
accessibility: {
|
|
4359
|
+
type: "object",
|
|
4360
|
+
properties: { label: nonEmptyString2, description: nonEmptyString2 },
|
|
4361
|
+
required: ["label"],
|
|
4362
|
+
additionalProperties: false
|
|
4363
|
+
},
|
|
4364
|
+
contribution,
|
|
4365
|
+
metrics: {
|
|
4366
|
+
type: "array",
|
|
4367
|
+
items: {
|
|
4368
|
+
type: "object",
|
|
4369
|
+
properties: {
|
|
4370
|
+
key: nonEmptyString2,
|
|
4371
|
+
label: nonEmptyString2,
|
|
4372
|
+
value: { type: "number" },
|
|
4373
|
+
unit: nonEmptyString2,
|
|
4374
|
+
semantic: {
|
|
4375
|
+
enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
|
|
4376
|
+
},
|
|
4377
|
+
aggregation: {
|
|
4378
|
+
enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
|
|
4379
|
+
},
|
|
4380
|
+
period,
|
|
4381
|
+
dimensions: { type: "array", items: dimension },
|
|
4382
|
+
series
|
|
4383
|
+
},
|
|
4384
|
+
required: ["key", "label", "value", "unit", "semantic", "aggregation", "period", "dimensions"],
|
|
4385
|
+
additionalProperties: false
|
|
4386
|
+
}
|
|
4387
|
+
},
|
|
4388
|
+
chartType: { enum: ["line", "bar", "area", "pie", "donut"] },
|
|
4389
|
+
series: { type: "array", items: series },
|
|
4390
|
+
activities: { type: "array", items: { type: "object" } },
|
|
4391
|
+
notifications: { type: "array", items: { type: "object" } },
|
|
4392
|
+
unreadCount: { type: "number" },
|
|
4393
|
+
actions: { type: "array", items: actionBinding }
|
|
4394
|
+
},
|
|
4395
|
+
required: [
|
|
4396
|
+
"id",
|
|
4397
|
+
"version",
|
|
4398
|
+
"appId",
|
|
4399
|
+
"serviceName",
|
|
4400
|
+
"lastUpdated",
|
|
4401
|
+
"type",
|
|
4402
|
+
"presentation",
|
|
4403
|
+
"resource",
|
|
4404
|
+
"state",
|
|
4405
|
+
"refresh",
|
|
4406
|
+
"configuration",
|
|
4407
|
+
"drilldowns",
|
|
4408
|
+
"controls",
|
|
4409
|
+
"localization",
|
|
4410
|
+
"accessibility",
|
|
4411
|
+
"contribution"
|
|
4412
|
+
],
|
|
4413
|
+
allOf: [
|
|
4414
|
+
{ if: { properties: { type: { const: "stats" } } }, then: { required: ["metrics"] } },
|
|
4415
|
+
{ if: { properties: { type: { const: "chart" } } }, then: { required: ["chartType", "series"] } },
|
|
4416
|
+
{ if: { properties: { type: { const: "activity" } } }, then: { required: ["activities"] } },
|
|
4417
|
+
{
|
|
4418
|
+
if: { properties: { type: { const: "notifications" } } },
|
|
4419
|
+
then: { required: ["notifications", "unreadCount"] }
|
|
4420
|
+
},
|
|
4421
|
+
{ if: { properties: { type: { const: "actions" } } }, then: { required: ["actions"] } }
|
|
4422
|
+
],
|
|
4423
|
+
additionalProperties: false
|
|
4424
|
+
};
|
|
4425
|
+
var TOPOLO_WIDGET_OUTPUT_SCHEMA = Object.freeze({
|
|
4426
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
4427
|
+
type: "object",
|
|
4428
|
+
properties: {
|
|
4429
|
+
success: { type: "boolean", const: true },
|
|
4430
|
+
contractVersion: { type: "string", const: "3.0.0" },
|
|
4431
|
+
appId: nonEmptyString2,
|
|
4432
|
+
serviceName: nonEmptyString2,
|
|
4433
|
+
generatedAt: nonEmptyString2,
|
|
4434
|
+
widgets: { type: "array", minItems: 1, items: widgetItem },
|
|
4435
|
+
workspace: {
|
|
4436
|
+
anyOf: [
|
|
4437
|
+
{
|
|
4438
|
+
type: "object",
|
|
4439
|
+
properties: {
|
|
4440
|
+
id: { anyOf: [{ type: "string" }, { type: "number" }] },
|
|
4441
|
+
name: nonEmptyString2
|
|
4442
|
+
},
|
|
4443
|
+
required: ["id", "name"],
|
|
4444
|
+
additionalProperties: true
|
|
4445
|
+
},
|
|
4446
|
+
{ type: "null" }
|
|
4447
|
+
]
|
|
4448
|
+
},
|
|
4449
|
+
workspaces: {
|
|
4450
|
+
type: "array",
|
|
4451
|
+
items: {
|
|
4452
|
+
type: "object",
|
|
4453
|
+
properties: {
|
|
4454
|
+
id: { anyOf: [{ type: "string" }, { type: "number" }] },
|
|
4455
|
+
name: nonEmptyString2,
|
|
4456
|
+
isDefault: { type: "boolean" }
|
|
4457
|
+
},
|
|
4458
|
+
required: ["id", "name"],
|
|
4459
|
+
additionalProperties: false
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4462
|
+
},
|
|
4463
|
+
required: ["success", "contractVersion", "appId", "serviceName", "generatedAt", "widgets"],
|
|
4464
|
+
additionalProperties: false
|
|
4465
|
+
});
|
|
4466
|
+
function isTopoloWidgetOutputSchema(schema) {
|
|
4467
|
+
if (!isRecord6(schema) || !isRecord6(schema.properties)) return false;
|
|
4468
|
+
const properties = schema.properties;
|
|
4469
|
+
const widgetItemSchema = isRecord6(properties.widgets) && isRecord6(properties.widgets.items) ? properties.widgets.items : void 0;
|
|
4470
|
+
const widgetProperties = widgetItemSchema && isRecord6(widgetItemSchema.properties) ? widgetItemSchema.properties : void 0;
|
|
4471
|
+
const contributionSchema = widgetProperties && isRecord6(widgetProperties.contribution) ? widgetProperties.contribution : void 0;
|
|
4472
|
+
const contractVersion = isRecord6(properties.contractVersion) ? properties.contractVersion.const : void 0;
|
|
4473
|
+
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");
|
|
4474
|
+
}
|
|
4475
|
+
function isRecord6(value) {
|
|
4476
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4477
|
+
}
|
|
4478
|
+
function hasRequired(schema, field) {
|
|
4479
|
+
return isRecord6(schema) && Array.isArray(schema.required) && schema.required.includes(field);
|
|
4480
|
+
}
|
|
4481
|
+
|
|
4008
4482
|
// src/index.ts
|
|
4009
4483
|
function createTopolo(options) {
|
|
4010
4484
|
const client = new TopoloClient(options);
|
|
@@ -4026,6 +4500,7 @@ function createTopolo(options) {
|
|
|
4026
4500
|
TOPOLO_RUNTIME_ENVIRONMENTS,
|
|
4027
4501
|
TOPOLO_WIDGET_CONTRACT_VERSION,
|
|
4028
4502
|
TOPOLO_WIDGET_ENDPOINT,
|
|
4503
|
+
TOPOLO_WIDGET_OUTPUT_SCHEMA,
|
|
4029
4504
|
TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
|
|
4030
4505
|
TopoloAuthError,
|
|
4031
4506
|
TopoloClient,
|
|
@@ -4063,6 +4538,7 @@ function createTopolo(options) {
|
|
|
4063
4538
|
extractTopoloServiceErrorDetails,
|
|
4064
4539
|
formatDirectoryApplicationIds,
|
|
4065
4540
|
friendlyAppId,
|
|
4541
|
+
isTopoloWidgetOutputSchema,
|
|
4066
4542
|
listApplicationDirectory,
|
|
4067
4543
|
parseTopoloActionUploadContract,
|
|
4068
4544
|
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
|
@@ -3652,22 +3652,22 @@ function validateRuntimeSemantics(widget, contributionPath, declared, errors) {
|
|
|
3652
3652
|
validateSeriesDimensions(metric.series, declared.dimensionKeys, contributionPath, errors);
|
|
3653
3653
|
}
|
|
3654
3654
|
}
|
|
3655
|
-
const
|
|
3656
|
-
for (const item of
|
|
3655
|
+
const series2 = Array.isArray(widget.series) ? widget.series : [];
|
|
3656
|
+
for (const item of series2) {
|
|
3657
3657
|
if (!isRecord5(item)) continue;
|
|
3658
3658
|
if (typeof item.id === "string" && !declared.seriesKeys.has(item.id)) errors.push(`${contributionPath}.seriesDefinitions is missing runtime series ${item.id}`);
|
|
3659
3659
|
validateSeriesDimensions(item, declared.dimensionKeys, contributionPath, errors);
|
|
3660
3660
|
}
|
|
3661
3661
|
}
|
|
3662
|
-
function validateSeriesDimensions(
|
|
3663
|
-
if (!Array.isArray(
|
|
3664
|
-
for (const point of
|
|
3662
|
+
function validateSeriesDimensions(series2, known, path, errors) {
|
|
3663
|
+
if (!Array.isArray(series2.points)) return;
|
|
3664
|
+
for (const point of series2.points) if (isRecord5(point)) validateRuntimeDimensions(point.dimensions, known, path, errors);
|
|
3665
3665
|
}
|
|
3666
3666
|
function validateRuntimeDimensions(value, known, path, errors) {
|
|
3667
3667
|
if (!Array.isArray(value)) return;
|
|
3668
|
-
for (const
|
|
3669
|
-
if (isRecord5(
|
|
3670
|
-
errors.push(`${path}.dimensions is missing runtime dimension ${
|
|
3668
|
+
for (const dimension2 of value) {
|
|
3669
|
+
if (isRecord5(dimension2) && typeof dimension2.key === "string" && !known.has(dimension2.key)) {
|
|
3670
|
+
errors.push(`${path}.dimensions is missing runtime dimension ${dimension2.key}`);
|
|
3671
3671
|
}
|
|
3672
3672
|
}
|
|
3673
3673
|
}
|
|
@@ -3704,12 +3704,12 @@ function validatePeriod(value, path, errors) {
|
|
|
3704
3704
|
}
|
|
3705
3705
|
function validateDimensions(value, path, errors) {
|
|
3706
3706
|
if (!arrayValue(value, path, errors)) return;
|
|
3707
|
-
value.forEach((
|
|
3707
|
+
value.forEach((dimension2, index) => {
|
|
3708
3708
|
const itemPath = `${path}[${index}]`;
|
|
3709
|
-
if (!recordValue(
|
|
3710
|
-
nonEmptyString(
|
|
3711
|
-
nonEmptyString(
|
|
3712
|
-
nonEmptyString(
|
|
3709
|
+
if (!recordValue(dimension2, itemPath, errors)) return;
|
|
3710
|
+
nonEmptyString(dimension2.key, `${itemPath}.key`, errors);
|
|
3711
|
+
nonEmptyString(dimension2.label, `${itemPath}.label`, errors);
|
|
3712
|
+
nonEmptyString(dimension2.value, `${itemPath}.value`, errors);
|
|
3713
3713
|
});
|
|
3714
3714
|
}
|
|
3715
3715
|
function validateComparison(value, path, errors) {
|
|
@@ -3723,7 +3723,7 @@ function validateComparison(value, path, errors) {
|
|
|
3723
3723
|
}
|
|
3724
3724
|
function validateSeriesCollection(value, path, errors, requireOne) {
|
|
3725
3725
|
if (!arrayValue(value, path, errors, requireOne)) return;
|
|
3726
|
-
value.forEach((
|
|
3726
|
+
value.forEach((series2, index) => validateSeries(series2, `${path}[${index}]`, errors));
|
|
3727
3727
|
}
|
|
3728
3728
|
function validateSeries(value, path, errors) {
|
|
3729
3729
|
if (!recordValue(value, path, errors)) return;
|
|
@@ -3921,6 +3921,478 @@ function toIsoTimestamp(input) {
|
|
|
3921
3921
|
return input ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
3922
3922
|
}
|
|
3923
3923
|
|
|
3924
|
+
// src/widget-output-schema.ts
|
|
3925
|
+
var nonEmptyString2 = { type: "string", minLength: 1 };
|
|
3926
|
+
var stringArray3 = { type: "array", items: nonEmptyString2 };
|
|
3927
|
+
var actionBinding = {
|
|
3928
|
+
type: "object",
|
|
3929
|
+
properties: {
|
|
3930
|
+
id: nonEmptyString2,
|
|
3931
|
+
label: nonEmptyString2,
|
|
3932
|
+
actionId: nonEmptyString2,
|
|
3933
|
+
resourceType: nonEmptyString2,
|
|
3934
|
+
resourceId: nonEmptyString2,
|
|
3935
|
+
input: { type: "object" },
|
|
3936
|
+
requiresConfirmation: { type: "boolean" },
|
|
3937
|
+
destructive: { type: "boolean" },
|
|
3938
|
+
effects: stringArray3,
|
|
3939
|
+
verification: stringArray3,
|
|
3940
|
+
recovery: {
|
|
3941
|
+
type: "object",
|
|
3942
|
+
properties: {
|
|
3943
|
+
mode: { enum: ["not_applicable", "retry", "compensating_action"] },
|
|
3944
|
+
actionId: nonEmptyString2,
|
|
3945
|
+
instructions: nonEmptyString2
|
|
3946
|
+
},
|
|
3947
|
+
required: ["mode", "instructions"],
|
|
3948
|
+
additionalProperties: false
|
|
3949
|
+
}
|
|
3950
|
+
},
|
|
3951
|
+
required: [
|
|
3952
|
+
"id",
|
|
3953
|
+
"label",
|
|
3954
|
+
"actionId",
|
|
3955
|
+
"resourceType",
|
|
3956
|
+
"input",
|
|
3957
|
+
"requiresConfirmation",
|
|
3958
|
+
"destructive",
|
|
3959
|
+
"effects",
|
|
3960
|
+
"verification",
|
|
3961
|
+
"recovery"
|
|
3962
|
+
],
|
|
3963
|
+
additionalProperties: false
|
|
3964
|
+
};
|
|
3965
|
+
var dimension = {
|
|
3966
|
+
type: "object",
|
|
3967
|
+
properties: { key: nonEmptyString2, label: nonEmptyString2, value: nonEmptyString2 },
|
|
3968
|
+
required: ["key", "label", "value"],
|
|
3969
|
+
additionalProperties: false
|
|
3970
|
+
};
|
|
3971
|
+
var period = {
|
|
3972
|
+
type: "object",
|
|
3973
|
+
properties: {
|
|
3974
|
+
start: nonEmptyString2,
|
|
3975
|
+
end: nonEmptyString2,
|
|
3976
|
+
timezone: nonEmptyString2
|
|
3977
|
+
},
|
|
3978
|
+
required: ["start", "end", "timezone"],
|
|
3979
|
+
additionalProperties: false
|
|
3980
|
+
};
|
|
3981
|
+
var series = {
|
|
3982
|
+
type: "object",
|
|
3983
|
+
properties: {
|
|
3984
|
+
id: nonEmptyString2,
|
|
3985
|
+
label: nonEmptyString2,
|
|
3986
|
+
unit: nonEmptyString2,
|
|
3987
|
+
points: {
|
|
3988
|
+
type: "array",
|
|
3989
|
+
items: {
|
|
3990
|
+
type: "object",
|
|
3991
|
+
properties: {
|
|
3992
|
+
timestamp: nonEmptyString2,
|
|
3993
|
+
value: { type: "number" },
|
|
3994
|
+
dimensions: { type: "array", items: dimension }
|
|
3995
|
+
},
|
|
3996
|
+
required: ["timestamp", "value", "dimensions"],
|
|
3997
|
+
additionalProperties: false
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
},
|
|
4001
|
+
required: ["id", "label", "unit", "points"],
|
|
4002
|
+
additionalProperties: false
|
|
4003
|
+
};
|
|
4004
|
+
var contribution = {
|
|
4005
|
+
type: "object",
|
|
4006
|
+
properties: {
|
|
4007
|
+
summary: nonEmptyString2,
|
|
4008
|
+
identity: {
|
|
4009
|
+
type: "object",
|
|
4010
|
+
properties: { iconSource: { const: "catalog" } },
|
|
4011
|
+
required: ["iconSource"],
|
|
4012
|
+
additionalProperties: false
|
|
4013
|
+
},
|
|
4014
|
+
workspaceSelector: {
|
|
4015
|
+
type: "object",
|
|
4016
|
+
properties: {
|
|
4017
|
+
mode: { enum: ["none", "optional", "required"] },
|
|
4018
|
+
resourceType: nonEmptyString2,
|
|
4019
|
+
label: nonEmptyString2,
|
|
4020
|
+
supportsMultiple: { type: "boolean" }
|
|
4021
|
+
},
|
|
4022
|
+
required: ["mode", "resourceType", "label", "supportsMultiple"],
|
|
4023
|
+
additionalProperties: false
|
|
4024
|
+
},
|
|
4025
|
+
metricDefinitions: {
|
|
4026
|
+
type: "array",
|
|
4027
|
+
items: {
|
|
4028
|
+
type: "object",
|
|
4029
|
+
properties: {
|
|
4030
|
+
key: nonEmptyString2,
|
|
4031
|
+
label: nonEmptyString2,
|
|
4032
|
+
description: nonEmptyString2,
|
|
4033
|
+
unit: nonEmptyString2,
|
|
4034
|
+
semantic: {
|
|
4035
|
+
enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
|
|
4036
|
+
},
|
|
4037
|
+
aggregation: {
|
|
4038
|
+
enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
|
|
4039
|
+
}
|
|
4040
|
+
},
|
|
4041
|
+
required: ["key", "label", "description", "unit", "semantic", "aggregation"],
|
|
4042
|
+
additionalProperties: false
|
|
4043
|
+
}
|
|
4044
|
+
},
|
|
4045
|
+
seriesDefinitions: {
|
|
4046
|
+
type: "array",
|
|
4047
|
+
items: {
|
|
4048
|
+
type: "object",
|
|
4049
|
+
properties: {
|
|
4050
|
+
key: nonEmptyString2,
|
|
4051
|
+
label: nonEmptyString2,
|
|
4052
|
+
metricKey: nonEmptyString2,
|
|
4053
|
+
unit: nonEmptyString2
|
|
4054
|
+
},
|
|
4055
|
+
required: ["key", "label", "metricKey", "unit"],
|
|
4056
|
+
additionalProperties: false
|
|
4057
|
+
}
|
|
4058
|
+
},
|
|
4059
|
+
dimensions: {
|
|
4060
|
+
type: "array",
|
|
4061
|
+
items: {
|
|
4062
|
+
type: "object",
|
|
4063
|
+
properties: {
|
|
4064
|
+
key: nonEmptyString2,
|
|
4065
|
+
label: nonEmptyString2,
|
|
4066
|
+
description: nonEmptyString2,
|
|
4067
|
+
valueType: { enum: ["string", "number", "boolean", "date", "datetime"] }
|
|
4068
|
+
},
|
|
4069
|
+
required: ["key", "label", "description", "valueType"],
|
|
4070
|
+
additionalProperties: false
|
|
4071
|
+
}
|
|
4072
|
+
},
|
|
4073
|
+
lifecycleStages: {
|
|
4074
|
+
type: "array",
|
|
4075
|
+
items: {
|
|
4076
|
+
type: "object",
|
|
4077
|
+
properties: {
|
|
4078
|
+
key: nonEmptyString2,
|
|
4079
|
+
label: nonEmptyString2,
|
|
4080
|
+
order: { type: "number" },
|
|
4081
|
+
terminal: { type: "boolean" }
|
|
4082
|
+
},
|
|
4083
|
+
required: ["key", "label", "order", "terminal"],
|
|
4084
|
+
additionalProperties: false
|
|
4085
|
+
}
|
|
4086
|
+
},
|
|
4087
|
+
events: {
|
|
4088
|
+
type: "array",
|
|
4089
|
+
items: {
|
|
4090
|
+
type: "object",
|
|
4091
|
+
properties: {
|
|
4092
|
+
key: nonEmptyString2,
|
|
4093
|
+
label: nonEmptyString2,
|
|
4094
|
+
description: nonEmptyString2
|
|
4095
|
+
},
|
|
4096
|
+
required: ["key", "label", "description"],
|
|
4097
|
+
additionalProperties: false
|
|
4098
|
+
}
|
|
4099
|
+
},
|
|
4100
|
+
datasets: {
|
|
4101
|
+
type: "array",
|
|
4102
|
+
minItems: 1,
|
|
4103
|
+
items: {
|
|
4104
|
+
type: "object",
|
|
4105
|
+
properties: {
|
|
4106
|
+
id: nonEmptyString2,
|
|
4107
|
+
label: nonEmptyString2,
|
|
4108
|
+
description: nonEmptyString2,
|
|
4109
|
+
grain: nonEmptyString2,
|
|
4110
|
+
metricKeys: stringArray3,
|
|
4111
|
+
seriesKeys: stringArray3,
|
|
4112
|
+
dimensionKeys: stringArray3,
|
|
4113
|
+
eventKeys: stringArray3,
|
|
4114
|
+
actionIds: stringArray3
|
|
4115
|
+
},
|
|
4116
|
+
required: [
|
|
4117
|
+
"id",
|
|
4118
|
+
"label",
|
|
4119
|
+
"description",
|
|
4120
|
+
"grain",
|
|
4121
|
+
"metricKeys",
|
|
4122
|
+
"seriesKeys",
|
|
4123
|
+
"dimensionKeys",
|
|
4124
|
+
"eventKeys",
|
|
4125
|
+
"actionIds"
|
|
4126
|
+
],
|
|
4127
|
+
additionalProperties: false
|
|
4128
|
+
}
|
|
4129
|
+
},
|
|
4130
|
+
compatibleVisualizations: {
|
|
4131
|
+
type: "array",
|
|
4132
|
+
minItems: 1,
|
|
4133
|
+
items: {
|
|
4134
|
+
enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
|
|
4135
|
+
}
|
|
4136
|
+
},
|
|
4137
|
+
defaultVisualization: {
|
|
4138
|
+
enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
|
|
4139
|
+
}
|
|
4140
|
+
},
|
|
4141
|
+
required: [
|
|
4142
|
+
"summary",
|
|
4143
|
+
"identity",
|
|
4144
|
+
"workspaceSelector",
|
|
4145
|
+
"metricDefinitions",
|
|
4146
|
+
"seriesDefinitions",
|
|
4147
|
+
"dimensions",
|
|
4148
|
+
"lifecycleStages",
|
|
4149
|
+
"events",
|
|
4150
|
+
"datasets",
|
|
4151
|
+
"compatibleVisualizations",
|
|
4152
|
+
"defaultVisualization"
|
|
4153
|
+
],
|
|
4154
|
+
additionalProperties: false
|
|
4155
|
+
};
|
|
4156
|
+
var widgetItem = {
|
|
4157
|
+
type: "object",
|
|
4158
|
+
properties: {
|
|
4159
|
+
id: nonEmptyString2,
|
|
4160
|
+
version: nonEmptyString2,
|
|
4161
|
+
appId: nonEmptyString2,
|
|
4162
|
+
serviceName: nonEmptyString2,
|
|
4163
|
+
lastUpdated: nonEmptyString2,
|
|
4164
|
+
type: { enum: ["stats", "chart", "activity", "notifications", "actions"] },
|
|
4165
|
+
presentation: {
|
|
4166
|
+
type: "object",
|
|
4167
|
+
properties: {
|
|
4168
|
+
title: nonEmptyString2,
|
|
4169
|
+
description: nonEmptyString2,
|
|
4170
|
+
contexts: {
|
|
4171
|
+
type: "array",
|
|
4172
|
+
minItems: 1,
|
|
4173
|
+
items: { enum: ["personal", "organization", "workspace", "resource"] }
|
|
4174
|
+
},
|
|
4175
|
+
supportedSizes: {
|
|
4176
|
+
type: "array",
|
|
4177
|
+
minItems: 1,
|
|
4178
|
+
items: { enum: ["compact", "medium", "wide", "full"] }
|
|
4179
|
+
},
|
|
4180
|
+
defaultSize: { enum: ["compact", "medium", "wide", "full"] }
|
|
4181
|
+
},
|
|
4182
|
+
required: ["title", "contexts", "supportedSizes", "defaultSize"],
|
|
4183
|
+
additionalProperties: false
|
|
4184
|
+
},
|
|
4185
|
+
resource: {
|
|
4186
|
+
type: "object",
|
|
4187
|
+
properties: {
|
|
4188
|
+
resourceType: nonEmptyString2,
|
|
4189
|
+
resourceId: nonEmptyString2,
|
|
4190
|
+
requiredPermissions: stringArray3
|
|
4191
|
+
},
|
|
4192
|
+
required: ["resourceType", "requiredPermissions"],
|
|
4193
|
+
additionalProperties: false
|
|
4194
|
+
},
|
|
4195
|
+
state: {
|
|
4196
|
+
type: "object",
|
|
4197
|
+
properties: {
|
|
4198
|
+
status: { enum: ["ready", "empty", "unavailable", "stale", "error"] },
|
|
4199
|
+
observedAt: nonEmptyString2,
|
|
4200
|
+
lastSuccessfulAt: nonEmptyString2,
|
|
4201
|
+
code: nonEmptyString2,
|
|
4202
|
+
message: nonEmptyString2
|
|
4203
|
+
},
|
|
4204
|
+
required: ["status", "observedAt"],
|
|
4205
|
+
additionalProperties: false
|
|
4206
|
+
},
|
|
4207
|
+
refresh: {
|
|
4208
|
+
type: "object",
|
|
4209
|
+
properties: {
|
|
4210
|
+
intervalSeconds: { type: "number" },
|
|
4211
|
+
timeoutSeconds: { type: "number" },
|
|
4212
|
+
maxAgeSeconds: { type: "number" },
|
|
4213
|
+
staleWhileRevalidateSeconds: { type: "number" }
|
|
4214
|
+
},
|
|
4215
|
+
required: ["intervalSeconds", "timeoutSeconds", "maxAgeSeconds", "staleWhileRevalidateSeconds"],
|
|
4216
|
+
additionalProperties: false
|
|
4217
|
+
},
|
|
4218
|
+
configuration: {
|
|
4219
|
+
type: "object",
|
|
4220
|
+
properties: {
|
|
4221
|
+
allowMultipleInstances: { type: "boolean" },
|
|
4222
|
+
fields: {
|
|
4223
|
+
type: "array",
|
|
4224
|
+
items: {
|
|
4225
|
+
type: "object",
|
|
4226
|
+
properties: {
|
|
4227
|
+
key: nonEmptyString2,
|
|
4228
|
+
label: nonEmptyString2,
|
|
4229
|
+
type: { enum: ["string", "number", "boolean", "select", "multi-select", "date-range"] },
|
|
4230
|
+
required: { type: "boolean" },
|
|
4231
|
+
options: {
|
|
4232
|
+
type: "array",
|
|
4233
|
+
items: {
|
|
4234
|
+
type: "object",
|
|
4235
|
+
properties: { value: nonEmptyString2, label: nonEmptyString2 },
|
|
4236
|
+
required: ["value", "label"],
|
|
4237
|
+
additionalProperties: false
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
},
|
|
4241
|
+
required: ["key", "label", "type", "required"],
|
|
4242
|
+
additionalProperties: false
|
|
4243
|
+
}
|
|
4244
|
+
},
|
|
4245
|
+
defaults: { type: "object" }
|
|
4246
|
+
},
|
|
4247
|
+
required: ["allowMultipleInstances", "fields", "defaults"],
|
|
4248
|
+
additionalProperties: false
|
|
4249
|
+
},
|
|
4250
|
+
drilldowns: {
|
|
4251
|
+
type: "array",
|
|
4252
|
+
items: {
|
|
4253
|
+
type: "object",
|
|
4254
|
+
properties: { id: nonEmptyString2, label: nonEmptyString2, href: nonEmptyString2 },
|
|
4255
|
+
required: ["id", "label", "href"],
|
|
4256
|
+
additionalProperties: false
|
|
4257
|
+
}
|
|
4258
|
+
},
|
|
4259
|
+
controls: { type: "array", items: actionBinding },
|
|
4260
|
+
localization: {
|
|
4261
|
+
type: "object",
|
|
4262
|
+
properties: {
|
|
4263
|
+
locale: nonEmptyString2,
|
|
4264
|
+
titleKey: nonEmptyString2,
|
|
4265
|
+
descriptionKey: nonEmptyString2,
|
|
4266
|
+
title: nonEmptyString2,
|
|
4267
|
+
description: nonEmptyString2
|
|
4268
|
+
},
|
|
4269
|
+
required: ["locale", "titleKey"],
|
|
4270
|
+
additionalProperties: false
|
|
4271
|
+
},
|
|
4272
|
+
accessibility: {
|
|
4273
|
+
type: "object",
|
|
4274
|
+
properties: { label: nonEmptyString2, description: nonEmptyString2 },
|
|
4275
|
+
required: ["label"],
|
|
4276
|
+
additionalProperties: false
|
|
4277
|
+
},
|
|
4278
|
+
contribution,
|
|
4279
|
+
metrics: {
|
|
4280
|
+
type: "array",
|
|
4281
|
+
items: {
|
|
4282
|
+
type: "object",
|
|
4283
|
+
properties: {
|
|
4284
|
+
key: nonEmptyString2,
|
|
4285
|
+
label: nonEmptyString2,
|
|
4286
|
+
value: { type: "number" },
|
|
4287
|
+
unit: nonEmptyString2,
|
|
4288
|
+
semantic: {
|
|
4289
|
+
enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
|
|
4290
|
+
},
|
|
4291
|
+
aggregation: {
|
|
4292
|
+
enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
|
|
4293
|
+
},
|
|
4294
|
+
period,
|
|
4295
|
+
dimensions: { type: "array", items: dimension },
|
|
4296
|
+
series
|
|
4297
|
+
},
|
|
4298
|
+
required: ["key", "label", "value", "unit", "semantic", "aggregation", "period", "dimensions"],
|
|
4299
|
+
additionalProperties: false
|
|
4300
|
+
}
|
|
4301
|
+
},
|
|
4302
|
+
chartType: { enum: ["line", "bar", "area", "pie", "donut"] },
|
|
4303
|
+
series: { type: "array", items: series },
|
|
4304
|
+
activities: { type: "array", items: { type: "object" } },
|
|
4305
|
+
notifications: { type: "array", items: { type: "object" } },
|
|
4306
|
+
unreadCount: { type: "number" },
|
|
4307
|
+
actions: { type: "array", items: actionBinding }
|
|
4308
|
+
},
|
|
4309
|
+
required: [
|
|
4310
|
+
"id",
|
|
4311
|
+
"version",
|
|
4312
|
+
"appId",
|
|
4313
|
+
"serviceName",
|
|
4314
|
+
"lastUpdated",
|
|
4315
|
+
"type",
|
|
4316
|
+
"presentation",
|
|
4317
|
+
"resource",
|
|
4318
|
+
"state",
|
|
4319
|
+
"refresh",
|
|
4320
|
+
"configuration",
|
|
4321
|
+
"drilldowns",
|
|
4322
|
+
"controls",
|
|
4323
|
+
"localization",
|
|
4324
|
+
"accessibility",
|
|
4325
|
+
"contribution"
|
|
4326
|
+
],
|
|
4327
|
+
allOf: [
|
|
4328
|
+
{ if: { properties: { type: { const: "stats" } } }, then: { required: ["metrics"] } },
|
|
4329
|
+
{ if: { properties: { type: { const: "chart" } } }, then: { required: ["chartType", "series"] } },
|
|
4330
|
+
{ if: { properties: { type: { const: "activity" } } }, then: { required: ["activities"] } },
|
|
4331
|
+
{
|
|
4332
|
+
if: { properties: { type: { const: "notifications" } } },
|
|
4333
|
+
then: { required: ["notifications", "unreadCount"] }
|
|
4334
|
+
},
|
|
4335
|
+
{ if: { properties: { type: { const: "actions" } } }, then: { required: ["actions"] } }
|
|
4336
|
+
],
|
|
4337
|
+
additionalProperties: false
|
|
4338
|
+
};
|
|
4339
|
+
var TOPOLO_WIDGET_OUTPUT_SCHEMA = Object.freeze({
|
|
4340
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
4341
|
+
type: "object",
|
|
4342
|
+
properties: {
|
|
4343
|
+
success: { type: "boolean", const: true },
|
|
4344
|
+
contractVersion: { type: "string", const: "3.0.0" },
|
|
4345
|
+
appId: nonEmptyString2,
|
|
4346
|
+
serviceName: nonEmptyString2,
|
|
4347
|
+
generatedAt: nonEmptyString2,
|
|
4348
|
+
widgets: { type: "array", minItems: 1, items: widgetItem },
|
|
4349
|
+
workspace: {
|
|
4350
|
+
anyOf: [
|
|
4351
|
+
{
|
|
4352
|
+
type: "object",
|
|
4353
|
+
properties: {
|
|
4354
|
+
id: { anyOf: [{ type: "string" }, { type: "number" }] },
|
|
4355
|
+
name: nonEmptyString2
|
|
4356
|
+
},
|
|
4357
|
+
required: ["id", "name"],
|
|
4358
|
+
additionalProperties: true
|
|
4359
|
+
},
|
|
4360
|
+
{ type: "null" }
|
|
4361
|
+
]
|
|
4362
|
+
},
|
|
4363
|
+
workspaces: {
|
|
4364
|
+
type: "array",
|
|
4365
|
+
items: {
|
|
4366
|
+
type: "object",
|
|
4367
|
+
properties: {
|
|
4368
|
+
id: { anyOf: [{ type: "string" }, { type: "number" }] },
|
|
4369
|
+
name: nonEmptyString2,
|
|
4370
|
+
isDefault: { type: "boolean" }
|
|
4371
|
+
},
|
|
4372
|
+
required: ["id", "name"],
|
|
4373
|
+
additionalProperties: false
|
|
4374
|
+
}
|
|
4375
|
+
}
|
|
4376
|
+
},
|
|
4377
|
+
required: ["success", "contractVersion", "appId", "serviceName", "generatedAt", "widgets"],
|
|
4378
|
+
additionalProperties: false
|
|
4379
|
+
});
|
|
4380
|
+
function isTopoloWidgetOutputSchema(schema) {
|
|
4381
|
+
if (!isRecord6(schema) || !isRecord6(schema.properties)) return false;
|
|
4382
|
+
const properties = schema.properties;
|
|
4383
|
+
const widgetItemSchema = isRecord6(properties.widgets) && isRecord6(properties.widgets.items) ? properties.widgets.items : void 0;
|
|
4384
|
+
const widgetProperties = widgetItemSchema && isRecord6(widgetItemSchema.properties) ? widgetItemSchema.properties : void 0;
|
|
4385
|
+
const contributionSchema = widgetProperties && isRecord6(widgetProperties.contribution) ? widgetProperties.contribution : void 0;
|
|
4386
|
+
const contractVersion = isRecord6(properties.contractVersion) ? properties.contractVersion.const : void 0;
|
|
4387
|
+
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");
|
|
4388
|
+
}
|
|
4389
|
+
function isRecord6(value) {
|
|
4390
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4391
|
+
}
|
|
4392
|
+
function hasRequired(schema, field) {
|
|
4393
|
+
return isRecord6(schema) && Array.isArray(schema.required) && schema.required.includes(field);
|
|
4394
|
+
}
|
|
4395
|
+
|
|
3924
4396
|
// src/index.ts
|
|
3925
4397
|
function createTopolo(options) {
|
|
3926
4398
|
const client = new TopoloClient(options);
|
|
@@ -3941,6 +4413,7 @@ export {
|
|
|
3941
4413
|
TOPOLO_RUNTIME_ENVIRONMENTS,
|
|
3942
4414
|
TOPOLO_WIDGET_CONTRACT_VERSION,
|
|
3943
4415
|
TOPOLO_WIDGET_ENDPOINT,
|
|
4416
|
+
TOPOLO_WIDGET_OUTPUT_SCHEMA,
|
|
3944
4417
|
TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
|
|
3945
4418
|
TopoloAuthError,
|
|
3946
4419
|
TopoloClient,
|
|
@@ -3978,6 +4451,7 @@ export {
|
|
|
3978
4451
|
extractTopoloServiceErrorDetails,
|
|
3979
4452
|
formatDirectoryApplicationIds,
|
|
3980
4453
|
friendlyAppId,
|
|
4454
|
+
isTopoloWidgetOutputSchema,
|
|
3981
4455
|
listApplicationDirectory,
|
|
3982
4456
|
parseTopoloActionUploadContract,
|
|
3983
4457
|
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.3",
|
|
4
|
+
"topoloPublishedVersion": "0.14.3",
|
|
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",
|