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,33 +0,0 @@
1
- import { DomainEntity } from 'domain-objects';
2
- import { VisualogicContext } from 'visualogic';
3
- import { DeclaredResourceReference } from '../domain/DeclaredResourceReference';
4
- import { DeclastructContext } from '../domain/DeclastructContext';
5
- interface CNCMachine {
6
- uuid?: string;
7
- serialNumber: string;
8
- size: string;
9
- location: string;
10
- }
11
- declare class CNCMachine extends DomainEntity<CNCMachine> implements CNCMachine {
12
- static primary: readonly ["uuid"];
13
- static unique: string[];
14
- }
15
- export type CNCMachineReference = DeclaredResourceReference<CNCMachine, 'uuid', 'serialNumber'>;
16
- interface CNCMachineRegistration {
17
- uuid?: string;
18
- machine: CNCMachineReference;
19
- registeredBy: string;
20
- }
21
- declare class CNCMachineRegistration extends DomainEntity<CNCMachineRegistration> implements CNCMachineRegistration {
22
- static primary: readonly ["uuid"];
23
- static unique: string[];
24
- }
25
- export type CNCMachineRegistrationReference = DeclaredResourceReference<CNCMachineRegistration, 'uuid', 'machine'>;
26
- export declare const getExampleContext: () => {
27
- exampleContext: DeclastructContext & VisualogicContext;
28
- exampleMachine: Required<CNCMachine>;
29
- CNCMachine: typeof CNCMachine;
30
- exampleRegistration: Required<CNCMachineRegistration>;
31
- CNCMachineRegistration: typeof CNCMachineRegistration;
32
- };
33
- export {};
@@ -1,87 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getExampleContext = void 0;
4
- const domain_objects_1 = require("domain-objects");
5
- const __1 = require("..");
6
- const DeclaredResourceReference_1 = require("../domain/DeclaredResourceReference");
7
- const log = console;
8
- class CNCMachine extends domain_objects_1.DomainEntity {
9
- }
10
- CNCMachine.primary = ['uuid'];
11
- CNCMachine.unique = ['serialNumber'];
12
- class CNCMachineRegistration extends domain_objects_1.DomainEntity {
13
- }
14
- CNCMachineRegistration.primary = ['uuid'];
15
- CNCMachineRegistration.unique = ['machine'];
16
- const exampleMachine = new CNCMachine({
17
- uuid: 'de0e34ca-ce61-4884-ace5-093a1a32ff92',
18
- serialNumber: '821',
19
- size: 'big',
20
- location: 'basement',
21
- });
22
- const exampleRegistration = new CNCMachineRegistration({
23
- uuid: '9857cc32-8bcf-4291-8850-aef94c2081f9',
24
- machine: (0, __1.getRef)(exampleMachine),
25
- registeredBy: 'bob',
26
- });
27
- const cncMachineRemoteStateInterface = {
28
- for: CNCMachine.name,
29
- findByPrimary: async ({ uuid }) => {
30
- if (uuid === exampleMachine.uuid)
31
- return exampleMachine;
32
- return null;
33
- },
34
- findByUnique: async ({ serialNumber }) => {
35
- if (serialNumber === exampleMachine.serialNumber)
36
- return exampleMachine;
37
- return null;
38
- },
39
- create: () => Promise.reject(new Error('todo')),
40
- update: () => Promise.reject(new Error('todo')),
41
- destroy: () => Promise.reject(new Error('todo')),
42
- };
43
- const cncMachineRegistrationRemoteStateInterface = {
44
- for: CNCMachineRegistration.name,
45
- findByPrimary: async ({ uuid }) => {
46
- if (uuid === exampleRegistration.uuid)
47
- return exampleRegistration;
48
- return null;
49
- },
50
- findByUnique: async ({ machine: machineRef }) => {
51
- if (machineRef.identifiedBy.key ===
52
- DeclaredResourceReference_1.DeclaredResourceReferenceKeyType.PRIMARY_KEY &&
53
- machineRef.identifiedBy.value.uuid === exampleMachine.uuid)
54
- return exampleRegistration;
55
- if (machineRef.identifiedBy.key ===
56
- DeclaredResourceReference_1.DeclaredResourceReferenceKeyType.UNIQUE_KEY &&
57
- machineRef.identifiedBy.value.serialNumber === exampleMachine.serialNumber)
58
- return exampleRegistration;
59
- return null;
60
- },
61
- create: () => Promise.reject(new Error('todo')),
62
- destroy: () => Promise.reject(new Error('todo')),
63
- };
64
- const exampleContext = {
65
- log,
66
- providers: [
67
- {
68
- agentOptions: {},
69
- interfaces: {
70
- [cncMachineRemoteStateInterface.for]: cncMachineRemoteStateInterface,
71
- [cncMachineRegistrationRemoteStateInterface.for]: cncMachineRegistrationRemoteStateInterface,
72
- }, // TODO: fix types to make this assertion not needed
73
- hooks: {},
74
- },
75
- ],
76
- resources: [], // no resources needed in context for this test
77
- };
78
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
79
- const getExampleContext = () => ({
80
- exampleContext,
81
- exampleMachine,
82
- CNCMachine,
83
- exampleRegistration,
84
- CNCMachineRegistration,
85
- });
86
- exports.getExampleContext = getExampleContext;
87
- //# sourceMappingURL=getExampleContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getExampleContext.js","sourceRoot":"","sources":["../../src/__test_assets__/getExampleContext.ts"],"names":[],"mappings":"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"}
@@ -1,6 +0,0 @@
1
- import { VisualogicContext } from 'visualogic';
2
- import { DeclastructCommandInput } from './utils/resolveCommandInputs';
3
- /**
4
- * applies the planned actions required to update the remote state to match the declared state
5
- */
6
- export declare const apply: (input: DeclastructCommandInput, context: VisualogicContext) => Promise<void>;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apply = void 0;
4
- const execute_1 = require("../../logic/commands/execute");
5
- const resolveCommandInputs_1 = require("./utils/resolveCommandInputs");
6
- /**
7
- * applies the planned actions required to update the remote state to match the declared state
8
- */
9
- const apply = async (input, context) => {
10
- // resolve the inputs
11
- const { resources, providers } = await (0, resolveCommandInputs_1.resolveCommandInputs)({ input });
12
- // execute the command
13
- await (0, execute_1.executeCommand)({
14
- option: execute_1.DeclastructCommandOption.APPLY,
15
- resources,
16
- providers,
17
- }, context);
18
- };
19
- exports.apply = apply;
20
- //# sourceMappingURL=command.apply.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command.apply.js","sourceRoot":"","sources":["../../../src/contract/commands/command.apply.ts"],"names":[],"mappings":";;;AAEA,0DAGsC;AACtC,uEAGsC;AAEtC;;GAEG;AACI,MAAM,KAAK,GAAG,KAAK,EACxB,KAA8B,EAC9B,OAA0B,EACX,EAAE;IACjB,qBAAqB;IACrB,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,2CAAoB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAEvE,sBAAsB;IACtB,MAAM,IAAA,wBAAc,EAClB;QACE,MAAM,EAAE,kCAAwB,CAAC,KAAK;QACtC,SAAS;QACT,SAAS;KACV,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,KAAK,SAgBhB"}
@@ -1,6 +0,0 @@
1
- import { VisualogicContext } from 'visualogic';
2
- import { DeclastructCommandInput } from './utils/resolveCommandInputs';
3
- /**
4
- * applies the planned actions required to update the remote state to match the declared state
5
- */
6
- export declare const plan: (input: DeclastructCommandInput, context: VisualogicContext) => Promise<void>;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.plan = void 0;
4
- const execute_1 = require("../../logic/commands/execute");
5
- const resolveCommandInputs_1 = require("./utils/resolveCommandInputs");
6
- /**
7
- * applies the planned actions required to update the remote state to match the declared state
8
- */
9
- const plan = async (input, context) => {
10
- // resolve the inputs
11
- const { resources, providers } = await (0, resolveCommandInputs_1.resolveCommandInputs)({ input });
12
- // execute the command
13
- await (0, execute_1.executeCommand)({
14
- option: execute_1.DeclastructCommandOption.PLAN,
15
- resources,
16
- providers,
17
- }, context);
18
- };
19
- exports.plan = plan;
20
- //# sourceMappingURL=command.plan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command.plan.js","sourceRoot":"","sources":["../../../src/contract/commands/command.plan.ts"],"names":[],"mappings":";;;AAEA,0DAGsC;AACtC,uEAGsC;AAEtC;;GAEG;AACI,MAAM,IAAI,GAAG,KAAK,EACvB,KAA8B,EAC9B,OAA0B,EACX,EAAE;IACjB,qBAAqB;IACrB,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,2CAAoB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAEvE,sBAAsB;IACtB,MAAM,IAAA,wBAAc,EAClB;QACE,MAAM,EAAE,kCAAwB,CAAC,IAAI;QACrC,SAAS;QACT,SAAS;KACV,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,IAAI,QAgBf"}
@@ -1,17 +0,0 @@
1
- import { DeclaredResource } from '../../../domain/DeclaredResource';
2
- import { DeclastructProvider } from '../../../domain/DeclastructProvider';
3
- export interface DeclastructCommandInput {
4
- resources: DeclaredResource[] | (() => Promise<DeclaredResource[]>);
5
- providers: DeclastructProvider<any>[] | (() => Promise<DeclastructProvider<any>[]>);
6
- }
7
- /**
8
- * a utility method for resolving the command inputs from user definition
9
- * - we allow users to specify the inputs directly or from a function that promises the inputs
10
- * - this method awaits the inputs if needed
11
- */
12
- export declare const resolveCommandInputs: ({ input, }: {
13
- input: DeclastructCommandInput;
14
- }) => Promise<{
15
- resources: DeclaredResource[];
16
- providers: DeclastructProvider<any>[];
17
- }>;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveCommandInputs = void 0;
4
- const type_fns_1 = require("type-fns");
5
- /**
6
- * a utility method for resolving the command inputs from user definition
7
- * - we allow users to specify the inputs directly or from a function that promises the inputs
8
- * - this method awaits the inputs if needed
9
- */
10
- const resolveCommandInputs = async ({ input, }) => {
11
- const resources = (0, type_fns_1.isAFunction)(input.resources)
12
- ? await input.resources()
13
- : input.resources;
14
- const providers = (0, type_fns_1.isAFunction)(input.providers)
15
- ? await input.providers()
16
- : input.providers;
17
- return {
18
- resources,
19
- providers,
20
- };
21
- };
22
- exports.resolveCommandInputs = resolveCommandInputs;
23
- //# sourceMappingURL=resolveCommandInputs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveCommandInputs.js","sourceRoot":"","sources":["../../../../src/contract/commands/utils/resolveCommandInputs.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AAavC;;;;GAIG;AACI,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACzC,KAAK,GAGN,EAAE,EAAE;IACH,MAAM,SAAS,GAAuB,IAAA,sBAAW,EAAC,KAAK,CAAC,SAAS,CAAC;QAChE,CAAC,CAAC,MAAM,KAAK,CAAC,SAAS,EAAE;QACzB,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;IACpB,MAAM,SAAS,GAA+B,IAAA,sBAAW,EAAC,KAAK,CAAC,SAAS,CAAC;QACxE,CAAC,CAAC,MAAM,KAAK,CAAC,SAAS,EAAE;QACzB,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;IACpB,OAAO;QACL,SAAS;QACT,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,oBAAoB,wBAe/B"}
@@ -1,2 +0,0 @@
1
- export * from '../../logic/tools/reference/getReferenceTo';
2
- export * from '../../logic/tools/reference/buildReferenceTo';
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("../../logic/tools/reference/getReferenceTo"), exports);
18
- __exportStar(require("../../logic/tools/reference/buildReferenceTo"), exports);
19
- //# sourceMappingURL=refs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"refs.js","sourceRoot":"","sources":["../../../src/contract/sdk/refs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6EAA2D;AAC3D,+EAA6D"}
@@ -1,22 +0,0 @@
1
- import { VisualogicContext } from 'visualogic';
2
- import { DeclaredResource } from '../../../domain/DeclaredResource';
3
- import { DeclastructChangeProposal } from '../../../domain/DeclastructChangeProposal';
4
- import { DeclastructProvider } from '../../../domain/DeclastructProvider';
5
- /**
6
- * tactic: apply plans to synchronize resources
7
- * objective:
8
- * - synchronize the remote state of the resource to the declared state
9
- * impact:
10
- * - ensures the remote state matches the declared state
11
- *
12
- * strategy
13
- * - define a context for these resources
14
- * - apply the plan for these resources
15
- */
16
- export declare const applyPlansToSynchronize: <R extends DeclaredResource>({ resources, plans, }: {
17
- resources: R[];
18
- plans: DeclastructChangeProposal<R>[];
19
- }, { providers, log, }: {
20
- providers: DeclastructProvider<any>[];
21
- } & VisualogicContext) => Promise<Required<R>[]>;
22
- export { applyPlansToSynchronize as applyPlans };
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applyPlans = exports.applyPlansToSynchronize = void 0;
4
- const executeProposal_1 = require("../../../logic/actions/execute/executeProposal");
5
- const createDeclastructContext_1 = require("../../../logic/tools/context/createDeclastructContext");
6
- /**
7
- * tactic: apply plans to synchronize resources
8
- * objective:
9
- * - synchronize the remote state of the resource to the declared state
10
- * impact:
11
- * - ensures the remote state matches the declared state
12
- *
13
- * strategy
14
- * - define a context for these resources
15
- * - apply the plan for these resources
16
- */
17
- const applyPlansToSynchronize = async ({ resources, plans, }, { providers, log, }) => {
18
- // define the context for these resources
19
- const context = await (0, createDeclastructContext_1.createDeclastructContext)({
20
- providers,
21
- resources,
22
- log,
23
- });
24
- // get the plan for this one resource
25
- return await Promise.all(plans.map((plan) => (0, executeProposal_1.executeProposal)({ proposal: plan }, context)));
26
- };
27
- exports.applyPlansToSynchronize = applyPlansToSynchronize;
28
- exports.applyPlans = exports.applyPlansToSynchronize;
29
- //# sourceMappingURL=apply.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../../src/contract/sdk/sync/apply.ts"],"names":[],"mappings":";;;AAKA,oFAAiF;AACjF,oGAAiG;AAEjG;;;;;;;;;;GAUG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAC1C,EACE,SAAS,EACT,KAAK,GACqD,EAC5D,EACE,SAAS,EACT,GAAG,GAC2D,EACxC,EAAE;IAC1B,yCAAyC;IACzC,MAAM,OAAO,GAAG,MAAM,IAAA,mDAAwB,EAAC;QAC7C,SAAS;QACT,SAAS;QACT,GAAG;KACJ,CAAC,CAAC;IAEH,qCAAqC;IACrC,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,KAAK,CAAC,GAAG,CACP,CAAC,IAAI,EAAE,EAAE,CACP,IAAA,iCAAe,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,OAAO,CAAyB,CACvE,CACF,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,uBAAuB,2BAwBlC;AAGkC,qBA3BvB,+BAAuB,CA2BU"}
@@ -1,22 +0,0 @@
1
- import { VisualogicContext } from 'visualogic';
2
- import { DeclaredResource } from '../../../domain/DeclaredResource';
3
- import { DeclastructChangeProposal } from '../../../domain/DeclastructChangeProposal';
4
- import { DeclastructProvider } from '../../../domain/DeclastructProvider';
5
- /**
6
- * tactic: get plan to synchronize one resource
7
- * objective:
8
- * - get a plan for synchronizing the remote state of the resource to the declared state
9
- * impact:
10
- * - enable comparing the difference between the remote state and declared state
11
- * - enable applying the plan to synchronize the remote state to the declared state
12
- *
13
- * strategy
14
- * - define a context for this one resource
15
- * - get the plan for this one resource
16
- */
17
- export declare const getPlansToSynchronize: <R extends DeclaredResource>({ resources }: {
18
- resources: R[];
19
- }, { providers, log, }: {
20
- providers: DeclastructProvider<any>[];
21
- } & VisualogicContext) => Promise<DeclastructChangeProposal<R>[]>;
22
- export { getPlansToSynchronize as getPlans };
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPlans = exports.getPlansToSynchronize = void 0;
4
- const proposeChangeForResource_1 = require("../../../logic/actions/propose/proposeChangeForResource");
5
- const createDeclastructContext_1 = require("../../../logic/tools/context/createDeclastructContext");
6
- /**
7
- * tactic: get plan to synchronize one resource
8
- * objective:
9
- * - get a plan for synchronizing the remote state of the resource to the declared state
10
- * impact:
11
- * - enable comparing the difference between the remote state and declared state
12
- * - enable applying the plan to synchronize the remote state to the declared state
13
- *
14
- * strategy
15
- * - define a context for this one resource
16
- * - get the plan for this one resource
17
- */
18
- const getPlansToSynchronize = async ({ resources }, { providers, log, }) => {
19
- // define the context for this one resource
20
- const context = await (0, createDeclastructContext_1.createDeclastructContext)({
21
- providers,
22
- resources,
23
- log,
24
- });
25
- // get the plan for this one resource
26
- return await Promise.all(resources.map((resource) => (0, proposeChangeForResource_1.proposeChangeForResource)({ resource }, context)));
27
- };
28
- exports.getPlansToSynchronize = getPlansToSynchronize;
29
- exports.getPlans = exports.getPlansToSynchronize;
30
- //# sourceMappingURL=plan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../../src/contract/sdk/sync/plan.ts"],"names":[],"mappings":";;;AAKA,sGAAmG;AACnG,oGAAiG;AAEjG;;;;;;;;;;;GAWG;AACI,MAAM,qBAAqB,GAAG,KAAK,EACxC,EAAE,SAAS,EAAsB,EACjC,EACE,SAAS,EACT,GAAG,GAC2D,EACvB,EAAE;IAC3C,2CAA2C;IAC3C,MAAM,OAAO,GAAG,MAAM,IAAA,mDAAwB,EAAC;QAC7C,SAAS;QACT,SAAS;QACT,GAAG;KACJ,CAAC,CAAC;IAEH,qCAAqC;IACrC,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzB,IAAA,mDAAwB,EAAC,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,CAChD,CACF,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,qBAAqB,yBAoBhC;AAGgC,mBAvBrB,6BAAqB,CAuBQ"}
@@ -1,2 +0,0 @@
1
- import { DomainObject } from 'domain-objects';
2
- export type DeclaredResource<R extends Record<string, any> = {}> = DomainObject<R>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeclaredResource.js","sourceRoot":"","sources":["../../src/domain/DeclaredResource.ts"],"names":[],"mappings":""}
@@ -1,66 +0,0 @@
1
- import { DomainLiteral } from 'domain-objects';
2
- import Joi from 'joi';
3
- export declare enum DeclaredResourceReferenceKeyType {
4
- PRIMARY_KEY = "PRIMARY_KEY",
5
- UNIQUE_KEY = "UNIQUE_KEY"
6
- }
7
- /**
8
- * a value that a declared resource reference identifier specifies to identify the resource
9
- */
10
- export declare class DeclaredResourceReferenceIdentifierValue<V extends Record<string, any>> extends DomainLiteral<V> {
11
- }
12
- /**
13
- * an identifier for a declared resource reference
14
- */
15
- export interface DeclaredResourceReferenceIdentifier<KT extends DeclaredResourceReferenceKeyType, T, K extends keyof T> {
16
- key: KT;
17
- value: Required<Pick<T, K>>;
18
- }
19
- export declare class DeclaredResourceReferenceIdentifier<KT extends DeclaredResourceReferenceKeyType, T, K extends keyof T> extends DomainLiteral<DeclaredResourceReferenceIdentifier<KT, T, K>> implements DeclaredResourceReferenceIdentifier<KT, T, K> {
20
- static nested: {
21
- value: typeof DeclaredResourceReferenceIdentifierValue;
22
- };
23
- }
24
- /**
25
- * a reference to a resource
26
- * - allows reference by primary key (i.e., can specify just the primary)
27
- * - allows reference by unique key (i.e., can specify the unique traits of the entity)
28
- */
29
- export interface DeclaredResourceReference<T,
30
- /**
31
- * the names of the primary key attributes
32
- */
33
- P extends keyof T,
34
- /**
35
- * the names of the unique key attributes
36
- */
37
- U extends keyof T> {
38
- /**
39
- * the class.name of the resource being referenced
40
- */
41
- referenceOf: string;
42
- /**
43
- * the mechanism used to reference
44
- */
45
- identifiedBy: {
46
- key: DeclaredResourceReferenceKeyType.PRIMARY_KEY;
47
- value: Required<Pick<T, P>>;
48
- } | {
49
- key: DeclaredResourceReferenceKeyType.UNIQUE_KEY;
50
- value: Required<Pick<T, U>>;
51
- };
52
- }
53
- export declare class DeclaredResourceReference<T,
54
- /**
55
- * the names of the primary key attributes
56
- */
57
- P extends keyof T,
58
- /**
59
- * the names of the unique key attributes
60
- */
61
- U extends keyof T> extends DomainLiteral<DeclaredResourceReference<T, P, U>> implements DeclaredResourceReference<T, P, U> {
62
- static schema: Joi.AlternativesSchema<any>;
63
- static nested: {
64
- identifiedBy: typeof DeclaredResourceReferenceIdentifier;
65
- };
66
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DeclaredResourceReference = exports.DeclaredResourceReferenceIdentifier = exports.DeclaredResourceReferenceIdentifierValue = exports.DeclaredResourceReferenceKeyType = void 0;
7
- const domain_objects_1 = require("domain-objects");
8
- const joi_1 = __importDefault(require("joi"));
9
- var DeclaredResourceReferenceKeyType;
10
- (function (DeclaredResourceReferenceKeyType) {
11
- DeclaredResourceReferenceKeyType["PRIMARY_KEY"] = "PRIMARY_KEY";
12
- DeclaredResourceReferenceKeyType["UNIQUE_KEY"] = "UNIQUE_KEY";
13
- })(DeclaredResourceReferenceKeyType || (exports.DeclaredResourceReferenceKeyType = DeclaredResourceReferenceKeyType = {}));
14
- /**
15
- * a value that a declared resource reference identifier specifies to identify the resource
16
- */
17
- class DeclaredResourceReferenceIdentifierValue extends domain_objects_1.DomainLiteral {
18
- }
19
- exports.DeclaredResourceReferenceIdentifierValue = DeclaredResourceReferenceIdentifierValue;
20
- class DeclaredResourceReferenceIdentifier extends domain_objects_1.DomainLiteral {
21
- }
22
- exports.DeclaredResourceReferenceIdentifier = DeclaredResourceReferenceIdentifier;
23
- DeclaredResourceReferenceIdentifier.nested = { value: DeclaredResourceReferenceIdentifierValue };
24
- const schema = joi_1.default.alternatives(joi_1.default.object().keys({
25
- _dobj: joi_1.default.string().optional(), // may be specified if hydrating from serialized form (e.g., a cache)
26
- referenceOf: joi_1.default.string().required(),
27
- identifiedBy: joi_1.default.object().keys({
28
- _dobj: joi_1.default.string().optional(), // may be specified if hydrating from serialized form (e.g., a cache)
29
- key: joi_1.default.string()
30
- .valid(...Object.values(DeclaredResourceReferenceKeyType))
31
- .required(),
32
- value: joi_1.default.object(),
33
- }),
34
- }), joi_1.default.string().required());
35
- class DeclaredResourceReference extends domain_objects_1.DomainLiteral {
36
- }
37
- exports.DeclaredResourceReference = DeclaredResourceReference;
38
- DeclaredResourceReference.schema = schema;
39
- DeclaredResourceReference.nested = {
40
- identifiedBy: DeclaredResourceReferenceIdentifier,
41
- };
42
- //# sourceMappingURL=DeclaredResourceReference.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeclaredResourceReference.js","sourceRoot":"","sources":["../../src/domain/DeclaredResourceReference.ts"],"names":[],"mappings":";;;;;;AAAA,mDAA+C;AAC/C,8CAAsB;AAEtB,IAAY,gCAGX;AAHD,WAAY,gCAAgC;IAC1C,+DAA2B,CAAA;IAC3B,6DAAyB,CAAA;AAC3B,CAAC,EAHW,gCAAgC,gDAAhC,gCAAgC,QAG3C;AAED;;GAEG;AACH,MAAa,wCAEX,SAAQ,8BAAgB;CAAG;AAF7B,4FAE6B;AAa7B,MAAa,mCAKX,SAAQ,8BAA4D;;AALtE,kFASC;AADe,0CAAM,GAAG,EAAE,KAAK,EAAE,wCAAwC,EAAE,CAAC;AAG7E,MAAM,MAAM,GAAG,aAAG,CAAC,YAAY,CAC7B,aAAG,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;IAChB,KAAK,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,qEAAqE;IACrG,WAAW,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,YAAY,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;QAC9B,KAAK,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,qEAAqE;QACrG,GAAG,EAAE,aAAG,CAAC,MAAM,EAAE;aACd,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,gCAAgC,CAAC,CAAC;aACzD,QAAQ,EAAE;QACb,KAAK,EAAE,aAAG,CAAC,MAAM,EAAE;KACpB,CAAC;CACH,CAAC,EACF,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CACxB,CAAC;AA+CF,MAAa,yBAWX,SAAQ,8BAAiD;;AAX3D,8DAkBC;AAJe,gCAAM,GAAG,MAAM,CAAC;AAChB,gCAAM,GAAG;IACrB,YAAY,EAAE,mCAAmC;CAClD,CAAC"}
@@ -1,61 +0,0 @@
1
- import { DomainObject } from 'domain-objects';
2
- import { DeclaredResource } from './DeclaredResource';
3
- /**
4
- * an action that can be proposed
5
- */
6
- export declare enum DeclastructChangeProposalAction {
7
- /**
8
- * do nothing, the resource is already in the desired state
9
- */
10
- DO_NOTHING = "DO_NOTHING",
11
- /**
12
- * create a new resource
13
- */
14
- CREATE = "CREATE",
15
- /**
16
- * update an existing resource
17
- */
18
- UPDATE = "UPDATE",
19
- /**
20
- * destroy an existing resource
21
- */
22
- DESTROY = "DESTROY",
23
- /**
24
- * replace an existing resource
25
- *
26
- * note
27
- * - this is a `delete` followed by a `create`
28
- */
29
- REPLACE = "REPLACE"
30
- }
31
- /**
32
- * a change that declastruct has proposed in order to update the remote state to reflect the declared state
33
- */
34
- export interface DeclastructChangeProposal<R extends DeclaredResource> {
35
- /**
36
- * the name of the class of resource this proposal is for
37
- */
38
- forResourceClassName: string;
39
- /**
40
- * the grokable identity string of the resource this proposal is for
41
- */
42
- forGrokableIdentifier: string;
43
- /**
44
- * the remote-state the resource is currently in, from which we will be changing it
45
- */
46
- fromRemoteState: R | null;
47
- /**
48
- * the desired-state the resource should be in, to which we will be changing it
49
- */
50
- toDesiredState: R | null;
51
- /**
52
- * the action we plan to execute in order to fulfil this proposed change
53
- */
54
- action: DeclastructChangeProposalAction;
55
- /**
56
- * the displayable difference made by the change
57
- */
58
- difference: string | null;
59
- }
60
- export declare class DeclastructChangeProposal<R extends DeclaredResource> extends DomainObject<DeclastructChangeProposal<R>> implements DeclastructChangeProposal<R> {
61
- }
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeclastructChangeProposal = exports.DeclastructChangeProposalAction = void 0;
4
- const domain_objects_1 = require("domain-objects");
5
- /**
6
- * an action that can be proposed
7
- */
8
- var DeclastructChangeProposalAction;
9
- (function (DeclastructChangeProposalAction) {
10
- /**
11
- * do nothing, the resource is already in the desired state
12
- */
13
- DeclastructChangeProposalAction["DO_NOTHING"] = "DO_NOTHING";
14
- /**
15
- * create a new resource
16
- */
17
- DeclastructChangeProposalAction["CREATE"] = "CREATE";
18
- /**
19
- * update an existing resource
20
- */
21
- DeclastructChangeProposalAction["UPDATE"] = "UPDATE";
22
- /**
23
- * destroy an existing resource
24
- */
25
- DeclastructChangeProposalAction["DESTROY"] = "DESTROY";
26
- /**
27
- * replace an existing resource
28
- *
29
- * note
30
- * - this is a `delete` followed by a `create`
31
- */
32
- DeclastructChangeProposalAction["REPLACE"] = "REPLACE";
33
- })(DeclastructChangeProposalAction || (exports.DeclastructChangeProposalAction = DeclastructChangeProposalAction = {}));
34
- class DeclastructChangeProposal extends domain_objects_1.DomainObject {
35
- }
36
- exports.DeclastructChangeProposal = DeclastructChangeProposal;
37
- //# sourceMappingURL=DeclastructChangeProposal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeclastructChangeProposal.js","sourceRoot":"","sources":["../../src/domain/DeclastructChangeProposal.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAI9C;;GAEG;AACH,IAAY,+BA4BX;AA5BD,WAAY,+BAA+B;IACzC;;OAEG;IACH,4DAAyB,CAAA;IAEzB;;OAEG;IACH,oDAAiB,CAAA;IAEjB;;OAEG;IACH,oDAAiB,CAAA;IAEjB;;OAEG;IACH,sDAAmB,CAAA;IAEnB;;;;;OAKG;IACH,sDAAmB,CAAA;AACrB,CAAC,EA5BW,+BAA+B,+CAA/B,+BAA+B,QA4B1C;AAqCD,MAAa,yBACX,SAAQ,6BAA0C;CACR;AAF5C,8DAE4C"}
@@ -1,24 +0,0 @@
1
- import type { LogMethods } from 'simple-leveled-log-methods';
2
- import { DeclaredResource } from './DeclaredResource';
3
- import { DeclastructProvider } from './DeclastructProvider';
4
- /**
5
- * the declastruct context defines all of the providers and resources declared by the user
6
- *
7
- * note:
8
- * - this is the global context available to declastruct methods
9
- * - this is _not_ the provider context available to provider methods
10
- */
11
- export interface DeclastructContext {
12
- /**
13
- * the providers loaded by the user
14
- */
15
- providers: DeclastructProvider<any>[];
16
- /**
17
- * all of the resources declared by the user
18
- */
19
- resources: DeclaredResource[];
20
- /**
21
- * the log context to use
22
- */
23
- log: LogMethods;
24
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeclastructContext.js","sourceRoot":"","sources":["../../src/domain/DeclastructContext.ts"],"names":[],"mappings":""}