@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
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ibgib/core-gib",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "ibgib core functionality, including base architecture for witnesses, spaces, apps, robbots, etc., as well as shared utility functions. Node v19+ needed for heavily-used isomorphic webcrypto hashing consumed in both node and browsers.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "https://github.com/wraiford/ibgib",
|
|
7
|
+
"type": "git"
|
|
8
|
+
},
|
|
9
|
+
"funding": {
|
|
10
|
+
"type": "individual",
|
|
11
|
+
"url": "https://paypal.me/ibGib"
|
|
12
|
+
},
|
|
13
|
+
"main": "dist/index.mjs",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "npm run clean && tsc -b tsconfig.json --force",
|
|
16
|
+
"build:test": "npm run clean && tsc -b tsconfig.test.json --force",
|
|
17
|
+
"build:test:noclean": "tsc -b tsconfig.test.json --force",
|
|
18
|
+
"clean": "rm -rf ./dist",
|
|
19
|
+
"test": "npm run test:both",
|
|
20
|
+
"test:both": "npm run build:test && npm run test:node:nobuild && npm run test:browser:nobuild",
|
|
21
|
+
"man:test:both": "use this if you want to test in both node and browser contexts",
|
|
22
|
+
"test:node": "npm run build:test && npx jasmine --config=jasmine.json",
|
|
23
|
+
"man:test:node": "use this if you want to build+test in node",
|
|
24
|
+
"test:node:nobuild": "npx jasmine --config=jasmine.json",
|
|
25
|
+
"man:test:node:nobuild": "use this if you want to test in node but its already built",
|
|
26
|
+
"test:browser": "npm run build:test && npx jasmine-browser-runner runSpecs --config=jasmine-browser.json ",
|
|
27
|
+
"man:test:browser": "use this if you want to build+test only the browser context",
|
|
28
|
+
"test:browser:nobuild": "npx jasmine-browser-runner runSpecs --config=jasmine-browser.json ",
|
|
29
|
+
"man:test:browser:nobuild": "use this if you want to test only the browser context but its already built",
|
|
30
|
+
"test:browser:serve": "npm run build:test && npx jasmine-browser-runner serve --config=jasmine-browser.json ",
|
|
31
|
+
"man:test:browser:serve": "use this if you want to build+test in the browser and don't want the browser to close when your done. (i.e. you're debugging)",
|
|
32
|
+
"test:browser:serve:nobuild": "npx jasmine-browser-runner serve --config=jasmine-browser.json ",
|
|
33
|
+
"man:test:browser:serve:nobuild": "use this if you are troubleshooting existing dist output and don't want to overwrite those files. (and you're debugging in the browser)",
|
|
34
|
+
"pack": "npm pack --pack-destination=\"./published\"",
|
|
35
|
+
"prepare:publish": "npm run clean && npm version patch && npm run build && npm run pack",
|
|
36
|
+
"man:prepare:publish": "use this to patch > build > pack for publishing to npm repo"
|
|
37
|
+
},
|
|
38
|
+
"type": "module",
|
|
39
|
+
"keywords": [
|
|
40
|
+
"ibgib",
|
|
41
|
+
"dlt",
|
|
42
|
+
"blockchain",
|
|
43
|
+
"graph-database"
|
|
44
|
+
],
|
|
45
|
+
"author": "William Raiford",
|
|
46
|
+
"license": "ISC",
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@ibgib/encrypt-gib": "^0.1.6",
|
|
49
|
+
"@ibgib/helper-gib": "^0.0.2",
|
|
50
|
+
"@ibgib/ts-gib": "^0.5.1",
|
|
51
|
+
"rxjs": "^7.8.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/jasmine": "^4.3.1",
|
|
55
|
+
"@types/node": "^16.11.6",
|
|
56
|
+
"jasmine": "^4.5.0",
|
|
57
|
+
"jasmine-browser-runner": "^1.3.0",
|
|
58
|
+
"jasmine-core": "^4.5.0",
|
|
59
|
+
"typescript": "^4.9.5"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=19.0.0"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
2
|
+
|
|
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({
|
|
12
|
+
s,
|
|
13
|
+
algorithm = 'SHA-256',
|
|
14
|
+
}: {
|
|
15
|
+
s: string,
|
|
16
|
+
algorithm?: string,
|
|
17
|
+
}): Promise<string> {
|
|
18
|
+
let { subtle } = globalThis.crypto;
|
|
19
|
+
if (!s) { throw new Error(`[${cryptoSubtleHash.name}] s is required`) }
|
|
20
|
+
if (!algorithm) { throw new Error(`[${cryptoSubtleHash.name}] algorithm is required`) }
|
|
21
|
+
try {
|
|
22
|
+
const msgUint8 = new TextEncoder().encode(s);
|
|
23
|
+
const buffer = await subtle.digest(algorithm, msgUint8);
|
|
24
|
+
const asArray = Array.from(new Uint8Array(buffer));
|
|
25
|
+
return asArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.error(e.message ?? e);
|
|
28
|
+
throw e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
describe(`non-ts-gib isomorphic crypto hashing`, () => {
|
|
33
|
+
|
|
34
|
+
it(`should digest simple string consistently using crypto.subtle directly `, async () => {
|
|
35
|
+
let h = await cryptoSubtleHash({ s: '42' });
|
|
36
|
+
expect(h).withContext('42').toBe('73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it(`should digest simple stringified ibgib consistently using crypto.subtle directly `, async () => {
|
|
40
|
+
let ibgib: IbGib_V1 = { ib: 'ib', gib: 'gib' };
|
|
41
|
+
let h = await cryptoSubtleHash({ s: JSON.stringify(ibgib) }); // doesn't use ts-gib but consistent stringifying json is important
|
|
42
|
+
expect(h).withContext('ib^gib').toBe('cbad0694a257358c044611ea1fa88ace71a01a9b8409d2354d0387d8043f7671');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* For pic binaries, this is a base 64 encoded string of the pic's image data.
|
|
5
|
+
|
|
6
|
+
* @see {@link BinIbGib_V1}
|
|
7
|
+
*/
|
|
8
|
+
export type BinData_V1 = any;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* IbGib for a binary, which right now atow just means a pic.
|
|
12
|
+
*
|
|
13
|
+
* Also for now, BinIbGib has no rel8ns, only data.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link BinData_V1}
|
|
16
|
+
*/
|
|
17
|
+
export interface BinIbGib_V1 extends IbGib_V1<any> { };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { IbGibAddr } from '@ibgib/ts-gib';
|
|
2
|
+
import { IbGib_V1, IB } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface IbGibCacheInfo {
|
|
6
|
+
/**
|
|
7
|
+
* The "primary key" of the cache info. If {@link addrScope} is not provided,
|
|
8
|
+
* then atow this will be the only location information for the ibGib.
|
|
9
|
+
*/
|
|
10
|
+
addr: IbGibAddr;
|
|
11
|
+
/**
|
|
12
|
+
* If provided, this will be used to identify the cache info in combination
|
|
13
|
+
* with the addr. Else, just the addr will be used.
|
|
14
|
+
*
|
|
15
|
+
* So, e.g., you may store an ibGib item by
|
|
16
|
+
* @example { addr: comment abc^123, addrScope: 'item', ibGib, other: item }
|
|
17
|
+
*/
|
|
18
|
+
addrScope?: string;
|
|
19
|
+
/**
|
|
20
|
+
* ibGib reference.
|
|
21
|
+
*/
|
|
22
|
+
ibGib: IbGib_V1;
|
|
23
|
+
/**
|
|
24
|
+
* Place to store additional associated cached data with the ibGib.
|
|
25
|
+
*
|
|
26
|
+
* ## driving use case
|
|
27
|
+
*
|
|
28
|
+
* I want to cache the entire IbGibItem for many IbGibComponentBase classes to
|
|
29
|
+
* speed up the entire loading (not just the loading of the ibGib property
|
|
30
|
+
* itself from storage).
|
|
31
|
+
*
|
|
32
|
+
* atow I'm storing a separate entry with addr + this.lc for using this other
|
|
33
|
+
* property.
|
|
34
|
+
*/
|
|
35
|
+
other?: any;
|
|
36
|
+
tjpAddr?: IbGibAddr;
|
|
37
|
+
tjpIbGib?: IbGib_V1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Using this for a quick implementation for caching.
|
|
42
|
+
*
|
|
43
|
+
* ## future
|
|
44
|
+
*
|
|
45
|
+
* change this to an ibgib (in memory) innerspace. then we can pass in
|
|
46
|
+
* the innerspace ibgib instead of just setting a property. this will make
|
|
47
|
+
* it more extensible in the future (i think...)
|
|
48
|
+
*/
|
|
49
|
+
export interface IbGibCacheService {
|
|
50
|
+
has({ addr, addrScope }: { addr: IbGibAddr, addrScope?: string }): Promise<boolean>;
|
|
51
|
+
put(info: IbGibCacheInfo): Promise<void>;
|
|
52
|
+
get({ addr, addrScope }: { addr: IbGibAddr, addrScope?: string }): Promise<IbGibCacheInfo | undefined>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* comment ibs atow are comment [commentText substring]
|
|
3
|
+
*/
|
|
4
|
+
export const DEFAULT_COMMENT_TEXT_IB_SUBSTRING_LENGTH = 20;
|
|
5
|
+
/**
|
|
6
|
+
* comment ib can have additional metadata string,
|
|
7
|
+
*
|
|
8
|
+
* @example "comment thisisacomm here_is_addl_metadata"
|
|
9
|
+
*/
|
|
10
|
+
export const DEFAULT_COMMENT_METADATA_IB_SUBSTRING_LENGTH = 64;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { Ib, TransformResult } from '@ibgib/ts-gib';
|
|
2
|
+
import { Factory_V1 as factory, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
|
|
6
|
+
import { persistTransformResult } from '../../witness/space/space-helper.mjs';
|
|
7
|
+
import { CommentData_V1, CommentIbGib_V1 } from './comment-types.mjs';
|
|
8
|
+
import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
|
|
9
|
+
import { getSaferSubstring, getTimestamp, pretty } from '@ibgib/helper-gib';
|
|
10
|
+
import { DEFAULT_COMMENT_METADATA_IB_SUBSTRING_LENGTH, DEFAULT_COMMENT_TEXT_IB_SUBSTRING_LENGTH } from './comment-constants.mjs';
|
|
11
|
+
// import { getSaferSubstring } from './utils.mjs';
|
|
12
|
+
|
|
13
|
+
const logalot = GLOBAL_LOG_A_LOT || false;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* generates an ib based on the comment text.
|
|
18
|
+
*
|
|
19
|
+
* Basically this gets a short substring of the comment text and replaces
|
|
20
|
+
* any non alphanumeric characters.
|
|
21
|
+
*
|
|
22
|
+
* @param commentText comment text
|
|
23
|
+
* @returns comment ib for the given comment text
|
|
24
|
+
*/
|
|
25
|
+
export function getCommentIb({
|
|
26
|
+
commentText,
|
|
27
|
+
addlMetadataText,
|
|
28
|
+
}: {
|
|
29
|
+
commentText: string;
|
|
30
|
+
/**
|
|
31
|
+
* Optional metadata string to be included in the comment's ib.
|
|
32
|
+
* Should be underscore-delimited but not a hard rule atow.
|
|
33
|
+
*
|
|
34
|
+
* @example "comment thisisacomm here_is_addl_metadata"
|
|
35
|
+
*/
|
|
36
|
+
addlMetadataText?: string;
|
|
37
|
+
}): string {
|
|
38
|
+
const lc = `[${getCommentIb.name}]`;
|
|
39
|
+
try {
|
|
40
|
+
if (!commentText) { throw new Error(`commentText required. (E: 22fdfd0aa0524a18b63a9405b312c99e)`); }
|
|
41
|
+
|
|
42
|
+
// get a safe slice of the comment text to add to the ib
|
|
43
|
+
const ibCommentText =
|
|
44
|
+
getSaferSubstring({
|
|
45
|
+
text: commentText,
|
|
46
|
+
length: DEFAULT_COMMENT_TEXT_IB_SUBSTRING_LENGTH,
|
|
47
|
+
replaceMap: { ['?']: '__qm__' }, // we want to preserve question marks for requests for robbots
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (addlMetadataText) {
|
|
51
|
+
if (addlMetadataText.length > DEFAULT_COMMENT_METADATA_IB_SUBSTRING_LENGTH) {
|
|
52
|
+
console.warn(`${lc} addlMetadataText (${addlMetadataText.length}) is too long. Max length: ${DEFAULT_COMMENT_METADATA_IB_SUBSTRING_LENGTH}`);
|
|
53
|
+
}
|
|
54
|
+
const ibCommentMetadata =
|
|
55
|
+
getSaferSubstring({ text: addlMetadataText, length: DEFAULT_COMMENT_METADATA_IB_SUBSTRING_LENGTH });
|
|
56
|
+
if (!ibCommentMetadata) { throw new Error(`(UNEXPECTED) addlMetadataText contains no safe characters? (E: dd03c578ada2836b05c94a4aa1785222)`); }
|
|
57
|
+
return `comment ${ibCommentText} ${ibCommentMetadata}`;
|
|
58
|
+
} else {
|
|
59
|
+
return `comment ${ibCommentText}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error(`${lc} ${error.message}`);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function parseCommentIb({
|
|
69
|
+
ib,
|
|
70
|
+
}: {
|
|
71
|
+
ib: Ib,
|
|
72
|
+
}): {
|
|
73
|
+
safeIbCommentText: string;
|
|
74
|
+
safeIbCommentMetadataText?: string;
|
|
75
|
+
} {
|
|
76
|
+
const lc = `${parseCommentIb.name}]`;
|
|
77
|
+
try {
|
|
78
|
+
if (logalot) { console.log(`${lc} starting... (I: 1a16f5e3134599eeb585eae77ee6af22)`); }
|
|
79
|
+
|
|
80
|
+
if (!ib) { throw new Error(`ib required (E: d89f8c4df46b970585c82bc89c1c6322)`); }
|
|
81
|
+
|
|
82
|
+
let [_, safeIbCommentText, safeIbCommentMetadataText] = ib.split(' ');
|
|
83
|
+
// replaceMap: { ['?']: '__qm__' }, // we want to preserve question marks for requests for robbots
|
|
84
|
+
while (safeIbCommentText.includes('__qm__')) {
|
|
85
|
+
safeIbCommentText = safeIbCommentText.replace('__qm__', '?');
|
|
86
|
+
}
|
|
87
|
+
return { safeIbCommentText, safeIbCommentMetadataText };
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.error(`${lc} ${error.message}`);
|
|
90
|
+
throw error;
|
|
91
|
+
} finally {
|
|
92
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* creates a comment ibgib, returning the transform result,
|
|
98
|
+
* optionally saving it in a given {@link space}.
|
|
99
|
+
*/
|
|
100
|
+
export async function createCommentIbGib({
|
|
101
|
+
text,
|
|
102
|
+
addlMetadataText,
|
|
103
|
+
saveInSpace,
|
|
104
|
+
space,
|
|
105
|
+
}: {
|
|
106
|
+
/**
|
|
107
|
+
* comment text
|
|
108
|
+
*/
|
|
109
|
+
text: string,
|
|
110
|
+
/**
|
|
111
|
+
* Optional metadata string to be included in the comment's ib.
|
|
112
|
+
* Should be underscore-delimited but not a hard rule atow.
|
|
113
|
+
*
|
|
114
|
+
* @example "comment thisisacomm here_is_addl_metadata"
|
|
115
|
+
*/
|
|
116
|
+
addlMetadataText?: string;
|
|
117
|
+
/**
|
|
118
|
+
* If true, will save the ibgibs created in the given {@link space}.
|
|
119
|
+
*/
|
|
120
|
+
saveInSpace?: boolean,
|
|
121
|
+
/**
|
|
122
|
+
* If {@link saveInSpace}, all ibgibs created in this function will be stored in
|
|
123
|
+
* this space.
|
|
124
|
+
*/
|
|
125
|
+
space?: IbGibSpaceAny,
|
|
126
|
+
}): Promise<TransformResult<CommentIbGib_V1>> {
|
|
127
|
+
const lc = `[${createCommentIbGib.name}]`;
|
|
128
|
+
|
|
129
|
+
if (logalot) { console.log(`${lc} starting...`); }
|
|
130
|
+
try {
|
|
131
|
+
if (!text) { throw new Error(`text required (E: 3e3d0f555e1a83771a6548eb10943522)`); }
|
|
132
|
+
|
|
133
|
+
text = text.trim();
|
|
134
|
+
|
|
135
|
+
if (!text) { throw new Error(`text cannot be only whitespace (E: d6db3537b9834294836aeb70987c908e)`); }
|
|
136
|
+
|
|
137
|
+
const data: CommentData_V1 = { text, textTimestamp: getTimestamp() };
|
|
138
|
+
|
|
139
|
+
// create an ibgib with the filename and ext
|
|
140
|
+
const opts: any = {
|
|
141
|
+
parentIbGib: factory.primitive({ ib: 'comment' }),
|
|
142
|
+
ib: getCommentIb({ commentText: text, addlMetadataText }),
|
|
143
|
+
data,
|
|
144
|
+
dna: true,
|
|
145
|
+
tjp: { uuid: true, timestamp: true },
|
|
146
|
+
nCounter: true,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// this makes it more difficult to share/sync ibgibs...
|
|
150
|
+
// if (this.addr) { opts.rel8ns = { 'comment on': [this.addr] }; }
|
|
151
|
+
|
|
152
|
+
if (logalot) { console.log(`${lc} opts: ${pretty(opts)}`); }
|
|
153
|
+
const resCommentIbGib = await factory.firstGen(opts) as TransformResult<CommentIbGib_V1>;
|
|
154
|
+
|
|
155
|
+
if (saveInSpace) {
|
|
156
|
+
if (!space) { throw new Error(`space required if saveInSpace is truthy (E: 40f69f22f21b4279a83cb746cb4b0da1)`); }
|
|
157
|
+
await persistTransformResult({ resTransform: resCommentIbGib, space });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return resCommentIbGib;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
console.error(`${lc} ${error.message}`);
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function isComment({
|
|
168
|
+
ibGib,
|
|
169
|
+
}: {
|
|
170
|
+
ibGib: IbGib_V1,
|
|
171
|
+
}): boolean {
|
|
172
|
+
const lc = `[${isComment.name}]`;
|
|
173
|
+
try {
|
|
174
|
+
if (logalot) { console.log(`${lc} starting...`); }
|
|
175
|
+
|
|
176
|
+
if (!ibGib) { throw new Error(`ibGib required (E: f204dac30ae548b0a049f1c4d8048502)`); }
|
|
177
|
+
|
|
178
|
+
const { ib, data, rel8ns } = ibGib;
|
|
179
|
+
|
|
180
|
+
// try rel8ns first
|
|
181
|
+
if (!rel8ns) {
|
|
182
|
+
if (logalot) { console.log(`${lc} rel8ns falsy, NOT a comment (I: 6e145eb2d0ba46629746215a3b655fd5)`); }
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// descends from comment^gib
|
|
187
|
+
const ancestors = rel8ns.ancestor || [];
|
|
188
|
+
if (ancestors && ancestors.includes('comment^gib')) {
|
|
189
|
+
if (logalot) { console.log(`${lc} descends from comment^gib, YES is a comment (I: 1a8557780e2e4c1580d5a2585567762b)`); }
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// has binary qualities and ib contains 'comment'
|
|
194
|
+
if (!data) {
|
|
195
|
+
if (logalot) { console.log(`${lc} data falsy, NOT a comment (I: 30b20ff6785f432f98489f11efe24299)`); }
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
if (data.text && ib?.includes('comment')) {
|
|
199
|
+
if (logalot) { console.log(`${lc} has text, and ib has 'comment', YES is a comment (I: 3aa03bcd639d4ec7abd7ead917eda3d8)`); }
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (logalot) { console.log(`${lc} reached end, doesn't have comment qualities. NOT a comment. (I: cfa529f27f9d490abd476c924ef77087)`); }
|
|
204
|
+
return false;
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.error(`${lc} ${error.message}`);
|
|
207
|
+
throw error;
|
|
208
|
+
} finally {
|
|
209
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TransformResult } from '@ibgib/ts-gib';
|
|
2
|
+
import { IbGibData_V1, IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Data for a comment ibGib
|
|
6
|
+
*/
|
|
7
|
+
export interface CommentData_V1 extends IbGibData_V1 {
|
|
8
|
+
text: string;
|
|
9
|
+
textTimestamp?: string;
|
|
10
|
+
timestamp?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface CommentRel8ns_V1 extends IbGibRel8ns_V1 {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface CommentIbGib_V1 extends IbGib_V1<CommentData_V1, CommentRel8ns_V1> {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type UpdateCommentPromptResult = TransformResult<CommentIbGib_V1>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Ib, } from '@ibgib/ts-gib';
|
|
2
|
+
|
|
3
|
+
import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
|
|
4
|
+
import {
|
|
5
|
+
DisplayData_V1, DisplayRel8ns_V1, DisplayIbGib_V1,
|
|
6
|
+
DISPLAY_ATOM,
|
|
7
|
+
// DisplayOutputMode, VALID_DISPLAY_OUTPUT_MODES
|
|
8
|
+
} from './display-types.mjs';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const logalot = GLOBAL_LOG_A_LOT || false;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export function validateDisplayData({
|
|
15
|
+
data,
|
|
16
|
+
}: {
|
|
17
|
+
data: DisplayData_V1,
|
|
18
|
+
}): string[] {
|
|
19
|
+
const lc = `[${validateDisplayData.name}]`;
|
|
20
|
+
try {
|
|
21
|
+
if (logalot) { console.log(`${lc} starting...`); }
|
|
22
|
+
if (!data) { throw new Error(`displayData required (E: 9e138d1bc84c4dbdaad768e85ce3dfa7)`); }
|
|
23
|
+
const errors: string[] = [];
|
|
24
|
+
const {
|
|
25
|
+
uuid,
|
|
26
|
+
filters,
|
|
27
|
+
sorts,
|
|
28
|
+
} =
|
|
29
|
+
data;
|
|
30
|
+
|
|
31
|
+
if (logalot) { console.warn(`${lc} not implemented yet (W: cc8c2d55cdbb40bc85531d8ff4df5bbc)`); }
|
|
32
|
+
|
|
33
|
+
if (filters?.length ?? 0 > 0) { }
|
|
34
|
+
|
|
35
|
+
if (sorts?.length ?? 0 > 0) { }
|
|
36
|
+
|
|
37
|
+
return errors;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error(`${lc} ${error.message}`);
|
|
40
|
+
throw error;
|
|
41
|
+
} finally {
|
|
42
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getDisplayIb({
|
|
47
|
+
data,
|
|
48
|
+
}: {
|
|
49
|
+
data: DisplayData_V1,
|
|
50
|
+
}): Ib {
|
|
51
|
+
const lc = `[${getDisplayIb.name}]`;
|
|
52
|
+
try {
|
|
53
|
+
const validationErrors = validateDisplayData({ data });
|
|
54
|
+
if (validationErrors.length > 0) { throw new Error(`invalid data: ${validationErrors} (E: 8b025bed03b7477e8114fb0f3fc68aea)`); }
|
|
55
|
+
|
|
56
|
+
const { ticks } = data;
|
|
57
|
+
|
|
58
|
+
return `${DISPLAY_ATOM} ${ticks}`
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error(`${lc} ${error.message}`);
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Current schema is `witness display [classname] [displayName] [displayId]
|
|
67
|
+
*
|
|
68
|
+
* NOTE this is space-delimited
|
|
69
|
+
*/
|
|
70
|
+
export function parseDisplayIb({
|
|
71
|
+
displayIb,
|
|
72
|
+
}: {
|
|
73
|
+
displayIb: Ib,
|
|
74
|
+
}): {
|
|
75
|
+
ticks: string,
|
|
76
|
+
} {
|
|
77
|
+
const lc = `[${parseDisplayIb.name}]`;
|
|
78
|
+
try {
|
|
79
|
+
if (!displayIb) { throw new Error(`displayIb required (E: d9920ab1683042388d156b1ae781565d)`); }
|
|
80
|
+
|
|
81
|
+
const [atom, ticks] = displayIb.split(' ');
|
|
82
|
+
|
|
83
|
+
return { ticks, };
|
|
84
|
+
} catch (error) {
|
|
85
|
+
console.error(`${lc} ${error.message}`);
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { IbGibData_V1, IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
2
|
+
|
|
3
|
+
export type SortStrategy = 'data_path';
|
|
4
|
+
export const SortStrategy = {
|
|
5
|
+
/**
|
|
6
|
+
* sorts targeting a specific path in the ibgib.data object.
|
|
7
|
+
*
|
|
8
|
+
* So if you want to sort by comment text, then the path will
|
|
9
|
+
* be `'text'`. If you want to sort by date, then `'timestamp'`.
|
|
10
|
+
*/
|
|
11
|
+
data_path: "data_path" as SortStrategy,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type SortDirection = 'ascending' | 'descending' | 'forward' | 'reverse';
|
|
15
|
+
export const SortDirection =
|
|
16
|
+
{
|
|
17
|
+
/**
|
|
18
|
+
* In an ordered list, we will sort starting with the least and going to the
|
|
19
|
+
* greatest.
|
|
20
|
+
*/
|
|
21
|
+
ascending: 'ascending' as SortDirection,
|
|
22
|
+
/**
|
|
23
|
+
* In an ordered list, we will sort starting with the highest/greatest and
|
|
24
|
+
* go to the lowest/least.
|
|
25
|
+
*/
|
|
26
|
+
descending: 'descending' as SortDirection,
|
|
27
|
+
/**
|
|
28
|
+
* Often the same as ascending, but depends on context.
|
|
29
|
+
*
|
|
30
|
+
* For example, there may be a non-ascending existing order and we are
|
|
31
|
+
* speaking relative to this.
|
|
32
|
+
*/
|
|
33
|
+
forward: 'forward' as SortDirection,
|
|
34
|
+
/**
|
|
35
|
+
* Often the same as descending, but depends on context.
|
|
36
|
+
*
|
|
37
|
+
* For example, there may be a non-ordered existing list and we are speaking
|
|
38
|
+
* relative to this.
|
|
39
|
+
*/
|
|
40
|
+
reverse: 'reverse' as SortDirection,
|
|
41
|
+
}
|
|
42
|
+
export type FilterType = 'keyword' | 'time';
|
|
43
|
+
|
|
44
|
+
export interface FilterInfo {
|
|
45
|
+
filterType: FilterType;
|
|
46
|
+
/**
|
|
47
|
+
* if provided, uses custom data path(s) into the ibgib.data object to
|
|
48
|
+
* filter against.
|
|
49
|
+
*
|
|
50
|
+
* If not provided, this defaults to whatever makes sense for the ibgib. For
|
|
51
|
+
* example, a comment or link ibgib will default to the 'text' path. A pic
|
|
52
|
+
* will look in filename, extension, and maybe some others that I haven't
|
|
53
|
+
* implemented yet.
|
|
54
|
+
*/
|
|
55
|
+
dataPaths?: string[];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* self explanatory
|
|
59
|
+
*/
|
|
60
|
+
caseSensitive?: boolean;
|
|
61
|
+
hasAllKeywords?: string[];
|
|
62
|
+
hasNoneKeywords?: string[];
|
|
63
|
+
hasAnyKeywords?: string[];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* If filterType is 'time', then this is the earliest date/time.
|
|
67
|
+
* If it's 'keyword', then this is lower bound by character. (may not implement at first)
|
|
68
|
+
*/
|
|
69
|
+
startBound?: string;
|
|
70
|
+
endBound?: string;
|
|
71
|
+
startBoundInclusive?: boolean;
|
|
72
|
+
endBoundInclusive?: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface SortInfo {
|
|
76
|
+
/**
|
|
77
|
+
* How we're approaching the sort.
|
|
78
|
+
*
|
|
79
|
+
* ATOW this is just 'data_path'
|
|
80
|
+
*/
|
|
81
|
+
strategy: SortStrategy;
|
|
82
|
+
/**
|
|
83
|
+
* If supplied, then this will dictate how the sort ordered.
|
|
84
|
+
*/
|
|
85
|
+
direction?: SortDirection;
|
|
86
|
+
/**
|
|
87
|
+
* If the `strategy` is 'data_path', then this is the value of
|
|
88
|
+
* the data_path.
|
|
89
|
+
*
|
|
90
|
+
* @example 'text' if sorting by comment text
|
|
91
|
+
*/
|
|
92
|
+
value: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface DisplayData_V1 extends IbGibData_V1 {
|
|
96
|
+
ticks: string;
|
|
97
|
+
filters?: FilterInfo[];
|
|
98
|
+
sorts?: SortInfo[];
|
|
99
|
+
}
|
|
100
|
+
export interface DisplayRel8ns_V1 extends IbGibRel8ns_V1 {
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface DisplayIbGib_V1 extends IbGib_V1<DisplayData_V1, DisplayRel8ns_V1> {
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const DISPLAY_ATOM = 'display';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SaltStrategy } from '@ibgib/encrypt-gib/dist/index.mjs';
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_ENCRYPTION_INITIAL_RECURSIONS = 50000;
|
|
4
|
+
export const MIN_ENCRYPTION_INITIAL_RECURSIONS = 1000;
|
|
5
|
+
export const MAX_ENCRYPTION_INITIAL_RECURSIONS = 10000000;
|
|
6
|
+
export const MIN_ENCRYPTION_RECURSIONS_PER_HASH = 1;
|
|
7
|
+
export const MAX_ENCRYPTION_RECURSIONS_PER_HASH = 1000;
|
|
8
|
+
export const MIN_ENCRYPTION_SALT_LENGTH = 50;
|
|
9
|
+
export const MAX_ENCRYPTION_SALT_LENGTH = 99999;
|
|
10
|
+
export const MIN_ENCRYPTION_PASSWORD_LENGTH = 8;
|
|
11
|
+
export const MAX_ENCRYPTION_PASSWORD_LENGTH = 9999999;
|
|
12
|
+
export const DEFAULT_ENCRYPTION_SALT_STRATEGY: SaltStrategy = SaltStrategy.appendPerHash;
|
|
13
|
+
export const DEFAULT_ENCRYPTION_RECURSIONS_PER_HASH = 10;
|
|
14
|
+
export const DEFAULT_ENCRYPTION_HASH_ALGORITHM = 'SHA-256';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A secrets ibgib uses this rel8n name for its children secrets.
|
|
18
|
+
*/
|
|
19
|
+
export const SECRET_REL8N_NAME = 'secret';
|
|
20
|
+
/**
|
|
21
|
+
* An encryptions ibgib uses this rel8n name for its children encryptions.
|
|
22
|
+
*/
|
|
23
|
+
export const ENCRYPTION_REL8N_NAME = 'encryption';
|
|
24
|
+
/**
|
|
25
|
+
* Related encrypted ciphertext ibgibs will use this rel8n name.
|
|
26
|
+
* Those ciphertext ibgibs will then relate to the encryption used.
|
|
27
|
+
*/
|
|
28
|
+
export const CIPHERTEXT_REL8N_NAME = 'ciphertext';
|