@ibgib/core-gib 0.1.3 → 0.1.4
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/dist/witness/space/inner-space/inner-space-v1.respec.mjs +4 -5
- package/dist/witness/space/inner-space/inner-space-v1.respec.mjs.map +1 -1
- package/package.json +4 -4
- package/src/witness/space/inner-space/inner-space-v1.respec.mts +4 -6
- package/dist/witness/keystone/keystone-base-v1.d.mts +0 -177
- package/dist/witness/keystone/keystone-base-v1.d.mts.map +0 -1
- package/dist/witness/keystone/keystone-base-v1.mjs +0 -397
- package/dist/witness/keystone/keystone-base-v1.mjs.map +0 -1
- package/dist/witness/keystone/keystone-constants.d.mts +0 -2
- package/dist/witness/keystone/keystone-constants.d.mts.map +0 -1
- package/dist/witness/keystone/keystone-constants.mjs +0 -2
- package/dist/witness/keystone/keystone-constants.mjs.map +0 -1
- package/dist/witness/keystone/keystone-helper.d.mts +0 -9
- package/dist/witness/keystone/keystone-helper.d.mts.map +0 -1
- package/dist/witness/keystone/keystone-helper.mjs +0 -53
- package/dist/witness/keystone/keystone-helper.mjs.map +0 -1
- package/dist/witness/keystone/keystone-types.d.mts +0 -164
- package/dist/witness/keystone/keystone-types.d.mts.map +0 -1
- package/dist/witness/keystone/keystone-types.mjs +0 -46
- package/dist/witness/keystone/keystone-types.mjs.map +0 -1
- package/dist/witness/keystone/keystone.d.mts +0 -2
- package/dist/witness/keystone/keystone.d.mts.map +0 -1
- package/dist/witness/keystone/keystone.mjs +0 -2
- package/dist/witness/keystone/keystone.mjs.map +0 -1
- package/dist/witness/keystone/keystone.respec.d.mts +0 -11
- package/dist/witness/keystone/keystone.respec.d.mts.map +0 -1
- package/dist/witness/keystone/keystone.respec.mjs +0 -11
- package/dist/witness/keystone/keystone.respec.mjs.map +0 -1
- package/dist/witness/keystone/math-keystone/math-keystone-constants.d.mts +0 -2
- package/dist/witness/keystone/math-keystone/math-keystone-constants.d.mts.map +0 -1
- package/dist/witness/keystone/math-keystone/math-keystone-constants.mjs +0 -2
- package/dist/witness/keystone/math-keystone/math-keystone-constants.mjs.map +0 -1
- package/dist/witness/keystone/math-keystone/math-keystone-helper.d.mts +0 -13
- package/dist/witness/keystone/math-keystone/math-keystone-helper.d.mts.map +0 -1
- package/dist/witness/keystone/math-keystone/math-keystone-helper.mjs +0 -41
- package/dist/witness/keystone/math-keystone/math-keystone-helper.mjs.map +0 -1
- package/dist/witness/keystone/math-keystone/math-keystone-types.d.mts +0 -80
- package/dist/witness/keystone/math-keystone/math-keystone-types.d.mts.map +0 -1
- package/dist/witness/keystone/math-keystone/math-keystone-types.mjs +0 -9
- package/dist/witness/keystone/math-keystone/math-keystone-types.mjs.map +0 -1
- package/dist/witness/keystone/math-keystone/math-keystone-v1.d.mts +0 -34
- package/dist/witness/keystone/math-keystone/math-keystone-v1.d.mts.map +0 -1
- package/dist/witness/keystone/math-keystone/math-keystone-v1.mjs +0 -119
- package/dist/witness/keystone/math-keystone/math-keystone-v1.mjs.map +0 -1
- package/dist/witness/keystone/math-keystone/math-keystone.respec.d.mts +0 -20
- package/dist/witness/keystone/math-keystone/math-keystone.respec.d.mts.map +0 -1
- package/dist/witness/keystone/math-keystone/math-keystone.respec.mjs +0 -76
- package/dist/witness/keystone/math-keystone/math-keystone.respec.mjs.map +0 -1
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-constants.d.mts +0 -2
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-constants.d.mts.map +0 -1
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-constants.mjs +0 -2
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-constants.mjs.map +0 -1
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-helper.d.mts +0 -2
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-helper.d.mts.map +0 -1
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-helper.mjs +0 -2
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-helper.mjs.map +0 -1
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-types.d.mts +0 -2
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-types.d.mts.map +0 -1
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-types.mjs +0 -2
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-types.mjs.map +0 -1
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-v1.d.mts +0 -2
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-v1.d.mts.map +0 -1
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-v1.mjs +0 -2
- package/dist/witness/keystone/zkp-keystone/zkp-keystone-v1.mjs.map +0 -1
- package/src/witness/keystone/keystone-base-v1.mts +0 -450
- package/src/witness/keystone/keystone-constants.mts +0 -0
- package/src/witness/keystone/keystone-helper.mts +0 -56
- package/src/witness/keystone/keystone-types.mts +0 -200
- package/src/witness/keystone/keystone.mts +0 -0
- package/src/witness/keystone/keystone.respec.mts +0 -9
- package/src/witness/keystone/math-keystone/math-keystone-constants.mts +0 -0
- package/src/witness/keystone/math-keystone/math-keystone-helper.mts +0 -45
- package/src/witness/keystone/math-keystone/math-keystone-types.mts +0 -115
- package/src/witness/keystone/math-keystone/math-keystone-v1.mts +0 -139
- package/src/witness/keystone/math-keystone/math-keystone.respec.mts +0 -122
- package/src/witness/keystone/zkp-keystone/zkp-keystone-constants.mts +0 -0
- package/src/witness/keystone/zkp-keystone/zkp-keystone-helper.mts +0 -0
- package/src/witness/keystone/zkp-keystone/zkp-keystone-types.mts +0 -0
- package/src/witness/keystone/zkp-keystone/zkp-keystone-v1.mts +0 -0
|
File without changes
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module keystone.respec.mts
|
|
3
|
-
*
|
|
4
|
-
* @see {@link './math-keystone/math-keystone.respec.mts'}
|
|
5
|
-
*
|
|
6
|
-
* In order to test the keystone at the base class, you have to create a mock.
|
|
7
|
-
* I've gone ahead and made a simplistic keystone at ./math-keystone which acts
|
|
8
|
-
* as this base keystone test.
|
|
9
|
-
*/
|
|
File without changes
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MathChallengeInfo, MathChallengeType, MathChallengeInfo_Add
|
|
3
|
-
} from "./math-keystone-types.mjs";
|
|
4
|
-
|
|
5
|
-
import { GLOBAL_LOG_A_LOT } from '../../../core-constants.mjs';
|
|
6
|
-
/**
|
|
7
|
-
* use for verbose logging.
|
|
8
|
-
*/
|
|
9
|
-
const logalot = GLOBAL_LOG_A_LOT;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* creates a new simple math challenge. only does 'add' atow.
|
|
13
|
-
*
|
|
14
|
-
* @returns math challenge info
|
|
15
|
-
*/
|
|
16
|
-
export async function getMathChallenge({
|
|
17
|
-
challengeType,
|
|
18
|
-
}: {
|
|
19
|
-
/**
|
|
20
|
-
* If provided, will create this type of challenge.
|
|
21
|
-
*/
|
|
22
|
-
challengeType?: MathChallengeType,
|
|
23
|
-
}): Promise<MathChallengeInfo> {
|
|
24
|
-
const lc = `[${getMathChallenge.name}]`;
|
|
25
|
-
try {
|
|
26
|
-
if (logalot) { console.log(`${lc} starting... (I: 75a805603968ca8a4b076caa2cf9bd23)`); }
|
|
27
|
-
if (challengeType && challengeType !== 'add') { throw new Error(`only 'add' implemented atow (E: 1e5bc2395395b8d48d61135b63a77923)`); }
|
|
28
|
-
|
|
29
|
-
// add
|
|
30
|
-
const x = Math.ceil(Math.random() * 999999);
|
|
31
|
-
const y = Math.ceil(Math.random() * 999999);
|
|
32
|
-
const challenge: MathChallengeInfo_Add = {
|
|
33
|
-
id: 'hmm',
|
|
34
|
-
op: 'add',
|
|
35
|
-
a: x,
|
|
36
|
-
b: y,
|
|
37
|
-
}
|
|
38
|
-
return challenge;
|
|
39
|
-
} catch (error) {
|
|
40
|
-
console.error(`${lc} ${error.message}`);
|
|
41
|
-
throw error;
|
|
42
|
-
} finally {
|
|
43
|
-
if (logalot) { console.log(`${lc} complete.`); }
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module math-keystone-types
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { IbGibData_V1, IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
6
|
-
import { IbGib } from '@ibgib/ts-gib/dist/types.mjs';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
KeystoneData_V1, KeystoneRel8ns_V1,
|
|
10
|
-
KeystoneOptionsData, KeystoneOptionsRel8ns, KeystoneOptionsIbGib,
|
|
11
|
-
KeystoneResultData, KeystoneResultRel8ns, KeystoneResultIbGib,
|
|
12
|
-
} from '../keystone-types.mjs';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { GLOBAL_LOG_A_LOT } from '../../../core-constants.mjs';
|
|
16
|
-
/**
|
|
17
|
-
* use for verbose logging.
|
|
18
|
-
*/
|
|
19
|
-
const logalot = GLOBAL_LOG_A_LOT;
|
|
20
|
-
|
|
21
|
-
export interface MathKeystoneData_V1 extends KeystoneData_V1<MathChallengeInfo[], MathSolutionInfo[]> {
|
|
22
|
-
challengeAtom: 'math';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface MathKeystoneRel8ns_V1 extends KeystoneRel8ns_V1 {
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* needed? yagni?
|
|
30
|
-
*/
|
|
31
|
-
export interface MathKeystoneAddlMetadata {
|
|
32
|
-
// atom: string;
|
|
33
|
-
// classnameIsh: string;
|
|
34
|
-
// nameIsh: string;
|
|
35
|
-
// idIsh: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* keystone for math problem challenges.
|
|
40
|
-
*
|
|
41
|
-
* I'm using this largely as a test implementation, which both gives me a chance
|
|
42
|
-
* to futz around and learn, as well as help corroborate that unit tests are
|
|
43
|
-
* properly scoped.
|
|
44
|
-
*/
|
|
45
|
-
export interface MathKeystoneIbGib_V1<MathKeystoneData_V1 extends IbGibData_V1, MathKeystoneRel8ns_V1 extends IbGibRel8ns_V1>
|
|
46
|
-
extends IbGib_V1<MathKeystoneData_V1, MathKeystoneRel8ns_V1> {
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface MathKeystoneOptionsData extends KeystoneOptionsData {
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface MathKeystoneOptionsRel8ns extends KeystoneOptionsRel8ns {
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface MathKeystoneOptionsIbGib extends KeystoneOptionsIbGib {
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @see {@link WitnessResultData}
|
|
61
|
-
*/
|
|
62
|
-
export interface MathKeystoneResultData extends KeystoneResultData {
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
*/
|
|
67
|
-
export interface MathKeystoneResultRel8ns extends KeystoneResultRel8ns { }
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Shape of result ibgib if used for a robbot.
|
|
71
|
-
*
|
|
72
|
-
* I'm not sure what to do with this atm, so I'm just stubbing out...
|
|
73
|
-
*/
|
|
74
|
-
export interface MathKeystoneResultIbGib
|
|
75
|
-
extends KeystoneResultIbGib<IbGib_V1, MathKeystoneResultData, MathKeystoneResultRel8ns> {
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export type MathChallengeOperation = 'add' | 'subtract';
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* info about our (simple atow) math challenge.
|
|
82
|
-
*/
|
|
83
|
-
export interface MathChallengeInfo {
|
|
84
|
-
/**
|
|
85
|
-
* operation to be performed on number's `a` and `b`.
|
|
86
|
-
*/
|
|
87
|
-
op: MathChallengeOperation;
|
|
88
|
-
/**
|
|
89
|
-
* id of the challenge
|
|
90
|
-
*/
|
|
91
|
-
id: string;
|
|
92
|
-
/**
|
|
93
|
-
* left hand side of math challenge expression.
|
|
94
|
-
*/
|
|
95
|
-
a: number;
|
|
96
|
-
/**
|
|
97
|
-
* right hande side of math challenge expression.
|
|
98
|
-
*/
|
|
99
|
-
b: number;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface MathChallengeInfo_Add extends MathChallengeInfo {
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* info about our (simple atow) math challenge's solution.
|
|
107
|
-
*/
|
|
108
|
-
export interface MathSolutionInfo {
|
|
109
|
-
challengeId: string;
|
|
110
|
-
solution: number;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface MathChallengeType {
|
|
114
|
-
|
|
115
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
2
|
-
import { WitnessWithContextBase_V1 } from "../../witness-with-context/witness-with-context-base-v1.mjs";
|
|
3
|
-
import {
|
|
4
|
-
MathKeystoneOptionsData, MathKeystoneOptionsIbGib, MathKeystoneOptionsRel8ns,
|
|
5
|
-
MathKeystoneResultData, MathKeystoneResultIbGib, MathKeystoneResultRel8ns,
|
|
6
|
-
MathKeystoneData_V1, MathKeystoneRel8ns_V1, MathKeystoneIbGib_V1,
|
|
7
|
-
MathKeystoneAddlMetadata,
|
|
8
|
-
MathChallengeInfo, MathSolutionInfo,
|
|
9
|
-
} from "./math-keystone-types.mjs";
|
|
10
|
-
import { KeystoneBase_V1 } from "../keystone-base-v1.mjs";
|
|
11
|
-
|
|
12
|
-
import { GLOBAL_LOG_A_LOT } from '../../../core-constants.mjs';
|
|
13
|
-
const logalot = GLOBAL_LOG_A_LOT;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* witness for keystones that have math problems as the challenges.
|
|
17
|
-
*
|
|
18
|
-
* @see {@link MathKeystoneIbGib_V1}
|
|
19
|
-
*/
|
|
20
|
-
export class MathKeystoneWitness_V1 extends KeystoneBase_V1<
|
|
21
|
-
MathChallengeInfo[], MathSolutionInfo[],
|
|
22
|
-
MathKeystoneOptionsData, MathKeystoneOptionsRel8ns, MathKeystoneOptionsIbGib,
|
|
23
|
-
MathKeystoneResultData, MathKeystoneResultRel8ns, MathKeystoneResultIbGib,
|
|
24
|
-
MathKeystoneData_V1, MathKeystoneRel8ns_V1> {
|
|
25
|
-
|
|
26
|
-
protected parseAddlMetadataString<TParseResult>({ ib }: { ib: string; }): TParseResult {
|
|
27
|
-
// const addlMetadataText = `${atom}_${classnameIsh}_${nameIsh}_${idIsh}`;
|
|
28
|
-
if (!ib) { throw new Error(`ib required (E: f3883d3ce90c4c15907dffa1c46e77d6)`); }
|
|
29
|
-
const lc = `[${this.parseAddlMetadataString.name}]`;
|
|
30
|
-
try {
|
|
31
|
-
const [atom, classnameIsh, nameIsh, idIsh] = ib.split('_');
|
|
32
|
-
const result = { atom, classnameIsh, nameIsh, idIsh, } as MathKeystoneAddlMetadata;
|
|
33
|
-
return result as TParseResult; // i'm not liking the TParseResult...hmm
|
|
34
|
-
} catch (error) {
|
|
35
|
-
console.error(`${lc} ${error.message}`);
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* this is the primary command handler when extending a keystone, i.e. when
|
|
42
|
-
* signing some payload.
|
|
43
|
-
*/
|
|
44
|
-
protected async extend({
|
|
45
|
-
arg,
|
|
46
|
-
}: {
|
|
47
|
-
arg: MathKeystoneOptionsIbGib,
|
|
48
|
-
}): Promise<MathKeystoneResultIbGib> {
|
|
49
|
-
const lc = `${this.lc}[${this.extend.name}]`;
|
|
50
|
-
try {
|
|
51
|
-
if (logalot) { console.log(`${lc} starting...`); }
|
|
52
|
-
// 1 .look at the specs for the keystone
|
|
53
|
-
// 2. determine requirements for keystone extension
|
|
54
|
-
// * for now, this is just the default (i.e. we skip these steps)
|
|
55
|
-
|
|
56
|
-
let nextChallenges: MathChallengeInfo[] = await this.getNextChallenges({ arg });
|
|
57
|
-
// get the next challenges to solve
|
|
58
|
-
// prompt user (if required) solve challenges
|
|
59
|
-
let nextSolutions: MathSolutionInfo[] = await this.getNextSolutions({ arg, nextChallenges });
|
|
60
|
-
|
|
61
|
-
throw new Error(`not impl (E: 470834fb2562dd33b49b8ec6c9be9423)`);
|
|
62
|
-
|
|
63
|
-
// validate nextSolutions
|
|
64
|
-
// await this.validateNextSolutions({ arg, nextChallenges, nextSolutions });
|
|
65
|
-
|
|
66
|
-
// perform keystone graph extension
|
|
67
|
-
// now that we have solutions
|
|
68
|
-
|
|
69
|
-
} catch (error) {
|
|
70
|
-
console.error(`${lc} ${error.message}`);
|
|
71
|
-
throw error;
|
|
72
|
-
} finally {
|
|
73
|
-
if (logalot) { console.log(`${lc} complete.`); }
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* chooses the next challenge infos in order to extend the keystone
|
|
79
|
-
* timeline.
|
|
80
|
-
*/
|
|
81
|
-
async getNextChallenges({
|
|
82
|
-
arg,
|
|
83
|
-
}: {
|
|
84
|
-
arg: MathKeystoneOptionsIbGib,
|
|
85
|
-
}): Promise<MathChallengeInfo[]> {
|
|
86
|
-
const lc = `${this.lc}[${this.getNextChallenges.name}]`;
|
|
87
|
-
try {
|
|
88
|
-
|
|
89
|
-
if (logalot) { console.log(`${lc} starting... (I: e5cf6a884a093eddc1f297b2a63dd123)`); }
|
|
90
|
-
throw new Error(`not impl (E: 602bdd6bfa38db5acbd798e60c861623)`);
|
|
91
|
-
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.error(`${lc} ${error.message}`);
|
|
94
|
-
throw error;
|
|
95
|
-
} finally {
|
|
96
|
-
if (logalot) { console.log(`${lc} complete.`); }
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
async getNextSolutions({
|
|
101
|
-
arg,
|
|
102
|
-
nextChallenges,
|
|
103
|
-
}: {
|
|
104
|
-
arg: MathKeystoneOptionsIbGib,
|
|
105
|
-
nextChallenges: MathChallengeInfo[],
|
|
106
|
-
}): Promise<MathSolutionInfo[]> {
|
|
107
|
-
const lc = `${this.lc}[${this.getNextSolutions.name}]`;
|
|
108
|
-
try {
|
|
109
|
-
if (logalot) { console.log(`${lc} starting... (I: f77696f021a32ec474de3ebc2c7d7823)`); }
|
|
110
|
-
|
|
111
|
-
throw new Error(`not impl (E: d727a9e378da4ddcb90d0be3a995daeb)`);
|
|
112
|
-
} catch (error) {
|
|
113
|
-
console.error(`${lc} ${error.message}`);
|
|
114
|
-
throw error;
|
|
115
|
-
} finally {
|
|
116
|
-
if (logalot) { console.log(`${lc} complete.`); }
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async validateNextSolutions({
|
|
121
|
-
arg,
|
|
122
|
-
}: {
|
|
123
|
-
arg: MathKeystoneOptionsIbGib,
|
|
124
|
-
}): Promise<string[]> {
|
|
125
|
-
const lc = `${this.lc}[${this.validateNextSolutions.name}]`;
|
|
126
|
-
let errors: string[] = [];
|
|
127
|
-
try {
|
|
128
|
-
if (logalot) { console.log(`${lc} starting... (I: 49fda11783ede527b64bf20e8a9feb23)`); }
|
|
129
|
-
|
|
130
|
-
throw new Error(`not impl (E: 5407f3d0b3d9729ee361a64cd411ea23)`);
|
|
131
|
-
|
|
132
|
-
} catch (error) {
|
|
133
|
-
console.error(`${lc} ${error.message}`);
|
|
134
|
-
throw error;
|
|
135
|
-
} finally {
|
|
136
|
-
if (logalot) { console.log(`${lc} complete.`); }
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import * as pathUtils from 'path';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
firstOfAll, firstOfEach, ifWe, ifWeMight, iReckon,
|
|
5
|
-
lastOfAll, lastOfEach, respecfully, respecfullyDear,
|
|
6
|
-
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
7
|
-
const maam = `[${import.meta.url}]`, sir = maam;
|
|
8
|
-
|
|
9
|
-
import { Gib } from '@ibgib/ts-gib/dist/types.mjs';
|
|
10
|
-
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
11
|
-
|
|
12
|
-
import { KeystoneData_V1, KeystoneIbGib_V1, KeystoneRel8ns_V1 } from '../keystone-types.mjs';
|
|
13
|
-
import { IbGibKeystoneAny } from '../keystone-base-v1.mjs';
|
|
14
|
-
|
|
15
|
-
import { GLOBAL_LOG_A_LOT } from '../../../core-constants.mjs';
|
|
16
|
-
import { WitnessWithContextBase_V1 } from '../../witness-with-context/witness-with-context-base-v1.mjs';
|
|
17
|
-
|
|
18
|
-
const logalot: boolean | number = GLOBAL_LOG_A_LOT;
|
|
19
|
-
|
|
20
|
-
const lcFile: string = `[${pathUtils.basename(import.meta.url)}]`;
|
|
21
|
-
|
|
22
|
-
// #region math mock/test helper functions/types
|
|
23
|
-
|
|
24
|
-
interface MathKeystoneData_V1 extends KeystoneData_V1<any, any> { }
|
|
25
|
-
interface MathKeystoneRel8ns_V1 extends KeystoneRel8ns_V1 { }
|
|
26
|
-
/**
|
|
27
|
-
* this keystone has math problems as its challenges
|
|
28
|
-
*/
|
|
29
|
-
interface MathKeystoneIbGib_V1 extends KeystoneIbGib_V1<MathKeystoneData_V1, MathKeystoneRel8ns_V1> {
|
|
30
|
-
}
|
|
31
|
-
type MathType = "arithmetic";
|
|
32
|
-
interface MathKeystoneAddlMetadata {
|
|
33
|
-
atom: 'keystone_math';
|
|
34
|
-
mathType: MathType;
|
|
35
|
-
tjpGib: Gib;
|
|
36
|
-
}
|
|
37
|
-
export async function createKeystone(): Promise<IbGibKeystoneAny> {
|
|
38
|
-
const lc = `[${createKeystone.name}]`;
|
|
39
|
-
try {
|
|
40
|
-
if (logalot) { console.log(`${lc} starting... (I: ba9c092ad0b19a7fd1c5d98fb27b5923)`); }
|
|
41
|
-
|
|
42
|
-
throw new Error(`not impl (E: db37bc8b249841397316812a006bc223)`);
|
|
43
|
-
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error(`${lc} ${error.message}`);
|
|
46
|
-
throw error;
|
|
47
|
-
} finally {
|
|
48
|
-
if (logalot) { console.log(`${lc} complete.`); }
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* @returns validation error if any, else returns null
|
|
55
|
-
*/
|
|
56
|
-
export async function validateKeystone({
|
|
57
|
-
keystoneLatest,
|
|
58
|
-
}: {
|
|
59
|
-
/**
|
|
60
|
-
* the latest (i.e. "head") keystone in the keystone's timeline.
|
|
61
|
-
*/
|
|
62
|
-
keystoneLatest?: IbGibKeystoneAny,
|
|
63
|
-
/**
|
|
64
|
-
* keystones are a graph, and the idea is
|
|
65
|
-
*/
|
|
66
|
-
dependencyGraph?: { [addr: string]: IbGib_V1 },
|
|
67
|
-
}): Promise<string[] | null> {
|
|
68
|
-
const lc = `[${validateKeystone.name}]`;
|
|
69
|
-
try {
|
|
70
|
-
throw new Error(`not imple yet (E: 2a80e8b2e6934b10a27df67395402c29)`);
|
|
71
|
-
} catch (error) {
|
|
72
|
-
console.error(`${lc} ${error.message}`);
|
|
73
|
-
throw error;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// #endregion math mock/test helper functions/types
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* witness for keystones that have math problems as the challenges.
|
|
81
|
-
*/
|
|
82
|
-
class MathKeystoneWitness_V1
|
|
83
|
-
extends WitnessWithContextBase_V1<
|
|
84
|
-
any, any, any, // options
|
|
85
|
-
any, any, any, // result
|
|
86
|
-
MathKeystoneData_V1, MathKeystoneRel8ns_V1> {
|
|
87
|
-
|
|
88
|
-
protected parseAddlMetadataString<TParseResult>({ ib }: { ib: string; }): TParseResult {
|
|
89
|
-
// const addlMetadataText = `${atom}_${classnameIsh}_${nameIsh}_${idIsh}`;
|
|
90
|
-
if (!ib) { throw new Error(`ib required (E: f3883d3ce90c4c15907dffa1c46e77d6)`); }
|
|
91
|
-
const lc = `[${this.parseAddlMetadataString.name}]`;
|
|
92
|
-
try {
|
|
93
|
-
const [atom, classnameIsh, nameIsh, idIsh] = ib.split('_');
|
|
94
|
-
const result = { atom, classnameIsh, nameIsh, idIsh, } as unknown as MathKeystoneAddlMetadata;
|
|
95
|
-
return result as TParseResult; // i'm not liking the TParseResult...hmm
|
|
96
|
-
} catch (error) {
|
|
97
|
-
console.error(`${lc} ${error.message}`);
|
|
98
|
-
throw error;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
protected witnessImpl(arg: any): Promise<any> {
|
|
102
|
-
throw new Error('Method not implemented.');
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
await respecfully(maam, lcFile, async () => {
|
|
108
|
-
let lc = lcFile.concat();
|
|
109
|
-
|
|
110
|
-
await respecfully(maam, `simple keystones (not composite)`, async () => {
|
|
111
|
-
|
|
112
|
-
await ifWe(maam, `createKeystone`, async () => {
|
|
113
|
-
|
|
114
|
-
});
|
|
115
|
-
await ifWe(maam, `validateKeystone`, async () => { });
|
|
116
|
-
await ifWe(maam, `iterateKeystone`, async () => { });
|
|
117
|
-
await ifWe(maam, `createKeystoneChallenge`, async () => { });
|
|
118
|
-
await ifWe(maam, `createKeystoneChallenge`, async () => { });
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
}, { logalot: !!logalot });
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|