@ibgib/core-gib 0.0.4
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/.vscode/core-gib-snippets.code-snippets +189 -0
- package/.vscode/launch.json +24 -0
- package/.vscode/settings.json +56 -0
- package/.vscode/tasks.json +37 -0
- package/CHANGELOG.md +11 -0
- package/README.md +215 -0
- package/dist/common/aws-constants.d.mts +7 -0
- package/dist/common/aws-constants.d.mts.map +1 -0
- package/dist/common/aws-constants.mjs +7 -0
- package/dist/common/aws-constants.mjs.map +1 -0
- package/dist/common/bin/bin-types.d.mts +17 -0
- package/dist/common/bin/bin-types.d.mts.map +1 -0
- package/dist/common/bin/bin-types.mjs +3 -0
- package/dist/common/bin/bin-types.mjs.map +1 -0
- package/dist/common/cache/cache-types.d.mts +57 -0
- package/dist/common/cache/cache-types.d.mts.map +1 -0
- package/dist/common/cache/cache-types.mjs +2 -0
- package/dist/common/cache/cache-types.mjs.map +1 -0
- package/dist/common/comment/comment-constants.d.mts +11 -0
- package/dist/common/comment/comment-constants.d.mts.map +1 -0
- package/dist/common/comment/comment-constants.mjs +11 -0
- package/dist/common/comment/comment-constants.mjs.map +1 -0
- package/dist/common/comment/comment-helper.d.mts +59 -0
- package/dist/common/comment/comment-helper.d.mts.map +1 -0
- package/dist/common/comment/comment-helper.mjs +173 -0
- package/dist/common/comment/comment-helper.mjs.map +1 -0
- package/dist/common/comment/comment-types.d.mts +16 -0
- package/dist/common/comment/comment-types.d.mts.map +1 -0
- package/dist/common/comment/comment-types.mjs +2 -0
- package/dist/common/comment/comment-types.mjs.map +1 -0
- package/dist/common/display/display-helper.d.mts +19 -0
- package/dist/common/display/display-helper.d.mts.map +1 -0
- package/dist/common/display/display-helper.mjs +68 -0
- package/dist/common/display/display-helper.mjs.map +1 -0
- package/dist/common/display/display-types.d.mts +97 -0
- package/dist/common/display/display-types.d.mts.map +1 -0
- package/dist/common/display/display-types.mjs +37 -0
- package/dist/common/display/display-types.mjs.map +1 -0
- package/dist/common/encrypt/encrypt-constants.d.mts +27 -0
- package/dist/common/encrypt/encrypt-constants.d.mts.map +1 -0
- package/dist/common/encrypt/encrypt-constants.mjs +27 -0
- package/dist/common/encrypt/encrypt-constants.mjs.map +1 -0
- package/dist/common/encrypt/encrypt-types.d.mts +116 -0
- package/dist/common/encrypt/encrypt-types.d.mts.map +1 -0
- package/dist/common/encrypt/encrypt-types.mjs +9 -0
- package/dist/common/encrypt/encrypt-types.mjs.map +1 -0
- package/dist/common/error/error-constants.d.mts +9 -0
- package/dist/common/error/error-constants.d.mts.map +1 -0
- package/dist/common/error/error-constants.mjs +9 -0
- package/dist/common/error/error-constants.mjs.map +1 -0
- package/dist/common/error/error-helper.d.mts +43 -0
- package/dist/common/error/error-helper.d.mts.map +1 -0
- package/dist/common/error/error-helper.mjs +167 -0
- package/dist/common/error/error-helper.mjs.map +1 -0
- package/dist/common/error/error-types.d.mts +58 -0
- package/dist/common/error/error-types.d.mts.map +1 -0
- package/dist/common/error/error-types.mjs +2 -0
- package/dist/common/error/error-types.mjs.map +1 -0
- package/dist/common/form/form-helper.d.mts +97 -0
- package/dist/common/form/form-helper.d.mts.map +1 -0
- package/dist/common/form/form-helper.mjs +185 -0
- package/dist/common/form/form-helper.mjs.map +1 -0
- package/dist/common/form/form-items.d.mts +229 -0
- package/dist/common/form/form-items.d.mts.map +1 -0
- package/dist/common/form/form-items.mjs +63 -0
- package/dist/common/form/form-items.mjs.map +1 -0
- package/dist/common/import-export/import-export-types.d.mts +18 -0
- package/dist/common/import-export/import-export-types.d.mts.map +1 -0
- package/dist/common/import-export/import-export-types.mjs +2 -0
- package/dist/common/import-export/import-export-types.mjs.map +1 -0
- package/dist/common/legacy/legacy-types.d.mts +2 -0
- package/dist/common/legacy/legacy-types.d.mts.map +1 -0
- package/dist/common/legacy/legacy-types.mjs +2 -0
- package/dist/common/legacy/legacy-types.mjs.map +1 -0
- package/dist/common/link/link-constants.d.mts +2 -0
- package/dist/common/link/link-constants.d.mts.map +1 -0
- package/dist/common/link/link-constants.mjs +2 -0
- package/dist/common/link/link-constants.mjs.map +1 -0
- package/dist/common/link/link-helper.d.mts +37 -0
- package/dist/common/link/link-helper.d.mts.map +1 -0
- package/dist/common/link/link-helper.mjs +143 -0
- package/dist/common/link/link-helper.mjs.map +1 -0
- package/dist/common/link/link-types.d.mts +14 -0
- package/dist/common/link/link-types.d.mts.map +1 -0
- package/dist/common/link/link-types.mjs +2 -0
- package/dist/common/link/link-types.mjs.map +1 -0
- package/dist/common/other/graph-helper.d.mts +166 -0
- package/dist/common/other/graph-helper.d.mts.map +1 -0
- package/dist/common/other/graph-helper.mjs +710 -0
- package/dist/common/other/graph-helper.mjs.map +1 -0
- package/dist/common/other/ibgib-helper.d.mts +245 -0
- package/dist/common/other/ibgib-helper.d.mts.map +1 -0
- package/dist/common/other/ibgib-helper.mjs +641 -0
- package/dist/common/other/ibgib-helper.mjs.map +1 -0
- package/dist/common/other/other-constants.d.mts +53 -0
- package/dist/common/other/other-constants.d.mts.map +1 -0
- package/dist/common/other/other-constants.mjs +67 -0
- package/dist/common/other/other-constants.mjs.map +1 -0
- package/dist/common/other/other-types.d.mts +166 -0
- package/dist/common/other/other-types.d.mts.map +1 -0
- package/dist/common/other/other-types.mjs +30 -0
- package/dist/common/other/other-types.mjs.map +1 -0
- package/dist/common/other/svg-constants.d.mts +2 -0
- package/dist/common/other/svg-constants.d.mts.map +1 -0
- package/dist/common/other/svg-constants.mjs +2 -0
- package/dist/common/other/svg-constants.mjs.map +1 -0
- package/dist/common/other/svg-helper.d.mts +54 -0
- package/dist/common/other/svg-helper.d.mts.map +1 -0
- package/dist/common/other/svg-helper.mjs +170 -0
- package/dist/common/other/svg-helper.mjs.map +1 -0
- package/dist/common/pic/pic-constants.d.mts +13 -0
- package/dist/common/pic/pic-constants.d.mts.map +1 -0
- package/dist/common/pic/pic-constants.mjs +13 -0
- package/dist/common/pic/pic-constants.mjs.map +1 -0
- package/dist/common/pic/pic-helper.d.mts +70 -0
- package/dist/common/pic/pic-helper.d.mts.map +1 -0
- package/dist/common/pic/pic-helper.mjs +235 -0
- package/dist/common/pic/pic-helper.mjs.map +1 -0
- package/dist/common/pic/pic-types.d.mts +23 -0
- package/dist/common/pic/pic-types.d.mts.map +1 -0
- package/dist/common/pic/pic-types.mjs +2 -0
- package/dist/common/pic/pic-types.mjs.map +1 -0
- package/dist/common/root/root-constants.d.mts +40 -0
- package/dist/common/root/root-constants.d.mts.map +1 -0
- package/dist/common/root/root-constants.mjs +40 -0
- package/dist/common/root/root-constants.mjs.map +1 -0
- package/dist/common/root/root-types.d.mts +9 -0
- package/dist/common/root/root-types.d.mts.map +1 -0
- package/dist/common/root/root-types.mjs +2 -0
- package/dist/common/root/root-types.mjs.map +1 -0
- package/dist/common/tag/tag-constants.d.mts +21 -0
- package/dist/common/tag/tag-constants.d.mts.map +1 -0
- package/dist/common/tag/tag-constants.mjs +28 -0
- package/dist/common/tag/tag-constants.mjs.map +1 -0
- package/dist/common/tag/tag-types.d.mts +14 -0
- package/dist/common/tag/tag-types.d.mts.map +1 -0
- package/dist/common/tag/tag-types.mjs +2 -0
- package/dist/common/tag/tag-types.mjs.map +1 -0
- package/dist/core-constants.d.mts +89 -0
- package/dist/core-constants.d.mts.map +1 -0
- package/dist/core-constants.mjs +484 -0
- package/dist/core-constants.mjs.map +1 -0
- package/dist/core-helper.d.mts +6 -0
- package/dist/core-helper.d.mts.map +1 -0
- package/dist/core-helper.mjs +28 -0
- package/dist/core-helper.mjs.map +1 -0
- package/dist/core-types.d.mts +520 -0
- package/dist/core-types.d.mts.map +1 -0
- package/dist/core-types.mjs +2 -0
- package/dist/core-types.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/dist/witness/app/app-base-v1.d.mts +130 -0
- package/dist/witness/app/app-base-v1.d.mts.map +1 -0
- package/dist/witness/app/app-base-v1.mjs +462 -0
- package/dist/witness/app/app-base-v1.mjs.map +1 -0
- package/dist/witness/app/app-constants.d.mts +10 -0
- package/dist/witness/app/app-constants.d.mts.map +1 -0
- package/dist/witness/app/app-constants.mjs +13 -0
- package/dist/witness/app/app-constants.mjs.map +1 -0
- package/dist/witness/app/app-helper.d.mts +85 -0
- package/dist/witness/app/app-helper.d.mts.map +1 -0
- package/dist/witness/app/app-helper.mjs +258 -0
- package/dist/witness/app/app-helper.mjs.map +1 -0
- package/dist/witness/app/app-types.d.mts +211 -0
- package/dist/witness/app/app-types.d.mts.map +1 -0
- package/dist/witness/app/app-types.mjs +49 -0
- package/dist/witness/app/app-types.mjs.map +1 -0
- package/dist/witness/app/chat-app/chat-app-types.d.mts +18 -0
- package/dist/witness/app/chat-app/chat-app-types.d.mts.map +1 -0
- package/dist/witness/app/chat-app/chat-app-types.mjs +25 -0
- package/dist/witness/app/chat-app/chat-app-types.mjs.map +1 -0
- package/dist/witness/app/flash-app/flash-app-types.d.mts +16 -0
- package/dist/witness/app/flash-app/flash-app-types.d.mts.map +1 -0
- package/dist/witness/app/flash-app/flash-app-types.mjs +23 -0
- package/dist/witness/app/flash-app/flash-app-types.mjs.map +1 -0
- package/dist/witness/app/raw-app/raw-app-types.d.mts +18 -0
- package/dist/witness/app/raw-app/raw-app-types.d.mts.map +1 -0
- package/dist/witness/app/raw-app/raw-app-types.mjs +25 -0
- package/dist/witness/app/raw-app/raw-app-types.mjs.map +1 -0
- package/dist/witness/app/todo-app/todo-app-types.d.ts +33 -0
- package/dist/witness/app/todo-app/todo-app-types.d.ts.map +1 -0
- package/dist/witness/app/todo-app/todo-app-types.js +31 -0
- package/dist/witness/app/todo-app/todo-app-types.js.map +1 -0
- package/dist/witness/robbot/robbot-base-v1.d.ts +432 -0
- package/dist/witness/robbot/robbot-base-v1.d.ts.map +1 -0
- package/dist/witness/robbot/robbot-base-v1.js +1407 -0
- package/dist/witness/robbot/robbot-base-v1.js.map +1 -0
- package/dist/witness/robbot/robbot-constants.d.mts +24 -0
- package/dist/witness/robbot/robbot-constants.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-constants.mjs +24 -0
- package/dist/witness/robbot/robbot-constants.mjs.map +1 -0
- package/dist/witness/robbot/robbot-helper.d.mts +152 -0
- package/dist/witness/robbot/robbot-helper.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-helper.mjs +609 -0
- package/dist/witness/robbot/robbot-helper.mjs.map +1 -0
- package/dist/witness/robbot/robbot-types.d.mts +539 -0
- package/dist/witness/robbot/robbot-types.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-types.mjs +294 -0
- package/dist/witness/robbot/robbot-types.mjs.map +1 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.d.mts +14 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.d.mts.map +1 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.mjs +15 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.mjs.map +1 -0
- package/dist/witness/space/inner-space-v1.d.ts +63 -0
- package/dist/witness/space/inner-space-v1.d.ts.map +1 -0
- package/dist/witness/space/inner-space-v1.js +356 -0
- package/dist/witness/space/inner-space-v1.js.map +1 -0
- package/dist/witness/space/outer-space/outer-space-constants.d.mts +2 -0
- package/dist/witness/space/outer-space/outer-space-constants.d.mts.map +1 -0
- package/dist/witness/space/outer-space/outer-space-constants.mjs +2 -0
- package/dist/witness/space/outer-space/outer-space-constants.mjs.map +1 -0
- package/dist/witness/space/outer-space/outer-space-helper.d.mts +28 -0
- package/dist/witness/space/outer-space/outer-space-helper.d.mts.map +1 -0
- package/dist/witness/space/outer-space/outer-space-helper.mjs +87 -0
- package/dist/witness/space/outer-space/outer-space-helper.mjs.map +1 -0
- package/dist/witness/space/outer-space/outer-space-types.d.mts +548 -0
- package/dist/witness/space/outer-space/outer-space-types.d.mts.map +1 -0
- package/dist/witness/space/outer-space/outer-space-types.mjs +118 -0
- package/dist/witness/space/outer-space/outer-space-types.mjs.map +1 -0
- package/dist/witness/space/space-base-v1.d.mts +147 -0
- package/dist/witness/space/space-base-v1.d.mts.map +1 -0
- package/dist/witness/space/space-base-v1.mjs +350 -0
- package/dist/witness/space/space-base-v1.mjs.map +1 -0
- package/dist/witness/space/space-constants.d.mts +181 -0
- package/dist/witness/space/space-constants.d.mts.map +1 -0
- package/dist/witness/space/space-constants.mjs +192 -0
- package/dist/witness/space/space-constants.mjs.map +1 -0
- package/dist/witness/space/space-helper.d.mts +666 -0
- package/dist/witness/space/space-helper.d.mts.map +1 -0
- package/dist/witness/space/space-helper.mjs +2830 -0
- package/dist/witness/space/space-helper.mjs.map +1 -0
- package/dist/witness/space/space-types.d.mts +422 -0
- package/dist/witness/space/space-types.d.mts.map +1 -0
- package/dist/witness/space/space-types.mjs +52 -0
- package/dist/witness/space/space-types.mjs.map +1 -0
- package/dist/witness/witness-base-v1.d.ts +144 -0
- package/dist/witness/witness-base-v1.d.ts.map +1 -0
- package/dist/witness/witness-base-v1.js +300 -0
- package/dist/witness/witness-base-v1.js.map +1 -0
- package/dist/witness/witness-constants.d.mts +3 -0
- package/dist/witness/witness-constants.d.mts.map +1 -0
- package/dist/witness/witness-constants.mjs +3 -0
- package/dist/witness/witness-constants.mjs.map +1 -0
- package/dist/witness/witness-form-builder.d.mts +45 -0
- package/dist/witness/witness-form-builder.d.mts.map +1 -0
- package/dist/witness/witness-form-builder.mjs +95 -0
- package/dist/witness/witness-form-builder.mjs.map +1 -0
- package/dist/witness/witness-helper.d.mts +89 -0
- package/dist/witness/witness-helper.d.mts.map +1 -0
- package/dist/witness/witness-helper.mjs +229 -0
- package/dist/witness/witness-helper.mjs.map +1 -0
- package/dist/witness/witness-types.d.mts +211 -0
- package/dist/witness/witness-types.d.mts.map +1 -0
- package/dist/witness/witness-types.mjs +2 -0
- package/dist/witness/witness-types.mjs.map +1 -0
- package/jasmine-browser.json +18 -0
- package/jasmine.json +6 -0
- package/package.json +67 -0
- package/src/assumptions.spec.mts +45 -0
- package/src/common/aws-constants.mts +5 -0
- package/src/common/bin/bin-types.mts +17 -0
- package/src/common/cache/cache-types.mts +53 -0
- package/src/common/comment/comment-constants.mts +10 -0
- package/src/common/comment/comment-helper.mts +211 -0
- package/src/common/comment/comment-types.mts +19 -0
- package/src/common/display/display-helper.mts +88 -0
- package/src/common/display/display-types.mts +108 -0
- package/src/common/encrypt/encrypt-constants.mts +28 -0
- package/src/common/encrypt/encrypt-types.mts +130 -0
- package/src/common/error/error-constants.mts +8 -0
- package/src/common/error/error-helper.mts +155 -0
- package/src/common/error/error-types.mts +62 -0
- package/src/common/form/form-helper.mts +253 -0
- package/src/common/form/form-items.mts +236 -0
- package/src/common/import-export/import-export-types.mts +18 -0
- package/src/common/legacy/about-legacy.md +0 -0
- package/src/common/legacy/legacy-types.mts +0 -0
- package/src/common/link/link-constants.mts +1 -0
- package/src/common/link/link-helper.mts +155 -0
- package/src/common/link/link-types.mts +16 -0
- package/src/common/other/graph-helper.mts +853 -0
- package/src/common/other/ibgib-helper.mts +671 -0
- package/src/common/other/other-constants.mts +76 -0
- package/src/common/other/other-types.mts +186 -0
- package/src/common/other/svg-constants.mts +1 -0
- package/src/common/other/svg-helper.mts +238 -0
- package/src/common/pic/pic-constants.mts +13 -0
- package/src/common/pic/pic-helper.mts +295 -0
- package/src/common/pic/pic-types.mts +29 -0
- package/src/common/root/root-constants.mts +41 -0
- package/src/common/root/root-types.mts +8 -0
- package/src/common/tag/tag-constants.mts +34 -0
- package/src/common/tag/tag-types.mts +19 -0
- package/src/core-constants.mts +506 -0
- package/src/core-helper.mts +33 -0
- package/src/core-types.mts +519 -0
- package/src/helper.spec.mts +64 -0
- package/src/index.mts +1 -0
- package/src/witness/app/app-base-v1.mts +584 -0
- package/src/witness/app/app-constants.mts +16 -0
- package/src/witness/app/app-helper.mts +322 -0
- package/src/witness/app/app-types.mts +252 -0
- package/src/witness/app/chat-app/chat-app-types.mts +40 -0
- package/src/witness/app/flash-app/flash-app-types.mts +38 -0
- package/src/witness/app/raw-app/raw-app-types.mts +40 -0
- package/src/witness/app/todo-app/todo-app-types.ts +59 -0
- package/src/witness/robbot/robbot-base-v1.ts +1531 -0
- package/src/witness/robbot/robbot-constants.mts +25 -0
- package/src/witness/robbot/robbot-helper.mts +676 -0
- package/src/witness/robbot/robbot-helper.spec.mts +135 -0
- package/src/witness/robbot/robbot-types.mts +797 -0
- package/src/witness/space/bootstrap/bootstrap-constants.mts +15 -0
- package/src/witness/space/inner-space-v1.ts +372 -0
- package/src/witness/space/outer-space/outer-space-constants.mts +1 -0
- package/src/witness/space/outer-space/outer-space-helper.mts +91 -0
- package/src/witness/space/outer-space/outer-space-types.mts +627 -0
- package/src/witness/space/space-base-v1.mts +414 -0
- package/src/witness/space/space-constants.mts +208 -0
- package/src/witness/space/space-helper.mts +3242 -0
- package/src/witness/space/space-types.mts +476 -0
- package/src/witness/witness-base-v1.ts +325 -0
- package/src/witness/witness-constants.mts +2 -0
- package/src/witness/witness-form-builder.mts +128 -0
- package/src/witness/witness-helper.mts +256 -0
- package/src/witness/witness-types.mts +249 -0
- package/tsconfig.json +15 -0
- package/tsconfig.test.json +10 -0
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import { IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
2
|
+
import { IbGibAddr, IbGib, IbGibRel8ns, TjpIbGibAddr } from '@ibgib/ts-gib';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Witness, WitnessCmdData, WitnessCmdIbGib, WitnessCmdRel8ns,
|
|
6
|
+
WitnessData_V1, WitnessResultData, WitnessResultIbGib, WitnessResultRel8ns,
|
|
7
|
+
} from '../witness-types.mjs';
|
|
8
|
+
import { IbGibSpaceAny } from './space-base-v1.mjs';
|
|
9
|
+
import { ENCRYPTION_REL8N_NAME } from '../../common/encrypt/encrypt-constants.mjs';
|
|
10
|
+
import { BOOTSTRAP_DATA_DEFAULT_SPACE_ID_KEY, BOOTSTRAP_DATA_KNOWN_SPACE_IDS_KEY } from './bootstrap/bootstrap-constants.mjs';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Marker type to show intent that it should be the spaceId, i.e.
|
|
14
|
+
* space.data.uuid.
|
|
15
|
+
*/
|
|
16
|
+
export type SpaceId = string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Common data among all ibgib spaces.
|
|
20
|
+
*/
|
|
21
|
+
export interface IbGibSpaceData extends WitnessData_V1 {
|
|
22
|
+
/**
|
|
23
|
+
* redeclaration for the name of the space, to make it required as opposed
|
|
24
|
+
* to the base declaration which is optional.
|
|
25
|
+
*
|
|
26
|
+
* does NOT have to be unique.
|
|
27
|
+
*/
|
|
28
|
+
name: string;
|
|
29
|
+
/**
|
|
30
|
+
* Redeclared over {@link WitnessData_V1.uuid} just for code readability,
|
|
31
|
+
* showing the id to be a {@link SpaceId}, as well making it a required
|
|
32
|
+
* field.
|
|
33
|
+
*/
|
|
34
|
+
uuid: SpaceId;
|
|
35
|
+
/**
|
|
36
|
+
* If true, when this space receives a command that includes incoming ibGibs
|
|
37
|
+
* and ibGibAddrs, we will ensure the ibGibs have a 1-to-1 correspondence to
|
|
38
|
+
* the addrs we're logging, and that the gib hashes are verified against the
|
|
39
|
+
* ibGibs themselves.
|
|
40
|
+
*
|
|
41
|
+
* Otherwise, someone could pass in a bunch of legitimate addresses and
|
|
42
|
+
* illegitimate ibGibs (that have little to do with the addresses). This
|
|
43
|
+
* could at best be a coding mistake & at worst be malicious.
|
|
44
|
+
*/
|
|
45
|
+
validateIbGibAddrsMatchIbGibs?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* interval between polling calls made to other spaces, e.g. sync spaces,
|
|
48
|
+
* or used within a space to check inside itself for updates.
|
|
49
|
+
*
|
|
50
|
+
* ## notes
|
|
51
|
+
*
|
|
52
|
+
* * use as needed
|
|
53
|
+
* * I want to just have this as a sync space setting, but since they are
|
|
54
|
+
* enciphered, I don't want to just have them sitting around in plaintext.
|
|
55
|
+
* * So I'm going to have it in the local app space, which the ibgibs
|
|
56
|
+
* service will check in order for it to decide on interval.
|
|
57
|
+
* * definitely a code smell, but I'm still resolving what a local app
|
|
58
|
+
* space is vs the service that accesses it.
|
|
59
|
+
*/
|
|
60
|
+
longPollingIntervalMs?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Specifically for ibgib spaces that are implemented via a path/subpath
|
|
65
|
+
* strategy, i.e., using a filesystem-like addressing mechanism.
|
|
66
|
+
*/
|
|
67
|
+
export interface IbGibSpaceData_Subpathed extends IbGibSpaceData {
|
|
68
|
+
/**
|
|
69
|
+
* Redeclared here to make this required (not optional)
|
|
70
|
+
*/
|
|
71
|
+
uuid: SpaceId;
|
|
72
|
+
baseDir: string | any;
|
|
73
|
+
encoding: string | any;
|
|
74
|
+
baseSubPath: string;
|
|
75
|
+
spaceSubPath: string;
|
|
76
|
+
ibgibsSubPath: string;
|
|
77
|
+
metaSubPath: string;
|
|
78
|
+
binSubPath: string;
|
|
79
|
+
dnaSubPath: string;
|
|
80
|
+
n?: number;
|
|
81
|
+
timestamp?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface IbGibSpaceRel8ns extends IbGibRel8ns_V1 {
|
|
85
|
+
[ENCRYPTION_REL8N_NAME]?: IbGibAddr[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Cmds for interacting with ibgib spaces.
|
|
91
|
+
*
|
|
92
|
+
* Not all of these will be implemented for every space.
|
|
93
|
+
*
|
|
94
|
+
* ## todo
|
|
95
|
+
*
|
|
96
|
+
* change these commands to better structure, e.g., verb/do/mod, can/get/addrs
|
|
97
|
+
* */
|
|
98
|
+
export type IbGibSpaceOptionsCmd =
|
|
99
|
+
'get' | 'put' | 'delete';
|
|
100
|
+
/** Cmds for interacting with ibgib spaces. */
|
|
101
|
+
export const IbGibSpaceOptionsCmd = {
|
|
102
|
+
/** Retrieve ibGib(s) out of the space (does not remove them). */
|
|
103
|
+
get: 'get' as IbGibSpaceOptionsCmd,
|
|
104
|
+
/** Registers/imports ibGib(s) into the space. */
|
|
105
|
+
put: 'put' as IbGibSpaceOptionsCmd,
|
|
106
|
+
/** Delete an ibGib from a space */
|
|
107
|
+
delete: 'delete' as IbGibSpaceOptionsCmd,
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Flags to affect the command's interpretation.
|
|
112
|
+
*/
|
|
113
|
+
export type IbGibSpaceOptionsCmdModifier =
|
|
114
|
+
'can' | 'addrs' | 'latest' | 'watch' | 'unwatch' | 'tjps';
|
|
115
|
+
/**
|
|
116
|
+
* Flags to affect the command's interpretation.
|
|
117
|
+
*/
|
|
118
|
+
export const IbGibSpaceOptionsCmdModifier = {
|
|
119
|
+
/**
|
|
120
|
+
* Only interested if possibility to do command.
|
|
121
|
+
*
|
|
122
|
+
* This can be due to authorization or other.
|
|
123
|
+
*/
|
|
124
|
+
can: 'can' as IbGibSpaceOptionsCmdModifier,
|
|
125
|
+
/**
|
|
126
|
+
* Only return the addresses of ibgibs
|
|
127
|
+
*/
|
|
128
|
+
addrs: 'addrs' as IbGibSpaceOptionsCmdModifier,
|
|
129
|
+
/**
|
|
130
|
+
* Only interested in the latest one(s).
|
|
131
|
+
*
|
|
132
|
+
* The incoming addr(s) should be the tjp(s), since "latest"
|
|
133
|
+
* only makes sense with unique timelines which are referenced by
|
|
134
|
+
* their tjps.
|
|
135
|
+
*
|
|
136
|
+
* ## notes
|
|
137
|
+
*
|
|
138
|
+
* ATOW I'm actually using this in the aws dynamodb ibgib space to
|
|
139
|
+
* get "newer" ibgibs, not just the latest.
|
|
140
|
+
*/
|
|
141
|
+
latest: 'latest' as IbGibSpaceOptionsCmdModifier,
|
|
142
|
+
/**
|
|
143
|
+
* Ask to get updates on tjps in ibGibAddrs.
|
|
144
|
+
*/
|
|
145
|
+
watch: 'watch' as IbGibSpaceOptionsCmdModifier,
|
|
146
|
+
/*
|
|
147
|
+
* Ask to stop getting updates on tjps in ibGibAddrs.
|
|
148
|
+
*/
|
|
149
|
+
unwatch: 'unwatch' as IbGibSpaceOptionsCmdModifier,
|
|
150
|
+
/**
|
|
151
|
+
* Get the tjp ibgibs/addrs for given ibgib(s)
|
|
152
|
+
*/
|
|
153
|
+
tjps: 'tjps' as IbGibSpaceOptionsCmdModifier,
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Information for interacting with spaces. */
|
|
157
|
+
export interface IbGibSpaceOptionsData
|
|
158
|
+
extends WitnessCmdData<IbGibSpaceOptionsCmd, IbGibSpaceOptionsCmdModifier> {
|
|
159
|
+
/**
|
|
160
|
+
* If putting, this will force replacing the file.
|
|
161
|
+
*
|
|
162
|
+
* ## intent
|
|
163
|
+
* atow this is just for `put` commands.
|
|
164
|
+
*/
|
|
165
|
+
force?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
*/
|
|
168
|
+
catchAllErrors?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
*/
|
|
171
|
+
trace?: boolean;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface IbGibSpaceOptionsRel8ns extends WitnessCmdRel8ns {
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface IbGibSpaceOptionsIbGib<
|
|
178
|
+
TIbGib extends IbGib = IbGib_V1,
|
|
179
|
+
TOptsData extends IbGibSpaceOptionsData = IbGibSpaceOptionsData,
|
|
180
|
+
// TOptsRel8ns extends IbGibSpaceOptionsRel8ns = IbGibSpaceOptionsRel8ns
|
|
181
|
+
TOptsRel8ns extends IbGibSpaceOptionsRel8ns = IbGibSpaceOptionsRel8ns,
|
|
182
|
+
> extends WitnessCmdIbGib<TIbGib, IbGibSpaceOptionsCmd, IbGibSpaceOptionsCmdModifier, TOptsData, TOptsRel8ns> {
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Shape of result data common to all (most) space interactions.
|
|
187
|
+
*
|
|
188
|
+
* This is in addition of course to {@link WitnessResultData}.
|
|
189
|
+
*/
|
|
190
|
+
export interface IbGibSpaceResultData extends WitnessResultData {
|
|
191
|
+
/**
|
|
192
|
+
* If the `cmd` is `canGet` or `canPut`, this holds the result that indicates
|
|
193
|
+
* if you can or can't.
|
|
194
|
+
*/
|
|
195
|
+
can?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Addresses not found in a get.
|
|
198
|
+
*/
|
|
199
|
+
addrsNotFound?: IbGibAddr[];
|
|
200
|
+
/**
|
|
201
|
+
* Addresses that are already in the space when requesting `put` or `canPut`.
|
|
202
|
+
*/
|
|
203
|
+
addrsAlreadyHave?: IbGibAddr[];
|
|
204
|
+
/**
|
|
205
|
+
* Result map used when
|
|
206
|
+
*
|
|
207
|
+
* Mapping of incoming ibGibAddr -> latestAddr | null
|
|
208
|
+
*
|
|
209
|
+
* If there is a tjp/timeline -> maps to the latest in the store.
|
|
210
|
+
* If there is no tjp -> maps to the incoming addr.
|
|
211
|
+
* If the incoming addr is not found in the store -> maps to null.
|
|
212
|
+
*/
|
|
213
|
+
latestAddrsMap?: { [addr: string]: IbGibAddr | null }
|
|
214
|
+
/**
|
|
215
|
+
* Map of TjpAddr -> newer LatestIbGibAddr notification.
|
|
216
|
+
*
|
|
217
|
+
* ## about
|
|
218
|
+
*
|
|
219
|
+
* When using the `watch` command modifier, a caller can subscribe to
|
|
220
|
+
* updates/notifications to a timeline. When an update occurs in the space
|
|
221
|
+
* via a `put` cmd that ends up creating/storing a newer ibgib address than
|
|
222
|
+
* the one the receiving space knows the caller is aware of, it will try to
|
|
223
|
+
* make the caller aware of the update.
|
|
224
|
+
*
|
|
225
|
+
* There are two ways to do this:
|
|
226
|
+
* 1. Store the notification info locally until the next interaction between
|
|
227
|
+
* the space and the caller.
|
|
228
|
+
* 2. Send the notification actively to the caller.
|
|
229
|
+
*
|
|
230
|
+
* For the first implementation of notifications, only the first will be
|
|
231
|
+
* implemented. Local notifications will be implemented, but active
|
|
232
|
+
* internodal notification in the general sense will be implemented at a
|
|
233
|
+
* later time.
|
|
234
|
+
*
|
|
235
|
+
* ## notes
|
|
236
|
+
*
|
|
237
|
+
* * may also implement a dedicated command to watch subscriptions.
|
|
238
|
+
*/
|
|
239
|
+
watchTjpUpdateMap?: { [tjpAddr: string]: IbGibAddr; }
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface IbGibSpaceResultRel8ns extends WitnessResultRel8ns { }
|
|
243
|
+
|
|
244
|
+
export interface IbGibSpaceResultIbGib<
|
|
245
|
+
TIbGib extends IbGib,
|
|
246
|
+
TResultData extends IbGibSpaceResultData,
|
|
247
|
+
TResultRel8ns extends IbGibSpaceResultRel8ns
|
|
248
|
+
>
|
|
249
|
+
extends WitnessResultIbGib<TIbGib, TResultData, TResultRel8ns> {
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Data space adapter/provider, such that a space should only have one type of...
|
|
254
|
+
* * ibGib shape
|
|
255
|
+
* * witness arg shape (which brings in external ibGibs)
|
|
256
|
+
* * witness result shape
|
|
257
|
+
*
|
|
258
|
+
* So this interface facilitates that belief.
|
|
259
|
+
*/
|
|
260
|
+
export interface IbGibSpace<
|
|
261
|
+
TIbGib extends IbGib,
|
|
262
|
+
TOptionsData extends IbGibSpaceOptionsData,
|
|
263
|
+
TOptionsRel8ns extends IbGibSpaceOptionsRel8ns,
|
|
264
|
+
TOptionsIbGib extends IbGibSpaceOptionsIbGib<TIbGib, TOptionsData, TOptionsRel8ns>,
|
|
265
|
+
TResultData extends IbGibSpaceResultData,
|
|
266
|
+
TResultRel8ns extends IbGibSpaceResultRel8ns,
|
|
267
|
+
TResultIbGib extends IbGibSpaceResultIbGib<TIbGib, TResultData, TResultRel8ns>,
|
|
268
|
+
TData extends IbGibSpaceData = IbGibSpaceData,
|
|
269
|
+
TRel8ns extends IbGibSpaceRel8ns = IbGibRel8ns,
|
|
270
|
+
>
|
|
271
|
+
extends Witness<TOptionsIbGib, TResultIbGib, TData, TRel8ns> {
|
|
272
|
+
witness(arg: TOptionsIbGib): Promise<TResultIbGib | undefined>;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export type SpaceLockAction = 'lock' | 'unlock';
|
|
276
|
+
export type SpaceLockScope = 'all' | TjpIbGibAddr;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Data shape for {@link IbGibSpaceLockIbGib}.
|
|
280
|
+
*
|
|
281
|
+
* This includes the options passed in and contains any result data of the lock
|
|
282
|
+
* as well.
|
|
283
|
+
*/
|
|
284
|
+
export interface IbGibSpaceLockData {
|
|
285
|
+
/**
|
|
286
|
+
* In-memory unique identifier associated with the lock.
|
|
287
|
+
*
|
|
288
|
+
* ## intent
|
|
289
|
+
*
|
|
290
|
+
* I intend this mainly as a device for differentiating among multiple
|
|
291
|
+
* tabs open on the same browser. These share the same IndexedDB instance
|
|
292
|
+
* (and thus the same space bucket), but they have different caching
|
|
293
|
+
* mechanisms and interfaces to this bucket.
|
|
294
|
+
*/
|
|
295
|
+
instanceId?: string;
|
|
296
|
+
/**
|
|
297
|
+
* self-explanatory
|
|
298
|
+
*/
|
|
299
|
+
// action?: SpaceLockAction;
|
|
300
|
+
/**
|
|
301
|
+
* When setting the lock, this was the maximum amount of time the lock is
|
|
302
|
+
* valid.
|
|
303
|
+
*
|
|
304
|
+
* {@link expirationUTC}
|
|
305
|
+
*/
|
|
306
|
+
secondsValid?: number;
|
|
307
|
+
/**
|
|
308
|
+
* When setting the lock, this was the calculated expiration string based on
|
|
309
|
+
* {@link secondsValid}.
|
|
310
|
+
*
|
|
311
|
+
* If the lock is not manually released, this will determine if the lock is
|
|
312
|
+
* adhered to.
|
|
313
|
+
*/
|
|
314
|
+
expirationUTC?: string;
|
|
315
|
+
/**
|
|
316
|
+
* The scope to which the lock applies.
|
|
317
|
+
*/
|
|
318
|
+
scope: SpaceLockScope;
|
|
319
|
+
/**
|
|
320
|
+
* True if space was already locked.
|
|
321
|
+
*/
|
|
322
|
+
alreadyLocked?: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* True if caller's request to lock the space was executed.
|
|
325
|
+
*/
|
|
326
|
+
success?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* If errored, this is the message.
|
|
329
|
+
*/
|
|
330
|
+
errorMsg?: string;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Options for the function that locks a space.
|
|
335
|
+
|
|
336
|
+
* {@link IbGibSpaceLockData}
|
|
337
|
+
* {@link IbGibSpaceLockIbGib}
|
|
338
|
+
*/
|
|
339
|
+
export interface IbGibSpaceLockOptions extends IbGibSpaceLockData {
|
|
340
|
+
/**
|
|
341
|
+
* the space to lock/unlock
|
|
342
|
+
*/
|
|
343
|
+
space: IbGibSpaceAny;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Rel8ns shape for {@link IbGibSpaceLockIbGib}
|
|
348
|
+
*
|
|
349
|
+
* marker interface atm
|
|
350
|
+
*/
|
|
351
|
+
export interface IbGibSpaceLockRel8ns extends IbGibRel8ns_V1 { }
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* When locking a space, this is the ibGib that contains informatino regarding
|
|
355
|
+
* the process. This includes if the lock was successful, how long the lock is
|
|
356
|
+
* good for, etc.
|
|
357
|
+
*
|
|
358
|
+
* ## notes
|
|
359
|
+
*
|
|
360
|
+
* * This is meant to be completely ephemeral and there will be no gib. There
|
|
361
|
+
* may be many calls to lock/release in tight loops and atow it wouldn't seem
|
|
362
|
+
* provide us with much benefit to store this kind of metadata.
|
|
363
|
+
*/
|
|
364
|
+
export interface IbGibSpaceLockIbGib
|
|
365
|
+
extends IbGib_V1<IbGibSpaceLockData, IbGibSpaceLockRel8ns> {
|
|
366
|
+
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Data of a {@link BootstrapIbGib}
|
|
372
|
+
*/
|
|
373
|
+
export interface BootstrapData {
|
|
374
|
+
/**
|
|
375
|
+
* this id will be the default space of the bootstrap (meta space).
|
|
376
|
+
*
|
|
377
|
+
* The `bootstrapIbGib.rel8ns` will contain links to the space addresses,
|
|
378
|
+
* with `rel8nName === spaceId`.
|
|
379
|
+
*
|
|
380
|
+
* So to get the default space, you need the default space address. To get
|
|
381
|
+
* that address, you first read this data value, then index into
|
|
382
|
+
* `bootstrap.rel8ns[spaceId]`.
|
|
383
|
+
*/
|
|
384
|
+
[BOOTSTRAP_DATA_DEFAULT_SPACE_ID_KEY]: SpaceId;
|
|
385
|
+
/**
|
|
386
|
+
* List of known spaces in this bootstrap. These should be rel8n names in
|
|
387
|
+
* the bootstrap's `rel8ns` map.
|
|
388
|
+
*/
|
|
389
|
+
[BOOTSTRAP_DATA_KNOWN_SPACE_IDS_KEY]: SpaceId[];
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Rel8ns of a {@link BootstrapIbGib}
|
|
394
|
+
*
|
|
395
|
+
* atow, these will have rel8nNames of [spaceId] that point to the corresponding
|
|
396
|
+
* latest spaceAddr, such that the length is always === 1.
|
|
397
|
+
*/
|
|
398
|
+
export interface BootstrapRel8ns extends IbGibRel8ns_V1 {
|
|
399
|
+
// [BOOTSTRAP_REL8N_NAME_SPACE]: IbGibAddr[];
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* When the application first starts, it looks to bootstrap itself. So it will
|
|
404
|
+
* look for an ibgib with this "primitive" address, i.e. where the gib is the
|
|
405
|
+
* string literal 'gib'. It looks for this address inside what is called the
|
|
406
|
+
* "zero space". This is a default space with default parameters that always
|
|
407
|
+
* points to the same location, relative to the context (app in our current case,
|
|
408
|
+
* but in the future the context could be e.g. an IoT device or AI microservice).
|
|
409
|
+
*
|
|
410
|
+
* So the context execution starts, creating a default zero space ibgib in
|
|
411
|
+
* memory, which itself has a default location/parameters that the space looks
|
|
412
|
+
* in in storage. Here it looks for the bootstrap ibgib with a known address
|
|
413
|
+
* "bootstrap^gib" (atow). Inside that bootstrap ibgib, there should be at least
|
|
414
|
+
* one local space referenced, or a new one must be created and then stored here
|
|
415
|
+
* for future app/context startups.
|
|
416
|
+
*
|
|
417
|
+
* Spaces are rel8d by their `spaceId`'s in `ibgib.rel8ns`, and the `ibgib.data`
|
|
418
|
+
* key (`ibgib.data.defaultSpaceId` atow) contains the default `spaceId`. If
|
|
419
|
+
* there are multiple local spaces that the bootstrap ibgib knows about, there
|
|
420
|
+
* will be only one "default" set.
|
|
421
|
+
*
|
|
422
|
+
* ## first run
|
|
423
|
+
*
|
|
424
|
+
* @see {@link IbgibsService.createNewLocalSpaceAndBootstrapGib}
|
|
425
|
+
* @see {@link getLocalSpace} in `helper/space.ts`
|
|
426
|
+
*
|
|
427
|
+
* A new local space will be created, whose parameters (including its `uuid`
|
|
428
|
+
* which is its `spaceId`) contribute to its reiffied gib hash. A new bootstrap
|
|
429
|
+
* ibgib is created, and in its `bootstrapIbGib.data.defaultSpaceId` we set the
|
|
430
|
+
* newly created local space's id. We then rel8 the space to the bootstrap also
|
|
431
|
+
* via this spaceId as the rel8nName.
|
|
432
|
+
*
|
|
433
|
+
* Note that when the local space is updated, its most recent address must
|
|
434
|
+
* replace the address that the bootstrap ibgib is pointing to.
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
*
|
|
438
|
+
* Here is a copy of a bootstrap^gib.json file on March 30, 2022:
|
|
439
|
+
* ```
|
|
440
|
+
* {
|
|
441
|
+
* "ib":"bootstrap",
|
|
442
|
+
* "gib":"gib",
|
|
443
|
+
* "data":{
|
|
444
|
+
* "defaultSpaceId":"72af3bba9c6da224829de86982346e283469823e49862398a56510c238bad869",
|
|
445
|
+
* "spaceIds":["72af3bba9c6da224829de86982346e283469823e49862398a56510c238bad869"]
|
|
446
|
+
* },
|
|
447
|
+
* "rel8ns":{
|
|
448
|
+
* "72af3bba9c6da224829de86982346e283469823e49862398a56510c238bad869": [
|
|
449
|
+
* "witness space IonicSpace_V1 test_space_name 72af3bba9c6da224829de86982346e283469823e49862398a56510c238bad869^62879B18C2726D27262626552672868923477EE09171626A386C1982F392AC26"
|
|
450
|
+
* ]
|
|
451
|
+
* }
|
|
452
|
+
* }
|
|
453
|
+
* ```
|
|
454
|
+
*
|
|
455
|
+
* ## notes
|
|
456
|
+
*
|
|
457
|
+
* Usually primitives are not stored/persisted. This is because the `gib`
|
|
458
|
+
* indicates that there is no hash corroboration ("guarantee") to the internal
|
|
459
|
+
* data or rel8ns. However, a newly started app has to start somewhere. This
|
|
460
|
+
* offers an alternative to using app storage and streamlines the app overall,
|
|
461
|
+
* since instead of working with two stores (in Ionic: `Storage` and
|
|
462
|
+
* `FileSystem`) we will just be working with one (`FileSystem`).
|
|
463
|
+
*
|
|
464
|
+
* In the future, we'll want to do a workflow here where the user
|
|
465
|
+
* can start from an existing space, but for now it's just located
|
|
466
|
+
* here.
|
|
467
|
+
*/
|
|
468
|
+
export interface BootstrapIbGib
|
|
469
|
+
extends IbGib_V1<BootstrapData, BootstrapRel8ns> {
|
|
470
|
+
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Marker type to indicate that a string is meant to be a transmission id.
|
|
475
|
+
*/
|
|
476
|
+
export type TxId = 'string';
|