@ibgib/space-gib 0.0.22 → 0.0.23
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/client/PRIVACY_POLICY.md +144 -0
- package/dist/client/bootstrap.mjs +36 -43
- package/dist/client/chunk-7LVERIWN.mjs +8 -0
- package/dist/client/chunk-JT6UUKP5.mjs +27 -0
- package/dist/client/{chunk-O6EUMDNJ.mjs → chunk-PJDAAEMZ.mjs} +339 -49
- package/dist/client/index.html +1 -1
- package/dist/client/index.mjs +40 -40
- package/dist/client/script.mjs +1 -1
- package/dist/server/server.mjs +100 -91
- package/generate-privacy-html.js +5 -0
- package/package.json +6 -6
- package/src/client/AUTO-GENERATED-version.mts +1 -1
- package/src/client/PRIVACY_POLICY.md +144 -0
- package/src/client/bootstrap.mts +1 -1
- package/src/client/dev-tools/vcs-workspace.mts +16 -4
- package/src/client/index.html +1 -1
- package/src/client/ui/shell/space-gib-shell-service.mts +61 -11
- package/src/server/server.mts +1 -1
- package/dist/client/chunk-772Z4Q4C.mjs +0 -1
- package/dist/client/chunk-XZM4L3U6.mjs +0 -25
package/dist/server/server.mjs
CHANGED
|
@@ -4562,6 +4562,9 @@ async function registerNewIbGib({ ibGib, space, fnBroadcast }) {
|
|
|
4562
4562
|
const existingLatestHasNCounter = typeof existingLatestIbGib.data?.n === "number" && existingLatestIbGib.data.n >= 0;
|
|
4563
4563
|
if (existingLatestHasNCounter) {
|
|
4564
4564
|
const n_existingLatest = existingLatestIbGib.data.n;
|
|
4565
|
+
if (logalot8) {
|
|
4566
|
+
console.log(`[registerNewIbGib] n_ibGib (${n_ibGib}) vs n_existingLatest (${n_existingLatest}) in space: ${space.data?.name || space.ib}`);
|
|
4567
|
+
}
|
|
4565
4568
|
if (n_ibGib > n_existingLatest) {
|
|
4566
4569
|
if (logalot8) {
|
|
4567
4570
|
console.log(`${lc2} is newer (I: 040d05ac2032f08c7fd0c4d8b2887323)`);
|
|
@@ -5541,6 +5544,12 @@ async function getLocalSpace({ zeroSpace, bootstrapIbGib, localSpaceId, lock, ca
|
|
|
5541
5544
|
throw new Error(`(UNEXPECTED) bootstrapIbGib.data required. invalid bootstrap? (E: 568c6b837c1a39f7a25d188a90167423)`);
|
|
5542
5545
|
}
|
|
5543
5546
|
localSpaceId = localSpaceId ?? bootstrapIbGib.data[BOOTSTRAP_DATA_DEFAULT_SPACE_ID_KEY];
|
|
5547
|
+
if (!bootstrapIbGib.rel8ns) {
|
|
5548
|
+
throw new Error(`(UNEXPECTED) bootstrapIbGib.rel8ns falsy? it should have been validated by now. (E: 817d9a2a0b98ec0c177cd7ab149b9426)`);
|
|
5549
|
+
}
|
|
5550
|
+
if (!bootstrapIbGib.rel8ns[localSpaceId]) {
|
|
5551
|
+
throw new Error(`localSpaceId (${localSpaceId}) not found in bootstrapIbGib.rel8ns (E: 8869884093984ec43f942fea24bd9926)`);
|
|
5552
|
+
}
|
|
5544
5553
|
const localSpaceAddr = bootstrapIbGib.rel8ns[localSpaceId][0];
|
|
5545
5554
|
const fnGet = async () => {
|
|
5546
5555
|
const argGet = await zeroSpace.argy({
|
|
@@ -6224,10 +6233,10 @@ async function getRel8dIbGibs({ ibGib, rel8nNames, space }) {
|
|
|
6224
6233
|
const lc2 = `[${getRel8dIbGibs.name}]`;
|
|
6225
6234
|
try {
|
|
6226
6235
|
if (!ibGib) {
|
|
6227
|
-
throw new Error(`ibGib required (E:
|
|
6236
|
+
throw new Error(`ibGib required (E: genuuid)`);
|
|
6228
6237
|
}
|
|
6229
6238
|
if (!space) {
|
|
6230
|
-
throw new Error(`space required (E:
|
|
6239
|
+
throw new Error(`space required (E: genuuid)`);
|
|
6231
6240
|
}
|
|
6232
6241
|
if (!rel8nNames) {
|
|
6233
6242
|
rel8nNames = Object.keys(ibGib.rel8ns || {});
|
|
@@ -6240,7 +6249,7 @@ async function getRel8dIbGibs({ ibGib, rel8nNames, space }) {
|
|
|
6240
6249
|
if (resGet.success && resGet.ibGibs?.length === rel8dAddrs.length) {
|
|
6241
6250
|
rel8dIbGibs[rel8nName] = resGet.ibGibs.concat();
|
|
6242
6251
|
} else {
|
|
6243
|
-
throw new Error(`Problem getting rel8d ibgibs for rel8nName: ${rel8nName}. ${resGet.errorMsg || "Unknown error"} (E:
|
|
6252
|
+
throw new Error(`Problem getting rel8d ibgibs for rel8nName: ${rel8nName}. ${resGet.errorMsg || "Unknown error"} (E: genuuid)`);
|
|
6244
6253
|
}
|
|
6245
6254
|
} else {
|
|
6246
6255
|
rel8dIbGibs[rel8nName] = [];
|
|
@@ -17490,7 +17499,7 @@ var KEYSTONE_CONFIG_DEFAULT_HASH_ALGORITHM_HIGHSECURITY = HashAlgorithm.sha_512;
|
|
|
17490
17499
|
var KEYSTONE_CHECKPOINT_FREQUENCY = 50;
|
|
17491
17500
|
|
|
17492
17501
|
// ../../libs/node-gib/dist/serve-gib/identity-index/identity-index-helpers.mjs
|
|
17493
|
-
var logalot37 = GLOBAL_LOG_A_LOT2
|
|
17502
|
+
var logalot37 = GLOBAL_LOG_A_LOT2;
|
|
17494
17503
|
function validateEmail({ email }) {
|
|
17495
17504
|
const errors = [];
|
|
17496
17505
|
if (!email || typeof email !== "string") {
|
|
@@ -17554,7 +17563,7 @@ function getShardedIndexPath({ baseDir, emailHash }) {
|
|
|
17554
17563
|
// ../../libs/node-gib/dist/serve-gib/identity-index/identity-index-service.mjs
|
|
17555
17564
|
import * as fs from "fs/promises";
|
|
17556
17565
|
import * as path3 from "path";
|
|
17557
|
-
var logalot38 = GLOBAL_LOG_A_LOT2
|
|
17566
|
+
var logalot38 = GLOBAL_LOG_A_LOT2;
|
|
17558
17567
|
var IdentityIndexService = class _IdentityIndexService {
|
|
17559
17568
|
lc = `[${_IdentityIndexService.name}]`;
|
|
17560
17569
|
baseDir;
|
|
@@ -19085,10 +19094,10 @@ var KeystoneProfileBuilder = class _KeystoneProfileBuilder {
|
|
|
19085
19094
|
*/
|
|
19086
19095
|
static registerCustomProfile({ name, template }) {
|
|
19087
19096
|
if (!name || typeof name !== "string") {
|
|
19088
|
-
throw new Error(`Profile name is required to register a custom profile. (E:
|
|
19097
|
+
throw new Error(`Profile name is required to register a custom profile. (E: genuuid)`);
|
|
19089
19098
|
}
|
|
19090
19099
|
if (!template || typeof template !== "object") {
|
|
19091
|
-
throw new Error(`Valid KeystonePolicyConfigTemplate is required to register custom profile '${name}'. (E:
|
|
19100
|
+
throw new Error(`Valid KeystonePolicyConfigTemplate is required to register custom profile '${name}'. (E: genuuid)`);
|
|
19092
19101
|
}
|
|
19093
19102
|
_customProfiles.set(name, JSON.parse(JSON.stringify(template)));
|
|
19094
19103
|
}
|
|
@@ -19103,17 +19112,17 @@ var KeystoneProfileBuilder = class _KeystoneProfileBuilder {
|
|
|
19103
19112
|
*/
|
|
19104
19113
|
static fromTemplate(template) {
|
|
19105
19114
|
if (!template || typeof template !== "object") {
|
|
19106
|
-
throw new Error(`Valid KeystonePolicyConfigTemplate is required for KeystoneProfileBuilder.fromTemplate. (E:
|
|
19115
|
+
throw new Error(`Valid KeystonePolicyConfigTemplate is required for KeystoneProfileBuilder.fromTemplate. (E: genuuid)`);
|
|
19107
19116
|
}
|
|
19108
19117
|
return new _KeystoneProfileBuilder(template);
|
|
19109
19118
|
}
|
|
19110
19119
|
static buildKeystone(profileName) {
|
|
19111
19120
|
if (!profileName || typeof profileName !== "string") {
|
|
19112
|
-
throw new Error(`Profile name is required for KeystoneProfileBuilder. (E:
|
|
19121
|
+
throw new Error(`Profile name is required for KeystoneProfileBuilder. (E: genuuid)`);
|
|
19113
19122
|
}
|
|
19114
19123
|
const isDevProfile = profileName.endsWith(".dev") || profileName.startsWith("test") || profileName.includes("test");
|
|
19115
19124
|
if (isDevProfile) {
|
|
19116
|
-
throw new Error(`Security Violation: Development keystone profile '${profileName}' is prohibited when NODE_ENV=production. (E:
|
|
19125
|
+
throw new Error(`Security Violation: Development keystone profile '${profileName}' is prohibited when NODE_ENV=production. (E: genuuid)`);
|
|
19117
19126
|
}
|
|
19118
19127
|
if (_customProfiles.has(profileName)) {
|
|
19119
19128
|
return new _KeystoneProfileBuilder(_customProfiles.get(profileName));
|
|
@@ -19671,13 +19680,13 @@ async function solveAndReplenish({ targetPoolId, prevPools, masterSecret, challe
|
|
|
19671
19680
|
}
|
|
19672
19681
|
const pool = prevPools.find((p) => p.id === targetPoolId);
|
|
19673
19682
|
if (!pool) {
|
|
19674
|
-
throw new Error(`Target pool not found: ${targetPoolId} (E:
|
|
19683
|
+
throw new Error(`Target pool not found: ${targetPoolId} (E: genuuid)`);
|
|
19675
19684
|
}
|
|
19676
19685
|
const strategy = KeystoneStrategyFactory.create({ config: pool.config });
|
|
19677
19686
|
const poolSecret = await strategy.derivePoolSecret({ masterSecret });
|
|
19678
19687
|
const isSecretCorrect = await verifyPoolSecret({ pool, signingSecret: masterSecret });
|
|
19679
19688
|
if (!isSecretCorrect) {
|
|
19680
|
-
throw new Error(`Crypto Violation: Invalid signing secret for pool: ${pool.id} (E:
|
|
19689
|
+
throw new Error(`Crypto Violation: Invalid signing secret for pool: ${pool.id} (E: genuuid)`);
|
|
19681
19690
|
}
|
|
19682
19691
|
const solutions = [];
|
|
19683
19692
|
for (const id of challengeIds) {
|
|
@@ -20644,7 +20653,7 @@ var KeystoneService_V1 = class _KeystoneService_V1 {
|
|
|
20644
20653
|
console.log(`${lc2} starting...`);
|
|
20645
20654
|
}
|
|
20646
20655
|
if (!signingPoolId) {
|
|
20647
|
-
throw new Error(`signingPoolId is required (E:
|
|
20656
|
+
throw new Error(`signingPoolId is required (E: genuuid)`);
|
|
20648
20657
|
}
|
|
20649
20658
|
const validationErrors = await validateKeystoneGraph({
|
|
20650
20659
|
keystoneIbGib: delegateKeystone,
|
|
@@ -21013,7 +21022,7 @@ var KeystoneService_V1 = class _KeystoneService_V1 {
|
|
|
21013
21022
|
const existingIds = new Set(replenishedExistingPools.map((p) => p.id));
|
|
21014
21023
|
for (const newPool of newPools) {
|
|
21015
21024
|
if (existingIds.has(newPool.id)) {
|
|
21016
|
-
throw new Error(`Cannot add pool. ID collision: ${newPool.id} (E:
|
|
21025
|
+
throw new Error(`Cannot add pool. ID collision: ${newPool.id} (E: genuuid)`);
|
|
21017
21026
|
}
|
|
21018
21027
|
}
|
|
21019
21028
|
const finalPools = [...replenishedExistingPools, ...newPools];
|
|
@@ -21111,7 +21120,7 @@ var KeystoneService_V1 = class _KeystoneService_V1 {
|
|
|
21111
21120
|
const finalPools = replenishedExistingPools.filter((p) => !removeSet.has(p.id));
|
|
21112
21121
|
if (finalPools.length !== replenishedExistingPools.length - poolIds.length) {
|
|
21113
21122
|
const missingIds = poolIds.filter((id) => !replenishedExistingPools.some((p) => p.id === id));
|
|
21114
|
-
throw new Error(`Cannot remove pool. Pool IDs not found in keystone: ${missingIds.join(", ")} (E:
|
|
21123
|
+
throw new Error(`Cannot remove pool. Pool IDs not found in keystone: ${missingIds.join(", ")} (E: genuuid)`);
|
|
21115
21124
|
}
|
|
21116
21125
|
const n = (prevData.n ?? 0) + 1;
|
|
21117
21126
|
let checkpointDetails;
|
|
@@ -21633,14 +21642,14 @@ var EmailSenderBase = class {
|
|
|
21633
21642
|
*/
|
|
21634
21643
|
validateOutboundEmail(email) {
|
|
21635
21644
|
if (!email) {
|
|
21636
|
-
throw new Error("OutboundEmail is required. (E:
|
|
21645
|
+
throw new Error("OutboundEmail is required. (E: genuuid)");
|
|
21637
21646
|
}
|
|
21638
21647
|
const fromParsed = parseEmailAddress(email.from);
|
|
21639
21648
|
if (!fromParsed.address || !validateEmail3(fromParsed.address)) {
|
|
21640
|
-
throw new Error(`Invalid "from" email address: ${fromParsed.address} (E:
|
|
21649
|
+
throw new Error(`Invalid "from" email address: ${fromParsed.address} (E: genuuid)`);
|
|
21641
21650
|
}
|
|
21642
21651
|
if (!email.to || !Array.isArray(email.to) || email.to.length === 0) {
|
|
21643
|
-
throw new Error('Outbound email must contain at least one recipient in "to". (E:
|
|
21652
|
+
throw new Error('Outbound email must contain at least one recipient in "to". (E: genuuid)');
|
|
21644
21653
|
}
|
|
21645
21654
|
for (const recipient of email.to) {
|
|
21646
21655
|
const parsed = parseEmailAddress(recipient);
|
|
@@ -21750,7 +21759,7 @@ var EmailSenderAws = class extends EmailSenderBase {
|
|
|
21750
21759
|
constructor(options) {
|
|
21751
21760
|
super();
|
|
21752
21761
|
if (!options.accessKeyId || !options.secretAccessKey) {
|
|
21753
|
-
throw new Error("EmailSenderAws requires accessKeyId and secretAccessKey. (E:
|
|
21762
|
+
throw new Error("EmailSenderAws requires accessKeyId and secretAccessKey. (E: genuuid)");
|
|
21754
21763
|
}
|
|
21755
21764
|
this.accessKeyId = options.accessKeyId;
|
|
21756
21765
|
this.secretAccessKey = options.secretAccessKey;
|
|
@@ -21956,7 +21965,7 @@ async function savePendingCodeRecord({ pendingDir, code, maxAttempts = 5, ttlMs
|
|
|
21956
21965
|
function createDefaultEmailSender() {
|
|
21957
21966
|
const rawMode = process.env.EMAIL_MODE;
|
|
21958
21967
|
if (!rawMode || !rawMode.trim()) {
|
|
21959
|
-
throw new Error('EMAIL_MODE environment variable is missing. Expected "aws" or "mock". (E:
|
|
21968
|
+
throw new Error('EMAIL_MODE environment variable is missing. Expected "aws" or "mock". (E: genuuid)');
|
|
21960
21969
|
}
|
|
21961
21970
|
const mode = rawMode.trim().toLowerCase();
|
|
21962
21971
|
const isProd = true;
|
|
@@ -21964,7 +21973,7 @@ function createDefaultEmailSender() {
|
|
|
21964
21973
|
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
|
|
21965
21974
|
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
|
|
21966
21975
|
if (!accessKeyId || !secretAccessKey) {
|
|
21967
|
-
throw new Error("EMAIL_MODE=aws requires AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables. (E:
|
|
21976
|
+
throw new Error("EMAIL_MODE=aws requires AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables. (E: genuuid)");
|
|
21968
21977
|
}
|
|
21969
21978
|
return new EmailSenderAws({
|
|
21970
21979
|
accessKeyId,
|
|
@@ -21973,11 +21982,11 @@ function createDefaultEmailSender() {
|
|
|
21973
21982
|
});
|
|
21974
21983
|
} else if (mode === "mock") {
|
|
21975
21984
|
if (isProd) {
|
|
21976
|
-
throw new Error("EMAIL_MODE=mock is prohibited when NODE_ENV=production. (E:
|
|
21985
|
+
throw new Error("EMAIL_MODE=mock is prohibited when NODE_ENV=production. (E: genuuid)");
|
|
21977
21986
|
}
|
|
21978
21987
|
return new EmailSenderMock();
|
|
21979
21988
|
} else {
|
|
21980
|
-
throw new Error(`Unsupported EMAIL_MODE '${mode}'. Must be 'aws' or 'mock'. (E:
|
|
21989
|
+
throw new Error(`Unsupported EMAIL_MODE '${mode}'. Must be 'aws' or 'mock'. (E: genuuid)`);
|
|
21981
21990
|
}
|
|
21982
21991
|
}
|
|
21983
21992
|
async function dispatchVerificationCode({ email, primaryTjpAddr, pendingDir, sender }) {
|
|
@@ -22068,7 +22077,7 @@ async function getPendingStagingDir({ dataDir, tjpHash }) {
|
|
|
22068
22077
|
}
|
|
22069
22078
|
|
|
22070
22079
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/keystone/keystone-genesis.handler.mjs
|
|
22071
|
-
var logalot47 = GLOBAL_LOG_A_LOT
|
|
22080
|
+
var logalot47 = GLOBAL_LOG_A_LOT;
|
|
22072
22081
|
var KeystoneGenesisHandler = class _KeystoneGenesisHandler extends ServeGibHandlerBase {
|
|
22073
22082
|
lc = `[${_KeystoneGenesisHandler.name}]`;
|
|
22074
22083
|
method = "POST";
|
|
@@ -22161,7 +22170,7 @@ var KeystoneGenesisHandler = class _KeystoneGenesisHandler extends ServeGibHandl
|
|
|
22161
22170
|
}
|
|
22162
22171
|
const space = await metaspace.getLocalUserSpace({ lock: false });
|
|
22163
22172
|
if (!space) {
|
|
22164
|
-
throw new Error(`(UNEXPECTED) Could not get local user space after bootstrapping domain for ${addr} (E:
|
|
22173
|
+
throw new Error(`(UNEXPECTED) Could not get local user space after bootstrapping domain for ${addr} (E: genuuid)`);
|
|
22165
22174
|
}
|
|
22166
22175
|
await metaspace.put({ ibGibs: [keystoneIbGib], space });
|
|
22167
22176
|
await metaspace.registerNewIbGib({ ibGib: keystoneIbGib, space });
|
|
@@ -22624,7 +22633,7 @@ function loadSsoServerConfig() {
|
|
|
22624
22633
|
|
|
22625
22634
|
// ../../libs/node-gib/dist/identity/sso/sso-custodian-service.mjs
|
|
22626
22635
|
import { createPublicKey, verify } from "node:crypto";
|
|
22627
|
-
var logalot49 = GLOBAL_LOG_A_LOT
|
|
22636
|
+
var logalot49 = GLOBAL_LOG_A_LOT;
|
|
22628
22637
|
var SsoCustodianService = class _SsoCustodianService {
|
|
22629
22638
|
config;
|
|
22630
22639
|
lc = `[${_SsoCustodianService.name}]`;
|
|
@@ -22955,14 +22964,14 @@ var SsoCustodianService = class _SsoCustodianService {
|
|
|
22955
22964
|
space
|
|
22956
22965
|
});
|
|
22957
22966
|
if (!targetKeystone) {
|
|
22958
|
-
throw new Error(`Keystone not found for address: ${keystoneAddr} (E:
|
|
22967
|
+
throw new Error(`Keystone not found for address: ${keystoneAddr} (E: genuuid)`);
|
|
22959
22968
|
}
|
|
22960
22969
|
const userManagePool = targetKeystone.data?.challengePools.find((p) => p.id === POOL_ID_MANAGE);
|
|
22961
22970
|
if (!userManagePool) {
|
|
22962
|
-
throw new Error(`Keystone manage pool not found. Custodian manage pool must match the user manage pool's security config. (E:
|
|
22971
|
+
throw new Error(`Keystone manage pool not found. Custodian manage pool must match the user manage pool's security config. (E: genuuid)`);
|
|
22963
22972
|
}
|
|
22964
22973
|
if (!providerId || !KEYSTONE_POOL_ID_REGEXP.test(providerId)) {
|
|
22965
|
-
throw new Error(`Invalid providerId: "${providerId}". Must match ${KEYSTONE_POOL_ID_REGEXP} (E:
|
|
22974
|
+
throw new Error(`Invalid providerId: "${providerId}". Must match ${KEYSTONE_POOL_ID_REGEXP} (E: genuuid)`);
|
|
22966
22975
|
}
|
|
22967
22976
|
const poolId = `custodian-manage-${providerId}`;
|
|
22968
22977
|
const custodianSecret = await this.deriveServerDelegateSecret(providerKey, userNonce);
|
|
@@ -23438,7 +23447,7 @@ var KeystoneGetHandler = class _KeystoneGetHandler extends ServeGibHandlerWithMe
|
|
|
23438
23447
|
};
|
|
23439
23448
|
|
|
23440
23449
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/keystone/keystone-lookup.handler.mjs
|
|
23441
|
-
var logalot53 = GLOBAL_LOG_A_LOT2
|
|
23450
|
+
var logalot53 = GLOBAL_LOG_A_LOT2;
|
|
23442
23451
|
var KeystoneLookupHandler = class _KeystoneLookupHandler extends ServeGibHandlerBase {
|
|
23443
23452
|
lc = `[${_KeystoneLookupHandler.name}]`;
|
|
23444
23453
|
method = "POST";
|
|
@@ -23591,7 +23600,7 @@ async function deriveCustodianAuthCode({ custodianReqsOmitAuthCode, serverSecret
|
|
|
23591
23600
|
const lc2 = `[${deriveCustodianAuthCode.name}]`;
|
|
23592
23601
|
try {
|
|
23593
23602
|
if (!serverSecret) {
|
|
23594
|
-
throw new Error("serverSecret required for custodian auth code derivation (E:
|
|
23603
|
+
throw new Error("serverSecret required for custodian auth code derivation (E: genuuid)");
|
|
23595
23604
|
}
|
|
23596
23605
|
const salt = await hash({
|
|
23597
23606
|
s: JSON.stringify(custodianReqsOmitAuthCode),
|
|
@@ -23667,7 +23676,7 @@ async function verifyCustodianRequirements({ custodianReqs, serverSecret }) {
|
|
|
23667
23676
|
}
|
|
23668
23677
|
|
|
23669
23678
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/keystone/sso-link.handler.mjs
|
|
23670
|
-
var logalot55 = GLOBAL_LOG_A_LOT
|
|
23679
|
+
var logalot55 = GLOBAL_LOG_A_LOT;
|
|
23671
23680
|
var SsoLinkHandler = class _SsoLinkHandler extends ServeGibHandlerWithMetaspaceBase {
|
|
23672
23681
|
lc = `[${_SsoLinkHandler.name}]`;
|
|
23673
23682
|
method = "POST";
|
|
@@ -23713,23 +23722,23 @@ var SsoLinkHandler = class _SsoLinkHandler extends ServeGibHandlerWithMetaspaceB
|
|
|
23713
23722
|
const lc2 = `${this.lc}[${this.handleRouteImpl.name}]`;
|
|
23714
23723
|
try {
|
|
23715
23724
|
if (logalot55) {
|
|
23716
|
-
console.log(`${lc2} starting... (I:
|
|
23725
|
+
console.log(`${lc2} starting... (I: genuuid)`);
|
|
23717
23726
|
}
|
|
23718
23727
|
if (!reqCtx.params) {
|
|
23719
|
-
return this.error(400, "Invalid parameters: parentTjpAddr missing (E:
|
|
23728
|
+
return this.error(400, "Invalid parameters: parentTjpAddr missing (E: genuuid)");
|
|
23720
23729
|
}
|
|
23721
23730
|
if (!reqCtx.metaspace) {
|
|
23722
|
-
return this.error(500, "Metaspace not initialized (E:
|
|
23731
|
+
return this.error(500, "Metaspace not initialized (E: genuuid)");
|
|
23723
23732
|
}
|
|
23724
23733
|
let parsed;
|
|
23725
23734
|
try {
|
|
23726
23735
|
parsed = JSON.parse(reqCtx.body);
|
|
23727
23736
|
} catch {
|
|
23728
|
-
return this.error(400, "Request body must be valid JSON (E:
|
|
23737
|
+
return this.error(400, "Request body must be valid JSON (E: genuuid)");
|
|
23729
23738
|
}
|
|
23730
23739
|
let { code, providerId, parentTjpAddr, userNonce, redirectUri } = parsed;
|
|
23731
23740
|
if (!code || !providerId || !parentTjpAddr || !userNonce || !redirectUri) {
|
|
23732
|
-
return this.error(400, "Body missing required parameters (code, providerId, parentTjpAddr, userNonce, redirectUri) (E:
|
|
23741
|
+
return this.error(400, "Body missing required parameters (code, providerId, parentTjpAddr, userNonce, redirectUri) (E: genuuid)");
|
|
23733
23742
|
}
|
|
23734
23743
|
if (logalot55) {
|
|
23735
23744
|
console.log(`${lc2} LinkBody parsed (I: 7525b8bd29c8504e989e918825d4e826)`);
|
|
@@ -23826,19 +23835,19 @@ var SsoLoginHandler = class _SsoLoginHandler extends ServeGibHandlerBase {
|
|
|
23826
23835
|
const lc2 = `${this.lc}[${this.handleRouteImpl.name}]`;
|
|
23827
23836
|
try {
|
|
23828
23837
|
if (logalot56) {
|
|
23829
|
-
console.log(`${lc2} starting... (I:
|
|
23838
|
+
console.log(`${lc2} starting... (I: genuuid)`);
|
|
23830
23839
|
}
|
|
23831
23840
|
if (reqCtx.method !== "POST") {
|
|
23832
23841
|
return this.error(405, "Method Not Allowed");
|
|
23833
23842
|
}
|
|
23834
23843
|
if (!reqCtx.body) {
|
|
23835
|
-
return this.error(400, "Request body is empty (E:
|
|
23844
|
+
return this.error(400, "Request body is empty (E: genuuid)");
|
|
23836
23845
|
}
|
|
23837
23846
|
let parsed;
|
|
23838
23847
|
try {
|
|
23839
23848
|
parsed = JSON.parse(reqCtx.body);
|
|
23840
23849
|
} catch {
|
|
23841
|
-
return this.error(400, "Request body must be valid JSON (E:
|
|
23850
|
+
return this.error(400, "Request body must be valid JSON (E: genuuid)");
|
|
23842
23851
|
}
|
|
23843
23852
|
const { code, providerId, redirectUri } = parsed;
|
|
23844
23853
|
if (!code || !providerId || !redirectUri) {
|
|
@@ -23935,7 +23944,7 @@ var SsoLoginHandler = class _SsoLoginHandler extends ServeGibHandlerBase {
|
|
|
23935
23944
|
|
|
23936
23945
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/identity/keystone-custodian-genesis.handler.mjs
|
|
23937
23946
|
import * as fs3 from "node:fs/promises";
|
|
23938
|
-
var logalot57 = GLOBAL_LOG_A_LOT
|
|
23947
|
+
var logalot57 = GLOBAL_LOG_A_LOT;
|
|
23939
23948
|
var KeystoneCustodianGenesisHandler = class _KeystoneCustodianGenesisHandler extends ServeGibHandlerBase {
|
|
23940
23949
|
lc = `[${_KeystoneCustodianGenesisHandler.name}]`;
|
|
23941
23950
|
method = "POST";
|
|
@@ -24007,7 +24016,7 @@ var KeystoneCustodianGenesisHandler = class _KeystoneCustodianGenesisHandler ext
|
|
|
24007
24016
|
const defaultUsername = username || normEmail.split("@")[0];
|
|
24008
24017
|
const primaryProfileName = "primary-profile.dev";
|
|
24009
24018
|
if (!primaryProfileName || !primaryProfileName.trim()) {
|
|
24010
|
-
throw new Error('KEYSTONE_PROFILE_CUSTODIAN_PRIMARY environment variable is missing. Expected valid profile name like "primary-profile.dev" or "primary-profile.prod". (E:
|
|
24019
|
+
throw new Error('KEYSTONE_PROFILE_CUSTODIAN_PRIMARY environment variable is missing. Expected valid profile name like "primary-profile.dev" or "primary-profile.prod". (E: genuuid)');
|
|
24011
24020
|
}
|
|
24012
24021
|
const primaryBuilder = KeystoneProfileBuilder.buildKeystone(primaryProfileName.trim()).withUsername(defaultUsername).withDescription(`Full Custodian Primary Identity for ${normEmail}`).withDetails({
|
|
24013
24022
|
emails: [normEmail],
|
|
@@ -24092,7 +24101,7 @@ var KeystoneCustodianGenesisHandler = class _KeystoneCustodianGenesisHandler ext
|
|
|
24092
24101
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/identity/keystone-custodian-register-delegate.handler.mjs
|
|
24093
24102
|
import * as fs4 from "fs/promises";
|
|
24094
24103
|
import * as path5 from "path";
|
|
24095
|
-
var logalot58 = GLOBAL_LOG_A_LOT
|
|
24104
|
+
var logalot58 = GLOBAL_LOG_A_LOT;
|
|
24096
24105
|
var KeystoneCustodianRegisterDelegateHandler = class _KeystoneCustodianRegisterDelegateHandler extends ServeGibHandlerBase {
|
|
24097
24106
|
lc = `[${_KeystoneCustodianRegisterDelegateHandler.name}]`;
|
|
24098
24107
|
method = "POST";
|
|
@@ -24224,7 +24233,7 @@ var KeystoneCustodianRegisterDelegateHandler = class _KeystoneCustodianRegisterD
|
|
|
24224
24233
|
};
|
|
24225
24234
|
|
|
24226
24235
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/identity/keystone-custodian-add-master-password.handler.mjs
|
|
24227
|
-
var logalot59 = GLOBAL_LOG_A_LOT
|
|
24236
|
+
var logalot59 = GLOBAL_LOG_A_LOT;
|
|
24228
24237
|
var KeystoneCustodianAddMasterPasswordHandler = class _KeystoneCustodianAddMasterPasswordHandler extends ServeGibHandlerBase {
|
|
24229
24238
|
lc = `[${_KeystoneCustodianAddMasterPasswordHandler.name}]`;
|
|
24230
24239
|
method = "POST";
|
|
@@ -24233,29 +24242,29 @@ var KeystoneCustodianAddMasterPasswordHandler = class _KeystoneCustodianAddMaste
|
|
|
24233
24242
|
const lc2 = `${this.lc}[${this.handleRouteImpl.name}]`;
|
|
24234
24243
|
try {
|
|
24235
24244
|
if (logalot59) {
|
|
24236
|
-
console.log(`${lc2} starting... (I:
|
|
24245
|
+
console.log(`${lc2} starting... (I: genuuid)`);
|
|
24237
24246
|
}
|
|
24238
24247
|
if (reqCtx.method !== "POST") {
|
|
24239
24248
|
return this.error(405, "Method Not Allowed");
|
|
24240
24249
|
}
|
|
24241
24250
|
if (!reqCtx.body) {
|
|
24242
|
-
return this.error(400, "Request body is empty (E:
|
|
24251
|
+
return this.error(400, "Request body is empty (E: genuuid)");
|
|
24243
24252
|
}
|
|
24244
24253
|
let body;
|
|
24245
24254
|
try {
|
|
24246
24255
|
body = JSON.parse(reqCtx.body);
|
|
24247
24256
|
} catch {
|
|
24248
|
-
return this.error(400, "Request body must be valid JSON (E:
|
|
24257
|
+
return this.error(400, "Request body must be valid JSON (E: genuuid)");
|
|
24249
24258
|
}
|
|
24250
24259
|
const { primaryTjpAddr, newManagePool, providerId, code, redirectUri, email } = body;
|
|
24251
24260
|
if (!primaryTjpAddr) {
|
|
24252
|
-
return this.error(400, "primaryTjpAddr is required (E:
|
|
24261
|
+
return this.error(400, "primaryTjpAddr is required (E: genuuid)");
|
|
24253
24262
|
}
|
|
24254
24263
|
if (!newManagePool || typeof newManagePool !== "object" || newManagePool.id !== POOL_ID_MANAGE) {
|
|
24255
|
-
return this.error(400, 'newManagePool is invalid. Must be an object with id "manage" (E:
|
|
24264
|
+
return this.error(400, 'newManagePool is invalid. Must be an object with id "manage" (E: genuuid)');
|
|
24256
24265
|
}
|
|
24257
24266
|
if (!newManagePool.challenges || Object.keys(newManagePool.challenges).length === 0) {
|
|
24258
|
-
return this.error(400, "newManagePool must contain pre-generated public challenges (E:
|
|
24267
|
+
return this.error(400, "newManagePool must contain pre-generated public challenges (E: genuuid)");
|
|
24259
24268
|
}
|
|
24260
24269
|
let verifiedEmail;
|
|
24261
24270
|
let effectiveProvider = providerId || "email";
|
|
@@ -24263,12 +24272,12 @@ var KeystoneCustodianAddMasterPasswordHandler = class _KeystoneCustodianAddMaste
|
|
|
24263
24272
|
const service = getSsoCustodianService();
|
|
24264
24273
|
const userInfo = await service.getOAuthUserInfo(providerId, code, redirectUri);
|
|
24265
24274
|
if (!userInfo || !userInfo.email) {
|
|
24266
|
-
return this.error(401, `Failed to authenticate with SSO provider ${providerId} (E:
|
|
24275
|
+
return this.error(401, `Failed to authenticate with SSO provider ${providerId} (E: genuuid)`);
|
|
24267
24276
|
}
|
|
24268
24277
|
verifiedEmail = normalizeEmail(userInfo.email);
|
|
24269
24278
|
} else if (email && code) {
|
|
24270
24279
|
if (!validateEmail2(email)) {
|
|
24271
|
-
return this.error(400, "Invalid email address format (E:
|
|
24280
|
+
return this.error(400, "Invalid email address format (E: genuuid)");
|
|
24272
24281
|
}
|
|
24273
24282
|
verifiedEmail = normalizeEmail(email);
|
|
24274
24283
|
const tjpHash = await getPendingTjpHash(primaryTjpAddr);
|
|
@@ -24278,22 +24287,22 @@ var KeystoneCustodianAddMasterPasswordHandler = class _KeystoneCustodianAddMaste
|
|
|
24278
24287
|
pendingInfo = reqCtx.dataDir && emailTjpHash ? await getPendingStagingDir({ dataDir: reqCtx.dataDir, tjpHash: emailTjpHash }) : void 0;
|
|
24279
24288
|
}
|
|
24280
24289
|
if (!pendingInfo || pendingInfo.isExpired) {
|
|
24281
|
-
return this.error(400, "Verification record missing or expired. Please request a new verification code. (E:
|
|
24290
|
+
return this.error(400, "Verification record missing or expired. Please request a new verification code. (E: genuuid)");
|
|
24282
24291
|
}
|
|
24283
24292
|
const codeVerifyResult = await verifyPendingCode({
|
|
24284
24293
|
pendingDir: pendingInfo.pendingDir,
|
|
24285
24294
|
code
|
|
24286
24295
|
});
|
|
24287
24296
|
if (!codeVerifyResult.valid) {
|
|
24288
|
-
return this.error(401, codeVerifyResult.error || "Invalid verification code (E:
|
|
24297
|
+
return this.error(401, codeVerifyResult.error || "Invalid verification code (E: genuuid)");
|
|
24289
24298
|
}
|
|
24290
24299
|
} else {
|
|
24291
|
-
return this.error(400, "Authentication credentials required (providerId+code+redirectUri or email+code) (E:
|
|
24300
|
+
return this.error(400, "Authentication credentials required (providerId+code+redirectUri or email+code) (E: genuuid)");
|
|
24292
24301
|
}
|
|
24293
24302
|
const indexService = getIdentityIndexService();
|
|
24294
24303
|
const identityRecord = await indexService.lookupIdentityByEmail({ email: verifiedEmail });
|
|
24295
24304
|
if (!identityRecord || identityRecord.primaryTjpAddr !== primaryTjpAddr) {
|
|
24296
|
-
return this.error(403, `Authenticated email ${verifiedEmail} does not match primary identity ${primaryTjpAddr} (E:
|
|
24305
|
+
return this.error(403, `Authenticated email ${verifiedEmail} does not match primary identity ${primaryTjpAddr} (E: genuuid)`);
|
|
24297
24306
|
}
|
|
24298
24307
|
const metaspace = await bootstrapDomainMetaspace(primaryTjpAddr, reqCtx.dataDir);
|
|
24299
24308
|
const space = await metaspace.getLocalUserSpace({ lock: false });
|
|
@@ -24312,10 +24321,10 @@ var KeystoneCustodianAddMasterPasswordHandler = class _KeystoneCustodianAddMaste
|
|
|
24312
24321
|
const prevPools = latestKeystone.data.challengePools || [];
|
|
24313
24322
|
const existingManagePool = prevPools.find((p) => p.id === POOL_ID_MANAGE);
|
|
24314
24323
|
if (!existingManagePool) {
|
|
24315
|
-
return this.error(400, 'Primary keystone missing active "manage" pool (E:
|
|
24324
|
+
return this.error(400, 'Primary keystone missing active "manage" pool (E: genuuid)');
|
|
24316
24325
|
}
|
|
24317
24326
|
if (existingManagePool.config?.type && newManagePool.config?.type !== existingManagePool.config.type) {
|
|
24318
|
-
return this.error(400, `newManagePool type "${newManagePool.config?.type}" does not match required type "${existingManagePool.config.type}" (E:
|
|
24327
|
+
return this.error(400, `newManagePool type "${newManagePool.config?.type}" does not match required type "${existingManagePool.config.type}" (E: genuuid)`);
|
|
24319
24328
|
}
|
|
24320
24329
|
const custodianPoolId = `${CUSTODIAN_POOL_ID_PREFIX}${effectiveProvider}`;
|
|
24321
24330
|
const auxiliaryCustodianPool = {
|
|
@@ -24405,14 +24414,14 @@ var EmailReceiverAws = class extends EmailReceiverBase {
|
|
|
24405
24414
|
try {
|
|
24406
24415
|
rawData = JSON.parse(rawData);
|
|
24407
24416
|
} catch {
|
|
24408
|
-
throw new Error("Invalid JSON string in AWS inbound payload. (E:
|
|
24417
|
+
throw new Error("Invalid JSON string in AWS inbound payload. (E: genuuid)");
|
|
24409
24418
|
}
|
|
24410
24419
|
}
|
|
24411
24420
|
if (rawData && typeof rawData === "object" && rawData.SigningCertURL) {
|
|
24412
24421
|
try {
|
|
24413
24422
|
const certUrl = new URL(rawData.SigningCertURL);
|
|
24414
24423
|
if (certUrl.protocol !== "https:" || !certUrl.hostname.endsWith(".amazonaws.com")) {
|
|
24415
|
-
throw new Error(`Invalid SNS SigningCertURL host: ${rawData.SigningCertURL} (E:
|
|
24424
|
+
throw new Error(`Invalid SNS SigningCertURL host: ${rawData.SigningCertURL} (E: genuuid)`);
|
|
24416
24425
|
}
|
|
24417
24426
|
} catch (err) {
|
|
24418
24427
|
if (err?.message?.includes("(E: ")) {
|
|
@@ -24428,7 +24437,7 @@ var EmailReceiverAws = class extends EmailReceiverBase {
|
|
|
24428
24437
|
}
|
|
24429
24438
|
}
|
|
24430
24439
|
if (!rawData || typeof rawData !== "object") {
|
|
24431
|
-
throw new Error("Invalid payload structure for AWS SES email parsing. (E:
|
|
24440
|
+
throw new Error("Invalid payload structure for AWS SES email parsing. (E: genuuid)");
|
|
24432
24441
|
}
|
|
24433
24442
|
const mail = rawData.mail || {};
|
|
24434
24443
|
const receipt = rawData.receipt || {};
|
|
@@ -24501,14 +24510,14 @@ var EmailInboundHandler = class _EmailInboundHandler extends ServeGibHandlerBase
|
|
|
24501
24510
|
payload = reqCtx.body;
|
|
24502
24511
|
}
|
|
24503
24512
|
const inboundEmail = await this.receiver.parseInboundPayload(payload);
|
|
24504
|
-
console.log(`${lc2} Successfully processed inbound email msgId: ${inboundEmail.messageId}, folder: ${inboundEmail.folder} (I:
|
|
24513
|
+
console.log(`${lc2} Successfully processed inbound email msgId: ${inboundEmail.messageId}, folder: ${inboundEmail.folder} (I: genuuid)`);
|
|
24505
24514
|
return this.ok({
|
|
24506
24515
|
success: true,
|
|
24507
24516
|
email: inboundEmail
|
|
24508
24517
|
});
|
|
24509
24518
|
} catch (error) {
|
|
24510
24519
|
const emsg = extractErrorMsg(error);
|
|
24511
|
-
console.error(`${lc2} Inbound email handling failed: ${emsg} (E:
|
|
24520
|
+
console.error(`${lc2} Inbound email handling failed: ${emsg} (E: genuuid)`);
|
|
24512
24521
|
return this.error(500, `Inbound email error: ${emsg}`);
|
|
24513
24522
|
}
|
|
24514
24523
|
}
|
|
@@ -24541,15 +24550,15 @@ var EmailOutboundHandler = class _EmailOutboundHandler extends ServeGibHandlerBa
|
|
|
24541
24550
|
}
|
|
24542
24551
|
const sendResult = await this.sender.sendEmail(emailData);
|
|
24543
24552
|
if (sendResult.success) {
|
|
24544
|
-
console.log(`${lc2} Successfully dispatched outbound email msgId: ${sendResult.messageId} (I:
|
|
24553
|
+
console.log(`${lc2} Successfully dispatched outbound email msgId: ${sendResult.messageId} (I: genuuid)`);
|
|
24545
24554
|
return this.ok(sendResult, sendResult.statusCode || 200);
|
|
24546
24555
|
} else {
|
|
24547
|
-
console.error(`${lc2} Failed to send email: ${sendResult.error} (E:
|
|
24556
|
+
console.error(`${lc2} Failed to send email: ${sendResult.error} (E: genuuid)`);
|
|
24548
24557
|
return this.error(sendResult.statusCode || 500, sendResult.error || "Failed to send email");
|
|
24549
24558
|
}
|
|
24550
24559
|
} catch (error) {
|
|
24551
24560
|
const emsg = extractErrorMsg(error);
|
|
24552
|
-
console.error(`${lc2} Outbound email error: ${emsg} (E:
|
|
24561
|
+
console.error(`${lc2} Outbound email error: ${emsg} (E: genuuid)`);
|
|
24553
24562
|
return this.error(500, `Outbound email error: ${emsg}`);
|
|
24554
24563
|
}
|
|
24555
24564
|
}
|
|
@@ -24559,7 +24568,7 @@ var EmailOutboundHandler = class _EmailOutboundHandler extends ServeGibHandlerBa
|
|
|
24559
24568
|
import * as path6 from "node:path";
|
|
24560
24569
|
import * as fs5 from "node:fs/promises";
|
|
24561
24570
|
import { existsSync as existsSync6 } from "node:fs";
|
|
24562
|
-
var logalot60 = GLOBAL_LOG_A_LOT
|
|
24571
|
+
var logalot60 = GLOBAL_LOG_A_LOT;
|
|
24563
24572
|
var EmailVerificationCodeHandler = class _EmailVerificationCodeHandler extends ServeGibHandlerBase {
|
|
24564
24573
|
lc = `[${_EmailVerificationCodeHandler.name}]`;
|
|
24565
24574
|
method = "POST";
|
|
@@ -24710,7 +24719,7 @@ If you did not request this, please ignore this email.`,
|
|
|
24710
24719
|
import * as fs6 from "node:fs/promises";
|
|
24711
24720
|
import { existsSync as existsSync7 } from "node:fs";
|
|
24712
24721
|
import * as path7 from "node:path";
|
|
24713
|
-
var logalot61 = GLOBAL_LOG_A_LOT
|
|
24722
|
+
var logalot61 = GLOBAL_LOG_A_LOT;
|
|
24714
24723
|
var EmailVerifyCodeOnetimeHandler = class _EmailVerifyCodeOnetimeHandler extends ServeGibHandlerBase {
|
|
24715
24724
|
lc = `[${_EmailVerifyCodeOnetimeHandler.name}]`;
|
|
24716
24725
|
method = "POST";
|
|
@@ -26111,10 +26120,10 @@ var SyncPeer_V1 = class _SyncPeer_V1 extends LightWitnessBase_V1 {
|
|
|
26111
26120
|
const lc2 = `${this.lc}[${this.establishSessionIdentity.name}]`;
|
|
26112
26121
|
try {
|
|
26113
26122
|
if (logalot66) {
|
|
26114
|
-
console.log(`${lc2} starting... (I:
|
|
26123
|
+
console.log(`${lc2} starting... (I: genuuid)`);
|
|
26115
26124
|
}
|
|
26116
26125
|
if (!this.opts) {
|
|
26117
|
-
throw new Error(`(UNEXPECTED) this.opts falsy? Call initializeOpts first. (E:
|
|
26126
|
+
throw new Error(`(UNEXPECTED) this.opts falsy? Call initializeOpts first. (E: genuuid)`);
|
|
26118
26127
|
}
|
|
26119
26128
|
const { senderIdentity, fnSenderSecret, senderDomainAddr, sagaId, localMetaspace, localSpace } = this.opts;
|
|
26120
26129
|
if (!senderIdentity || !fnSenderSecret) {
|
|
@@ -26745,7 +26754,7 @@ async function appendToTimeline({ timeline, rel8nInfos, rel8nRemovalInfos, timel
|
|
|
26745
26754
|
space
|
|
26746
26755
|
});
|
|
26747
26756
|
if (!latestTimelineIbGibAddr) {
|
|
26748
|
-
throw new Error(`${lc2} (UNEXPECTED) Could not get latest address for timeline ${getIbGibAddr({ ibGib: timeline })}. (E:
|
|
26757
|
+
throw new Error(`${lc2} (UNEXPECTED) Could not get latest address for timeline ${getIbGibAddr({ ibGib: timeline })}. (E: genuuid)`);
|
|
26749
26758
|
}
|
|
26750
26759
|
let latestTimelineIbGibDto = toDto2({ ibGib: timeline });
|
|
26751
26760
|
if (timelineAddr !== latestTimelineIbGibAddr) {
|
|
@@ -26754,7 +26763,7 @@ async function appendToTimeline({ timeline, rel8nInfos, rel8nRemovalInfos, timel
|
|
|
26754
26763
|
space
|
|
26755
26764
|
});
|
|
26756
26765
|
if (resGetLatest.errorMsg || (resGetLatest.ibGibs ?? []).length !== 1) {
|
|
26757
|
-
throw new Error(`${lc2} (UNEXPECTED) couldn't get latest timeline ibgib (${latestTimelineIbGibAddr}) from space (${space.ib}). errorMsg: ${resGetLatest.errorMsg ?? "[unknown error]"} (E:
|
|
26766
|
+
throw new Error(`${lc2} (UNEXPECTED) couldn't get latest timeline ibgib (${latestTimelineIbGibAddr}) from space (${space.ib}). errorMsg: ${resGetLatest.errorMsg ?? "[unknown error]"} (E: genuuid)`);
|
|
26758
26767
|
}
|
|
26759
26768
|
latestTimelineIbGibDto = resGetLatest.ibGibs.at(0);
|
|
26760
26769
|
}
|
|
@@ -26849,7 +26858,7 @@ async function updateSpecialIndex({ type, rel8nInfos, dataToAddOrPatch, metaspac
|
|
|
26849
26858
|
initialize: true
|
|
26850
26859
|
});
|
|
26851
26860
|
if (!specialIndex) {
|
|
26852
|
-
throw new Error(`(UNEXPECTED) couldn't initialize/get special ibgib index of type ${type}. (E:
|
|
26861
|
+
throw new Error(`(UNEXPECTED) couldn't initialize/get special ibgib index of type ${type}. (E: genuuid)`);
|
|
26853
26862
|
}
|
|
26854
26863
|
if (!specialIndex.rel8ns) {
|
|
26855
26864
|
console.warn(`${lc2} not sure if this ever hits, but is there ever a scenario where specialIndex.rel8ns is falsy? (W: 06161c366bc7ec858b9b5aa7ee9b6d25)`);
|
|
@@ -26949,7 +26958,7 @@ async function getLatestTimelineIbGibDto_nonLocking({ timeline, timelineAddr, me
|
|
|
26949
26958
|
space
|
|
26950
26959
|
}) ?? timelineAddr;
|
|
26951
26960
|
if (!latestTimelineIbGibAddr) {
|
|
26952
|
-
throw new Error(`${lc2} (UNEXPECTED) Could not get latest address for timeline ${getIbGibAddr({ ibGib: timeline })}. (E:
|
|
26961
|
+
throw new Error(`${lc2} (UNEXPECTED) Could not get latest address for timeline ${getIbGibAddr({ ibGib: timeline })}. (E: genuuid)`);
|
|
26953
26962
|
}
|
|
26954
26963
|
let latestTimelineIbGibDto;
|
|
26955
26964
|
if (timelineAddr === latestTimelineIbGibAddr) {
|
|
@@ -26970,7 +26979,7 @@ async function getLatestTimelineIbGibDto_nonLocking({ timeline, timelineAddr, me
|
|
|
26970
26979
|
space
|
|
26971
26980
|
});
|
|
26972
26981
|
if (resGetLatest.errorMsg || (resGetLatest.ibGibs ?? []).length !== 1) {
|
|
26973
|
-
throw new Error(`${lc2} (UNEXPECTED) couldn't get latest timeline ibgib (${latestTimelineIbGibAddr}) from space (${space.ib}). errorMsg: ${resGetLatest.errorMsg ?? "[unknown error]"} (E:
|
|
26982
|
+
throw new Error(`${lc2} (UNEXPECTED) couldn't get latest timeline ibgib (${latestTimelineIbGibAddr}) from space (${space.ib}). errorMsg: ${resGetLatest.errorMsg ?? "[unknown error]"} (E: genuuid)`);
|
|
26974
26983
|
}
|
|
26975
26984
|
latestTimelineIbGibDto = resGetLatest.ibGibs.at(0);
|
|
26976
26985
|
}
|
|
@@ -27036,7 +27045,7 @@ async function getDna({ ibGib, metaspace, space }) {
|
|
|
27036
27045
|
}
|
|
27037
27046
|
space ??= await metaspace.getLocalUserSpace({ lock: false });
|
|
27038
27047
|
if (!space) {
|
|
27039
|
-
throw new Error(`(UNEXPECTED) space is required. (E:
|
|
27048
|
+
throw new Error(`(UNEXPECTED) space is required. (E: genuuid)`);
|
|
27040
27049
|
}
|
|
27041
27050
|
const dnaAddrs = ibGib.rel8ns?.dna ?? [];
|
|
27042
27051
|
if (dnaAddrs.length === 0) {
|
|
@@ -27045,7 +27054,7 @@ async function getDna({ ibGib, metaspace, space }) {
|
|
|
27045
27054
|
const resGet = await metaspace.get({ addrs: dnaAddrs, space });
|
|
27046
27055
|
if (!resGet.success || (resGet.ibGibs ?? []).length !== dnaAddrs.length) {
|
|
27047
27056
|
const notFound = dnaAddrs.filter((addr) => !resGet.ibGibs?.some((x) => getIbGibAddr({ ibGib: x }) === addr));
|
|
27048
|
-
throw new Error(`Could not get all dna ibGibs for ${getIbGibAddr({ ibGib })}. Addrs not found: ${notFound.join(", ")}. Errors: ${resGet.errorMsg ?? "[unknown error (E: 92cf95774828d8a978331da859098625)]"} (E:
|
|
27057
|
+
throw new Error(`Could not get all dna ibGibs for ${getIbGibAddr({ ibGib })}. Addrs not found: ${notFound.join(", ")}. Errors: ${resGet.errorMsg ?? "[unknown error (E: 92cf95774828d8a978331da859098625)]"} (E: genuuid)`);
|
|
27049
27058
|
}
|
|
27050
27059
|
return resGet.ibGibs;
|
|
27051
27060
|
} catch (error) {
|
|
@@ -27061,7 +27070,7 @@ async function getHistory({ timeline, getLatest, includeDna, metaspace, space })
|
|
|
27061
27070
|
}
|
|
27062
27071
|
space ??= await metaspace.getLocalUserSpace({ lock: false });
|
|
27063
27072
|
if (!space) {
|
|
27064
|
-
throw new Error(`(UNEXPECTED) space is required. (E:
|
|
27073
|
+
throw new Error(`(UNEXPECTED) space is required. (E: genuuid)`);
|
|
27065
27074
|
}
|
|
27066
27075
|
const headIbGib = getLatest ? await getLatestTimelineIbGibDto_nonLocking({ timeline, metaspace, space }) : toDto2({ ibGib: timeline });
|
|
27067
27076
|
const headAddr = getIbGibAddr({ ibGib: headIbGib });
|
|
@@ -27160,10 +27169,10 @@ async function getSyncSagaMessageFromFrame({ frameIbGib, space }) {
|
|
|
27160
27169
|
});
|
|
27161
27170
|
const msgs = rel8d[SYNC_MSG_REL8N_NAME];
|
|
27162
27171
|
if (!msgs || msgs.length === 0) {
|
|
27163
|
-
throw new Error(`(UNEXPECTED) No sync message stone found found for frame: ${frameIbGib.ib} (E:
|
|
27172
|
+
throw new Error(`(UNEXPECTED) No sync message stone found found for frame: ${frameIbGib.ib} (E: genuuid)`);
|
|
27164
27173
|
}
|
|
27165
27174
|
if (msgs.length > 1) {
|
|
27166
|
-
throw new Error(`(UNEXPECTED) Multiple sync message stones found (${msgs.length}) for frame: ${frameIbGib.ib}. logic not currently equipped to handle multiple messages per frame. (E:
|
|
27175
|
+
throw new Error(`(UNEXPECTED) Multiple sync message stones found (${msgs.length}) for frame: ${frameIbGib.ib}. logic not currently equipped to handle multiple messages per frame. (E: genuuid)`);
|
|
27167
27176
|
}
|
|
27168
27177
|
return msgs[0];
|
|
27169
27178
|
} catch (error) {
|
|
@@ -27326,7 +27335,7 @@ var GraftMergeStrategyBase_V1 = class {
|
|
|
27326
27335
|
const lc2 = `[${this.constructor.name}][${this.applyTransformAndRegister.name}]`;
|
|
27327
27336
|
try {
|
|
27328
27337
|
if (logalot70) {
|
|
27329
|
-
console.log(`${lc2} starting... (I:
|
|
27338
|
+
console.log(`${lc2} starting... (I: genuuid)`);
|
|
27330
27339
|
}
|
|
27331
27340
|
if (!resTransform) {
|
|
27332
27341
|
throw new Error(`(UNEXPECTED) resTransform falsy (E: 83b27a8102f4423ab194e82f7c001826)`);
|
|
@@ -27389,7 +27398,7 @@ var DefaultDnaReplayGraftStrategy = class extends GraftMergeStrategyBase_V1 {
|
|
|
27389
27398
|
};
|
|
27390
27399
|
var throwIfUnexpected = throwIfUnexpected2;
|
|
27391
27400
|
if (logalot71) {
|
|
27392
|
-
console.log(`${lc2} starting default DNA replay graft... (I:
|
|
27401
|
+
console.log(`${lc2} starting default DNA replay graft... (I: genuuid)`);
|
|
27393
27402
|
}
|
|
27394
27403
|
const { conflictStrategy, timelineAddrsA, timelineAddrsB, latestCommonFrameAddr, ibGibReadCache, space, graftPreference } = context;
|
|
27395
27404
|
const newGraftedIntermediateIbGibs_ordered = [];
|
|
@@ -27552,7 +27561,7 @@ var DefaultDnaReplayGraftStrategy = class extends GraftMergeStrategyBase_V1 {
|
|
|
27552
27561
|
graftInfoCreated: graftInfo
|
|
27553
27562
|
};
|
|
27554
27563
|
} catch (error) {
|
|
27555
|
-
console.error(`${lc2} ${extractErrorMsg(error)} (E:
|
|
27564
|
+
console.error(`${lc2} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
27556
27565
|
throw error;
|
|
27557
27566
|
} finally {
|
|
27558
27567
|
if (logalot71) {
|
|
@@ -27582,11 +27591,11 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27582
27591
|
registerStrategy(strategy) {
|
|
27583
27592
|
const lc2 = `${lcFile}[${this.registerStrategy.name}]`;
|
|
27584
27593
|
if (!strategy) {
|
|
27585
|
-
throw new Error(`(UNEXPECTED) strategy falsy (E:
|
|
27594
|
+
throw new Error(`(UNEXPECTED) strategy falsy (E: genuuid)`);
|
|
27586
27595
|
}
|
|
27587
27596
|
if (!this._registeredStrategies.some((s) => s.strategyId === strategy.strategyId)) {
|
|
27588
27597
|
if (logalot72) {
|
|
27589
|
-
console.log(`${lc2} registering strategy ${strategy.strategyId} (I:
|
|
27598
|
+
console.log(`${lc2} registering strategy ${strategy.strategyId} (I: genuuid)`);
|
|
27590
27599
|
}
|
|
27591
27600
|
this._registeredStrategies.push(strategy);
|
|
27592
27601
|
}
|
|
@@ -27597,10 +27606,10 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27597
27606
|
setFallbackStrategy(strategy) {
|
|
27598
27607
|
const lc2 = `${lcFile}[${this.setFallbackStrategy.name}]`;
|
|
27599
27608
|
if (!strategy) {
|
|
27600
|
-
throw new Error(`(UNEXPECTED) fallback strategy falsy (E:
|
|
27609
|
+
throw new Error(`(UNEXPECTED) fallback strategy falsy (E: genuuid)`);
|
|
27601
27610
|
}
|
|
27602
27611
|
if (logalot72) {
|
|
27603
|
-
console.log(`${lc2} setting fallback strategy ${strategy.strategyId} (I:
|
|
27612
|
+
console.log(`${lc2} setting fallback strategy ${strategy.strategyId} (I: genuuid)`);
|
|
27604
27613
|
}
|
|
27605
27614
|
this._fallbackStrategy = strategy;
|
|
27606
27615
|
}
|
|
@@ -27616,7 +27625,7 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27616
27625
|
reset() {
|
|
27617
27626
|
const lc2 = `${lcFile}[${this.reset.name}]`;
|
|
27618
27627
|
if (logalot72) {
|
|
27619
|
-
console.log(`${lc2} resetting strategies to default fallback... (I:
|
|
27628
|
+
console.log(`${lc2} resetting strategies to default fallback... (I: genuuid)`);
|
|
27620
27629
|
}
|
|
27621
27630
|
this._registeredStrategies = [];
|
|
27622
27631
|
this._fallbackStrategy = new DefaultDnaReplayGraftStrategy();
|
|
@@ -27685,7 +27694,7 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27685
27694
|
let resGraft = void 0;
|
|
27686
27695
|
for (const strategy of strategyPipeline) {
|
|
27687
27696
|
if (logalot72) {
|
|
27688
|
-
console.log(`${lc2} executing graft strategy ${strategy.strategyId} (I:
|
|
27697
|
+
console.log(`${lc2} executing graft strategy ${strategy.strategyId} (I: genuuid)`);
|
|
27689
27698
|
}
|
|
27690
27699
|
resGraft = await strategy.graft(context);
|
|
27691
27700
|
if (resGraft) {
|
|
@@ -27697,7 +27706,7 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27697
27706
|
}
|
|
27698
27707
|
return resGraft;
|
|
27699
27708
|
} catch (error) {
|
|
27700
|
-
console.error(`${lc2} ${extractErrorMsg(error)} (E:
|
|
27709
|
+
console.error(`${lc2} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
27701
27710
|
throw error;
|
|
27702
27711
|
} finally {
|
|
27703
27712
|
if (logalot72) {
|
|
@@ -30083,7 +30092,7 @@ async function main() {
|
|
|
30083
30092
|
console.log(`${lc2} dataDir: ${DATA_DIR}`);
|
|
30084
30093
|
const custodianPrimaryProfile = "primary-profile.dev".trim();
|
|
30085
30094
|
if (!custodianPrimaryProfile) {
|
|
30086
|
-
throw new Error(`${lc2} Fatal Error: KEYSTONE_PROFILE_CUSTODIAN_PRIMARY environment variable is missing or blank. (E:
|
|
30095
|
+
throw new Error(`${lc2} Fatal Error: KEYSTONE_PROFILE_CUSTODIAN_PRIMARY environment variable is missing or blank. (E: genuuid)`);
|
|
30087
30096
|
}
|
|
30088
30097
|
const isProdEnv = true;
|
|
30089
30098
|
if (isProdEnv && !custodianPrimaryProfile.endsWith(".prod")) {
|