@ibgib/core-gib 0.0.98 → 0.0.99
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/metaspace/metaspace-base.d.mts.map +1 -1
- package/dist/witness/space/metaspace/metaspace-base.mjs +4 -4
- package/dist/witness/space/metaspace/metaspace-base.mjs.map +1 -1
- package/dist/witness/space/space-helper.d.mts.map +1 -1
- package/dist/witness/space/space-helper.mjs +0 -135
- package/dist/witness/space/space-helper.mjs.map +1 -1
- package/package.json +1 -1
- package/src/witness/space/metaspace/metaspace-base.mts +4 -4
- package/src/witness/space/space-helper.mts +0 -145
|
@@ -493,151 +493,6 @@ export async function getSpecialIbGib({
|
|
|
493
493
|
return null;
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
// /**
|
|
497
|
-
// * Gets one of the app's special ibGibs, e.g., TagsIbGib.
|
|
498
|
-
// *
|
|
499
|
-
// * When initializing tags, this will generate some boilerplate tags.
|
|
500
|
-
// * I'm going to be doing roots here also, and who knows what else, but each
|
|
501
|
-
// * one will have its own initialize specifics.
|
|
502
|
-
// *
|
|
503
|
-
// * @param initialize initialize (i.e. create) ONLY IF IbGib not found. Used for initializing app (first run).
|
|
504
|
-
// *
|
|
505
|
-
// * @see {@link createSpecial}
|
|
506
|
-
// * @see {@link createSpecial_Tags}
|
|
507
|
-
// */
|
|
508
|
-
// export async function getSpecialIbGib_latest({
|
|
509
|
-
// type,
|
|
510
|
-
// initialize,
|
|
511
|
-
// space,
|
|
512
|
-
// zeroSpace,
|
|
513
|
-
// fnUpdateBootstrap,
|
|
514
|
-
// fnBroadcast,
|
|
515
|
-
// fnGetInitializing,
|
|
516
|
-
// fnSetInitializing,
|
|
517
|
-
// }: {
|
|
518
|
-
// type: SpecialIbGibType,
|
|
519
|
-
// initialize?: boolean,
|
|
520
|
-
// space: IbGibSpaceAny,
|
|
521
|
-
// /**
|
|
522
|
-
// * Only required if `initialize` is true.
|
|
523
|
-
// */
|
|
524
|
-
// zeroSpace?: IbGibSpaceAny,
|
|
525
|
-
// /**
|
|
526
|
-
// * Only required if `initialize` is true.
|
|
527
|
-
// */
|
|
528
|
-
// fnUpdateBootstrap?: (newSpace: IbGibSpaceAny) => Promise<void>,
|
|
529
|
-
// /**
|
|
530
|
-
// * Only required if `initialize` is true.
|
|
531
|
-
// */
|
|
532
|
-
// fnBroadcast?: (info: IbGibTimelineUpdateInfo) => void,
|
|
533
|
-
// /**
|
|
534
|
-
// * Initialization lock getter function.
|
|
535
|
-
// */
|
|
536
|
-
// fnGetInitializing?: () => boolean,
|
|
537
|
-
// /**
|
|
538
|
-
// * Initialization lock setter function.
|
|
539
|
-
// *
|
|
540
|
-
// * Because we don't want to initialize while we're initializing.
|
|
541
|
-
// */
|
|
542
|
-
// fnSetInitializing?: (x: boolean) => void,
|
|
543
|
-
// }): Promise<IbGib_V1 | null> {
|
|
544
|
-
// const lc = `[${getSpecialIbGib.name}]`;
|
|
545
|
-
// try {
|
|
546
|
-
// if (!space) { throw new Error(`space required. (E: d454b31d58764a9bb9c4e47fb5ef38b5)`); }
|
|
547
|
-
|
|
548
|
-
// // the addr is going to be a constant. but we want to check in config to see if
|
|
549
|
-
// // it has been initialized
|
|
550
|
-
|
|
551
|
-
// let key = getSpecialConfigKey({ type });
|
|
552
|
-
// let addr = await getConfigAddr({ key, space });
|
|
553
|
-
|
|
554
|
-
// if (!addr) {
|
|
555
|
-
// if (initialize && (!fnGetInitializing || !fnSetInitializing)) { throw new Error(`if initialize, you must provide fnGetInitializeLock & fnSetInitializeLock. (E: 8eb322625d0c4538be089800882487de)`); }
|
|
556
|
-
// if (initialize && !fnGetInitializing!()) {
|
|
557
|
-
// fnSetInitializing!(true);
|
|
558
|
-
// try {
|
|
559
|
-
// if (!zeroSpace) { throw new Error(`zeroSpace required when 'initialize' truthy (E: 8582c92c637f90c9b2dbe0ec8355b523)`); }
|
|
560
|
-
// addr = await createSpecial({ type, space, zeroSpace: zeroSpace!, fnBroadcast, fnUpdateBootstrap }) ?? undefined;
|
|
561
|
-
// } catch (error) {
|
|
562
|
-
// console.error(`${lc} error initializing: ${error.message}`);
|
|
563
|
-
// } finally {
|
|
564
|
-
// fnSetInitializing!(false);
|
|
565
|
-
// }
|
|
566
|
-
// }
|
|
567
|
-
// if (!addr) {
|
|
568
|
-
// if (fnGetInitializing && fnGetInitializing()) {
|
|
569
|
-
// console.warn(`${lc} couldn't get addr, but we're still initializing...`);
|
|
570
|
-
// return null;
|
|
571
|
-
// } else {
|
|
572
|
-
// throw new Error(`Special address not in config and couldn't initialize it either.`);
|
|
573
|
-
// }
|
|
574
|
-
// }
|
|
575
|
-
// }
|
|
576
|
-
|
|
577
|
-
// if (logalot) { console.log(`${lc} getting addr: ${addr}`); }
|
|
578
|
-
|
|
579
|
-
// if (type === "latest") {
|
|
580
|
-
// // getting the latest index is special, even for special ibgibs...
|
|
581
|
-
// let resSpecial = await getFromSpace({ addr, space });
|
|
582
|
-
|
|
583
|
-
// // I'm putting in this check in case we're getting a meta that wasn't
|
|
584
|
-
// // saved into the meta folder.
|
|
585
|
-
// if (!resSpecial.success) {
|
|
586
|
-
// resSpecial = await getFromSpace({ addr, space });
|
|
587
|
-
// if (resSpecial.success) {
|
|
588
|
-
// console.warn(`${lc} special ibgib was not stored in meta folder...putting in meta folder now for the future (W: e6f5571fd98c449bb2809359be5057cc)`);
|
|
589
|
-
// const resPutInMeta = await putInSpace({ ibGib: resSpecial!.ibGibs![0], space });
|
|
590
|
-
// if (!resPutInMeta.success) {
|
|
591
|
-
// console.warn(`${lc} (UNEXPECTED) tried to put special in meta but success was false? (W: b934b53571c24057af172c790e6a7240)`)
|
|
592
|
-
// }
|
|
593
|
-
// }
|
|
594
|
-
// }
|
|
595
|
-
// if (!resSpecial.success) {
|
|
596
|
-
// // haven't found via the punctiliar address. revert to the
|
|
597
|
-
// }
|
|
598
|
-
// if (!resSpecial.success) { throw new Error(resSpecial.errorMsg); }
|
|
599
|
-
// if (resSpecial.ibGibs?.length !== 1) { throw new Error(`no ibGib in result (E: 3a42abdddc3648e292d63dc45c560064)`); }
|
|
600
|
-
// const specialIbGib = resSpecial.ibGibs[0];
|
|
601
|
-
|
|
602
|
-
// } else {
|
|
603
|
-
// let resSpecial = await getFromSpace({ addr, space });
|
|
604
|
-
|
|
605
|
-
// // I'm putting in this check in case we're getting a meta that wasn't
|
|
606
|
-
// // saved into the meta folder.
|
|
607
|
-
// if (!resSpecial.success) {
|
|
608
|
-
// resSpecial = await getFromSpace({ addr, space });
|
|
609
|
-
// if (resSpecial.success) {
|
|
610
|
-
// console.warn(`${lc} special ibgib was not stored in meta folder...putting in meta folder now for the future (W: e6f5571fd98c449bb2809359be5057cc)`);
|
|
611
|
-
// const resPutInMeta = await putInSpace({ ibGib: resSpecial!.ibGibs![0], space });
|
|
612
|
-
// if (!resPutInMeta.success) {
|
|
613
|
-
// console.warn(`${lc} (UNEXPECTED) tried to put special in meta but success was false? (W: b934b53571c24057af172c790e6a7240)`)
|
|
614
|
-
// }
|
|
615
|
-
// }
|
|
616
|
-
// }
|
|
617
|
-
// if (!resSpecial.success) { throw new Error(resSpecial.errorMsg); }
|
|
618
|
-
// if (resSpecial.ibGibs?.length !== 1) { throw new Error(`no ibGib in result (E: 3a42abdddc3648e292d63dc45c560064)`); }
|
|
619
|
-
// const specialIbGib = resSpecial.ibGibs[0];
|
|
620
|
-
|
|
621
|
-
// // I'm putting this check in here because it's bad not to have the
|
|
622
|
-
// // latest special associated with a space
|
|
623
|
-
// // if (type !== 'latest') {
|
|
624
|
-
// let resLatest = await getLatestAddrs({ ibGibs: [specialIbGib], space });
|
|
625
|
-
// if (resLatest?.data?.success && resLatest.data.addrs?.length === 1) {
|
|
626
|
-
// let specialAddr = getIbGibAddr({ ibGib: specialIbGib });
|
|
627
|
-
// let latestAddr = resLatest.data.addrs[0];
|
|
628
|
-
// if (latestAddr !== specialAddr) {
|
|
629
|
-
// console.warn(`${lc} latest addr is not the one associated with the local space.\nspecialAddr: ${specialAddr}\nlatestAddr: ${latestAddr} (W: 141b69dc3c414efc9645bb76fcf12df9)`)
|
|
630
|
-
// }
|
|
631
|
-
// }
|
|
632
|
-
// // }
|
|
633
|
-
// }
|
|
634
|
-
|
|
635
|
-
// return specialIbGib;
|
|
636
|
-
// } catch (error) {
|
|
637
|
-
// console.error(`${lc} ${error.message}`);
|
|
638
|
-
// return null;
|
|
639
|
-
// }
|
|
640
|
-
// }
|
|
641
496
|
|
|
642
497
|
/**
|
|
643
498
|
* Gets a config addr from the current space via the given key
|