@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,519 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import {
|
|
3
|
+
DeleteIbGibOpts, DeleteIbGibResult, GetIbGibOpts, GetIbGibResult,
|
|
4
|
+
IbGibTimelineUpdateInfo, PutIbGibOpts, PutIbGibResult,
|
|
5
|
+
SpecialIbGibType
|
|
6
|
+
} from './common/other/other-types.mjs';
|
|
7
|
+
import { SpaceId } from './witness/space/space-types.mjs';
|
|
8
|
+
import { RobbotIbGib_V1, RobbotPromptResult } from './witness/robbot/robbot-types.mjs';
|
|
9
|
+
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
10
|
+
import { PicIbGib_V1, UpdatePicPromptResult } from './common/pic/pic-types.mjs';
|
|
11
|
+
import { CommentIbGib_V1, UpdateCommentPromptResult } from './common/comment/comment-types.mjs';
|
|
12
|
+
import { AppIbGib_V1, AppPromptResult } from './witness/app/app-types.mjs';
|
|
13
|
+
import { RootData } from './common/root/root-types.mjs';
|
|
14
|
+
import { IbGibAddr, TransformResult } from '@ibgib/ts-gib';
|
|
15
|
+
import { GetDependencyGraphOptions } from './common/other/graph-helper.mjs';
|
|
16
|
+
import { CiphertextIbGib_V1, EncryptionData_V1, SecretData_V1, SecretIbGib_V1 } from './common/encrypt/encrypt-types.mjs';
|
|
17
|
+
import { SyncSagaInfo } from './witness/space/outer-space/outer-space-types.mjs';
|
|
18
|
+
import { IbGibSpaceAny } from './witness/space/space-base-v1.mjs';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Primary "All Powerful" service (too big) that does a lot of work for a local
|
|
22
|
+
* space (node).
|
|
23
|
+
*
|
|
24
|
+
* All-purpose mega service (todo: which we'll need to break up!) to interact
|
|
25
|
+
* with ibgibs at the app/device level.
|
|
26
|
+
*
|
|
27
|
+
* This works with the local app user space.
|
|
28
|
+
*
|
|
29
|
+
* ## regarding special ibgibs
|
|
30
|
+
*
|
|
31
|
+
* Special ibgibs' behaviors are what hold in other apps configuration data.
|
|
32
|
+
* Of course the difference is that most special ibgibs can leverage the "on-chain"
|
|
33
|
+
* functionality of "regular" ibgibs.
|
|
34
|
+
*
|
|
35
|
+
* There are a couple meta ibgibs (which I also call "special"):
|
|
36
|
+
* * roots^gib
|
|
37
|
+
* * tracks other special root^gib ibgibs, which are like local app-level indexes.
|
|
38
|
+
* * tags^gib
|
|
39
|
+
* * tracks other special tag^gib ibgibs, which you can apply to any ibgib
|
|
40
|
+
* * latest^gib
|
|
41
|
+
* * tracks mappings between tjp -> latest ib^gib address
|
|
42
|
+
* * ephemeral (deletes past rel8ns and past ibGib frames)
|
|
43
|
+
* * ...
|
|
44
|
+
*
|
|
45
|
+
* ## regarding latest ibgibs
|
|
46
|
+
*
|
|
47
|
+
* The tjp (temporal junction point) defines atow the beginning of an ibGib
|
|
48
|
+
* timeline. it's like the birthday for an ibGib. (Or you can think if it as
|
|
49
|
+
* the id for the stream of ibgib frames in a given timeline.)
|
|
50
|
+
*
|
|
51
|
+
* The latest ibGib in that timeline is also special, because it's often what
|
|
52
|
+
* you want to work with.
|
|
53
|
+
*
|
|
54
|
+
* So ideally, when an ibgib, A, has a tjp A1, and it is updated to A2, A3, An
|
|
55
|
+
* via `mut8` and/or `rel8` transforms, that ibgib creates a single timeline.
|
|
56
|
+
* This service attempts to track the relationship between that starting tjp
|
|
57
|
+
* address and its corresponding latest frame in that timeline, i.e., A1 -> An.
|
|
58
|
+
*
|
|
59
|
+
* ### mapping persistence implementation details
|
|
60
|
+
*
|
|
61
|
+
* The latest ibGib service is backed by a special ibgib that maintains the
|
|
62
|
+
* mapping index. It does this by rel8-ing that special backing ibgib via the
|
|
63
|
+
* tjp pointer, e.g. [special latest ibgib^XXX000].rel8ns[A^TJP123] ===
|
|
64
|
+
* [A^N12345] . It does this via the ib^gib content address pointer, so this
|
|
65
|
+
* becomes a mapping from A^TJP123 to A^N12345.
|
|
66
|
+
*
|
|
67
|
+
* This backing ibGib is special (even for special ibGibs) in that:
|
|
68
|
+
* * it does not relate itself with the current root of the application
|
|
69
|
+
* * it does not maintain references to its past (i.e. rel8ns['past'] === [])
|
|
70
|
+
* * it DELETES its previous incarnation from the files service
|
|
71
|
+
*
|
|
72
|
+
* In other words, this service is meant to be as ephemeral as possible. I am
|
|
73
|
+
* keeping it as an ibGib and not some other data format (like straight in
|
|
74
|
+
* storage/some other db) because I've found this is often useful and what I end
|
|
75
|
+
* up doing anyway to leverage other ibgib behavior. For example, in the future
|
|
76
|
+
* it may be good to take snapshots, which is a simple copy operation of the
|
|
77
|
+
* file persistence.
|
|
78
|
+
*
|
|
79
|
+
* ### current naive implementation notes
|
|
80
|
+
*
|
|
81
|
+
* questions:
|
|
82
|
+
* * What do we want to do if we can't locate an ibGib record?
|
|
83
|
+
* * How/when do we want to alert the user/our own code that we've found
|
|
84
|
+
* multiple timelines for an ibGib with a tjp (usually a thing we want to
|
|
85
|
+
* avoid)?
|
|
86
|
+
* * Who do we want to notify when new ibGibs arrive?
|
|
87
|
+
* * How often do we want to check external sources for latest?
|
|
88
|
+
* * When do we get to merging ibGib timelines?
|
|
89
|
+
*
|
|
90
|
+
* This is behavior that is somewhat taken care of, e.g. in git, with the HEAD
|
|
91
|
+
* pointer for a repo. But we're talking about here basically as a metarepo or
|
|
92
|
+
* "repo of repos", and unlike git, we don't want our HEAD metadata living "off
|
|
93
|
+
* chain" (outside of the DLT itself that it's modifying). So eventually, what
|
|
94
|
+
* we want is just like what we want with ALL ibGibs: perspective. From "the
|
|
95
|
+
* app"'s perspective, the latest is mapped. But really, apps can't view slices
|
|
96
|
+
* of ibGib graphs in all sorts of interesting ways and still be productive &
|
|
97
|
+
* beneficial to the ecosystem as a whole.
|
|
98
|
+
*/
|
|
99
|
+
export interface IbGibLocalSpaceService_AllPowerful {
|
|
100
|
+
instanceId: string;
|
|
101
|
+
get initialized(): boolean;
|
|
102
|
+
get initializing(): boolean;
|
|
103
|
+
get initialized$(): Observable<void>;
|
|
104
|
+
get latestObs(): Observable<IbGibTimelineUpdateInfo>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* gets the current local user space according to this svc.
|
|
108
|
+
*/
|
|
109
|
+
getLocalUserSpace(arg: {
|
|
110
|
+
/**
|
|
111
|
+
* If true, then we lock by bootstrap/spaceId before trying to retrieve.
|
|
112
|
+
*
|
|
113
|
+
* @default If undefined, will default to false if platform is 'web', else true
|
|
114
|
+
*/
|
|
115
|
+
lock?: boolean,
|
|
116
|
+
/**
|
|
117
|
+
* If provided, will look for the space via this id in the bootstrap ibgib.
|
|
118
|
+
* If not provided, will use the bootstrap ibgib's default spaceId.
|
|
119
|
+
*/
|
|
120
|
+
localSpaceId?: SpaceId,
|
|
121
|
+
}): Promise<IbGibSpaceAny | undefined>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* gets all local user spaces known in bootstrap ibgib, according to
|
|
125
|
+
* spaceIds property
|
|
126
|
+
*
|
|
127
|
+
* (`bootstrapIbGib.data[c.BOOTSTRAP_DATA_KNOWN_SPACE_IDS_KEY]` atow)
|
|
128
|
+
*
|
|
129
|
+
* ## example bootstrap ibgib atow
|
|
130
|
+
*
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"ib":"bootstrap",
|
|
134
|
+
"gib":"gib",
|
|
135
|
+
"data":{
|
|
136
|
+
"defaultSpaceId":"d455d9a72807617634ccbf1e532b71037c45762f824ec85fcd9a4c2275562f33",
|
|
137
|
+
"spaceIds":["d455d9a72807617634ccbf1e532b71037c45762f824ec85fcd9a4c2275562f33"]
|
|
138
|
+
},
|
|
139
|
+
"rel8ns":{
|
|
140
|
+
"d455d9a72807617634ccbf1e532b71037c45762f824ec85fcd9a4c2275562f33":[
|
|
141
|
+
"witness space IonicSpace_V1 oij d455d9a72807617634ccbf1e532b71037c45762f824ec85fcd9a4c2275562f33^B336251655E8C56B38E9E86F20E0E42E6C153785F1A0A798ADE6916E71CF055B"
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
*
|
|
147
|
+
* so this enumerates `data.spaceIds` and gets the corresponding addrs in the `rel8ns`.
|
|
148
|
+
* it then gets the space ibgibs themselves via the local zero space.
|
|
149
|
+
*
|
|
150
|
+
* @returns array of known local user spaces
|
|
151
|
+
*
|
|
152
|
+
* @throws if no local user spaces found (there should be at least one atow i think)
|
|
153
|
+
*/
|
|
154
|
+
getLocalUserSpaces(arg: {
|
|
155
|
+
/**
|
|
156
|
+
* If true, then we lock by bootstrap/spaceId before trying to retrieve.
|
|
157
|
+
*
|
|
158
|
+
* @default false if platform is 'web', else true
|
|
159
|
+
*/
|
|
160
|
+
lock?: boolean,
|
|
161
|
+
}): Promise<IbGibSpaceAny[]>;
|
|
162
|
+
|
|
163
|
+
get zeroSpace(): IbGibSpaceAny;
|
|
164
|
+
|
|
165
|
+
fnPromptRobbot: (space: IbGibSpaceAny, ibGib: RobbotIbGib_V1 | null) => Promise<RobbotPromptResult | undefined>;
|
|
166
|
+
fnPromptApp: (space: IbGibSpaceAny, ibGib: AppIbGib_V1 | null) => Promise<AppPromptResult | undefined>;
|
|
167
|
+
get syncing(): boolean;
|
|
168
|
+
initialize(arg: {
|
|
169
|
+
fnPromptSecret: (space: IbGibSpaceAny) => Promise<IbGib_V1 | undefined>,
|
|
170
|
+
fnPromptEncryption: (space: IbGibSpaceAny) => Promise<IbGib_V1 | undefined>,
|
|
171
|
+
fnPromptOuterSpace: (space: IbGibSpaceAny) => Promise<IbGib_V1 | undefined>,
|
|
172
|
+
fnPromptUpdatePic: (space: IbGibSpaceAny, picIbGib: PicIbGib_V1) => Promise<UpdatePicPromptResult | undefined>,
|
|
173
|
+
fnPromptUpdateComment: (space: IbGibSpaceAny, commentIbGib: CommentIbGib_V1) => Promise<UpdateCommentPromptResult | undefined>,
|
|
174
|
+
fnPromptRobbot: (space: IbGibSpaceAny, ibGib: RobbotIbGib_V1) => Promise<RobbotPromptResult | undefined>,
|
|
175
|
+
fnPromptApp: (space: IbGibSpaceAny, ibGib: AppIbGib_V1) => Promise<AppPromptResult | undefined>,
|
|
176
|
+
}): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Takes the given `key`, which should be unique in the given space (or
|
|
179
|
+
* zerospace), and uses that to get the stored `addr` in that space.
|
|
180
|
+
*
|
|
181
|
+
* # notes
|
|
182
|
+
*
|
|
183
|
+
* configuration is stored in "special" ibgibs, and so we need only to persist
|
|
184
|
+
* the address of that configuration.
|
|
185
|
+
*/
|
|
186
|
+
getConfigAddr(arg: {
|
|
187
|
+
key: string,
|
|
188
|
+
space?: IbGibSpaceAny,
|
|
189
|
+
}): Promise<string | undefined>;
|
|
190
|
+
fnUpdateBootstrap: (newSpace: IbGibSpaceAny) => Promise<void>;
|
|
191
|
+
fnBroadcast: (info: IbGibTimelineUpdateInfo) => void;
|
|
192
|
+
/**
|
|
193
|
+
* Takes the given `key`, which should be unique in the given space (or
|
|
194
|
+
* zerospace), and uses that to persist the given `addr` in that space.
|
|
195
|
+
*
|
|
196
|
+
* # notes
|
|
197
|
+
*
|
|
198
|
+
* configuration is stored in "special" ibgibs, and so we need only to persist
|
|
199
|
+
* the address of that configuration.
|
|
200
|
+
*/
|
|
201
|
+
setConfigAddr(arg: {
|
|
202
|
+
key: string,
|
|
203
|
+
addr: string,
|
|
204
|
+
space?: IbGibSpaceAny,
|
|
205
|
+
}): Promise<IbGibSpaceAny>;
|
|
206
|
+
/**
|
|
207
|
+
* Gets the current root in the given space, or the default zerospace if not provided.
|
|
208
|
+
*/
|
|
209
|
+
getCurrentRoot(arg: { space?: IbGibSpaceAny }): Promise<IbGib_V1<RootData> | undefined>;
|
|
210
|
+
/**
|
|
211
|
+
* Sets the current root in the given space, or the default zerospace if not provided.
|
|
212
|
+
*/
|
|
213
|
+
setCurrentRoot(arg: { root: IbGib_V1<RootData>, space?: IbGibSpaceAny }): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Every tjp should be related to one of the roots in a space.
|
|
216
|
+
*
|
|
217
|
+
* You should NOT relate every ibgib frame of a given ibGib.
|
|
218
|
+
*/
|
|
219
|
+
rel8ToCurrentRoot(arg: {
|
|
220
|
+
ibGib: IbGib_V1,
|
|
221
|
+
linked?: boolean,
|
|
222
|
+
rel8nName?: string,
|
|
223
|
+
space?: IbGibSpaceAny,
|
|
224
|
+
}): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* rel8s given ibgibs to special ibgib.
|
|
227
|
+
* @see {@link rel8ToSpecialIbGib}
|
|
228
|
+
* @returns new special ibgib addr
|
|
229
|
+
*/
|
|
230
|
+
rel8ToSpecialIbGib(arg: {
|
|
231
|
+
type: SpecialIbGibType,
|
|
232
|
+
rel8nName: string,
|
|
233
|
+
/**
|
|
234
|
+
* multiple ibgibs to rel8
|
|
235
|
+
*/
|
|
236
|
+
ibGibsToRel8?: IbGib_V1[],
|
|
237
|
+
/**
|
|
238
|
+
* multiple ibgibs to remove rel8n.
|
|
239
|
+
*/
|
|
240
|
+
ibGibsToUnRel8?: IbGib_V1[],
|
|
241
|
+
linked?: boolean,
|
|
242
|
+
/**
|
|
243
|
+
* Clears out the special.rel8ns.past array to an empty array.
|
|
244
|
+
*
|
|
245
|
+
* {@see deletePreviousSpecialIbGib} for driving use case.
|
|
246
|
+
*/
|
|
247
|
+
severPast?: boolean,
|
|
248
|
+
/**
|
|
249
|
+
* Deletes the previous special ibGib.
|
|
250
|
+
*
|
|
251
|
+
* ## driving use case
|
|
252
|
+
*
|
|
253
|
+
* the latest ibGib is one that is completely ephemeral. It doesn't get attached
|
|
254
|
+
* to the current root, and it only has the current instance. So we don't want to
|
|
255
|
+
* keep around past incarnations.
|
|
256
|
+
*/
|
|
257
|
+
deletePreviousSpecialIbGib?: boolean,
|
|
258
|
+
space?: IbGibSpaceAny,
|
|
259
|
+
}): Promise<IbGibAddr>;
|
|
260
|
+
/**
|
|
261
|
+
* Used for tracking tjpAddr -> latest ibGibAddr.
|
|
262
|
+
*
|
|
263
|
+
* Call this when you create a new ibGib.
|
|
264
|
+
*
|
|
265
|
+
* Need to put this in another service at some point, but crunch crunch
|
|
266
|
+
* like pacman's lunch.
|
|
267
|
+
*/
|
|
268
|
+
registerNewIbGib(arg: { ibGib: IbGib_V1, space?: IbGibSpaceAny }): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* Will trigger a latest info event to be fired.
|
|
271
|
+
* @param param0
|
|
272
|
+
*/
|
|
273
|
+
pingLatest_Local(arg: {
|
|
274
|
+
ibGib: IbGib_V1<any>,
|
|
275
|
+
tjpIbGib: IbGib_V1<any>,
|
|
276
|
+
space?: IbGibSpaceAny,
|
|
277
|
+
/**
|
|
278
|
+
* If true, then will check the latest ibgib cache first. if found, will
|
|
279
|
+
* just return that.
|
|
280
|
+
*/
|
|
281
|
+
useCache: boolean,
|
|
282
|
+
}): Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Convenience function for persisting a transform result, which has
|
|
285
|
+
* a newIbGib and optionally intermediate ibGibs and/or dnas.
|
|
286
|
+
*
|
|
287
|
+
* it persists these ibgibs into the given space, else the current space.
|
|
288
|
+
*/
|
|
289
|
+
persistTransformResult(arg: {
|
|
290
|
+
resTransform: TransformResult<IbGib_V1>,
|
|
291
|
+
isMeta?: boolean,
|
|
292
|
+
force?: boolean,
|
|
293
|
+
space?: IbGibSpaceAny,
|
|
294
|
+
}): Promise<void>;
|
|
295
|
+
/**
|
|
296
|
+
* Wrapper for retrieving ibgib from a given space, else the current space.
|
|
297
|
+
*/
|
|
298
|
+
get(arg: GetIbGibOpts): Promise<GetIbGibResult>;
|
|
299
|
+
/**
|
|
300
|
+
* Wrapper for saving ibgib in a given space, else the current space.
|
|
301
|
+
*/
|
|
302
|
+
put(arg: PutIbGibOpts): Promise<PutIbGibResult>;
|
|
303
|
+
/**
|
|
304
|
+
* Wrapper for removing ibgib from the a given space, else the current space.
|
|
305
|
+
*/
|
|
306
|
+
delete(arg: DeleteIbGibOpts): Promise<DeleteIbGibResult>;
|
|
307
|
+
/**
|
|
308
|
+
* Wrapper for `getDependencyGraph` fn in `helper/space.ts`, but using
|
|
309
|
+
* `this.localUserSpace` as default space.
|
|
310
|
+
*
|
|
311
|
+
* (refactoring!)
|
|
312
|
+
*
|
|
313
|
+
* ## note on space
|
|
314
|
+
*
|
|
315
|
+
* pass in `null` for space if you want to
|
|
316
|
+
*
|
|
317
|
+
* ## warning
|
|
318
|
+
*
|
|
319
|
+
* This does not (YET) have a flag that gets the latest ibgibs for the graph.
|
|
320
|
+
* It only climbs the current graph, which may not cover all ibgibs when you
|
|
321
|
+
* deal with ibGibs with tjps (timelines). We're going to eventually
|
|
322
|
+
* combat this with auto-updating our rel8ns, but for now we're just going
|
|
323
|
+
* to earmark this for the future.
|
|
324
|
+
*
|
|
325
|
+
* todo: auto-update or better
|
|
326
|
+
*
|
|
327
|
+
* @returns map of addr => ibGib
|
|
328
|
+
*/
|
|
329
|
+
getDependencyGraph(opts: GetDependencyGraphOptions): Promise<{ [addr: string]: IbGib_V1 }>;
|
|
330
|
+
/**
|
|
331
|
+
* Wrapper for getting the latest addr in the given space.
|
|
332
|
+
*
|
|
333
|
+
* ## warnings
|
|
334
|
+
*
|
|
335
|
+
* * This was written early and makes many assumptions.
|
|
336
|
+
* * Meant to work with Ionic space atow.
|
|
337
|
+
*
|
|
338
|
+
* @returns latest addr in a given space (or localUserSpace)
|
|
339
|
+
*/
|
|
340
|
+
getLatestAddr(arg: {
|
|
341
|
+
ibGib?: IbGib_V1<any>,
|
|
342
|
+
addr?: IbGibAddr,
|
|
343
|
+
tjpAddr?: IbGibAddr,
|
|
344
|
+
tjp?: IbGib_V1<any>,
|
|
345
|
+
space?: IbGibSpaceAny,
|
|
346
|
+
}): Promise<IbGibAddr | undefined>;
|
|
347
|
+
/**
|
|
348
|
+
* Gets the tjpIbGib for the given `ibGib` in the given `space`.
|
|
349
|
+
* atow, naive must be true.
|
|
350
|
+
*
|
|
351
|
+
*
|
|
352
|
+
*
|
|
353
|
+
* @returns tjpIbGib for the given `ibGib`
|
|
354
|
+
*/
|
|
355
|
+
getTjpIbGib(arg: {
|
|
356
|
+
ibGib: IbGib_V1<any>,
|
|
357
|
+
naive?: boolean,
|
|
358
|
+
space?: IbGibSpaceAny,
|
|
359
|
+
}): Promise<IbGib_V1<any>>;
|
|
360
|
+
/**
|
|
361
|
+
* Gets one of the app's special ibGibs, e.g., TagsIbGib.
|
|
362
|
+
*
|
|
363
|
+
* When initializing tags, this will generate some boilerplate tags.
|
|
364
|
+
* I'm going to be doing roots here also, and who knows what else, but each
|
|
365
|
+
* one will have its own initialize specifics.
|
|
366
|
+
*
|
|
367
|
+
* @param initialize initialize (i.e. create) ONLY IF IbGib not found. Used for initializing app (first run).
|
|
368
|
+
*
|
|
369
|
+
* @see {@link createSpecial}
|
|
370
|
+
* @see {@link createTags}
|
|
371
|
+
*/
|
|
372
|
+
getSpecialIbGib(arg: {
|
|
373
|
+
type: SpecialIbGibType,
|
|
374
|
+
initialize?: boolean,
|
|
375
|
+
space?: IbGibSpaceAny,
|
|
376
|
+
lock?: boolean,
|
|
377
|
+
}): Promise<IbGib_V1 | null>;
|
|
378
|
+
getSpecialRel8dIbGibs<TIbGib extends IbGib_V1 = IbGib_V1>(arg: {
|
|
379
|
+
type: SpecialIbGibType,
|
|
380
|
+
rel8nName: string,
|
|
381
|
+
space?: IbGibSpaceAny,
|
|
382
|
+
}): Promise<TIbGib[]>;
|
|
383
|
+
/**
|
|
384
|
+
* Feels klugy.
|
|
385
|
+
*/
|
|
386
|
+
getPasswordForSecrets(arg: {
|
|
387
|
+
secretIbGibs: IbGib_V1<SecretData_V1>[],
|
|
388
|
+
fnPromptPassword: (title: string, msg: string) => Promise<string | null>,
|
|
389
|
+
dontPrompt?: boolean,
|
|
390
|
+
checkCacheFirst?: boolean,
|
|
391
|
+
cacheAfter?: boolean,
|
|
392
|
+
}): Promise<string | null>;
|
|
393
|
+
getCiphertextIbGib<TEncryptionIbGib extends IbGib_V1<EncryptionData_V1>, TMetadata = any>(arg: {
|
|
394
|
+
/**
|
|
395
|
+
* Um...data...to...erm...encrypt...(as a string)
|
|
396
|
+
*/
|
|
397
|
+
plaintext: string,
|
|
398
|
+
/**
|
|
399
|
+
* Password to perform the encryption.
|
|
400
|
+
*/
|
|
401
|
+
password: string,
|
|
402
|
+
/**
|
|
403
|
+
* Information about encryption, i.e. encryption settings.
|
|
404
|
+
*/
|
|
405
|
+
encryptionIbGib: TEncryptionIbGib,
|
|
406
|
+
/**
|
|
407
|
+
* Decrypts and checks against original data
|
|
408
|
+
*/
|
|
409
|
+
confirm?: boolean,
|
|
410
|
+
/**
|
|
411
|
+
* If true, will persist the ibgib
|
|
412
|
+
*/
|
|
413
|
+
persist?: boolean,
|
|
414
|
+
/**
|
|
415
|
+
* If you provide this, the resulting ibgib will have the following format:
|
|
416
|
+
* `${ibRoot} ${publicIbMetadata}`. Otherwise, this will default to:
|
|
417
|
+
* `ciphertext ${publicIbMetadata}`, or just `ciphertext` if
|
|
418
|
+
* `publicIbMetadata` is falsy.
|
|
419
|
+
*/
|
|
420
|
+
ibRoot?: string,
|
|
421
|
+
/**
|
|
422
|
+
* If you want to include metadata in the ib itself of the
|
|
423
|
+
* ciphertext ibgib. This will of course make this metadata
|
|
424
|
+
* available without loading the full ibgib, but will increase
|
|
425
|
+
* storage size because every address linking to the ibgib will
|
|
426
|
+
* include this as well.
|
|
427
|
+
*/
|
|
428
|
+
publicIbMetadata?: string,
|
|
429
|
+
/**
|
|
430
|
+
* If you want to include public, unencrypted metadata in the ibgib's
|
|
431
|
+
* data body itself.
|
|
432
|
+
*/
|
|
433
|
+
publicMetadata?: TMetadata,
|
|
434
|
+
}): Promise<TransformResult<CiphertextIbGib_V1>>;
|
|
435
|
+
/**
|
|
436
|
+
* Brings together a ciphertext and secretIbGibs to decrypt
|
|
437
|
+
* the `ciphertextIbGib.data.ciphertext`
|
|
438
|
+
* @returns plaintext string of `ciphertextIbGib.data.ciphertext`
|
|
439
|
+
*/
|
|
440
|
+
getPlaintextString(arg: {
|
|
441
|
+
ciphertextIbGib: CiphertextIbGib_V1,
|
|
442
|
+
secretIbGibs: SecretIbGib_V1[],
|
|
443
|
+
fnPromptPassword: (title: string, msg: string) => Promise<string | null>,
|
|
444
|
+
dontPrompt?: boolean,
|
|
445
|
+
space: IbGibSpaceAny,
|
|
446
|
+
}): Promise<string>;
|
|
447
|
+
unwrapEncryptedSyncSpace(arg: {
|
|
448
|
+
encryptedSpace: IbGibSpaceAny,
|
|
449
|
+
fnPromptPassword: (title: string, msg: string) => Promise<string | null>,
|
|
450
|
+
dontPrompt?: boolean,
|
|
451
|
+
space?: IbGibSpaceAny,
|
|
452
|
+
}): Promise<IbGibSpaceAny>;
|
|
453
|
+
getAppSyncSpaces(arg: {
|
|
454
|
+
unwrapEncrypted: boolean,
|
|
455
|
+
createIfNone: boolean,
|
|
456
|
+
/**
|
|
457
|
+
* If true, don't prompt the user if we don't have it already cached.
|
|
458
|
+
*
|
|
459
|
+
* We don't want the user to hit the page and then always have to type in
|
|
460
|
+
* the password, just because my password code sucks atow.
|
|
461
|
+
*/
|
|
462
|
+
dontPrompt?: boolean,
|
|
463
|
+
space?: IbGibSpaceAny,
|
|
464
|
+
}): Promise<IbGibSpaceAny[]>;
|
|
465
|
+
getAppRobbotIbGibs(arg: {
|
|
466
|
+
createIfNone: boolean,
|
|
467
|
+
space?: IbGibSpaceAny,
|
|
468
|
+
}): Promise<RobbotIbGib_V1[]>;
|
|
469
|
+
getAppAppIbGibs(arg: {
|
|
470
|
+
createIfNone: boolean,
|
|
471
|
+
space?: IbGibSpaceAny,
|
|
472
|
+
}): Promise<AppIbGib_V1[]>;
|
|
473
|
+
syncIbGibs(arg: {
|
|
474
|
+
dependencyGraphIbGibs?: IbGib_V1[],
|
|
475
|
+
// confirm?: boolean,
|
|
476
|
+
/**
|
|
477
|
+
* If true, will watch ibgibs in dependency graph that have timelines
|
|
478
|
+
* (tjps).
|
|
479
|
+
*/
|
|
480
|
+
watch?: boolean,
|
|
481
|
+
/**
|
|
482
|
+
* The meat of the sync process is tracked via a status within the sync
|
|
483
|
+
* spaces themselves. I'm addign this fn to track the pre and post progress
|
|
484
|
+
* stuff, since decrypting takes some time, and building the dependency
|
|
485
|
+
* graphs takes time. Both of these happen before the actual syncing occurs
|
|
486
|
+
* in the spaces.
|
|
487
|
+
*/
|
|
488
|
+
fnPreSyncProgress?: (msg: string) => Promise<void>,
|
|
489
|
+
}): Promise<SyncSagaInfo[] | undefined>;
|
|
490
|
+
/**
|
|
491
|
+
* Prompts the user to select a new picture for the given `picIbGib`.
|
|
492
|
+
*
|
|
493
|
+
* If the user does select one, this creates the appropriate ibgibs (pic,
|
|
494
|
+
* binary, dependencies), saves them, registers the new pic (but not the bin)
|
|
495
|
+
* in the given `space` if specified, else in the current `localUserSpace`.
|
|
496
|
+
*/
|
|
497
|
+
updatePic(arg: {
|
|
498
|
+
/**
|
|
499
|
+
* picIbGib to update with a new image.
|
|
500
|
+
*/
|
|
501
|
+
picIbGib: PicIbGib_V1,
|
|
502
|
+
/**
|
|
503
|
+
* space within which we are working, i.e., where the incoming `picIbGib` is
|
|
504
|
+
* and where we will save any new ibgibs.
|
|
505
|
+
*/
|
|
506
|
+
space?: IbGibSpaceAny,
|
|
507
|
+
}): Promise<void>;
|
|
508
|
+
updateComment(arg: {
|
|
509
|
+
/**
|
|
510
|
+
* commentIbGib to update with a new text
|
|
511
|
+
*/
|
|
512
|
+
commentIbGib: CommentIbGib_V1,
|
|
513
|
+
/**
|
|
514
|
+
* space within which we are working, i.e., where the incoming `commentIbGib` is
|
|
515
|
+
* and where we will save any new ibgibs.
|
|
516
|
+
*/
|
|
517
|
+
space?: IbGibSpaceAny,
|
|
518
|
+
}): Promise<void>;
|
|
519
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
let crypto = globalThis.crypto;
|
|
2
|
+
let { subtle } = crypto;
|
|
3
|
+
|
|
4
|
+
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
5
|
+
/**
|
|
6
|
+
* Test helper functions.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as h from './helper.mjs';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
describe(`foo clone`, () => {
|
|
13
|
+
|
|
14
|
+
it(`should foo Clone yo (testing node/browser isomorphic packages)`, () => {
|
|
15
|
+
let obj = 1;
|
|
16
|
+
let clone = h.fooClone(obj);
|
|
17
|
+
expect(clone).withContext('clone foo yo').toEqual(obj);
|
|
18
|
+
// expect(1).withContext('expected fail test case').toBe(2);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it(`should foo getibAndGib yo (testing node/browser isomorphic packages)`, () => {
|
|
22
|
+
let result = h.fooGetIbAndGib();
|
|
23
|
+
expect(result.ib).withContext('ib').toEqual('ib');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it(`should foo factory yo (testing node/browser isomorphic packages)`, async () => {
|
|
27
|
+
let result = await h.fooFactory();
|
|
28
|
+
expect(result).withContext('result').toBeTruthy();
|
|
29
|
+
expect(result.ib).withContext('result.ib').toBeTruthy();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
async function hash({
|
|
35
|
+
s,
|
|
36
|
+
}: {
|
|
37
|
+
s: string,
|
|
38
|
+
}): Promise<string> {
|
|
39
|
+
if (!s) { return ''; }
|
|
40
|
+
let algorithm = 'SHA-256';
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
const msgUint8 = new TextEncoder().encode(s);
|
|
44
|
+
const buffer = await subtle.digest(algorithm, msgUint8);
|
|
45
|
+
const asArray = Array.from(new Uint8Array(buffer));
|
|
46
|
+
return asArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.error(e.message ?? e);
|
|
49
|
+
throw e;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
describe(`non-ts-gib isomorphic crypto hashing`, () => {
|
|
54
|
+
|
|
55
|
+
it(`should digest simple string consistently using crypto.subtle directly `, async () => {
|
|
56
|
+
let h = await hash({ s: '42' });
|
|
57
|
+
expect(h).withContext('42').toBe('73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049');
|
|
58
|
+
});
|
|
59
|
+
it(`should digest simple stringified ibgib consistently using crypto.subtle directly `, async () => {
|
|
60
|
+
let ibgib: IbGib_V1 = { ib: 'ib', gib: 'gib' };
|
|
61
|
+
let h = await hash({ s: JSON.stringify(ibgib) }); // doesn't use ts-gib but consistent stringifying json is important
|
|
62
|
+
expect(h).withContext('ib^gib').toBe('cbad0694a257358c044611ea1fa88ace71a01a9b8409d2354d0387d8043f7671');
|
|
63
|
+
});
|
|
64
|
+
});
|
package/src/index.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// export * from './helper.mjs';
|