@degenerate/generic 0.0.4 → 0.0.6
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.
- package/README.md +1 -1
- package/dist/_settings/cryptography-settings.d.ts +27 -0
- package/dist/_settings/cryptography-settings.d.ts.map +1 -0
- package/dist/_settings/cryptography-settings.js +25 -0
- package/dist/_settings/cryptography-settings.js.map +1 -0
- package/dist/crypto/calculate-hash.d.ts +7 -0
- package/dist/crypto/calculate-hash.d.ts.map +1 -0
- package/dist/crypto/calculate-hash.js +12 -0
- package/dist/crypto/calculate-hash.js.map +1 -0
- package/dist/crypto/index.d.ts +2 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +2 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/errors/base-error.d.ts +23 -0
- package/dist/errors/base-error.d.ts.map +1 -0
- package/dist/errors/base-error.js +31 -0
- package/dist/errors/base-error.js.map +1 -0
- package/dist/errors/scheduler/scheduler-errors.d.ts +8 -0
- package/dist/errors/scheduler/scheduler-errors.d.ts.map +1 -0
- package/dist/errors/scheduler/scheduler-errors.js +11 -0
- package/dist/errors/scheduler/scheduler-errors.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/eslint.config.mjs +20 -20
- package/jest.config.js +6 -6
- package/jest.config.ts +199 -199
- package/package.json +41 -41
- package/src/_settings/cryptography-settings.ts +29 -29
- package/src/crypto/calculate-hash.ts +13 -13
- package/src/crypto/index.ts +1 -1
- package/src/errors/base-error.ts +34 -34
- package/src/errors/scheduler/scheduler-errors.ts +12 -12
- package/src/index.ts +8 -8
- package/tsconfig.json +123 -123
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# RaptureEvents
|
|
1
|
+
# RaptureEvents
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This contains the settings for the proofs around encryption, hashing and signing.
|
|
3
|
+
*/
|
|
4
|
+
import * as crypto from 'crypto';
|
|
5
|
+
/**
|
|
6
|
+
* This contains the settings for the cryptography. settings
|
|
7
|
+
*/
|
|
8
|
+
export declare const CryptoSettings: {
|
|
9
|
+
TextEncoding: crypto.Encoding;
|
|
10
|
+
Hash: {
|
|
11
|
+
Algorithm: string;
|
|
12
|
+
Digest: crypto.BinaryToTextEncoding;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* This contains the values for the elliptical curvers for encryption
|
|
17
|
+
*/
|
|
18
|
+
export declare enum EllipticalCurvesEncryption {
|
|
19
|
+
Curve25519 = "curve25519"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* This contains the values for the elliptical curvers for signing
|
|
23
|
+
*/
|
|
24
|
+
export declare enum EllipticalCurvesSigning {
|
|
25
|
+
Curve25519 = "ed25519"
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=cryptography-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cryptography-settings.d.ts","sourceRoot":"","sources":["../../src/_settings/cryptography-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,cAAc;kBACC,MAAM,CAAC,QAAQ;;;gBAGlB,MAAM,CAAC,oBAAoB;;CAEnD,CAAC;AAEF;;GAEG;AACH,oBAAY,0BAA0B;IAClC,UAAU,eAAe;CAC5B;AAED;;GAEG;AACH,oBAAY,uBAAuB;IAC/B,UAAU,YAAY;CACzB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This contains the settings for the cryptography. settings
|
|
3
|
+
*/
|
|
4
|
+
export const CryptoSettings = {
|
|
5
|
+
TextEncoding: 'utf8', // "utf8" | "ascii" | "latin1"
|
|
6
|
+
Hash: {
|
|
7
|
+
Algorithm: 'sha256',
|
|
8
|
+
Digest: 'hex', // "hex" | "base64" | "base64url" | "binary"
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* This contains the values for the elliptical curvers for encryption
|
|
13
|
+
*/
|
|
14
|
+
export var EllipticalCurvesEncryption;
|
|
15
|
+
(function (EllipticalCurvesEncryption) {
|
|
16
|
+
EllipticalCurvesEncryption["Curve25519"] = "curve25519";
|
|
17
|
+
})(EllipticalCurvesEncryption || (EllipticalCurvesEncryption = {}));
|
|
18
|
+
/**
|
|
19
|
+
* This contains the values for the elliptical curvers for signing
|
|
20
|
+
*/
|
|
21
|
+
export var EllipticalCurvesSigning;
|
|
22
|
+
(function (EllipticalCurvesSigning) {
|
|
23
|
+
EllipticalCurvesSigning["Curve25519"] = "ed25519";
|
|
24
|
+
})(EllipticalCurvesSigning || (EllipticalCurvesSigning = {}));
|
|
25
|
+
//# sourceMappingURL=cryptography-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cryptography-settings.js","sourceRoot":"","sources":["../../src/_settings/cryptography-settings.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,YAAY,EAAE,MAAyB,EAAE,8BAA8B;IACvE,IAAI,EAAE;QACF,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,KAAoC,EAAE,4CAA4C;KAC7F;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,0BAEX;AAFD,WAAY,0BAA0B;IAClC,uDAAyB,CAAA;AAC7B,CAAC,EAFW,0BAA0B,KAA1B,0BAA0B,QAErC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,uBAEX;AAFD,WAAY,uBAAuB;IAC/B,iDAAsB,CAAA;AAC1B,CAAC,EAFW,uBAAuB,KAAvB,uBAAuB,QAElC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate-hash.d.ts","sourceRoot":"","sources":["../../src/crypto/calculate-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC;;GAEG;AACH,QAAA,MAAM,aAAa,gBAAiB,MAAM,YAAY,MAAM,CAAC,oBAAoB,KAAG,MAInF,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as crypto from 'crypto';
|
|
2
|
+
import { CryptoSettings } from '../_settings/cryptography-settings';
|
|
3
|
+
/**
|
|
4
|
+
* Calculates the hash of the input string.
|
|
5
|
+
*/
|
|
6
|
+
const calculateHash = (inputString, encoding) => {
|
|
7
|
+
const combinedHash = crypto.createHash(CryptoSettings.Hash.Algorithm)
|
|
8
|
+
.update(inputString).digest(encoding);
|
|
9
|
+
return combinedHash;
|
|
10
|
+
};
|
|
11
|
+
export { calculateHash };
|
|
12
|
+
//# sourceMappingURL=calculate-hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate-hash.js","sourceRoot":"","sources":["../../src/crypto/calculate-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE;;GAEG;AACH,MAAM,aAAa,GAAG,CAAC,WAAmB,EAAE,QAAqC,EAAU,EAAE;IACzF,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC;SAChE,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,YAAY,CAAC;AACxB,CAAC,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the base error class that all other errors should extend from.
|
|
3
|
+
*/
|
|
4
|
+
export declare class BaseError extends Error {
|
|
5
|
+
errorCode?: number;
|
|
6
|
+
/**
|
|
7
|
+
* This is the base error type for the application.
|
|
8
|
+
*
|
|
9
|
+
* @param message the message to include.
|
|
10
|
+
* @param errorCode the error code if we want to include one.
|
|
11
|
+
*/
|
|
12
|
+
constructor(message: string, errorCode?: number);
|
|
13
|
+
/**
|
|
14
|
+
* This function returns the error as a JSON object.
|
|
15
|
+
*/
|
|
16
|
+
toJSON(): {
|
|
17
|
+
message: string;
|
|
18
|
+
errorType: string;
|
|
19
|
+
errorCode: number | undefined;
|
|
20
|
+
stack: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=base-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-error.d.ts","sourceRoot":"","sources":["../../src/errors/base-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAU/C;;OAEG;IACI,MAAM;;;;;;CAQhB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the base error class that all other errors should extend from.
|
|
3
|
+
*/
|
|
4
|
+
export class BaseError extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* This is the base error type for the application.
|
|
7
|
+
*
|
|
8
|
+
* @param message the message to include.
|
|
9
|
+
* @param errorCode the error code if we want to include one.
|
|
10
|
+
*/
|
|
11
|
+
constructor(message, errorCode) {
|
|
12
|
+
super(message); // Pass the message to the Error constructor
|
|
13
|
+
this.name = this.constructor.name; // Set the name of the error
|
|
14
|
+
this.errorCode = errorCode; // Set the error code
|
|
15
|
+
// This line is needed to restore the correct prototype chain.
|
|
16
|
+
// (see note below)
|
|
17
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* This function returns the error as a JSON object.
|
|
21
|
+
*/
|
|
22
|
+
toJSON() {
|
|
23
|
+
return {
|
|
24
|
+
message: this.message,
|
|
25
|
+
errorType: this.name,
|
|
26
|
+
errorCode: this.errorCode,
|
|
27
|
+
stack: this.stack,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=base-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-error.js","sourceRoot":"","sources":["../../src/errors/base-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAGhC;;;;;OAKG;IACH,YAAY,OAAe,EAAE,SAAkB;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,4CAA4C;QAC5D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,4BAA4B;QAC/D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC,qBAAqB;QAEjD,8DAA8D;QAC9D,mBAAmB;QACnB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,MAAM;QACT,OAAO;YACH,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,IAAI;YACpB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK;SACpB,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/scheduler/scheduler-errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,SAAS;gBAChC,MAAM,EAAE,MAAM;CAG7B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// this file contains all the errors that can be thrown by the scheduler
|
|
2
|
+
import { BaseError } from '../base-error';
|
|
3
|
+
/**
|
|
4
|
+
* This error is thrown when a task is not found in the scheduler
|
|
5
|
+
*/
|
|
6
|
+
export class TaskNotFoundError extends BaseError {
|
|
7
|
+
constructor(taskId) {
|
|
8
|
+
super(`An error occurred while trying to remove task ${taskId}.`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=scheduler-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler-errors.js","sourceRoot":"","sources":["../../../src/errors/scheduler/scheduler-errors.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IAC5C,YAAY,MAAc;QACtB,KAAK,CAAC,iDAAiD,MAAM,GAAG,CAAC,CAAC;IACtE,CAAC;CACJ"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACH,aAAa,EACb,cAAc,EACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,iFAAiF;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACH,aAAa,EACb,cAAc,EACjB,CAAC"}
|
package/eslint.config.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import eslint from '@eslint/js';
|
|
4
|
-
import tseslint from 'typescript-eslint';
|
|
5
|
-
|
|
6
|
-
export default tseslint.config(
|
|
7
|
-
eslint.configs.recommended,
|
|
8
|
-
// ...tseslint.configs.strictTypeChecked,
|
|
9
|
-
...tseslint.configs.stylisticTypeChecked,
|
|
10
|
-
...tseslint.configs.recommendedTypeChecked,
|
|
11
|
-
{
|
|
12
|
-
languageOptions: {
|
|
13
|
-
parserOptions: {
|
|
14
|
-
projectService: true,
|
|
15
|
-
tsconfigRootDir: import.meta.dirname,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
);
|
|
20
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import eslint from '@eslint/js';
|
|
4
|
+
import tseslint from 'typescript-eslint';
|
|
5
|
+
|
|
6
|
+
export default tseslint.config(
|
|
7
|
+
eslint.configs.recommended,
|
|
8
|
+
// ...tseslint.configs.strictTypeChecked,
|
|
9
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
10
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
11
|
+
{
|
|
12
|
+
languageOptions: {
|
|
13
|
+
parserOptions: {
|
|
14
|
+
projectService: true,
|
|
15
|
+
tsconfigRootDir: import.meta.dirname,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
package/jest.config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** @type {import('ts-jest').JestConfigWithTsJest} **/
|
|
2
|
-
module.exports = {
|
|
3
|
-
testEnvironment: "node",
|
|
4
|
-
transform: {
|
|
5
|
-
"^.+.tsx?$": ["ts-jest",{}],
|
|
6
|
-
},
|
|
1
|
+
/** @type {import('ts-jest').JestConfigWithTsJest} **/
|
|
2
|
+
module.exports = {
|
|
3
|
+
testEnvironment: "node",
|
|
4
|
+
transform: {
|
|
5
|
+
"^.+.tsx?$": ["ts-jest",{}],
|
|
6
|
+
},
|
|
7
7
|
};
|