declastruct 1.0.0 → 1.1.0

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 (253) hide show
  1. package/dist/.test/assets/providers/demo.provider.d.ts +32 -0
  2. package/dist/.test/assets/providers/demo.provider.js +101 -0
  3. package/dist/.test/assets/providers/demo.provider.js.map +1 -0
  4. package/dist/contract/cli/apply.d.ts +9 -0
  5. package/dist/contract/cli/apply.integration.test.js +148 -0
  6. package/dist/contract/cli/apply.integration.test.js.map +1 -0
  7. package/dist/contract/cli/apply.js +90 -0
  8. package/dist/contract/cli/apply.js.map +1 -0
  9. package/dist/contract/cli/invoke.d.ts +8 -0
  10. package/dist/contract/cli/invoke.js +58 -0
  11. package/dist/contract/cli/invoke.js.map +1 -0
  12. package/dist/contract/cli/plan.d.ts +10 -0
  13. package/dist/contract/cli/plan.integration.test.js +107 -0
  14. package/dist/contract/cli/plan.integration.test.js.map +1 -0
  15. package/dist/contract/cli/plan.js +94 -0
  16. package/dist/contract/cli/plan.js.map +1 -0
  17. package/dist/contract/sdk/index.d.ts +15 -3
  18. package/dist/contract/sdk/index.js +31 -17
  19. package/dist/contract/sdk/index.js.map +1 -1
  20. package/dist/domain.objects/ContextDeclastruct.d.ts +15 -0
  21. package/dist/{domain/DeclastructContext.js → domain.objects/ContextDeclastruct.js} +1 -1
  22. package/dist/domain.objects/ContextDeclastruct.js.map +1 -0
  23. package/dist/domain.objects/ContextDeclastruct.test.js +41 -0
  24. package/dist/domain.objects/ContextDeclastruct.test.js.map +1 -0
  25. package/dist/domain.objects/DeclastructChange.d.ts +73 -0
  26. package/dist/domain.objects/DeclastructChange.js +35 -0
  27. package/dist/domain.objects/DeclastructChange.js.map +1 -0
  28. package/dist/domain.objects/DeclastructChange.test.js +59 -0
  29. package/dist/domain.objects/DeclastructChange.test.js.map +1 -0
  30. package/dist/domain.objects/DeclastructDao.d.ts +39 -0
  31. package/dist/domain.objects/DeclastructDao.js +8 -0
  32. package/dist/domain.objects/DeclastructDao.js.map +1 -0
  33. package/dist/domain.objects/DeclastructDao.test.js +42 -0
  34. package/dist/domain.objects/DeclastructDao.test.js.map +1 -0
  35. package/dist/domain.objects/DeclastructPlan.d.ts +35 -0
  36. package/dist/domain.objects/DeclastructPlan.js +11 -0
  37. package/dist/domain.objects/DeclastructPlan.js.map +1 -0
  38. package/dist/domain.objects/DeclastructPlan.test.js +31 -0
  39. package/dist/domain.objects/DeclastructPlan.test.js.map +1 -0
  40. package/dist/domain.objects/DeclastructProvider.d.ts +30 -0
  41. package/dist/domain.objects/DeclastructProvider.js +8 -0
  42. package/dist/domain.objects/DeclastructProvider.js.map +1 -0
  43. package/dist/domain.objects/DeclastructProvider.test.js +35 -0
  44. package/dist/domain.objects/DeclastructProvider.test.js.map +1 -0
  45. package/dist/domain.objects/IsoTimestamp.d.ts +6 -0
  46. package/dist/{domain/DeclaredResource.js → domain.objects/IsoTimestamp.js} +1 -1
  47. package/dist/domain.objects/IsoTimestamp.js.map +1 -0
  48. package/dist/domain.objects/IsoTimestamp.test.js +10 -0
  49. package/dist/domain.objects/IsoTimestamp.test.js.map +1 -0
  50. package/dist/domain.operations/apply/applyChange.d.ts +14 -0
  51. package/dist/domain.operations/apply/applyChange.js +64 -0
  52. package/dist/domain.operations/apply/applyChange.js.map +1 -0
  53. package/dist/domain.operations/apply/applyChange.test.d.ts +1 -0
  54. package/dist/domain.operations/apply/applyChange.test.js +247 -0
  55. package/dist/domain.operations/apply/applyChange.test.js.map +1 -0
  56. package/dist/domain.operations/apply/applyChanges.d.ts +18 -0
  57. package/dist/domain.operations/apply/applyChanges.integration.test.d.ts +1 -0
  58. package/dist/domain.operations/apply/applyChanges.integration.test.js +291 -0
  59. package/dist/domain.operations/apply/applyChanges.integration.test.js.map +1 -0
  60. package/dist/domain.operations/apply/applyChanges.js +53 -0
  61. package/dist/domain.operations/apply/applyChanges.js.map +1 -0
  62. package/dist/domain.operations/plan/computeChange.d.ts +11 -0
  63. package/dist/domain.operations/plan/computeChange.js +78 -0
  64. package/dist/domain.operations/plan/computeChange.js.map +1 -0
  65. package/dist/domain.operations/plan/computeChange.test.d.ts +1 -0
  66. package/dist/domain.operations/plan/computeChange.test.js +67 -0
  67. package/dist/domain.operations/plan/computeChange.test.js.map +1 -0
  68. package/dist/domain.operations/plan/extractResourcesFromPlan.d.ts +8 -0
  69. package/dist/domain.operations/plan/extractResourcesFromPlan.js +17 -0
  70. package/dist/domain.operations/plan/extractResourcesFromPlan.js.map +1 -0
  71. package/dist/domain.operations/plan/getDaoByResource.d.ts +12 -0
  72. package/dist/domain.operations/plan/getDaoByResource.js +41 -0
  73. package/dist/domain.operations/plan/getDaoByResource.js.map +1 -0
  74. package/dist/domain.operations/plan/getDaoByResource.test.d.ts +1 -0
  75. package/dist/domain.operations/plan/getDaoByResource.test.js +99 -0
  76. package/dist/domain.operations/plan/getDaoByResource.test.js.map +1 -0
  77. package/dist/domain.operations/plan/hashChanges.d.ts +7 -0
  78. package/dist/domain.operations/plan/hashChanges.js +18 -0
  79. package/dist/domain.operations/plan/hashChanges.js.map +1 -0
  80. package/dist/domain.operations/plan/planChanges.d.ts +15 -0
  81. package/dist/domain.operations/plan/planChanges.integration.test.d.ts +1 -0
  82. package/dist/domain.operations/plan/planChanges.integration.test.js +197 -0
  83. package/dist/domain.operations/plan/planChanges.integration.test.js.map +1 -0
  84. package/dist/domain.operations/plan/planChanges.js +50 -0
  85. package/dist/domain.operations/plan/planChanges.js.map +1 -0
  86. package/dist/domain.operations/plan/validate.d.ts +10 -0
  87. package/dist/domain.operations/plan/validate.js +21 -0
  88. package/dist/domain.operations/plan/validate.js.map +1 -0
  89. package/dist/infra/asIsoTimestamp.d.ts +6 -0
  90. package/dist/infra/asIsoTimestamp.js +12 -0
  91. package/dist/infra/asIsoTimestamp.js.map +1 -0
  92. package/package.json +8 -15
  93. package/readme.md +48 -28
  94. package/dist/__test_assets__/getExampleContext.d.ts +0 -33
  95. package/dist/__test_assets__/getExampleContext.js +0 -87
  96. package/dist/__test_assets__/getExampleContext.js.map +0 -1
  97. package/dist/contract/commands/command.apply.d.ts +0 -6
  98. package/dist/contract/commands/command.apply.js +0 -20
  99. package/dist/contract/commands/command.apply.js.map +0 -1
  100. package/dist/contract/commands/command.plan.d.ts +0 -6
  101. package/dist/contract/commands/command.plan.js +0 -20
  102. package/dist/contract/commands/command.plan.js.map +0 -1
  103. package/dist/contract/commands/utils/resolveCommandInputs.d.ts +0 -17
  104. package/dist/contract/commands/utils/resolveCommandInputs.js +0 -23
  105. package/dist/contract/commands/utils/resolveCommandInputs.js.map +0 -1
  106. package/dist/contract/sdk/refs.d.ts +0 -2
  107. package/dist/contract/sdk/refs.js +0 -19
  108. package/dist/contract/sdk/refs.js.map +0 -1
  109. package/dist/contract/sdk/sync/apply.d.ts +0 -22
  110. package/dist/contract/sdk/sync/apply.js +0 -29
  111. package/dist/contract/sdk/sync/apply.js.map +0 -1
  112. package/dist/contract/sdk/sync/plan.d.ts +0 -22
  113. package/dist/contract/sdk/sync/plan.js +0 -30
  114. package/dist/contract/sdk/sync/plan.js.map +0 -1
  115. package/dist/domain/DeclaredResource.d.ts +0 -2
  116. package/dist/domain/DeclaredResource.js.map +0 -1
  117. package/dist/domain/DeclaredResourceReference.d.ts +0 -66
  118. package/dist/domain/DeclaredResourceReference.js +0 -42
  119. package/dist/domain/DeclaredResourceReference.js.map +0 -1
  120. package/dist/domain/DeclastructChangeProposal.d.ts +0 -61
  121. package/dist/domain/DeclastructChangeProposal.js +0 -37
  122. package/dist/domain/DeclastructChangeProposal.js.map +0 -1
  123. package/dist/domain/DeclastructContext.d.ts +0 -24
  124. package/dist/domain/DeclastructContext.js.map +0 -1
  125. package/dist/domain/DeclastructProvider.d.ts +0 -58
  126. package/dist/domain/DeclastructProvider.js +0 -3
  127. package/dist/domain/DeclastructProvider.js.map +0 -1
  128. package/dist/domain/DeclastructProviderContext.d.ts +0 -30
  129. package/dist/domain/DeclastructProviderContext.js +0 -3
  130. package/dist/domain/DeclastructProviderContext.js.map +0 -1
  131. package/dist/domain/DeclastructProviderResourceRemoteStateInterface.d.ts +0 -156
  132. package/dist/domain/DeclastructProviderResourceRemoteStateInterface.js +0 -3
  133. package/dist/domain/DeclastructProviderResourceRemoteStateInterface.js.map +0 -1
  134. package/dist/index.d.ts +0 -1
  135. package/dist/index.js +0 -18
  136. package/dist/index.js.map +0 -1
  137. package/dist/logic/actions/execute/canUpdateResource.d.ts +0 -5
  138. package/dist/logic/actions/execute/canUpdateResource.js +0 -12
  139. package/dist/logic/actions/execute/canUpdateResource.js.map +0 -1
  140. package/dist/logic/actions/execute/executeProposal.d.ts +0 -5
  141. package/dist/logic/actions/execute/executeProposal.js +0 -52
  142. package/dist/logic/actions/execute/executeProposal.js.map +0 -1
  143. package/dist/logic/actions/propose/getColoredActionToken.d.ts +0 -4
  144. package/dist/logic/actions/propose/getColoredActionToken.js +0 -22
  145. package/dist/logic/actions/propose/getColoredActionToken.js.map +0 -1
  146. package/dist/logic/actions/propose/getColoredProposalTitle.d.ts +0 -4
  147. package/dist/logic/actions/propose/getColoredProposalTitle.js +0 -34
  148. package/dist/logic/actions/propose/getColoredProposalTitle.js.map +0 -1
  149. package/dist/logic/actions/propose/proposeChangeForResource.d.ts +0 -7
  150. package/dist/logic/actions/propose/proposeChangeForResource.js +0 -65
  151. package/dist/logic/actions/propose/proposeChangeForResource.js.map +0 -1
  152. package/dist/logic/actions/propose/proposeChangeForResource.test.js +0 -48
  153. package/dist/logic/actions/propose/proposeChangeForResource.test.js.map +0 -1
  154. package/dist/logic/commands/command.apply.d.ts +0 -8
  155. package/dist/logic/commands/command.apply.js +0 -77
  156. package/dist/logic/commands/command.apply.js.map +0 -1
  157. package/dist/logic/commands/command.plan.d.ts +0 -13
  158. package/dist/logic/commands/command.plan.js +0 -155
  159. package/dist/logic/commands/command.plan.js.map +0 -1
  160. package/dist/logic/commands/execute.d.ts +0 -15
  161. package/dist/logic/commands/execute.js +0 -63
  162. package/dist/logic/commands/execute.js.map +0 -1
  163. package/dist/logic/tools/compare/castReferenceToGrokableString.d.ts +0 -16
  164. package/dist/logic/tools/compare/castReferenceToGrokableString.js +0 -66
  165. package/dist/logic/tools/compare/castReferenceToGrokableString.js.map +0 -1
  166. package/dist/logic/tools/compare/castReferenceToGrokableString.test.js +0 -111
  167. package/dist/logic/tools/compare/castReferenceToGrokableString.test.js.map +0 -1
  168. package/dist/logic/tools/compare/detectDifferenceBetweenDesiredAndRemoteStateOfResource.d.ts +0 -11
  169. package/dist/logic/tools/compare/detectDifferenceBetweenDesiredAndRemoteStateOfResource.js +0 -61
  170. package/dist/logic/tools/compare/detectDifferenceBetweenDesiredAndRemoteStateOfResource.js.map +0 -1
  171. package/dist/logic/tools/compare/detectDifferenceBetweenDesiredAndRemoteStateOfResource.test.js +0 -31
  172. package/dist/logic/tools/compare/detectDifferenceBetweenDesiredAndRemoteStateOfResource.test.js.map +0 -1
  173. package/dist/logic/tools/compare/resolveReferenceToCommonComparableForm.d.ts +0 -21
  174. package/dist/logic/tools/compare/resolveReferenceToCommonComparableForm.js +0 -53
  175. package/dist/logic/tools/compare/resolveReferenceToCommonComparableForm.js.map +0 -1
  176. package/dist/logic/tools/compare/resolveReferenceToCommonComparableForm.test.js +0 -31
  177. package/dist/logic/tools/compare/resolveReferenceToCommonComparableForm.test.js.map +0 -1
  178. package/dist/logic/tools/compare/resolveReferencesToCommonComparableForm.d.ts +0 -10
  179. package/dist/logic/tools/compare/resolveReferencesToCommonComparableForm.js +0 -41
  180. package/dist/logic/tools/compare/resolveReferencesToCommonComparableForm.js.map +0 -1
  181. package/dist/logic/tools/compare/resolveReferencesToCommonComparableForm.test.js +0 -174
  182. package/dist/logic/tools/compare/resolveReferencesToCommonComparableForm.test.js.map +0 -1
  183. package/dist/logic/tools/context/createDeclastructContext.d.ts +0 -10
  184. package/dist/logic/tools/context/createDeclastructContext.js +0 -12
  185. package/dist/logic/tools/context/createDeclastructContext.js.map +0 -1
  186. package/dist/logic/tools/context/destroyDeclastructContext.d.ts +0 -4
  187. package/dist/logic/tools/context/destroyDeclastructContext.js +0 -10
  188. package/dist/logic/tools/context/destroyDeclastructContext.js.map +0 -1
  189. package/dist/logic/tools/provider/castProviderContextToGlobalContext.d.ts +0 -4
  190. package/dist/logic/tools/provider/castProviderContextToGlobalContext.js +0 -10
  191. package/dist/logic/tools/provider/castProviderContextToGlobalContext.js.map +0 -1
  192. package/dist/logic/tools/provider/getProviderContextFromGlobalContextForResourceClass.d.ts +0 -13
  193. package/dist/logic/tools/provider/getProviderContextFromGlobalContextForResourceClass.js +0 -29
  194. package/dist/logic/tools/provider/getProviderContextFromGlobalContextForResourceClass.js.map +0 -1
  195. package/dist/logic/tools/provider/getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource.d.ts +0 -13
  196. package/dist/logic/tools/provider/getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource.js +0 -24
  197. package/dist/logic/tools/provider/getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource.js.map +0 -1
  198. package/dist/logic/tools/provider/getProviderResourceRemoteStateInterfaceFromContextForResourceClass.d.ts +0 -10
  199. package/dist/logic/tools/provider/getProviderResourceRemoteStateInterfaceFromContextForResourceClass.js +0 -21
  200. package/dist/logic/tools/provider/getProviderResourceRemoteStateInterfaceFromContextForResourceClass.js.map +0 -1
  201. package/dist/logic/tools/reference/buildPrimaryKeyTo.d.ts +0 -5
  202. package/dist/logic/tools/reference/buildPrimaryKeyTo.js +0 -40
  203. package/dist/logic/tools/reference/buildPrimaryKeyTo.js.map +0 -1
  204. package/dist/logic/tools/reference/buildReferenceTo.d.ts +0 -28
  205. package/dist/logic/tools/reference/buildReferenceTo.js +0 -92
  206. package/dist/logic/tools/reference/buildReferenceTo.js.map +0 -1
  207. package/dist/logic/tools/reference/buildReferenceTo.test.js +0 -119
  208. package/dist/logic/tools/reference/buildReferenceTo.test.js.map +0 -1
  209. package/dist/logic/tools/reference/buildUniqueKeyTo.d.ts +0 -5
  210. package/dist/logic/tools/reference/buildUniqueKeyTo.js +0 -40
  211. package/dist/logic/tools/reference/buildUniqueKeyTo.js.map +0 -1
  212. package/dist/logic/tools/reference/defineReferenceClassOf.d.ts +0 -5
  213. package/dist/logic/tools/reference/defineReferenceClassOf.js +0 -25
  214. package/dist/logic/tools/reference/defineReferenceClassOf.js.map +0 -1
  215. package/dist/logic/tools/reference/defineReferenceKeyConstituentsOf.d.ts +0 -13
  216. package/dist/logic/tools/reference/defineReferenceKeyConstituentsOf.js +0 -36
  217. package/dist/logic/tools/reference/defineReferenceKeyConstituentsOf.js.map +0 -1
  218. package/dist/logic/tools/reference/getByReference.d.ts +0 -15
  219. package/dist/logic/tools/reference/getByReference.js +0 -55
  220. package/dist/logic/tools/reference/getByReference.js.map +0 -1
  221. package/dist/logic/tools/reference/getByReference.test.js +0 -92
  222. package/dist/logic/tools/reference/getByReference.test.js.map +0 -1
  223. package/dist/logic/tools/reference/getByReferencedPrimaryKey.d.ts +0 -6
  224. package/dist/logic/tools/reference/getByReferencedPrimaryKey.js +0 -17
  225. package/dist/logic/tools/reference/getByReferencedPrimaryKey.js.map +0 -1
  226. package/dist/logic/tools/reference/getByReferencedUniqueKey.d.ts +0 -7
  227. package/dist/logic/tools/reference/getByReferencedUniqueKey.js +0 -42
  228. package/dist/logic/tools/reference/getByReferencedUniqueKey.js.map +0 -1
  229. package/dist/logic/tools/reference/getPrimaryKeyByReference.d.ts +0 -15
  230. package/dist/logic/tools/reference/getPrimaryKeyByReference.js +0 -36
  231. package/dist/logic/tools/reference/getPrimaryKeyByReference.js.map +0 -1
  232. package/dist/logic/tools/reference/getReferenceTo.d.ts +0 -18
  233. package/dist/logic/tools/reference/getReferenceTo.js +0 -55
  234. package/dist/logic/tools/reference/getReferenceTo.js.map +0 -1
  235. package/dist/logic/tools/reference/getReferenceTo.test.js +0 -95
  236. package/dist/logic/tools/reference/getReferenceTo.test.js.map +0 -1
  237. package/dist/logic/tools/reference/getUniqueKeyByReference.d.ts +0 -15
  238. package/dist/logic/tools/reference/getUniqueKeyByReference.js +0 -36
  239. package/dist/logic/tools/reference/getUniqueKeyByReference.js.map +0 -1
  240. package/dist/logic/tools/reference/isPrimaryKeyReference.d.ts +0 -6
  241. package/dist/logic/tools/reference/isPrimaryKeyReference.js +0 -7
  242. package/dist/logic/tools/reference/isPrimaryKeyReference.js.map +0 -1
  243. package/dist/logic/tools/reference/isUniqueKeyReference.d.ts +0 -6
  244. package/dist/logic/tools/reference/isUniqueKeyReference.js +0 -7
  245. package/dist/logic/tools/reference/isUniqueKeyReference.js.map +0 -1
  246. /package/dist/{logic/actions/propose/proposeChangeForResource.test.d.ts → contract/cli/apply.integration.test.d.ts} +0 -0
  247. /package/dist/{logic/tools/compare/castReferenceToGrokableString.test.d.ts → contract/cli/plan.integration.test.d.ts} +0 -0
  248. /package/dist/{logic/tools/compare/detectDifferenceBetweenDesiredAndRemoteStateOfResource.test.d.ts → domain.objects/ContextDeclastruct.test.d.ts} +0 -0
  249. /package/dist/{logic/tools/compare/resolveReferenceToCommonComparableForm.test.d.ts → domain.objects/DeclastructChange.test.d.ts} +0 -0
  250. /package/dist/{logic/tools/compare/resolveReferencesToCommonComparableForm.test.d.ts → domain.objects/DeclastructDao.test.d.ts} +0 -0
  251. /package/dist/{logic/tools/reference/buildReferenceTo.test.d.ts → domain.objects/DeclastructPlan.test.d.ts} +0 -0
  252. /package/dist/{logic/tools/reference/getByReference.test.d.ts → domain.objects/DeclastructProvider.test.d.ts} +0 -0
  253. /package/dist/{logic/tools/reference/getReferenceTo.test.d.ts → domain.objects/IsoTimestamp.test.d.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"detectDifferenceBetweenDesiredAndRemoteStateOfResource.js","sourceRoot":"","sources":["../../../../src/logic/tools/compare/detectDifferenceBetweenDesiredAndRemoteStateOfResource.ts"],"names":[],"mappings":";;;AAAA,uDAA4E;AAC5E,mDAAkE;AAClE,yCAA6C;AAI7C,yFAAsF;AAEtF,mFAAgF;AAEhF;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OAA+C,EAI9C,EAAE;IACH,6EAA6E;IAC7E,MAAM,oBAAoB,GAAG,YAAY;QACvC,CAAC,CAAC,+OAA+O;YAC/O,IAAA,mCAAkB,EAChB,MAAM,uBAAuB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,OAAO,CAAC,CACnE;QACH,CAAC,CAAC,IAAI,CAAC;IACT,MAAM,mBAAmB,GAAG,WAAW;QACrC,CAAC,CAAC,8OAA8O;YAC9O,IAAA,mCAAkB,EAChB,MAAM,uBAAuB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,CAClE;QACH,CAAC,CAAC,IAAI,CAAC;IAET,kCAAkC;IAClC,MAAM,qBAAqB,GAAW,IAAA,gBAAQ,EAC5C,oBAAoB,IAAI,EAAE,EAC1B,mBAAmB,IAAI,EAAE,EACzB;QACE,mBAAmB,EAAE,IAAI;QACzB,WAAW,EAAE,eAAe;QAC5B,WAAW,EAAE,cAAc;QAC3B,UAAU,EAAE,GAAG;QACf,UAAU,EAAE,GAAG;KAChB,CACD,CAAC;IAEH,yNAAyN;IACzN,MAAM,4BAA4B,GAAG,qBAAqB;QACxD,EAAE,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC;SACjC,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAEpC,6BAA6B;IAC7B,MAAM,gBAAgB,GAAG,IAAA,+BAAU,EACjC,mBAAmB,IAAI,EAAE,EACzB,oBAAoB,IAAI,EAAE,CAC3B,CAAC,CAAC,2GAA2G;IAE9G,cAAc;IACd,OAAO;QACL,WAAW,EAAE,4BAA4B;QACzC,MAAM,EAAE,gBAAgB;KACzB,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,sDAAsD,0DA0DjE"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const getExampleContext_1 = require("../../../__test_assets__/getExampleContext");
4
- const detectDifferenceBetweenDesiredAndRemoteStateOfResource_1 = require("./detectDifferenceBetweenDesiredAndRemoteStateOfResource");
5
- const { exampleContext, exampleMachine, CNCMachine } = (0, getExampleContext_1.getExampleContext)();
6
- describe('detectDifferenceBetweenDesiredAndRemoteStateOfResource', () => {
7
- it('should return a helpful displayable difference and usable difference', async () => {
8
- const desiredState = exampleMachine;
9
- const remoteState = new CNCMachine({
10
- ...desiredState,
11
- location: 'moon',
12
- });
13
- const difference = await (0, detectDifferenceBetweenDesiredAndRemoteStateOfResource_1.detectDifferenceBetweenDesiredAndRemoteStateOfResource)({
14
- desiredState,
15
- remoteState,
16
- }, exampleContext);
17
- expect(difference).toMatchSnapshot();
18
- });
19
- it('should show the case where we want to create a new resource well', async () => {
20
- const desiredState = exampleMachine;
21
- const remoteState = null;
22
- const difference = await (0, detectDifferenceBetweenDesiredAndRemoteStateOfResource_1.detectDifferenceBetweenDesiredAndRemoteStateOfResource)({
23
- desiredState,
24
- remoteState,
25
- }, exampleContext);
26
- console.log(difference.displayable);
27
- console.log(difference.usable);
28
- expect(difference).toMatchSnapshot();
29
- });
30
- });
31
- //# sourceMappingURL=detectDifferenceBetweenDesiredAndRemoteStateOfResource.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detectDifferenceBetweenDesiredAndRemoteStateOfResource.test.js","sourceRoot":"","sources":["../../../../src/logic/tools/compare/detectDifferenceBetweenDesiredAndRemoteStateOfResource.test.ts"],"names":[],"mappings":";;AAAA,kFAA+E;AAC/E,qIAAkI;AAElI,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAA,qCAAiB,GAAE,CAAC;AAE3E,QAAQ,CAAC,wDAAwD,EAAE,GAAG,EAAE;IACtE,EAAE,CAAC,sEAAsE,EAAE,KAAK,IAAI,EAAE;QACpF,MAAM,YAAY,GAAG,cAAc,CAAC;QACpC,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC;YACjC,GAAG,YAAY;YACf,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;QACH,MAAM,UAAU,GACd,MAAM,IAAA,+GAAsD,EAC1D;YACE,YAAY;YACZ,WAAW;SACZ,EACD,cAAc,CACf,CAAC;QACJ,MAAM,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,kEAAkE,EAAE,KAAK,IAAI,EAAE;QAChF,MAAM,YAAY,GAAG,cAAc,CAAC;QACpC,MAAM,WAAW,GAAG,IAAI,CAAC;QACzB,MAAM,UAAU,GACd,MAAM,IAAA,+GAAsD,EAC1D;YACE,YAAY;YACZ,WAAW;SACZ,EACD,cAAc,CACf,CAAC;QACJ,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC/B,MAAM,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,21 +0,0 @@
1
- import { VisualogicContext } from 'visualogic';
2
- import { DeclaredResourceReference } from '../../../domain/DeclaredResourceReference';
3
- import { DeclastructContext } from '../../../domain/DeclastructContext';
4
- /**
5
- * resolves a reference to a common form, which any reference can be normalized to, in which it can be compared
6
- * - references can only be compared in fully-expanded unique-key form
7
- * - this function resolves all primary key references into fully-expanded unique-key form
8
- *
9
- * context
10
- * - references to the same resource can be defined by primary-key or unique-key
11
- * - there is no way to determine whether a unique-key reference and a primary-key reference are referring to the same resource
12
- * - the unique-key reference is the only reference form which can be guaranteed to be resolvable
13
- * - a primary-key reference can always be resolved to a unique-key reference (if a resource has a primary key assigned, then it can be looked up by primary key in the remote state)
14
- * - a unique-key reference may not be resolvable into a primary-key reference (the resource may not exist yet, and so there may not exist a primary-key defined for the resource)
15
- * - a unique-key may itself be composed of nested unique keys
16
- * - for example, a `GoogleAdsAdGroup` is unique per `GoogleAdsCampaign` which itself is unique per `GoogleAdsAccount`
17
- * - these nested references must each be resolved
18
- */
19
- export declare const resolveReferenceToCommonComparableForm: <T extends DeclaredResourceReference<any, any, any>>({ reference }: {
20
- reference: T;
21
- }, context: DeclastructContext & VisualogicContext) => Promise<T>;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveReferenceToCommonComparableForm = void 0;
4
- const error_fns_1 = require("@ehmpathy/error-fns");
5
- const error_fns_2 = require("@ehmpathy/error-fns");
6
- const __1 = require("../../..");
7
- const DeclaredResourceReference_1 = require("../../../domain/DeclaredResourceReference");
8
- const getByReference_1 = require("../reference/getByReference");
9
- const resolveReferencesToCommonComparableForm_1 = require("./resolveReferencesToCommonComparableForm");
10
- /**
11
- * resolves a reference to a common form, which any reference can be normalized to, in which it can be compared
12
- * - references can only be compared in fully-expanded unique-key form
13
- * - this function resolves all primary key references into fully-expanded unique-key form
14
- *
15
- * context
16
- * - references to the same resource can be defined by primary-key or unique-key
17
- * - there is no way to determine whether a unique-key reference and a primary-key reference are referring to the same resource
18
- * - the unique-key reference is the only reference form which can be guaranteed to be resolvable
19
- * - a primary-key reference can always be resolved to a unique-key reference (if a resource has a primary key assigned, then it can be looked up by primary key in the remote state)
20
- * - a unique-key reference may not be resolvable into a primary-key reference (the resource may not exist yet, and so there may not exist a primary-key defined for the resource)
21
- * - a unique-key may itself be composed of nested unique keys
22
- * - for example, a `GoogleAdsAdGroup` is unique per `GoogleAdsCampaign` which itself is unique per `GoogleAdsAccount`
23
- * - these nested references must each be resolved
24
- */
25
- const resolveReferenceToCommonComparableForm = async ({ reference }, context) => {
26
- // if this is a unique key reference, resolve any nested references and return that result
27
- if (reference.identifiedBy.key === DeclaredResourceReference_1.DeclaredResourceReferenceKeyType.UNIQUE_KEY) {
28
- const uniqueKeyValueWithNestedReferencesResolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({
29
- in: reference.identifiedBy.value,
30
- }, context);
31
- return new DeclaredResourceReference_1.DeclaredResourceReference({
32
- referenceOf: reference.referenceOf,
33
- identifiedBy: {
34
- key: reference.identifiedBy.key,
35
- value: uniqueKeyValueWithNestedReferencesResolved,
36
- },
37
- });
38
- }
39
- // if this is a primary key reference, lookup the resource and evaluate common form from there
40
- const resource = await (0, getByReference_1.getByReference)({ reference }, context);
41
- if (!resource)
42
- throw new error_fns_2.BadRequestError('could not find resource by primary key reference. can not resolveReferenceToCommonComparableForm', { reference });
43
- const resolvedShallowReference = (0, __1.getReferenceTo)(resource); // get reference to will produce a reference that may be shallow, since it synchronously computes the deepest reference possible from the available data returned by the interface
44
- if (resolvedShallowReference.identifiedBy.key !==
45
- DeclaredResourceReference_1.DeclaredResourceReferenceKeyType.UNIQUE_KEY // sanity check that the resolved resource reference is defined by unique key; that's what it should normalize to since it's the most common form
46
- )
47
- throw new error_fns_1.UnexpectedCodePathError('should have resolved a reference by unique key from resolved resource', { resource, resolvedReference: resolvedShallowReference });
48
- const resolvedReference = await (0, exports.resolveReferenceToCommonComparableForm)({ reference: resolvedShallowReference }, // now resolve the reference into the deep common form
49
- context);
50
- return resolvedReference;
51
- };
52
- exports.resolveReferenceToCommonComparableForm = resolveReferenceToCommonComparableForm;
53
- //# sourceMappingURL=resolveReferenceToCommonComparableForm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveReferenceToCommonComparableForm.js","sourceRoot":"","sources":["../../../../src/logic/tools/compare/resolveReferenceToCommonComparableForm.ts"],"names":[],"mappings":";;;AAAA,mDAA8D;AAC9D,mDAAsD;AAGtD,gCAA0C;AAC1C,yFAGmD;AAEnD,gEAA6D;AAC7D,uGAAoG;AAEpG;;;;;;;;;;;;;;GAcG;AACI,MAAM,sCAAsC,GAAG,KAAK,EAGzD,EAAE,SAAS,EAAoB,EAC/B,OAA+C,EACnC,EAAE;IACd,0FAA0F;IAC1F,IACE,SAAS,CAAC,YAAY,CAAC,GAAG,KAAK,4DAAgC,CAAC,UAAU,EAC1E,CAAC;QACD,MAAM,0CAA0C,GAC9C,MAAM,IAAA,iFAAuC,EAC3C;YACE,EAAE,EAAE,SAAS,CAAC,YAAY,CAAC,KAAK;SACjC,EACD,OAAO,CACR,CAAC;QACJ,OAAO,IAAI,qDAAyB,CAAC;YACnC,WAAW,EAAE,SAAS,CAAC,WAAW;YAClC,YAAY,EAAE;gBACZ,GAAG,EAAE,SAAS,CAAC,YAAY,CAAC,GAAG;gBAC/B,KAAK,EAAE,0CAA0C;aAClD;SACF,CAAM,CAAC;IACV,CAAC;IAED,8FAA8F;IAC9F,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAc,EAAC,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,IAAI,CAAC,QAAQ;QACX,MAAM,IAAI,2BAAe,CACvB,kGAAkG,EAClG,EAAE,SAAS,EAAE,CACd,CAAC;IACJ,MAAM,wBAAwB,GAAG,IAAA,kBAAc,EAAC,QAAQ,CAAC,CAAC,CAAC,kLAAkL;IAC7O,IACE,wBAAwB,CAAC,YAAY,CAAC,GAAG;QACzC,4DAAgC,CAAC,UAAU,CAAC,iJAAiJ;;QAE7L,MAAM,IAAI,mCAAuB,CAC/B,uEAAuE,EACvE,EAAE,QAAQ,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,CAC1D,CAAC;IACJ,MAAM,iBAAiB,GAAG,MAAM,IAAA,8CAAsC,EACpE,EAAE,SAAS,EAAE,wBAAwB,EAAE,EAAE,sDAAsD;IAC/F,OAAO,CACR,CAAC;IACF,OAAO,iBAAsB,CAAC;AAChC,CAAC,CAAC;AA/CW,QAAA,sCAAsC,0CA+CjD"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const __1 = require("../../..");
4
- const getExampleContext_1 = require("../../../__test_assets__/getExampleContext");
5
- const resolveReferenceToCommonComparableForm_1 = require("./resolveReferenceToCommonComparableForm");
6
- const { exampleContext, exampleMachine, CNCMachine } = (0, getExampleContext_1.getExampleContext)();
7
- describe('resolveReferenceToCommonComparableForm', () => {
8
- it('should change nothing on a shallow unique key reference', async () => {
9
- const original = (0, __1.buildRef)(CNCMachine, {
10
- serialNumber: exampleMachine.serialNumber,
11
- });
12
- const resolved = await (0, resolveReferenceToCommonComparableForm_1.resolveReferenceToCommonComparableForm)({
13
- reference: original,
14
- }, exampleContext);
15
- expect(resolved).toEqual(original);
16
- });
17
- it('should resolve unique key reference from primary key reference', async () => {
18
- const original = (0, __1.buildRef)(CNCMachine, {
19
- uuid: exampleMachine.uuid,
20
- });
21
- const expected = (0, __1.buildRef)(CNCMachine, {
22
- serialNumber: exampleMachine.serialNumber,
23
- });
24
- const resolved = await (0, resolveReferenceToCommonComparableForm_1.resolveReferenceToCommonComparableForm)({
25
- reference: original,
26
- }, exampleContext);
27
- expect(resolved).toEqual(expected);
28
- });
29
- it.todo('should resolve a primary key reference nested in a unique key reference to unique key form');
30
- });
31
- //# sourceMappingURL=resolveReferenceToCommonComparableForm.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveReferenceToCommonComparableForm.test.js","sourceRoot":"","sources":["../../../../src/logic/tools/compare/resolveReferenceToCommonComparableForm.test.ts"],"names":[],"mappings":";;AAAA,gCAAoC;AACpC,kFAGoD;AACpD,qGAAkG;AAElG,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAA,qCAAiB,GAAE,CAAC;AAE3E,QAAQ,CAAC,wCAAwC,EAAE,GAAG,EAAE;IACtD,EAAE,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;QACvE,MAAM,QAAQ,GAAwB,IAAA,YAAQ,EAAC,UAAU,EAAE;YACzD,YAAY,EAAE,cAAc,CAAC,YAAY;SAC1C,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAA,+EAAsC,EAC3D;YACE,SAAS,EAAE,QAAQ;SACpB,EACD,cAAc,CACf,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;QAC9E,MAAM,QAAQ,GAAwB,IAAA,YAAQ,EAAC,UAAU,EAAE;YACzD,IAAI,EAAE,cAAc,CAAC,IAAI;SAC1B,CAAC,CAAC;QACH,MAAM,QAAQ,GAAwB,IAAA,YAAQ,EAAC,UAAU,EAAE;YACzD,YAAY,EAAE,cAAc,CAAC,YAAY;SAC1C,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAA,+EAAsC,EAC3D;YACE,SAAS,EAAE,QAAQ;SACpB,EACD,cAAc,CACf,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,IAAI,CACL,4FAA4F,CAC7F,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- import { VisualogicContext } from 'visualogic';
2
- import { DeclastructContext } from '../../../domain/DeclastructContext';
3
- /**
4
- * recursively resolves all references in the given object to their common-comparable-form
5
- *
6
- * see the docs on `resolveReferenceToCommonComparableForm` for more info
7
- */
8
- export declare const resolveReferencesToCommonComparableForm: <T extends unknown>({ in: value }: {
9
- in: T;
10
- }, context: DeclastructContext & VisualogicContext) => Promise<T>;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveReferencesToCommonComparableForm = void 0;
4
- const domain_objects_1 = require("domain-objects");
5
- const DeclaredResourceReference_1 = require("../../../domain/DeclaredResourceReference");
6
- const resolveReferenceToCommonComparableForm_1 = require("./resolveReferenceToCommonComparableForm");
7
- /**
8
- * recursively resolves all references in the given object to their common-comparable-form
9
- *
10
- * see the docs on `resolveReferenceToCommonComparableForm` for more info
11
- */
12
- const resolveReferencesToCommonComparableForm = async ({ in: value }, context) => {
13
- // if this is not an object, then do nothing to it
14
- if (!Array.isArray(value) && typeof value !== 'object')
15
- return value; // if this value is not an array and is not an object, then it's a literal, so no more preparation required, return it itself
16
- if (value === null)
17
- return value; // if its null, return it too (null is typeof 'object' in js :shrug:)
18
- // if its an array, then `resolve references` on each element
19
- if (Array.isArray(value))
20
- return (await Promise.all(value.map((el) => (0, exports.resolveReferencesToCommonComparableForm)({ in: el }, context))));
21
- // if it's a reference, then resolve the reference
22
- if (value instanceof DeclaredResourceReference_1.DeclaredResourceReference)
23
- return await (0, resolveReferenceToCommonComparableForm_1.resolveReferenceToCommonComparableForm)({ reference: value }, context);
24
- // otherwise, it's a generic object, so resolve the references on each key
25
- const object = value;
26
- const resolvedObject = {};
27
- for (const nestedKey of Object.keys(object)) {
28
- const nestedValue = object[nestedKey];
29
- const resolvedValue = await (0, exports.resolveReferencesToCommonComparableForm)({ in: nestedValue }, context);
30
- resolvedObject[nestedKey] = resolvedValue;
31
- }
32
- // if the object was a declared resource, then instantiate it with the same constructor and return that
33
- if (object instanceof domain_objects_1.DomainObject) {
34
- const DomainObjectConstructor = object.constructor;
35
- return new DomainObjectConstructor(resolvedObject);
36
- }
37
- // otherwise, return the resolved object
38
- return resolvedObject;
39
- };
40
- exports.resolveReferencesToCommonComparableForm = resolveReferencesToCommonComparableForm;
41
- //# sourceMappingURL=resolveReferencesToCommonComparableForm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveReferencesToCommonComparableForm.js","sourceRoot":"","sources":["../../../../src/logic/tools/compare/resolveReferencesToCommonComparableForm.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAG9C,yFAAsF;AAEtF,qGAAkG;AAElG;;;;GAIG;AACI,MAAM,uCAAuC,GAAG,KAAK,EAC1D,EAAE,EAAE,EAAE,KAAK,EAAa,EACxB,OAA+C,EACnC,EAAE;IACd,kDAAkD;IAClD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,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require("domain-objects");
4
- const __1 = require("../../..");
5
- const getExampleContext_1 = require("../../../__test_assets__/getExampleContext");
6
- const DeclaredResourceReference_1 = require("../../../domain/DeclaredResourceReference");
7
- const resolveReferencesToCommonComparableForm_1 = require("./resolveReferencesToCommonComparableForm");
8
- const { exampleContext, exampleMachine, CNCMachine, exampleRegistration, CNCMachineRegistration, } = (0, getExampleContext_1.getExampleContext)();
9
- describe('resolveReferencesToCommonComparableForm', () => {
10
- describe('basic types', () => {
11
- it('should resolve strings', async () => {
12
- const original = 'hello!';
13
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
14
- expect(resolved).toEqual(original);
15
- });
16
- it('should resolve numbers', async () => {
17
- const original = 821;
18
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
19
- expect(resolved).toEqual(original);
20
- });
21
- // TODO: fix this
22
- it.skip('should resolve dates', async () => {
23
- const original = new Date('2020-08-21 00:00:00');
24
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
25
- expect(resolved).toEqual(original);
26
- });
27
- it('should resolve undefined', async () => {
28
- const original = undefined;
29
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
30
- expect(resolved).toEqual(original);
31
- });
32
- it('should resolve nulls', async () => {
33
- const original = null;
34
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
35
- expect(resolved).toEqual(original);
36
- });
37
- // TODO: fix this
38
- it.skip('should resolve buffers', async () => {
39
- const original = Buffer.from('821');
40
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
41
- expect(resolved).toEqual(original);
42
- });
43
- });
44
- describe('arrays', () => {
45
- it('should be able to resolve arrays', async () => {
46
- const original = ['821', 721, 'leopard', 7, 'apple', 3];
47
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
48
- expect(resolved).toEqual(original);
49
- });
50
- it('should resolve arrays even if they have objects', async () => {
51
- const original = [
52
- 'banana',
53
- { id: 1, value: 821, meaning: 42 },
54
- 821,
55
- { id: 0, value: undefined, meaning: null }, // should go first, because id is 0
56
- ];
57
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
58
- expect(resolved).toEqual(original);
59
- });
60
- });
61
- describe('objects', () => {
62
- it('should be able to resolve an object with all sorts of types', async () => {
63
- const original = {
64
- color: 'blue',
65
- cost: 821,
66
- orders: [
67
- { id: 1, value: 821, meaning: 42 },
68
- { id: 0, value: undefined, meaning: null },
69
- ],
70
- application: {
71
- type: 'PAINTING',
72
- },
73
- };
74
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
75
- expect(resolved).toEqual(original);
76
- });
77
- });
78
- describe('domain objects', () => {
79
- class Spaceship extends domain_objects_1.DomainEntity {
80
- }
81
- Spaceship.primary = ['uuid'];
82
- Spaceship.unique = ['serialNumber'];
83
- Spaceship.updatable = ['serialNumber'];
84
- class Address extends domain_objects_1.DomainLiteral {
85
- }
86
- class Spaceport extends domain_objects_1.DomainEntity {
87
- }
88
- Spaceport.primary = ['uuid'];
89
- Spaceport.unique = ['uuid'];
90
- Spaceport.updatable = ['spaceships'];
91
- Spaceport.nested = {
92
- address: Address,
93
- spaceships: DeclaredResourceReference_1.DeclaredResourceReference,
94
- };
95
- // run the tests
96
- it('should resolve a domain object with no nested references', async () => {
97
- const ship = new Spaceship({
98
- serialNumber: '__UUID__',
99
- fuelQuantity: 9001,
100
- passengers: 21,
101
- });
102
- const original = ship;
103
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
104
- expect(resolved).toEqual(original);
105
- });
106
- it('should not change nested references already in common form', async () => {
107
- const shipA = new Spaceship({
108
- serialNumber: '__SHIP_A__',
109
- fuelQuantity: 9001,
110
- passengers: 21,
111
- });
112
- const shipB = new Spaceship({
113
- uuid: '821',
114
- serialNumber: '__SHIP_B__',
115
- fuelQuantity: 7000,
116
- passengers: 42,
117
- });
118
- const spaceport = new Spaceport({
119
- uuid: '__SPACEPORT_UUID__',
120
- address: new Address({
121
- galaxy: 'Milky Way',
122
- solarSystem: 'Sun',
123
- planet: 'Earth',
124
- continent: 'North America',
125
- }),
126
- spaceships: [(0, __1.getRef)(shipA), (0, __1.getRef)(shipB)],
127
- });
128
- const original = spaceport;
129
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
130
- expect(resolved).toEqual(original);
131
- });
132
- it('should resolve each nested primary key reference to its common form', async () => {
133
- const primaryKeyRef = (0, __1.buildRef)(CNCMachine, {
134
- uuid: exampleMachine.uuid,
135
- });
136
- const uniqueKeyRef = (0, __1.buildRef)(CNCMachine, {
137
- serialNumber: exampleMachine.serialNumber,
138
- });
139
- const original = {
140
- machine: primaryKeyRef,
141
- };
142
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
143
- expect(resolved).not.toEqual(original);
144
- expect(resolved).toEqual({ machine: uniqueKeyRef }); // should have taken it to common form
145
- });
146
- it('should resolve each nested unique key reference to its common form', async () => {
147
- const uniqueKeyRef = (0, __1.buildRef)(CNCMachine, {
148
- serialNumber: exampleMachine.serialNumber,
149
- });
150
- const original = {
151
- machine: uniqueKeyRef,
152
- };
153
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
154
- expect(resolved).toEqual({ machine: uniqueKeyRef }); // should have taken it to common form
155
- });
156
- it('should resolve a primary key reference to a multi level nested unique key reference common form', async () => {
157
- const primaryKeyRef = (0, __1.buildRef)(CNCMachineRegistration, {
158
- uuid: exampleRegistration.uuid,
159
- });
160
- const uniqueKeyRef = (0, __1.buildRef)(CNCMachineRegistration, {
161
- machine: (0, __1.buildRef)(CNCMachine, {
162
- serialNumber: exampleMachine.serialNumber,
163
- }),
164
- });
165
- const original = {
166
- registration: primaryKeyRef,
167
- };
168
- const resolved = await (0, resolveReferencesToCommonComparableForm_1.resolveReferencesToCommonComparableForm)({ in: original }, exampleContext);
169
- expect(resolved).not.toEqual(original);
170
- expect(resolved).toEqual({ registration: uniqueKeyRef }); // should have taken it to common form});
171
- });
172
- });
173
- });
174
- //# sourceMappingURL=resolveReferencesToCommonComparableForm.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveReferencesToCommonComparableForm.test.js","sourceRoot":"","sources":["../../../../src/logic/tools/compare/resolveReferencesToCommonComparableForm.test.ts"],"names":[],"mappings":";;AAAA,mDAA6D;AAE7D,gCAA4C;AAC5C,kFAIoD;AACpD,yFAAsF;AACtF,uGAAoG;AAEpG,MAAM,EACJ,cAAc,EACd,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,sBAAsB,GACvB,GAAG,IAAA,qCAAiB,GAAE,CAAC;AAExB,QAAQ,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACvD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;YACtC,MAAM,QAAQ,GAAG,QAAQ,CAAC;YAC1B,MAAM,QAAQ,GAAG,MAAM,IAAA,iFAAuC,EAC5D,EAAE,EAAE,EAAE,QAAQ,EAAE,EAChB,cAAc,CACf,CAAC;YACF,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;YACtC,MAAM,QAAQ,GAAG,GAAG,CAAC;YACrB,MAAM,QA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,CACF,CAAC;YACF,MAAM,YAAY,GAAoC,IAAA,YAAQ,EAC5D,sBAAsB,EACtB;gBACE,OAAO,EAAE,IAAA,YAAQ,EAAC,UAAU,EAAE;oBAC5B,YAAY,EAAE,cAAc,CAAC,YAAY;iBAC1C,CAAC;aACH,CACF,CAAC;YACF,MAAM,QAAQ,GAAG;gBACf,YAAY,EAAE,aAAa;aAC5B,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,iFAAuC,EAC5D,EAAE,EAAE,EAAE,QAAQ,EAAE,EAChB,cAAc,CACf,CAAC;YACF,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACvC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,yCAAyC;QACrG,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- import type { LogMethods } from 'simple-leveled-log-methods';
2
- import { VisualogicContext } from 'visualogic';
3
- import { DeclaredResource } from '../../../domain/DeclaredResource';
4
- import { DeclastructContext } from '../../../domain/DeclastructContext';
5
- import { DeclastructProvider } from '../../../domain/DeclastructProvider';
6
- export declare const createDeclastructContext: ({ providers, resources, log, }: {
7
- providers: DeclastructProvider<any>[];
8
- resources: DeclaredResource[];
9
- log: LogMethods;
10
- }) => DeclastructContext & VisualogicContext;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createDeclastructContext = void 0;
4
- const createDeclastructContext = ({ providers, resources, log, }) => {
5
- return {
6
- providers,
7
- resources,
8
- log,
9
- };
10
- };
11
- exports.createDeclastructContext = createDeclastructContext;
12
- //# sourceMappingURL=createDeclastructContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDeclastructContext.js","sourceRoot":"","sources":["../../../../src/logic/tools/context/createDeclastructContext.ts"],"names":[],"mappings":";;;AAOO,MAAM,wBAAwB,GAAG,CAAC,EACvC,SAAS,EACT,SAAS,EACT,GAAG,GAKJ,EAA0C,EAAE;IAC3C,OAAO;QACL,SAAS;QACT,SAAS;QACT,GAAG;KACJ,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,wBAAwB,4BAcnC"}
@@ -1,4 +0,0 @@
1
- import { DeclastructContext } from '../../../domain/DeclastructContext';
2
- export declare const destroyDeclastructContext: ({ context, }: {
3
- context: DeclastructContext;
4
- }) => Promise<void>;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.destroyDeclastructContext = void 0;
4
- const destroyDeclastructContext = async ({ context, }) => {
5
- // run the "afterall" of each provider
6
- await Promise.all(context.providers.map((provider) => provider.hooks.afterAll ? provider.hooks.afterAll() : undefined));
7
- // todo: mark the context as "destroyed" so it wont be used anymore?
8
- };
9
- exports.destroyDeclastructContext = destroyDeclastructContext;
10
- //# sourceMappingURL=destroyDeclastructContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"destroyDeclastructContext.js","sourceRoot":"","sources":["../../../../src/logic/tools/context/destroyDeclastructContext.ts"],"names":[],"mappings":";;;AAEO,MAAM,yBAAyB,GAAG,KAAK,EAAE,EAC9C,OAAO,GAGR,EAAE,EAAE;IACH,sCAAsC;IACtC,MAAM,OAAO,CAAC,GAAG,CACf,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CACjC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAChE,CACF,CAAC;IAEF,oEAAoE;AACtE,CAAC,CAAC;AAbW,QAAA,yBAAyB,6BAapC"}
@@ -1,4 +0,0 @@
1
- import { VisualogicContext } from 'visualogic';
2
- import { DeclastructContext } from '../../../domain/DeclastructContext';
3
- import { DeclastructProviderContext } from '../../../domain/DeclastructProviderContext';
4
- export declare const castProviderContextToGlobalContext: (from: DeclastructProviderContext<any>) => DeclastructContext & VisualogicContext;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.castProviderContextToGlobalContext = void 0;
4
- const castProviderContextToGlobalContext = (from) => ({
5
- providers: [from.provider],
6
- resources: from.resources ?? [],
7
- log: from.log,
8
- });
9
- exports.castProviderContextToGlobalContext = castProviderContextToGlobalContext;
10
- //# sourceMappingURL=castProviderContextToGlobalContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"castProviderContextToGlobalContext.js","sourceRoot":"","sources":["../../../../src/logic/tools/provider/castProviderContextToGlobalContext.ts"],"names":[],"mappings":";;;AAKO,MAAM,kCAAkC,GAAG,CAChD,IAAqC,EACG,EAAE,CAAC,CAAC;IAC5C,SAAS,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC1B,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;IAC/B,GAAG,EAAE,IAAI,CAAC,GAAG;CACd,CAAC,CAAC;AANU,QAAA,kCAAkC,sCAM5C"}
@@ -1,13 +0,0 @@
1
- import { DeclastructContext } from '../../../domain/DeclastructContext';
2
- import { DeclastructProviderAgentOptions } from '../../../domain/DeclastructProvider';
3
- import { DeclastructProviderContext } from '../../../domain/DeclastructProviderContext';
4
- /**
5
- * defines the provider specific context for resources of a specific class, from the full context
6
- *
7
- * relevance
8
- * - we dont share the full declastruct context to providers, due to security, becuase credentials are defined in the full context
9
- * - instead, we only share the the data the user explicitly defined for a particular provider (agentOptions, resources)
10
- */
11
- export declare const getProviderContextFromGlobalContextForResourceClass: <AO extends DeclastructProviderAgentOptions>({ resourceClassName }: {
12
- resourceClassName: string;
13
- }, context: DeclastructContext) => DeclastructProviderContext<AO>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProviderContextFromGlobalContextForResourceClass = void 0;
4
- const error_fns_1 = require("@ehmpathy/error-fns");
5
- /**
6
- * defines the provider specific context for resources of a specific class, from the full context
7
- *
8
- * relevance
9
- * - we dont share the full declastruct context to providers, due to security, becuase credentials are defined in the full context
10
- * - instead, we only share the the data the user explicitly defined for a particular provider (agentOptions, resources)
11
- */
12
- const getProviderContextFromGlobalContextForResourceClass = ({ resourceClassName }, context) => {
13
- // lookup the provider for this resource
14
- const provider = context.providers.find((thisProvider) => resourceClassName in thisProvider.interfaces);
15
- if (!provider)
16
- throw new error_fns_1.UnexpectedCodePathError('could not find provider for resource', {
17
- resourceClassName,
18
- });
19
- // find all of the resources managed by this provider
20
- const resources = context.resources.filter((resource) => resource.constructor.name in provider.interfaces);
21
- // return the context
22
- return {
23
- provider: provider,
24
- resources,
25
- log: context.log,
26
- };
27
- };
28
- exports.getProviderContextFromGlobalContextForResourceClass = getProviderContextFromGlobalContextForResourceClass;
29
- //# sourceMappingURL=getProviderContextFromGlobalContextForResourceClass.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getProviderContextFromGlobalContextForResourceClass.js","sourceRoot":"","sources":["../../../../src/logic/tools/provider/getProviderContextFromGlobalContextForResourceClass.ts"],"names":[],"mappings":";;;AAAA,mDAA8D;AAU9D;;;;;;GAMG;AACI,MAAM,mDAAmD,GAAG,CAGjE,EAAE,iBAAiB,EAAiC,EACpD,OAA2B,EACK,EAAE;IAClC,wCAAwC;IACxC,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CACrC,CAAC,YAAY,EAAE,EAAE,CAAC,iBAAiB,IAAI,YAAY,CAAC,UAAU,CAC/D,CAAC;IACF,IAAI,CAAC,QAAQ;QACX,MAAM,IAAI,mCAAuB,CAAC,sCAAsC,EAAE;YACxE,iBAAiB;SAClB,CAAC,CAAC;IAEL,qDAAqD;IACrD,MAAM,SAAS,GAAuB,OAAO,CAAC,SAAS,CAAC,MAAM,CAC5D,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,CAAC,UAAU,CAC/D,CAAC;IAEF,qBAAqB;IACrB,OAAO;QACL,QAAQ,EAAE,QAAmC;QAC7C,SAAS;QACT,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,mDAAmD,uDA0B9D"}
@@ -1,13 +0,0 @@
1
- import { DomainEntity } from 'domain-objects';
2
- import { DeclastructContext } from '../../../domain/DeclastructContext';
3
- import { DeclastructProviderContext } from '../../../domain/DeclastructProviderContext';
4
- import { DeclastructProviderResourceRemoteStateInterface } from '../../../domain/DeclastructProviderResourceRemoteStateInterface';
5
- /**
6
- * returns everything required to execute operations against the remote-state-interface for a resource
7
- */
8
- export declare const getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource: <R extends DomainEntity<any>>({ resource }: {
9
- resource: R;
10
- }, context: DeclastructContext) => {
11
- remoteStateInterface: DeclastructProviderResourceRemoteStateInterface<R, any, any, any>;
12
- providerContext: DeclastructProviderContext<any>;
13
- };
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource = void 0;
4
- const error_fns_1 = require("@ehmpathy/error-fns");
5
- const domain_objects_1 = require("domain-objects");
6
- const getProviderContextFromGlobalContextForResourceClass_1 = require("./getProviderContextFromGlobalContextForResourceClass");
7
- const getProviderResourceRemoteStateInterfaceFromContextForResourceClass_1 = require("./getProviderResourceRemoteStateInterfaceFromContextForResourceClass");
8
- /**
9
- * returns everything required to execute operations against the remote-state-interface for a resource
10
- */
11
- const getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource = ({ resource }, context) => {
12
- // sanity check that resource is a domain entity (otherwise, it cant be created)
13
- if (!(resource instanceof domain_objects_1.DomainEntity))
14
- throw new error_fns_1.UnexpectedCodePathError('can not createResource on a non DomainEntity object', { resource });
15
- const resourceClassName = resource.constructor.name;
16
- // lookup the interface
17
- const remoteStateInterface = (0, getProviderResourceRemoteStateInterfaceFromContextForResourceClass_1.getProviderResourceRemoteStateInterfaceFromContextForResourceClass)({ resourceClassName }, context);
18
- // lookup the provider context
19
- const providerContext = (0, getProviderContextFromGlobalContextForResourceClass_1.getProviderContextFromGlobalContextForResourceClass)({ resourceClassName }, context);
20
- // return the dependencies
21
- return { remoteStateInterface, providerContext };
22
- };
23
- exports.getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource = getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource;
24
- //# sourceMappingURL=getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource.js","sourceRoot":"","sources":["../../../../src/logic/tools/provider/getProviderResourceRemoteStateInterfaceExecutionDependenciesForResource.ts"],"names":[],"mappings":";;;AAAA,mDAA8D;AAC9D,mDAA8C;AAK9C,+HAA4H;AAC5H,6JAA0J;AAE1J;;GAEG;AACI,MAAM,uEAAuE,GAClF,CACE,EAAE,QAAQ,EAAmB,EAC7B,OAA2B,EAS3B,EAAE;IACF,gFAAgF;IAChF,IAAI,CAAC,CAAC,QAAQ,YAAY,6BAAY,CAAC;QACrC,MAAM,IAAI,mCAAuB,CAC/B,qDAAqD,EACrD,EAAE,QAAQ,EAAE,CACb,CAAC;IACJ,MAAM,iBAAiB,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC;IAEpD,uBAAuB;IACvB,MAAM,oBAAoB,GACxB,IAAA,uIAAkE,EAKhE,EAAE,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAC;IAEpC,8BAA8B;IAC9B,MAAM,eAAe,GAAG,IAAA,yGAAmD,EACzE,EAAE,iBAAiB,EAAE,EACrB,OAAO,CACR,CAAC;IAEF,0BAA0B;IAC1B,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,CAAC;AACnD,CAAC,CAAC;AAtCS,QAAA,uEAAuE,2EAsChF"}
@@ -1,10 +0,0 @@
1
- import { DeclaredResource } from '../../../domain/DeclaredResource';
2
- import { DeclastructContext } from '../../../domain/DeclastructContext';
3
- import { DeclastructProviderAgentOptions } from '../../../domain/DeclastructProvider';
4
- import { DeclastructProviderResourceRemoteStateInterface } from '../../../domain/DeclastructProviderResourceRemoteStateInterface';
5
- /**
6
- * grabs the appropriate interface for managing resources of this class, by resource class name
7
- */
8
- export declare const getProviderResourceRemoteStateInterfaceFromContextForResourceClass: <R extends DeclaredResource, AO extends DeclastructProviderAgentOptions, P extends keyof R, U extends keyof R>({ resourceClassName }: {
9
- resourceClassName: string;
10
- }, context: DeclastructContext) => DeclastructProviderResourceRemoteStateInterface<R, AO, P, U>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProviderResourceRemoteStateInterfaceFromContextForResourceClass = void 0;
4
- const error_fns_1 = require("@ehmpathy/error-fns");
5
- /**
6
- * grabs the appropriate interface for managing resources of this class, by resource class name
7
- */
8
- const getProviderResourceRemoteStateInterfaceFromContextForResourceClass = ({ resourceClassName }, context) => {
9
- // lookup the provider for this resource
10
- const provider = context.providers.find((thisProvider) => resourceClassName in thisProvider.interfaces);
11
- if (!provider)
12
- throw new error_fns_1.UnexpectedCodePathError('could not find provider for resource', {
13
- resourceClassName,
14
- });
15
- // grab the interface
16
- const resourceInterface = provider.interfaces[resourceClassName];
17
- // return it
18
- return resourceInterface;
19
- };
20
- exports.getProviderResourceRemoteStateInterfaceFromContextForResourceClass = getProviderResourceRemoteStateInterfaceFromContextForResourceClass;
21
- //# sourceMappingURL=getProviderResourceRemoteStateInterfaceFromContextForResourceClass.js.map