superbee 0.4.3-pre.5 → 0.4.3-pre.7

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.
@@ -5160,6 +5160,23 @@ setDefaultBackendFactory((root) => new FilesystemBackend(root));
5160
5160
  // ../core/src/kinds.ts
5161
5161
  var CONVENTIONS_PREFIX = "conventions/";
5162
5162
  var CONVENTION_TYPE = "Convention";
5163
+ var KIND_FIELD_TYPES = [
5164
+ "date",
5165
+ "datetime",
5166
+ "https-url",
5167
+ "https-url-list",
5168
+ "integer",
5169
+ "number",
5170
+ "boolean",
5171
+ "slug",
5172
+ "string-list",
5173
+ "latitude",
5174
+ "longitude"
5175
+ ];
5176
+ var KIND_FIELD_TYPE_SET = new Set(KIND_FIELD_TYPES);
5177
+ function isKindFieldType(value) {
5178
+ return typeof value === "string" && KIND_FIELD_TYPE_SET.has(value);
5179
+ }
5163
5180
  function buildKindRegistry(docs, initialWarnings = [], options = {}) {
5164
5181
  const accepted = /* @__PURE__ */ new Map();
5165
5182
  const warnings = [...initialWarnings];
@@ -5311,7 +5328,8 @@ var VALID_FIELDS_KEYS = /* @__PURE__ */ new Set([
5311
5328
  "values",
5312
5329
  "value_descriptions",
5313
5330
  "terminal",
5314
- "descriptions"
5331
+ "descriptions",
5332
+ "types"
5315
5333
  ]);
5316
5334
  var MISPLACED_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set(["enum", "enums", "values", "constraints"]);
5317
5335
  var CLAIM_COORDINATE_KEYS = [
@@ -5351,7 +5369,7 @@ function parseConventionDoc(doc, options = {}) {
5351
5369
  if (!VALID_FIELDS_KEYS.has(key)) {
5352
5370
  warnings.push({
5353
5371
  code: "KIND_CONVENTION_UNKNOWN_FIELDS_KEY",
5354
- message: `kind convention '${doc.id}' declares an unrecognized key 'fields.${key}' (valid keys: fields.required, fields.optional, fields.values, fields.value_descriptions, fields.terminal, fields.descriptions); ignoring it.`,
5372
+ message: `kind convention '${doc.id}' declares an unrecognized key 'fields.${key}' (valid keys: fields.required, fields.optional, fields.values, fields.value_descriptions, fields.terminal, fields.descriptions, fields.types); ignoring it.`,
5355
5373
  field: `fields.${key}`,
5356
5374
  severity: "warning"
5357
5375
  });
@@ -5408,6 +5426,51 @@ function parseConventionDoc(doc, options = {}) {
5408
5426
  });
5409
5427
  }
5410
5428
  }
5429
+ const typesSource = fieldsRaw.types;
5430
+ const types = {};
5431
+ if (typesSource !== void 0) {
5432
+ if (!isPlainObject(typesSource)) {
5433
+ warnings.push({
5434
+ code: "KIND_CONVENTION_BAD_SHAPE",
5435
+ message: `kind convention '${doc.id}' has a non-map 'fields.types' (${describeShape(typesSource)}; expected a map of field name -> type); ignoring it.`,
5436
+ field: "fields.types",
5437
+ severity: "warning"
5438
+ });
5439
+ } else {
5440
+ for (const [field, declared] of Object.entries(typesSource)) {
5441
+ if (dropReserved(field, `fields.types.${field}`)) continue;
5442
+ if (!isKindFieldType(declared)) {
5443
+ warnings.push({
5444
+ code: "KIND_CONVENTION_UNKNOWN_FIELD_TYPE",
5445
+ message: `kind convention '${doc.id}' declares 'fields.types.${field}' as ${isScalar(declared) ? `'${String(declared)}'` : describeShape(declared)}, which is not a field type (valid types: ${KIND_FIELD_TYPES.join(", ")}); ignoring it.`,
5446
+ field: `fields.types.${field}`,
5447
+ severity: "warning"
5448
+ });
5449
+ continue;
5450
+ }
5451
+ if (!declaredFieldNames.has(field)) {
5452
+ warnings.push({
5453
+ code: "KIND_CONVENTION_UNDECLARED_TYPES_FIELD",
5454
+ message: `kind convention '${doc.id}' declares 'fields.types.${field}' but '${field}' is not in fields.required or fields.optional; ignoring it.`,
5455
+ field: `fields.types.${field}`,
5456
+ severity: "warning"
5457
+ });
5458
+ continue;
5459
+ }
5460
+ setOwn(types, field, declared);
5461
+ }
5462
+ }
5463
+ }
5464
+ for (const field of Object.keys(values)) {
5465
+ if (types[field] !== "https-url-list") continue;
5466
+ warnings.push({
5467
+ code: "KIND_CONVENTION_VALUES_TYPE_MISMATCH",
5468
+ message: `kind convention '${doc.id}' declares 'fields.values.${field}' on a field of type 'https-url-list', which cannot carry an enum; ignoring the values.`,
5469
+ field: `fields.values.${field}`,
5470
+ severity: "warning"
5471
+ });
5472
+ delete values[field];
5473
+ }
5411
5474
  const valueDescriptionsSource = fieldsRaw.value_descriptions;
5412
5475
  const valueDescriptions = {};
5413
5476
  if (valueDescriptionsSource !== void 0) {
@@ -5700,6 +5763,7 @@ function parseConventionDoc(doc, options = {}) {
5700
5763
  governs,
5701
5764
  fields: { required, optional, values, valueDescriptions, terminal, descriptions }
5702
5765
  };
5766
+ if (Object.keys(types).length > 0) kind.fields.types = types;
5703
5767
  if (description !== void 0) kind.description = description;
5704
5768
  if (path4 !== void 0) kind.path = path4;
5705
5769
  if (links !== void 0) kind.links = links;
@@ -33173,6 +33173,23 @@ setDefaultBackendFactory((root) => new FilesystemBackend(root));
33173
33173
  // ../core/src/kinds.ts
33174
33174
  var CONVENTIONS_PREFIX = "conventions/";
33175
33175
  var CONVENTION_TYPE = "Convention";
33176
+ var KIND_FIELD_TYPES = [
33177
+ "date",
33178
+ "datetime",
33179
+ "https-url",
33180
+ "https-url-list",
33181
+ "integer",
33182
+ "number",
33183
+ "boolean",
33184
+ "slug",
33185
+ "string-list",
33186
+ "latitude",
33187
+ "longitude"
33188
+ ];
33189
+ var KIND_FIELD_TYPE_SET = new Set(KIND_FIELD_TYPES);
33190
+ function isKindFieldType(value) {
33191
+ return typeof value === "string" && KIND_FIELD_TYPE_SET.has(value);
33192
+ }
33176
33193
  function buildKindRegistry(docs, initialWarnings = [], options = {}) {
33177
33194
  const accepted = /* @__PURE__ */ new Map();
33178
33195
  const warnings = [...initialWarnings];
@@ -33324,7 +33341,8 @@ var VALID_FIELDS_KEYS = /* @__PURE__ */ new Set([
33324
33341
  "values",
33325
33342
  "value_descriptions",
33326
33343
  "terminal",
33327
- "descriptions"
33344
+ "descriptions",
33345
+ "types"
33328
33346
  ]);
33329
33347
  var MISPLACED_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set(["enum", "enums", "values", "constraints"]);
33330
33348
  var CLAIM_COORDINATE_KEYS = [
@@ -33364,7 +33382,7 @@ function parseConventionDoc(doc, options = {}) {
33364
33382
  if (!VALID_FIELDS_KEYS.has(key)) {
33365
33383
  warnings.push({
33366
33384
  code: "KIND_CONVENTION_UNKNOWN_FIELDS_KEY",
33367
- message: `kind convention '${doc.id}' declares an unrecognized key 'fields.${key}' (valid keys: fields.required, fields.optional, fields.values, fields.value_descriptions, fields.terminal, fields.descriptions); ignoring it.`,
33385
+ message: `kind convention '${doc.id}' declares an unrecognized key 'fields.${key}' (valid keys: fields.required, fields.optional, fields.values, fields.value_descriptions, fields.terminal, fields.descriptions, fields.types); ignoring it.`,
33368
33386
  field: `fields.${key}`,
33369
33387
  severity: "warning"
33370
33388
  });
@@ -33421,6 +33439,51 @@ function parseConventionDoc(doc, options = {}) {
33421
33439
  });
33422
33440
  }
33423
33441
  }
33442
+ const typesSource = fieldsRaw.types;
33443
+ const types = {};
33444
+ if (typesSource !== void 0) {
33445
+ if (!isPlainObject(typesSource)) {
33446
+ warnings.push({
33447
+ code: "KIND_CONVENTION_BAD_SHAPE",
33448
+ message: `kind convention '${doc.id}' has a non-map 'fields.types' (${describeShape(typesSource)}; expected a map of field name -> type); ignoring it.`,
33449
+ field: "fields.types",
33450
+ severity: "warning"
33451
+ });
33452
+ } else {
33453
+ for (const [field, declared] of Object.entries(typesSource)) {
33454
+ if (dropReserved(field, `fields.types.${field}`)) continue;
33455
+ if (!isKindFieldType(declared)) {
33456
+ warnings.push({
33457
+ code: "KIND_CONVENTION_UNKNOWN_FIELD_TYPE",
33458
+ message: `kind convention '${doc.id}' declares 'fields.types.${field}' as ${isScalar(declared) ? `'${String(declared)}'` : describeShape(declared)}, which is not a field type (valid types: ${KIND_FIELD_TYPES.join(", ")}); ignoring it.`,
33459
+ field: `fields.types.${field}`,
33460
+ severity: "warning"
33461
+ });
33462
+ continue;
33463
+ }
33464
+ if (!declaredFieldNames.has(field)) {
33465
+ warnings.push({
33466
+ code: "KIND_CONVENTION_UNDECLARED_TYPES_FIELD",
33467
+ message: `kind convention '${doc.id}' declares 'fields.types.${field}' but '${field}' is not in fields.required or fields.optional; ignoring it.`,
33468
+ field: `fields.types.${field}`,
33469
+ severity: "warning"
33470
+ });
33471
+ continue;
33472
+ }
33473
+ setOwn(types, field, declared);
33474
+ }
33475
+ }
33476
+ }
33477
+ for (const field of Object.keys(values)) {
33478
+ if (types[field] !== "https-url-list") continue;
33479
+ warnings.push({
33480
+ code: "KIND_CONVENTION_VALUES_TYPE_MISMATCH",
33481
+ message: `kind convention '${doc.id}' declares 'fields.values.${field}' on a field of type 'https-url-list', which cannot carry an enum; ignoring the values.`,
33482
+ field: `fields.values.${field}`,
33483
+ severity: "warning"
33484
+ });
33485
+ delete values[field];
33486
+ }
33424
33487
  const valueDescriptionsSource = fieldsRaw.value_descriptions;
33425
33488
  const valueDescriptions = {};
33426
33489
  if (valueDescriptionsSource !== void 0) {
@@ -33713,6 +33776,7 @@ function parseConventionDoc(doc, options = {}) {
33713
33776
  governs,
33714
33777
  fields: { required, optional, values, valueDescriptions, terminal, descriptions }
33715
33778
  };
33779
+ if (Object.keys(types).length > 0) kind2.fields.types = types;
33716
33780
  if (description !== void 0) kind2.description = description;
33717
33781
  if (path6 !== void 0) kind2.path = path6;
33718
33782
  if (links !== void 0) kind2.links = links;