@ibgib/web-gib 0.0.64 → 0.0.66
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/AUTO-GENERATED-version.d.mts +1 -1
- package/dist/AUTO-GENERATED-version.mjs +1 -1
- package/dist/api/commands/ibgib/get-ibgibs.mjs +4 -4
- package/dist/api/commands/ibgib/get-ibgibs.mjs.map +1 -1
- package/dist/identity/device-delegate-helper.mjs +5 -5
- package/dist/identity/device-delegate-helper.mjs.map +1 -1
- package/dist/identity/keystone-sync-service.mjs +3 -3
- package/dist/identity/keystone-sync-service.mjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/dist/storage/storage-helpers.web.mjs +1 -1
- package/dist/storage/storage-helpers.web.mjs.map +1 -1
- package/dist/ui/component/identity/add-device/add-device.d.mts.map +1 -1
- package/dist/ui/component/identity/add-device/add-device.mjs +1 -1
- package/dist/ui/component/identity/add-device/add-device.mjs.map +1 -1
- package/dist/ui/component/identity/identity-header/identity-header.d.mts.map +1 -1
- package/dist/ui/component/identity/identity-header/identity-header.mjs +4 -4
- package/dist/ui/component/identity/identity-header/identity-header.mjs.map +1 -1
- package/dist/ui/component/identity/keystone-details/keystone-details.mjs +2 -2
- package/dist/ui/component/identity/keystone-details/keystone-details.mjs.map +1 -1
- package/dist/ui/component/privacy-policy/index.d.mts +11 -0
- package/dist/ui/component/privacy-policy/index.d.mts.map +1 -0
- package/dist/ui/component/privacy-policy/index.mjs +16 -0
- package/dist/ui/component/privacy-policy/index.mjs.map +1 -0
- package/dist/ui/component/privacy-policy/privacy-policy.css +263 -0
- package/dist/ui/component/privacy-policy/privacy-policy.d.mts +46 -0
- package/dist/ui/component/privacy-policy/privacy-policy.d.mts.map +1 -0
- package/dist/ui/component/privacy-policy/privacy-policy.html +27 -0
- package/dist/ui/component/privacy-policy/privacy-policy.mjs +128 -0
- package/dist/ui/component/privacy-policy/privacy-policy.mjs.map +1 -0
- package/dist/ui/ui-constants.d.mts +4 -0
- package/dist/ui/ui-constants.d.mts.map +1 -1
- package/dist/ui/ui-constants.mjs +6 -0
- package/dist/ui/ui-constants.mjs.map +1 -1
- package/dist/witness/agent/gemini/gemini-helpers.mjs +4 -4
- package/dist/witness/agent/gemini/gemini-helpers.mjs.map +1 -1
- package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.mjs +11 -11
- package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.mjs.map +1 -1
- package/package.json +5 -5
- package/src/AUTO-GENERATED-version.mts +1 -1
- package/src/api/commands/ibgib/get-ibgibs.mts +4 -4
- package/src/identity/device-delegate-helper.mts +5 -5
- package/src/identity/keystone-sync-service.mts +3 -3
- package/src/index.mts +3 -0
- package/src/storage/storage-helpers.web.mts +1 -1
- package/src/ui/component/identity/add-device/add-device.mts +5 -4
- package/src/ui/component/identity/identity-header/identity-header.mts +4 -3
- package/src/ui/component/identity/keystone-details/keystone-details.mts +2 -2
- package/src/ui/component/privacy-policy/index.mts +18 -0
- package/src/ui/component/privacy-policy/privacy-policy.css +263 -0
- package/src/ui/component/privacy-policy/privacy-policy.html +27 -0
- package/src/ui/component/privacy-policy/privacy-policy.mts +168 -0
- package/src/ui/ui-constants.mts +7 -0
- package/src/witness/agent/gemini/gemini-helpers.mts +4 -4
- package/src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.mts +11 -11
- package/src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.respec.mts +6 -5
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app/SKILL.md +3 -3
- package/tools/auto-generated-agent-skills/skills/ibgib-create-client-app/SKILL.md +1 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-create-client-app-core/SKILL.md +1 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-create-client-app-core/generate-id.js +1 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-create-client-app-witness/SKILL.md +1 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-create-client-identity/SKILL.md +2 -2
- package/tools/auto-generated-agent-skills/skills/ibgib-create-client-shell/SKILL.md +1 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-create-server-app/SKILL.md +1 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-implementation-plan/SKILL.md +7 -4
- package/tsconfig.json +2 -2
- package/dist/api/commands/command-service.respec.d.mts +0 -7
- package/dist/api/commands/command-service.respec.d.mts.map +0 -1
- package/dist/api/commands/command-service.respec.mjs +0 -66
- package/dist/api/commands/command-service.respec.mjs.map +0 -1
- package/dist/assumptions.respec.d.mts +0 -2
- package/dist/assumptions.respec.d.mts.map +0 -1
- package/dist/assumptions.respec.mjs +0 -41
- package/dist/assumptions.respec.mjs.map +0 -1
- package/dist/helpers.web.respec.d.mts +0 -2
- package/dist/helpers.web.respec.d.mts.map +0 -1
- package/dist/helpers.web.respec.mjs +0 -39
- package/dist/helpers.web.respec.mjs.map +0 -1
- package/dist/identity/device-delegate.respec.d.mts +0 -2
- package/dist/identity/device-delegate.respec.d.mts.map +0 -1
- package/dist/identity/device-delegate.respec.mjs +0 -106
- package/dist/identity/device-delegate.respec.mjs.map +0 -1
- package/dist/identity/passkey.respec.d.mts +0 -2
- package/dist/identity/passkey.respec.d.mts.map +0 -1
- package/dist/identity/passkey.respec.mjs +0 -169
- package/dist/identity/passkey.respec.mjs.map +0 -1
- package/dist/spec-helper.node.respec.d.mts +0 -13
- package/dist/spec-helper.node.respec.d.mts.map +0 -1
- package/dist/spec-helper.node.respec.mjs +0 -50
- package/dist/spec-helper.node.respec.mjs.map +0 -1
- package/dist/util/device-helper.respec.d.mts +0 -2
- package/dist/util/device-helper.respec.d.mts.map +0 -1
- package/dist/util/device-helper.respec.mjs +0 -83
- package/dist/util/device-helper.respec.mjs.map +0 -1
- package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.respec.d.mts +0 -8
- package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.respec.d.mts.map +0 -1
- package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.respec.mjs +0 -249
- package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.respec.mjs.map +0 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import thisCss from "./privacy-policy.css";
|
|
2
|
+
import thisHtml from "./privacy-policy.html";
|
|
3
|
+
import commonComponentStylesCss from "../common-component-styles.css";
|
|
4
|
+
|
|
5
|
+
import { extractErrorMsg } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
6
|
+
import { convertMarkdownToHtml } from "@ibgib/helper-gib/dist/helpers/markdown-helper.mjs";
|
|
7
|
+
import { ROOT_ADDR } from "@ibgib/ts-gib/dist/V1/constants.mjs";
|
|
8
|
+
import { IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
|
|
9
|
+
import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
10
|
+
|
|
11
|
+
import { IbGibDynamicComponentMetaBase, IbGibDynamicComponentInstanceBase } from "../ibgib-dynamic-component-bases.mjs";
|
|
12
|
+
import { ElementsBase, IbGibDynamicComponentInstance } from "../component-types.mjs";
|
|
13
|
+
import { getComponentCtorArg } from "../../../app-bootstrap/init-orchestration.mjs";
|
|
14
|
+
|
|
15
|
+
export const PRIVACY_POLICY_COMPONENT_NAME = 'ibgib-privacy-policy';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Metadata for the Privacy Policy component.
|
|
19
|
+
*/
|
|
20
|
+
export class PrivacyPolicyComponentMeta extends IbGibDynamicComponentMetaBase {
|
|
21
|
+
protected lc: string = `[PrivacyPolicyComponentMeta]`;
|
|
22
|
+
|
|
23
|
+
routeRegExp?: RegExp = new RegExp(`^${PRIVACY_POLICY_COMPONENT_NAME}$|^privacy(-policy)?$`, 'i');
|
|
24
|
+
componentName = PRIVACY_POLICY_COMPONENT_NAME;
|
|
25
|
+
|
|
26
|
+
constructor() {
|
|
27
|
+
super(getComponentCtorArg());
|
|
28
|
+
if (typeof customElements !== 'undefined' && !customElements.get(this.componentName)) {
|
|
29
|
+
customElements.define(this.componentName, PrivacyPolicyComponentInstance);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async createInstance({
|
|
34
|
+
path,
|
|
35
|
+
ibGibAddr
|
|
36
|
+
}: {
|
|
37
|
+
path: string;
|
|
38
|
+
ibGibAddr: IbGibAddr;
|
|
39
|
+
}): Promise<IbGibDynamicComponentInstance> {
|
|
40
|
+
const lc = `${this.lc}[${this.createInstance.name}]`;
|
|
41
|
+
const component = document.createElement(this.componentName) as PrivacyPolicyComponentInstance;
|
|
42
|
+
await component.initialize({
|
|
43
|
+
ibGibAddr: ibGibAddr || ROOT_ADDR,
|
|
44
|
+
meta: this,
|
|
45
|
+
html: thisHtml,
|
|
46
|
+
css: [commonComponentStylesCss, thisCss],
|
|
47
|
+
});
|
|
48
|
+
return component;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* References to DOM elements within the Privacy Policy shadow root.
|
|
54
|
+
*/
|
|
55
|
+
interface PrivacyPolicyElements extends ElementsBase {
|
|
56
|
+
btnBack?: HTMLButtonElement;
|
|
57
|
+
loadingSpinner?: HTMLDivElement;
|
|
58
|
+
errorContainer?: HTMLDivElement;
|
|
59
|
+
errorMessage?: HTMLParagraphElement;
|
|
60
|
+
btnRetry?: HTMLButtonElement;
|
|
61
|
+
privacyContent?: HTMLElement;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Concrete Web Component implementation for rendering Privacy Policy markdown.
|
|
66
|
+
*/
|
|
67
|
+
export class PrivacyPolicyComponentInstance
|
|
68
|
+
extends IbGibDynamicComponentInstanceBase<IbGib_V1, PrivacyPolicyElements> {
|
|
69
|
+
|
|
70
|
+
protected lc: string = `[PrivacyPolicyComponentInstance]`;
|
|
71
|
+
|
|
72
|
+
/** Path or URL to the markdown privacy policy file */
|
|
73
|
+
public markdownUrl: string = '/PRIVACY_POLICY.md';
|
|
74
|
+
|
|
75
|
+
constructor() {
|
|
76
|
+
super();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public override async created(): Promise<void> {
|
|
80
|
+
const lc = `${this.lc}[${this.created.name}]`;
|
|
81
|
+
try {
|
|
82
|
+
const shadow = this.shadowRoot!;
|
|
83
|
+
const contentEl = (shadow.querySelector('.privacy-container') || shadow.querySelector('#privacy-content') || this) as HTMLElement;
|
|
84
|
+
|
|
85
|
+
this.elements = {
|
|
86
|
+
contentEl,
|
|
87
|
+
btnBack: shadow.querySelector('#btn-back') as HTMLButtonElement,
|
|
88
|
+
loadingSpinner: shadow.querySelector('#loading-spinner') as HTMLDivElement,
|
|
89
|
+
errorContainer: shadow.querySelector('#error-container') as HTMLDivElement,
|
|
90
|
+
errorMessage: shadow.querySelector('#error-message') as HTMLParagraphElement,
|
|
91
|
+
btnRetry: shadow.querySelector('#btn-retry') as HTMLButtonElement,
|
|
92
|
+
privacyContent: shadow.querySelector('#privacy-content') as HTMLElement,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
this.elements.btnBack?.addEventListener('click', () => {
|
|
96
|
+
if (window.history.length > 1) {
|
|
97
|
+
window.history.back();
|
|
98
|
+
} else {
|
|
99
|
+
window.location.href = '/';
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
this.elements.btnRetry?.addEventListener('click', () => {
|
|
104
|
+
this.loadPrivacyPolicy();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
await this.loadPrivacyPolicy();
|
|
108
|
+
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public override async disconnected(): Promise<void> {
|
|
115
|
+
const lc = `${this.lc}[${this.disconnected.name}]`;
|
|
116
|
+
// Cleanup if needed
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Fetches the markdown policy and converts it to formatted HTML in the DOM.
|
|
121
|
+
*/
|
|
122
|
+
public async loadPrivacyPolicy(): Promise<void> {
|
|
123
|
+
const lc = `${this.lc}[${this.loadPrivacyPolicy.name}]`;
|
|
124
|
+
try {
|
|
125
|
+
const el = this.elements;
|
|
126
|
+
if (el?.loadingSpinner) {
|
|
127
|
+
el.loadingSpinner.classList.remove('hidden');
|
|
128
|
+
}
|
|
129
|
+
if (el?.errorContainer) {
|
|
130
|
+
el.errorContainer.classList.add('hidden');
|
|
131
|
+
}
|
|
132
|
+
if (el?.privacyContent) {
|
|
133
|
+
el.privacyContent.classList.add('hidden');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const res = await fetch(this.markdownUrl);
|
|
137
|
+
if (!res.ok) {
|
|
138
|
+
throw new Error(`Failed to load ${this.markdownUrl} (status ${res.status}: ${res.statusText})`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const mdText = await res.text();
|
|
142
|
+
const renderedHtml = convertMarkdownToHtml(mdText, {
|
|
143
|
+
linkTarget: '_blank',
|
|
144
|
+
linkRel: 'noopener',
|
|
145
|
+
enableAlerts: true
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
if (this.elements?.privacyContent) {
|
|
149
|
+
this.elements.privacyContent.innerHTML = renderedHtml;
|
|
150
|
+
this.elements.privacyContent.classList.remove('hidden');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
} catch (error) {
|
|
154
|
+
const msg = extractErrorMsg(error);
|
|
155
|
+
console.error(`${lc} ${msg}`);
|
|
156
|
+
if (this.elements?.errorMessage) {
|
|
157
|
+
this.elements.errorMessage.textContent = `Unable to load Privacy Policy: ${msg}`;
|
|
158
|
+
}
|
|
159
|
+
if (this.elements?.errorContainer) {
|
|
160
|
+
this.elements.errorContainer.classList.remove('hidden');
|
|
161
|
+
}
|
|
162
|
+
} finally {
|
|
163
|
+
if (this.elements?.loadingSpinner) {
|
|
164
|
+
this.elements.loadingSpinner.classList.add('hidden');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
package/src/ui/ui-constants.mts
CHANGED
|
@@ -110,4 +110,11 @@ export const EVENT_IBGIB_IDENTITY_UPDATE_AVAILABLE = 'ibgib-identity-update-avai
|
|
|
110
110
|
export const EVENT_IBGIB_IDENTITY_RENEWAL_REQUIRED = 'ibgib-identity-renewal-required';
|
|
111
111
|
// #endregion Custom Events
|
|
112
112
|
|
|
113
|
+
// #region UI Message Actions
|
|
114
|
+
export const UI_ACTION_SHOW_IDENTITY_MANAGER = 'show-identity-manager';
|
|
115
|
+
export const UI_ACTION_SHOW_KEYSTONE_CREATOR = 'show-keystone-creator';
|
|
116
|
+
export const UI_ACTION_SHOW_ADD_DEVICE = 'show-add-device';
|
|
117
|
+
export const UI_ACTION_SHOW_PRIVACY_POLICY = 'show-privacy-policy';
|
|
118
|
+
// #endregion UI Message Actions
|
|
119
|
+
|
|
113
120
|
|
|
@@ -181,19 +181,19 @@ export function getFunctionCallAndResponseParts({
|
|
|
181
181
|
}): { call: FunctionCallPart, response: FunctionResponsePart } {
|
|
182
182
|
const lc = `[${getFunctionCallAndResponseParts.name}]`;
|
|
183
183
|
try {
|
|
184
|
-
if (logalot) { console.log(`${lc} starting... (I:
|
|
184
|
+
if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
|
|
185
185
|
|
|
186
186
|
if (!functionInfoIbGib) {
|
|
187
|
-
throw new Error(`${lc} functionInfoIbGib parameter is required. (E:
|
|
187
|
+
throw new Error(`${lc} functionInfoIbGib parameter is required. (E: genuuid)`);
|
|
188
188
|
}
|
|
189
189
|
if (!functionInfoIbGib.data) {
|
|
190
|
-
throw new Error(`${lc} functionInfoIbGib.data is required. (E:
|
|
190
|
+
throw new Error(`${lc} functionInfoIbGib.data is required. (E: genuuid)`);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
const { fnName, fnArgs, fnResult } = functionInfoIbGib.data;
|
|
194
194
|
|
|
195
195
|
if (!fnName) {
|
|
196
|
-
throw new Error(`${lc} functionInfoIbGib.data.fnName is required. (E:
|
|
196
|
+
throw new Error(`${lc} functionInfoIbGib.data.fnName is required. (E: genuuid)`);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
// 1. Create FunctionCallPart
|
|
@@ -90,7 +90,7 @@ export class WebInMemoryWorkspaceProjectionSpace_V1 extends WorkspaceProjectionS
|
|
|
90
90
|
if (logalot) { console.log(`${lc} projecting item to virtual workspace...`); }
|
|
91
91
|
|
|
92
92
|
if (!item || !item.data) {
|
|
93
|
-
throw new Error(`${lc} item and item.data are required (E:
|
|
93
|
+
throw new Error(`${lc} item and item.data are required (E: genuuid)`);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
const { fsType, name } = item.data;
|
|
@@ -123,19 +123,19 @@ export class WebInMemoryWorkspaceProjectionSpace_V1 extends WorkspaceProjectionS
|
|
|
123
123
|
}
|
|
124
124
|
} else if (fsType === 'file') {
|
|
125
125
|
if (!item.rel8ns) {
|
|
126
|
-
throw new Error(`${lc} item.rel8ns required for file item (E:
|
|
126
|
+
throw new Error(`${lc} item.rel8ns required for file item (E: genuuid)`);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
const binAddrs = item.rel8ns.bin;
|
|
130
130
|
if (!binAddrs || binAddrs.length === 0) {
|
|
131
|
-
throw new Error(`${lc} item.rel8ns.bin required for file item ${name} (E:
|
|
131
|
+
throw new Error(`${lc} item.rel8ns.bin required for file item ${name} (E: genuuid)`);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
const latestBinAddr = binAddrs.at(-1)!;
|
|
135
135
|
const binIbGib = await this.fetchIbGib(latestBinAddr);
|
|
136
136
|
|
|
137
137
|
if (binIbGib.data === undefined) {
|
|
138
|
-
throw new Error(`${lc} BinIbGib at addr ${latestBinAddr} has undefined data (E:
|
|
138
|
+
throw new Error(`${lc} BinIbGib at addr ${latestBinAddr} has undefined data (E: genuuid)`);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
let fileData: Uint8Array;
|
|
@@ -158,7 +158,7 @@ export class WebInMemoryWorkspaceProjectionSpace_V1 extends WorkspaceProjectionS
|
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
} catch (error) {
|
|
161
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E:
|
|
161
|
+
console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
162
162
|
throw error;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
@@ -261,7 +261,7 @@ export class WebInMemoryWorkspaceProjectionSpace_V1 extends WorkspaceProjectionS
|
|
|
261
261
|
pendingComments,
|
|
262
262
|
};
|
|
263
263
|
} catch (error) {
|
|
264
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E:
|
|
264
|
+
console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
265
265
|
throw error;
|
|
266
266
|
}
|
|
267
267
|
}
|
|
@@ -282,7 +282,7 @@ export class WebInMemoryWorkspaceProjectionSpace_V1 extends WorkspaceProjectionS
|
|
|
282
282
|
|
|
283
283
|
const targetRelPath = this.normalizePath(relPath || (ibGib?.data as any)?.name);
|
|
284
284
|
if (!targetRelPath) {
|
|
285
|
-
throw new Error(`${lc} relPath or item name required for deletion (E:
|
|
285
|
+
throw new Error(`${lc} relPath or item name required for deletion (E: genuuid)`);
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
// Remove target path and any nested children
|
|
@@ -297,7 +297,7 @@ export class WebInMemoryWorkspaceProjectionSpace_V1 extends WorkspaceProjectionS
|
|
|
297
297
|
this._virtualFiles.delete(key);
|
|
298
298
|
}
|
|
299
299
|
} catch (error) {
|
|
300
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E:
|
|
300
|
+
console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
301
301
|
throw error;
|
|
302
302
|
}
|
|
303
303
|
}
|
|
@@ -403,19 +403,19 @@ export class WebInMemoryWorkspaceProjectionSpace_V1 extends WorkspaceProjectionS
|
|
|
403
403
|
const lc = `${this.lc}[${this.fetchIbGib.name}]`;
|
|
404
404
|
try {
|
|
405
405
|
if (!this.backingSpace) {
|
|
406
|
-
throw new Error(`${lc} backingSpace required to fetch IbGib at ${addr} (E:
|
|
406
|
+
throw new Error(`${lc} backingSpace required to fetch IbGib at ${addr} (E: genuuid)`);
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
const resGet = await getFromSpace({ space: this.backingSpace, addrs: [addr] });
|
|
410
410
|
if (!resGet.success || !resGet.ibGibs || resGet.ibGibs.length === 0) {
|
|
411
411
|
const resIbGib = resGet.rawResultIbGib as any;
|
|
412
412
|
const addrsNotFound = resIbGib?.data?.addrsNotFound ?? 'unknown';
|
|
413
|
-
throw new Error(`${lc} couldn't find addr ${addr} in backingSpace. addrsNotFound: ${addrsNotFound} (E:
|
|
413
|
+
throw new Error(`${lc} couldn't find addr ${addr} in backingSpace. addrsNotFound: ${addrsNotFound} (E: genuuid)`);
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
return resGet.ibGibs[0];
|
|
417
417
|
} catch (error) {
|
|
418
|
-
console.error(`${lc} ${extractErrorMsg(error)} (E:
|
|
418
|
+
console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
419
419
|
throw error;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
@@ -13,6 +13,7 @@ import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
|
13
13
|
import { getGib } from '@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs';
|
|
14
14
|
import { hash } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
15
15
|
import { InnerSpace_V1 } from '@ibgib/core-gib/dist/witness/space/inner-space/inner-space-v1.mjs';
|
|
16
|
+
// import { getSpaceIdFromIb } from '@ibgib/core-gib/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mjs';
|
|
16
17
|
import { DEFAULT_INNER_SPACE_DATA_V1 } from '@ibgib/core-gib/dist/witness/space/inner-space/inner-space-types.mjs';
|
|
17
18
|
import { putInSpace, persistTransformResult, registerNewIbGib } from '@ibgib/core-gib/dist/witness/space/space-helper.mjs';
|
|
18
19
|
import { CMD_MODIFIER_WORKSPACE_SCAN } from '@ibgib/core-gib/dist/witness/space/workspace-projection-space/workspace-projection-space-constants.mjs';
|
|
@@ -101,7 +102,7 @@ await respecfully(lc, `WebInMemoryWorkspaceProjectionSpace_V1 Specs`, async () =
|
|
|
101
102
|
});
|
|
102
103
|
|
|
103
104
|
await respecfully(lc, `Reification into In-Memory Virtual Tree`, async () => {
|
|
104
|
-
await
|
|
105
|
+
await ifWeMight(lc, `reifies file and folder hierarchies into virtual file map`, async () => {
|
|
105
106
|
const file1 = await createFileWithContent({ name: 'main.ts', content: 'console.log("hello");', space: backingSpace });
|
|
106
107
|
const file1Addr = getIbGibAddr({ ibGib: file1 });
|
|
107
108
|
|
|
@@ -151,7 +152,7 @@ await respecfully(lc, `WebInMemoryWorkspaceProjectionSpace_V1 Specs`, async () =
|
|
|
151
152
|
});
|
|
152
153
|
|
|
153
154
|
await respecfully(lc, `Virtual Workspace Scan & Observation`, async () => {
|
|
154
|
-
await
|
|
155
|
+
await ifWeMight(lc, `scans virtual files, computes sha256 hashes, and extracts companion comments`, async () => {
|
|
155
156
|
// Set up virtual files directly
|
|
156
157
|
wsSpace.setVirtualFile('src/index.ts', 'const a = 1;');
|
|
157
158
|
wsSpace.setVirtualFile('src/.ib.index.ts.md', '# Note on index.ts\nThis is a companion note.');
|
|
@@ -198,7 +199,7 @@ await respecfully(lc, `WebInMemoryWorkspaceProjectionSpace_V1 Specs`, async () =
|
|
|
198
199
|
});
|
|
199
200
|
|
|
200
201
|
await respecfully(lc, `Isomorphic getRepoStatus with WebInMemoryWorkspaceProjectionSpace`, async () => {
|
|
201
|
-
await
|
|
202
|
+
await ifWeMight(lc, `detects untracked, modified, and deleted files in virtual workspace`, async () => {
|
|
202
203
|
const trackedFile = await createFileWithContent({ name: 'app.ts', content: 'version 1', space: backingSpace });
|
|
203
204
|
const trackedAddr = getIbGibAddr({ ibGib: trackedFile });
|
|
204
205
|
|
|
@@ -241,9 +242,9 @@ await respecfully(lc, `WebInMemoryWorkspaceProjectionSpace_V1 Specs`, async () =
|
|
|
241
242
|
|
|
242
243
|
// Create index in backingSpace with unstaged working tree
|
|
243
244
|
let indexIbGib = await createB2tFSIndexIbGib({
|
|
244
|
-
spaceId: backingSpace.
|
|
245
|
+
// spaceId: getSpaceIdFromIb(backingSpace.ib) || 'test_backing_uuid_1',
|
|
245
246
|
activeSpaceId: backingSpace.data?.uuid || 'test_backing_uuid_1',
|
|
246
|
-
|
|
247
|
+
activeBranchName: 'main',
|
|
247
248
|
branchAddr,
|
|
248
249
|
space: backingSpace,
|
|
249
250
|
metaspace: mockMetaspace,
|
|
@@ -10,9 +10,9 @@ description: The Master Coordinator skill for scaffolding complete ibgib applica
|
|
|
10
10
|
This is the **Master Coordinator Skill** for scaffolding applications in the `ibgib` ecosystem. It evaluates the desired application topology and orchestrates the appropriate sub-skills to produce a buildable, type-safe, and consistent application.
|
|
11
11
|
|
|
12
12
|
For complete architectural background, refer to:
|
|
13
|
-
* **The App Guide**: [`docs/CREATING_IBGIB_APPS_GUIDE.md`](
|
|
14
|
-
* **The Client Guide**: [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](
|
|
15
|
-
* **The Server Guide**: [`docs/IBGIB_SERVER_APPS_GUIDE.md`](
|
|
13
|
+
* **The App Guide**: [`docs/CREATING_IBGIB_APPS_GUIDE.md`](../../../docs/CREATING_IBGIB_APPS_GUIDE.md)
|
|
14
|
+
* **The Client Guide**: [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](../../../docs/IBGIB_CLIENT_APPS_GUIDE.md)
|
|
15
|
+
* **The Server Guide**: [`docs/IBGIB_SERVER_APPS_GUIDE.md`](../../../docs/IBGIB_SERVER_APPS_GUIDE.md)
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
@@ -9,7 +9,7 @@ description: Coordinator skill for scaffolding an ibgib client application (SPA,
|
|
|
9
9
|
|
|
10
10
|
Coordinates the modular sub-skills required to scaffold a fully functional, type-safe, and buildable `ibgib` client application.
|
|
11
11
|
|
|
12
|
-
For architectural foundations, refer to [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](
|
|
12
|
+
For architectural foundations, refer to [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](../../../docs/IBGIB_CLIENT_APPS_GUIDE.md).
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@ Generates the engineering foundation for an `ibgib` client application (SPA, bro
|
|
|
20
20
|
- **Storage**: Initializing IndexedDB spaces.
|
|
21
21
|
- **Types & Helpers**: Providing the basic framework for identity and witness coordination.
|
|
22
22
|
|
|
23
|
-
For the complete architectural guide, refer to [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](
|
|
23
|
+
For the complete architectural guide, refer to [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](../../../docs/IBGIB_CLIENT_APPS_GUIDE.md).
|
|
24
24
|
|
|
25
25
|
> [!NOTE]
|
|
26
26
|
> This skill does NOT generate the App Witness (the business logic), UI Shell, or Identity wiring; use `ibgib-create-client-app-witness`, `ibgib-create-client-shell`, and `ibgib-create-client-identity` for those.
|
|
@@ -21,7 +21,7 @@ This skill scaffolds:
|
|
|
21
21
|
- **App Types**: Data and Relationship structures unique to this app.
|
|
22
22
|
- **API Registration**: Plumbing to register core app functions with the ibgib runtime.
|
|
23
23
|
|
|
24
|
-
For complete architectural context, refer to [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](
|
|
24
|
+
For complete architectural context, refer to [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](../../../docs/IBGIB_CLIENT_APPS_GUIDE.md).
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -14,7 +14,7 @@ This skill automates:
|
|
|
14
14
|
2. **HTML Integration**: Embedding `<ibgib-identity-manager>`, `<ibgib-keystone-creator>`, `<ibgib-keystone-details>`, or `<ibgib-identity-header>` into the application shell.
|
|
15
15
|
3. **Hub Sync Wiring**: Initializing `SyncWebsocketPeer_V1` and `KeystoneSyncService` using `APP_CONFIG.hubUrl`.
|
|
16
16
|
|
|
17
|
-
For complete architectural details, refer to [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](
|
|
17
|
+
For complete architectural details, refer to [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](../../../docs/IBGIB_CLIENT_APPS_GUIDE.md).
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -60,7 +60,7 @@ import { APP_CONFIG } from './config.mjs';
|
|
|
60
60
|
|
|
61
61
|
export async function initHubSync({ metaspace, localSpace }: { metaspace: any, localSpace: any }) {
|
|
62
62
|
const wsUrl = APP_CONFIG.hubUrl.replace(/^http/, 'ws') + '/api/sync';
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
const peerWitness = new SyncWebsocketPeer_V1({
|
|
65
65
|
url: wsUrl,
|
|
66
66
|
metaspace,
|
|
@@ -9,7 +9,7 @@ description: Scaffolds the foundational UI Shell for an ibgib client app. Genera
|
|
|
9
9
|
|
|
10
10
|
This skill scaffolds the UI Shell architecture for an `ibgib` client application. The Shell Service acts as a singleton on `globalThis` that manages DOM interactions, handles shell-specific events (e.g. burger menus, window resizing), and coordinates UI activation once the Metaspace and App Witness are initialized.
|
|
11
11
|
|
|
12
|
-
For full architectural context, refer to [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](
|
|
12
|
+
For full architectural context, refer to [`docs/IBGIB_CLIENT_APPS_GUIDE.md`](../../../docs/IBGIB_CLIENT_APPS_GUIDE.md).
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -13,7 +13,7 @@ Generates the backend server infrastructure for an `ibgib` server application or
|
|
|
13
13
|
- **`Dockerfile`**: Lightweight Alpine container packaging the bundled server and static client SPA.
|
|
14
14
|
- **`docker-compose.yml`**: Local multi-container orchestration behind the Traefik reverse proxy with automatic local HTTPS (`*.localhost` and `local.ibgib.space` SSO loopback).
|
|
15
15
|
|
|
16
|
-
For architectural context, refer to [`docs/IBGIB_SERVER_APPS_GUIDE.md`](
|
|
16
|
+
For architectural context, refer to [`docs/IBGIB_SERVER_APPS_GUIDE.md`](../../../docs/IBGIB_SERVER_APPS_GUIDE.md).
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -60,7 +60,7 @@ Break the work into small, incremental, independently verifiable steps:
|
|
|
60
60
|
|
|
61
61
|
### Step 1: [Component / Sub-system Name]
|
|
62
62
|
- [ ] **1.1 [Sub-task Title]**: Description of changes.
|
|
63
|
-
- Linked files: [`basename.mts`](
|
|
63
|
+
- Linked files: [`basename.mts`](relative/path/to/file.mts#L10-L30)
|
|
64
64
|
- [ ] **1.2 [Sub-task Title]**: Description of changes.
|
|
65
65
|
|
|
66
66
|
### Step 2: [Next Phase / Integration]
|
|
@@ -71,9 +71,12 @@ Break the work into small, incremental, independently verifiable steps:
|
|
|
71
71
|
## 🧪 Testing & Verification Strategy
|
|
72
72
|
|
|
73
73
|
> [!IMPORTANT]
|
|
74
|
-
> Always review and follow [`docs/RESPEC_GIB_GUIDANCE.md`](
|
|
74
|
+
> Always review and follow [`docs/RESPEC_GIB_GUIDANCE.md`](../../../docs/RESPEC_GIB_GUIDANCE.md) for respec testing patterns, including the strict use of `ifWeMight` blocks, avoiding artificial delays, and proper error handling.
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
> [!TIP]
|
|
77
|
+
> **Tester Subagents Mandate**: All test execution and log analysis should be delegated to a dedicated **Tester Subagent** spawned with the protocol in [`docs/TESTER_TEMPLATE.md`](../../../docs/TESTER_TEMPLATE.md). The tester subagent reads `RESPEC_GIB_GUIDANCE.md`, runs the canonical test command, and returns only the isolated failure points and stack traces to keep the primary conversation clean.
|
|
78
|
+
|
|
79
|
+
* **Unit & Integration Tests**: `respec-gib` test commands (`npm run test:core-gib`, `npm run test:vcs-gib`) and specific `ifWeMight` focus instructions.
|
|
77
80
|
* **Manual & E2E Checks**: Step-by-step verification steps in browser or CLI environment.
|
|
78
81
|
|
|
79
82
|
---
|
|
@@ -97,7 +100,7 @@ _note: these are not PRs proper, because we're not using git. This is just to co
|
|
|
97
100
|
|
|
98
101
|
## Best Practices & Guidelines
|
|
99
102
|
|
|
100
|
-
1. **Explicit File Links**: Always use clickable file links using
|
|
103
|
+
1. **Explicit File Links**: Always use clickable file links using relative file paths (e.g. `[filename.mts](relative/path/to/file.mts)` or `[filename.mts#L10-L20](relative/path/to/file.mts#L10-L20)`).
|
|
101
104
|
2. **Incremental Updates**: Update task checkboxes (`- [ ]` $\to$ `- [x]`) and add journal entries in real-time as tasks progress.
|
|
102
105
|
3. **Strict Casing & Naming**: Maintain consistency with `ibgib` conventions (flatcase inner tokens, kebab-case component IDs, explicit transform names like `fork`, `mut8`, `rel8`).
|
|
103
106
|
4. **Preserve Context**: When starting a new conversation prompt for a sub-task, reference the corresponding `[what]_IMPLEMENTATION.md` file so any agent can instantly regain full architectural context.
|
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-service.respec.d.mts","sourceRoot":"","sources":["../../../src/api/commands/command-service.respec.mts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module command-service respec, not quite a real respec atow (01/2025).
|
|
3
|
-
* convert later when doing better testing. for now, just import the test function
|
|
4
|
-
* and run it to test.
|
|
5
|
-
*/
|
|
6
|
-
export {};
|
|
7
|
-
// import { RenderableHandle } from '../../render/render-one-file.mjs';
|
|
8
|
-
// import { renderableCreateFunctionInfo } from './renderable/create-renderables.mjs';
|
|
9
|
-
// import { renderableDestroyFunctionInfo } from './renderable/destroy-renderable.mts';
|
|
10
|
-
// import { renderableUpdateFunctionInfo } from './renderable/update-renderable.mts';
|
|
11
|
-
// /**
|
|
12
|
-
// * @function testCommandService - A test function to demonstrate using the command service.
|
|
13
|
-
// * @returns {Promise<void>}
|
|
14
|
-
// */
|
|
15
|
-
// export async function testCommandService(): Promise<void> {
|
|
16
|
-
// console.log('>>> Starting testCommandService...');
|
|
17
|
-
// // 1. Create a renderable
|
|
18
|
-
// let createHandle: RenderableHandle | undefined;
|
|
19
|
-
// try {
|
|
20
|
-
// const renderableCreateViaCmd = renderableCreateFunctionInfo.fnViaCmd;
|
|
21
|
-
// // createHandle = (await renderableCreateViaCmd({
|
|
22
|
-
// const resCreate = await renderableCreateViaCmd(
|
|
23
|
-
// {
|
|
24
|
-
// cmd: 'Renderable',
|
|
25
|
-
// initialStates: [{
|
|
26
|
-
// isVisible: true,
|
|
27
|
-
// color: { r: 1, g: 0, b: 0, a: 1 }, // Red
|
|
28
|
-
// position: { x: 10, y: 10, z: 0 },
|
|
29
|
-
// scale: { x: 1, y: 1 },
|
|
30
|
-
// geometry: { type: 'rect', parameters: { type: 'rect', width: 50, height: 50 } },
|
|
31
|
-
// }],
|
|
32
|
-
// });
|
|
33
|
-
// createHandle = resCreate.at(0);
|
|
34
|
-
// console.log(`testCommandService: Created renderable with handle ${createHandle.uuid}`);
|
|
35
|
-
// } catch (error) {
|
|
36
|
-
// console.error('testCommandService: Error creating renderable:', error);
|
|
37
|
-
// return;
|
|
38
|
-
// }
|
|
39
|
-
// if (!createHandle) {
|
|
40
|
-
// console.error('testCommandService: Error creating renderable - handle is undefined. (E: 6548f5560b07137bd683cb713a4fcc24)');
|
|
41
|
-
// return;
|
|
42
|
-
// }
|
|
43
|
-
// // 2. Update the renderable after a short delay
|
|
44
|
-
// await new Promise(resolve => setTimeout(resolve, 2000));
|
|
45
|
-
// try {
|
|
46
|
-
// const renderableUpdateViaCmd = renderableUpdateFunctionInfo.fnViaCmd;
|
|
47
|
-
// await renderableUpdateViaCmd({
|
|
48
|
-
// handle: createHandle,
|
|
49
|
-
// updatedState: { color: { r: 0, g: 1, b: 0, a: 1 }, position: { x: 100, y: 100, z: 0 } }, // Green, moved
|
|
50
|
-
// });
|
|
51
|
-
// console.log(`testCommandService: Updated renderable with handle ${createHandle.uuid}`);
|
|
52
|
-
// } catch (error) {
|
|
53
|
-
// console.error('testCommandService: Error updating renderable:', error);
|
|
54
|
-
// }
|
|
55
|
-
// // 3. Destroy the renderable after another short delay
|
|
56
|
-
// await new Promise(resolve => setTimeout(resolve, 2000));
|
|
57
|
-
// try {
|
|
58
|
-
// const renderableDestroyViaCmd = renderableDestroyFunctionInfo.fnViaCmd;
|
|
59
|
-
// await renderableDestroyViaCmd({ handle: createHandle });
|
|
60
|
-
// console.log(`testCommandService: Destroyed renderable with handle ${createHandle.uuid}`);
|
|
61
|
-
// } catch (error) {
|
|
62
|
-
// console.error('testCommandService: Error destroying renderable:', error);
|
|
63
|
-
// }
|
|
64
|
-
// console.log('>>> Finished testCommandService.');
|
|
65
|
-
// }
|
|
66
|
-
//# sourceMappingURL=command-service.respec.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-service.respec.mjs","sourceRoot":"","sources":["../../../src/api/commands/command-service.respec.mts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,uEAAuE;AACvE,sFAAsF;AACtF,uFAAuF;AACvF,qFAAqF;AAErF,MAAM;AACN,8FAA8F;AAC9F,8BAA8B;AAC9B,MAAM;AACN,8DAA8D;AAC9D,yDAAyD;AAEzD,gCAAgC;AAChC,sDAAsD;AACtD,YAAY;AACZ,gFAAgF;AAChF,4DAA4D;AAC5D,0DAA0D;AAC1D,gBAAgB;AAChB,qCAAqC;AACrC,oCAAoC;AACpC,uCAAuC;AACvC,gEAAgE;AAChE,wDAAwD;AACxD,6CAA6C;AAC7C,uGAAuG;AACvG,sBAAsB;AACtB,kBAAkB;AAElB,0CAA0C;AAC1C,kGAAkG;AAClG,wBAAwB;AACxB,kFAAkF;AAClF,kBAAkB;AAClB,QAAQ;AAER,2BAA2B;AAC3B,uIAAuI;AACvI,kBAAkB;AAClB,QAAQ;AAER,sDAAsD;AACtD,+DAA+D;AAC/D,YAAY;AACZ,gFAAgF;AAChF,yCAAyC;AACzC,oCAAoC;AACpC,uHAAuH;AACvH,cAAc;AACd,kGAAkG;AAClG,wBAAwB;AACxB,kFAAkF;AAClF,QAAQ;AAER,6DAA6D;AAC7D,+DAA+D;AAC/D,YAAY;AACZ,kFAAkF;AAClF,mEAAmE;AACnE,oGAAoG;AACpG,wBAAwB;AACxB,oFAAoF;AACpF,QAAQ;AAER,uDAAuD;AACvD,IAAI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assumptions.respec.d.mts","sourceRoot":"","sources":["../src/assumptions.respec.mts"],"names":[],"mappings":""}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ifWe, iReckon, respecfully } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
2
|
-
const maam = `[${import.meta.url}]`, sir = maam;
|
|
3
|
-
/**
|
|
4
|
-
* wrapper that uses crypto.subtle under the hood (i.e. doesn't hash using ts-gib)
|
|
5
|
-
*
|
|
6
|
-
* notes:
|
|
7
|
-
*
|
|
8
|
-
* * i did in fact copy this from ts-gib though, but we're testing simply that the
|
|
9
|
-
* context (node/browser/whatever) has this since it's integral to all things ibgib.
|
|
10
|
-
*/
|
|
11
|
-
async function cryptoSubtleHash({ s, algorithm = 'SHA-256', }) {
|
|
12
|
-
let { subtle } = globalThis.crypto;
|
|
13
|
-
if (!s) {
|
|
14
|
-
throw new Error(`[${cryptoSubtleHash.name}] s is required`);
|
|
15
|
-
}
|
|
16
|
-
if (!algorithm) {
|
|
17
|
-
throw new Error(`[${cryptoSubtleHash.name}] algorithm is required`);
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const msgUint8 = new TextEncoder().encode(s);
|
|
21
|
-
const buffer = await subtle.digest(algorithm, msgUint8);
|
|
22
|
-
const asArray = Array.from(new Uint8Array(buffer));
|
|
23
|
-
return asArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
console.error(e.message ?? e);
|
|
27
|
-
throw e;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
await respecfully(sir, `non-ts-gib isomorphic crypto hashing`, async () => {
|
|
31
|
-
await ifWe(sir, `should digest simple string consistently using crypto.subtle directly `, async () => {
|
|
32
|
-
let h = await cryptoSubtleHash({ s: '42' });
|
|
33
|
-
iReckon(sir, h).asTo('42').isGonnaBe('73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049');
|
|
34
|
-
});
|
|
35
|
-
await ifWe(sir, `should digest simple stringified ibgib consistently using crypto.subtle directly `, async () => {
|
|
36
|
-
let ibgib = { ib: 'ib', gib: 'gib' };
|
|
37
|
-
let h = await cryptoSubtleHash({ s: JSON.stringify(ibgib) }); // doesn't use ts-gib but consistent stringifying json is important
|
|
38
|
-
iReckon(sir, h).asTo('ib^gib').isGonnaBe('cbad0694a257358c044611ea1fa88ace71a01a9b8409d2354d0387d8043f7671');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
//# sourceMappingURL=assumptions.respec.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assumptions.respec.mjs","sourceRoot":"","sources":["../src/assumptions.respec.mts"],"names":[],"mappings":"AAAA,OAAO,EACsB,IAAI,EAElB,OAAO,EAAE,WAAW,EAClC,MAAM,kDAAkD,CAAC;AAC1D,MAAM,IAAI,GAAG,IAAI,OAAO,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;AAGhD;;;;;;;GAOG;AACH,KAAK,UAAU,gBAAgB,CAAC,EAC5B,CAAC,EACD,SAAS,GAAG,SAAS,GAIxB;IACG,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;IACnC,IAAI,CAAC,CAAC,EAAE,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,IAAI,gBAAgB,CAAC,IAAI,iBAAiB,CAAC,CAAA;IAAC,CAAC;IACvE,IAAI,CAAC,SAAS,EAAE,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,IAAI,gBAAgB,CAAC,IAAI,yBAAyB,CAAC,CAAA;IAAC,CAAC;IACvF,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACnD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,CAAC;IACZ,CAAC;AACL,CAAC;AAED,MAAM,WAAW,CAAC,GAAG,EAAE,sCAAsC,EAAE,KAAK,IAAI,EAAE;IAEtE,MAAM,IAAI,CAAC,GAAG,EAAE,wEAAwE,EAAE,KAAK,IAAI,EAAE;QACjG,IAAI,CAAC,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,kEAAkE,CAAC,CAAC;IAC7G,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,GAAG,EAAE,mFAAmF,EAAE,KAAK,IAAI,EAAE;QAC5G,IAAI,KAAK,GAAa,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;QAC/C,IAAI,CAAC,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,mEAAmE;QACjI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,kEAAkE,CAAC,CAAC;IACjH,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.web.respec.d.mts","sourceRoot":"","sources":["../src/helpers.web.respec.mts"],"names":[],"mappings":""}
|