@ibgib/core-gib 0.0.8 → 0.0.11
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 +5 -10
- package/dist/assumptions.respec.d.mts +2 -0
- package/dist/assumptions.respec.d.mts.map +1 -0
- package/dist/assumptions.respec.mjs +41 -0
- package/dist/assumptions.respec.mjs.map +1 -0
- package/dist/core-constants.d.mts +0 -2
- package/dist/core-constants.d.mts.map +1 -1
- package/dist/core-constants.mjs +0 -2
- package/dist/core-constants.mjs.map +1 -1
- package/dist/core-helper.respec.d.mts +2 -0
- package/dist/core-helper.respec.d.mts.map +1 -0
- package/dist/core-helper.respec.mjs +53 -0
- package/dist/core-helper.respec.mjs.map +1 -0
- package/dist/core-types.d.mts +22 -0
- package/dist/core-types.d.mts.map +1 -1
- package/dist/respec-gib.node.d.mts +2 -0
- package/dist/respec-gib.node.d.mts.map +1 -0
- package/dist/respec-gib.node.mjs +211 -0
- package/dist/respec-gib.node.mjs.map +1 -0
- package/dist/spec-helper.node.respec.d.mts +12 -0
- package/dist/spec-helper.node.respec.d.mts.map +1 -0
- package/dist/spec-helper.node.respec.mjs +43 -0
- package/dist/spec-helper.node.respec.mjs.map +1 -0
- package/dist/witness/app/app-base-v1.d.mts +2 -2
- package/dist/witness/app/app-base-v1.d.mts.map +1 -1
- package/dist/witness/app/app-base-v1.mjs +23 -141
- package/dist/witness/app/app-base-v1.mjs.map +1 -1
- package/dist/witness/app/app-constants.d.mts +2 -0
- package/dist/witness/app/app-constants.d.mts.map +1 -1
- package/dist/witness/app/app-constants.mjs +2 -0
- package/dist/witness/app/app-constants.mjs.map +1 -1
- package/dist/witness/app/app-helper.d.mts.map +1 -1
- package/dist/witness/app/app-helper.mjs +2 -1
- package/dist/witness/app/app-helper.mjs.map +1 -1
- package/dist/witness/app/app-types.d.mts +2 -1
- package/dist/witness/app/app-types.d.mts.map +1 -1
- package/dist/witness/robbot/robbot-base-v1.d.mts +12 -164
- package/dist/witness/robbot/robbot-base-v1.d.mts.map +1 -1
- package/dist/witness/robbot/robbot-base-v1.mjs +41 -657
- package/dist/witness/robbot/robbot-base-v1.mjs.map +1 -1
- package/dist/witness/robbot/robbot-helper.mjs +3 -3
- package/dist/witness/robbot/robbot-helper.mjs.map +1 -1
- package/dist/witness/robbot/robbot-helper.respec.d.mts +2 -0
- package/dist/witness/robbot/robbot-helper.respec.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-helper.respec.mjs +106 -0
- package/dist/witness/robbot/robbot-helper.respec.mjs.map +1 -0
- package/dist/witness/robbot/robbot-types.d.mts +6 -3
- package/dist/witness/robbot/robbot-types.d.mts.map +1 -1
- package/dist/witness/robbot/robbot-types.mjs +1 -0
- package/dist/witness/robbot/robbot-types.mjs.map +1 -1
- package/dist/witness/space/filesystem-space/filesystem-space-v1.d.mts +1 -1
- package/dist/witness/space/filesystem-space/filesystem-space-v1.d.mts.map +1 -1
- package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.d.mts +2 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.d.mts.map +1 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.mjs +107 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.mjs.map +1 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.d.mts.map +1 -1
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.mjs +1 -1
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.mjs.map +1 -1
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.d.mts +2 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.d.mts.map +1 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.mjs +129 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.mjs.map +1 -0
- package/dist/witness/space/inner-space/inner-space-v1.respec.d.mts +2 -0
- package/dist/witness/space/inner-space/inner-space-v1.respec.d.mts.map +1 -0
- package/dist/witness/space/inner-space/inner-space-v1.respec.mjs +56 -0
- package/dist/witness/space/inner-space/inner-space-v1.respec.mjs.map +1 -0
- package/dist/witness/space/metaspace/metaspace-base.d.mts +795 -0
- package/dist/witness/space/metaspace/metaspace-base.d.mts.map +1 -0
- package/dist/witness/space/metaspace/metaspace-base.mjs +3251 -0
- package/dist/witness/space/metaspace/metaspace-base.mjs.map +1 -0
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.d.mts +4 -0
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.d.mts.map +1 -0
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mjs +117 -0
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mjs.map +1 -0
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.d.mts +34 -0
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.d.mts.map +1 -0
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mjs +76 -0
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mjs.map +1 -0
- package/dist/witness/space/metaspace/metaspace-types.d.mts +580 -0
- package/dist/witness/space/metaspace/metaspace-types.d.mts.map +1 -0
- package/dist/witness/space/metaspace/metaspace-types.mjs +6 -0
- package/dist/witness/space/metaspace/metaspace-types.mjs.map +1 -0
- package/dist/witness/space/space-helper.d.mts.map +1 -1
- package/dist/witness/space/space-helper.mjs +2 -1
- package/dist/witness/space/space-helper.mjs.map +1 -1
- package/dist/witness/space/{space-spec-helper.d.mts → space-respec-helper.d.mts} +15 -5
- package/dist/witness/space/space-respec-helper.d.mts.map +1 -0
- package/dist/witness/space/space-respec-helper.mjs +186 -0
- package/dist/witness/space/space-respec-helper.mjs.map +1 -0
- package/dist/witness/space/space-types.d.mts +2 -1
- package/dist/witness/space/space-types.d.mts.map +1 -1
- package/dist/witness/space/space-types.mjs.map +1 -1
- package/dist/witness/witness-base-v1.d.mts.map +1 -1
- package/dist/witness/witness-base-v1.mjs +7 -7
- package/dist/witness/witness-base-v1.mjs.map +1 -1
- package/dist/witness/witness-cmd/witness-cmd-types.d.mts +31 -0
- package/dist/witness/witness-cmd/witness-cmd-types.d.mts.map +1 -0
- package/dist/witness/witness-cmd/witness-cmd-types.mjs +2 -0
- package/dist/witness/witness-cmd/witness-cmd-types.mjs.map +1 -0
- package/dist/witness/witness-helper.d.mts +8 -0
- package/dist/witness/witness-helper.d.mts.map +1 -1
- package/dist/witness/witness-helper.mjs +30 -0
- package/dist/witness/witness-helper.mjs.map +1 -1
- package/dist/witness/witness-types.d.mts +26 -36
- package/dist/witness/witness-types.d.mts.map +1 -1
- package/dist/witness/witness-with-context/witness-with-context-base-v1.d.mts +235 -0
- package/dist/witness/witness-with-context/witness-with-context-base-v1.d.mts.map +1 -0
- package/dist/witness/witness-with-context/witness-with-context-base-v1.mjs +742 -0
- package/dist/witness/witness-with-context/witness-with-context-base-v1.mjs.map +1 -0
- package/dist/witness/witness-with-context/witness-with-context-types.d.mts +17 -0
- package/dist/witness/witness-with-context/witness-with-context-types.d.mts.map +1 -0
- package/dist/witness/witness-with-context/witness-with-context-types.mjs +2 -0
- package/dist/witness/witness-with-context/witness-with-context-types.mjs.map +1 -0
- package/package.json +12 -15
- package/src/{assumptions.spec.mts → assumptions.respec.mts} +11 -5
- package/src/core-constants.mts +0 -2
- package/src/core-helper.respec.mts +71 -0
- package/src/core-types.mts +20 -0
- package/src/respec-gib.node.mts +199 -0
- package/src/witness/app/app-base-v1.mts +19 -212
- package/src/witness/app/app-constants.mts +3 -0
- package/src/witness/app/app-helper.mts +2 -1
- package/src/witness/app/app-types.mts +1 -1
- package/src/witness/robbot/robbot-base-v1.mts +39 -690
- package/src/witness/robbot/robbot-helper.mts +1 -1
- package/src/witness/robbot/{robbot-helper.spec.mts → robbot-helper.respec.mts} +39 -33
- package/src/witness/robbot/robbot-types.mts +5 -3
- package/src/witness/space/filesystem-space/filesystem-space-v1.mts +1 -1
- package/src/witness/space/filesystem-space/{filesystem-space-v1.spec.mts → filesystem-space-v1.respec.mts} +17 -8
- package/src/witness/space/filesystem-space/node-filesystem-space-v1.mts +3 -11
- package/src/witness/space/filesystem-space/{node-filesystem-space-v1.node.spec.mts → node-filesystem-space-v1.node.respec.mts} +18 -14
- package/src/witness/space/inner-space/{inner-space-v1.spec.mts → inner-space-v1.respec.mts} +17 -8
- package/src/witness/space/metaspace/metaspace-base.mts +3702 -0
- package/src/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mts +116 -0
- package/src/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mts +88 -0
- package/src/witness/space/metaspace/metaspace-types.mts +614 -0
- package/src/witness/space/space-helper.mts +2 -1
- package/src/witness/space/{space-spec-helper.mts → space-respec-helper.mts} +76 -57
- package/src/witness/space/space-types.mts +2 -1
- package/src/witness/witness-base-v1.mts +8 -6
- package/src/witness/witness-cmd/witness-cmd-types.mts +38 -0
- package/src/witness/witness-helper.mts +31 -0
- package/src/witness/witness-types.mts +31 -41
- package/src/witness/witness-with-context/witness-with-context-base-v1.mts +809 -0
- package/src/witness/witness-with-context/witness-with-context-types.mts +24 -0
- package/tsconfig.json +1 -0
- package/dist/witness/space/space-spec-helper.d.mts.map +0 -1
- package/dist/witness/space/space-spec-helper.mjs +0 -179
- package/dist/witness/space/space-spec-helper.mjs.map +0 -1
- package/jasmine-browser.json +0 -18
- package/jasmine.json +0 -6
- package/src/core-helper.spec.mts +0 -64
- /package/src/{spec-helper.node.spec.mts → spec-helper.node.respec.mts} +0 -0
|
@@ -13,12 +13,15 @@ import { CommentIbGib_V1 } from '../../common/comment/comment-types.mjs';
|
|
|
13
13
|
import { PicIbGib_V1 } from '../../common/pic/pic-types.mjs';
|
|
14
14
|
import { ErrorIbGib_V1 } from '../../common/error/error-types.mjs';
|
|
15
15
|
import { validateCommonAppData } from './app-helper.mjs';
|
|
16
|
-
import { argy_, isArg, resulty_ } from '../witness-helper.mjs';
|
|
16
|
+
import { argy_, isArg, isCommand, resulty_ } from '../witness-helper.mjs';
|
|
17
17
|
import { IbGibLocalSpaceService_AllPowerful } from '../../core-types.mjs';
|
|
18
18
|
import { pretty } from '@ibgib/helper-gib';
|
|
19
19
|
import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
|
|
20
20
|
import { errorIbGib } from '../../common/error/error-helper.mjs';
|
|
21
21
|
import { getIbGibAddr } from '@ibgib/ts-gib';
|
|
22
|
+
import { isComment } from '../../common/comment/comment-helper.mjs';
|
|
23
|
+
import { isPic } from '../../common/pic/pic-helper.mjs';
|
|
24
|
+
import { WitnessWithContextBase_V1 } from '../witness-with-context/witness-with-context-base-v1.mjs';
|
|
22
25
|
|
|
23
26
|
const logalot = GLOBAL_LOG_A_LOT || false;
|
|
24
27
|
|
|
@@ -44,7 +47,7 @@ export abstract class AppBase_V1<
|
|
|
44
47
|
TData extends AppData_V1 = AppData_V1,
|
|
45
48
|
TRel8ns extends AppRel8ns_V1 = AppRel8ns_V1,
|
|
46
49
|
>
|
|
47
|
-
extends
|
|
50
|
+
extends WitnessWithContextBase_V1<
|
|
48
51
|
TOptionsData, TOptionsRel8ns, TOptionsIbGib,
|
|
49
52
|
TResultData, TResultRel8ns, TResultIbGib,
|
|
50
53
|
TData, TRel8ns>
|
|
@@ -54,18 +57,6 @@ export abstract class AppBase_V1<
|
|
|
54
57
|
* Log context for convenience with logging. (Ignore if you don't want to use this.)
|
|
55
58
|
*/
|
|
56
59
|
protected lc: string = `[${AppBase_V1.name}]`;
|
|
57
|
-
// protected lc: string = `[${AppBase_V1.name}]`;
|
|
58
|
-
|
|
59
|
-
// getAppIb(classname: string): string {
|
|
60
|
-
// const lc = `${this.lc}[${this.getAppIb.name}]`;
|
|
61
|
-
// if (!classname) {
|
|
62
|
-
// classname = this.lc?.replace('[','').replace(']','') || AppBase_V1.name+'_descendant';
|
|
63
|
-
// console.warn(`${lc} classname is falsy. Using ${classname}.`);
|
|
64
|
-
// }
|
|
65
|
-
// const name = this.data?.name || IBGIB_SPACE_NAME_DEFAULT;
|
|
66
|
-
// const id = this.data?.uuid || undefined;
|
|
67
|
-
// return `witness space ${classname} ${name} ${id}`;
|
|
68
|
-
// }
|
|
69
60
|
|
|
70
61
|
/**
|
|
71
62
|
* Reference to the local ibgibs service, which is one way at getting at the
|
|
@@ -90,22 +81,12 @@ export abstract class AppBase_V1<
|
|
|
90
81
|
try {
|
|
91
82
|
if (logalot) { console.log(`${lc} starting...`); }
|
|
92
83
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
let resGet = await this.ibgibsSvc.get({ addr: latestAddr });
|
|
100
|
-
if (!resGet || !resGet?.success || (resGet?.ibGibs ?? []).length === 0) {
|
|
101
|
-
throw new Error(`could not get newer app ibgib (E: 15fa346c8ac17edb96e4b0870104c122)`);
|
|
102
|
-
}
|
|
103
|
-
await this.loadIbGibDto(resGet.ibGibs![0] as IbGib_V1<TData, TRel8ns>);
|
|
104
|
-
const validationErrors = await this.validateThis();
|
|
105
|
-
if (validationErrors?.length > 0) { throw new Error(`validationErrors when loading newer version: ${pretty(validationErrors)} (E: 0d9f0684a1ff6af44e20a57130e3ac22)`); }
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return this.routeAndDoArg({ arg });
|
|
84
|
+
await this.loadNewerSelfIfAvailable();
|
|
85
|
+
|
|
86
|
+
let result = await this.routeAndDoArg({ arg });
|
|
87
|
+
if (!result) { result = await this.doDefault({ ibGib: arg }); }
|
|
88
|
+
if (!result) { console.warn(`${lc} result falsy...Could not produce result? Was doDefault implemented in concrete class? (W: 15e70486bc33922f9388961bab815223)`); }
|
|
89
|
+
return result;
|
|
109
90
|
} catch (error) {
|
|
110
91
|
console.error(`${lc} ${error.message}`);
|
|
111
92
|
throw error;
|
|
@@ -138,11 +119,16 @@ export abstract class AppBase_V1<
|
|
|
138
119
|
const lc = `${this.lc}[${this.routeAndDoArg.name}]`;
|
|
139
120
|
try {
|
|
140
121
|
if (logalot) { console.log(`${lc} starting...`); }
|
|
141
|
-
|
|
142
|
-
|
|
122
|
+
const ibGib = arg as IbGib_V1;
|
|
123
|
+
if (isArg({ ibGib })) {
|
|
124
|
+
if (isCommand({ ibGib })) {
|
|
143
125
|
return this.doCmdArg({ arg: arg as AppCmdIbGib<IbGib_V1, AppCmdData, AppCmdRel8ns> });
|
|
126
|
+
} else if (isComment({ ibGib })) {
|
|
127
|
+
return this.doComment({ ibGib: ibGib as CommentIbGib_V1 });
|
|
128
|
+
} else if (isPic({ ibGib })) {
|
|
129
|
+
return this.doPic({ ibGib: ibGib as PicIbGib_V1 });
|
|
144
130
|
} else {
|
|
145
|
-
return
|
|
131
|
+
return undefined;
|
|
146
132
|
}
|
|
147
133
|
}
|
|
148
134
|
} catch (error) {
|
|
@@ -309,138 +295,6 @@ export abstract class AppBase_V1<
|
|
|
309
295
|
|
|
310
296
|
// #endregion other stubbed do functions (doPic, doComment, doDefault)
|
|
311
297
|
|
|
312
|
-
// /**
|
|
313
|
-
// * By default, this...
|
|
314
|
-
// *
|
|
315
|
-
// * * performs the raw {@link rel8} transform to the given `ibGib`.
|
|
316
|
-
// * * persists the new ibgib's transform result in the given space.
|
|
317
|
-
// * * registers the newer version of this app ibgib with the ibgibs svc.
|
|
318
|
-
// *
|
|
319
|
-
// * @see {@link ibGibs}
|
|
320
|
-
// * @see {@link rel8nName}
|
|
321
|
-
// * @see {@link ibgibsSvc}
|
|
322
|
-
// * @see {@link space}
|
|
323
|
-
// *
|
|
324
|
-
// * ## notes
|
|
325
|
-
// *
|
|
326
|
-
// * * If there is no given `space`, then we will use the `ibgibsSvc` to get
|
|
327
|
-
// * the local user space. If none, then we skip persistence.
|
|
328
|
-
// * * If there is no `ibgibsSvc`, we won't register the new ibgibs locally.
|
|
329
|
-
// */
|
|
330
|
-
// protected async rel8To({
|
|
331
|
-
// ibGibs,
|
|
332
|
-
// rel8nName,
|
|
333
|
-
// ibgibsSvc,
|
|
334
|
-
// space,
|
|
335
|
-
// }: {
|
|
336
|
-
// /**
|
|
337
|
-
// * The ibgib to which we are relating.
|
|
338
|
-
// */
|
|
339
|
-
// ibGibs: IbGib_V1[],
|
|
340
|
-
// /**
|
|
341
|
-
// * If given, will use this as the rel8n name when performing the `rel8`
|
|
342
|
-
// * transform.
|
|
343
|
-
// *
|
|
344
|
-
// * If not given, will use the `app.data`'s {@link AppData_V1.defaultRel8nName} value.
|
|
345
|
-
// */
|
|
346
|
-
// rel8nName?: string,
|
|
347
|
-
// /**
|
|
348
|
-
// * If provided, will register the newly created ibgib.
|
|
349
|
-
// */
|
|
350
|
-
// ibgibsSvc?: IbgibsService,
|
|
351
|
-
// /**
|
|
352
|
-
// * If given (which atow is most likely the case), then the {@link TransformResult} will
|
|
353
|
-
// * be persisted in this `space`.
|
|
354
|
-
// */
|
|
355
|
-
// space?: IbGibSpaceAny,
|
|
356
|
-
// }): Promise<void> {
|
|
357
|
-
// const lc = `${this.lc}[${this.rel8To.name}]`;
|
|
358
|
-
// try {
|
|
359
|
-
// if (logalot) { console.log(`${lc} starting...`); }
|
|
360
|
-
|
|
361
|
-
// // #region initialize, validate args and this
|
|
362
|
-
|
|
363
|
-
// if ((ibGibs ?? []).length === 0) { throw new Error(`ibGibs required (E: 2fd13de0f025b170885bede4d7a50922)`); }
|
|
364
|
-
|
|
365
|
-
// rel8nName = rel8nName || this.data?.defaultRel8nName;
|
|
366
|
-
// if (!rel8nName) { throw new Error(`rel8nName required either as an arg or in this.data.defaultRel8nName (E: 43ab8ae63694a2a82cd8a70ed6b6b522)`); }
|
|
367
|
-
|
|
368
|
-
// const thisValidationErrors = await this.validateThis();
|
|
369
|
-
// if (thisValidationErrors?.length > 0) { throw new Error(`this is an invalid ibGib. thisValidationErrors: ${thisValidationErrors.join('|')} (E: 8f08716866cd13bf254222ee9e6a6722)`); }
|
|
370
|
-
|
|
371
|
-
// if (!ibgibsSvc) {
|
|
372
|
-
// if (this.ibgibsSvc) {
|
|
373
|
-
// if (logalot) { console.log(`${lc} ibgibsSvc arg falsy, but we have a reference on this object, which we will use. (I: ee0d39a47ee8aee8ffd797721fea4322)`); }
|
|
374
|
-
// ibgibsSvc = this.ibgibsSvc;
|
|
375
|
-
// }
|
|
376
|
-
// }
|
|
377
|
-
|
|
378
|
-
// if (!space) {
|
|
379
|
-
// if (ibgibsSvc) {
|
|
380
|
-
// if (logalot) { console.log(`${lc} space arg falsy, but ibgibsSvc truthy, so we'll use ibgibsSvc's local user space for persistence. (I: 37a4b4c1406556cb23831671755b0d22)`); }
|
|
381
|
-
// space = await ibgibsSvc.getLocalUserSpace({ lock: true });
|
|
382
|
-
// }
|
|
383
|
-
// }
|
|
384
|
-
|
|
385
|
-
// // #endregion initialize, validate args and this
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
// // we want to rel8 only to the ibGibs whose timelines we're not
|
|
390
|
-
// // already related to. So we look to see if we already have the tjpGib
|
|
391
|
-
// // per our rel8nName.
|
|
392
|
-
// const alreadyRel8dAddrs = this.rel8ns[rel8nName] ?? [];
|
|
393
|
-
// const alreadyRel8dTjpGibs = alreadyRel8dAddrs.map(x => getGibInfo({ ibGibAddr: x }).tjpGib);
|
|
394
|
-
// const ibGibsNotYetRel8dByTjp = ibGibs.filter(x => {
|
|
395
|
-
// const tjpGib = getGibInfo({ ibGibAddr: h.getIbGibAddr({ ibGib: x }) }).tjpGib;
|
|
396
|
-
// return !alreadyRel8dTjpGibs.includes(tjpGib);
|
|
397
|
-
// });
|
|
398
|
-
|
|
399
|
-
// if (ibGibsNotYetRel8dByTjp.length === 0) {
|
|
400
|
-
// if (logalot) { console.log(`${lc} already rel8d to all incoming ibGib(s) via tjp. (I: 5e9d94a98ba262f146c0c0b765157922)`); }
|
|
401
|
-
// return; /* <<<< returns early */
|
|
402
|
-
// }
|
|
403
|
-
|
|
404
|
-
// // perform the raw ibgib rel8 transform
|
|
405
|
-
// const addrs = ibGibsNotYetRel8dByTjp.map(x => h.getIbGibAddr({ ibGib: x }));
|
|
406
|
-
// const resNewApp = await V1.rel8({
|
|
407
|
-
// src: this.toIbGibDto(),
|
|
408
|
-
// rel8nsToAddByAddr: { [rel8nName]: addrs },
|
|
409
|
-
// linkedRel8ns: ["past", "ancestor"], // we only want the most recent key address
|
|
410
|
-
// dna: true,
|
|
411
|
-
// nCounter: true,
|
|
412
|
-
// });
|
|
413
|
-
// const newAppIbGib = <IbGib_V1<TData, TRel8ns>>resNewApp.newIbGib;
|
|
414
|
-
// const newAppValidationErrors =
|
|
415
|
-
// await validateIbGibIntrinsically({ ibGib: newAppIbGib });
|
|
416
|
-
// if (newAppValidationErrors?.length > 0) { throw new Error(`new app would have validation errors. aborting. newAppValidationErrors: ${newAppValidationErrors.join('|')} (E: eb816a27156c246c121ef55e37d59322)`); }
|
|
417
|
-
|
|
418
|
-
// // if space is given, perform the persistence
|
|
419
|
-
// if (space) {
|
|
420
|
-
// await persistTransformResult({ resTransform: resNewApp, space });
|
|
421
|
-
// } else {
|
|
422
|
-
// if (logalot) { console.log(`${lc} space falsy, skipping persistence (I: 90aa3553e92ad1d02bce61f83648ea22)`); }
|
|
423
|
-
// }
|
|
424
|
-
|
|
425
|
-
// // if ibgibs svc is given, register the new ibgib
|
|
426
|
-
// // (in the future, need to revisit the ibgibs service to the idea of locality/ies).
|
|
427
|
-
// if (ibgibsSvc) {
|
|
428
|
-
// await ibgibsSvc.registerNewIbGib({ ibGib: newAppIbGib, space });
|
|
429
|
-
// } else {
|
|
430
|
-
// if (logalot) { console.log(`${lc} ibgibsSvc falsy so skipping registerNewIbGib for new app (I: eda4f68fffaf2435eba25cd39d4f2922)`); }
|
|
431
|
-
// }
|
|
432
|
-
|
|
433
|
-
// // update this witness' primary ibGib properties (ib, gib, data, rel8ns).
|
|
434
|
-
// // override `loadIbGibDto` to update secondary/derivative properties
|
|
435
|
-
// await this.loadIbGibDto(newAppIbGib);
|
|
436
|
-
// } catch (error) {
|
|
437
|
-
// console.error(`${lc} ${error.message}`);
|
|
438
|
-
// throw error;
|
|
439
|
-
// } finally {
|
|
440
|
-
// if (logalot) { console.log(`${lc} complete.`); }
|
|
441
|
-
// }
|
|
442
|
-
// }
|
|
443
|
-
|
|
444
298
|
/**
|
|
445
299
|
* validates against common app qualities.
|
|
446
300
|
*
|
|
@@ -530,53 +384,6 @@ export abstract class AppBase_V1<
|
|
|
530
384
|
return result;
|
|
531
385
|
}
|
|
532
386
|
|
|
533
|
-
// protected async rel8ToIbGib({
|
|
534
|
-
// ibGibToRel8,
|
|
535
|
-
// ibGibAddrToRel8,
|
|
536
|
-
// contextIbGib,
|
|
537
|
-
// rel8nNames,
|
|
538
|
-
// }: {
|
|
539
|
-
// ibGibToRel8?: IbGib_V1,
|
|
540
|
-
// ibGibAddrToRel8?: IbGibAddr,
|
|
541
|
-
// contextIbGib: IbGib_V1,
|
|
542
|
-
// rel8nNames: string[],
|
|
543
|
-
// }): Promise<void> {
|
|
544
|
-
// const lc = `${this.lc}[${this.rel8ToIbGib.name}]`;
|
|
545
|
-
// try {
|
|
546
|
-
// if (!ibGibToRel8 && !ibGibAddrToRel8) { throw new Error(`ibGibToRel8 or ibGibAddrToRel8 required (E: 3ee14659fd22355a5ba0e537a477be22)`); }
|
|
547
|
-
// if (!contextIbGib) { throw new Error(`contextIbGib required (E: 85f27c7cbf713704c21084c141cd8822)`); }
|
|
548
|
-
|
|
549
|
-
// if ((rel8nNames ?? []).length === 0) {
|
|
550
|
-
// if (!this.data?.defaultRel8nName) { throw new Error(`either rel8nNames or this.data.defaultRel8nName required (E: a14ab4b3e479d9274c61bc5a30bc2222)`); }
|
|
551
|
-
// rel8nNames = [this.data.defaultRel8nName];
|
|
552
|
-
// }
|
|
553
|
-
|
|
554
|
-
// // set up the rel8ns to add
|
|
555
|
-
// const rel8nsToAddByAddr: IbGibRel8ns_V1 = {};
|
|
556
|
-
// ibGibAddrToRel8 = ibGibAddrToRel8 || h.getIbGibAddr({ ibGib: ibGibToRel8 });
|
|
557
|
-
// rel8nNames.forEach((rel8nName) => { rel8nsToAddByAddr[rel8nName] = [ibGibAddrToRel8]; });
|
|
558
|
-
|
|
559
|
-
// // perform the rel8 transform and...
|
|
560
|
-
// const resRel8ToContext =
|
|
561
|
-
// await V1.rel8({
|
|
562
|
-
// src: contextIbGib,
|
|
563
|
-
// rel8nsToAddByAddr,
|
|
564
|
-
// dna: true,
|
|
565
|
-
// nCounter: true
|
|
566
|
-
// });
|
|
567
|
-
|
|
568
|
-
// // ...persist it...
|
|
569
|
-
// await this.ibgibsSvc.persistTransformResult({ resTransform: resRel8ToContext });
|
|
570
|
-
|
|
571
|
-
// // ...register the context.
|
|
572
|
-
// const { newIbGib: newContext } = resRel8ToContext;
|
|
573
|
-
// await this.ibgibsSvc.registerNewIbGib({ ibGib: newContext });
|
|
574
|
-
// } catch (error) {
|
|
575
|
-
// console.error(`${lc} ${error.message}`);
|
|
576
|
-
// throw error;
|
|
577
|
-
// }
|
|
578
|
-
// }
|
|
579
|
-
|
|
580
387
|
}
|
|
581
388
|
|
|
582
389
|
export interface IbGibAppAny
|
|
@@ -3,8 +3,9 @@ import { Gib, Ib, } from '@ibgib/ts-gib';
|
|
|
3
3
|
import { validateIbGibIntrinsically } from '@ibgib/ts-gib/dist/V1/validate-helper.mjs';
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
|
|
7
7
|
import { AppData_V1, } from './app-types.mjs';
|
|
8
|
+
import { APP_NAME_REGEXP, APP_REL8N_NAME, } from './app-constants.mjs';
|
|
8
9
|
import { IbGibAppAny } from './app-base-v1.mjs';
|
|
9
10
|
// import { CommonService } from '../../services/common.service.mjs';
|
|
10
11
|
// import { getFn_promptAppIbGib } from './prompt-functions.mjs';
|
|
@@ -5,11 +5,11 @@ import { IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
|
5
5
|
// import { IonicSpaceData_V1 } from '../witnesses/spaces/ionic-space-v1';
|
|
6
6
|
import {
|
|
7
7
|
WitnessData_V1, WitnessRel8ns_V1,
|
|
8
|
-
WitnessCmdData, WitnessCmdRel8ns, WitnessCmdIbGib,
|
|
9
8
|
WitnessResultData, WitnessResultRel8ns, WitnessResultIbGib,
|
|
10
9
|
} from '../witness-types.mjs';
|
|
11
10
|
import { IbGibSpaceData_Subpathed } from '../space/space-types.mjs';
|
|
12
11
|
import { IbGibAppAny } from './app-base-v1.mjs';
|
|
12
|
+
import { WitnessCmdData, WitnessCmdRel8ns, WitnessCmdIbGib, } from '../witness-cmd/witness-cmd-types.mjs';
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|