@api-client/core 0.17.7 → 0.18.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.
Files changed (59) hide show
  1. package/build/src/amf/ApiSchemaGenerator.d.ts +2 -2
  2. package/build/src/amf/ApiSchemaGenerator.d.ts.map +1 -1
  3. package/build/src/amf/ApiSchemaGenerator.js.map +1 -1
  4. package/build/src/amf/ApiSchemaValues.d.ts.map +1 -1
  5. package/build/src/amf/ApiSchemaValues.js +8 -1
  6. package/build/src/amf/ApiSchemaValues.js.map +1 -1
  7. package/build/src/amf/shape/ShapeBase.d.ts +1 -1
  8. package/build/src/amf/shape/ShapeBase.d.ts.map +1 -1
  9. package/build/src/amf/shape/ShapeBase.js.map +1 -1
  10. package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts +1 -1
  11. package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts.map +1 -1
  12. package/build/src/amf/shape/ShapeJsonSchemaGenerator.js +7 -1
  13. package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +1 -1
  14. package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts +1 -1
  15. package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts.map +1 -1
  16. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +8 -2
  17. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -1
  18. package/build/src/mocking/RandExp.d.ts +55 -0
  19. package/build/src/mocking/RandExp.d.ts.map +1 -0
  20. package/build/src/mocking/RandExp.js +302 -0
  21. package/build/src/mocking/RandExp.js.map +1 -0
  22. package/build/src/mocking/lib/ret.d.ts +16 -0
  23. package/build/src/mocking/lib/ret.d.ts.map +1 -0
  24. package/build/src/mocking/lib/ret.js +284 -0
  25. package/build/src/mocking/lib/ret.js.map +1 -0
  26. package/build/src/modeling/Bindings.d.ts +0 -4
  27. package/build/src/modeling/Bindings.d.ts.map +1 -1
  28. package/build/src/modeling/Bindings.js.map +1 -1
  29. package/build/src/modeling/DomainEntity.js +3 -3
  30. package/build/src/modeling/DomainEntity.js.map +1 -1
  31. package/build/src/modeling/DomainProperty.d.ts +18 -0
  32. package/build/src/modeling/DomainProperty.d.ts.map +1 -1
  33. package/build/src/modeling/DomainProperty.js +31 -0
  34. package/build/src/modeling/DomainProperty.js.map +1 -1
  35. package/build/src/modeling/amf/ShapeGenerator.js +3 -3
  36. package/build/src/modeling/amf/ShapeGenerator.js.map +1 -1
  37. package/build/src/modeling/types.d.ts +4 -0
  38. package/build/src/modeling/types.d.ts.map +1 -1
  39. package/build/src/modeling/types.js.map +1 -1
  40. package/build/src/models/DataCatalog.d.ts +12 -1
  41. package/build/src/models/DataCatalog.d.ts.map +1 -1
  42. package/build/src/models/DataCatalog.js.map +1 -1
  43. package/build/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +1 -1
  45. package/src/amf/ApiSchemaGenerator.ts +2 -2
  46. package/src/amf/ApiSchemaValues.ts +8 -1
  47. package/src/amf/shape/ShapeBase.ts +1 -1
  48. package/src/amf/shape/ShapeJsonSchemaGenerator.ts +7 -2
  49. package/src/amf/shape/ShapeXmlSchemaGenerator.ts +8 -3
  50. package/src/mocking/RandExp.ts +335 -0
  51. package/src/mocking/lib/ret.ts +279 -0
  52. package/src/modeling/Bindings.ts +0 -4
  53. package/src/modeling/DomainEntity.ts +3 -3
  54. package/src/modeling/DomainProperty.ts +33 -0
  55. package/src/modeling/amf/ShapeGenerator.ts +3 -3
  56. package/src/modeling/types.ts +4 -0
  57. package/src/models/DataCatalog.ts +13 -1
  58. package/tests/unit/modeling/amf/shape_generator.spec.ts +3 -8
  59. package/tests/unit/modeling/domain_property.spec.ts +335 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ret.js","sourceRoot":"","sources":["../../../../src/mocking/lib/ret.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,iCAAiC;AAEjC,MAAM,CAAN,IAAY,KASX;AATD,WAAY,KAAK;IACf,iCAAQ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AC,CAAA;gBACjF,MAAK;YACP;gBACE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,KAAK,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAA;IACnE,OAAO,IAAI,CAAA;AACb,CAAC,CAAA","sourcesContent":["// Regular Expression Tokenizer\n// https://github.com/fent/ret.js\n\nexport enum types {\n ROOT = 0,\n GROUP = 1,\n POSITION = 2,\n SET = 3,\n RANGE = 4,\n REPETITION = 5,\n REFERENCE = 6,\n CHAR = 7,\n}\n\nexport interface Token {\n type: types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any\n}\nconst wordBoundary = (): Token => ({ type: types.POSITION, value: 'b' })\nconst nonWordBoundary = (): Token => ({ type: types.POSITION, value: 'B' })\nconst begin = (): Token => ({ type: types.POSITION, value: '^' })\nconst end = (): Token => ({ type: types.POSITION, value: '$' })\n\nconst ints = (): Token[] => [{ type: types.RANGE, from: 48, to: 57 }]\nconst words = (): Token[] => [\n { type: types.CHAR, value: 95 },\n { type: types.RANGE, from: 97, to: 122 },\n { type: types.RANGE, from: 65, to: 90 },\n ...ints(),\n]\nconst whitespace = (): Token[] => [\n { type: types.CHAR, value: 9 },\n { type: types.CHAR, value: 10 },\n { type: types.CHAR, value: 11 },\n { type: types.CHAR, value: 12 },\n { type: types.CHAR, value: 13 },\n { type: types.CHAR, value: 32 },\n { type: types.CHAR, value: 160 },\n { type: types.CHAR, value: 5760 },\n { type: types.CHAR, value: 6158 },\n { type: types.CHAR, value: 8192 },\n { type: types.CHAR, value: 8193 },\n { type: types.CHAR, value: 8194 },\n { type: types.CHAR, value: 8195 },\n { type: types.CHAR, value: 8196 },\n { type: types.CHAR, value: 8197 },\n { type: types.CHAR, value: 8198 },\n { type: types.CHAR, value: 8199 },\n { type: types.CHAR, value: 8200 },\n { type: types.CHAR, value: 8201 },\n { type: types.CHAR, value: 8202 },\n { type: types.CHAR, value: 8232 },\n { type: types.CHAR, value: 8233 },\n { type: types.CHAR, value: 8239 },\n { type: types.CHAR, value: 8287 },\n { type: types.CHAR, value: 12288 },\n { type: types.CHAR, value: 65279 },\n]\nconst notanychar = (): Token[] => [\n { type: types.CHAR, value: 10 },\n { type: types.CHAR, value: 13 },\n { type: types.CHAR, value: 8232 },\n { type: types.CHAR, value: 8233 },\n]\n\nconst words_ = (): Token => ({ type: types.SET, set: words(), not: false })\nconst notWords = (): Token => ({ type: types.SET, set: words(), not: true })\nconst ints_ = (): Token => ({ type: types.SET, set: ints(), not: false })\nconst notInts = (): Token => ({ type: types.SET, set: ints(), not: true })\nconst whitespace_ = (): Token => ({ type: types.SET, set: whitespace(), not: false })\nconst notWhitespace = (): Token => ({ type: types.SET, set: whitespace(), not: true })\nconst anyChar = (): Token => ({ type: types.SET, set: notanychar(), not: true })\n\nconst specialChars: Record<string, number> = {\n '0': 0,\n 't': 9,\n 'n': 10,\n 'v': 11,\n 'f': 12,\n 'r': 13,\n}\n\nconst strToChars = (str: string): string => {\n const chars = /(\\[\\\\b\\])|(\\\\)?\\\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\\\\]^?])|([0tnvfr]))/g\n return str.replace(chars, (match, b, s, uh, xh, o, c, sp) => {\n if (s) return match\n const code = b\n ? 8\n : uh\n ? parseInt(uh, 16)\n : xh\n ? parseInt(xh, 16)\n : o\n ? parseInt(o, 8)\n : c\n ? '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^ ?'.indexOf(c)\n : specialChars[sp]\n let ch = String.fromCharCode(code)\n if (/[[{}^$.|?*+()]/.test(ch)) {\n ch = `\\\\${ch}`\n }\n return ch\n })\n}\n\nconst tokenizeClass = (str: string, regexpStr: string): [Token[], number] => {\n const tokens: Token[] = []\n const classTokens = /\\\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\\\)(.)|([^\\]\\\\]))-(?:\\\\)?([^\\]]))|(\\])|(?:\\\\)?(.)/g\n let match\n let char\n while ((match = classTokens.exec(str)) !== null) {\n if (match[1]) {\n tokens.push(words_())\n } else if (match[2]) {\n tokens.push(ints_())\n } else if (match[3]) {\n tokens.push(whitespace_())\n } else if (match[4]) {\n tokens.push(notWords())\n } else if (match[5]) {\n tokens.push(notInts())\n } else if (match[6]) {\n tokens.push(notWhitespace())\n } else if (match[7]) {\n tokens.push({\n type: types.RANGE,\n from: (match[8] || match[9]).charCodeAt(0),\n to: match[10].charCodeAt(0),\n })\n } else if ((char = match[12])) {\n tokens.push({ type: types.CHAR, value: char.charCodeAt(0) })\n } else {\n return [tokens, classTokens.lastIndex]\n }\n }\n throw new SyntaxError(`Invalid regular expression: /${regexpStr}/: Unterminated character class`)\n}\n\nconst error = (regexpStr: string, msg: string): never => {\n throw new SyntaxError(`Invalid regular expression: /${regexpStr}/: ${msg}`)\n}\n\nexport const ret = (regexpStr: string): Token => {\n let i = 0\n const root: Token = { type: types.ROOT, stack: [] }\n let p: Token = root\n let stack: Token[] = root.stack\n const groupStack: Token[] = []\n\n const repeatErr = (i: number) => error(regexpStr, `Nothing to repeat at column ${i - 1}`)\n const chars = strToChars(regexpStr)\n\n while (i < chars.length) {\n let c = chars[i++]\n switch (c) {\n case '\\\\':\n c = chars[i++]\n switch (c) {\n case 'b':\n stack.push(wordBoundary())\n break\n case 'B':\n stack.push(nonWordBoundary())\n break\n case 'w':\n stack.push(words_())\n break\n case 'W':\n stack.push(notWords())\n break\n case 'd':\n stack.push(ints_())\n break\n case 'D':\n stack.push(notInts())\n break\n case 's':\n stack.push(whitespace_())\n break\n case 'S':\n stack.push(notWhitespace())\n break\n default:\n if (/\\d/.test(c)) {\n stack.push({ type: types.REFERENCE, value: parseInt(c, 10) })\n } else {\n stack.push({ type: types.CHAR, value: c.charCodeAt(0) })\n }\n }\n break\n case '^':\n stack.push(begin())\n break\n case '$':\n stack.push(end())\n break\n case '[': {\n let not = false\n if (chars[i] === '^') {\n not = true\n i++\n }\n const [set, lastIndex] = tokenizeClass(chars.slice(i), regexpStr)\n i += lastIndex\n stack.push({ type: types.SET, set, not })\n break\n }\n case '.':\n stack.push(anyChar())\n break\n case '(': {\n const group: Token = { type: types.GROUP, stack: [], remember: true }\n if (chars[i] === '?') {\n c = chars[i + 1]\n i += 2\n if (c === '=') {\n group.followedBy = true\n } else if (c === '!') {\n group.notFollowedBy = true\n } else if (c !== ':') {\n error(regexpStr, `Invalid group, character '${c}' after '?' at column ${i - 1}`)\n }\n group.remember = false\n }\n stack.push(group)\n groupStack.push(p)\n p = group\n stack = group.stack\n break\n }\n case ')':\n if (groupStack.length === 0) error(regexpStr, `Unmatched ) at column ${i - 1}`)\n p = groupStack.pop() as Token\n stack = p.options ? p.options[p.options.length - 1] : p.stack\n break\n case '|':\n if (!p.options) {\n p.options = [p.stack]\n delete p.stack\n }\n {\n const newStack: Token[] = []\n p.options.push(newStack)\n stack = newStack\n }\n break\n case '{': {\n const repetition = /^(\\d+)(,(\\d+)?)?\\}/.exec(chars.slice(i))\n if (repetition) {\n if (stack.length === 0) repeatErr(i)\n const min = parseInt(repetition[1], 10)\n const max = repetition[2] ? (repetition[3] ? parseInt(repetition[3], 10) : Infinity) : min\n i += repetition[0].length\n stack.push({ type: types.REPETITION, min, max, value: stack.pop() })\n } else {\n stack.push({ type: types.CHAR, value: 123 })\n }\n break\n }\n case '?':\n if (stack.length === 0) repeatErr(i)\n stack.push({ type: types.REPETITION, min: 0, max: 1, value: stack.pop() })\n break\n case '+':\n if (stack.length === 0) repeatErr(i)\n stack.push({ type: types.REPETITION, min: 1, max: Infinity, value: stack.pop() })\n break\n case '*':\n if (stack.length === 0) repeatErr(i)\n stack.push({ type: types.REPETITION, min: 0, max: Infinity, value: stack.pop() })\n break\n default:\n stack.push({ type: types.CHAR, value: c.charCodeAt(0) })\n }\n }\n if (groupStack.length !== 0) error(regexpStr, 'Unterminated group')\n return root\n}\n"]}
@@ -73,10 +73,6 @@ export interface PropertyWebBindings {
73
73
  * The list of file mime types.
74
74
  */
75
75
  fileTypes?: string[];
76
- /**
77
- * The patter to use wit a string scalar
78
- */
79
- pattern?: string;
80
76
  /**
81
77
  * Whether the attribute is hidden in the schema (not a part of it).
82
78
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Bindings.d.ts","sourceRoot":"","sources":["../../../src/modeling/Bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAEtD,UAAU,OAAO;IACf;;;;;OAKG;IACH,IAAI,EAAE,UAAU,GAAG,KAAK,CAAA;IACxB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,iBAAiB,CAAA;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,QAAQ,CAAC,EACL,QAAQ,GACR,OAAO,GACP,OAAO,GAC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OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,QAAQ,CAAC,EACL,QAAQ,GACR,OAAO,GACP,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,MAAM,GACN,QAAQ,GACR,OAAO,CAAA;CACZ;AAED,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAAG,wBAAwB,CAAA;AAE7E,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C;;;;;OAKG;IACH,MAAM,EAAE,gBAAgB,CAAA;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,MAAM,mBAAmB,GAAG,sBAAsB,CAAA;AAExD,MAAM,WAAW,kBAAmB,SAAQ,OAAO;IACjD;;OAEG;IACH,MAAM,EAAE,mBAAmB,CAAA;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"Bindings.js","sourceRoot":"","sources":["../../../src/modeling/Bindings.ts"],"names":[],"mappings":"","sourcesContent":["import { IApiXmlSerializer } from '../amf/definitions/Shapes.js'\nimport { DomainPropertyFormat } from './DataFormat.js'\n\ninterface Binding {\n /**\n * The type of the bindings\n *\n * - Protocol buffers: `protobuf`\n * - RAML or OAS - `web`\n */\n type: 'protobuf' | 'web'\n /**\n * The binding schema.\n */\n schema: unknown\n}\n\n/**\n * Binding for web API schema types (RAML, OAS)\n *\n * Data type translation (type to dataType)\n *\n * - `string` -> `string` with appropriate format\n * - `number` -> `number` data type with format `float`, `double`, or none format for OAS\n * - `integer` -> `integer` data type with `int32`, `int64`, or none format for OAS\n * - `nil` -> `nullable` property on OAS or `nil` type in RAML\n * - `boolean` -> `boolean` (both the same)\n * - `date` ->\n * - `any` -> `any` in RAML, `{}` shorthand in OAS\n *\n *\n *\n * The `binary` type\n *\n * OAS\n *\n * `http://www.w3.org/2001/XMLSchema#byte` For a file\n * `http://www.w3.org/2001/XMLSchema#base64Binary` for base 64\n *\n * RAML\n *\n * Has it's own AMF shape: FileShape.\n *\n * The `data` type\n *\n * OAS\n *\n * `http://www.w3.org/2001/XMLSchema#date` for a `date`\n * `http://www.w3.org/2001/XMLSchema#dateTime` for a `datetime` and `time`.\n * Note, OAS has no concept of `time` do we add `time` as the `format which is a custom thing.\n *\n * RAML\n *\n * `http://www.w3.org/2001/XMLSchema#date` for a `date` (raml's date-only)\n * `http://a.ml/vocabularies/shapes#dateTimeOnly` for a `time` (raml's time-only)\n * `http://www.w3.org/2001/XMLSchema#dateTime` for a `datetime` (raml's datetime) + format\n *\n * Note, we won't support RAML's `datetime-only`.\n */\nexport interface PropertyWebBindings {\n /**\n * The format specifying the property data type.\n */\n format?: DomainPropertyFormat\n /**\n * When set it overrides the `name` of the property.\n */\n name?: string\n /**\n * The XML encoding instructions.\n */\n xml?: IApiXmlSerializer\n /**\n * Only valid for the `file` property type.\n * The list of file mime types.\n */\n fileTypes?: string[]\n /**\n * The patter to use wit a string scalar\n */\n pattern?: string\n /**\n * Whether the attribute is hidden in the schema (not a part of it).\n */\n hidden?: boolean\n}\n\n/**\n * Binding to the protocol buffer.\n *\n * Data type translation (type to dataType)\n *\n * - `string` -> `string`\n * - `number` -> `double`, `float`\n * - `integer` -> `int32`, `int64`, `uint32`, `uint64`, `sint32`, `sint64`, `fixed32`, `fixed64`, `sfixed32`, `sfixed64`\n * - `nil` -> No translation.\n * - `boolean` -> `boolean`\n * - `date` -> No translation, we allow string or number (date string or a timestamp with a\n * combination with format but this is not standard for ProtoBuf)\n * - `any` -> No translation, the user has to pick any of the data formats.\n * - `binary` -> `bytes`\n */\nexport interface PropertyProtobufBindings {\n /**\n * The field number in a protocol buffer message\n */\n field?: number\n /**\n * Whether this property (field) is reserved\n */\n reserved?: boolean\n /**\n * Whether the attribute is hidden in the schema (not a part of it).\n */\n hidden?: boolean\n /**\n * The data type of the protocol buffer proprty\n */\n dataType?:\n | 'double'\n | 'float'\n | 'int32'\n | 'int64'\n | 'uint32'\n | 'uint64'\n | 'sint32'\n | 'sint64'\n | 'fixed32'\n | 'fixed64'\n | 'sfixed32'\n | 'sfixed64'\n | 'bool'\n | 'string'\n | 'bytes'\n}\n\nexport type PropertyBindings = PropertyWebBindings | PropertyProtobufBindings\n\nexport interface PropertyBinding extends Binding {\n /**\n * The definition of the bindings.\n * The bindings tells how to translated the DomainProperty to a specific format.\n * For example, it allows to define the `dataType` and `format` for RAML / OAS (via the AMF shapes)\n * or the field number for protocol buffer.\n */\n schema: PropertyBindings\n}\n\nexport interface AssociationWebBindings {\n /**\n * Whether the association is hidden in the schema (not a part of it).\n */\n hidden?: boolean\n}\n\nexport type AssociationBindings = AssociationWebBindings\n\nexport interface AssociationBinding extends Binding {\n /**\n * Association binding definition.\n */\n schema: AssociationBindings\n}\n"]}
1
+ {"version":3,"file":"Bindings.js","sourceRoot":"","sources":["../../../src/modeling/Bindings.ts"],"names":[],"mappings":"","sourcesContent":["import { IApiXmlSerializer } from '../amf/definitions/Shapes.js'\nimport { DomainPropertyFormat } from './DataFormat.js'\n\ninterface Binding {\n /**\n * The type of the bindings\n *\n * - Protocol buffers: `protobuf`\n * - RAML or OAS - `web`\n */\n type: 'protobuf' | 'web'\n /**\n * The binding schema.\n */\n schema: unknown\n}\n\n/**\n * Binding for web API schema types (RAML, OAS)\n *\n * Data type translation (type to dataType)\n *\n * - `string` -> `string` with appropriate format\n * - `number` -> `number` data type with format `float`, `double`, or none format for OAS\n * - `integer` -> `integer` data type with `int32`, `int64`, or none format for OAS\n * - `nil` -> `nullable` property on OAS or `nil` type in RAML\n * - `boolean` -> `boolean` (both the same)\n * - `date` ->\n * - `any` -> `any` in RAML, `{}` shorthand in OAS\n *\n *\n *\n * The `binary` type\n *\n * OAS\n *\n * `http://www.w3.org/2001/XMLSchema#byte` For a file\n * `http://www.w3.org/2001/XMLSchema#base64Binary` for base 64\n *\n * RAML\n *\n * Has it's own AMF shape: FileShape.\n *\n * The `data` type\n *\n * OAS\n *\n * `http://www.w3.org/2001/XMLSchema#date` for a `date`\n * `http://www.w3.org/2001/XMLSchema#dateTime` for a `datetime` and `time`.\n * Note, OAS has no concept of `time` do we add `time` as the `format which is a custom thing.\n *\n * RAML\n *\n * `http://www.w3.org/2001/XMLSchema#date` for a `date` (raml's date-only)\n * `http://a.ml/vocabularies/shapes#dateTimeOnly` for a `time` (raml's time-only)\n * `http://www.w3.org/2001/XMLSchema#dateTime` for a `datetime` (raml's datetime) + format\n *\n * Note, we won't support RAML's `datetime-only`.\n */\nexport interface PropertyWebBindings {\n /**\n * The format specifying the property data type.\n */\n format?: DomainPropertyFormat\n /**\n * When set it overrides the `name` of the property.\n */\n name?: string\n /**\n * The XML encoding instructions.\n */\n xml?: IApiXmlSerializer\n /**\n * Only valid for the `file` property type.\n * The list of file mime types.\n */\n fileTypes?: string[]\n /**\n * Whether the attribute is hidden in the schema (not a part of it).\n */\n hidden?: boolean\n}\n\n/**\n * Binding to the protocol buffer.\n *\n * Data type translation (type to dataType)\n *\n * - `string` -> `string`\n * - `number` -> `double`, `float`\n * - `integer` -> `int32`, `int64`, `uint32`, `uint64`, `sint32`, `sint64`, `fixed32`, `fixed64`, `sfixed32`, `sfixed64`\n * - `nil` -> No translation.\n * - `boolean` -> `boolean`\n * - `date` -> No translation, we allow string or number (date string or a timestamp with a\n * combination with format but this is not standard for ProtoBuf)\n * - `any` -> No translation, the user has to pick any of the data formats.\n * - `binary` -> `bytes`\n */\nexport interface PropertyProtobufBindings {\n /**\n * The field number in a protocol buffer message\n */\n field?: number\n /**\n * Whether this property (field) is reserved\n */\n reserved?: boolean\n /**\n * Whether the attribute is hidden in the schema (not a part of it).\n */\n hidden?: boolean\n /**\n * The data type of the protocol buffer proprty\n */\n dataType?:\n | 'double'\n | 'float'\n | 'int32'\n | 'int64'\n | 'uint32'\n | 'uint64'\n | 'sint32'\n | 'sint64'\n | 'fixed32'\n | 'fixed64'\n | 'sfixed32'\n | 'sfixed64'\n | 'bool'\n | 'string'\n | 'bytes'\n}\n\nexport type PropertyBindings = PropertyWebBindings | PropertyProtobufBindings\n\nexport interface PropertyBinding extends Binding {\n /**\n * The definition of the bindings.\n * The bindings tells how to translated the DomainProperty to a specific format.\n * For example, it allows to define the `dataType` and `format` for RAML / OAS (via the AMF shapes)\n * or the field number for protocol buffer.\n */\n schema: PropertyBindings\n}\n\nexport interface AssociationWebBindings {\n /**\n * Whether the association is hidden in the schema (not a part of it).\n */\n hidden?: boolean\n}\n\nexport type AssociationBindings = AssociationWebBindings\n\nexport interface AssociationBinding extends Binding {\n /**\n * Association binding definition.\n */\n schema: AssociationBindings\n}\n"]}
@@ -737,9 +737,9 @@ let DomainEntity = (() => {
737
737
  toExample(mime, opts = {}) {
738
738
  const shape = this.toApiShape();
739
739
  const generator = new ApiSchemaGenerator(mime, {
740
- renderExamples: typeof opts.renderExamples === 'boolean' ? opts.renderExamples : true,
741
- renderMocked: typeof opts.renderMocked === 'boolean' ? opts.renderMocked : true,
742
- renderOptional: typeof opts.renderOptional === 'boolean' ? opts.renderOptional : true,
740
+ renderExamples: opts.renderExamples ?? true,
741
+ renderMocked: opts.renderMocked ?? true,
742
+ renderOptional: opts.renderOptional ?? true,
743
743
  selectedUnions: opts.selectedUnions,
744
744
  });
745
745
  return generator.generate(shape);
@@ -1 +1 @@
1
- {"version":3,"file":"DomainEntity.js","sourceRoot":"","sources":["../../../src/modeling/DomainEntity.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAChG,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAe,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,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;gBAC/B,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;YAC5B,CAAC;QACH,CAAC;QAED;;;;WAIG;QACH,WAAW,CAAC,UAAwB;YAClC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAA;QACxD,CAAC;;;SApvBU,YAAY","sourcesContent":["import type { DataDomain } from './DataDomain.js'\nimport { DomainAssociationKind, DomainEntityKind, DomainPropertyKind } from '../models/kinds.js'\nimport { DomainElement, type DomainElementSchema } from './DomainElement.js'\nimport { nanoid } from '../nanoid.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport { observed, retargetChange, toRaw } from './observed.js'\nimport type { IShapeUnion } from '../amf/definitions/Shapes.js'\nimport { DomainProperty, type DomainPropertySchema } from './DomainProperty.js'\nimport { RemovePropertyException } from '../exceptions/remove_property_exception.js'\nimport { DomainAssociation, DomainAssociationSchema } from './DomainAssociation.js'\nimport type { AssociationAddOptions } from './types.js'\nimport type { FileBreadcrumb } from '../models/store/File.js'\nimport type { DomainModel } from './DomainModel.js'\nimport type { DomainNamespace } from './DomainNamespace.js'\nimport { ValidationError } from '../exceptions/validation_error.js'\nimport { ShapeGenerator } from './amf/ShapeGenerator.js'\nimport type { IShapeRenderOptions } from '../amf/shape/ShapeBase.js'\nimport { ApiSchemaGenerator } from '../amf/ApiSchemaGenerator.js'\nimport { removeGraphNode } from './GraphUtils.js'\nimport { DataSemantics, isEntitySemantic, type SemanticType, type AppliedDataSemantic } from './Semantics.js'\n\nexport interface EntityOrderedItem {\n /**\n * The type of the ordered item.\n */\n type: 'property' | 'association'\n\n /**\n * The key of the ordered item.\n */\n key: string\n}\n\nexport interface DomainEntitySchema extends DomainElementSchema {\n kind: typeof DomainEntityKind\n /**\n * The domain entity description.\n */\n info: IThing\n\n /**\n * Optional general purpose tags for the UI.\n */\n tags?: string[]\n\n /**\n * The semantics applied to this entity.\n * This is a list of applied semantics that can be used to\n * describe the entity in more detail.\n */\n semantics?: AppliedDataSemantic[]\n\n /**\n * The ordered list of fields (properties and associations) in the schema.\n * These only keep references to the properties and associations.\n * The order of the fields is important as it defines the order of the\n * properties in the schema.\n */\n fields?: EntityOrderedItem[]\n\n /**\n * Whether this entity is deprecated.\n */\n deprecated?: boolean\n}\n\n/**\n * Represents an entity within a data domain model.\n *\n * A `DomainEntity` defines a structured data type,\n * containing properties and associations. It's a\n * fundamental building block for modeling complex data\n * structures.\n *\n * **Key Features:**\n *\n * - **Properties:** Defines the data elements (fields) within the entity.\n * - **Associations:** Defines relationships to other entities.\n * - **Inheritance:** Supports inheriting properties and associations from parent entities.\n * - **Metadata:** Supports tags, semantics, and deprecation status.\n * - **AMF Shape Generation:** Can be serialized to an AMF (API Modeling Framework) shape.\n * - **Example Generation:** Can generate example databased on its schema.\n *\n * **Usage:**\n *\n * The preferred way to create a `DomainEntity` is through\n * the `DomainModel.addEntity()` method.\n *\n * **Example:**\n *\n * ```typescript\n * const dataDomain = new DataDomain();\n * const userModel = dataDomain.addModel({ key: 'userModel' });\n * const userEntity = userModel.addEntity({ key: 'user' });\n * ```\n *\n * Entity Validation Rules:\n *\n * - **Primary Key:** An entity must have a primary key selected. This can come from a parent\n * entity or be defined in the current entity.\n * - **Parent Entity:** The parent entity must exist in the graph.\n * - **Circular Dependency:** Adding a parent entity that creates a circular dependency is not allowed.\n * - **Unique Parent:** An entity cannot have the same parent more than once.\n * - **Property Shadowing:** A property can shadow a parent property. This means that if a property\n * with the same key exists in both the parent and child entity, the child property will take precedence.\n * - **Association Shadowing:** An association can shadow a parent association. This means that if an\n * association with the same key exists in both the parent and child entity,\n * the child association will take precedence.\n * - **Property Resolution:** When the same property exists more than one parent and the child entity,\n * doesn't explicitly define the property, then:\n * - The last parent entity (iterating from the first entity to the last) that has the property\n * will be used as the source of the property.\n * - **Association Resolution:** When the same association exists more than one parent and the child entity,\n * doesn't explicitly define the association, then:\n * - The last parent entity (iterating from the first entity to the last) that has the association\n * will be used as the source of the association.\n * - **Minimum Required Properties:** An entity must have at least one property defined. Entities without properties\n * are ignored in the system.\n * - **Entity Name**:\n * - An entity must have a name defined.\n * - The name has to follow the same rules as the names in a SQL database. This means that the name must be unique\n * within the data domain and cannot contain special characters.\n * - **Association Targets:** An association must have a target entity defined.\n * This means that the association must point to at least one entity.\n */\nexport class DomainEntity extends DomainElement {\n /**\n * The kind of the domain element.\n */\n override kind: typeof DomainEntityKind\n\n /**\n * The description of the domain entity.\n */\n @retargetChange() accessor info: Thing\n\n /**\n * Optional general purpose tags for the UI.\n */\n @observed({ deep: true }) accessor tags: string[]\n\n /**\n * Semantics applied to this property.\n */\n @observed({ deep: true }) accessor semantics: AppliedDataSemantic[] = []\n\n /**\n * The ordered list of fields (properties and associations) in the schema.\n * These only keep references to the properties and associations.\n * The order of the fields is important as it defines the order of the\n * properties in the schema.\n */\n accessor fields: EntityOrderedItem[]\n\n /**\n * Whether this entity is deprecated.\n */\n @observed() accessor deprecated: boolean | undefined\n\n /**\n * Creates a full data entity schema with defaults.\n *\n * @param input The partial data entity schema.\n * @returns The data entity schema.\n */\n static createSchema(input: Partial<DomainEntitySchema> = {}): DomainEntitySchema {\n const { key = nanoid(), tags, semantics, fields, deprecated } = input\n const info = Thing.fromJSON(input.info, { name: 'new_entity' }).toJSON()\n const result: DomainEntitySchema = {\n kind: DomainEntityKind,\n key,\n info,\n }\n if (Array.isArray(tags)) {\n result.tags = [...tags]\n }\n if (Array.isArray(semantics)) {\n result.semantics = [...semantics]\n }\n if (Array.isArray(fields)) {\n result.fields = [...fields]\n }\n if (typeof deprecated === 'boolean') {\n result.deprecated = deprecated\n }\n return result\n }\n\n /**\n * Creates a new domain entity instance.\n *\n * You probably want to use the `DomainModel.addEntity()`\n * method instead.\n *\n * @param root A reference to the root DataDomain instance.\n * @param input The partial domain entity schema.\n */\n constructor(root: DataDomain, input?: Partial<DomainEntitySchema>) {\n const init = DomainEntity.createSchema(input)\n super(root, init.key)\n this.kind = DomainEntityKind\n this.info = new Thing(init.info)\n if (Array.isArray(init.tags)) {\n this.tags = [...init.tags]\n } else {\n this.tags = []\n }\n if (Array.isArray(init.semantics)) {\n this.semantics = init.semantics.map((item) => structuredClone(item))\n } else {\n this.semantics = []\n }\n if (Array.isArray(init.fields)) {\n this.fields = [...init.fields]\n } else {\n this.fields = []\n }\n if (typeof init.deprecated === 'boolean') {\n this.deprecated = init.deprecated\n }\n }\n\n /**\n * Generates a JSON representation of the entity.\n *\n * @returns A plain object representation of the `DomainEntity`.\n */\n toJSON(): DomainEntitySchema {\n const result: DomainEntitySchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n }\n if (Array.isArray(this.fields) && this.fields.length) {\n result.fields = [...this.fields]\n }\n if (Array.isArray(this.semantics) && this.semantics.length) {\n result.semantics = toRaw(this, this.semantics)?.map((i) => structuredClone(i))\n }\n if (Array.isArray(this.tags) && this.tags.length) {\n result.tags = [...(toRaw(this, this.tags) as string[])]\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n return result\n }\n\n /**\n * Returns a parent data entity where this data property\n * exist.\n *\n * @returns The parent `DomainModel` or undefined if not found.\n * @example\n * ```typescript\n * const parent = entity.getParentInstance();\n * if (parent) {\n * console.log(parent.key);\n * }\n * ```\n */\n getParentInstance(): DomainModel | undefined {\n const parentKey = this.root.graph.parent(this.key)\n if (!parentKey) {\n return undefined\n }\n return this.root.graph.node(parentKey) as DomainModel | undefined\n }\n\n /**\n * Adds a property to this entity.\n *\n * @param property The partial property schema.\n * @returns The created `DomainProperty` instance.\n * @example\n * ```typescript\n * const property = entity.addProperty({\n * key: 'name',\n * type: 'string',\n * required: true,\n * })\n * ```\n */\n addProperty(property?: Partial<DomainPropertySchema>): DomainProperty {\n if (property && property.key && this.root.graph.hasNode(property.key)) {\n throw new Error(`Trying to add a property ${property.key}, but it already exists`)\n }\n const instance = new DomainProperty(this.root, this.key, property)\n this.root.graph.setNode(instance.key, instance)\n this.root.graph.setEdge(this.key, instance.key, { type: 'property' })\n this.fields.push({\n type: 'property',\n key: instance.key,\n })\n this.root.notifyChange()\n return instance\n }\n\n /**\n * Removes a property from this entity.\n *\n * @param key The key of the property to remove.\n * @throws {RemovePropertyException} When the property does not exist.\n * @example\n * ```typescript\n * entity.removeProperty('name')\n * ```\n */\n removeProperty(key: string): void {\n if (!this.root.graph.hasNode(key)) {\n throw new RemovePropertyException(`Trying to remove the ${key} property, but it doesn't exist`)\n }\n const prop = this.root.graph.node(key) as DomainProperty\n if (prop.getParentInstance() !== this) {\n throw new RemovePropertyException(`Trying to remove the ${key} property, but it doesn't belong to this entity`)\n }\n removeGraphNode(this.root.graph, key)\n this.removeField(key)\n this.root.notifyChange()\n }\n\n /**\n * A shortcut to `listProperties()`.\n */\n get properties(): Generator<DomainProperty> {\n return this.listProperties()\n }\n\n /**\n * Lists all properties of this entity.\n *\n * Note, it accounts for the order of the properties as\n * defined in the `fields` array.\n *\n * @returns A generator that yields each `DomainProperty`.\n * @example\n * ```typescript\n * for (const property of entity.listProperties()) {\n * console.log(property.key);\n * }\n * ```\n */\n *listProperties(): Generator<DomainProperty> {\n for (const { key, type } of this.fields) {\n if (type !== 'property') {\n continue\n }\n const node = this.root.graph.node(key)\n if (!node || node.kind !== DomainPropertyKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this entity has any properties.\n *\n * @returns True if the entity has properties.\n * @example\n * ```typescript\n * if (entity.hasProperties()) {\n * // ...\n * }\n * ```\n */\n hasProperties(): boolean {\n return this.fields.some((item) => item.type === 'property')\n }\n\n /**\n * A shortcut to `listParents()`.\n */\n get parents(): Generator<DomainEntity> {\n return this.listParents()\n }\n\n /**\n * Lists all parent entities of this entity.\n *\n * @returns A generator that yields each parent `DomainEntity`.\n * @example\n * ```typescript\n * for (const parent of entity.listParents()) {\n * console.log(parent.key);\n * }\n * ```\n */\n *listParents(): Generator<DomainEntity> {\n for (const edge of this.root.graph.outEdges(this.key)) {\n const value = this.root.graph.edge(edge)\n if (!value || value.type !== 'parent') {\n continue\n }\n const parent = this.root.graph.node(edge.w) as DomainEntity\n if (parent) {\n yield parent\n }\n }\n }\n\n /**\n * Adds a parent to this entity.\n *\n * @param key The key of the parent entity.\n * @param domain The key of the foreign domain the parent belongs to.\n * @returns `this` for chaining.\n * @throws ValidationError When the parent does not exist or a circular dependency is detected.\n * @example\n * ```typescript\n * entity.addParent('baseEntity');\n * ```\n */\n addParent(key: string, domain?: string): this {\n const effectiveKey = domain ? `${domain}:${key}` : key\n // Prevent adding self as parent\n if (effectiveKey === this.key) {\n const message = 'Entity cannot be a parent of itself'\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'circular',\n },\n ],\n { message }\n )\n }\n const { graph } = this.root\n if (!graph.hasNode(effectiveKey)) {\n let message = `Entity with key \"${key}\" not found`\n if (domain) {\n message += ` in domain \"${domain}\"`\n }\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'required',\n },\n ],\n { message }\n )\n }\n // Check for circular inheritance\n if (this.hasCircularParent(effectiveKey)) {\n const message = `Circular inheritance detected. Cannot add ${key} as a parent`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'circular',\n },\n ],\n { message }\n )\n }\n if (graph.outEdges(this.key, effectiveKey).next().value) {\n const message = `Parent ${key} already exists`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'unique',\n },\n ],\n { message }\n )\n }\n // Parents are associated through graph edges.\n // Otherwise it would collide with the parent model.\n if (domain) {\n graph.setEdge(this.key, effectiveKey, { type: 'parent', domain, foreign: true })\n } else {\n graph.setEdge(this.key, effectiveKey, { type: 'parent' })\n }\n this.root.notifyChange()\n return this\n }\n\n /**\n * Removes a parent from this entity.\n *\n * @param key The key of the parent entity to remove.\n * @returns `this` for chaining.\n * @throws Error When the parent does not exist.\n * @example\n * ```typescript\n * entity.removeParent('baseEntity');\n * ```\n */\n removeParent(key: string): this {\n const { graph } = this.root\n if (!graph.hasEdge(this.key, key)) {\n throw new Error(`Trying to remove a parent ${key} from ${this.key}, but it doesn't exist`)\n }\n graph.removeEdge(this.key, key)\n this.root.notifyChange()\n return this\n }\n\n /**\n * Checks if this entity has any parents.\n *\n * @returns True if the entity has parents.\n * @example\n * ```typescript\n * if (entity.hasParents()) {\n * // ...\n * }\n * ```\n */\n hasParents(): boolean {\n for (const edge of this.root.graph.outEdges(this.key)) {\n if (this.root.graph.edge(edge)?.type === 'parent') {\n return true\n }\n }\n return false\n }\n\n /**\n * Checks if the passed entity has a circular parent\n * relationship when attempting to add a new parent.\n *\n * @param key The key of the parent being added.\n * @returns True if adding this parent would create a\n * circular relationship.\n */\n hasCircularParent(key: string): boolean {\n const { graph } = this.root\n\n // Check if new parent is one of the children.\n for (const edge of graph.outEdges(key, this.key)) {\n if (graph.edge(edge)?.type === 'parent') {\n return true\n }\n }\n\n // check if this entity is in parents chain.\n let current: DomainEntity | undefined = graph.node(key) as DomainEntity | undefined\n while (current) {\n if (current.key === this.key) {\n return true\n }\n const parents = [...current.listParents()]\n if (parents.length === 0) {\n break\n }\n // Assuming single inheritance\n // TODO: Update this to check for multiple parents.\n current = parents[0]\n }\n\n return false\n }\n\n /**\n * Creates breadcrumbs from this entity to the root\n * namespace.\n *\n * @returns An array of `FileBreadcrumb` instances.\n * @example\n * ```typescript\n * const breadcrumbs = entity.breadcrumbs();\n * console.log(breadcrumbs);\n * ```\n */\n breadcrumbs(): FileBreadcrumb[] {\n const result: FileBreadcrumb[] = []\n result.push({\n key: this.key,\n name: this.info.getLabel('Unnamed entity'),\n kind: DomainEntityKind,\n })\n const model = this.getParentInstance()\n if (model) {\n result.push({\n key: model.key,\n kind: model.kind,\n name: model.info.getLabel('Unnamed model'),\n })\n let parent: DataDomain | DomainNamespace = model.getParentInstance()\n while (parent && parent !== this.root) {\n result.push({\n key: parent.key,\n kind: parent.kind,\n name: parent.info.getLabel('Unnamed namespace'),\n })\n const typed = parent as DomainNamespace\n parent = typed.getParentInstance()\n }\n }\n result.push({\n key: this.root.key,\n name: this.root.info.getLabel('Unnamed data domain'),\n kind: this.root.kind,\n })\n return result.reverse()\n }\n\n /**\n * Adds an association to this entity.\n *\n * @param init The association options.\n * @param input The partial association schema.\n * @returns The created `DomainAssociation` instance.\n * @throws Error When the target entity does not exist.\n * @example\n * ```typescript\n * const association = entity.addAssociation({\n * key: 'address',\n * });\n * ```\n */\n addAssociation(init: AssociationAddOptions = {}, input?: Partial<DomainAssociationSchema>): DomainAssociation {\n const { graph } = this.root\n if (init.domain && init.key) {\n // target is foreign\n const foreignKey = `${init.domain}:${init.key}`\n if (!graph.hasNode(foreignKey)) {\n throw new Error(`Foreign entity ${foreignKey} not found`)\n }\n } else if (init.key) {\n if (!graph.hasNode(init.key)) {\n throw new Error(`Target entity ${init.key} not found`)\n }\n }\n const item = new DomainAssociation(this.root, this.key, input)\n graph.setNode(item.key, item)\n graph.setEdge(this.key, item.key, { type: 'association' })\n if (init.key) {\n item.addTarget(init.key, init.domain)\n }\n this.fields.push({ type: 'association', key: item.key })\n this.root.notifyChange()\n return item\n }\n\n /**\n * Removes an association from this entity.\n *\n * @param key The key of the association to remove.\n * @throws Error When the association does not exist.\n * @example\n * ```typescript\n * entity.removeAssociation('address');\n * ```\n */\n removeAssociation(key: string): void {\n if (!this.root.graph.hasEdge(this.key, key)) {\n throw new Error(`Unable to find a connection between this entity and the ${key} association`)\n }\n const edge = this.root.graph.edge(this.key, key)\n if (!edge || edge.type !== 'association') {\n throw new Error(`Association ${key} does not exist`)\n }\n removeGraphNode(this.root.graph, key)\n this.removeField(key)\n this.root.notifyChange()\n }\n\n /**\n * A shortcut to `listAssociations()`.\n */\n get associations(): Generator<DomainAssociation> {\n return this.listAssociations()\n }\n\n /**\n * Lists all associations of this entity.\n *\n * The order of the associations is defined in the `fields` array.\n *\n * @returns A generator that yields each\n * `DomainAssociation`.\n * @example\n * ```typescript\n * for (const association of entity.listAssociations()) {\n * console.log(association.key);\n * }\n * ```\n */\n *listAssociations(): Generator<DomainAssociation> {\n for (const { key, type } of this.fields) {\n if (type !== 'association') {\n continue\n }\n const node = this.root.graph.node(key)\n if (!node || node.kind !== DomainAssociationKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this entity has any associations.\n *\n * @returns True if the entity has associations.\n * @example\n * ```typescript\n * if (entity.hasAssociations()) {\n * // ...\n * }\n * ```\n */\n hasAssociations(): boolean {\n return this.fields.some((item) => item.type === 'association')\n }\n\n /**\n * Lists all fields (properties and associations) of this entity.\n *\n * @returns A generator that yields each `DomainAssociation` or `DomainProperty`.\n * @example\n * ```typescript\n * for (const field of entity.listFields()) {\n * console.log(field.key);\n * }\n * ```\n */\n *listFields(): Generator<DomainAssociation | DomainProperty> {\n for (const { key } of this.fields) {\n const node = this.root.graph.node(key)\n if (!node) {\n continue\n }\n if (node.kind === DomainAssociationKind || node.kind === DomainPropertyKind) {\n yield node\n }\n }\n }\n\n /**\n * Checks if this entity has any fields (properties or associations).\n *\n * @returns True if the entity has fields.\n * @example\n * ```typescript\n * if (entity.hasFields()) {\n * // ...\n * }\n * ```\n */\n hasFields(): boolean {\n return this.fields.length > 0\n }\n\n private removeField(key: string): void {\n this.fields = this.fields.filter((item) => item.key !== key)\n }\n\n /**\n * Creates an AMF's data Shape.\n *\n * The property itself is auto-generated. If the `schema` is defined then it is used\n * as the `range` of the property. Otherwise basic shape is generated for the range.\n *\n * This is a preferred way of reading the AMF shape as this synchronizes changed\n * data properties with the shape definition.\n *\n * @returns AMF property shape definition.\n */\n toApiShape(): IShapeUnion {\n const serializer = new ShapeGenerator()\n return serializer.entity(this)\n }\n\n /**\n * Reads the schema of the Entity and generates an example for it.\n *\n * @param mime The mime type of the example.\n * @param opts The example generation options.\n * @returns The generated example.\n * @example\n * ```typescript\n * const example = entity.toExample('application/json');\n * console.log(example);\n * ```\n */\n toExample(mime: string, opts: IShapeRenderOptions = {}): string | number | boolean | null | undefined {\n const shape = this.toApiShape()\n const generator = new ApiSchemaGenerator(mime, {\n renderExamples: typeof opts.renderExamples === 'boolean' ? opts.renderExamples : true,\n renderMocked: typeof opts.renderMocked === 'boolean' ? opts.renderMocked : true,\n renderOptional: typeof opts.renderOptional === 'boolean' ? opts.renderOptional : true,\n selectedUnions: opts.selectedUnions,\n })\n return generator.generate(shape)\n }\n\n /**\n * Checks whether the entity is a child of the given namespace or data model.\n * The relationship doesn't have to be direct, as long as the entity\n * is in the hierarchy it will return true.\n *\n * @param key The key of the parent to check.\n * @returns True if this entity is a child of the given namespace or data model.\n */\n isChildOf(key: string): boolean {\n if (this.key === key) {\n return false\n }\n const parent = this.getParentInstance()\n if (!parent) {\n return false\n }\n if (parent.key === key) {\n return true\n }\n return parent.isChildOf(key)\n }\n\n /**\n * Finds the primary key property of this entity.\n * @returns The primary key property of this entity or undefined if not found.\n */\n primaryKey(): DomainProperty | undefined {\n for (const property of this.properties) {\n if (property.primary) {\n return property\n }\n }\n let property: DomainProperty | undefined\n for (const parent of this.listParents()) {\n const prop = parent.primaryKey()\n if (prop) {\n // According to the validation rules, the last parent\n // that has the property will be used as the source of\n // the property.\n // In the future, we may add a schema definition to the entity that\n // will explicitly define which property to use.\n property = prop\n }\n }\n return property\n }\n\n /**\n * Adds or updates a semantic to the entity.\n * @param semantic The semantic to add to the entity.\n * @throws Error if the semantic is not an entity semantic.\n */\n addSemantic(semantic: AppliedDataSemantic): void {\n const sem = DataSemantics[semantic.id]\n if (!isEntitySemantic(sem)) {\n throw new Error(`Invalid semantic type: ${semantic.id}. Expected an entity semantic.`)\n }\n const index = this.semantics.findIndex((s) => s.id === semantic.id)\n if (index >= 0) {\n this.semantics[index] = semantic\n } else {\n this.semantics.push(semantic)\n }\n this.domain.notifyChange()\n }\n\n /**\n * Removes a semantic from the entity.\n * @param semanticId The ID of the semantic to remove.\n */\n removeSemantic(semanticId: SemanticType): void {\n const index = this.semantics.findIndex((s) => s.id === semanticId)\n if (index >= 0) {\n this.semantics.splice(index, 1)\n this.domain.notifyChange()\n }\n }\n\n /**\n * Checks if the entity has a specific semantic.\n * @param semanticId The ID of the semantic to check.\n * @returns True if the semantic is present, false otherwise.\n */\n hasSemantic(semanticId: SemanticType): boolean {\n return this.semantics.some((s) => s.id === semanticId)\n }\n}\n"]}
1
+ {"version":3,"file":"DomainEntity.js","sourceRoot":"","sources":["../../../src/modeling/DomainEntity.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAChG,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAe,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE/D,OAAO,EAAE,cAAc,EAA6B,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAA;AACpF,OAAO,EAAE,iBAAiB,EAA2B,MAAM,wBAAwB,CAAA;AAKnF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAA+C,MAAM,gBAAgB,CAAA;AA+C7G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;IACU,YAAY;sBAAS,aAAa;;;;;;;;;;;;;iBAAlC,YAAa,SA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C,GAAG,QAAQ,CAAA;YAClC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAC/B,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;QAC5B,CAAC;QAED;;;WAGG;QACH,cAAc,CAAC,UAAwB;YACrC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAA;YAClE,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;gBAC/B,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;YAC5B,CAAC;QACH,CAAC;QAED;;;;WAIG;QACH,WAAW,CAAC,UAAwB;YAClC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAA;QACxD,CAAC;;;SApvBU,YAAY","sourcesContent":["import type { DataDomain } from './DataDomain.js'\nimport { DomainAssociationKind, DomainEntityKind, DomainPropertyKind } from '../models/kinds.js'\nimport { DomainElement, type DomainElementSchema } from './DomainElement.js'\nimport { nanoid } from '../nanoid.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport { observed, retargetChange, toRaw } from './observed.js'\nimport type { IShapeUnion } from '../amf/definitions/Shapes.js'\nimport { DomainProperty, type DomainPropertySchema } from './DomainProperty.js'\nimport { RemovePropertyException } from '../exceptions/remove_property_exception.js'\nimport { DomainAssociation, DomainAssociationSchema } from './DomainAssociation.js'\nimport type { AssociationAddOptions } from './types.js'\nimport type { FileBreadcrumb } from '../models/store/File.js'\nimport type { DomainModel } from './DomainModel.js'\nimport type { DomainNamespace } from './DomainNamespace.js'\nimport { ValidationError } from '../exceptions/validation_error.js'\nimport { ShapeGenerator } from './amf/ShapeGenerator.js'\nimport type { IShapeRenderOptions } from '../amf/shape/ShapeBase.js'\nimport { ApiSchemaGenerator } from '../amf/ApiSchemaGenerator.js'\nimport { removeGraphNode } from './GraphUtils.js'\nimport { DataSemantics, isEntitySemantic, type SemanticType, type AppliedDataSemantic } from './Semantics.js'\n\nexport interface EntityOrderedItem {\n /**\n * The type of the ordered item.\n */\n type: 'property' | 'association'\n\n /**\n * The key of the ordered item.\n */\n key: string\n}\n\nexport interface DomainEntitySchema extends DomainElementSchema {\n kind: typeof DomainEntityKind\n /**\n * The domain entity description.\n */\n info: IThing\n\n /**\n * Optional general purpose tags for the UI.\n */\n tags?: string[]\n\n /**\n * The semantics applied to this entity.\n * This is a list of applied semantics that can be used to\n * describe the entity in more detail.\n */\n semantics?: AppliedDataSemantic[]\n\n /**\n * The ordered list of fields (properties and associations) in the schema.\n * These only keep references to the properties and associations.\n * The order of the fields is important as it defines the order of the\n * properties in the schema.\n */\n fields?: EntityOrderedItem[]\n\n /**\n * Whether this entity is deprecated.\n */\n deprecated?: boolean\n}\n\n/**\n * Represents an entity within a data domain model.\n *\n * A `DomainEntity` defines a structured data type,\n * containing properties and associations. It's a\n * fundamental building block for modeling complex data\n * structures.\n *\n * **Key Features:**\n *\n * - **Properties:** Defines the data elements (fields) within the entity.\n * - **Associations:** Defines relationships to other entities.\n * - **Inheritance:** Supports inheriting properties and associations from parent entities.\n * - **Metadata:** Supports tags, semantics, and deprecation status.\n * - **AMF Shape Generation:** Can be serialized to an AMF (API Modeling Framework) shape.\n * - **Example Generation:** Can generate example databased on its schema.\n *\n * **Usage:**\n *\n * The preferred way to create a `DomainEntity` is through\n * the `DomainModel.addEntity()` method.\n *\n * **Example:**\n *\n * ```typescript\n * const dataDomain = new DataDomain();\n * const userModel = dataDomain.addModel({ key: 'userModel' });\n * const userEntity = userModel.addEntity({ key: 'user' });\n * ```\n *\n * Entity Validation Rules:\n *\n * - **Primary Key:** An entity must have a primary key selected. This can come from a parent\n * entity or be defined in the current entity.\n * - **Parent Entity:** The parent entity must exist in the graph.\n * - **Circular Dependency:** Adding a parent entity that creates a circular dependency is not allowed.\n * - **Unique Parent:** An entity cannot have the same parent more than once.\n * - **Property Shadowing:** A property can shadow a parent property. This means that if a property\n * with the same key exists in both the parent and child entity, the child property will take precedence.\n * - **Association Shadowing:** An association can shadow a parent association. This means that if an\n * association with the same key exists in both the parent and child entity,\n * the child association will take precedence.\n * - **Property Resolution:** When the same property exists more than one parent and the child entity,\n * doesn't explicitly define the property, then:\n * - The last parent entity (iterating from the first entity to the last) that has the property\n * will be used as the source of the property.\n * - **Association Resolution:** When the same association exists more than one parent and the child entity,\n * doesn't explicitly define the association, then:\n * - The last parent entity (iterating from the first entity to the last) that has the association\n * will be used as the source of the association.\n * - **Minimum Required Properties:** An entity must have at least one property defined. Entities without properties\n * are ignored in the system.\n * - **Entity Name**:\n * - An entity must have a name defined.\n * - The name has to follow the same rules as the names in a SQL database. This means that the name must be unique\n * within the data domain and cannot contain special characters.\n * - **Association Targets:** An association must have a target entity defined.\n * This means that the association must point to at least one entity.\n */\nexport class DomainEntity extends DomainElement {\n /**\n * The kind of the domain element.\n */\n override kind: typeof DomainEntityKind\n\n /**\n * The description of the domain entity.\n */\n @retargetChange() accessor info: Thing\n\n /**\n * Optional general purpose tags for the UI.\n */\n @observed({ deep: true }) accessor tags: string[]\n\n /**\n * Semantics applied to this property.\n */\n @observed({ deep: true }) accessor semantics: AppliedDataSemantic[] = []\n\n /**\n * The ordered list of fields (properties and associations) in the schema.\n * These only keep references to the properties and associations.\n * The order of the fields is important as it defines the order of the\n * properties in the schema.\n */\n accessor fields: EntityOrderedItem[]\n\n /**\n * Whether this entity is deprecated.\n */\n @observed() accessor deprecated: boolean | undefined\n\n /**\n * Creates a full data entity schema with defaults.\n *\n * @param input The partial data entity schema.\n * @returns The data entity schema.\n */\n static createSchema(input: Partial<DomainEntitySchema> = {}): DomainEntitySchema {\n const { key = nanoid(), tags, semantics, fields, deprecated } = input\n const info = Thing.fromJSON(input.info, { name: 'new_entity' }).toJSON()\n const result: DomainEntitySchema = {\n kind: DomainEntityKind,\n key,\n info,\n }\n if (Array.isArray(tags)) {\n result.tags = [...tags]\n }\n if (Array.isArray(semantics)) {\n result.semantics = [...semantics]\n }\n if (Array.isArray(fields)) {\n result.fields = [...fields]\n }\n if (typeof deprecated === 'boolean') {\n result.deprecated = deprecated\n }\n return result\n }\n\n /**\n * Creates a new domain entity instance.\n *\n * You probably want to use the `DomainModel.addEntity()`\n * method instead.\n *\n * @param root A reference to the root DataDomain instance.\n * @param input The partial domain entity schema.\n */\n constructor(root: DataDomain, input?: Partial<DomainEntitySchema>) {\n const init = DomainEntity.createSchema(input)\n super(root, init.key)\n this.kind = DomainEntityKind\n this.info = new Thing(init.info)\n if (Array.isArray(init.tags)) {\n this.tags = [...init.tags]\n } else {\n this.tags = []\n }\n if (Array.isArray(init.semantics)) {\n this.semantics = init.semantics.map((item) => structuredClone(item))\n } else {\n this.semantics = []\n }\n if (Array.isArray(init.fields)) {\n this.fields = [...init.fields]\n } else {\n this.fields = []\n }\n if (typeof init.deprecated === 'boolean') {\n this.deprecated = init.deprecated\n }\n }\n\n /**\n * Generates a JSON representation of the entity.\n *\n * @returns A plain object representation of the `DomainEntity`.\n */\n toJSON(): DomainEntitySchema {\n const result: DomainEntitySchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n }\n if (Array.isArray(this.fields) && this.fields.length) {\n result.fields = [...this.fields]\n }\n if (Array.isArray(this.semantics) && this.semantics.length) {\n result.semantics = toRaw(this, this.semantics)?.map((i) => structuredClone(i))\n }\n if (Array.isArray(this.tags) && this.tags.length) {\n result.tags = [...(toRaw(this, this.tags) as string[])]\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n return result\n }\n\n /**\n * Returns a parent data entity where this data property\n * exist.\n *\n * @returns The parent `DomainModel` or undefined if not found.\n * @example\n * ```typescript\n * const parent = entity.getParentInstance();\n * if (parent) {\n * console.log(parent.key);\n * }\n * ```\n */\n getParentInstance(): DomainModel | undefined {\n const parentKey = this.root.graph.parent(this.key)\n if (!parentKey) {\n return undefined\n }\n return this.root.graph.node(parentKey) as DomainModel | undefined\n }\n\n /**\n * Adds a property to this entity.\n *\n * @param property The partial property schema.\n * @returns The created `DomainProperty` instance.\n * @example\n * ```typescript\n * const property = entity.addProperty({\n * key: 'name',\n * type: 'string',\n * required: true,\n * })\n * ```\n */\n addProperty(property?: Partial<DomainPropertySchema>): DomainProperty {\n if (property && property.key && this.root.graph.hasNode(property.key)) {\n throw new Error(`Trying to add a property ${property.key}, but it already exists`)\n }\n const instance = new DomainProperty(this.root, this.key, property)\n this.root.graph.setNode(instance.key, instance)\n this.root.graph.setEdge(this.key, instance.key, { type: 'property' })\n this.fields.push({\n type: 'property',\n key: instance.key,\n })\n this.root.notifyChange()\n return instance\n }\n\n /**\n * Removes a property from this entity.\n *\n * @param key The key of the property to remove.\n * @throws {RemovePropertyException} When the property does not exist.\n * @example\n * ```typescript\n * entity.removeProperty('name')\n * ```\n */\n removeProperty(key: string): void {\n if (!this.root.graph.hasNode(key)) {\n throw new RemovePropertyException(`Trying to remove the ${key} property, but it doesn't exist`)\n }\n const prop = this.root.graph.node(key) as DomainProperty\n if (prop.getParentInstance() !== this) {\n throw new RemovePropertyException(`Trying to remove the ${key} property, but it doesn't belong to this entity`)\n }\n removeGraphNode(this.root.graph, key)\n this.removeField(key)\n this.root.notifyChange()\n }\n\n /**\n * A shortcut to `listProperties()`.\n */\n get properties(): Generator<DomainProperty> {\n return this.listProperties()\n }\n\n /**\n * Lists all properties of this entity.\n *\n * Note, it accounts for the order of the properties as\n * defined in the `fields` array.\n *\n * @returns A generator that yields each `DomainProperty`.\n * @example\n * ```typescript\n * for (const property of entity.listProperties()) {\n * console.log(property.key);\n * }\n * ```\n */\n *listProperties(): Generator<DomainProperty> {\n for (const { key, type } of this.fields) {\n if (type !== 'property') {\n continue\n }\n const node = this.root.graph.node(key)\n if (!node || node.kind !== DomainPropertyKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this entity has any properties.\n *\n * @returns True if the entity has properties.\n * @example\n * ```typescript\n * if (entity.hasProperties()) {\n * // ...\n * }\n * ```\n */\n hasProperties(): boolean {\n return this.fields.some((item) => item.type === 'property')\n }\n\n /**\n * A shortcut to `listParents()`.\n */\n get parents(): Generator<DomainEntity> {\n return this.listParents()\n }\n\n /**\n * Lists all parent entities of this entity.\n *\n * @returns A generator that yields each parent `DomainEntity`.\n * @example\n * ```typescript\n * for (const parent of entity.listParents()) {\n * console.log(parent.key);\n * }\n * ```\n */\n *listParents(): Generator<DomainEntity> {\n for (const edge of this.root.graph.outEdges(this.key)) {\n const value = this.root.graph.edge(edge)\n if (!value || value.type !== 'parent') {\n continue\n }\n const parent = this.root.graph.node(edge.w) as DomainEntity\n if (parent) {\n yield parent\n }\n }\n }\n\n /**\n * Adds a parent to this entity.\n *\n * @param key The key of the parent entity.\n * @param domain The key of the foreign domain the parent belongs to.\n * @returns `this` for chaining.\n * @throws ValidationError When the parent does not exist or a circular dependency is detected.\n * @example\n * ```typescript\n * entity.addParent('baseEntity');\n * ```\n */\n addParent(key: string, domain?: string): this {\n const effectiveKey = domain ? `${domain}:${key}` : key\n // Prevent adding self as parent\n if (effectiveKey === this.key) {\n const message = 'Entity cannot be a parent of itself'\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'circular',\n },\n ],\n { message }\n )\n }\n const { graph } = this.root\n if (!graph.hasNode(effectiveKey)) {\n let message = `Entity with key \"${key}\" not found`\n if (domain) {\n message += ` in domain \"${domain}\"`\n }\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'required',\n },\n ],\n { message }\n )\n }\n // Check for circular inheritance\n if (this.hasCircularParent(effectiveKey)) {\n const message = `Circular inheritance detected. Cannot add ${key} as a parent`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'circular',\n },\n ],\n { message }\n )\n }\n if (graph.outEdges(this.key, effectiveKey).next().value) {\n const message = `Parent ${key} already exists`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'unique',\n },\n ],\n { message }\n )\n }\n // Parents are associated through graph edges.\n // Otherwise it would collide with the parent model.\n if (domain) {\n graph.setEdge(this.key, effectiveKey, { type: 'parent', domain, foreign: true })\n } else {\n graph.setEdge(this.key, effectiveKey, { type: 'parent' })\n }\n this.root.notifyChange()\n return this\n }\n\n /**\n * Removes a parent from this entity.\n *\n * @param key The key of the parent entity to remove.\n * @returns `this` for chaining.\n * @throws Error When the parent does not exist.\n * @example\n * ```typescript\n * entity.removeParent('baseEntity');\n * ```\n */\n removeParent(key: string): this {\n const { graph } = this.root\n if (!graph.hasEdge(this.key, key)) {\n throw new Error(`Trying to remove a parent ${key} from ${this.key}, but it doesn't exist`)\n }\n graph.removeEdge(this.key, key)\n this.root.notifyChange()\n return this\n }\n\n /**\n * Checks if this entity has any parents.\n *\n * @returns True if the entity has parents.\n * @example\n * ```typescript\n * if (entity.hasParents()) {\n * // ...\n * }\n * ```\n */\n hasParents(): boolean {\n for (const edge of this.root.graph.outEdges(this.key)) {\n if (this.root.graph.edge(edge)?.type === 'parent') {\n return true\n }\n }\n return false\n }\n\n /**\n * Checks if the passed entity has a circular parent\n * relationship when attempting to add a new parent.\n *\n * @param key The key of the parent being added.\n * @returns True if adding this parent would create a\n * circular relationship.\n */\n hasCircularParent(key: string): boolean {\n const { graph } = this.root\n\n // Check if new parent is one of the children.\n for (const edge of graph.outEdges(key, this.key)) {\n if (graph.edge(edge)?.type === 'parent') {\n return true\n }\n }\n\n // check if this entity is in parents chain.\n let current: DomainEntity | undefined = graph.node(key) as DomainEntity | undefined\n while (current) {\n if (current.key === this.key) {\n return true\n }\n const parents = [...current.listParents()]\n if (parents.length === 0) {\n break\n }\n // Assuming single inheritance\n // TODO: Update this to check for multiple parents.\n current = parents[0]\n }\n\n return false\n }\n\n /**\n * Creates breadcrumbs from this entity to the root\n * namespace.\n *\n * @returns An array of `FileBreadcrumb` instances.\n * @example\n * ```typescript\n * const breadcrumbs = entity.breadcrumbs();\n * console.log(breadcrumbs);\n * ```\n */\n breadcrumbs(): FileBreadcrumb[] {\n const result: FileBreadcrumb[] = []\n result.push({\n key: this.key,\n name: this.info.getLabel('Unnamed entity'),\n kind: DomainEntityKind,\n })\n const model = this.getParentInstance()\n if (model) {\n result.push({\n key: model.key,\n kind: model.kind,\n name: model.info.getLabel('Unnamed model'),\n })\n let parent: DataDomain | DomainNamespace = model.getParentInstance()\n while (parent && parent !== this.root) {\n result.push({\n key: parent.key,\n kind: parent.kind,\n name: parent.info.getLabel('Unnamed namespace'),\n })\n const typed = parent as DomainNamespace\n parent = typed.getParentInstance()\n }\n }\n result.push({\n key: this.root.key,\n name: this.root.info.getLabel('Unnamed data domain'),\n kind: this.root.kind,\n })\n return result.reverse()\n }\n\n /**\n * Adds an association to this entity.\n *\n * @param init The association options.\n * @param input The partial association schema.\n * @returns The created `DomainAssociation` instance.\n * @throws Error When the target entity does not exist.\n * @example\n * ```typescript\n * const association = entity.addAssociation({\n * key: 'address',\n * });\n * ```\n */\n addAssociation(init: AssociationAddOptions = {}, input?: Partial<DomainAssociationSchema>): DomainAssociation {\n const { graph } = this.root\n if (init.domain && init.key) {\n // target is foreign\n const foreignKey = `${init.domain}:${init.key}`\n if (!graph.hasNode(foreignKey)) {\n throw new Error(`Foreign entity ${foreignKey} not found`)\n }\n } else if (init.key) {\n if (!graph.hasNode(init.key)) {\n throw new Error(`Target entity ${init.key} not found`)\n }\n }\n const item = new DomainAssociation(this.root, this.key, input)\n graph.setNode(item.key, item)\n graph.setEdge(this.key, item.key, { type: 'association' })\n if (init.key) {\n item.addTarget(init.key, init.domain)\n }\n this.fields.push({ type: 'association', key: item.key })\n this.root.notifyChange()\n return item\n }\n\n /**\n * Removes an association from this entity.\n *\n * @param key The key of the association to remove.\n * @throws Error When the association does not exist.\n * @example\n * ```typescript\n * entity.removeAssociation('address');\n * ```\n */\n removeAssociation(key: string): void {\n if (!this.root.graph.hasEdge(this.key, key)) {\n throw new Error(`Unable to find a connection between this entity and the ${key} association`)\n }\n const edge = this.root.graph.edge(this.key, key)\n if (!edge || edge.type !== 'association') {\n throw new Error(`Association ${key} does not exist`)\n }\n removeGraphNode(this.root.graph, key)\n this.removeField(key)\n this.root.notifyChange()\n }\n\n /**\n * A shortcut to `listAssociations()`.\n */\n get associations(): Generator<DomainAssociation> {\n return this.listAssociations()\n }\n\n /**\n * Lists all associations of this entity.\n *\n * The order of the associations is defined in the `fields` array.\n *\n * @returns A generator that yields each\n * `DomainAssociation`.\n * @example\n * ```typescript\n * for (const association of entity.listAssociations()) {\n * console.log(association.key);\n * }\n * ```\n */\n *listAssociations(): Generator<DomainAssociation> {\n for (const { key, type } of this.fields) {\n if (type !== 'association') {\n continue\n }\n const node = this.root.graph.node(key)\n if (!node || node.kind !== DomainAssociationKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this entity has any associations.\n *\n * @returns True if the entity has associations.\n * @example\n * ```typescript\n * if (entity.hasAssociations()) {\n * // ...\n * }\n * ```\n */\n hasAssociations(): boolean {\n return this.fields.some((item) => item.type === 'association')\n }\n\n /**\n * Lists all fields (properties and associations) of this entity.\n *\n * @returns A generator that yields each `DomainAssociation` or `DomainProperty`.\n * @example\n * ```typescript\n * for (const field of entity.listFields()) {\n * console.log(field.key);\n * }\n * ```\n */\n *listFields(): Generator<DomainAssociation | DomainProperty> {\n for (const { key } of this.fields) {\n const node = this.root.graph.node(key)\n if (!node) {\n continue\n }\n if (node.kind === DomainAssociationKind || node.kind === DomainPropertyKind) {\n yield node\n }\n }\n }\n\n /**\n * Checks if this entity has any fields (properties or associations).\n *\n * @returns True if the entity has fields.\n * @example\n * ```typescript\n * if (entity.hasFields()) {\n * // ...\n * }\n * ```\n */\n hasFields(): boolean {\n return this.fields.length > 0\n }\n\n private removeField(key: string): void {\n this.fields = this.fields.filter((item) => item.key !== key)\n }\n\n /**\n * Creates an AMF's data Shape.\n *\n * The property itself is auto-generated. If the `schema` is defined then it is used\n * as the `range` of the property. Otherwise basic shape is generated for the range.\n *\n * This is a preferred way of reading the AMF shape as this synchronizes changed\n * data properties with the shape definition.\n *\n * @returns AMF property shape definition.\n */\n toApiShape(): IShapeUnion {\n const serializer = new ShapeGenerator()\n return serializer.entity(this)\n }\n\n /**\n * Reads the schema of the Entity and generates an example for it.\n *\n * @param mime The mime type of the example.\n * @param opts The example generation options.\n * @returns The generated example.\n * @example\n * ```typescript\n * const example = entity.toExample('application/json');\n * console.log(example);\n * ```\n */\n toExample(mime: string, opts: IShapeRenderOptions = {}): string | number | boolean | null | undefined {\n const shape = this.toApiShape()\n const generator = new ApiSchemaGenerator(mime, {\n renderExamples: opts.renderExamples ?? true,\n renderMocked: opts.renderMocked ?? true,\n renderOptional: opts.renderOptional ?? true,\n selectedUnions: opts.selectedUnions,\n })\n return generator.generate(shape)\n }\n\n /**\n * Checks whether the entity is a child of the given namespace or data model.\n * The relationship doesn't have to be direct, as long as the entity\n * is in the hierarchy it will return true.\n *\n * @param key The key of the parent to check.\n * @returns True if this entity is a child of the given namespace or data model.\n */\n isChildOf(key: string): boolean {\n if (this.key === key) {\n return false\n }\n const parent = this.getParentInstance()\n if (!parent) {\n return false\n }\n if (parent.key === key) {\n return true\n }\n return parent.isChildOf(key)\n }\n\n /**\n * Finds the primary key property of this entity.\n * @returns The primary key property of this entity or undefined if not found.\n */\n primaryKey(): DomainProperty | undefined {\n for (const property of this.properties) {\n if (property.primary) {\n return property\n }\n }\n let property: DomainProperty | undefined\n for (const parent of this.listParents()) {\n const prop = parent.primaryKey()\n if (prop) {\n // According to the validation rules, the last parent\n // that has the property will be used as the source of\n // the property.\n // In the future, we may add a schema definition to the entity that\n // will explicitly define which property to use.\n property = prop\n }\n }\n return property\n }\n\n /**\n * Adds or updates a semantic to the entity.\n * @param semantic The semantic to add to the entity.\n * @throws Error if the semantic is not an entity semantic.\n */\n addSemantic(semantic: AppliedDataSemantic): void {\n const sem = DataSemantics[semantic.id]\n if (!isEntitySemantic(sem)) {\n throw new Error(`Invalid semantic type: ${semantic.id}. Expected an entity semantic.`)\n }\n const index = this.semantics.findIndex((s) => s.id === semantic.id)\n if (index >= 0) {\n this.semantics[index] = semantic\n } else {\n this.semantics.push(semantic)\n }\n this.domain.notifyChange()\n }\n\n /**\n * Removes a semantic from the entity.\n * @param semanticId The ID of the semantic to remove.\n */\n removeSemantic(semanticId: SemanticType): void {\n const index = this.semantics.findIndex((s) => s.id === semanticId)\n if (index >= 0) {\n this.semantics.splice(index, 1)\n this.domain.notifyChange()\n }\n }\n\n /**\n * Checks if the entity has a specific semantic.\n * @param semanticId The ID of the semantic to check.\n * @returns True if the semantic is present, false otherwise.\n */\n hasSemantic(semanticId: SemanticType): boolean {\n return this.semantics.some((s) => s.id === semanticId)\n }\n}\n"]}
@@ -9,6 +9,7 @@ import type { DomainEntity } from './DomainEntity.js';
9
9
  import type { IApiPropertyShape } from '../amf/definitions/Shapes.js';
10
10
  import type { PropertySchema } from './types.js';
11
11
  import { type SemanticType, type AppliedDataSemantic } from './Semantics.js';
12
+ import type { IShapeRenderOptions } from '../amf/shape/ShapeBase.js';
12
13
  export interface DomainPropertySchema extends DomainElementSchema {
13
14
  kind: typeof DomainPropertyKind;
14
15
  /**
@@ -276,6 +277,23 @@ export declare class DomainProperty extends DomainElement {
276
277
  * @returns AMF property shape definition.
277
278
  */
278
279
  toApiShape(): IApiPropertyShape;
280
+ /**
281
+ * Generates an example value for this property based on its schema and type.
282
+ *
283
+ * This method converts the property to an AMF shape and then generates
284
+ * an example value using the ApiSchemaGenerator. The generated example
285
+ * respects the property's type, constraints, and any defined schema.
286
+ *
287
+ * @param mime The mime type of the example (e.g., 'application/json', 'application/xml').
288
+ * @param opts Optional configuration for example generation.
289
+ * @returns The generated example value.
290
+ * @example
291
+ * ```typescript
292
+ * const example = property.toExample('application/json');
293
+ * console.log(example);
294
+ * ```
295
+ */
296
+ toExample(mime: string, opts?: IShapeRenderOptions): string | number | boolean | null | undefined;
279
297
  /**
280
298
  * Adds or updates a semantic to the property.
281
299
  * @param semantic The semantic to add to the property.
@@ -1 +1 @@
1
- {"version":3,"file":"DomainProperty.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainProperty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE5E,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAGL,KAAK,uBAAuB,EAE5B,KAAK,oBAAoB,EAEzB,KAAK,kBAAkB,EAIxB,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAC3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAqC,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAE/G,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,IAAI,EAAE,OAAO,kBAAkB,CAAA;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO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AAmB;IASpC;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,UAAU,GAAG,gBAAgB,GAAG,SAAS;IAKnE;;;;;;;;;;;;OAYG;IACH,UAAU,IAAI,iBAAiB;IAK/B;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,mBAAwB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS;IAerG;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAchD;;;OAGG;IACH,cAAc,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI;IAQ9C;;;;OAIG;IACH,WAAW,CAAC,UAAU,EAAE,YAAY,GAAG,OAAO;CAG/C"}
@@ -7,6 +7,7 @@ import { observed, retargetChange, toRaw } from './observed.js';
7
7
  import { BinaryFormats, DomainPropertyAttributes, DomainPropertyList, DomainPropertyTypes, NumberFormats, } from './DataFormat.js';
8
8
  import { ShapeGenerator } from './amf/ShapeGenerator.js';
9
9
  import { DataSemantics, isPropertySemantic } from './Semantics.js';
10
+ import { ApiSchemaGenerator } from '../amf/ApiSchemaGenerator.js';
10
11
  /**
11
12
  * Represents a property within a data domain entity.
12
13
  *
@@ -551,6 +552,36 @@ let DomainProperty = (() => {
551
552
  const serializer = new ShapeGenerator();
552
553
  return serializer.property(this);
553
554
  }
555
+ /**
556
+ * Generates an example value for this property based on its schema and type.
557
+ *
558
+ * This method converts the property to an AMF shape and then generates
559
+ * an example value using the ApiSchemaGenerator. The generated example
560
+ * respects the property's type, constraints, and any defined schema.
561
+ *
562
+ * @param mime The mime type of the example (e.g., 'application/json', 'application/xml').
563
+ * @param opts Optional configuration for example generation.
564
+ * @returns The generated example value.
565
+ * @example
566
+ * ```typescript
567
+ * const example = property.toExample('application/json');
568
+ * console.log(example);
569
+ * ```
570
+ */
571
+ toExample(mime, opts = {}) {
572
+ // TODO: add support for semantic extensions and generate example values based on them.
573
+ const shape = this.toApiShape();
574
+ if (!shape.range) {
575
+ return undefined;
576
+ }
577
+ const generator = new ApiSchemaGenerator(mime, {
578
+ renderExamples: opts.renderExamples ?? true,
579
+ renderMocked: opts.renderMocked ?? true,
580
+ renderOptional: opts.renderOptional ?? true,
581
+ selectedUnions: opts.selectedUnions,
582
+ });
583
+ return generator.generate(shape);
584
+ }
554
585
  /**
555
586
  * Adds or updates a semantic to the property.
556
587
  * @param semantic The semantic to add to the property.
@@ -1 +1 @@
1
- {"version":3,"file":"DomainProperty.js","sourceRoot":"","sources":["../../../src/modeling/DomainProperty.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAe,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EAEL,aAAa,EAEb,wBAAwB,EAExB,kBAAkB,EAElB,mBAAmB,EAEnB,aAAa,GACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAMxD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAA+C,MAAM,gBAAgB,CAAA;AAqE/G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;IACU,cAAc;sBAAS,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAApC,cAAe,SAAQ,WAAa;;;gCAM9C,cAAc,EAAE;oCAKhB,QAAQ,EAAE;oCAKV,QAAQ,EAAE;mCAKV,QAAQ,EAAE;iCAKV,QAAQ,EAAE;oCAKV,QAAQ,EAAE;qCAKV,QAAQ,EAAE;sCAKV,QAAQ,EAAE;gCAS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,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAA;YAClE,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;gBAC/B,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;YAC5B,CAAC;QACH,CAAC;QAED;;;;WAIG;QACH,WAAW,CAAC,UAAwB;YAClC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAA;QACxD,CAAC;;;SAlcU,cAAc","sourcesContent":["import type { DataDomain } from './DataDomain.js'\nimport { DomainPropertyKind } from '../models/kinds.js'\nimport { DomainElement, type DomainElementSchema } from './DomainElement.js'\nimport { nanoid } from '../nanoid.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport { observed, retargetChange, toRaw } from './observed.js'\nimport {\n type BinaryFormat,\n BinaryFormats,\n type DomainPropertyAttribute,\n DomainPropertyAttributes,\n type DomainPropertyFormat,\n DomainPropertyList,\n type DomainPropertyType,\n DomainPropertyTypes,\n type NumberFormat,\n NumberFormats,\n} from './DataFormat.js'\nimport { ShapeGenerator } from './amf/ShapeGenerator.js'\nimport type { PropertyBinding, PropertyBindings, PropertyWebBindings } from './Bindings.js'\nimport type { ModelValidationOptions } from '../models/types.js'\nimport type { DomainEntity } from './DomainEntity.js'\nimport type { IApiPropertyShape } from '../amf/definitions/Shapes.js'\nimport type { PropertySchema } from './types.js'\nimport { DataSemantics, isPropertySemantic, type SemanticType, type AppliedDataSemantic } from './Semantics.js'\n\nexport interface DomainPropertySchema extends DomainElementSchema {\n kind: typeof DomainPropertyKind\n /**\n * The domain property description.\n */\n info: IThing\n /**\n * Wether the data property is required.\n */\n required?: boolean\n /**\n * Whether the data property allows multiple items.\n */\n multiple?: boolean\n /**\n * Whether this property describes a primary key of the entity.\n */\n primary?: boolean\n /**\n * Whether this property describes an indexed property of the entity.\n */\n index?: boolean\n /**\n * Whether the property is read only in the schema.\n */\n readOnly?: boolean\n /**\n * Whether the property is write only in the schema.\n */\n writeOnly?: boolean\n /**\n * Whether this property is deprecated.\n */\n deprecated?: boolean\n /**\n * Optional general purpose tags for the UI.\n */\n tags?: string[]\n /**\n * The semantics applied to this property.\n * This is a list of applied semantics that can be used to\n * describe the property in more detail.\n */\n semantics?: AppliedDataSemantic[]\n /**\n * The data type for this property.\n * Note, not all schemas support the same type. For example, defining `sint32`\n * works for protocol buffers, but does not for JSON. In such case we use default\n * translation `sint32` -> `number`. Another way it to create\n * a derivative entity for specific schema to describe specific schema case.\n */\n type: DomainPropertyType\n /**\n * The general schema definition of this property.\n * This is propagated to all bindings (when they support these properties).\n */\n schema?: PropertySchema\n /**\n * The list of bindings for this property.\n *\n * A binding defines a translation from a data model to a specific format.\n * For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs\n * or a protocol buffer schema.\n */\n bindings?: PropertyBinding[]\n}\n\n/**\n * Represents a property within a data domain entity.\n *\n * A `DomainProperty` defines a single data element within a\n * `DomainEntity`. It specifies the data type, constraints,\n * and other metadata for a specific piece of information.\n *\n * **Key Features:**\n *\n * - **Data Type:** Defines the type of data the property\n * holds (e.g., string, number, boolean, date).\n * - **Constraints:** Supports defining constraints such as\n * minimum/maximum values, enum values, and default values.\n * - **Bindings:** Allows defining how the property is\n * represented in different formats (e.g., web APIs,\n * protocol buffers).\n * - **Metadata:** Supports metadata such as tags, semantics,\n * read-only/write-only status, and deprecation.\n * - **Schema:** Allows defining a general schema for the\n * property, which is propagated to all bindings.\n *\n * **Usage:**\n *\n * Use the `DomainEntity.addProperty` method to add a new property to an\n * entity. The property can be created using the constructor, but it\n * won't be added to the graph until you call the `addProperty` method.\n *\n * **Example:**\n *\n * ```typescript\n * const entity = domainModel.addEntity({ key: 'user' });\n * const property = entity.addProperty({\n * key: 'name',\n * type: 'string',\n * required: true,\n * schema: {\n * minimum: 3,\n * maximum: 50,\n * },\n * });\n * ```\n */\nexport class DomainProperty extends DomainElement {\n override kind: typeof DomainPropertyKind\n\n /**\n * The description of the domain property.\n */\n @retargetChange() accessor info: Thing\n\n /**\n * Wether the data property is required.\n */\n @observed() accessor required: boolean | undefined\n\n /**\n * Whether the data property allows multiple items.\n */\n @observed() accessor multiple: boolean | undefined\n\n /**\n * Whether this property describes a primary key of the entity.\n */\n @observed() accessor primary: boolean | undefined\n\n /**\n * Whether this property describes an indexed property of the entity.\n */\n @observed() accessor index: boolean | undefined\n\n /**\n * Whether the property is read only in the schema.\n */\n @observed() accessor readOnly: boolean | undefined\n\n /**\n * Whether the property is write only in the schema.\n */\n @observed() accessor writeOnly: boolean | undefined\n\n /**\n * Whether this property is deprecated.\n */\n @observed() accessor deprecated: boolean | undefined\n\n /**\n * Optional general purpose tags for the UI.\n *\n * Note to implementations, use the `addTag()` method as it propagates the \"tag\" value in the namespace.\n * Also, the tags property is excluded from the observer properties.\n * Changes to this property will not notify the observers.\n */\n @observed({ deep: true }) accessor tags: string[] = []\n\n /**\n * Semantics applied to this property.\n */\n @observed({ deep: true }) accessor semantics: AppliedDataSemantic[] = []\n\n /**\n * The data type for this property.\n * Note, not all schemas support the same type. For example, defining `sint32`\n * works for protocol buffers but does not for JSON. In such case we use default\n * translation `sint32` -> `number`. Another way it to create\n * a derivative entity for specific schema to describe specific schema case.\n */\n @observed() accessor type: DomainPropertyType = 'string'\n\n /**\n * The general schema definition of this property.\n * This is propagated to all bindings (when they support these properties).\n */\n @observed({ deep: true }) accessor schema: PropertySchema | undefined\n\n /**\n * The list of bindings for this property.\n *\n * A binding defines a translation from a data model to a specific format.\n * For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs\n * or a protocol buffer schema.\n */\n @observed({ deep: true }) accessor bindings: PropertyBinding[] = []\n\n /**\n * Creates a full data model schema with defaults.\n *\n * @param input The partial data model schema.\n * @returns The data model schema.\n */\n static createSchema(input: Partial<DomainPropertySchema> = {}): DomainPropertySchema {\n const {\n key = nanoid(),\n multiple,\n required,\n type = DomainPropertyList.string,\n index,\n primary,\n readOnly,\n writeOnly,\n tags,\n semantics,\n deprecated,\n schema,\n bindings,\n } = input\n if (typeof type === 'string') {\n if (!DomainPropertyTypes.includes(type as DomainPropertyType)) {\n throw new Error(`Invalid data property type ${type}`)\n }\n }\n const info = Thing.fromJSON(input.info, { name: 'new_property' }).toJSON()\n const result: DomainPropertySchema = {\n kind: DomainPropertyKind,\n key,\n info,\n type,\n }\n if (typeof multiple === 'boolean') {\n result.multiple = multiple\n }\n if (typeof required === 'boolean') {\n result.required = required\n }\n if (typeof index === 'boolean') {\n result.index = index\n }\n if (typeof primary === 'boolean') {\n result.primary = primary\n }\n if (typeof readOnly === 'boolean') {\n result.readOnly = readOnly\n }\n if (typeof writeOnly === 'boolean') {\n result.writeOnly = writeOnly\n }\n if (typeof deprecated === 'boolean') {\n result.deprecated = deprecated\n }\n if (Array.isArray(tags)) {\n result.tags = [...tags]\n }\n if (Array.isArray(semantics)) {\n result.semantics = [...semantics]\n }\n if (schema) {\n result.schema = structuredClone(schema)\n }\n if (Array.isArray(bindings)) {\n result.bindings = bindings.map((i) => structuredClone(i))\n } else {\n result.bindings = []\n }\n return result\n }\n\n /**\n * The key of the parent entity.\n */\n protected parent: string\n\n /**\n * Creates a new domain property instance.\n * It does not add it to the graph.\n * You need to call the `addProperty` method of the graph or a data model to add it.\n *\n * Domain objects constructors shouldn't be used directly. Use methods\n * provided on the DataDomain class to create new objects.\n *\n * @param root A reference to the root DataDomain instance.\n * @param parent The key of the parent entity.\n * @param input The partial domain property schema.\n * @returns Created domain property instance.\n */\n constructor(root: DataDomain, parent: string, input: Partial<DomainPropertySchema> = {}) {\n const init = DomainProperty.createSchema(input)\n super(root, init.key)\n this.parent = parent\n this.kind = DomainPropertyKind\n this.info = new Thing(init.info)\n this.type = init.type\n\n if (typeof init.multiple === 'boolean') {\n this.multiple = init.multiple\n } else {\n this.multiple = undefined\n }\n if (typeof init.required === 'boolean') {\n this.required = init.required\n } else {\n this.required = undefined\n }\n if (typeof init.index === 'boolean') {\n this.index = init.index\n } else {\n this.index = undefined\n }\n if (typeof init.deprecated === 'boolean') {\n this.deprecated = init.deprecated\n } else {\n this.deprecated = undefined\n }\n if (typeof init.primary === 'boolean') {\n this.primary = init.primary\n } else {\n this.primary = undefined\n }\n if (typeof init.readOnly === 'boolean') {\n this.readOnly = init.readOnly\n } else {\n this.readOnly = undefined\n }\n if (typeof init.writeOnly === 'boolean') {\n this.writeOnly = init.writeOnly\n } else {\n this.writeOnly = undefined\n }\n if (Array.isArray(init.tags)) {\n this.tags = [...init.tags]\n } else {\n this.tags = []\n }\n if (Array.isArray(init.semantics)) {\n this.semantics = [...init.semantics]\n } else {\n this.semantics = []\n }\n if (init.schema) {\n this.schema = structuredClone(init.schema)\n } else {\n this.schema = undefined\n }\n if (Array.isArray(init.bindings)) {\n this.bindings = init.bindings.map((i) => structuredClone(i))\n } else {\n this.bindings = []\n }\n }\n\n /**\n * Checks whether the input is a valid definition of a domain property.\n *\n * @param input The input to validate.\n * @param options Validation options.\n * @returns true when the passed input is a valid definition of a domain property.\n */\n static validate(input: unknown, options: ModelValidationOptions = {}): boolean {\n if (!input || (typeof input !== 'object' && input !== null)) {\n return false\n }\n const typed = input as DomainPropertySchema\n if (options.strict && typed.kind !== DomainPropertyKind) {\n return false\n }\n return true\n }\n\n toJSON(): DomainPropertySchema {\n const result: DomainPropertySchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n type: this.type || DomainPropertyList.string,\n }\n if (typeof this.index === 'boolean') {\n result.index = this.index\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n if (typeof this.primary === 'boolean') {\n result.primary = this.primary\n }\n if (typeof this.multiple === 'boolean') {\n result.multiple = this.multiple\n }\n if (typeof this.required === 'boolean') {\n result.required = this.required\n }\n if (typeof this.readOnly === 'boolean') {\n result.readOnly = this.readOnly\n }\n if (typeof this.writeOnly === 'boolean') {\n result.writeOnly = this.writeOnly\n }\n if (Array.isArray(this.tags) && this.tags.length) {\n result.tags = [...this.tags]\n }\n if (Array.isArray(this.semantics) && this.semantics.length) {\n result.semantics = toRaw(this, this.semantics)?.map((i) => structuredClone(i))\n }\n if (this.schema) {\n result.schema = structuredClone(toRaw(this, this.schema))\n }\n if (Array.isArray(this.bindings) && this.bindings.length) {\n result.bindings = toRaw(this, this.bindings)?.map((i) => structuredClone(i))\n }\n return result\n }\n\n /**\n * Removes this property from the parent entity.\n * It calls the `removeProperty()` method of the parent entity.\n */\n remove(): void {\n const parent = this.getParentInstance()\n parent?.removeProperty(this.key)\n }\n\n /**\n * Returns a parent data entity where this data property exist.\n */\n getParentInstance(): DomainEntity | undefined {\n return this.root.graph.node(this.parent) as DomainEntity | undefined\n }\n\n /**\n * Checks whether the passed value is one of the supported data types.\n * @param value The value to test\n * @returns True when the passed value is one of the supported data types.\n */\n static isValidType(value: unknown): value is DomainPropertyType {\n if (typeof value !== 'string') {\n return false\n }\n return DomainPropertyTypes.includes(value as DomainPropertyType)\n }\n\n /**\n * Checks whether the passed value is one of the supported data property attributes.\n * @param value The value to test\n * @returns True when the passed value is one of the supported data property attributes.\n */\n static isValidAttribute(value: unknown): value is DomainPropertyAttribute {\n if (typeof value !== 'string') {\n return false\n }\n return DomainPropertyAttributes.includes(value as DomainPropertyAttribute)\n }\n\n /**\n * Checks whether the passed value of one of the supported `format` values.\n *\n * @param value The value to test\n * @returns `true` when the value is one of the supported `format` values.\n */\n static isValidFormat(value: unknown): value is DomainPropertyFormat {\n if (value === undefined) {\n // It is the valid value.\n return true\n }\n if (typeof value !== 'string') {\n return false\n }\n if (NumberFormats.includes(value as NumberFormat)) {\n return true\n }\n if (BinaryFormats.includes(value as BinaryFormat)) {\n return true\n }\n return false\n }\n\n /**\n * Creates the `schema` object if missing and returns it.\n * @returns The schema object.\n */\n ensureSchema(): PropertySchema {\n if (!this.schema) {\n this.schema = {}\n }\n return this.schema\n }\n\n /**\n * Creates if not existing and returns web bindings definition.\n * @returns The web binding definition\n */\n getWebBinding(): PropertyWebBindings {\n let object = this.bindings.find((i) => i.type === 'web') as PropertyBinding | undefined\n if (!object) {\n object = { type: 'web', schema: {} } as PropertyBinding\n this.bindings.push(object)\n }\n return object.schema as PropertyWebBindings\n }\n\n /**\n * Returns the schema value of the binding, if any was created.\n * @param type The type of the binding to read.\n * @returns The binding schema, if any\n */\n readBinding(type: 'web' | 'protobuf'): PropertyBindings | undefined {\n const item = this.bindings.find((i) => i.type === type) as PropertyBinding\n return item?.schema || undefined\n }\n\n /**\n * Creates a Property Shape of AMF.\n *\n * The property itself is auto-generated. If the `schema` is\n * defined then it is used as the `range` of the property.\n * Otherwise basic shape is generated for the range.\n *\n * This is a preferred way of reading the AMF shape as this\n * synchronizes changed data properties with the shape\n * definition.\n *\n * @returns AMF property shape definition.\n */\n toApiShape(): IApiPropertyShape {\n const serializer = new ShapeGenerator()\n return serializer.property(this)\n }\n\n /**\n * Adds or updates a semantic to the property.\n * @param semantic The semantic to add to the property.\n * @throws Error if the semantic is not an property semantic.\n */\n addSemantic(semantic: AppliedDataSemantic): void {\n const sem = DataSemantics[semantic.id]\n if (!isPropertySemantic(sem)) {\n throw new Error(`Invalid semantic type: ${semantic.id}. Expected a property semantic.`)\n }\n const index = this.semantics.findIndex((s) => s.id === semantic.id)\n if (index >= 0) {\n this.semantics[index] = semantic\n } else {\n this.semantics.push(semantic)\n }\n this.domain.notifyChange()\n }\n\n /**\n * Removes a semantic from the property.\n * @param semanticId The ID of the semantic to remove.\n */\n removeSemantic(semanticId: SemanticType): void {\n const index = this.semantics.findIndex((s) => s.id === semanticId)\n if (index >= 0) {\n this.semantics.splice(index, 1)\n this.domain.notifyChange()\n }\n }\n\n /**\n * Checks if the property has a specific semantic.\n * @param semanticId The ID of the semantic to check.\n * @returns True if the semantic is present, false otherwise.\n */\n hasSemantic(semanticId: SemanticType): boolean {\n return this.semantics.some((s) => s.id === semanticId)\n }\n}\n"]}
1
+ {"version":3,"file":"DomainProperty.js","sourceRoot":"","sources":["../../../src/modeling/DomainProperty.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAe,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EAEL,aAAa,EAEb,wBAAwB,EAExB,kBAAkB,EAElB,mBAAmB,EAEnB,aAAa,GACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAMxD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAA+C,MAAM,gBAAgB,CAAA;AAC/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAsEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;IACU,cAAc;sBAAS,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAApC,cAAe,SAAQ,WAAa;;;gCAM9C,cAAc,EAAE;oCAKhB,QAAQ,EAAE;oCAKV,QAAQ,EAAE;mCAKV,QAAQ,EAAE;iCAKV,QAAQ,EAAE;oCAKV,QAAQ,EAAE;qCAKV,QAAQ,EAAE;sCAKV,QAAQ,EAAE;gCASV,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;qCAKxB,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;gCASxB,QAAQ,EAAE;kCAMV,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;oCASxB,QAAQ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CAAA;YACnE,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAA;YAClC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAC/B,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;QAC5B,CAAC;QAED;;;WAGG;QACH,cAAc,CAAC,UAAwB;YACrC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAA;YAClE,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;gBAC/B,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;YAC5B,CAAC;QACH,CAAC;QAED;;;;WAIG;QACH,WAAW,CAAC,UAAwB;YAClC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAA;QACxD,CAAC;;;SAjeU,cAAc","sourcesContent":["import type { DataDomain } from './DataDomain.js'\nimport { DomainPropertyKind } from '../models/kinds.js'\nimport { DomainElement, type DomainElementSchema } from './DomainElement.js'\nimport { nanoid } from '../nanoid.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport { observed, retargetChange, toRaw } from './observed.js'\nimport {\n type BinaryFormat,\n BinaryFormats,\n type DomainPropertyAttribute,\n DomainPropertyAttributes,\n type DomainPropertyFormat,\n DomainPropertyList,\n type DomainPropertyType,\n DomainPropertyTypes,\n type NumberFormat,\n NumberFormats,\n} from './DataFormat.js'\nimport { ShapeGenerator } from './amf/ShapeGenerator.js'\nimport type { PropertyBinding, PropertyBindings, PropertyWebBindings } from './Bindings.js'\nimport type { ModelValidationOptions } from '../models/types.js'\nimport type { DomainEntity } from './DomainEntity.js'\nimport type { IApiPropertyShape } from '../amf/definitions/Shapes.js'\nimport type { PropertySchema } from './types.js'\nimport { DataSemantics, isPropertySemantic, type SemanticType, type AppliedDataSemantic } from './Semantics.js'\nimport { ApiSchemaGenerator } from '../amf/ApiSchemaGenerator.js'\nimport type { IShapeRenderOptions } from '../amf/shape/ShapeBase.js'\n\nexport interface DomainPropertySchema extends DomainElementSchema {\n kind: typeof DomainPropertyKind\n /**\n * The domain property description.\n */\n info: IThing\n /**\n * Wether the data property is required.\n */\n required?: boolean\n /**\n * Whether the data property allows multiple items.\n */\n multiple?: boolean\n /**\n * Whether this property describes a primary key of the entity.\n */\n primary?: boolean\n /**\n * Whether this property describes an indexed property of the entity.\n */\n index?: boolean\n /**\n * Whether the property is read only in the schema.\n */\n readOnly?: boolean\n /**\n * Whether the property is write only in the schema.\n */\n writeOnly?: boolean\n /**\n * Whether this property is deprecated.\n */\n deprecated?: boolean\n /**\n * Optional general purpose tags for the UI.\n */\n tags?: string[]\n /**\n * The semantics applied to this property.\n * This is a list of applied semantics that can be used to\n * describe the property in more detail.\n */\n semantics?: AppliedDataSemantic[]\n /**\n * The data type for this property.\n * Note, not all schemas support the same type. For example, defining `sint32`\n * works for protocol buffers, but does not for JSON. In such case we use default\n * translation `sint32` -> `number`. Another way it to create\n * a derivative entity for specific schema to describe specific schema case.\n */\n type: DomainPropertyType\n /**\n * The general schema definition of this property.\n * This is propagated to all bindings (when they support these properties).\n */\n schema?: PropertySchema\n /**\n * The list of bindings for this property.\n *\n * A binding defines a translation from a data model to a specific format.\n * For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs\n * or a protocol buffer schema.\n */\n bindings?: PropertyBinding[]\n}\n\n/**\n * Represents a property within a data domain entity.\n *\n * A `DomainProperty` defines a single data element within a\n * `DomainEntity`. It specifies the data type, constraints,\n * and other metadata for a specific piece of information.\n *\n * **Key Features:**\n *\n * - **Data Type:** Defines the type of data the property\n * holds (e.g., string, number, boolean, date).\n * - **Constraints:** Supports defining constraints such as\n * minimum/maximum values, enum values, and default values.\n * - **Bindings:** Allows defining how the property is\n * represented in different formats (e.g., web APIs,\n * protocol buffers).\n * - **Metadata:** Supports metadata such as tags, semantics,\n * read-only/write-only status, and deprecation.\n * - **Schema:** Allows defining a general schema for the\n * property, which is propagated to all bindings.\n *\n * **Usage:**\n *\n * Use the `DomainEntity.addProperty` method to add a new property to an\n * entity. The property can be created using the constructor, but it\n * won't be added to the graph until you call the `addProperty` method.\n *\n * **Example:**\n *\n * ```typescript\n * const entity = domainModel.addEntity({ key: 'user' });\n * const property = entity.addProperty({\n * key: 'name',\n * type: 'string',\n * required: true,\n * schema: {\n * minimum: 3,\n * maximum: 50,\n * },\n * });\n * ```\n */\nexport class DomainProperty extends DomainElement {\n override kind: typeof DomainPropertyKind\n\n /**\n * The description of the domain property.\n */\n @retargetChange() accessor info: Thing\n\n /**\n * Wether the data property is required.\n */\n @observed() accessor required: boolean | undefined\n\n /**\n * Whether the data property allows multiple items.\n */\n @observed() accessor multiple: boolean | undefined\n\n /**\n * Whether this property describes a primary key of the entity.\n */\n @observed() accessor primary: boolean | undefined\n\n /**\n * Whether this property describes an indexed property of the entity.\n */\n @observed() accessor index: boolean | undefined\n\n /**\n * Whether the property is read only in the schema.\n */\n @observed() accessor readOnly: boolean | undefined\n\n /**\n * Whether the property is write only in the schema.\n */\n @observed() accessor writeOnly: boolean | undefined\n\n /**\n * Whether this property is deprecated.\n */\n @observed() accessor deprecated: boolean | undefined\n\n /**\n * Optional general purpose tags for the UI.\n *\n * Note to implementations, use the `addTag()` method as it propagates the \"tag\" value in the namespace.\n * Also, the tags property is excluded from the observer properties.\n * Changes to this property will not notify the observers.\n */\n @observed({ deep: true }) accessor tags: string[] = []\n\n /**\n * Semantics applied to this property.\n */\n @observed({ deep: true }) accessor semantics: AppliedDataSemantic[] = []\n\n /**\n * The data type for this property.\n * Note, not all schemas support the same type. For example, defining `sint32`\n * works for protocol buffers but does not for JSON. In such case we use default\n * translation `sint32` -> `number`. Another way it to create\n * a derivative entity for specific schema to describe specific schema case.\n */\n @observed() accessor type: DomainPropertyType = 'string'\n\n /**\n * The general schema definition of this property.\n * This is propagated to all bindings (when they support these properties).\n */\n @observed({ deep: true }) accessor schema: PropertySchema | undefined\n\n /**\n * The list of bindings for this property.\n *\n * A binding defines a translation from a data model to a specific format.\n * For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs\n * or a protocol buffer schema.\n */\n @observed({ deep: true }) accessor bindings: PropertyBinding[] = []\n\n /**\n * Creates a full data model schema with defaults.\n *\n * @param input The partial data model schema.\n * @returns The data model schema.\n */\n static createSchema(input: Partial<DomainPropertySchema> = {}): DomainPropertySchema {\n const {\n key = nanoid(),\n multiple,\n required,\n type = DomainPropertyList.string,\n index,\n primary,\n readOnly,\n writeOnly,\n tags,\n semantics,\n deprecated,\n schema,\n bindings,\n } = input\n if (typeof type === 'string') {\n if (!DomainPropertyTypes.includes(type as DomainPropertyType)) {\n throw new Error(`Invalid data property type ${type}`)\n }\n }\n const info = Thing.fromJSON(input.info, { name: 'new_property' }).toJSON()\n const result: DomainPropertySchema = {\n kind: DomainPropertyKind,\n key,\n info,\n type,\n }\n if (typeof multiple === 'boolean') {\n result.multiple = multiple\n }\n if (typeof required === 'boolean') {\n result.required = required\n }\n if (typeof index === 'boolean') {\n result.index = index\n }\n if (typeof primary === 'boolean') {\n result.primary = primary\n }\n if (typeof readOnly === 'boolean') {\n result.readOnly = readOnly\n }\n if (typeof writeOnly === 'boolean') {\n result.writeOnly = writeOnly\n }\n if (typeof deprecated === 'boolean') {\n result.deprecated = deprecated\n }\n if (Array.isArray(tags)) {\n result.tags = [...tags]\n }\n if (Array.isArray(semantics)) {\n result.semantics = [...semantics]\n }\n if (schema) {\n result.schema = structuredClone(schema)\n }\n if (Array.isArray(bindings)) {\n result.bindings = bindings.map((i) => structuredClone(i))\n } else {\n result.bindings = []\n }\n return result\n }\n\n /**\n * The key of the parent entity.\n */\n protected parent: string\n\n /**\n * Creates a new domain property instance.\n * It does not add it to the graph.\n * You need to call the `addProperty` method of the graph or a data model to add it.\n *\n * Domain objects constructors shouldn't be used directly. Use methods\n * provided on the DataDomain class to create new objects.\n *\n * @param root A reference to the root DataDomain instance.\n * @param parent The key of the parent entity.\n * @param input The partial domain property schema.\n * @returns Created domain property instance.\n */\n constructor(root: DataDomain, parent: string, input: Partial<DomainPropertySchema> = {}) {\n const init = DomainProperty.createSchema(input)\n super(root, init.key)\n this.parent = parent\n this.kind = DomainPropertyKind\n this.info = new Thing(init.info)\n this.type = init.type\n\n if (typeof init.multiple === 'boolean') {\n this.multiple = init.multiple\n } else {\n this.multiple = undefined\n }\n if (typeof init.required === 'boolean') {\n this.required = init.required\n } else {\n this.required = undefined\n }\n if (typeof init.index === 'boolean') {\n this.index = init.index\n } else {\n this.index = undefined\n }\n if (typeof init.deprecated === 'boolean') {\n this.deprecated = init.deprecated\n } else {\n this.deprecated = undefined\n }\n if (typeof init.primary === 'boolean') {\n this.primary = init.primary\n } else {\n this.primary = undefined\n }\n if (typeof init.readOnly === 'boolean') {\n this.readOnly = init.readOnly\n } else {\n this.readOnly = undefined\n }\n if (typeof init.writeOnly === 'boolean') {\n this.writeOnly = init.writeOnly\n } else {\n this.writeOnly = undefined\n }\n if (Array.isArray(init.tags)) {\n this.tags = [...init.tags]\n } else {\n this.tags = []\n }\n if (Array.isArray(init.semantics)) {\n this.semantics = [...init.semantics]\n } else {\n this.semantics = []\n }\n if (init.schema) {\n this.schema = structuredClone(init.schema)\n } else {\n this.schema = undefined\n }\n if (Array.isArray(init.bindings)) {\n this.bindings = init.bindings.map((i) => structuredClone(i))\n } else {\n this.bindings = []\n }\n }\n\n /**\n * Checks whether the input is a valid definition of a domain property.\n *\n * @param input The input to validate.\n * @param options Validation options.\n * @returns true when the passed input is a valid definition of a domain property.\n */\n static validate(input: unknown, options: ModelValidationOptions = {}): boolean {\n if (!input || (typeof input !== 'object' && input !== null)) {\n return false\n }\n const typed = input as DomainPropertySchema\n if (options.strict && typed.kind !== DomainPropertyKind) {\n return false\n }\n return true\n }\n\n toJSON(): DomainPropertySchema {\n const result: DomainPropertySchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n type: this.type || DomainPropertyList.string,\n }\n if (typeof this.index === 'boolean') {\n result.index = this.index\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n if (typeof this.primary === 'boolean') {\n result.primary = this.primary\n }\n if (typeof this.multiple === 'boolean') {\n result.multiple = this.multiple\n }\n if (typeof this.required === 'boolean') {\n result.required = this.required\n }\n if (typeof this.readOnly === 'boolean') {\n result.readOnly = this.readOnly\n }\n if (typeof this.writeOnly === 'boolean') {\n result.writeOnly = this.writeOnly\n }\n if (Array.isArray(this.tags) && this.tags.length) {\n result.tags = [...this.tags]\n }\n if (Array.isArray(this.semantics) && this.semantics.length) {\n result.semantics = toRaw(this, this.semantics)?.map((i) => structuredClone(i))\n }\n if (this.schema) {\n result.schema = structuredClone(toRaw(this, this.schema))\n }\n if (Array.isArray(this.bindings) && this.bindings.length) {\n result.bindings = toRaw(this, this.bindings)?.map((i) => structuredClone(i))\n }\n return result\n }\n\n /**\n * Removes this property from the parent entity.\n * It calls the `removeProperty()` method of the parent entity.\n */\n remove(): void {\n const parent = this.getParentInstance()\n parent?.removeProperty(this.key)\n }\n\n /**\n * Returns a parent data entity where this data property exist.\n */\n getParentInstance(): DomainEntity | undefined {\n return this.root.graph.node(this.parent) as DomainEntity | undefined\n }\n\n /**\n * Checks whether the passed value is one of the supported data types.\n * @param value The value to test\n * @returns True when the passed value is one of the supported data types.\n */\n static isValidType(value: unknown): value is DomainPropertyType {\n if (typeof value !== 'string') {\n return false\n }\n return DomainPropertyTypes.includes(value as DomainPropertyType)\n }\n\n /**\n * Checks whether the passed value is one of the supported data property attributes.\n * @param value The value to test\n * @returns True when the passed value is one of the supported data property attributes.\n */\n static isValidAttribute(value: unknown): value is DomainPropertyAttribute {\n if (typeof value !== 'string') {\n return false\n }\n return DomainPropertyAttributes.includes(value as DomainPropertyAttribute)\n }\n\n /**\n * Checks whether the passed value of one of the supported `format` values.\n *\n * @param value The value to test\n * @returns `true` when the value is one of the supported `format` values.\n */\n static isValidFormat(value: unknown): value is DomainPropertyFormat {\n if (value === undefined) {\n // It is the valid value.\n return true\n }\n if (typeof value !== 'string') {\n return false\n }\n if (NumberFormats.includes(value as NumberFormat)) {\n return true\n }\n if (BinaryFormats.includes(value as BinaryFormat)) {\n return true\n }\n return false\n }\n\n /**\n * Creates the `schema` object if missing and returns it.\n * @returns The schema object.\n */\n ensureSchema(): PropertySchema {\n if (!this.schema) {\n this.schema = {}\n }\n return this.schema\n }\n\n /**\n * Creates if not existing and returns web bindings definition.\n * @returns The web binding definition\n */\n getWebBinding(): PropertyWebBindings {\n let object = this.bindings.find((i) => i.type === 'web') as PropertyBinding | undefined\n if (!object) {\n object = { type: 'web', schema: {} } as PropertyBinding\n this.bindings.push(object)\n }\n return object.schema as PropertyWebBindings\n }\n\n /**\n * Returns the schema value of the binding, if any was created.\n * @param type The type of the binding to read.\n * @returns The binding schema, if any\n */\n readBinding(type: 'web' | 'protobuf'): PropertyBindings | undefined {\n const item = this.bindings.find((i) => i.type === type) as PropertyBinding\n return item?.schema || undefined\n }\n\n /**\n * Creates a Property Shape of AMF.\n *\n * The property itself is auto-generated. If the `schema` is\n * defined then it is used as the `range` of the property.\n * Otherwise basic shape is generated for the range.\n *\n * This is a preferred way of reading the AMF shape as this\n * synchronizes changed data properties with the shape\n * definition.\n *\n * @returns AMF property shape definition.\n */\n toApiShape(): IApiPropertyShape {\n const serializer = new ShapeGenerator()\n return serializer.property(this)\n }\n\n /**\n * Generates an example value for this property based on its schema and type.\n *\n * This method converts the property to an AMF shape and then generates\n * an example value using the ApiSchemaGenerator. The generated example\n * respects the property's type, constraints, and any defined schema.\n *\n * @param mime The mime type of the example (e.g., 'application/json', 'application/xml').\n * @param opts Optional configuration for example generation.\n * @returns The generated example value.\n * @example\n * ```typescript\n * const example = property.toExample('application/json');\n * console.log(example);\n * ```\n */\n toExample(mime: string, opts: IShapeRenderOptions = {}): string | number | boolean | null | undefined {\n // TODO: add support for semantic extensions and generate example values based on them.\n const shape = this.toApiShape()\n if (!shape.range) {\n return undefined\n }\n const generator = new ApiSchemaGenerator(mime, {\n renderExamples: opts.renderExamples ?? true,\n renderMocked: opts.renderMocked ?? true,\n renderOptional: opts.renderOptional ?? true,\n selectedUnions: opts.selectedUnions,\n })\n return generator.generate(shape)\n }\n\n /**\n * Adds or updates a semantic to the property.\n * @param semantic The semantic to add to the property.\n * @throws Error if the semantic is not an property semantic.\n */\n addSemantic(semantic: AppliedDataSemantic): void {\n const sem = DataSemantics[semantic.id]\n if (!isPropertySemantic(sem)) {\n throw new Error(`Invalid semantic type: ${semantic.id}. Expected a property semantic.`)\n }\n const index = this.semantics.findIndex((s) => s.id === semantic.id)\n if (index >= 0) {\n this.semantics[index] = semantic\n } else {\n this.semantics.push(semantic)\n }\n this.domain.notifyChange()\n }\n\n /**\n * Removes a semantic from the property.\n * @param semanticId The ID of the semantic to remove.\n */\n removeSemantic(semanticId: SemanticType): void {\n const index = this.semantics.findIndex((s) => s.id === semanticId)\n if (index >= 0) {\n this.semantics.splice(index, 1)\n this.domain.notifyChange()\n }\n }\n\n /**\n * Checks if the property has a specific semantic.\n * @param semanticId The ID of the semantic to check.\n * @returns True if the semantic is present, false otherwise.\n */\n hasSemantic(semanticId: SemanticType): boolean {\n return this.semantics.some((s) => s.id === semanticId)\n }\n}\n"]}
@@ -403,11 +403,11 @@ export class ShapeGenerator {
403
403
  if (bindings?.xml) {
404
404
  result.xmlSerialization = bindings.xml;
405
405
  }
406
- if (bindings?.pattern) {
407
- result.pattern = bindings.pattern;
408
- }
409
406
  const { schema, type } = input;
410
407
  if (schema) {
408
+ if (schema.pattern) {
409
+ result.pattern = schema.pattern;
410
+ }
411
411
  if (typeof schema.multipleOf === 'number') {
412
412
  result.multipleOf = schema.multipleOf;
413
413
  }