@api-client/core 0.12.5 → 0.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/build/src/amf/ApiSchemaValues.d.ts +6 -2
  2. package/build/src/amf/ApiSchemaValues.d.ts.map +1 -1
  3. package/build/src/amf/ApiSchemaValues.js +17 -12
  4. package/build/src/amf/ApiSchemaValues.js.map +1 -1
  5. package/build/src/amf/shape/ShapeBase.d.ts +1 -1
  6. package/build/src/amf/shape/ShapeBase.d.ts.map +1 -1
  7. package/build/src/amf/shape/ShapeBase.js +1 -1
  8. package/build/src/amf/shape/ShapeBase.js.map +1 -1
  9. package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts.map +1 -1
  10. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +1 -2
  11. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -1
  12. package/build/src/events/BaseEvents.d.ts +3 -3
  13. package/build/src/events/BaseEvents.d.ts.map +1 -1
  14. package/build/src/events/BaseEvents.js.map +1 -1
  15. package/build/src/mocking/LegacyInterfaces.d.ts +1 -1
  16. package/build/src/mocking/LegacyInterfaces.d.ts.map +1 -1
  17. package/build/src/mocking/LegacyInterfaces.js.map +1 -1
  18. package/build/src/mocking/LegacyMock.d.ts +1 -1
  19. package/build/src/mocking/LegacyMock.d.ts.map +1 -1
  20. package/build/src/mocking/LegacyMock.js +1 -1
  21. package/build/src/mocking/LegacyMock.js.map +1 -1
  22. package/build/src/mocking/ProjectMock.d.ts +2 -1
  23. package/build/src/mocking/ProjectMock.d.ts.map +1 -1
  24. package/build/src/mocking/ProjectMock.js +1 -1
  25. package/build/src/mocking/ProjectMock.js.map +1 -1
  26. package/build/src/mocking/legacy/Authorization.d.ts +2 -1
  27. package/build/src/mocking/legacy/Authorization.d.ts.map +1 -1
  28. package/build/src/mocking/legacy/Authorization.js +2 -1
  29. package/build/src/mocking/legacy/Authorization.js.map +1 -1
  30. package/build/src/mocking/legacy/Certificates.d.ts +3 -1
  31. package/build/src/mocking/legacy/Certificates.d.ts.map +1 -1
  32. package/build/src/mocking/legacy/Certificates.js +6 -3
  33. package/build/src/mocking/legacy/Certificates.js.map +1 -1
  34. package/build/src/mocking/legacy/Cookies.d.ts +3 -1
  35. package/build/src/mocking/legacy/Cookies.d.ts.map +1 -1
  36. package/build/src/mocking/legacy/Cookies.js +3 -1
  37. package/build/src/mocking/legacy/Cookies.js.map +1 -1
  38. package/build/src/mocking/legacy/HostRules.d.ts +3 -1
  39. package/build/src/mocking/legacy/HostRules.d.ts.map +1 -1
  40. package/build/src/mocking/legacy/HostRules.js +3 -1
  41. package/build/src/mocking/legacy/HostRules.js.map +1 -1
  42. package/build/src/mocking/legacy/Http.d.ts +6 -1
  43. package/build/src/mocking/legacy/Http.d.ts.map +1 -1
  44. package/build/src/mocking/legacy/Http.js +5 -1
  45. package/build/src/mocking/legacy/Http.js.map +1 -1
  46. package/build/src/mocking/legacy/HttpResponse.d.ts +3 -2
  47. package/build/src/mocking/legacy/HttpResponse.d.ts.map +1 -1
  48. package/build/src/mocking/legacy/HttpResponse.js +2 -2
  49. package/build/src/mocking/legacy/HttpResponse.js.map +1 -1
  50. package/build/src/mocking/legacy/RestApi.d.ts +3 -1
  51. package/build/src/mocking/legacy/RestApi.d.ts.map +1 -1
  52. package/build/src/mocking/legacy/RestApi.js +3 -1
  53. package/build/src/mocking/legacy/RestApi.js.map +1 -1
  54. package/build/src/mocking/legacy/Urls.d.ts +3 -1
  55. package/build/src/mocking/legacy/Urls.d.ts.map +1 -1
  56. package/build/src/mocking/legacy/Urls.js +3 -1
  57. package/build/src/mocking/legacy/Urls.js.map +1 -1
  58. package/build/src/mocking/legacy/Variables.d.ts +2 -1
  59. package/build/src/mocking/legacy/Variables.d.ts.map +1 -1
  60. package/build/src/mocking/legacy/Variables.js +2 -1
  61. package/build/src/mocking/legacy/Variables.js.map +1 -1
  62. package/build/src/mocking/lib/Certificates.d.ts +4 -1
  63. package/build/src/mocking/lib/Certificates.d.ts.map +1 -1
  64. package/build/src/mocking/lib/Certificates.js +5 -2
  65. package/build/src/mocking/lib/Certificates.js.map +1 -1
  66. package/build/src/mocking/lib/History.d.ts +5 -1
  67. package/build/src/mocking/lib/History.d.ts.map +1 -1
  68. package/build/src/mocking/lib/History.js +4 -1
  69. package/build/src/mocking/lib/History.js.map +1 -1
  70. package/build/src/mocking/lib/HostRules.d.ts +4 -1
  71. package/build/src/mocking/lib/HostRules.d.ts.map +1 -1
  72. package/build/src/mocking/lib/HostRules.js +3 -1
  73. package/build/src/mocking/lib/HostRules.js.map +1 -1
  74. package/build/src/mocking/lib/Request.d.ts +5 -1
  75. package/build/src/mocking/lib/Request.d.ts.map +1 -1
  76. package/build/src/mocking/lib/Request.js +4 -1
  77. package/build/src/mocking/lib/Request.js.map +1 -1
  78. package/build/src/mocking/lib/Response.d.ts +7 -1
  79. package/build/src/mocking/lib/Response.d.ts.map +1 -1
  80. package/build/src/mocking/lib/Response.js +6 -1
  81. package/build/src/mocking/lib/Response.js.map +1 -1
  82. package/build/src/mocking/lib/Url.d.ts +4 -1
  83. package/build/src/mocking/lib/Url.d.ts.map +1 -1
  84. package/build/src/mocking/lib/Url.js +3 -1
  85. package/build/src/mocking/lib/Url.js.map +1 -1
  86. package/build/src/mocking/lib/User.d.ts +5 -1
  87. package/build/src/mocking/lib/User.d.ts.map +1 -1
  88. package/build/src/mocking/lib/User.js +4 -1
  89. package/build/src/mocking/lib/User.js.map +1 -1
  90. package/build/src/modeling/DataDomain.d.ts +1 -1
  91. package/build/src/modeling/DataDomain.d.ts.map +1 -1
  92. package/build/src/modeling/DataDomain.js.map +1 -1
  93. package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
  94. package/build/src/modeling/DomainAssociation.js +2 -3
  95. package/build/src/modeling/DomainAssociation.js.map +1 -1
  96. package/build/src/modeling/DomainSerialization.d.ts.map +1 -1
  97. package/build/src/modeling/DomainSerialization.js +1 -1
  98. package/build/src/modeling/DomainSerialization.js.map +1 -1
  99. package/build/src/modeling/DomainVersioning.js.map +1 -1
  100. package/build/src/modeling/GraphUtils.d.ts +1 -1
  101. package/build/src/modeling/GraphUtils.d.ts.map +1 -1
  102. package/build/src/modeling/GraphUtils.js.map +1 -1
  103. package/build/src/modeling/legacy/DataAssociation.d.ts.map +1 -1
  104. package/build/src/modeling/legacy/DataAssociation.js +4 -5
  105. package/build/src/modeling/legacy/DataAssociation.js.map +1 -1
  106. package/build/src/modeling/legacy/DataProperty.d.ts.map +1 -1
  107. package/build/src/modeling/legacy/DataProperty.js +4 -5
  108. package/build/src/modeling/legacy/DataProperty.js.map +1 -1
  109. package/build/src/modeling/types.d.ts +2 -1
  110. package/build/src/modeling/types.d.ts.map +1 -1
  111. package/build/src/modeling/types.js.map +1 -1
  112. package/build/src/models/ProjectExecution.d.ts.map +1 -1
  113. package/build/src/models/ProjectExecution.js +2 -3
  114. package/build/src/models/ProjectExecution.js.map +1 -1
  115. package/build/src/models/Request.d.ts.map +1 -1
  116. package/build/src/models/Request.js +4 -5
  117. package/build/src/models/Request.js.map +1 -1
  118. package/build/src/models/store/Revision.d.ts +1 -1
  119. package/build/src/models/store/Revision.d.ts.map +1 -1
  120. package/build/src/models/store/Revision.js.map +1 -1
  121. package/build/src/patch/PatchClient.d.ts +2 -1
  122. package/build/src/patch/PatchClient.d.ts.map +1 -1
  123. package/build/src/patch/PatchClient.js +1 -1
  124. package/build/src/patch/PatchClient.js.map +1 -1
  125. package/build/src/patch/types.d.ts +1 -1
  126. package/build/src/patch/types.d.ts.map +1 -1
  127. package/build/src/patch/types.js.map +1 -1
  128. package/data/models/example-generator-api.json +22 -22
  129. package/package.json +21 -20
  130. package/src/amf/ApiSchemaValues.ts +18 -13
  131. package/src/amf/shape/ShapeBase.ts +1 -1
  132. package/src/amf/shape/ShapeXmlSchemaGenerator.ts +1 -2
  133. package/src/events/BaseEvents.ts +3 -3
  134. package/src/mocking/LegacyInterfaces.ts +1 -1
  135. package/src/mocking/LegacyMock.ts +1 -1
  136. package/src/mocking/ProjectMock.ts +2 -1
  137. package/src/mocking/legacy/Authorization.ts +2 -1
  138. package/src/mocking/legacy/Certificates.ts +6 -3
  139. package/src/mocking/legacy/Cookies.ts +3 -1
  140. package/src/mocking/legacy/HostRules.ts +3 -1
  141. package/src/mocking/legacy/Http.ts +6 -1
  142. package/src/mocking/legacy/HttpResponse.ts +3 -7
  143. package/src/mocking/legacy/RestApi.ts +3 -1
  144. package/src/mocking/legacy/Urls.ts +3 -1
  145. package/src/mocking/legacy/Variables.ts +2 -1
  146. package/src/mocking/lib/Certificates.ts +6 -2
  147. package/src/mocking/lib/History.ts +5 -1
  148. package/src/mocking/lib/HostRules.ts +4 -1
  149. package/src/mocking/lib/Request.ts +5 -1
  150. package/src/mocking/lib/Response.ts +7 -12
  151. package/src/mocking/lib/Url.ts +4 -1
  152. package/src/mocking/lib/User.ts +5 -1
  153. package/src/modeling/DataDomain.ts +1 -1
  154. package/src/modeling/DomainAssociation.ts +2 -3
  155. package/src/modeling/DomainSerialization.ts +2 -1
  156. package/src/modeling/DomainVersioning.ts +1 -1
  157. package/src/modeling/GraphUtils.ts +1 -1
  158. package/src/modeling/legacy/DataAssociation.ts +4 -5
  159. package/src/modeling/legacy/DataProperty.ts +4 -5
  160. package/src/modeling/types.ts +2 -1
  161. package/src/models/ProjectExecution.ts +2 -3
  162. package/src/models/Request.ts +4 -5
  163. package/src/models/store/Revision.ts +1 -1
  164. package/src/patch/PatchClient.ts +2 -1
  165. package/src/patch/types.ts +1 -1
  166. package/tests/servers/express-routes/StreamApi.ts +6 -4
@@ -1 +1 @@
1
- {"version":3,"file":"DomainVersioning.js","sourceRoot":"","sources":["../../../src/modeling/DomainVersioning.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAgB,EAAE,OAAe;IAClE,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IAC3B,MAAM,K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AAI,CAAC,OAAO,CAAC,CAAA;QAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,SAAQ;QACV,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YACnC,0DAA0D;YAC1D,OAAO,IAAI,CAAA;QACb,CAAC;QAED,6DAA6D;QAC7D,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACtC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACpB,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC1B,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAA;YACf,IAAI,KAAK,EAAE,OAAO,EAAE,CAAC;gBACnB,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,EAAE,CAAA;YAClC,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAChB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAA,CAAC,uCAAuC;AACtD,CAAC","sourcesContent":["import type { JsonEdge, Node } from '@api-client/graph'\nimport type { DataDomain, DataDomainSchema } from './DataDomain.js'\nimport type { DomainGraphEdge, DataDomainGraph, SerializedGraph } from './types.js'\n\n/**\n * Serializes a DataDomain for version release, including only relevant foreign nodes.\n * @param root The DataDomain to serialize.\n * @param version The version to set in the serialized graph. This mutates the DataDomain.\n * @returns The serialized graph with the version set.\n */\nexport function createGraphVersion(root: DataDomain, version: string): DataDomainSchema {\n root.info.version = version\n const graph = serializeForVersionRelease(root)\n const result: DataDomainSchema = {\n key: root.key,\n kind: root.kind,\n info: root.info.toJSON(),\n graph,\n }\n if (root.dependencyList.length) {\n // Note: the used dependencies are serialized in the graph.\n // The dependency list is only preserved for linage purposes.\n result.dependencyList = [...root.dependencyList]\n }\n if (root.fields.length) {\n result.fields = [...root.fields]\n }\n return result\n}\n\n/**\n * Serializes a DataDomain for version release, including only relevant foreign nodes.\n *\n * @param dataDomain The DataDomain to serialize.\n * @returns A SerializedGraph containing the versioned data.\n */\nexport function serializeForVersionRelease(dataDomain: DataDomain): SerializedGraph {\n const { graph, key: domainKey } = dataDomain\n const relevantForeignNodes = new Set<string>()\n\n // 1. Identify relevant foreign nodes: those connected to local entities.\n for (const node of graph.nodes()) {\n const nodeValue = graph.node(node)\n if (!nodeValue) {\n continue\n }\n if (nodeValue.domain.key === domainKey) {\n continue // Skip local nodes\n }\n\n // Check if the foreign node is connected to a local node (directly or indirectly).\n if (isConnectedToLocal(graph, node, domainKey)) {\n relevantForeignNodes.add(node)\n }\n }\n\n // 2. Filter nodes and edges based on relevance.\n const nodes = []\n const edges = []\n\n for (const node of graph.nodes()) {\n const nodeValue = graph.node(node)\n if (!nodeValue) {\n continue\n }\n\n if (nodeValue.domain.key === domainKey || relevantForeignNodes.has(node)) {\n const parents = [...graph.parents(node)]\n const serializedNode: Node<object> = { v: node, value: nodeValue.toJSON() }\n if (parents.length) {\n serializedNode.parents = parents\n }\n nodes.push(serializedNode)\n }\n }\n\n for (const edge of graph.edges()) {\n const edgeValue = graph.edge(edge)\n if (!edgeValue) continue\n\n const sourceNode = graph.node(edge.v)\n const targetNode = graph.node(edge.w)\n\n if (!sourceNode || !targetNode) continue\n\n const isSourceRelevant = sourceNode.domain.key === domainKey || relevantForeignNodes.has(edge.v)\n const isTargetRelevant = targetNode.domain.key === domainKey || relevantForeignNodes.has(edge.w)\n\n if (isSourceRelevant && isTargetRelevant) {\n const serializedEdge: JsonEdge<DomainGraphEdge> = { v: edge.v, w: edge.w, value: structuredClone(edgeValue) }\n if (edge.name) {\n serializedEdge.name = edge.name\n }\n edges.push(serializedEdge)\n }\n }\n\n // 3. Construct the SerializedGraph.\n const json: SerializedGraph = {\n options: {\n directed: graph.isDirected(),\n multigraph: graph.isMultigraph(),\n compound: graph.isCompound(),\n },\n nodes,\n edges,\n }\n\n return json\n}\n\n/**\n * Checks if a foreign node is connected to a local node (directly or indirectly).\n *\n * This function performs a breadth-first search (BFS) to determine if a foreign node\n * is connected to any local node.\n *\n * @param g The DataDomain graph.\n * @param node The key of the foreign node to check.\n * @param domainKey The key of the local domain.\n * @returns True if the foreign node is connected to a local node.\n */\nfunction isConnectedToLocal(g: DataDomainGraph, node: string, domainKey: string): boolean {\n const visited = new Set<string>()\n const queue: string[] = [node]\n\n while (queue.length > 0) {\n const current = queue.shift() as string\n if (visited.has(current)) {\n continue\n }\n visited.add(current)\n\n const value = g.node(current)\n if (!value) {\n continue\n }\n\n if (value.domain.key === domainKey) {\n // It means the foreign node is connected to a local node.\n return true\n }\n\n // Explore adjacent nodes (both incoming and outgoing edges).\n for (const edge of g.inEdges(current)) {\n queue.push(edge.v)\n }\n for (const edge of g.outEdges(current)) {\n const label = g.edge(edge)\n let id = edge.w\n if (label?.foreign) {\n id = `${label.domain}:${edge.w}`\n }\n queue.push(id)\n }\n }\n\n return false // No connection to a local node found.\n}\n"]}
1
+ {"version":3,"file":"DomainVersioning.js","sourceRoot":"","sources":["../../../src/modeling/DomainVersioning.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAgB,EAAE,OAAe;IAClE,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IAC3B,MAAM,KAAK,GAAG,0BAA0B,CAAC,IAAI,CAAC,CAAA;IAC9C,MAAM,MAAM,GAAqB;QAC/B,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QACxB,KAAK;KACN,CAAA;IACD,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;QAC/B,2D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AAC,EAAE,CAAC;YACtC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACpB,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC1B,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAA;YACf,IAAI,KAAK,EAAE,OAAO,EAAE,CAAC;gBACnB,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,EAAE,CAAA;YAClC,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAChB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAA,CAAC,uCAAuC;AACtD,CAAC","sourcesContent":["import type { JsonEdge, Node } from '@api-client/graph/graph/types.js'\nimport type { DataDomain, DataDomainSchema } from './DataDomain.js'\nimport type { DomainGraphEdge, DataDomainGraph, SerializedGraph } from './types.js'\n\n/**\n * Serializes a DataDomain for version release, including only relevant foreign nodes.\n * @param root The DataDomain to serialize.\n * @param version The version to set in the serialized graph. This mutates the DataDomain.\n * @returns The serialized graph with the version set.\n */\nexport function createGraphVersion(root: DataDomain, version: string): DataDomainSchema {\n root.info.version = version\n const graph = serializeForVersionRelease(root)\n const result: DataDomainSchema = {\n key: root.key,\n kind: root.kind,\n info: root.info.toJSON(),\n graph,\n }\n if (root.dependencyList.length) {\n // Note: the used dependencies are serialized in the graph.\n // The dependency list is only preserved for linage purposes.\n result.dependencyList = [...root.dependencyList]\n }\n if (root.fields.length) {\n result.fields = [...root.fields]\n }\n return result\n}\n\n/**\n * Serializes a DataDomain for version release, including only relevant foreign nodes.\n *\n * @param dataDomain The DataDomain to serialize.\n * @returns A SerializedGraph containing the versioned data.\n */\nexport function serializeForVersionRelease(dataDomain: DataDomain): SerializedGraph {\n const { graph, key: domainKey } = dataDomain\n const relevantForeignNodes = new Set<string>()\n\n // 1. Identify relevant foreign nodes: those connected to local entities.\n for (const node of graph.nodes()) {\n const nodeValue = graph.node(node)\n if (!nodeValue) {\n continue\n }\n if (nodeValue.domain.key === domainKey) {\n continue // Skip local nodes\n }\n\n // Check if the foreign node is connected to a local node (directly or indirectly).\n if (isConnectedToLocal(graph, node, domainKey)) {\n relevantForeignNodes.add(node)\n }\n }\n\n // 2. Filter nodes and edges based on relevance.\n const nodes = []\n const edges = []\n\n for (const node of graph.nodes()) {\n const nodeValue = graph.node(node)\n if (!nodeValue) {\n continue\n }\n\n if (nodeValue.domain.key === domainKey || relevantForeignNodes.has(node)) {\n const parents = [...graph.parents(node)]\n const serializedNode: Node<object> = { v: node, value: nodeValue.toJSON() }\n if (parents.length) {\n serializedNode.parents = parents\n }\n nodes.push(serializedNode)\n }\n }\n\n for (const edge of graph.edges()) {\n const edgeValue = graph.edge(edge)\n if (!edgeValue) continue\n\n const sourceNode = graph.node(edge.v)\n const targetNode = graph.node(edge.w)\n\n if (!sourceNode || !targetNode) continue\n\n const isSourceRelevant = sourceNode.domain.key === domainKey || relevantForeignNodes.has(edge.v)\n const isTargetRelevant = targetNode.domain.key === domainKey || relevantForeignNodes.has(edge.w)\n\n if (isSourceRelevant && isTargetRelevant) {\n const serializedEdge: JsonEdge<DomainGraphEdge> = { v: edge.v, w: edge.w, value: structuredClone(edgeValue) }\n if (edge.name) {\n serializedEdge.name = edge.name\n }\n edges.push(serializedEdge)\n }\n }\n\n // 3. Construct the SerializedGraph.\n const json: SerializedGraph = {\n options: {\n directed: graph.isDirected(),\n multigraph: graph.isMultigraph(),\n compound: graph.isCompound(),\n },\n nodes,\n edges,\n }\n\n return json\n}\n\n/**\n * Checks if a foreign node is connected to a local node (directly or indirectly).\n *\n * This function performs a breadth-first search (BFS) to determine if a foreign node\n * is connected to any local node.\n *\n * @param g The DataDomain graph.\n * @param node The key of the foreign node to check.\n * @param domainKey The key of the local domain.\n * @returns True if the foreign node is connected to a local node.\n */\nfunction isConnectedToLocal(g: DataDomainGraph, node: string, domainKey: string): boolean {\n const visited = new Set<string>()\n const queue: string[] = [node]\n\n while (queue.length > 0) {\n const current = queue.shift() as string\n if (visited.has(current)) {\n continue\n }\n visited.add(current)\n\n const value = g.node(current)\n if (!value) {\n continue\n }\n\n if (value.domain.key === domainKey) {\n // It means the foreign node is connected to a local node.\n return true\n }\n\n // Explore adjacent nodes (both incoming and outgoing edges).\n for (const edge of g.inEdges(current)) {\n queue.push(edge.v)\n }\n for (const edge of g.outEdges(current)) {\n const label = g.edge(edge)\n let id = edge.w\n if (label?.foreign) {\n id = `${label.domain}:${edge.w}`\n }\n queue.push(id)\n }\n }\n\n return false // No connection to a local node found.\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { Graph } from '@api-client/graph';
1
+ import type { Graph } from '@api-client/graph/graph/Graph.js';
2
2
  import type { DomainGraphEdge, DomainGraphNodeType } from './types.js';
3
3
  /**
4
4
  * Recursively removes a node and all its children from the graph.
@@ -1 +1 @@
1
- {"version":3,"file":"GraphUtils.d.ts","sourceRoot":"","sources":["../../../src/modeling/GraphUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEtE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAoB9G"}
1
+ {"version":3,"file":"GraphUtils.d.ts","sourceRoot":"","sources":["../../../src/modeling/GraphUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEtE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAoB9G"}
@@ -1 +1 @@
1
- {"version":3,"file":"GraphUtils.js","sourceRoot":"","sources":["../../../src/modeling/GraphUtils.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2D,EAAE,GAAW;IACtG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAM;IACR,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAC/B,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,SAAQ;QACV,CAAC;QACD,2EAA2E;QAC3E,2DAA2D;QAC3D,wDAAwD;QACxD,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACrD,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AACvB,CAAC","sourcesContent":["import type { Graph } from '@api-client/graph'\nimport type { DomainGraphEdge, DomainGraphNodeType } from './types.js'\n\n/**\n * Recursively removes a node and all its children from the graph.\n * @param key The key of the node to remove.\n */\nexport function removeGraphNode(graph: Graph<unknown, DomainGraphNodeType, DomainGraphEdge>, key: string): void {\n if (!graph.hasNode(key)) {\n return\n }\n for (const child of graph.children(key)) {\n removeGraphNode(graph, child)\n }\n for (const edge of graph.outEdges(key)) {\n const label = graph.edge(edge)\n if (!label) {\n continue\n }\n // While associations should be associated with the entity through an edge,\n // I am still on a fence about properties being the same...\n // We won't be reusing properties within a domain model.\n if (['property', 'association'].includes(label.type)) {\n removeGraphNode(graph, edge.w)\n }\n }\n graph.removeNode(key)\n}\n"]}
1
+ {"version":3,"file":"GraphUtils.js","sourceRoot":"","sources":["../../../src/modeling/GraphUtils.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2D,EAAE,GAAW;IACtG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAM;IACR,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAC/B,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,SAAQ;QACV,CAAC;QACD,2EAA2E;QAC3E,2DAA2D;QAC3D,wDAAwD;QACxD,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACrD,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AACvB,CAAC","sourcesContent":["import type { Graph } from '@api-client/graph/graph/Graph.js'\nimport type { DomainGraphEdge, DomainGraphNodeType } from './types.js'\n\n/**\n * Recursively removes a node and all its children from the graph.\n * @param key The key of the node to remove.\n */\nexport function removeGraphNode(graph: Graph<unknown, DomainGraphNodeType, DomainGraphEdge>, key: string): void {\n if (!graph.hasNode(key)) {\n return\n }\n for (const child of graph.children(key)) {\n removeGraphNode(graph, child)\n }\n for (const edge of graph.outEdges(key)) {\n const label = graph.edge(edge)\n if (!label) {\n continue\n }\n // While associations should be associated with the entity through an edge,\n // I am still on a fence about properties being the same...\n // We won't be reusing properties within a domain model.\n if (['property', 'association'].includes(label.type)) {\n removeGraphNode(graph, edge.w)\n }\n }\n graph.removeNode(key)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DataAssociation.d.ts","sourceRoot":"","sources":["../../../../src/modeling/legacy/DataAssociation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAEzF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AACrG,OAAO,EAA2B,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAEvF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,mBAAmB,CAAA;IAChC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;I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AG,SAAS;IAKtE;;;;;;OAMG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAahC"}
@@ -1,4 +1,3 @@
1
- import { Json } from '@api-client/json';
2
1
  import { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js';
3
2
  import { nanoid } from 'nanoid';
4
3
  import { Thing } from '../../models/Thing.js';
@@ -168,7 +167,7 @@ export class DataAssociation {
168
167
  this.info = Thing.fromName('');
169
168
  }
170
169
  if (schema) {
171
- this.schema = Json.clone(schema);
170
+ this.schema = structuredClone(schema);
172
171
  }
173
172
  else {
174
173
  this.schema = undefined;
@@ -192,7 +191,7 @@ export class DataAssociation {
192
191
  this.targets = [];
193
192
  }
194
193
  if (Array.isArray(bindings)) {
195
- this.bindings = bindings.map((i) => Json.clone(i));
194
+ this.bindings = bindings.map((i) => structuredClone(i));
196
195
  }
197
196
  else {
198
197
  this.bindings = [];
@@ -248,7 +247,7 @@ export class DataAssociation {
248
247
  info: this.info.toJSON(),
249
248
  };
250
249
  if (this.schema) {
251
- result.schema = Json.clone(this.schema);
250
+ result.schema = structuredClone(this.schema);
252
251
  }
253
252
  if (typeof this.multiple === 'boolean') {
254
253
  result.multiple = this.multiple;
@@ -260,7 +259,7 @@ export class DataAssociation {
260
259
  result.targets = this.targets.map((i) => ({ ...i }));
261
260
  }
262
261
  if (Array.isArray(this.bindings) && this.bindings.length) {
263
- result.bindings = this.bindings.map((i) => Json.clone(i));
262
+ result.bindings = this.bindings.map((i) => structuredClone(i));
264
263
  }
265
264
  return result;
266
265
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DataAssociation.js","sourceRoot":"","sources":["../../../../src/modeling/legacy/DataAssociation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAA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AAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAwB,CAAA;YAC1D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC;QACD,OAAO,MAAM,CAAC,MAAgC,CAAA;IAChD,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,IAAwB;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAuB,CAAA;QAC7E,OAAO,IAAI,EAAE,MAAM,CAAA;IACrB,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,GAAW;QACnB,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACrB,OAAO,KAAK,CAAA;QACd,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,KAAK,CAAA;QACd,CAAC;QACD,IAAI,MAAM,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACvB,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import { Json } from '@api-client/json'\nimport { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js'\nimport { IApiAssociationShape, IApiPropertyShape } from '../../amf/definitions/Shapes.js'\nimport { nanoid } from 'nanoid'\nimport { IThing, Thing } from '../../models/Thing.js'\nimport { DataEntity, IDataEntity } from './DataEntity.js'\nimport { DataNamespace } from './DataNamespace.js'\nimport { type FieldValidationMessage, ValidationError } from '../../exceptions/validation_error.js'\nimport { DataAssociationKind } from '../../models/kinds.js'\nimport type { AssociationBinding, AssociationBindings, AssociationWebBindings } from '../Bindings.js'\nimport { DataAttributeAttributes, type DataAttributeAttribute } from '../DataFormat.js'\n\n/**\n * Describes association target of an entity\n * @deprecated\n */\nexport interface AssociationTarget {\n /**\n * The key of the associated entity.\n */\n key: string\n /**\n * The key of the namespace to look for entities.\n * By default it is the current (root) namespace. When this is set the program\n * will look into `foreign` of the root namespace for the definition\n * of the entity.\n */\n namespace?: string\n}\n\n/**\n * Describes an association between entities. An association is another property of an entity.\n * The `name` is the name of the property and the value is the associated target or targets.\n *\n * An association can have multiple targets to allow describing the model as `allOf`, `anyOf` and `oneOf` schemas.\n * When the association has only one target, then generated schema cannot have union types.\n *\n * Depending on the schema translation an association can be embedded as a sub-object in the generated schema\n * or can be references via a primary key.\n * @deprecated\n */\nexport interface IDataAssociation {\n kind: typeof DataAssociationKind\n /**\n * The key of the association.\n */\n key: string\n /**\n * The data association description.\n */\n info: IThing\n /**\n * Wether the data association is required.\n */\n required?: boolean\n /**\n * Whether the data association allows multiple items.\n */\n multiple?: boolean\n /**\n * The list of keys associated with the entity through this association.\n * An association without a target is considered invalid and discarded when processing the values.\n * When multiple associations are set then we are dealing with an union.\n */\n targets?: AssociationTarget[]\n /**\n * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)\n *\n * When this is defined then it is used as the schema. When this is not defined it uses\n * referenced entities schemas. Note, changes in the referenced entities may not be propagated\n * to schemas altered by the user.\n */\n schema?: IApiAssociationShape\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?: AssociationBinding[]\n}\n\n/**\n * Describes an association between entities. An association is a relationship defined on an entity\n * that links it to one or more other entities. The association has a `name` which is used as the\n * property name in the context of the parent entity, and it connects to a set of `targets`\n * representing the associated entities.\n *\n * An association can have multiple targets to allow describing the model as `allOf`, `anyOf`, or `oneOf`\n * schemas. When the association has only one target, then the generated schema cannot have union types.\n *\n * Depending on the schema translation, an association can be embedded as a sub-object in the generated\n * schema, or it can be referenced via a primary key.\n *\n * ## Key Concepts\n *\n * - **Targets**: An association's `targets` specify the entities that this association points to.\n * Each target is defined by:\n * - `key`: The key of the target entity.\n * - `namespace` (optional): The key of the namespace where the target entity is defined.\n * If not specified, it defaults to the current namespace.\n *\n * - **Cardinality**:\n * - `multiple` (boolean): Indicates whether the association allows multiple target entities.\n * If `true`, it's a to-many relationship; otherwise, it's a to-one relationship.\n *\n * - **Schema**:\n * - `schema` (optional): A custom schema for the association, allowing manual definition of the\n * association's structure in specific formats (e.g., JSON, RAML, XML).\n * When provided, this schema overrides the automatically generated schema based on the\n * target entities.\n * - **Important**: If a custom schema is defined and changes are made to the referenced\n * entities, those changes **will not** be automatically propagated to the custom schema.\n * This means the custom schema may become outdated and no longer accurately reflect the\n * structure of the target entities.\n *\n * - **Hidden**:\n * - `hidden`: (boolean) Defines if this association is a part of the schema or not.\n * @deprecated\n */\nexport class DataAssociation {\n kind = DataAssociationKind\n\n key = ''\n\n /**\n * The description of the data association.\n */\n info: Thing = Thing.fromName('')\n\n /**\n * Wether the data association is required.\n */\n required?: boolean\n\n /**\n * Whether the data association allows multiple items.\n */\n multiple?: boolean\n\n /**\n * The list of keys associated with the entity through this association.\n * An association without a target is considered invalid and discarded when processing the values.\n * When multiple associations are set then we are dealing with an union.\n */\n targets: AssociationTarget[] = []\n\n /**\n * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)\n *\n * When this is defined then it is used as the schema. When this is not defined it uses\n * referenced entities schemas. Note, changes in the referenced entities may not be propagated\n * to schemas altered by the user.\n */\n schema?: IApiAssociationShape\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 bindings: AssociationBinding[] = []\n\n /**\n * Returns true when the association has 0 or 1 targets.\n */\n get isSingle(): boolean {\n return this.targets.length < 2\n }\n\n /**\n * Creates an instance of DataAssociation from a target entity key.\n * Note, this entity will have no name. The default name is used instead.\n *\n * @param root The namespace root.\n * @param target The target entity key.\n * @param namespace The optional key of the target association when different to the current one.\n * @returns A new `DataAssociation` instance.\n */\n static fromTarget(root: DataNamespace, target: string, namespace?: string): DataAssociation {\n const assoc = new DataAssociation(root)\n const info: AssociationTarget = {\n key: target,\n }\n if (namespace) {\n info.namespace = namespace\n }\n assoc.targets = [info]\n return assoc\n }\n\n /**\n * Creates an instance of DataAssociation from a name, without defining a target.\n *\n * @param root The namespace root.\n * @param name The name of the association.\n * @returns A new `DataAssociation` instance.\n */\n static fromName(root: DataNamespace, name: string): DataAssociation {\n const assoc = new DataAssociation(root)\n assoc.info = Thing.fromName(name)\n return assoc\n }\n\n /**\n * @param input The data association definition to restore.\n */\n constructor(\n public root: DataNamespace,\n input?: string | IDataAssociation\n ) {\n let init: IDataAssociation\n if (typeof input === 'string') {\n try {\n init = JSON.parse(input)\n } catch {\n throw new ValidationError([\n {\n field: '',\n message: 'Unable to parse the data association input as JSON.',\n rule: 'object_required',\n },\n ])\n }\n } else if (typeof input === 'object') {\n init = input\n } else {\n init = {\n kind: DataAssociationKind,\n key: nanoid(),\n info: Thing.fromName('Unnamed association').toJSON(),\n }\n }\n this.new(init)\n }\n\n /**\n * Initializes the association using provided data.\n *\n * @param init - The data association definition to restore.\n */\n new(init: IDataAssociation): this {\n DataAssociation.validate(init)\n const { info, key = nanoid(), kind = DataAssociationKind, schema, multiple, required, targets, bindings } = init\n this.kind = kind\n this.key = key\n if (info) {\n this.info = new Thing(info)\n } else {\n this.info = Thing.fromName('')\n }\n if (schema) {\n this.schema = Json.clone(schema)\n } else {\n this.schema = undefined\n }\n if (typeof multiple === 'boolean') {\n this.multiple = multiple\n } else {\n this.multiple = undefined\n }\n if (typeof required === 'boolean') {\n this.required = required\n } else {\n this.required = undefined\n }\n if (Array.isArray(targets)) {\n this.targets = targets.map((i) => ({ ...i }))\n } else {\n this.targets = []\n }\n if (Array.isArray(bindings)) {\n this.bindings = bindings.map((i) => Json.clone(i))\n } else {\n this.bindings = []\n }\n return this\n }\n\n /**\n * Validates if the input object is a valid `DataAssociation` definition.\n * Throws a `ValidationError` if the input is invalid.\n *\n * @param input The object to validate.\n * @throws {ValidationError} When the validation fails.\n * @deprecated\n */\n static validate(input: unknown): void {\n const typed = input as IDataAssociation\n const messages: FieldValidationMessage[] = []\n if (!typed) {\n messages.push({\n field: '',\n message: 'The input is required. None given',\n rule: 'required',\n })\n throw new ValidationError(messages)\n }\n if (typed.kind !== DataAssociationKind) {\n messages.push({\n field: 'kind',\n message: `The kind property must be ${DataAssociationKind}`,\n rule: 'invalid',\n })\n }\n if (typed.info && typeof typed.info !== 'object') {\n messages.push({\n field: 'info',\n message: 'The info property must be an object',\n rule: 'invalid',\n })\n }\n if (messages.length) {\n throw new ValidationError(messages)\n }\n }\n\n /**\n * Generates an object representing the association, suitable for serialization.\n *\n * @returns A plain object representation of the `DataAssociation`.\n */\n toJSON(): IDataAssociation {\n const result: IDataAssociation = {\n kind: DataAssociationKind,\n key: this.key,\n info: this.info.toJSON(),\n }\n if (this.schema) {\n result.schema = Json.clone(this.schema)\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 (Array.isArray(this.targets) && this.targets.length) {\n result.targets = this.targets.map((i) => ({ ...i }))\n }\n if (Array.isArray(this.bindings) && this.bindings.length) {\n result.bindings = this.bindings.map((i) => Json.clone(i))\n }\n return result\n }\n\n /**\n * Retrieves the list of target entities.\n *\n * @returns An array of `DataEntity` instances representing the targets of this association.\n */\n getTargets(): DataEntity[] {\n const { targets } = this\n return this.root.findAssociatedEntities(targets).filter((i) => !!i) as DataEntity[]\n }\n\n /**\n * Removes self from the parent entity and the namespace definition.\n */\n remove(): void {\n const { root } = this\n const entity = root.definitions.entities.find((i) => i.associations.some((j) => j.key === this.key))\n if (entity) {\n const assocIndex = entity.associations.findIndex((i) => i.key === this.key)\n entity.associations.splice(assocIndex, 1)\n }\n const defIndex = this.root.definitions.associations.findIndex((i) => i.key === this.key)\n if (defIndex >= 0) {\n this.root.definitions.associations.splice(defIndex, 1)\n }\n }\n\n /**\n * Adds a target entity to the association.\n * If the entity comes from another namespace then it is set as a foreign entity.\n *\n * @param entity - The `DataEntity` instance to add.\n */\n addTarget(entity: DataEntity): void\n\n /**\n * Adds a target entity to the association.\n *\n * @param entity - The `IDataEntity` definition or just its key.\n * @param namespace - The key of the foreign namespace this entity belongs to.\n * Do not set this value for local entities.\n */\n addTarget(entity: IDataEntity | string, namespace?: string): void\n\n /**\n * @param init The key of an entity, its instance, or schema.\n * @param namespace - The key of the foreign namespace this entity belongs to.\n * Do not set this value for local entities.\n */\n addTarget(init: string | DataEntity | IDataEntity, namespace?: string): void {\n let key: string\n if (typeof init === 'string') {\n key = init\n } else {\n key = init.key\n const typed = init as IDataEntity & { root?: DataNamespace }\n if (!namespace && typed.root && typed.root !== this.root) {\n namespace = typed.root.key\n }\n }\n if (this.targets.some((i) => i.key === key)) {\n const message = `Target ${key} already exists.`\n throw new ValidationError(\n [\n {\n field: 'targets',\n message,\n rule: 'unique',\n },\n ],\n { message }\n )\n }\n if (namespace && namespace !== this.root.key) {\n const foreignNamespace = this.root.foreign.find((ns) => ns.key === namespace)\n if (!foreignNamespace) {\n throw new Error(`Foreign namespace \"${namespace}\" does not exist.`)\n }\n }\n const info: AssociationTarget = {\n key,\n }\n if (namespace) {\n info.namespace = namespace\n }\n this.targets.push(info)\n }\n\n /**\n * Removes a target entity from the targets list.\n *\n * @param init The key of an entity, its instance, or schema.\n */\n removeTarget(init: string | DataEntity | IDataEntity): void {\n let key: string\n if (typeof init === 'string') {\n key = init\n } else {\n key = init.key\n }\n const index = this.targets.findIndex((i) => i.key === key)\n if (index >= 0) {\n this.targets.splice(index, 1)\n }\n }\n\n /**\n * Creates a Property Shape of AMF.\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(): IApiPropertyShape {\n const serializer = new AmfShapeGenerator()\n return serializer.associationProperty(this)\n }\n\n /**\n * @deprecated Use the `getParentInstance()` method instead.\n */\n getParent(): DataEntity {\n return this.getParentInstance()\n }\n\n /**\n * Retrieves the parent entity of this association.\n *\n * @returns The `DataEntity` instance that contains this association.\n */\n getParentInstance(): DataEntity {\n // this is forced as an association is only created when an entity is created\n // so it has to be defined.\n return this.root.definitions.entities.find((i) => i.associations.some((a) => a.key === this.key)) as DataEntity\n }\n\n /**\n * Creates the `schema` object if missing and returns it.\n * @returns The schema object.\n */\n ensureSchema(): IApiAssociationShape {\n if (!this.schema) {\n this.schema = {}\n }\n return this.schema\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 * @deprecated\n */\n static isValidAttribute(value: unknown): value is DataAttributeAttribute {\n if (typeof value !== 'string') {\n return false\n }\n return DataAttributeAttributes.includes(value as DataAttributeAttribute)\n }\n\n /**\n * Creates if not existing and returns web bindings definition.\n * @returns The web binding definition\n */\n getWebBinding(): AssociationWebBindings {\n let object = this.bindings.find((i) => i.type === 'web') as AssociationBinding | undefined\n if (!object) {\n object = { type: 'web', schema: {} } as AssociationBinding\n this.bindings.push(object)\n }\n return object.schema as AssociationWebBindings\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'): AssociationBindings | undefined {\n const item = this.bindings.find((i) => i.type === type) as AssociationBinding\n return item?.schema\n }\n\n /**\n * Checks whether the association is a child of the given namespace, data model, or an entity.\n * The relationship doesn't have to be direct, as long as the association is in the hierarchy it will return true.\n *\n * @param key The key of the parent to check.\n * @returns True if this data association is a child of the given namespace, data model, or an entity\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"]}
1
+ {"version":3,"file":"DataAssociation.js","sourceRoot":"","sources":["../../../../src/modeling/legacy/DataAssociation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAU,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAGrD,OAAO,EAA+B,eAAe,EAAE,MAAM,sCAAsC,CAAA;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,uBAAuB,EAA+B,MAAM,kBAAkB,CAAA;AAyEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,OAAO,eAAe;IA0FjB;IAzFT,IAAI,GAAG,mBAAmB,CAAA;IAE1B,GAAG,GAAG,EAAE,CAAA;IAER;;OAEG;IACH,IAAI,GAAU,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,QAAQ,CAAU;IAElB;;;;OAIG;IACH,OAAO,GAAwB,EAAE,CAAA;IAEjC;;;;;;OAMG;IACH,MAAM,CAAuB;IAE7B;;;;;;OAMG;IACH,QAAQ,GAAyB,EAAE,CAAA;IAEnC;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAU,CAAC,IAAmB,EAAE,MAAc,EAAE,SAAkB;QACvE,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAA;QACvC,MAAM,IAAI,GAAsB;YAC9B,GAAG,EAAE,MAAM;SACZ,CAAA;QACD,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,SA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;OAGG;IACH,aAAa;QACX,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAmC,CAAA;QAC1F,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAwB,CAAA;YAC1D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC;QACD,OAAO,MAAM,CAAC,MAAgC,CAAA;IAChD,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,IAAwB;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAuB,CAAA;QAC7E,OAAO,IAAI,EAAE,MAAM,CAAA;IACrB,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,GAAW;QACnB,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACrB,OAAO,KAAK,CAAA;QACd,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,KAAK,CAAA;QACd,CAAC;QACD,IAAI,MAAM,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACvB,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js'\nimport { IApiAssociationShape, IApiPropertyShape } from '../../amf/definitions/Shapes.js'\nimport { nanoid } from 'nanoid'\nimport { IThing, Thing } from '../../models/Thing.js'\nimport { DataEntity, IDataEntity } from './DataEntity.js'\nimport { DataNamespace } from './DataNamespace.js'\nimport { type FieldValidationMessage, ValidationError } from '../../exceptions/validation_error.js'\nimport { DataAssociationKind } from '../../models/kinds.js'\nimport type { AssociationBinding, AssociationBindings, AssociationWebBindings } from '../Bindings.js'\nimport { DataAttributeAttributes, type DataAttributeAttribute } from '../DataFormat.js'\n\n/**\n * Describes association target of an entity\n * @deprecated\n */\nexport interface AssociationTarget {\n /**\n * The key of the associated entity.\n */\n key: string\n /**\n * The key of the namespace to look for entities.\n * By default it is the current (root) namespace. When this is set the program\n * will look into `foreign` of the root namespace for the definition\n * of the entity.\n */\n namespace?: string\n}\n\n/**\n * Describes an association between entities. An association is another property of an entity.\n * The `name` is the name of the property and the value is the associated target or targets.\n *\n * An association can have multiple targets to allow describing the model as `allOf`, `anyOf` and `oneOf` schemas.\n * When the association has only one target, then generated schema cannot have union types.\n *\n * Depending on the schema translation an association can be embedded as a sub-object in the generated schema\n * or can be references via a primary key.\n * @deprecated\n */\nexport interface IDataAssociation {\n kind: typeof DataAssociationKind\n /**\n * The key of the association.\n */\n key: string\n /**\n * The data association description.\n */\n info: IThing\n /**\n * Wether the data association is required.\n */\n required?: boolean\n /**\n * Whether the data association allows multiple items.\n */\n multiple?: boolean\n /**\n * The list of keys associated with the entity through this association.\n * An association without a target is considered invalid and discarded when processing the values.\n * When multiple associations are set then we are dealing with an union.\n */\n targets?: AssociationTarget[]\n /**\n * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)\n *\n * When this is defined then it is used as the schema. When this is not defined it uses\n * referenced entities schemas. Note, changes in the referenced entities may not be propagated\n * to schemas altered by the user.\n */\n schema?: IApiAssociationShape\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?: AssociationBinding[]\n}\n\n/**\n * Describes an association between entities. An association is a relationship defined on an entity\n * that links it to one or more other entities. The association has a `name` which is used as the\n * property name in the context of the parent entity, and it connects to a set of `targets`\n * representing the associated entities.\n *\n * An association can have multiple targets to allow describing the model as `allOf`, `anyOf`, or `oneOf`\n * schemas. When the association has only one target, then the generated schema cannot have union types.\n *\n * Depending on the schema translation, an association can be embedded as a sub-object in the generated\n * schema, or it can be referenced via a primary key.\n *\n * ## Key Concepts\n *\n * - **Targets**: An association's `targets` specify the entities that this association points to.\n * Each target is defined by:\n * - `key`: The key of the target entity.\n * - `namespace` (optional): The key of the namespace where the target entity is defined.\n * If not specified, it defaults to the current namespace.\n *\n * - **Cardinality**:\n * - `multiple` (boolean): Indicates whether the association allows multiple target entities.\n * If `true`, it's a to-many relationship; otherwise, it's a to-one relationship.\n *\n * - **Schema**:\n * - `schema` (optional): A custom schema for the association, allowing manual definition of the\n * association's structure in specific formats (e.g., JSON, RAML, XML).\n * When provided, this schema overrides the automatically generated schema based on the\n * target entities.\n * - **Important**: If a custom schema is defined and changes are made to the referenced\n * entities, those changes **will not** be automatically propagated to the custom schema.\n * This means the custom schema may become outdated and no longer accurately reflect the\n * structure of the target entities.\n *\n * - **Hidden**:\n * - `hidden`: (boolean) Defines if this association is a part of the schema or not.\n * @deprecated\n */\nexport class DataAssociation {\n kind = DataAssociationKind\n\n key = ''\n\n /**\n * The description of the data association.\n */\n info: Thing = Thing.fromName('')\n\n /**\n * Wether the data association is required.\n */\n required?: boolean\n\n /**\n * Whether the data association allows multiple items.\n */\n multiple?: boolean\n\n /**\n * The list of keys associated with the entity through this association.\n * An association without a target is considered invalid and discarded when processing the values.\n * When multiple associations are set then we are dealing with an union.\n */\n targets: AssociationTarget[] = []\n\n /**\n * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)\n *\n * When this is defined then it is used as the schema. When this is not defined it uses\n * referenced entities schemas. Note, changes in the referenced entities may not be propagated\n * to schemas altered by the user.\n */\n schema?: IApiAssociationShape\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 bindings: AssociationBinding[] = []\n\n /**\n * Returns true when the association has 0 or 1 targets.\n */\n get isSingle(): boolean {\n return this.targets.length < 2\n }\n\n /**\n * Creates an instance of DataAssociation from a target entity key.\n * Note, this entity will have no name. The default name is used instead.\n *\n * @param root The namespace root.\n * @param target The target entity key.\n * @param namespace The optional key of the target association when different to the current one.\n * @returns A new `DataAssociation` instance.\n */\n static fromTarget(root: DataNamespace, target: string, namespace?: string): DataAssociation {\n const assoc = new DataAssociation(root)\n const info: AssociationTarget = {\n key: target,\n }\n if (namespace) {\n info.namespace = namespace\n }\n assoc.targets = [info]\n return assoc\n }\n\n /**\n * Creates an instance of DataAssociation from a name, without defining a target.\n *\n * @param root The namespace root.\n * @param name The name of the association.\n * @returns A new `DataAssociation` instance.\n */\n static fromName(root: DataNamespace, name: string): DataAssociation {\n const assoc = new DataAssociation(root)\n assoc.info = Thing.fromName(name)\n return assoc\n }\n\n /**\n * @param input The data association definition to restore.\n */\n constructor(\n public root: DataNamespace,\n input?: string | IDataAssociation\n ) {\n let init: IDataAssociation\n if (typeof input === 'string') {\n try {\n init = JSON.parse(input)\n } catch {\n throw new ValidationError([\n {\n field: '',\n message: 'Unable to parse the data association input as JSON.',\n rule: 'object_required',\n },\n ])\n }\n } else if (typeof input === 'object') {\n init = input\n } else {\n init = {\n kind: DataAssociationKind,\n key: nanoid(),\n info: Thing.fromName('Unnamed association').toJSON(),\n }\n }\n this.new(init)\n }\n\n /**\n * Initializes the association using provided data.\n *\n * @param init - The data association definition to restore.\n */\n new(init: IDataAssociation): this {\n DataAssociation.validate(init)\n const { info, key = nanoid(), kind = DataAssociationKind, schema, multiple, required, targets, bindings } = init\n this.kind = kind\n this.key = key\n if (info) {\n this.info = new Thing(info)\n } else {\n this.info = Thing.fromName('')\n }\n if (schema) {\n this.schema = structuredClone(schema)\n } else {\n this.schema = undefined\n }\n if (typeof multiple === 'boolean') {\n this.multiple = multiple\n } else {\n this.multiple = undefined\n }\n if (typeof required === 'boolean') {\n this.required = required\n } else {\n this.required = undefined\n }\n if (Array.isArray(targets)) {\n this.targets = targets.map((i) => ({ ...i }))\n } else {\n this.targets = []\n }\n if (Array.isArray(bindings)) {\n this.bindings = bindings.map((i) => structuredClone(i))\n } else {\n this.bindings = []\n }\n return this\n }\n\n /**\n * Validates if the input object is a valid `DataAssociation` definition.\n * Throws a `ValidationError` if the input is invalid.\n *\n * @param input The object to validate.\n * @throws {ValidationError} When the validation fails.\n * @deprecated\n */\n static validate(input: unknown): void {\n const typed = input as IDataAssociation\n const messages: FieldValidationMessage[] = []\n if (!typed) {\n messages.push({\n field: '',\n message: 'The input is required. None given',\n rule: 'required',\n })\n throw new ValidationError(messages)\n }\n if (typed.kind !== DataAssociationKind) {\n messages.push({\n field: 'kind',\n message: `The kind property must be ${DataAssociationKind}`,\n rule: 'invalid',\n })\n }\n if (typed.info && typeof typed.info !== 'object') {\n messages.push({\n field: 'info',\n message: 'The info property must be an object',\n rule: 'invalid',\n })\n }\n if (messages.length) {\n throw new ValidationError(messages)\n }\n }\n\n /**\n * Generates an object representing the association, suitable for serialization.\n *\n * @returns A plain object representation of the `DataAssociation`.\n */\n toJSON(): IDataAssociation {\n const result: IDataAssociation = {\n kind: DataAssociationKind,\n key: this.key,\n info: this.info.toJSON(),\n }\n if (this.schema) {\n result.schema = structuredClone(this.schema)\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 (Array.isArray(this.targets) && this.targets.length) {\n result.targets = this.targets.map((i) => ({ ...i }))\n }\n if (Array.isArray(this.bindings) && this.bindings.length) {\n result.bindings = this.bindings.map((i) => structuredClone(i))\n }\n return result\n }\n\n /**\n * Retrieves the list of target entities.\n *\n * @returns An array of `DataEntity` instances representing the targets of this association.\n */\n getTargets(): DataEntity[] {\n const { targets } = this\n return this.root.findAssociatedEntities(targets).filter((i) => !!i) as DataEntity[]\n }\n\n /**\n * Removes self from the parent entity and the namespace definition.\n */\n remove(): void {\n const { root } = this\n const entity = root.definitions.entities.find((i) => i.associations.some((j) => j.key === this.key))\n if (entity) {\n const assocIndex = entity.associations.findIndex((i) => i.key === this.key)\n entity.associations.splice(assocIndex, 1)\n }\n const defIndex = this.root.definitions.associations.findIndex((i) => i.key === this.key)\n if (defIndex >= 0) {\n this.root.definitions.associations.splice(defIndex, 1)\n }\n }\n\n /**\n * Adds a target entity to the association.\n * If the entity comes from another namespace then it is set as a foreign entity.\n *\n * @param entity - The `DataEntity` instance to add.\n */\n addTarget(entity: DataEntity): void\n\n /**\n * Adds a target entity to the association.\n *\n * @param entity - The `IDataEntity` definition or just its key.\n * @param namespace - The key of the foreign namespace this entity belongs to.\n * Do not set this value for local entities.\n */\n addTarget(entity: IDataEntity | string, namespace?: string): void\n\n /**\n * @param init The key of an entity, its instance, or schema.\n * @param namespace - The key of the foreign namespace this entity belongs to.\n * Do not set this value for local entities.\n */\n addTarget(init: string | DataEntity | IDataEntity, namespace?: string): void {\n let key: string\n if (typeof init === 'string') {\n key = init\n } else {\n key = init.key\n const typed = init as IDataEntity & { root?: DataNamespace }\n if (!namespace && typed.root && typed.root !== this.root) {\n namespace = typed.root.key\n }\n }\n if (this.targets.some((i) => i.key === key)) {\n const message = `Target ${key} already exists.`\n throw new ValidationError(\n [\n {\n field: 'targets',\n message,\n rule: 'unique',\n },\n ],\n { message }\n )\n }\n if (namespace && namespace !== this.root.key) {\n const foreignNamespace = this.root.foreign.find((ns) => ns.key === namespace)\n if (!foreignNamespace) {\n throw new Error(`Foreign namespace \"${namespace}\" does not exist.`)\n }\n }\n const info: AssociationTarget = {\n key,\n }\n if (namespace) {\n info.namespace = namespace\n }\n this.targets.push(info)\n }\n\n /**\n * Removes a target entity from the targets list.\n *\n * @param init The key of an entity, its instance, or schema.\n */\n removeTarget(init: string | DataEntity | IDataEntity): void {\n let key: string\n if (typeof init === 'string') {\n key = init\n } else {\n key = init.key\n }\n const index = this.targets.findIndex((i) => i.key === key)\n if (index >= 0) {\n this.targets.splice(index, 1)\n }\n }\n\n /**\n * Creates a Property Shape of AMF.\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(): IApiPropertyShape {\n const serializer = new AmfShapeGenerator()\n return serializer.associationProperty(this)\n }\n\n /**\n * @deprecated Use the `getParentInstance()` method instead.\n */\n getParent(): DataEntity {\n return this.getParentInstance()\n }\n\n /**\n * Retrieves the parent entity of this association.\n *\n * @returns The `DataEntity` instance that contains this association.\n */\n getParentInstance(): DataEntity {\n // this is forced as an association is only created when an entity is created\n // so it has to be defined.\n return this.root.definitions.entities.find((i) => i.associations.some((a) => a.key === this.key)) as DataEntity\n }\n\n /**\n * Creates the `schema` object if missing and returns it.\n * @returns The schema object.\n */\n ensureSchema(): IApiAssociationShape {\n if (!this.schema) {\n this.schema = {}\n }\n return this.schema\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 * @deprecated\n */\n static isValidAttribute(value: unknown): value is DataAttributeAttribute {\n if (typeof value !== 'string') {\n return false\n }\n return DataAttributeAttributes.includes(value as DataAttributeAttribute)\n }\n\n /**\n * Creates if not existing and returns web bindings definition.\n * @returns The web binding definition\n */\n getWebBinding(): AssociationWebBindings {\n let object = this.bindings.find((i) => i.type === 'web') as AssociationBinding | undefined\n if (!object) {\n object = { type: 'web', schema: {} } as AssociationBinding\n this.bindings.push(object)\n }\n return object.schema as AssociationWebBindings\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'): AssociationBindings | undefined {\n const item = this.bindings.find((i) => i.type === type) as AssociationBinding\n return item?.schema\n }\n\n /**\n * Checks whether the association is a child of the given namespace, data model, or an entity.\n * The relationship doesn't have to be direct, as long as the association is in the hierarchy it will return true.\n *\n * @param key The key of the parent to check.\n * @returns True if this data association is a child of the given namespace, data model, or an entity\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DataProperty.d.ts","sourceRoot":"","sources":["../../../../src/modeling/legacy/DataProperty.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAEnE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAGL,KAAK,qBAAqB,EAE1B,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EAItB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,IAAI,EAAE,SAAS,GAAG,UAAU,CAAA;IAC5B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;;;OAOG;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;IACH,MAAM,IAAI,IAAI;IAad;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAgBzB;;;;OAIG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAY5B;;;;;;;;;OASG;IACH,UAAU,IAAI,iBAAiB;IAK/B;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB;IAO7D;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB;IAOvE;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB;IAiBjE;;;OAGG;IACH,YAAY,IAAI,kBAAkB;IAOlC;;;OAGG;IACH,aAAa,IAAI,mBAAmB;IASpC;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,UAAU,GAAG,gBAAgB,GAAG,SAAS;IAKnE;;OAEG;IACH,iBAAiB,IAAI,UAAU,GAAG,SAAS;IAI3C;;;;;;OAMG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAahC"}
@@ -1,4 +1,3 @@
1
- import { Json } from '@api-client/json';
2
1
  import { Thing } from '../../models/Thing.js';
3
2
  import { nanoid } from 'nanoid';
4
3
  import { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js';
@@ -183,13 +182,13 @@ export class DataProperty {
183
182
  this.taxonomy = [];
184
183
  }
185
184
  if (schema) {
186
- this.schema = Json.clone(schema);
185
+ this.schema = structuredClone(schema);
187
186
  }
188
187
  else {
189
188
  this.schema = undefined;
190
189
  }
191
190
  if (Array.isArray(bindings)) {
192
- this.bindings = bindings.map((i) => Json.clone(i));
191
+ this.bindings = bindings.map((i) => structuredClone(i));
193
192
  }
194
193
  else {
195
194
  this.bindings = [];
@@ -237,10 +236,10 @@ export class DataProperty {
237
236
  result.taxonomy = [...this.taxonomy];
238
237
  }
239
238
  if (this.schema) {
240
- result.schema = Json.clone(this.schema);
239
+ result.schema = structuredClone(this.schema);
241
240
  }
242
241
  if (Array.isArray(this.bindings) && this.bindings.length) {
243
- result.bindings = this.bindings.map((i) => Json.clone(i));
242
+ result.bindings = this.bindings.map((i) => structuredClone(i));
244
243
  }
245
244
  return result;
246
245
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DataProperty.js","sourceRoot":"","sources":["../../../../src/modeling/legacy/DataProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAU,KAAK,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAEL,aAAa,EAEb,sBAAsB,EAEtB,gBAAgB,EAEhB,iBAAiB,EAEjB,aAAa,GACd,MAAM,kBAAkB,CAAA;AAwKzB;;GAEG;AACH,MAAM,OAAO,YAAY;IAyGd;IAxGT,IAAI,GAAG,gBAAgB,CAAA;IAEvB,GAAG,GAAG,EAAE,CAAA;IAER;;OAEG;IACH,IAAI,GAAU,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,OAAO,CAAU;IAEjB;;OAEG;IACH,KAAK,CAAU;IAEf;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,SAAS,CAAU;IAEnB;;OAEG;IACH,UAAU,CAAU;IAEpB;;;;OAIG;IACH,IAAI,GAAa,EAAE,CAAA;IAEnB;;;;OAIG;IACH,QAAQ,GAAa,EAAE,CAAA;IAEvB;;;;;;OAMG;IACH,IAA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CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAoB,CAAA;QAC1E,OAAO,IAAI,EAAE,MAAM,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IACjG,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,GAAW;QACnB,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACrB,OAAO,KAAK,CAAA;QACd,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,KAAK,CAAA;QACd,CAAC;QACD,IAAI,MAAM,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACvB,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import { Json } from '@api-client/json'\nimport { IThing, Thing } from '../../models/Thing.js'\nimport { nanoid } from 'nanoid'\nimport { DataNamespace } from './DataNamespace.js'\nimport { IApiPropertyShape } from '../../amf/definitions/Shapes.js'\nimport { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js'\nimport { PropertyBinding, PropertyBindings, PropertyWebBindings } from '../Bindings.js'\nimport { DataPropertyKind } from '../../models/kinds.js'\nimport {\n type BinaryFormat,\n BinaryFormats,\n type DataPropertyAttribute,\n DataPropertyAttributes,\n type DataPropertyFormat,\n DataPropertyList,\n type DataPropertyType,\n DataPropertyTypes,\n type NumberFormat,\n NumberFormats,\n} from '../DataFormat.js'\nimport type { DataEntity } from './DataEntity.js'\n\n/**\n * Describes the default value set on a property schema.\n * @deprecated\n */\nexport interface SchemaDefaultValue {\n /**\n * The type of the default value.\n *\n * - `literal` The `value` should be used as-is.\n * - `function` The value represents the name of the function to be used.\n */\n type: 'literal' | 'function'\n /**\n * The actual value type depends on the `type`.\n * It is always a string and it has to be casted to the property's data type.\n */\n value: string\n}\n\n/**\n * A general schema definition for a property.\n * This is propagated to all bindings (when they support these properties).\n * @deprecated\n */\nexport interface DataPropertySchema {\n /**\n * The minimum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMinimum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n minimum?: number\n /**\n * The maximum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMaximum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n maximum?: number\n /**\n * When set, the minimum value is exclusive.\n *\n * - When `false`: value ≥ minimum.\n * - When `true`: value > minimum.\n */\n exclusiveMinimum?: boolean\n /**\n * When set, the exclusiveMaximum value is exclusive.\n *\n * - When `false`: value ≤ maximum.\n * - When `true`: value < minimum.\n */\n exclusiveMaximum?: boolean\n /**\n * The multiplier value for a number scalar.\n *\n * Examples:\n * - if `1` then every integer is allowed\n * - if `2` than every even number is allowed\n * - if `0.5` than every number dividable by `0.5` is allowed\n */\n multipleOf?: number\n /**\n * The enum values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n enum?: string[]\n /**\n * The default value for the property.\n * This is always encoded as a string. The actual type is defined in the `dataType` property.\n */\n defaultValue?: SchemaDefaultValue\n /**\n * The example values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n examples?: string[]\n}\n\n/**\n * @deprecated\n */\nexport interface IDataProperty {\n kind: typeof DataPropertyKind\n /**\n * The key of the namespace.\n */\n key: string\n /**\n * The data 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 * For future use.\n *\n * The keys of the taxonomy items associated with the property.\n */\n taxonomy?: string[]\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: DataPropertyType\n /**\n * The general schema definition of this property.\n * This is propagated to all bindings (when they support these properties).\n */\n schema?: DataPropertySchema\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 * @deprecated\n */\nexport class DataProperty {\n kind = DataPropertyKind\n\n key = ''\n\n /**\n * The description of the data namespace.\n */\n info: Thing = Thing.fromName('')\n\n /**\n * Wether the data property is required.\n */\n required?: boolean\n\n /**\n * Whether the data property allows multiple items.\n */\n multiple?: boolean\n\n /**\n * Whether this property describes a primary key of the entity.\n */\n primary?: boolean\n\n /**\n * Whether this property describes an indexed property of the entity.\n */\n index?: boolean\n\n /**\n * Whether the property is read only in the schema.\n */\n readOnly?: boolean\n\n /**\n * Whether the property is write only in the schema.\n */\n writeOnly?: boolean\n\n /**\n * Whether this property is deprecated.\n */\n deprecated?: boolean\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 */\n tags: string[] = []\n\n /**\n * Reserved for future use.\n *\n * The keys of the taxonomy items associated with the property.\n */\n taxonomy: string[] = []\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 type: DataPropertyType = '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 schema?: DataPropertySchema\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 * @deprecated Use the direct import of types.\n */\n static get supportedTypes(): DataPropertyType[] {\n return [...DataPropertyTypes]\n }\n\n static fromName(root: DataNamespace, name: string): DataProperty {\n const property = new DataProperty(root)\n property.info = Thing.fromName(name)\n return property\n }\n\n static fromType(root: DataNamespace, type: DataPropertyType): DataProperty {\n const result = new DataProperty(root)\n result.type = type\n return result\n }\n\n /**\n * @param input The data property definition to restore.\n */\n constructor(\n public root: DataNamespace,\n input?: string | IDataProperty\n ) {\n let init: IDataProperty\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n } else {\n init = {\n kind: DataPropertyKind,\n key: nanoid(),\n info: Thing.fromName('').toJSON(),\n type: 'string',\n }\n }\n this.new(init)\n }\n\n new(init: IDataProperty): void {\n if (!DataProperty.isDataProperty(init)) {\n throw new Error(`Not a data property.`)\n }\n const {\n info,\n key = nanoid(),\n kind = DataPropertyKind,\n multiple,\n required,\n type = DataPropertyList.string,\n index,\n primary,\n readOnly,\n writeOnly,\n tags,\n taxonomy,\n deprecated,\n schema,\n bindings,\n } = init\n this.kind = kind\n this.key = key\n this.type = type\n if (info) {\n this.info = new Thing(info)\n } else {\n this.info = Thing.fromName('')\n }\n if (typeof multiple === 'boolean') {\n this.multiple = multiple\n } else {\n this.multiple = undefined\n }\n if (typeof required === 'boolean') {\n this.required = required\n } else {\n this.required = undefined\n }\n if (typeof index === 'boolean') {\n this.index = index\n } else {\n this.index = undefined\n }\n if (typeof deprecated === 'boolean') {\n this.deprecated = deprecated\n } else {\n this.deprecated = undefined\n }\n if (typeof primary === 'boolean') {\n this.primary = primary\n } else {\n this.primary = undefined\n }\n if (typeof readOnly === 'boolean') {\n this.readOnly = readOnly\n } else {\n this.readOnly = undefined\n }\n if (typeof writeOnly === 'boolean') {\n this.writeOnly = writeOnly\n } else {\n this.writeOnly = undefined\n }\n if (Array.isArray(tags)) {\n this.tags = [...tags]\n } else {\n this.tags = []\n }\n if (Array.isArray(taxonomy)) {\n this.taxonomy = [...taxonomy]\n } else {\n this.taxonomy = []\n }\n if (schema) {\n this.schema = Json.clone(schema)\n } else {\n this.schema = undefined\n }\n if (Array.isArray(bindings)) {\n this.bindings = bindings.map((i) => Json.clone(i))\n } else {\n this.bindings = []\n }\n }\n\n static isDataProperty(input: unknown): boolean {\n const typed = input as IDataProperty\n if (!input || typed.kind !== DataPropertyKind) {\n return false\n }\n return true\n }\n\n toJSON(): IDataProperty {\n const result: IDataProperty = {\n kind: DataPropertyKind,\n info: this.info.toJSON(),\n key: this.key,\n type: this.type || DataPropertyList.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.taxonomy) && this.taxonomy.length) {\n result.taxonomy = [...this.taxonomy]\n }\n if (this.schema) {\n result.schema = Json.clone(this.schema)\n }\n if (Array.isArray(this.bindings) && this.bindings.length) {\n result.bindings = this.bindings.map((i) => Json.clone(i))\n }\n return result\n }\n\n /**\n * Removes self from the parent entity and the namespace definition.\n */\n remove(): void {\n const { root } = this\n const entity = root.definitions.entities.find((i) => i.properties.some((j) => j.key === this.key))\n if (entity) {\n const assocIndex = entity.properties.findIndex((i) => i.key === this.key)\n entity.properties.splice(assocIndex, 1)\n }\n const defIndex = this.root.definitions.properties.findIndex((i) => i.key === this.key)\n if (defIndex >= 0) {\n this.root.definitions.properties.splice(defIndex, 1)\n }\n }\n\n /**\n * Adds a new tag to the property. It also populates the root namespace's tags when tag is new.\n *\n * Note, it does nothing when the tag is already defined.\n *\n * @param tag The tag to add.\n */\n addTag(tag: string): void {\n if (!tag) {\n return\n }\n const lower = tag.toLowerCase()\n const { tags } = this\n if (tags.some((t) => t.toLowerCase() === lower)) {\n return\n }\n tags.push(tag)\n const { definitions } = this.root\n if (!definitions.tags.some((t) => t.toLowerCase() === lower)) {\n definitions.tags.push(tag)\n }\n }\n\n /**\n * Removes a tag from the property. Unlike the `addTag()` this won't remove a `tag` from the root namespace.\n *\n * @param tag The tag to remove.\n */\n removeTag(tag: string): void {\n if (!tag) {\n return\n }\n const lower = tag.toLowerCase()\n const { tags } = this\n const index = tags.findIndex((t) => t.toLowerCase() === lower)\n if (index >= 0) {\n tags.splice(index, 1)\n }\n }\n\n /**\n * Creates a Property Shape of AMF.\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(): IApiPropertyShape {\n const serializer = new AmfShapeGenerator()\n return serializer.property(this)\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 DataPropertyType {\n if (typeof value !== 'string') {\n return false\n }\n return DataPropertyTypes.includes(value as DataPropertyType)\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 DataPropertyAttribute {\n if (typeof value !== 'string') {\n return false\n }\n return DataPropertyAttributes.includes(value as DataPropertyAttribute)\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 DataPropertyFormat {\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(): DataPropertySchema {\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\n }\n\n /**\n * Returns a parent data entity where this data property exist.\n */\n getParentInstance(): DataEntity | undefined {\n return this.root.definitions.entities.find((e) => e.properties.some((e) => e.key === this.key))\n }\n\n /**\n * Checks whether the property is a child of the given namespace, data model, or an entity.\n * The relationship doesn't have to be direct, as long as the property is in the hierarchy it will return true.\n *\n * @param key The key of the parent to check.\n * @returns True if this data property is a child of the given namespace, data model, or an entity\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"]}
1
+ {"version":3,"file":"DataProperty.js","sourceRoot":"","sources":["../../../../src/modeling/legacy/DataProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAEL,aAAa,EAEb,sBAAsB,EAEtB,gBAAgB,EAEhB,iBAAiB,EAEjB,aAAa,GACd,MAAM,kBAAkB,CAAA;AAwKzB;;GAEG;AACH,MAAM,OAAO,YAAY;IAyGd;IAxGT,IAAI,GAAG,gBAAgB,CAAA;IAEvB,GAAG,GAAG,EAAE,CAAA;IAER;;OAEG;IACH,IAAI,GAAU,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,OAAO,CAAU;IAEjB;;OAEG;IACH,KAAK,CAAU;IAEf;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,SAAS,CAAU;IAEnB;;OAEG;IACH,UAAU,CAAU;IAEpB;;;;OAIG;IACH,IAAI,GAAa,EAAE,CAAA;IAEnB;;;;OAIG;IACH,QAAQ,GAAa,EAAE,CAAA;IAEvB;;;;;;OAMG;IACH,IAAI,GAAqB,QAAQ,CAAA;IAEjC;;;OAGG;IACH,MAAM,CAAqB;IAC3B;;;;;;OAMG;IACH,QAAQ,GAAsB,EAAE,CAAA;IAEhC;;OAEG;IACH,MAAM,KAAK,cAAc;QACvB,OAAO,CAAC,GAAG,iBAAiB,CAAC,CAAA;IAC/B,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAmB,EAAE,IAAY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EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IACjG,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,GAAW;QACnB,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACrB,OAAO,KAAK,CAAA;QACd,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,KAAK,CAAA;QACd,CAAC;QACD,IAAI,MAAM,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACvB,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import { IThing, Thing } from '../../models/Thing.js'\nimport { nanoid } from 'nanoid'\nimport { DataNamespace } from './DataNamespace.js'\nimport { IApiPropertyShape } from '../../amf/definitions/Shapes.js'\nimport { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js'\nimport { PropertyBinding, PropertyBindings, PropertyWebBindings } from '../Bindings.js'\nimport { DataPropertyKind } from '../../models/kinds.js'\nimport {\n type BinaryFormat,\n BinaryFormats,\n type DataPropertyAttribute,\n DataPropertyAttributes,\n type DataPropertyFormat,\n DataPropertyList,\n type DataPropertyType,\n DataPropertyTypes,\n type NumberFormat,\n NumberFormats,\n} from '../DataFormat.js'\nimport type { DataEntity } from './DataEntity.js'\n\n/**\n * Describes the default value set on a property schema.\n * @deprecated\n */\nexport interface SchemaDefaultValue {\n /**\n * The type of the default value.\n *\n * - `literal` The `value` should be used as-is.\n * - `function` The value represents the name of the function to be used.\n */\n type: 'literal' | 'function'\n /**\n * The actual value type depends on the `type`.\n * It is always a string and it has to be casted to the property's data type.\n */\n value: string\n}\n\n/**\n * A general schema definition for a property.\n * This is propagated to all bindings (when they support these properties).\n * @deprecated\n */\nexport interface DataPropertySchema {\n /**\n * The minimum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMinimum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n minimum?: number\n /**\n * The maximum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMaximum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n maximum?: number\n /**\n * When set, the minimum value is exclusive.\n *\n * - When `false`: value ≥ minimum.\n * - When `true`: value > minimum.\n */\n exclusiveMinimum?: boolean\n /**\n * When set, the exclusiveMaximum value is exclusive.\n *\n * - When `false`: value ≤ maximum.\n * - When `true`: value < minimum.\n */\n exclusiveMaximum?: boolean\n /**\n * The multiplier value for a number scalar.\n *\n * Examples:\n * - if `1` then every integer is allowed\n * - if `2` than every even number is allowed\n * - if `0.5` than every number dividable by `0.5` is allowed\n */\n multipleOf?: number\n /**\n * The enum values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n enum?: string[]\n /**\n * The default value for the property.\n * This is always encoded as a string. The actual type is defined in the `dataType` property.\n */\n defaultValue?: SchemaDefaultValue\n /**\n * The example values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n examples?: string[]\n}\n\n/**\n * @deprecated\n */\nexport interface IDataProperty {\n kind: typeof DataPropertyKind\n /**\n * The key of the namespace.\n */\n key: string\n /**\n * The data 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 * For future use.\n *\n * The keys of the taxonomy items associated with the property.\n */\n taxonomy?: string[]\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: DataPropertyType\n /**\n * The general schema definition of this property.\n * This is propagated to all bindings (when they support these properties).\n */\n schema?: DataPropertySchema\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 * @deprecated\n */\nexport class DataProperty {\n kind = DataPropertyKind\n\n key = ''\n\n /**\n * The description of the data namespace.\n */\n info: Thing = Thing.fromName('')\n\n /**\n * Wether the data property is required.\n */\n required?: boolean\n\n /**\n * Whether the data property allows multiple items.\n */\n multiple?: boolean\n\n /**\n * Whether this property describes a primary key of the entity.\n */\n primary?: boolean\n\n /**\n * Whether this property describes an indexed property of the entity.\n */\n index?: boolean\n\n /**\n * Whether the property is read only in the schema.\n */\n readOnly?: boolean\n\n /**\n * Whether the property is write only in the schema.\n */\n writeOnly?: boolean\n\n /**\n * Whether this property is deprecated.\n */\n deprecated?: boolean\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 */\n tags: string[] = []\n\n /**\n * Reserved for future use.\n *\n * The keys of the taxonomy items associated with the property.\n */\n taxonomy: string[] = []\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 type: DataPropertyType = '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 schema?: DataPropertySchema\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 * @deprecated Use the direct import of types.\n */\n static get supportedTypes(): DataPropertyType[] {\n return [...DataPropertyTypes]\n }\n\n static fromName(root: DataNamespace, name: string): DataProperty {\n const property = new DataProperty(root)\n property.info = Thing.fromName(name)\n return property\n }\n\n static fromType(root: DataNamespace, type: DataPropertyType): DataProperty {\n const result = new DataProperty(root)\n result.type = type\n return result\n }\n\n /**\n * @param input The data property definition to restore.\n */\n constructor(\n public root: DataNamespace,\n input?: string | IDataProperty\n ) {\n let init: IDataProperty\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n } else {\n init = {\n kind: DataPropertyKind,\n key: nanoid(),\n info: Thing.fromName('').toJSON(),\n type: 'string',\n }\n }\n this.new(init)\n }\n\n new(init: IDataProperty): void {\n if (!DataProperty.isDataProperty(init)) {\n throw new Error(`Not a data property.`)\n }\n const {\n info,\n key = nanoid(),\n kind = DataPropertyKind,\n multiple,\n required,\n type = DataPropertyList.string,\n index,\n primary,\n readOnly,\n writeOnly,\n tags,\n taxonomy,\n deprecated,\n schema,\n bindings,\n } = init\n this.kind = kind\n this.key = key\n this.type = type\n if (info) {\n this.info = new Thing(info)\n } else {\n this.info = Thing.fromName('')\n }\n if (typeof multiple === 'boolean') {\n this.multiple = multiple\n } else {\n this.multiple = undefined\n }\n if (typeof required === 'boolean') {\n this.required = required\n } else {\n this.required = undefined\n }\n if (typeof index === 'boolean') {\n this.index = index\n } else {\n this.index = undefined\n }\n if (typeof deprecated === 'boolean') {\n this.deprecated = deprecated\n } else {\n this.deprecated = undefined\n }\n if (typeof primary === 'boolean') {\n this.primary = primary\n } else {\n this.primary = undefined\n }\n if (typeof readOnly === 'boolean') {\n this.readOnly = readOnly\n } else {\n this.readOnly = undefined\n }\n if (typeof writeOnly === 'boolean') {\n this.writeOnly = writeOnly\n } else {\n this.writeOnly = undefined\n }\n if (Array.isArray(tags)) {\n this.tags = [...tags]\n } else {\n this.tags = []\n }\n if (Array.isArray(taxonomy)) {\n this.taxonomy = [...taxonomy]\n } else {\n this.taxonomy = []\n }\n if (schema) {\n this.schema = structuredClone(schema)\n } else {\n this.schema = undefined\n }\n if (Array.isArray(bindings)) {\n this.bindings = bindings.map((i) => structuredClone(i))\n } else {\n this.bindings = []\n }\n }\n\n static isDataProperty(input: unknown): boolean {\n const typed = input as IDataProperty\n if (!input || typed.kind !== DataPropertyKind) {\n return false\n }\n return true\n }\n\n toJSON(): IDataProperty {\n const result: IDataProperty = {\n kind: DataPropertyKind,\n info: this.info.toJSON(),\n key: this.key,\n type: this.type || DataPropertyList.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.taxonomy) && this.taxonomy.length) {\n result.taxonomy = [...this.taxonomy]\n }\n if (this.schema) {\n result.schema = structuredClone(this.schema)\n }\n if (Array.isArray(this.bindings) && this.bindings.length) {\n result.bindings = this.bindings.map((i) => structuredClone(i))\n }\n return result\n }\n\n /**\n * Removes self from the parent entity and the namespace definition.\n */\n remove(): void {\n const { root } = this\n const entity = root.definitions.entities.find((i) => i.properties.some((j) => j.key === this.key))\n if (entity) {\n const assocIndex = entity.properties.findIndex((i) => i.key === this.key)\n entity.properties.splice(assocIndex, 1)\n }\n const defIndex = this.root.definitions.properties.findIndex((i) => i.key === this.key)\n if (defIndex >= 0) {\n this.root.definitions.properties.splice(defIndex, 1)\n }\n }\n\n /**\n * Adds a new tag to the property. It also populates the root namespace's tags when tag is new.\n *\n * Note, it does nothing when the tag is already defined.\n *\n * @param tag The tag to add.\n */\n addTag(tag: string): void {\n if (!tag) {\n return\n }\n const lower = tag.toLowerCase()\n const { tags } = this\n if (tags.some((t) => t.toLowerCase() === lower)) {\n return\n }\n tags.push(tag)\n const { definitions } = this.root\n if (!definitions.tags.some((t) => t.toLowerCase() === lower)) {\n definitions.tags.push(tag)\n }\n }\n\n /**\n * Removes a tag from the property. Unlike the `addTag()` this won't remove a `tag` from the root namespace.\n *\n * @param tag The tag to remove.\n */\n removeTag(tag: string): void {\n if (!tag) {\n return\n }\n const lower = tag.toLowerCase()\n const { tags } = this\n const index = tags.findIndex((t) => t.toLowerCase() === lower)\n if (index >= 0) {\n tags.splice(index, 1)\n }\n }\n\n /**\n * Creates a Property Shape of AMF.\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(): IApiPropertyShape {\n const serializer = new AmfShapeGenerator()\n return serializer.property(this)\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 DataPropertyType {\n if (typeof value !== 'string') {\n return false\n }\n return DataPropertyTypes.includes(value as DataPropertyType)\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 DataPropertyAttribute {\n if (typeof value !== 'string') {\n return false\n }\n return DataPropertyAttributes.includes(value as DataPropertyAttribute)\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 DataPropertyFormat {\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(): DataPropertySchema {\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\n }\n\n /**\n * Returns a parent data entity where this data property exist.\n */\n getParentInstance(): DataEntity | undefined {\n return this.root.definitions.entities.find((e) => e.properties.some((e) => e.key === this.key))\n }\n\n /**\n * Checks whether the property is a child of the given namespace, data model, or an entity.\n * The relationship doesn't have to be direct, as long as the property is in the hierarchy it will return true.\n *\n * @param key The key of the parent to check.\n * @returns True if this data property is a child of the given namespace, data model, or an entity\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"]}
@@ -1,4 +1,5 @@
1
- import type { Graph, GraphJson } from '@api-client/graph';
1
+ import type { GraphJson } from '@api-client/graph/graph/types.js';
2
+ import type { Graph } from '@api-client/graph/graph/Graph.js';
2
3
  import type { DomainAssociation } from './DomainAssociation.js';
3
4
  import type { DomainEntity } from './DomainEntity.js';
4
5
  import type { DomainModel } from './DomainModel.js';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d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AAE,MAAM,CAAA;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,eAAe,CAAC,CAAA;AAClF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modeling/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Graph, GraphJson } from '@api-client/graph'\nimport type { DomainAssociation } from './DomainAssociation.js'\nimport type { DomainEntity } from './DomainEntity.js'\nimport type { DomainModel } from './DomainModel.js'\nimport type { DomainNamespace } from './DomainNamespace.js'\nimport type { DomainProperty } from './DomainProperty.js'\n\nexport interface DataDomainRemoveOptions {\n /**\n * When true, the object will be forcibly removed.\n * The resolution defined in the `ImpactResolution` class will be applied.\n *\n * For example, when removing an entity that is a parent to another entity, it will\n * removed itself as a parent from the child entity.\n *\n * Note, this option should only be used when the DomainImpactAnalysis has been performed\n * and the user was informed of the impact.\n */\n force?: boolean\n}\n\nexport interface AssociationAddOptions {\n /**\n * When set, it is the the association target's origin data domain.\n * The key of the target data domain where this target entity is defined.\n * Only used when `key` is specified.\n */\n domain?: string\n /**\n * The key of the association target, if known.\n * If the target of the association is not specified, and the association has no other targets,\n * the association is ignored in the namespace while processing.\n */\n key?: string\n}\n\nexport interface DomainGraphEdge {\n /**\n * Indicates that the edge is to or from a foreign domain.\n */\n foreign?: boolean\n /**\n * The key of the foreign domain. Always set with the `foreign` property.\n */\n domain?: string\n /**\n * The type of the edge.\n * - `association` The edge is to an association object.\n * - When coming **from** an entiry (the `v` property), that entity owns the association.\n * - When coming **to** an entity (the `w` property), that entity is the target of the association.\n * An association can have multiple targets.\n * - `property` The edge is to a property object. Can only be created between an entity and a property.\n * - The **from** (`v`) is the entity.\n * - The **to** (`w`) is the property.\n * - `parent` The edge is to a parent object.\n * - The **from** (`v`) is the child entity.\n * - The **to** (`w`) is the parent entity.\n */\n type: 'association' | 'property' | 'parent'\n}\n\nexport type DomainGraphNodeType = DomainNamespace | DomainModel | DomainEntity | DomainProperty | DomainAssociation\n\n/**\n * An interface that describes the data domain dependency.\n */\nexport interface ForeignDomainDependency {\n /**\n * The system registered key of the foreign domain.\n */\n key: string\n /**\n * The version of the foreign domain used in this domain.\n */\n version: string\n}\n\nexport interface AssociationTarget {\n /**\n * The key of the target entity.\n */\n key: string\n /**\n * The key of the target data domain.\n * This is only set when the target is in a different data domain.\n */\n domain?: string\n}\n\n/**\n * Describes the default value set on a property schema.\n */\nexport interface SchemaDefaultValue {\n /**\n * The type of the default value.\n *\n * - `literal` The `value` should be used as-is.\n * - `function` The value represents the name of the function to be used.\n */\n type: 'literal' | 'function'\n /**\n * The actual value type depends on the `type`.\n * It is always a string and it has to be casted to the property's data type.\n */\n value: string\n}\n\n/**\n * A general schema definition for a property.\n * This is propagated to all bindings (when they support these properties).\n */\nexport interface PropertySchema {\n /**\n * The minimum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMinimum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n minimum?: number\n /**\n * The maximum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMaximum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n maximum?: number\n /**\n * When set, the minimum value is exclusive.\n *\n * - When `false`: value ≥ minimum.\n * - When `true`: value > minimum.\n */\n exclusiveMinimum?: boolean\n /**\n * When set, the exclusiveMaximum value is exclusive.\n *\n * - When `false`: value ≤ maximum.\n * - When `true`: value < minimum.\n */\n exclusiveMaximum?: boolean\n /**\n * The multiplier value for a number scalar.\n *\n * Examples:\n * - if `1` then every integer is allowed\n * - if `2` than every even number is allowed\n * - if `0.5` than every number dividable by `0.5` is allowed\n */\n multipleOf?: number\n /**\n * The enum values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n enum?: string[]\n /**\n * The default value for the property.\n * This is always encoded as a string. The actual type is defined in the `dataType` property.\n */\n defaultValue?: SchemaDefaultValue\n /**\n * The example values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n examples?: string[]\n}\n\n/**\n * The shortcut type for the data domain graph.\n */\nexport type DataDomainGraph = Graph<unknown, DomainGraphNodeType, DomainGraphEdge>\n/**\n * The serialized version of the data domain graph.\n */\nexport type SerializedGraph = GraphJson<unknown, object, DomainGraphEdge>\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modeling/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GraphJson } from '@api-client/graph/graph/types.js'\nimport type { Graph } from '@api-client/graph/graph/Graph.js'\nimport type { DomainAssociation } from './DomainAssociation.js'\nimport type { DomainEntity } from './DomainEntity.js'\nimport type { DomainModel } from './DomainModel.js'\nimport type { DomainNamespace } from './DomainNamespace.js'\nimport type { DomainProperty } from './DomainProperty.js'\n\nexport interface DataDomainRemoveOptions {\n /**\n * When true, the object will be forcibly removed.\n * The resolution defined in the `ImpactResolution` class will be applied.\n *\n * For example, when removing an entity that is a parent to another entity, it will\n * removed itself as a parent from the child entity.\n *\n * Note, this option should only be used when the DomainImpactAnalysis has been performed\n * and the user was informed of the impact.\n */\n force?: boolean\n}\n\nexport interface AssociationAddOptions {\n /**\n * When set, it is the the association target's origin data domain.\n * The key of the target data domain where this target entity is defined.\n * Only used when `key` is specified.\n */\n domain?: string\n /**\n * The key of the association target, if known.\n * If the target of the association is not specified, and the association has no other targets,\n * the association is ignored in the namespace while processing.\n */\n key?: string\n}\n\nexport interface DomainGraphEdge {\n /**\n * Indicates that the edge is to or from a foreign domain.\n */\n foreign?: boolean\n /**\n * The key of the foreign domain. Always set with the `foreign` property.\n */\n domain?: string\n /**\n * The type of the edge.\n * - `association` The edge is to an association object.\n * - When coming **from** an entiry (the `v` property), that entity owns the association.\n * - When coming **to** an entity (the `w` property), that entity is the target of the association.\n * An association can have multiple targets.\n * - `property` The edge is to a property object. Can only be created between an entity and a property.\n * - The **from** (`v`) is the entity.\n * - The **to** (`w`) is the property.\n * - `parent` The edge is to a parent object.\n * - The **from** (`v`) is the child entity.\n * - The **to** (`w`) is the parent entity.\n */\n type: 'association' | 'property' | 'parent'\n}\n\nexport type DomainGraphNodeType = DomainNamespace | DomainModel | DomainEntity | DomainProperty | DomainAssociation\n\n/**\n * An interface that describes the data domain dependency.\n */\nexport interface ForeignDomainDependency {\n /**\n * The system registered key of the foreign domain.\n */\n key: string\n /**\n * The version of the foreign domain used in this domain.\n */\n version: string\n}\n\nexport interface AssociationTarget {\n /**\n * The key of the target entity.\n */\n key: string\n /**\n * The key of the target data domain.\n * This is only set when the target is in a different data domain.\n */\n domain?: string\n}\n\n/**\n * Describes the default value set on a property schema.\n */\nexport interface SchemaDefaultValue {\n /**\n * The type of the default value.\n *\n * - `literal` The `value` should be used as-is.\n * - `function` The value represents the name of the function to be used.\n */\n type: 'literal' | 'function'\n /**\n * The actual value type depends on the `type`.\n * It is always a string and it has to be casted to the property's data type.\n */\n value: string\n}\n\n/**\n * A general schema definition for a property.\n * This is propagated to all bindings (when they support these properties).\n */\nexport interface PropertySchema {\n /**\n * The minimum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMinimum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n minimum?: number\n /**\n * The maximum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMaximum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n maximum?: number\n /**\n * When set, the minimum value is exclusive.\n *\n * - When `false`: value ≥ minimum.\n * - When `true`: value > minimum.\n */\n exclusiveMinimum?: boolean\n /**\n * When set, the exclusiveMaximum value is exclusive.\n *\n * - When `false`: value ≤ maximum.\n * - When `true`: value < minimum.\n */\n exclusiveMaximum?: boolean\n /**\n * The multiplier value for a number scalar.\n *\n * Examples:\n * - if `1` then every integer is allowed\n * - if `2` than every even number is allowed\n * - if `0.5` than every number dividable by `0.5` is allowed\n */\n multipleOf?: number\n /**\n * The enum values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n enum?: string[]\n /**\n * The default value for the property.\n * This is always encoded as a string. The actual type is defined in the `dataType` property.\n */\n defaultValue?: SchemaDefaultValue\n /**\n * The example values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n examples?: string[]\n}\n\n/**\n * The shortcut type for the data domain graph.\n */\nexport type DataDomainGraph = Graph<unknown, DomainGraphNodeType, DomainGraphEdge>\n/**\n * The serialized version of the data domain graph.\n */\nexport type SerializedGraph = GraphJson<unknown, object, DomainGraphEdge>\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectExecution.d.ts","sourceRoot":"","sources":["../../../src/models/ProjectExecution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,eAAO,MAAM,IAAI,0BAA0B,CAAA;AAE3C,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,UAAU,EAAE,0BAA0B,EAAE,CAAA;CACzC;AAED,MAAM,WAAW,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EAAE,0BAA0B,EAAE,CAAK;gBAEjC,KAAK,CAAC,EAAE,MAAM,GAAG,iBAAiB;IAuB9C,GAAG,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAmClC,MAAM,IAAI,iBAAiB;IAkB3B;;OAEG;IACH,eAAe,IAAI,MAAM;CAK1B"}
@@ -1,4 +1,3 @@
1
- import { Json } from '@api-client/json';
2
1
  export const Kind = 'Core#ProjectExecution';
3
2
  export class ProjectExecution {
4
3
  kind = Kind;
@@ -84,7 +83,7 @@ export class ProjectExecution {
84
83
  const { started = Date.now(), midnight, project, user, key, app, ended = started, iterations, parent } = init;
85
84
  this.started = started;
86
85
  this.ended = ended;
87
- this.iterations = iterations.map((i) => Json.clone(i));
86
+ this.iterations = iterations.map((i) => structuredClone(i));
88
87
  if (key) {
89
88
  this.key = key;
90
89
  }
@@ -128,7 +127,7 @@ export class ProjectExecution {
128
127
  project: this.project,
129
128
  app: this.app,
130
129
  ended: this.ended,
131
- iterations: this.iterations.map((i) => Json.clone(i)),
130
+ iterations: this.iterations.map((i) => structuredClone(i)),
132
131
  started: this.started,
133
132
  };
134
133
  if (this.parent) {
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectExecution.js","sourceRoot":"","sources":["../../../src/models/ProjectExecution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAGvC,MAAM,CAAC,MAAM,IAAI,GAAG,uBAAuB,CAAA;AAuE3C,MAAM,OAAO,gBAAgB;IAC3B,IAAI,GAAgB,IAAI,CAAA;IAExB;;OAEG;IACH,GAAG,GAAG,EAAE,CAAA;IAER;;OAEG;IACH,OAAO,GAAG,EAAE,CAAA;IAEZ;;OAEG;IACH,MAAM,CAAS;IAEf;;OAEG;IACH,GAAG,GAAG,EAAE,CAAA;IAER;;;OAGG;IACH,IAAI,CAAS;IAEb;;OAEG;IACH,IAAI,QAAQ,CAAC,KAAyB;QACpC,IAAI,CAAC,KAAK,EAAE,C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ACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACrD,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAC7B,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;OAEG;IACH,eAAe;QACb,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QACtB,OAAO,CAAC,CAAC,OAAO,EAAE,CAAA;IACpB,CAAC;CACF","sourcesContent":["import { Json } from '@api-client/json'\nimport { IRequestLog } from './RequestLog.js'\n\nexport const Kind = 'Core#ProjectExecution'\n\nexport interface IProjectExecutionIteration {\n /**\n * The index of the iteration.\n */\n index: number\n /**\n * The list of requests executed in the iteration.\n */\n executed: IRequestLog[]\n /**\n * The variables evaluated during the run.\n * These variables have values set by requests' HTTP flows.\n */\n variables: Record<string, string>\n /**\n * Optional general error message.\n */\n error?: string\n}\n\nexport interface IProjectExecutionLog {\n /**\n * The timestamp when the execution started\n */\n started: number\n /**\n * The timestamp when the execution ended\n */\n ended: number\n /**\n * The execution logs for each iteration.\n */\n iterations: IProjectExecutionIteration[]\n}\n\nexport interface IProjectExecution extends IProjectExecutionLog {\n kind: typeof Kind\n /**\n * The key of the execution entry. This is generated by the store. Client value is ignored.\n */\n key: string\n\n /**\n * The key of the parent project.\n */\n project: string\n\n /**\n * The key of the parent folder, if any.\n */\n parent?: string\n\n /**\n * The application id that generated the entry.\n */\n app: string\n\n /**\n * The user id that made that request.\n * This is only available when the store support multi-user environment.\n */\n user?: string\n\n /**\n * A timestamp of the midnight when the object was created.\n */\n midnight: number\n}\n\nexport class ProjectExecution implements IProjectExecution {\n kind: typeof Kind = Kind\n\n /**\n * The key of the execution entry. This is generated by the store. Client value is ignored.\n */\n key = ''\n\n /**\n * The key of the parent project.\n */\n project = ''\n\n /**\n * The key of the parent folder, if any.\n */\n parent?: string\n\n /**\n * The application id that generated the entry.\n */\n app = ''\n\n /**\n * The user id that made that request.\n * This is only available when the store support multi-user environment.\n */\n user?: string\n\n /**\n * @param value The timestamp of the midnight when the request object was updated\n */\n set midnight(value: number | undefined) {\n if (!value) {\n this.midnightInternal = this.defaultMidnight()\n } else {\n this.midnightInternal = value\n }\n }\n\n /**\n * @returns The timestamp of the midnight when the request object was updated\n */\n get midnight(): number {\n if (this.midnightInternal) {\n return this.midnightInternal\n }\n return this.defaultMidnight()\n }\n\n private midnightInternal = 0\n\n /**\n * The timestamp when the execution started\n */\n started = 0\n\n /**\n * The timestamp when the execution ended\n */\n ended = 0\n\n /**\n * The execution logs for each iteration.\n */\n iterations: IProjectExecutionIteration[] = []\n\n constructor(input?: string | IProjectExecution) {\n let init: IProjectExecution\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n } else {\n const now = Date.now()\n init = {\n kind: Kind,\n user: '',\n app: '',\n key: '',\n project: '',\n ended: 0,\n iterations: [],\n midnight: 0,\n started: now,\n }\n }\n this.new(init)\n }\n\n new(init: IProjectExecution): void {\n const { started = Date.now(), midnight, project, user, key, app, ended = started, iterations, parent } = init\n this.started = started\n this.ended = ended\n this.iterations = iterations.map((i) => Json.clone(i))\n if (key) {\n this.key = key\n } else {\n this.key = ''\n }\n if (app) {\n this.app = app\n } else {\n this.app = ''\n }\n if (midnight) {\n this.midnight = midnight\n }\n if (project) {\n this.project = project\n } else {\n this.project = ''\n }\n if (parent) {\n this.parent = parent\n } else {\n this.parent = ''\n }\n if (user) {\n this.user = user\n } else {\n this.user = ''\n }\n }\n\n toJSON(): IProjectExecution {\n const result: IProjectExecution = {\n kind: Kind,\n midnight: this.midnight,\n user: this.user,\n key: this.key,\n project: this.project,\n app: this.app,\n ended: this.ended,\n iterations: this.iterations.map((i) => Json.clone(i)),\n started: this.started,\n }\n if (this.parent) {\n result.parent = this.parent\n }\n return result\n }\n\n /**\n * @returns The default value for the midnight when the request was last updated.\n */\n defaultMidnight(): number {\n const d = new Date(this.started)\n d.setHours(0, 0, 0, 0)\n return d.getTime()\n }\n}\n"]}
1
+ {"version":3,"file":"ProjectExecution.js","sourceRoot":"","sources":["../../../src/models/ProjectExecution.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAG,uBAAuB,CAAA;AAuE3C,MAAM,OAAO,gBAAgB;IAC3B,IAAI,GAAgB,IAAI,CAAA;IAExB;;OAEG;IACH,GAAG,GAAG,EAAE,CAAA;IAER;;OAEG;IACH,OAAO,GAAG,EAAE,CAAA;IAEZ;;OAEG;IACH,MAAM,CAAS;IAEf;;OAEG;IACH,GAAG,GAAG,EAAE,CAAA;IAER;;;OAGG;IACH,IAAI,CAAS;IAEb;;OAEG;IACH,IAAI,QAAQ,CAAC,KAAyB;QACpC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,eAAe,EAAE,CAAA;QAChD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAA;QAC/B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC,gBAAgB,CAAA;QAC9B,CAAC;QACD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AAe,CAAC,CAAC,CAAC,CAAC;YAC1D,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAC7B,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;OAEG;IACH,eAAe;QACb,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QACtB,OAAO,CAAC,CAAC,OAAO,EAAE,CAAA;IACpB,CAAC;CACF","sourcesContent":["import { IRequestLog } from './RequestLog.js'\n\nexport const Kind = 'Core#ProjectExecution'\n\nexport interface IProjectExecutionIteration {\n /**\n * The index of the iteration.\n */\n index: number\n /**\n * The list of requests executed in the iteration.\n */\n executed: IRequestLog[]\n /**\n * The variables evaluated during the run.\n * These variables have values set by requests' HTTP flows.\n */\n variables: Record<string, string>\n /**\n * Optional general error message.\n */\n error?: string\n}\n\nexport interface IProjectExecutionLog {\n /**\n * The timestamp when the execution started\n */\n started: number\n /**\n * The timestamp when the execution ended\n */\n ended: number\n /**\n * The execution logs for each iteration.\n */\n iterations: IProjectExecutionIteration[]\n}\n\nexport interface IProjectExecution extends IProjectExecutionLog {\n kind: typeof Kind\n /**\n * The key of the execution entry. This is generated by the store. Client value is ignored.\n */\n key: string\n\n /**\n * The key of the parent project.\n */\n project: string\n\n /**\n * The key of the parent folder, if any.\n */\n parent?: string\n\n /**\n * The application id that generated the entry.\n */\n app: string\n\n /**\n * The user id that made that request.\n * This is only available when the store support multi-user environment.\n */\n user?: string\n\n /**\n * A timestamp of the midnight when the object was created.\n */\n midnight: number\n}\n\nexport class ProjectExecution implements IProjectExecution {\n kind: typeof Kind = Kind\n\n /**\n * The key of the execution entry. This is generated by the store. Client value is ignored.\n */\n key = ''\n\n /**\n * The key of the parent project.\n */\n project = ''\n\n /**\n * The key of the parent folder, if any.\n */\n parent?: string\n\n /**\n * The application id that generated the entry.\n */\n app = ''\n\n /**\n * The user id that made that request.\n * This is only available when the store support multi-user environment.\n */\n user?: string\n\n /**\n * @param value The timestamp of the midnight when the request object was updated\n */\n set midnight(value: number | undefined) {\n if (!value) {\n this.midnightInternal = this.defaultMidnight()\n } else {\n this.midnightInternal = value\n }\n }\n\n /**\n * @returns The timestamp of the midnight when the request object was updated\n */\n get midnight(): number {\n if (this.midnightInternal) {\n return this.midnightInternal\n }\n return this.defaultMidnight()\n }\n\n private midnightInternal = 0\n\n /**\n * The timestamp when the execution started\n */\n started = 0\n\n /**\n * The timestamp when the execution ended\n */\n ended = 0\n\n /**\n * The execution logs for each iteration.\n */\n iterations: IProjectExecutionIteration[] = []\n\n constructor(input?: string | IProjectExecution) {\n let init: IProjectExecution\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n } else {\n const now = Date.now()\n init = {\n kind: Kind,\n user: '',\n app: '',\n key: '',\n project: '',\n ended: 0,\n iterations: [],\n midnight: 0,\n started: now,\n }\n }\n this.new(init)\n }\n\n new(init: IProjectExecution): void {\n const { started = Date.now(), midnight, project, user, key, app, ended = started, iterations, parent } = init\n this.started = started\n this.ended = ended\n this.iterations = iterations.map((i) => structuredClone(i))\n if (key) {\n this.key = key\n } else {\n this.key = ''\n }\n if (app) {\n this.app = app\n } else {\n this.app = ''\n }\n if (midnight) {\n this.midnight = midnight\n }\n if (project) {\n this.project = project\n } else {\n this.project = ''\n }\n if (parent) {\n this.parent = parent\n } else {\n this.parent = ''\n }\n if (user) {\n this.user = user\n } else {\n this.user = ''\n }\n }\n\n toJSON(): IProjectExecution {\n const result: IProjectExecution = {\n kind: Kind,\n midnight: this.midnight,\n user: this.user,\n key: this.key,\n project: this.project,\n app: this.app,\n ended: this.ended,\n iterations: this.iterations.map((i) => structuredClone(i)),\n started: this.started,\n }\n if (this.parent) {\n result.parent = this.parent\n }\n return result\n }\n\n /**\n * @returns The default value for the midnight when the request was last updated.\n */\n defaultMidnight(): number {\n const d = new Date(this.started)\n d.setHours(0, 0, 0, 0)\n return d.getTime()\n }\n}\n"]}