@ibgib/node-gib 0.0.23 → 0.0.24
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/email/aws/email-receiver-aws.mjs +3 -3
- package/dist/email/aws/email-receiver-aws.mjs.map +1 -1
- package/dist/email/aws/email-sender-aws.mjs +1 -1
- package/dist/email/aws/email-sender-aws.mjs.map +1 -1
- package/dist/email/email-sender.mjs +3 -3
- package/dist/email/email-sender.mjs.map +1 -1
- package/dist/email/verify/email-verify-helpers.mjs +5 -5
- package/dist/email/verify/email-verify-helpers.mjs.map +1 -1
- package/dist/identity/sso/custodian-auth-helpers.mjs +1 -1
- package/dist/identity/sso/custodian-auth-helpers.mjs.map +1 -1
- package/dist/identity/sso/sso-custodian-service.mjs +4 -4
- package/dist/identity/sso/sso-custodian-service.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/email/email-inbound.handler.mjs +2 -2
- package/dist/serve-gib/handlers/api/email/email-inbound.handler.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/email/email-outbound.handler.mjs +3 -3
- package/dist/serve-gib/handlers/api/email/email-outbound.handler.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/email/email-verification-code.handler.mjs +1 -1
- package/dist/serve-gib/handlers/api/email/email-verification-code.handler.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/email/email-verify-code-onetime.handler.mjs +1 -1
- package/dist/serve-gib/handlers/api/email/email-verify-code-onetime.handler.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/identity/keystone-custodian-add-master-password.handler.mjs +15 -15
- package/dist/serve-gib/handlers/api/identity/keystone-custodian-add-master-password.handler.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/identity/keystone-custodian-genesis.handler.mjs +2 -2
- package/dist/serve-gib/handlers/api/identity/keystone-custodian-genesis.handler.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/identity/keystone-custodian-register-delegate.handler.mjs +1 -1
- package/dist/serve-gib/handlers/api/identity/keystone-custodian-register-delegate.handler.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/keystone/keystone-genesis.handler.mjs +2 -2
- package/dist/serve-gib/handlers/api/keystone/keystone-genesis.handler.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/keystone/keystone-lookup.handler.mjs +1 -1
- package/dist/serve-gib/handlers/api/keystone/keystone-lookup.handler.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/keystone/sso-link.handler.mjs +6 -6
- package/dist/serve-gib/handlers/api/keystone/sso-link.handler.mjs.map +1 -1
- package/dist/serve-gib/handlers/api/keystone/sso-login.handler.mjs +3 -3
- package/dist/serve-gib/handlers/api/keystone/sso-login.handler.mjs.map +1 -1
- package/dist/serve-gib/identity-index/identity-index-helpers.mjs +1 -1
- package/dist/serve-gib/identity-index/identity-index-helpers.mjs.map +1 -1
- package/dist/serve-gib/identity-index/identity-index-service.mjs +1 -1
- package/dist/serve-gib/identity-index/identity-index-service.mjs.map +1 -1
- package/dist/vcs/workspace-space-helper.mjs +3 -3
- package/dist/vcs/workspace-space-helper.mjs.map +1 -1
- package/dist/witness/space/node-workspace-projection-space/node-workspace-projection-space-v1.mjs +17 -17
- package/dist/witness/space/node-workspace-projection-space/node-workspace-projection-space-v1.mjs.map +1 -1
- package/package.json +5 -5
- package/src/email/aws/email-receiver-aws.mts +3 -3
- package/src/email/aws/email-sender-aws.mts +1 -1
- package/src/email/email-sender.mts +3 -3
- package/src/email/verify/email-verify-helpers.mts +5 -5
- package/src/identity/sso/custodian-auth-helpers.mts +1 -1
- package/src/identity/sso/sso-custodian-service.mts +4 -4
- package/src/serve-gib/handlers/api/email/email-inbound.handler.mts +2 -2
- package/src/serve-gib/handlers/api/email/email-outbound.handler.mts +3 -3
- package/src/serve-gib/handlers/api/email/email-verification-code.handler.mts +1 -1
- package/src/serve-gib/handlers/api/email/email-verify-code-onetime.handler.mts +1 -1
- package/src/serve-gib/handlers/api/identity/keystone-custodian-add-master-password.handler.mts +15 -15
- package/src/serve-gib/handlers/api/identity/keystone-custodian-genesis.handler.mts +2 -2
- package/src/serve-gib/handlers/api/identity/keystone-custodian-register-delegate.handler.mts +1 -1
- package/src/serve-gib/handlers/api/keystone/keystone-genesis.handler.mts +2 -2
- package/src/serve-gib/handlers/api/keystone/keystone-lookup.handler.mts +1 -1
- package/src/serve-gib/handlers/api/keystone/sso-link.handler.mts +6 -6
- package/src/serve-gib/handlers/api/keystone/sso-login.handler.mts +3 -3
- package/src/serve-gib/identity-index/identity-index-helpers.mts +1 -1
- package/src/serve-gib/identity-index/identity-index-service.mts +1 -1
- package/src/vcs/workspace-space-helper.mts +3 -3
- package/src/witness/space/node-workspace-projection-space/node-workspace-projection-space-v1.mts +17 -17
- package/src/witness/space/node-workspace-projection-space/node-workspace-projection-space-v1.respec.mts +1 -1
- package/dist/vcs/branch-space-helper.d.mts +0 -23
- package/dist/vcs/branch-space-helper.d.mts.map +0 -1
- package/dist/vcs/branch-space-helper.mjs +0 -78
- package/dist/vcs/branch-space-helper.mjs.map +0 -1
- package/src/vcs/branch-space-helper.mts +0 -109
|
@@ -63,21 +63,21 @@ export class SsoLoginHandler extends ServeGibHandlerBase<undefined, undefined> {
|
|
|
63
63
|
): Promise<ResponseResult | undefined> {
|
|
64
64
|
const lc = `${this.lc}[${this.handleRouteImpl.name}]`;
|
|
65
65
|
try {
|
|
66
|
-
if (logalot) { console.log(`${lc} starting... (I:
|
|
66
|
+
if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
|
|
67
67
|
|
|
68
68
|
if (reqCtx.method !== 'POST') {
|
|
69
69
|
return this.error(405, 'Method Not Allowed');
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
if (!reqCtx.body) {
|
|
73
|
-
return this.error(400, 'Request body is empty (E:
|
|
73
|
+
return this.error(400, 'Request body is empty (E: genuuid)');
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
let parsed: SsoLoginBody;
|
|
77
77
|
try {
|
|
78
78
|
parsed = JSON.parse(reqCtx.body);
|
|
79
79
|
} catch {
|
|
80
|
-
return this.error(400, 'Request body must be valid JSON (E:
|
|
80
|
+
return this.error(400, 'Request body must be valid JSON (E: genuuid)');
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
const { code, providerId, redirectUri } = parsed;
|
|
@@ -5,7 +5,7 @@ import { KEYSTONE_EMAIL_REGEXP } from '@ibgib/core-gib/dist/keystone/keystone-co
|
|
|
5
5
|
import { GLOBAL_LOG_A_LOT } from '../server-constants.mjs';
|
|
6
6
|
import { DEFAULT_EMAIL_HASHES_SUBDIR, DEFAULT_IDENTITY_INDEX_SALT } from './identity-index-constants.mjs';
|
|
7
7
|
|
|
8
|
-
const logalot = GLOBAL_LOG_A_LOT
|
|
8
|
+
const logalot = GLOBAL_LOG_A_LOT;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Validates an email address against length constraints and KEYSTONE_EMAIL_REGEXP.
|
|
@@ -9,7 +9,7 @@ import { DEFAULT_IDENTITY_INDEX_SALT, DEFAULT_IDENTITY_INDEX_DIR_NAME } from './
|
|
|
9
9
|
import { getIdentityEmailHash, getShardedIndexPath } from './identity-index-helpers.mjs';
|
|
10
10
|
import { IdentityIndexRecord, IdentityIndexServiceOptions, RegisterEmailIndexResult } from './identity-index-types.mjs';
|
|
11
11
|
|
|
12
|
-
const logalot = GLOBAL_LOG_A_LOT
|
|
12
|
+
const logalot = GLOBAL_LOG_A_LOT;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Service managing atomic, sharded identity index files for backwards email -> primary identity tjpAddr lookups.
|
|
@@ -42,11 +42,11 @@ export async function getOrCreateWorkspaceProjectionSpace({
|
|
|
42
42
|
const lc = `${lcFile}[${getOrCreateWorkspaceProjectionSpace.name}]`;
|
|
43
43
|
try {
|
|
44
44
|
if (logalot) {
|
|
45
|
-
console.log(`${lc} starting... (I:
|
|
45
|
+
console.log(`${lc} starting... (I: genuuid)`);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
if (!metaspace || !workspaceRoot || !backingSpace) {
|
|
49
|
-
throw new Error(`metaspace, workspaceRoot, and backingSpace are required (E:
|
|
49
|
+
throw new Error(`metaspace, workspaceRoot, and backingSpace are required (E: genuuid)`);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const spaceName = name || `ws_${workspaceRoot.replace(/[^a-zA-Z0-9_]/g, '_')}`;
|
|
@@ -94,7 +94,7 @@ export async function getOrCreateWorkspaceProjectionSpace({
|
|
|
94
94
|
spaceName,
|
|
95
95
|
};
|
|
96
96
|
} catch (error) {
|
|
97
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E:
|
|
97
|
+
console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
98
98
|
throw error;
|
|
99
99
|
} finally {
|
|
100
100
|
if (logalot) {
|
package/src/witness/space/node-workspace-projection-space/node-workspace-projection-space-v1.mts
CHANGED
|
@@ -91,11 +91,11 @@ export class NodeWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBas
|
|
|
91
91
|
|
|
92
92
|
const workspaceRoot = this.data?.workspaceRoot;
|
|
93
93
|
if (!workspaceRoot) {
|
|
94
|
-
throw new Error(`${lc} workspaceRoot is required in space data (E:
|
|
94
|
+
throw new Error(`${lc} workspaceRoot is required in space data (E: genuuid)`);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
if (!item || !item.data) {
|
|
98
|
-
throw new Error(`${lc} item and item.data are required (E:
|
|
98
|
+
throw new Error(`${lc} item and item.data are required (E: genuuid)`);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
const { fsType, name } = item.data;
|
|
@@ -124,19 +124,19 @@ export class NodeWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBas
|
|
|
124
124
|
await fs.mkdir(path.dirname(targetPath), { recursive: true });
|
|
125
125
|
|
|
126
126
|
if (!item.rel8ns) {
|
|
127
|
-
throw new Error(`${lc} item.rel8ns required for file item (E:
|
|
127
|
+
throw new Error(`${lc} item.rel8ns required for file item (E: genuuid)`);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
const binAddrs = item.rel8ns.bin;
|
|
131
131
|
if (!binAddrs || binAddrs.length === 0) {
|
|
132
|
-
throw new Error(`${lc} item.rel8ns.bin required for file item ${name} (E:
|
|
132
|
+
throw new Error(`${lc} item.rel8ns.bin required for file item ${name} (E: genuuid)`);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
const latestBinAddr = binAddrs.at(-1)!;
|
|
136
136
|
const binIbGib = await this.fetchIbGib(latestBinAddr);
|
|
137
137
|
|
|
138
138
|
if (binIbGib.data === undefined) {
|
|
139
|
-
throw new Error(`${lc} BinIbGib at addr ${latestBinAddr} has undefined data (E:
|
|
139
|
+
throw new Error(`${lc} BinIbGib at addr ${latestBinAddr} has undefined data (E: genuuid)`);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
let fileData: Uint8Array | string;
|
|
@@ -154,7 +154,7 @@ export class NodeWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBas
|
|
|
154
154
|
await fs.writeFile(targetPath, fileData);
|
|
155
155
|
}
|
|
156
156
|
} catch (error) {
|
|
157
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E:
|
|
157
|
+
console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
158
158
|
throw error;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
@@ -175,7 +175,7 @@ export class NodeWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBas
|
|
|
175
175
|
|
|
176
176
|
const workspaceRoot = this.data?.workspaceRoot;
|
|
177
177
|
if (!workspaceRoot) {
|
|
178
|
-
throw new Error(`${lc} workspaceRoot is required in space data (E:
|
|
178
|
+
throw new Error(`${lc} workspaceRoot is required in space data (E: genuuid)`);
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
const scanDir = subPath ? path.join(workspaceRoot, subPath) : workspaceRoot;
|
|
@@ -209,7 +209,7 @@ export class NodeWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBas
|
|
|
209
209
|
pendingComments,
|
|
210
210
|
};
|
|
211
211
|
} catch (error) {
|
|
212
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E:
|
|
212
|
+
console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
213
213
|
throw error;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
@@ -230,18 +230,18 @@ export class NodeWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBas
|
|
|
230
230
|
|
|
231
231
|
const workspaceRoot = this.data?.workspaceRoot;
|
|
232
232
|
if (!workspaceRoot) {
|
|
233
|
-
throw new Error(`${lc} workspaceRoot is required (E:
|
|
233
|
+
throw new Error(`${lc} workspaceRoot is required (E: genuuid)`);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
const targetRelPath = relPath || (ibGib?.data as any)?.name;
|
|
237
237
|
if (!targetRelPath) {
|
|
238
|
-
throw new Error(`${lc} relPath or item name required for deletion (E:
|
|
238
|
+
throw new Error(`${lc} relPath or item name required for deletion (E: genuuid)`);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
const fullPath = path.join(workspaceRoot, targetRelPath);
|
|
242
242
|
await fs.rm(fullPath, { recursive: true, force: true });
|
|
243
243
|
} catch (error) {
|
|
244
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E:
|
|
244
|
+
console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
245
245
|
throw error;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
@@ -293,7 +293,7 @@ export class NodeWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBas
|
|
|
293
293
|
try {
|
|
294
294
|
entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
295
295
|
} catch (error) {
|
|
296
|
-
console.error(`${lc} Failed to read directory ${dirPath}: ${extractErrorMsg(error)} (E:
|
|
296
|
+
console.error(`${lc} Failed to read directory ${dirPath}: ${extractErrorMsg(error)} (E: genuuid)`);
|
|
297
297
|
throw error;
|
|
298
298
|
}
|
|
299
299
|
|
|
@@ -336,7 +336,7 @@ export class NodeWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBas
|
|
|
336
336
|
try {
|
|
337
337
|
content = await fs.readFile(fullEntryPath, 'utf8');
|
|
338
338
|
} catch (error) {
|
|
339
|
-
console.error(`${lc} Failed to read comment file ${fullEntryPath}: ${extractErrorMsg(error)} (E:
|
|
339
|
+
console.error(`${lc} Failed to read comment file ${fullEntryPath}: ${extractErrorMsg(error)} (E: genuuid)`);
|
|
340
340
|
throw error;
|
|
341
341
|
}
|
|
342
342
|
|
|
@@ -359,7 +359,7 @@ export class NodeWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBas
|
|
|
359
359
|
fileHash = crypto.createHash('sha256').update(fileData).digest('hex');
|
|
360
360
|
size = fileData.length;
|
|
361
361
|
} catch (error) {
|
|
362
|
-
console.error(`${lc} Failed to read file ${fullEntryPath}: ${extractErrorMsg(error)} (E:
|
|
362
|
+
console.error(`${lc} Failed to read file ${fullEntryPath}: ${extractErrorMsg(error)} (E: genuuid)`);
|
|
363
363
|
throw error;
|
|
364
364
|
}
|
|
365
365
|
|
|
@@ -395,19 +395,19 @@ export class NodeWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBas
|
|
|
395
395
|
const lc = `${this.lc}[${this.fetchIbGib.name}]`;
|
|
396
396
|
try {
|
|
397
397
|
if (!this.backingSpace) {
|
|
398
|
-
throw new Error(`${lc} backingSpace required to fetch IbGib at ${addr} (E:
|
|
398
|
+
throw new Error(`${lc} backingSpace required to fetch IbGib at ${addr} (E: genuuid)`);
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
const resGet = await getFromSpace({ space: this.backingSpace, addrs: [addr] });
|
|
402
402
|
if (!resGet.success || !resGet.ibGibs || resGet.ibGibs.length === 0) {
|
|
403
403
|
const resIbGib = resGet.rawResultIbGib as any;
|
|
404
404
|
const addrsNotFound = resIbGib?.data?.addrsNotFound ?? 'unknown';
|
|
405
|
-
throw new Error(`${lc} couldn't find addr ${addr} in backingSpace. addrsNotFound: ${addrsNotFound} (E:
|
|
405
|
+
throw new Error(`${lc} couldn't find addr ${addr} in backingSpace. addrsNotFound: ${addrsNotFound} (E: genuuid)`);
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
return resGet.ibGibs[0];
|
|
409
409
|
} catch (error) {
|
|
410
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E:
|
|
410
|
+
console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
411
411
|
throw error;
|
|
412
412
|
}
|
|
413
413
|
}
|
|
@@ -9,7 +9,7 @@ import fs from 'node:fs/promises';
|
|
|
9
9
|
import crypto from 'node:crypto';
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
|
-
respecfully, ifWeMight, iReckon, firstOfAll, lastOfAll
|
|
12
|
+
respecfully, ifWe, ifWeMight, iReckon, firstOfAll, lastOfAll, // don't remove ifWe/ifWeMight even if unused
|
|
13
13
|
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
14
14
|
import { Factory_V1 as factory } from '@ibgib/ts-gib/dist/V1/factory.mjs';
|
|
15
15
|
import { getGib } from '@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module branch-space-helper
|
|
3
|
-
*
|
|
4
|
-
* Helper for managing dedicated Node branch spaces (`b2s_...`) in metaspace.
|
|
5
|
-
*/
|
|
6
|
-
import { Metaspace_Nodespace } from '../witness/space/metaspace/metaspace-nodespace/metaspace-nodespace.mjs';
|
|
7
|
-
import { NodeFilesystemSpace_V1 } from '../witness/space/node-filesystem-space/node-filesystem-space-v1.mjs';
|
|
8
|
-
export { populateBranchSpaceFromGraph, PopulateBranchSpaceFromGraphOpts, PopulateBranchSpaceFromGraphResult, } from '@ibgib/core-gib/dist/vcs/branch/branch-graph-helper.mjs';
|
|
9
|
-
export interface GetOrCreateBranchSpaceOpts {
|
|
10
|
-
metaspace: Metaspace_Nodespace;
|
|
11
|
-
vcsPath: string;
|
|
12
|
-
branchName: string;
|
|
13
|
-
}
|
|
14
|
-
export interface GetOrCreateBranchSpaceResult {
|
|
15
|
-
space: NodeFilesystemSpace_V1;
|
|
16
|
-
spaceId: string;
|
|
17
|
-
spaceName: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Gets an existing branch space or creates and registers a new dedicated NodeFilesystemSpace_V1 in metaspace.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getOrCreateBranchSpace({ metaspace, vcsPath, branchName, }: GetOrCreateBranchSpaceOpts): Promise<GetOrCreateBranchSpaceResult>;
|
|
23
|
-
//# sourceMappingURL=branch-space-helper.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"branch-space-helper.d.mts","sourceRoot":"","sources":["../../src/vcs/branch-space-helper.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wEAAwE,CAAC;AAC7G,OAAO,EAAE,sBAAsB,EAAE,MAAM,qEAAqE,CAAC;AAM7G,OAAO,EACH,4BAA4B,EAC5B,gCAAgC,EAChC,kCAAkC,GACrC,MAAM,yDAAyD,CAAC;AAKjE,MAAM,WAAW,0BAA0B;IACvC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,4BAA4B;IACzC,KAAK,EAAE,sBAAsB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,EACzC,SAAS,EACT,OAAO,EACP,UAAU,GACb,EAAE,0BAA0B,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAiEpE"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module branch-space-helper
|
|
3
|
-
*
|
|
4
|
-
* Helper for managing dedicated Node branch spaces (`b2s_...`) in metaspace.
|
|
5
|
-
*/
|
|
6
|
-
import { clone, extractErrorMsg, getUUID } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
7
|
-
import { getGib } from '@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs';
|
|
8
|
-
import { NodeFilesystemSpace_V1 } from '../witness/space/node-filesystem-space/node-filesystem-space-v1.mjs';
|
|
9
|
-
import { DEFAULT_NODE_FILESYSTEM_SPACE_DATA_V1 } from '../witness/space/node-filesystem-space/node-filesystem-space-types.mjs';
|
|
10
|
-
import { putInSpace } from '@ibgib/core-gib/dist/witness/space/space-helper.mjs';
|
|
11
|
-
import { GLOBAL_LOG_A_LOT } from '@ibgib/core-gib/dist/core-constants.mjs';
|
|
12
|
-
import { getB2tFSBranchSpaceName } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
|
|
13
|
-
export { populateBranchSpaceFromGraph, } from '@ibgib/core-gib/dist/vcs/branch/branch-graph-helper.mjs';
|
|
14
|
-
const lcFile = `[branch-space-helper]`;
|
|
15
|
-
const logalot = GLOBAL_LOG_A_LOT;
|
|
16
|
-
/**
|
|
17
|
-
* Gets an existing branch space or creates and registers a new dedicated NodeFilesystemSpace_V1 in metaspace.
|
|
18
|
-
*/
|
|
19
|
-
export async function getOrCreateBranchSpace({ metaspace, vcsPath, branchName, }) {
|
|
20
|
-
const lc = `${lcFile}[${getOrCreateBranchSpace.name}]`;
|
|
21
|
-
try {
|
|
22
|
-
if (logalot) {
|
|
23
|
-
console.log(`${lc} starting... (I: a1b2c3d4e5f60718293a4b5c6d7e8f9a)`);
|
|
24
|
-
}
|
|
25
|
-
if (!metaspace || !vcsPath || !branchName) {
|
|
26
|
-
throw new Error(`metaspace, vcsPath, and branchName are required (E: b2c3d4e5f60718293a4b5c6d7e8f9a0b)`);
|
|
27
|
-
}
|
|
28
|
-
const spaceName = getB2tFSBranchSpaceName(branchName);
|
|
29
|
-
const localSpaces = await metaspace.getLocalUserSpaces({ lock: false });
|
|
30
|
-
const existingSpace = localSpaces.find(s => s.data?.name === spaceName || s.ib === spaceName);
|
|
31
|
-
if (existingSpace) {
|
|
32
|
-
const spaceId = existingSpace.data?.uuid || existingSpace.data?.spaceId || spaceName;
|
|
33
|
-
if (logalot) {
|
|
34
|
-
console.log(`${lc} Found existing branch space ${spaceName} (spaceId: ${spaceId}) (I: c3d4e5f60718293a4b5c6d7e8f9a0b1c)`);
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
space: existingSpace,
|
|
38
|
-
spaceId,
|
|
39
|
-
spaceName,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const spaceUuid = await getUUID();
|
|
43
|
-
const spaceData = {
|
|
44
|
-
...clone(DEFAULT_NODE_FILESYSTEM_SPACE_DATA_V1),
|
|
45
|
-
uuid: spaceUuid,
|
|
46
|
-
isTjp: true,
|
|
47
|
-
name: spaceName,
|
|
48
|
-
baseDir: vcsPath,
|
|
49
|
-
spaceSubPath: spaceName,
|
|
50
|
-
};
|
|
51
|
-
const space = new NodeFilesystemSpace_V1(spaceData);
|
|
52
|
-
space.gib = await getGib({ ibGib: space, hasTjp: true });
|
|
53
|
-
await space.initialized;
|
|
54
|
-
await putInSpace({ space: metaspace.zeroSpace, ibGib: space });
|
|
55
|
-
await metaspace.registerNewIbGib({ ibGib: space });
|
|
56
|
-
if (metaspace.fnUpdateBootstrap) {
|
|
57
|
-
await metaspace.fnUpdateBootstrap(space);
|
|
58
|
-
}
|
|
59
|
-
if (logalot) {
|
|
60
|
-
console.log(`${lc} Created new branch space ${spaceName} (spaceId: ${spaceUuid}) (I: d4e5f60718293a4b5c6d7e8f9a0b1c2d)`);
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
space,
|
|
64
|
-
spaceId: spaceUuid,
|
|
65
|
-
spaceName,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E: e5f60718293a4b5c6d7e8f9a0b1c2d3e)`);
|
|
70
|
-
throw error;
|
|
71
|
-
}
|
|
72
|
-
finally {
|
|
73
|
-
if (logalot) {
|
|
74
|
-
console.log(`${lc} complete. (I: f60718293a4b5c6d7e8f9a0b1c2d3e4f)`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=branch-space-helper.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"branch-space-helper.mjs","sourceRoot":"","sources":["../../src/vcs/branch-space-helper.mts"],"names":[],"mappings":"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"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module branch-space-helper
|
|
3
|
-
*
|
|
4
|
-
* Helper for managing dedicated Node branch spaces (`b2s_...`) in metaspace.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { clone, extractErrorMsg, getUUID } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
8
|
-
import { getGib } from '@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs';
|
|
9
|
-
import { Metaspace_Nodespace } from '../witness/space/metaspace/metaspace-nodespace/metaspace-nodespace.mjs';
|
|
10
|
-
import { NodeFilesystemSpace_V1 } from '../witness/space/node-filesystem-space/node-filesystem-space-v1.mjs';
|
|
11
|
-
import { DEFAULT_NODE_FILESYSTEM_SPACE_DATA_V1 } from '../witness/space/node-filesystem-space/node-filesystem-space-types.mjs';
|
|
12
|
-
import { putInSpace } from '@ibgib/core-gib/dist/witness/space/space-helper.mjs';
|
|
13
|
-
import { GLOBAL_LOG_A_LOT } from '@ibgib/core-gib/dist/core-constants.mjs';
|
|
14
|
-
import { getB2tFSBranchSpaceName } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
populateBranchSpaceFromGraph,
|
|
18
|
-
PopulateBranchSpaceFromGraphOpts,
|
|
19
|
-
PopulateBranchSpaceFromGraphResult,
|
|
20
|
-
} from '@ibgib/core-gib/dist/vcs/branch/branch-graph-helper.mjs';
|
|
21
|
-
|
|
22
|
-
const lcFile = `[branch-space-helper]`;
|
|
23
|
-
const logalot = GLOBAL_LOG_A_LOT;
|
|
24
|
-
|
|
25
|
-
export interface GetOrCreateBranchSpaceOpts {
|
|
26
|
-
metaspace: Metaspace_Nodespace;
|
|
27
|
-
vcsPath: string;
|
|
28
|
-
branchName: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface GetOrCreateBranchSpaceResult {
|
|
32
|
-
space: NodeFilesystemSpace_V1;
|
|
33
|
-
spaceId: string;
|
|
34
|
-
spaceName: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Gets an existing branch space or creates and registers a new dedicated NodeFilesystemSpace_V1 in metaspace.
|
|
39
|
-
*/
|
|
40
|
-
export async function getOrCreateBranchSpace({
|
|
41
|
-
metaspace,
|
|
42
|
-
vcsPath,
|
|
43
|
-
branchName,
|
|
44
|
-
}: GetOrCreateBranchSpaceOpts): Promise<GetOrCreateBranchSpaceResult> {
|
|
45
|
-
const lc = `${lcFile}[${getOrCreateBranchSpace.name}]`;
|
|
46
|
-
try {
|
|
47
|
-
if (logalot) {
|
|
48
|
-
console.log(`${lc} starting... (I: a1b2c3d4e5f60718293a4b5c6d7e8f9a)`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!metaspace || !vcsPath || !branchName) {
|
|
52
|
-
throw new Error(`metaspace, vcsPath, and branchName are required (E: b2c3d4e5f60718293a4b5c6d7e8f9a0b)`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const spaceName = getB2tFSBranchSpaceName(branchName);
|
|
56
|
-
|
|
57
|
-
const localSpaces = await metaspace.getLocalUserSpaces({ lock: false });
|
|
58
|
-
const existingSpace = localSpaces.find(s => s.data?.name === spaceName || s.ib === spaceName);
|
|
59
|
-
|
|
60
|
-
if (existingSpace) {
|
|
61
|
-
const spaceId = existingSpace.data?.uuid || existingSpace.data?.spaceId || spaceName;
|
|
62
|
-
if (logalot) {
|
|
63
|
-
console.log(`${lc} Found existing branch space ${spaceName} (spaceId: ${spaceId}) (I: c3d4e5f60718293a4b5c6d7e8f9a0b1c)`);
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
space: existingSpace as NodeFilesystemSpace_V1,
|
|
67
|
-
spaceId,
|
|
68
|
-
spaceName,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const spaceUuid = await getUUID();
|
|
73
|
-
const spaceData = {
|
|
74
|
-
...clone(DEFAULT_NODE_FILESYSTEM_SPACE_DATA_V1),
|
|
75
|
-
uuid: spaceUuid,
|
|
76
|
-
isTjp: true,
|
|
77
|
-
name: spaceName,
|
|
78
|
-
baseDir: vcsPath,
|
|
79
|
-
spaceSubPath: spaceName,
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const space = new NodeFilesystemSpace_V1(spaceData);
|
|
83
|
-
space.gib = await getGib({ ibGib: space, hasTjp: true });
|
|
84
|
-
await space.initialized;
|
|
85
|
-
|
|
86
|
-
await putInSpace({ space: metaspace.zeroSpace, ibGib: space });
|
|
87
|
-
await metaspace.registerNewIbGib({ ibGib: space });
|
|
88
|
-
if (metaspace.fnUpdateBootstrap) {
|
|
89
|
-
await metaspace.fnUpdateBootstrap(space);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (logalot) {
|
|
93
|
-
console.log(`${lc} Created new branch space ${spaceName} (spaceId: ${spaceUuid}) (I: d4e5f60718293a4b5c6d7e8f9a0b1c2d)`);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
space,
|
|
98
|
-
spaceId: spaceUuid,
|
|
99
|
-
spaceName,
|
|
100
|
-
};
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E: e5f60718293a4b5c6d7e8f9a0b1c2d3e)`);
|
|
103
|
-
throw error;
|
|
104
|
-
} finally {
|
|
105
|
-
if (logalot) {
|
|
106
|
-
console.log(`${lc} complete. (I: f60718293a4b5c6d7e8f9a0b1c2d3e4f)`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|