@topolo/sdk 0.14.0 → 0.14.1

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 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,
@@ -3701,22 +3703,22 @@ function validateRuntimeSemantics(widget, contributionPath, declared, errors) {
3701
3703
  validateSeriesDimensions(metric.series, declared.dimensionKeys, contributionPath, errors);
3702
3704
  }
3703
3705
  }
3704
- const series = Array.isArray(widget.series) ? widget.series : [];
3705
- for (const item of series) {
3706
+ const series2 = Array.isArray(widget.series) ? widget.series : [];
3707
+ for (const item of series2) {
3706
3708
  if (!isRecord5(item)) continue;
3707
3709
  if (typeof item.id === "string" && !declared.seriesKeys.has(item.id)) errors.push(`${contributionPath}.seriesDefinitions is missing runtime series ${item.id}`);
3708
3710
  validateSeriesDimensions(item, declared.dimensionKeys, contributionPath, errors);
3709
3711
  }
3710
3712
  }
3711
- function validateSeriesDimensions(series, known, path, errors) {
3712
- if (!Array.isArray(series.points)) return;
3713
- for (const point of series.points) if (isRecord5(point)) validateRuntimeDimensions(point.dimensions, known, path, errors);
3713
+ function validateSeriesDimensions(series2, known, path, errors) {
3714
+ if (!Array.isArray(series2.points)) return;
3715
+ for (const point of series2.points) if (isRecord5(point)) validateRuntimeDimensions(point.dimensions, known, path, errors);
3714
3716
  }
3715
3717
  function validateRuntimeDimensions(value, known, path, errors) {
3716
3718
  if (!Array.isArray(value)) return;
3717
- for (const dimension of value) {
3718
- if (isRecord5(dimension) && typeof dimension.key === "string" && !known.has(dimension.key)) {
3719
- errors.push(`${path}.dimensions is missing runtime dimension ${dimension.key}`);
3719
+ for (const dimension2 of value) {
3720
+ if (isRecord5(dimension2) && typeof dimension2.key === "string" && !known.has(dimension2.key)) {
3721
+ errors.push(`${path}.dimensions is missing runtime dimension ${dimension2.key}`);
3720
3722
  }
3721
3723
  }
3722
3724
  }
@@ -3753,12 +3755,12 @@ function validatePeriod(value, path, errors) {
3753
3755
  }
3754
3756
  function validateDimensions(value, path, errors) {
3755
3757
  if (!arrayValue(value, path, errors)) return;
3756
- value.forEach((dimension, index) => {
3758
+ value.forEach((dimension2, index) => {
3757
3759
  const itemPath = `${path}[${index}]`;
3758
- if (!recordValue(dimension, itemPath, errors)) return;
3759
- nonEmptyString(dimension.key, `${itemPath}.key`, errors);
3760
- nonEmptyString(dimension.label, `${itemPath}.label`, errors);
3761
- nonEmptyString(dimension.value, `${itemPath}.value`, errors);
3760
+ if (!recordValue(dimension2, itemPath, errors)) return;
3761
+ nonEmptyString(dimension2.key, `${itemPath}.key`, errors);
3762
+ nonEmptyString(dimension2.label, `${itemPath}.label`, errors);
3763
+ nonEmptyString(dimension2.value, `${itemPath}.value`, errors);
3762
3764
  });
3763
3765
  }
3764
3766
  function validateComparison(value, path, errors) {
@@ -3772,7 +3774,7 @@ function validateComparison(value, path, errors) {
3772
3774
  }
3773
3775
  function validateSeriesCollection(value, path, errors, requireOne) {
3774
3776
  if (!arrayValue(value, path, errors, requireOne)) return;
3775
- value.forEach((series, index) => validateSeries(series, `${path}[${index}]`, errors));
3777
+ value.forEach((series2, index) => validateSeries(series2, `${path}[${index}]`, errors));
3776
3778
  }
3777
3779
  function validateSeries(value, path, errors) {
3778
3780
  if (!recordValue(value, path, errors)) return;
@@ -3970,6 +3972,478 @@ function toIsoTimestamp(input) {
3970
3972
  return input ?? (/* @__PURE__ */ new Date()).toISOString();
3971
3973
  }
3972
3974
 
3975
+ // src/widget-output-schema.ts
3976
+ var nonEmptyString2 = { type: "string", minLength: 1 };
3977
+ var stringArray3 = { type: "array", items: nonEmptyString2 };
3978
+ var actionBinding = {
3979
+ type: "object",
3980
+ properties: {
3981
+ id: nonEmptyString2,
3982
+ label: nonEmptyString2,
3983
+ actionId: nonEmptyString2,
3984
+ resourceType: nonEmptyString2,
3985
+ resourceId: nonEmptyString2,
3986
+ input: { type: "object" },
3987
+ requiresConfirmation: { type: "boolean" },
3988
+ destructive: { type: "boolean" },
3989
+ effects: stringArray3,
3990
+ verification: stringArray3,
3991
+ recovery: {
3992
+ type: "object",
3993
+ properties: {
3994
+ mode: { enum: ["not_applicable", "retry", "compensating_action"] },
3995
+ actionId: nonEmptyString2,
3996
+ instructions: nonEmptyString2
3997
+ },
3998
+ required: ["mode", "instructions"],
3999
+ additionalProperties: false
4000
+ }
4001
+ },
4002
+ required: [
4003
+ "id",
4004
+ "label",
4005
+ "actionId",
4006
+ "resourceType",
4007
+ "input",
4008
+ "requiresConfirmation",
4009
+ "destructive",
4010
+ "effects",
4011
+ "verification",
4012
+ "recovery"
4013
+ ],
4014
+ additionalProperties: false
4015
+ };
4016
+ var dimension = {
4017
+ type: "object",
4018
+ properties: { key: nonEmptyString2, label: nonEmptyString2, value: nonEmptyString2 },
4019
+ required: ["key", "label", "value"],
4020
+ additionalProperties: false
4021
+ };
4022
+ var period = {
4023
+ type: "object",
4024
+ properties: {
4025
+ start: nonEmptyString2,
4026
+ end: nonEmptyString2,
4027
+ timezone: nonEmptyString2
4028
+ },
4029
+ required: ["start", "end", "timezone"],
4030
+ additionalProperties: false
4031
+ };
4032
+ var series = {
4033
+ type: "object",
4034
+ properties: {
4035
+ id: nonEmptyString2,
4036
+ label: nonEmptyString2,
4037
+ unit: nonEmptyString2,
4038
+ points: {
4039
+ type: "array",
4040
+ items: {
4041
+ type: "object",
4042
+ properties: {
4043
+ timestamp: nonEmptyString2,
4044
+ value: { type: "number" },
4045
+ dimensions: { type: "array", items: dimension }
4046
+ },
4047
+ required: ["timestamp", "value", "dimensions"],
4048
+ additionalProperties: false
4049
+ }
4050
+ }
4051
+ },
4052
+ required: ["id", "label", "unit", "points"],
4053
+ additionalProperties: false
4054
+ };
4055
+ var contribution = {
4056
+ type: "object",
4057
+ properties: {
4058
+ summary: nonEmptyString2,
4059
+ identity: {
4060
+ type: "object",
4061
+ properties: { iconSource: { const: "catalog" } },
4062
+ required: ["iconSource"],
4063
+ additionalProperties: false
4064
+ },
4065
+ workspaceSelector: {
4066
+ type: "object",
4067
+ properties: {
4068
+ mode: { enum: ["none", "optional", "required"] },
4069
+ resourceType: nonEmptyString2,
4070
+ label: nonEmptyString2,
4071
+ supportsMultiple: { type: "boolean" }
4072
+ },
4073
+ required: ["mode", "resourceType", "label", "supportsMultiple"],
4074
+ additionalProperties: false
4075
+ },
4076
+ metricDefinitions: {
4077
+ type: "array",
4078
+ items: {
4079
+ type: "object",
4080
+ properties: {
4081
+ key: nonEmptyString2,
4082
+ label: nonEmptyString2,
4083
+ description: nonEmptyString2,
4084
+ unit: nonEmptyString2,
4085
+ semantic: {
4086
+ enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
4087
+ },
4088
+ aggregation: {
4089
+ enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
4090
+ }
4091
+ },
4092
+ required: ["key", "label", "description", "unit", "semantic", "aggregation"],
4093
+ additionalProperties: false
4094
+ }
4095
+ },
4096
+ seriesDefinitions: {
4097
+ type: "array",
4098
+ items: {
4099
+ type: "object",
4100
+ properties: {
4101
+ key: nonEmptyString2,
4102
+ label: nonEmptyString2,
4103
+ metricKey: nonEmptyString2,
4104
+ unit: nonEmptyString2
4105
+ },
4106
+ required: ["key", "label", "metricKey", "unit"],
4107
+ additionalProperties: false
4108
+ }
4109
+ },
4110
+ dimensions: {
4111
+ type: "array",
4112
+ items: {
4113
+ type: "object",
4114
+ properties: {
4115
+ key: nonEmptyString2,
4116
+ label: nonEmptyString2,
4117
+ description: nonEmptyString2,
4118
+ valueType: { enum: ["string", "number", "boolean", "date", "datetime"] }
4119
+ },
4120
+ required: ["key", "label", "description", "valueType"],
4121
+ additionalProperties: false
4122
+ }
4123
+ },
4124
+ lifecycleStages: {
4125
+ type: "array",
4126
+ items: {
4127
+ type: "object",
4128
+ properties: {
4129
+ key: nonEmptyString2,
4130
+ label: nonEmptyString2,
4131
+ order: { type: "number" },
4132
+ terminal: { type: "boolean" }
4133
+ },
4134
+ required: ["key", "label", "order", "terminal"],
4135
+ additionalProperties: false
4136
+ }
4137
+ },
4138
+ events: {
4139
+ type: "array",
4140
+ items: {
4141
+ type: "object",
4142
+ properties: {
4143
+ key: nonEmptyString2,
4144
+ label: nonEmptyString2,
4145
+ description: nonEmptyString2
4146
+ },
4147
+ required: ["key", "label", "description"],
4148
+ additionalProperties: false
4149
+ }
4150
+ },
4151
+ datasets: {
4152
+ type: "array",
4153
+ minItems: 1,
4154
+ items: {
4155
+ type: "object",
4156
+ properties: {
4157
+ id: nonEmptyString2,
4158
+ label: nonEmptyString2,
4159
+ description: nonEmptyString2,
4160
+ grain: nonEmptyString2,
4161
+ metricKeys: stringArray3,
4162
+ seriesKeys: stringArray3,
4163
+ dimensionKeys: stringArray3,
4164
+ eventKeys: stringArray3,
4165
+ actionIds: stringArray3
4166
+ },
4167
+ required: [
4168
+ "id",
4169
+ "label",
4170
+ "description",
4171
+ "grain",
4172
+ "metricKeys",
4173
+ "seriesKeys",
4174
+ "dimensionKeys",
4175
+ "eventKeys",
4176
+ "actionIds"
4177
+ ],
4178
+ additionalProperties: false
4179
+ }
4180
+ },
4181
+ compatibleVisualizations: {
4182
+ type: "array",
4183
+ minItems: 1,
4184
+ items: {
4185
+ enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
4186
+ }
4187
+ },
4188
+ defaultVisualization: {
4189
+ enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
4190
+ }
4191
+ },
4192
+ required: [
4193
+ "summary",
4194
+ "identity",
4195
+ "workspaceSelector",
4196
+ "metricDefinitions",
4197
+ "seriesDefinitions",
4198
+ "dimensions",
4199
+ "lifecycleStages",
4200
+ "events",
4201
+ "datasets",
4202
+ "compatibleVisualizations",
4203
+ "defaultVisualization"
4204
+ ],
4205
+ additionalProperties: false
4206
+ };
4207
+ var widgetItem = {
4208
+ type: "object",
4209
+ properties: {
4210
+ id: nonEmptyString2,
4211
+ version: nonEmptyString2,
4212
+ appId: nonEmptyString2,
4213
+ serviceName: nonEmptyString2,
4214
+ lastUpdated: nonEmptyString2,
4215
+ type: { enum: ["stats", "chart", "activity", "notifications", "actions"] },
4216
+ presentation: {
4217
+ type: "object",
4218
+ properties: {
4219
+ title: nonEmptyString2,
4220
+ description: nonEmptyString2,
4221
+ contexts: {
4222
+ type: "array",
4223
+ minItems: 1,
4224
+ items: { enum: ["personal", "organization", "workspace", "resource"] }
4225
+ },
4226
+ supportedSizes: {
4227
+ type: "array",
4228
+ minItems: 1,
4229
+ items: { enum: ["compact", "medium", "wide", "full"] }
4230
+ },
4231
+ defaultSize: { enum: ["compact", "medium", "wide", "full"] }
4232
+ },
4233
+ required: ["title", "contexts", "supportedSizes", "defaultSize"],
4234
+ additionalProperties: false
4235
+ },
4236
+ resource: {
4237
+ type: "object",
4238
+ properties: {
4239
+ resourceType: nonEmptyString2,
4240
+ resourceId: nonEmptyString2,
4241
+ requiredPermissions: stringArray3
4242
+ },
4243
+ required: ["resourceType", "requiredPermissions"],
4244
+ additionalProperties: false
4245
+ },
4246
+ state: {
4247
+ type: "object",
4248
+ properties: {
4249
+ status: { enum: ["ready", "empty", "unavailable", "stale", "error"] },
4250
+ observedAt: nonEmptyString2,
4251
+ lastSuccessfulAt: nonEmptyString2,
4252
+ code: nonEmptyString2,
4253
+ message: nonEmptyString2
4254
+ },
4255
+ required: ["status", "observedAt"],
4256
+ additionalProperties: false
4257
+ },
4258
+ refresh: {
4259
+ type: "object",
4260
+ properties: {
4261
+ intervalSeconds: { type: "number" },
4262
+ timeoutSeconds: { type: "number" },
4263
+ maxAgeSeconds: { type: "number" },
4264
+ staleWhileRevalidateSeconds: { type: "number" }
4265
+ },
4266
+ required: ["intervalSeconds", "timeoutSeconds", "maxAgeSeconds", "staleWhileRevalidateSeconds"],
4267
+ additionalProperties: false
4268
+ },
4269
+ configuration: {
4270
+ type: "object",
4271
+ properties: {
4272
+ allowMultipleInstances: { type: "boolean" },
4273
+ fields: {
4274
+ type: "array",
4275
+ items: {
4276
+ type: "object",
4277
+ properties: {
4278
+ key: nonEmptyString2,
4279
+ label: nonEmptyString2,
4280
+ type: { enum: ["string", "number", "boolean", "select", "multi-select", "date-range"] },
4281
+ required: { type: "boolean" },
4282
+ options: {
4283
+ type: "array",
4284
+ items: {
4285
+ type: "object",
4286
+ properties: { value: nonEmptyString2, label: nonEmptyString2 },
4287
+ required: ["value", "label"],
4288
+ additionalProperties: false
4289
+ }
4290
+ }
4291
+ },
4292
+ required: ["key", "label", "type", "required"],
4293
+ additionalProperties: false
4294
+ }
4295
+ },
4296
+ defaults: { type: "object" }
4297
+ },
4298
+ required: ["allowMultipleInstances", "fields", "defaults"],
4299
+ additionalProperties: false
4300
+ },
4301
+ drilldowns: {
4302
+ type: "array",
4303
+ items: {
4304
+ type: "object",
4305
+ properties: { id: nonEmptyString2, label: nonEmptyString2, href: nonEmptyString2 },
4306
+ required: ["id", "label", "href"],
4307
+ additionalProperties: false
4308
+ }
4309
+ },
4310
+ controls: { type: "array", items: actionBinding },
4311
+ localization: {
4312
+ type: "object",
4313
+ properties: {
4314
+ locale: nonEmptyString2,
4315
+ titleKey: nonEmptyString2,
4316
+ descriptionKey: nonEmptyString2,
4317
+ title: nonEmptyString2,
4318
+ description: nonEmptyString2
4319
+ },
4320
+ required: ["locale", "titleKey"],
4321
+ additionalProperties: false
4322
+ },
4323
+ accessibility: {
4324
+ type: "object",
4325
+ properties: { label: nonEmptyString2, description: nonEmptyString2 },
4326
+ required: ["label"],
4327
+ additionalProperties: false
4328
+ },
4329
+ contribution,
4330
+ metrics: {
4331
+ type: "array",
4332
+ items: {
4333
+ type: "object",
4334
+ properties: {
4335
+ key: nonEmptyString2,
4336
+ label: nonEmptyString2,
4337
+ value: { type: "number" },
4338
+ unit: nonEmptyString2,
4339
+ semantic: {
4340
+ enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
4341
+ },
4342
+ aggregation: {
4343
+ enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
4344
+ },
4345
+ period,
4346
+ dimensions: { type: "array", items: dimension },
4347
+ series
4348
+ },
4349
+ required: ["key", "label", "value", "unit", "semantic", "aggregation", "period", "dimensions"],
4350
+ additionalProperties: false
4351
+ }
4352
+ },
4353
+ chartType: { enum: ["line", "bar", "area", "pie", "donut"] },
4354
+ series: { type: "array", items: series },
4355
+ activities: { type: "array", items: { type: "object" } },
4356
+ notifications: { type: "array", items: { type: "object" } },
4357
+ unreadCount: { type: "number" },
4358
+ actions: { type: "array", items: actionBinding }
4359
+ },
4360
+ required: [
4361
+ "id",
4362
+ "version",
4363
+ "appId",
4364
+ "serviceName",
4365
+ "lastUpdated",
4366
+ "type",
4367
+ "presentation",
4368
+ "resource",
4369
+ "state",
4370
+ "refresh",
4371
+ "configuration",
4372
+ "drilldowns",
4373
+ "controls",
4374
+ "localization",
4375
+ "accessibility",
4376
+ "contribution"
4377
+ ],
4378
+ allOf: [
4379
+ { if: { properties: { type: { const: "stats" } } }, then: { required: ["metrics"] } },
4380
+ { if: { properties: { type: { const: "chart" } } }, then: { required: ["chartType", "series"] } },
4381
+ { if: { properties: { type: { const: "activity" } } }, then: { required: ["activities"] } },
4382
+ {
4383
+ if: { properties: { type: { const: "notifications" } } },
4384
+ then: { required: ["notifications", "unreadCount"] }
4385
+ },
4386
+ { if: { properties: { type: { const: "actions" } } }, then: { required: ["actions"] } }
4387
+ ],
4388
+ additionalProperties: false
4389
+ };
4390
+ var TOPOLO_WIDGET_OUTPUT_SCHEMA = Object.freeze({
4391
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4392
+ type: "object",
4393
+ properties: {
4394
+ success: { type: "boolean", const: true },
4395
+ contractVersion: { type: "string", const: "3.0.0" },
4396
+ appId: nonEmptyString2,
4397
+ serviceName: nonEmptyString2,
4398
+ generatedAt: nonEmptyString2,
4399
+ widgets: { type: "array", minItems: 1, items: widgetItem },
4400
+ workspace: {
4401
+ anyOf: [
4402
+ {
4403
+ type: "object",
4404
+ properties: {
4405
+ id: { anyOf: [{ type: "string" }, { type: "number" }] },
4406
+ name: nonEmptyString2
4407
+ },
4408
+ required: ["id", "name"],
4409
+ additionalProperties: true
4410
+ },
4411
+ { type: "null" }
4412
+ ]
4413
+ },
4414
+ workspaces: {
4415
+ type: "array",
4416
+ items: {
4417
+ type: "object",
4418
+ properties: {
4419
+ id: { anyOf: [{ type: "string" }, { type: "number" }] },
4420
+ name: nonEmptyString2,
4421
+ isDefault: { type: "boolean" }
4422
+ },
4423
+ required: ["id", "name"],
4424
+ additionalProperties: false
4425
+ }
4426
+ }
4427
+ },
4428
+ required: ["success", "contractVersion", "appId", "serviceName", "generatedAt", "widgets"],
4429
+ additionalProperties: false
4430
+ });
4431
+ function isTopoloWidgetOutputSchema(schema) {
4432
+ if (!isRecord6(schema) || !isRecord6(schema.properties)) return false;
4433
+ const properties = schema.properties;
4434
+ const widgetItemSchema = isRecord6(properties.widgets) && isRecord6(properties.widgets.items) ? properties.widgets.items : void 0;
4435
+ const widgetProperties = widgetItemSchema && isRecord6(widgetItemSchema.properties) ? widgetItemSchema.properties : void 0;
4436
+ const contributionSchema = widgetProperties && isRecord6(widgetProperties.contribution) ? widgetProperties.contribution : void 0;
4437
+ const contractVersion = isRecord6(properties.contractVersion) ? properties.contractVersion.const : void 0;
4438
+ 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");
4439
+ }
4440
+ function isRecord6(value) {
4441
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4442
+ }
4443
+ function hasRequired(schema, field) {
4444
+ return isRecord6(schema) && Array.isArray(schema.required) && schema.required.includes(field);
4445
+ }
4446
+
3973
4447
  // src/index.ts
3974
4448
  function createTopolo(options) {
3975
4449
  const client = new TopoloClient(options);
@@ -3991,6 +4465,7 @@ function createTopolo(options) {
3991
4465
  TOPOLO_RUNTIME_ENVIRONMENTS,
3992
4466
  TOPOLO_WIDGET_CONTRACT_VERSION,
3993
4467
  TOPOLO_WIDGET_ENDPOINT,
4468
+ TOPOLO_WIDGET_OUTPUT_SCHEMA,
3994
4469
  TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
3995
4470
  TopoloAuthError,
3996
4471
  TopoloClient,
@@ -4028,6 +4503,7 @@ function createTopolo(options) {
4028
4503
  extractTopoloServiceErrorDetails,
4029
4504
  formatDirectoryApplicationIds,
4030
4505
  friendlyAppId,
4506
+ isTopoloWidgetOutputSchema,
4031
4507
  listApplicationDirectory,
4032
4508
  parseTopoloActionUploadContract,
4033
4509
  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
@@ -3617,22 +3617,22 @@ function validateRuntimeSemantics(widget, contributionPath, declared, errors) {
3617
3617
  validateSeriesDimensions(metric.series, declared.dimensionKeys, contributionPath, errors);
3618
3618
  }
3619
3619
  }
3620
- const series = Array.isArray(widget.series) ? widget.series : [];
3621
- for (const item of series) {
3620
+ const series2 = Array.isArray(widget.series) ? widget.series : [];
3621
+ for (const item of series2) {
3622
3622
  if (!isRecord5(item)) continue;
3623
3623
  if (typeof item.id === "string" && !declared.seriesKeys.has(item.id)) errors.push(`${contributionPath}.seriesDefinitions is missing runtime series ${item.id}`);
3624
3624
  validateSeriesDimensions(item, declared.dimensionKeys, contributionPath, errors);
3625
3625
  }
3626
3626
  }
3627
- function validateSeriesDimensions(series, known, path, errors) {
3628
- if (!Array.isArray(series.points)) return;
3629
- for (const point of series.points) if (isRecord5(point)) validateRuntimeDimensions(point.dimensions, known, path, errors);
3627
+ function validateSeriesDimensions(series2, known, path, errors) {
3628
+ if (!Array.isArray(series2.points)) return;
3629
+ for (const point of series2.points) if (isRecord5(point)) validateRuntimeDimensions(point.dimensions, known, path, errors);
3630
3630
  }
3631
3631
  function validateRuntimeDimensions(value, known, path, errors) {
3632
3632
  if (!Array.isArray(value)) return;
3633
- for (const dimension of value) {
3634
- if (isRecord5(dimension) && typeof dimension.key === "string" && !known.has(dimension.key)) {
3635
- errors.push(`${path}.dimensions is missing runtime dimension ${dimension.key}`);
3633
+ for (const dimension2 of value) {
3634
+ if (isRecord5(dimension2) && typeof dimension2.key === "string" && !known.has(dimension2.key)) {
3635
+ errors.push(`${path}.dimensions is missing runtime dimension ${dimension2.key}`);
3636
3636
  }
3637
3637
  }
3638
3638
  }
@@ -3669,12 +3669,12 @@ function validatePeriod(value, path, errors) {
3669
3669
  }
3670
3670
  function validateDimensions(value, path, errors) {
3671
3671
  if (!arrayValue(value, path, errors)) return;
3672
- value.forEach((dimension, index) => {
3672
+ value.forEach((dimension2, index) => {
3673
3673
  const itemPath = `${path}[${index}]`;
3674
- if (!recordValue(dimension, itemPath, errors)) return;
3675
- nonEmptyString(dimension.key, `${itemPath}.key`, errors);
3676
- nonEmptyString(dimension.label, `${itemPath}.label`, errors);
3677
- nonEmptyString(dimension.value, `${itemPath}.value`, errors);
3674
+ if (!recordValue(dimension2, itemPath, errors)) return;
3675
+ nonEmptyString(dimension2.key, `${itemPath}.key`, errors);
3676
+ nonEmptyString(dimension2.label, `${itemPath}.label`, errors);
3677
+ nonEmptyString(dimension2.value, `${itemPath}.value`, errors);
3678
3678
  });
3679
3679
  }
3680
3680
  function validateComparison(value, path, errors) {
@@ -3688,7 +3688,7 @@ function validateComparison(value, path, errors) {
3688
3688
  }
3689
3689
  function validateSeriesCollection(value, path, errors, requireOne) {
3690
3690
  if (!arrayValue(value, path, errors, requireOne)) return;
3691
- value.forEach((series, index) => validateSeries(series, `${path}[${index}]`, errors));
3691
+ value.forEach((series2, index) => validateSeries(series2, `${path}[${index}]`, errors));
3692
3692
  }
3693
3693
  function validateSeries(value, path, errors) {
3694
3694
  if (!recordValue(value, path, errors)) return;
@@ -3886,6 +3886,478 @@ function toIsoTimestamp(input) {
3886
3886
  return input ?? (/* @__PURE__ */ new Date()).toISOString();
3887
3887
  }
3888
3888
 
3889
+ // src/widget-output-schema.ts
3890
+ var nonEmptyString2 = { type: "string", minLength: 1 };
3891
+ var stringArray3 = { type: "array", items: nonEmptyString2 };
3892
+ var actionBinding = {
3893
+ type: "object",
3894
+ properties: {
3895
+ id: nonEmptyString2,
3896
+ label: nonEmptyString2,
3897
+ actionId: nonEmptyString2,
3898
+ resourceType: nonEmptyString2,
3899
+ resourceId: nonEmptyString2,
3900
+ input: { type: "object" },
3901
+ requiresConfirmation: { type: "boolean" },
3902
+ destructive: { type: "boolean" },
3903
+ effects: stringArray3,
3904
+ verification: stringArray3,
3905
+ recovery: {
3906
+ type: "object",
3907
+ properties: {
3908
+ mode: { enum: ["not_applicable", "retry", "compensating_action"] },
3909
+ actionId: nonEmptyString2,
3910
+ instructions: nonEmptyString2
3911
+ },
3912
+ required: ["mode", "instructions"],
3913
+ additionalProperties: false
3914
+ }
3915
+ },
3916
+ required: [
3917
+ "id",
3918
+ "label",
3919
+ "actionId",
3920
+ "resourceType",
3921
+ "input",
3922
+ "requiresConfirmation",
3923
+ "destructive",
3924
+ "effects",
3925
+ "verification",
3926
+ "recovery"
3927
+ ],
3928
+ additionalProperties: false
3929
+ };
3930
+ var dimension = {
3931
+ type: "object",
3932
+ properties: { key: nonEmptyString2, label: nonEmptyString2, value: nonEmptyString2 },
3933
+ required: ["key", "label", "value"],
3934
+ additionalProperties: false
3935
+ };
3936
+ var period = {
3937
+ type: "object",
3938
+ properties: {
3939
+ start: nonEmptyString2,
3940
+ end: nonEmptyString2,
3941
+ timezone: nonEmptyString2
3942
+ },
3943
+ required: ["start", "end", "timezone"],
3944
+ additionalProperties: false
3945
+ };
3946
+ var series = {
3947
+ type: "object",
3948
+ properties: {
3949
+ id: nonEmptyString2,
3950
+ label: nonEmptyString2,
3951
+ unit: nonEmptyString2,
3952
+ points: {
3953
+ type: "array",
3954
+ items: {
3955
+ type: "object",
3956
+ properties: {
3957
+ timestamp: nonEmptyString2,
3958
+ value: { type: "number" },
3959
+ dimensions: { type: "array", items: dimension }
3960
+ },
3961
+ required: ["timestamp", "value", "dimensions"],
3962
+ additionalProperties: false
3963
+ }
3964
+ }
3965
+ },
3966
+ required: ["id", "label", "unit", "points"],
3967
+ additionalProperties: false
3968
+ };
3969
+ var contribution = {
3970
+ type: "object",
3971
+ properties: {
3972
+ summary: nonEmptyString2,
3973
+ identity: {
3974
+ type: "object",
3975
+ properties: { iconSource: { const: "catalog" } },
3976
+ required: ["iconSource"],
3977
+ additionalProperties: false
3978
+ },
3979
+ workspaceSelector: {
3980
+ type: "object",
3981
+ properties: {
3982
+ mode: { enum: ["none", "optional", "required"] },
3983
+ resourceType: nonEmptyString2,
3984
+ label: nonEmptyString2,
3985
+ supportsMultiple: { type: "boolean" }
3986
+ },
3987
+ required: ["mode", "resourceType", "label", "supportsMultiple"],
3988
+ additionalProperties: false
3989
+ },
3990
+ metricDefinitions: {
3991
+ type: "array",
3992
+ items: {
3993
+ type: "object",
3994
+ properties: {
3995
+ key: nonEmptyString2,
3996
+ label: nonEmptyString2,
3997
+ description: nonEmptyString2,
3998
+ unit: nonEmptyString2,
3999
+ semantic: {
4000
+ enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
4001
+ },
4002
+ aggregation: {
4003
+ enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
4004
+ }
4005
+ },
4006
+ required: ["key", "label", "description", "unit", "semantic", "aggregation"],
4007
+ additionalProperties: false
4008
+ }
4009
+ },
4010
+ seriesDefinitions: {
4011
+ type: "array",
4012
+ items: {
4013
+ type: "object",
4014
+ properties: {
4015
+ key: nonEmptyString2,
4016
+ label: nonEmptyString2,
4017
+ metricKey: nonEmptyString2,
4018
+ unit: nonEmptyString2
4019
+ },
4020
+ required: ["key", "label", "metricKey", "unit"],
4021
+ additionalProperties: false
4022
+ }
4023
+ },
4024
+ dimensions: {
4025
+ type: "array",
4026
+ items: {
4027
+ type: "object",
4028
+ properties: {
4029
+ key: nonEmptyString2,
4030
+ label: nonEmptyString2,
4031
+ description: nonEmptyString2,
4032
+ valueType: { enum: ["string", "number", "boolean", "date", "datetime"] }
4033
+ },
4034
+ required: ["key", "label", "description", "valueType"],
4035
+ additionalProperties: false
4036
+ }
4037
+ },
4038
+ lifecycleStages: {
4039
+ type: "array",
4040
+ items: {
4041
+ type: "object",
4042
+ properties: {
4043
+ key: nonEmptyString2,
4044
+ label: nonEmptyString2,
4045
+ order: { type: "number" },
4046
+ terminal: { type: "boolean" }
4047
+ },
4048
+ required: ["key", "label", "order", "terminal"],
4049
+ additionalProperties: false
4050
+ }
4051
+ },
4052
+ events: {
4053
+ type: "array",
4054
+ items: {
4055
+ type: "object",
4056
+ properties: {
4057
+ key: nonEmptyString2,
4058
+ label: nonEmptyString2,
4059
+ description: nonEmptyString2
4060
+ },
4061
+ required: ["key", "label", "description"],
4062
+ additionalProperties: false
4063
+ }
4064
+ },
4065
+ datasets: {
4066
+ type: "array",
4067
+ minItems: 1,
4068
+ items: {
4069
+ type: "object",
4070
+ properties: {
4071
+ id: nonEmptyString2,
4072
+ label: nonEmptyString2,
4073
+ description: nonEmptyString2,
4074
+ grain: nonEmptyString2,
4075
+ metricKeys: stringArray3,
4076
+ seriesKeys: stringArray3,
4077
+ dimensionKeys: stringArray3,
4078
+ eventKeys: stringArray3,
4079
+ actionIds: stringArray3
4080
+ },
4081
+ required: [
4082
+ "id",
4083
+ "label",
4084
+ "description",
4085
+ "grain",
4086
+ "metricKeys",
4087
+ "seriesKeys",
4088
+ "dimensionKeys",
4089
+ "eventKeys",
4090
+ "actionIds"
4091
+ ],
4092
+ additionalProperties: false
4093
+ }
4094
+ },
4095
+ compatibleVisualizations: {
4096
+ type: "array",
4097
+ minItems: 1,
4098
+ items: {
4099
+ enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
4100
+ }
4101
+ },
4102
+ defaultVisualization: {
4103
+ enum: ["number", "line", "area", "bar", "donut", "table", "funnel", "timeline", "actions"]
4104
+ }
4105
+ },
4106
+ required: [
4107
+ "summary",
4108
+ "identity",
4109
+ "workspaceSelector",
4110
+ "metricDefinitions",
4111
+ "seriesDefinitions",
4112
+ "dimensions",
4113
+ "lifecycleStages",
4114
+ "events",
4115
+ "datasets",
4116
+ "compatibleVisualizations",
4117
+ "defaultVisualization"
4118
+ ],
4119
+ additionalProperties: false
4120
+ };
4121
+ var widgetItem = {
4122
+ type: "object",
4123
+ properties: {
4124
+ id: nonEmptyString2,
4125
+ version: nonEmptyString2,
4126
+ appId: nonEmptyString2,
4127
+ serviceName: nonEmptyString2,
4128
+ lastUpdated: nonEmptyString2,
4129
+ type: { enum: ["stats", "chart", "activity", "notifications", "actions"] },
4130
+ presentation: {
4131
+ type: "object",
4132
+ properties: {
4133
+ title: nonEmptyString2,
4134
+ description: nonEmptyString2,
4135
+ contexts: {
4136
+ type: "array",
4137
+ minItems: 1,
4138
+ items: { enum: ["personal", "organization", "workspace", "resource"] }
4139
+ },
4140
+ supportedSizes: {
4141
+ type: "array",
4142
+ minItems: 1,
4143
+ items: { enum: ["compact", "medium", "wide", "full"] }
4144
+ },
4145
+ defaultSize: { enum: ["compact", "medium", "wide", "full"] }
4146
+ },
4147
+ required: ["title", "contexts", "supportedSizes", "defaultSize"],
4148
+ additionalProperties: false
4149
+ },
4150
+ resource: {
4151
+ type: "object",
4152
+ properties: {
4153
+ resourceType: nonEmptyString2,
4154
+ resourceId: nonEmptyString2,
4155
+ requiredPermissions: stringArray3
4156
+ },
4157
+ required: ["resourceType", "requiredPermissions"],
4158
+ additionalProperties: false
4159
+ },
4160
+ state: {
4161
+ type: "object",
4162
+ properties: {
4163
+ status: { enum: ["ready", "empty", "unavailable", "stale", "error"] },
4164
+ observedAt: nonEmptyString2,
4165
+ lastSuccessfulAt: nonEmptyString2,
4166
+ code: nonEmptyString2,
4167
+ message: nonEmptyString2
4168
+ },
4169
+ required: ["status", "observedAt"],
4170
+ additionalProperties: false
4171
+ },
4172
+ refresh: {
4173
+ type: "object",
4174
+ properties: {
4175
+ intervalSeconds: { type: "number" },
4176
+ timeoutSeconds: { type: "number" },
4177
+ maxAgeSeconds: { type: "number" },
4178
+ staleWhileRevalidateSeconds: { type: "number" }
4179
+ },
4180
+ required: ["intervalSeconds", "timeoutSeconds", "maxAgeSeconds", "staleWhileRevalidateSeconds"],
4181
+ additionalProperties: false
4182
+ },
4183
+ configuration: {
4184
+ type: "object",
4185
+ properties: {
4186
+ allowMultipleInstances: { type: "boolean" },
4187
+ fields: {
4188
+ type: "array",
4189
+ items: {
4190
+ type: "object",
4191
+ properties: {
4192
+ key: nonEmptyString2,
4193
+ label: nonEmptyString2,
4194
+ type: { enum: ["string", "number", "boolean", "select", "multi-select", "date-range"] },
4195
+ required: { type: "boolean" },
4196
+ options: {
4197
+ type: "array",
4198
+ items: {
4199
+ type: "object",
4200
+ properties: { value: nonEmptyString2, label: nonEmptyString2 },
4201
+ required: ["value", "label"],
4202
+ additionalProperties: false
4203
+ }
4204
+ }
4205
+ },
4206
+ required: ["key", "label", "type", "required"],
4207
+ additionalProperties: false
4208
+ }
4209
+ },
4210
+ defaults: { type: "object" }
4211
+ },
4212
+ required: ["allowMultipleInstances", "fields", "defaults"],
4213
+ additionalProperties: false
4214
+ },
4215
+ drilldowns: {
4216
+ type: "array",
4217
+ items: {
4218
+ type: "object",
4219
+ properties: { id: nonEmptyString2, label: nonEmptyString2, href: nonEmptyString2 },
4220
+ required: ["id", "label", "href"],
4221
+ additionalProperties: false
4222
+ }
4223
+ },
4224
+ controls: { type: "array", items: actionBinding },
4225
+ localization: {
4226
+ type: "object",
4227
+ properties: {
4228
+ locale: nonEmptyString2,
4229
+ titleKey: nonEmptyString2,
4230
+ descriptionKey: nonEmptyString2,
4231
+ title: nonEmptyString2,
4232
+ description: nonEmptyString2
4233
+ },
4234
+ required: ["locale", "titleKey"],
4235
+ additionalProperties: false
4236
+ },
4237
+ accessibility: {
4238
+ type: "object",
4239
+ properties: { label: nonEmptyString2, description: nonEmptyString2 },
4240
+ required: ["label"],
4241
+ additionalProperties: false
4242
+ },
4243
+ contribution,
4244
+ metrics: {
4245
+ type: "array",
4246
+ items: {
4247
+ type: "object",
4248
+ properties: {
4249
+ key: nonEmptyString2,
4250
+ label: nonEmptyString2,
4251
+ value: { type: "number" },
4252
+ unit: nonEmptyString2,
4253
+ semantic: {
4254
+ enum: ["gauge", "counter", "rate", "duration", "currency", "percentage"]
4255
+ },
4256
+ aggregation: {
4257
+ enum: ["last", "sum", "average", "minimum", "maximum", "count", "distinct_count"]
4258
+ },
4259
+ period,
4260
+ dimensions: { type: "array", items: dimension },
4261
+ series
4262
+ },
4263
+ required: ["key", "label", "value", "unit", "semantic", "aggregation", "period", "dimensions"],
4264
+ additionalProperties: false
4265
+ }
4266
+ },
4267
+ chartType: { enum: ["line", "bar", "area", "pie", "donut"] },
4268
+ series: { type: "array", items: series },
4269
+ activities: { type: "array", items: { type: "object" } },
4270
+ notifications: { type: "array", items: { type: "object" } },
4271
+ unreadCount: { type: "number" },
4272
+ actions: { type: "array", items: actionBinding }
4273
+ },
4274
+ required: [
4275
+ "id",
4276
+ "version",
4277
+ "appId",
4278
+ "serviceName",
4279
+ "lastUpdated",
4280
+ "type",
4281
+ "presentation",
4282
+ "resource",
4283
+ "state",
4284
+ "refresh",
4285
+ "configuration",
4286
+ "drilldowns",
4287
+ "controls",
4288
+ "localization",
4289
+ "accessibility",
4290
+ "contribution"
4291
+ ],
4292
+ allOf: [
4293
+ { if: { properties: { type: { const: "stats" } } }, then: { required: ["metrics"] } },
4294
+ { if: { properties: { type: { const: "chart" } } }, then: { required: ["chartType", "series"] } },
4295
+ { if: { properties: { type: { const: "activity" } } }, then: { required: ["activities"] } },
4296
+ {
4297
+ if: { properties: { type: { const: "notifications" } } },
4298
+ then: { required: ["notifications", "unreadCount"] }
4299
+ },
4300
+ { if: { properties: { type: { const: "actions" } } }, then: { required: ["actions"] } }
4301
+ ],
4302
+ additionalProperties: false
4303
+ };
4304
+ var TOPOLO_WIDGET_OUTPUT_SCHEMA = Object.freeze({
4305
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4306
+ type: "object",
4307
+ properties: {
4308
+ success: { type: "boolean", const: true },
4309
+ contractVersion: { type: "string", const: "3.0.0" },
4310
+ appId: nonEmptyString2,
4311
+ serviceName: nonEmptyString2,
4312
+ generatedAt: nonEmptyString2,
4313
+ widgets: { type: "array", minItems: 1, items: widgetItem },
4314
+ workspace: {
4315
+ anyOf: [
4316
+ {
4317
+ type: "object",
4318
+ properties: {
4319
+ id: { anyOf: [{ type: "string" }, { type: "number" }] },
4320
+ name: nonEmptyString2
4321
+ },
4322
+ required: ["id", "name"],
4323
+ additionalProperties: true
4324
+ },
4325
+ { type: "null" }
4326
+ ]
4327
+ },
4328
+ workspaces: {
4329
+ type: "array",
4330
+ items: {
4331
+ type: "object",
4332
+ properties: {
4333
+ id: { anyOf: [{ type: "string" }, { type: "number" }] },
4334
+ name: nonEmptyString2,
4335
+ isDefault: { type: "boolean" }
4336
+ },
4337
+ required: ["id", "name"],
4338
+ additionalProperties: false
4339
+ }
4340
+ }
4341
+ },
4342
+ required: ["success", "contractVersion", "appId", "serviceName", "generatedAt", "widgets"],
4343
+ additionalProperties: false
4344
+ });
4345
+ function isTopoloWidgetOutputSchema(schema) {
4346
+ if (!isRecord6(schema) || !isRecord6(schema.properties)) return false;
4347
+ const properties = schema.properties;
4348
+ const widgetItemSchema = isRecord6(properties.widgets) && isRecord6(properties.widgets.items) ? properties.widgets.items : void 0;
4349
+ const widgetProperties = widgetItemSchema && isRecord6(widgetItemSchema.properties) ? widgetItemSchema.properties : void 0;
4350
+ const contributionSchema = widgetProperties && isRecord6(widgetProperties.contribution) ? widgetProperties.contribution : void 0;
4351
+ const contractVersion = isRecord6(properties.contractVersion) ? properties.contractVersion.const : void 0;
4352
+ 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");
4353
+ }
4354
+ function isRecord6(value) {
4355
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4356
+ }
4357
+ function hasRequired(schema, field) {
4358
+ return isRecord6(schema) && Array.isArray(schema.required) && schema.required.includes(field);
4359
+ }
4360
+
3889
4361
  // src/index.ts
3890
4362
  function createTopolo(options) {
3891
4363
  const client = new TopoloClient(options);
@@ -3906,6 +4378,7 @@ export {
3906
4378
  TOPOLO_RUNTIME_ENVIRONMENTS,
3907
4379
  TOPOLO_WIDGET_CONTRACT_VERSION,
3908
4380
  TOPOLO_WIDGET_ENDPOINT,
4381
+ TOPOLO_WIDGET_OUTPUT_SCHEMA,
3909
4382
  TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
3910
4383
  TopoloAuthError,
3911
4384
  TopoloClient,
@@ -3943,6 +4416,7 @@ export {
3943
4416
  extractTopoloServiceErrorDetails,
3944
4417
  formatDirectoryApplicationIds,
3945
4418
  friendlyAppId,
4419
+ isTopoloWidgetOutputSchema,
3946
4420
  listApplicationDirectory,
3947
4421
  parseTopoloActionUploadContract,
3948
4422
  preferExactActionMatches,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@topolo/sdk",
3
- "version": "0.14.0",
4
- "topoloPublishedVersion": "0.14.0",
3
+ "version": "0.14.1",
4
+ "topoloPublishedVersion": "0.14.1",
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",