@api-client/core 0.11.11 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/Testing.md +1 -1
  2. package/bin/plugins/events/EventPlugin.ts +61 -0
  3. package/bin/plugins/events/assert.ts +193 -0
  4. package/bin/plugins/events/types.ts +6 -0
  5. package/bin/test.ts +8 -1
  6. package/build/src/amf/AmfShapeGenerator.d.ts +6 -3
  7. package/build/src/amf/AmfShapeGenerator.d.ts.map +1 -1
  8. package/build/src/amf/AmfShapeGenerator.js +7 -4
  9. package/build/src/amf/AmfShapeGenerator.js.map +1 -1
  10. package/build/src/amf/AmfTypes.d.ts +2 -2
  11. package/build/src/amf/AmfTypes.d.ts.map +1 -1
  12. package/build/src/amf/AmfTypes.js.map +1 -1
  13. package/build/src/amf/DataValueGenerator.d.ts +15 -15
  14. package/build/src/amf/DataValueGenerator.d.ts.map +1 -1
  15. package/build/src/amf/DataValueGenerator.js +17 -16
  16. package/build/src/amf/DataValueGenerator.js.map +1 -1
  17. package/build/src/amf/models/AmfDataNode.d.ts.map +1 -1
  18. package/build/src/amf/models/AmfDataNode.js +2 -2
  19. package/build/src/amf/models/AmfDataNode.js.map +1 -1
  20. package/build/src/browser.d.ts +12 -9
  21. package/build/src/browser.d.ts.map +1 -1
  22. package/build/src/browser.js +11 -8
  23. package/build/src/browser.js.map +1 -1
  24. package/build/src/exceptions/attach_exception.d.ts +11 -0
  25. package/build/src/exceptions/attach_exception.d.ts.map +1 -0
  26. package/build/src/exceptions/attach_exception.js +11 -0
  27. package/build/src/exceptions/attach_exception.js.map +1 -0
  28. package/build/src/exceptions/detach_exception.d.ts +11 -0
  29. package/build/src/exceptions/detach_exception.d.ts.map +1 -0
  30. package/build/src/exceptions/detach_exception.js +11 -0
  31. package/build/src/exceptions/detach_exception.js.map +1 -0
  32. package/build/src/exceptions/remove_model_exception.d.ts +8 -0
  33. package/build/src/exceptions/remove_model_exception.d.ts.map +1 -0
  34. package/build/src/exceptions/remove_model_exception.js +8 -0
  35. package/build/src/exceptions/remove_model_exception.js.map +1 -0
  36. package/build/src/exceptions/remove_namespace_exception.d.ts +8 -0
  37. package/build/src/exceptions/remove_namespace_exception.d.ts.map +1 -0
  38. package/build/src/exceptions/remove_namespace_exception.js +8 -0
  39. package/build/src/exceptions/remove_namespace_exception.js.map +1 -0
  40. package/build/src/index.d.ts +12 -9
  41. package/build/src/index.d.ts.map +1 -1
  42. package/build/src/index.js +11 -8
  43. package/build/src/index.js.map +1 -1
  44. package/build/src/legacy.d.ts +8 -0
  45. package/build/src/legacy.d.ts.map +1 -1
  46. package/build/src/legacy.js +9 -0
  47. package/build/src/legacy.js.map +1 -1
  48. package/build/src/lib/uuid.d.ts +1 -1
  49. package/build/src/lib/uuid.js +1 -1
  50. package/build/src/lib/uuid.js.map +1 -1
  51. package/build/src/mocking/lib/History.js +8 -8
  52. package/build/src/mocking/lib/History.js.map +1 -1
  53. package/build/src/mocking/lib/HostRules.js +1 -1
  54. package/build/src/mocking/lib/HostRules.js.map +1 -1
  55. package/build/src/mocking/lib/User.js +2 -2
  56. package/build/src/mocking/lib/User.js.map +1 -1
  57. package/build/src/modeling/Bindings.d.ts +2 -2
  58. package/build/src/modeling/Bindings.d.ts.map +1 -1
  59. package/build/src/modeling/Bindings.js.map +1 -1
  60. package/build/src/modeling/DataDomain.d.ts +601 -0
  61. package/build/src/modeling/DataDomain.d.ts.map +1 -0
  62. package/build/src/modeling/DataDomain.js +1141 -0
  63. package/build/src/modeling/DataDomain.js.map +1 -0
  64. package/build/src/modeling/DataFormat.d.ts +42 -41
  65. package/build/src/modeling/DataFormat.d.ts.map +1 -1
  66. package/build/src/modeling/DataFormat.js +30 -131
  67. package/build/src/modeling/DataFormat.js.map +1 -1
  68. package/build/src/modeling/DomainAssociation.d.ts +281 -0
  69. package/build/src/modeling/DomainAssociation.d.ts.map +1 -0
  70. package/build/src/modeling/DomainAssociation.js +440 -0
  71. package/build/src/modeling/DomainAssociation.js.map +1 -0
  72. package/build/src/modeling/DomainElement.d.ts +33 -0
  73. package/build/src/modeling/DomainElement.d.ts.map +1 -0
  74. package/build/src/modeling/DomainElement.js +32 -0
  75. package/build/src/modeling/DomainElement.js.map +1 -0
  76. package/build/src/modeling/DomainEntity.d.ts +383 -0
  77. package/build/src/modeling/DomainEntity.d.ts.map +1 -0
  78. package/build/src/modeling/DomainEntity.js +718 -0
  79. package/build/src/modeling/DomainEntity.js.map +1 -0
  80. package/build/src/modeling/DomainFile.d.ts +25 -0
  81. package/build/src/modeling/DomainFile.d.ts.map +1 -0
  82. package/build/src/modeling/DomainFile.js +86 -0
  83. package/build/src/modeling/DomainFile.js.map +1 -0
  84. package/build/src/modeling/DomainImpactAnalysis.d.ts +60 -47
  85. package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
  86. package/build/src/modeling/DomainImpactAnalysis.js +201 -132
  87. package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
  88. package/build/src/modeling/DomainModel.d.ts +226 -0
  89. package/build/src/modeling/DomainModel.d.ts.map +1 -0
  90. package/build/src/modeling/DomainModel.js +401 -0
  91. package/build/src/modeling/DomainModel.js.map +1 -0
  92. package/build/src/modeling/DomainNamespace.d.ts +268 -0
  93. package/build/src/modeling/DomainNamespace.d.ts.map +1 -0
  94. package/build/src/modeling/DomainNamespace.js +512 -0
  95. package/build/src/modeling/DomainNamespace.js.map +1 -0
  96. package/build/src/modeling/DomainProperty.d.ts +281 -0
  97. package/build/src/modeling/DomainProperty.d.ts.map +1 -0
  98. package/build/src/modeling/DomainProperty.js +560 -0
  99. package/build/src/modeling/DomainProperty.js.map +1 -0
  100. package/build/src/modeling/DomainSerialization.d.ts +40 -0
  101. package/build/src/modeling/DomainSerialization.d.ts.map +1 -0
  102. package/build/src/modeling/DomainSerialization.js +288 -0
  103. package/build/src/modeling/DomainSerialization.js.map +1 -0
  104. package/build/src/modeling/DomainVersioning.d.ts +17 -0
  105. package/build/src/modeling/DomainVersioning.d.ts.map +1 -0
  106. package/build/src/modeling/DomainVersioning.js +124 -0
  107. package/build/src/modeling/DomainVersioning.js.map +1 -0
  108. package/build/src/modeling/GraphUtils.d.ts +8 -0
  109. package/build/src/modeling/GraphUtils.d.ts.map +1 -0
  110. package/build/src/modeling/GraphUtils.js +26 -0
  111. package/build/src/modeling/GraphUtils.js.map +1 -0
  112. package/build/src/modeling/amf/ShapeGenerator.d.ts +164 -0
  113. package/build/src/modeling/amf/ShapeGenerator.d.ts.map +1 -0
  114. package/build/src/modeling/amf/ShapeGenerator.js +492 -0
  115. package/build/src/modeling/amf/ShapeGenerator.js.map +1 -0
  116. package/build/src/modeling/{DataAssociation.d.ts → legacy/DataAssociation.d.ts} +10 -5
  117. package/build/src/modeling/legacy/DataAssociation.d.ts.map +1 -0
  118. package/build/src/modeling/{DataAssociation.js → legacy/DataAssociation.js} +11 -8
  119. package/build/src/modeling/legacy/DataAssociation.js.map +1 -0
  120. package/build/src/modeling/{DataEntity.d.ts → legacy/DataEntity.d.ts} +12 -7
  121. package/build/src/modeling/legacy/DataEntity.d.ts.map +1 -0
  122. package/build/src/modeling/{DataEntity.js → legacy/DataEntity.js} +21 -20
  123. package/build/src/modeling/legacy/DataEntity.js.map +1 -0
  124. package/build/src/modeling/{DataEntityBuilder.d.ts → legacy/DataEntityBuilder.d.ts} +3 -2
  125. package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +1 -0
  126. package/build/src/modeling/{DataEntityBuilder.js → legacy/DataEntityBuilder.js} +4 -3
  127. package/build/src/modeling/legacy/DataEntityBuilder.js.map +1 -0
  128. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +298 -0
  129. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +1 -0
  130. package/build/src/modeling/legacy/DataImpactAnalysis.js +441 -0
  131. package/build/src/modeling/legacy/DataImpactAnalysis.js.map +1 -0
  132. package/build/src/modeling/{DataModel.d.ts → legacy/DataModel.d.ts} +6 -4
  133. package/build/src/modeling/legacy/DataModel.d.ts.map +1 -0
  134. package/build/src/modeling/{DataModel.js → legacy/DataModel.js} +9 -8
  135. package/build/src/modeling/legacy/DataModel.js.map +1 -0
  136. package/build/src/modeling/{DataNamespace.d.ts → legacy/DataNamespace.d.ts} +22 -3
  137. package/build/src/modeling/legacy/DataNamespace.d.ts.map +1 -0
  138. package/build/src/modeling/{DataNamespace.js → legacy/DataNamespace.js} +9 -5
  139. package/build/src/modeling/legacy/DataNamespace.js.map +1 -0
  140. package/build/src/modeling/{DataProperty.d.ts → legacy/DataProperty.d.ts} +13 -5
  141. package/build/src/modeling/legacy/DataProperty.d.ts.map +1 -0
  142. package/build/src/modeling/{DataProperty.js → legacy/DataProperty.js} +10 -7
  143. package/build/src/modeling/legacy/DataProperty.js.map +1 -0
  144. package/build/src/modeling/observed.d.ts +67 -0
  145. package/build/src/modeling/observed.d.ts.map +1 -0
  146. package/build/src/modeling/observed.js +230 -0
  147. package/build/src/modeling/observed.js.map +1 -0
  148. package/build/src/modeling/types.d.ts +165 -1
  149. package/build/src/modeling/types.d.ts.map +1 -1
  150. package/build/src/modeling/types.js.map +1 -1
  151. package/build/src/models/AuthorizationData.js +3 -3
  152. package/build/src/models/AuthorizationData.js.map +1 -1
  153. package/build/src/models/CertificateFile.js +2 -2
  154. package/build/src/models/CertificateFile.js.map +1 -1
  155. package/build/src/models/ClientCertificate.js +5 -5
  156. package/build/src/models/ClientCertificate.js.map +1 -1
  157. package/build/src/models/Environment.js +6 -6
  158. package/build/src/models/Environment.js.map +1 -1
  159. package/build/src/models/Folder.js +2 -2
  160. package/build/src/models/Folder.js.map +1 -1
  161. package/build/src/models/HostRule.js +4 -4
  162. package/build/src/models/HostRule.js.map +1 -1
  163. package/build/src/models/HttpProject.js +12 -12
  164. package/build/src/models/HttpProject.js.map +1 -1
  165. package/build/src/models/Project.d.ts.map +1 -1
  166. package/build/src/models/Project.js +2 -2
  167. package/build/src/models/Project.js.map +1 -1
  168. package/build/src/models/ProjectFolder.d.ts.map +1 -1
  169. package/build/src/models/ProjectFolder.js +6 -6
  170. package/build/src/models/ProjectFolder.js.map +1 -1
  171. package/build/src/models/ProjectRequest.d.ts.map +1 -1
  172. package/build/src/models/ProjectRequest.js +8 -8
  173. package/build/src/models/ProjectRequest.js.map +1 -1
  174. package/build/src/models/ProjectSchema.js +6 -6
  175. package/build/src/models/ProjectSchema.js.map +1 -1
  176. package/build/src/models/Thing.d.ts +26 -5
  177. package/build/src/models/Thing.d.ts.map +1 -1
  178. package/build/src/models/Thing.js +193 -91
  179. package/build/src/models/Thing.js.map +1 -1
  180. package/build/src/models/kinds.d.ts +31 -6
  181. package/build/src/models/kinds.d.ts.map +1 -1
  182. package/build/src/models/kinds.js +31 -6
  183. package/build/src/models/kinds.js.map +1 -1
  184. package/build/src/models/store/DataFile.d.ts +3 -1
  185. package/build/src/models/store/DataFile.d.ts.map +1 -1
  186. package/build/src/models/store/DataFile.js +4 -2
  187. package/build/src/models/store/DataFile.js.map +1 -1
  188. package/build/src/models/store/File.d.ts.map +1 -1
  189. package/build/src/models/store/File.js +3 -3
  190. package/build/src/models/store/File.js.map +1 -1
  191. package/build/src/models/store/Organization.js +3 -3
  192. package/build/src/models/store/Organization.js.map +1 -1
  193. package/build/src/models/store/Permission.js +7 -7
  194. package/build/src/models/store/Permission.js.map +1 -1
  195. package/build/src/models/store/UserIdentity.js +3 -3
  196. package/build/src/models/store/UserIdentity.js.map +1 -1
  197. package/build/src/models/transformers/ArcDexieTransformer.js +4 -4
  198. package/build/src/models/transformers/ArcDexieTransformer.js.map +1 -1
  199. package/build/src/models/transformers/ArcLegacyTransformer.js +3 -3
  200. package/build/src/models/transformers/ArcLegacyTransformer.js.map +1 -1
  201. package/build/src/models/transformers/ArcPouchTransformer.js +2 -2
  202. package/build/src/models/transformers/ArcPouchTransformer.js.map +1 -1
  203. package/build/src/models/transformers/PostmanV21Transformer.js +2 -2
  204. package/build/src/models/transformers/PostmanV21Transformer.js.map +1 -1
  205. package/build/src/models/transformers/PostmanV2Transformer.js +2 -2
  206. package/build/src/models/transformers/PostmanV2Transformer.js.map +1 -1
  207. package/build/src/models/types.d.ts +12 -0
  208. package/build/src/models/types.d.ts.map +1 -0
  209. package/build/src/models/types.js +2 -0
  210. package/build/src/models/types.js.map +1 -0
  211. package/build/src/patch/PatchClient.js +2 -2
  212. package/build/src/patch/PatchClient.js.map +1 -1
  213. package/build/src/runtime/store/FilesSdk.d.ts +2 -2
  214. package/build/src/runtime/store/FilesSdk.d.ts.map +1 -1
  215. package/build/src/runtime/store/FilesSdk.js +3 -3
  216. package/build/src/runtime/store/FilesSdk.js.map +1 -1
  217. package/data/models/example-generator-api.json +8 -8
  218. package/package.json +20 -6
  219. package/readme.md +1 -1
  220. package/src/amf/AmfShapeGenerator.ts +10 -7
  221. package/src/amf/AmfTypes.ts +2 -2
  222. package/src/amf/DataValueGenerator.ts +24 -23
  223. package/src/amf/models/AmfDataNode.ts +2 -2
  224. package/src/exceptions/attach_exception.ts +11 -0
  225. package/src/exceptions/detach_exception.ts +11 -0
  226. package/src/exceptions/remove_model_exception.ts +8 -0
  227. package/src/exceptions/remove_namespace_exception.ts +8 -0
  228. package/src/lib/uuid.ts +1 -1
  229. package/src/mocking/lib/History.ts +8 -8
  230. package/src/mocking/lib/HostRules.ts +1 -1
  231. package/src/mocking/lib/User.ts +2 -2
  232. package/src/modeling/Bindings.ts +2 -2
  233. package/src/modeling/DataDomain.ts +1220 -0
  234. package/src/modeling/DataFormat.ts +54 -163
  235. package/src/modeling/DomainAssociation.ts +476 -0
  236. package/src/modeling/DomainElement.ts +50 -0
  237. package/src/modeling/DomainEntity.ts +769 -0
  238. package/src/modeling/DomainFile.ts +94 -0
  239. package/src/modeling/DomainImpactAnalysis.ts +218 -144
  240. package/src/modeling/DomainModel.ts +421 -0
  241. package/src/modeling/DomainNamespace.ts +537 -0
  242. package/src/modeling/DomainProperty.ts +548 -0
  243. package/src/modeling/DomainSerialization.ts +312 -0
  244. package/src/modeling/DomainVersioning.ts +144 -0
  245. package/src/modeling/GraphUtils.ts +28 -0
  246. package/src/modeling/amf/ShapeGenerator.ts +552 -0
  247. package/src/modeling/graph.md +115 -0
  248. package/src/modeling/{DataAssociation.ts → legacy/DataAssociation.ts} +15 -10
  249. package/src/modeling/{DataEntity.ts → legacy/DataEntity.ts} +30 -25
  250. package/src/modeling/{DataEntityBuilder.ts → legacy/DataEntityBuilder.ts} +5 -4
  251. package/src/modeling/legacy/DataImpactAnalysis.ts +530 -0
  252. package/src/modeling/{DataModel.ts → legacy/DataModel.ts} +12 -10
  253. package/src/modeling/{DataNamespace.ts → legacy/DataNamespace.ts} +25 -7
  254. package/src/modeling/{DataProperty.ts → legacy/DataProperty.ts} +17 -9
  255. package/src/modeling/observed.ts +267 -0
  256. package/src/modeling/types.ts +174 -1
  257. package/src/models/AuthorizationData.ts +3 -3
  258. package/src/models/CertificateFile.ts +2 -2
  259. package/src/models/ClientCertificate.ts +5 -5
  260. package/src/models/Environment.ts +6 -6
  261. package/src/models/Folder.ts +2 -2
  262. package/src/models/HostRule.ts +4 -4
  263. package/src/models/HttpProject.ts +12 -12
  264. package/src/models/Project.ts +2 -2
  265. package/src/models/ProjectFolder.ts +6 -6
  266. package/src/models/ProjectRequest.ts +8 -8
  267. package/src/models/ProjectSchema.ts +6 -6
  268. package/src/models/Thing.ts +70 -5
  269. package/src/models/kinds.ts +32 -6
  270. package/src/models/store/DataFile.ts +5 -3
  271. package/src/models/store/File.ts +3 -3
  272. package/src/models/store/Organization.ts +3 -3
  273. package/src/models/store/Permission.ts +7 -7
  274. package/src/models/store/UserIdentity.ts +3 -3
  275. package/src/models/transformers/ArcDexieTransformer.ts +4 -4
  276. package/src/models/transformers/ArcLegacyTransformer.ts +3 -3
  277. package/src/models/transformers/ArcPouchTransformer.ts +2 -2
  278. package/src/models/transformers/PostmanV21Transformer.ts +2 -2
  279. package/src/models/transformers/PostmanV2Transformer.ts +2 -2
  280. package/src/models/types.ts +11 -0
  281. package/src/patch/PatchClient.ts +2 -2
  282. package/src/runtime/store/FilesSdk.ts +5 -5
  283. package/tests/unit/amf/data_value_generator.spec.ts +15 -15
  284. package/tests/unit/legacy-transformers/ARC-legacy-import.spec.ts +1 -1
  285. package/tests/unit/modeling/amf/shape_generator.spec.ts +1174 -0
  286. package/tests/unit/modeling/data_domain.spec.ts +444 -0
  287. package/tests/unit/modeling/data_domain_associations.spec.ts +279 -0
  288. package/tests/unit/modeling/data_domain_change_observers.spec.ts +681 -0
  289. package/tests/unit/modeling/data_domain_entities.spec.ts +449 -0
  290. package/tests/unit/modeling/data_domain_foreign.spec.ts +355 -0
  291. package/tests/unit/modeling/data_domain_models.spec.ts +658 -0
  292. package/tests/unit/modeling/data_domain_namespaces.spec.ts +668 -0
  293. package/tests/unit/modeling/data_domain_property.spec.ts +264 -0
  294. package/tests/unit/modeling/data_domain_serialization.spec.ts +294 -0
  295. package/tests/unit/modeling/domain.property.spec.ts +822 -0
  296. package/tests/unit/modeling/domain_asociation.spec.ts +643 -0
  297. package/tests/unit/modeling/domain_asociation_targets.spec.ts +350 -0
  298. package/tests/unit/modeling/domain_entity.spec.ts +730 -0
  299. package/tests/unit/modeling/domain_entity_associations.spec.ts +330 -0
  300. package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +988 -0
  301. package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +1451 -0
  302. package/tests/unit/modeling/domain_entity_fields.spec.ts +113 -0
  303. package/tests/unit/modeling/domain_entity_generators.spec.ts +20 -0
  304. package/tests/unit/modeling/domain_entity_parents.spec.ts +291 -0
  305. package/tests/unit/modeling/domain_entity_properties.spec.ts +305 -0
  306. package/tests/unit/modeling/{data_file.spec.ts → domain_file.spec.ts} +29 -85
  307. package/tests/unit/modeling/domain_impact_analysis.spec.ts +452 -0
  308. package/tests/unit/modeling/domain_model.spec.ts +568 -0
  309. package/tests/unit/modeling/domain_model_entities.spec.ts +408 -0
  310. package/tests/unit/modeling/domain_namespace.spec.ts +514 -0
  311. package/tests/unit/modeling/domain_namespace_models.spec.ts +324 -0
  312. package/tests/unit/modeling/domain_namespace_namespaces.spec.ts +404 -0
  313. package/tests/unit/modeling/domain_versioning.spec.ts +140 -0
  314. package/tests/unit/{amf → modeling/legacy}/amf_shape_generator.spec.ts +11 -11
  315. package/tests/unit/modeling/{data_association.spec.ts → legacy/data_association.spec.ts} +3 -11
  316. package/tests/unit/modeling/{data_entity.spec.ts → legacy/data_entity.spec.ts} +10 -8
  317. package/tests/unit/modeling/{data_entity_generator_json.spec.ts → legacy/data_entity_generator_json.spec.ts} +1 -1
  318. package/tests/unit/modeling/{data_entity_generator_xml.spec.ts → legacy/data_entity_generator_xml.spec.ts} +1 -1
  319. package/tests/unit/modeling/{data_model.spec.ts → legacy/data_model.spec.ts} +3 -3
  320. package/tests/unit/modeling/{data_namespace.spec.ts → legacy/data_namespace.spec.ts} +3 -10
  321. package/tests/unit/modeling/{data_property.spec.ts → legacy/data_property.spec.ts} +3 -6
  322. package/tests/unit/modeling/{impact_analysis.spec.ts → legacy/impact_analysis.spec.ts} +9 -9
  323. package/tests/unit/models/File/new.spec.ts +1 -1
  324. package/tests/unit/models/HttpProject.spec.ts +3 -3
  325. package/tests/unit/runtime/proxy/HttpProjectProxy.spec.ts +8 -8
  326. package/tsconfig.node.json +35 -0
  327. package/build/src/modeling/DataAssociation.d.ts.map +0 -1
  328. package/build/src/modeling/DataAssociation.js.map +0 -1
  329. package/build/src/modeling/DataEntity.d.ts.map +0 -1
  330. package/build/src/modeling/DataEntity.js.map +0 -1
  331. package/build/src/modeling/DataEntityBuilder.d.ts.map +0 -1
  332. package/build/src/modeling/DataEntityBuilder.js.map +0 -1
  333. package/build/src/modeling/DataModel.d.ts.map +0 -1
  334. package/build/src/modeling/DataModel.js.map +0 -1
  335. package/build/src/modeling/DataNamespace.d.ts.map +0 -1
  336. package/build/src/modeling/DataNamespace.js.map +0 -1
  337. package/build/src/modeling/DataProperty.d.ts.map +0 -1
  338. package/build/src/modeling/DataProperty.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import v4 from '../lib/uuid.js'
1
+ import { nanoid } from 'nanoid'
2
2
 
3
3
  export const Kind = 'Core#HostRule'
4
4
 
@@ -56,7 +56,7 @@ export class HostRule {
56
56
 
57
57
  static fromValues(from: string, to: string): HostRule {
58
58
  const result = new HostRule({
59
- key: v4(),
59
+ key: nanoid(),
60
60
  kind: Kind,
61
61
  from,
62
62
  to,
@@ -76,7 +76,7 @@ export class HostRule {
76
76
  init = input
77
77
  } else {
78
78
  init = {
79
- key: v4(),
79
+ key: nanoid(),
80
80
  kind: Kind,
81
81
  from: '',
82
82
  to: '',
@@ -94,7 +94,7 @@ export class HostRule {
94
94
  if (!HostRule.isHostRule(init)) {
95
95
  throw new Error(`Not a HostRule.`)
96
96
  }
97
- const { from = '', to = '', enabled, comment, key = v4() } = init
97
+ const { from = '', to = '', enabled, comment, key = nanoid() } = init
98
98
  this.kind = Kind
99
99
  this.key = key
100
100
  this.from = from
@@ -12,7 +12,7 @@ import { IProjectFolder, ProjectFolder } from './ProjectFolder.js'
12
12
  import { IProjectRequest, ProjectRequest, Kind as ProjectRequestKind } from './ProjectRequest.js'
13
13
  import { ProjectSchema, IProjectSchema } from './ProjectSchema.js'
14
14
  import { Request } from './Request.js'
15
- import v4 from '../lib/uuid.js'
15
+ import { nanoid } from 'nanoid'
16
16
  import { ARCSavedRequest, ARCHistoryRequest } from './legacy/request/ArcRequest.js'
17
17
  import { ArcLegacyProject, ARCProject } from './legacy/models/ArcLegacyProject.js'
18
18
  import { PostmanDataTransformer } from './transformers/PostmanDataTransformer.js'
@@ -372,7 +372,7 @@ export class HttpProject extends ProjectParent {
372
372
  } else {
373
373
  init = {
374
374
  kind: Kind,
375
- key: v4(),
375
+ key: nanoid(),
376
376
  definitions: {},
377
377
  items: [],
378
378
  info: Thing.fromName('').toJSON(),
@@ -390,7 +390,7 @@ export class HttpProject extends ProjectParent {
390
390
  if (!init || !init.definitions || !init.items) {
391
391
  throw new Error(`Not a project.`)
392
392
  }
393
- const { key = v4(), definitions = {}, items, info, license, provider } = init
393
+ const { key = nanoid(), definitions = {}, items, info, license, provider } = init
394
394
  this.key = key
395
395
  if (license) {
396
396
  this.license = new License(license)
@@ -739,7 +739,7 @@ export class HttpProject extends ProjectParent {
739
739
  finalRequest = new ProjectRequest(this, request)
740
740
  }
741
741
  if (!finalRequest.key) {
742
- finalRequest.key = v4()
742
+ finalRequest.key = nanoid()
743
743
  }
744
744
 
745
745
  let root: ProjectFolder | HttpProject
@@ -1039,7 +1039,7 @@ export class HttpProject extends ProjectParent {
1039
1039
  clone(opts: IProjectCloneOptions = {}): HttpProject {
1040
1040
  const copy = new HttpProject(this.toJSON())
1041
1041
  if (!opts.withoutRevalidate) {
1042
- copy.key = v4()
1042
+ copy.key = nanoid()
1043
1043
  HttpProject.regenerateKeys(copy)
1044
1044
  }
1045
1045
  return copy
@@ -1072,7 +1072,7 @@ export class HttpProject extends ProjectParent {
1072
1072
  if (!indexObject) {
1073
1073
  return
1074
1074
  }
1075
- const newKey = v4()
1075
+ const newKey = nanoid()
1076
1076
  indexObject.key = newKey
1077
1077
  folder.key = newKey
1078
1078
  })
@@ -1082,15 +1082,15 @@ export class HttpProject extends ProjectParent {
1082
1082
  if (!indexObject) {
1083
1083
  return
1084
1084
  }
1085
- const newKey = v4()
1085
+ const newKey = nanoid()
1086
1086
  indexObject.key = newKey
1087
1087
  request.key = newKey
1088
1088
  })
1089
1089
  ;(definitions.schemas || []).forEach((schema) => {
1090
- schema.key = v4()
1090
+ schema.key = nanoid()
1091
1091
  })
1092
1092
  ;(definitions.certificates || []).forEach((cert) => {
1093
- cert.key = v4()
1093
+ cert.key = nanoid()
1094
1094
  })
1095
1095
  ;(definitions.environments || []).forEach((environment) => {
1096
1096
  const oldKey = environment.key
@@ -1098,7 +1098,7 @@ export class HttpProject extends ProjectParent {
1098
1098
  if (!indexObject) {
1099
1099
  return
1100
1100
  }
1101
- const newKey = v4()
1101
+ const newKey = nanoid()
1102
1102
  indexObject.key = newKey
1103
1103
  environment.key = newKey
1104
1104
  })
@@ -1133,7 +1133,7 @@ export class HttpProject extends ProjectParent {
1133
1133
  finalSchema = new ProjectSchema(schema)
1134
1134
  }
1135
1135
  if (!finalSchema.key) {
1136
- finalSchema.key = v4()
1136
+ finalSchema.key = nanoid()
1137
1137
  }
1138
1138
  const { index } = opts
1139
1139
  const hasIndex = typeof index === 'number'
@@ -1328,7 +1328,7 @@ export class HttpProject extends ProjectParent {
1328
1328
  finalEnv = new Environment(env)
1329
1329
  }
1330
1330
  if (!finalEnv.key) {
1331
- finalEnv.key = v4()
1331
+ finalEnv.key = nanoid()
1332
1332
  }
1333
1333
  return finalEnv
1334
1334
  }
@@ -1,7 +1,7 @@
1
+ import { nanoid } from 'nanoid'
1
2
  import { IFile, File } from './store/File.js'
2
3
  import { Thing } from './Thing.js'
3
4
  import { HttpProject, IHttpProject } from './HttpProject.js'
4
- import v4 from '../lib/uuid.js'
5
5
  import { ProjectKind } from './kinds.js'
6
6
 
7
7
  /**
@@ -58,7 +58,7 @@ export class Project extends File {
58
58
  } else {
59
59
  init = {
60
60
  kind: ProjectKind,
61
- key: v4(),
61
+ key: nanoid(),
62
62
  organization: '',
63
63
  info: Thing.fromName('').toJSON(),
64
64
  parents: [],
@@ -1,3 +1,4 @@
1
+ import { nanoid } from 'nanoid'
1
2
  import { ProjectParent } from './ProjectParent.js'
2
3
  import { type IProjectDefinitionProperty } from './ProjectDefinitionProperty.js'
3
4
  import { ProjectItem, type IProjectItem } from './ProjectItem.js'
@@ -6,7 +7,6 @@ import { type HttpProject, type IEnvironmentCreateOptions } from './HttpProject.
6
7
  import { type IThing, Thing } from './Thing.js'
7
8
  import { Environment, type IEnvironment } from './Environment.js'
8
9
  import { ProjectFolderKind } from './kinds.js'
9
- import v4 from '../lib/uuid.js'
10
10
 
11
11
  export const DefaultFolderName = 'New folder'
12
12
 
@@ -110,7 +110,7 @@ export class ProjectFolder extends ProjectParent {
110
110
  created: now,
111
111
  updated: now,
112
112
  items: [],
113
- key: v4(),
113
+ key: nanoid(),
114
114
  }
115
115
  }
116
116
  this.new(init)
@@ -125,7 +125,7 @@ export class ProjectFolder extends ProjectParent {
125
125
  if (!ProjectFolder.isProjectFolder(init)) {
126
126
  throw new Error(`Not a project folder.`)
127
127
  }
128
- const { key = v4(), created = Date.now(), updated = Date.now(), items, info } = init
128
+ const { key = nanoid(), created = Date.now(), updated = Date.now(), items, info } = init
129
129
  this.kind = ProjectFolderKind
130
130
  this.key = key
131
131
  this.created = created
@@ -175,7 +175,7 @@ export class ProjectFolder extends ProjectParent {
175
175
  */
176
176
  static fromName(project: HttpProject, name = DefaultFolderName): ProjectFolder {
177
177
  const now = Date.now()
178
- const key = v4()
178
+ const key = nanoid()
179
179
  const info = Thing.fromName(name)
180
180
  const definition = new ProjectFolder(project, {
181
181
  key,
@@ -350,7 +350,7 @@ export class ProjectFolder extends ProjectParent {
350
350
  clone(opts: IFolderCloneOptions = {}): ProjectFolder {
351
351
  const { targetProject = this.project, targetFolder } = opts
352
352
  const copy = new ProjectFolder(targetProject, this.toJSON())
353
- copy.key = v4()
353
+ copy.key = nanoid()
354
354
 
355
355
  const extProject = targetProject !== this.project
356
356
  if (extProject) {
@@ -428,7 +428,7 @@ export class ProjectFolder extends ProjectParent {
428
428
  return
429
429
  }
430
430
  const copy = new ProjectFolder(folder.getProject(), definition.toJSON())
431
- copy.key = v4()
431
+ copy.key = nanoid()
432
432
  copy.items = []
433
433
  folder.addFolder(copy)
434
434
  if (withRequests) {
@@ -1,8 +1,8 @@
1
+ import { nanoid } from 'nanoid'
1
2
  import { ProjectDefinitionProperty, IProjectDefinitionProperty } from './ProjectDefinitionProperty.js'
2
3
  import { ProjectFolder } from './ProjectFolder.js'
3
4
  import { IHttpRequest, Kind as HttpRequestKind } from './HttpRequest.js'
4
5
  import { HttpProject } from './HttpProject.js'
5
- import v4 from '../lib/uuid.js'
6
6
  import { IRequest, Request } from './Request.js'
7
7
  import { Environment } from './Environment.js'
8
8
  import { Property } from './Property.js'
@@ -109,7 +109,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
109
109
  }
110
110
  const now: number = Date.now()
111
111
  const request = new ProjectRequest(project, {
112
- key: v4(),
112
+ key: nanoid(),
113
113
  kind: Kind,
114
114
  created: now,
115
115
  updated: now,
@@ -136,7 +136,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
136
136
  }
137
137
  const now: number = Date.now()
138
138
  const request = new ProjectRequest(project, {
139
- key: v4(),
139
+ key: nanoid(),
140
140
  kind: Kind,
141
141
  created: now,
142
142
  updated: now,
@@ -163,7 +163,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
163
163
  }
164
164
  const now: number = Date.now()
165
165
  const request = new ProjectRequest(project, {
166
- key: v4(),
166
+ key: nanoid(),
167
167
  kind: Kind,
168
168
  created: now,
169
169
  updated: now,
@@ -183,7 +183,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
183
183
  * Creates a project request for a schema of a Request.
184
184
  */
185
185
  static fromRequest(request: IRequest, project: HttpProject): ProjectRequest {
186
- const key = v4()
186
+ const key = nanoid()
187
187
  const init: IProjectRequest = { ...request, key, kind: Kind }
188
188
  const result = new ProjectRequest(project, init)
189
189
  return result
@@ -200,7 +200,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
200
200
  } else {
201
201
  const now: number = Date.now()
202
202
  init = {
203
- key: v4(),
203
+ key: nanoid(),
204
204
  kind: Kind,
205
205
  created: now,
206
206
  updated: now,
@@ -219,7 +219,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
219
219
  super.new(init)
220
220
 
221
221
  const { key, environment } = init as IProjectRequest
222
- this.key = key || v4()
222
+ this.key = key || nanoid()
223
223
  if (environment) {
224
224
  this.environment = environment
225
225
  }
@@ -282,7 +282,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
282
282
  clone(opts: IRequestCloneOptions = {}): ProjectRequest {
283
283
  const copy = new ProjectRequest(this.project, this.toJSON())
284
284
  if (!opts.withoutRevalidate) {
285
- copy.key = v4()
285
+ copy.key = nanoid()
286
286
  }
287
287
  if (!opts.withoutAttach) {
288
288
  // if the parent is the project then add the request to the project.
@@ -1,4 +1,4 @@
1
- import v4 from '../lib/uuid.js'
1
+ import { nanoid } from 'nanoid'
2
2
  import { Property, IProperty, PropertyType, Kind as PropertyKind } from './Property.js'
3
3
  export const Kind = 'Core#ProjectSchema'
4
4
 
@@ -78,7 +78,7 @@ export class ProjectSchema {
78
78
  const init: IProjectSchema = {
79
79
  kind: Kind,
80
80
  name,
81
- key: v4(),
81
+ key: nanoid(),
82
82
  }
83
83
  return new ProjectSchema(init)
84
84
  }
@@ -94,7 +94,7 @@ export class ProjectSchema {
94
94
  const init: IProjectSchema = {
95
95
  kind: Kind,
96
96
  name,
97
- key: v4(),
97
+ key: nanoid(),
98
98
  content,
99
99
  mime,
100
100
  }
@@ -114,7 +114,7 @@ export class ProjectSchema {
114
114
  init = {
115
115
  kind: Kind,
116
116
  name: '',
117
- key: v4(),
117
+ key: nanoid(),
118
118
  }
119
119
  }
120
120
  this.new(init)
@@ -124,7 +124,7 @@ export class ProjectSchema {
124
124
  * Creates a new schema definition clearing anything that is so far defined.
125
125
  */
126
126
  new(init: IProjectSchema): void {
127
- const { key = v4(), content, properties, mime, name = '' } = init
127
+ const { key = nanoid(), content, properties, mime, name = '' } = init
128
128
  this.name = name
129
129
  this.key = key
130
130
  if (content) {
@@ -148,7 +148,7 @@ export class ProjectSchema {
148
148
  const result: IProjectSchema = {
149
149
  kind: Kind,
150
150
  name: this.name || '',
151
- key: this.key || v4(),
151
+ key: this.key || nanoid(),
152
152
  }
153
153
  if (this.content) {
154
154
  result.content = this.content
@@ -1,4 +1,6 @@
1
1
  import { ThingKind } from './kinds.js'
2
+ import { ModelValidationOptions } from './types.js'
3
+ import { observed } from '../modeling/observed.js'
2
4
 
3
5
  /**
4
6
  * An interface describing a base metadata of a thing.
@@ -28,31 +30,33 @@ export declare interface IThing {
28
30
  version?: string
29
31
  }
30
32
 
31
- export class Thing {
33
+ export class Thing extends EventTarget {
32
34
  kind = ThingKind
33
35
  /**
34
36
  * The name of the thing.
35
37
  */
36
- name?: string
38
+ @observed() accessor name: string | undefined
37
39
  /**
38
40
  * Optional value to overwrite the `name` in the UI.
39
41
  * The primary descriptive field is the `name`. The display name is only used in the presentation of the data.
40
42
  */
41
- displayName?: string
43
+ @observed() accessor displayName: string | undefined
42
44
  /**
43
45
  * The description of the thing.
44
46
  */
45
- description?: string
47
+ @observed() accessor description: string | undefined
46
48
  /**
47
49
  * The version number of the thing.
48
50
  */
49
- version?: string
51
+ @observed() accessor version: string | undefined
50
52
 
51
53
  /**
52
54
  * Returns one in this order:
53
55
  * - displayName
54
56
  * - name
55
57
  * - 'Unnamed object'
58
+ *
59
+ * @deprecated Use `getLabel()` instead.
56
60
  */
57
61
  get renderLabel(): string {
58
62
  return this.displayName || this.name || 'Unnamed object'
@@ -69,10 +73,42 @@ export class Thing {
69
73
  return thing
70
74
  }
71
75
 
76
+ /**
77
+ * Creates a new thing instance.
78
+ *
79
+ * @param input The thing definition used to restore the state.
80
+ */
81
+ static fromJSON(input: Partial<IThing> = {}, defaults: Partial<IThing> = {}): Thing {
82
+ const result = new Thing()
83
+ const { name, displayName, description, version } = input || {}
84
+ if (typeof name === 'string') {
85
+ result.name = name
86
+ } else if (typeof defaults.name === 'string') {
87
+ result.name = defaults.name
88
+ }
89
+ if (typeof displayName === 'string') {
90
+ result.displayName = displayName
91
+ } else if (typeof defaults.displayName === 'string') {
92
+ result.displayName = defaults.displayName
93
+ }
94
+ if (description) {
95
+ result.description = description
96
+ } else if (typeof defaults.description === 'string') {
97
+ result.description = defaults.description
98
+ }
99
+ if (version) {
100
+ result.version = version
101
+ } else if (typeof defaults.version === 'string') {
102
+ result.version = defaults.version
103
+ }
104
+ return result
105
+ }
106
+
72
107
  /**
73
108
  * @param input The thing definition used to restore the state.
74
109
  */
75
110
  constructor(input?: string | IThing) {
111
+ super()
76
112
  let init: IThing
77
113
  if (typeof input === 'string') {
78
114
  init = JSON.parse(input)
@@ -103,6 +139,22 @@ export class Thing {
103
139
  this.version = version
104
140
  }
105
141
 
142
+ notifyChange(): void {
143
+ this.dispatchEvent(new Event('change'))
144
+ }
145
+
146
+ static validate(input: unknown, options: ModelValidationOptions = {}): boolean {
147
+ const { strict } = options
148
+ if (input && typeof input === 'object') {
149
+ const typed = input as IThing
150
+ if (strict && typed.kind !== ThingKind) {
151
+ return false
152
+ }
153
+ return true
154
+ }
155
+ return false
156
+ }
157
+
106
158
  /**
107
159
  * Checks whether the input is a definition of a server.
108
160
  */
@@ -132,4 +184,17 @@ export class Thing {
132
184
  }
133
185
  return result
134
186
  }
187
+
188
+ /**
189
+ * Returns one in this order:
190
+ * - `this.displayName`
191
+ * - `this.name`
192
+ * - `defaultName`
193
+ * - 'Unnamed object'
194
+ *
195
+ * @param defaultName The default name to use when no other is available.
196
+ */
197
+ getLabel(defaultName?: string): string {
198
+ return this.displayName || this.name || defaultName || 'Unnamed object'
199
+ }
135
200
  }
@@ -2,16 +2,42 @@ export const ProjectFolderKind = 'Core#ProjectFolder'
2
2
  export const ResponseKind = 'Core#HttpResponse'
3
3
  export const HttpResponseKind = 'Core#HttpResponse'
4
4
  export const CertificateFileKind = 'Core#CertificateFile'
5
- export const DataNamespaceKind = 'Core#DataNamespace'
6
- export const DataModelKind = 'Core#DataModel'
7
- export const DataEntityKind = 'Core#DataEntity'
8
- export const DataAssociationKind = 'Core#DataAssociation'
9
- export const DataPropertyKind = 'Core#DataProperty'
10
5
  export const FolderKind = 'Core#Folder'
11
6
  export const ProjectKind = 'Core#Project'
12
7
  export const ThingKind = 'Core#Thing'
13
- export const DataFileKind = 'Core#DataFile'
14
8
  export const DeletionKind = 'Core#Deletion'
15
9
  export const RevisionKind = 'Core#Revision'
16
10
  export const UnresolvedDependencyKind = 'Core#UnresolvedDependency'
17
11
  export const UserKind = 'Core#User'
12
+ export const DomainFileKind = 'Data#DomainFile'
13
+ export const DataDomainKind = 'Data#Domain'
14
+ export const DomainNamespaceKind = 'Domain#Namespace'
15
+ export const DomainModelKind = 'Domain#Model'
16
+ export const DomainEntityKind = 'Domain#Entity'
17
+ export const DomainAssociationKind = 'Domain#Association'
18
+ export const DomainPropertyKind = 'Domain#Property'
19
+
20
+ /**
21
+ * @deprecated Not used anymore.
22
+ */
23
+ export const DataFileKind = 'Core#DataFile'
24
+ /**
25
+ * @deprecated Not used anymore.
26
+ */
27
+ export const DataNamespaceKind = 'Data#DataNamespace'
28
+ /**
29
+ * @deprecated Not used anymore.
30
+ */
31
+ export const DataModelKind = 'Data#DataModel'
32
+ /**
33
+ * @deprecated Not used anymore.
34
+ */
35
+ export const DataEntityKind = 'Data#DataEntity'
36
+ /**
37
+ * @deprecated Not used anymore.
38
+ */
39
+ export const DataAssociationKind = 'Data#DataAssociation'
40
+ /**
41
+ * @deprecated Not used anymore.
42
+ */
43
+ export const DataPropertyKind = 'Data#DataProperty'
@@ -1,7 +1,7 @@
1
- import v4 from '../../lib/uuid.js'
1
+ import { nanoid } from 'nanoid'
2
2
  import { File, IFile } from './File.js'
3
3
  import { Thing } from '../Thing.js'
4
- import { DataNamespace, IDataNamespace } from '../../modeling/DataNamespace.js'
4
+ import { DataNamespace, IDataNamespace } from '../../modeling/legacy/DataNamespace.js'
5
5
  import { DataFileKind as Kind } from '../kinds.js'
6
6
 
7
7
  export interface IDataFile extends IFile {
@@ -10,6 +10,7 @@ export interface IDataFile extends IFile {
10
10
 
11
11
  /**
12
12
  * Used by the store. A file definition for the DataNamespace
13
+ * @deprecated Use DomainFile instead.
13
14
  */
14
15
  export class DataFile extends File {
15
16
  override kind = Kind
@@ -19,6 +20,7 @@ export class DataFile extends File {
19
20
  *
20
21
  * @param input The data namespace instance or schema.
21
22
  * @param owner Optional owner to set.
23
+ * @deprecated Use DomainFile instead.
22
24
  */
23
25
  static fromDataNamespace(input: DataNamespace | IDataNamespace, organization: string, owner?: string): DataFile {
24
26
  let final: IDataNamespace
@@ -59,7 +61,7 @@ export class DataFile extends File {
59
61
  } else {
60
62
  init = {
61
63
  kind: Kind,
62
- key: v4(),
64
+ key: nanoid(),
63
65
  organization: '',
64
66
  info: Thing.fromName('').toJSON(),
65
67
  parents: [],
@@ -1,9 +1,9 @@
1
+ import { nanoid } from 'nanoid'
1
2
  import { IPermission, Permission, PermissionRole } from './Permission.js'
2
3
  import { IModification } from './Modification.js'
3
4
  import { IDeletion } from './Deletion.js'
4
5
  import { IUser, Kind as UserKind } from './User.js'
5
6
  import { IThing, Thing } from '../Thing.js'
6
- import v4 from '../../lib/uuid.js'
7
7
  import { ICapabilities } from './Capabilities.js'
8
8
  import { FolderKind } from '../kinds.js'
9
9
  // this causes error
@@ -206,7 +206,7 @@ export class StoredFile {
206
206
  }
207
207
 
208
208
  new(init: IStoredFile): this {
209
- const { key = v4(), info, kind, owner, iconColor, organization, shortcutTarget } = init
209
+ const { key = nanoid(), info, kind, owner, iconColor, organization, shortcutTarget } = init
210
210
  this.key = key
211
211
  this.organization = organization
212
212
  this.kind = kind
@@ -485,7 +485,7 @@ export class File extends StoredFile {
485
485
  * @param owner The user id that is the owner of the file.
486
486
  */
487
487
  static fromName(name: string, organization: string, owner?: string, kind = ''): File {
488
- const key = v4()
488
+ const key = nanoid()
489
489
  const definition = new File()
490
490
  definition.new({
491
491
  key,
@@ -1,4 +1,4 @@
1
- import v4 from '../../lib/uuid.js'
1
+ import { nanoid } from 'nanoid'
2
2
  import type { IDeletion } from './Deletion.js'
3
3
 
4
4
  export const Kind = 'Core#Organization'
@@ -63,7 +63,7 @@ export class Organization implements IOrganization {
63
63
  } else {
64
64
  init = {
65
65
  kind: Kind,
66
- key: v4(),
66
+ key: nanoid(),
67
67
  name: '',
68
68
  createdBy: '',
69
69
  createdDate: Date.now(),
@@ -79,7 +79,7 @@ export class Organization implements IOrganization {
79
79
  throw new Error(`Not an Organization.`)
80
80
  }
81
81
  const {
82
- key = v4(),
82
+ key = nanoid(),
83
83
  name,
84
84
  createdBy,
85
85
  createdDate = Date.now(),
@@ -1,4 +1,4 @@
1
- import v4 from '../../lib/uuid.js'
1
+ import { nanoid } from 'nanoid'
2
2
 
3
3
  export const Kind = 'Core#Permission'
4
4
 
@@ -129,7 +129,7 @@ export class Permission {
129
129
  */
130
130
  static fromUserRole(role: PermissionRole, itemId: string, user: string, addingUser: string): Permission {
131
131
  const init: IPermission = {
132
- key: v4(),
132
+ key: nanoid(),
133
133
  kind: Kind,
134
134
  itemId,
135
135
  granteeId: user,
@@ -150,7 +150,7 @@ export class Permission {
150
150
  */
151
151
  static fromGroupRole(role: PermissionRole, itemId: string, group: string, addingUser: string): Permission {
152
152
  const init: IPermission = {
153
- key: v4(),
153
+ key: nanoid(),
154
154
  kind: Kind,
155
155
  itemId,
156
156
  granteeId: group,
@@ -175,7 +175,7 @@ export class Permission {
175
175
  addingUser: string
176
176
  ): Permission {
177
177
  const init: IPermission = {
178
- key: v4(),
178
+ key: nanoid(),
179
179
  kind: Kind,
180
180
  itemId,
181
181
  granteeId: organizationId,
@@ -192,7 +192,7 @@ export class Permission {
192
192
  static fromValues(init: IBasePermission): Permission {
193
193
  return new Permission({
194
194
  ...init,
195
- key: v4(),
195
+ key: nanoid(),
196
196
  kind: Kind,
197
197
  })
198
198
  }
@@ -206,7 +206,7 @@ export class Permission {
206
206
  } else {
207
207
  init = {
208
208
  kind: Kind,
209
- key: v4(),
209
+ key: nanoid(),
210
210
  granteeId: '',
211
211
  itemId: '',
212
212
  role: 'reader',
@@ -221,7 +221,7 @@ export class Permission {
221
221
  if (!Permission.isPermission(init)) {
222
222
  throw new Error(`Not a permission.`)
223
223
  }
224
- const { key = v4(), granteeId, role, type, displayName, expirationTime, addingUser, itemId } = init
224
+ const { key = nanoid(), granteeId, role, type, displayName, expirationTime, addingUser, itemId } = init
225
225
  this.kind = Kind
226
226
  this.key = key
227
227
  this.granteeId = granteeId
@@ -1,4 +1,4 @@
1
- import v4 from '../../lib/uuid.js'
1
+ import { nanoid } from 'nanoid'
2
2
 
3
3
  export const Kind = 'Core#UserIdentity'
4
4
 
@@ -57,7 +57,7 @@ export class UserIdentity implements IUserIdentity {
57
57
  } else {
58
58
  init = {
59
59
  kind: Kind,
60
- key: v4(),
60
+ key: nanoid(),
61
61
  userId: '',
62
62
  provider: 'google',
63
63
  providerId: '',
@@ -71,7 +71,7 @@ export class UserIdentity implements IUserIdentity {
71
71
  if (!UserIdentity.isUserIdentity(init)) {
72
72
  throw new Error(`Not a UserIdentity.`)
73
73
  }
74
- const { key = v4(), emailVerified, provider, providerId, userId, hostDomain } = init
74
+ const { key = nanoid(), emailVerified, provider, providerId, userId, hostDomain } = init
75
75
  this.kind = Kind
76
76
  this.key = key
77
77
  this.provider = provider