dphelper 4.6.0 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COPYRIGHT.md +6 -6
- package/FUNDING.yml +12 -12
- package/LICENSE.md +21 -21
- package/README.md +417 -397
- package/SECURITY.md +26 -26
- package/SUMMARY.md +83 -83
- package/index.cjs +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/llms.txt +73 -73
- package/modules/ai.cjs +1 -1
- package/modules/ai.d.ts +11 -11
- package/modules/ai.js +1 -1
- package/modules/anchor.cjs +1 -1
- package/modules/anchor.d.ts +6 -6
- package/modules/anchor.js +1 -1
- package/modules/array.cjs +1 -1
- package/modules/array.d.ts +21 -21
- package/modules/array.js +1 -1
- package/modules/audio.cjs +1 -1
- package/modules/audio.d.ts +10 -10
- package/modules/audio.js +1 -1
- package/modules/avoid.cjs +1 -1
- package/modules/avoid.d.ts +2 -2
- package/modules/avoid.js +1 -1
- package/modules/biometric.cjs +1 -1
- package/modules/biometric.d.ts +14 -14
- package/modules/biometric.js +1 -1
- package/modules/browser.cjs +1 -1
- package/modules/browser.d.ts +10 -10
- package/modules/browser.js +1 -1
- package/modules/check.cjs +1 -1
- package/modules/check.d.ts +4 -4
- package/modules/check.js +1 -1
- package/modules/color.cjs +1 -1
- package/modules/color.d.ts +6 -6
- package/modules/color.js +1 -1
- package/modules/compress.cjs +1 -1
- package/modules/compress.d.ts +13 -13
- package/modules/compress.js +1 -1
- package/modules/cookie.cjs +1 -1
- package/modules/cookie.d.ts +12 -12
- package/modules/cookie.js +1 -1
- package/modules/coords.cjs +1 -1
- package/modules/coords.d.ts +8 -8
- package/modules/coords.js +1 -1
- package/modules/credits.cjs +1 -1
- package/modules/credits.d.ts +11 -11
- package/modules/credits.js +1 -1
- package/modules/date.cjs +1 -1
- package/modules/date.d.ts +25 -25
- package/modules/date.js +1 -1
- package/modules/disable.cjs +1 -1
- package/modules/disable.d.ts +8 -8
- package/modules/disable.js +1 -1
- package/modules/dispatch.cjs +1 -1
- package/modules/dispatch.d.ts +4 -4
- package/modules/dispatch.js +1 -1
- package/modules/elements.cjs +1 -1
- package/modules/elements.d.ts +3 -3
- package/modules/elements.js +1 -1
- package/modules/events.cjs +1 -1
- package/modules/events.d.ts +6 -6
- package/modules/events.js +1 -1
- package/modules/fetch.cjs +1 -1
- package/modules/fetch.d.ts +15 -15
- package/modules/fetch.js +1 -1
- package/modules/form.cjs +1 -1
- package/modules/form.d.ts +13 -13
- package/modules/form.js +1 -1
- package/modules/format.cjs +1 -1
- package/modules/format.d.ts +3 -3
- package/modules/format.js +1 -1
- package/modules/i18n.cjs +1 -1
- package/modules/i18n.d.ts +11 -11
- package/modules/i18n.js +1 -1
- package/modules/image.cjs +1 -1
- package/modules/image.d.ts +13 -13
- package/modules/image.js +1 -1
- package/modules/json.cjs +1 -1
- package/modules/json.d.ts +8 -8
- package/modules/json.js +1 -1
- package/modules/load.cjs +1 -1
- package/modules/load.d.ts +8 -8
- package/modules/load.js +1 -1
- package/modules/logging.cjs +1 -1
- package/modules/logging.d.ts +8 -8
- package/modules/logging.js +1 -1
- package/modules/math.cjs +1 -1
- package/modules/math.d.ts +13 -13
- package/modules/math.js +1 -1
- package/modules/memory.cjs +1 -1
- package/modules/memory.d.ts +3 -3
- package/modules/memory.js +1 -1
- package/modules/navigation.cjs +1 -1
- package/modules/navigation.d.ts +4 -4
- package/modules/navigation.js +1 -1
- package/modules/net.cjs +1 -1
- package/modules/net.d.ts +10 -10
- package/modules/net.js +1 -1
- package/modules/objects.cjs +1 -1
- package/modules/objects.d.ts +15 -15
- package/modules/objects.js +1 -1
- package/modules/path.cjs +1 -1
- package/modules/path.d.ts +4 -4
- package/modules/path.js +1 -1
- package/modules/promise.cjs +1 -1
- package/modules/promise.d.ts +3 -3
- package/modules/promise.js +1 -1
- package/modules/sanitize.cjs +1 -1
- package/modules/sanitize.d.ts +2 -2
- package/modules/sanitize.js +1 -1
- package/modules/screen.cjs +1 -1
- package/modules/screen.d.ts +11 -11
- package/modules/screen.js +1 -1
- package/modules/scrollbar.cjs +1 -1
- package/modules/scrollbar.d.ts +9 -9
- package/modules/scrollbar.js +1 -1
- package/modules/security.cjs +1 -1
- package/modules/security.d.ts +15 -15
- package/modules/security.js +1 -1
- package/modules/shortcut.cjs +1 -1
- package/modules/shortcut.d.ts +2 -2
- package/modules/shortcut.js +1 -1
- package/modules/socket.cjs +1 -1
- package/modules/socket.d.ts +13 -13
- package/modules/socket.js +1 -1
- package/modules/sse.cjs +1 -1
- package/modules/sse.d.ts +8 -8
- package/modules/sse.js +1 -1
- package/modules/svg.cjs +1 -1
- package/modules/svg.d.ts +12 -12
- package/modules/svg.js +1 -1
- package/modules/sync.cjs +1 -1
- package/modules/sync.d.ts +13 -13
- package/modules/sync.js +1 -1
- package/modules/system.cjs +1 -1
- package/modules/system.d.ts +2 -2
- package/modules/system.js +1 -1
- package/modules/text.cjs +1 -1
- package/modules/text.d.ts +13 -13
- package/modules/text.js +1 -1
- package/modules/timer.cjs +1 -1
- package/modules/timer.d.ts +3 -3
- package/modules/timer.js +1 -1
- package/modules/tools.cjs +1 -1
- package/modules/tools.d.ts +5 -5
- package/modules/tools.js +1 -1
- package/modules/translators.cjs +1 -1
- package/modules/translators.d.ts +2 -2
- package/modules/translators.js +1 -1
- package/modules/triggers.cjs +1 -1
- package/modules/triggers.d.ts +43 -43
- package/modules/triggers.js +1 -1
- package/modules/types.cjs +1 -1
- package/modules/types.d.ts +5 -5
- package/modules/types.js +1 -1
- package/modules/ui.cjs +1 -1
- package/modules/ui.d.ts +3 -3
- package/modules/ui.js +1 -1
- package/modules/window.cjs +1 -1
- package/modules/window.d.ts +9 -9
- package/modules/window.js +1 -1
- package/modules/worker.cjs +1 -1
- package/modules/worker.d.ts +16 -16
- package/modules/worker.js +1 -1
- package/package.json +1 -1
- package/sbom.json +9 -14
- package/types/dphelper.d.ts +546 -546
- package/types/global.d.ts +8 -8
package/SECURITY.md
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
# Security Policy
|
|
2
|
-
|
|
3
|
-
## Supported Versions
|
|
4
|
-
|
|
5
|
-
| Version | Supported |
|
|
6
|
-
| ------- | --------- |
|
|
7
|
-
| 3.9.x | ✅ |
|
|
8
|
-
| < 3.5 | ❌ |
|
|
9
|
-
|
|
10
|
-
## Security Standards
|
|
11
|
-
|
|
12
|
-
- **NIST SP 800-53:** 98% compliance
|
|
13
|
-
- **OWASP Top 10:** 100% compliance
|
|
14
|
-
- **Socket.dev:** 90%+ target
|
|
15
|
-
|
|
16
|
-
## Reporting a Vulnerability
|
|
17
|
-
|
|
18
|
-
Email: architecture@biglogic.ca
|
|
19
|
-
Response: Within 24 hours
|
|
20
|
-
|
|
21
|
-
## Security Features
|
|
22
|
-
|
|
23
|
-
- PBKDF2 310k iterations (OWASP 2023)
|
|
24
|
-
- AES-GCM 256-bit encryption
|
|
25
|
-
- TLS 1.2+ enforcement
|
|
26
|
-
- WebSocket wss:// only
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------- | --------- |
|
|
7
|
+
| 3.9.x | ✅ |
|
|
8
|
+
| < 3.5 | ❌ |
|
|
9
|
+
|
|
10
|
+
## Security Standards
|
|
11
|
+
|
|
12
|
+
- **NIST SP 800-53:** 98% compliance
|
|
13
|
+
- **OWASP Top 10:** 100% compliance
|
|
14
|
+
- **Socket.dev:** 90%+ target
|
|
15
|
+
|
|
16
|
+
## Reporting a Vulnerability
|
|
17
|
+
|
|
18
|
+
Email: architecture@biglogic.ca
|
|
19
|
+
Response: Within 24 hours
|
|
20
|
+
|
|
21
|
+
## Security Features
|
|
22
|
+
|
|
23
|
+
- PBKDF2 310k iterations (OWASP 2023)
|
|
24
|
+
- AES-GCM 256-bit encryption
|
|
25
|
+
- TLS 1.2+ enforcement
|
|
26
|
+
- WebSocket wss:// only
|
|
27
27
|
- Input validation on all endpoints
|
package/SUMMARY.md
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
# Table of Contents
|
|
2
|
-
|
|
3
|
-
- [dpHelper](../README.md)
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Core Tools
|
|
8
|
-
|
|
9
|
-
- [ai](markdown/ai.md)
|
|
10
|
-
- [array](markdown/array.md)
|
|
11
|
-
- [browser](markdown/browser.md)
|
|
12
|
-
- [check](markdown/check.md)
|
|
13
|
-
- [date](markdown/date.md)
|
|
14
|
-
- [form](markdown/form.md)
|
|
15
|
-
- [json](markdown/json.md)
|
|
16
|
-
- [load](markdown/load.md)
|
|
17
|
-
- [navigation](markdown/navigation.md)
|
|
18
|
-
- [security](markdown/security.md)
|
|
19
|
-
- [socket](markdown/socket.md)
|
|
20
|
-
- [svg](markdown/svg.md)
|
|
21
|
-
- [markdown](markdown/markdown.md)
|
|
22
|
-
- [window](markdown/window.md)
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## UI & DOM
|
|
27
|
-
|
|
28
|
-
- [anchor](markdown/anchor.md)
|
|
29
|
-
- [audio](markdown/audio.md)
|
|
30
|
-
- [color](markdown/color.md)
|
|
31
|
-
- [coords](markdown/coords.md)
|
|
32
|
-
- [disable](markdown/disable.md)
|
|
33
|
-
- [dispatch](markdown/dispatch.md)
|
|
34
|
-
- [element](markdown/element.md)
|
|
35
|
-
- [event](markdown/event.md)
|
|
36
|
-
- [scrollbar](markdown/scrollbar.md)
|
|
37
|
-
- [screen](markdown/screen.md)
|
|
38
|
-
- [trigger](markdown/trigger.md)
|
|
39
|
-
- [type](markdown/type.md)
|
|
40
|
-
- [types](markdown/types.md)
|
|
41
|
-
- [ui](markdown/ui.md)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## Data & Text
|
|
46
|
-
|
|
47
|
-
- [format](markdown/format.md)
|
|
48
|
-
- [math](markdown/math.md)
|
|
49
|
-
- [objects](markdown/objects.md)
|
|
50
|
-
- [path](markdown/path.md)
|
|
51
|
-
- [sanitize](markdown/sanitize.md)
|
|
52
|
-
- [text](markdown/text.md)
|
|
53
|
-
- [translators](markdown/translators.md)
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Network & Storage
|
|
58
|
-
|
|
59
|
-
- [cookie](markdown/cookie.md)
|
|
60
|
-
- [compress](markdown/compress.md)
|
|
61
|
-
- [fetch](markdown/fetch.md)
|
|
62
|
-
- [net](markdown/net.md)
|
|
63
|
-
- [sse](markdown/sse.md)
|
|
64
|
-
- [sync](markdown/sync.md)
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## Advanced
|
|
69
|
-
|
|
70
|
-
- [avoid](markdown/avoid.md)
|
|
71
|
-
- [biometric](markdown/biometric.md)
|
|
72
|
-
- [credits](markdown/credits.md)
|
|
73
|
-
- [i18n](markdown/i18n.md)
|
|
74
|
-
- [image](markdown/image.md)
|
|
75
|
-
- [logging](markdown/logging.md)
|
|
76
|
-
- [memory](markdown/memory.md)
|
|
77
|
-
- [promise](markdown/promise.md)
|
|
78
|
-
- [shortcut](markdown/shortcut.md)
|
|
79
|
-
- [system](markdown/system.md)
|
|
80
|
-
- [terminal](markdown/terminal.md)
|
|
81
|
-
- [timer](markdown/timer.md)
|
|
82
|
-
- [triggers](markdown/triggers.md)
|
|
83
|
-
- [worker](markdown/worker.md)
|
|
1
|
+
# Table of Contents
|
|
2
|
+
|
|
3
|
+
- [dpHelper](../README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Core Tools
|
|
8
|
+
|
|
9
|
+
- [ai](markdown/ai.md)
|
|
10
|
+
- [array](markdown/array.md)
|
|
11
|
+
- [browser](markdown/browser.md)
|
|
12
|
+
- [check](markdown/check.md)
|
|
13
|
+
- [date](markdown/date.md)
|
|
14
|
+
- [form](markdown/form.md)
|
|
15
|
+
- [json](markdown/json.md)
|
|
16
|
+
- [load](markdown/load.md)
|
|
17
|
+
- [navigation](markdown/navigation.md)
|
|
18
|
+
- [security](markdown/security.md)
|
|
19
|
+
- [socket](markdown/socket.md)
|
|
20
|
+
- [svg](markdown/svg.md)
|
|
21
|
+
- [markdown](markdown/markdown.md)
|
|
22
|
+
- [window](markdown/window.md)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## UI & DOM
|
|
27
|
+
|
|
28
|
+
- [anchor](markdown/anchor.md)
|
|
29
|
+
- [audio](markdown/audio.md)
|
|
30
|
+
- [color](markdown/color.md)
|
|
31
|
+
- [coords](markdown/coords.md)
|
|
32
|
+
- [disable](markdown/disable.md)
|
|
33
|
+
- [dispatch](markdown/dispatch.md)
|
|
34
|
+
- [element](markdown/element.md)
|
|
35
|
+
- [event](markdown/event.md)
|
|
36
|
+
- [scrollbar](markdown/scrollbar.md)
|
|
37
|
+
- [screen](markdown/screen.md)
|
|
38
|
+
- [trigger](markdown/trigger.md)
|
|
39
|
+
- [type](markdown/type.md)
|
|
40
|
+
- [types](markdown/types.md)
|
|
41
|
+
- [ui](markdown/ui.md)
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Data & Text
|
|
46
|
+
|
|
47
|
+
- [format](markdown/format.md)
|
|
48
|
+
- [math](markdown/math.md)
|
|
49
|
+
- [objects](markdown/objects.md)
|
|
50
|
+
- [path](markdown/path.md)
|
|
51
|
+
- [sanitize](markdown/sanitize.md)
|
|
52
|
+
- [text](markdown/text.md)
|
|
53
|
+
- [translators](markdown/translators.md)
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Network & Storage
|
|
58
|
+
|
|
59
|
+
- [cookie](markdown/cookie.md)
|
|
60
|
+
- [compress](markdown/compress.md)
|
|
61
|
+
- [fetch](markdown/fetch.md)
|
|
62
|
+
- [net](markdown/net.md)
|
|
63
|
+
- [sse](markdown/sse.md)
|
|
64
|
+
- [sync](markdown/sync.md)
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Advanced
|
|
69
|
+
|
|
70
|
+
- [avoid](markdown/avoid.md)
|
|
71
|
+
- [biometric](markdown/biometric.md)
|
|
72
|
+
- [credits](markdown/credits.md)
|
|
73
|
+
- [i18n](markdown/i18n.md)
|
|
74
|
+
- [image](markdown/image.md)
|
|
75
|
+
- [logging](markdown/logging.md)
|
|
76
|
+
- [memory](markdown/memory.md)
|
|
77
|
+
- [promise](markdown/promise.md)
|
|
78
|
+
- [shortcut](markdown/shortcut.md)
|
|
79
|
+
- [system](markdown/system.md)
|
|
80
|
+
- [terminal](markdown/terminal.md)
|
|
81
|
+
- [timer](markdown/timer.md)
|
|
82
|
+
- [triggers](markdown/triggers.md)
|
|
83
|
+
- [worker](markdown/worker.md)
|
package/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var V={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var x={codeName:"dphelper",version:"4.6.
|
|
1
|
+
'use strict';var V={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var x={codeName:"dphelper",version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...V},configurable:true,writable:true},version:{value:x.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var P=dphelper;Object.defineProperty(P,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(P,"setDescription",{value:(e,t)=>{Object.defineProperties(P,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(P[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),P.setProps(P,e,{writable:false,configurable:false,enumerable:false}),P._list.scripts.push(e);}});var ue={name:"ai",active:true,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:true,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},B=e=>e===null||typeof e!="object",H=e=>e===null?"null":typeof e=="string"?e.includes(",")||e.includes(":")||e.includes('"')||e.includes(`
|
|
2
2
|
`)||e.trim()!==e?`"${e.replace(/"/g,'\\"')}"`:e||'""':String(e),N=(e,t=0)=>{let r=" ".repeat(t);if(B(e))return H(e);if(Array.isArray(e)){if(e.length===0)return "[0]:";let n=e[0];if(!B(n)&&!Array.isArray(n)){let o=Object.keys(n),a=`[${e.length}]{${o.join(",")}}:`;for(let i of e){let s=o.map(l=>H(i[l])).join(",");a+=`
|
|
3
3
|
${r} ${s}`;}return a}else return `[${e.length}]: `+e.map(H).join(",")}else return Object.entries(e).map(([n,o])=>{let a=n.includes(" ")||n.includes(":")?`"${n}"`:n;if(!B(o)){let i=N(o,t+1);return i.startsWith("[")?`${a}${i}`:`${a}:
|
|
4
4
|
${r}${i}`}return `${a}: ${H(o)}`}).join(`
|
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/// <reference path="./types/dphelper.d.ts" />
|
|
1
|
+
/// <reference path="./types/dphelper.d.ts" />
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var K={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var C={codeName:"dphelper",version:"4.6.
|
|
1
|
+
var K={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var C={codeName:"dphelper",version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...K},configurable:true,writable:true},version:{value:C.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var k=dphelper;Object.defineProperty(k,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(k,"setDescription",{value:(e,t)=>{Object.defineProperties(k,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(k[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),k.setProps(k,e,{writable:false,configurable:false,enumerable:false}),k._list.scripts.push(e);}});var pe={name:"ai",active:true,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:true,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},W=e=>e===null||typeof e!="object",U=e=>e===null?"null":typeof e=="string"?e.includes(",")||e.includes(":")||e.includes('"')||e.includes(`
|
|
2
2
|
`)||e.trim()!==e?`"${e.replace(/"/g,'\\"')}"`:e||'""':String(e),$=(e,t=0)=>{let r=" ".repeat(t);if(W(e))return U(e);if(Array.isArray(e)){if(e.length===0)return "[0]:";let n=e[0];if(!W(n)&&!Array.isArray(n)){let o=Object.keys(n),a=`[${e.length}]{${o.join(",")}}:`;for(let i of e){let s=o.map(l=>U(i[l])).join(",");a+=`
|
|
3
3
|
${r} ${s}`;}return a}else return `[${e.length}]: `+e.map(U).join(",")}else return Object.entries(e).map(([n,o])=>{let a=n.includes(" ")||n.includes(":")?`"${n}"`:n;if(!W(o)){let i=$(o,t+1);return i.startsWith("[")?`${a}${i}`:`${a}:
|
|
4
4
|
${r}${i}`}return `${a}: ${U(o)}`}).join(`
|
package/llms.txt
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
# dphelper
|
|
2
|
-
|
|
3
|
-
> [!IMPORTANT]
|
|
4
|
-
> **ARCHITECTURAL CHANGE:** State management has been COMPLETELY REMOVED from the `dphelper` library.
|
|
5
|
-
> Application state is now handled exclusively through dedicated external managers: **Memorio** (for simple global state) or **Argis RGS** (for enterprise-level state).
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## About dphelper
|
|
10
|
-
|
|
11
|
-
`dphelper` is a powerful, **zero-dependency, stateless utility library** that packs 303 production-ready tools for modern web developers, AI engineers, and DevTools creators. It is fully isomorphic, running flawlessly across the Browser, Node.js, Bun, and Deno with a tiny minified footprint of ~171KB.
|
|
12
|
-
|
|
13
|
-
### ⚡ Key Capabilities
|
|
14
|
-
* **AI-First Engineering:** Built-in support for the modern LLM stack, featuring **TOON optimization** (the efficient JSON alternative for prompts), context-aware token counting, smart RAG-ready chunking, and deep reasoning extraction (supporting architectures like DeepSeek and OpenAI o1/o3).
|
|
15
|
-
* **Modern Web Primitives:** Sophisticated wrappers for Web Workers (including worker pool orchestration and multi-tab SharedWorkers), full IndexedDB query builders, and native client-side compression (Gzip/Deflate/LZW).
|
|
16
|
-
* **Cross-Tab Intelligence:** Desktop-grade synchronization without a backend, powered by `dphelper.sync.pulse` cross-tab event buses and active browser tab interlocks.
|
|
17
|
-
* **Biometric Authentication:** Built-in async WebAuthn primitives for effortless fingerprint and facial recognition integrations.
|
|
18
|
-
* **Enterprise Security:** NIST SP 800-53 and NSA CNSA compliant, utilizing AES-256-GCM and strict OWASP-aligned PBKDF2 with 310,000 iterations.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Quick Usage Syntax
|
|
23
|
-
|
|
24
|
-
`dphelper` maps its modules globally. Import it **exactly once** at your application's absolute entry point (e.g., `index.js`, `main.ts`, or `App.tsx`):
|
|
25
|
-
|
|
26
|
-
```javascript
|
|
27
|
-
import "dphelper";
|
|
28
|
-
|
|
29
|
-
### 🧬 The Core Architectural Ecosystem
|
|
30
|
-
|
|
31
|
-
`dphelper` operates as a completely stateless, high-performance toolkit. To ensure clean separation of concerns and prevent race conditions or state contamination across asynchronous modules, state management has been extracted into dedicated standalone libraries.
|
|
32
|
-
|
|
33
|
-
Always map your application architecture according to the following layout:
|
|
34
|
-
|
|
35
|
-
| Layer & Purpose | Package | Operational Target | Design Philosophy |
|
|
36
|
-
| :--- | :--- | :--- | :--- |
|
|
37
|
-
| **Stateless Utilities & AI Tools** | `dphelper` | Isomorphic (Browser, Node.js, Bun, Deno) | **Zero-Dependency Universal Core.** Packs 303 production-ready modules including `ai` (TOON optimization, smart chunking), `worker` multi-threaded pools, `biometric` WebAuthn, `i18n`, desktop-grade cross-tab `sync.pulse`, and NIST-compliant cryptography. |
|
|
38
|
-
| **Simple Global State** | `memorio` | Application-Wide Runtime | **Global Singleton Pattern.** High-performance, lightweight state management that eliminates boilerplate. It registers globally upon initial import and removes the need for custom context providers, actions, or dispatch files. |
|
|
39
|
-
| **Enterprise State Architecture** | `Argis RGS` | Distributed / Complex SaaS Systems | **Heavy-Duty Reactive Structure.** Built for multi-module, enterprise-grade applications requiring strict state rules, relational data synchronization, and heavy concurrent data pipelines. |
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
### ⚠️ Integration Best Practices for AI & Humans
|
|
44
|
-
|
|
45
|
-
1. **Do Not Bundle State Logic in dphelper:** Any legacy codebase referencing `dphelper.store` or namespace getters/setters must be migrated to `memorio` or `Argis RGS`.
|
|
46
|
-
2. **Single-Entry Side Effect:** `dphelper` is designed to be imported exactly once in your root file (`import "dphelper";`). It will automatically map its 303 tools safely to the global scope.
|
|
47
|
-
3. **State Integrity:** When building micro-frontends or multi-tab web applications, use `dphelper.sync` primitives to handle cross-tab events, while allowing `memorio` to manage the underlying atomic state memory.
|
|
48
|
-
|
|
49
|
-
// dphelper attaches to the global scope and is ready across your entire project
|
|
50
|
-
console.debug(dphelper.version);
|
|
51
|
-
|
|
52
|
-
// 🤖 AI Stack Snapshot & TOON Optimization
|
|
53
|
-
const appStateToon = dphelper.ai.snapshot();
|
|
54
|
-
const textChunks = dphelper.ai.chunker(longText, { size: 1000, overlap: 200 });
|
|
55
|
-
const { reasoning, content } = dphelper.ai.extractReasoning(rawAiReply);
|
|
56
|
-
|
|
57
|
-
// ⚙️ Multi-Threaded Worker Pools
|
|
58
|
-
const pool = dphelper.worker.pool('worker.js', 4);
|
|
59
|
-
const results = await dphelper.worker.poolExec(pool, [1, 2, 3, 4]);
|
|
60
|
-
|
|
61
|
-
// 💓 Real-Time Cross-Tab Sync (No Backend Required)
|
|
62
|
-
const bus = dphelper.sync.pulse('my-app', (msg) => console.log(msg));
|
|
63
|
-
bus.emit({ action: 'theme-change', value: 'dark' });
|
|
64
|
-
|
|
65
|
-
// 🌍 Full i18n Internationalization Suite
|
|
66
|
-
dphelper.i18n.setLocale('it');
|
|
67
|
-
dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' });
|
|
68
|
-
|
|
69
|
-
## DEVELOPMENT ENVIRONMENT GUIDELINES:
|
|
70
|
-
- We are using dphelper (Stateless Core). Never generate code using 'dphelper.store'.
|
|
71
|
-
- Global state must be managed exclusively via 'memorio' (lightweight) or 'Argis RGS' (enterprise).
|
|
72
|
-
- dphelper is initialized as a global side-effect: 'import "dphelper";' in the root file. Do not generate inline imports for it in sub-modules.
|
|
73
|
-
- For cross-tab/micro-frontend synchronization, use 'dphelper.sync.pulse' for events, but delegate data persistence to memorio.
|
|
1
|
+
# dphelper
|
|
2
|
+
|
|
3
|
+
> [!IMPORTANT]
|
|
4
|
+
> **ARCHITECTURAL CHANGE:** State management has been COMPLETELY REMOVED from the `dphelper` library.
|
|
5
|
+
> Application state is now handled exclusively through dedicated external managers: **Memorio** (for simple global state) or **Argis RGS** (for enterprise-level state).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## About dphelper
|
|
10
|
+
|
|
11
|
+
`dphelper` is a powerful, **zero-dependency, stateless utility library** that packs 303 production-ready tools for modern web developers, AI engineers, and DevTools creators. It is fully isomorphic, running flawlessly across the Browser, Node.js, Bun, and Deno with a tiny minified footprint of ~171KB.
|
|
12
|
+
|
|
13
|
+
### ⚡ Key Capabilities
|
|
14
|
+
* **AI-First Engineering:** Built-in support for the modern LLM stack, featuring **TOON optimization** (the efficient JSON alternative for prompts), context-aware token counting, smart RAG-ready chunking, and deep reasoning extraction (supporting architectures like DeepSeek and OpenAI o1/o3).
|
|
15
|
+
* **Modern Web Primitives:** Sophisticated wrappers for Web Workers (including worker pool orchestration and multi-tab SharedWorkers), full IndexedDB query builders, and native client-side compression (Gzip/Deflate/LZW).
|
|
16
|
+
* **Cross-Tab Intelligence:** Desktop-grade synchronization without a backend, powered by `dphelper.sync.pulse` cross-tab event buses and active browser tab interlocks.
|
|
17
|
+
* **Biometric Authentication:** Built-in async WebAuthn primitives for effortless fingerprint and facial recognition integrations.
|
|
18
|
+
* **Enterprise Security:** NIST SP 800-53 and NSA CNSA compliant, utilizing AES-256-GCM and strict OWASP-aligned PBKDF2 with 310,000 iterations.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Quick Usage Syntax
|
|
23
|
+
|
|
24
|
+
`dphelper` maps its modules globally. Import it **exactly once** at your application's absolute entry point (e.g., `index.js`, `main.ts`, or `App.tsx`):
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
import "dphelper";
|
|
28
|
+
|
|
29
|
+
### 🧬 The Core Architectural Ecosystem
|
|
30
|
+
|
|
31
|
+
`dphelper` operates as a completely stateless, high-performance toolkit. To ensure clean separation of concerns and prevent race conditions or state contamination across asynchronous modules, state management has been extracted into dedicated standalone libraries.
|
|
32
|
+
|
|
33
|
+
Always map your application architecture according to the following layout:
|
|
34
|
+
|
|
35
|
+
| Layer & Purpose | Package | Operational Target | Design Philosophy |
|
|
36
|
+
| :--- | :--- | :--- | :--- |
|
|
37
|
+
| **Stateless Utilities & AI Tools** | `dphelper` | Isomorphic (Browser, Node.js, Bun, Deno) | **Zero-Dependency Universal Core.** Packs 303 production-ready modules including `ai` (TOON optimization, smart chunking), `worker` multi-threaded pools, `biometric` WebAuthn, `i18n`, desktop-grade cross-tab `sync.pulse`, and NIST-compliant cryptography. |
|
|
38
|
+
| **Simple Global State** | `memorio` | Application-Wide Runtime | **Global Singleton Pattern.** High-performance, lightweight state management that eliminates boilerplate. It registers globally upon initial import and removes the need for custom context providers, actions, or dispatch files. |
|
|
39
|
+
| **Enterprise State Architecture** | `Argis RGS` | Distributed / Complex SaaS Systems | **Heavy-Duty Reactive Structure.** Built for multi-module, enterprise-grade applications requiring strict state rules, relational data synchronization, and heavy concurrent data pipelines. |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### ⚠️ Integration Best Practices for AI & Humans
|
|
44
|
+
|
|
45
|
+
1. **Do Not Bundle State Logic in dphelper:** Any legacy codebase referencing `dphelper.store` or namespace getters/setters must be migrated to `memorio` or `Argis RGS`.
|
|
46
|
+
2. **Single-Entry Side Effect:** `dphelper` is designed to be imported exactly once in your root file (`import "dphelper";`). It will automatically map its 303 tools safely to the global scope.
|
|
47
|
+
3. **State Integrity:** When building micro-frontends or multi-tab web applications, use `dphelper.sync` primitives to handle cross-tab events, while allowing `memorio` to manage the underlying atomic state memory.
|
|
48
|
+
|
|
49
|
+
// dphelper attaches to the global scope and is ready across your entire project
|
|
50
|
+
console.debug(dphelper.version);
|
|
51
|
+
|
|
52
|
+
// 🤖 AI Stack Snapshot & TOON Optimization
|
|
53
|
+
const appStateToon = dphelper.ai.snapshot();
|
|
54
|
+
const textChunks = dphelper.ai.chunker(longText, { size: 1000, overlap: 200 });
|
|
55
|
+
const { reasoning, content } = dphelper.ai.extractReasoning(rawAiReply);
|
|
56
|
+
|
|
57
|
+
// ⚙️ Multi-Threaded Worker Pools
|
|
58
|
+
const pool = dphelper.worker.pool('worker.js', 4);
|
|
59
|
+
const results = await dphelper.worker.poolExec(pool, [1, 2, 3, 4]);
|
|
60
|
+
|
|
61
|
+
// 💓 Real-Time Cross-Tab Sync (No Backend Required)
|
|
62
|
+
const bus = dphelper.sync.pulse('my-app', (msg) => console.log(msg));
|
|
63
|
+
bus.emit({ action: 'theme-change', value: 'dark' });
|
|
64
|
+
|
|
65
|
+
// 🌍 Full i18n Internationalization Suite
|
|
66
|
+
dphelper.i18n.setLocale('it');
|
|
67
|
+
dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' });
|
|
68
|
+
|
|
69
|
+
## DEVELOPMENT ENVIRONMENT GUIDELINES:
|
|
70
|
+
- We are using dphelper (Stateless Core). Never generate code using 'dphelper.store'.
|
|
71
|
+
- Global state must be managed exclusively via 'memorio' (lightweight) or 'Argis RGS' (enterprise).
|
|
72
|
+
- dphelper is initialized as a global side-effect: 'import "dphelper";' in the root file. Do not generate inline imports for it in sub-modules.
|
|
73
|
+
- For cross-tab/micro-frontend synchronization, use 'dphelper.sync.pulse' for events, but delegate data persistence to memorio.
|
package/modules/ai.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var P={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var v={version:"4.6.
|
|
1
|
+
'use strict';var P={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var v={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...P},configurable:true,writable:true},version:{value:v.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var f=dphelper;Object.defineProperty(f,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(f,"setDescription",{value:(e,t)=>{Object.defineProperties(f,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(f[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),f.setProps(f,e,{writable:false,configurable:false,enumerable:false}),f._list.scripts.push(e);}});var M={name:"ai",active:true,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:true,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},x=e=>e===null||typeof e!="object",O=e=>e===null?"null":typeof e=="string"?e.includes(",")||e.includes(":")||e.includes('"')||e.includes(`
|
|
2
2
|
`)||e.trim()!==e?`"${e.replace(/"/g,'\\"')}"`:e||'""':String(e),b=(e,t=0)=>{let r=" ".repeat(t);if(x(e))return O(e);if(Array.isArray(e)){if(e.length===0)return "[0]:";let n=e[0];if(!x(n)&&!Array.isArray(n)){let s=Object.keys(n),o=`[${e.length}]{${s.join(",")}}:`;for(let i of e){let u=s.map(a=>O(i[a])).join(",");o+=`
|
|
3
3
|
${r} ${u}`;}return o}else return `[${e.length}]: `+e.map(O).join(",")}else return Object.entries(e).map(([n,s])=>{let o=n.includes(" ")||n.includes(":")?`"${n}"`:n;if(!x(s)){let i=b(s,t+1);return i.startsWith("[")?`${o}${i}`:`${o}:
|
|
4
4
|
${r}${i}`}return `${o}: ${O(s)}`}).join(`
|
package/modules/ai.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/// <reference path="../types/dphelper.d.ts" />
|
|
2
|
-
export interface AiTool {
|
|
3
|
-
tokenCount: (data: any) => number
|
|
4
|
-
smartSanitize: (text: string) => string
|
|
5
|
-
toon: (data: any) => string
|
|
6
|
-
toonToJson: (toon: string) => any
|
|
7
|
-
chunker: (text: string, options?: { size?: number, overlap?: number }) => string[]
|
|
8
|
-
similarity: (a: number[], b: number[]) => number
|
|
9
|
-
extractReasoning: (text: string) => { reasoning: string, content: string }
|
|
10
|
-
prompt: (template: string, vars: Record<string, any>) => string
|
|
11
|
-
schema: (data: any) => string
|
|
12
|
-
snapshot: () => string
|
|
2
|
+
export interface AiTool {
|
|
3
|
+
tokenCount: (data: any) => number
|
|
4
|
+
smartSanitize: (text: string) => string
|
|
5
|
+
toon: (data: any) => string
|
|
6
|
+
toonToJson: (toon: string) => any
|
|
7
|
+
chunker: (text: string, options?: { size?: number, overlap?: number }) => string[]
|
|
8
|
+
similarity: (a: number[], b: number[]) => number
|
|
9
|
+
extractReasoning: (text: string) => { reasoning: string, content: string }
|
|
10
|
+
prompt: (template: string, vars: Record<string, any>) => string
|
|
11
|
+
schema: (data: any) => string
|
|
12
|
+
snapshot: () => string
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const ai: AiTool
|
package/modules/ai.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var v={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var $={version:"4.6.
|
|
1
|
+
var v={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var $={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...v},configurable:true,writable:true},version:{value:$.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var f=dphelper;Object.defineProperty(f,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(f,"setDescription",{value:(e,t)=>{Object.defineProperties(f,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(f[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),f.setProps(f,e,{writable:false,configurable:false,enumerable:false}),f._list.scripts.push(e);}});var N={name:"ai",active:true,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:true,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},A=e=>e===null||typeof e!="object",O=e=>e===null?"null":typeof e=="string"?e.includes(",")||e.includes(":")||e.includes('"')||e.includes(`
|
|
2
2
|
`)||e.trim()!==e?`"${e.replace(/"/g,'\\"')}"`:e||'""':String(e),b=(e,t=0)=>{let r=" ".repeat(t);if(A(e))return O(e);if(Array.isArray(e)){if(e.length===0)return "[0]:";let n=e[0];if(!A(n)&&!Array.isArray(n)){let s=Object.keys(n),o=`[${e.length}]{${s.join(",")}}:`;for(let i of e){let u=s.map(a=>O(i[a])).join(",");o+=`
|
|
3
3
|
${r} ${u}`;}return o}else return `[${e.length}]: `+e.map(O).join(",")}else return Object.entries(e).map(([n,s])=>{let o=n.includes(" ")||n.includes(":")?`"${n}"`:n;if(!A(s)){let i=b(s,t+1);return i.startsWith("[")?`${o}${i}`:`${o}:
|
|
4
4
|
${r}${i}`}return `${o}: ${O(s)}`}).join(`
|
package/modules/anchor.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var p={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var c={version:"4.6.
|
|
1
|
+
'use strict';var p={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var c={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...p},configurable:true,writable:true},version:{value:c.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var r=dphelper;Object.defineProperty(r,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(r[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var b={name:"anchor",active:true,subCommand:[{name:"toOnClick",type:"function",version:"0.0.2",example:"dphelper.anchor.toOnClick([element, 'foo' | '.foo' | '#foo'])",description:`This tool allows you to convert all links in an element to 'onclick'.
|
|
2
2
|
It allows you to avoid the message with the path relative to the requested address
|
|
3
3
|
and it is very useful when you work with SPA but you want to keep even older browsers.`,author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:true,env:"client",subCommand:[]}]},d={toOnClick:e=>{let t=document.querySelector(e);if(!t)return;t.querySelectorAll("a").forEach(o=>{let l=o.getAttribute("href");if(!l)return;o.style.cursor="pointer";let n=dphelper.pathRail()?.[3]?.replace(/\//g,"")||"";n&&o.classList.add(n);let s=o.cloneNode(true);o.parentNode?.replaceChild(s,o),s.removeAttribute("href"),s.addEventListener("mouseup",u=>{l.startsWith("/")?(history.pushState({href:l},"",l),dphelper.navigation.load(l),u.stopPropagation()):dphelper.browser.href(l);});});}};dphelper?.setDescription(b,d);var A=dphelper.anchor;
|
|
4
4
|
exports.anchor=A;
|
package/modules/anchor.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference path="../types/dphelper.d.ts" />
|
|
2
|
-
export interface AnchorTool {
|
|
3
|
-
/**
|
|
4
|
-
* Converts anchor tags to onClick events
|
|
5
|
-
* @param selector - CSS selector for target elements
|
|
6
|
-
*/
|
|
7
|
-
toOnClick(selector: string): void
|
|
2
|
+
export interface AnchorTool {
|
|
3
|
+
/**
|
|
4
|
+
* Converts anchor tags to onClick events
|
|
5
|
+
* @param selector - CSS selector for target elements
|
|
6
|
+
*/
|
|
7
|
+
toOnClick(selector: string): void
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const anchor: AnchorTool
|
package/modules/anchor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var u={version:"4.6.
|
|
1
|
+
var c={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var u={version:"4.6.1"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...c},configurable:true,writable:true},version:{value:u.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var r=dphelper;Object.defineProperty(r,"setProps",{value:(e,t,a)=>{Object.defineProperty(e,t.name,a||{writable:false,configurable:false,enumerable:false}),a?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(r,"setDescription",{value:(e,t)=>{Object.defineProperties(r,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(a=>(Object.defineProperties(r[e.name],{[a]:{writable:false,configurable:false,enumerable:false}}),null)),r.setProps(r,e,{writable:false,configurable:false,enumerable:false}),r._list.scripts.push(e);}});var d={name:"anchor",active:true,subCommand:[{name:"toOnClick",type:"function",version:"0.0.2",example:"dphelper.anchor.toOnClick([element, 'foo' | '.foo' | '#foo'])",description:`This tool allows you to convert all links in an element to 'onclick'.
|
|
2
2
|
It allows you to avoid the message with the path relative to the requested address
|
|
3
3
|
and it is very useful when you work with SPA but you want to keep even older browsers.`,author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:true,env:"client",subCommand:[]}]},m={toOnClick:e=>{let t=document.querySelector(e);if(!t)return;t.querySelectorAll("a").forEach(o=>{let l=o.getAttribute("href");if(!l)return;o.style.cursor="pointer";let p=dphelper.pathRail()?.[3]?.replace(/\//g,"")||"";p&&o.classList.add(p);let s=o.cloneNode(true);o.parentNode?.replaceChild(s,o),s.removeAttribute("href"),s.addEventListener("mouseup",h=>{l.startsWith("/")?(history.pushState({href:l},"",l),dphelper.navigation.load(l),h.stopPropagation()):dphelper.browser.href(l);});});}};dphelper?.setDescription(d,m);var D=dphelper.anchor;
|
|
4
4
|
export{D as anchor};
|