@degenerate/generic 0.0.8 → 0.0.10

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 (127) hide show
  1. package/dist/_settings/cryptography-settings.d.ts +27 -0
  2. package/dist/_settings/cryptography-settings.d.ts.map +1 -0
  3. package/dist/_settings/cryptography-settings.js +27 -0
  4. package/dist/crypto/calculate-combined-hash.d.ts +13 -0
  5. package/dist/crypto/calculate-combined-hash.d.ts.map +1 -0
  6. package/dist/crypto/calculate-combined-hash.js +44 -0
  7. package/dist/crypto/calculate-hash.d.ts +7 -0
  8. package/dist/crypto/calculate-hash.d.ts.map +1 -0
  9. package/dist/crypto/calculate-hash.js +37 -0
  10. package/dist/crypto/index.d.ts +13 -0
  11. package/dist/crypto/index.d.ts.map +1 -0
  12. package/dist/crypto/index.js +34 -0
  13. package/dist/crypto/private-public-keys/create-key-pair-from-mnemonic.d.ts +12 -0
  14. package/dist/crypto/private-public-keys/create-key-pair-from-mnemonic.d.ts.map +1 -0
  15. package/dist/crypto/private-public-keys/create-key-pair-from-mnemonic.js +44 -0
  16. package/dist/crypto/private-public-keys/create-key-pair-from-private-key.d.ts +11 -0
  17. package/dist/crypto/private-public-keys/create-key-pair-from-private-key.d.ts.map +1 -0
  18. package/dist/crypto/private-public-keys/create-key-pair-from-private-key.js +40 -0
  19. package/dist/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.d.ts +11 -0
  20. package/dist/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.d.ts.map +1 -0
  21. package/dist/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.js +45 -0
  22. package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts +10 -0
  23. package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts.map +1 -0
  24. package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.js +40 -0
  25. package/dist/crypto/private-public-keys/generation/create-random-256-private-key.d.ts +8 -0
  26. package/dist/crypto/private-public-keys/generation/create-random-256-private-key.d.ts.map +1 -0
  27. package/dist/crypto/private-public-keys/generation/create-random-256-private-key.js +41 -0
  28. package/dist/crypto/private-public-keys/generation/generate-key-pair.d.ts +11 -0
  29. package/dist/crypto/private-public-keys/generation/generate-key-pair.d.ts.map +1 -0
  30. package/dist/crypto/private-public-keys/generation/generate-key-pair.js +39 -0
  31. package/dist/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts +15 -0
  32. package/dist/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts.map +1 -0
  33. package/dist/crypto/private-public-keys/generation/get-private-public-key-from-keypair.js +21 -0
  34. package/dist/crypto/signature/create-crypto-signature.d.ts +9 -0
  35. package/dist/crypto/signature/create-crypto-signature.d.ts.map +1 -0
  36. package/dist/crypto/signature/create-crypto-signature.js +13 -0
  37. package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts +13 -0
  38. package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts.map +1 -0
  39. package/dist/crypto/signature/verify-crypto-signature-by-data.js +45 -0
  40. package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts +13 -0
  41. package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts.map +1 -0
  42. package/dist/crypto/signature/verify-crypto-signature-by-hash.js +42 -0
  43. package/dist/errors/base-error.d.ts +23 -0
  44. package/dist/errors/base-error.d.ts.map +1 -0
  45. package/dist/errors/base-error.js +34 -0
  46. package/dist/errors/generic/generic-errors.d.ts +35 -0
  47. package/dist/errors/generic/generic-errors.d.ts.map +1 -0
  48. package/dist/errors/generic/generic-errors.js +47 -0
  49. package/dist/errors/index.d.ts +6 -0
  50. package/dist/errors/index.d.ts.map +1 -0
  51. package/dist/errors/index.js +21 -0
  52. package/dist/errors/request/request-errors.d.ts +89 -0
  53. package/dist/errors/request/request-errors.d.ts.map +1 -0
  54. package/dist/errors/request/request-errors.js +120 -0
  55. package/dist/errors/scheduler/scheduler-errors.d.ts +8 -0
  56. package/dist/errors/scheduler/scheduler-errors.d.ts.map +1 -0
  57. package/dist/errors/scheduler/scheduler-errors.js +14 -0
  58. package/dist/errors/share-data/share-data-errors.d.ts +49 -0
  59. package/dist/errors/share-data/share-data-errors.d.ts.map +1 -0
  60. package/dist/errors/share-data/share-data-errors.js +66 -0
  61. package/dist/helpers/array/array-helpers.d.ts +8 -0
  62. package/dist/helpers/array/array-helpers.d.ts.map +1 -0
  63. package/dist/helpers/array/array-helpers.js +14 -0
  64. package/dist/helpers/data/data-helpers.d.ts +46 -0
  65. package/dist/helpers/data/data-helpers.d.ts.map +1 -0
  66. package/dist/helpers/data/data-helpers.js +106 -0
  67. package/dist/helpers/file/file-helpers.d.ts +12 -0
  68. package/dist/helpers/file/file-helpers.d.ts.map +1 -0
  69. package/dist/helpers/file/file-helpers.js +39 -0
  70. package/dist/helpers/id-helpers.d.ts +8 -0
  71. package/dist/helpers/id-helpers.d.ts.map +1 -0
  72. package/dist/helpers/id-helpers.js +19 -0
  73. package/dist/helpers/index.d.ts +11 -0
  74. package/dist/helpers/index.d.ts.map +1 -0
  75. package/dist/helpers/index.js +31 -0
  76. package/dist/helpers/lodash/lodash-helpers.d.ts +14 -0
  77. package/dist/helpers/lodash/lodash-helpers.d.ts.map +1 -0
  78. package/dist/helpers/lodash/lodash-helpers.js +28 -0
  79. package/dist/helpers/object-helpers.d.ts +23 -0
  80. package/dist/helpers/object-helpers.d.ts.map +1 -0
  81. package/dist/helpers/object-helpers.js +54 -0
  82. package/dist/helpers/object-validation-helpers.d.ts +59 -0
  83. package/dist/helpers/object-validation-helpers.d.ts.map +1 -0
  84. package/dist/helpers/object-validation-helpers.js +233 -0
  85. package/dist/helpers/request/params-object-helpers.d.ts +38 -0
  86. package/dist/helpers/request/params-object-helpers.d.ts.map +1 -0
  87. package/dist/helpers/request/params-object-helpers.js +54 -0
  88. package/dist/helpers/request/query-object-helpers.d.ts +12 -0
  89. package/dist/helpers/request/query-object-helpers.d.ts.map +1 -0
  90. package/dist/helpers/request/query-object-helpers.js +25 -0
  91. package/dist/helpers/request/request-object-helpers.d.ts +19 -0
  92. package/dist/helpers/request/request-object-helpers.d.ts.map +1 -0
  93. package/dist/helpers/request/request-object-helpers.js +28 -0
  94. package/dist/index.d.ts +2 -0
  95. package/dist/index.d.ts.map +1 -1
  96. package/dist/index.js +3 -0
  97. package/dist/models/data/data-models.d.ts +24 -0
  98. package/dist/models/data/data-models.d.ts.map +1 -0
  99. package/dist/models/data/data-models.js +3 -0
  100. package/dist/models/dynamic-execution/dynamic-execution-models.d.ts +9 -0
  101. package/dist/models/dynamic-execution/dynamic-execution-models.d.ts.map +1 -0
  102. package/dist/models/dynamic-execution/dynamic-execution-models.js +2 -0
  103. package/dist/models/events/share-event-models.d.ts +65 -0
  104. package/dist/models/events/share-event-models.d.ts.map +1 -0
  105. package/dist/models/events/share-event-models.js +70 -0
  106. package/dist/models/functions/share-data-function-models.d.ts +86 -0
  107. package/dist/models/functions/share-data-function-models.d.ts.map +1 -0
  108. package/dist/models/functions/share-data-function-models.js +17 -0
  109. package/dist/models/generic/__tests__/request-response-models.d.ts +2 -0
  110. package/dist/models/generic/__tests__/request-response-models.d.ts.map +1 -0
  111. package/dist/models/generic/__tests__/request-response-models.js +33 -0
  112. package/dist/models/generic/request-response-models.d.ts +8 -0
  113. package/dist/models/generic/request-response-models.d.ts.map +1 -0
  114. package/dist/models/generic/request-response-models.js +2 -0
  115. package/dist/models/index.d.ts +8 -0
  116. package/dist/models/index.d.ts.map +1 -0
  117. package/dist/models/index.js +24 -0
  118. package/dist/models/rules/share-rule-models.d.ts +277 -0
  119. package/dist/models/rules/share-rule-models.d.ts.map +1 -0
  120. package/dist/models/rules/share-rule-models.js +107 -0
  121. package/dist/models/share-data/share-data.d.ts +55 -0
  122. package/dist/models/share-data/share-data.d.ts.map +1 -0
  123. package/dist/models/share-data/share-data.js +19 -0
  124. package/dist/share-data/share-data.d.ts +1 -0
  125. package/dist/share-data/share-data.d.ts.map +1 -0
  126. package/dist/share-data/share-data.js +166 -0
  127. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=share-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-data.d.ts","sourceRoot":"","sources":["../../src/share-data/share-data.ts"],"names":[],"mappings":""}
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ // import { startRuleEvaluation } from '../../../rules/src/evaluation/start-rule-evaluation';
3
+ // import { ShareDataIsLockedError } from '../errors';
4
+ // import { IShareDataEvent } from '../models/events/share-event-models';
5
+ // import { IShareRuleApplied, IShareRuleEvalutionResult } from '../models/rules/share-rule-models';
6
+ // import { IShareFunction, IShareTransactionHistory, IShareData, ShareDataTypes } from '../models/share-data/share-data';
7
+ // /**
8
+ // * This contains the interface for the share data object
9
+ // */
10
+ // export class ShareData {
11
+ // private _id: string; // the id of the share data
12
+ // private _rules: IShareRuleApplied[]; // the rules for the share data
13
+ // private _functions: IShareFunction<any, (...args: any[]) => any, any>[]; // the functions for the share data
14
+ // private _transactionHistory: IShareTransactionHistory[]; // The transaction history for the share data
15
+ // private _events: IShareDataEvent[]; // the events for the share data
16
+ // private isLocked: boolean; // the lock status of the share data
17
+ // private _data: IShareData; // the data for the share data
18
+ // /**
19
+ // * This is the constructor for the share data object
20
+ // * @param id the id of the share data
21
+ // */
22
+ // constructor(id: string) {
23
+ // this.isLocked = false;
24
+ // this._id = id;
25
+ // this._rules = [];
26
+ // this._functions = [];
27
+ // this._transactionHistory = [];
28
+ // this._events = [];
29
+ // this._data = {};
30
+ // }
31
+ // //#region Getters and Setters
32
+ // /**
33
+ // * This adds a rule to the share block.
34
+ // * @param rule the rule to add to the share block
35
+ // */
36
+ // addRule(rule: IShareRuleApplied): void {
37
+ // if (this.isLocked) {
38
+ // throw new ShareDataIsLockedError(this._id, ShareDataTypes.RULE);
39
+ // }
40
+ // this._rules.push(rule);
41
+ // }
42
+ // /**
43
+ // * This gets the rules for the share block
44
+ // */
45
+ // get rules(): IShareRuleApplied[] {
46
+ // return this._rules;
47
+ // }
48
+ // /**
49
+ // * This gets the transaction history for the share block
50
+ // */
51
+ // addFunction(func: IShareFunction<any, (...args: any[]) => any, any>): void {
52
+ // if (this.isLocked) {
53
+ // throw new ShareDataIsLockedError(this._id, ShareDataTypes.FUNCTION);
54
+ // }
55
+ // this._functions.push(func);
56
+ // }
57
+ // /**
58
+ // * This gets the functions for the share block
59
+ // */
60
+ // get functions(): IShareFunction<any, (...args: any[]) => any, any>[] {
61
+ // return this._functions;
62
+ // }
63
+ // /**
64
+ // * This gets the events for the sharedata
65
+ // */
66
+ // get events(): IShareDataEvent[] {
67
+ // return this._events;
68
+ // }
69
+ // /**
70
+ // * This adds an event to the share data
71
+ // * @param event the event to add
72
+ // */
73
+ // addEvent(event: IShareDataEvent): void {
74
+ // this._events.push(event);
75
+ // }
76
+ // /**
77
+ // * This adds a transaction to the share block
78
+ // * @param rulesEvaluation the evaluation of the rules (result)
79
+ // * @param transactionFunction the function that was run
80
+ // */
81
+ // addTransactionAlreadyValidated(
82
+ // proposedData: IShareData,
83
+ // rulesEvaluation: IShareRuleEvalutionResult,
84
+ // transactionFunction: IShareFunction<any, (...args: any[]) => any, any>,
85
+ // ): void {
86
+ // // make sure the function is known.
87
+ // if (!this._functions.includes(transactionFunction)) {
88
+ // throw new Error('The function is not known');
89
+ // }
90
+ // const transactionTime = Date.now(); // get the current time
91
+ // const transactionId = this._transactionHistory.length + 1; // get the transaction id
92
+ // const ruleOutcome = (rulesEvaluation.proposedResult && rulesEvaluation.currentResult);
93
+ // const transaction: IShareTransactionHistory = {
94
+ // ruleOutcome,
95
+ // ruleFailures: [],
96
+ // transactionFunction,
97
+ // transactionId: transactionId.toString(),
98
+ // transactionTime,
99
+ // };
100
+ // // the outcome of the rules is valid write the data to be the new current data.
101
+ // if (ruleOutcome) {
102
+ // this._data = proposedData;
103
+ // }
104
+ // this._transactionHistory.push(transaction);
105
+ // }
106
+ // /**
107
+ // * This adds a transaction to the share block but the transaction has not yet been validated
108
+ // *
109
+ // * @param proposedData the proposed data
110
+ // * @param transactionFunction the function that was attempted
111
+ // */
112
+ // addTransactionNotValidated(
113
+ // proposedData: IShareData,
114
+ // transactionFunction: IShareFunction<any, (...args: any[]) => any, any>,
115
+ // ): void {
116
+ // // make sure the function is known.
117
+ // if (!this._functions.includes(transactionFunction)) {
118
+ // // throw ShareDataFunctionBeingAppliedDoesNotExistOnShareDataError
119
+ // throw new Error('The function is not known');
120
+ // }
121
+ // // // evaluate the rules.
122
+ // // const rulesEvalOutcome = evaluateRules('transaction', this._data, proposedData, this._rules);
123
+ // const rulesOutcome = startRuleEvaluation(this._id, transactionFunction, this.functions, this._rules, this._data, proposedData);
124
+ // const transactionTime = Date.now(); // get the current time
125
+ // const transactionId = this._transactionHistory.length + 1; // get the transaction id
126
+ // const transaction: IShareTransactionHistory = {
127
+ // ruleOutcome: rulesOutcome.isValidProposal,
128
+ // ruleFailures: [],
129
+ // transactionFunction,
130
+ // transactionId: transactionId.toString(),
131
+ // transactionTime,
132
+ // };
133
+ // // update the data if the rules are valid
134
+ // if (rulesOutcome.isValidProposal) {
135
+ // this._data = proposedData;
136
+ // }
137
+ // // add the transaction to the history
138
+ // this._transactionHistory.push(transaction);
139
+ // }
140
+ // /**
141
+ // * This gets the transaction history for the share block
142
+ // */
143
+ // get transactionHistory(): IShareTransactionHistory[] {
144
+ // return this._transactionHistory;
145
+ // }
146
+ // /**
147
+ // * This returns the current state of data for the share block
148
+ // */
149
+ // get data(): IShareData {
150
+ // return this._data;
151
+ // }
152
+ // /**
153
+ // * This copies a share data object to a new transaction number
154
+ // * @param transactionNumber the number of the transaction to run until.
155
+ // */
156
+ // copyTo(transactionNumber: number): ShareData {
157
+ // // return share data with a new ID
158
+ // const newShareData = new ShareData(`${this._id}-${transactionNumber}`);
159
+ // newShareData._rules = [...this._rules];
160
+ // newShareData._functions = [...this._functions];
161
+ // newShareData._transactionHistory = [...this._transactionHistory];
162
+ // newShareData._data = { ...this._data };
163
+ // return newShareData;
164
+ // }
165
+ // //#endregion Getters and Setters
166
+ // }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@degenerate/generic",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "This contains the generic information needed for the Distributed Execution Infrastructure network.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",