@ibgib/space-gib 0.0.1

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/Dockerfile +14 -0
  3. package/IMPLEMENTATION.md +484 -0
  4. package/README.md +46 -0
  5. package/dist/client/bootstrap.mjs +58 -0
  6. package/dist/client/bootstrap.mjs.map +7 -0
  7. package/dist/client/chunk-CT47Z5WU.mjs +21 -0
  8. package/dist/client/chunk-CT47Z5WU.mjs.map +7 -0
  9. package/dist/client/chunk-RHEDTRKF.mjs +235 -0
  10. package/dist/client/chunk-RHEDTRKF.mjs.map +7 -0
  11. package/dist/client/index.html +147 -0
  12. package/dist/client/index.mjs +2 -0
  13. package/dist/client/index.mjs.map +7 -0
  14. package/dist/client/script.mjs +2 -0
  15. package/dist/client/script.mjs.map +7 -0
  16. package/dist/client/style.css +605 -0
  17. package/dist/respec-gib.node.mjs +5 -0
  18. package/dist/server/server.mjs +20157 -0
  19. package/dist/server/server.mjs.map +7 -0
  20. package/generate-version-file.js +35 -0
  21. package/package.json +27 -0
  22. package/src/client/AUTO-GENERATED-version.mts +11 -0
  23. package/src/client/README.md +19 -0
  24. package/src/client/api/function-infos.web.mts +38 -0
  25. package/src/client/api/space-gib-api-bridge.mts +85 -0
  26. package/src/client/bootstrap.mts +49 -0
  27. package/src/client/components/keystone-creator/keystone-creator.css +139 -0
  28. package/src/client/components/keystone-creator/keystone-creator.html +26 -0
  29. package/src/client/components/keystone-creator/keystone-creator.mts +229 -0
  30. package/src/client/constants.mts +76 -0
  31. package/src/client/custom.d.ts +11 -0
  32. package/src/client/dev-tools.mts +540 -0
  33. package/src/client/helpers.web.mts +178 -0
  34. package/src/client/index.html +147 -0
  35. package/src/client/index.mts +59 -0
  36. package/src/client/script.mts +13 -0
  37. package/src/client/style.css +605 -0
  38. package/src/client/types.mts +85 -0
  39. package/src/client/ui/shell/space-gib-shell-constants.mts +24 -0
  40. package/src/client/ui/shell/space-gib-shell-service.mts +233 -0
  41. package/src/client/ui/shell/space-gib-shell-types.mts +5 -0
  42. package/src/client/witness/app/space-gib/space-gib-app-v1.mts +160 -0
  43. package/src/client/witness/app/space-gib/space-gib-constants.mts +38 -0
  44. package/src/client/witness/app/space-gib/space-gib-helper.mts +72 -0
  45. package/src/client/witness/app/space-gib/space-gib-types.mts +47 -0
  46. package/src/common/keystone-policies.mts +159 -0
  47. package/src/respec-gib.node.mts +6 -0
  48. package/src/server/README.md +18 -0
  49. package/src/server/bootstrap-helper.mts +141 -0
  50. package/src/server/bootstrap-helper.respec.mts +100 -0
  51. package/src/server/metaspace-nodeindexedspace/metaspace-nodeindexedspace.mts +85 -0
  52. package/src/server/path-constants.mts +89 -0
  53. package/src/server/path-helper.mts +101 -0
  54. package/src/server/path-helper.respec.mts +94 -0
  55. package/src/server/serve-gib/CHANGELOG.md +29 -0
  56. package/src/server/serve-gib/README.md +34 -0
  57. package/src/server/serve-gib/constants.mts +1 -0
  58. package/src/server/serve-gib/handlers/api/debug/ws-echo.handler.mts +104 -0
  59. package/src/server/serve-gib/handlers/api/health.handler.mts +23 -0
  60. package/src/server/serve-gib/handlers/api/health.respec.mts +51 -0
  61. package/src/server/serve-gib/handlers/api/ibgib/ibgib-handler-types.mts +49 -0
  62. package/src/server/serve-gib/handlers/api/ibgib/ibgib.handler.mts +176 -0
  63. package/src/server/serve-gib/handlers/api/keystone/keystone-evolve.handler.mts +261 -0
  64. package/src/server/serve-gib/handlers/api/keystone/keystone-genesis.handler.mts +146 -0
  65. package/src/server/serve-gib/handlers/api/keystone/keystone-get.handler.mts +198 -0
  66. package/src/server/serve-gib/handlers/api/keystone/keystone-get.respec.mts +107 -0
  67. package/src/server/serve-gib/handlers/api/keystone/keystone-handler-types.mts +29 -0
  68. package/src/server/serve-gib/handlers/api/keystone/keystone-post.handler.mts +70 -0
  69. package/src/server/serve-gib/handlers/api/keystone/keystone-post.respec.mts +130 -0
  70. package/src/server/serve-gib/handlers/error-handler.mts +36 -0
  71. package/src/server/serve-gib/handlers/handler-base.mts +383 -0
  72. package/src/server/serve-gib/handlers/static-handler.mts +82 -0
  73. package/src/server/serve-gib/handlers/ws/sync-upgrade.handler.mts +498 -0
  74. package/src/server/serve-gib/handlers/ws/ws-helper.mts +111 -0
  75. package/src/server/serve-gib/handlers/ws/ws-types.mts +53 -0
  76. package/src/server/serve-gib/serve-gib-helpers.mts +32 -0
  77. package/src/server/serve-gib/serve-gib-v1.mts +172 -0
  78. package/src/server/serve-gib/serve-gib.respec.mts +90 -0
  79. package/src/server/serve-gib/types.mts +102 -0
  80. package/src/server/server-constants.mts +2 -0
  81. package/src/server/server.mts +96 -0
  82. package/tsconfig.json +29 -0
  83. package/tsconfig.server.json +29 -0
  84. package/tsconfig.test.json +27 -0
@@ -0,0 +1,233 @@
1
+ import { extractErrorMsg } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
2
+ import { ROOT_ADDR } from "@ibgib/ts-gib/dist/V1/constants.mjs";
3
+ import { getComponentSvc } from "@ibgib/web-gib/dist/ui/component/ibgib-component-service.mjs";
4
+ import { IbGibDynamicComponentMeta } from "@ibgib/web-gib/dist/ui/component/component-types.mjs";
5
+
6
+ import { APP_CONFIG } from "../../constants.mjs";
7
+ import { getIbGibGlobalThis_SpaceGib } from "../../helpers.web.mjs";
8
+ import {
9
+ ID_APP_ROOT, ID_HEADER_PANEL, ID_LEFT_PANEL, ID_CENTER_PANEL,
10
+ ID_RIGHT_PANEL, ID_FOOTER_PANEL, ID_LEFT_RESIZER, ID_RIGHT_RESIZER,
11
+ ID_FOOTER_RESIZER, ID_BTN_LEFT_PANEL_TOGGLE, ID_BTN_RIGHT_PANEL_TOGGLE,
12
+ ID_BTN_CREATE_KEYSTONE, ID_CENTER_PANEL_CONTENT,
13
+ EVENT_SHELL_READY
14
+ } from "./space-gib-shell-constants.mjs";
15
+ import { PanelState } from "./space-gib-shell-types.mjs";
16
+ import { KeystoneCreatorComponentMeta } from "../../components/keystone-creator/keystone-creator.mjs";
17
+
18
+ export class SpaceGibShellService {
19
+ private lc: string = `[SpaceGibShellService]`;
20
+
21
+ public initialized: Promise<void>;
22
+
23
+ // Panel States
24
+ private leftPanelState: PanelState = 'collapsed';
25
+ private rightPanelState: PanelState = 'collapsed';
26
+
27
+ // Resizing State
28
+ private isResizingLeft = false;
29
+ private isResizingRight = false;
30
+ private isResizingFooter = false;
31
+
32
+ constructor() {
33
+ this.initialized = this.initialize();
34
+ }
35
+
36
+ private async initialize(): Promise<void> {
37
+ this.initElements();
38
+ this.initEventHandlers();
39
+ await this.registerComponents();
40
+ }
41
+
42
+ private initElements(): void {
43
+ const lc = `${this.lc}[${this.initElements.name}]`;
44
+ try {
45
+ // Initial CSS vars setup
46
+ this.updateCssVariables();
47
+ } catch (error) {
48
+ console.error(`${lc} ${extractErrorMsg(error)}`);
49
+ }
50
+ }
51
+
52
+ private initEventHandlers(): void {
53
+ const lc = `${this.lc}[${this.initEventHandlers.name}]`;
54
+ try {
55
+ // Left Panel Toggle
56
+ const btnLeft = document.getElementById(ID_BTN_LEFT_PANEL_TOGGLE);
57
+ if (btnLeft) {
58
+ btnLeft.addEventListener('click', () => this.toggleLeftPanel());
59
+ }
60
+
61
+ // Right Panel Toggle
62
+ const btnRight = document.getElementById(ID_BTN_RIGHT_PANEL_TOGGLE);
63
+ if (btnRight) {
64
+ btnRight.addEventListener('click', () => this.toggleRightPanel());
65
+ }
66
+
67
+ // Resizers
68
+ const leftResizer = document.getElementById(ID_LEFT_RESIZER);
69
+ if (leftResizer) {
70
+ leftResizer.addEventListener('mousedown', () => {
71
+ if (this.leftPanelState === 'expanded') { this.isResizingLeft = true; }
72
+ });
73
+ leftResizer.addEventListener('dblclick', () => this.toggleLeftPanel());
74
+ }
75
+
76
+ const rightResizer = document.getElementById(ID_RIGHT_RESIZER);
77
+ if (rightResizer) {
78
+ rightResizer.addEventListener('mousedown', () => {
79
+ if (this.rightPanelState === 'expanded') { this.isResizingRight = true; }
80
+ });
81
+ rightResizer.addEventListener('dblclick', () => this.toggleRightPanel());
82
+ }
83
+
84
+ const footerResizer = document.getElementById(ID_FOOTER_RESIZER);
85
+ if (footerResizer) {
86
+ footerResizer.addEventListener('mousedown', () => this.isResizingFooter = true);
87
+ }
88
+
89
+ // Window mouse events for dragging
90
+ window.addEventListener('mousemove', (e) => this.handleMouseMove(e));
91
+ window.addEventListener('mouseup', () => this.handleMouseUp());
92
+
93
+ // Create Keystone Button
94
+ const btnCreate = document.getElementById(ID_BTN_CREATE_KEYSTONE);
95
+ if (btnCreate) {
96
+ btnCreate.addEventListener('click', () => this.showKeystoneCreator());
97
+ }
98
+
99
+ } catch (error) {
100
+ console.error(`${lc} ${extractErrorMsg(error)}`);
101
+ }
102
+ }
103
+
104
+ private async showKeystoneCreator() {
105
+ const lc = `${this.lc}[${this.showKeystoneCreator.name}]`;
106
+ try {
107
+ // 1. Expand side panels (as requested for visual transition)
108
+ if (this.leftPanelState === 'collapsed') { this.toggleLeftPanel(); }
109
+ if (this.rightPanelState === 'collapsed') { this.toggleRightPanel(); }
110
+
111
+ // 2. Instantiate and inject the component
112
+ const componentSvc = await getComponentSvc();
113
+ const component = await componentSvc.getComponentInstance({
114
+ path: 'space-gib-keystone-creator',
115
+ ibGibAddr: ROOT_ADDR, // Virtual address for initial render
116
+ useRegExpPrefilter: true,
117
+ });
118
+
119
+ const centerPanel = document.getElementById(ID_CENTER_PANEL);
120
+ if (centerPanel && component) {
121
+ centerPanel.innerHTML = ''; // Clear hero section
122
+ centerPanel.appendChild(component as any);
123
+ }
124
+ } catch (error) {
125
+ console.error(`${lc} ${extractErrorMsg(error)}`);
126
+ }
127
+ }
128
+
129
+ private toggleLeftPanel() {
130
+ this.leftPanelState = this.leftPanelState === 'expanded' ? 'collapsed' : 'expanded';
131
+ const panel = document.getElementById(ID_LEFT_PANEL);
132
+ if (panel) {
133
+ if (this.leftPanelState === 'collapsed') {
134
+ panel.classList.add('collapsed');
135
+ } else {
136
+ panel.classList.remove('collapsed');
137
+ }
138
+ }
139
+ }
140
+
141
+ private toggleRightPanel() {
142
+ this.rightPanelState = this.rightPanelState === 'expanded' ? 'collapsed' : 'expanded';
143
+ const panel = document.getElementById(ID_RIGHT_PANEL);
144
+ if (panel) {
145
+ if (this.rightPanelState === 'collapsed') {
146
+ panel.classList.add('collapsed');
147
+ } else {
148
+ panel.classList.remove('collapsed');
149
+ }
150
+ }
151
+ }
152
+
153
+ private handleMouseMove(e: MouseEvent) {
154
+ if (!this.isResizingLeft && !this.isResizingRight && !this.isResizingFooter) return;
155
+
156
+ // Prevent text selection while dragging
157
+ e.preventDefault();
158
+
159
+ if (this.isResizingLeft) {
160
+ // Constrain between 100px and 600px
161
+ let newWidth = Math.max(100, Math.min(e.clientX, 600));
162
+ document.documentElement.style.setProperty('--left-panel-width', `${newWidth}px`);
163
+ }
164
+
165
+ if (this.isResizingRight) {
166
+ // Right panel width = window inner width - mouse X
167
+ let newWidth = Math.max(100, Math.min(window.innerWidth - e.clientX, 600));
168
+ document.documentElement.style.setProperty('--right-panel-width', `${newWidth}px`);
169
+ }
170
+
171
+ if (this.isResizingFooter) {
172
+ // Footer height = window inner height - mouse Y
173
+ let newHeight = Math.max(24, Math.min(window.innerHeight - e.clientY, 400));
174
+ document.documentElement.style.setProperty('--footer-panel-height', `${newHeight}px`);
175
+ }
176
+ }
177
+
178
+ private handleMouseUp() {
179
+ this.isResizingLeft = false;
180
+ this.isResizingRight = false;
181
+ this.isResizingFooter = false;
182
+ }
183
+
184
+ private updateCssVariables() {
185
+ // We set defaults in CSS, but this is a placeholder if we need to load saved user prefs later
186
+ }
187
+
188
+ private async registerComponents(): Promise<void> {
189
+ const lc = `${this.lc}[${this.registerComponents.name}]`;
190
+ try {
191
+ const componentsMeta: IbGibDynamicComponentMeta[] = [
192
+ new KeystoneCreatorComponentMeta(),
193
+ ];
194
+ const componentSvc = await getComponentSvc();
195
+ for (let componentMeta of componentsMeta) {
196
+ componentSvc.registerComponentMeta(componentMeta);
197
+ }
198
+ } catch (error) {
199
+ console.error(`${lc} ${extractErrorMsg(error)}`);
200
+ throw error;
201
+ }
202
+ }
203
+
204
+ public async onEngineReady(): Promise<void> {
205
+ const lc = `${this.lc}[${this.onEngineReady.name}]`;
206
+ try {
207
+ await this.initialized;
208
+ console.log(`${lc} SpaceGib Shell Service is ready.`);
209
+
210
+ // Ensure the UI removes the loading text
211
+ const statusSection = document.getElementById('status-section');
212
+ if (statusSection) {
213
+ statusSection.style.display = 'none';
214
+ }
215
+
216
+ window.dispatchEvent(new CustomEvent(EVENT_SHELL_READY, { detail: { timestamp: Date.now() } }));
217
+ } catch (error) {
218
+ console.error(`${lc} ${extractErrorMsg(error)}`);
219
+ }
220
+ }
221
+ }
222
+
223
+ export function getSpaceGibShellSvc(): SpaceGibShellService {
224
+ const lc = `[getSpaceGibShellSvc]`;
225
+ const ibGibGlobalThis = getIbGibGlobalThis_SpaceGib(APP_CONFIG);
226
+ if (!ibGibGlobalThis.spaceGibShellSvc) {
227
+ if (typeof (console) !== 'undefined') {
228
+ console.log(`${lc} initializing SpaceGibShellService singleton on globalThis... (I: genuuid)`);
229
+ }
230
+ ibGibGlobalThis.spaceGibShellSvc = new SpaceGibShellService();
231
+ }
232
+ return ibGibGlobalThis.spaceGibShellSvc;
233
+ }
@@ -0,0 +1,5 @@
1
+ export type PanelState = 'collapsed' | 'expanded';
2
+
3
+ export interface ShellReadyDetail {
4
+ timestamp: number;
5
+ }
@@ -0,0 +1,160 @@
1
+ /**
2
+ * @module SpaceGibApp_V1
3
+ *
4
+ * The App witness for space-gib. This is the client-side engine that manages
5
+ * local ibgib interactions and proxies storage requests to the server API.
6
+ *
7
+ * ## design notes
8
+ *
9
+ * * For Phase 1 (scaffold), this simply extends AppBase_V1 with no extra
10
+ * commands — a solid foundation to evolve.
11
+ * * Keystone-scoped write operations and manifest management will be layered
12
+ * in subsequent phases (see IMPLEMENTATION.md).
13
+ */
14
+
15
+ import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
16
+ import { IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
17
+ import { AppBase_V1 } from '@ibgib/core-gib/dist/witness/app/app-base-v1.mjs';
18
+
19
+ import { GLOBAL_LOG_A_LOT } from '../../../constants.mjs';
20
+ import {
21
+ SpaceGibAppData_V1,
22
+ SpaceGibAppRel8ns_V1,
23
+ SpaceGibAppAddlMetadata,
24
+ } from './space-gib-types.mjs';
25
+ import { ROOT } from '@ibgib/ts-gib/dist/V1/constants.mjs';
26
+ import { WITNESS_CONTEXT_REL8N_NAME } from '@ibgib/core-gib/dist/witness/witness-constants.mjs';
27
+ import { isRequestComment } from './space-gib-helper.mjs';
28
+ import { RequestCommentIbGib_V1 } from '../../../types.mjs';
29
+ import { PARAM_INFO_INTERACTIVE } from './space-gib-constants.mjs';
30
+
31
+ const logalot = GLOBAL_LOG_A_LOT;
32
+
33
+ /**
34
+ * SpaceGib App witness — client-side engine.
35
+ */
36
+ export class SpaceGibApp_V1 extends AppBase_V1<
37
+ // in
38
+ any, IbGibRel8ns_V1, IbGib_V1<any, IbGibRel8ns_V1>,
39
+ // out
40
+ any, IbGibRel8ns_V1, IbGib_V1<any, IbGibRel8ns_V1>,
41
+ // this
42
+ SpaceGibAppData_V1, SpaceGibAppRel8ns_V1
43
+ > {
44
+ protected lc: string = `[${SpaceGibApp_V1.name}]`;
45
+
46
+ constructor(
47
+ initialData?: SpaceGibAppData_V1,
48
+ initialRel8ns?: SpaceGibAppRel8ns_V1
49
+ ) {
50
+ super(initialData, initialRel8ns);
51
+ const lc = `${this.lc}[ctor]`;
52
+ try {
53
+ if (logalot) { console.log(`${lc} starting...`); }
54
+ this.initialized = this.initialize();
55
+ } catch (error) {
56
+ console.error(`${lc} ${extractErrorMsg(error)}`);
57
+ throw error;
58
+ } finally {
59
+ if (logalot) { console.log(`${lc} complete.`); }
60
+ }
61
+ }
62
+
63
+ /**
64
+ * @returns addlmetadata string (atow default impl in base class)
65
+ */
66
+ protected getAddlMetadata(): string {
67
+ return super.getAddlMetadata();
68
+ }
69
+ protected parseAddlMetadataString<TParseResult>({ ib }: { ib: string; }): TParseResult {
70
+ if (!ib) { throw new Error(`ib required (E: aec93595c12cc15ee71d92dd8a4f4f23)`); }
71
+ const lc = `[${this.parseAddlMetadataString.name}]`;
72
+ try {
73
+ const [atom, classnameIsh, nameIsh, idIsh] = ib.split('_');
74
+ const result = { atom, classnameIsh, nameIsh, idIsh, } as SpaceGibAppAddlMetadata;
75
+ return result as TParseResult;
76
+ } catch (error) {
77
+ console.error(`${lc} ${extractErrorMsg(error)}`);
78
+ throw error;
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Minimal override — will be expanded in Phase 2 to route to API
84
+ * endpoints and handle keystone-scoped writes.
85
+ */
86
+ protected async handleNewContextChild({ newChild }: { newChild: IbGib_V1 }): Promise<void> {
87
+ const lc = `${this.lc}[${this.handleNewContextChild.name}]`;
88
+ try {
89
+ if (logalot) { console.log(`${lc} starting... (I: 8494f1d374a8490bb4598c8bffa1fe75)`); }
90
+ // TODO Phase 2: route to REST API
91
+ } catch (error) {
92
+ console.error(`${lc} ${extractErrorMsg(error)}`);
93
+ throw error;
94
+ } finally {
95
+ if (logalot) { console.log(`${lc} complete.`); }
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Overridden to handle Request comments (commands).
101
+ */
102
+ protected async doNonArg({
103
+ ibGib,
104
+ }: {
105
+ ibGib: IbGib_V1,
106
+ }): Promise<IbGib_V1 | undefined> {
107
+ const lc = `${this.lc}[${this.doNonArg.name}]`;
108
+ try {
109
+ if (logalot) { console.log(`${lc} starting...`); }
110
+
111
+ if (isRequestComment({ ibGib })) {
112
+ return await this.doContextRequestComment({
113
+ requestCommentIbGib: ibGib as RequestCommentIbGib_V1
114
+ });
115
+ } else {
116
+ return await super.doNonArg({ ibGib });
117
+ }
118
+ } catch (error) {
119
+ console.error(`${lc} ${extractErrorMsg(error)}`);
120
+ throw error;
121
+ } finally {
122
+ if (logalot) { console.log(`${lc} complete.`); }
123
+ }
124
+ }
125
+
126
+ /**
127
+ * Handles the initial bootstrap request or any subsequent command request.
128
+ */
129
+ protected async doContextRequestComment({
130
+ requestCommentIbGib
131
+ }: {
132
+ requestCommentIbGib: RequestCommentIbGib_V1
133
+ }): Promise<IbGib_V1> {
134
+ const lc = `${this.lc}[${this.doContextRequestComment.name}]`;
135
+ try {
136
+ if (logalot) { console.log(`${lc} starting...`); }
137
+
138
+ const { interpretedArgInfos } = requestCommentIbGib.data!;
139
+
140
+ // Handle the initial --interactive bootstrap request
141
+ if (interpretedArgInfos.some(x => x.name === PARAM_INFO_INTERACTIVE.name)) {
142
+ await this.initializeContext({
143
+ contextIbGib: requestCommentIbGib,
144
+ rel8nName: WITNESS_CONTEXT_REL8N_NAME,
145
+ });
146
+
147
+ console.log(`${this.lc} space-gib initialized and ready.`);
148
+ } else {
149
+ console.warn(`${lc} other requests not implemented yet.`);
150
+ }
151
+
152
+ return ROOT;
153
+ } catch (error) {
154
+ console.error(`${lc} ${extractErrorMsg(error)}`);
155
+ throw error;
156
+ } finally {
157
+ if (logalot) { console.log(`${lc} complete.`); }
158
+ }
159
+ }
160
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @module space-gib-constants
3
+ *
4
+ * Constants for the SpaceGib App witness.
5
+ */
6
+
7
+ import { RCLIParamInfo } from "@ibgib/helper-gib/dist/rcli/rcli-types.mjs";
8
+
9
+ // ---------------------------------------------------------------------------
10
+ // Commands
11
+ // ---------------------------------------------------------------------------
12
+
13
+ export type SpaceGibCommand = 'help' | 'quit';
14
+ export const SpaceGibCommand = {
15
+ help: 'help' as SpaceGibCommand,
16
+ quit: 'quit' as SpaceGibCommand,
17
+ } satisfies { [key: string]: SpaceGibCommand };
18
+
19
+ export const SPACE_GIB_COMMANDS: SpaceGibCommand[] = Object.values(SpaceGibCommand);
20
+
21
+ // ---------------------------------------------------------------------------
22
+ // Param infos
23
+ // ---------------------------------------------------------------------------
24
+
25
+ export const PARAM_INFO_INTERACTIVE: RCLIParamInfo = {
26
+ name: 'interactive',
27
+ isFlag: true,
28
+ synonyms: ['i'],
29
+ argTypeName: 'boolean',
30
+ allowMultiple: false,
31
+ };
32
+
33
+ /**
34
+ * PARAM_INFOS consumed by bootstrapIbGibApp
35
+ */
36
+ export const PARAM_INFOS: RCLIParamInfo[] = [
37
+ PARAM_INFO_INTERACTIVE,
38
+ ];
@@ -0,0 +1,72 @@
1
+ import {
2
+ getTimestamp, getUUID,
3
+ } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
4
+ import { RCLIArgInfo, RCLIParamInfo } from '@ibgib/helper-gib/dist/rcli/rcli-types.mjs';
5
+ import { Factory_V1 as factory } from '@ibgib/ts-gib/dist/V1/factory.mjs';
6
+ import { TransformResult } from '@ibgib/ts-gib/dist/types.mjs';
7
+ import { isComment } from '@ibgib/core-gib/dist/common/comment/comment-helper.mjs';
8
+ import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
9
+
10
+ import { RequestCommentData_V1, RequestCommentIbGib_V1 } from "@ibgib/web-gib/dist/app-bootstrap/types.mjs";
11
+
12
+ /**
13
+ * Validates that no duplicate parameter identifiers exist in the config.
14
+ */
15
+ export function validateParamInfos({ paramInfos }: { paramInfos: RCLIParamInfo[] }): string[] {
16
+ const errors: string[] = [];
17
+ const identifiers: string[] = [];
18
+ paramInfos.forEach(p => {
19
+ const names = [p.name, ...(p.synonyms ?? [])];
20
+ names.forEach(name => {
21
+ if (identifiers.includes(name.toLowerCase())) {
22
+ errors.push(`Duplicate identifier found: ${name} (E: genuuid)`);
23
+ }
24
+ identifiers.push(name.toLowerCase());
25
+ });
26
+ });
27
+ return errors;
28
+ }
29
+
30
+ /**
31
+ * Minimal stub for arg validation.
32
+ */
33
+ export function validateArgInfos({ argInfos }: { argInfos: RCLIArgInfo[] }): string | undefined {
34
+ return undefined;
35
+ }
36
+
37
+ /**
38
+ * Detects if an ibgib is a Request Comment (a command).
39
+ */
40
+ export function isRequestComment({ ibGib }: { ibGib: IbGib_V1 }): boolean {
41
+ if (!isComment({ ibGib })) { return false; }
42
+ const data = ibGib.data as RequestCommentData_V1;
43
+ return !!(data?.args?.length && data?.interpretedArgInfos?.length);
44
+ }
45
+
46
+ /**
47
+ * Creates a Request Comment ibgib from raw arguments.
48
+ */
49
+ export async function createRequestCommentIbGib({
50
+ args, interpretedArgInfos,
51
+ }: {
52
+ args: string[],
53
+ interpretedArgInfos: RCLIArgInfo[],
54
+ }): Promise<TransformResult<RequestCommentIbGib_V1>> {
55
+ const text = args.join(' ');
56
+ const data: RequestCommentData_V1 = {
57
+ uuid: await getUUID(),
58
+ text,
59
+ args,
60
+ interpretedArgInfos,
61
+ textTimestamp: getTimestamp(),
62
+ };
63
+
64
+ return await factory.firstGen({
65
+ parentIbGib: factory.primitive({ ib: 'comment' }),
66
+ ib: `comment ${text.substring(0, 32).replace(/ /g, '_')}`,
67
+ data,
68
+ dna: true,
69
+ tjp: { uuid: true, timestamp: true },
70
+ nCounter: true,
71
+ }) as TransformResult<RequestCommentIbGib_V1>;
72
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @module space-gib-types
3
+ *
4
+ * Types for the SpaceGib App witness.
5
+ */
6
+
7
+ import {
8
+ AppData_V1, AppRel8ns_V1,
9
+ AppIbGib_V1,
10
+ } from "@ibgib/core-gib/dist/witness/app/app-types.mjs";
11
+
12
+ export const DEFAULT_UUID_SPACE_GIB_APP = '';
13
+ export const DEFAULT_NAME_SPACE_GIB_APP = 'space_gib';
14
+ export const DEFAULT_DESCRIPTION_SPACE_GIB_APP =
15
+ `SpaceGib: ibgib durable storage and SaaS provider at ibgib.space.`;
16
+
17
+ export interface SpaceGibAppAddlMetadata {
18
+ atom: string;
19
+ classnameIsh: string;
20
+ nameIsh: string;
21
+ idIsh: string;
22
+ }
23
+
24
+ export interface SpaceGibAppData_V1 extends AppData_V1 {
25
+ // app-specific settings will be added here
26
+ }
27
+
28
+ export interface SpaceGibAppRel8ns_V1 extends AppRel8ns_V1 {
29
+ // app-specific rel8ns will be added here
30
+ }
31
+
32
+ export interface SpaceGibAppIbGib_V1 extends AppIbGib_V1<SpaceGibAppData_V1, SpaceGibAppRel8ns_V1> {}
33
+
34
+ export const DEFAULT_SPACE_GIB_APP_DATA_V1: SpaceGibAppData_V1 = {
35
+ version: '1',
36
+ uuid: DEFAULT_UUID_SPACE_GIB_APP,
37
+ name: DEFAULT_NAME_SPACE_GIB_APP,
38
+ description: DEFAULT_DESCRIPTION_SPACE_GIB_APP,
39
+ classname: 'SpaceGibApp_V1',
40
+ icon: 'cube',
41
+ persistOptsAndResultIbGibs: false,
42
+ allowPrimitiveArgs: true,
43
+ catchAllErrors: true,
44
+ trace: false,
45
+ };
46
+
47
+ export const DEFAULT_SPACE_GIB_APP_REL8NS_V1: SpaceGibAppRel8ns_V1 | undefined = undefined;