@ibgib/space-gib 0.0.21 → 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/README.md +4 -0
- 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-7YXHRAEW.mjs → chunk-PJDAAEMZ.mjs} +333 -46
- package/dist/client/index.html +15 -1
- package/dist/client/index.mjs +46 -13
- package/dist/client/privacy.html +29 -29
- package/dist/client/script.mjs +1 -1
- package/dist/server/server.mjs +107 -96
- package/generate-privacy-html.js +6 -1
- 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 +342 -0
- package/src/client/dev-tools.mts +13 -1
- package/src/client/index.html +15 -1
- package/src/client/privacy.html +29 -29
- package/src/client/ui/shell/space-gib-shell-service.mts +61 -11
- package/src/server/server.mts +1 -1
- package/dist/client/chunk-M2IO3EMM.mjs +0 -22
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] = [];
|
|
@@ -7171,9 +7180,11 @@ async function getDependencyGraph({ ibGib, ibGibs, ibGibAddr, ibGibAddrs, live,
|
|
|
7171
7180
|
timeLogName,
|
|
7172
7181
|
mapTjpAddrToLatestAddrsInSpace
|
|
7173
7182
|
});
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7183
|
+
if (logalot11) {
|
|
7184
|
+
Object.values(graph).filter((ibGib2) => ibGib2.ib.startsWith("comment ")).forEach((ibGib2) => {
|
|
7185
|
+
console.table(ibGib2);
|
|
7186
|
+
});
|
|
7187
|
+
}
|
|
7177
7188
|
if (logalot11) {
|
|
7178
7189
|
console.log(`${lc2} graph size: ${Object.keys(graph).length} (I: c6cb5e7e1e2611d35b9006fac6503d22)`);
|
|
7179
7190
|
const ibs = Object.values(graph).filter((ibGib2) => ibGib2.ib.startsWith("comment ") || ibGib2.ib.startsWith("pic ")).map((ibGib2) => ibGib2.ib);
|
|
@@ -17488,7 +17499,7 @@ var KEYSTONE_CONFIG_DEFAULT_HASH_ALGORITHM_HIGHSECURITY = HashAlgorithm.sha_512;
|
|
|
17488
17499
|
var KEYSTONE_CHECKPOINT_FREQUENCY = 50;
|
|
17489
17500
|
|
|
17490
17501
|
// ../../libs/node-gib/dist/serve-gib/identity-index/identity-index-helpers.mjs
|
|
17491
|
-
var logalot37 = GLOBAL_LOG_A_LOT2
|
|
17502
|
+
var logalot37 = GLOBAL_LOG_A_LOT2;
|
|
17492
17503
|
function validateEmail({ email }) {
|
|
17493
17504
|
const errors = [];
|
|
17494
17505
|
if (!email || typeof email !== "string") {
|
|
@@ -17552,7 +17563,7 @@ function getShardedIndexPath({ baseDir, emailHash }) {
|
|
|
17552
17563
|
// ../../libs/node-gib/dist/serve-gib/identity-index/identity-index-service.mjs
|
|
17553
17564
|
import * as fs from "fs/promises";
|
|
17554
17565
|
import * as path3 from "path";
|
|
17555
|
-
var logalot38 = GLOBAL_LOG_A_LOT2
|
|
17566
|
+
var logalot38 = GLOBAL_LOG_A_LOT2;
|
|
17556
17567
|
var IdentityIndexService = class _IdentityIndexService {
|
|
17557
17568
|
lc = `[${_IdentityIndexService.name}]`;
|
|
17558
17569
|
baseDir;
|
|
@@ -19083,10 +19094,10 @@ var KeystoneProfileBuilder = class _KeystoneProfileBuilder {
|
|
|
19083
19094
|
*/
|
|
19084
19095
|
static registerCustomProfile({ name, template }) {
|
|
19085
19096
|
if (!name || typeof name !== "string") {
|
|
19086
|
-
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)`);
|
|
19087
19098
|
}
|
|
19088
19099
|
if (!template || typeof template !== "object") {
|
|
19089
|
-
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)`);
|
|
19090
19101
|
}
|
|
19091
19102
|
_customProfiles.set(name, JSON.parse(JSON.stringify(template)));
|
|
19092
19103
|
}
|
|
@@ -19101,17 +19112,17 @@ var KeystoneProfileBuilder = class _KeystoneProfileBuilder {
|
|
|
19101
19112
|
*/
|
|
19102
19113
|
static fromTemplate(template) {
|
|
19103
19114
|
if (!template || typeof template !== "object") {
|
|
19104
|
-
throw new Error(`Valid KeystonePolicyConfigTemplate is required for KeystoneProfileBuilder.fromTemplate. (E:
|
|
19115
|
+
throw new Error(`Valid KeystonePolicyConfigTemplate is required for KeystoneProfileBuilder.fromTemplate. (E: genuuid)`);
|
|
19105
19116
|
}
|
|
19106
19117
|
return new _KeystoneProfileBuilder(template);
|
|
19107
19118
|
}
|
|
19108
19119
|
static buildKeystone(profileName) {
|
|
19109
19120
|
if (!profileName || typeof profileName !== "string") {
|
|
19110
|
-
throw new Error(`Profile name is required for KeystoneProfileBuilder. (E:
|
|
19121
|
+
throw new Error(`Profile name is required for KeystoneProfileBuilder. (E: genuuid)`);
|
|
19111
19122
|
}
|
|
19112
19123
|
const isDevProfile = profileName.endsWith(".dev") || profileName.startsWith("test") || profileName.includes("test");
|
|
19113
19124
|
if (isDevProfile) {
|
|
19114
|
-
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)`);
|
|
19115
19126
|
}
|
|
19116
19127
|
if (_customProfiles.has(profileName)) {
|
|
19117
19128
|
return new _KeystoneProfileBuilder(_customProfiles.get(profileName));
|
|
@@ -19669,13 +19680,13 @@ async function solveAndReplenish({ targetPoolId, prevPools, masterSecret, challe
|
|
|
19669
19680
|
}
|
|
19670
19681
|
const pool = prevPools.find((p) => p.id === targetPoolId);
|
|
19671
19682
|
if (!pool) {
|
|
19672
|
-
throw new Error(`Target pool not found: ${targetPoolId} (E:
|
|
19683
|
+
throw new Error(`Target pool not found: ${targetPoolId} (E: genuuid)`);
|
|
19673
19684
|
}
|
|
19674
19685
|
const strategy = KeystoneStrategyFactory.create({ config: pool.config });
|
|
19675
19686
|
const poolSecret = await strategy.derivePoolSecret({ masterSecret });
|
|
19676
19687
|
const isSecretCorrect = await verifyPoolSecret({ pool, signingSecret: masterSecret });
|
|
19677
19688
|
if (!isSecretCorrect) {
|
|
19678
|
-
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)`);
|
|
19679
19690
|
}
|
|
19680
19691
|
const solutions = [];
|
|
19681
19692
|
for (const id of challengeIds) {
|
|
@@ -20642,7 +20653,7 @@ var KeystoneService_V1 = class _KeystoneService_V1 {
|
|
|
20642
20653
|
console.log(`${lc2} starting...`);
|
|
20643
20654
|
}
|
|
20644
20655
|
if (!signingPoolId) {
|
|
20645
|
-
throw new Error(`signingPoolId is required (E:
|
|
20656
|
+
throw new Error(`signingPoolId is required (E: genuuid)`);
|
|
20646
20657
|
}
|
|
20647
20658
|
const validationErrors = await validateKeystoneGraph({
|
|
20648
20659
|
keystoneIbGib: delegateKeystone,
|
|
@@ -21011,7 +21022,7 @@ var KeystoneService_V1 = class _KeystoneService_V1 {
|
|
|
21011
21022
|
const existingIds = new Set(replenishedExistingPools.map((p) => p.id));
|
|
21012
21023
|
for (const newPool of newPools) {
|
|
21013
21024
|
if (existingIds.has(newPool.id)) {
|
|
21014
|
-
throw new Error(`Cannot add pool. ID collision: ${newPool.id} (E:
|
|
21025
|
+
throw new Error(`Cannot add pool. ID collision: ${newPool.id} (E: genuuid)`);
|
|
21015
21026
|
}
|
|
21016
21027
|
}
|
|
21017
21028
|
const finalPools = [...replenishedExistingPools, ...newPools];
|
|
@@ -21109,7 +21120,7 @@ var KeystoneService_V1 = class _KeystoneService_V1 {
|
|
|
21109
21120
|
const finalPools = replenishedExistingPools.filter((p) => !removeSet.has(p.id));
|
|
21110
21121
|
if (finalPools.length !== replenishedExistingPools.length - poolIds.length) {
|
|
21111
21122
|
const missingIds = poolIds.filter((id) => !replenishedExistingPools.some((p) => p.id === id));
|
|
21112
|
-
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)`);
|
|
21113
21124
|
}
|
|
21114
21125
|
const n = (prevData.n ?? 0) + 1;
|
|
21115
21126
|
let checkpointDetails;
|
|
@@ -21553,7 +21564,7 @@ var KeystoneService_V1 = class _KeystoneService_V1 {
|
|
|
21553
21564
|
* from aggregated detail maps/arrays.
|
|
21554
21565
|
*/
|
|
21555
21566
|
pruneTombstoneNulls(obj) {
|
|
21556
|
-
if (
|
|
21567
|
+
if (obj === null || obj === void 0 || typeof obj !== "object") {
|
|
21557
21568
|
return obj;
|
|
21558
21569
|
}
|
|
21559
21570
|
if (Array.isArray(obj)) {
|
|
@@ -21562,7 +21573,7 @@ var KeystoneService_V1 = class _KeystoneService_V1 {
|
|
|
21562
21573
|
for (const key of Object.keys(obj)) {
|
|
21563
21574
|
if (obj[key] === null) {
|
|
21564
21575
|
delete obj[key];
|
|
21565
|
-
} else if (typeof obj[key] === "object") {
|
|
21576
|
+
} else if (obj[key] !== null && typeof obj[key] === "object") {
|
|
21566
21577
|
this.pruneTombstoneNulls(obj[key]);
|
|
21567
21578
|
}
|
|
21568
21579
|
}
|
|
@@ -21631,14 +21642,14 @@ var EmailSenderBase = class {
|
|
|
21631
21642
|
*/
|
|
21632
21643
|
validateOutboundEmail(email) {
|
|
21633
21644
|
if (!email) {
|
|
21634
|
-
throw new Error("OutboundEmail is required. (E:
|
|
21645
|
+
throw new Error("OutboundEmail is required. (E: genuuid)");
|
|
21635
21646
|
}
|
|
21636
21647
|
const fromParsed = parseEmailAddress(email.from);
|
|
21637
21648
|
if (!fromParsed.address || !validateEmail3(fromParsed.address)) {
|
|
21638
|
-
throw new Error(`Invalid "from" email address: ${fromParsed.address} (E:
|
|
21649
|
+
throw new Error(`Invalid "from" email address: ${fromParsed.address} (E: genuuid)`);
|
|
21639
21650
|
}
|
|
21640
21651
|
if (!email.to || !Array.isArray(email.to) || email.to.length === 0) {
|
|
21641
|
-
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)');
|
|
21642
21653
|
}
|
|
21643
21654
|
for (const recipient of email.to) {
|
|
21644
21655
|
const parsed = parseEmailAddress(recipient);
|
|
@@ -21748,7 +21759,7 @@ var EmailSenderAws = class extends EmailSenderBase {
|
|
|
21748
21759
|
constructor(options) {
|
|
21749
21760
|
super();
|
|
21750
21761
|
if (!options.accessKeyId || !options.secretAccessKey) {
|
|
21751
|
-
throw new Error("EmailSenderAws requires accessKeyId and secretAccessKey. (E:
|
|
21762
|
+
throw new Error("EmailSenderAws requires accessKeyId and secretAccessKey. (E: genuuid)");
|
|
21752
21763
|
}
|
|
21753
21764
|
this.accessKeyId = options.accessKeyId;
|
|
21754
21765
|
this.secretAccessKey = options.secretAccessKey;
|
|
@@ -21954,7 +21965,7 @@ async function savePendingCodeRecord({ pendingDir, code, maxAttempts = 5, ttlMs
|
|
|
21954
21965
|
function createDefaultEmailSender() {
|
|
21955
21966
|
const rawMode = process.env.EMAIL_MODE;
|
|
21956
21967
|
if (!rawMode || !rawMode.trim()) {
|
|
21957
|
-
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)');
|
|
21958
21969
|
}
|
|
21959
21970
|
const mode = rawMode.trim().toLowerCase();
|
|
21960
21971
|
const isProd = true;
|
|
@@ -21962,7 +21973,7 @@ function createDefaultEmailSender() {
|
|
|
21962
21973
|
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
|
|
21963
21974
|
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
|
|
21964
21975
|
if (!accessKeyId || !secretAccessKey) {
|
|
21965
|
-
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)");
|
|
21966
21977
|
}
|
|
21967
21978
|
return new EmailSenderAws({
|
|
21968
21979
|
accessKeyId,
|
|
@@ -21971,11 +21982,11 @@ function createDefaultEmailSender() {
|
|
|
21971
21982
|
});
|
|
21972
21983
|
} else if (mode === "mock") {
|
|
21973
21984
|
if (isProd) {
|
|
21974
|
-
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)");
|
|
21975
21986
|
}
|
|
21976
21987
|
return new EmailSenderMock();
|
|
21977
21988
|
} else {
|
|
21978
|
-
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)`);
|
|
21979
21990
|
}
|
|
21980
21991
|
}
|
|
21981
21992
|
async function dispatchVerificationCode({ email, primaryTjpAddr, pendingDir, sender }) {
|
|
@@ -22066,7 +22077,7 @@ async function getPendingStagingDir({ dataDir, tjpHash }) {
|
|
|
22066
22077
|
}
|
|
22067
22078
|
|
|
22068
22079
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/keystone/keystone-genesis.handler.mjs
|
|
22069
|
-
var logalot47 = GLOBAL_LOG_A_LOT
|
|
22080
|
+
var logalot47 = GLOBAL_LOG_A_LOT;
|
|
22070
22081
|
var KeystoneGenesisHandler = class _KeystoneGenesisHandler extends ServeGibHandlerBase {
|
|
22071
22082
|
lc = `[${_KeystoneGenesisHandler.name}]`;
|
|
22072
22083
|
method = "POST";
|
|
@@ -22159,7 +22170,7 @@ var KeystoneGenesisHandler = class _KeystoneGenesisHandler extends ServeGibHandl
|
|
|
22159
22170
|
}
|
|
22160
22171
|
const space = await metaspace.getLocalUserSpace({ lock: false });
|
|
22161
22172
|
if (!space) {
|
|
22162
|
-
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)`);
|
|
22163
22174
|
}
|
|
22164
22175
|
await metaspace.put({ ibGibs: [keystoneIbGib], space });
|
|
22165
22176
|
await metaspace.registerNewIbGib({ ibGib: keystoneIbGib, space });
|
|
@@ -22622,7 +22633,7 @@ function loadSsoServerConfig() {
|
|
|
22622
22633
|
|
|
22623
22634
|
// ../../libs/node-gib/dist/identity/sso/sso-custodian-service.mjs
|
|
22624
22635
|
import { createPublicKey, verify } from "node:crypto";
|
|
22625
|
-
var logalot49 = GLOBAL_LOG_A_LOT
|
|
22636
|
+
var logalot49 = GLOBAL_LOG_A_LOT;
|
|
22626
22637
|
var SsoCustodianService = class _SsoCustodianService {
|
|
22627
22638
|
config;
|
|
22628
22639
|
lc = `[${_SsoCustodianService.name}]`;
|
|
@@ -22953,14 +22964,14 @@ var SsoCustodianService = class _SsoCustodianService {
|
|
|
22953
22964
|
space
|
|
22954
22965
|
});
|
|
22955
22966
|
if (!targetKeystone) {
|
|
22956
|
-
throw new Error(`Keystone not found for address: ${keystoneAddr} (E:
|
|
22967
|
+
throw new Error(`Keystone not found for address: ${keystoneAddr} (E: genuuid)`);
|
|
22957
22968
|
}
|
|
22958
22969
|
const userManagePool = targetKeystone.data?.challengePools.find((p) => p.id === POOL_ID_MANAGE);
|
|
22959
22970
|
if (!userManagePool) {
|
|
22960
|
-
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)`);
|
|
22961
22972
|
}
|
|
22962
22973
|
if (!providerId || !KEYSTONE_POOL_ID_REGEXP.test(providerId)) {
|
|
22963
|
-
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)`);
|
|
22964
22975
|
}
|
|
22965
22976
|
const poolId = `custodian-manage-${providerId}`;
|
|
22966
22977
|
const custodianSecret = await this.deriveServerDelegateSecret(providerKey, userNonce);
|
|
@@ -23436,7 +23447,7 @@ var KeystoneGetHandler = class _KeystoneGetHandler extends ServeGibHandlerWithMe
|
|
|
23436
23447
|
};
|
|
23437
23448
|
|
|
23438
23449
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/keystone/keystone-lookup.handler.mjs
|
|
23439
|
-
var logalot53 = GLOBAL_LOG_A_LOT2
|
|
23450
|
+
var logalot53 = GLOBAL_LOG_A_LOT2;
|
|
23440
23451
|
var KeystoneLookupHandler = class _KeystoneLookupHandler extends ServeGibHandlerBase {
|
|
23441
23452
|
lc = `[${_KeystoneLookupHandler.name}]`;
|
|
23442
23453
|
method = "POST";
|
|
@@ -23589,7 +23600,7 @@ async function deriveCustodianAuthCode({ custodianReqsOmitAuthCode, serverSecret
|
|
|
23589
23600
|
const lc2 = `[${deriveCustodianAuthCode.name}]`;
|
|
23590
23601
|
try {
|
|
23591
23602
|
if (!serverSecret) {
|
|
23592
|
-
throw new Error("serverSecret required for custodian auth code derivation (E:
|
|
23603
|
+
throw new Error("serverSecret required for custodian auth code derivation (E: genuuid)");
|
|
23593
23604
|
}
|
|
23594
23605
|
const salt = await hash({
|
|
23595
23606
|
s: JSON.stringify(custodianReqsOmitAuthCode),
|
|
@@ -23665,7 +23676,7 @@ async function verifyCustodianRequirements({ custodianReqs, serverSecret }) {
|
|
|
23665
23676
|
}
|
|
23666
23677
|
|
|
23667
23678
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/keystone/sso-link.handler.mjs
|
|
23668
|
-
var logalot55 = GLOBAL_LOG_A_LOT
|
|
23679
|
+
var logalot55 = GLOBAL_LOG_A_LOT;
|
|
23669
23680
|
var SsoLinkHandler = class _SsoLinkHandler extends ServeGibHandlerWithMetaspaceBase {
|
|
23670
23681
|
lc = `[${_SsoLinkHandler.name}]`;
|
|
23671
23682
|
method = "POST";
|
|
@@ -23711,23 +23722,23 @@ var SsoLinkHandler = class _SsoLinkHandler extends ServeGibHandlerWithMetaspaceB
|
|
|
23711
23722
|
const lc2 = `${this.lc}[${this.handleRouteImpl.name}]`;
|
|
23712
23723
|
try {
|
|
23713
23724
|
if (logalot55) {
|
|
23714
|
-
console.log(`${lc2} starting... (I:
|
|
23725
|
+
console.log(`${lc2} starting... (I: genuuid)`);
|
|
23715
23726
|
}
|
|
23716
23727
|
if (!reqCtx.params) {
|
|
23717
|
-
return this.error(400, "Invalid parameters: parentTjpAddr missing (E:
|
|
23728
|
+
return this.error(400, "Invalid parameters: parentTjpAddr missing (E: genuuid)");
|
|
23718
23729
|
}
|
|
23719
23730
|
if (!reqCtx.metaspace) {
|
|
23720
|
-
return this.error(500, "Metaspace not initialized (E:
|
|
23731
|
+
return this.error(500, "Metaspace not initialized (E: genuuid)");
|
|
23721
23732
|
}
|
|
23722
23733
|
let parsed;
|
|
23723
23734
|
try {
|
|
23724
23735
|
parsed = JSON.parse(reqCtx.body);
|
|
23725
23736
|
} catch {
|
|
23726
|
-
return this.error(400, "Request body must be valid JSON (E:
|
|
23737
|
+
return this.error(400, "Request body must be valid JSON (E: genuuid)");
|
|
23727
23738
|
}
|
|
23728
23739
|
let { code, providerId, parentTjpAddr, userNonce, redirectUri } = parsed;
|
|
23729
23740
|
if (!code || !providerId || !parentTjpAddr || !userNonce || !redirectUri) {
|
|
23730
|
-
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)");
|
|
23731
23742
|
}
|
|
23732
23743
|
if (logalot55) {
|
|
23733
23744
|
console.log(`${lc2} LinkBody parsed (I: 7525b8bd29c8504e989e918825d4e826)`);
|
|
@@ -23824,19 +23835,19 @@ var SsoLoginHandler = class _SsoLoginHandler extends ServeGibHandlerBase {
|
|
|
23824
23835
|
const lc2 = `${this.lc}[${this.handleRouteImpl.name}]`;
|
|
23825
23836
|
try {
|
|
23826
23837
|
if (logalot56) {
|
|
23827
|
-
console.log(`${lc2} starting... (I:
|
|
23838
|
+
console.log(`${lc2} starting... (I: genuuid)`);
|
|
23828
23839
|
}
|
|
23829
23840
|
if (reqCtx.method !== "POST") {
|
|
23830
23841
|
return this.error(405, "Method Not Allowed");
|
|
23831
23842
|
}
|
|
23832
23843
|
if (!reqCtx.body) {
|
|
23833
|
-
return this.error(400, "Request body is empty (E:
|
|
23844
|
+
return this.error(400, "Request body is empty (E: genuuid)");
|
|
23834
23845
|
}
|
|
23835
23846
|
let parsed;
|
|
23836
23847
|
try {
|
|
23837
23848
|
parsed = JSON.parse(reqCtx.body);
|
|
23838
23849
|
} catch {
|
|
23839
|
-
return this.error(400, "Request body must be valid JSON (E:
|
|
23850
|
+
return this.error(400, "Request body must be valid JSON (E: genuuid)");
|
|
23840
23851
|
}
|
|
23841
23852
|
const { code, providerId, redirectUri } = parsed;
|
|
23842
23853
|
if (!code || !providerId || !redirectUri) {
|
|
@@ -23933,7 +23944,7 @@ var SsoLoginHandler = class _SsoLoginHandler extends ServeGibHandlerBase {
|
|
|
23933
23944
|
|
|
23934
23945
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/identity/keystone-custodian-genesis.handler.mjs
|
|
23935
23946
|
import * as fs3 from "node:fs/promises";
|
|
23936
|
-
var logalot57 = GLOBAL_LOG_A_LOT
|
|
23947
|
+
var logalot57 = GLOBAL_LOG_A_LOT;
|
|
23937
23948
|
var KeystoneCustodianGenesisHandler = class _KeystoneCustodianGenesisHandler extends ServeGibHandlerBase {
|
|
23938
23949
|
lc = `[${_KeystoneCustodianGenesisHandler.name}]`;
|
|
23939
23950
|
method = "POST";
|
|
@@ -24005,7 +24016,7 @@ var KeystoneCustodianGenesisHandler = class _KeystoneCustodianGenesisHandler ext
|
|
|
24005
24016
|
const defaultUsername = username || normEmail.split("@")[0];
|
|
24006
24017
|
const primaryProfileName = "primary-profile.dev";
|
|
24007
24018
|
if (!primaryProfileName || !primaryProfileName.trim()) {
|
|
24008
|
-
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)');
|
|
24009
24020
|
}
|
|
24010
24021
|
const primaryBuilder = KeystoneProfileBuilder.buildKeystone(primaryProfileName.trim()).withUsername(defaultUsername).withDescription(`Full Custodian Primary Identity for ${normEmail}`).withDetails({
|
|
24011
24022
|
emails: [normEmail],
|
|
@@ -24090,7 +24101,7 @@ var KeystoneCustodianGenesisHandler = class _KeystoneCustodianGenesisHandler ext
|
|
|
24090
24101
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/identity/keystone-custodian-register-delegate.handler.mjs
|
|
24091
24102
|
import * as fs4 from "fs/promises";
|
|
24092
24103
|
import * as path5 from "path";
|
|
24093
|
-
var logalot58 = GLOBAL_LOG_A_LOT
|
|
24104
|
+
var logalot58 = GLOBAL_LOG_A_LOT;
|
|
24094
24105
|
var KeystoneCustodianRegisterDelegateHandler = class _KeystoneCustodianRegisterDelegateHandler extends ServeGibHandlerBase {
|
|
24095
24106
|
lc = `[${_KeystoneCustodianRegisterDelegateHandler.name}]`;
|
|
24096
24107
|
method = "POST";
|
|
@@ -24222,7 +24233,7 @@ var KeystoneCustodianRegisterDelegateHandler = class _KeystoneCustodianRegisterD
|
|
|
24222
24233
|
};
|
|
24223
24234
|
|
|
24224
24235
|
// ../../libs/node-gib/dist/serve-gib/handlers/api/identity/keystone-custodian-add-master-password.handler.mjs
|
|
24225
|
-
var logalot59 = GLOBAL_LOG_A_LOT
|
|
24236
|
+
var logalot59 = GLOBAL_LOG_A_LOT;
|
|
24226
24237
|
var KeystoneCustodianAddMasterPasswordHandler = class _KeystoneCustodianAddMasterPasswordHandler extends ServeGibHandlerBase {
|
|
24227
24238
|
lc = `[${_KeystoneCustodianAddMasterPasswordHandler.name}]`;
|
|
24228
24239
|
method = "POST";
|
|
@@ -24231,29 +24242,29 @@ var KeystoneCustodianAddMasterPasswordHandler = class _KeystoneCustodianAddMaste
|
|
|
24231
24242
|
const lc2 = `${this.lc}[${this.handleRouteImpl.name}]`;
|
|
24232
24243
|
try {
|
|
24233
24244
|
if (logalot59) {
|
|
24234
|
-
console.log(`${lc2} starting... (I:
|
|
24245
|
+
console.log(`${lc2} starting... (I: genuuid)`);
|
|
24235
24246
|
}
|
|
24236
24247
|
if (reqCtx.method !== "POST") {
|
|
24237
24248
|
return this.error(405, "Method Not Allowed");
|
|
24238
24249
|
}
|
|
24239
24250
|
if (!reqCtx.body) {
|
|
24240
|
-
return this.error(400, "Request body is empty (E:
|
|
24251
|
+
return this.error(400, "Request body is empty (E: genuuid)");
|
|
24241
24252
|
}
|
|
24242
24253
|
let body;
|
|
24243
24254
|
try {
|
|
24244
24255
|
body = JSON.parse(reqCtx.body);
|
|
24245
24256
|
} catch {
|
|
24246
|
-
return this.error(400, "Request body must be valid JSON (E:
|
|
24257
|
+
return this.error(400, "Request body must be valid JSON (E: genuuid)");
|
|
24247
24258
|
}
|
|
24248
24259
|
const { primaryTjpAddr, newManagePool, providerId, code, redirectUri, email } = body;
|
|
24249
24260
|
if (!primaryTjpAddr) {
|
|
24250
|
-
return this.error(400, "primaryTjpAddr is required (E:
|
|
24261
|
+
return this.error(400, "primaryTjpAddr is required (E: genuuid)");
|
|
24251
24262
|
}
|
|
24252
24263
|
if (!newManagePool || typeof newManagePool !== "object" || newManagePool.id !== POOL_ID_MANAGE) {
|
|
24253
|
-
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)');
|
|
24254
24265
|
}
|
|
24255
24266
|
if (!newManagePool.challenges || Object.keys(newManagePool.challenges).length === 0) {
|
|
24256
|
-
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)");
|
|
24257
24268
|
}
|
|
24258
24269
|
let verifiedEmail;
|
|
24259
24270
|
let effectiveProvider = providerId || "email";
|
|
@@ -24261,12 +24272,12 @@ var KeystoneCustodianAddMasterPasswordHandler = class _KeystoneCustodianAddMaste
|
|
|
24261
24272
|
const service = getSsoCustodianService();
|
|
24262
24273
|
const userInfo = await service.getOAuthUserInfo(providerId, code, redirectUri);
|
|
24263
24274
|
if (!userInfo || !userInfo.email) {
|
|
24264
|
-
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)`);
|
|
24265
24276
|
}
|
|
24266
24277
|
verifiedEmail = normalizeEmail(userInfo.email);
|
|
24267
24278
|
} else if (email && code) {
|
|
24268
24279
|
if (!validateEmail2(email)) {
|
|
24269
|
-
return this.error(400, "Invalid email address format (E:
|
|
24280
|
+
return this.error(400, "Invalid email address format (E: genuuid)");
|
|
24270
24281
|
}
|
|
24271
24282
|
verifiedEmail = normalizeEmail(email);
|
|
24272
24283
|
const tjpHash = await getPendingTjpHash(primaryTjpAddr);
|
|
@@ -24276,22 +24287,22 @@ var KeystoneCustodianAddMasterPasswordHandler = class _KeystoneCustodianAddMaste
|
|
|
24276
24287
|
pendingInfo = reqCtx.dataDir && emailTjpHash ? await getPendingStagingDir({ dataDir: reqCtx.dataDir, tjpHash: emailTjpHash }) : void 0;
|
|
24277
24288
|
}
|
|
24278
24289
|
if (!pendingInfo || pendingInfo.isExpired) {
|
|
24279
|
-
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)");
|
|
24280
24291
|
}
|
|
24281
24292
|
const codeVerifyResult = await verifyPendingCode({
|
|
24282
24293
|
pendingDir: pendingInfo.pendingDir,
|
|
24283
24294
|
code
|
|
24284
24295
|
});
|
|
24285
24296
|
if (!codeVerifyResult.valid) {
|
|
24286
|
-
return this.error(401, codeVerifyResult.error || "Invalid verification code (E:
|
|
24297
|
+
return this.error(401, codeVerifyResult.error || "Invalid verification code (E: genuuid)");
|
|
24287
24298
|
}
|
|
24288
24299
|
} else {
|
|
24289
|
-
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)");
|
|
24290
24301
|
}
|
|
24291
24302
|
const indexService = getIdentityIndexService();
|
|
24292
24303
|
const identityRecord = await indexService.lookupIdentityByEmail({ email: verifiedEmail });
|
|
24293
24304
|
if (!identityRecord || identityRecord.primaryTjpAddr !== primaryTjpAddr) {
|
|
24294
|
-
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)`);
|
|
24295
24306
|
}
|
|
24296
24307
|
const metaspace = await bootstrapDomainMetaspace(primaryTjpAddr, reqCtx.dataDir);
|
|
24297
24308
|
const space = await metaspace.getLocalUserSpace({ lock: false });
|
|
@@ -24310,10 +24321,10 @@ var KeystoneCustodianAddMasterPasswordHandler = class _KeystoneCustodianAddMaste
|
|
|
24310
24321
|
const prevPools = latestKeystone.data.challengePools || [];
|
|
24311
24322
|
const existingManagePool = prevPools.find((p) => p.id === POOL_ID_MANAGE);
|
|
24312
24323
|
if (!existingManagePool) {
|
|
24313
|
-
return this.error(400, 'Primary keystone missing active "manage" pool (E:
|
|
24324
|
+
return this.error(400, 'Primary keystone missing active "manage" pool (E: genuuid)');
|
|
24314
24325
|
}
|
|
24315
24326
|
if (existingManagePool.config?.type && newManagePool.config?.type !== existingManagePool.config.type) {
|
|
24316
|
-
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)`);
|
|
24317
24328
|
}
|
|
24318
24329
|
const custodianPoolId = `${CUSTODIAN_POOL_ID_PREFIX}${effectiveProvider}`;
|
|
24319
24330
|
const auxiliaryCustodianPool = {
|
|
@@ -24403,14 +24414,14 @@ var EmailReceiverAws = class extends EmailReceiverBase {
|
|
|
24403
24414
|
try {
|
|
24404
24415
|
rawData = JSON.parse(rawData);
|
|
24405
24416
|
} catch {
|
|
24406
|
-
throw new Error("Invalid JSON string in AWS inbound payload. (E:
|
|
24417
|
+
throw new Error("Invalid JSON string in AWS inbound payload. (E: genuuid)");
|
|
24407
24418
|
}
|
|
24408
24419
|
}
|
|
24409
24420
|
if (rawData && typeof rawData === "object" && rawData.SigningCertURL) {
|
|
24410
24421
|
try {
|
|
24411
24422
|
const certUrl = new URL(rawData.SigningCertURL);
|
|
24412
24423
|
if (certUrl.protocol !== "https:" || !certUrl.hostname.endsWith(".amazonaws.com")) {
|
|
24413
|
-
throw new Error(`Invalid SNS SigningCertURL host: ${rawData.SigningCertURL} (E:
|
|
24424
|
+
throw new Error(`Invalid SNS SigningCertURL host: ${rawData.SigningCertURL} (E: genuuid)`);
|
|
24414
24425
|
}
|
|
24415
24426
|
} catch (err) {
|
|
24416
24427
|
if (err?.message?.includes("(E: ")) {
|
|
@@ -24426,7 +24437,7 @@ var EmailReceiverAws = class extends EmailReceiverBase {
|
|
|
24426
24437
|
}
|
|
24427
24438
|
}
|
|
24428
24439
|
if (!rawData || typeof rawData !== "object") {
|
|
24429
|
-
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)");
|
|
24430
24441
|
}
|
|
24431
24442
|
const mail = rawData.mail || {};
|
|
24432
24443
|
const receipt = rawData.receipt || {};
|
|
@@ -24499,14 +24510,14 @@ var EmailInboundHandler = class _EmailInboundHandler extends ServeGibHandlerBase
|
|
|
24499
24510
|
payload = reqCtx.body;
|
|
24500
24511
|
}
|
|
24501
24512
|
const inboundEmail = await this.receiver.parseInboundPayload(payload);
|
|
24502
|
-
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)`);
|
|
24503
24514
|
return this.ok({
|
|
24504
24515
|
success: true,
|
|
24505
24516
|
email: inboundEmail
|
|
24506
24517
|
});
|
|
24507
24518
|
} catch (error) {
|
|
24508
24519
|
const emsg = extractErrorMsg(error);
|
|
24509
|
-
console.error(`${lc2} Inbound email handling failed: ${emsg} (E:
|
|
24520
|
+
console.error(`${lc2} Inbound email handling failed: ${emsg} (E: genuuid)`);
|
|
24510
24521
|
return this.error(500, `Inbound email error: ${emsg}`);
|
|
24511
24522
|
}
|
|
24512
24523
|
}
|
|
@@ -24539,15 +24550,15 @@ var EmailOutboundHandler = class _EmailOutboundHandler extends ServeGibHandlerBa
|
|
|
24539
24550
|
}
|
|
24540
24551
|
const sendResult = await this.sender.sendEmail(emailData);
|
|
24541
24552
|
if (sendResult.success) {
|
|
24542
|
-
console.log(`${lc2} Successfully dispatched outbound email msgId: ${sendResult.messageId} (I:
|
|
24553
|
+
console.log(`${lc2} Successfully dispatched outbound email msgId: ${sendResult.messageId} (I: genuuid)`);
|
|
24543
24554
|
return this.ok(sendResult, sendResult.statusCode || 200);
|
|
24544
24555
|
} else {
|
|
24545
|
-
console.error(`${lc2} Failed to send email: ${sendResult.error} (E:
|
|
24556
|
+
console.error(`${lc2} Failed to send email: ${sendResult.error} (E: genuuid)`);
|
|
24546
24557
|
return this.error(sendResult.statusCode || 500, sendResult.error || "Failed to send email");
|
|
24547
24558
|
}
|
|
24548
24559
|
} catch (error) {
|
|
24549
24560
|
const emsg = extractErrorMsg(error);
|
|
24550
|
-
console.error(`${lc2} Outbound email error: ${emsg} (E:
|
|
24561
|
+
console.error(`${lc2} Outbound email error: ${emsg} (E: genuuid)`);
|
|
24551
24562
|
return this.error(500, `Outbound email error: ${emsg}`);
|
|
24552
24563
|
}
|
|
24553
24564
|
}
|
|
@@ -24557,7 +24568,7 @@ var EmailOutboundHandler = class _EmailOutboundHandler extends ServeGibHandlerBa
|
|
|
24557
24568
|
import * as path6 from "node:path";
|
|
24558
24569
|
import * as fs5 from "node:fs/promises";
|
|
24559
24570
|
import { existsSync as existsSync6 } from "node:fs";
|
|
24560
|
-
var logalot60 = GLOBAL_LOG_A_LOT
|
|
24571
|
+
var logalot60 = GLOBAL_LOG_A_LOT;
|
|
24561
24572
|
var EmailVerificationCodeHandler = class _EmailVerificationCodeHandler extends ServeGibHandlerBase {
|
|
24562
24573
|
lc = `[${_EmailVerificationCodeHandler.name}]`;
|
|
24563
24574
|
method = "POST";
|
|
@@ -24708,7 +24719,7 @@ If you did not request this, please ignore this email.`,
|
|
|
24708
24719
|
import * as fs6 from "node:fs/promises";
|
|
24709
24720
|
import { existsSync as existsSync7 } from "node:fs";
|
|
24710
24721
|
import * as path7 from "node:path";
|
|
24711
|
-
var logalot61 = GLOBAL_LOG_A_LOT
|
|
24722
|
+
var logalot61 = GLOBAL_LOG_A_LOT;
|
|
24712
24723
|
var EmailVerifyCodeOnetimeHandler = class _EmailVerifyCodeOnetimeHandler extends ServeGibHandlerBase {
|
|
24713
24724
|
lc = `[${_EmailVerifyCodeOnetimeHandler.name}]`;
|
|
24714
24725
|
method = "POST";
|
|
@@ -26109,10 +26120,10 @@ var SyncPeer_V1 = class _SyncPeer_V1 extends LightWitnessBase_V1 {
|
|
|
26109
26120
|
const lc2 = `${this.lc}[${this.establishSessionIdentity.name}]`;
|
|
26110
26121
|
try {
|
|
26111
26122
|
if (logalot66) {
|
|
26112
|
-
console.log(`${lc2} starting... (I:
|
|
26123
|
+
console.log(`${lc2} starting... (I: genuuid)`);
|
|
26113
26124
|
}
|
|
26114
26125
|
if (!this.opts) {
|
|
26115
|
-
throw new Error(`(UNEXPECTED) this.opts falsy? Call initializeOpts first. (E:
|
|
26126
|
+
throw new Error(`(UNEXPECTED) this.opts falsy? Call initializeOpts first. (E: genuuid)`);
|
|
26116
26127
|
}
|
|
26117
26128
|
const { senderIdentity, fnSenderSecret, senderDomainAddr, sagaId, localMetaspace, localSpace } = this.opts;
|
|
26118
26129
|
if (!senderIdentity || !fnSenderSecret) {
|
|
@@ -26743,7 +26754,7 @@ async function appendToTimeline({ timeline, rel8nInfos, rel8nRemovalInfos, timel
|
|
|
26743
26754
|
space
|
|
26744
26755
|
});
|
|
26745
26756
|
if (!latestTimelineIbGibAddr) {
|
|
26746
|
-
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)`);
|
|
26747
26758
|
}
|
|
26748
26759
|
let latestTimelineIbGibDto = toDto2({ ibGib: timeline });
|
|
26749
26760
|
if (timelineAddr !== latestTimelineIbGibAddr) {
|
|
@@ -26752,7 +26763,7 @@ async function appendToTimeline({ timeline, rel8nInfos, rel8nRemovalInfos, timel
|
|
|
26752
26763
|
space
|
|
26753
26764
|
});
|
|
26754
26765
|
if (resGetLatest.errorMsg || (resGetLatest.ibGibs ?? []).length !== 1) {
|
|
26755
|
-
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)`);
|
|
26756
26767
|
}
|
|
26757
26768
|
latestTimelineIbGibDto = resGetLatest.ibGibs.at(0);
|
|
26758
26769
|
}
|
|
@@ -26847,7 +26858,7 @@ async function updateSpecialIndex({ type, rel8nInfos, dataToAddOrPatch, metaspac
|
|
|
26847
26858
|
initialize: true
|
|
26848
26859
|
});
|
|
26849
26860
|
if (!specialIndex) {
|
|
26850
|
-
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)`);
|
|
26851
26862
|
}
|
|
26852
26863
|
if (!specialIndex.rel8ns) {
|
|
26853
26864
|
console.warn(`${lc2} not sure if this ever hits, but is there ever a scenario where specialIndex.rel8ns is falsy? (W: 06161c366bc7ec858b9b5aa7ee9b6d25)`);
|
|
@@ -26947,7 +26958,7 @@ async function getLatestTimelineIbGibDto_nonLocking({ timeline, timelineAddr, me
|
|
|
26947
26958
|
space
|
|
26948
26959
|
}) ?? timelineAddr;
|
|
26949
26960
|
if (!latestTimelineIbGibAddr) {
|
|
26950
|
-
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)`);
|
|
26951
26962
|
}
|
|
26952
26963
|
let latestTimelineIbGibDto;
|
|
26953
26964
|
if (timelineAddr === latestTimelineIbGibAddr) {
|
|
@@ -26968,7 +26979,7 @@ async function getLatestTimelineIbGibDto_nonLocking({ timeline, timelineAddr, me
|
|
|
26968
26979
|
space
|
|
26969
26980
|
});
|
|
26970
26981
|
if (resGetLatest.errorMsg || (resGetLatest.ibGibs ?? []).length !== 1) {
|
|
26971
|
-
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)`);
|
|
26972
26983
|
}
|
|
26973
26984
|
latestTimelineIbGibDto = resGetLatest.ibGibs.at(0);
|
|
26974
26985
|
}
|
|
@@ -27034,7 +27045,7 @@ async function getDna({ ibGib, metaspace, space }) {
|
|
|
27034
27045
|
}
|
|
27035
27046
|
space ??= await metaspace.getLocalUserSpace({ lock: false });
|
|
27036
27047
|
if (!space) {
|
|
27037
|
-
throw new Error(`(UNEXPECTED) space is required. (E:
|
|
27048
|
+
throw new Error(`(UNEXPECTED) space is required. (E: genuuid)`);
|
|
27038
27049
|
}
|
|
27039
27050
|
const dnaAddrs = ibGib.rel8ns?.dna ?? [];
|
|
27040
27051
|
if (dnaAddrs.length === 0) {
|
|
@@ -27043,7 +27054,7 @@ async function getDna({ ibGib, metaspace, space }) {
|
|
|
27043
27054
|
const resGet = await metaspace.get({ addrs: dnaAddrs, space });
|
|
27044
27055
|
if (!resGet.success || (resGet.ibGibs ?? []).length !== dnaAddrs.length) {
|
|
27045
27056
|
const notFound = dnaAddrs.filter((addr) => !resGet.ibGibs?.some((x) => getIbGibAddr({ ibGib: x }) === addr));
|
|
27046
|
-
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)`);
|
|
27047
27058
|
}
|
|
27048
27059
|
return resGet.ibGibs;
|
|
27049
27060
|
} catch (error) {
|
|
@@ -27059,7 +27070,7 @@ async function getHistory({ timeline, getLatest, includeDna, metaspace, space })
|
|
|
27059
27070
|
}
|
|
27060
27071
|
space ??= await metaspace.getLocalUserSpace({ lock: false });
|
|
27061
27072
|
if (!space) {
|
|
27062
|
-
throw new Error(`(UNEXPECTED) space is required. (E:
|
|
27073
|
+
throw new Error(`(UNEXPECTED) space is required. (E: genuuid)`);
|
|
27063
27074
|
}
|
|
27064
27075
|
const headIbGib = getLatest ? await getLatestTimelineIbGibDto_nonLocking({ timeline, metaspace, space }) : toDto2({ ibGib: timeline });
|
|
27065
27076
|
const headAddr = getIbGibAddr({ ibGib: headIbGib });
|
|
@@ -27158,10 +27169,10 @@ async function getSyncSagaMessageFromFrame({ frameIbGib, space }) {
|
|
|
27158
27169
|
});
|
|
27159
27170
|
const msgs = rel8d[SYNC_MSG_REL8N_NAME];
|
|
27160
27171
|
if (!msgs || msgs.length === 0) {
|
|
27161
|
-
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)`);
|
|
27162
27173
|
}
|
|
27163
27174
|
if (msgs.length > 1) {
|
|
27164
|
-
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)`);
|
|
27165
27176
|
}
|
|
27166
27177
|
return msgs[0];
|
|
27167
27178
|
} catch (error) {
|
|
@@ -27324,7 +27335,7 @@ var GraftMergeStrategyBase_V1 = class {
|
|
|
27324
27335
|
const lc2 = `[${this.constructor.name}][${this.applyTransformAndRegister.name}]`;
|
|
27325
27336
|
try {
|
|
27326
27337
|
if (logalot70) {
|
|
27327
|
-
console.log(`${lc2} starting... (I:
|
|
27338
|
+
console.log(`${lc2} starting... (I: genuuid)`);
|
|
27328
27339
|
}
|
|
27329
27340
|
if (!resTransform) {
|
|
27330
27341
|
throw new Error(`(UNEXPECTED) resTransform falsy (E: 83b27a8102f4423ab194e82f7c001826)`);
|
|
@@ -27387,7 +27398,7 @@ var DefaultDnaReplayGraftStrategy = class extends GraftMergeStrategyBase_V1 {
|
|
|
27387
27398
|
};
|
|
27388
27399
|
var throwIfUnexpected = throwIfUnexpected2;
|
|
27389
27400
|
if (logalot71) {
|
|
27390
|
-
console.log(`${lc2} starting default DNA replay graft... (I:
|
|
27401
|
+
console.log(`${lc2} starting default DNA replay graft... (I: genuuid)`);
|
|
27391
27402
|
}
|
|
27392
27403
|
const { conflictStrategy, timelineAddrsA, timelineAddrsB, latestCommonFrameAddr, ibGibReadCache, space, graftPreference } = context;
|
|
27393
27404
|
const newGraftedIntermediateIbGibs_ordered = [];
|
|
@@ -27550,7 +27561,7 @@ var DefaultDnaReplayGraftStrategy = class extends GraftMergeStrategyBase_V1 {
|
|
|
27550
27561
|
graftInfoCreated: graftInfo
|
|
27551
27562
|
};
|
|
27552
27563
|
} catch (error) {
|
|
27553
|
-
console.error(`${lc2} ${extractErrorMsg(error)} (E:
|
|
27564
|
+
console.error(`${lc2} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
27554
27565
|
throw error;
|
|
27555
27566
|
} finally {
|
|
27556
27567
|
if (logalot71) {
|
|
@@ -27580,11 +27591,11 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27580
27591
|
registerStrategy(strategy) {
|
|
27581
27592
|
const lc2 = `${lcFile}[${this.registerStrategy.name}]`;
|
|
27582
27593
|
if (!strategy) {
|
|
27583
|
-
throw new Error(`(UNEXPECTED) strategy falsy (E:
|
|
27594
|
+
throw new Error(`(UNEXPECTED) strategy falsy (E: genuuid)`);
|
|
27584
27595
|
}
|
|
27585
27596
|
if (!this._registeredStrategies.some((s) => s.strategyId === strategy.strategyId)) {
|
|
27586
27597
|
if (logalot72) {
|
|
27587
|
-
console.log(`${lc2} registering strategy ${strategy.strategyId} (I:
|
|
27598
|
+
console.log(`${lc2} registering strategy ${strategy.strategyId} (I: genuuid)`);
|
|
27588
27599
|
}
|
|
27589
27600
|
this._registeredStrategies.push(strategy);
|
|
27590
27601
|
}
|
|
@@ -27595,10 +27606,10 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27595
27606
|
setFallbackStrategy(strategy) {
|
|
27596
27607
|
const lc2 = `${lcFile}[${this.setFallbackStrategy.name}]`;
|
|
27597
27608
|
if (!strategy) {
|
|
27598
|
-
throw new Error(`(UNEXPECTED) fallback strategy falsy (E:
|
|
27609
|
+
throw new Error(`(UNEXPECTED) fallback strategy falsy (E: genuuid)`);
|
|
27599
27610
|
}
|
|
27600
27611
|
if (logalot72) {
|
|
27601
|
-
console.log(`${lc2} setting fallback strategy ${strategy.strategyId} (I:
|
|
27612
|
+
console.log(`${lc2} setting fallback strategy ${strategy.strategyId} (I: genuuid)`);
|
|
27602
27613
|
}
|
|
27603
27614
|
this._fallbackStrategy = strategy;
|
|
27604
27615
|
}
|
|
@@ -27614,7 +27625,7 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27614
27625
|
reset() {
|
|
27615
27626
|
const lc2 = `${lcFile}[${this.reset.name}]`;
|
|
27616
27627
|
if (logalot72) {
|
|
27617
|
-
console.log(`${lc2} resetting strategies to default fallback... (I:
|
|
27628
|
+
console.log(`${lc2} resetting strategies to default fallback... (I: genuuid)`);
|
|
27618
27629
|
}
|
|
27619
27630
|
this._registeredStrategies = [];
|
|
27620
27631
|
this._fallbackStrategy = new DefaultDnaReplayGraftStrategy();
|
|
@@ -27683,7 +27694,7 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27683
27694
|
let resGraft = void 0;
|
|
27684
27695
|
for (const strategy of strategyPipeline) {
|
|
27685
27696
|
if (logalot72) {
|
|
27686
|
-
console.log(`${lc2} executing graft strategy ${strategy.strategyId} (I:
|
|
27697
|
+
console.log(`${lc2} executing graft strategy ${strategy.strategyId} (I: genuuid)`);
|
|
27687
27698
|
}
|
|
27688
27699
|
resGraft = await strategy.graft(context);
|
|
27689
27700
|
if (resGraft) {
|
|
@@ -27695,7 +27706,7 @@ var GraftStrategyService = class _GraftStrategyService {
|
|
|
27695
27706
|
}
|
|
27696
27707
|
return resGraft;
|
|
27697
27708
|
} catch (error) {
|
|
27698
|
-
console.error(`${lc2} ${extractErrorMsg(error)} (E:
|
|
27709
|
+
console.error(`${lc2} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
27699
27710
|
throw error;
|
|
27700
27711
|
} finally {
|
|
27701
27712
|
if (logalot72) {
|
|
@@ -30081,7 +30092,7 @@ async function main() {
|
|
|
30081
30092
|
console.log(`${lc2} dataDir: ${DATA_DIR}`);
|
|
30082
30093
|
const custodianPrimaryProfile = "primary-profile.dev".trim();
|
|
30083
30094
|
if (!custodianPrimaryProfile) {
|
|
30084
|
-
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)`);
|
|
30085
30096
|
}
|
|
30086
30097
|
const isProdEnv = true;
|
|
30087
30098
|
if (isProdEnv && !custodianPrimaryProfile.endsWith(".prod")) {
|