@topolo/sdk 0.14.1 → 0.14.2

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,7 +29,6 @@ __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,
33
32
  TOPOLO_WIDGET_REFRESH_INTERVAL_MS: () => TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
34
33
  TopoloAuthError: () => TopoloAuthError,
35
34
  TopoloClient: () => TopoloClient,
@@ -67,7 +66,6 @@ __export(index_exports, {
67
66
  extractTopoloServiceErrorDetails: () => extractTopoloServiceErrorDetails,
68
67
  formatDirectoryApplicationIds: () => formatDirectoryApplicationIds,
69
68
  friendlyAppId: () => friendlyAppId,
70
- isTopoloWidgetOutputSchema: () => isTopoloWidgetOutputSchema,
71
69
  listApplicationDirectory: () => listApplicationDirectory,
72
70
  parseTopoloActionUploadContract: () => parseTopoloActionUploadContract,
73
71
  preferExactActionMatches: () => preferExactActionMatches,
@@ -163,6 +161,7 @@ var ERROR_CODE_PATTERN = /^[a-z][a-z0-9_]{0,63}$/;
163
161
  var TOPOLO_REQUEST_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
164
162
  var CLOUDFLARE_RAY_ID_PATTERN = /^[0-9a-f]{16}-[A-Z]{3}$/;
165
163
  var PERMISSION_PATTERN = /^[a-z][a-z0-9_-]{0,63}(?:\.[a-z][a-z0-9_-]{0,63})*:(?:[a-z][a-z0-9_-]{0,63}|\*)$/;
164
+ var PUBLIC_FIELD_PATH_PATTERN = /^[$.a-z0-9_[\]-]{1,160}$/i;
166
165
  var RETRY_AFTER_DATE_PATTERN = /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}:\d{2}:\d{2} GMT$/;
167
166
  var PUBLIC_DETAIL_SOURCES = /* @__PURE__ */ new Set([
168
167
  "api_key_introspection",
@@ -275,7 +274,11 @@ function extractTopoloServiceErrorDetails(body) {
275
274
  if (candidate === void 0) candidate = nestedRecord.details ?? nestedRecord;
276
275
  }
277
276
  if (candidate === void 0) candidate = record;
278
- if (!candidate || typeof candidate !== "object" || Array.isArray(candidate)) return void 0;
277
+ if (Array.isArray(candidate)) {
278
+ const paths = canonicalTopoloValidationPaths(candidate);
279
+ return paths.length ? { paths } : void 0;
280
+ }
281
+ if (!candidate || typeof candidate !== "object") return void 0;
279
282
  const source = candidate;
280
283
  const safe = {};
281
284
  for (const [key, value] of Object.entries(source)) {
@@ -312,12 +315,42 @@ function extractTopoloServiceErrorDetails(body) {
312
315
  continue;
313
316
  }
314
317
  if (["missingFields", "fields", "paths"].includes(key) && Array.isArray(value)) {
315
- const paths = value.filter((item) => typeof item === "string" && /^[$.a-z0-9_[\]-]{1,160}$/i.test(item));
318
+ const paths = value.filter((item) => typeof item === "string" && PUBLIC_FIELD_PATH_PATTERN.test(item));
316
319
  if (paths.length) safe[key] = paths;
317
320
  }
318
321
  }
319
322
  return Object.keys(safe).length ? safe : void 0;
320
323
  }
324
+ function canonicalTopoloValidationPaths(issues) {
325
+ const paths = [];
326
+ for (const issue of issues) {
327
+ if (!issue || typeof issue !== "object" || Array.isArray(issue)) continue;
328
+ const record = issue;
329
+ const path = canonicalTopoloValidationPath(record.field) ?? canonicalTopoloValidationPath(record.path);
330
+ if (path && !paths.includes(path)) paths.push(path);
331
+ if (paths.length === 32) break;
332
+ }
333
+ return paths;
334
+ }
335
+ function canonicalTopoloValidationPath(value) {
336
+ if (typeof value === "string") {
337
+ const path2 = value.trim();
338
+ return PUBLIC_FIELD_PATH_PATTERN.test(path2) ? path2 : void 0;
339
+ }
340
+ if (!Array.isArray(value) || value.length === 0 || value.length > 32) return void 0;
341
+ const segments = value.map((segment) => {
342
+ if (typeof segment === "number" && Number.isSafeInteger(segment) && segment >= 0) {
343
+ return String(segment);
344
+ }
345
+ if (typeof segment === "string" && /^[a-z0-9_$-]{1,80}$/i.test(segment)) {
346
+ return segment;
347
+ }
348
+ return null;
349
+ });
350
+ if (segments.includes(null)) return void 0;
351
+ const path = segments.join(".");
352
+ return PUBLIC_FIELD_PATH_PATTERN.test(path) ? path : void 0;
353
+ }
321
354
  function publicTopoloErrorMessage(error) {
322
355
  const code = canonicalTopoloErrorCode(
323
356
  typeof error === "string" ? error : error.code ?? extractTopoloServiceErrorCode(error.body)
@@ -3703,22 +3736,22 @@ function validateRuntimeSemantics(widget, contributionPath, declared, errors) {
3703
3736
  validateSeriesDimensions(metric.series, declared.dimensionKeys, contributionPath, errors);
3704
3737
  }
3705
3738
  }
3706
- const series2 = Array.isArray(widget.series) ? widget.series : [];
3707
- for (const item of series2) {
3739
+ const series = Array.isArray(widget.series) ? widget.series : [];
3740
+ for (const item of series) {
3708
3741
  if (!isRecord5(item)) continue;
3709
3742
  if (typeof item.id === "string" && !declared.seriesKeys.has(item.id)) errors.push(`${contributionPath}.seriesDefinitions is missing runtime series ${item.id}`);
3710
3743
  validateSeriesDimensions(item, declared.dimensionKeys, contributionPath, errors);
3711
3744
  }
3712
3745
  }
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);
3746
+ function validateSeriesDimensions(series, known, path, errors) {
3747
+ if (!Array.isArray(series.points)) return;
3748
+ for (const point of series.points) if (isRecord5(point)) validateRuntimeDimensions(point.dimensions, known, path, errors);
3716
3749
  }
3717
3750
  function validateRuntimeDimensions(value, known, path, errors) {
3718
3751
  if (!Array.isArray(value)) return;
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}`);
3752
+ for (const dimension of value) {
3753
+ if (isRecord5(dimension) && typeof dimension.key === "string" && !known.has(dimension.key)) {
3754
+ errors.push(`${path}.dimensions is missing runtime dimension ${dimension.key}`);
3722
3755
  }
3723
3756
  }
3724
3757
  }
@@ -3755,12 +3788,12 @@ function validatePeriod(value, path, errors) {
3755
3788
  }
3756
3789
  function validateDimensions(value, path, errors) {
3757
3790
  if (!arrayValue(value, path, errors)) return;
3758
- value.forEach((dimension2, index) => {
3791
+ value.forEach((dimension, index) => {
3759
3792
  const itemPath = `${path}[${index}]`;
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);
3793
+ if (!recordValue(dimension, itemPath, errors)) return;
3794
+ nonEmptyString(dimension.key, `${itemPath}.key`, errors);
3795
+ nonEmptyString(dimension.label, `${itemPath}.label`, errors);
3796
+ nonEmptyString(dimension.value, `${itemPath}.value`, errors);
3764
3797
  });
3765
3798
  }
3766
3799
  function validateComparison(value, path, errors) {
@@ -3774,7 +3807,7 @@ function validateComparison(value, path, errors) {
3774
3807
  }
3775
3808
  function validateSeriesCollection(value, path, errors, requireOne) {
3776
3809
  if (!arrayValue(value, path, errors, requireOne)) return;
3777
- value.forEach((series2, index) => validateSeries(series2, `${path}[${index}]`, errors));
3810
+ value.forEach((series, index) => validateSeries(series, `${path}[${index}]`, errors));
3778
3811
  }
3779
3812
  function validateSeries(value, path, errors) {
3780
3813
  if (!recordValue(value, path, errors)) return;
@@ -3972,478 +4005,6 @@ function toIsoTimestamp(input) {
3972
4005
  return input ?? (/* @__PURE__ */ new Date()).toISOString();
3973
4006
  }
3974
4007
 
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
-
4447
4008
  // src/index.ts
4448
4009
  function createTopolo(options) {
4449
4010
  const client = new TopoloClient(options);
@@ -4465,7 +4026,6 @@ function createTopolo(options) {
4465
4026
  TOPOLO_RUNTIME_ENVIRONMENTS,
4466
4027
  TOPOLO_WIDGET_CONTRACT_VERSION,
4467
4028
  TOPOLO_WIDGET_ENDPOINT,
4468
- TOPOLO_WIDGET_OUTPUT_SCHEMA,
4469
4029
  TOPOLO_WIDGET_REFRESH_INTERVAL_MS,
4470
4030
  TopoloAuthError,
4471
4031
  TopoloClient,
@@ -4503,7 +4063,6 @@ function createTopolo(options) {
4503
4063
  extractTopoloServiceErrorDetails,
4504
4064
  formatDirectoryApplicationIds,
4505
4065
  friendlyAppId,
4506
- isTopoloWidgetOutputSchema,
4507
4066
  listApplicationDirectory,
4508
4067
  parseTopoloActionUploadContract,
4509
4068
  preferExactActionMatches,
package/dist/index.d.cts CHANGED
@@ -1574,10 +1574,6 @@ 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
-
1581
1577
  /**
1582
1578
  * Convenience factory that returns a ready-to-use typed Topolo client plus
1583
1579
  * domain module surfaces (identity, crm, ...).
@@ -1593,4 +1589,4 @@ declare function createTopolo(options: TopoloClientOptions): {
1593
1589
  };
1594
1590
  type Topolo = ReturnType<typeof createTopolo>;
1595
1591
 
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 };
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 };