@degenerate/generic 0.0.9 → 0.0.11

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 (96) hide show
  1. package/dist/crypto/index.d.ts +3 -0
  2. package/dist/crypto/index.d.ts.map +1 -1
  3. package/dist/crypto/index.js +5 -0
  4. package/dist/crypto/signature/create-crypto-signature.d.ts +9 -0
  5. package/dist/crypto/signature/create-crypto-signature.d.ts.map +1 -0
  6. package/dist/crypto/signature/create-crypto-signature.js +13 -0
  7. package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts +13 -0
  8. package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts.map +1 -0
  9. package/dist/crypto/signature/verify-crypto-signature-by-data.js +45 -0
  10. package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts +13 -0
  11. package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts.map +1 -0
  12. package/dist/{errors/__tests__/index-test.js → crypto/signature/verify-crypto-signature-by-hash.js} +17 -9
  13. package/dist/errors/generic/generic-errors.d.ts +35 -0
  14. package/dist/errors/generic/generic-errors.d.ts.map +1 -0
  15. package/dist/errors/generic/generic-errors.js +47 -0
  16. package/dist/errors/index.d.ts +4 -0
  17. package/dist/errors/index.d.ts.map +1 -1
  18. package/dist/errors/index.js +4 -0
  19. package/dist/errors/request/request-errors.d.ts +89 -0
  20. package/dist/errors/request/request-errors.d.ts.map +1 -0
  21. package/dist/errors/request/request-errors.js +120 -0
  22. package/dist/errors/safe/safe-rules-errors.d.ts +11 -0
  23. package/dist/errors/safe/safe-rules-errors.d.ts.map +1 -0
  24. package/dist/errors/safe/safe-rules-errors.js +17 -0
  25. package/dist/errors/share-data/share-data-errors.d.ts +49 -0
  26. package/dist/errors/share-data/share-data-errors.d.ts.map +1 -0
  27. package/dist/errors/share-data/share-data-errors.js +66 -0
  28. package/dist/helpers/array/array-helpers.d.ts +8 -0
  29. package/dist/helpers/array/array-helpers.d.ts.map +1 -0
  30. package/dist/helpers/array/array-helpers.js +14 -0
  31. package/dist/helpers/data/data-helpers.d.ts +46 -0
  32. package/dist/helpers/data/data-helpers.d.ts.map +1 -0
  33. package/dist/helpers/data/data-helpers.js +106 -0
  34. package/dist/helpers/file/file-helpers.d.ts +12 -0
  35. package/dist/helpers/file/file-helpers.d.ts.map +1 -0
  36. package/dist/helpers/file/file-helpers.js +39 -0
  37. package/dist/helpers/id-helpers.d.ts +8 -0
  38. package/dist/helpers/id-helpers.d.ts.map +1 -0
  39. package/dist/helpers/id-helpers.js +19 -0
  40. package/dist/helpers/index.d.ts +11 -0
  41. package/dist/helpers/index.d.ts.map +1 -0
  42. package/dist/helpers/index.js +31 -0
  43. package/dist/helpers/lodash/lodash-helpers.d.ts +14 -0
  44. package/dist/helpers/lodash/lodash-helpers.d.ts.map +1 -0
  45. package/dist/helpers/lodash/lodash-helpers.js +28 -0
  46. package/dist/helpers/object-helpers.d.ts +23 -0
  47. package/dist/helpers/object-helpers.d.ts.map +1 -0
  48. package/dist/helpers/object-helpers.js +54 -0
  49. package/dist/helpers/object-validation-helpers.d.ts +59 -0
  50. package/dist/helpers/object-validation-helpers.d.ts.map +1 -0
  51. package/dist/helpers/object-validation-helpers.js +233 -0
  52. package/dist/helpers/request/params-object-helpers.d.ts +38 -0
  53. package/dist/helpers/request/params-object-helpers.d.ts.map +1 -0
  54. package/dist/helpers/request/params-object-helpers.js +54 -0
  55. package/dist/helpers/request/query-object-helpers.d.ts +12 -0
  56. package/dist/helpers/request/query-object-helpers.d.ts.map +1 -0
  57. package/dist/helpers/request/query-object-helpers.js +25 -0
  58. package/dist/helpers/request/request-object-helpers.d.ts +19 -0
  59. package/dist/helpers/request/request-object-helpers.d.ts.map +1 -0
  60. package/dist/helpers/request/request-object-helpers.js +28 -0
  61. package/dist/index.d.ts +2 -0
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +3 -0
  64. package/dist/models/data/data-models.d.ts +24 -0
  65. package/dist/models/data/data-models.d.ts.map +1 -0
  66. package/dist/models/data/data-models.js +3 -0
  67. package/dist/models/dynamic-execution/dynamic-execution-models.d.ts +9 -0
  68. package/dist/models/dynamic-execution/dynamic-execution-models.d.ts.map +1 -0
  69. package/dist/models/dynamic-execution/dynamic-execution-models.js +2 -0
  70. package/dist/models/events/share-event-models.d.ts +65 -0
  71. package/dist/models/events/share-event-models.d.ts.map +1 -0
  72. package/dist/models/events/share-event-models.js +70 -0
  73. package/dist/models/functions/share-data-function-models.d.ts +86 -0
  74. package/dist/models/functions/share-data-function-models.d.ts.map +1 -0
  75. package/dist/models/functions/share-data-function-models.js +17 -0
  76. package/dist/models/generic/__tests__/request-response-models.d.ts +2 -0
  77. package/dist/models/generic/__tests__/request-response-models.d.ts.map +1 -0
  78. package/dist/models/generic/__tests__/request-response-models.js +33 -0
  79. package/dist/models/generic/request-response-models.d.ts +8 -0
  80. package/dist/models/generic/request-response-models.d.ts.map +1 -0
  81. package/dist/models/generic/request-response-models.js +2 -0
  82. package/dist/models/index.d.ts +8 -0
  83. package/dist/models/index.d.ts.map +1 -0
  84. package/dist/models/index.js +24 -0
  85. package/dist/models/rules/share-rule-models.d.ts +277 -0
  86. package/dist/models/rules/share-rule-models.d.ts.map +1 -0
  87. package/dist/models/rules/share-rule-models.js +107 -0
  88. package/dist/models/share-data/share-data.d.ts +55 -0
  89. package/dist/models/share-data/share-data.d.ts.map +1 -0
  90. package/dist/models/share-data/share-data.js +19 -0
  91. package/dist/share-data/share-data.d.ts +1 -0
  92. package/dist/share-data/share-data.d.ts.map +1 -0
  93. package/dist/share-data/share-data.js +166 -0
  94. package/package.json +1 -1
  95. package/dist/errors/__tests__/index-test.d.ts +0 -2
  96. package/dist/errors/__tests__/index-test.d.ts.map +0 -1
@@ -0,0 +1,86 @@
1
+ /**
2
+ * This contains the data for the sahre functions
3
+ */
4
+ /**
5
+ * This is the incoming object for the share functions.
6
+ */
7
+ export interface ITargetObject {
8
+ [key: string]: unknown;
9
+ }
10
+ /**
11
+ * This contains all the proof types that exist for the network.
12
+ */
13
+ export declare enum INetworkProofType {
14
+ CRYPTOGRAPHIC_SIGNATURE = "CRYPTOGRAPHIC_SIGNATURE"
15
+ }
16
+ /**
17
+ * This contains the network proof for the share data network functions.
18
+ */
19
+ export type INetworkProof = ICryptographicSignatureProof;
20
+ /**
21
+ * This contains the cryptographic signature proof for the share data network functions.
22
+ */
23
+ export interface ICryptographicSignatureProof {
24
+ publicKey: string;
25
+ signature: string;
26
+ }
27
+ /**
28
+ * This contains the data for a share data network function without the signature
29
+ */
30
+ export interface IShareDataFunctionBasic {
31
+ createdAt: number;
32
+ previousHash: string;
33
+ stringifiedFunction: string;
34
+ currentHash: string;
35
+ }
36
+ /**
37
+ * This contains the data for a share data network function.
38
+ */
39
+ export interface IShareDataFunction extends IShareDataFunctionBasic {
40
+ proof: INetworkProof;
41
+ proofType: INetworkProofType;
42
+ }
43
+ /**
44
+ * This contains a share data network function
45
+ */
46
+ export interface IShareDataNetworkFunction {
47
+ id: string;
48
+ name: string;
49
+ description: string;
50
+ shareDataFunctions: IShareDataFunction[];
51
+ proof: INetworkProof;
52
+ proofType: INetworkProofType;
53
+ }
54
+ export interface IShareDataNetworkFunctionDescriptor {
55
+ functionNumber: number;
56
+ name: string;
57
+ description: string;
58
+ }
59
+ /**
60
+ * This contains the data for a share data network rule that is the basic shape.
61
+ */
62
+ export interface IShareDataRuleBasic {
63
+ createdAt: number;
64
+ previousHash: string;
65
+ stringifiedRule: string;
66
+ currentHash: string;
67
+ }
68
+ /**
69
+ * This contains the interface for a share function record in the share data object
70
+ */
71
+ export interface IShareDataNetworkRule {
72
+ id: string;
73
+ shareDataRules: IShareDataRule[];
74
+ applicationId: string;
75
+ applicationIdProof: string;
76
+ }
77
+ /**
78
+ * This contains the data for a share data network rule.
79
+ */
80
+ export interface IShareDataRule {
81
+ createdAt: number;
82
+ previousHash: string;
83
+ stringifiedRule: string;
84
+ currentHash: string;
85
+ }
86
+ //# sourceMappingURL=share-data-function-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-data-function-models.d.ts","sourceRoot":"","sources":["../../../src/models/functions/share-data-function-models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,oBAAY,iBAAiB;IACzB,uBAAuB,4BAA4B;CACtD;AACD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,4BAA4B,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,4BAA4B;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AACD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IAC/D,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,iBAAiB,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;IACzC,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,iBAAiB,CAAC;CAChC;AAED,MAAM,WAAW,mCAAmC;IAChD,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACvB;AAGD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,cAAc,EAAE,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * This contains the data for the sahre functions
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.INetworkProofType = void 0;
7
+ /**
8
+ * This contains all the proof types that exist for the network.
9
+ */
10
+ var INetworkProofType;
11
+ (function (INetworkProofType) {
12
+ INetworkProofType["CRYPTOGRAPHIC_SIGNATURE"] = "CRYPTOGRAPHIC_SIGNATURE";
13
+ })(INetworkProofType || (exports.INetworkProofType = INetworkProofType = {}));
14
+ /// Use of user defined function in the share data
15
+ /// Storage / Retrieval of the user defined functions in the network. (logic library)
16
+ // Use of user defined rules in the share data (product)
17
+ // Storage / Retrieval of the user defined rules in the network. (logic library)
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=request-response-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-response-models.d.ts","sourceRoot":"","sources":["../../../../src/models/generic/__tests__/request-response-models.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ describe('IGenericResponse', () => {
4
+ it('should create a successful response without an error', () => {
5
+ const response = {
6
+ successful: true,
7
+ };
8
+ expect(response.successful).toBe(true);
9
+ expect(response.error).toBeUndefined();
10
+ });
11
+ it('should create a failed response with an error message', () => {
12
+ const errorMessage = 'An error occurred';
13
+ const response = {
14
+ successful: false,
15
+ error: errorMessage,
16
+ };
17
+ expect(response.successful).toBe(false);
18
+ expect(response.error).toBe(errorMessage);
19
+ });
20
+ it('should handle optional error property correctly', () => {
21
+ const response = {
22
+ successful: true,
23
+ };
24
+ expect(response.successful).toBe(true);
25
+ expect(response.error).toBeUndefined();
26
+ const errorResponse = {
27
+ successful: false,
28
+ error: 'An error occurred',
29
+ };
30
+ expect(errorResponse.successful).toBe(false);
31
+ expect(errorResponse.error).toBe('An error occurred');
32
+ });
33
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This contains a generic response of the application when complex or other data is not required.
3
+ */
4
+ export interface IGenericResponse {
5
+ successful: boolean;
6
+ error?: string;
7
+ }
8
+ //# sourceMappingURL=request-response-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-response-models.d.ts","sourceRoot":"","sources":["../../../src/models/generic/request-response-models.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export * from './data/data-models';
2
+ export * from './dynamic-execution/dynamic-execution-models';
3
+ export * from './events/share-event-models';
4
+ export * from './functions/share-data-function-models';
5
+ export * from './generic/request-response-models';
6
+ export * from './rules/share-rule-models';
7
+ export * from './share-data/share-data';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,8CAA8C,CAAC;AAC7D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ // This exports all model files from the models folder.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./data/data-models"), exports);
19
+ __exportStar(require("./dynamic-execution/dynamic-execution-models"), exports);
20
+ __exportStar(require("./events/share-event-models"), exports);
21
+ __exportStar(require("./functions/share-data-function-models"), exports);
22
+ __exportStar(require("./generic/request-response-models"), exports);
23
+ __exportStar(require("./rules/share-rule-models"), exports);
24
+ __exportStar(require("./share-data/share-data"), exports);
@@ -0,0 +1,277 @@
1
+ /**
2
+ * This file contains the models for the rules used in the share data.
3
+ */
4
+ /**
5
+ * This contains the interface for the rule evaluation.
6
+ */
7
+ export interface IShareRuleEvalutionResult {
8
+ ruleId: string;
9
+ currentResult: boolean;
10
+ currentConditionFailure: ICondition[];
11
+ proposedResult: boolean;
12
+ proposedConditionFailure: ICondition[];
13
+ }
14
+ /**
15
+ * This contains the interface for the rule evaluation.
16
+ */
17
+ export interface IShareRulesEvaluationResult {
18
+ rootParam: string;
19
+ passedRuleCheck: boolean;
20
+ passedRuleId: string;
21
+ shareRuleEvalutionResults: IShareRuleEvalutionResult[];
22
+ }
23
+ /**
24
+ * This contains the interface for the rule evaluation results.
25
+ */
26
+ export interface IRuleEvaluationResults {
27
+ shareDataId: string;
28
+ rulesResults: IShareRulesEvaluationResult[];
29
+ isValidProposal: boolean;
30
+ }
31
+ /**
32
+ * This contains the interface for the rule set in the share data object
33
+ */
34
+ export interface IRuleSet {
35
+ id: string;
36
+ name: string;
37
+ description: string;
38
+ ruleGroups: IRuleGroup[];
39
+ }
40
+ /**
41
+ * This contains the logical operators for combining rules.
42
+ */
43
+ export declare enum LogicalOperator {
44
+ AND = "AND",
45
+ OR = "OR"
46
+ }
47
+ /**
48
+ * This contains the interface for a rule group.
49
+ *
50
+ * A rule group can contain individual rules or nested rule groups.
51
+ */
52
+ export interface IRuleGroup {
53
+ operator: LogicalOperator;
54
+ rules: (IShareRule | IRuleGroup)[];
55
+ }
56
+ /**
57
+ * This contains the interface for a share rule in the share data object
58
+ */
59
+ export interface IShareRule {
60
+ ruleId: string;
61
+ currentDataConditions: ICondition[];
62
+ proposedDataConditions: ICondition[];
63
+ }
64
+ /**
65
+ * This contains the applied rule informaiton in the share data object.
66
+ */
67
+ export interface IShareRuleApplied extends IShareRule {
68
+ targettedProperty: string;
69
+ }
70
+ /**
71
+ * This contains the different types of conditions that can be evaluated.
72
+ */
73
+ export type ConditionType = ConditionTypeTypeOf | ConditionTypeEquality | ConditionTypeRange | ConditionTypeContains | ConditionTypeStartsEndsWith | ConditionTypeNull | ConditionTypeBoolean | ConditionTypeEmpty;
74
+ /**
75
+ * This contains the choices for the typeof conditions.
76
+ */
77
+ export declare enum ConditionTypeTypeOf {
78
+ IS_TYPEOF = "is typeof",
79
+ IS_NOT_TYPEOF = "is not typeof"
80
+ }
81
+ /**
82
+ * This contains the choices for the equality conditions.
83
+ */
84
+ export declare enum ConditionTypeEquality {
85
+ EQUAL = "equal",
86
+ NOT_EQUAL = "not equal"
87
+ }
88
+ /**
89
+ * This contains the choices for the range conditions.
90
+ */
91
+ export declare enum ConditionTypeRange {
92
+ GREATER_THAN = "greater than",
93
+ LESS_THAN = "less than",
94
+ GREATER_THAN_OR_EQUAL = "greater than or equal",
95
+ LESS_THAN_OR_EQUAL = "less than or equal"
96
+ }
97
+ /**
98
+ * This contains the choices for the contains conditions.
99
+ */
100
+ export declare enum ConditionTypeContains {
101
+ CONTAINS = "contains",
102
+ NOT_CONTAINS = "not contains"
103
+ }
104
+ /**
105
+ * This contains the choices for the starts with and ends with conditions.
106
+ */
107
+ export declare enum ConditionTypeStartsEndsWith {
108
+ STARTS_WITH = "starts with",
109
+ ENDS_WITH = "ends with"
110
+ }
111
+ /**
112
+ * This contains the choices for the null conditions.
113
+ */
114
+ export declare enum ConditionTypeNull {
115
+ IS_NULL = "is null",
116
+ IS_NOT_NULL = "is not null"
117
+ }
118
+ /**
119
+ * This contains the choices for the boolean conditions.
120
+ */
121
+ export declare enum ConditionTypeBoolean {
122
+ IS_TRUE = "is true",
123
+ IS_FALSE = "is false"
124
+ }
125
+ /**
126
+ * This contains the choices for the empty conditions.
127
+ */
128
+ export declare enum ConditionTypeEmpty {
129
+ IS_EMPTY = "is empty",
130
+ IS_NOT_EMPTY = "is not empty"
131
+ }
132
+ /**
133
+ * This contains the choices for the special conditions.
134
+ */
135
+ export declare enum ConditionTypeSpecial {
136
+ PATTERN = "pattern"
137
+ }
138
+ /**
139
+ * This is the interface for the conditional information in the checks.
140
+ */
141
+ export type ICondition = IConditionTypeOf | IConditionEquality | IConditionRange | IConditionContains | IConditionStartsEndsWith | IConditionNull | IConditionBoolean | IConditionEmpty | IConditionSpecial;
142
+ /**
143
+ * These are the different choices for the types of data in a condition.
144
+ */
145
+ export declare enum ConditionTypeOf {
146
+ STRING = "string",
147
+ NUMBER = "number",
148
+ INTEGER = "integer",
149
+ BOOLEAN = "boolean",
150
+ OBJECT = "object",
151
+ ARRAY = "array",
152
+ NULL = "null",
153
+ UNDEFINED = "undefined",
154
+ FUNCTION = "function",
155
+ BIGINT = "bigint"
156
+ }
157
+ /**
158
+ * This is the interface for the type of condition.
159
+ *
160
+ const exampleConditionTypeOf: IConditionTypeOf = {
161
+ targettedProperty: 'address.city.total',
162
+ conditionType: ConditionTypeTypeOf.IS_TYPEOF,
163
+ conditionValue: ConditionTypeOf.NUMBER
164
+ };
165
+ */
166
+ export interface IConditionTypeOf {
167
+ targettedProperty: string;
168
+ conditionType: ConditionTypeTypeOf;
169
+ conditionValue: ConditionTypeOf;
170
+ }
171
+ /**
172
+ * This is the interface for the equality condition.
173
+ *
174
+ const exampleConditionEquality: IConditionEquality = {
175
+ targettedProperty: 'address.city.total',
176
+ conditionType: ConditionTypeEquality.EQUAL,
177
+ conditionValue: 100
178
+ };
179
+ */
180
+ export interface IConditionEquality {
181
+ targettedProperty: string;
182
+ conditionType: ConditionTypeEquality;
183
+ conditionValue: number | string;
184
+ }
185
+ /**
186
+ * This is the interface for the range condition.
187
+ *
188
+ const exampleConditionRange: IConditionRange = {
189
+ targettedProperty: 'address.city.total',
190
+ conditionType: ConditionTypeRange.GREATER_THAN,
191
+ conditionValue: 100
192
+ };
193
+ */
194
+ export interface IConditionRange {
195
+ targettedProperty: string;
196
+ conditionType: ConditionTypeRange;
197
+ conditionValue: string | number;
198
+ }
199
+ /**
200
+ * This is the interface for the contains condition.
201
+ *
202
+ const exampleConditionContains: IConditionContains = {
203
+ targettedProperty: 'address.city.name',
204
+ conditionType: ConditionTypeContains.CONTAINS,
205
+ conditionValue: ['gar'| 'garison' | 'garage']
206
+ * };
207
+ */
208
+ export interface IConditionContains {
209
+ targettedProperty: string;
210
+ conditionType: ConditionTypeContains;
211
+ conditionValue: string | string[] | number[];
212
+ }
213
+ /**
214
+ * This is the interface for the starts with and ends with condition.
215
+ *
216
+ const exampleConditionStartsEndsWith: IConditionStartsEndsWith = {
217
+ targettedProperty: 'address.city.name',
218
+ conditionType: ConditionTypeStartsEndsWith.STARTS_WITH,
219
+ conditionValue: 'cal'
220
+ };
221
+ */
222
+ export interface IConditionStartsEndsWith {
223
+ targettedProperty: string;
224
+ conditionType: ConditionTypeStartsEndsWith;
225
+ conditionValue: string;
226
+ }
227
+ /**
228
+ * This is the interface for the null condition.
229
+ *
230
+ const exampleConditionNull: IConditionNull = {
231
+ targettedProperty: 'address.city.name',
232
+ conditionType: ConditionTypeNull.IS_NULL
233
+ };
234
+ */
235
+ export interface IConditionNull {
236
+ targettedProperty: string;
237
+ conditionType: ConditionTypeNull;
238
+ }
239
+ /**
240
+ * This is the interface for the boolean condition.
241
+ *
242
+ const exampleConditionBoolean: IConditionBoolean = {
243
+ targettedProperty: 'address.city.name',
244
+ conditionType: ConditionTypeBoolean.IS_TRUE
245
+ };
246
+ */
247
+ export interface IConditionBoolean {
248
+ targettedProperty: string;
249
+ conditionType: ConditionTypeBoolean;
250
+ }
251
+ /**
252
+ * This is the interface for the empty condition.
253
+ *
254
+ const exampleConditionEmpty: IConditionEmpty = {
255
+ targettedProperty: 'address.city.name',
256
+ conditionType: ConditionTypeEmpty.IS_EMPTY
257
+ };
258
+ */
259
+ export interface IConditionEmpty {
260
+ targettedProperty: string;
261
+ conditionType: ConditionTypeEmpty;
262
+ }
263
+ /**
264
+ * This is the interface for the special condition.
265
+ *
266
+ const exampleConditionSpecial: IConditionSpecial = {
267
+ targettedProperty: 'address.city.name',
268
+ conditionType: ConditionTypeSpecial.PATTERN,
269
+ conditionValue: '^[a-zA-Z0-9]*$'
270
+ };
271
+ */
272
+ export interface IConditionSpecial {
273
+ targettedProperty: string;
274
+ conditionType: ConditionTypeSpecial;
275
+ conditionValue: string;
276
+ }
277
+ //# sourceMappingURL=share-rule-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-rule-models.d.ts","sourceRoot":"","sources":["../../../src/models/rules/share-rule-models.ts"],"names":[],"mappings":"AACA;;GAEG;AAIH;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,uBAAuB,EAAE,UAAU,EAAE,CAAC;IACtC,cAAc,EAAE,OAAO,CAAC;IACxB,wBAAwB,EAAE,UAAU,EAAE,CAAC;CAC1C;AAED;;GAEG;AACH,MA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E,MAAM,GAAG,MAAM,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,kBAAkB,CAAC;IAClC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,qBAAqB,CAAC;IACrC,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;CAChD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,2BAA2B,CAAC;IAC3C,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,iBAAiB,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,oBAAoB,CAAC;CACvC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,kBAAkB,CAAC;CACrC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,oBAAoB,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC;CAC1B"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ /**
3
+ * This file contains the models for the rules used in the share data.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ConditionTypeOf = exports.ConditionTypeSpecial = exports.ConditionTypeEmpty = exports.ConditionTypeBoolean = exports.ConditionTypeNull = exports.ConditionTypeStartsEndsWith = exports.ConditionTypeContains = exports.ConditionTypeRange = exports.ConditionTypeEquality = exports.ConditionTypeTypeOf = exports.LogicalOperator = void 0;
7
+ //#endregion RuleSet
8
+ //#region RuleGroup
9
+ /**
10
+ * This contains the logical operators for combining rules.
11
+ */
12
+ var LogicalOperator;
13
+ (function (LogicalOperator) {
14
+ LogicalOperator["AND"] = "AND";
15
+ LogicalOperator["OR"] = "OR";
16
+ })(LogicalOperator || (exports.LogicalOperator = LogicalOperator = {}));
17
+ /**
18
+ * This contains the choices for the typeof conditions.
19
+ */
20
+ var ConditionTypeTypeOf;
21
+ (function (ConditionTypeTypeOf) {
22
+ ConditionTypeTypeOf["IS_TYPEOF"] = "is typeof";
23
+ ConditionTypeTypeOf["IS_NOT_TYPEOF"] = "is not typeof";
24
+ })(ConditionTypeTypeOf || (exports.ConditionTypeTypeOf = ConditionTypeTypeOf = {}));
25
+ /**
26
+ * This contains the choices for the equality conditions.
27
+ */
28
+ var ConditionTypeEquality;
29
+ (function (ConditionTypeEquality) {
30
+ ConditionTypeEquality["EQUAL"] = "equal";
31
+ ConditionTypeEquality["NOT_EQUAL"] = "not equal";
32
+ })(ConditionTypeEquality || (exports.ConditionTypeEquality = ConditionTypeEquality = {}));
33
+ /**
34
+ * This contains the choices for the range conditions.
35
+ */
36
+ var ConditionTypeRange;
37
+ (function (ConditionTypeRange) {
38
+ ConditionTypeRange["GREATER_THAN"] = "greater than";
39
+ ConditionTypeRange["LESS_THAN"] = "less than";
40
+ ConditionTypeRange["GREATER_THAN_OR_EQUAL"] = "greater than or equal";
41
+ ConditionTypeRange["LESS_THAN_OR_EQUAL"] = "less than or equal";
42
+ })(ConditionTypeRange || (exports.ConditionTypeRange = ConditionTypeRange = {}));
43
+ /**
44
+ * This contains the choices for the contains conditions.
45
+ */
46
+ var ConditionTypeContains;
47
+ (function (ConditionTypeContains) {
48
+ ConditionTypeContains["CONTAINS"] = "contains";
49
+ ConditionTypeContains["NOT_CONTAINS"] = "not contains";
50
+ })(ConditionTypeContains || (exports.ConditionTypeContains = ConditionTypeContains = {}));
51
+ /**
52
+ * This contains the choices for the starts with and ends with conditions.
53
+ */
54
+ var ConditionTypeStartsEndsWith;
55
+ (function (ConditionTypeStartsEndsWith) {
56
+ ConditionTypeStartsEndsWith["STARTS_WITH"] = "starts with";
57
+ ConditionTypeStartsEndsWith["ENDS_WITH"] = "ends with";
58
+ })(ConditionTypeStartsEndsWith || (exports.ConditionTypeStartsEndsWith = ConditionTypeStartsEndsWith = {}));
59
+ /**
60
+ * This contains the choices for the null conditions.
61
+ */
62
+ var ConditionTypeNull;
63
+ (function (ConditionTypeNull) {
64
+ ConditionTypeNull["IS_NULL"] = "is null";
65
+ ConditionTypeNull["IS_NOT_NULL"] = "is not null";
66
+ })(ConditionTypeNull || (exports.ConditionTypeNull = ConditionTypeNull = {}));
67
+ /**
68
+ * This contains the choices for the boolean conditions.
69
+ */
70
+ var ConditionTypeBoolean;
71
+ (function (ConditionTypeBoolean) {
72
+ ConditionTypeBoolean["IS_TRUE"] = "is true";
73
+ ConditionTypeBoolean["IS_FALSE"] = "is false";
74
+ })(ConditionTypeBoolean || (exports.ConditionTypeBoolean = ConditionTypeBoolean = {}));
75
+ /**
76
+ * This contains the choices for the empty conditions.
77
+ */
78
+ var ConditionTypeEmpty;
79
+ (function (ConditionTypeEmpty) {
80
+ ConditionTypeEmpty["IS_EMPTY"] = "is empty";
81
+ ConditionTypeEmpty["IS_NOT_EMPTY"] = "is not empty";
82
+ })(ConditionTypeEmpty || (exports.ConditionTypeEmpty = ConditionTypeEmpty = {}));
83
+ /**
84
+ * This contains the choices for the special conditions.
85
+ */
86
+ var ConditionTypeSpecial;
87
+ (function (ConditionTypeSpecial) {
88
+ ConditionTypeSpecial["PATTERN"] = "pattern";
89
+ })(ConditionTypeSpecial || (exports.ConditionTypeSpecial = ConditionTypeSpecial = {}));
90
+ /**
91
+ * These are the different choices for the types of data in a condition.
92
+ */
93
+ var ConditionTypeOf;
94
+ (function (ConditionTypeOf) {
95
+ ConditionTypeOf["STRING"] = "string";
96
+ ConditionTypeOf["NUMBER"] = "number";
97
+ ConditionTypeOf["INTEGER"] = "integer";
98
+ ConditionTypeOf["BOOLEAN"] = "boolean";
99
+ ConditionTypeOf["OBJECT"] = "object";
100
+ ConditionTypeOf["ARRAY"] = "array";
101
+ ConditionTypeOf["NULL"] = "null";
102
+ ConditionTypeOf["UNDEFINED"] = "undefined";
103
+ ConditionTypeOf["FUNCTION"] = "function";
104
+ // SYMBOL = 'symbol',
105
+ ConditionTypeOf["BIGINT"] = "bigint";
106
+ })(ConditionTypeOf || (exports.ConditionTypeOf = ConditionTypeOf = {}));
107
+ //#endregion Conditions
@@ -0,0 +1,55 @@
1
+ /**
2
+ * This contains the data for the share data object
3
+ */
4
+ export declare enum ShareDataTypes {
5
+ RULE = "RULE",
6
+ FUNCTION = "FUNCTION",
7
+ TRANSACTION_HISTORY = "TRANSACTION_HISTORY",
8
+ DATA = "DATA"
9
+ }
10
+ export interface IShareData {
11
+ [key: string]: any;
12
+ }
13
+ /**
14
+ * This contains the interface for a share function record in the share data object
15
+ */
16
+ export interface IShareFunctionRecord {
17
+ id: string;
18
+ groupingId: string;
19
+ groupingName: string;
20
+ name: string;
21
+ description: string;
22
+ hash: string;
23
+ stringifiedFunction: string;
24
+ }
25
+ /**
26
+ * This contains the interface for a share function in the share data object
27
+ */
28
+ export interface IShareFunction<TInput, TFunction extends (...args: any[]) => any, TOutput> {
29
+ input: TInput;
30
+ func: TFunction;
31
+ output: TOutput;
32
+ }
33
+ /**
34
+ * This contains the interface for the share transaction history in the share data object
35
+ */
36
+ export interface IShareTransactionBase {
37
+ ruleOutcome: boolean;
38
+ ruleFailures: IRuleFailures[];
39
+ transactionFunction: IShareFunction<any, (...args: any[]) => any, any>;
40
+ }
41
+ /**
42
+ * This contains the interface for the share transaction history in the share data object
43
+ * This is done for storage
44
+ */
45
+ export interface IShareTransactionHistory extends IShareTransactionBase {
46
+ transactionId: string;
47
+ transactionTime: number;
48
+ }
49
+ /**
50
+ * This contains the interface for the rule success in the share data object
51
+ */
52
+ export interface IRuleFailures {
53
+ ruleId: string;
54
+ }
55
+ //# sourceMappingURL=share-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-data.d.ts","sourceRoot":"","sources":["../../../src/models/share-data/share-data.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,oBAAY,cAAc;IACtB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,mBAAmB,wBAAwB;IAC3C,IAAI,SAAS;CAChB;AAGD,MAAM,WAAW,UAAU;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,MAAM,EAAE,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,OAAO;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9B,mBAAmB,EAAE,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,GAAG,CAAC,CAAC;CAC1E;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,qBAAqB;IACnE,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShareDataTypes = void 0;
4
+ /**
5
+ * This contains the data for the share data object
6
+ */
7
+ var ShareDataTypes;
8
+ (function (ShareDataTypes) {
9
+ ShareDataTypes["RULE"] = "RULE";
10
+ ShareDataTypes["FUNCTION"] = "FUNCTION";
11
+ ShareDataTypes["TRANSACTION_HISTORY"] = "TRANSACTION_HISTORY";
12
+ ShareDataTypes["DATA"] = "DATA";
13
+ })(ShareDataTypes || (exports.ShareDataTypes = ShareDataTypes = {}));
14
+ // export interface IShareData {
15
+ // rules: IShareRule[]; // the rules for the share data
16
+ // functions: IShareFunction[]; // the functions for the share data
17
+ // transactionHistory: IShareTransactionHistory[]; // The transaction history for the share data
18
+ // data
19
+ // }